diff --git a/BUILD.gn b/BUILD.gn
index 5384e51..47845cf3 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -240,6 +240,7 @@
     deps += [
       "//ash:ash_shell_with_content",
       "//ash:ash_unittests",
+      "//ui/app_list/shower:app_list_shower_unittests",
       "//ui/aura:aura_unittests",
       "//ui/aura:demo",
       "//ui/wm:wm_unittests",
diff --git a/DEPS b/DEPS
index 3de58a4..0f8845b9 100644
--- a/DEPS
+++ b/DEPS
@@ -39,7 +39,7 @@
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling Skia
   # and whatever else without interference from each other.
-  'skia_revision': 'c416912da4840af0c49bd8cdcf00044ed39500f6',
+  'skia_revision': '758586c7f11a6b3529bd4a1c9b4e982a0d0b0582',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling V8
   # and whatever else without interference from each other.
@@ -67,7 +67,7 @@
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling BoringSSL
   # and whatever else without interference from each other.
-  'boringssl_revision': 'feaa57d13daa0b5bf3c068ce18d24870d50bfae9',
+  'boringssl_revision': 'd44a9431112d37430b3a686bbf4fb6211be69848',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling nss
   # and whatever else without interference from each other.
@@ -100,7 +100,7 @@
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling catapult
   # and whatever else without interference from each other.
-  'catapult_revision': 'dc924aae80a2ae72acfff1472baac64fbc64b7df',
+  'catapult_revision': '1224db2960f728efd09e327b3351dd2a690aae41',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling libFuzzer
   # and whatever else without interference from each other.
@@ -184,7 +184,7 @@
     Var('chromium_git') + '/external/bidichecker/lib.git' + '@' + '97f2aa645b74c28c57eca56992235c79850fa9e0',
 
   'src/third_party/webgl/src':
-   Var('chromium_git') + '/external/khronosgroup/webgl.git' + '@' + '863cabbe53447cd4e131ee5bf1979bfe9dcf3016',
+   Var('chromium_git') + '/external/khronosgroup/webgl.git' + '@' + '8b636f38a19fa416217ae9882cf8e199f22e44d5',
 
   'src/third_party/webdriver/pylib':
     Var('chromium_git') + '/external/selenium/py.git' + '@' + '5fd78261a75fe08d27ca4835fb6c5ce4b42275bd',
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 51ae552e..7d32ad53 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -2057,7 +2057,6 @@
   # Potentially ambiguous bot names are listed explicitly.
   master_map = {
       'chromium_presubmit': 'tryserver.chromium.linux',
-      'blink_presubmit': 'tryserver.chromium.linux',
       'tools_build_presubmit': 'tryserver.chromium.linux',
   }
   master = master_map.get(bot)
diff --git a/PRESUBMIT_test.py b/PRESUBMIT_test.py
index d2eb524..a8a3c27a 100755
--- a/PRESUBMIT_test.py
+++ b/PRESUBMIT_test.py
@@ -738,7 +738,6 @@
             'android_x86_dbg',
             'blink_android_compile_dbg',
             'blink_android_compile_rel',
-            'blink_presubmit',
             'chromium_presubmit',
             'linux_arm_cross_compile',
             'linux_arm_tester',
diff --git a/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromium.java b/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromium.java
index eea404c..c5a1f3d 100644
--- a/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromium.java
+++ b/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromium.java
@@ -234,11 +234,13 @@
         final boolean isAccessFromFileURLsGrantedByDefault =
                 mAppTargetSdkVersion < Build.VERSION_CODES.JELLY_BEAN;
         final boolean areLegacyQuirksEnabled = mAppTargetSdkVersion < Build.VERSION_CODES.KITKAT;
+        final boolean allowEmptyDocumentPersistence = mAppTargetSdkVersion <= Build.VERSION_CODES.M;
 
         mContentsClientAdapter =
                 new WebViewContentsClientAdapter(mWebView, mContext, mFactory.getWebViewDelegate());
-        mWebSettings = new ContentSettingsAdapter(new AwSettings(
-                mContext, isAccessFromFileURLsGrantedByDefault, areLegacyQuirksEnabled));
+        mWebSettings = new ContentSettingsAdapter(
+                new AwSettings(mContext, isAccessFromFileURLsGrantedByDefault,
+                        areLegacyQuirksEnabled, allowEmptyDocumentPersistence));
 
         if (mAppTargetSdkVersion < Build.VERSION_CODES.LOLLIPOP) {
             // Prior to Lollipop we always allowed third party cookies and mixed content.
diff --git a/android_webview/java/src/org/chromium/android_webview/AwSettings.java b/android_webview/java/src/org/chromium/android_webview/AwSettings.java
index bf7d241..a7f1afd 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwSettings.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwSettings.java
@@ -96,6 +96,7 @@
     private boolean mAcceptThirdPartyCookies = false;
 
     private final boolean mSupportLegacyQuirks;
+    private final boolean mAllowEmptyDocumentPersistence;
 
     private final boolean mPasswordEchoEnabled;
 
@@ -208,7 +209,8 @@
 
     public AwSettings(Context context,
             boolean isAccessFromFileURLsGrantedByDefault,
-            boolean supportsLegacyQuirks) {
+            boolean supportsLegacyQuirks,
+            boolean allowEmptyDocumentPersistence) {
         boolean hasInternetPermission = context.checkPermission(
                 android.Manifest.permission.INTERNET,
                 Process.myPid(),
@@ -237,6 +239,7 @@
             mTextSizePercent *= context.getResources().getConfiguration().fontScale;
 
             mSupportLegacyQuirks = supportsLegacyQuirks;
+            mAllowEmptyDocumentPersistence = allowEmptyDocumentPersistence;
         }
         // Defer initializing the native side until a native WebContents instance is set.
     }
@@ -1246,6 +1249,12 @@
         return mSupportLegacyQuirks;
     }
 
+    @CalledByNative
+    private boolean getAllowEmptyDocumentPersistenceLocked() {
+        assert Thread.holdsLock(mAwSettingsLock);
+        return mAllowEmptyDocumentPersistence;
+    }
+
     /**
      * See {@link android.webkit.WebSettings#setUseWideViewPort}.
      */
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java
index ffcd210b..fa5c110 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java
@@ -27,6 +27,7 @@
 import org.chromium.android_webview.AwWebResourceResponse;
 import org.chromium.android_webview.test.util.CommonResources;
 import org.chromium.android_webview.test.util.ImagePageGenerator;
+import org.chromium.android_webview.test.util.JSUtils;
 import org.chromium.android_webview.test.util.VideoTestUtil;
 import org.chromium.android_webview.test.util.VideoTestWebServer;
 import org.chromium.base.test.util.DisabledTest;
@@ -2873,6 +2874,66 @@
         }
     }
 
+    private TestDependencyFactory mOverridenFactory;
+
+    @Override
+    public void tearDown() throws Exception {
+        mOverridenFactory = null;
+        super.tearDown();
+    }
+
+    @Override
+    protected TestDependencyFactory createTestDependencyFactory() {
+        if (mOverridenFactory == null) {
+            return new TestDependencyFactory();
+        } else {
+            return mOverridenFactory;
+        }
+    }
+
+    private static class EmptyDocumentPeristenceTestDependencyFactory
+            extends TestDependencyFactory {
+        private boolean mAllow;
+        public EmptyDocumentPeristenceTestDependencyFactory(boolean allow) {
+            mAllow = allow;
+        }
+
+        @Override
+        public AwSettings createAwSettings(Context context, boolean supportsLegacyQuirks) {
+            return new AwSettings(context, false /* isAccessFromFileURLsGrantedByDefault */,
+                    supportsLegacyQuirks, mAllow);
+        }
+    }
+
+    private void doAllowEmptyDocumentPersistenceTest(boolean allow) throws Throwable {
+        mOverridenFactory = new EmptyDocumentPeristenceTestDependencyFactory(allow);
+
+        final TestAwContentsClient client = new TestAwContentsClient();
+        final AwTestContainerView mContainerView = createAwTestContainerViewOnMainSync(client);
+        final AwContents awContents = mContainerView.getAwContents();
+        enableJavaScriptOnUiThread(awContents);
+        JSUtils.executeJavaScriptAndWaitForResult(this, awContents,
+                client.getOnEvaluateJavaScriptResultHelper(),
+                "window.emptyDocumentPersistenceTest = true;");
+        loadUrlSync(awContents, client.getOnPageFinishedHelper(), "about:blank");
+        String result = JSUtils.executeJavaScriptAndWaitForResult(this, awContents,
+                client.getOnEvaluateJavaScriptResultHelper(),
+                "window.emptyDocumentPersistenceTest ? 'set' : 'not set';");
+        assertEquals(allow ? "\"set\"" : "\"not set\"", result);
+    }
+
+    @SmallTest
+    @Feature({"AndroidWebView", "Preferences"})
+    public void testAllowEmptyDocumentPersistence() throws Throwable {
+        doAllowEmptyDocumentPersistenceTest(true);
+    }
+
+    @SmallTest
+    @Feature({"AndroidWebView", "Preferences"})
+    public void testDisallowEmptyDocumentPersistence() throws Throwable {
+        doAllowEmptyDocumentPersistenceTest(false);
+    }
+
     static class ViewPair {
         private final AwTestContainerView mContainer0;
         private final TestAwContentsClient mClient0;
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java
index 00352faf..d432226 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java
@@ -381,7 +381,8 @@
             return new AwTestContainerView(activity, allowHardwareAcceleration);
         }
         public AwSettings createAwSettings(Context context, boolean supportsLegacyQuirks) {
-            return new AwSettings(context, false, supportsLegacyQuirks);
+            return new AwSettings(context, false /* isAccessFromFileURLsGrantedByDefault */,
+                    supportsLegacyQuirks, false /* allowEmptyDocumentPersistence */);
         }
     }
 
diff --git a/android_webview/native/aw_settings.cc b/android_webview/native/aw_settings.cc
index 3ba4ac5..acd5356d 100644
--- a/android_webview/native/aw_settings.cc
+++ b/android_webview/native/aw_settings.cc
@@ -400,6 +400,9 @@
   web_prefs->ignore_main_frame_overflow_hidden_quirk = support_quirks;
   web_prefs->report_screen_size_in_physical_pixels_quirk = support_quirks;
 
+  web_prefs->resue_global_for_unowned_main_frame =
+      Java_AwSettings_getAllowEmptyDocumentPersistenceLocked(env, obj);
+
   web_prefs->password_echo_enabled =
       Java_AwSettings_getPasswordEchoEnabledLocked(env, obj);
   web_prefs->spatial_navigation_enabled =
diff --git a/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellActivity.java b/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellActivity.java
index deb0ccb..e3ddc60 100644
--- a/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellActivity.java
+++ b/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellActivity.java
@@ -183,8 +183,9 @@
         if (mBrowserContext == null) {
             mBrowserContext = new AwBrowserContext(sharedPreferences, getApplicationContext());
         }
-        final AwSettings awSettings = new AwSettings(this /*context*/,
-                false /*isAccessFromFileURLsGrantedByDefault*/, false /*supportsLegacyQuirks*/);
+        final AwSettings awSettings = new AwSettings(this /* context */,
+                false /* isAccessFromFileURLsGrantedByDefault */, false /* supportsLegacyQuirks */,
+                false /* allowEmptyDocumentPersistence */);
         // Required for WebGL conformance tests.
         awSettings.setMediaPlaybackRequiresUserGesture(false);
         // Allow zoom and fit contents to screen
diff --git a/base/android/build_info.cc b/base/android/build_info.cc
index 2d3ef278..5fa6c6c 100644
--- a/base/android/build_info.cc
+++ b/base/android/build_info.cc
@@ -16,8 +16,15 @@
 
 namespace {
 
-// The caller takes ownership of the returned const char*.
+// We are leaking these strings.
 const char* StrDupJString(const base::android::JavaRef<jstring>& java_string) {
+  // Some of the Java methods on BuildInfo can return null
+  // (https://crbug.com/601081), which can't be represented as a std::string, so
+  // use an empty string instead.
+  // TODO(bauerb): Do this only for methods that can legitimately return null.
+  if (java_string.is_null())
+    return "";
+
   std::string str = ConvertJavaStringToUTF8(java_string);
   return strdup(str.c_str());
 }
diff --git a/base/bit_cast.h b/base/bit_cast.h
index 853e865..42d08ee8 100644
--- a/base/bit_cast.h
+++ b/base/bit_cast.h
@@ -72,7 +72,7 @@
                 "non-trivially-copyable bit_cast is undefined");
   static_assert(std::is_trivially_copyable<Source>::value,
                 "non-trivially-copyable bit_cast is undefined");
-#elif __has_feature(is_trivially_copyable)
+#elif HAS_FEATURE(is_trivially_copyable)
   // The compiler supports an equivalent intrinsic.
   static_assert(__is_trivially_copyable(Dest),
                 "non-trivially-copyable bit_cast is undefined");
diff --git a/base/compiler_specific.h b/base/compiler_specific.h
index 1667d73..17e1f688 100644
--- a/base/compiler_specific.h
+++ b/base/compiler_specific.h
@@ -188,9 +188,11 @@
 #endif  // !defined(UNLIKELY)
 
 // Compiler feature-detection.
-// http://clang.llvm.org/docs/LanguageExtensions.html
-#if !defined(__has_feature)
-#define __has_feature(FEATURE) 0
+// clang.llvm.org/docs/LanguageExtensions.html#has-feature-and-has-extension
+#if defined(__has_feature)
+#define HAS_FEATURE(FEATURE) __has_feature(FEATURE)
+#else
+#define HAS_FEATURE(FEATURE) 0
 #endif
 
 #endif  // BASE_COMPILER_SPECIFIC_H_
diff --git a/blimp/DEPS b/blimp/DEPS
new file mode 100644
index 0000000..36d9d3f
--- /dev/null
+++ b/blimp/DEPS
@@ -0,0 +1,5 @@
+include_rules = [
+  "+third_party/libwebp",
+  "+third_party/skia",
+  "+skia",
+]
diff --git a/blimp/client/DEPS b/blimp/client/DEPS
index dfa2aa15..82d0d9cb 100644
--- a/blimp/client/DEPS
+++ b/blimp/client/DEPS
@@ -8,9 +8,6 @@
   "+gpu",
   "+jni",
   "+net",
-  "+skia",
-  "+third_party/libwebp",
-  "+third_party/skia",
   "+third_party/WebKit/public/web/WebInputEvent.h",
   "+ui/base/ime/text_input_type.h",
   "+ui/events",
diff --git a/blimp/client/app/android/blimp_compositor_manager_android.cc b/blimp/client/app/android/blimp_compositor_manager_android.cc
index d52f30b..6aa30fc 100644
--- a/blimp/client/app/android/blimp_compositor_manager_android.cc
+++ b/blimp/client/app/android/blimp_compositor_manager_android.cc
@@ -5,9 +5,10 @@
 #include "blimp/client/app/android/blimp_compositor_manager_android.h"
 
 #include <algorithm>
+#include <memory>
 
 #include "base/command_line.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
 #include "ui/gfx/geometry/size.h"
 
 namespace {
@@ -20,7 +21,8 @@
 namespace client {
 
 // static
-scoped_ptr<BlimpCompositorManagerAndroid> BlimpCompositorManagerAndroid::Create(
+std::unique_ptr<BlimpCompositorManagerAndroid>
+BlimpCompositorManagerAndroid::Create(
     const gfx::Size& real_size,
     const gfx::Size& size,
     RenderWidgetFeature* render_widget_feature) {
@@ -30,7 +32,7 @@
     real_size_supported = false;
     device_size = size;
   }
-  return make_scoped_ptr(new BlimpCompositorManagerAndroid(
+  return base::WrapUnique(new BlimpCompositorManagerAndroid(
       device_size, real_size_supported, render_widget_feature));
 }
 
diff --git a/blimp/client/app/android/blimp_compositor_manager_android.h b/blimp/client/app/android/blimp_compositor_manager_android.h
index c1b94f4d..2f9f653 100644
--- a/blimp/client/app/android/blimp_compositor_manager_android.h
+++ b/blimp/client/app/android/blimp_compositor_manager_android.h
@@ -32,7 +32,7 @@
   // |real_size| is the total display area including system decorations (see
   // android.view.Display.getRealSize()).  |size| is the total display
   // area not including system decorations (see android.view.Display.getSize()).
-  static scoped_ptr<BlimpCompositorManagerAndroid> Create(
+  static std::unique_ptr<BlimpCompositorManagerAndroid> Create(
       const gfx::Size& real_size,
       const gfx::Size& size,
       RenderWidgetFeature* render_widget_feature);
diff --git a/blimp/client/app/android/blimp_view.h b/blimp/client/app/android/blimp_view.h
index e8789ee..4e01934 100644
--- a/blimp/client/app/android/blimp_view.h
+++ b/blimp/client/app/android/blimp_view.h
@@ -5,9 +5,10 @@
 #ifndef BLIMP_CLIENT_APP_ANDROID_BLIMP_VIEW_H_
 #define BLIMP_CLIENT_APP_ANDROID_BLIMP_VIEW_H_
 
+#include <memory>
+
 #include "base/android/jni_android.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "ui/gfx/native_widget_types.h"
 
 namespace gfx {
@@ -96,7 +97,7 @@
 
   const float device_scale_factor_;
 
-  scoped_ptr<BlimpCompositorManagerAndroid> compositor_manager_;
+  std::unique_ptr<BlimpCompositorManagerAndroid> compositor_manager_;
 
   // The format of the current surface owned by |compositor_|.  See
   // android.graphics.PixelFormat.java.
diff --git a/blimp/client/app/blimp_discardable_memory_allocator.cc b/blimp/client/app/blimp_discardable_memory_allocator.cc
index 6d1d174..fecbf750 100644
--- a/blimp/client/app/blimp_discardable_memory_allocator.cc
+++ b/blimp/client/app/blimp_discardable_memory_allocator.cc
@@ -97,7 +97,7 @@
  private:
   bool is_locked_;
   size_t size_;
-  scoped_ptr<uint8_t[]> data_;
+  std::unique_ptr<uint8_t[]> data_;
   BlimpDiscardableMemoryAllocator* allocator_;
 
   MemoryChunkList::iterator unlocked_position_;
@@ -120,10 +120,10 @@
   STLDeleteElements(&live_unlocked_chunks_);
 }
 
-scoped_ptr<base::DiscardableMemory>
+std::unique_ptr<base::DiscardableMemory>
 BlimpDiscardableMemoryAllocator::AllocateLockedDiscardableMemory(size_t size) {
   base::AutoLock lock(lock_);
-  scoped_ptr<DiscardableMemoryChunkImpl> chunk(
+  std::unique_ptr<DiscardableMemoryChunkImpl> chunk(
       new DiscardableMemoryChunkImpl(size, this));
   total_live_memory_ += size;
   locked_chunks_++;
diff --git a/blimp/client/app/blimp_discardable_memory_allocator.h b/blimp/client/app/blimp_discardable_memory_allocator.h
index 52b8c7e..24d1f1f 100644
--- a/blimp/client/app/blimp_discardable_memory_allocator.h
+++ b/blimp/client/app/blimp_discardable_memory_allocator.h
@@ -6,10 +6,10 @@
 #define BLIMP_CLIENT_APP_BLIMP_DISCARDABLE_MEMORY_ALLOCATOR_H_
 
 #include <list>
+#include <memory>
 
 #include "base/macros.h"
 #include "base/memory/discardable_memory_allocator.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/synchronization/lock.h"
 
 namespace blimp {
@@ -26,7 +26,7 @@
   ~BlimpDiscardableMemoryAllocator() override;
 
   // Overridden from DiscardableMemoryAllocator:
-  scoped_ptr<base::DiscardableMemory> AllocateLockedDiscardableMemory(
+  std::unique_ptr<base::DiscardableMemory> AllocateLockedDiscardableMemory(
       size_t size) override;
 
  private:
diff --git a/blimp/client/app/blimp_discardable_memory_allocator_unittest.cc b/blimp/client/app/blimp_discardable_memory_allocator_unittest.cc
index 714c2516..2858822f 100644
--- a/blimp/client/app/blimp_discardable_memory_allocator_unittest.cc
+++ b/blimp/client/app/blimp_discardable_memory_allocator_unittest.cc
@@ -19,7 +19,7 @@
 
 TEST(BlimpDiscardableMemoryAllocator, Basic) {
   BlimpDiscardableMemoryAllocator allocator(kOneMegabyte);
-  scoped_ptr<base::DiscardableMemory> chunk;
+  std::unique_ptr<base::DiscardableMemory> chunk;
   // Make sure the chunk is locked when allocated. In debug mode, we will
   // dcheck.
   chunk = allocator.AllocateLockedDiscardableMemory(kOneKilobyte);
@@ -33,13 +33,13 @@
 TEST(BlimpDiscardableMemoryAllocator, DiscardChunks) {
   BlimpDiscardableMemoryAllocator allocator(kOneMegabyte);
 
-  scoped_ptr<base::DiscardableMemory> chunk_to_remove =
+  std::unique_ptr<base::DiscardableMemory> chunk_to_remove =
       allocator.AllocateLockedDiscardableMemory(kAlmostOneMegabyte);
   chunk_to_remove->Unlock();
 
   // Allocating a second chunk should deallocate the first one due to memory
   // pressure, since we only have one megabyte available.
-  scoped_ptr<base::DiscardableMemory> chunk_to_keep =
+  std::unique_ptr<base::DiscardableMemory> chunk_to_keep =
       allocator.AllocateLockedDiscardableMemory(kAlmostOneMegabyte);
 
   // Fail to get a lock because allocating the second chunk removed the first.
@@ -51,10 +51,10 @@
 TEST(BlimpDiscardableMemoyAllocator, DiscardChunksOnUnlock) {
   BlimpDiscardableMemoryAllocator allocator(kOneMegabyte);
 
-  scoped_ptr<base::DiscardableMemory> chunk_to_remove =
+  std::unique_ptr<base::DiscardableMemory> chunk_to_remove =
       allocator.AllocateLockedDiscardableMemory(kAlmostOneMegabyte);
-  scoped_ptr<base::DiscardableMemory> chunk_to_keep =
-        allocator.AllocateLockedDiscardableMemory(kAlmostOneMegabyte);
+  std::unique_ptr<base::DiscardableMemory> chunk_to_keep =
+      allocator.AllocateLockedDiscardableMemory(kAlmostOneMegabyte);
 
   // We should have both the allocated chunks.
   EXPECT_NE(nullptr, chunk_to_remove->data());
@@ -70,11 +70,11 @@
 TEST(BlimpDiscardableMemoryAllocator, DontDiscardLiveChunks) {
   BlimpDiscardableMemoryAllocator allocator(kOneMegabyte);
 
-  scoped_ptr<base::DiscardableMemory> chunk_one =
+  std::unique_ptr<base::DiscardableMemory> chunk_one =
       allocator.AllocateLockedDiscardableMemory(kAlmostOneMegabyte);
-  scoped_ptr<base::DiscardableMemory> chunk_two =
+  std::unique_ptr<base::DiscardableMemory> chunk_two =
       allocator.AllocateLockedDiscardableMemory(kAlmostOneMegabyte);
-  scoped_ptr<base::DiscardableMemory> chunk_three =
+  std::unique_ptr<base::DiscardableMemory> chunk_three =
       allocator.AllocateLockedDiscardableMemory(kAlmostOneMegabyte);
 
   // These accesses will fail if the underlying weak ptr has been deallocated.
diff --git a/blimp/client/app/blimp_startup.cc b/blimp/client/app/blimp_startup.cc
index 00668833..ad36ed1 100644
--- a/blimp/client/app/blimp_startup.cc
+++ b/blimp/client/app/blimp_startup.cc
@@ -18,8 +18,8 @@
 class SkImageGenerator;
 
 namespace {
-base::LazyInstance<scoped_ptr<base::MessageLoopForUI>> g_main_message_loop =
-    LAZY_INSTANCE_INITIALIZER;
+base::LazyInstance<std::unique_ptr<base::MessageLoopForUI>>
+    g_main_message_loop = LAZY_INSTANCE_INITIALIZER;
 
 base::LazyInstance<blimp::client::BlimpDiscardableMemoryAllocator>
     g_discardable_memory_allocator = LAZY_INSTANCE_INITIALIZER;
diff --git a/blimp/client/app/linux/blimp_client_session_linux.h b/blimp/client/app/linux/blimp_client_session_linux.h
index 1a60b0d..25cb524e 100644
--- a/blimp/client/app/linux/blimp_client_session_linux.h
+++ b/blimp/client/app/linux/blimp_client_session_linux.h
@@ -27,9 +27,9 @@
   void OnClosed() override;
 
  private:
-  scoped_ptr<ui::PlatformEventSource> event_source_;
-  scoped_ptr<BlimpDisplayManager> blimp_display_manager_;
-  scoped_ptr<NavigationFeature::NavigationFeatureDelegate>
+  std::unique_ptr<ui::PlatformEventSource> event_source_;
+  std::unique_ptr<BlimpDisplayManager> blimp_display_manager_;
+  std::unique_ptr<NavigationFeature::NavigationFeatureDelegate>
       navigation_feature_delegate_;
 
   DISALLOW_COPY_AND_ASSIGN(BlimpClientSessionLinux);
diff --git a/blimp/client/app/linux/blimp_display_manager.h b/blimp/client/app/linux/blimp_display_manager.h
index 15c23160..ca3f50d 100644
--- a/blimp/client/app/linux/blimp_display_manager.h
+++ b/blimp/client/app/linux/blimp_display_manager.h
@@ -5,8 +5,9 @@
 #ifndef BLIMP_CLIENT_APP_LINUX_BLIMP_DISPLAY_MANAGER_H_
 #define BLIMP_CLIENT_APP_LINUX_BLIMP_DISPLAY_MANAGER_H_
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "ui/platform_window/platform_window_delegate.h"
 
 namespace gfx {
@@ -56,8 +57,8 @@
   BlimpDisplayManagerDelegate* delegate_;
   TabControlFeature* tab_control_feature_;
 
-  scoped_ptr<BlimpCompositorManager> blimp_compositor_manager_;
-  scoped_ptr<ui::PlatformWindow> platform_window_;
+  std::unique_ptr<BlimpCompositorManager> blimp_compositor_manager_;
+  std::unique_ptr<ui::PlatformWindow> platform_window_;
 
   DISALLOW_COPY_AND_ASSIGN(BlimpDisplayManager);
 };
diff --git a/blimp/client/feature/compositor/blimp_compositor.cc b/blimp/client/feature/compositor/blimp_compositor.cc
index dc889419..0c27935 100644
--- a/blimp/client/feature/compositor/blimp_compositor.cc
+++ b/blimp/client/feature/compositor/blimp_compositor.cc
@@ -6,6 +6,7 @@
 
 #include "base/bind_helpers.h"
 #include "base/command_line.h"
+#include "base/memory/ptr_util.h"
 #include "base/numerics/safe_conversions.h"
 #include "base/single_thread_task_runner.h"
 #include "base/thread_task_runner_handle.h"
@@ -112,8 +113,10 @@
 void BlimpCompositor::DidCompletePageScaleAnimation() {}
 
 void BlimpCompositor::RecordFrameTimingEvents(
-    scoped_ptr<cc::FrameTimingTracker::CompositeTimingSet> composite_events,
-    scoped_ptr<cc::FrameTimingTracker::MainFrameTimingSet> main_frame_events) {}
+    std::unique_ptr<cc::FrameTimingTracker::CompositeTimingSet>
+        composite_events,
+    std::unique_ptr<cc::FrameTimingTracker::MainFrameTimingSet>
+        main_frame_events) {}
 
 void BlimpCompositor::SetProtoReceiver(ProtoReceiver* receiver) {
   remote_proto_channel_receiver_ = receiver;
@@ -125,7 +128,7 @@
 }
 
 void BlimpCompositor::OnCompositorMessageReceived(
-    scoped_ptr<cc::proto::CompositorMessage> message) {
+    std::unique_ptr<cc::proto::CompositorMessage> message) {
   DCHECK(message->has_to_impl());
   const cc::proto::CompositorMessageToImpl& to_impl_proto =
       message->to_impl();
@@ -257,7 +260,7 @@
                                    client_->GetGpuMemoryBufferManager());
 
   host_->SetOutputSurface(
-      make_scoped_ptr(new BlimpOutputSurface(context_provider)));
+      base::WrapUnique(new BlimpOutputSurface(context_provider)));
   output_surface_request_pending_ = false;
 }
 
diff --git a/blimp/client/feature/compositor/blimp_compositor.h b/blimp/client/feature/compositor/blimp_compositor.h
index dc2dc6d..c558b50f 100644
--- a/blimp/client/feature/compositor/blimp_compositor.h
+++ b/blimp/client/feature/compositor/blimp_compositor.h
@@ -5,11 +5,11 @@
 #ifndef BLIMP_CLIENT_FEATURE_COMPOSITOR_BLIMP_COMPOSITOR_H_
 #define BLIMP_CLIENT_FEATURE_COMPOSITOR_BLIMP_COMPOSITOR_H_
 
+#include <memory>
 #include <vector>
 
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "blimp/client/blimp_client_export.h"
 #include "blimp/client/feature/compositor/blimp_input_manager.h"
 #include "cc/trees/layer_tree_host.h"
@@ -124,7 +124,7 @@
   // LayerTreeHost of the render widget for this compositor.
   // virtual for testing.
   virtual void OnCompositorMessageReceived(
-      scoped_ptr<cc::proto::CompositorMessage> message);
+      std::unique_ptr<cc::proto::CompositorMessage> message);
 
   int render_widget_id() const { return render_widget_id_; }
 
@@ -151,9 +151,10 @@
   void DidCompleteSwapBuffers() override;
   void DidCompletePageScaleAnimation() override;
   void RecordFrameTimingEvents(
-      scoped_ptr<cc::FrameTimingTracker::CompositeTimingSet> composite_events,
-      scoped_ptr<cc::FrameTimingTracker::MainFrameTimingSet> main_frame_events)
-      override;
+      std::unique_ptr<cc::FrameTimingTracker::CompositeTimingSet>
+          composite_events,
+      std::unique_ptr<cc::FrameTimingTracker::MainFrameTimingSet>
+          main_frame_events) override;
 
   // RemoteProtoChannel implementation.
   void SetProtoReceiver(ProtoReceiver* receiver) override;
@@ -185,7 +186,7 @@
 
   BlimpCompositorClient* client_;
 
-  scoped_ptr<cc::LayerTreeHost> host_;
+  std::unique_ptr<cc::LayerTreeHost> host_;
 
   gfx::AcceleratedWidget window_;
 
@@ -209,7 +210,7 @@
   // cc::InputHandler. The input events are forwarded to this input handler by
   // the manager to be handled by the client compositor for the current render
   // widget.
-  scoped_ptr<BlimpInputManager> input_manager_;
+  std::unique_ptr<BlimpInputManager> input_manager_;
 
   DISALLOW_COPY_AND_ASSIGN(BlimpCompositor);
 };
diff --git a/blimp/client/feature/compositor/blimp_compositor_manager.cc b/blimp/client/feature/compositor/blimp_compositor_manager.cc
index 9902745..b44a1999 100644
--- a/blimp/client/feature/compositor/blimp_compositor_manager.cc
+++ b/blimp/client/feature/compositor/blimp_compositor_manager.cc
@@ -5,6 +5,7 @@
 #include "blimp/client/feature/compositor/blimp_compositor_manager.h"
 
 #include "base/lazy_instance.h"
+#include "base/memory/ptr_util.h"
 #include "blimp/client/feature/compositor/blimp_layer_tree_settings.h"
 #include "blimp/common/compositor/blimp_image_serialization_processor.h"
 #include "blimp/common/compositor/blimp_task_graph_runner.h"
@@ -70,10 +71,10 @@
   PopulateCommonLayerTreeSettings(settings);
 }
 
-scoped_ptr<BlimpCompositor> BlimpCompositorManager::CreateBlimpCompositor(
-    int render_widget_id, BlimpCompositorClient* client) {
-  return make_scoped_ptr(
-      new BlimpCompositor(render_widget_id, client));
+std::unique_ptr<BlimpCompositor> BlimpCompositorManager::CreateBlimpCompositor(
+    int render_widget_id,
+    BlimpCompositorClient* client) {
+  return base::WrapUnique(new BlimpCompositor(render_widget_id, client));
 }
 
 void BlimpCompositorManager::OnRenderWidgetCreated(int render_widget_id) {
@@ -115,7 +116,7 @@
 
 void BlimpCompositorManager::OnCompositorMessageReceived(
     int render_widget_id,
-    scoped_ptr<cc::proto::CompositorMessage> message) {
+    std::unique_ptr<cc::proto::CompositorMessage> message) {
   BlimpCompositor* compositor = GetCompositor(render_widget_id);
   DCHECK(compositor);
 
diff --git a/blimp/client/feature/compositor/blimp_compositor_manager.h b/blimp/client/feature/compositor/blimp_compositor_manager.h
index 68f6a320..9382c0d 100644
--- a/blimp/client/feature/compositor/blimp_compositor_manager.h
+++ b/blimp/client/feature/compositor/blimp_compositor_manager.h
@@ -42,8 +42,9 @@
   virtual void GenerateLayerTreeSettings(cc::LayerTreeSettings* settings);
 
   // virtual for testing.
-  virtual scoped_ptr<BlimpCompositor> CreateBlimpCompositor(
-      int render_widget_id, BlimpCompositorClient* client);
+  virtual std::unique_ptr<BlimpCompositor> CreateBlimpCompositor(
+      int render_widget_id,
+      BlimpCompositorClient* client);
 
   // Returns the compositor for the |render_widget_id|. Will return nullptr if
   // no compositor is found.
@@ -57,7 +58,7 @@
   void OnRenderWidgetDeleted(int render_widget_id) override;
   void OnCompositorMessageReceived(
       int render_widget_id,
-      scoped_ptr<cc::proto::CompositorMessage> message) override;
+      std::unique_ptr<cc::proto::CompositorMessage> message) override;
 
   // BlimpCompositorClient implementation.
   cc::LayerTreeSettings* GetLayerTreeSettings() override;
@@ -77,15 +78,16 @@
 
   gfx::AcceleratedWidget window_;
 
-  scoped_ptr<cc::LayerTreeSettings> settings_;
+  std::unique_ptr<cc::LayerTreeSettings> settings_;
 
-  scoped_ptr<BlimpGpuMemoryBufferManager> gpu_memory_buffer_manager_;
+  std::unique_ptr<BlimpGpuMemoryBufferManager> gpu_memory_buffer_manager_;
 
   // Provides the functionality to deserialize images in SkPicture.
-  scoped_ptr<BlimpImageSerializationProcessor> image_serialization_processor_;
+  std::unique_ptr<BlimpImageSerializationProcessor>
+      image_serialization_processor_;
 
   // A map of render_widget_ids to the BlimpCompositor instance.
-  typedef std::map<int, scoped_ptr<BlimpCompositor>> CompositorMap;
+  typedef std::map<int, std::unique_ptr<BlimpCompositor>> CompositorMap;
   CompositorMap compositors_;
 
   // The |active_compositor_| represents the compositor from the CompositorMap
@@ -95,7 +97,7 @@
 
   // Lazily created thread that will run the compositor rendering tasks and will
   // be shared by all compositor instances.
-  scoped_ptr<base::Thread> compositor_thread_;
+  std::unique_ptr<base::Thread> compositor_thread_;
 
   // The bridge to the network layer that does the proto/RenderWidget id work.
   // BlimpCompositorManager does not own this and it is expected to outlive this
diff --git a/blimp/client/feature/compositor/blimp_compositor_manager_unittest.cc b/blimp/client/feature/compositor/blimp_compositor_manager_unittest.cc
index eed8224..9c1d21fe 100644
--- a/blimp/client/feature/compositor/blimp_compositor_manager_unittest.cc
+++ b/blimp/client/feature/compositor/blimp_compositor_manager_unittest.cc
@@ -4,6 +4,7 @@
 
 #include "blimp/client/feature/compositor/blimp_compositor_manager.h"
 
+#include "base/memory/ptr_util.h"
 #include "cc/proto/compositor_message.pb.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
@@ -41,7 +42,7 @@
   MOCK_METHOD1(OnTouchEvent, bool(const ui::MotionEvent& motion_event));
 
   void OnCompositorMessageReceived(
-      scoped_ptr<cc::proto::CompositorMessage> message) override {
+      std::unique_ptr<cc::proto::CompositorMessage> message) override {
     MockableOnCompositorMessageReceived(*message);
   }
   MOCK_METHOD1(MockableOnCompositorMessageReceived,
@@ -56,9 +57,10 @@
 
   using BlimpCompositorManager::GetCompositor;
 
-  scoped_ptr<BlimpCompositor> CreateBlimpCompositor(
-      int render_widget_id, BlimpCompositorClient* client) override {
-    return make_scoped_ptr(new MockBlimpCompositor(render_widget_id));
+  std::unique_ptr<BlimpCompositor> CreateBlimpCompositor(
+      int render_widget_id,
+      BlimpCompositorClient* client) override {
+    return base::WrapUnique(new MockBlimpCompositor(render_widget_id));
   }
 };
 
@@ -98,7 +100,7 @@
         (compositor_manager_.get());
   }
 
-  scoped_ptr<BlimpCompositorManagerForTesting> compositor_manager_;
+  std::unique_ptr<BlimpCompositorManagerForTesting> compositor_manager_;
   MockRenderWidgetFeature render_widget_feature_;
   MockBlimpCompositor* mock_compositor1_;
   MockBlimpCompositor* mock_compositor2_;
@@ -119,12 +121,12 @@
                 SetAcceleratedWidget(gfx::kNullAcceleratedWidget)).Times(1);
 
   delegate()->OnCompositorMessageReceived(
-      1, make_scoped_ptr(new cc::proto::CompositorMessage));
+      1, base::WrapUnique(new cc::proto::CompositorMessage));
   delegate()->OnRenderWidgetInitialized(1);
   delegate()->OnCompositorMessageReceived(
-      2, make_scoped_ptr(new cc::proto::CompositorMessage));
+      2, base::WrapUnique(new cc::proto::CompositorMessage));
   delegate()->OnCompositorMessageReceived(
-      1, make_scoped_ptr(new cc::proto::CompositorMessage));
+      1, base::WrapUnique(new cc::proto::CompositorMessage));
 
   delegate()->OnRenderWidgetDeleted(1);
   EXPECT_EQ(compositor_manager_->GetCompositor(1), nullptr);
diff --git a/blimp/client/feature/compositor/blimp_compositor_unittest.cc b/blimp/client/feature/compositor/blimp_compositor_unittest.cc
index 548fd80..8656b018 100644
--- a/blimp/client/feature/compositor/blimp_compositor_unittest.cc
+++ b/blimp/client/feature/compositor/blimp_compositor_unittest.cc
@@ -96,7 +96,7 @@
   ~BlimpCompositorTest() override {}
 
   void SendInitializeMessage() {
-    scoped_ptr<cc::proto::CompositorMessage> message;
+    std::unique_ptr<cc::proto::CompositorMessage> message;
     message.reset(new cc::proto::CompositorMessage);
     cc::proto::CompositorMessageToImpl* to_impl =
         message->mutable_to_impl();
@@ -110,7 +110,7 @@
   }
 
   void SendShutdownMessage() {
-    scoped_ptr<cc::proto::CompositorMessage> message;
+    std::unique_ptr<cc::proto::CompositorMessage> message;
     message.reset(new cc::proto::CompositorMessage);
     cc::proto::CompositorMessageToImpl* to_impl =
         message->mutable_to_impl();
@@ -119,9 +119,9 @@
   }
 
   int render_widget_id_;
-  scoped_ptr<base::MessageLoop> loop_;
+  std::unique_ptr<base::MessageLoop> loop_;
   MockBlimpCompositorClient compositor_client_;
-  scoped_ptr<BlimpCompositorForTesting> compositor_;
+  std::unique_ptr<BlimpCompositorForTesting> compositor_;
   gfx::AcceleratedWidget window_;
 };
 
diff --git a/blimp/client/feature/compositor/blimp_context_provider.h b/blimp/client/feature/compositor/blimp_context_provider.h
index 54c87aa..ef48637 100644
--- a/blimp/client/feature/compositor/blimp_context_provider.h
+++ b/blimp/client/feature/compositor/blimp_context_provider.h
@@ -7,8 +7,9 @@
 
 #include <stdint.h>
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/synchronization/lock.h"
 #include "base/threading/thread_checker.h"
 #include "cc/output/context_provider.h"
@@ -53,7 +54,7 @@
   base::ThreadChecker context_thread_checker_;
 
   base::Lock context_lock_;
-  scoped_ptr<gpu::GLInProcessContext> context_;
+  std::unique_ptr<gpu::GLInProcessContext> context_;
   skia::RefPtr<class GrContext> gr_context_;
 
   cc::ContextProvider::Capabilities capabilities_;
diff --git a/blimp/client/feature/compositor/blimp_gpu_memory_buffer_manager.cc b/blimp/client/feature/compositor/blimp_gpu_memory_buffer_manager.cc
index 9831d74..8d1e624 100644
--- a/blimp/client/feature/compositor/blimp_gpu_memory_buffer_manager.cc
+++ b/blimp/client/feature/compositor/blimp_gpu_memory_buffer_manager.cc
@@ -8,6 +8,7 @@
 #include <stdint.h>
 
 #include "base/logging.h"
+#include "base/memory/ptr_util.h"
 #include "base/numerics/safe_conversions.h"
 #include "ui/gfx/buffer_format_util.h"
 #include "ui/gfx/gpu_memory_buffer.h"
@@ -21,15 +22,15 @@
  public:
   GpuMemoryBufferImpl(const gfx::Size& size,
                       gfx::BufferFormat format,
-                      scoped_ptr<base::SharedMemory> shared_memory,
+                      std::unique_ptr<base::SharedMemory> shared_memory,
                       size_t offset,
                       size_t stride)
-     :size_(size),
-      format_(format),
-      shared_memory_(std::move(shared_memory)),
-      offset_(offset),
-      stride_(stride),
-      mapped_(false) {}
+      : size_(size),
+        format_(format),
+        shared_memory_(std::move(shared_memory)),
+        offset_(offset),
+        stride_(stride),
+        mapped_(false) {}
 
   // Overridden from gfx::GpuMemoryBuffer:
   bool Map() override {
@@ -86,7 +87,7 @@
  private:
   const gfx::Size size_;
   gfx::BufferFormat format_;
-  scoped_ptr<base::SharedMemory> shared_memory_;
+  std::unique_ptr<base::SharedMemory> shared_memory_;
   size_t offset_;
   size_t stride_;
   bool mapped_;
@@ -98,21 +99,21 @@
 
 BlimpGpuMemoryBufferManager::~BlimpGpuMemoryBufferManager() {}
 
-scoped_ptr<gfx::GpuMemoryBuffer>
+std::unique_ptr<gfx::GpuMemoryBuffer>
 BlimpGpuMemoryBufferManager::AllocateGpuMemoryBuffer(const gfx::Size& size,
-                                                    gfx::BufferFormat format,
-                                                    gfx::BufferUsage usage) {
-  scoped_ptr<base::SharedMemory> shared_memory(new base::SharedMemory);
+                                                     gfx::BufferFormat format,
+                                                     gfx::BufferUsage usage) {
+  std::unique_ptr<base::SharedMemory> shared_memory(new base::SharedMemory);
   const size_t buffer_size = gfx::BufferSizeForBufferFormat(size, format);
   if (!shared_memory->CreateAnonymous(buffer_size))
     return nullptr;
-  return make_scoped_ptr<gfx::GpuMemoryBuffer>(new GpuMemoryBufferImpl(
+  return base::WrapUnique<gfx::GpuMemoryBuffer>(new GpuMemoryBufferImpl(
       size, format, std::move(shared_memory), 0,
       base::checked_cast<int>(
           gfx::RowSizeForBufferFormat(size.width(), format, 0))));
 }
 
-scoped_ptr<gfx::GpuMemoryBuffer>
+std::unique_ptr<gfx::GpuMemoryBuffer>
 BlimpGpuMemoryBufferManager::CreateGpuMemoryBufferFromHandle(
     const gfx::GpuMemoryBufferHandle& handle,
     const gfx::Size& size,
@@ -120,9 +121,9 @@
   if (handle.type != gfx::SHARED_MEMORY_BUFFER)
     return nullptr;
 
-  return make_scoped_ptr<gfx::GpuMemoryBuffer>(new GpuMemoryBufferImpl(
+  return base::WrapUnique<gfx::GpuMemoryBuffer>(new GpuMemoryBufferImpl(
       size, format,
-      make_scoped_ptr(new base::SharedMemory(handle.handle, false)),
+      base::WrapUnique(new base::SharedMemory(handle.handle, false)),
       handle.offset, handle.stride));
 }
 
diff --git a/blimp/client/feature/compositor/blimp_gpu_memory_buffer_manager.h b/blimp/client/feature/compositor/blimp_gpu_memory_buffer_manager.h
index 5281ba69..25afe20 100644
--- a/blimp/client/feature/compositor/blimp_gpu_memory_buffer_manager.h
+++ b/blimp/client/feature/compositor/blimp_gpu_memory_buffer_manager.h
@@ -17,11 +17,11 @@
   ~BlimpGpuMemoryBufferManager() override;
 
   // Overridden from gpu::GpuMemoryBufferManager:
-  scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer(
+  std::unique_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer(
       const gfx::Size& size,
       gfx::BufferFormat format,
       gfx::BufferUsage usage) override;
-  scoped_ptr<gfx::GpuMemoryBuffer> CreateGpuMemoryBufferFromHandle(
+  std::unique_ptr<gfx::GpuMemoryBuffer> CreateGpuMemoryBufferFromHandle(
       const gfx::GpuMemoryBufferHandle& handle,
       const gfx::Size& size,
       gfx::BufferFormat format) override;
diff --git a/blimp/client/feature/compositor/blimp_input_handler_wrapper.h b/blimp/client/feature/compositor/blimp_input_handler_wrapper.h
index dea9c25..e917794 100644
--- a/blimp/client/feature/compositor/blimp_input_handler_wrapper.h
+++ b/blimp/client/feature/compositor/blimp_input_handler_wrapper.h
@@ -59,7 +59,7 @@
   // BlimpInputManager is destroyed.
   base::WeakPtr<BlimpInputManager> input_manager_weak_ptr_;
 
-  scoped_ptr<ui::InputHandlerProxy> input_handler_proxy_;
+  std::unique_ptr<ui::InputHandlerProxy> input_handler_proxy_;
 
   DISALLOW_COPY_AND_ASSIGN(BlimpInputHandlerWrapper);
 };
diff --git a/blimp/client/feature/compositor/blimp_input_manager.cc b/blimp/client/feature/compositor/blimp_input_manager.cc
index 30b2da9..14f6f38b 100644
--- a/blimp/client/feature/compositor/blimp_input_manager.cc
+++ b/blimp/client/feature/compositor/blimp_input_manager.cc
@@ -7,21 +7,20 @@
 #include "base/auto_reset.h"
 #include "base/bind.h"
 #include "base/location.h"
+#include "base/memory/ptr_util.h"
 #include "ui/events/blink/blink_event_util.h"
 #include "ui/events/gesture_detection/gesture_provider_config_helper.h"
 
 namespace blimp {
 namespace client {
 
-scoped_ptr<BlimpInputManager> BlimpInputManager::Create(
-      BlimpInputManagerClient* client,
-      scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
-      scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner,
-      const base::WeakPtr<cc::InputHandler>& input_handler) {
-  return make_scoped_ptr(new BlimpInputManager(client,
-                                               main_task_runner,
-                                               compositor_task_runner,
-                                               input_handler));
+std::unique_ptr<BlimpInputManager> BlimpInputManager::Create(
+    BlimpInputManagerClient* client,
+    scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
+    scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner,
+    const base::WeakPtr<cc::InputHandler>& input_handler) {
+  return base::WrapUnique(new BlimpInputManager(
+      client, main_task_runner, compositor_task_runner, input_handler));
 }
 
 BlimpInputManager::BlimpInputManager(
@@ -113,10 +112,8 @@
     return;
 
   DCHECK(!input_handler_wrapper_);
-  input_handler_wrapper_ = make_scoped_ptr(
-      new BlimpInputHandlerWrapper(main_task_runner_,
-                                   input_manager_weak_ptr,
-                                   input_handler.get()));
+  input_handler_wrapper_ = base::WrapUnique(new BlimpInputHandlerWrapper(
+      main_task_runner_, input_manager_weak_ptr, input_handler.get()));
 }
 
 void BlimpInputManager::HandleWebGestureEventOnCompositorThread(
diff --git a/blimp/client/feature/compositor/blimp_input_manager.h b/blimp/client/feature/compositor/blimp_input_manager.h
index b93c6dd8..120988a1 100644
--- a/blimp/client/feature/compositor/blimp_input_manager.h
+++ b/blimp/client/feature/compositor/blimp_input_manager.h
@@ -5,8 +5,9 @@
 #ifndef BLIMP_CLIENT_FEATURE_COMPOSITOR_BLIMP_INPUT_MANAGER_H_
 #define BLIMP_CLIENT_FEATURE_COMPOSITOR_BLIMP_INPUT_MANAGER_H_
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/single_thread_task_runner.h"
 #include "base/synchronization/waitable_event.h"
 #include "blimp/client/feature/compositor/blimp_input_handler_wrapper.h"
@@ -43,7 +44,7 @@
 
 class BlimpInputManager : public ui::GestureProviderClient {
  public:
-  static scoped_ptr<BlimpInputManager> Create(
+  static std::unique_ptr<BlimpInputManager> Create(
       BlimpInputManagerClient* client,
       scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
       scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner,
@@ -95,7 +96,7 @@
   // read in ShutdownOnCompositorThread.
   bool main_thread_blocked_;
 
-  scoped_ptr<BlimpInputHandlerWrapper> input_handler_wrapper_;
+  std::unique_ptr<BlimpInputHandlerWrapper> input_handler_wrapper_;
 
   base::WeakPtrFactory<BlimpInputManager> weak_factory_;
 
diff --git a/blimp/client/feature/compositor/blimp_output_surface.h b/blimp/client/feature/compositor/blimp_output_surface.h
index b98804c..728ddf49 100644
--- a/blimp/client/feature/compositor/blimp_output_surface.h
+++ b/blimp/client/feature/compositor/blimp_output_surface.h
@@ -5,8 +5,9 @@
 #ifndef BLIMP_CLIENT_FEATURE_COMPOSITOR_BLIMP_OUTPUT_SURFACE_H_
 #define BLIMP_CLIENT_FEATURE_COMPOSITOR_BLIMP_OUTPUT_SURFACE_H_
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "cc/output/output_surface.h"
 
diff --git a/blimp/client/feature/ime_feature.cc b/blimp/client/feature/ime_feature.cc
index 2e69507..7795007 100644
--- a/blimp/client/feature/ime_feature.cc
+++ b/blimp/client/feature/ime_feature.cc
@@ -22,7 +22,7 @@
   DCHECK_LT(0, render_widget_id_);
 
   ImeMessage* ime_message;
-  scoped_ptr<BlimpMessage> blimp_message =
+  std::unique_ptr<BlimpMessage> blimp_message =
       CreateBlimpMessage(&ime_message, tab_id_);
   ime_message->set_render_widget_id(render_widget_id_);
   ime_message->set_type(ImeMessage::SET_TEXT);
@@ -32,7 +32,7 @@
                                               net::CompletionCallback());
 }
 
-void ImeFeature::ProcessMessage(scoped_ptr<BlimpMessage> message,
+void ImeFeature::ProcessMessage(std::unique_ptr<BlimpMessage> message,
                                 const net::CompletionCallback& callback) {
   DCHECK(!callback.is_null());
   DCHECK_EQ(BlimpMessage::IME, message->type());
diff --git a/blimp/client/feature/ime_feature.h b/blimp/client/feature/ime_feature.h
index 4db2cde6..0eeee823 100644
--- a/blimp/client/feature/ime_feature.h
+++ b/blimp/client/feature/ime_feature.h
@@ -45,7 +45,7 @@
   // Set the BlimpMessageProcessor that will be used to send BlimpMessage::IME
   // messages to the engine.
   void set_outgoing_message_processor(
-      scoped_ptr<BlimpMessageProcessor> processor) {
+      std::unique_ptr<BlimpMessageProcessor> processor) {
     outgoing_message_processor_ = std::move(processor);
   }
 
@@ -58,7 +58,7 @@
 
  private:
   // BlimpMessageProcessor implementation.
-  void ProcessMessage(scoped_ptr<BlimpMessage> message,
+  void ProcessMessage(std::unique_ptr<BlimpMessage> message,
                       const net::CompletionCallback& callback) override;
 
   // Delegate for processing the text input related messages. |delegate_| must
@@ -74,7 +74,7 @@
   int render_widget_id_ = 0;
 
   // Used to send BlimpMessage::IME messages to the engine.
-  scoped_ptr<BlimpMessageProcessor> outgoing_message_processor_;
+  std::unique_ptr<BlimpMessageProcessor> outgoing_message_processor_;
 
   DISALLOW_COPY_AND_ASSIGN(ImeFeature);
 };
diff --git a/blimp/client/feature/navigation_feature.cc b/blimp/client/feature/navigation_feature.cc
index 973862d4..9128c64e 100644
--- a/blimp/client/feature/navigation_feature.cc
+++ b/blimp/client/feature/navigation_feature.cc
@@ -21,7 +21,7 @@
 NavigationFeature::~NavigationFeature() {}
 
 void NavigationFeature::set_outgoing_message_processor(
-    scoped_ptr<BlimpMessageProcessor> processor) {
+    std::unique_ptr<BlimpMessageProcessor> processor) {
   outgoing_message_processor_ = std::move(processor);
 }
 
@@ -40,7 +40,7 @@
 void NavigationFeature::NavigateToUrlText(int tab_id,
                                           const std::string& url_text) {
   NavigationMessage* navigation_message;
-  scoped_ptr<BlimpMessage> blimp_message =
+  std::unique_ptr<BlimpMessage> blimp_message =
       CreateBlimpMessage(&navigation_message, tab_id);
   navigation_message->set_type(NavigationMessage::LOAD_URL);
   navigation_message->mutable_load_url()->set_url(url_text);
@@ -50,7 +50,7 @@
 
 void NavigationFeature::Reload(int tab_id) {
   NavigationMessage* navigation_message;
-  scoped_ptr<BlimpMessage> blimp_message =
+  std::unique_ptr<BlimpMessage> blimp_message =
       CreateBlimpMessage(&navigation_message, tab_id);
   navigation_message->set_type(NavigationMessage::RELOAD);
 
@@ -60,7 +60,7 @@
 
 void NavigationFeature::GoForward(int tab_id) {
   NavigationMessage* navigation_message;
-  scoped_ptr<BlimpMessage> blimp_message =
+  std::unique_ptr<BlimpMessage> blimp_message =
       CreateBlimpMessage(&navigation_message, tab_id);
   navigation_message->set_type(NavigationMessage::GO_FORWARD);
 
@@ -70,7 +70,7 @@
 
 void NavigationFeature::GoBack(int tab_id) {
   NavigationMessage* navigation_message;
-  scoped_ptr<BlimpMessage> blimp_message =
+  std::unique_ptr<BlimpMessage> blimp_message =
       CreateBlimpMessage(&navigation_message, tab_id);
   navigation_message->set_type(NavigationMessage::GO_BACK);
 
@@ -79,7 +79,7 @@
 }
 
 void NavigationFeature::ProcessMessage(
-    scoped_ptr<BlimpMessage> message,
+    std::unique_ptr<BlimpMessage> message,
     const net::CompletionCallback& callback) {
   DCHECK(!callback.is_null());
   DCHECK(message->type() == BlimpMessage::NAVIGATION);
diff --git a/blimp/client/feature/navigation_feature.h b/blimp/client/feature/navigation_feature.h
index 565f3be..b971bb70 100644
--- a/blimp/client/feature/navigation_feature.h
+++ b/blimp/client/feature/navigation_feature.h
@@ -41,7 +41,7 @@
   // Set the BlimpMessageProcessor that will be used to send
   // BlimpMessage::NAVIGATION messages to the engine.
   void set_outgoing_message_processor(
-      scoped_ptr<BlimpMessageProcessor> processor);
+      std::unique_ptr<BlimpMessageProcessor> processor);
 
   // Sets a NavigationMessageDelegate to be notified of all navigation messages
   // for |tab_id| from the engine.
@@ -55,7 +55,7 @@
 
  private:
   // BlimpMessageProcessor implementation.
-  void ProcessMessage(scoped_ptr<BlimpMessage> message,
+  void ProcessMessage(std::unique_ptr<BlimpMessage> message,
                       const net::CompletionCallback& callback) override;
 
   NavigationFeatureDelegate* FindDelegate(const int tab_id);
@@ -65,7 +65,7 @@
   DelegateMap delegates_;
 
   // Used to send BlimpMessage::NAVIGATION messages to the engine.
-  scoped_ptr<BlimpMessageProcessor> outgoing_message_processor_;
+  std::unique_ptr<BlimpMessageProcessor> outgoing_message_processor_;
 
   DISALLOW_COPY_AND_ASSIGN(NavigationFeature);
 };
diff --git a/blimp/client/feature/navigation_feature_unittest.cc b/blimp/client/feature/navigation_feature_unittest.cc
index 4a1efb72..9b1de3b8 100644
--- a/blimp/client/feature/navigation_feature_unittest.cc
+++ b/blimp/client/feature/navigation_feature_unittest.cc
@@ -4,8 +4,10 @@
 
 #include "blimp/client/feature/navigation_feature.h"
 
+#include <memory>
+
 #include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
 #include "blimp/common/create_blimp_message.h"
 #include "blimp/common/proto/blimp_message.pb.h"
 #include "blimp/net/test_common.h"
@@ -38,7 +40,7 @@
                                            const std::string* title,
                                            const bool* loading) {
   NavigationMessage* navigation_message;
-  scoped_ptr<BlimpMessage> message =
+  std::unique_ptr<BlimpMessage> message =
       CreateBlimpMessage(&navigation_message, tab_id);
   navigation_message->set_type(NavigationMessage::NAVIGATION_STATE_CHANGED);
   NavigationStateChangeMessage* state =
@@ -84,7 +86,7 @@
 
   void SetUp() override {
     out_processor_ = new MockBlimpMessageProcessor();
-    feature_.set_outgoing_message_processor(make_scoped_ptr(out_processor_));
+    feature_.set_outgoing_message_processor(base::WrapUnique(out_processor_));
 
     feature_.SetDelegate(1, &delegate1_);
     feature_.SetDelegate(2, &delegate2_);
diff --git a/blimp/client/feature/render_widget_feature.cc b/blimp/client/feature/render_widget_feature.cc
index 21764de..e92258de 100644
--- a/blimp/client/feature/render_widget_feature.cc
+++ b/blimp/client/feature/render_widget_feature.cc
@@ -21,12 +21,12 @@
 RenderWidgetFeature::~RenderWidgetFeature() {}
 
 void RenderWidgetFeature::set_outgoing_input_message_processor(
-    scoped_ptr<BlimpMessageProcessor> processor) {
+    std::unique_ptr<BlimpMessageProcessor> processor) {
   outgoing_input_message_processor_ = std::move(processor);
 }
 
 void RenderWidgetFeature::set_outgoing_compositor_message_processor(
-    scoped_ptr<BlimpMessageProcessor> processor) {
+    std::unique_ptr<BlimpMessageProcessor> processor) {
   outgoing_compositor_message_processor_ = std::move(processor);
 }
 
@@ -34,7 +34,7 @@
     const int tab_id,
     const int render_widget_id,
     const blink::WebGestureEvent& event) {
-  scoped_ptr<BlimpMessage> blimp_message =
+  std::unique_ptr<BlimpMessage> blimp_message =
       input_message_generator_.GenerateMessage(event);
 
   // Don't send unsupported WebGestureEvents.
@@ -53,7 +53,7 @@
     const int render_widget_id,
     const cc::proto::CompositorMessage& message) {
   CompositorMessage* compositor_message;
-  scoped_ptr<BlimpMessage> blimp_message =
+  std::unique_ptr<BlimpMessage> blimp_message =
       CreateBlimpMessage(&compositor_message, tab_id);
 
   compositor_message->set_render_widget_id(render_widget_id);
@@ -80,7 +80,7 @@
 }
 
 void RenderWidgetFeature::ProcessMessage(
-    scoped_ptr<BlimpMessage> message,
+    std::unique_ptr<BlimpMessage> message,
     const net::CompletionCallback& callback) {
   DCHECK(!callback.is_null());
   DCHECK(message->type() == BlimpMessage::RENDER_WIDGET ||
@@ -128,7 +128,7 @@
     const CompositorMessage& message) {
   int render_widget_id = message.render_widget_id();
 
-  scoped_ptr<cc::proto::CompositorMessage> payload(
+  std::unique_ptr<cc::proto::CompositorMessage> payload(
       new cc::proto::CompositorMessage);
   if (payload->ParseFromString(message.payload())) {
     delegate->OnCompositorMessageReceived(render_widget_id,
diff --git a/blimp/client/feature/render_widget_feature.h b/blimp/client/feature/render_widget_feature.h
index bda4cc0..43c5e920 100644
--- a/blimp/client/feature/render_widget_feature.h
+++ b/blimp/client/feature/render_widget_feature.h
@@ -8,10 +8,10 @@
 #include <stdint.h>
 
 #include <map>
+#include <memory>
 
 #include "base/containers/small_map.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "blimp/client/blimp_client_export.h"
 #include "blimp/net/blimp_message_processor.h"
 #include "blimp/net/input_message_generator.h"
@@ -56,7 +56,7 @@
     // be sent to the client's RemoteChannel of the compositor.
     virtual void OnCompositorMessageReceived(
         int render_widget_id,
-        scoped_ptr<cc::proto::CompositorMessage> message) = 0;
+        std::unique_ptr<cc::proto::CompositorMessage> message) = 0;
   };
 
   RenderWidgetFeature();
@@ -65,12 +65,12 @@
   // Set the BlimpMessageProcessor that will be used to send BlimpMessage::INPUT
   // messages to the engine.
   void set_outgoing_input_message_processor(
-      scoped_ptr<BlimpMessageProcessor> processor);
+      std::unique_ptr<BlimpMessageProcessor> processor);
 
   // Set the BlimpMessageProcessor that will be used to send
   // BlimpMessage::COMPOSITOR messages to the engine.
   void set_outgoing_compositor_message_processor(
-      scoped_ptr<BlimpMessageProcessor> processor);
+      std::unique_ptr<BlimpMessageProcessor> processor);
 
   // Sends a WebGestureEvent for |tab_id| to the engine.
   void SendWebGestureEvent(const int tab_id,
@@ -91,7 +91,7 @@
 
  private:
   // BlimpMessageProcessor implementation.
-  void ProcessMessage(scoped_ptr<BlimpMessage> message,
+  void ProcessMessage(std::unique_ptr<BlimpMessage> message,
                       const net::CompletionCallback& callback) override;
 
   void ProcessRenderWidgetMessage(
@@ -112,10 +112,10 @@
   InputMessageGenerator input_message_generator_;
 
   // Used to send BlimpMessage::INPUT type messages to the engine.
-  scoped_ptr<BlimpMessageProcessor> outgoing_input_message_processor_;
+  std::unique_ptr<BlimpMessageProcessor> outgoing_input_message_processor_;
 
   // Used to send BlimpMessage::COMPOSITOR messages to the engine.
-  scoped_ptr<BlimpMessageProcessor> outgoing_compositor_message_processor_;
+  std::unique_ptr<BlimpMessageProcessor> outgoing_compositor_message_processor_;
 
   DISALLOW_COPY_AND_ASSIGN(RenderWidgetFeature);
 };
diff --git a/blimp/client/feature/render_widget_feature_unittest.cc b/blimp/client/feature/render_widget_feature_unittest.cc
index 4852059..6a67329 100644
--- a/blimp/client/feature/render_widget_feature_unittest.cc
+++ b/blimp/client/feature/render_widget_feature_unittest.cc
@@ -4,8 +4,10 @@
 
 #include "blimp/client/feature/render_widget_feature.h"
 
+#include <memory>
+
 #include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
 #include "blimp/common/create_blimp_message.h"
 #include "blimp/common/proto/blimp_message.pb.h"
 #include "blimp/common/proto/compositor.pb.h"
@@ -41,7 +43,7 @@
   }
   void OnCompositorMessageReceived(
       int render_widget_id,
-      scoped_ptr<cc::proto::CompositorMessage> message) override {
+      std::unique_ptr<cc::proto::CompositorMessage> message) override {
     MockableOnCompositorMessageReceived(render_widget_id, *message);
   }
 
@@ -63,7 +65,7 @@
                              int rw_id,
                              RenderWidgetMessage::Type message_type) {
   RenderWidgetMessage* details;
-  scoped_ptr<BlimpMessage> message = CreateBlimpMessage(&details, tab_id);
+  std::unique_ptr<BlimpMessage> message = CreateBlimpMessage(&details, tab_id);
   details->set_type(message_type);
   details->set_render_widget_id(rw_id);
   net::TestCompletionCallback cb;
@@ -75,7 +77,7 @@
                            int tab_id,
                            int rw_id) {
   CompositorMessage* details;
-  scoped_ptr<BlimpMessage> message = CreateBlimpMessage(&details, tab_id);
+  std::unique_ptr<BlimpMessage> message = CreateBlimpMessage(&details, tab_id);
   details->set_render_widget_id(rw_id);
   net::TestCompletionCallback cb;
   processor->ProcessMessage(std::move(message), cb.callback());
@@ -93,9 +95,9 @@
     out_input_processor_ = new MockBlimpMessageProcessor();
     out_compositor_processor_ = new MockBlimpMessageProcessor();
     feature_.set_outgoing_input_message_processor(
-        make_scoped_ptr(out_input_processor_));
+        base::WrapUnique(out_input_processor_));
     feature_.set_outgoing_compositor_message_processor(
-        make_scoped_ptr(out_compositor_processor_));
+        base::WrapUnique(out_compositor_processor_));
 
     feature_.SetDelegate(1, &delegate1_);
     feature_.SetDelegate(2, &delegate2_);
diff --git a/blimp/client/feature/settings_feature.cc b/blimp/client/feature/settings_feature.cc
index 5c3e31ed..e38f3f0 100644
--- a/blimp/client/feature/settings_feature.cc
+++ b/blimp/client/feature/settings_feature.cc
@@ -17,7 +17,7 @@
 SettingsFeature::~SettingsFeature() {}
 
 void SettingsFeature::set_outgoing_message_processor(
-    scoped_ptr<BlimpMessageProcessor> processor) {
+    std::unique_ptr<BlimpMessageProcessor> processor) {
   outgoing_message_processor_ = std::move(processor);
 }
 
@@ -28,13 +28,13 @@
   record_whole_document_ = record_whole_document;
 
   EngineSettingsMessage* engine_settings;
-  scoped_ptr<BlimpMessage> message = CreateBlimpMessage(&engine_settings);
+  std::unique_ptr<BlimpMessage> message = CreateBlimpMessage(&engine_settings);
   engine_settings->set_record_whole_document(record_whole_document_);
   outgoing_message_processor_->ProcessMessage(std::move(message),
                                               net::CompletionCallback());
 }
 
-void SettingsFeature::ProcessMessage(scoped_ptr<BlimpMessage> message,
+void SettingsFeature::ProcessMessage(std::unique_ptr<BlimpMessage> message,
                                      const net::CompletionCallback& callback) {
   // We don't receive any messages from the engine yet.
   NOTREACHED() << "Invalid settings message received from the engine.";
diff --git a/blimp/client/feature/settings_feature.h b/blimp/client/feature/settings_feature.h
index eb114ac5..d722003 100644
--- a/blimp/client/feature/settings_feature.h
+++ b/blimp/client/feature/settings_feature.h
@@ -21,17 +21,17 @@
   // Set the BlimpMessageProcessor that will be used to send
   // BlimpMessage::SETTINGS messages to the engine.
   void set_outgoing_message_processor(
-      scoped_ptr<BlimpMessageProcessor> processor);
+      std::unique_ptr<BlimpMessageProcessor> processor);
 
   void SetRecordWholeDocument(bool record_whole_document);
 
  private:
   // BlimpMessageProcessor implementation.
-  void ProcessMessage(scoped_ptr<BlimpMessage> message,
+  void ProcessMessage(std::unique_ptr<BlimpMessage> message,
                       const net::CompletionCallback& callback) override;
 
   // Used to send BlimpMessage::TAB_CONTROL messages to the engine.
-  scoped_ptr<BlimpMessageProcessor> outgoing_message_processor_;
+  std::unique_ptr<BlimpMessageProcessor> outgoing_message_processor_;
 
   // Used to avoid sending unnecessary messages to engine.
   bool record_whole_document_;
diff --git a/blimp/client/feature/tab_control_feature.cc b/blimp/client/feature/tab_control_feature.cc
index c4cf7d1..25f61a9 100644
--- a/blimp/client/feature/tab_control_feature.cc
+++ b/blimp/client/feature/tab_control_feature.cc
@@ -18,7 +18,7 @@
 TabControlFeature::~TabControlFeature() {}
 
 void TabControlFeature::set_outgoing_message_processor(
-    scoped_ptr<BlimpMessageProcessor> processor) {
+    std::unique_ptr<BlimpMessageProcessor> processor) {
   outgoing_message_processor_ = std::move(processor);
 }
 
@@ -32,7 +32,7 @@
   last_device_pixel_ratio_ = device_pixel_ratio;
 
   SizeMessage* size_details;
-  scoped_ptr<BlimpMessage> message = CreateBlimpMessage(&size_details);
+  std::unique_ptr<BlimpMessage> message = CreateBlimpMessage(&size_details);
   size_details->set_width(size.width());
   size_details->set_height(size.height());
   size_details->set_device_pixel_ratio(device_pixel_ratio);
@@ -45,7 +45,7 @@
 
 void TabControlFeature::CreateTab(int tab_id) {
   TabControlMessage* tab_control;
-  scoped_ptr<BlimpMessage> message = CreateBlimpMessage(&tab_control);
+  std::unique_ptr<BlimpMessage> message = CreateBlimpMessage(&tab_control);
   tab_control->set_type(TabControlMessage::CREATE_TAB);
   outgoing_message_processor_->ProcessMessage(std::move(message),
                                               net::CompletionCallback());
@@ -53,14 +53,14 @@
 
 void TabControlFeature::CloseTab(int tab_id) {
   TabControlMessage* tab_control;
-  scoped_ptr<BlimpMessage> message = CreateBlimpMessage(&tab_control);
+  std::unique_ptr<BlimpMessage> message = CreateBlimpMessage(&tab_control);
   tab_control->set_type(TabControlMessage::CLOSE_TAB);
   outgoing_message_processor_->ProcessMessage(std::move(message),
                                               net::CompletionCallback());
 }
 
 void TabControlFeature::ProcessMessage(
-    scoped_ptr<BlimpMessage> message,
+    std::unique_ptr<BlimpMessage> message,
     const net::CompletionCallback& callback) {
   DCHECK(!callback.is_null());
   callback.Run(net::OK);
diff --git a/blimp/client/feature/tab_control_feature.h b/blimp/client/feature/tab_control_feature.h
index d5e9f80..0ae7481 100644
--- a/blimp/client/feature/tab_control_feature.h
+++ b/blimp/client/feature/tab_control_feature.h
@@ -5,8 +5,9 @@
 #ifndef BLIMP_CLIENT_FEATURE_TAB_CONTROL_FEATURE_H_
 #define BLIMP_CLIENT_FEATURE_TAB_CONTROL_FEATURE_H_
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "blimp/client/blimp_client_export.h"
 #include "blimp/net/blimp_message_processor.h"
 #include "ui/gfx/geometry/size.h"
@@ -26,7 +27,7 @@
   // Set the BlimpMessageProcessor that will be used to send
   // BlimpMessage::TAB_CONTROL messages to the engine.
   void set_outgoing_message_processor(
-      scoped_ptr<BlimpMessageProcessor> processor);
+      std::unique_ptr<BlimpMessageProcessor> processor);
 
   // Pushes the current size and scale information to the engine, which will
   // affect the web content display area for all tabs.
@@ -37,11 +38,11 @@
 
  private:
   // BlimpMessageProcessor implementation.
-  void ProcessMessage(scoped_ptr<BlimpMessage> message,
+  void ProcessMessage(std::unique_ptr<BlimpMessage> message,
                       const net::CompletionCallback& callback) override;
 
   // Used to send BlimpMessage::TAB_CONTROL messages to the engine.
-  scoped_ptr<BlimpMessageProcessor> outgoing_message_processor_;
+  std::unique_ptr<BlimpMessageProcessor> outgoing_message_processor_;
 
   // Used to avoid sending unnecessary messages to engine.
   gfx::Size last_size_;
diff --git a/blimp/client/feature/tab_control_feature_unittest.cc b/blimp/client/feature/tab_control_feature_unittest.cc
index b2faa1b..701346d8 100644
--- a/blimp/client/feature/tab_control_feature_unittest.cc
+++ b/blimp/client/feature/tab_control_feature_unittest.cc
@@ -4,8 +4,10 @@
 
 #include "blimp/client/feature/tab_control_feature.h"
 
+#include <memory>
+
 #include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
 #include "blimp/common/proto/blimp_message.pb.h"
 #include "blimp/common/proto/tab_control.pb.h"
 #include "blimp/net/test_common.h"
@@ -32,7 +34,7 @@
 
   void SetUp() override {
     out_processor_ = new MockBlimpMessageProcessor();
-    feature_.set_outgoing_message_processor(make_scoped_ptr(out_processor_));
+    feature_.set_outgoing_message_processor(base::WrapUnique(out_processor_));
   }
 
  protected:
diff --git a/blimp/client/session/assignment_source.cc b/blimp/client/session/assignment_source.cc
index acec23b2..f22e554 100644
--- a/blimp/client/session/assignment_source.cc
+++ b/blimp/client/session/assignment_source.cc
@@ -79,13 +79,13 @@
   ~SimpleURLRequestContextGetter() override {}
 
   scoped_refptr<base::SingleThreadTaskRunner> io_loop_task_runner_;
-  scoped_ptr<net::URLRequestContext> url_request_context_;
+  std::unique_ptr<net::URLRequestContext> url_request_context_;
 
   // Temporary storage for the ProxyConfigService, which needs to be created on
   // the main thread but cleared on the IO thread.  This will be built in the
   // constructor and cleared on the IO thread.  Due to the usage of this class
   // this is safe.
-  scoped_ptr<net::ProxyConfigService> proxy_config_service_;
+  std::unique_ptr<net::ProxyConfigService> proxy_config_service_;
 
   DISALLOW_COPY_AND_ASSIGN(SimpleURLRequestContextGetter);
 };
@@ -315,7 +315,7 @@
                  weak_factory_.GetWeakPtr()));
 }
 
-void AssignmentSource::OnJsonParsed(scoped_ptr<base::Value> json) {
+void AssignmentSource::OnJsonParsed(std::unique_ptr<base::Value> json) {
   const base::DictionaryValue* dict;
   if (!json->GetAsDictionary(&dict)) {
     base::ResetAndReturn(&callback_)
diff --git a/blimp/client/session/assignment_source.h b/blimp/client/session/assignment_source.h
index 9d6f60ec..a5ab358c 100644
--- a/blimp/client/session/assignment_source.h
+++ b/blimp/client/session/assignment_source.h
@@ -111,7 +111,7 @@
                                           Assignment parsed_assignment);
   void QueryAssigner(const std::string& client_auth_token);
   void ParseAssignerResponse();
-  void OnJsonParsed(scoped_ptr<base::Value> json);
+  void OnJsonParsed(std::unique_ptr<base::Value> json);
   void OnJsonParseError(const std::string& error);
 
   // net::URLFetcherDelegate implementation:
@@ -123,7 +123,7 @@
   const GURL assigner_endpoint_;
   scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_;
   scoped_refptr<net::URLRequestContextGetter> url_request_context_;
-  scoped_ptr<net::URLFetcher> url_fetcher_;
+  std::unique_ptr<net::URLFetcher> url_fetcher_;
 
   base::WeakPtrFactory<AssignmentSource> weak_factory_;
 
diff --git a/blimp/client/session/assignment_source_unittest.cc b/blimp/client/session/assignment_source_unittest.cc
index a2a69a55..440b4dfe 100644
--- a/blimp/client/session/assignment_source_unittest.cc
+++ b/blimp/client/session/assignment_source_unittest.cc
@@ -114,7 +114,7 @@
     EXPECT_EQ(kAssignerUrl, fetcher->GetOriginalURL().spec());
 
     // Check that the request has a valid protocol_version.
-    scoped_ptr<base::Value> json =
+    std::unique_ptr<base::Value> json =
         base::JSONReader::Read(fetcher->upload_data());
     EXPECT_NE(nullptr, json.get());
 
@@ -150,7 +150,7 @@
   Assignment BuildSslAssignment();
 
   // Builds simulated JSON response from the Assigner service.
-  scoped_ptr<base::DictionaryValue> BuildAssignerResponse();
+  std::unique_ptr<base::DictionaryValue> BuildAssignerResponse();
 
   // Used to drive all AssignmentSource tasks.
   // MessageLoop is required by TestingJsonParser's self-deletion logic.
@@ -185,9 +185,9 @@
   return assignment;
 }
 
-scoped_ptr<base::DictionaryValue>
+std::unique_ptr<base::DictionaryValue>
 AssignmentSourceTest::BuildAssignerResponse() {
-  scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
+  std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
   dict->SetString("clientToken", kTestClientToken);
   dict->SetString("host", kTestIpAddressString);
   dict->SetInteger("port", kTestPort);
@@ -342,7 +342,7 @@
 }
 
 TEST_F(AssignmentSourceTest, TestMissingResponsePort) {
-  scoped_ptr<base::DictionaryValue> response = BuildAssignerResponse();
+  std::unique_ptr<base::DictionaryValue> response = BuildAssignerResponse();
   response->Remove("port", nullptr);
   EXPECT_CALL(*this, AssignmentResponse(
                          AssignmentSource::Result::RESULT_BAD_RESPONSE, _));
@@ -352,7 +352,7 @@
 }
 
 TEST_F(AssignmentSourceTest, TestInvalidIPAddress) {
-  scoped_ptr<base::DictionaryValue> response = BuildAssignerResponse();
+  std::unique_ptr<base::DictionaryValue> response = BuildAssignerResponse();
   response->SetString("host", "happywhales.test");
 
   EXPECT_CALL(*this, AssignmentResponse(
@@ -363,7 +363,7 @@
 }
 
 TEST_F(AssignmentSourceTest, TestMissingCert) {
-  scoped_ptr<base::DictionaryValue> response = BuildAssignerResponse();
+  std::unique_ptr<base::DictionaryValue> response = BuildAssignerResponse();
   response->Remove("certificate", nullptr);
   EXPECT_CALL(*this, AssignmentResponse(
                          AssignmentSource::Result::RESULT_BAD_RESPONSE, _));
@@ -373,7 +373,7 @@
 }
 
 TEST_F(AssignmentSourceTest, TestInvalidCert) {
-  scoped_ptr<base::DictionaryValue> response = BuildAssignerResponse();
+  std::unique_ptr<base::DictionaryValue> response = BuildAssignerResponse();
   response->SetString("certificate", "h4x0rz!");
   EXPECT_CALL(*this, AssignmentResponse(
                          AssignmentSource::Result::RESULT_INVALID_CERT, _));
diff --git a/blimp/client/session/blimp_client_session.cc b/blimp/client/session/blimp_client_session.cc
index ee533e8..f6a8c0a8 100644
--- a/blimp/client/session/blimp_client_session.cc
+++ b/blimp/client/session/blimp_client_session.cc
@@ -7,6 +7,7 @@
 #include <vector>
 
 #include "base/command_line.h"
+#include "base/memory/ptr_util.h"
 #include "base/numerics/safe_conversions.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/thread_task_runner_handle.h"
@@ -71,7 +72,8 @@
                                 public ConnectionErrorObserver {
  public:
   // Can be created on any thread.
-  explicit ClientNetworkComponents(scoped_ptr<NetworkEventObserver> observer);
+  explicit ClientNetworkComponents(
+      std::unique_ptr<NetworkEventObserver> observer);
   ~ClientNetworkComponents() override;
 
   // Sets up network components.
@@ -85,20 +87,20 @@
 
  private:
   // ConnectionHandler implementation.
-  void HandleConnection(scoped_ptr<BlimpConnection> connection) override;
+  void HandleConnection(std::unique_ptr<BlimpConnection> connection) override;
 
   // ConnectionErrorObserver implementation.
   void OnConnectionError(int error) override;
 
-  scoped_ptr<BrowserConnectionHandler> connection_handler_;
-  scoped_ptr<ClientConnectionManager> connection_manager_;
-  scoped_ptr<NetworkEventObserver> network_observer_;
+  std::unique_ptr<BrowserConnectionHandler> connection_handler_;
+  std::unique_ptr<ClientConnectionManager> connection_manager_;
+  std::unique_ptr<NetworkEventObserver> network_observer_;
 
   DISALLOW_COPY_AND_ASSIGN(ClientNetworkComponents);
 };
 
 ClientNetworkComponents::ClientNetworkComponents(
-    scoped_ptr<NetworkEventObserver> network_observer)
+    std::unique_ptr<NetworkEventObserver> network_observer)
     : connection_handler_(new BrowserConnectionHandler),
       network_observer_(std::move(network_observer)) {}
 
@@ -106,7 +108,7 @@
 
 void ClientNetworkComponents::Initialize() {
   DCHECK(!connection_manager_);
-  connection_manager_ = make_scoped_ptr(new ClientConnectionManager(this));
+  connection_manager_ = base::WrapUnique(new ClientConnectionManager(this));
 }
 
 void ClientNetworkComponents::ConnectWithAssignment(
@@ -117,11 +119,11 @@
   switch (assignment.transport_protocol) {
     case Assignment::SSL:
       DCHECK(assignment.cert);
-      connection_manager_->AddTransport(make_scoped_ptr(new SSLClientTransport(
+      connection_manager_->AddTransport(base::WrapUnique(new SSLClientTransport(
           assignment.engine_endpoint, std::move(assignment.cert), nullptr)));
       break;
     case Assignment::TCP:
-      connection_manager_->AddTransport(make_scoped_ptr(
+      connection_manager_->AddTransport(base::WrapUnique(
           new TCPClientTransport(assignment.engine_endpoint, nullptr)));
       break;
     case Assignment::UNKNOWN:
@@ -138,7 +140,7 @@
 }
 
 void ClientNetworkComponents::HandleConnection(
-    scoped_ptr<BlimpConnection> connection) {
+    std::unique_ptr<BlimpConnection> connection) {
   connection->AddConnectionErrorObserver(this);
   network_observer_->OnConnected();
   connection_handler_->HandleConnection(std::move(connection));
@@ -157,7 +159,7 @@
       settings_feature_(new SettingsFeature),
       weak_factory_(this) {
   net_components_.reset(new ClientNetworkComponents(
-      make_scoped_ptr(new CrossThreadNetworkEventObserver(
+      base::WrapUnique(new CrossThreadNetworkEventObserver(
           weak_factory_.GetWeakPtr(),
           base::SequencedTaskRunnerHandle::Get()))));
   base::Thread::Options options;
@@ -205,7 +207,7 @@
     AssignmentSource::Result result) {}
 
 void BlimpClientSession::RegisterFeatures() {
-  thread_pipe_manager_ = make_scoped_ptr(new ThreadPipeManager(
+  thread_pipe_manager_ = base::WrapUnique(new ThreadPipeManager(
       io_thread_.task_runner(), base::SequencedTaskRunnerHandle::Get(),
       net_components_->GetBrowserConnectionHandler()));
 
diff --git a/blimp/client/session/blimp_client_session.h b/blimp/client/session/blimp_client_session.h
index d78f5bf..6fd751a 100644
--- a/blimp/client/session/blimp_client_session.h
+++ b/blimp/client/session/blimp_client_session.h
@@ -5,11 +5,11 @@
 #ifndef BLIMP_CLIENT_SESSION_BLIMP_CLIENT_SESSION_H_
 #define BLIMP_CLIENT_SESSION_BLIMP_CLIENT_SESSION_H_
 
+#include <memory>
 #include <string>
 
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/threading/thread.h"
 #include "blimp/client/blimp_client_export.h"
 #include "blimp/client/session/assignment_source.h"
@@ -90,21 +90,21 @@
   void OnDisconnected(int result) override;
 
   base::Thread io_thread_;
-  scoped_ptr<TabControlFeature> tab_control_feature_;
-  scoped_ptr<NavigationFeature> navigation_feature_;
-  scoped_ptr<ImeFeature> ime_feature_;
-  scoped_ptr<RenderWidgetFeature> render_widget_feature_;
-  scoped_ptr<SettingsFeature> settings_feature_;
+  std::unique_ptr<TabControlFeature> tab_control_feature_;
+  std::unique_ptr<NavigationFeature> navigation_feature_;
+  std::unique_ptr<ImeFeature> ime_feature_;
+  std::unique_ptr<RenderWidgetFeature> render_widget_feature_;
+  std::unique_ptr<SettingsFeature> settings_feature_;
 
   // The AssignmentSource is used when the user of BlimpClientSession calls
   // Connect() to get a valid assignment and later connect to the engine.
-  scoped_ptr<AssignmentSource> assignment_source_;
+  std::unique_ptr<AssignmentSource> assignment_source_;
 
   // Container struct for network components.
   // Must be deleted on the IO thread.
-  scoped_ptr<ClientNetworkComponents> net_components_;
+  std::unique_ptr<ClientNetworkComponents> net_components_;
 
-  scoped_ptr<ThreadPipeManager> thread_pipe_manager_;
+  std::unique_ptr<ThreadPipeManager> thread_pipe_manager_;
 
   base::WeakPtrFactory<BlimpClientSession> weak_factory_;
 
diff --git a/blimp/common/compositor/blimp_image_serialization_processor.h b/blimp/common/compositor/blimp_image_serialization_processor.h
index 040f2455..9deb15bd 100644
--- a/blimp/common/compositor/blimp_image_serialization_processor.h
+++ b/blimp/common/compositor/blimp_image_serialization_processor.h
@@ -5,8 +5,9 @@
 #ifndef BLIMP_COMMON_COMPOSITOR_BLIMP_IMAGE_SERIALIZATION_PROCESSOR_H_
 #define BLIMP_COMMON_COMPOSITOR_BLIMP_IMAGE_SERIALIZATION_PROCESSOR_H_
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "blimp/common/blimp_common_export.h"
 #include "cc/proto/image_serialization_processor.h"
 #include "third_party/skia/include/core/SkPicture.h"
@@ -31,7 +32,7 @@
   SkPicture::InstallPixelRefProc GetPixelDeserializer() override;
 
  private:
-  scoped_ptr<SkPixelSerializer> pixel_serializer_;
+  std::unique_ptr<SkPixelSerializer> pixel_serializer_;
   SkPicture::InstallPixelRefProc pixel_deserializer_;
 
   DISALLOW_COPY_AND_ASSIGN(BlimpImageSerializationProcessor);
diff --git a/blimp/common/create_blimp_message.cc b/blimp/common/create_blimp_message.cc
index 3c1eb70..43d4377 100644
--- a/blimp/common/create_blimp_message.cc
+++ b/blimp/common/create_blimp_message.cc
@@ -4,8 +4,9 @@
 
 #include "blimp/common/create_blimp_message.h"
 
+#include <memory>
+
 #include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
 #include "blimp/common/proto/blimp_message.pb.h"
 #include "blimp/common/proto/compositor.pb.h"
 #include "blimp/common/proto/input.pb.h"
@@ -15,88 +16,88 @@
 
 namespace blimp {
 
-scoped_ptr<BlimpMessage> CreateBlimpMessage(
+std::unique_ptr<BlimpMessage> CreateBlimpMessage(
     CompositorMessage** compositor_message,
     int target_tab_id) {
   DCHECK(compositor_message);
-  scoped_ptr<BlimpMessage> output(new BlimpMessage);
+  std::unique_ptr<BlimpMessage> output(new BlimpMessage);
   output->set_type(BlimpMessage::COMPOSITOR);
   output->set_target_tab_id(target_tab_id);
   *compositor_message = output->mutable_compositor();
   return output;
 }
 
-scoped_ptr<BlimpMessage> CreateBlimpMessage(
+std::unique_ptr<BlimpMessage> CreateBlimpMessage(
     TabControlMessage** control_message) {
   DCHECK(control_message);
-  scoped_ptr<BlimpMessage> output(new BlimpMessage);
+  std::unique_ptr<BlimpMessage> output(new BlimpMessage);
   output->set_type(BlimpMessage::TAB_CONTROL);
   *control_message = output->mutable_tab_control();
   return output;
 }
 
-scoped_ptr<BlimpMessage> CreateBlimpMessage(InputMessage** input_message) {
+std::unique_ptr<BlimpMessage> CreateBlimpMessage(InputMessage** input_message) {
   DCHECK(input_message);
-  scoped_ptr<BlimpMessage> output(new BlimpMessage);
+  std::unique_ptr<BlimpMessage> output(new BlimpMessage);
   output->set_type(BlimpMessage::INPUT);
   *input_message = output->mutable_input();
   return output;
 }
 
-scoped_ptr<BlimpMessage> CreateBlimpMessage(
+std::unique_ptr<BlimpMessage> CreateBlimpMessage(
     NavigationMessage** navigation_message,
     int target_tab_id) {
   DCHECK(navigation_message);
-  scoped_ptr<BlimpMessage> output(new BlimpMessage);
+  std::unique_ptr<BlimpMessage> output(new BlimpMessage);
   output->set_type(BlimpMessage::NAVIGATION);
   output->set_target_tab_id(target_tab_id);
   *navigation_message = output->mutable_navigation();
   return output;
 }
 
-scoped_ptr<BlimpMessage> CreateBlimpMessage(ImeMessage** ime_message,
-                                            int target_tab_id) {
+std::unique_ptr<BlimpMessage> CreateBlimpMessage(ImeMessage** ime_message,
+                                                 int target_tab_id) {
   DCHECK(ime_message);
-  scoped_ptr<BlimpMessage> output(new BlimpMessage);
+  std::unique_ptr<BlimpMessage> output(new BlimpMessage);
   output->set_type(BlimpMessage::IME);
   output->set_target_tab_id(target_tab_id);
   *ime_message = output->mutable_ime();
   return output;
 }
 
-scoped_ptr<BlimpMessage> CreateBlimpMessage(
+std::unique_ptr<BlimpMessage> CreateBlimpMessage(
     RenderWidgetMessage** render_widget_message,
     int target_tab_id) {
   DCHECK(render_widget_message);
-  scoped_ptr<BlimpMessage> output(new BlimpMessage);
+  std::unique_ptr<BlimpMessage> output(new BlimpMessage);
   output->set_type(BlimpMessage::RENDER_WIDGET);
   output->set_target_tab_id(target_tab_id);
   *render_widget_message = output->mutable_render_widget();
   return output;
 }
 
-scoped_ptr<BlimpMessage> CreateBlimpMessage(SizeMessage** size_message) {
+std::unique_ptr<BlimpMessage> CreateBlimpMessage(SizeMessage** size_message) {
   DCHECK(size_message);
   TabControlMessage* control_message;
-  scoped_ptr<BlimpMessage> output = CreateBlimpMessage(&control_message);
+  std::unique_ptr<BlimpMessage> output = CreateBlimpMessage(&control_message);
   control_message->set_type(TabControlMessage::SIZE);
   *size_message = control_message->mutable_size();
   return output;
 }
 
-scoped_ptr<BlimpMessage> CreateBlimpMessage(
+std::unique_ptr<BlimpMessage> CreateBlimpMessage(
     EngineSettingsMessage** engine_settings) {
   DCHECK(engine_settings);
-  scoped_ptr<BlimpMessage> output(new BlimpMessage);
+  std::unique_ptr<BlimpMessage> output(new BlimpMessage);
   output->set_type(BlimpMessage::SETTINGS);
   *engine_settings = output->mutable_settings()->mutable_engine_settings();
   return output;
 }
 
-scoped_ptr<BlimpMessage> CreateStartConnectionMessage(
+std::unique_ptr<BlimpMessage> CreateStartConnectionMessage(
     const std::string& client_token,
     int protocol_version) {
-  scoped_ptr<BlimpMessage> output(new BlimpMessage);
+  std::unique_ptr<BlimpMessage> output(new BlimpMessage);
   output->set_type(BlimpMessage::PROTOCOL_CONTROL);
 
   ProtocolControlMessage* control_message = output->mutable_protocol_control();
@@ -110,8 +111,9 @@
   return output;
 }
 
-scoped_ptr<BlimpMessage> CreateCheckpointAckMessage(int64_t checkpoint_id) {
-  scoped_ptr<BlimpMessage> output(new BlimpMessage);
+std::unique_ptr<BlimpMessage> CreateCheckpointAckMessage(
+    int64_t checkpoint_id) {
+  std::unique_ptr<BlimpMessage> output(new BlimpMessage);
   output->set_type(BlimpMessage::PROTOCOL_CONTROL);
 
   ProtocolControlMessage* control_message = output->mutable_protocol_control();
diff --git a/blimp/common/create_blimp_message.h b/blimp/common/create_blimp_message.h
index 87086353..ab8a16d 100644
--- a/blimp/common/create_blimp_message.h
+++ b/blimp/common/create_blimp_message.h
@@ -7,9 +7,9 @@
 
 #include <stdint.h>
 
+#include <memory>
 #include <string>
 
-#include "base/memory/scoped_ptr.h"
 #include "blimp/common/blimp_common_export.h"
 
 namespace blimp {
@@ -38,39 +38,39 @@
 // Additional initialization arguments may be taken depending on the
 // message type.
 
-BLIMP_COMMON_EXPORT scoped_ptr<BlimpMessage> CreateBlimpMessage(
+BLIMP_COMMON_EXPORT std::unique_ptr<BlimpMessage> CreateBlimpMessage(
     CompositorMessage** compositor_message,
     int target_tab_id);
 
-BLIMP_COMMON_EXPORT scoped_ptr<BlimpMessage> CreateBlimpMessage(
+BLIMP_COMMON_EXPORT std::unique_ptr<BlimpMessage> CreateBlimpMessage(
     TabControlMessage** control_message);
 
-BLIMP_COMMON_EXPORT scoped_ptr<BlimpMessage> CreateBlimpMessage(
+BLIMP_COMMON_EXPORT std::unique_ptr<BlimpMessage> CreateBlimpMessage(
     InputMessage** input_message);
 
-BLIMP_COMMON_EXPORT scoped_ptr<BlimpMessage> CreateBlimpMessage(
+BLIMP_COMMON_EXPORT std::unique_ptr<BlimpMessage> CreateBlimpMessage(
     NavigationMessage** navigation_message,
     int target_tab_id);
 
-BLIMP_COMMON_EXPORT scoped_ptr<BlimpMessage> CreateBlimpMessage(
+BLIMP_COMMON_EXPORT std::unique_ptr<BlimpMessage> CreateBlimpMessage(
     ImeMessage** ime_message,
     int target_tab_id);
 
-BLIMP_COMMON_EXPORT scoped_ptr<BlimpMessage> CreateBlimpMessage(
+BLIMP_COMMON_EXPORT std::unique_ptr<BlimpMessage> CreateBlimpMessage(
     RenderWidgetMessage** render_widget_message,
     int target_tab_id);
 
-BLIMP_COMMON_EXPORT scoped_ptr<BlimpMessage> CreateBlimpMessage(
+BLIMP_COMMON_EXPORT std::unique_ptr<BlimpMessage> CreateBlimpMessage(
     SizeMessage** size_message);
 
-BLIMP_COMMON_EXPORT scoped_ptr<BlimpMessage> CreateBlimpMessage(
+BLIMP_COMMON_EXPORT std::unique_ptr<BlimpMessage> CreateBlimpMessage(
     EngineSettingsMessage** engine_settings);
 
-BLIMP_COMMON_EXPORT scoped_ptr<BlimpMessage> CreateStartConnectionMessage(
+BLIMP_COMMON_EXPORT std::unique_ptr<BlimpMessage> CreateStartConnectionMessage(
     const std::string& client_token,
     int protocol_version);
 
-BLIMP_COMMON_EXPORT scoped_ptr<BlimpMessage> CreateCheckpointAckMessage(
+BLIMP_COMMON_EXPORT std::unique_ptr<BlimpMessage> CreateCheckpointAckMessage(
     int64_t checkpoint_id);
 
 }  // namespace blimp
diff --git a/blimp/common/create_blimp_message_unittest.cc b/blimp/common/create_blimp_message_unittest.cc
index 752f1ff..d2b57dc54 100644
--- a/blimp/common/create_blimp_message_unittest.cc
+++ b/blimp/common/create_blimp_message_unittest.cc
@@ -18,7 +18,7 @@
 
 TEST(CreateBlimpMessageTest, CompositorMessage) {
   CompositorMessage* details = nullptr;
-  scoped_ptr<BlimpMessage> message = CreateBlimpMessage(&details, kTabId);
+  std::unique_ptr<BlimpMessage> message = CreateBlimpMessage(&details, kTabId);
   EXPECT_NE(nullptr, details);
   EXPECT_NE(nullptr, message);
   EXPECT_EQ(details, message->mutable_compositor());
@@ -27,7 +27,7 @@
 
 TEST(CreateBlimpMessageTest, TabControlMessage) {
   TabControlMessage* details = nullptr;
-  scoped_ptr<BlimpMessage> message = CreateBlimpMessage(&details);
+  std::unique_ptr<BlimpMessage> message = CreateBlimpMessage(&details);
   EXPECT_NE(nullptr, details);
   EXPECT_NE(nullptr, message);
   EXPECT_EQ(details, message->mutable_tab_control());
@@ -35,7 +35,7 @@
 
 TEST(CreateBlimpMessageTest, InputMessage) {
   InputMessage* details = nullptr;
-  scoped_ptr<BlimpMessage> message = CreateBlimpMessage(&details);
+  std::unique_ptr<BlimpMessage> message = CreateBlimpMessage(&details);
   EXPECT_NE(nullptr, details);
   EXPECT_NE(nullptr, message);
   EXPECT_EQ(details, message->mutable_input());
@@ -43,7 +43,7 @@
 
 TEST(CreateBlimpMessageTest, NavigationMessage) {
   NavigationMessage* details = nullptr;
-  scoped_ptr<BlimpMessage> message = CreateBlimpMessage(&details, kTabId);
+  std::unique_ptr<BlimpMessage> message = CreateBlimpMessage(&details, kTabId);
   EXPECT_NE(nullptr, details);
   EXPECT_NE(nullptr, message);
   EXPECT_EQ(details, message->mutable_navigation());
@@ -52,7 +52,7 @@
 
 TEST(CreateBlimpMessageTest, RenderWidgetMessage) {
   RenderWidgetMessage* details = nullptr;
-  scoped_ptr<BlimpMessage> message = CreateBlimpMessage(&details, kTabId);
+  std::unique_ptr<BlimpMessage> message = CreateBlimpMessage(&details, kTabId);
   EXPECT_NE(nullptr, details);
   EXPECT_NE(nullptr, message);
   EXPECT_EQ(details, message->mutable_render_widget());
@@ -61,7 +61,7 @@
 
 TEST(CreateBlimpMessageTest, SizeMessage) {
   SizeMessage* details = nullptr;
-  scoped_ptr<BlimpMessage> message = CreateBlimpMessage(&details);
+  std::unique_ptr<BlimpMessage> message = CreateBlimpMessage(&details);
   EXPECT_NE(nullptr, details);
   EXPECT_NE(nullptr, message);
   EXPECT_EQ(TabControlMessage::SIZE, message->mutable_tab_control()->type());
@@ -70,7 +70,7 @@
 
 TEST(CreateBlimpMessageTest, EngineSettingsMessage) {
   EngineSettingsMessage* details;
-  scoped_ptr<BlimpMessage> message = CreateBlimpMessage(&details);
+  std::unique_ptr<BlimpMessage> message = CreateBlimpMessage(&details);
   EXPECT_NE(nullptr, details);
   EXPECT_NE(nullptr, message);
   EXPECT_EQ(details, message->mutable_settings()->mutable_engine_settings());
@@ -79,7 +79,7 @@
 TEST(CreateBlimpMessageTest, StartConnectionMessage) {
   const char* client_token = "token";
   const int protocol_version = 1;
-  scoped_ptr<BlimpMessage> message =
+  std::unique_ptr<BlimpMessage> message =
       CreateStartConnectionMessage(client_token, protocol_version);
   EXPECT_NE(nullptr, message);
   EXPECT_EQ(BlimpMessage::PROTOCOL_CONTROL, message->type());
diff --git a/blimp/common/logging.cc b/blimp/common/logging.cc
index 07954c6c..d10adbd 100644
--- a/blimp/common/logging.cc
+++ b/blimp/common/logging.cc
@@ -11,6 +11,7 @@
 #include "base/format_macros.h"
 #include "base/json/string_escape.h"
 #include "base/lazy_instance.h"
+#include "base/memory/ptr_util.h"
 #include "base/strings/string_util.h"
 #include "base/strings/stringprintf.h"
 #include "blimp/common/proto/blimp_message.pb.h"
@@ -242,24 +243,24 @@
 
 BlimpMessageLogger::BlimpMessageLogger() {
   AddHandler("COMPOSITOR", BlimpMessage::COMPOSITOR,
-             make_scoped_ptr(new CompositorLogExtractor));
+             base::WrapUnique(new CompositorLogExtractor));
   AddHandler("INPUT", BlimpMessage::INPUT,
-             make_scoped_ptr(new InputLogExtractor));
+             base::WrapUnique(new InputLogExtractor));
   AddHandler("NAVIGATION", BlimpMessage::NAVIGATION,
-             make_scoped_ptr(new NavigationLogExtractor));
+             base::WrapUnique(new NavigationLogExtractor));
   AddHandler("PROTOCOL_CONTROL", BlimpMessage::PROTOCOL_CONTROL,
-             make_scoped_ptr(new ProtocolControlLogExtractor));
+             base::WrapUnique(new ProtocolControlLogExtractor));
   AddHandler("RENDER_WIDGET", BlimpMessage::RENDER_WIDGET,
-             make_scoped_ptr(new RenderWidgetLogExtractor));
+             base::WrapUnique(new RenderWidgetLogExtractor));
   AddHandler("TAB_CONTROL", BlimpMessage::TAB_CONTROL,
-             make_scoped_ptr(new TabControlLogExtractor));
+             base::WrapUnique(new TabControlLogExtractor));
 }
 
 BlimpMessageLogger::~BlimpMessageLogger() {}
 
 void BlimpMessageLogger::AddHandler(const std::string& type_name,
                                     BlimpMessage::Type type,
-                                    scoped_ptr<LogExtractor> extractor) {
+                                    std::unique_ptr<LogExtractor> extractor) {
   DCHECK(extractors_.find(type) == extractors_.end());
   DCHECK(!type_name.empty());
   extractors_[type] = make_pair(type_name, std::move(extractor));
diff --git a/blimp/common/logging.h b/blimp/common/logging.h
index 4f560db..e53f333 100644
--- a/blimp/common/logging.h
+++ b/blimp/common/logging.h
@@ -6,12 +6,12 @@
 #define BLIMP_COMMON_LOGGING_H_
 
 #include <map>
+#include <memory>
 #include <string>
 #include <utility>
 #include <vector>
 
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "blimp/common/blimp_common_export.h"
 #include "blimp/common/proto/blimp_message.pb.h"
 
@@ -48,11 +48,12 @@
   // |type_name|: The human readable name of |type|.
   void AddHandler(const std::string& type_name,
                   BlimpMessage::Type type,
-                  scoped_ptr<LogExtractor> extractor);
+                  std::unique_ptr<LogExtractor> extractor);
 
   // Registry of log extractors. Map structure is:
   // {message type => (human readable message type, LogExtractor*)}
-  std::map<BlimpMessage::Type, std::pair<std::string, scoped_ptr<LogExtractor>>>
+  std::map<BlimpMessage::Type,
+           std::pair<std::string, std::unique_ptr<LogExtractor>>>
       extractors_;
 
   DISALLOW_COPY_AND_ASSIGN(BlimpMessageLogger);
diff --git a/blimp/engine/BUILD.gn b/blimp/engine/BUILD.gn
index 7a00a81..76ddb68 100644
--- a/blimp/engine/BUILD.gn
+++ b/blimp/engine/BUILD.gn
@@ -5,6 +5,7 @@
 import("//build/config/features.gni")
 import("//build/config/sanitizers/sanitizers.gni")
 import("//build/config/ui.gni")
+import("//mojo/public/tools/bindings/mojom.gni")
 import("//tools/grit/repack.gni")
 import("//tools/grit/grit_rule.gni")
 
@@ -72,7 +73,9 @@
 
   deps = [
     ":app_ui",
+    ":blob_channel",
     ":common",
+    ":renderer",
     ":session",
     "//base",
     "//blimp/common/proto",
@@ -146,6 +149,23 @@
   ]
 }
 
+source_set("renderer") {
+  sources = [
+    "renderer/engine_image_serialization_processor.cc",
+    "renderer/engine_image_serialization_processor.h",
+  ]
+
+  deps = [
+    ":blob_channel_mojo",
+    "//base",
+    "//cc",
+    "//skia",
+    "//third_party/libwebp",
+    "//ui/gfx/geometry",
+    "//ui/gl",
+  ]
+}
+
 source_set("session") {
   sources = [
     "session/blimp_engine_session.cc",
@@ -163,6 +183,23 @@
   ]
 }
 
+# Implements the browser portions of the Mojo bridge to BlobChannel.
+source_set("blob_channel") {
+  sources = [
+    "mojo/blob_channel_service.cc",
+    "mojo/blob_channel_service.h",
+  ]
+  deps = [
+    ":blob_channel_mojo",
+  ]
+}
+
+mojom("blob_channel_mojo") {
+  sources = [
+    "mojo/blob_channel.mojom",
+  ]
+}
+
 source_set("app_unit_tests") {
   testonly = true
 
diff --git a/blimp/engine/DEPS b/blimp/engine/DEPS
index 5c16370..e64143af 100644
--- a/blimp/engine/DEPS
+++ b/blimp/engine/DEPS
@@ -5,6 +5,7 @@
   "+components/version_info",
   "+components/web_cache/renderer",
   "+content/public",
+  "+mojo/public",
   "+net",
   "+third_party/blimp_fonts",
   "+third_party/khronos/GLES2/gl2.h",
diff --git a/blimp/engine/app/blimp_browser_main_parts.cc b/blimp/engine/app/blimp_browser_main_parts.cc
index dc21560..c37d2cd0 100644
--- a/blimp/engine/app/blimp_browser_main_parts.cc
+++ b/blimp/engine/app/blimp_browser_main_parts.cc
@@ -40,7 +40,7 @@
 void BlimpBrowserMainParts::PreMainMessageLoopRun() {
   net_log_.reset(new net::NetLog());
   settings_manager_.reset(new SettingsManager);
-  scoped_ptr<BlimpBrowserContext> browser_context(
+  std::unique_ptr<BlimpBrowserContext> browser_context(
       new BlimpBrowserContext(false, net_log_.get()));
   engine_session_.reset(
       new BlimpEngineSession(std::move(browser_context), net_log_.get(),
diff --git a/blimp/engine/app/blimp_browser_main_parts.h b/blimp/engine/app/blimp_browser_main_parts.h
index 2262119f..81c4891 100644
--- a/blimp/engine/app/blimp_browser_main_parts.h
+++ b/blimp/engine/app/blimp_browser_main_parts.h
@@ -5,8 +5,9 @@
 #ifndef BLIMP_ENGINE_APP_BLIMP_BROWSER_MAIN_PARTS_H_
 #define BLIMP_ENGINE_APP_BLIMP_BROWSER_MAIN_PARTS_H_
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "content/public/browser/browser_main_parts.h"
 #include "content/public/common/main_function_params.h"
 
@@ -40,10 +41,10 @@
   SettingsManager* GetSettingsManager();
 
  private:
-  scoped_ptr<BlimpEngineConfig> engine_config_;
-  scoped_ptr<net::NetLog> net_log_;
-  scoped_ptr<SettingsManager> settings_manager_;
-  scoped_ptr<BlimpEngineSession> engine_session_;
+  std::unique_ptr<BlimpEngineConfig> engine_config_;
+  std::unique_ptr<net::NetLog> net_log_;
+  std::unique_ptr<SettingsManager> settings_manager_;
+  std::unique_ptr<BlimpEngineSession> engine_session_;
 
   DISALLOW_COPY_AND_ASSIGN(BlimpBrowserMainParts);
 };
diff --git a/blimp/engine/app/blimp_content_browser_client.cc b/blimp/engine/app/blimp_content_browser_client.cc
index b10ad1a..55fcb17 100644
--- a/blimp/engine/app/blimp_content_browser_client.cc
+++ b/blimp/engine/app/blimp_content_browser_client.cc
@@ -6,6 +6,8 @@
 #include "blimp/engine/app/blimp_browser_main_parts.h"
 #include "blimp/engine/app/settings_manager.h"
 #include "blimp/engine/common/blimp_browser_context.h"
+#include "blimp/engine/mojo/blob_channel_service.h"
+#include "content/public/common/service_registry.h"
 
 namespace blimp {
 namespace engine {
@@ -49,5 +51,11 @@
   return blimp_browser_main_parts_->GetBrowserContext();
 }
 
+void BlimpContentBrowserClient::RegisterRenderProcessMojoServices(
+    content::ServiceRegistry* registry) {
+  registry->AddService<mojom::BlobChannel>(
+      base::Bind(&BlobChannelService::Create));
+}
+
 }  // namespace engine
 }  // namespace blimp
diff --git a/blimp/engine/app/blimp_content_browser_client.h b/blimp/engine/app/blimp_content_browser_client.h
index 8177332..f743258 100644
--- a/blimp/engine/app/blimp_content_browser_client.h
+++ b/blimp/engine/app/blimp_content_browser_client.h
@@ -28,6 +28,8 @@
       content::URLRequestInterceptorScopedVector request_interceptors) override;
   void OverrideWebkitPrefs(content::RenderViewHost* render_view_host,
                            content::WebPreferences* prefs) override;
+  void RegisterRenderProcessMojoServices(
+      content::ServiceRegistry* registry) override;
 
   BlimpBrowserContext* GetBrowserContext();
 
diff --git a/blimp/engine/app/blimp_content_main_delegate.cc b/blimp/engine/app/blimp_content_main_delegate.cc
index 265f368a..9b68c52 100644
--- a/blimp/engine/app/blimp_content_main_delegate.cc
+++ b/blimp/engine/app/blimp_content_main_delegate.cc
@@ -9,9 +9,9 @@
 #include "base/files/file_path.h"
 #include "base/logging.h"
 #include "base/path_service.h"
-#include "blimp/common/compositor/blimp_image_serialization_processor.h"
 #include "blimp/engine/app/blimp_content_browser_client.h"
 #include "blimp/engine/app/blimp_content_renderer_client.h"
+#include "mojo/public/cpp/bindings/interface_request.h"
 #include "ui/base/resource/resource_bundle.h"
 
 namespace blimp {
@@ -72,11 +72,7 @@
 content::ContentRendererClient*
 BlimpContentMainDelegate::CreateContentRendererClient() {
   DCHECK(!renderer_client_);
-  scoped_ptr<BlimpImageSerializationProcessor> image_serialization_processor =
-      make_scoped_ptr(new BlimpImageSerializationProcessor(
-          BlimpImageSerializationProcessor::Mode::SERIALIZATION));
-  renderer_client_.reset(
-      new BlimpContentRendererClient(std::move(image_serialization_processor)));
+  renderer_client_.reset(new BlimpContentRendererClient);
   return renderer_client_.get();
 }
 
diff --git a/blimp/engine/app/blimp_content_main_delegate.h b/blimp/engine/app/blimp_content_main_delegate.h
index 24aa4c3d..bc7876fc2 100644
--- a/blimp/engine/app/blimp_content_main_delegate.h
+++ b/blimp/engine/app/blimp_content_main_delegate.h
@@ -5,8 +5,9 @@
 #ifndef BLIMP_ENGINE_APP_BLIMP_CONTENT_MAIN_DELEGATE_H_
 #define BLIMP_ENGINE_APP_BLIMP_CONTENT_MAIN_DELEGATE_H_
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "blimp/engine/common/blimp_content_client.h"
 #include "content/public/app/content_main_delegate.h"
 
@@ -30,8 +31,8 @@
  private:
   void InitializeResourceBundle();
 
-  scoped_ptr<BlimpContentBrowserClient> browser_client_;
-  scoped_ptr<BlimpContentRendererClient> renderer_client_;
+  std::unique_ptr<BlimpContentBrowserClient> browser_client_;
+  std::unique_ptr<BlimpContentRendererClient> renderer_client_;
   BlimpContentClient content_client_;
 
   DISALLOW_COPY_AND_ASSIGN(BlimpContentMainDelegate);
diff --git a/blimp/engine/app/blimp_content_renderer_client.cc b/blimp/engine/app/blimp_content_renderer_client.cc
index 9b9b40a..0ddf1c2 100644
--- a/blimp/engine/app/blimp_content_renderer_client.cc
+++ b/blimp/engine/app/blimp_content_renderer_client.cc
@@ -5,20 +5,34 @@
 #include "blimp/engine/app/blimp_content_renderer_client.h"
 
 #include "blimp/common/compositor/blimp_image_serialization_processor.h"
+#include "blimp/engine/mojo/blob_channel.mojom.h"
+#include "blimp/engine/renderer/engine_image_serialization_processor.h"
 #include "components/web_cache/renderer/web_cache_render_process_observer.h"
+#include "content/public/common/service_registry.h"
+#include "content/public/renderer/render_thread.h"
 
 namespace blimp {
 namespace engine {
+namespace {
 
-BlimpContentRendererClient::BlimpContentRendererClient(
-    scoped_ptr<BlimpImageSerializationProcessor> image_serialization_processor)
-    : image_serialization_processor_(std::move(image_serialization_processor)) {
+mojom::BlobChannelPtr GetConnectedBlobChannel() {
+  mojom::BlobChannelPtr blob_channel_ptr;
+  content::RenderThread::Get()->GetServiceRegistry()->ConnectToRemoteService(
+      mojo::GetProxy(&blob_channel_ptr));
+  DCHECK(blob_channel_ptr);
+  return blob_channel_ptr;
 }
 
+}  // namespace
+
+BlimpContentRendererClient::BlimpContentRendererClient() {}
+
 BlimpContentRendererClient::~BlimpContentRendererClient() {}
 
 void BlimpContentRendererClient::RenderThreadStarted() {
   web_cache_observer_.reset(new web_cache::WebCacheRenderProcessObserver());
+  image_serialization_processor_.reset(
+      new EngineImageSerializationProcessor(GetConnectedBlobChannel()));
 }
 
 cc::ImageSerializationProcessor*
diff --git a/blimp/engine/app/blimp_content_renderer_client.h b/blimp/engine/app/blimp_content_renderer_client.h
index 8e86966..c80ca51 100644
--- a/blimp/engine/app/blimp_content_renderer_client.h
+++ b/blimp/engine/app/blimp_content_renderer_client.h
@@ -5,8 +5,9 @@
 #ifndef BLIMP_ENGINE_APP_BLIMP_CONTENT_RENDERER_CLIENT_H_
 #define BLIMP_ENGINE_APP_BLIMP_CONTENT_RENDERER_CLIENT_H_
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "content/public/renderer/content_renderer_client.h"
 
 namespace web_cache {
@@ -20,8 +21,7 @@
 
 class BlimpContentRendererClient : public content::ContentRendererClient {
  public:
-  BlimpContentRendererClient(scoped_ptr<BlimpImageSerializationProcessor>
-                                 image_serialization_processor);
+  BlimpContentRendererClient();
   ~BlimpContentRendererClient() override;
 
   // content::ContentRendererClient implementation.
@@ -30,10 +30,11 @@
 
  private:
   // This observer manages the process-global web cache.
-  scoped_ptr<web_cache::WebCacheRenderProcessObserver> web_cache_observer_;
+  std::unique_ptr<web_cache::WebCacheRenderProcessObserver> web_cache_observer_;
 
   // Provides the functionality to serialize images in SkPicture.
-  scoped_ptr<BlimpImageSerializationProcessor> image_serialization_processor_;
+  std::unique_ptr<cc::ImageSerializationProcessor>
+      image_serialization_processor_;
 
   DISALLOW_COPY_AND_ASSIGN(BlimpContentRendererClient);
 };
diff --git a/blimp/engine/app/blimp_engine_config.cc b/blimp/engine/app/blimp_engine_config.cc
index 8b831586..ccbdc4e5 100644
--- a/blimp/engine/app/blimp_engine_config.cc
+++ b/blimp/engine/app/blimp_engine_config.cc
@@ -4,12 +4,13 @@
 
 #include "blimp/engine/app/blimp_engine_config.h"
 
+#include <memory>
 #include <string>
 
 #include "base/command_line.h"
 #include "base/files/file_path.h"
 #include "base/files/file_util.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
 #include "base/strings/string_util.h"
 #include "blimp/engine/app/switches.h"
 
@@ -33,19 +34,19 @@
 BlimpEngineConfig::~BlimpEngineConfig() {}
 
 // static
-scoped_ptr<BlimpEngineConfig> BlimpEngineConfig::Create(
+std::unique_ptr<BlimpEngineConfig> BlimpEngineConfig::Create(
     const base::CommandLine& cmd_line) {
   const std::string client_token = GetClientToken(cmd_line);
   if (!client_token.empty()) {
-    return make_scoped_ptr(new BlimpEngineConfig(client_token));
+    return base::WrapUnique(new BlimpEngineConfig(client_token));
   }
   return nullptr;
 }
 
 // static
-scoped_ptr<BlimpEngineConfig> BlimpEngineConfig::CreateForTest(
+std::unique_ptr<BlimpEngineConfig> BlimpEngineConfig::CreateForTest(
     const std::string& client_token) {
-  return make_scoped_ptr(new BlimpEngineConfig(client_token));
+  return base::WrapUnique(new BlimpEngineConfig(client_token));
 }
 
 const std::string& BlimpEngineConfig::client_token() const {
diff --git a/blimp/engine/app/blimp_engine_config.h b/blimp/engine/app/blimp_engine_config.h
index 6f1583e..b385c6fd 100644
--- a/blimp/engine/app/blimp_engine_config.h
+++ b/blimp/engine/app/blimp_engine_config.h
@@ -5,10 +5,10 @@
 #ifndef BLIMP_ENGINE_APP_BLIMP_ENGINE_CONFIG_H_
 #define BLIMP_ENGINE_APP_BLIMP_ENGINE_CONFIG_H_
 
+#include <memory>
 #include <string>
 
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 
 namespace base {
 class CommandLine;
@@ -31,14 +31,14 @@
   ~BlimpEngineConfig();
 
   // Attempts to create a BlimpEngineConfig based on the parameters in the
-  // specified CommandLine. This validates all of the command line switches
-  // and parses all files specified. Returns a non-null scoped_ptr on success.
-  static scoped_ptr<BlimpEngineConfig> Create(
+  // specified CommandLine. This validates all of the command line switches and
+  // parses all files specified. Returns a non-null std::unique_ptr on success.
+  static std::unique_ptr<BlimpEngineConfig> Create(
       const base::CommandLine& cmd_line);
 
   // Creates a BlimpEngineConfig based on individual components. Should only
   // be used for testing.
-  static scoped_ptr<BlimpEngineConfig> CreateForTest(
+  static std::unique_ptr<BlimpEngineConfig> CreateForTest(
       const std::string& client_token);
 
   // Returns the client token.
diff --git a/blimp/engine/app/blimp_engine_config_unittest.cc b/blimp/engine/app/blimp_engine_config_unittest.cc
index 4f8213b..d4afec2 100644
--- a/blimp/engine/app/blimp_engine_config_unittest.cc
+++ b/blimp/engine/app/blimp_engine_config_unittest.cc
@@ -4,13 +4,13 @@
 
 #include "blimp/engine/app/blimp_engine_config.h"
 
+#include <memory>
 #include <string>
 #include <vector>
 
 #include "base/command_line.h"
 #include "base/files/file_util.h"
 #include "base/files/scoped_temp_dir.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/strings/stringprintf.h"
 #include "blimp/engine/app/switches.h"
 #include "testing/gtest/include/gtest/gtest.h"
diff --git a/blimp/engine/app/blimp_url_request_context_getter.cc b/blimp/engine/app/blimp_url_request_context_getter.cc
index 5bb6708..b1c4cf9 100644
--- a/blimp/engine/app/blimp_url_request_context_getter.cc
+++ b/blimp/engine/app/blimp_url_request_context_getter.cc
@@ -8,6 +8,7 @@
 #include <vector>
 
 #include "base/logging.h"
+#include "base/memory/ptr_util.h"
 #include "base/single_thread_task_runner.h"
 #include "blimp/engine/app/blimp_network_delegate.h"
 #include "blimp/engine/common/blimp_content_client.h"
@@ -56,19 +57,20 @@
     builder.set_accept_language("en-us,en");
     builder.set_user_agent(GetBlimpEngineUserAgent());
     builder.set_proxy_config_service(std::move(proxy_config_service_));
-    builder.set_network_delegate(make_scoped_ptr(new BlimpNetworkDelegate));
+    builder.set_network_delegate(base::WrapUnique(new BlimpNetworkDelegate));
     builder.set_net_log(net_log_);
     builder.set_data_enabled(true);
     for (auto& scheme_handler : protocol_handlers_) {
       builder.SetProtocolHandler(
           scheme_handler.first,
-          make_scoped_ptr(scheme_handler.second.release()));
+          base::WrapUnique(scheme_handler.second.release()));
     }
     protocol_handlers_.clear();
 
-    std::vector<scoped_ptr<net::URLRequestInterceptor>> request_interceptors;
+    std::vector<std::unique_ptr<net::URLRequestInterceptor>>
+        request_interceptors;
     for (auto i : request_interceptors_) {
-      request_interceptors.push_back(make_scoped_ptr(i));
+      request_interceptors.push_back(base::WrapUnique(i));
     }
     request_interceptors_.weak_clear();
     builder.SetInterceptors(std::move(request_interceptors));
diff --git a/blimp/engine/app/blimp_url_request_context_getter.h b/blimp/engine/app/blimp_url_request_context_getter.h
index e7375a6b..087e70a 100644
--- a/blimp/engine/app/blimp_url_request_context_getter.h
+++ b/blimp/engine/app/blimp_url_request_context_getter.h
@@ -5,9 +5,10 @@
 #ifndef BLIMP_ENGINE_APP_BLIMP_URL_REQUEST_CONTEXT_GETTER_H_
 #define BLIMP_ENGINE_APP_BLIMP_URL_REQUEST_CONTEXT_GETTER_H_
 
+#include <memory>
+
 #include "base/files/file_path.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "content/public/browser/content_browser_client.h"
 #include "net/url_request/url_request_context_getter.h"
 
@@ -55,8 +56,8 @@
   scoped_refptr<base::SingleThreadTaskRunner> file_loop_task_runner_;
   net::NetLog* net_log_;
 
-  scoped_ptr<net::ProxyConfigService> proxy_config_service_;
-  scoped_ptr<net::URLRequestContext> url_request_context_;
+  std::unique_ptr<net::ProxyConfigService> proxy_config_service_;
+  std::unique_ptr<net::URLRequestContext> url_request_context_;
   content::ProtocolHandlerMap protocol_handlers_;
   content::URLRequestInterceptorScopedVector request_interceptors_;
 
diff --git a/blimp/engine/app/ui/blimp_screen_unittest.cc b/blimp/engine/app/ui/blimp_screen_unittest.cc
index e865517..09244de 100644
--- a/blimp/engine/app/ui/blimp_screen_unittest.cc
+++ b/blimp/engine/app/ui/blimp_screen_unittest.cc
@@ -4,13 +4,14 @@
 
 #include "blimp/engine/app/ui/blimp_screen.h"
 
+#include <memory>
 #include <string>
 #include <vector>
 
 #include "base/command_line.h"
 #include "base/files/file_util.h"
 #include "base/files/scoped_temp_dir.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
 #include "base/strings/stringprintf.h"
 #include "blimp/engine/app/switches.h"
 #include "testing/gmock/include/gmock/gmock.h"
@@ -44,12 +45,12 @@
 class BlimpScreenTest : public testing::Test {
  protected:
   void SetUp() override {
-    screen_ = make_scoped_ptr(new BlimpScreen);
+    screen_ = base::WrapUnique(new BlimpScreen);
     screen_->AddObserver(&observer1_);
     screen_->AddObserver(&observer2_);
   }
 
-  scoped_ptr<BlimpScreen> screen_;
+  std::unique_ptr<BlimpScreen> screen_;
   testing::StrictMock<MockDisplayObserver> observer1_;
   testing::StrictMock<MockDisplayObserver> observer2_;
 };
diff --git a/blimp/engine/app/ui/blimp_window_tree_host.cc b/blimp/engine/app/ui/blimp_window_tree_host.cc
index d5fd0d2a4..9c38d5dd 100644
--- a/blimp/engine/app/ui/blimp_window_tree_host.cc
+++ b/blimp/engine/app/ui/blimp_window_tree_host.cc
@@ -4,13 +4,14 @@
 
 #include "blimp/engine/app/ui/blimp_window_tree_host.h"
 
+#include "base/memory/ptr_util.h"
 #include "ui/platform_window/stub/stub_window.h"
 
 namespace blimp {
 namespace engine {
 
 BlimpWindowTreeHost::BlimpWindowTreeHost() : aura::WindowTreeHostPlatform() {
-  SetPlatformWindow(make_scoped_ptr(new ui::StubWindow(this)));
+  SetPlatformWindow(base::WrapUnique(new ui::StubWindow(this)));
 }
 
 BlimpWindowTreeHost::~BlimpWindowTreeHost() {}
diff --git a/blimp/engine/app/ui/blimp_window_tree_host.h b/blimp/engine/app/ui/blimp_window_tree_host.h
index 6a48a3e..c06f8c2 100644
--- a/blimp/engine/app/ui/blimp_window_tree_host.h
+++ b/blimp/engine/app/ui/blimp_window_tree_host.h
@@ -5,8 +5,9 @@
 #ifndef BLIMP_ENGINE_APP_UI_BLIMP_WINDOW_TREE_HOST_H_
 #define BLIMP_ENGINE_APP_UI_BLIMP_WINDOW_TREE_HOST_H_
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "ui/aura/window_tree_host_platform.h"
 
 namespace blimp {
diff --git a/blimp/engine/common/blimp_browser_context.cc b/blimp/engine/common/blimp_browser_context.cc
index d536f7a..f91426a 100644
--- a/blimp/engine/common/blimp_browser_context.cc
+++ b/blimp/engine/common/blimp_browser_context.cc
@@ -70,7 +70,7 @@
 
 void BlimpBrowserContext::InitWhileIOAllowed() {
   // Ensures ~/.config/blimp_engine directory exists.
-  scoped_ptr<base::Environment> env(base::Environment::Create());
+  std::unique_ptr<base::Environment> env(base::Environment::Create());
   base::FilePath config_dir(base::nix::GetXDGDirectory(
       env.get(), base::nix::kXdgConfigHomeEnvVar, base::nix::kDotConfigDir));
   path_ = config_dir.Append("blimp_engine");
@@ -79,7 +79,7 @@
   BrowserContext::Initialize(this, path_);
 }
 
-scoped_ptr<content::ZoomLevelDelegate>
+std::unique_ptr<content::ZoomLevelDelegate>
 BlimpBrowserContext::CreateZoomLevelDelegate(const base::FilePath&) {
   return nullptr;
 }
diff --git a/blimp/engine/common/blimp_browser_context.h b/blimp/engine/common/blimp_browser_context.h
index 76f0c8b..e859a3c 100644
--- a/blimp/engine/common/blimp_browser_context.h
+++ b/blimp/engine/common/blimp_browser_context.h
@@ -5,9 +5,10 @@
 #ifndef BLIMP_ENGINE_COMMON_BLIMP_BROWSER_CONTEXT_H_
 #define BLIMP_ENGINE_COMMON_BLIMP_BROWSER_CONTEXT_H_
 
+#include <memory>
+
 #include "base/files/file_path.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "blimp/engine/app/blimp_url_request_context_getter.h"
 #include "content/public/browser/browser_context.h"
 #include "content/public/browser/content_browser_client.h"
@@ -31,7 +32,7 @@
   ~BlimpBrowserContext() override;
 
   // content::BrowserContext implementation.
-  scoped_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate(
+  std::unique_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate(
       const base::FilePath& partition_path) override;
   base::FilePath GetPath() const override;
   bool IsOffTheRecord() const override;
@@ -62,9 +63,9 @@
   // allowed on the current thread.
   void InitWhileIOAllowed();
 
-  scoped_ptr<BlimpResourceContext> resource_context_;
+  std::unique_ptr<BlimpResourceContext> resource_context_;
   bool ignore_certificate_errors_;
-  scoped_ptr<content::PermissionManager> permission_manager_;
+  std::unique_ptr<content::PermissionManager> permission_manager_;
   bool off_the_record_;
   net::NetLog* net_log_;
   base::FilePath path_;
diff --git a/blimp/engine/feature/engine_render_widget_feature.cc b/blimp/engine/feature/engine_render_widget_feature.cc
index 1b59e5d..37688c3e 100644
--- a/blimp/engine/feature/engine_render_widget_feature.cc
+++ b/blimp/engine/feature/engine_render_widget_feature.cc
@@ -32,25 +32,25 @@
 }
 
 void EngineRenderWidgetFeature::set_render_widget_message_sender(
-    scoped_ptr<BlimpMessageProcessor> message_processor) {
+    std::unique_ptr<BlimpMessageProcessor> message_processor) {
   DCHECK(message_processor);
   render_widget_message_sender_ = std::move(message_processor);
 }
 
 void EngineRenderWidgetFeature::set_input_message_sender(
-    scoped_ptr<BlimpMessageProcessor> message_processor) {
+    std::unique_ptr<BlimpMessageProcessor> message_processor) {
   DCHECK(message_processor);
   input_message_sender_ = std::move(message_processor);
 }
 
 void EngineRenderWidgetFeature::set_ime_message_sender(
-    scoped_ptr<BlimpMessageProcessor> message_processor) {
+    std::unique_ptr<BlimpMessageProcessor> message_processor) {
   DCHECK(message_processor);
   ime_message_sender_ = std::move(message_processor);
 }
 
 void EngineRenderWidgetFeature::set_compositor_message_sender(
-    scoped_ptr<BlimpMessageProcessor> message_processor) {
+    std::unique_ptr<BlimpMessageProcessor> message_processor) {
   DCHECK(message_processor);
   compositor_message_sender_ = std::move(message_processor);
 }
@@ -64,7 +64,7 @@
   DCHECK_GT(render_widget_id, 0);
 
   RenderWidgetMessage* render_widget_message;
-  scoped_ptr<BlimpMessage> blimp_message =
+  std::unique_ptr<BlimpMessage> blimp_message =
       CreateBlimpMessage(&render_widget_message, tab_id);
   render_widget_message->set_type(RenderWidgetMessage::CREATED);
   render_widget_message->set_render_widget_id(render_widget_id);
@@ -82,7 +82,7 @@
   DCHECK_GT(render_widget_id, 0);
 
   RenderWidgetMessage* render_widget_message;
-  scoped_ptr<BlimpMessage> blimp_message =
+  std::unique_ptr<BlimpMessage> blimp_message =
       CreateBlimpMessage(&render_widget_message, tab_id);
   render_widget_message->set_type(RenderWidgetMessage::INITIALIZE);
   render_widget_message->set_render_widget_id(render_widget_id);
@@ -100,7 +100,7 @@
   DCHECK_GT(render_widget_id, 0);
 
   RenderWidgetMessage* render_widget_message;
-  scoped_ptr<BlimpMessage> blimp_message =
+  std::unique_ptr<BlimpMessage> blimp_message =
       CreateBlimpMessage(&render_widget_message, tab_id);
   render_widget_message->set_type(RenderWidgetMessage::DELETED);
   render_widget_message->set_render_widget_id(render_widget_id);
@@ -114,7 +114,7 @@
     content::RenderWidgetHost* render_widget_host,
     const std::vector<uint8_t>& message) {
   CompositorMessage* compositor_message;
-  scoped_ptr<BlimpMessage> blimp_message =
+  std::unique_ptr<BlimpMessage> blimp_message =
       CreateBlimpMessage(&compositor_message, tab_id);
 
   int render_widget_id = GetRenderWidgetId(tab_id, render_widget_host);
@@ -137,7 +137,7 @@
   DCHECK(client);
 
   ImeMessage* ime_message;
-  scoped_ptr<BlimpMessage> blimp_message =
+  std::unique_ptr<BlimpMessage> blimp_message =
       CreateBlimpMessage(&ime_message, tab_id);
 
   int render_widget_id = GetRenderWidgetId(tab_id, render_widget_host);
@@ -161,7 +161,7 @@
     const int tab_id,
     content::RenderWidgetHost* render_widget_host) {
   ImeMessage* ime_message;
-  scoped_ptr<BlimpMessage> blimp_message =
+  std::unique_ptr<BlimpMessage> blimp_message =
       CreateBlimpMessage(&ime_message, tab_id);
 
   int render_widget_id = GetRenderWidgetId(tab_id, render_widget_host);
@@ -187,7 +187,7 @@
 }
 
 void EngineRenderWidgetFeature::ProcessMessage(
-    scoped_ptr<BlimpMessage> message,
+    std::unique_ptr<BlimpMessage> message,
     const net::CompletionCallback& callback) {
   DCHECK(!callback.is_null());
   DCHECK(message->type() == BlimpMessage::RENDER_WIDGET ||
@@ -207,7 +207,7 @@
       render_widget_host = GetRenderWidgetHost(target_tab_id,
                               message->input().render_widget_id());
       if (render_widget_host) {
-        scoped_ptr<blink::WebGestureEvent> event =
+        std::unique_ptr<blink::WebGestureEvent> event =
             input_message_converter_.ProcessMessage(message->input());
         if (event)
           delegate->OnWebGestureEvent(render_widget_host, std::move(event));
diff --git a/blimp/engine/feature/engine_render_widget_feature.h b/blimp/engine/feature/engine_render_widget_feature.h
index dff2b76..5065eaf 100644
--- a/blimp/engine/feature/engine_render_widget_feature.h
+++ b/blimp/engine/feature/engine_render_widget_feature.h
@@ -8,12 +8,12 @@
 #include <stdint.h>
 
 #include <map>
+#include <memory>
 #include <vector>
 
 #include "base/atomic_sequence_num.h"
 #include "base/containers/small_map.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "blimp/engine/app/settings_manager.h"
 #include "blimp/net/blimp_message_processor.h"
 #include "blimp/net/input_message_converter.h"
@@ -45,7 +45,7 @@
     // Called when the client is sending a WebGestureEvent to the engine.
     virtual void OnWebGestureEvent(
         content::RenderWidgetHost* render_widget_host,
-        scoped_ptr<blink::WebGestureEvent> event) = 0;
+        std::unique_ptr<blink::WebGestureEvent> event) = 0;
 
     // Called when the client sent a CompositorMessage.  These messages should
     // be sent to the engine's render process so they can be processed by the
@@ -59,16 +59,16 @@
   ~EngineRenderWidgetFeature() override;
 
   void set_render_widget_message_sender(
-      scoped_ptr<BlimpMessageProcessor> message_processor);
+      std::unique_ptr<BlimpMessageProcessor> message_processor);
 
   void set_input_message_sender(
-      scoped_ptr<BlimpMessageProcessor> message_processor);
+      std::unique_ptr<BlimpMessageProcessor> message_processor);
 
   void set_compositor_message_sender(
-      scoped_ptr<BlimpMessageProcessor> message_processor);
+      std::unique_ptr<BlimpMessageProcessor> message_processor);
 
   void set_ime_message_sender(
-      scoped_ptr<BlimpMessageProcessor> message_processor);
+      std::unique_ptr<BlimpMessageProcessor> message_processor);
 
   // Notifes the client that a new RenderWidget for a particular WebContents has
   // been created. This will trigger the creation of the BlimpCompositor for
@@ -109,7 +109,7 @@
   void RemoveDelegate(const int tab_id);
 
   // BlimpMessageProcessor implementation.
-  void ProcessMessage(scoped_ptr<BlimpMessage> message,
+  void ProcessMessage(std::unique_ptr<BlimpMessage> message,
                       const net::CompletionCallback& callback) override;
 
   // Settings::Observer implementation.
@@ -175,10 +175,10 @@
   SettingsManager* settings_manager_;
 
   // Outgoing message processors for RENDER_WIDGET, COMPOSITOR and INPUT types.
-  scoped_ptr<BlimpMessageProcessor> render_widget_message_sender_;
-  scoped_ptr<BlimpMessageProcessor> compositor_message_sender_;
-  scoped_ptr<BlimpMessageProcessor> input_message_sender_;
-  scoped_ptr<BlimpMessageProcessor> ime_message_sender_;
+  std::unique_ptr<BlimpMessageProcessor> render_widget_message_sender_;
+  std::unique_ptr<BlimpMessageProcessor> compositor_message_sender_;
+  std::unique_ptr<BlimpMessageProcessor> input_message_sender_;
+  std::unique_ptr<BlimpMessageProcessor> ime_message_sender_;
 
   DISALLOW_COPY_AND_ASSIGN(EngineRenderWidgetFeature);
 };
diff --git a/blimp/engine/feature/engine_render_widget_feature_unittest.cc b/blimp/engine/feature/engine_render_widget_feature_unittest.cc
index 9305775..a16b57d 100644
--- a/blimp/engine/feature/engine_render_widget_feature_unittest.cc
+++ b/blimp/engine/feature/engine_render_widget_feature_unittest.cc
@@ -2,15 +2,18 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "blimp/engine/feature/engine_render_widget_feature.h"
+
+#include <memory>
+
 #include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
 #include "base/numerics/safe_conversions.h"
 #include "base/strings/utf_string_conversions.h"
 #include "blimp/common/create_blimp_message.h"
 #include "blimp/common/proto/blimp_message.pb.h"
 #include "blimp/common/proto/compositor.pb.h"
 #include "blimp/common/proto/render_widget.pb.h"
-#include "blimp/engine/feature/engine_render_widget_feature.h"
 #include "blimp/net/input_message_generator.h"
 #include "blimp/net/test_common.h"
 #include "content/public/browser/render_widget_host.h"
@@ -36,7 +39,7 @@
   // EngineRenderWidgetFeature implementation.
   void OnWebGestureEvent(
       content::RenderWidgetHost* render_widget_host,
-      scoped_ptr<blink::WebGestureEvent> event) override {
+      std::unique_ptr<blink::WebGestureEvent> event) override {
     MockableOnWebGestureEvent(render_widget_host);
   }
 
@@ -201,7 +204,8 @@
   input_event.type = blink::WebGestureEvent::Type::GestureTap;
 
   InputMessageGenerator generator;
-  scoped_ptr<BlimpMessage> message = generator.GenerateMessage(input_event);
+  std::unique_ptr<BlimpMessage> message =
+      generator.GenerateMessage(input_event);
   message->set_type(BlimpMessage::INPUT);
   message->set_target_tab_id(tab_id);
   message->mutable_input()->set_render_widget_id(rw_id);
@@ -216,7 +220,7 @@
                            int rw_id,
                            const std::vector<uint8_t>& payload) {
   CompositorMessage* details;
-  scoped_ptr<BlimpMessage> message = CreateBlimpMessage(&details, tab_id);
+  std::unique_ptr<BlimpMessage> message = CreateBlimpMessage(&details, tab_id);
   details->set_render_widget_id(rw_id);
   details->set_payload(payload.data(), base::checked_cast<int>(payload.size()));
   net::TestCompletionCallback cb;
@@ -233,12 +237,12 @@
   void SetUp() override {
     render_widget_message_sender_ = new MockBlimpMessageProcessor;
     feature_.set_render_widget_message_sender(
-        make_scoped_ptr(render_widget_message_sender_));
+        base::WrapUnique(render_widget_message_sender_));
     compositor_message_sender_ = new MockBlimpMessageProcessor;
     feature_.set_compositor_message_sender(
-        make_scoped_ptr(compositor_message_sender_));
+        base::WrapUnique(compositor_message_sender_));
     ime_message_sender_ = new MockBlimpMessageProcessor;
-    feature_.set_ime_message_sender(make_scoped_ptr(ime_message_sender_));
+    feature_.set_ime_message_sender(base::WrapUnique(ime_message_sender_));
     feature_.SetDelegate(1, &delegate1_);
     feature_.SetDelegate(2, &delegate2_);
   }
diff --git a/blimp/engine/feature/engine_settings_feature.cc b/blimp/engine/feature/engine_settings_feature.cc
index 8db576a..4188b67 100644
--- a/blimp/engine/feature/engine_settings_feature.cc
+++ b/blimp/engine/feature/engine_settings_feature.cc
@@ -22,7 +22,7 @@
 EngineSettingsFeature::~EngineSettingsFeature() {}
 
 void EngineSettingsFeature::ProcessMessage(
-    scoped_ptr<BlimpMessage> message,
+    std::unique_ptr<BlimpMessage> message,
     const net::CompletionCallback& callback) {
   DCHECK_EQ(message->type(), BlimpMessage::SETTINGS);
   DCHECK(message->has_settings());
diff --git a/blimp/engine/feature/engine_settings_feature.h b/blimp/engine/feature/engine_settings_feature.h
index 126888d8..d80377e 100644
--- a/blimp/engine/feature/engine_settings_feature.h
+++ b/blimp/engine/feature/engine_settings_feature.h
@@ -23,7 +23,7 @@
   ~EngineSettingsFeature() override;
 
   // BlimpMessageProcessor implementation.
-  void ProcessMessage(scoped_ptr<BlimpMessage> message,
+  void ProcessMessage(std::unique_ptr<BlimpMessage> message,
                       const net::CompletionCallback& callback) override;
 
  private:
diff --git a/blimp/engine/feature/engine_settings_feature_unittest.cc b/blimp/engine/feature/engine_settings_feature_unittest.cc
index 94c78ca4..14e67736 100644
--- a/blimp/engine/feature/engine_settings_feature_unittest.cc
+++ b/blimp/engine/feature/engine_settings_feature_unittest.cc
@@ -29,7 +29,7 @@
   EXPECT_FALSE(settings_manager_.GetEngineSettings().record_whole_document);
 
   EngineSettingsMessage* engine_settings;
-  scoped_ptr<BlimpMessage> message = CreateBlimpMessage(&engine_settings);
+  std::unique_ptr<BlimpMessage> message = CreateBlimpMessage(&engine_settings);
   engine_settings->set_record_whole_document(true);
 
   net::TestCompletionCallback cb;
diff --git a/blimp/engine/mojo/blob_channel.mojom b/blimp/engine/mojo/blob_channel.mojom
new file mode 100644
index 0000000..fe3ebb9
--- /dev/null
+++ b/blimp/engine/mojo/blob_channel.mojom
@@ -0,0 +1,16 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+module blimp.engine.mojom;
+
+interface BlobChannel {
+  // Stores the blob |id| in the BlobCache.
+  Put(string id, array<uint8> data);
+
+  // Requests that the BlobChannel push the blob |id| over the wire.
+  // The request will be ignored if the BlobChannel knows that
+  // the client already has the data.
+  Push(string id);
+};
+
diff --git a/blimp/engine/mojo/blob_channel_service.cc b/blimp/engine/mojo/blob_channel_service.cc
new file mode 100644
index 0000000..42dfd389
--- /dev/null
+++ b/blimp/engine/mojo/blob_channel_service.cc
@@ -0,0 +1,33 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "blimp/engine/mojo/blob_channel_service.h"
+
+namespace blimp {
+namespace engine {
+
+BlobChannelService::BlobChannelService(mojom::BlobChannelRequest request)
+    : binding_(this, std::move(request)) {}
+
+BlobChannelService::~BlobChannelService() {}
+
+void BlobChannelService::Put(const mojo::String& id,
+                             mojo::Array<uint8_t> data) {
+  NOTIMPLEMENTED();
+}
+
+void BlobChannelService::Push(const mojo::String& id) {
+  NOTIMPLEMENTED();
+}
+
+// static
+void BlobChannelService::Create(
+    mojo::InterfaceRequest<mojom::BlobChannel> request) {
+  // Object lifetime is managed by BlobChannelService's StrongBinding
+  // |binding_|.
+  new BlobChannelService(std::move(request));
+}
+
+}  // namespace engine
+}  // namespace blimp
diff --git a/blimp/engine/mojo/blob_channel_service.h b/blimp/engine/mojo/blob_channel_service.h
new file mode 100644
index 0000000..e0d76827
--- /dev/null
+++ b/blimp/engine/mojo/blob_channel_service.h
@@ -0,0 +1,39 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BLIMP_ENGINE_MOJO_BLOB_CHANNEL_SERVICE_H_
+#define BLIMP_ENGINE_MOJO_BLOB_CHANNEL_SERVICE_H_
+
+#include "blimp/engine/mojo/blob_channel.mojom.h"
+#include "mojo/public/cpp/bindings/strong_binding.h"
+
+namespace blimp {
+namespace engine {
+
+// Service for processing BlobChannel requests from the renderer.
+// Runs on the browser process.
+class BlobChannelService : public mojom::BlobChannel {
+ public:
+  // Creates a BlobChannel bound to the connection specified by |request|.
+  explicit BlobChannelService(mojom::BlobChannelRequest request);
+  ~BlobChannelService() override;
+
+  // Factory method called by Mojo.
+  static void Create(mojo::InterfaceRequest<mojom::BlobChannel> request);
+
+ private:
+  // BlobChannel implementation.
+  void Put(const mojo::String& id, mojo::Array<uint8_t> data) override;
+  void Push(const mojo::String& id) override;
+
+  // Binds |this| and its object lifetime to a Mojo connection.
+  mojo::StrongBinding<mojom::BlobChannel> binding_;
+
+  DISALLOW_COPY_AND_ASSIGN(BlobChannelService);
+};
+
+}  // namespace engine
+}  // namespace blimp
+
+#endif  // BLIMP_ENGINE_MOJO_BLOB_CHANNEL_SERVICE_H_
diff --git a/blimp/engine/renderer/BUILD.gn b/blimp/engine/renderer/BUILD.gn
deleted file mode 100644
index 8d9db08..0000000
--- a/blimp/engine/renderer/BUILD.gn
+++ /dev/null
@@ -1,15 +0,0 @@
-# Copyright 2015 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-source_set("renderer") {
-  sources = [
-    "blimp_content_renderer_client.cc",
-    "blimp_content_renderer_client.h",
-  ]
-
-  deps = [
-    "//components/web_cache/renderer",
-    "//content/public/renderer",
-  ]
-}
diff --git a/blimp/engine/renderer/engine_image_serialization_processor.cc b/blimp/engine/renderer/engine_image_serialization_processor.cc
new file mode 100644
index 0000000..8d1f2bb5
--- /dev/null
+++ b/blimp/engine/renderer/engine_image_serialization_processor.cc
@@ -0,0 +1,169 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "blimp/engine/renderer/engine_image_serialization_processor.h"
+
+#include <stddef.h>
+#include <vector>
+
+#include "base/logging.h"
+#include "blimp/common/compositor/webp_decoder.h"
+#include "content/public/renderer/render_frame.h"
+#include "third_party/libwebp/webp/encode.h"
+#include "third_party/skia/include/core/SkData.h"
+#include "third_party/skia/include/core/SkPicture.h"
+#include "third_party/skia/include/core/SkPixelSerializer.h"
+#include "third_party/skia/include/core/SkUnPreMultiply.h"
+
+namespace {
+// TODO(nyquist): Make sure encoder does not serialize images more than once.
+// See crbug.com/548434.
+class WebPImageEncoder : public SkPixelSerializer {
+ public:
+  WebPImageEncoder() {}
+  ~WebPImageEncoder() override{};
+
+  bool onUseEncodedData(const void* data, size_t len) override {
+    const unsigned char* cast_data = static_cast<const unsigned char*>(data);
+    if (len < 14)
+      return false;
+    return !memcmp(cast_data, "RIFF", 4) && !memcmp(cast_data + 8, "WEBPVP", 6);
+  }
+
+  SkData* onEncode(const SkPixmap& pixmap) override {
+    // Initialize an empty WebPConfig.
+    WebPConfig config;
+    if (!WebPConfigInit(&config))
+      return nullptr;
+
+    // Initialize an empty WebPPicture.
+    WebPPicture picture;
+    if (!WebPPictureInit(&picture))
+      return nullptr;
+
+    // Ensure width and height are valid dimensions.
+    if (!pixmap.width() || pixmap.width() > WEBP_MAX_DIMENSION)
+      return nullptr;
+    picture.width = pixmap.width();
+    if (!pixmap.height() || pixmap.height() > WEBP_MAX_DIMENSION)
+      return nullptr;
+    picture.height = pixmap.height();
+
+    // Import picture from raw pixels.
+    DCHECK(pixmap.alphaType() == kPremul_SkAlphaType);
+    auto pixel_chars = static_cast<const unsigned char*>(pixmap.addr());
+    if (!PlatformPictureImport(pixel_chars, &picture))
+      return nullptr;
+
+    // Create a buffer for where to store the output data.
+    std::vector<unsigned char> data;
+    picture.custom_ptr = &data;
+
+    // Use our own WebPWriterFunction implementation.
+    picture.writer = &WebPImageEncoder::WriteOutput;
+
+    // Setup the configuration for the output WebP picture. This is currently
+    // the same as the default configuration for WebP, but since any change in
+    // the WebP defaults would invalidate all caches they are hard coded.
+    config.quality = 75.0;  // between 0 (smallest file) and 100 (biggest).
+    config.method = 4;  // quality/speed trade-off (0=fast, 6=slower-better).
+
+    // Encode the picture using the given configuration.
+    bool success = WebPEncode(&config, &picture);
+
+    // Release the memory allocated by WebPPictureImport*(). This does not free
+    // the memory used by the picture object itself.
+    WebPPictureFree(&picture);
+
+    if (!success)
+      return nullptr;
+
+    // Copy WebP data into SkData. |data| is allocated only on the stack, so
+    // it is automatically deleted after this.
+    return SkData::NewWithCopy(&data.front(), data.size());
+  }
+
+ private:
+  // WebPWriterFunction implementation.
+  static int WriteOutput(const uint8_t* data,
+                         size_t size,
+                         const WebPPicture* const picture) {
+    std::vector<unsigned char>* dest =
+        static_cast<std::vector<unsigned char>*>(picture->custom_ptr);
+    dest->insert(dest->end(), data, data + size);
+    return 1;
+  }
+
+  // For each pixel, un-premultiplies the alpha-channel for each of the RGB
+  // channels. As an example, for a channel value that before multiplication was
+  // 255, and after applying an alpha of 128, the premultiplied pixel would be
+  // 128. The un-premultiply step uses the alpha-channel to get back to 255. The
+  // alpha channel is kept unchanged.
+  void UnPremultiply(const unsigned char* in_pixels,
+                     unsigned char* out_pixels,
+                     size_t pixel_count) {
+    const SkUnPreMultiply::Scale* table = SkUnPreMultiply::GetScaleTable();
+    for (; pixel_count-- > 0; in_pixels += 4) {
+      unsigned char alpha = in_pixels[3];
+      if (alpha == 255) {  // Full opacity, just blindly copy.
+        *out_pixels++ = in_pixels[0];
+        *out_pixels++ = in_pixels[1];
+        *out_pixels++ = in_pixels[2];
+        *out_pixels++ = alpha;
+      } else {
+        SkUnPreMultiply::Scale scale = table[alpha];
+        *out_pixels++ = SkUnPreMultiply::ApplyScale(scale, in_pixels[0]);
+        *out_pixels++ = SkUnPreMultiply::ApplyScale(scale, in_pixels[1]);
+        *out_pixels++ = SkUnPreMultiply::ApplyScale(scale, in_pixels[2]);
+        *out_pixels++ = alpha;
+      }
+    }
+  }
+
+  bool PlatformPictureImport(const unsigned char* pixels,
+                             WebPPicture* picture) {
+    // Need to unpremultiply each pixel, each pixel using 4 bytes (RGBA).
+    size_t pixel_count = picture->height * picture->width;
+    std::vector<unsigned char> unpremul_pixels(pixel_count * 4);
+    UnPremultiply(pixels, unpremul_pixels.data(), pixel_count);
+
+    // Each pixel uses 4 bytes (RGBA) which affects the stride per row.
+    int row_stride = picture->width * 4;
+
+    if (SK_B32_SHIFT)  // Android
+      return WebPPictureImportRGBA(picture, unpremul_pixels.data(), row_stride);
+    return WebPPictureImportBGRA(picture, unpremul_pixels.data(), row_stride);
+  }
+};
+
+}  // namespace
+
+namespace blimp {
+namespace engine {
+
+EngineImageSerializationProcessor::EngineImageSerializationProcessor(
+    mojom::BlobChannelPtr blob_channel)
+    : blob_channel_(std::move(blob_channel)) {
+  DCHECK(blob_channel_);
+
+  pixel_serializer_.reset(new WebPImageEncoder);
+
+  // Dummy BlobChannel command.
+  // TODO(nyquist): Remove this after integrating BlobChannel.
+  blob_channel_->Push("foo");
+}
+
+EngineImageSerializationProcessor::~EngineImageSerializationProcessor() {}
+
+SkPixelSerializer* EngineImageSerializationProcessor::GetPixelSerializer() {
+  return pixel_serializer_.get();
+}
+
+SkPicture::InstallPixelRefProc
+EngineImageSerializationProcessor::GetPixelDeserializer() {
+  return nullptr;
+}
+
+}  // namespace engine
+}  // namespace blimp
diff --git a/blimp/engine/renderer/engine_image_serialization_processor.h b/blimp/engine/renderer/engine_image_serialization_processor.h
new file mode 100644
index 0000000..7aad7a0
--- /dev/null
+++ b/blimp/engine/renderer/engine_image_serialization_processor.h
@@ -0,0 +1,47 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BLIMP_ENGINE_RENDERER_ENGINE_IMAGE_SERIALIZATION_PROCESSOR_H_
+#define BLIMP_ENGINE_RENDERER_ENGINE_IMAGE_SERIALIZATION_PROCESSOR_H_
+
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+#include "blimp/common/blimp_common_export.h"
+#include "blimp/engine/mojo/blob_channel.mojom.h"
+#include "cc/proto/image_serialization_processor.h"
+#include "third_party/skia/include/core/SkPicture.h"
+
+class SkPixelSerializer;
+
+namespace content {
+class RenderFrame;
+}  // class content
+
+namespace blimp {
+namespace engine {
+
+// EngineImageSerializationProcessor provides functionality to serialize and
+// deserialize Skia images.
+class BLIMP_COMMON_EXPORT EngineImageSerializationProcessor
+    : public cc::ImageSerializationProcessor {
+ public:
+  explicit EngineImageSerializationProcessor(
+      mojom::BlobChannelPtr blob_channel);
+  ~EngineImageSerializationProcessor();
+
+  // cc::ImageSerializationProcessor implementation.
+  SkPixelSerializer* GetPixelSerializer() override;
+  SkPicture::InstallPixelRefProc GetPixelDeserializer() override;
+
+ private:
+  scoped_ptr<SkPixelSerializer> pixel_serializer_;
+  mojom::BlobChannelPtr blob_channel_;
+
+  DISALLOW_COPY_AND_ASSIGN(EngineImageSerializationProcessor);
+};
+
+}  // namespace engine
+}  // namespace blimp
+
+#endif  // BLIMP_ENGINE_RENDERER_ENGINE_IMAGE_SERIALIZATION_PROCESSOR_H_
diff --git a/blimp/engine/session/blimp_engine_session.cc b/blimp/engine/session/blimp_engine_session.cc
index 3e9acd6..32cfcd5 100644
--- a/blimp/engine/session/blimp_engine_session.cc
+++ b/blimp/engine/session/blimp_engine_session.cc
@@ -6,6 +6,7 @@
 
 #include <string>
 
+#include "base/memory/ptr_util.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/thread_task_runner_handle.h"
 #include "blimp/common/create_blimp_message.h"
@@ -112,7 +113,7 @@
 
  private:
   // ConnectionHandler implementation.
-  void HandleConnection(scoped_ptr<BlimpConnection> connection) override;
+  void HandleConnection(std::unique_ptr<BlimpConnection> connection) override;
 
   // ConnectionErrorObserver implementation.
   // Signals the engine session that an authenticated connection was
@@ -122,9 +123,9 @@
   net::NetLog* net_log_;
   base::Closure quit_closure_;
 
-  scoped_ptr<BrowserConnectionHandler> connection_handler_;
-  scoped_ptr<EngineAuthenticationHandler> authentication_handler_;
-  scoped_ptr<EngineConnectionManager> connection_manager_;
+  std::unique_ptr<BrowserConnectionHandler> connection_handler_;
+  std::unique_ptr<EngineAuthenticationHandler> authentication_handler_;
+  std::unique_ptr<EngineConnectionManager> connection_manager_;
 
   DISALLOW_COPY_AND_ASSIGN(EngineNetworkComponents);
 };
@@ -147,20 +148,20 @@
   // Plumb authenticated connections from the authentication handler
   // to |this| (which will then pass it to |connection_handler_|.
   authentication_handler_ =
-      make_scoped_ptr(new EngineAuthenticationHandler(this, client_token));
+      base::WrapUnique(new EngineAuthenticationHandler(this, client_token));
 
   // Plumb unauthenticated connections to |authentication_handler_|.
-  connection_manager_ = make_scoped_ptr(
+  connection_manager_ = base::WrapUnique(
       new EngineConnectionManager(authentication_handler_.get()));
 
   // Adds BlimpTransports to connection_manager_.
   net::IPEndPoint address(GetIPv4AnyAddress(), kDefaultPort);
   connection_manager_->AddTransport(
-      make_scoped_ptr(new TCPEngineTransport(address, net_log_)));
+      base::WrapUnique(new TCPEngineTransport(address, net_log_)));
 }
 
 void EngineNetworkComponents::HandleConnection(
-    scoped_ptr<BlimpConnection> connection) {
+    std::unique_ptr<BlimpConnection> connection) {
   // Observe |connection| for disconnection events.
   connection->AddConnectionErrorObserver(this);
   connection_handler_->HandleConnection(std::move(connection));
@@ -177,7 +178,7 @@
 }
 
 BlimpEngineSession::BlimpEngineSession(
-    scoped_ptr<BlimpBrowserContext> browser_context,
+    std::unique_ptr<BlimpBrowserContext> browser_context,
     net::NetLog* net_log,
     BlimpEngineConfig* engine_config,
     SettingsManager* settings_manager)
@@ -290,8 +291,8 @@
 
   content::WebContents::CreateParams create_params(browser_context_.get(),
                                                    nullptr);
-  scoped_ptr<content::WebContents> new_contents =
-      make_scoped_ptr(content::WebContents::Create(create_params));
+  std::unique_ptr<content::WebContents> new_contents =
+      base::WrapUnique(content::WebContents::Create(create_params));
   PlatformSetContents(std::move(new_contents));
   return true;
 }
@@ -350,8 +351,7 @@
 
 void BlimpEngineSession::OnWebGestureEvent(
     content::RenderWidgetHost* render_widget_host,
-    scoped_ptr<blink::WebGestureEvent> event) {
-
+    std::unique_ptr<blink::WebGestureEvent> event) {
   render_widget_host->ForwardGestureEvent(*event);
 }
 
@@ -409,7 +409,7 @@
 }
 
 void BlimpEngineSession::ProcessMessage(
-    scoped_ptr<BlimpMessage> message,
+    std::unique_ptr<BlimpMessage> message,
     const net::CompletionCallback& callback) {
   DCHECK(!callback.is_null());
   DCHECK(message->type() == BlimpMessage::TAB_CONTROL ||
@@ -524,7 +524,7 @@
     return;
 
   NavigationMessage* navigation_message;
-  scoped_ptr<BlimpMessage> message =
+  std::unique_ptr<BlimpMessage> message =
       CreateBlimpMessage(&navigation_message, kDummyTabId);
   navigation_message->set_type(NavigationMessage::NAVIGATION_STATE_CHANGED);
   NavigationStateChangeMessage* details =
@@ -562,8 +562,8 @@
     return;
 
   NavigationMessage* navigation_message = nullptr;
-  scoped_ptr<BlimpMessage> message =
-        CreateBlimpMessage(&navigation_message, kDummyTabId);
+  std::unique_ptr<BlimpMessage> message =
+      CreateBlimpMessage(&navigation_message, kDummyTabId);
   navigation_message->set_type(NavigationMessage::NAVIGATION_STATE_CHANGED);
   NavigationStateChangeMessage* details =
       navigation_message->mutable_navigation_state_changed();
@@ -597,7 +597,7 @@
 }
 
 void BlimpEngineSession::PlatformSetContents(
-    scoped_ptr<content::WebContents> new_contents) {
+    std::unique_ptr<content::WebContents> new_contents) {
   new_contents->SetDelegate(this);
   Observe(new_contents.get());
   web_contents_ = std::move(new_contents);
diff --git a/blimp/engine/session/blimp_engine_session.h b/blimp/engine/session/blimp_engine_session.h
index d9093b2b..a78bb66 100644
--- a/blimp/engine/session/blimp_engine_session.h
+++ b/blimp/engine/session/blimp_engine_session.h
@@ -7,10 +7,10 @@
 
 #include <stdint.h>
 
+#include <memory>
 #include <vector>
 
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "blimp/common/proto/blimp_message.pb.h"
 #include "blimp/engine/feature/engine_render_widget_feature.h"
 #include "blimp/engine/feature/engine_settings_feature.h"
@@ -74,7 +74,7 @@
       public ui::InputMethodObserver,
       public EngineRenderWidgetFeature::RenderWidgetMessageDelegate {
  public:
-  BlimpEngineSession(scoped_ptr<BlimpBrowserContext> browser_context,
+  BlimpEngineSession(std::unique_ptr<BlimpBrowserContext> browser_context,
                      net::NetLog* net_log,
                      BlimpEngineConfig* config,
                      SettingsManager* settings_manager);
@@ -89,7 +89,7 @@
 
   // BlimpMessageProcessor implementation.
   // This object handles incoming TAB_CONTROL and NAVIGATION messages directly.
-  void ProcessMessage(scoped_ptr<BlimpMessage> message,
+  void ProcessMessage(std::unique_ptr<BlimpMessage> message,
                       const net::CompletionCallback& callback) override;
 
  private:
@@ -114,8 +114,9 @@
 
   // RenderWidgetMessage handler methods.
   // RenderWidgetMessageDelegate implementation.
-  void OnWebGestureEvent(content::RenderWidgetHost* render_widget_host,
-                         scoped_ptr<blink::WebGestureEvent> event) override;
+  void OnWebGestureEvent(
+      content::RenderWidgetHost* render_widget_host,
+      std::unique_ptr<blink::WebGestureEvent> event) override;
   void OnCompositorMessageReceived(
       content::RenderWidgetHost* render_widget_host,
       const std::vector<uint8_t>& message) override;
@@ -159,37 +160,37 @@
   void RenderViewDeleted(content::RenderViewHost* render_view_host) override;
 
   // Sets up and owns |new_contents|.
-  void PlatformSetContents(scoped_ptr<content::WebContents> new_contents);
+  void PlatformSetContents(std::unique_ptr<content::WebContents> new_contents);
 
   // Stores the value of the last page load completed update sent to the client.
   // This field is used per tab.
   bool last_page_load_completed_value_;
 
   // Content BrowserContext for this session.
-  scoped_ptr<BlimpBrowserContext> browser_context_;
+  std::unique_ptr<BlimpBrowserContext> browser_context_;
 
   // Engine configuration including assigned client token.
   BlimpEngineConfig* engine_config_;
 
   // Presents the client's single screen.
-  scoped_ptr<BlimpScreen> screen_;
+  std::unique_ptr<BlimpScreen> screen_;
 
   // Represents the (currently single) browser window into which tab(s) will
   // be rendered.
-  scoped_ptr<BlimpWindowTreeHost> window_tree_host_;
+  std::unique_ptr<BlimpWindowTreeHost> window_tree_host_;
 
   // Used to apply standard focus conventions to the windows in the
   // WindowTreeHost hierarchy.
-  scoped_ptr<wm::FocusController> focus_client_;
+  std::unique_ptr<wm::FocusController> focus_client_;
 
   // Used to manage input capture.
-  scoped_ptr<aura::client::DefaultCaptureClient> capture_client_;
+  std::unique_ptr<aura::client::DefaultCaptureClient> capture_client_;
 
   // Used to attach null-parented windows (e.g. popups) to the root window.
-  scoped_ptr<aura::client::WindowTreeClient> window_tree_client_;
+  std::unique_ptr<aura::client::WindowTreeClient> window_tree_client_;
 
   // Only one web_contents is supported for blimp 0.5
-  scoped_ptr<content::WebContents> web_contents_;
+  std::unique_ptr<content::WebContents> web_contents_;
 
   // Manages all global settings for the engine session.
   SettingsManager* settings_manager_;
@@ -204,13 +205,13 @@
   // Container for connection manager, authentication handler, and
   // browser connection handler. The components run on the I/O thread, and
   // this object is destroyed there.
-  scoped_ptr<EngineNetworkComponents> net_components_;
+  std::unique_ptr<EngineNetworkComponents> net_components_;
 
-  scoped_ptr<ThreadPipeManager> thread_pipe_manager_;
+  std::unique_ptr<ThreadPipeManager> thread_pipe_manager_;
 
   // Used to send TAB_CONTROL or NAVIGATION messages to client.
-  scoped_ptr<BlimpMessageProcessor> tab_control_message_sender_;
-  scoped_ptr<BlimpMessageProcessor> navigation_message_sender_;
+  std::unique_ptr<BlimpMessageProcessor> tab_control_message_sender_;
+  std::unique_ptr<BlimpMessageProcessor> navigation_message_sender_;
 
   DISALLOW_COPY_AND_ASSIGN(BlimpEngineSession);
 };
diff --git a/blimp/net/blimp_connection.cc b/blimp/net/blimp_connection.cc
index 663273f..4b48f773 100644
--- a/blimp/net/blimp_connection.cc
+++ b/blimp/net/blimp_connection.cc
@@ -33,7 +33,7 @@
   }
 
   // BlimpMessageProcessor implementation.
-  void ProcessMessage(scoped_ptr<BlimpMessage> message,
+  void ProcessMessage(std::unique_ptr<BlimpMessage> message,
                       const net::CompletionCallback& callback) override;
 
  private:
@@ -60,7 +60,7 @@
 }
 
 void BlimpMessageSender::ProcessMessage(
-    scoped_ptr<BlimpMessage> message,
+    std::unique_ptr<BlimpMessage> message,
     const net::CompletionCallback& callback) {
   DCHECK(error_observer_);
   VLOG(1) << "Sending " << *message;
@@ -99,8 +99,8 @@
 
 }  // namespace
 
-BlimpConnection::BlimpConnection(scoped_ptr<PacketReader> reader,
-                                 scoped_ptr<PacketWriter> writer)
+BlimpConnection::BlimpConnection(std::unique_ptr<PacketReader> reader,
+                                 std::unique_ptr<PacketWriter> writer)
     : reader_(std::move(reader)),
       message_pump_(new BlimpMessagePump(reader_.get())),
       writer_(std::move(writer)),
diff --git a/blimp/net/blimp_connection.h b/blimp/net/blimp_connection.h
index ac43f26..a662c4e 100644
--- a/blimp/net/blimp_connection.h
+++ b/blimp/net/blimp_connection.h
@@ -5,8 +5,9 @@
 #ifndef BLIMP_NET_BLIMP_CONNECTION_H_
 #define BLIMP_NET_BLIMP_CONNECTION_H_
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/observer_list.h"
 #include "blimp/net/blimp_net_export.h"
 #include "blimp/net/connection_error_observer.h"
@@ -22,8 +23,8 @@
 // a network connection.
 class BLIMP_NET_EXPORT BlimpConnection : public ConnectionErrorObserver {
  public:
-  BlimpConnection(scoped_ptr<PacketReader> reader,
-                  scoped_ptr<PacketWriter> writer);
+  BlimpConnection(std::unique_ptr<PacketReader> reader,
+                  std::unique_ptr<PacketWriter> writer);
 
   ~BlimpConnection() override;
 
@@ -48,10 +49,10 @@
   void OnConnectionError(int error) override;
 
  private:
-  scoped_ptr<PacketReader> reader_;
-  scoped_ptr<BlimpMessagePump> message_pump_;
-  scoped_ptr<PacketWriter> writer_;
-  scoped_ptr<BlimpMessageProcessor> outgoing_msg_processor_;
+  std::unique_ptr<PacketReader> reader_;
+  std::unique_ptr<BlimpMessagePump> message_pump_;
+  std::unique_ptr<PacketWriter> writer_;
+  std::unique_ptr<BlimpMessageProcessor> outgoing_msg_processor_;
   base::ObserverList<ConnectionErrorObserver> error_observers_;
 
   DISALLOW_COPY_AND_ASSIGN(BlimpConnection);
diff --git a/blimp/net/blimp_connection_unittest.cc b/blimp/net/blimp_connection_unittest.cc
index ad55a2c9..59c7a39 100644
--- a/blimp/net/blimp_connection_unittest.cc
+++ b/blimp/net/blimp_connection_unittest.cc
@@ -2,13 +2,16 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "blimp/net/blimp_connection.h"
+
 #include <stddef.h>
+
 #include <string>
 
 #include "base/callback_helpers.h"
+#include "base/memory/ptr_util.h"
 #include "base/message_loop/message_loop.h"
 #include "blimp/common/proto/blimp_message.pb.h"
-#include "blimp/net/blimp_connection.h"
 #include "blimp/net/common.h"
 #include "blimp/net/connection_error_observer.h"
 #include "blimp/net/test_common.h"
@@ -30,11 +33,11 @@
 class BlimpConnectionTest : public testing::Test {
  public:
   BlimpConnectionTest() {
-    scoped_ptr<testing::StrictMock<MockPacketWriter>> writer(
+    std::unique_ptr<testing::StrictMock<MockPacketWriter>> writer(
         new testing::StrictMock<MockPacketWriter>);
     writer_ = writer.get();
-    connection_.reset(new BlimpConnection(make_scoped_ptr(new MockPacketReader),
-                                          std::move(writer)));
+    connection_.reset(new BlimpConnection(
+        base::WrapUnique(new MockPacketReader), std::move(writer)));
     connection_->AddConnectionErrorObserver(&error_observer1_);
     connection_->AddConnectionErrorObserver(&error_observer2_);
     connection_->AddConnectionErrorObserver(&error_observer3_);
@@ -44,14 +47,14 @@
   ~BlimpConnectionTest() override {}
 
  protected:
-  scoped_ptr<BlimpMessage> CreateInputMessage() {
-    scoped_ptr<BlimpMessage> msg(new BlimpMessage);
+  std::unique_ptr<BlimpMessage> CreateInputMessage() {
+    std::unique_ptr<BlimpMessage> msg(new BlimpMessage);
     msg->set_type(BlimpMessage::INPUT);
     return msg;
   }
 
-  scoped_ptr<BlimpMessage> CreateControlMessage() {
-    scoped_ptr<BlimpMessage> msg(new BlimpMessage);
+  std::unique_ptr<BlimpMessage> CreateControlMessage() {
+    std::unique_ptr<BlimpMessage> msg(new BlimpMessage);
     msg->set_type(BlimpMessage::TAB_CONTROL);
     return msg;
   }
@@ -66,7 +69,7 @@
   testing::StrictMock<MockConnectionErrorObserver> error_observer3_;
 
   testing::StrictMock<MockBlimpMessageProcessor> receiver_;
-  scoped_ptr<BlimpConnection> connection_;
+  std::unique_ptr<BlimpConnection> connection_;
 };
 
 // Write completes writing two packets asynchronously.
diff --git a/blimp/net/blimp_message_checkpointer.cc b/blimp/net/blimp_message_checkpointer.cc
index abf77d6..c9a20c3 100644
--- a/blimp/net/blimp_message_checkpointer.cc
+++ b/blimp/net/blimp_message_checkpointer.cc
@@ -33,7 +33,7 @@
 BlimpMessageCheckpointer::~BlimpMessageCheckpointer() {}
 
 void BlimpMessageCheckpointer::ProcessMessage(
-    scoped_ptr<BlimpMessage> message,
+    std::unique_ptr<BlimpMessage> message,
     const net::CompletionCallback& callback) {
   if (message->type() == BlimpMessage::PROTOCOL_CONTROL &&
       message->protocol_control().type() ==
diff --git a/blimp/net/blimp_message_checkpointer.h b/blimp/net/blimp_message_checkpointer.h
index cd5fd49c..d7633200 100644
--- a/blimp/net/blimp_message_checkpointer.h
+++ b/blimp/net/blimp_message_checkpointer.h
@@ -33,7 +33,7 @@
   ~BlimpMessageCheckpointer() override;
 
   // BlimpMessageProcessor interface.
-  void ProcessMessage(scoped_ptr<BlimpMessage> message,
+  void ProcessMessage(std::unique_ptr<BlimpMessage> message,
                       const net::CompletionCallback& callback) override;
 
  private:
diff --git a/blimp/net/blimp_message_checkpointer_unittest.cc b/blimp/net/blimp_message_checkpointer_unittest.cc
index eead783c..dbd5c1e 100644
--- a/blimp/net/blimp_message_checkpointer_unittest.cc
+++ b/blimp/net/blimp_message_checkpointer_unittest.cc
@@ -4,6 +4,7 @@
 
 #include "blimp/net/blimp_message_checkpointer.h"
 
+#include "base/memory/ptr_util.h"
 #include "base/memory/ref_counted.h"
 #include "base/test/test_mock_time_task_runner.h"
 #include "base/thread_task_runner_handle.h"
@@ -31,8 +32,8 @@
 
 }  // namespace
 
-static scoped_ptr<BlimpMessage> CreateExpectedAckMessage(int64_t id) {
-  scoped_ptr<BlimpMessage> message = make_scoped_ptr(new BlimpMessage);
+static std::unique_ptr<BlimpMessage> CreateExpectedAckMessage(int64_t id) {
+  std::unique_ptr<BlimpMessage> message = base::WrapUnique(new BlimpMessage);
   message->set_type(BlimpMessage::PROTOCOL_CONTROL);
   ProtocolControlMessage* protocol_control =
       message->mutable_protocol_control();
@@ -51,7 +52,7 @@
   ~BlimpMessageCheckpointerTest() override {}
 
   int64_t SimulateIncomingMessage() {
-    scoped_ptr<BlimpMessage> message(new BlimpMessage);
+    std::unique_ptr<BlimpMessage> message(new BlimpMessage);
     message->set_message_id(++message_id_);
     message->set_type(BlimpMessage::INPUT);
     checkpointer_->ProcessMessage(
@@ -62,7 +63,7 @@
   }
 
   void SetUp() override {
-    checkpointer_ = make_scoped_ptr(new BlimpMessageCheckpointer(
+    checkpointer_ = base::WrapUnique(new BlimpMessageCheckpointer(
         &incoming_processor_, &outgoing_processor_, &checkpoint_observer_));
   }
 
@@ -80,7 +81,7 @@
   testing::StrictMock<MockCheckpointObserver> checkpoint_observer_;
   net::CompletionCallback captured_cb_;
 
-  scoped_ptr<BlimpMessageCheckpointer> checkpointer_;
+  std::unique_ptr<BlimpMessageCheckpointer> checkpointer_;
 };
 
 TEST_F(BlimpMessageCheckpointerTest, CallbackPropagates) {
@@ -112,7 +113,7 @@
 TEST_F(BlimpMessageCheckpointerTest, SingleMessageAck) {
   EXPECT_CALL(incoming_processor_, MockableProcessMessage(_, _))
       .WillOnce(SaveArg<1>(&captured_cb_));
-  scoped_ptr<BlimpMessage> expected_ack = CreateExpectedAckMessage(1);
+  std::unique_ptr<BlimpMessage> expected_ack = CreateExpectedAckMessage(1);
   EXPECT_CALL(outgoing_processor_,
               MockableProcessMessage(EqualsProto(*expected_ack), _));
   EXPECT_CALL(*this, IncomingCompletionCallback(net::OK));
@@ -129,7 +130,7 @@
   EXPECT_CALL(incoming_processor_, MockableProcessMessage(_, _))
       .Times(10)
       .WillRepeatedly(SaveArg<1>(&captured_cb_));
-  scoped_ptr<BlimpMessage> expected_ack = CreateExpectedAckMessage(10);
+  std::unique_ptr<BlimpMessage> expected_ack = CreateExpectedAckMessage(10);
   EXPECT_CALL(outgoing_processor_,
               MockableProcessMessage(EqualsProto(*expected_ack), _));
   EXPECT_CALL(*this, IncomingCompletionCallback(net::OK)).Times(10);
@@ -148,10 +149,10 @@
   EXPECT_CALL(incoming_processor_, MockableProcessMessage(_, _))
       .Times(2)
       .WillRepeatedly(SaveArg<1>(&captured_cb_));
-  scoped_ptr<BlimpMessage> expected_ack1 = CreateExpectedAckMessage(1);
+  std::unique_ptr<BlimpMessage> expected_ack1 = CreateExpectedAckMessage(1);
   EXPECT_CALL(outgoing_processor_,
               MockableProcessMessage(EqualsProto(*expected_ack1), _));
-  scoped_ptr<BlimpMessage> expected_ack2 = CreateExpectedAckMessage(2);
+  std::unique_ptr<BlimpMessage> expected_ack2 = CreateExpectedAckMessage(2);
   EXPECT_CALL(outgoing_processor_,
               MockableProcessMessage(EqualsProto(*expected_ack2), _));
   EXPECT_CALL(*this, IncomingCompletionCallback(net::OK)).Times(2);
@@ -172,7 +173,7 @@
   EXPECT_CALL(checkpoint_observer_, OnMessageCheckpoint(10));
 
   // Simulate an incoming message.
-  scoped_ptr<BlimpMessage> ack_message = CreateCheckpointAckMessage(10);
+  std::unique_ptr<BlimpMessage> ack_message = CreateCheckpointAckMessage(10);
   checkpointer_->ProcessMessage(
       std::move(ack_message),
       base::Bind(&BlimpMessageCheckpointerTest::IncomingCompletionCallback,
diff --git a/blimp/net/blimp_message_demultiplexer.cc b/blimp/net/blimp_message_demultiplexer.cc
index 22189b4..ab67c84 100644
--- a/blimp/net/blimp_message_demultiplexer.cc
+++ b/blimp/net/blimp_message_demultiplexer.cc
@@ -28,7 +28,7 @@
 }
 
 void BlimpMessageDemultiplexer::ProcessMessage(
-    scoped_ptr<BlimpMessage> message,
+    std::unique_ptr<BlimpMessage> message,
     const net::CompletionCallback& callback) {
   DVLOG(2) << "ProcessMessage : " << *message;
   auto receiver_iter = feature_receiver_map_.find(message->type());
diff --git a/blimp/net/blimp_message_demultiplexer.h b/blimp/net/blimp_message_demultiplexer.h
index 07854aa..bd41338 100644
--- a/blimp/net/blimp_message_demultiplexer.h
+++ b/blimp/net/blimp_message_demultiplexer.h
@@ -34,7 +34,7 @@
   void AddProcessor(BlimpMessage::Type type, BlimpMessageProcessor* handler);
 
   // BlimpMessageProcessor implementation.
-  void ProcessMessage(scoped_ptr<BlimpMessage> message,
+  void ProcessMessage(std::unique_ptr<BlimpMessage> message,
                       const net::CompletionCallback& callback) override;
 
  private:
diff --git a/blimp/net/blimp_message_demultiplexer_unittest.cc b/blimp/net/blimp_message_demultiplexer_unittest.cc
index 95e63532..de16fbc 100644
--- a/blimp/net/blimp_message_demultiplexer_unittest.cc
+++ b/blimp/net/blimp_message_demultiplexer_unittest.cc
@@ -32,8 +32,8 @@
   }
 
  protected:
-  scoped_ptr<BlimpMessage> input_msg_;
-  scoped_ptr<BlimpMessage> compositor_msg_;
+  std::unique_ptr<BlimpMessage> input_msg_;
+  std::unique_ptr<BlimpMessage> compositor_msg_;
   MockBlimpMessageProcessor receiver1_;
   MockBlimpMessageProcessor receiver2_;
   net::CompletionCallback captured_cb_;
@@ -60,7 +60,7 @@
 
 TEST_F(BlimpMessageDemultiplexerTest, ProcessMessageNoRegisteredHandler) {
   net::TestCompletionCallback cb;
-  scoped_ptr<BlimpMessage> unknown_message(new BlimpMessage);
+  std::unique_ptr<BlimpMessage> unknown_message(new BlimpMessage);
   unknown_message->set_type(BlimpMessage::UNKNOWN);
   demux_.ProcessMessage(std::move(unknown_message), cb.callback());
   EXPECT_EQ(net::ERR_NOT_IMPLEMENTED, cb.WaitForResult());
diff --git a/blimp/net/blimp_message_multiplexer.cc b/blimp/net/blimp_message_multiplexer.cc
index 4d4703b7..0e53f3e 100644
--- a/blimp/net/blimp_message_multiplexer.cc
+++ b/blimp/net/blimp_message_multiplexer.cc
@@ -5,6 +5,7 @@
 #include "blimp/net/blimp_message_multiplexer.h"
 
 #include "base/logging.h"
+#include "base/memory/ptr_util.h"
 #include "blimp/common/proto/blimp_message.pb.h"
 #include "blimp/net/blimp_message_processor.h"
 
@@ -19,7 +20,7 @@
 
   // BlimpMessageProcessor implementation.
   // |message.type|, if set, must match the sender's type.
-  void ProcessMessage(scoped_ptr<BlimpMessage> message,
+  void ProcessMessage(std::unique_ptr<BlimpMessage> message,
                       const net::CompletionCallback& callback) override;
 
  private:
@@ -37,7 +38,7 @@
 MultiplexedSender::~MultiplexedSender() {}
 
 void MultiplexedSender::ProcessMessage(
-    scoped_ptr<BlimpMessage> message,
+    std::unique_ptr<BlimpMessage> message,
     const net::CompletionCallback& callback) {
   if (message->has_type()) {
     DCHECK_EQ(type_, message->type());
@@ -55,9 +56,9 @@
 
 BlimpMessageMultiplexer::~BlimpMessageMultiplexer() {}
 
-scoped_ptr<BlimpMessageProcessor> BlimpMessageMultiplexer::CreateSenderForType(
-    BlimpMessage::Type type) {
-  return make_scoped_ptr(
+std::unique_ptr<BlimpMessageProcessor>
+BlimpMessageMultiplexer::CreateSenderForType(BlimpMessage::Type type) {
+  return base::WrapUnique(
       new MultiplexedSender(output_weak_factory_.GetWeakPtr(), type));
 }
 }  // namespace blimp
diff --git a/blimp/net/blimp_message_multiplexer.h b/blimp/net/blimp_message_multiplexer.h
index 046f796b..8101edbb 100644
--- a/blimp/net/blimp_message_multiplexer.h
+++ b/blimp/net/blimp_message_multiplexer.h
@@ -5,8 +5,9 @@
 #ifndef BLIMP_NET_BLIMP_MESSAGE_MULTIPLEXER_H_
 #define BLIMP_NET_BLIMP_MESSAGE_MULTIPLEXER_H_
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "blimp/common/proto/blimp_message.pb.h"
 #include "blimp/net/blimp_net_export.h"
@@ -30,7 +31,7 @@
 
   // Creates a BlimpMessageProcessor object for sending messages of type |type|.
   // Any number of senders can be created at a time for a given type.
-  scoped_ptr<BlimpMessageProcessor> CreateSenderForType(
+  std::unique_ptr<BlimpMessageProcessor> CreateSenderForType(
       BlimpMessage::Type type);
 
  private:
diff --git a/blimp/net/blimp_message_multiplexer_unittest.cc b/blimp/net/blimp_message_multiplexer_unittest.cc
index ec0e8ff..4692da1a 100644
--- a/blimp/net/blimp_message_multiplexer_unittest.cc
+++ b/blimp/net/blimp_message_multiplexer_unittest.cc
@@ -44,12 +44,12 @@
  protected:
   MockBlimpMessageProcessor mock_output_processor_;
   BlimpMessageMultiplexer multiplexer_;
-  scoped_ptr<BlimpMessage> input_message_;
-  scoped_ptr<BlimpMessage> navigation_message_;
+  std::unique_ptr<BlimpMessage> input_message_;
+  std::unique_ptr<BlimpMessage> navigation_message_;
   BlimpMessage captured_message_;
   net::CompletionCallback captured_cb_;
-  scoped_ptr<BlimpMessageProcessor> input_processor_;
-  scoped_ptr<BlimpMessageProcessor> navigation_processor_;
+  std::unique_ptr<BlimpMessageProcessor> input_processor_;
+  std::unique_ptr<BlimpMessageProcessor> navigation_processor_;
 };
 
 // Verify that each sender propagates its types and copies the message payload
@@ -100,7 +100,7 @@
 // Verify that there is no limit on the number of senders for a given type.
 TEST_F(BlimpMessageMultiplexerTest, SenderMultiplicity) {
   net::TestCompletionCallback cb_4;
-  scoped_ptr<BlimpMessageProcessor> input_processor_2 =
+  std::unique_ptr<BlimpMessageProcessor> input_processor_2 =
       multiplexer_.CreateSenderForType(BlimpMessage::INPUT);
   input_processor_2->ProcessMessage(std::move(input_message_), cb_4.callback());
   EXPECT_EQ(BlimpMessage::INPUT, captured_message_.type());
diff --git a/blimp/net/blimp_message_output_buffer.cc b/blimp/net/blimp_message_output_buffer.cc
index 7ba9324..b5c5ec56 100644
--- a/blimp/net/blimp_message_output_buffer.cc
+++ b/blimp/net/blimp_message_output_buffer.cc
@@ -7,6 +7,7 @@
 #include <algorithm>
 
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/message_loop/message_loop.h"
 #include "blimp/common/logging.h"
 #include "blimp/common/proto/blimp_message.pb.h"
@@ -58,7 +59,7 @@
 }
 
 void BlimpMessageOutputBuffer::ProcessMessage(
-    scoped_ptr<BlimpMessage> message,
+    std::unique_ptr<BlimpMessage> message,
     const net::CompletionCallback& callback) {
   DVLOG(2) << "OutputBuffer::ProcessMessage " << *message;
 
@@ -71,7 +72,7 @@
                   << " bytes.";
 
   write_buffer_.push_back(
-      make_scoped_ptr(new BufferEntry(std::move(message), callback)));
+      base::WrapUnique(new BufferEntry(std::move(message), callback)));
 
   // Write the message
   if (write_buffer_.size() == 1 && output_processor_) {
@@ -118,7 +119,7 @@
 }
 
 BlimpMessageOutputBuffer::BufferEntry::BufferEntry(
-    scoped_ptr<BlimpMessage> message,
+    std::unique_ptr<BlimpMessage> message,
     net::CompletionCallback callback)
     : message(std::move(message)), callback(callback) {}
 
@@ -131,7 +132,7 @@
     return;
   }
 
-  scoped_ptr<BlimpMessage> message_to_write(
+  std::unique_ptr<BlimpMessage> message_to_write(
       new BlimpMessage(*write_buffer_.front()->message));
   DVLOG(3) << "Writing message (id="
            << write_buffer_.front()->message->message_id()
diff --git a/blimp/net/blimp_message_output_buffer.h b/blimp/net/blimp_message_output_buffer.h
index 97bd2ff3..bc5bd60 100644
--- a/blimp/net/blimp_message_output_buffer.h
+++ b/blimp/net/blimp_message_output_buffer.h
@@ -46,7 +46,7 @@
   // BlimpMessageProcessor implementation.
   // |callback|, if set, will be called once the remote end has acknowledged the
   // receipt of |message|.
-  void ProcessMessage(scoped_ptr<BlimpMessage> message,
+  void ProcessMessage(std::unique_ptr<BlimpMessage> message,
                       const net::CompletionCallback& callback) override;
 
   // MessageCheckpointObserver implementation.
@@ -57,15 +57,15 @@
 
  private:
   struct BufferEntry {
-    BufferEntry(scoped_ptr<BlimpMessage> message,
+    BufferEntry(std::unique_ptr<BlimpMessage> message,
                 net::CompletionCallback callback);
     ~BufferEntry();
 
-    const scoped_ptr<BlimpMessage> message;
+    const std::unique_ptr<BlimpMessage> message;
     const net::CompletionCallback callback;
   };
 
-  typedef std::list<scoped_ptr<BufferEntry>> MessageBuffer;
+  typedef std::list<std::unique_ptr<BufferEntry>> MessageBuffer;
 
   // Writes the next message in the buffer if an output processor is attached
   // and the buffer contains a message.
diff --git a/blimp/net/blimp_message_output_buffer_unittest.cc b/blimp/net/blimp_message_output_buffer_unittest.cc
index 93b2772..6db7ec2 100644
--- a/blimp/net/blimp_message_output_buffer_unittest.cc
+++ b/blimp/net/blimp_message_output_buffer_unittest.cc
@@ -6,6 +6,7 @@
 
 #include "base/callback_helpers.h"
 #include "base/logging.h"
+#include "base/memory/ptr_util.h"
 #include "base/message_loop/message_loop.h"
 #include "blimp/common/proto/blimp_message.pb.h"
 #include "blimp/net/test_common.h"
@@ -58,7 +59,7 @@
   base::MessageLoop message_loop_;
   net::CompletionCallback captured_cb_;
   MockBlimpMessageProcessor output_processor_;
-  scoped_ptr<BlimpMessageOutputBuffer> buffer_;
+  std::unique_ptr<BlimpMessageOutputBuffer> buffer_;
   testing::InSequence s;
 };
 
@@ -71,9 +72,9 @@
   AddOutputExpectation(compositor_msg_);
 
   // Accumulate two messages.
-  buffer_->ProcessMessage(make_scoped_ptr(new BlimpMessage(input_msg_)),
+  buffer_->ProcessMessage(base::WrapUnique(new BlimpMessage(input_msg_)),
                           complete_cb_1.callback());
-  buffer_->ProcessMessage(make_scoped_ptr(new BlimpMessage(compositor_msg_)),
+  buffer_->ProcessMessage(base::WrapUnique(new BlimpMessage(compositor_msg_)),
                           complete_cb_2.callback());
   ASSERT_EQ(2, buffer_->GetBufferByteSizeForTest());
 
@@ -111,7 +112,7 @@
   buffer_->SetOutputProcessor(&output_processor_);
 
   // Message #0 is buffered, sent, acknowledged.
-  buffer_->ProcessMessage(make_scoped_ptr(new BlimpMessage(input_msg_)),
+  buffer_->ProcessMessage(base::WrapUnique(new BlimpMessage(input_msg_)),
                           complete_cb_1.callback());
   ASSERT_EQ(1, buffer_->GetBufferByteSizeForTest());
   ASSERT_FALSE(captured_cb_.is_null());
@@ -122,7 +123,7 @@
   ASSERT_EQ(0, buffer_->GetBufferByteSizeForTest());
   ASSERT_EQ(0, buffer_->GetUnacknowledgedMessageCountForTest());
 
-  buffer_->ProcessMessage(make_scoped_ptr(new BlimpMessage(compositor_msg_)),
+  buffer_->ProcessMessage(base::WrapUnique(new BlimpMessage(compositor_msg_)),
                           complete_cb_2.callback());
   ASSERT_EQ(1, buffer_->GetBufferByteSizeForTest());
   ASSERT_FALSE(captured_cb_.is_null());
@@ -143,7 +144,7 @@
   AddOutputExpectation(compositor_msg_);
 
   // Message #1 is written but unacknowledged.
-  buffer_->ProcessMessage(make_scoped_ptr(new BlimpMessage(input_msg_)),
+  buffer_->ProcessMessage(base::WrapUnique(new BlimpMessage(input_msg_)),
                           complete_cb_1.callback());
   ASSERT_EQ(1, buffer_->GetBufferByteSizeForTest());
   ASSERT_TRUE(captured_cb_.is_null());
@@ -154,7 +155,7 @@
   ASSERT_EQ(1, buffer_->GetUnacknowledgedMessageCountForTest());
 
   // Message #2 is written but unacknowledged.
-  buffer_->ProcessMessage(make_scoped_ptr(new BlimpMessage(compositor_msg_)),
+  buffer_->ProcessMessage(base::WrapUnique(new BlimpMessage(compositor_msg_)),
                           complete_cb_2.callback());
   ASSERT_EQ(2, buffer_->GetBufferByteSizeForTest());
   ASSERT_FALSE(captured_cb_.is_null());
@@ -180,7 +181,7 @@
   AddOutputExpectation(input_msg_);
 
   // Accumulate two messages.
-  buffer_->ProcessMessage(make_scoped_ptr(new BlimpMessage(input_msg_)),
+  buffer_->ProcessMessage(base::WrapUnique(new BlimpMessage(input_msg_)),
                           complete_cb_1.callback());
   ASSERT_EQ(1, buffer_->GetBufferByteSizeForTest());
 
@@ -218,9 +219,9 @@
   AddOutputExpectation(compositor_msg_);  // Retransmitted message.
 
   // Accumulate two messages.
-  buffer_->ProcessMessage(make_scoped_ptr(new BlimpMessage(input_msg_)),
+  buffer_->ProcessMessage(base::WrapUnique(new BlimpMessage(input_msg_)),
                           complete_cb_1.callback());
-  buffer_->ProcessMessage(make_scoped_ptr(new BlimpMessage(compositor_msg_)),
+  buffer_->ProcessMessage(base::WrapUnique(new BlimpMessage(compositor_msg_)),
                           complete_cb_2.callback());
   ASSERT_EQ(2, buffer_->GetBufferByteSizeForTest());
 
diff --git a/blimp/net/blimp_message_processor.h b/blimp/net/blimp_message_processor.h
index d0609184..f13b5be0 100644
--- a/blimp/net/blimp_message_processor.h
+++ b/blimp/net/blimp_message_processor.h
@@ -5,7 +5,8 @@
 #ifndef BLIMP_NET_BLIMP_MESSAGE_PROCESSOR_H_
 #define BLIMP_NET_BLIMP_MESSAGE_PROCESSOR_H_
 
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
 #include "net/base/completion_callback.h"
 
 namespace blimp {
@@ -22,7 +23,7 @@
 
   // Processes the BlimpMessage asynchronously.
   // The result of the operation is returned to the caller via |callback|.
-  virtual void ProcessMessage(scoped_ptr<BlimpMessage> message,
+  virtual void ProcessMessage(std::unique_ptr<BlimpMessage> message,
                               const net::CompletionCallback& callback) = 0;
 };
 
diff --git a/blimp/net/blimp_message_pump.cc b/blimp/net/blimp_message_pump.cc
index 8d512242..cc53d1f 100644
--- a/blimp/net/blimp_message_pump.cc
+++ b/blimp/net/blimp_message_pump.cc
@@ -54,7 +54,7 @@
   DCHECK(read_inflight_);
   read_inflight_ = false;
   if (result >= 0) {
-    scoped_ptr<BlimpMessage> message(new BlimpMessage);
+    std::unique_ptr<BlimpMessage> message(new BlimpMessage);
     if (message->ParseFromArray(buffer_->data(), result)) {
       VLOG(1) << "Received " << *message;
       processor_->ProcessMessage(
diff --git a/blimp/net/blimp_message_pump.h b/blimp/net/blimp_message_pump.h
index 07a80c1..199ca51 100644
--- a/blimp/net/blimp_message_pump.h
+++ b/blimp/net/blimp_message_pump.h
@@ -5,9 +5,10 @@
 #ifndef BLIMP_NET_BLIMP_MESSAGE_PUMP_H_
 #define BLIMP_NET_BLIMP_MESSAGE_PUMP_H_
 
+#include <memory>
+
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "blimp/net/blimp_net_export.h"
 #include "net/base/completion_callback.h"
diff --git a/blimp/net/blimp_message_pump_unittest.cc b/blimp/net/blimp_message_pump_unittest.cc
index 8d813e6..5511c0d 100644
--- a/blimp/net/blimp_message_pump_unittest.cc
+++ b/blimp/net/blimp_message_pump_unittest.cc
@@ -43,13 +43,13 @@
   void NullMessageProcessor() { message_pump_->SetMessageProcessor(nullptr); }
 
  protected:
-  scoped_ptr<BlimpMessage> message1_;
-  scoped_ptr<BlimpMessage> message2_;
+  std::unique_ptr<BlimpMessage> message1_;
+  std::unique_ptr<BlimpMessage> message2_;
 
   testing::StrictMock<MockPacketReader> reader_;
   testing::StrictMock<MockConnectionErrorObserver> error_observer_;
   testing::StrictMock<MockBlimpMessageProcessor> receiver_;
-  scoped_ptr<BlimpMessagePump> message_pump_;
+  std::unique_ptr<BlimpMessagePump> message_pump_;
 };
 
 // Reader completes reading one packet asynchronously.
diff --git a/blimp/net/blimp_message_thread_pipe.cc b/blimp/net/blimp_message_thread_pipe.cc
index 7ebcf30f..3848d9b 100644
--- a/blimp/net/blimp_message_thread_pipe.cc
+++ b/blimp/net/blimp_message_thread_pipe.cc
@@ -7,6 +7,7 @@
 #include "base/bind_helpers.h"
 #include "base/location.h"
 #include "base/logging.h"
+#include "base/memory/ptr_util.h"
 #include "base/sequenced_task_runner.h"
 #include "base/threading/sequenced_task_runner_handle.h"
 #include "blimp/common/proto/blimp_message.pb.h"
@@ -24,7 +25,7 @@
   ~BlimpMessageThreadProxy() override;
 
   // BlimpMessageProcessor implementation.
-  void ProcessMessage(scoped_ptr<BlimpMessage> message,
+  void ProcessMessage(std::unique_ptr<BlimpMessage> message,
                       const net::CompletionCallback& callback) override;
 
  private:
@@ -46,7 +47,7 @@
 BlimpMessageThreadProxy::~BlimpMessageThreadProxy() {}
 
 void DispatchProcessMessage(const base::WeakPtr<BlimpMessageThreadPipe> pipe,
-                            scoped_ptr<BlimpMessage> message,
+                            std::unique_ptr<BlimpMessage> message,
                             const net::CompletionCallback& callback) {
   // Process the message only if the pipe is still active.
   if (pipe) {
@@ -74,7 +75,7 @@
 }
 
 void BlimpMessageThreadProxy::ProcessMessage(
-    scoped_ptr<BlimpMessage> message,
+    std::unique_ptr<BlimpMessage> message,
     const net::CompletionCallback& callback) {
   // If |callback| is non-null then wrap it to be called on this thread, iff
   // this proxy instance is still alive at the time.
@@ -101,8 +102,8 @@
   DCHECK(target_task_runner_->RunsTasksOnCurrentThread());
 }
 
-scoped_ptr<BlimpMessageProcessor> BlimpMessageThreadPipe::CreateProxy() {
-  return make_scoped_ptr(new BlimpMessageThreadProxy(
+std::unique_ptr<BlimpMessageProcessor> BlimpMessageThreadPipe::CreateProxy() {
+  return base::WrapUnique(new BlimpMessageThreadProxy(
       target_task_runner_, weak_factory_.GetWeakPtr()));
 }
 
diff --git a/blimp/net/blimp_message_thread_pipe.h b/blimp/net/blimp_message_thread_pipe.h
index bca86d1..d6c8321 100644
--- a/blimp/net/blimp_message_thread_pipe.h
+++ b/blimp/net/blimp_message_thread_pipe.h
@@ -5,8 +5,9 @@
 #ifndef BLIMP_NET_BLIMP_MESSAGE_THREAD_PIPE_H_
 #define BLIMP_NET_BLIMP_MESSAGE_THREAD_PIPE_H_
 
+#include <memory>
+
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "blimp/net/blimp_net_export.h"
 
@@ -45,7 +46,7 @@
   // has been set, but cannot be used until it has after been set -
   // see the class-level comment on usage.
   // Proxies must be deleted on the thread on which they are used.
-  scoped_ptr<BlimpMessageProcessor> CreateProxy();
+  std::unique_ptr<BlimpMessageProcessor> CreateProxy();
 
   // Sets/gets the target MessageProcessor on the target thread.
   void set_target_processor(BlimpMessageProcessor* processor);
diff --git a/blimp/net/blimp_message_thread_pipe_unittest.cc b/blimp/net/blimp_message_thread_pipe_unittest.cc
index dd267da7..6c5caf03 100644
--- a/blimp/net/blimp_message_thread_pipe_unittest.cc
+++ b/blimp/net/blimp_message_thread_pipe_unittest.cc
@@ -5,6 +5,7 @@
 #include "blimp/net/blimp_message_thread_pipe.h"
 
 #include "base/location.h"
+#include "base/memory/ptr_util.h"
 #include "base/memory/ref_counted.h"
 #include "base/message_loop/message_loop.h"
 #include "base/threading/thread.h"
@@ -31,7 +32,7 @@
     // Note that none of this will "touch" the target processor, so it's
     // safe to do here, before EXPECT_CALL() expectations are set up.
     ASSERT_TRUE(thread_.Start());
-    pipe_ = make_scoped_ptr(new BlimpMessageThreadPipe(thread_.task_runner()));
+    pipe_ = base::WrapUnique(new BlimpMessageThreadPipe(thread_.task_runner()));
     proxy_ = pipe_->CreateProxy();
 
     thread_.task_runner()->PostTask(
@@ -67,8 +68,8 @@
 
   NullBlimpMessageProcessor null_processor_;
 
-  scoped_ptr<BlimpMessageThreadPipe> pipe_;
-  scoped_ptr<BlimpMessageProcessor> proxy_;
+  std::unique_ptr<BlimpMessageThreadPipe> pipe_;
+  std::unique_ptr<BlimpMessageProcessor> proxy_;
 
   base::Thread thread_;
 };
@@ -78,7 +79,7 @@
 
   // Pass a message to the proxy for processing.
   proxy_->ProcessMessage(
-      make_scoped_ptr(new BlimpMessage),
+      base::WrapUnique(new BlimpMessage),
       base::Bind(&BlimpMessageThreadPipeTest::MockCompletionCallback,
                  base::Unretained(this)));
 }
@@ -88,7 +89,7 @@
 
   // Pass a message to the proxy, but then immediately delete the proxy.
   proxy_->ProcessMessage(
-      make_scoped_ptr(new BlimpMessage),
+      base::WrapUnique(new BlimpMessage),
       base::Bind(&BlimpMessageThreadPipeTest::MockCompletionCallback,
                  base::Unretained(this)));
   proxy_ = nullptr;
@@ -99,12 +100,12 @@
 
   // Tear down the pipe (on |thread_|) between two ProcessMessage calls.
   proxy_->ProcessMessage(
-      make_scoped_ptr(new BlimpMessage),
+      base::WrapUnique(new BlimpMessage),
       base::Bind(&BlimpMessageThreadPipeTest::MockCompletionCallback,
                  base::Unretained(this)));
   DeletePipeOnThread();
   proxy_->ProcessMessage(
-      make_scoped_ptr(new BlimpMessage),
+      base::WrapUnique(new BlimpMessage),
       base::Bind(&BlimpMessageThreadPipeTest::MockCompletionCallback,
                  base::Unretained(this)));
 }
@@ -113,7 +114,7 @@
   // Don't expect the mock to be called, but do expect not to crash.
   EXPECT_CALL(*this, MockCompletionCallback(_)).Times(0);
 
-  proxy_->ProcessMessage(make_scoped_ptr(new BlimpMessage),
+  proxy_->ProcessMessage(base::WrapUnique(new BlimpMessage),
                          net::CompletionCallback());
 }
 
diff --git a/blimp/net/blimp_transport.h b/blimp/net/blimp_transport.h
index 8deabd5a..e74bb16 100644
--- a/blimp/net/blimp_transport.h
+++ b/blimp/net/blimp_transport.h
@@ -5,9 +5,9 @@
 #ifndef BLIMP_NET_BLIMP_TRANSPORT_H_
 #define BLIMP_NET_BLIMP_TRANSPORT_H_
 
+#include <memory>
 #include <string>
 
-#include "base/memory/scoped_ptr.h"
 #include "net/base/completion_callback.h"
 
 namespace blimp {
@@ -32,7 +32,7 @@
   virtual void Connect(const net::CompletionCallback& callback) = 0;
 
   // Returns the connection object after a successful Connect().
-  virtual scoped_ptr<BlimpConnection> TakeConnection() = 0;
+  virtual std::unique_ptr<BlimpConnection> TakeConnection() = 0;
 
   // Gets transport name, e.g. "TCP", "SSL", "mock", etc.
   virtual const char* GetName() const = 0;
diff --git a/blimp/net/browser_connection_handler.cc b/blimp/net/browser_connection_handler.cc
index 10448aa..1b4ea1d 100644
--- a/blimp/net/browser_connection_handler.cc
+++ b/blimp/net/browser_connection_handler.cc
@@ -33,7 +33,8 @@
 
 BrowserConnectionHandler::~BrowserConnectionHandler() {}
 
-scoped_ptr<BlimpMessageProcessor> BrowserConnectionHandler::RegisterFeature(
+std::unique_ptr<BlimpMessageProcessor>
+BrowserConnectionHandler::RegisterFeature(
     BlimpMessage::Type type,
     BlimpMessageProcessor* incoming_processor) {
   demultiplexer_->AddProcessor(type, incoming_processor);
@@ -41,7 +42,7 @@
 }
 
 void BrowserConnectionHandler::HandleConnection(
-    scoped_ptr<BlimpConnection> connection) {
+    std::unique_ptr<BlimpConnection> connection) {
   DCHECK(connection);
   VLOG(1) << "HandleConnection " << connection.get();
 
diff --git a/blimp/net/browser_connection_handler.h b/blimp/net/browser_connection_handler.h
index 0304ae1..df71d9b 100644
--- a/blimp/net/browser_connection_handler.h
+++ b/blimp/net/browser_connection_handler.h
@@ -5,8 +5,9 @@
 #ifndef BLIMP_NET_BROWSER_CONNECTION_HANDLER_H_
 #define BLIMP_NET_BROWSER_CONNECTION_HANDLER_H_
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "blimp/common/proto/blimp_message.pb.h"
 #include "blimp/net/blimp_net_export.h"
 #include "blimp/net/connection_error_observer.h"
@@ -40,12 +41,12 @@
   // this object is in-use.
   //
   // Returns a BlimpMessageProcessor object for sending messages of type |type|.
-  virtual scoped_ptr<BlimpMessageProcessor> RegisterFeature(
+  virtual std::unique_ptr<BlimpMessageProcessor> RegisterFeature(
       BlimpMessage::Type type,
       BlimpMessageProcessor* incoming_processor);
 
   // ConnectionHandler implementation.
-  void HandleConnection(scoped_ptr<BlimpConnection> connection) override;
+  void HandleConnection(std::unique_ptr<BlimpConnection> connection) override;
 
   // ConnectionErrorObserver implementation.
   void OnConnectionError(int error) override;
@@ -54,21 +55,21 @@
   void DropCurrentConnection();
 
   // Routes incoming messages to the relevant feature-specific handlers.
-  scoped_ptr<BlimpMessageDemultiplexer> demultiplexer_;
+  std::unique_ptr<BlimpMessageDemultiplexer> demultiplexer_;
 
   // Provides buffering of outgoing messages, for use in session-recovery.
-  scoped_ptr<BlimpMessageOutputBuffer> output_buffer_;
+  std::unique_ptr<BlimpMessageOutputBuffer> output_buffer_;
 
   // Routes outgoing messages from feature-specific handlers to a single
   // message stream.
-  scoped_ptr<BlimpMessageMultiplexer> multiplexer_;
+  std::unique_ptr<BlimpMessageMultiplexer> multiplexer_;
 
   // Dispatches checkpoint/ACK messages to the outgoing processor, as the
   // incoming processor completes processing them.
-  scoped_ptr<BlimpMessageCheckpointer> checkpointer_;
+  std::unique_ptr<BlimpMessageCheckpointer> checkpointer_;
 
   // Holds network resources while there is a Client connected.
-  scoped_ptr<BlimpConnection> connection_;
+  std::unique_ptr<BlimpConnection> connection_;
 
   DISALLOW_COPY_AND_ASSIGN(BrowserConnectionHandler);
 };
diff --git a/blimp/net/browser_connection_handler_unittest.cc b/blimp/net/browser_connection_handler_unittest.cc
index 2a9f739..2c53949 100644
--- a/blimp/net/browser_connection_handler_unittest.cc
+++ b/blimp/net/browser_connection_handler_unittest.cc
@@ -2,15 +2,18 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "blimp/net/browser_connection_handler.h"
+
 #include <stddef.h>
+
 #include <string>
 
 #include "base/callback_helpers.h"
+#include "base/memory/ptr_util.h"
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
 #include "blimp/common/proto/blimp_message.pb.h"
 #include "blimp/net/blimp_message_processor.h"
-#include "blimp/net/browser_connection_handler.h"
 #include "blimp/net/common.h"
 #include "blimp/net/connection_error_observer.h"
 #include "blimp/net/test_common.h"
@@ -63,7 +66,7 @@
 
  private:
   testing::StrictMock<MockBlimpMessageProcessor> incoming_message_processor_;
-  scoped_ptr<BlimpMessageProcessor> outgoing_message_processor_;
+  std::unique_ptr<BlimpMessageProcessor> outgoing_message_processor_;
 };
 
 class FakeBlimpConnection : public BlimpConnection,
@@ -88,13 +91,13 @@
   BlimpMessageProcessor* GetOutgoingMessageProcessor() override { return this; }
 
  private:
-  void ForwardMessage(scoped_ptr<BlimpMessage> message) {
+  void ForwardMessage(std::unique_ptr<BlimpMessage> message) {
     other_end_->incoming_message_processor_->ProcessMessage(
         std::move(message), net::CompletionCallback());
   }
 
   // BlimpMessageProcessor implementation.
-  void ProcessMessage(scoped_ptr<BlimpMessage> message,
+  void ProcessMessage(std::unique_ptr<BlimpMessage> message,
                       const net::CompletionCallback& callback) override {
     base::MessageLoop::current()->PostTask(
         FROM_HERE, base::Bind(&FakeBlimpConnection::ForwardMessage,
@@ -108,15 +111,15 @@
   BlimpMessageProcessor* incoming_message_processor_ = nullptr;
 };
 
-scoped_ptr<BlimpMessage> CreateInputMessage(int tab_id) {
-  scoped_ptr<BlimpMessage> output(new BlimpMessage);
+std::unique_ptr<BlimpMessage> CreateInputMessage(int tab_id) {
+  std::unique_ptr<BlimpMessage> output(new BlimpMessage);
   output->set_type(BlimpMessage::INPUT);
   output->set_target_tab_id(tab_id);
   return output;
 }
 
-scoped_ptr<BlimpMessage> CreateControlMessage(int tab_id) {
-  scoped_ptr<BlimpMessage> output(new BlimpMessage);
+std::unique_ptr<BlimpMessage> CreateControlMessage(int tab_id) {
+  std::unique_ptr<BlimpMessage> output(new BlimpMessage);
   output->set_type(BlimpMessage::TAB_CONTROL);
   output->set_target_tab_id(tab_id);
   return output;
@@ -149,9 +152,9 @@
     client_connection_->set_other_end(engine_connection_);
     engine_connection_->set_other_end(client_connection_);
     client_connection_handler_->HandleConnection(
-        make_scoped_ptr(client_connection_));
+        base::WrapUnique(client_connection_));
     engine_connection_handler_->HandleConnection(
-        make_scoped_ptr(engine_connection_));
+        base::WrapUnique(engine_connection_));
   }
 
   base::MessageLoop message_loop_;
@@ -159,19 +162,21 @@
   FakeBlimpConnection* client_connection_;
   FakeBlimpConnection* engine_connection_;
 
-  scoped_ptr<BrowserConnectionHandler> client_connection_handler_;
-  scoped_ptr<BrowserConnectionHandler> engine_connection_handler_;
+  std::unique_ptr<BrowserConnectionHandler> client_connection_handler_;
+  std::unique_ptr<BrowserConnectionHandler> engine_connection_handler_;
 
-  scoped_ptr<FakeFeature> client_input_feature_;
-  scoped_ptr<FakeFeature> engine_input_feature_;
-  scoped_ptr<FakeFeature> client_control_feature_;
-  scoped_ptr<FakeFeature> engine_control_feature_;
+  std::unique_ptr<FakeFeature> client_input_feature_;
+  std::unique_ptr<FakeFeature> engine_input_feature_;
+  std::unique_ptr<FakeFeature> client_control_feature_;
+  std::unique_ptr<FakeFeature> engine_control_feature_;
 };
 
 TEST_F(BrowserConnectionHandlerTest, ExchangeMessages) {
-  scoped_ptr<BlimpMessage> client_input_message = CreateInputMessage(1);
-  scoped_ptr<BlimpMessage> client_control_message = CreateControlMessage(1);
-  scoped_ptr<BlimpMessage> engine_control_message = CreateControlMessage(2);
+  std::unique_ptr<BlimpMessage> client_input_message = CreateInputMessage(1);
+  std::unique_ptr<BlimpMessage> client_control_message =
+      CreateControlMessage(1);
+  std::unique_ptr<BlimpMessage> engine_control_message =
+      CreateControlMessage(2);
 
   EXPECT_CALL(
       *(engine_input_feature_->incoming_message_processor()),
@@ -197,13 +202,13 @@
 TEST_F(BrowserConnectionHandlerTest, ConnectionError) {
   // Engine will not get message after connection error.
   client_connection_->error_observer()->OnConnectionError(net::ERR_FAILED);
-  scoped_ptr<BlimpMessage> client_input_message = CreateInputMessage(1);
+  std::unique_ptr<BlimpMessage> client_input_message = CreateInputMessage(1);
   client_input_feature_->outgoing_message_processor()->ProcessMessage(
       std::move(client_input_message), net::CompletionCallback());
 }
 
 TEST_F(BrowserConnectionHandlerTest, ReconnectionAfterError) {
-  scoped_ptr<BlimpMessage> client_input_message = CreateInputMessage(1);
+  std::unique_ptr<BlimpMessage> client_input_message = CreateInputMessage(1);
   EXPECT_CALL(
       *(engine_input_feature_->incoming_message_processor()),
       MockableProcessMessage(EqualsMessageIgnoringId(*client_input_message), _))
diff --git a/blimp/net/client_connection_manager.cc b/blimp/net/client_connection_manager.cc
index 7ffc77a..1d513e2 100644
--- a/blimp/net/client_connection_manager.cc
+++ b/blimp/net/client_connection_manager.cc
@@ -26,7 +26,7 @@
 ClientConnectionManager::~ClientConnectionManager() {}
 
 void ClientConnectionManager::AddTransport(
-    scoped_ptr<BlimpTransport> transport) {
+    std::unique_ptr<BlimpTransport> transport) {
   DCHECK(transport);
   transports_.push_back(std::move(transport));
 }
@@ -54,7 +54,7 @@
   DCHECK_NE(result, net::ERR_IO_PENDING);
   const auto& transport = transports_[transport_index];
   if (result == net::OK) {
-    scoped_ptr<BlimpConnection> connection = transport->TakeConnection();
+    std::unique_ptr<BlimpConnection> connection = transport->TakeConnection();
     connection->AddConnectionErrorObserver(this);
     SendAuthenticationMessage(std::move(connection));
   } else {
@@ -65,7 +65,7 @@
 }
 
 void ClientConnectionManager::SendAuthenticationMessage(
-    scoped_ptr<BlimpConnection> connection) {
+    std::unique_ptr<BlimpConnection> connection) {
   DVLOG(1) << "Sending authentication message.";
   connection->GetOutgoingMessageProcessor()->ProcessMessage(
       CreateStartConnectionMessage(client_token_, kProtocolVersion),
@@ -75,7 +75,7 @@
 }
 
 void ClientConnectionManager::OnAuthenticationMessageSent(
-    scoped_ptr<BlimpConnection> connection,
+    std::unique_ptr<BlimpConnection> connection,
     int result) {
   DVLOG(1) << "AuthenticationMessageSent, result=" << result;
   if (result != net::OK) {
diff --git a/blimp/net/client_connection_manager.h b/blimp/net/client_connection_manager.h
index 10644d0..5e39006 100644
--- a/blimp/net/client_connection_manager.h
+++ b/blimp/net/client_connection_manager.h
@@ -5,11 +5,11 @@
 #ifndef BLIMP_NET_CLIENT_CONNECTION_MANAGER_H_
 #define BLIMP_NET_CLIENT_CONNECTION_MANAGER_H_
 
+#include <memory>
 #include <string>
 #include <vector>
 
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "blimp/net/blimp_net_export.h"
 #include "blimp/net/connection_error_observer.h"
@@ -36,7 +36,7 @@
 
   // Adds a transport. All transports are expected to be added before invoking
   // |Connect|.
-  void AddTransport(scoped_ptr<BlimpTransport> transport);
+  void AddTransport(std::unique_ptr<BlimpTransport> transport);
 
   // Attempts to create a connection using any of the BlimpTransports in
   // |transports_|.
@@ -60,11 +60,11 @@
   void OnConnectResult(int transport_index, int result);
 
   // Sends authentication message to the engine via |connection|.
-  void SendAuthenticationMessage(scoped_ptr<BlimpConnection> connection);
+  void SendAuthenticationMessage(std::unique_ptr<BlimpConnection> connection);
 
   // Invoked after the authentication message is sent to |connection|.
   // The result of the write operation is passed via |result|.
-  void OnAuthenticationMessageSent(scoped_ptr<BlimpConnection> connection,
+  void OnAuthenticationMessageSent(std::unique_ptr<BlimpConnection> connection,
                                    int result);
 
   // ConnectionErrorObserver implementation.
@@ -72,7 +72,7 @@
 
   std::string client_token_;
   ConnectionHandler* connection_handler_;
-  std::vector<scoped_ptr<BlimpTransport>> transports_;
+  std::vector<std::unique_ptr<BlimpTransport>> transports_;
   base::WeakPtrFactory<ClientConnectionManager> weak_factory_;
 
   DISALLOW_COPY_AND_ASSIGN(ClientConnectionManager);
diff --git a/blimp/net/client_connection_manager_unittest.cc b/blimp/net/client_connection_manager_unittest.cc
index 3a424ff5..fd128e1 100644
--- a/blimp/net/client_connection_manager_unittest.cc
+++ b/blimp/net/client_connection_manager_unittest.cc
@@ -2,17 +2,20 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "blimp/net/client_connection_manager.h"
+
 #include <stddef.h>
+
 #include <string>
 
 #include "base/callback_helpers.h"
+#include "base/memory/ptr_util.h"
 #include "base/message_loop/message_loop.h"
 #include "blimp/common/create_blimp_message.h"
 #include "blimp/common/proto/blimp_message.pb.h"
 #include "blimp/common/protocol_version.h"
 #include "blimp/net/blimp_connection.h"
 #include "blimp/net/blimp_transport.h"
-#include "blimp/net/client_connection_manager.h"
 #include "blimp/net/test_common.h"
 #include "net/base/completion_callback.h"
 #include "net/base/net_errors.h"
@@ -38,8 +41,8 @@
         transport2_(new testing::StrictMock<MockTransport>),
         reader_(new MockPacketReader),
         writer_(new MockPacketWriter),
-        connection_(new BlimpConnection(make_scoped_ptr(reader_),
-                                        make_scoped_ptr(writer_))),
+        connection_(new BlimpConnection(base::WrapUnique(reader_),
+                                        base::WrapUnique(writer_))),
         start_connection_message_(
             CreateStartConnectionMessage(kDummyClientToken, kProtocolVersion)) {
     manager_->set_client_token(kDummyClientToken);
@@ -50,13 +53,13 @@
  protected:
   base::MessageLoop message_loop_;
   testing::StrictMock<MockConnectionHandler> connection_handler_;
-  scoped_ptr<ClientConnectionManager> manager_;
-  scoped_ptr<testing::StrictMock<MockTransport>> transport1_;
-  scoped_ptr<testing::StrictMock<MockTransport>> transport2_;
+  std::unique_ptr<ClientConnectionManager> manager_;
+  std::unique_ptr<testing::StrictMock<MockTransport>> transport1_;
+  std::unique_ptr<testing::StrictMock<MockTransport>> transport2_;
   MockPacketReader* reader_;
   MockPacketWriter* writer_;
-  scoped_ptr<BlimpConnection> connection_;
-  scoped_ptr<BlimpMessage> start_connection_message_;
+  std::unique_ptr<BlimpConnection> connection_;
+  std::unique_ptr<BlimpMessage> start_connection_message_;
 };
 
 // The 1st transport connects, and the 2nd transport is not used.
diff --git a/blimp/net/compressed_packet_reader.cc b/blimp/net/compressed_packet_reader.cc
index 41dc294..92a3b9ae 100644
--- a/blimp/net/compressed_packet_reader.cc
+++ b/blimp/net/compressed_packet_reader.cc
@@ -18,7 +18,8 @@
 
 namespace blimp {
 
-CompressedPacketReader::CompressedPacketReader(scoped_ptr<PacketReader> source)
+CompressedPacketReader::CompressedPacketReader(
+    std::unique_ptr<PacketReader> source)
     : source_(std::move(source)),
       compressed_buf_(new net::GrowableIOBuffer),
       weak_factory_(this) {
diff --git a/blimp/net/compressed_packet_reader.h b/blimp/net/compressed_packet_reader.h
index e97d7710..2b44b16d 100644
--- a/blimp/net/compressed_packet_reader.h
+++ b/blimp/net/compressed_packet_reader.h
@@ -21,7 +21,7 @@
 class BLIMP_NET_EXPORT CompressedPacketReader : public PacketReader {
  public:
   // |source|: The source which from which compressed packets are read.
-  explicit CompressedPacketReader(scoped_ptr<PacketReader> source);
+  explicit CompressedPacketReader(std::unique_ptr<PacketReader> source);
 
   ~CompressedPacketReader() override;
 
@@ -49,7 +49,7 @@
   int DecompressPacket(const scoped_refptr<net::GrowableIOBuffer>& decompressed,
                        int size);
 
-  scoped_ptr<PacketReader> source_;
+  std::unique_ptr<PacketReader> source_;
   scoped_refptr<net::GrowableIOBuffer> compressed_buf_;
   z_stream zlib_stream_;
 
diff --git a/blimp/net/compressed_packet_unittest.cc b/blimp/net/compressed_packet_unittest.cc
index 36a6b1f..61e39b8 100644
--- a/blimp/net/compressed_packet_unittest.cc
+++ b/blimp/net/compressed_packet_unittest.cc
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "base/memory/ptr_util.h"
 #include "base/sys_byteorder.h"
 #include "blimp/net/common.h"
 #include "blimp/net/compressed_packet_reader.h"
@@ -48,9 +49,9 @@
       : mock_reader_(new MockPacketReader),
         mock_writer_(new MockPacketWriter),
         compressed_reader_(
-            new CompressedPacketReader(make_scoped_ptr(mock_reader_))),
+            new CompressedPacketReader(base::WrapUnique(mock_reader_))),
         compressed_writer_(
-            new CompressedPacketWriter(make_scoped_ptr(mock_writer_))) {}
+            new CompressedPacketWriter(base::WrapUnique(mock_writer_))) {}
   ~CompressedPacketTest() override {}
 
  protected:
@@ -98,8 +99,8 @@
 
   MockPacketReader* mock_reader_;
   MockPacketWriter* mock_writer_;
-  scoped_ptr<CompressedPacketReader> compressed_reader_;
-  scoped_ptr<CompressedPacketWriter> compressed_writer_;
+  std::unique_ptr<CompressedPacketReader> compressed_reader_;
+  std::unique_ptr<CompressedPacketWriter> compressed_writer_;
   testing::InSequence s;
 };
 
diff --git a/blimp/net/compressed_packet_writer.cc b/blimp/net/compressed_packet_writer.cc
index 3a87f61..3fe8856 100644
--- a/blimp/net/compressed_packet_writer.cc
+++ b/blimp/net/compressed_packet_writer.cc
@@ -22,7 +22,8 @@
 
 }  // namespace
 
-CompressedPacketWriter::CompressedPacketWriter(scoped_ptr<PacketWriter> sink)
+CompressedPacketWriter::CompressedPacketWriter(
+    std::unique_ptr<PacketWriter> sink)
     : sink_(std::move(sink)), compressed_buf_(new net::GrowableIOBuffer) {
   DCHECK(sink_);
 
diff --git a/blimp/net/compressed_packet_writer.h b/blimp/net/compressed_packet_writer.h
index 4689a32c..8490273 100644
--- a/blimp/net/compressed_packet_writer.h
+++ b/blimp/net/compressed_packet_writer.h
@@ -25,7 +25,7 @@
 class BLIMP_NET_EXPORT CompressedPacketWriter : public PacketWriter {
  public:
   // |source|: The PacketWriter which will receive compressed packets.
-  explicit CompressedPacketWriter(scoped_ptr<PacketWriter> sink);
+  explicit CompressedPacketWriter(std::unique_ptr<PacketWriter> sink);
   ~CompressedPacketWriter() override;
 
   // PacketWriter implementation.
@@ -42,7 +42,7 @@
                const scoped_refptr<net::GrowableIOBuffer>& dest_buf);
 
   z_stream zlib_stream_;
-  scoped_ptr<PacketWriter> sink_;
+  std::unique_ptr<PacketWriter> sink_;
   scoped_refptr<net::GrowableIOBuffer> compressed_buf_;
   size_t uncompressed_size_total_ = 0u;
   size_t compressed_size_total_ = 0u;
diff --git a/blimp/net/connection_handler.h b/blimp/net/connection_handler.h
index 5e54740..dc5b62cc 100644
--- a/blimp/net/connection_handler.h
+++ b/blimp/net/connection_handler.h
@@ -5,7 +5,7 @@
 #ifndef BLIMP_NET_CONNECTION_HANDLER_H_
 #define BLIMP_NET_CONNECTION_HANDLER_H_
 
-#include "base/memory/scoped_ptr.h"
+#include <memory>
 
 namespace blimp {
 
@@ -16,7 +16,8 @@
  public:
   virtual ~ConnectionHandler() {}
 
-  virtual void HandleConnection(scoped_ptr<BlimpConnection> connection) = 0;
+  virtual void HandleConnection(
+      std::unique_ptr<BlimpConnection> connection) = 0;
 };
 
 }  // namespace blimp
diff --git a/blimp/net/engine_authentication_handler.cc b/blimp/net/engine_authentication_handler.cc
index 753438e..798ac87 100644
--- a/blimp/net/engine_authentication_handler.cc
+++ b/blimp/net/engine_authentication_handler.cc
@@ -33,7 +33,7 @@
 class Authenticator : public ConnectionErrorObserver,
                       public BlimpMessageProcessor {
  public:
-  explicit Authenticator(scoped_ptr<BlimpConnection> connection,
+  explicit Authenticator(std::unique_ptr<BlimpConnection> connection,
                          base::WeakPtr<ConnectionHandler> connection_handler,
                          const std::string& client_token);
   ~Authenticator() override;
@@ -49,11 +49,11 @@
   void OnConnectionError(int error) override;
 
   // BlimpMessageProcessor implementation.
-  void ProcessMessage(scoped_ptr<BlimpMessage> message,
+  void ProcessMessage(std::unique_ptr<BlimpMessage> message,
                       const net::CompletionCallback& callback) override;
 
   // The connection to be authenticated.
-  scoped_ptr<BlimpConnection> connection_;
+  std::unique_ptr<BlimpConnection> connection_;
 
   // Handler to pass successfully authenticated connections to.
   base::WeakPtr<ConnectionHandler> connection_handler_;
@@ -68,7 +68,7 @@
 };
 
 Authenticator::Authenticator(
-    scoped_ptr<BlimpConnection> connection,
+    std::unique_ptr<BlimpConnection> connection,
     base::WeakPtr<ConnectionHandler> connection_handler,
     const std::string& client_token)
     : connection_(std::move(connection)),
@@ -109,7 +109,7 @@
   OnConnectionAuthenticated(false);
 }
 
-void Authenticator::ProcessMessage(scoped_ptr<BlimpMessage> message,
+void Authenticator::ProcessMessage(std::unique_ptr<BlimpMessage> message,
                                    const net::CompletionCallback& callback) {
   if (message->type() == BlimpMessage::PROTOCOL_CONTROL &&
       message->protocol_control().type() ==
@@ -144,7 +144,7 @@
 EngineAuthenticationHandler::~EngineAuthenticationHandler() {}
 
 void EngineAuthenticationHandler::HandleConnection(
-    scoped_ptr<BlimpConnection> connection) {
+    std::unique_ptr<BlimpConnection> connection) {
   // Authenticator manages its own lifetime.
   new Authenticator(std::move(connection),
                     connection_handler_weak_factory_.GetWeakPtr(),
diff --git a/blimp/net/engine_authentication_handler.h b/blimp/net/engine_authentication_handler.h
index 89188b7e..89bbc500 100644
--- a/blimp/net/engine_authentication_handler.h
+++ b/blimp/net/engine_authentication_handler.h
@@ -30,7 +30,7 @@
   ~EngineAuthenticationHandler() override;
 
   // ConnectionHandler implementation.
-  void HandleConnection(scoped_ptr<BlimpConnection> connection) override;
+  void HandleConnection(std::unique_ptr<BlimpConnection> connection) override;
 
  private:
   // Used to abandon pending authenticated connections if |this| is deleted.
diff --git a/blimp/net/engine_authentication_handler_unittest.cc b/blimp/net/engine_authentication_handler_unittest.cc
index dd8943c..b349810 100644
--- a/blimp/net/engine_authentication_handler_unittest.cc
+++ b/blimp/net/engine_authentication_handler_unittest.cc
@@ -53,8 +53,8 @@
   scoped_refptr<base::TestMockTimeTaskRunner> runner_;
   base::ThreadTaskRunnerHandle runner_handle_;
   testing::StrictMock<MockConnectionHandler> connection_handler_;
-  scoped_ptr<EngineAuthenticationHandler> auth_handler_;
-  scoped_ptr<testing::StrictMock<MockBlimpConnection>> connection_;
+  std::unique_ptr<EngineAuthenticationHandler> auth_handler_;
+  std::unique_ptr<testing::StrictMock<MockBlimpConnection>> connection_;
   ConnectionErrorObserver* error_observer_ = nullptr;
   BlimpMessageProcessor* incoming_message_processor_ = nullptr;
 };
@@ -67,7 +67,7 @@
   EXPECT_NE(nullptr, error_observer_);
   EXPECT_NE(nullptr, incoming_message_processor_);
 
-  scoped_ptr<BlimpMessage> blimp_message =
+  std::unique_ptr<BlimpMessage> blimp_message =
       CreateStartConnectionMessage(client_token, 0);
   net::TestCompletionCallback process_message_cb;
   incoming_message_processor_->ProcessMessage(std::move(blimp_message),
@@ -79,7 +79,7 @@
   ExpectOnConnection();
   auth_handler_->HandleConnection(std::move(connection_));
 
-  scoped_ptr<BlimpMessage> blimp_message =
+  std::unique_ptr<BlimpMessage> blimp_message =
       CreateStartConnectionMessage("invalid token", 0);
   net::TestCompletionCallback process_message_cb;
   incoming_message_processor_->ProcessMessage(std::move(blimp_message),
@@ -92,7 +92,8 @@
   auth_handler_->HandleConnection(std::move(connection_));
 
   InputMessage* input_message;
-  scoped_ptr<BlimpMessage> blimp_message = CreateBlimpMessage(&input_message);
+  std::unique_ptr<BlimpMessage> blimp_message =
+      CreateBlimpMessage(&input_message);
   net::TestCompletionCallback process_message_cb;
   incoming_message_processor_->ProcessMessage(std::move(blimp_message),
                                               process_message_cb.callback());
@@ -121,7 +122,7 @@
   auth_handler_->HandleConnection(std::move(connection_));
   auth_handler_.reset();
 
-  scoped_ptr<BlimpMessage> blimp_message =
+  std::unique_ptr<BlimpMessage> blimp_message =
       CreateStartConnectionMessage(client_token, 0);
   net::TestCompletionCallback process_message_cb;
   incoming_message_processor_->ProcessMessage(std::move(blimp_message),
diff --git a/blimp/net/engine_connection_manager.cc b/blimp/net/engine_connection_manager.cc
index 053508e..f8ff84a 100644
--- a/blimp/net/engine_connection_manager.cc
+++ b/blimp/net/engine_connection_manager.cc
@@ -20,7 +20,7 @@
 EngineConnectionManager::~EngineConnectionManager() {}
 
 void EngineConnectionManager::AddTransport(
-    scoped_ptr<BlimpTransport> transport) {
+    std::unique_ptr<BlimpTransport> transport) {
   BlimpTransport* transport_ptr = transport.get();
   transports_.push_back(std::move(transport));
   Connect(transport_ptr);
diff --git a/blimp/net/engine_connection_manager.h b/blimp/net/engine_connection_manager.h
index 1a0a491..9fe0416 100644
--- a/blimp/net/engine_connection_manager.h
+++ b/blimp/net/engine_connection_manager.h
@@ -5,11 +5,11 @@
 #ifndef BLIMP_NET_ENGINE_CONNECTION_MANAGER_H_
 #define BLIMP_NET_ENGINE_CONNECTION_MANAGER_H_
 
+#include <memory>
 #include <vector>
 
 #include "base/gtest_prod_util.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "blimp/net/blimp_net_export.h"
 #include "blimp/net/connection_handler.h"
 
@@ -32,7 +32,7 @@
 
   // Adds a transport and accepts new BlimpConnections from it as fast as they
   // arrive.
-  void AddTransport(scoped_ptr<BlimpTransport> transport);
+  void AddTransport(std::unique_ptr<BlimpTransport> transport);
 
  private:
   // Invokes transport->Connect to listen for a connection.
@@ -43,7 +43,7 @@
   void OnConnectResult(BlimpTransport* transport, int result);
 
   ConnectionHandler* connection_handler_;
-  std::vector<scoped_ptr<BlimpTransport>> transports_;
+  std::vector<std::unique_ptr<BlimpTransport>> transports_;
 
   DISALLOW_COPY_AND_ASSIGN(EngineConnectionManager);
 };
diff --git a/blimp/net/engine_connection_manager_unittest.cc b/blimp/net/engine_connection_manager_unittest.cc
index df9de9d..d178bb7 100644
--- a/blimp/net/engine_connection_manager_unittest.cc
+++ b/blimp/net/engine_connection_manager_unittest.cc
@@ -2,17 +2,20 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "blimp/net/engine_connection_manager.h"
+
 #include <stddef.h>
+
 #include <string>
 
 #include "base/callback_helpers.h"
+#include "base/memory/ptr_util.h"
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
 #include "blimp/net/blimp_connection.h"
 #include "blimp/net/blimp_transport.h"
 #include "blimp/net/common.h"
 #include "blimp/net/connection_error_observer.h"
-#include "blimp/net/engine_connection_manager.h"
 #include "blimp/net/test_common.h"
 #include "net/base/completion_callback.h"
 #include "net/base/io_buffer.h"
@@ -35,25 +38,25 @@
 
   ~EngineConnectionManagerTest() override {}
 
-  scoped_ptr<BlimpConnection> CreateConnection() {
-    return make_scoped_ptr(
-        new BlimpConnection(make_scoped_ptr(new MockPacketReader),
-                            make_scoped_ptr(new MockPacketWriter)));
+  std::unique_ptr<BlimpConnection> CreateConnection() {
+    return base::WrapUnique(
+        new BlimpConnection(base::WrapUnique(new MockPacketReader),
+                            base::WrapUnique(new MockPacketWriter)));
   }
 
  protected:
   base::MessageLoopForIO message_loop_;
   testing::StrictMock<MockConnectionHandler> connection_handler_;
-  scoped_ptr<EngineConnectionManager> manager_;
+  std::unique_ptr<EngineConnectionManager> manager_;
 };
 
 TEST_F(EngineConnectionManagerTest, ConnectionSucceeds) {
-  scoped_ptr<testing::StrictMock<MockTransport>> transport1(
+  std::unique_ptr<testing::StrictMock<MockTransport>> transport1(
       new testing::StrictMock<MockTransport>);
-  scoped_ptr<testing::StrictMock<MockTransport>> transport2(
+  std::unique_ptr<testing::StrictMock<MockTransport>> transport2(
       new testing::StrictMock<MockTransport>);
 
-  scoped_ptr<BlimpConnection> connection1 = CreateConnection();
+  std::unique_ptr<BlimpConnection> connection1 = CreateConnection();
   net::CompletionCallback connect_cb_1;
   EXPECT_CALL(*transport1, Connect(_))
       .Times(2)
@@ -62,7 +65,7 @@
   EXPECT_CALL(*transport1, TakeConnectionPtr())
       .WillOnce(Return(connection1.release()));
 
-  scoped_ptr<BlimpConnection> connection2 = CreateConnection();
+  std::unique_ptr<BlimpConnection> connection2 = CreateConnection();
   net::CompletionCallback connect_cb_2;
   EXPECT_CALL(*transport2, Connect(_))
       .Times(2)
diff --git a/blimp/net/exact_match_cert_verifier.cc b/blimp/net/exact_match_cert_verifier.cc
index 1209fbb..84d1ae7 100644
--- a/blimp/net/exact_match_cert_verifier.cc
+++ b/blimp/net/exact_match_cert_verifier.cc
@@ -4,9 +4,10 @@
 
 #include "blimp/net/exact_match_cert_verifier.h"
 
+#include <memory>
+
 #include "base/callback.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "net/base/net_errors.h"
 #include "net/cert/cert_verifier.h"
 #include "net/cert/cert_verify_result.h"
@@ -39,7 +40,7 @@
                                    net::CRLSet* crl_set,
                                    net::CertVerifyResult* verify_result,
                                    const net::CompletionCallback& callback,
-                                   scoped_ptr<Request>* out_req,
+                                   std::unique_ptr<Request>* out_req,
                                    const net::BoundNetLog& net_log) {
   verify_result->Reset();
   verify_result->verified_cert = engine_cert_;
diff --git a/blimp/net/exact_match_cert_verifier.h b/blimp/net/exact_match_cert_verifier.h
index d26d57a..3211849 100644
--- a/blimp/net/exact_match_cert_verifier.h
+++ b/blimp/net/exact_match_cert_verifier.h
@@ -35,7 +35,7 @@
              net::CRLSet* crl_set,
              net::CertVerifyResult* verify_result,
              const net::CompletionCallback& callback,
-             scoped_ptr<Request>* out_req,
+             std::unique_ptr<Request>* out_req,
              const net::BoundNetLog& net_log) override;
 
  private:
diff --git a/blimp/net/input_message_converter.cc b/blimp/net/input_message_converter.cc
index 5f3854eb..99427c6a 100644
--- a/blimp/net/input_message_converter.cc
+++ b/blimp/net/input_message_converter.cc
@@ -12,10 +12,10 @@
 namespace blimp {
 namespace {
 
-scoped_ptr<blink::WebGestureEvent> BuildCommonWebGesture(
+std::unique_ptr<blink::WebGestureEvent> BuildCommonWebGesture(
     const InputMessage& proto,
     blink::WebInputEvent::Type type) {
-  scoped_ptr<blink::WebGestureEvent> event(new blink::WebGestureEvent);
+  std::unique_ptr<blink::WebGestureEvent> event(new blink::WebGestureEvent);
   event->type = type;
   event->timeStampSeconds = proto.timestamp_seconds();
 
@@ -28,11 +28,10 @@
   return event;
 }
 
-scoped_ptr<blink::WebGestureEvent> ProtoToGestureScrollBegin(
+std::unique_ptr<blink::WebGestureEvent> ProtoToGestureScrollBegin(
     const InputMessage& proto) {
-  scoped_ptr<blink::WebGestureEvent> event(
-      BuildCommonWebGesture(proto,
-                            blink::WebInputEvent::Type::GestureScrollBegin));
+  std::unique_ptr<blink::WebGestureEvent> event(BuildCommonWebGesture(
+      proto, blink::WebInputEvent::Type::GestureScrollBegin));
 
   const GestureScrollBegin& details = proto.gesture_scroll_begin();
   event->data.scrollBegin.deltaXHint = details.delta_x_hint();
@@ -42,17 +41,16 @@
   return event;
 }
 
-scoped_ptr<blink::WebGestureEvent> ProtoToGestureScrollEnd(
+std::unique_ptr<blink::WebGestureEvent> ProtoToGestureScrollEnd(
     const InputMessage& proto) {
   return BuildCommonWebGesture(proto,
                                blink::WebInputEvent::Type::GestureScrollEnd);
 }
 
-scoped_ptr<blink::WebGestureEvent> ProtoToGestureScrollUpdate(
+std::unique_ptr<blink::WebGestureEvent> ProtoToGestureScrollUpdate(
     const InputMessage& proto) {
-  scoped_ptr<blink::WebGestureEvent> event(
-        BuildCommonWebGesture(proto,
-                              blink::WebInputEvent::Type::GestureScrollUpdate));
+  std::unique_ptr<blink::WebGestureEvent> event(BuildCommonWebGesture(
+      proto, blink::WebInputEvent::Type::GestureScrollUpdate));
 
   const GestureScrollUpdate& details = proto.gesture_scroll_update();
   event->data.scrollUpdate.deltaX = details.delta_x();
@@ -67,11 +65,10 @@
   return event;
 }
 
-scoped_ptr<blink::WebGestureEvent> ProtoToGestureFlingStart(
+std::unique_ptr<blink::WebGestureEvent> ProtoToGestureFlingStart(
     const InputMessage& proto) {
-  scoped_ptr<blink::WebGestureEvent> event(
-        BuildCommonWebGesture(proto,
-                              blink::WebInputEvent::Type::GestureFlingStart));
+  std::unique_ptr<blink::WebGestureEvent> event(BuildCommonWebGesture(
+      proto, blink::WebInputEvent::Type::GestureFlingStart));
 
   const GestureFlingStart& details = proto.gesture_fling_start();
   event->data.flingStart.velocityX = details.velocity_x();
@@ -81,11 +78,10 @@
   return event;
 }
 
-scoped_ptr<blink::WebGestureEvent> ProtoToGestureFlingCancel(
+std::unique_ptr<blink::WebGestureEvent> ProtoToGestureFlingCancel(
     const InputMessage& proto) {
-  scoped_ptr<blink::WebGestureEvent> event(
-        BuildCommonWebGesture(proto,
-                              blink::WebInputEvent::Type::GestureFlingCancel));
+  std::unique_ptr<blink::WebGestureEvent> event(BuildCommonWebGesture(
+      proto, blink::WebInputEvent::Type::GestureFlingCancel));
 
   const GestureFlingCancel& details = proto.gesture_fling_cancel();
   event->data.flingCancel.preventBoosting = details.prevent_boosting();
@@ -93,11 +89,10 @@
   return event;
 }
 
-scoped_ptr<blink::WebGestureEvent> ProtoToGestureTap(
+std::unique_ptr<blink::WebGestureEvent> ProtoToGestureTap(
     const InputMessage& proto) {
-  scoped_ptr<blink::WebGestureEvent> event(
-        BuildCommonWebGesture(proto,
-                              blink::WebInputEvent::Type::GestureTap));
+  std::unique_ptr<blink::WebGestureEvent> event(
+      BuildCommonWebGesture(proto, blink::WebInputEvent::Type::GestureTap));
 
   const GestureTap& details = proto.gesture_tap();
   event->data.tap.tapCount = details.tap_count();
@@ -107,23 +102,22 @@
   return event;
 }
 
-scoped_ptr<blink::WebGestureEvent> ProtoToGesturePinchBegin(
+std::unique_ptr<blink::WebGestureEvent> ProtoToGesturePinchBegin(
     const InputMessage& proto) {
   return BuildCommonWebGesture(proto,
                                blink::WebInputEvent::Type::GesturePinchBegin);
 }
 
-scoped_ptr<blink::WebGestureEvent> ProtoToGesturePinchEnd(
+std::unique_ptr<blink::WebGestureEvent> ProtoToGesturePinchEnd(
     const InputMessage& proto) {
   return BuildCommonWebGesture(proto,
                                blink::WebInputEvent::Type::GesturePinchEnd);
 }
 
-scoped_ptr<blink::WebGestureEvent> ProtoToGesturePinchUpdate(
+std::unique_ptr<blink::WebGestureEvent> ProtoToGesturePinchUpdate(
     const InputMessage& proto) {
-  scoped_ptr<blink::WebGestureEvent> event(
-        BuildCommonWebGesture(proto,
-                              blink::WebInputEvent::Type::GesturePinchUpdate));
+  std::unique_ptr<blink::WebGestureEvent> event(BuildCommonWebGesture(
+      proto, blink::WebInputEvent::Type::GesturePinchUpdate));
 
   const GesturePinchUpdate& details = proto.gesture_pinch_update();
   event->data.pinchUpdate.zoomDisabled = details.zoom_disabled();
@@ -138,9 +132,9 @@
 
 InputMessageConverter::~InputMessageConverter() {}
 
-scoped_ptr<blink::WebGestureEvent> InputMessageConverter::ProcessMessage(
+std::unique_ptr<blink::WebGestureEvent> InputMessageConverter::ProcessMessage(
     const InputMessage& message) {
-  scoped_ptr<blink::WebGestureEvent> event;
+  std::unique_ptr<blink::WebGestureEvent> event;
 
   switch (message.type()) {
     case InputMessage::Type_GestureScrollBegin:
diff --git a/blimp/net/input_message_converter.h b/blimp/net/input_message_converter.h
index 7d21216..7c5827d 100644
--- a/blimp/net/input_message_converter.h
+++ b/blimp/net/input_message_converter.h
@@ -5,8 +5,9 @@
 #ifndef BLIMP_NET_INPUT_MESSAGE_CONVERTER_H_
 #define BLIMP_NET_INPUT_MESSAGE_CONVERTER_H_
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "blimp/common/proto/ime.pb.h"
 #include "blimp/net/blimp_net_export.h"
 #include "ui/base/ime/text_input_type.h"
@@ -32,7 +33,7 @@
 
   // Process an InputMessage and create a WebGestureEvent from it.  This might
   // make use of state from previous messages.
-  scoped_ptr<blink::WebGestureEvent> ProcessMessage(
+  std::unique_ptr<blink::WebGestureEvent> ProcessMessage(
       const InputMessage& message);
 
   // Converts a ui::TextInputType to ImeMessage proto.
diff --git a/blimp/net/input_message_generator.cc b/blimp/net/input_message_generator.cc
index e929cf7..cfdc7c89 100644
--- a/blimp/net/input_message_generator.cc
+++ b/blimp/net/input_message_generator.cc
@@ -112,10 +112,10 @@
 
 InputMessageGenerator::~InputMessageGenerator() {}
 
-scoped_ptr<BlimpMessage> InputMessageGenerator::GenerateMessage(
+std::unique_ptr<BlimpMessage> InputMessageGenerator::GenerateMessage(
     const blink::WebGestureEvent& event) {
   InputMessage* details;
-  scoped_ptr<BlimpMessage> message = CreateBlimpMessage(&details);
+  std::unique_ptr<BlimpMessage> message = CreateBlimpMessage(&details);
 
   switch (event.type) {
     case blink::WebInputEvent::Type::GestureScrollBegin:
diff --git a/blimp/net/input_message_generator.h b/blimp/net/input_message_generator.h
index 69b2fcb..dbae9d4 100644
--- a/blimp/net/input_message_generator.h
+++ b/blimp/net/input_message_generator.h
@@ -5,8 +5,9 @@
 #ifndef BLIMP_NET_INPUT_MESSAGE_GENERATOR_H_
 #define BLIMP_NET_INPUT_MESSAGE_GENERATOR_H_
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "blimp/net/blimp_net_export.h"
 #include "net/base/completion_callback.h"
 
@@ -32,7 +33,8 @@
   // populated.  This might make use of state sent from previous
   // BlimpMessage::INPUT messages.  It is up to the caller to populate the
   // non-input fields and to send the BlimpMessage.
-  scoped_ptr<BlimpMessage> GenerateMessage(const blink::WebGestureEvent& event);
+  std::unique_ptr<BlimpMessage> GenerateMessage(
+      const blink::WebGestureEvent& event);
 
  private:
   DISALLOW_COPY_AND_ASSIGN(InputMessageGenerator);
diff --git a/blimp/net/input_message_unittest.cc b/blimp/net/input_message_unittest.cc
index 02579d7..4b7a2e7 100644
--- a/blimp/net/input_message_unittest.cc
+++ b/blimp/net/input_message_unittest.cc
@@ -2,10 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include <memory>
 #include <vector>
 
 #include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
 #include "blimp/common/proto/blimp_message.pb.h"
 #include "blimp/common/proto/input.pb.h"
 #include "blimp/net/blimp_message_processor.h"
@@ -22,12 +22,12 @@
   InputMessageGenerator generator;
   InputMessageConverter processor;
 
-  scoped_ptr<BlimpMessage> proto = generator.GenerateMessage(event);
+  std::unique_ptr<BlimpMessage> proto = generator.GenerateMessage(event);
   EXPECT_NE(nullptr, proto.get());
   EXPECT_TRUE(proto->has_input());
   EXPECT_EQ(BlimpMessage::INPUT, proto->type());
 
-  scoped_ptr<blink::WebGestureEvent> new_event =
+  std::unique_ptr<blink::WebGestureEvent> new_event =
       processor.ProcessMessage(proto->input());
   EXPECT_NE(nullptr, new_event.get());
 
diff --git a/blimp/net/null_blimp_message_processor.cc b/blimp/net/null_blimp_message_processor.cc
index 40e9388..87f275bc 100644
--- a/blimp/net/null_blimp_message_processor.cc
+++ b/blimp/net/null_blimp_message_processor.cc
@@ -12,7 +12,7 @@
 NullBlimpMessageProcessor::~NullBlimpMessageProcessor() {}
 
 void NullBlimpMessageProcessor::ProcessMessage(
-    scoped_ptr<BlimpMessage> message,
+    std::unique_ptr<BlimpMessage> message,
     const net::CompletionCallback& callback) {
   DVLOG(2) << "Dropped message: " << *message;
   if (!callback.is_null())
diff --git a/blimp/net/null_blimp_message_processor.h b/blimp/net/null_blimp_message_processor.h
index aa3fc68..305aeb5 100644
--- a/blimp/net/null_blimp_message_processor.h
+++ b/blimp/net/null_blimp_message_processor.h
@@ -18,7 +18,7 @@
  public:
   ~NullBlimpMessageProcessor() override;
 
-  void ProcessMessage(scoped_ptr<BlimpMessage> message,
+  void ProcessMessage(std::unique_ptr<BlimpMessage> message,
                       const net::CompletionCallback& callback) override;
 };
 
diff --git a/blimp/net/ssl_client_transport.cc b/blimp/net/ssl_client_transport.cc
index 33640937..e5ccaf79 100644
--- a/blimp/net/ssl_client_transport.cc
+++ b/blimp/net/ssl_client_transport.cc
@@ -39,7 +39,8 @@
 void SSLClientTransport::OnTCPConnectComplete(int result) {
   DCHECK_NE(net::ERR_IO_PENDING, result);
 
-  scoped_ptr<net::StreamSocket> tcp_socket = TCPClientTransport::TakeSocket();
+  std::unique_ptr<net::StreamSocket> tcp_socket =
+      TCPClientTransport::TakeSocket();
 
   DVLOG(1) << "TCP connection result=" << result;
   if (result != net::OK) {
@@ -48,7 +49,7 @@
   }
 
   // Construct arguments to use for the SSL socket factory.
-  scoped_ptr<net::ClientSocketHandle> socket_handle(
+  std::unique_ptr<net::ClientSocketHandle> socket_handle(
       new net::ClientSocketHandle);
   socket_handle->SetSocket(std::move(tcp_socket));
 
@@ -59,7 +60,7 @@
   create_context.cert_verifier = cert_verifier_.get();
   create_context.transport_security_state = &transport_security_state_;
 
-  scoped_ptr<net::StreamSocket> ssl_socket(
+  std::unique_ptr<net::StreamSocket> ssl_socket(
       socket_factory()->CreateSSLClientSocket(std::move(socket_handle),
                                               host_port_pair, net::SSLConfig(),
                                               create_context));
diff --git a/blimp/net/ssl_client_transport.h b/blimp/net/ssl_client_transport.h
index 0f0a1f4a..13a3ae7b 100644
--- a/blimp/net/ssl_client_transport.h
+++ b/blimp/net/ssl_client_transport.h
@@ -5,10 +5,11 @@
 #ifndef BLIMP_NET_SSL_CLIENT_TRANSPORT_H_
 #define BLIMP_NET_SSL_CLIENT_TRANSPORT_H_
 
+#include <memory>
 #include <string>
+
 #include "base/callback_forward.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "blimp/net/blimp_net_export.h"
 #include "blimp/net/blimp_transport.h"
 #include "blimp/net/exact_match_cert_verifier.h"
@@ -53,7 +54,7 @@
   void OnSSLConnectComplete(int result);
 
   net::IPEndPoint ip_endpoint_;
-  scoped_ptr<ExactMatchCertVerifier> cert_verifier_;
+  std::unique_ptr<ExactMatchCertVerifier> cert_verifier_;
   net::TransportSecurityState transport_security_state_;
 
   DISALLOW_COPY_AND_ASSIGN(SSLClientTransport);
diff --git a/blimp/net/ssl_client_transport_unittest.cc b/blimp/net/ssl_client_transport_unittest.cc
index 47724ce5..c4d31132 100644
--- a/blimp/net/ssl_client_transport_unittest.cc
+++ b/blimp/net/ssl_client_transport_unittest.cc
@@ -67,9 +67,9 @@
   base::MessageLoop message_loop;
   net::NetLog net_log_;
   net::StaticSocketDataProvider tcp_connect_;
-  scoped_ptr<net::SSLSocketDataProvider> ssl_connect_;
+  std::unique_ptr<net::SSLSocketDataProvider> ssl_connect_;
   net::MockClientSocketFactory socket_factory_;
-  scoped_ptr<SSLClientTransport> transport_;
+  std::unique_ptr<SSLClientTransport> transport_;
 };
 
 TEST_F(SSLClientTransportTest, ConnectSyncOK) {
diff --git a/blimp/net/stream_packet_reader_unittest.cc b/blimp/net/stream_packet_reader_unittest.cc
index b9de4ba..a076a41 100644
--- a/blimp/net/stream_packet_reader_unittest.cc
+++ b/blimp/net/stream_packet_reader_unittest.cc
@@ -313,7 +313,7 @@
 TEST_F(StreamPacketReaderTest, ReaderDeletedDuringAsyncHeaderRead) {
   net::CompletionCallback cb;
   net::TestCompletionCallback test_cb;
-  scoped_ptr<StreamPacketReader> reader(new StreamPacketReader(&socket_));
+  std::unique_ptr<StreamPacketReader> reader(new StreamPacketReader(&socket_));
 
   EXPECT_CALL(socket_, Read(NotNull(), kPacketHeaderSizeBytes, _))
       .WillOnce(DoAll(FillBufferFromString<0>(EncodeHeader(test_msg_.size())),
@@ -328,7 +328,7 @@
 // StreamPacketReader object was destroyed.
 TEST_F(StreamPacketReaderTest, ReaderDeletedDuringAsyncPayloadRead) {
   net::CompletionCallback cb;
-  scoped_ptr<StreamPacketReader> reader(new StreamPacketReader(&socket_));
+  std::unique_ptr<StreamPacketReader> reader(new StreamPacketReader(&socket_));
 
   EXPECT_CALL(socket_, Read(NotNull(), kPacketHeaderSizeBytes, _))
       .WillOnce(DoAll(FillBufferFromString<0>(EncodeHeader(test_msg_.size())),
diff --git a/blimp/net/stream_packet_writer_unittest.cc b/blimp/net/stream_packet_writer_unittest.cc
index 3212e928..a5519bfa 100644
--- a/blimp/net/stream_packet_writer_unittest.cc
+++ b/blimp/net/stream_packet_writer_unittest.cc
@@ -198,7 +198,7 @@
   net::TestCompletionCallback writer_cb;
   net::CompletionCallback header_cb;
   net::CompletionCallback payload_cb;
-  scoped_ptr<StreamPacketWriter> writer(new StreamPacketWriter(&socket_));
+  std::unique_ptr<StreamPacketWriter> writer(new StreamPacketWriter(&socket_));
 
   // Write header.
   EXPECT_CALL(socket_, Write(BufferEquals(EncodeHeader(test_data_str_.size())),
@@ -218,7 +218,7 @@
   net::TestCompletionCallback writer_cb;
   net::CompletionCallback header_cb;
   net::CompletionCallback payload_cb;
-  scoped_ptr<StreamPacketWriter> writer(new StreamPacketWriter(&socket_));
+  std::unique_ptr<StreamPacketWriter> writer(new StreamPacketWriter(&socket_));
 
   EXPECT_CALL(socket_, Write(BufferEquals(EncodeHeader(test_data_str_.size())),
                              kPacketHeaderSizeBytes, _))
diff --git a/blimp/net/stream_socket_connection.cc b/blimp/net/stream_socket_connection.cc
index fb80100..d1f6315 100644
--- a/blimp/net/stream_socket_connection.cc
+++ b/blimp/net/stream_socket_connection.cc
@@ -4,6 +4,7 @@
 
 #include "blimp/net/stream_socket_connection.h"
 
+#include "base/memory/ptr_util.h"
 #include "blimp/net/compressed_packet_reader.h"
 #include "blimp/net/compressed_packet_writer.h"
 #include "blimp/net/stream_packet_reader.h"
@@ -12,12 +13,12 @@
 namespace blimp {
 
 StreamSocketConnection::StreamSocketConnection(
-    scoped_ptr<net::StreamSocket> socket)
+    std::unique_ptr<net::StreamSocket> socket)
     : BlimpConnection(
-          make_scoped_ptr(new CompressedPacketReader(
-              make_scoped_ptr(new StreamPacketReader(socket.get())))),
-          make_scoped_ptr(new CompressedPacketWriter(
-              make_scoped_ptr(new StreamPacketWriter(socket.get()))))),
+          base::WrapUnique(new CompressedPacketReader(
+              base::WrapUnique(new StreamPacketReader(socket.get())))),
+          base::WrapUnique(new CompressedPacketWriter(
+              base::WrapUnique(new StreamPacketWriter(socket.get()))))),
       socket_(std::move(socket)) {
   DCHECK(socket_);
 }
diff --git a/blimp/net/stream_socket_connection.h b/blimp/net/stream_socket_connection.h
index 9739a09..f86de22 100644
--- a/blimp/net/stream_socket_connection.h
+++ b/blimp/net/stream_socket_connection.h
@@ -5,7 +5,8 @@
 #ifndef BLIMP_NET_STREAM_SOCKET_CONNECTION_H_
 #define BLIMP_NET_STREAM_SOCKET_CONNECTION_H_
 
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
 #include "blimp/net/blimp_connection.h"
 #include "net/socket/stream_socket.h"
 
@@ -18,12 +19,12 @@
 // BlimpConnection specialization for StreamSocket-based connections.
 class StreamSocketConnection : public BlimpConnection {
  public:
-  explicit StreamSocketConnection(scoped_ptr<net::StreamSocket> socket);
+  explicit StreamSocketConnection(std::unique_ptr<net::StreamSocket> socket);
 
   ~StreamSocketConnection() override;
 
  private:
-  scoped_ptr<net::StreamSocket> socket_;
+  std::unique_ptr<net::StreamSocket> socket_;
 };
 
 }  // namespace blimp
diff --git a/blimp/net/tcp_client_transport.cc b/blimp/net/tcp_client_transport.cc
index 6a6cc50..f9e0bd3 100644
--- a/blimp/net/tcp_client_transport.cc
+++ b/blimp/net/tcp_client_transport.cc
@@ -4,9 +4,11 @@
 
 #include "blimp/net/tcp_client_transport.h"
 
+#include <memory>
+
 #include "base/callback.h"
 #include "base/callback_helpers.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
 #include "base/message_loop/message_loop.h"
 #include "blimp/net/stream_socket_connection.h"
 #include "net/socket/client_socket_factory.h"
@@ -47,10 +49,10 @@
   OnTCPConnectComplete(result);
 }
 
-scoped_ptr<BlimpConnection> TCPClientTransport::TakeConnection() {
+std::unique_ptr<BlimpConnection> TCPClientTransport::TakeConnection() {
   DCHECK(connect_callback_.is_null());
   DCHECK(socket_);
-  return make_scoped_ptr(new StreamSocketConnection(std::move(socket_)));
+  return base::WrapUnique(new StreamSocketConnection(std::move(socket_)));
 }
 
 const char* TCPClientTransport::GetName() const {
@@ -69,11 +71,11 @@
   base::ResetAndReturn(&connect_callback_).Run(result);
 }
 
-scoped_ptr<net::StreamSocket> TCPClientTransport::TakeSocket() {
+std::unique_ptr<net::StreamSocket> TCPClientTransport::TakeSocket() {
   return std::move(socket_);
 }
 
-void TCPClientTransport::SetSocket(scoped_ptr<net::StreamSocket> socket) {
+void TCPClientTransport::SetSocket(std::unique_ptr<net::StreamSocket> socket) {
   DCHECK(socket);
   socket_ = std::move(socket);
 }
diff --git a/blimp/net/tcp_client_transport.h b/blimp/net/tcp_client_transport.h
index 6a879fe..35826a2 100644
--- a/blimp/net/tcp_client_transport.h
+++ b/blimp/net/tcp_client_transport.h
@@ -5,11 +5,11 @@
 #ifndef BLIMP_NET_TCP_CLIENT_TRANSPORT_H_
 #define BLIMP_NET_TCP_CLIENT_TRANSPORT_H_
 
+#include <memory>
 #include <string>
 
 #include "base/callback.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "blimp/net/blimp_net_export.h"
 #include "blimp/net/blimp_transport.h"
 #include "net/base/address_list.h"
@@ -36,7 +36,7 @@
 
   // BlimpTransport implementation.
   void Connect(const net::CompletionCallback& callback) override;
-  scoped_ptr<BlimpConnection> TakeConnection() override;
+  std::unique_ptr<BlimpConnection> TakeConnection() override;
   const char* GetName() const override;
 
  protected:
@@ -49,8 +49,8 @@
 
   // Methods for taking and setting |socket_|. Can be used by subclasses to
   // swap out a socket for an upgraded one, e.g. adding SSL encryption.
-  scoped_ptr<net::StreamSocket> TakeSocket();
-  void SetSocket(scoped_ptr<net::StreamSocket> socket);
+  std::unique_ptr<net::StreamSocket> TakeSocket();
+  void SetSocket(std::unique_ptr<net::StreamSocket> socket);
 
   // Gets the socket factory instance.
   net::ClientSocketFactory* socket_factory() const;
@@ -60,7 +60,7 @@
   net::NetLog* net_log_;
   net::CompletionCallback connect_callback_;
   net::ClientSocketFactory* socket_factory_ = nullptr;
-  scoped_ptr<net::StreamSocket> socket_;
+  std::unique_ptr<net::StreamSocket> socket_;
 
   DISALLOW_COPY_AND_ASSIGN(TCPClientTransport);
 };
diff --git a/blimp/net/tcp_engine_transport.cc b/blimp/net/tcp_engine_transport.cc
index 4606caf..9d30be70 100644
--- a/blimp/net/tcp_engine_transport.cc
+++ b/blimp/net/tcp_engine_transport.cc
@@ -4,9 +4,11 @@
 
 #include "blimp/net/tcp_engine_transport.h"
 
+#include <memory>
+
 #include "base/callback.h"
 #include "base/callback_helpers.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
 #include "base/message_loop/message_loop.h"
 #include "blimp/net/stream_socket_connection.h"
 #include "net/socket/stream_socket.h"
@@ -54,10 +56,10 @@
                                          base::Bind(callback, result));
 }
 
-scoped_ptr<BlimpConnection> TCPEngineTransport::TakeConnection() {
+std::unique_ptr<BlimpConnection> TCPEngineTransport::TakeConnection() {
   DCHECK(connect_callback_.is_null());
   DCHECK(accepted_socket_);
-  return make_scoped_ptr(
+  return base::WrapUnique(
       new StreamSocketConnection(std::move(accepted_socket_)));
 }
 
diff --git a/blimp/net/tcp_engine_transport.h b/blimp/net/tcp_engine_transport.h
index ace223e9..92490077 100644
--- a/blimp/net/tcp_engine_transport.h
+++ b/blimp/net/tcp_engine_transport.h
@@ -5,9 +5,10 @@
 #ifndef BLIMP_NET_TCP_ENGINE_TRANSPORT_H_
 #define BLIMP_NET_TCP_ENGINE_TRANSPORT_H_
 
+#include <memory>
+
 #include "base/callback.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "blimp/net/blimp_net_export.h"
 #include "blimp/net/blimp_transport.h"
 #include "net/base/ip_endpoint.h"
@@ -32,7 +33,7 @@
 
   // BlimpTransport implementation.
   void Connect(const net::CompletionCallback& callback) override;
-  scoped_ptr<BlimpConnection> TakeConnection() override;
+  std::unique_ptr<BlimpConnection> TakeConnection() override;
   const char* GetName() const override;
 
   int GetLocalAddressForTesting(net::IPEndPoint* address) const;
@@ -42,8 +43,8 @@
 
   const net::IPEndPoint address_;
   net::NetLog* net_log_;
-  scoped_ptr<net::ServerSocket> server_socket_;
-  scoped_ptr<net::StreamSocket> accepted_socket_;
+  std::unique_ptr<net::ServerSocket> server_socket_;
+  std::unique_ptr<net::StreamSocket> accepted_socket_;
   net::CompletionCallback connect_callback_;
 
   DISALLOW_COPY_AND_ASSIGN(TCPEngineTransport);
diff --git a/blimp/net/tcp_transport_unittest.cc b/blimp/net/tcp_transport_unittest.cc
index c5916c0..667a9bb 100644
--- a/blimp/net/tcp_transport_unittest.cc
+++ b/blimp/net/tcp_transport_unittest.cc
@@ -2,9 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include <memory>
 #include <string>
 
-#include "base/memory/scoped_ptr.h"
 #include "base/message_loop/message_loop.h"
 #include "blimp/common/create_blimp_message.h"
 #include "blimp/common/proto/blimp_message.pb.h"
@@ -42,7 +42,7 @@
   }
 
   base::MessageLoopForIO message_loop_;
-  scoped_ptr<TCPEngineTransport> engine_;
+  std::unique_ptr<TCPEngineTransport> engine_;
 };
 
 TEST_F(TCPTransportTest, Connect) {
@@ -96,11 +96,11 @@
   MockBlimpMessageProcessor engine_incoming_processor;
   MockBlimpMessageProcessor client_incoming_processor;
   net::CompletionCallback engine_process_message_cb;
-  scoped_ptr<BlimpMessage> client_message1 =
+  std::unique_ptr<BlimpMessage> client_message1 =
       CreateStartConnectionMessage("", 0);
   int client_message1_size = client_message1->ByteSize();
-  scoped_ptr<BlimpMessage> client_message2 = CreateCheckpointAckMessage(5);
-  scoped_ptr<BlimpMessage> engine_message = CreateCheckpointAckMessage(10);
+  std::unique_ptr<BlimpMessage> client_message2 = CreateCheckpointAckMessage(5);
+  std::unique_ptr<BlimpMessage> engine_message = CreateCheckpointAckMessage(10);
   EXPECT_CALL(engine_incoming_processor,
               MockableProcessMessage(EqualsProto(*client_message1), _))
       .WillOnce(SaveArg<1>(&engine_process_message_cb));
@@ -112,8 +112,9 @@
       .Times(1);
 
   // Attach the ends of the connection to our mock message-processors.
-  scoped_ptr<BlimpConnection> engine_connnection = engine_->TakeConnection();
-  scoped_ptr<BlimpConnection> client_connnection = client.TakeConnection();
+  std::unique_ptr<BlimpConnection> engine_connnection =
+      engine_->TakeConnection();
+  std::unique_ptr<BlimpConnection> client_connnection = client.TakeConnection();
   engine_connnection->SetIncomingMessageProcessor(&engine_incoming_processor);
   client_connnection->SetIncomingMessageProcessor(&client_incoming_processor);
 
diff --git a/blimp/net/test_common.cc b/blimp/net/test_common.cc
index 261401e5..f6b3558 100644
--- a/blimp/net/test_common.cc
+++ b/blimp/net/test_common.cc
@@ -6,6 +6,7 @@
 
 #include <string>
 
+#include "base/memory/ptr_util.h"
 #include "base/sys_byteorder.h"
 #include "blimp/common/proto/blimp_message.pb.h"
 #include "blimp/net/blimp_connection.h"
@@ -22,8 +23,8 @@
 
 MockTransport::~MockTransport() {}
 
-scoped_ptr<BlimpConnection> MockTransport::TakeConnection() {
-  return make_scoped_ptr(TakeConnectionPtr());
+std::unique_ptr<BlimpConnection> MockTransport::TakeConnection() {
+  return base::WrapUnique(TakeConnectionPtr());
 }
 
 const char* MockTransport::GetName() const {
@@ -35,7 +36,7 @@
 MockConnectionHandler::~MockConnectionHandler() {}
 
 void MockConnectionHandler::HandleConnection(
-    scoped_ptr<BlimpConnection> connection) {
+    std::unique_ptr<BlimpConnection> connection) {
   HandleConnectionPtr(connection.get());
 }
 
@@ -60,13 +61,13 @@
 MockBlimpMessageProcessor::~MockBlimpMessageProcessor() {}
 
 void MockBlimpMessageProcessor::ProcessMessage(
-    scoped_ptr<BlimpMessage> message,
+    std::unique_ptr<BlimpMessage> message,
     const net::CompletionCallback& callback) {
   MockableProcessMessage(*message, callback);
 }
 
 std::string EncodeHeader(size_t size) {
-  scoped_ptr<char[]> serialized(new char[kPacketHeaderSizeBytes]);
+  std::unique_ptr<char[]> serialized(new char[kPacketHeaderSizeBytes]);
   uint32_t net_size = base::HostToNet32(size);
   memcpy(serialized.get(), &net_size, sizeof(net_size));
   return std::string(serialized.get(), kPacketHeaderSizeBytes);
diff --git a/blimp/net/test_common.h b/blimp/net/test_common.h
index 479f2dca..5aaae7e 100644
--- a/blimp/net/test_common.h
+++ b/blimp/net/test_common.h
@@ -8,9 +8,9 @@
 #include <stddef.h>
 #include <stdint.h>
 
+#include <memory>
 #include <string>
 
-#include "base/memory/scoped_ptr.h"
 #include "blimp/common/proto/blimp_message.pb.h"
 #include "blimp/net/blimp_connection.h"
 #include "blimp/net/blimp_message_processor.h"
@@ -136,7 +136,7 @@
   MOCK_METHOD1(Connect, void(const net::CompletionCallback& callback));
   MOCK_METHOD0(TakeConnectionPtr, BlimpConnection*());
 
-  scoped_ptr<BlimpConnection> TakeConnection() override;
+  std::unique_ptr<BlimpConnection> TakeConnection() override;
   const char* GetName() const override;
 };
 
@@ -146,7 +146,7 @@
   ~MockConnectionHandler() override;
 
   MOCK_METHOD1(HandleConnectionPtr, void(BlimpConnection* connection));
-  void HandleConnection(scoped_ptr<BlimpConnection> connection) override;
+  void HandleConnection(std::unique_ptr<BlimpConnection> connection) override;
 };
 
 class MockPacketReader : public PacketReader {
@@ -202,8 +202,8 @@
   ~MockBlimpMessageProcessor() override;
 
   // Adapts calls from ProcessMessage to MockableProcessMessage by
-  // unboxing the |message| scoped_ptr for GMock compatibility.
-  void ProcessMessage(scoped_ptr<BlimpMessage> message,
+  // unboxing the |message| std::unique_ptr for GMock compatibility.
+  void ProcessMessage(std::unique_ptr<BlimpMessage> message,
                       const net::CompletionCallback& callback) override;
 
   MOCK_METHOD2(MockableProcessMessage,
diff --git a/blimp/net/thread_pipe_manager.cc b/blimp/net/thread_pipe_manager.cc
index 95bc350..1363e09 100644
--- a/blimp/net/thread_pipe_manager.cc
+++ b/blimp/net/thread_pipe_manager.cc
@@ -25,21 +25,22 @@
   // using |incoming_proxy| as the incoming message processor, and connecting
   // |outgoing_pipe| to the actual message sender.
   void RegisterFeature(BlimpMessage::Type type,
-                       scoped_ptr<BlimpMessageThreadPipe> outgoing_pipe,
-                       scoped_ptr<BlimpMessageProcessor> incoming_proxy);
+                       std::unique_ptr<BlimpMessageThreadPipe> outgoing_pipe,
+                       std::unique_ptr<BlimpMessageProcessor> incoming_proxy);
 
  private:
   BrowserConnectionHandler* connection_handler_;
 
   // Container for the feature-specific MessageProcessors.
   // IO-side proxy for sending messages to UI thread.
-  std::vector<scoped_ptr<BlimpMessageProcessor>> incoming_proxies_;
+  std::vector<std::unique_ptr<BlimpMessageProcessor>> incoming_proxies_;
 
   // Containers for the MessageProcessors used to write feature-specific
   // messages to the network, and the thread-pipe endpoints through which
   // they are used from the UI thread.
-  std::vector<scoped_ptr<BlimpMessageProcessor>> outgoing_message_processors_;
-  std::vector<scoped_ptr<BlimpMessageThreadPipe>> outgoing_pipes_;
+  std::vector<std::unique_ptr<BlimpMessageProcessor>>
+      outgoing_message_processors_;
+  std::vector<std::unique_ptr<BlimpMessageThreadPipe>> outgoing_pipes_;
 
   DISALLOW_COPY_AND_ASSIGN(IoThreadPipeManager);
 };
@@ -54,12 +55,12 @@
 
 void IoThreadPipeManager::RegisterFeature(
     BlimpMessage::Type type,
-    scoped_ptr<BlimpMessageThreadPipe> outgoing_pipe,
-    scoped_ptr<BlimpMessageProcessor> incoming_proxy) {
+    std::unique_ptr<BlimpMessageThreadPipe> outgoing_pipe,
+    std::unique_ptr<BlimpMessageProcessor> incoming_proxy) {
   // Registers |incoming_proxy| as the message processor for incoming
   // messages with |type|. Sets the returned outgoing message processor as the
   // target of the |outgoing_pipe|.
-  scoped_ptr<BlimpMessageProcessor> outgoing_message_processor =
+  std::unique_ptr<BlimpMessageProcessor> outgoing_message_processor =
       connection_handler_->RegisterFeature(type, incoming_proxy.get());
   outgoing_pipe->set_target_processor(outgoing_message_processor.get());
 
@@ -81,22 +82,22 @@
   io_task_runner_->DeleteSoon(FROM_HERE, io_pipe_manager_.release());
 }
 
-scoped_ptr<BlimpMessageProcessor> ThreadPipeManager::RegisterFeature(
+std::unique_ptr<BlimpMessageProcessor> ThreadPipeManager::RegisterFeature(
     BlimpMessage::Type type,
     BlimpMessageProcessor* incoming_processor) {
   // Creates an outgoing pipe and a proxy for forwarding messages
   // from features on the UI thread to network components on the IO thread.
-  scoped_ptr<BlimpMessageThreadPipe> outgoing_pipe(
+  std::unique_ptr<BlimpMessageThreadPipe> outgoing_pipe(
       new BlimpMessageThreadPipe(io_task_runner_));
-  scoped_ptr<BlimpMessageProcessor> outgoing_proxy =
+  std::unique_ptr<BlimpMessageProcessor> outgoing_proxy =
       outgoing_pipe->CreateProxy();
 
   // Creates an incoming pipe and a proxy for receiving messages
   // from network components on the IO thread.
-  scoped_ptr<BlimpMessageThreadPipe> incoming_pipe(
+  std::unique_ptr<BlimpMessageThreadPipe> incoming_pipe(
       new BlimpMessageThreadPipe(ui_task_runner_));
   incoming_pipe->set_target_processor(incoming_processor);
-  scoped_ptr<BlimpMessageProcessor> incoming_proxy =
+  std::unique_ptr<BlimpMessageProcessor> incoming_proxy =
       incoming_pipe->CreateProxy();
 
   // Finishes registration on IO thread.
diff --git a/blimp/net/thread_pipe_manager.h b/blimp/net/thread_pipe_manager.h
index 55bf5b6e..01ec7d3e 100644
--- a/blimp/net/thread_pipe_manager.h
+++ b/blimp/net/thread_pipe_manager.h
@@ -5,11 +5,11 @@
 #ifndef BLIMP_NET_THREAD_PIPE_MANAGER_H_
 #define BLIMP_NET_THREAD_PIPE_MANAGER_H_
 
+#include <memory>
 #include <vector>
 
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "blimp/common/proto/blimp_message.pb.h"
 #include "blimp/net/blimp_net_export.h"
 
@@ -41,7 +41,7 @@
   // Registers a message processor |incoming_processor| which will receive all
   // messages of the |type| specified. Returns a BlimpMessageProcessor object
   // for sending messages of type |type|.
-  scoped_ptr<BlimpMessageProcessor> RegisterFeature(
+  std::unique_ptr<BlimpMessageProcessor> RegisterFeature(
       BlimpMessage::Type type,
       BlimpMessageProcessor* incoming_processor);
 
@@ -50,12 +50,12 @@
   scoped_refptr<base::SequencedTaskRunner> ui_task_runner_;
 
   // Container for BlimpMessageThreadPipes that are destroyed on IO thread.
-  scoped_ptr<IoThreadPipeManager> io_pipe_manager_;
+  std::unique_ptr<IoThreadPipeManager> io_pipe_manager_;
 
   // Pipes for routing messages from the IO to the UI thread.
   // Incoming messages are only routed to the UI thread since all features run
   // there.
-  std::vector<scoped_ptr<BlimpMessageThreadPipe>> incoming_pipes_;
+  std::vector<std::unique_ptr<BlimpMessageThreadPipe>> incoming_pipes_;
 
   DISALLOW_COPY_AND_ASSIGN(ThreadPipeManager);
 };
diff --git a/blimp/net/thread_pipe_manager_unittest.cc b/blimp/net/thread_pipe_manager_unittest.cc
index f36ef48..ed9cc85 100644
--- a/blimp/net/thread_pipe_manager_unittest.cc
+++ b/blimp/net/thread_pipe_manager_unittest.cc
@@ -5,6 +5,7 @@
 #include "blimp/net/thread_pipe_manager.h"
 
 #include "base/location.h"
+#include "base/memory/ptr_util.h"
 #include "base/memory/ref_counted.h"
 #include "base/message_loop/message_loop.h"
 #include "base/threading/sequenced_task_runner_handle.h"
@@ -23,8 +24,8 @@
 namespace blimp {
 namespace {
 
-scoped_ptr<BlimpMessage> CreateMessage(BlimpMessage::Type type) {
-  scoped_ptr<BlimpMessage> output(new BlimpMessage);
+std::unique_ptr<BlimpMessage> CreateMessage(BlimpMessage::Type type) {
+  std::unique_ptr<BlimpMessage> output(new BlimpMessage);
   output->set_type(type);
   return output;
 }
@@ -49,7 +50,7 @@
 
  private:
   testing::StrictMock<MockBlimpMessageProcessor> incoming_message_processor_;
-  scoped_ptr<BlimpMessageProcessor> outgoing_message_processor_;
+  std::unique_ptr<BlimpMessageProcessor> outgoing_message_processor_;
 };
 
 // A feature peer on |thread_| that forwards incoming messages to
@@ -66,14 +67,14 @@
   ~FakeFeaturePeer() override {}
 
  private:
-  void ForwardMessage(scoped_ptr<BlimpMessage> message) {
+  void ForwardMessage(std::unique_ptr<BlimpMessage> message) {
     DCHECK(task_runner_->RunsTasksOnCurrentThread());
     message_processor_->ProcessMessage(std::move(message),
                                        net::CompletionCallback());
   }
 
   // BlimpMessageProcessor implementation.
-  void ProcessMessage(scoped_ptr<BlimpMessage> message,
+  void ProcessMessage(std::unique_ptr<BlimpMessage> message,
                       const net::CompletionCallback& callback) override {
     DCHECK(task_runner_->RunsTasksOnCurrentThread());
     ASSERT_EQ(type_, message->type());
@@ -97,11 +98,11 @@
   FakeBrowserConnectionHandler(
       const scoped_refptr<base::SequencedTaskRunner>& task_runner)
       : task_runner_(task_runner) {}
-  scoped_ptr<BlimpMessageProcessor> RegisterFeature(
+  std::unique_ptr<BlimpMessageProcessor> RegisterFeature(
       BlimpMessage::Type type,
       BlimpMessageProcessor* incoming_processor) override {
     DCHECK(task_runner_->RunsTasksOnCurrentThread());
-    return make_scoped_ptr(
+    return base::WrapUnique(
         new FakeFeaturePeer(type, incoming_processor, task_runner_));
   }
 
@@ -119,9 +120,9 @@
 
   void SetUp() override {
     ASSERT_TRUE(thread_.Start());
-    connection_handler_ = make_scoped_ptr(
+    connection_handler_ = base::WrapUnique(
         new FakeBrowserConnectionHandler(thread_.task_runner()));
-    pipe_manager_ = make_scoped_ptr(new ThreadPipeManager(
+    pipe_manager_ = base::WrapUnique(new ThreadPipeManager(
         thread_.task_runner(), base::SequencedTaskRunnerHandle::Get(),
         connection_handler_.get()));
 
@@ -144,19 +145,20 @@
 
  protected:
   base::MessageLoop message_loop_;
-  scoped_ptr<BrowserConnectionHandler> connection_handler_;
-  scoped_ptr<ThreadPipeManager> pipe_manager_;
+  std::unique_ptr<BrowserConnectionHandler> connection_handler_;
+  std::unique_ptr<ThreadPipeManager> pipe_manager_;
   base::Thread thread_;
 
-  scoped_ptr<FakeFeature> input_feature_;
-  scoped_ptr<FakeFeature> tab_control_feature_;
+  std::unique_ptr<FakeFeature> input_feature_;
+  std::unique_ptr<FakeFeature> tab_control_feature_;
 };
 
 // Features send out message and receive the same message due to
 // |FakeFeaturePeer| loops the message back on |thread_|.
 TEST_F(ThreadPipeManagerTest, MessageSentIsReceived) {
-  scoped_ptr<BlimpMessage> input_message = CreateMessage(BlimpMessage::INPUT);
-  scoped_ptr<BlimpMessage> tab_control_message =
+  std::unique_ptr<BlimpMessage> input_message =
+      CreateMessage(BlimpMessage::INPUT);
+  std::unique_ptr<BlimpMessage> tab_control_message =
       CreateMessage(BlimpMessage::TAB_CONTROL);
 
   EXPECT_CALL(*(input_feature_->incoming_message_processor()),
diff --git a/build/all.gyp b/build/all.gyp
index 6037e184..f688ebb 100644
--- a/build/all.gyp
+++ b/build/all.gyp
@@ -469,6 +469,7 @@
           'dependencies': [
             '../ash/ash.gyp:ash_unittests',
             '../ui/app_list/app_list.gyp:app_list_unittests',
+            '../ui/app_list/shower/app_list_shower.gyp:app_list_shower_unittests',
             '../ui/aura/aura.gyp:aura_unittests',
             '../ui/compositor/compositor.gyp:compositor_unittests',
           ],
diff --git a/build/android/gyp/create_test_runner_script.py b/build/android/gyp/create_test_runner_script.py
index 87d6c6c..0b127e7 100755
--- a/build/android/gyp/create_test_runner_script.py
+++ b/build/android/gyp/create_test_runner_script.py
@@ -50,6 +50,8 @@
   parser.add_argument('--depfile',
                       help='Path to the depfile. This must be specified as '
                            "the action's first output.")
+  parser.add_argument('--test-runner-path',
+                      help='Path to test_runner.py (optional).')
   # We need to intercept any test runner path arguments and make all
   # of the paths relative to the output script directory.
   group = parser.add_argument_group('Test runner path arguments.')
@@ -70,7 +72,7 @@
     """Returns the path relative to the output script directory."""
     return os.path.relpath(path, os.path.dirname(args.script_output_path))
 
-  test_runner_path = os.path.join(
+  test_runner_path = args.test_runner_path or os.path.join(
       os.path.dirname(__file__), os.path.pardir, 'test_runner.py')
   test_runner_path = RelativizePathToScript(test_runner_path)
 
diff --git a/build/android/test_runner.gypi b/build/android/test_runner.gypi
index b211995..50e3ffa 100644
--- a/build/android/test_runner.gypi
+++ b/build/android/test_runner.gypi
@@ -43,6 +43,7 @@
     'variables': {
       'additional_apks%': [],
       'isolate_file%': '',
+      'test_runner_path%': '',
     },
     'test_runner_args': ['--output-directory', '<(PRODUCT_DIR)'],
     'conditions': [
@@ -74,6 +75,9 @@
       ['isolate_file != ""', {
         'test_runner_args': ['--isolate-file-path', '<(isolate_file)']
       }],
+      ['test_runner_path != ""', {
+        'test_runner_args': ['--test-runner-path', '<(test_runner_path)']
+      }],
     ],
   },
   'actions': [
diff --git a/cc/BUILD.gn b/cc/BUILD.gn
index 0901f0a..ec16931 100644
--- a/cc/BUILD.gn
+++ b/cc/BUILD.gn
@@ -570,25 +570,15 @@
   }
 
   if (enable_vulkan) {
-    deps += [ ":vulkan_cc" ]
-  }
-}
-
-if (enable_vulkan) {
-  source_set("vulkan_cc") {
-    include_dirs = [ "/usr/include" ]
-    sources = [
+    sources += [
       "output/vulkan_context_provider.h",
       "output/vulkan_in_process_context_provider.cc",
       "output/vulkan_in_process_context_provider.h",
+      "output/vulkan_renderer.cc",
+      "output/vulkan_renderer.h",
     ]
 
-    configs += [ "//build/config:precompiled_headers" ]
-    defines = [ "CC_IMPLEMENTATION=1" ]
-
-    deps = [
-      "//gpu/vulkan",
-    ]
+    deps += [ "//gpu/vulkan" ]
   }
 }
 
diff --git a/cc/output/output_surface.cc b/cc/output/output_surface.cc
index 5698635..b3b18da4 100644
--- a/cc/output/output_surface.cc
+++ b/cc/output/output_surface.cc
@@ -121,10 +121,16 @@
 OutputSurface::OutputSurface(
     scoped_refptr<ContextProvider> context_provider,
     scoped_refptr<ContextProvider> worker_context_provider,
+#if defined(ENABLE_VULKAN)
+    scoped_refptr<VulkanContextProvider> vulkan_context_provider,
+#endif
     scoped_ptr<SoftwareOutputDevice> software_device)
     : client_(NULL),
       context_provider_(std::move(context_provider)),
       worker_context_provider_(std::move(worker_context_provider)),
+#if defined(ENABLE_VULKAN)
+      vulkan_context_provider_(vulkan_context_provider),
+#endif
       software_device_(std::move(software_device)),
       device_scale_factor_(-1),
       has_alpha_(true),
@@ -134,23 +140,52 @@
 }
 
 OutputSurface::OutputSurface(scoped_refptr<ContextProvider> context_provider)
-    : OutputSurface(std::move(context_provider), nullptr, nullptr) {}
+    : OutputSurface(std::move(context_provider),
+                    nullptr,
+#if defined(ENABLE_VULKAN)
+                    nullptr,
+#endif
+                    nullptr) {
+}
 
 OutputSurface::OutputSurface(
     scoped_refptr<ContextProvider> context_provider,
     scoped_refptr<ContextProvider> worker_context_provider)
     : OutputSurface(std::move(context_provider),
                     std::move(worker_context_provider),
+#if defined(ENABLE_VULKAN)
+                    nullptr,
+#endif
+                    nullptr) {
+}
+
+#if defined(ENABLE_VULKAN)
+OutputSurface::OutputSurface(
+    scoped_refptr<VulkanContextProvider> vulkan_context_provider)
+    : OutputSurface(nullptr,
+                    nullptr,
+                    std::move(vulkan_context_provider),
                     nullptr) {}
+#endif
 
 OutputSurface::OutputSurface(scoped_ptr<SoftwareOutputDevice> software_device)
-    : OutputSurface(nullptr, nullptr, std::move(software_device)) {}
+    : OutputSurface(nullptr,
+                    nullptr,
+#if defined(ENABLE_VULKAN)
+                    nullptr,
+#endif
+                    std::move(software_device)) {
+}
 
 OutputSurface::OutputSurface(scoped_refptr<ContextProvider> context_provider,
                              scoped_ptr<SoftwareOutputDevice> software_device)
     : OutputSurface(std::move(context_provider),
                     nullptr,
-                    std::move(software_device)) {}
+#if defined(ENABLE_VULKAN)
+                    nullptr,
+#endif
+                    std::move(software_device)) {
+}
 
 void OutputSurface::CommitVSyncParameters(base::TimeTicks timebase,
                                           base::TimeDelta interval) {
diff --git a/cc/output/output_surface.h b/cc/output/output_surface.h
index 43cacfee..ccfe1184d 100644
--- a/cc/output/output_surface.h
+++ b/cc/output/output_surface.h
@@ -17,6 +17,10 @@
 #include "cc/output/overlay_candidate_validator.h"
 #include "cc/output/software_output_device.h"
 
+#if defined(ENABLE_VULKAN)
+#include "cc/output/vulkan_context_provider.h"
+#endif
+
 namespace base { class SingleThreadTaskRunner; }
 
 namespace ui {
@@ -47,11 +51,17 @@
  public:
   OutputSurface(scoped_refptr<ContextProvider> context_provider,
                 scoped_refptr<ContextProvider> worker_context_provider,
+#if defined(ENABLE_VULKAN)
+                scoped_refptr<VulkanContextProvider> vulkan_context_provider,
+#endif
                 scoped_ptr<SoftwareOutputDevice> software_device);
   OutputSurface(scoped_refptr<ContextProvider> context_provider,
                 scoped_refptr<ContextProvider> worker_context_provider);
   explicit OutputSurface(scoped_refptr<ContextProvider> context_provider);
-
+#if defined(ENABLE_VULKAN)
+  explicit OutputSurface(
+      scoped_refptr<VulkanContextProvider> vulkan_context_provider);
+#endif
   explicit OutputSurface(scoped_ptr<SoftwareOutputDevice> software_device);
 
   OutputSurface(scoped_refptr<ContextProvider> context_provider,
@@ -101,6 +111,11 @@
   ContextProvider* worker_context_provider() const {
     return worker_context_provider_.get();
   }
+#if defined(ENABLE_VULKAN)
+  VulkanContextProvider* vulkan_context_provider() const {
+    return vulkan_context_provider_.get();
+  }
+#endif
   SoftwareOutputDevice* software_device() const {
     return software_device_.get();
   }
@@ -175,6 +190,9 @@
   struct OutputSurface::Capabilities capabilities_;
   scoped_refptr<ContextProvider> context_provider_;
   scoped_refptr<ContextProvider> worker_context_provider_;
+#if defined(ENABLE_VULKAN)
+  scoped_refptr<VulkanContextProvider> vulkan_context_provider_;
+#endif
   scoped_ptr<SoftwareOutputDevice> software_device_;
   gfx::Size surface_size_;
   float device_scale_factor_;
diff --git a/cc/output/vulkan_renderer.cc b/cc/output/vulkan_renderer.cc
new file mode 100644
index 0000000..a285c65
--- /dev/null
+++ b/cc/output/vulkan_renderer.cc
@@ -0,0 +1,117 @@
+// Copyright (c) 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "cc/output/vulkan_renderer.h"
+
+namespace cc {
+
+scoped_ptr<VulkanRenderer> VulkanRenderer::Create(
+    RendererClient* client,
+    const RendererSettings* settings,
+    OutputSurface* output_surface,
+    ResourceProvider* resource_provider,
+    TextureMailboxDeleter* texture_mailbox_deleter,
+    int highp_threshold_min) {
+  return scoped_ptr<VulkanRenderer>(
+      new VulkanRenderer(client, settings, output_surface, resource_provider,
+                         texture_mailbox_deleter, highp_threshold_min));
+}
+
+VulkanRenderer::~VulkanRenderer() {}
+
+const RendererCapabilitiesImpl& VulkanRenderer::Capabilities() const {
+  return capabilities_;
+}
+
+void VulkanRenderer::Finish() {
+  NOTIMPLEMENTED();
+}
+
+void VulkanRenderer::SwapBuffers(const CompositorFrameMetadata& metadata) {
+  NOTIMPLEMENTED();
+}
+
+void VulkanRenderer::ReceiveSwapBuffersAck(const CompositorFrameAck& ack) {
+  NOTIMPLEMENTED();
+}
+
+VulkanRenderer::VulkanRenderer(RendererClient* client,
+                               const RendererSettings* settings,
+                               OutputSurface* output_surface,
+                               ResourceProvider* resource_provider,
+                               TextureMailboxDeleter* texture_mailbox_deleter,
+                               int highp_threshold_min)
+    : DirectRenderer(client, settings, output_surface, resource_provider) {}
+
+void VulkanRenderer::DidChangeVisibility() {
+  NOTIMPLEMENTED();
+}
+
+void VulkanRenderer::BindFramebufferToOutputSurface(DrawingFrame* frame) {
+  NOTIMPLEMENTED();
+}
+
+bool VulkanRenderer::BindFramebufferToTexture(DrawingFrame* frame,
+                                              const ScopedResource* resource) {
+  NOTIMPLEMENTED();
+  return false;
+}
+
+void VulkanRenderer::SetScissorTestRect(const gfx::Rect& scissor_rect) {
+  NOTIMPLEMENTED();
+}
+
+void VulkanRenderer::PrepareSurfaceForPass(
+    DrawingFrame* frame,
+    SurfaceInitializationMode initialization_mode,
+    const gfx::Rect& render_pass_scissor) {
+  NOTIMPLEMENTED();
+}
+
+void VulkanRenderer::DoDrawQuad(DrawingFrame* frame,
+                                const DrawQuad* quad,
+                                const gfx::QuadF* clip_region) {
+  NOTIMPLEMENTED();
+}
+
+void VulkanRenderer::BeginDrawingFrame(DrawingFrame* frame) {
+  NOTIMPLEMENTED();
+}
+
+void VulkanRenderer::FinishDrawingFrame(DrawingFrame* frame) {
+  NOTIMPLEMENTED();
+}
+
+void VulkanRenderer::FinishDrawingQuadList() {
+  NOTIMPLEMENTED();
+}
+
+bool VulkanRenderer::FlippedFramebuffer(const DrawingFrame* frame) const {
+  NOTIMPLEMENTED();
+  return false;
+}
+
+void VulkanRenderer::EnsureScissorTestEnabled() {
+  NOTIMPLEMENTED();
+}
+
+void VulkanRenderer::EnsureScissorTestDisabled() {
+  NOTIMPLEMENTED();
+}
+
+void VulkanRenderer::DiscardBackbuffer() {
+  NOTIMPLEMENTED();
+}
+
+void VulkanRenderer::EnsureBackbuffer() {
+  NOTIMPLEMENTED();
+}
+
+void VulkanRenderer::CopyCurrentRenderPassToBitmap(
+    DrawingFrame* frame,
+    scoped_ptr<CopyOutputRequest> request) {
+  NOTIMPLEMENTED();
+}
+
+}  // namespace cc
diff --git a/cc/output/vulkan_renderer.h b/cc/output/vulkan_renderer.h
new file mode 100644
index 0000000..1dfbbc7
--- /dev/null
+++ b/cc/output/vulkan_renderer.h
@@ -0,0 +1,76 @@
+// Copyright (c) 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_OUTPUT_VULKAN_RENDERER_H_
+#define CC_OUTPUT_VULKAN_RENDERER_H_
+
+#include "cc/base/cc_export.h"
+#include "cc/output/direct_renderer.h"
+#include "cc/output/renderer.h"
+
+namespace cc {
+
+class TextureMailboxDeleter;
+
+class VulkanRenderer : public DirectRenderer {
+ public:
+  static scoped_ptr<VulkanRenderer> Create(
+      RendererClient* client,
+      const RendererSettings* settings,
+      OutputSurface* output_surface,
+      ResourceProvider* resource_provider,
+      TextureMailboxDeleter* texture_mailbox_deleter,
+      int highp_threshold_min);
+
+  ~VulkanRenderer() override;
+
+  // Implementation of public Renderer functions.
+  const RendererCapabilitiesImpl& Capabilities() const override;
+  void Finish() override;
+  void SwapBuffers(const CompositorFrameMetadata& metadata) override;
+  void ReceiveSwapBuffersAck(const CompositorFrameAck& ack) override;
+
+ protected:
+  VulkanRenderer(RendererClient* client,
+                 const RendererSettings* settings,
+                 OutputSurface* output_surface,
+                 ResourceProvider* resource_provider,
+                 TextureMailboxDeleter* texture_mailbox_deleter,
+                 int highp_threshold_min);
+
+  // Implementations of protected Renderer functions.
+  void DidChangeVisibility() override;
+
+  // Implementations of protected DirectRenderer functions.
+  void BindFramebufferToOutputSurface(DrawingFrame* frame) override;
+  bool BindFramebufferToTexture(DrawingFrame* frame,
+                                const ScopedResource* resource) override;
+  void SetScissorTestRect(const gfx::Rect& scissor_rect) override;
+  void PrepareSurfaceForPass(DrawingFrame* frame,
+                             SurfaceInitializationMode initialization_mode,
+                             const gfx::Rect& render_pass_scissor) override;
+  void DoDrawQuad(DrawingFrame* frame,
+                  const DrawQuad* quad,
+                  const gfx::QuadF* clip_region) override;
+  void BeginDrawingFrame(DrawingFrame* frame) override;
+  void FinishDrawingFrame(DrawingFrame* frame) override;
+  void FinishDrawingQuadList() override;
+  bool FlippedFramebuffer(const DrawingFrame* frame) const override;
+  void EnsureScissorTestEnabled() override;
+  void EnsureScissorTestDisabled() override;
+  void DiscardBackbuffer() override;
+  void EnsureBackbuffer() override;
+  void CopyCurrentRenderPassToBitmap(
+      DrawingFrame* frame,
+      scoped_ptr<CopyOutputRequest> request) override;
+
+ private:
+  RendererCapabilitiesImpl capabilities_;
+
+  DISALLOW_COPY_AND_ASSIGN(VulkanRenderer);
+};
+
+}  // namespace cc
+
+#endif  // CC_OUTPUT_VULKAN_RENDERER_H_
diff --git a/cc/tiles/software_image_decode_controller.cc b/cc/tiles/software_image_decode_controller.cc
index 93d017f..b6e84de7 100644
--- a/cc/tiles/software_image_decode_controller.cc
+++ b/cc/tiles/software_image_decode_controller.cc
@@ -267,7 +267,7 @@
   //       it yet (or failed to decode it).
   //   2b. Unlock the image but keep it in list.
   const ImageKey& key = ImageKey::FromDrawImage(image);
-  DCHECK(CanHandleImage(key));
+  DCHECK(CanHandleImage(key)) << key.ToString();
   TRACE_EVENT1("disabled-by-default-cc.debug",
                "SoftwareImageDecodeController::UnrefImage", "key",
                key.ToString());
@@ -427,7 +427,8 @@
   ImageKey original_size_key =
       ImageKey::FromDrawImage(original_size_draw_image);
   // Sanity checks.
-  DCHECK(original_size_key.can_use_original_decode());
+  DCHECK(original_size_key.can_use_original_decode())
+      << original_size_key.ToString();
   DCHECK(full_image_rect.size() == original_size_key.target_size());
 
   auto decoded_draw_image = GetDecodedImageForDrawInternal(
@@ -439,11 +440,11 @@
 
   SkPixmap decoded_pixmap;
   bool result = decoded_draw_image.image()->peekPixels(&decoded_pixmap);
-  DCHECK(result);
+  DCHECK(result) << key.ToString();
   if (key.src_rect() != full_image_rect) {
     result = decoded_pixmap.extractSubset(&decoded_pixmap,
                                           gfx::RectToSkIRect(key.src_rect()));
-    DCHECK(result);
+    DCHECK(result) << key.ToString();
   }
 
   // Now we have a decoded_pixmap which represents the src_rect at the
@@ -471,7 +472,7 @@
         "SoftwareImageDecodeController::DecodeImageInternal - scale pixels");
     bool result =
         decoded_pixmap.scalePixels(scaled_pixmap, key.filter_quality());
-    DCHECK(result);
+    DCHECK(result) << key.ToString();
   }
 
   // Release the original sized decode. Any other intermediate result to release
diff --git a/cc/trees/draw_property_utils.cc b/cc/trees/draw_property_utils.cc
index 605bca3..c30efd4 100644
--- a/cc/trees/draw_property_utils.cc
+++ b/cc/trees/draw_property_utils.cc
@@ -404,7 +404,7 @@
     bool layer_is_drawn =
         effect_tree.Node(layer->effect_tree_index())->data.is_drawn;
 
-    if (layer_impl->parent() &&
+    if (!IsRootLayer(layer_impl) &&
         LayerShouldBeSkipped(layer_impl, layer_is_drawn, transform_tree))
       continue;
 
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index 3bd87f32..c6efe95 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -18,6 +18,7 @@
 #include "base/command_line.h"
 #include "base/location.h"
 #include "base/metrics/histogram.h"
+#include "base/numerics/safe_math.h"
 #include "base/single_thread_task_runner.h"
 #include "base/stl_util.h"
 #include "base/strings/string_number_conversions.h"
@@ -80,6 +81,57 @@
   return layer_it->second;
 }
 
+scoped_ptr<base::trace_event::TracedValue>
+ComputeLayerTreeHostProtoSizeSplitAsValue(proto::LayerTreeHost* proto) {
+  scoped_ptr<base::trace_event::TracedValue> value(
+      new base::trace_event::TracedValue());
+  base::CheckedNumeric<int> base_layer_properties_size = 0;
+  base::CheckedNumeric<int> picture_layer_properties_size = 0;
+  base::CheckedNumeric<int> display_item_list_size = 0;
+  base::CheckedNumeric<int> drawing_display_items_size = 0;
+
+  const proto::LayerUpdate& layer_update_proto = proto->layer_updates();
+  for (int i = 0; i < layer_update_proto.layers_size(); ++i) {
+    const proto::LayerProperties layer_properties_proto =
+        layer_update_proto.layers(i);
+    base_layer_properties_size += layer_properties_proto.base().ByteSize();
+
+    if (layer_properties_proto.has_picture()) {
+      const proto::PictureLayerProperties& picture_proto =
+          layer_properties_proto.picture();
+      picture_layer_properties_size += picture_proto.ByteSize();
+
+      const proto::RecordingSource& recording_source_proto =
+          picture_proto.recording_source();
+      const proto::DisplayItemList& display_list_proto =
+          recording_source_proto.display_list();
+      display_item_list_size += display_list_proto.ByteSize();
+
+      for (int j = 0; j < display_list_proto.items_size(); ++j) {
+        const proto::DisplayItem& display_item = display_list_proto.items(j);
+        if (display_item.type() == proto::DisplayItem::Type_Drawing)
+          drawing_display_items_size += display_item.ByteSize();
+      }
+    }
+  }
+
+  value->SetInteger("TotalLayerTreeHostProtoSize", proto->ByteSize());
+  value->SetInteger("LayerTreeHierarchySize", proto->root_layer().ByteSize());
+  value->SetInteger("LayerUpdatesSize", proto->layer_updates().ByteSize());
+  value->SetInteger("PropertyTreesSize", proto->property_trees().ByteSize());
+
+  // LayerUpdate size breakdown.
+  value->SetInteger("TotalBasePropertiesSize",
+                    base_layer_properties_size.ValueOrDefault(-1));
+  value->SetInteger("PictureLayerPropertiesSize",
+                    picture_layer_properties_size.ValueOrDefault(-1));
+  value->SetInteger("DisplayItemListSize",
+                    display_item_list_size.ValueOrDefault(-1));
+  value->SetInteger("DrawingDisplayItemsSize",
+                    drawing_display_items_size.ValueOrDefault(-1));
+  return value;
+}
+
 }  // namespace
 
 LayerTreeHost::InitParams::InitParams() {
@@ -1440,6 +1492,7 @@
   //   will need special handling outside of the serialization of the
   //   LayerTreeHost.
   // TODO(nyquist): Figure out how to support animations. See crbug.com/570376.
+  TRACE_EVENT0("cc.remote", "LayerTreeHost::ToProtobufForCommit");
   proto->set_needs_full_tree_sync(needs_full_tree_sync_);
   proto->set_needs_meta_info_recomputation(needs_meta_info_recomputation_);
   proto->set_source_frame_number(source_frame_number_);
@@ -1496,6 +1549,10 @@
   property_trees_.ToProtobuf(proto->mutable_property_trees());
   proto->set_surface_id_namespace(surface_id_namespace_);
   proto->set_next_surface_sequence(next_surface_sequence_);
+
+  TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(
+      "cc.remote", "LayerTreeHostProto", source_frame_number_,
+      ComputeLayerTreeHostProtoSizeSplitAsValue(proto));
 }
 
 void LayerTreeHost::FromProtobufForCommit(const proto::LayerTreeHost& proto) {
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
index 7b94dad..394548d0 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -1346,21 +1346,42 @@
   filters.Append(FilterOperation::CreateBlurFilter(1.5f));
   render_surface1->SetBackgroundFilters(filters);
 
-  LayerImplList render_surface_layer_list;
-  parent->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting();
-  LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
-      parent, parent->bounds(), &render_surface_layer_list,
-      parent->layer_tree_impl()->current_render_surface_list_id());
-  inputs.can_adjust_raster_scales = true;
-  LayerTreeHostCommon::CalculateDrawProperties(&inputs);
-
+  {
+    LayerImplList render_surface_layer_list;
+    parent->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting();
+    LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
+        parent, parent->bounds(), &render_surface_layer_list,
+        parent->layer_tree_impl()->current_render_surface_list_id());
+    inputs.can_adjust_raster_scales = true;
+    LayerTreeHostCommon::CalculateDrawProperties(&inputs);
+    EXPECT_EQ(2U, render_surface_layer_list.size());
+  }
   // The layer is fully transparent, but has a background filter, so it
-  // shouldn't be skipped.
+  // shouldn't be skipped and should be drawn.
   ASSERT_TRUE(parent->render_surface());
   EXPECT_EQ(1U, parent->render_surface()->layer_list().size());
-  EXPECT_EQ(2U, render_surface_layer_list.size());
   EXPECT_EQ(gfx::RectF(0, 0, 10, 10),
             parent->render_surface()->DrawableContentRect());
+  EffectTree& effect_tree =
+      parent->layer_tree_impl()->property_trees()->effect_tree;
+  EffectNode* node = effect_tree.Node(render_surface1->effect_tree_index());
+  EXPECT_TRUE(node->data.is_drawn);
+
+  // When parent is transparent, the layer should not be drawn.
+  parent->OnOpacityAnimated(0.f);
+  render_surface1->OnOpacityAnimated(1.f);
+  {
+    LayerImplList render_surface_layer_list;
+    parent->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting();
+    LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
+        parent, parent->bounds(), &render_surface_layer_list,
+        parent->layer_tree_impl()->current_render_surface_list_id());
+    inputs.can_adjust_raster_scales = true;
+    LayerTreeHostCommon::CalculateDrawProperties(&inputs);
+  }
+
+  node = effect_tree.Node(render_surface1->effect_tree_index());
+  EXPECT_FALSE(node->data.is_drawn);
 }
 
 TEST_F(LayerTreeHostCommonTest, RenderSurfaceListForFilter) {
diff --git a/cc/trees/property_tree.cc b/cc/trees/property_tree.cc
index bc019dc..e3025b23 100644
--- a/cc/trees/property_tree.cc
+++ b/cc/trees/property_tree.cc
@@ -1210,9 +1210,10 @@
   // 2) Nodes that have a background filter.
   // 3) Nodes with animating screen space opacity are drawn if their parent is
   //    drawn irrespective of their opacity.
-  if (node->data.has_copy_request || node->data.has_background_filters)
+  if (node->data.has_copy_request)
     node->data.is_drawn = true;
-  else if (node->data.opacity == 0.f && !node->data.has_animated_opacity)
+  else if (node->data.opacity == 0.f && !node->data.has_animated_opacity &&
+           !node->data.has_background_filters)
     node->data.is_drawn = false;
   else if (parent_node)
     node->data.is_drawn = parent_node->data.is_drawn;
diff --git a/chrome/android/java/res/drawable-hdpi/tab_strip_fade.png b/chrome/android/java/res/drawable-hdpi/tab_strip_fade.png
new file mode 100644
index 0000000..98a5832
--- /dev/null
+++ b/chrome/android/java/res/drawable-hdpi/tab_strip_fade.png
Binary files differ
diff --git a/chrome/android/java/res/drawable-hdpi/tab_strip_fade_for_model_selector.png b/chrome/android/java/res/drawable-hdpi/tab_strip_fade_for_model_selector.png
new file mode 100644
index 0000000..7c58684
--- /dev/null
+++ b/chrome/android/java/res/drawable-hdpi/tab_strip_fade_for_model_selector.png
Binary files differ
diff --git a/chrome/android/java/res/drawable-mdpi/tab_strip_fade.png b/chrome/android/java/res/drawable-mdpi/tab_strip_fade.png
new file mode 100644
index 0000000..fac41f53
--- /dev/null
+++ b/chrome/android/java/res/drawable-mdpi/tab_strip_fade.png
Binary files differ
diff --git a/chrome/android/java/res/drawable-mdpi/tab_strip_fade_for_model_selector.png b/chrome/android/java/res/drawable-mdpi/tab_strip_fade_for_model_selector.png
new file mode 100644
index 0000000..b0e0b02
--- /dev/null
+++ b/chrome/android/java/res/drawable-mdpi/tab_strip_fade_for_model_selector.png
Binary files differ
diff --git a/chrome/android/java/res/drawable-xhdpi/tab_strip_fade.png b/chrome/android/java/res/drawable-xhdpi/tab_strip_fade.png
new file mode 100644
index 0000000..51b70d8
--- /dev/null
+++ b/chrome/android/java/res/drawable-xhdpi/tab_strip_fade.png
Binary files differ
diff --git a/chrome/android/java/res/drawable-xhdpi/tab_strip_fade_for_model_selector.png b/chrome/android/java/res/drawable-xhdpi/tab_strip_fade_for_model_selector.png
new file mode 100644
index 0000000..a4cf9d1
--- /dev/null
+++ b/chrome/android/java/res/drawable-xhdpi/tab_strip_fade_for_model_selector.png
Binary files differ
diff --git a/chrome/android/java/res/drawable-xxhdpi/tab_strip_fade.png b/chrome/android/java/res/drawable-xxhdpi/tab_strip_fade.png
new file mode 100644
index 0000000..6de72e1
--- /dev/null
+++ b/chrome/android/java/res/drawable-xxhdpi/tab_strip_fade.png
Binary files differ
diff --git a/chrome/android/java/res/drawable-xxhdpi/tab_strip_fade_for_model_selector.png b/chrome/android/java/res/drawable-xxhdpi/tab_strip_fade_for_model_selector.png
new file mode 100644
index 0000000..a1381345
--- /dev/null
+++ b/chrome/android/java/res/drawable-xxhdpi/tab_strip_fade_for_model_selector.png
Binary files differ
diff --git a/chrome/android/java/res/drawable-xxxhdpi/tab_strip_fade.png b/chrome/android/java/res/drawable-xxxhdpi/tab_strip_fade.png
new file mode 100644
index 0000000..27e0126
--- /dev/null
+++ b/chrome/android/java/res/drawable-xxxhdpi/tab_strip_fade.png
Binary files differ
diff --git a/chrome/android/java/res/drawable-xxxhdpi/tab_strip_fade_for_model_selector.png b/chrome/android/java/res/drawable-xxxhdpi/tab_strip_fade_for_model_selector.png
new file mode 100644
index 0000000..feff228b
--- /dev/null
+++ b/chrome/android/java/res/drawable-xxxhdpi/tab_strip_fade_for_model_selector.png
Binary files differ
diff --git a/chrome/android/java/res/menu/main_menu.xml b/chrome/android/java/res/menu/main_menu.xml
index 74afcd1..8a0c6c2 100644
--- a/chrome/android/java/res/menu/main_menu.xml
+++ b/chrome/android/java/res/menu/main_menu.xml
@@ -27,6 +27,8 @@
         <item android:id="@+id/update_menu_id"
             android:title="@string/menu_update"
             android:icon="@drawable/menu_update" />
+        <item android:id="@+id/move_to_other_window_menu_id"
+            android:title="@string/menu_move_to_other_window" />
         <item android:id="@+id/new_tab_menu_id"
             android:title="@string/menu_new_tab" />
         <item android:id="@+id/new_incognito_tab_menu_id"
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
index 1ee255bb7..661a4db32 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
@@ -61,10 +61,12 @@
 import org.chromium.chrome.browser.firstrun.FirstRunFlowSequencer;
 import org.chromium.chrome.browser.firstrun.FirstRunSignInProcessor;
 import org.chromium.chrome.browser.firstrun.FirstRunStatus;
+import org.chromium.chrome.browser.incognito.IncognitoNotificationManager;
 import org.chromium.chrome.browser.metrics.ActivityStopMetrics;
 import org.chromium.chrome.browser.metrics.LaunchMetrics;
 import org.chromium.chrome.browser.metrics.StartupMetrics;
 import org.chromium.chrome.browser.metrics.UmaUtils;
+import org.chromium.chrome.browser.multiwindow.MultiWindowUtils;
 import org.chromium.chrome.browser.ntp.NativePageAssassin;
 import org.chromium.chrome.browser.omaha.OmahaClient;
 import org.chromium.chrome.browser.omnibox.AutocompleteController;
@@ -77,6 +79,7 @@
 import org.chromium.chrome.browser.signin.SigninPromoScreen;
 import org.chromium.chrome.browser.snackbar.undo.UndoBarController;
 import org.chromium.chrome.browser.tab.Tab;
+import org.chromium.chrome.browser.tabmodel.AsyncTabParamsManager;
 import org.chromium.chrome.browser.tabmodel.ChromeTabCreator;
 import org.chromium.chrome.browser.tabmodel.EmptyTabModelObserver;
 import org.chromium.chrome.browser.tabmodel.TabModel;
@@ -85,6 +88,7 @@
 import org.chromium.chrome.browser.tabmodel.TabModelSelectorImpl;
 import org.chromium.chrome.browser.tabmodel.TabModelSelectorTabObserver;
 import org.chromium.chrome.browser.tabmodel.TabModelUtils;
+import org.chromium.chrome.browser.tabmodel.TabReparentingParams;
 import org.chromium.chrome.browser.tabmodel.TabWindowManager;
 import org.chromium.chrome.browser.toolbar.ToolbarControlContainer;
 import org.chromium.chrome.browser.util.FeatureUtilities;
@@ -313,6 +317,11 @@
             getWindow().setFeatureInt(Window.FEATURE_INDETERMINATE_PROGRESS,
                     Window.PROGRESS_VISIBILITY_OFF);
 
+            // Check for incognito tabs to handle the case where Chrome was swiped away in the
+            // background.
+            int incognitoCount = TabWindowManager.getInstance().getIncognitoTabCount();
+            if (incognitoCount == 0) IncognitoNotificationManager.dismissIncognitoNotification();
+
             super.finishNativeInitialization();
         } finally {
             TraceEvent.end("ChromeTabbedActivity.finishNativeInitialization");
@@ -1001,7 +1010,9 @@
     @Override
     public boolean onMenuOrKeyboardAction(final int id, boolean fromMenu) {
         final Tab currentTab = getActivityTab();
-        if (id == R.id.new_tab_menu_id) {
+        if (id == R.id.move_to_other_window_menu_id) {
+            if (currentTab != null) moveTabToOtherWindow(currentTab);
+        } else if (id == R.id.new_tab_menu_id) {
             Tab launchedTab = getTabCreator(false).launchUrl(
                     UrlConstants.NTP_URL, TabLaunchType.FROM_CHROME_UI);
             RecordUserAction.record("MobileMenuNewTab");
@@ -1077,6 +1088,27 @@
                 action, BACK_PRESSED_COUNT);
     }
 
+    private void moveTabToOtherWindow(Tab tab) {
+        getCurrentTabModel().removeTab(tab);
+        tab.getContentViewCore().updateWindowAndroid(null);
+        tab.attachTabContentManager(null);
+
+        Class<? extends Activity> targetActivity =
+                MultiWindowUtils.getInstance().getOpenInOtherWindowActivity(this);
+        if (targetActivity == null) return;
+
+        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(tab.getUrl()));
+        intent.setClass(this, targetActivity);
+        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
+                | MultiWindowUtils.FLAG_ACTIVITY_LAUNCH_ADJACENT);
+        intent.putExtra(IntentHandler.EXTRA_TAB_ID, tab.getId());
+
+        AsyncTabParamsManager.add(tab.getId(),
+                new TabReparentingParams(tab, intent, null));
+
+        startActivity(intent);
+    }
+
     @Override
     public boolean handleBackPressed() {
         RecordUserAction.record("SystemBack");
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/RepostFormWarningDialog.java b/chrome/android/java/src/org/chromium/chrome/browser/RepostFormWarningDialog.java
index 9d7d0bb..47dc738 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/RepostFormWarningDialog.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/RepostFormWarningDialog.java
@@ -4,6 +4,7 @@
 
 package org.chromium.chrome.browser;
 
+import android.annotation.SuppressLint;
 import android.app.Dialog;
 import android.app.DialogFragment;
 import android.content.DialogInterface;
@@ -37,6 +38,7 @@
      * Handles the repost form warning for the given Tab.
      * @param tab The tab waiting for confirmation on a repost form warning.
      */
+    @SuppressLint("ValidFragment")
     public RepostFormWarningDialog(Tab tab) {
         mTab = tab;
         mTabObserver = new EmptyTabObserver() {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuPropertiesDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuPropertiesDelegate.java
index 3fe178a..072a6a7d 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuPropertiesDelegate.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuPropertiesDelegate.java
@@ -13,6 +13,7 @@
 import org.chromium.chrome.browser.ShortcutHelper;
 import org.chromium.chrome.browser.UrlConstants;
 import org.chromium.chrome.browser.bookmarks.BookmarkBridge;
+import org.chromium.chrome.browser.multiwindow.MultiWindowUtils;
 import org.chromium.chrome.browser.offlinepages.OfflinePageUtils;
 import org.chromium.chrome.browser.omaha.UpdateMenuItemHelper;
 import org.chromium.chrome.browser.preferences.ManagedPreferencesUtils;
@@ -69,9 +70,10 @@
 
         // Determine which menu to show.
         if (mActivity.isTablet()) {
-            isPageMenu = !isOverview && mActivity.getCurrentTabModel().getCount() != 0;
-            isOverviewMenu = isOverview && mActivity.getCurrentTabModel().getCount() != 0;
-            isTabletEmptyModeMenu = !isPageMenu && mActivity.getCurrentTabModel().getCount() == 0;
+            boolean hasTabs = mActivity.getCurrentTabModel().getCount() != 0;
+            isPageMenu = hasTabs && !isOverview;
+            isOverviewMenu = hasTabs && isOverview;
+            isTabletEmptyModeMenu = !hasTabs;
         } else {
             isPageMenu = !isOverview;
             isOverviewMenu = isOverview;
@@ -108,6 +110,11 @@
             menu.findItem(R.id.update_menu_id).setVisible(
                     UpdateMenuItemHelper.getInstance().shouldShowMenuItem(mActivity));
 
+            // TODO(newt): change this to a flag when command line flags work on Android N.
+            boolean enableMoveToOtherWindow = false;
+            menu.findItem(R.id.move_to_other_window_menu_id).setVisible(enableMoveToOtherWindow
+                    && MultiWindowUtils.getInstance().isOpenInOtherWindowSupported(mActivity));
+
             // Hide "Recent tabs" in incognito mode or when sync can't be enabled.
             MenuItem recentTabsMenuItem = menu.findItem(R.id.recent_tabs_menu_id);
             recentTabsMenuItem.setVisible(!isIncognito && FeatureUtilities.canAllowSync(mActivity));
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkRow.java b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkRow.java
index 709af16..4094f43 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkRow.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkRow.java
@@ -79,7 +79,7 @@
 
     private void clearPopup() {
         if (mPopupMenu != null) {
-            if (mPopupMenu.isShowing()) mPopupMenu.dismiss();
+            mPopupMenu.dismiss();
             mPopupMenu = null;
         }
     }
@@ -164,9 +164,13 @@
                         BookmarkFolderSelectActivity.startFolderSelectActivity(getContext(),
                                 mBookmarkId);
                     } else if (position == 3) {
-                        mDelegate.getModel().deleteBookmarks(mBookmarkId);
+                        if (mDelegate != null && mDelegate.getModel() != null) {
+                            mDelegate.getModel().deleteBookmarks(mBookmarkId);
+                        }
                     }
-                    mPopupMenu.dismiss();
+                    // Somehow the on click event can be triggered way after we dismiss the popup.
+                    // http://crbug.com/600642
+                    if (mPopupMenu != null) mPopupMenu.dismiss();
                 }
             });
         }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerChromeTablet.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerChromeTablet.java
index 345c4cb..1e191a34 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerChromeTablet.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerChromeTablet.java
@@ -141,7 +141,7 @@
             ReaderModeManagerDelegate readerModeDelegate,
             DynamicResourceLoader dynamicResourceLoader) {
         if (mTabStripLayoutHelperManager != null) {
-            mTabStripLayoutHelperManager.setTabModelSelector(selector, creator, content);
+            mTabStripLayoutHelperManager.setTabModelSelector(selector, creator);
         }
 
         super.init(selector, creator, content, androidContentContainer, contextualSearchDelegate,
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/strip/CascadingStripStacker.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/strip/CascadingStripStacker.java
new file mode 100644
index 0000000..555b21c
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/strip/CascadingStripStacker.java
@@ -0,0 +1,183 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.compositor.overlays.strip;
+
+import org.chromium.chrome.browser.util.MathUtils;
+import org.chromium.ui.base.LocalizationUtils;
+
+/**
+ * A stacker that tells the {@link StripLayoutHelper} how to layer the tabs for the
+ * {@link StaticLayout} when the available window width is >= 600dp. Tabs will be stacked with the
+ * focused tab in front with tabs cascading back to each side.
+ */
+public class CascadingStripStacker extends StripStacker {
+    @Override
+    public void setTabOffsets(int selectedIndex, StripLayoutTab[] indexOrderedTabs,
+            float tabStackWidth, int maxTabsToStack, float tabOverlapWidth, float stripLeftMargin,
+            float stripRightMargin, float stripWidth, boolean inReorderMode) {
+        // 1. Calculate the size of the selected tab.  This is used later to figure out how
+        // occluded the tabs are.
+        final StripLayoutTab selTab = selectedIndex >= 0 ? indexOrderedTabs[selectedIndex] : null;
+        final float selTabWidth = selTab != null ? selTab.getWidth() : 0;
+        final float selTabVisibleSize = selTabWidth - tabStackWidth - tabOverlapWidth;
+
+        for (int i = 0; i < indexOrderedTabs.length; i++) {
+            StripLayoutTab tab = indexOrderedTabs[i];
+
+            float posX = tab.getIdealX();
+
+            // 2. Calculate how many tabs are stacked on the left or the right, giving us an idea
+            // of where we can stack this current tab.
+            int leftStackCount = (i < selectedIndex) ? Math.min(i, maxTabsToStack)
+                                                : Math.min(maxTabsToStack, selectedIndex)
+                            + Math.min(maxTabsToStack, i - selectedIndex);
+
+            int rightStackCount = (i >= selectedIndex)
+                    ? Math.min(indexOrderedTabs.length - 1 - i, maxTabsToStack)
+                    : Math.min(indexOrderedTabs.length - 1 - selectedIndex, maxTabsToStack)
+                            + Math.min(selectedIndex - i, maxTabsToStack);
+
+            if (LocalizationUtils.isLayoutRtl()) {
+                int oldLeft = leftStackCount;
+                leftStackCount = rightStackCount;
+                rightStackCount = oldLeft;
+            }
+
+            // 3. Calculate the proper draw position for the tab.  Clamp based on stacking
+            // rules.
+            float minDrawX = tabStackWidth * leftStackCount + stripLeftMargin;
+            float maxDrawX = stripWidth - tabStackWidth * rightStackCount - stripRightMargin;
+
+            float drawX =
+                    MathUtils.clamp(posX + tab.getOffsetX(), minDrawX, maxDrawX - tab.getWidth());
+
+            // TODO(dtrainor): Don't set drawX if the tab is closing?
+            tab.setDrawX(drawX);
+            tab.setDrawY(tab.getOffsetY());
+
+            // 4. Calculate how visible this tab is.
+            float visiblePercentage = 1.f;
+            if (i != selectedIndex) {
+                final float effectiveTabWidth = Math.max(tab.getWidth(), 1.f);
+                final boolean leftStack =
+                        LocalizationUtils.isLayoutRtl() ? i > selectedIndex : i < selectedIndex;
+                final float minVisible = !leftStack ? minDrawX + selTabVisibleSize : minDrawX;
+                final float maxVisible = leftStack ? maxDrawX - selTabVisibleSize : maxDrawX;
+
+                final float clippedTabWidth =
+                        Math.min(posX + effectiveTabWidth, maxVisible) - Math.max(posX, minVisible);
+                visiblePercentage = MathUtils.clamp(clippedTabWidth / effectiveTabWidth, 0.f, 1.f);
+            }
+            tab.setVisiblePercentage(visiblePercentage);
+
+            // 5. Calculate which index we start sliding content for.
+            // When reordering, we don't want to slide the content of the adjacent tabs.
+            int contentOffsetIndex = inReorderMode ? selectedIndex + 1 : selectedIndex;
+
+            // 6. Calculate how much the tab is overlapped on the left side or right for RTL.
+            float hiddenAmount = 0.f;
+            if (i > contentOffsetIndex && i > 0) {
+                // 6.a. Get the effective right edge of the previous tab.
+                final StripLayoutTab prevTab = indexOrderedTabs[i - 1];
+                final float prevLayoutWidth =
+                        (prevTab.getWidth() - tabOverlapWidth) * prevTab.getWidthWeight();
+                float prevTabRight = prevTab.getDrawX();
+                if (!LocalizationUtils.isLayoutRtl()) prevTabRight += prevLayoutWidth;
+
+                // 6.b. Subtract our current draw X from the previous tab's right edge and
+                // get the percentage covered.
+                hiddenAmount = Math.max(prevTabRight - drawX, 0);
+                if (LocalizationUtils.isLayoutRtl()) {
+                    // Invert The amount because we're RTL.
+                    hiddenAmount = prevLayoutWidth - hiddenAmount;
+                }
+            }
+
+            tab.setContentOffsetX(hiddenAmount);
+        }
+    }
+
+    @Override
+    public float computeNewTabButtonOffset(StripLayoutTab[] indexOrderedTabs,
+            float tabOverlapWidth, float stripLeftMargin, float stripRightMargin, float stripWidth,
+            float newTabButtonWidth) {
+        return LocalizationUtils.isLayoutRtl()
+                ? computeNewTabButtonOffsetRtl(indexOrderedTabs, tabOverlapWidth, stripLeftMargin,
+                        stripRightMargin, stripWidth, newTabButtonWidth)
+                                : computeNewTabButtonOffsetLtr(indexOrderedTabs, tabOverlapWidth,
+                                        stripLeftMargin, stripRightMargin, stripWidth);
+    }
+
+    @Override
+    public void performOcclusionPass(int selectedIndex, StripLayoutTab[] indexOrderedTabs,
+            float stripWidth) {
+        for (int i = 1; i < indexOrderedTabs.length; i++) {
+            StripLayoutTab prevTab = indexOrderedTabs[i - 1];
+            StripLayoutTab currTab = indexOrderedTabs[i];
+
+            if ((int) prevTab.getDrawY() == (int) currTab.getDrawY()
+                    && (int) prevTab.getDrawX() == (int) currTab.getDrawX()) {
+                if (i <= selectedIndex) {
+                    prevTab.setVisible(false);
+                } else if (i > selectedIndex) {
+                    currTab.setVisible(false);
+                }
+            } else if ((int) prevTab.getDrawX() != (int) currTab.getDrawX()) {
+                if (i <= selectedIndex) {
+                    prevTab.setVisible(true);
+                } else if (i > selectedIndex) {
+                    currTab.setVisible(true);
+                }
+            }
+
+            if (i == selectedIndex) currTab.setVisible(true);
+
+            // If index 0 is selected, this line is required to set its visibility correctly.
+            if (i - 1 == selectedIndex) prevTab.setVisible(true);
+        }
+    }
+
+    private float computeNewTabButtonOffsetLtr(StripLayoutTab[] indexOrderedTabs,
+            float tabOverlapWidth, float stripLeftMargin, float stripRightMargin,
+            float stripWidth) {
+        float rightEdge = stripLeftMargin;
+
+        for (int i = 0; i < indexOrderedTabs.length; i++) {
+            StripLayoutTab tab = indexOrderedTabs[i];
+            float layoutWidth = (tab.getWidth() - tabOverlapWidth) * tab.getWidthWeight();
+            rightEdge = Math.max(tab.getDrawX() + layoutWidth, rightEdge);
+        }
+
+        rightEdge = Math.min(rightEdge + tabOverlapWidth, stripWidth - stripRightMargin);
+
+        // Adjust the right edge by the tab overlap width so that the new tab button is nestled
+        // closer to the tab.
+        rightEdge -= tabOverlapWidth / 2;
+
+        // The draw X position for the new tab button is the rightEdge of the tab strip.
+        return rightEdge;
+    }
+
+    private float computeNewTabButtonOffsetRtl(StripLayoutTab[] indexOrderedTabs,
+            float tabOverlapWidth, float stripLeftMargin, float stripRightMargin, float stripWidth,
+            float newTabButtonWidth) {
+        float leftEdge = stripWidth - stripRightMargin;
+
+        for (int i = 0; i < indexOrderedTabs.length; i++) {
+            StripLayoutTab tab = indexOrderedTabs[i];
+            leftEdge = Math.min(tab.getDrawX(), leftEdge);
+        }
+
+        leftEdge = Math.max(leftEdge, stripLeftMargin);
+
+        // Adjust the left edge by the tab overlap width so that the new tab button is nestled
+        // closer to the tab.
+        leftEdge += tabOverlapWidth / 2;
+
+        // The draw X position for the new tab button is the left edge of the tab strip minus
+        // the new tab button width.
+        return leftEdge - newTabButtonWidth;
+    }
+}
\ No newline at end of file
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/strip/ScrollingStripStacker.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/strip/ScrollingStripStacker.java
new file mode 100644
index 0000000..f356bb0
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/strip/ScrollingStripStacker.java
@@ -0,0 +1,99 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.compositor.overlays.strip;
+
+import org.chromium.ui.base.LocalizationUtils;
+
+/**
+ * A stacker that tells the {@link StripLayoutHelper} how to layer the tabs for the
+ * {@link StaticLayout} when the available window width is < 600dp. Tabs will be stacked side by
+ * side and the entire strip will scroll. Tabs will never completely overlap each other.
+ */
+public class ScrollingStripStacker extends StripStacker {
+    @Override
+    public void setTabOffsets(int selectedIndex, StripLayoutTab[] indexOrderedTabs,
+            float tabStackWidth, int maxTabsToStack, float tabOverlapWidth, float stripLeftMargin,
+            float stripRightMargin, float stripWidth, boolean inReorderMode) {
+        for (int i = 0; i < indexOrderedTabs.length; i++) {
+            StripLayoutTab tab = indexOrderedTabs[i];
+            tab.setDrawX(tab.getIdealX());
+            tab.setDrawY(tab.getOffsetY());
+            tab.setVisiblePercentage(1.f);
+            tab.setContentOffsetX(0.f);
+        }
+    }
+
+    @Override
+    public float computeNewTabButtonOffset(StripLayoutTab[] indexOrderedTabs,
+            float tabOverlapWidth, float stripLeftMargin, float stripRightMargin, float stripWidth,
+            float newTabButtonWidth) {
+        return LocalizationUtils.isLayoutRtl()
+                ? computeNewTabButtonOffsetRtl(indexOrderedTabs, tabOverlapWidth, stripRightMargin,
+                        stripWidth, newTabButtonWidth)
+                                : computeNewTabButtonOffsetLtr(indexOrderedTabs, tabOverlapWidth,
+                                        stripLeftMargin, stripWidth);
+    }
+
+    @Override
+    public void performOcclusionPass(int selectedIndex, StripLayoutTab[] indexOrderedTabs,
+            float layoutWidth) {
+        for (int i = 0; i < indexOrderedTabs.length; i++) {
+            StripLayoutTab tab = indexOrderedTabs[i];
+            tab.setVisible((tab.getDrawX() + tab.getWidth()) >= 0 && tab.getDrawX() <= layoutWidth);
+        }
+    }
+
+    private float computeNewTabButtonOffsetLtr(StripLayoutTab[] indexOrderedTabs,
+            float tabOverlapWidth, float stripLeftMargin, float stripWidth) {
+        float rightEdge = stripLeftMargin;
+
+        int numTabs = indexOrderedTabs.length;
+        // Need to look at the last two tabs to determine the new tab position in case the last
+        // tab is dying.
+        int i = numTabs > 0 ? ((numTabs >= 2) ? numTabs - 2 : numTabs - 1) : 0;
+        for (; i < numTabs; i++) {
+            StripLayoutTab tab = indexOrderedTabs[i];
+            float layoutWidth;
+            if (tab.isDying()) {
+                // If a tab is dying, adjust the tab width by the width weight so that the new
+                // tab button slides to the left with the closing tab.
+                layoutWidth = tab.getWidth() * tab.getWidthWeight();
+            } else {
+                // If a tab is being created, disregard its width weight so the new tab button
+                // doesn't end up positioned too far to the left. If a tab is neither being
+                // created or dying, its width width weight is 1.0 and can also be ignored.
+                layoutWidth = tab.getWidth();
+            }
+
+            rightEdge = Math.max(tab.getDrawX() + layoutWidth, rightEdge);
+        }
+
+        // Adjust the right edge by the tab overlap width so that the new tab button is nestled
+        // closer to the tab.
+        rightEdge -= tabOverlapWidth / 2;
+
+        // The draw X position for the new tab button is the rightEdge of the tab strip.
+        return rightEdge;
+    }
+
+    private float computeNewTabButtonOffsetRtl(StripLayoutTab[] indexOrderedTabs,
+            float tabOverlapWidth, float stripRightMargin, float stripWidth,
+            float newTabButtonWidth) {
+        float leftEdge = stripWidth - stripRightMargin;
+        int numTabs = indexOrderedTabs.length;
+        if (numTabs >= 1) {
+            StripLayoutTab tab = indexOrderedTabs[numTabs - 1];
+            leftEdge = Math.min(tab.getDrawX(), leftEdge);
+        }
+
+        // Adjust the left edge by the tab overlap width so that the new tab button is nestled
+        // closer to the tab.
+        leftEdge += tabOverlapWidth / 2;
+
+        // The draw X position for the new tab button is the left edge of the tab strip minus
+        // the new tab button width.
+        return leftEdge - newTabButtonWidth;
+    }
+}
\ No newline at end of file
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/strip/StaticStripStacker.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/strip/StaticStripStacker.java
deleted file mode 100644
index 992b5bd..0000000
--- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/strip/StaticStripStacker.java
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.chrome.browser.compositor.overlays.strip;
-
-import org.chromium.chrome.browser.util.MathUtils;
-
-/**
- * A stacker that tells the {@link StripHelper} how to layer the tabs for the
- * {@link StaticLayout}.  This will basically be focused tab in front with tabs cascading
- * back to each side.
- */
-public class StaticStripStacker implements StripStacker {
-    @Override
-    public boolean canShowCloseButton() {
-        return true;
-    }
-
-    @Override
-    public boolean canSlideTitleText() {
-        return true;
-    }
-
-    @Override
-    public void createVisualOrdering(int selectedIndex, StripLayoutTab[] indexOrderedTabs,
-            StripLayoutTab[] outVisualOrderedTabs) {
-        assert indexOrderedTabs.length == outVisualOrderedTabs.length;
-
-        selectedIndex = MathUtils.clamp(selectedIndex, 0, indexOrderedTabs.length);
-
-        int outIndex = 0;
-        for (int i = 0; i < selectedIndex; i++) {
-            outVisualOrderedTabs[outIndex++] = indexOrderedTabs[i];
-        }
-
-        for (int i = indexOrderedTabs.length - 1; i >= selectedIndex; --i) {
-            outVisualOrderedTabs[outIndex++] = indexOrderedTabs[i];
-        }
-    }
-
-    @Override
-    public void performOcclusionPass(int selectedIndex, StripLayoutTab[] indexOrderedTabs) {
-        for (int i = 1; i < indexOrderedTabs.length; i++) {
-            StripLayoutTab prevTab = indexOrderedTabs[i - 1];
-            StripLayoutTab currTab = indexOrderedTabs[i];
-
-            if ((int) prevTab.getDrawY() == (int) currTab.getDrawY()
-                    && (int) prevTab.getDrawX() == (int) currTab.getDrawX()) {
-                if (i <= selectedIndex) {
-                    prevTab.setVisible(false);
-                } else if (i > selectedIndex) {
-                    currTab.setVisible(false);
-                }
-            } else if ((int) prevTab.getDrawX() != (int) currTab.getDrawX()) {
-                if (i <= selectedIndex) {
-                    prevTab.setVisible(true);
-                } else if (i > selectedIndex) {
-                    currTab.setVisible(true);
-                }
-            }
-
-            if (i == selectedIndex) currTab.setVisible(true);
-        }
-    }
-}
\ No newline at end of file
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/strip/StripLayoutHelper.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/strip/StripLayoutHelper.java
index dd894353c..19db6a5 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/strip/StripLayoutHelper.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/strip/StripLayoutHelper.java
@@ -30,7 +30,6 @@
 import org.chromium.chrome.browser.compositor.layouts.LayoutUpdateHost;
 import org.chromium.chrome.browser.compositor.layouts.components.CompositorButton;
 import org.chromium.chrome.browser.compositor.layouts.components.VirtualView;
-import org.chromium.chrome.browser.compositor.layouts.content.TabContentManager;
 import org.chromium.chrome.browser.compositor.layouts.phone.stack.StackScroller;
 import org.chromium.chrome.browser.compositor.overlays.strip.TabLoadTracker.TabLoadTrackerCallback;
 import org.chromium.chrome.browser.tab.Tab;
@@ -38,6 +37,7 @@
 import org.chromium.chrome.browser.tabmodel.TabModel;
 import org.chromium.chrome.browser.tabmodel.TabModelUtils;
 import org.chromium.chrome.browser.util.MathUtils;
+import org.chromium.ui.base.DeviceFormFactor;
 import org.chromium.ui.base.LocalizationUtils;
 
 import java.util.ArrayList;
@@ -67,7 +67,7 @@
     // Animation/Timer Constants
     private static final int RESIZE_DELAY_MS = 1500;
     private static final int SPINNER_UPDATE_DELAY_MS = 66;
-    // Degrees per milisecond.
+    // Degrees per millisecond.
     private static final float SPINNER_DPMS = 0.33f;
     private static final int EXPAND_DURATION_MS = 250;
     private static final int ANIM_TAB_CREATED_MS = 150;
@@ -88,6 +88,7 @@
     private static final float NEW_TAB_BUTTON_CLICK_SLOP_DP = 4.f;
     private static final float NEW_TAB_BUTTON_WIDTH_DP = 58.f;
     private static final float NEW_TAB_BUTTON_HEIGHT_DP = 32.5f;
+    static final float FADE_FULL_OPACITY_THRESHOLD_DP = 24.f;
 
     private static final int MESSAGE_RESIZE = 1;
     private static final int MESSAGE_UPDATE_SPINNER = 2;
@@ -97,8 +98,9 @@
     private final LayoutRenderHost mRenderHost;
     private TabModel mModel;
     private TabCreator mTabCreator;
-    private TabContentManager mTabContentManager;
-    private StripStacker mStripStacker = new StaticStripStacker();
+    private StripStacker mStripStacker;
+    private CascadingStripStacker mCascadingStripStacker = new CascadingStripStacker();
+    private ScrollingStripStacker mScrollingStripStacker = new ScrollingStripStacker();
 
     // Internal State
     private StripLayoutTab[] mStripTabs = new StripLayoutTab[0];
@@ -111,9 +113,8 @@
     private final CompositorButton mNewTabButton;
 
     // Layout Constants
-    private final float mTabStackWidth;
     private final float mTabOverlapWidth;
-    private float mNewTabButtonWidth;
+    private final float mNewTabButtonWidth;
     private final float mMinTabWidth;
     private final float mMaxTabWidth;
     private final float mReorderMoveStartThreshold;
@@ -141,6 +142,8 @@
     private float mRightMargin;
     private final boolean mIncognito;
     private float mBrightness;
+    // Whether the CascadingStripStacker should be used.
+    private boolean mShouldCascadeTabs;
 
     // Tab menu item IDs
     public static final int ID_CLOSE_ALL_TABS = 0;
@@ -155,14 +158,9 @@
      */
     public StripLayoutHelper(Context context, LayoutUpdateHost updateHost,
             LayoutRenderHost renderHost, boolean incognito) {
-        mTabStackWidth = TAB_STACK_WIDTH_DP;
         mTabOverlapWidth = TAB_OVERLAP_WIDTH_DP;
         mNewTabButtonWidth = NEW_TAB_BUTTON_WIDTH_DP;
 
-        if (LocalizationUtils.isLayoutRtl()) {
-            // In rtl let the tab nest closer to the new tab button.
-            mNewTabButtonWidth -= mTabOverlapWidth / 2;
-        }
         mRightMargin = LocalizationUtils.isLayoutRtl() ? 0 : mNewTabButtonWidth;
         mLeftMargin = LocalizationUtils.isLayoutRtl() ? mNewTabButtonWidth : 0;
         mMinTabWidth = MIN_TAB_WIDTH_DP;
@@ -206,6 +204,13 @@
         int menuWidth = mContext.getResources().getDimensionPixelSize(R.dimen.menu_width);
         mTabMenu.setWidth(menuWidth);
         mTabMenu.setModal(true);
+
+        int screenWidthDp = context.getResources().getConfiguration().screenWidthDp;
+        mShouldCascadeTabs = screenWidthDp >= DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP;
+        mStripStacker = mShouldCascadeTabs ? mCascadingStripStacker : mScrollingStripStacker;
+
+        // TODO(twellington): auto-scroll on cold start and when the tab model is switched
+        //                    so the selected tab is visible when !mShouldCascadeTabs.
     }
 
     /**
@@ -263,6 +268,47 @@
     }
 
     /**
+     * @return The opacity to use for the fade on the left side of the tab strip.
+     */
+    public float getLeftFadeOpacity() {
+        return getFadeOpacity(true);
+    }
+
+    /**
+     * @return The opacity to use for the fade on the right side of the tab strip.
+     */
+    public float getRightFadeOpacity() {
+        return getFadeOpacity(false);
+    }
+
+    /**
+     * When the {@link ScrollingStripStacker} is being used, a fade is shown at the left and
+     * right edges to indicate there is tab strip content off screen. As the scroll position
+     * approaches the edge of the screen, the fade opacity is lowered.
+     *
+     * @param isLeft Whether the opacity for the left or right side should be returned.
+     * @return The opacity to use for the fade.
+     */
+    private float getFadeOpacity(boolean isLeft) {
+        if (mShouldCascadeTabs) return 0.f;
+
+        // In RTL, scroll position 0 is on the right side of the screen, whereas in LTR scroll
+        // position 0 is on the left. Account for that in the offset calculation.
+        boolean isRtl = LocalizationUtils.isLayoutRtl();
+        boolean useUnadjustedScrollOffset = isRtl != isLeft;
+        float offset = -(useUnadjustedScrollOffset ? mScrollOffset
+                : (mMinScrollOffset - mScrollOffset));
+
+        if (offset == 0.f) {
+            return 0.f;
+        } else if (offset >= FADE_FULL_OPACITY_THRESHOLD_DP) {
+            return 1.f;
+        } else {
+            return offset / FADE_FULL_OPACITY_THRESHOLD_DP;
+        }
+    }
+
+    /**
      * Allows changing the visual behavior of the tabs in this stack, as specified by
      * {@code stacker}.
      * @param stacker The {@link StripStacker} that should specify how the tabs should be
@@ -279,21 +325,14 @@
     }
 
     /**
-     * @parm margin The width of the distance between the left edge of
-     *              the screen and first tab.
+     * @param margin The distance between the last tab and the edge of the screen.
      */
-    public void setLeftMargin(float margin) {
-        mLeftMargin = margin;
-        mLeftMargin += LocalizationUtils.isLayoutRtl() ? mNewTabButtonWidth : 0;
-    }
-
-    /**
-     * @param margin The distance between the rightmost tab and the edge of the
-     *               screen.
-     */
-    public void setRightMargin(float margin) {
-        mRightMargin = margin;
-        mRightMargin += LocalizationUtils.isLayoutRtl() ? 0 : mNewTabButtonWidth;
+    public void setEndMargin(float margin) {
+        if (LocalizationUtils.isLayoutRtl()) {
+            mLeftMargin = margin + mNewTabButtonWidth;
+        } else {
+            mRightMargin = margin + mNewTabButtonWidth;
+        }
     }
 
     /**
@@ -313,7 +352,10 @@
             mStripTabs[i].setHeight(mHeight);
         }
 
-        if (widthChanged) computeAndUpdateTabWidth(false);
+        if (widthChanged) {
+            computeAndUpdateTabWidth(false);
+            setShouldCascadeTabs(width >= DeviceFormFactor.MINIMUM_TABLET_WIDTH_DP);
+        }
         if (mStripTabs.length > 0) mUpdateHost.requestUpdate();
 
         // Dismiss tab menu, similar to how the app menu is dismissed on orientation change
@@ -321,6 +363,31 @@
     }
 
     /**
+     * Should be called when the viewport width crosses the 600dp threshold. The
+     * {@link CascadingStripStacker} should be used at 600dp+, otherwise the
+     * {@link ScrollingStripStacker} should be used.
+     * @param shouldCascadeTabs Whether the {@link CascadingStripStacker} should be used.
+     */
+    void setShouldCascadeTabs(boolean shouldCascadeTabs) {
+        if (shouldCascadeTabs != mShouldCascadeTabs) {
+            mShouldCascadeTabs = shouldCascadeTabs;
+            setTabStacker(shouldCascadeTabs ? mCascadingStripStacker : mScrollingStripStacker);
+
+            // Scroll to make the selected tab visible and nearby tabs visible.
+            if (mModel.getTabAt(mModel.index()) != null) {
+                updateScrollOffsetLimits();
+                StripLayoutTab tab = findTabById(mModel.getTabAt(mModel.index()).getId());
+                float delta = calculateOffsetToMakeTabVisible(tab, true, true, true);
+                // During this resize, mMinScrollOffset will be changing, so the scroll effect
+                // cannot be properly animated. Jump to the new scroll offset instead.
+                mScrollOffset += delta;
+            }
+
+            updateStrip();
+        }
+    }
+
+    /**
      * Updates all internal resources and dimensions.
      * @param context The current Android {@link Context}.
      */
@@ -343,11 +410,11 @@
     /**
      * Sets the {@link TabModel} that this {@link StripLayoutHelper} will visually represent.
      * @param model The {@link TabModel} to visually represent.
+     * @param tabCreator The {@link TabCreator}, used to create new tabs.
      */
-    public void setTabModel(TabModel model, TabContentManager manager, TabCreator tabCreator) {
+    public void setTabModel(TabModel model, TabCreator tabCreator) {
         if (mModel == model) return;
         mModel = model;
-        mTabContentManager = manager;
         mTabCreator = tabCreator;
         computeAndUpdateTabOrders(false);
     }
@@ -361,7 +428,7 @@
     public boolean updateLayout(long time, long dt) {
         PerfTraceEvent.instant("StripLayoutHelper:updateLayout");
         final boolean doneAnimating = onUpdateAnimation(time, false);
-        updateStrip(time, dt);
+        updateStrip();
         return doneAnimating;
     }
 
@@ -376,6 +443,14 @@
             tabCreated(time, id, prevId, true);
         } else {
             updateVisualTabOrdering();
+
+            // If the tab was selected through a method other than the user tapping on the strip, it
+            // may not be currently visible. Scroll if necessary.
+            if (!mShouldCascadeTabs && !findTabById(id).isVisible()) {
+                float delta = calculateOffsetToMakeTabVisible(findTabById(id), true, true, true);
+                setScrollForScrollingTabStacker(delta, true, time);
+            }
+
             mUpdateHost.requestUpdate();
         }
     }
@@ -443,16 +518,33 @@
         // 3. Figure out which tab needs to be visible.
         StripLayoutTab fastExpandTab = findTabById(prevId);
         boolean allowLeftExpand = false;
+        boolean canExpandSelectedTab = false;
         if (!selected) {
             fastExpandTab = tab;
             allowLeftExpand = true;
         }
 
+        if (!mShouldCascadeTabs) {
+            fastExpandTab = tab;
+            allowLeftExpand = true;
+            canExpandSelectedTab = true;
+        }
+
         // 4. Scroll the stack so that the fast expand tab is visible.
         if (fastExpandTab != null) {
-            float delta =
-                    calculateOffsetToMakeTabVisible(fastExpandTab, false, allowLeftExpand, true);
-            if (delta != 0.f) {
+            float delta = calculateOffsetToMakeTabVisible(
+                    fastExpandTab,
+                    canExpandSelectedTab,
+                    allowLeftExpand,
+                    true);
+
+            if (!mShouldCascadeTabs) {
+                // If the ScrollingStripStacker is being used and the new tab button is visible, go
+                // directly to the new scroll offset rather than animating. Animating the scroll
+                // causes the new tab button to disappear for a frame.
+                boolean shouldAnimate = !mNewTabButton.isVisible();
+                setScrollForScrollingTabStacker(delta, shouldAnimate, time);
+            } else if (delta != 0.f) {
                 mScroller.startScroll(mScrollOffset, 0, (int) delta, 0, time, EXPAND_DURATION_MS);
             }
         }
@@ -546,9 +638,16 @@
             // 2.b. Still scrolling, update the scroll destination here.
             mScroller.setFinalX((int) (mScroller.getFinalX() + deltaX));
         } else {
-            // 2.c. Not scrolling.  Check if we need to fast expand.
-            float fastExpandDelta =
-                    calculateOffsetToMakeTabVisible(mInteractingTab, true, true, true);
+            // 2.c. Not scrolling. Check if we need to fast expand.
+            float fastExpandDelta;
+            if (mShouldCascadeTabs) {
+                fastExpandDelta =
+                        calculateOffsetToMakeTabVisible(mInteractingTab, true, true, true);
+            } else {
+                // Non-cascaded tabs are never hidden behind each other, so there's no need to fast
+                // expand.
+                fastExpandDelta = 0.f;
+            }
 
             if (mInteractingTab != null && fastExpandDelta != 0.f) {
                 if ((fastExpandDelta > 0 && deltaX > 0) || (fastExpandDelta < 0 && deltaX < 0)) {
@@ -874,9 +973,15 @@
 
         // 2. Compute the effective width of every tab.
         float tabsWidth = 0.f;
-        for (int i = 0; i < mStripTabs.length; i++) {
-            final StripLayoutTab tab = mStripTabs[i];
-            tabsWidth += (tab.getWidth() - mTabOverlapWidth) * tab.getWidthWeight();
+        if (mShouldCascadeTabs) {
+            for (int i = 0; i < mStripTabs.length; i++) {
+                final StripLayoutTab tab = mStripTabs[i];
+                tabsWidth += (tab.getWidth() - mTabOverlapWidth) * tab.getWidthWeight();
+            }
+        } else {
+            // When tabs aren't cascaded, they're non-animating width weight is always 1.0 so it
+            // doesn't need to be included in this calculation.
+            tabsWidth = mStripTabs.length * (mCachedTabWidth - mTabOverlapWidth);
         }
 
         // 3. Correct fencepost error in tabswidth;
@@ -994,7 +1099,7 @@
         }
     }
 
-    private void updateStrip(long time, long dt) {
+    private void updateStrip() {
         if (mModel == null) return;
 
         // TODO(dtrainor): Remove this once tabCreated() is refactored to be called even from
@@ -1010,10 +1115,12 @@
         computeTabInitialPositions();
 
         // 3. Calculate the tab stacking.
-        computeTabOffsetHelper();
+        mStripStacker.setTabOffsets(mModel.index(), mStripTabs, TAB_STACK_WIDTH_DP,
+                MAX_TABS_TO_STACK, mTabOverlapWidth, mLeftMargin, mRightMargin, mWidth,
+                mInReorderMode);
 
         // 4. Calculate which tabs are visible.
-        mStripStacker.performOcclusionPass(mModel.index(), mStripTabs);
+        mStripStacker.performOcclusionPass(mModel.index(), mStripTabs, mWidth);
 
         // 5. Create render list.
         createRenderList();
@@ -1052,91 +1159,6 @@
         }
     }
 
-    private void computeTabOffsetHelper() {
-        final int selIndex = mModel.index();
-
-        // 1. Calculate the size of the selected tab.  This is used later to figure out how
-        // occluded the tabs are.
-        final StripLayoutTab selTab = selIndex >= 0 ? mStripTabs[selIndex] : null;
-        final float selTabWidth = selTab != null ? selTab.getWidth() : 0;
-        final float selTabVisibleSize = selTabWidth - mTabStackWidth - mTabOverlapWidth;
-
-        for (int i = 0; i < mStripTabs.length; i++) {
-            StripLayoutTab tab = mStripTabs[i];
-
-            float posX = tab.getIdealX();
-
-            // 2. Calculate how many tabs are stacked on the left or the right, giving us an idea
-            // of where we can stack this current tab.
-            int leftStackCount = (i < selIndex) ? Math.min(i, MAX_TABS_TO_STACK)
-                                                : Math.min(MAX_TABS_TO_STACK, selIndex)
-                            + Math.min(MAX_TABS_TO_STACK, i - selIndex);
-
-            int rightStackCount = (i >= selIndex)
-                    ? Math.min(mStripTabs.length - 1 - i, MAX_TABS_TO_STACK)
-                    : Math.min(mStripTabs.length - 1 - selIndex, MAX_TABS_TO_STACK)
-                            + Math.min(selIndex - i, MAX_TABS_TO_STACK);
-
-            if (LocalizationUtils.isLayoutRtl()) {
-                int oldLeft = leftStackCount;
-                leftStackCount = rightStackCount;
-                rightStackCount = oldLeft;
-            }
-
-            // 3. Calculate the proper draw position for the tab.  Clamp based on stacking
-            // rules.
-            float minDrawX = mTabStackWidth * leftStackCount + mLeftMargin;
-            float maxDrawX = mWidth - mTabStackWidth * rightStackCount - mRightMargin;
-
-            float drawX =
-                    MathUtils.clamp(posX + tab.getOffsetX(), minDrawX, maxDrawX - tab.getWidth());
-
-            // TODO(dtrainor): Don't set drawX if the tab is closing?
-            tab.setDrawX(drawX);
-            tab.setDrawY(tab.getOffsetY());
-
-            // 4. Calculate how visible this tab is.
-            float visiblePercentage = 1.f;
-            if (i != selIndex) {
-                final float effectiveTabWidth = Math.max(tab.getWidth(), 1.f);
-                final boolean leftStack =
-                        LocalizationUtils.isLayoutRtl() ? i > selIndex : i < selIndex;
-                final float minVisible = !leftStack ? minDrawX + selTabVisibleSize : minDrawX;
-                final float maxVisible = leftStack ? maxDrawX - selTabVisibleSize : maxDrawX;
-
-                final float clippedTabWidth =
-                        Math.min(posX + effectiveTabWidth, maxVisible) - Math.max(posX, minVisible);
-                visiblePercentage = MathUtils.clamp(clippedTabWidth / effectiveTabWidth, 0.f, 1.f);
-            }
-            tab.setVisiblePercentage(visiblePercentage);
-
-            // 5. Calculate which index we start sliding content for.
-            // When reordering, we don't want to slide the content of the adjacent tabs.
-            int contentOffsetIndex = mInReorderMode ? selIndex + 1 : selIndex;
-
-            // 6. Calculate how much the tab is overlapped on the left side or right for RTL.
-            float hiddenAmount = 0.f;
-            if (i > contentOffsetIndex && i > 0 && mStripStacker.canSlideTitleText()) {
-                // 6.a. Get the effective right edge of the previous tab.
-                final StripLayoutTab prevTab = mStripTabs[i - 1];
-                final float prevLayoutWidth =
-                        (prevTab.getWidth() - mTabOverlapWidth) * prevTab.getWidthWeight();
-                float prevTabRight = prevTab.getDrawX();
-                if (!LocalizationUtils.isLayoutRtl()) prevTabRight += prevLayoutWidth;
-
-                // 6.b. Subtract our current draw X from the previous tab's right edge and
-                // get the percentage covered.
-                hiddenAmount = Math.max(prevTabRight - drawX, 0);
-                if (LocalizationUtils.isLayoutRtl()) {
-                    // Invert The amount because we're RTL.
-                    hiddenAmount = prevLayoutWidth - hiddenAmount;
-                }
-            }
-
-            tab.setContentOffsetX(hiddenAmount);
-        }
-    }
-
     private void createRenderList() {
         // 1. Figure out how many tabs will need to be rendered.
         int renderCount = 0;
@@ -1164,28 +1186,21 @@
             mNewTabButton.setVisible(false);
             return;
         }
+
+        // 1. Get offset from strip stacker.
+        float offset = mStripStacker.computeNewTabButtonOffset(mStripTabs,
+                mTabOverlapWidth, mLeftMargin, mRightMargin, mWidth, mNewTabButtonWidth);
+
+        // 2. Hide the new tab button if it's not visible on the screen.
+        boolean isRtl = LocalizationUtils.isLayoutRtl();
+        if ((isRtl && offset + mNewTabButtonWidth < 0) || (!isRtl && offset > mWidth)) {
+            mNewTabButton.setVisible(false);
+            return;
+        }
         mNewTabButton.setVisible(true);
 
-        float leftEdge = mWidth - mRightMargin;
-        float rightEdge = mLeftMargin;
-
-        for (int i = 0; i < mStripTabs.length; i++) {
-            StripLayoutTab tab = mStripTabs[i];
-            float layoutWidth = (tab.getWidth() - mTabOverlapWidth) * tab.getWidthWeight();
-            rightEdge = Math.max(tab.getDrawX() + layoutWidth, rightEdge);
-            leftEdge = Math.min(tab.getDrawX(), leftEdge);
-        }
-        rightEdge = Math.min(rightEdge + mTabOverlapWidth, mWidth - mRightMargin);
-        leftEdge = Math.max(leftEdge, mLeftMargin);
-
-        rightEdge -= mTabOverlapWidth / 2;
-
         // 3. Position the new tab button.
-        if (!LocalizationUtils.isLayoutRtl()) {
-            mNewTabButton.setX(rightEdge);
-        } else {
-            mNewTabButton.setX(leftEdge - mNewTabButtonWidth);
-        }
+        mNewTabButton.setX(offset);
     }
 
     private float calculateOffsetToMakeTabVisible(StripLayoutTab tab, boolean canExpandSelectedTab,
@@ -1219,10 +1234,16 @@
 
         // 4. Return the proper deltaX that has to be applied to the current scroll to see the
         // tab.
-        if (mScrollOffset < optimalLeft && canExpandLeft) {
+        if (mShouldCascadeTabs) {
+            if (mScrollOffset < optimalLeft && canExpandLeft) {
+                return optimalLeft - mScrollOffset;
+            } else if (mScrollOffset > optimalRight && canExpandRight) {
+                return optimalRight - mScrollOffset;
+            }
+        } else {
+            // If tabs are not cascaded, the entire tab strip scrolls and the strip should be
+            // scrolled to the optimal left offset.
             return optimalLeft - mScrollOffset;
-        } else if (mScrollOffset > optimalRight && canExpandRight) {
-            return optimalRight - mScrollOffset;
         }
 
         // 5. We don't have to do anything.  Return no delta.
@@ -1286,9 +1307,14 @@
         TabModelUtils.setIndex(
                 mModel, TabModelUtils.getTabIndexById(mModel, mInteractingTab.getId()));
 
-        // 5. Fast expand to make sure this tab is visible.
-        float fastExpandDelta = calculateOffsetToMakeTabVisible(mInteractingTab, true, true, true);
-        mScroller.startScroll(mScrollOffset, 0, (int) fastExpandDelta, 0, time, EXPAND_DURATION_MS);
+        // 5. Fast expand to make sure this tab is visible. If tabs are not cascaded, the selected
+        //    tab will already be visible, so there's no need to fast expand to make it visible.
+        if (mShouldCascadeTabs) {
+            float fastExpandDelta =
+                    calculateOffsetToMakeTabVisible(mInteractingTab, true, true, true);
+            mScroller.startScroll(mScrollOffset, 0, (int) fastExpandDelta, 0, time,
+                    EXPAND_DURATION_MS);
+        }
 
         // 6. Request an update.
         mUpdateHost.requestUpdate();
@@ -1583,6 +1609,16 @@
         mTabMenu.show();
     }
 
+    private void setScrollForScrollingTabStacker(float delta, boolean shouldAnimate, long time) {
+        if (delta == 0.f) return;
+
+        if (shouldAnimate) {
+            mScroller.startScroll(mScrollOffset, 0, (int) delta, 0, time, EXPAND_DURATION_MS);
+        } else {
+            mScrollOffset += delta;
+        }
+    }
+
     /**
      * @return true if the tab menu is showing
      */
@@ -1598,4 +1634,62 @@
     public void clickTabMenuItem(int menuItemId) {
         mTabMenu.performItemClick(menuItemId);
     }
+
+    /**
+     * @return Whether the {@link CascadingStripStacker} is being used.
+     */
+    @VisibleForTesting
+    boolean shouldCascadeTabs() {
+        return mShouldCascadeTabs;
+    }
+
+    /**
+     * @return The with of the tab strip.
+     */
+    @VisibleForTesting
+    float getWidth() {
+        return mWidth;
+    }
+
+    /**
+     * @return The strip's current scroll offset.
+     */
+    @VisibleForTesting
+    int getScrollOffset() {
+        return mScrollOffset;
+    }
+
+    /**
+     * @return The strip's minimum scroll offset.
+     */
+    @VisibleForTesting
+    float getMinimumScrollOffset() {
+        return mMinScrollOffset;
+    }
+
+    /**
+     * Set the scroll offset. Should only be used for testing.
+     * @param scrollOffset The scroll offset.
+     */
+    @VisibleForTesting
+    void setScrollOffsetForTesting(int scrollOffset) {
+        mScrollOffset = scrollOffset;
+        updateStrip();
+    }
+
+    /**
+     * @return An array containing the StripLayoutTabs.
+     */
+    @VisibleForTesting
+    StripLayoutTab[] getStripLayoutTabs() {
+        return mStripTabs;
+    }
+
+    /**
+     * @return The amount tabs overlap.
+     */
+    @VisibleForTesting
+    float getTabOverlapWidth() {
+        return mTabOverlapWidth;
+    }
 }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/strip/StripLayoutHelperManager.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/strip/StripLayoutHelperManager.java
index cbc6054d..a03e4f8e9 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/strip/StripLayoutHelperManager.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/strip/StripLayoutHelperManager.java
@@ -15,14 +15,16 @@
 import org.chromium.chrome.browser.compositor.layouts.LayoutUpdateHost;
 import org.chromium.chrome.browser.compositor.layouts.components.CompositorButton;
 import org.chromium.chrome.browser.compositor.layouts.components.VirtualView;
-import org.chromium.chrome.browser.compositor.layouts.content.TabContentManager;
 import org.chromium.chrome.browser.compositor.layouts.eventfilter.AreaGestureEventFilter;
 import org.chromium.chrome.browser.compositor.layouts.eventfilter.EventFilter;
 import org.chromium.chrome.browser.compositor.overlays.SceneOverlay;
 import org.chromium.chrome.browser.compositor.scene_layer.SceneOverlayLayer;
 import org.chromium.chrome.browser.compositor.scene_layer.TabStripSceneLayer;
+import org.chromium.chrome.browser.tab.Tab;
 import org.chromium.chrome.browser.tabmodel.TabCreatorManager;
+import org.chromium.chrome.browser.tabmodel.TabModel;
 import org.chromium.chrome.browser.tabmodel.TabModelSelector;
+import org.chromium.ui.base.LocalizationUtils;
 import org.chromium.ui.resources.ResourceManager;
 
 import java.util.List;
@@ -41,15 +43,14 @@
 
     // Model selector buttons constants.
     private static final float MODEL_SELECTOR_BUTTON_Y_OFFSET_DP = 10.f;
-    private static final float MODEL_SELECTOR_BUTTON_RIGHT_PADDING_DP = 6.f;
-    private static final float MODEL_SELECTOR_BUTTON_LEFT_PADDING_DP = 3.f;
+    private static final float MODEL_SELECTOR_BUTTON_END_PADDING_DP = 6.f;
+    private static final float MODEL_SELECTOR_BUTTON_START_PADDING_DP = 3.f;
     private static final float MODEL_SELECTOR_BUTTON_WIDTH_DP = 24.f;
     private static final float MODEL_SELECTOR_BUTTON_HEIGHT_DP = 24.f;
 
     // External influences
     private TabModelSelector mTabModelSelector;
     private final LayoutUpdateHost mUpdateHost;
-    private final LayoutRenderHost mRenderHost;
 
     // Event Filters
     private final AreaGestureEventFilter mEventFilter;
@@ -76,7 +77,6 @@
     public StripLayoutHelperManager(Context context, LayoutUpdateHost updateHost,
             LayoutRenderHost renderHost, AreaGestureEventFilter eventFilter) {
         mUpdateHost = updateHost;
-        mRenderHost = renderHost;
         mTabStripTreeProvider = new TabStripSceneLayer(context);
 
         mEventFilter = eventFilter;
@@ -116,8 +116,12 @@
             ResourceManager resourceManager, float yOffset) {
         assert mTabStripTreeProvider != null;
 
+        Tab selectedTab = mTabModelSelector.getCurrentModel().getTabAt(
+                mTabModelSelector.getCurrentModel().index());
+        int selectedTabId = selectedTab == null ? TabModel.INVALID_TAB_INDEX : selectedTab.getId();
         mTabStripTreeProvider.pushAndUpdateStrip(this, layerTitleCache, resourceManager,
-                getActiveStripLayoutHelper().getStripLayoutTabsToRender(), yOffset);
+                getActiveStripLayoutHelper().getStripLayoutTabsToRender(), yOffset,
+                selectedTabId);
         return mTabStripTreeProvider;
     }
 
@@ -131,8 +135,13 @@
             float width, float height, float visibleViewportOffsetY, int orientation) {
         mWidth = width;
         mOrientation = orientation;
-        mModelSelectorButton.setX(
-                mWidth - MODEL_SELECTOR_BUTTON_WIDTH_DP - MODEL_SELECTOR_BUTTON_RIGHT_PADDING_DP);
+        if (!LocalizationUtils.isLayoutRtl()) {
+            mModelSelectorButton.setX(
+                    mWidth - MODEL_SELECTOR_BUTTON_WIDTH_DP - MODEL_SELECTOR_BUTTON_END_PADDING_DP);
+        } else {
+            mModelSelectorButton.setX(MODEL_SELECTOR_BUTTON_END_PADDING_DP);
+        }
+
         mNormalHelper.onSizeChanged(mWidth, mHeight);
         mIncognitoHelper.onSizeChanged(mWidth, mHeight);
 
@@ -160,6 +169,20 @@
     }
 
     /**
+     * @return The opacity to use for the fade on the left side of the tab strip.
+     */
+    public float getLeftFadeOpacity() {
+        return getActiveStripLayoutHelper().getLeftFadeOpacity();
+    }
+
+    /**
+     * @return The opacity to use for the fade on the right side of the tab strip.
+     */
+    public float getRightFadeOpacity() {
+        return getActiveStripLayoutHelper().getRightFadeOpacity();
+    }
+
+    /**
      * @return The brightness of background tabs in the tabstrip.
      */
     public float getBackgroundTabBrightness() {
@@ -185,16 +208,14 @@
      * represent, and various objects associated with it.
      * @param modelSelector The {@link TabModelSelector} to visually represent.
      * @param tabCreatorManager The {@link TabCreatorManager}, used to create new tabs.
-     * @param tabContentManager The {@link TabContentManager}, used to provide display content for
-     *                          tabs.
      */
     public void setTabModelSelector(TabModelSelector modelSelector,
-            TabCreatorManager tabCreatorManager, TabContentManager tabContentManager) {
+            TabCreatorManager tabCreatorManager) {
         if (mTabModelSelector == modelSelector) return;
         mTabModelSelector = modelSelector;
-        mNormalHelper.setTabModel(mTabModelSelector.getModel(false), tabContentManager,
+        mNormalHelper.setTabModel(mTabModelSelector.getModel(false),
                 tabCreatorManager.getTabCreator(false));
-        mIncognitoHelper.setTabModel(mTabModelSelector.getModel(true), tabContentManager,
+        mIncognitoHelper.setTabModel(mTabModelSelector.getModel(true),
                 tabCreatorManager.getTabCreator(true));
         tabModelSwitched(mTabModelSelector.isIncognitoSelected());
     }
@@ -256,12 +277,13 @@
             boolean isVisible = mTabModelSelector.getModel(true).getCount() != 0;
             mModelSelectorButton.setVisible(isVisible);
 
-            float rightMargin = isVisible
-                    ? MODEL_SELECTOR_BUTTON_WIDTH_DP + MODEL_SELECTOR_BUTTON_RIGHT_PADDING_DP
-                            + MODEL_SELECTOR_BUTTON_LEFT_PADDING_DP
+            float endMargin = isVisible
+                    ? MODEL_SELECTOR_BUTTON_WIDTH_DP + MODEL_SELECTOR_BUTTON_END_PADDING_DP
+                            + MODEL_SELECTOR_BUTTON_START_PADDING_DP
                     : 0.0f;
-            mNormalHelper.setRightMargin(rightMargin);
-            mIncognitoHelper.setRightMargin(rightMargin);
+
+            mNormalHelper.setEndMargin(endMargin);
+            mIncognitoHelper.setEndMargin(endMargin);
         }
     }
 
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/strip/StripStacker.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/strip/StripStacker.java
index 02e24cbe..41968dd 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/strip/StripStacker.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/overlays/strip/StripStacker.java
@@ -5,43 +5,88 @@
 package org.chromium.chrome.browser.compositor.overlays.strip;
 
 import org.chromium.chrome.browser.compositor.layouts.Layout;
+import org.chromium.chrome.browser.util.MathUtils;
 
 /**
  * An interface that defines how to stack tabs and how they should look visually.  This lets
  * certain components customize how the {@link StripLayoutHelper} functions and how other
  * {@link Layout}s visually order tabs.
  */
-public interface StripStacker {
+public abstract class StripStacker {
     /**
      * @return Whether or not the close button can be shown.  Note that even if it can be shown,
      *         it might not be due to how much of the tab is actually visible to preserve proper hit
      *         target sizes.
      */
-    public boolean canShowCloseButton();
-
-    /**
-     * @return Whether or not the title text can slide to the right to stay visible.
-     */
-    public boolean canSlideTitleText();
+    public boolean canShowCloseButton() {
+        return true;
+    }
 
     /**
      * This gives the implementing class a chance to determine how the tabs should be ordered
-     * visually.  The positioning logic is the same regardless, this just has to do with visual
+     * visually. The positioning logic is the same regardless, this just has to do with visual
      * stacking.
      *
      * @param selectedIndex The selected index of the tabs.
      * @param indexOrderedTabs A list of tabs ordered by index.
-     * @param outVisualOrderedTabs The new list of tabs, ordered from back to front visually.
+     * @param outVisualOrderedTabs The new list of tabs, ordered from back (low z-index) to front
+     *                             (high z-index) visually.
      */
     public void createVisualOrdering(int selectedIndex, StripLayoutTab[] indexOrderedTabs,
-            StripLayoutTab[] outVisualOrderedTabs);
+            StripLayoutTab[] outVisualOrderedTabs) {
+        assert indexOrderedTabs.length == outVisualOrderedTabs.length;
+
+        selectedIndex = MathUtils.clamp(selectedIndex, 0, indexOrderedTabs.length);
+
+        int outIndex = 0;
+        for (int i = 0; i < selectedIndex; i++) {
+            outVisualOrderedTabs[outIndex++] = indexOrderedTabs[i];
+        }
+
+        for (int i = indexOrderedTabs.length - 1; i >= selectedIndex; --i) {
+            outVisualOrderedTabs[outIndex++] = indexOrderedTabs[i];
+        }
+    }
 
     /**
-     * Performs an occlusion pass, setting the visibility on tabs depending on whether or not they
-     * overlap each other perfectly.  This is relegated to this interface because the implementing
-     * class knows the proper visual order to optimize this pass.
+     * Computes and sets the draw X, draw Y, visibility and content offset for each tab.
+     *
      * @param selectedIndex The selected index of the tabs.
      * @param indexOrderedTabs A list of tabs ordered by index.
+     * @param tabStackWidth The width of a tab when it's stacked behind another tab.
+     * @param maxTabsToStack The maximum number of tabs to stack.
+     * @param tabOverlapWidth The amount tabs overlap.
+     * @param stripLeftMargin The left margin of the tab strip.
+     * @param stripRightMargin The right margin of the tab strip.
+     * @param stripWidth The width of the tab strip.
+     * @param inReorderMode Whether the strip is in reorder mode.
      */
-    public void performOcclusionPass(int selectedIndex, StripLayoutTab[] indexOrderedTabs);
+    public abstract void setTabOffsets(int selectedIndex, StripLayoutTab[] indexOrderedTabs,
+            float tabStackWidth, int maxTabsToStack, float tabOverlapWidth, float stripLeftMargin,
+            float stripRightMargin, float stripWidth, boolean inReorderMode);
+
+    /**
+     * Computes the X offset for the new tab button.
+     *
+     * @param indexOrderedTabs A list of tabs ordered by index.
+     * @param tabOverlapWidth The amount tabs overlap.
+     * @param stripLeftMargin The left margin of the tab strip.
+     * @param stripRightMargin The right margin of the tab strip.
+     * @param stripWidth The width of the tab strip.
+     * @param mNewTabButtonWidth The width of the new tab button.
+     * @return The x offset for the new tab button.
+     */
+    public abstract float computeNewTabButtonOffset(StripLayoutTab[] indexOrderedTabs,
+            float tabOverlapWidth, float stripLeftMargin, float stripRightMargin, float stripWidth,
+            float mNewTabButtonWidth);
+
+    /**
+     * Performs an occlusion pass, setting the visibility on tabs. This is relegated to this
+     * interface because the implementing class knows the proper visual order to optimize this pass.
+     * @param selectedIndex The selected index of the tabs.
+     * @param indexOrderedTabs A list of tabs ordered by index.
+     * @param stripWidth The width of the tab strip.
+     */
+    public abstract void performOcclusionPass(int selectedIndex, StripLayoutTab[] indexOrderedTabs,
+            float stripWidth);
 }
\ No newline at end of file
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/scene_layer/TabStripSceneLayer.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/scene_layer/TabStripSceneLayer.java
index 4153ba6..4805e98 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/scene_layer/TabStripSceneLayer.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/scene_layer/TabStripSceneLayer.java
@@ -8,10 +8,12 @@
 import android.os.Build;
 
 import org.chromium.base.annotations.JNINamespace;
+import org.chromium.chrome.R;
 import org.chromium.chrome.browser.compositor.LayerTitleCache;
 import org.chromium.chrome.browser.compositor.layouts.components.CompositorButton;
 import org.chromium.chrome.browser.compositor.overlays.strip.StripLayoutHelperManager;
 import org.chromium.chrome.browser.compositor.overlays.strip.StripLayoutTab;
+import org.chromium.ui.base.LocalizationUtils;
 import org.chromium.ui.resources.ResourceManager;
 
 /**
@@ -58,7 +60,7 @@
      */
     public void pushAndUpdateStrip(StripLayoutHelperManager layoutHelper,
             LayerTitleCache layerTitleCache, ResourceManager resourceManager,
-            StripLayoutTab[] stripLayoutTabsToRender, float yOffset) {
+            StripLayoutTab[] stripLayoutTabsToRender, float yOffset, int selectedTabId) {
         if (mNativePtr == 0) return;
 
         final boolean visible = yOffset > -layoutHelper.getHeight();
@@ -67,7 +69,8 @@
         // When strip tabs are completely off screen, we don't need to update it.
         if (visible) {
             pushButtonsAndBackground(layoutHelper, resourceManager, yOffset);
-            pushStripTabs(layoutHelper, layerTitleCache, resourceManager, stripLayoutTabsToRender);
+            pushStripTabs(layoutHelper, layerTitleCache, resourceManager, stripLayoutTabsToRender,
+                    selectedTabId);
         }
         nativeFinishBuildingFrame(mNativePtr);
     }
@@ -108,17 +111,29 @@
                 modelSelectorButton.getX() * mDpToPx, modelSelectorButton.getY() * mDpToPx,
                 modelSelectorButton.getWidth() * mDpToPx, modelSelectorButton.getHeight() * mDpToPx,
                 modelSelectorButton.isIncognito(), modelSelectorButtonVisible, resourceManager);
+
+        int leftFadeDrawable = modelSelectorButtonVisible && LocalizationUtils.isLayoutRtl()
+                ? R.drawable.tab_strip_fade_for_model_selector : R.drawable.tab_strip_fade;
+        int rightFadeDrawable = modelSelectorButtonVisible && !LocalizationUtils.isLayoutRtl()
+                ? R.drawable.tab_strip_fade_for_model_selector : R.drawable.tab_strip_fade;
+
+        nativeUpdateTabStripLeftFade(mNativePtr, leftFadeDrawable,
+                layoutHelper.getLeftFadeOpacity(), resourceManager);
+
+        nativeUpdateTabStripRightFade(mNativePtr, rightFadeDrawable,
+                layoutHelper.getRightFadeOpacity(), resourceManager);
     }
 
     private void pushStripTabs(StripLayoutHelperManager layoutHelper,
             LayerTitleCache layerTitleCache, ResourceManager resourceManager,
-            StripLayoutTab[] stripTabs) {
+            StripLayoutTab[] stripTabs, int selectedTabId) {
         final int tabsCount = stripTabs != null ? stripTabs.length : 0;
 
         for (int i = 0; i < tabsCount; i++) {
             final StripLayoutTab st = stripTabs[i];
+            boolean isSelected = st.getId() == selectedTabId;
             nativePutStripTabLayer(mNativePtr, st.getId(), st.getCloseButton().getResourceId(),
-                    st.getResourceId(i == tabsCount - 1), i == tabsCount - 1, st.getClosePressed(),
+                    st.getResourceId(isSelected), isSelected, st.getClosePressed(),
                     layoutHelper.getWidth() * mDpToPx, st.getDrawX() * mDpToPx,
                     st.getDrawY() * mDpToPx, st.getWidth() * mDpToPx, st.getHeight() * mDpToPx,
                     st.getContentOffsetX() * mDpToPx, st.getCloseButton().getOpacity(),
@@ -145,6 +160,10 @@
     private native void nativeUpdateModelSelectorButton(long nativeTabStripSceneLayer,
             int resourceId, float x, float y, float width, float height, boolean incognito,
             boolean visible, ResourceManager resourceManager);
+    private native void nativeUpdateTabStripLeftFade(long nativeTabStripSceneLayer,
+            int resourceId, float opacity, ResourceManager resourceManager);
+    private native void nativeUpdateTabStripRightFade(long nativeTabStripSceneLayer,
+            int resourceId, float opacity, ResourceManager resourceManager);
     private native void nativePutStripTabLayer(long nativeTabStripSceneLayer, int id,
             int closeResourceId, int handleResourceId, boolean foreground, boolean closePressed,
             float toolbarWidth, float x, float y, float width, float height, float contentOffsetX,
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarContainerLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarContainerLayout.java
index 40adf4b..122aa47 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarContainerLayout.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarContainerLayout.java
@@ -706,6 +706,7 @@
     }
 
     @Override
+    @SuppressLint("ClickableViewAccessibility")
     public boolean onTouchEvent(MotionEvent event) {
         super.onTouchEvent(event);
         // Consume all touch events so they do not reach the ContentView.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/multiwindow/MultiWindowUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/multiwindow/MultiWindowUtils.java
index ca885a2..b215255 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/multiwindow/MultiWindowUtils.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/multiwindow/MultiWindowUtils.java
@@ -27,6 +27,10 @@
  */
 public class MultiWindowUtils {
 
+    // TODO(twellington): replace this with Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT once we're building
+    //                    against N.
+    public static final int FLAG_ACTIVITY_LAUNCH_ADJACENT = 0x00001000;
+
     private static AtomicReference<MultiWindowUtils> sInstance =
             new AtomicReference<MultiWindowUtils>();
 
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/IncognitoNewTabPageView.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/IncognitoNewTabPageView.java
index 25099d1..0be417bd 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/IncognitoNewTabPageView.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/IncognitoNewTabPageView.java
@@ -95,10 +95,9 @@
         mSnapshotScrollY = mScrollView.getScrollY();
     }
 
-    // OnAttachStateChangeListener overrides
-
     @Override
     public void onAttachedToWindow() {
+        super.onAttachedToWindow();
         assert mManager != null;
         if (mFirstShow) {
             mManager.onLoadingComplete();
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageScrollView.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageScrollView.java
index b3fae9b..fe3e978c 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageScrollView.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageScrollView.java
@@ -4,6 +4,7 @@
 
 package org.chromium.chrome.browser.ntp;
 
+import android.annotation.SuppressLint;
 import android.content.Context;
 import android.graphics.Canvas;
 import android.os.Build;
@@ -98,6 +99,7 @@
     }
 
     @Override
+    @SuppressLint("ClickableViewAccessibility")
     public boolean onTouchEvent(MotionEvent ev) {
         // Action down would already have been handled in onInterceptTouchEvent
         if (ev.getActionMasked() != MotionEvent.ACTION_DOWN) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageToolbar.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageToolbar.java
index 97eda057..43a48a5 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageToolbar.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageToolbar.java
@@ -45,6 +45,7 @@
 
     @Override
     protected void onFinishInflate() {
+        super.onFinishInflate();
         mBookmarksButton = initButton(R.id.bookmarks_button, R.drawable.btn_star);
         mRecentTabsButton = initButton(R.id.recent_tabs_button, R.drawable.btn_recents);
         ((TextView) mBookmarksButton.getChildAt(0))
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/TrailingTextView.java b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/TrailingTextView.java
index 1e20894..a3ea666 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/TrailingTextView.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/TrailingTextView.java
@@ -4,6 +4,7 @@
 
 package org.chromium.chrome.browser.omnibox;
 
+import android.annotation.SuppressLint;
 import android.content.Context;
 import android.support.v7.widget.AppCompatTextView;
 import android.util.AttributeSet;
@@ -29,14 +30,20 @@
     }
 
     @Override
+    @SuppressLint("MissingSuperCall")
     public void onPopulateAccessibilityEvent(AccessibilityEvent event) {
+        // Intentionally empty so this view is ignored by accessibility.
     }
 
     @Override
+    @SuppressLint("MissingSuperCall")
     public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
+        // Intentionally empty so this view is ignored by accessibility.
     }
 
     @Override
+    @SuppressLint("MissingSuperCall")
     public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
+        // Intentionally empty so this view is ignored by accessibility.
     }
 }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlManager.java b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlManager.java
index baba423..a71d7d8 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlManager.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlManager.java
@@ -269,7 +269,7 @@
             protected Void doInBackground(Void... params) {
                 SharedPreferences oldPrefs =
                         mContext.getSharedPreferences(DEPRECATED_PREFS_NAME, Context.MODE_PRIVATE);
-                oldPrefs.edit().clear().commit();
+                oldPrefs.edit().clear().apply();
                 return null;
             }
         }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferences.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferences.java
index 1388505..cead708 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferences.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferences.java
@@ -128,7 +128,8 @@
     public static final String TAG = "ClearBrowsingDataPreferences";
 
     /** The my activity URL. */
-    private static final String URL_MY_ACTIVITY = "https://history.google.com";
+    private static final String URL_MY_ACTIVITY =
+            "https://history.google.com/history/?utm_source=chrome_cbd";
 
     /**
      * The various data types that can be cleared via this screen.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelImpl.java
index 798b2770..ba7bc66 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelImpl.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelImpl.java
@@ -86,7 +86,8 @@
     @Override
     public void removeTab(Tab tab) {
         for (TabModelObserver obs : mObservers) obs.tabRemoved(tab);
-        mTabs.remove(tab);
+
+        removeTabAndSelectNext(tab, TabSelectionType.FROM_USER, true, true);
     }
 
     @Override
@@ -514,22 +515,34 @@
      *                called to actually delete and clean up {@code tab}.
      */
     private void startTabClosure(Tab tab, boolean animate, boolean uponExit, boolean canUndo) {
-        final int closingTabId = tab.getId();
-        final int closingTabIndex = indexOf(tab);
-
         tab.setClosing(true);
 
         for (TabModelObserver obs : mObservers) obs.willCloseTab(tab, animate);
 
+        TabSelectionType selectionType =
+                uponExit ? TabSelectionType.FROM_EXIT : TabSelectionType.FROM_CLOSE;
+        boolean pauseMedia = canUndo;
+        boolean updateRewoundList = !canUndo;
+        removeTabAndSelectNext(tab, selectionType, pauseMedia, updateRewoundList);
+    }
+
+    /**
+     * Removes the given tab from the tab model and selects a new tab.
+     */
+    private void removeTabAndSelectNext(Tab tab, TabSelectionType selectionType, boolean pauseMedia,
+            boolean updateRewoundList) {
+        final int closingTabId = tab.getId();
+        final int closingTabIndex = indexOf(tab);
+
         Tab currentTab = TabModelUtils.getCurrentTab(this);
         Tab adjacentTab = getTabAt(closingTabIndex == 0 ? 1 : closingTabIndex - 1);
         Tab nextTab = getNextTabIfClosed(closingTabId);
 
         // TODO(dtrainor): Update the list of undoable tabs instead of committing it.
-        if (!canUndo) commitAllTabClosures();
+        if (updateRewoundList) commitAllTabClosures();
 
         // Cancel or mute any media currently playing.
-        if (canUndo) {
+        if (pauseMedia) {
             WebContents webContents = tab.getWebContents();
             if (webContents != null) {
                 webContents.suspendAllMediaPlayers();
@@ -548,13 +561,12 @@
             if (nextIsIncognito != isIncognito()) mIndex = indexOf(adjacentTab);
 
             TabModel nextModel = mModelDelegate.getModel(nextIsIncognito);
-            nextModel.setIndex(nextTabIndex,
-                    uponExit ? TabSelectionType.FROM_EXIT : TabSelectionType.FROM_CLOSE);
+            nextModel.setIndex(nextTabIndex, selectionType);
         } else {
             mIndex = nextTabIndex;
         }
 
-        if (!canUndo) mRewoundList.resetRewoundState();
+        if (updateRewoundList) mRewoundList.resetRewoundState();
     }
 
     /**
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabReparentingParams.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabReparentingParams.java
index 389ca6c4..f046eb4 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabReparentingParams.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabReparentingParams.java
@@ -57,7 +57,7 @@
      * Carry out any remaining finalization to be done after the tab is reparented.
      */
     public void finalizeTabReparenting() {
-        mFinalizeCallback.run();
+        if (mFinalizeCallback != null) mFinalizeCallback.run();
     }
 
     @Override
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/document/TabDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/document/TabDelegate.java
index 0291259..f0622969 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/document/TabDelegate.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/document/TabDelegate.java
@@ -103,10 +103,7 @@
         if (targetActivity == null) return;
         intent.setClass(activity, targetActivity);
 
-        // TODO(newt): use Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT once we're building against N.
-        final int flagActivityLaunchAdjacent = 0x00001000;
-        intent.addFlags(flagActivityLaunchAdjacent);
-
+        intent.addFlags(MultiWindowUtils.FLAG_ACTIVITY_LAUNCH_ADJACENT);
         IntentHandler.addTrustedIntentExtras(intent, activity);
         activity.startActivity(intent);
     }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/widget/findinpage/FindToolbar.java b/chrome/android/java/src/org/chromium/chrome/browser/widget/findinpage/FindToolbar.java
index 4ce6acac..932f598 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/widget/findinpage/FindToolbar.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/widget/findinpage/FindToolbar.java
@@ -204,6 +204,8 @@
 
     @Override
     public void onFinishInflate() {
+        super.onFinishInflate();
+
         setOrientation(HORIZONTAL);
         setGravity(Gravity.CENTER_VERTICAL);
 
diff --git a/chrome/android/java/strings/android_chrome_strings.grd b/chrome/android/java/strings/android_chrome_strings.grd
index c84bddaae..047b7c7 100644
--- a/chrome/android/java/strings/android_chrome_strings.grd
+++ b/chrome/android/java/strings/android_chrome_strings.grd
@@ -1851,6 +1851,9 @@
       <message name="IDS_MENU_UPDATE_SUMMARY_NEW_FEATURES" desc="Summary string for update menu item explaining that new features are available. [CHAR-LIMIT=30]">
         Get the latest features
       </message>
+      <message name="IDS_MENU_MOVE_TO_OTHER_WINDOW" desc="Menu item for moving the current tab into the other window. [CHAR-LIMIT=27]">
+        Move to other window
+      </message>
       <message name="IDS_MENU_NEW_TAB" desc="Menu item for opening a new tab. [CHAR-LIMIT=27]">
         New tab
       </message>
diff --git a/chrome/android/java_sources.gni b/chrome/android/java_sources.gni
index 9fb4d5d..b822423 100644
--- a/chrome/android/java_sources.gni
+++ b/chrome/android/java_sources.gni
@@ -198,7 +198,8 @@
   "java/src/org/chromium/chrome/browser/compositor/layouts/phone/stack/StackTab.java",
   "java/src/org/chromium/chrome/browser/compositor/layouts/phone/stack/StackViewAnimation.java",
   "java/src/org/chromium/chrome/browser/compositor/overlays/SceneOverlay.java",
-  "java/src/org/chromium/chrome/browser/compositor/overlays/strip/StaticStripStacker.java",
+  "java/src/org/chromium/chrome/browser/compositor/overlays/strip/CascadingStripStacker.java",
+  "java/src/org/chromium/chrome/browser/compositor/overlays/strip/ScrollingStripStacker.java",
   "java/src/org/chromium/chrome/browser/compositor/overlays/strip/StripLayoutHelper.java",
   "java/src/org/chromium/chrome/browser/compositor/overlays/strip/StripLayoutHelperManager.java",
   "java/src/org/chromium/chrome/browser/compositor/overlays/strip/StripLayoutTab.java",
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/compositor/overlays/strip/TabStripTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/compositor/overlays/strip/TabStripTest.java
index 3d060ec9..eb60b9b 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/compositor/overlays/strip/TabStripTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/compositor/overlays/strip/TabStripTest.java
@@ -22,6 +22,7 @@
 import org.chromium.chrome.test.util.ChromeTabUtils;
 import org.chromium.chrome.test.util.TabStripUtils;
 import org.chromium.content.browser.test.util.CallbackHelper;
+import org.chromium.ui.base.LocalizationUtils;
 
 import java.util.concurrent.TimeoutException;
 
@@ -466,6 +467,224 @@
     }
 
     /**
+     * Compares tab strips with models after switching between the ScrollingStripStacker and
+     * CascadingStripStacker when an incognito tab is present. Also tests tapping the incognito
+     * button while the strip is using the ScrollingStripStacker (other tests cover tapping
+     * the button while using the CascadingStripStacker).
+     */
+    @LargeTest
+    @Restriction(ChromeRestriction.RESTRICTION_TYPE_TABLET)
+    @Feature({"TabStrip"})
+    public void testSwitchStripStackersWithIncognito() throws InterruptedException {
+        // Open an incognito tab.
+        newIncognitoTabFromMenu();
+
+        // Switch to the ScrollingStripStacker.
+        setShouldCascadeTabsAndCheckTabStrips(false);
+
+        // Switch tab models.
+        clickIncognitoToggleButton();
+
+        // Switch to the CascadingStripStacker.
+        setShouldCascadeTabsAndCheckTabStrips(true);
+    }
+
+    /**
+     * Compares tab strip with model after switching between the ScrollingStripStacker and
+     * CascadingStripStacker when the last tab is selected. This also verifies that the strip
+     * scrolls correctly and the correct index is selected after switching.
+     */
+    @LargeTest
+    @Restriction(ChromeRestriction.RESTRICTION_TYPE_TABLET)
+    @Feature({"TabStrip"})
+    public void testSwitchStripStackersWithLastTabSelected() throws InterruptedException {
+        // Open enough regular tabs to cause the tabs to cascade or the strip to scroll depending
+        // on which stacker is being used.
+        ChromeTabUtils.newTabsFromMenu(getInstrumentation(), getActivity(), 10);
+
+        // Switch to the ScrollingStripStacker.
+        setShouldCascadeTabsAndCheckTabStrips(false);
+
+        // Switch to the CascadingStripStacker.
+        setShouldCascadeTabsAndCheckTabStrips(true);
+    }
+
+    /**
+     * Compares tab strip with model after switching between the ScrollingStripStacker and
+     * CascadingStripStacker when the first tab is selected. This also verifies that the strip
+     * scrolls correctly and the correct index is selected after switching.
+     */
+    @LargeTest
+    @Restriction(ChromeRestriction.RESTRICTION_TYPE_TABLET)
+    @Feature({"TabStrip"})
+    public void testSwitchStripStackersWithFirstTabSelected() throws InterruptedException {
+        // Open enough regular tabs to cause the tabs to cascade or the strip to scroll depending
+        // on which stacker is being used.
+        ChromeTabUtils.newTabsFromMenu(getInstrumentation(), getActivity(), 10);
+
+        // Select the first tab by setting the index directly. It may not be visible, so don't
+        // try to tap on it.
+        ChromeTabUtils.switchTabInCurrentTabModel(getActivity(), 0);
+
+        // Switch to the ScrollingStripStacker.
+        setShouldCascadeTabsAndCheckTabStrips(false);
+
+        // Scroll so the first tab is off screen to verify that switching to the
+        // CascadingStripStacker makes it visible again. The selected tab should always be visible
+        // when using the CascadingStripStacker but may not be visible when using the
+        // ScrollingStripStacker.
+        assertSetTabStripScrollOffset((int) TabStripUtils.getActiveStripLayoutHelper(
+                getActivity()).getMinimumScrollOffset());
+        StripLayoutTab selectedLayoutTab = TabStripUtils.findStripLayoutTab(
+                getActivity(), false, getActivity().getCurrentTabModel().getTabAt(0).getId());
+        assertTabVisibility(false, selectedLayoutTab);
+
+        // Switch to the CascadingStripStacker.
+        setShouldCascadeTabsAndCheckTabStrips(true);
+    }
+
+    /**
+     * Compares tab strip with model after switching between the ScrollingStripStacker and
+     * CascadingStripStacker when a middle tab is selected. This also verifies that the strip
+     * scrolls correctly and the correct index is selected after switching.
+     */
+    @LargeTest
+    @Restriction(ChromeRestriction.RESTRICTION_TYPE_TABLET)
+    @Feature({"TabStrip"})
+    public void testSwitchStripStackersWithMiddleTabSelected() throws InterruptedException {
+        // Open enough regular tabs to cause the tabs to cascade or the strip to scroll depending
+        // on which stacker is being used.
+        ChromeTabUtils.newTabsFromMenu(getInstrumentation(), getActivity(), 10);
+
+        // Select the sixth tab by setting the index directly. It may not be visible, so don't
+        // try to tap on it.
+        ChromeTabUtils.switchTabInCurrentTabModel(getActivity(), 5);
+
+        // Switch to the ScrollingStripStacker.
+        setShouldCascadeTabsAndCheckTabStrips(false);
+
+        // Switch to the CascadingStripStacker.
+        setShouldCascadeTabsAndCheckTabStrips(true);
+    }
+
+    /**
+     * Test that the right and left tab strip fades are fully visible, partially visible or
+     * hidden at various scroll positions.
+     * TODO(twellington): Also test these expectations in RTL.
+     */
+    @LargeTest
+    @Restriction(ChromeRestriction.RESTRICTION_TYPE_TABLET)
+    @Feature({"TabStrip"})
+    public void testScrollingStripStackerFadeOpacity() throws InterruptedException {
+        // Switch to the ScrollingStripStacker.
+        setShouldCascadeTabsAndCheckTabStrips(false);
+
+        // Open enough regular tabs to cause the strip to scroll.
+        ChromeTabUtils.newTabsFromMenu(getInstrumentation(), getActivity(), 10);
+
+        // In RTL the expectation for left/right fade opacities is swapped.
+        boolean isLeft = !LocalizationUtils.isLayoutRtl();
+
+        // Initially the right fade (in LTR) should be hidden and the left fade should be visible.
+        assertTabStripFadeFullyHidden(!isLeft);
+        assertTabStripFadeFullyVisible(isLeft);
+
+        // Scroll a little below the minimum scroll offset causing the right fade (in LTR) to be
+        // at partial opacity.
+        assertSetTabStripScrollOffset((int) (TabStripUtils.getActiveStripLayoutHelper(
+                getActivity()).getMinimumScrollOffset()
+                + StripLayoutHelper.FADE_FULL_OPACITY_THRESHOLD_DP / 2));
+        assertTabStripFadePartiallyVisible(!isLeft);
+        assertTabStripFadeFullyVisible(isLeft);
+
+        // Scroll a little above 0 causing the left fade (in LTR) to be at partial opacity.
+        assertSetTabStripScrollOffset(
+                (int) (0 - StripLayoutHelper.FADE_FULL_OPACITY_THRESHOLD_DP / 2));
+        assertTabStripFadeFullyVisible(!isLeft);
+        assertTabStripFadePartiallyVisible(isLeft);
+
+        // Scroll to 0 causing the left fade (in LTR) to be hidden.
+        assertSetTabStripScrollOffset(0);
+        assertTabStripFadeFullyHidden(isLeft);
+        assertTabStripFadeFullyVisible(!isLeft);
+    }
+
+    /**
+     * Test that selecting a tab that isn't currently visible causes the ScrollingStripStacker
+     * to scroll to make it visible.
+     */
+    @LargeTest
+    @Restriction(ChromeRestriction.RESTRICTION_TYPE_TABLET)
+    @Feature({"TabStrip"})
+    public void testScrollingStripStackerScrollsToSelectedTab() throws InterruptedException {
+        // Switch to the ScrollingStripStacker.
+        setShouldCascadeTabsAndCheckTabStrips(false);
+
+        // Open enough regular tabs to cause the strip to scroll.
+        ChromeTabUtils.newTabsFromMenu(getInstrumentation(), getActivity(), 10);
+
+        // Get tab at index 0 and assert it is not visible.
+        TabModel model = getActivity().getTabModelSelector().getModel(false);
+        StripLayoutTab tab = TabStripUtils.findStripLayoutTab(getActivity(), false,
+                model.getTabAt(0).getId());
+        assertTabVisibility(false, tab);
+
+        // Select tab 0.
+        ChromeTabUtils.switchTabInCurrentTabModel(getActivity(), 0);
+        getInstrumentation().waitForIdleSync();
+
+        // Tab should now be visible.
+        assertTabVisibility(true, tab);
+    }
+
+    /**
+     * Test that the draw positions for tabs match expectations at various scroll positions
+     * when using the ScrollingStripStacker.
+     */
+    @LargeTest
+    @Restriction(ChromeRestriction.RESTRICTION_TYPE_TABLET)
+    @Feature({"TabStrip"})
+    public void testScrollingStripStackerTabOffsets() throws InterruptedException {
+        // Switch to the ScrollingStripStacker.
+        setShouldCascadeTabsAndCheckTabStrips(false);
+
+        // Open enough regular tabs to cause the strip to scroll and select the first tab.
+        ChromeTabUtils.newTabsFromMenu(getInstrumentation(), getActivity(), 10);
+        ChromeTabUtils.switchTabInCurrentTabModel(getActivity(), 0);
+        getInstrumentation().waitForIdleSync();
+
+        // Check initial model validity.
+        compareAllTabStripsWithModel();
+
+        // Set up some variables.
+        StripLayoutHelper strip = TabStripUtils.getActiveStripLayoutHelper(getActivity());
+        StripLayoutTab[] tabs = strip.getStripLayoutTabs();
+        float tabDrawWidth = tabs[0].getWidth() - strip.getTabOverlapWidth();
+
+        // Assert getStripLayoutTabs() returns the expected number of tabs.
+        assertEquals("Unexpected number of StripLayoutTabs.", 11, tabs.length);
+
+        // Scroll tab strip to 0 and check tab positions.
+        assertSetTabStripScrollOffset(0);
+        for (int i = 0; i < tabs.length; i++) {
+            assertTabDrawX(i * tabDrawWidth, tabs[i]);
+        }
+
+        // Scroll tab strip a little and check tab draw positions.
+        assertSetTabStripScrollOffset(-25);
+        for (int i = 0; i < tabs.length; i++) {
+            assertTabDrawX(i * tabDrawWidth - 25.f, tabs[i]);
+        }
+
+        // Scroll tab strip a lot and check tab draw positions.
+        assertSetTabStripScrollOffset(-500);
+        for (int i = 0; i < tabs.length; i++) {
+            assertTabDrawX(i * tabDrawWidth - 500.f, tabs[i]);
+        }
+        assertTabVisibility(false, tabs[0]);
+    }
+
+    /**
      * Take a model index and figure out which index it will be in the TabStrip's view hierarchy.
      * @param tabCount The number of tabs.
      * @param selectedIndex The index of the selected tab.
@@ -584,15 +803,22 @@
                 && getActivity().getTabModelSelector().isIncognitoSelected() == incognito) {
             assertTrue("ChromeTab is not in the proper selection state",
                     tabStrip.isForegroundTab(tabView));
-            assertEquals("ChromeTab is not completely visible, but is selected",
-                    tabView.getVisiblePercentage(), 1.0f);
+            if (tabStrip.shouldCascadeTabs()) {
+                assertEquals("ChromeTab is not completely visible, but is selected. The selected "
+                        + "tab should be visible when the CascadingStripStacker is in use.",
+                        tabView.getVisiblePercentage(), 1.0f);
+            }
+        }
+
+        if (!tabStrip.shouldCascadeTabs()) {
+            assertTabVisibilityForScrollingStripStacker(tabStrip, tabView);
         }
 
         // TODO(dtrainor): Compare favicon bitmaps?  Only compare a few pixels.
     }
 
     /**
-     * Compares an entire TabStrip with the corresponding TabModel.  This tries to compare
+     * Compares an entire TabStrip with the corresponding TabModel. This tries to compare
      * as many features as possible, including checking all of the tabs through
      * compareTabViewWithModel.  It also checks that the incognito indicator is visible if the
      * incognito tab is showing.
@@ -636,4 +862,150 @@
         compareTabStripWithModel(true);
         compareTabStripWithModel(false);
     }
+
+    /**
+     * Sets whether the strip should cascade tabs and checks for validity.
+     *
+     * @param shouldCascadeTabs Whether the {@link CascadingStripStacker} should be used. If false,
+     *                          the {@link ScrollingStripStacker} will be used instead.
+     */
+    private void setShouldCascadeTabsAndCheckTabStrips(final boolean shouldCascadeTabs) {
+        TabModel model = getActivity().getCurrentTabModel();
+        int selectedTabIndex = model.index();
+
+        ThreadUtils.runOnUiThreadBlocking(new Runnable() {
+            @Override
+            public void run() {
+                TabStripUtils.getStripLayoutHelper(getActivity(), true).setShouldCascadeTabs(
+                        shouldCascadeTabs);
+                TabStripUtils.getStripLayoutHelper(getActivity(), false).setShouldCascadeTabs(
+                        shouldCascadeTabs);
+            }
+        });
+
+        // Assert that the correct StripStacker is being used.
+        assertEquals(shouldCascadeTabs
+                ? "Expected CascadingStripStacker but was ScrollingStripStacker."
+                        : "Expected ScrollingStripStacker but was CascadingStripStacker.",
+                shouldCascadeTabs,
+                TabStripUtils.getActiveStripLayoutHelper(getActivity()).shouldCascadeTabs());
+
+        // Assert that the same tab is still selected.
+        assertEquals("The correct tab is not selected.", selectedTabIndex, model.index());
+
+        // Compare all TabStrips with corresponding TabModels.
+        compareAllTabStripsWithModel();
+
+        // The selected tab should always be visible in the CascadingStripStacker and switching to
+        // the ScrollingStripStacker should auto-scroll to make the selected tab visible.
+        StripLayoutTab selectedLayoutTab = TabStripUtils.findStripLayoutTab(
+                getActivity(), model.isIncognito(), model.getTabAt(selectedTabIndex).getId());
+        assertTabVisibility(true, selectedLayoutTab);
+    }
+
+    /**
+     * Scrolls the tab strip to the desired position and checks for validity.
+     *
+     * @param scrollOffset The end scroll position for the tab strip.
+     */
+    private void assertSetTabStripScrollOffset(final int scrollOffset) {
+        final StripLayoutHelper strip = TabStripUtils.getActiveStripLayoutHelper(getActivity());
+        ThreadUtils.runOnUiThreadBlocking(new Runnable() {
+            @Override
+            public void run() {
+                strip.setScrollOffsetForTesting(scrollOffset);
+            }
+        });
+
+        assertEquals("Tab strip scroll incorrect.", scrollOffset, strip.getScrollOffset());
+        compareAllTabStripsWithModel();
+    }
+
+    /**
+     * Asserts that the left or right fade is fully hidden.
+     * @param isLeft Whether the left fade should be checked.
+     */
+    private void assertTabStripFadeFullyHidden(boolean isLeft) {
+        StripLayoutHelper strip = TabStripUtils.getActiveStripLayoutHelper(getActivity());
+        if (isLeft) {
+            assertEquals("Left tab strip fade visibility is incorrect.", 0.f,
+                    strip.getLeftFadeOpacity());
+        } else {
+            assertEquals("Right tab strip fade visibility is incorrect.", 0.f,
+                    strip.getRightFadeOpacity());
+        }
+    }
+
+    /**
+     * Asserts that the left or right fade is fully visible.
+     * @param isLeft Whether the left fade should be checked.
+     */
+    private void assertTabStripFadeFullyVisible(boolean isLeft) {
+        StripLayoutHelper strip = TabStripUtils.getActiveStripLayoutHelper(getActivity());
+        if (isLeft) {
+            assertEquals("Left tab strip fade visibility is incorrect.", 1.f,
+                    strip.getLeftFadeOpacity());
+        } else {
+            assertEquals("Right tab strip fade visibility is incorrect.", 1.f,
+                    strip.getRightFadeOpacity());
+        }
+    }
+
+    /**
+     * Asserts that the left or right fade is partially visible.
+     * @param isLeft Whether the left fade should be checked.
+     */
+    private void assertTabStripFadePartiallyVisible(boolean isLeft) {
+        StripLayoutHelper strip = TabStripUtils.getActiveStripLayoutHelper(getActivity());
+        if (isLeft) {
+            boolean isPartiallyVisible = strip.getLeftFadeOpacity() > 0.f
+                    && strip.getLeftFadeOpacity() < 1.f;
+            assertEquals("Left tab strip fade expected to be partially visible.", true,
+                    isPartiallyVisible);
+        } else {
+            boolean isPartiallyVisible = strip.getRightFadeOpacity() > 0.f
+                    && strip.getRightFadeOpacity() < 1.f;
+            assertEquals("Right tab strip fade expected to be partially visible.", true,
+                    isPartiallyVisible);
+        }
+    }
+
+    /**
+     * Checks visible percentage and visibility for the given tab. Should only be called when the
+     * ScrollingStripStacker is in use.
+     *
+     * @param tabStrip The StripLayoutHelper that owns the tab.
+     * @param tabView The StripLayoutTab associated with the tab to check.
+     */
+    private void assertTabVisibilityForScrollingStripStacker(StripLayoutHelper tabStrip,
+            StripLayoutTab tabView) {
+        // The visible percent for all tabs is 1.0 in the ScrollingStripStacker.
+        assertEquals("ChromeTab is not completely visible. All tabs should be visible when "
+                + "the ScrollingStripStacker is in use.",
+                tabView.getVisiblePercentage(), 1.0f);
+
+        // Only tabs that can currently be seen on the screen should be visible.
+        boolean shouldBeVisible = (tabView.getDrawX() + tabView.getWidth()) >= 0
+                && tabView.getDrawX() <= tabStrip.getWidth();
+        assertTabVisibility(shouldBeVisible, tabView);
+    }
+
+    /**
+     * Asserts whether a tab should be visible.
+     * @param shouldBeVisible Whether the tab should be visible.
+     * @param tabView The StripLayoutTab associated with the tab to check.
+     */
+    private void assertTabVisibility(boolean shouldBeVisible, StripLayoutTab tabView) {
+        assertEquals("ChromeTab " + (shouldBeVisible ? "should" : "should not") + " be visible.",
+                shouldBeVisible, tabView.isVisible());
+    }
+
+    /**
+     * Asserts that the tab has the expected draw X position.
+     * @param expectedDrawX The expected draw X position.
+     * @param tabView The StripLayoutTab associated with the tab to check.
+     */
+    private void assertTabDrawX(float expectedDrawX, StripLayoutTab tabView) {
+        assertEquals("Incorrect draw position for tab.", expectedDrawX, tabView.getDrawX());
+    }
 }
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index ab15b94..c34bf157 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -5684,6 +5684,12 @@
         <message name="IDS_FLAGS_ENABLE_SYSTEM_DOWNLOAD_MANAGER_DESCRIPTION" desc="Description for the flag to use system download manager.">
           Allow downloads to be handled by the system download manager when applicable.
         </message>
+        <message name="IDS_FLAGS_MEDIA_DOCUMENT_DOWNLOAD_BUTTON_NAME" desc="Title for the flag to enable the download button on MediaDocument.">
+          Download button when opening a page with media url.
+        </message>
+        <message name="IDS_FLAGS_MEDIA_DOCUMENT_DOWNLOAD_BUTTON_DESCRIPTION" desc="Description for the flag to enable download button on MediaDocument.">
+          Allow a download button to show up when opening a page with media url.
+        </message>
       </if>
       <message name="IDS_FLAGS_DOWNLOAD_RESUMPTION_NAME" desc="Title for the flag to enable the download resume feature.">
         Download Resumption
diff --git a/chrome/app/settings_strings.grdp b/chrome/app/settings_strings.grdp
index 9124aa1..e63c421 100644
--- a/chrome/app/settings_strings.grdp
+++ b/chrome/app/settings_strings.grdp
@@ -1168,6 +1168,28 @@
     <message name="IDS_SETTINGS_KEYBOARD_SEND_FUNCTION_KEYS_DESCRIPTION" desc="In Device Settings, the label describing how to use the top-row keys' original actions when they are set to behave like function keys.">
       Hold the Search key to switch the behavior of the top-row keys.
     </message>
+    <!-- Display -->
+    <message name="IDS_SETTINGS_DISPLAY_TITLE" desc="In Device Settings, the title for display settings.">
+      Displays
+    </message>
+    <message name="IDS_SETTINGS_DISPLAY_ARRANGEMENT" desc="In Device Settings > Displays, the label for the display arrangement section.">
+      Arrangement
+    </message>
+    <message name="IDS_SETTINGS_DISPLAY_MIRROR" desc="In Device Settings > Displays, the label for the control for mirroring.">
+      Mirror displays
+    </message>
+    <message name="IDS_SETTINGS_DISPLAY_MAKE_PRIMARY" desc="In Device Settings > Displays, the label for the control for making a display primary.">
+      Make primary
+    </message>
+    <message name="IDS_SETTINGS_DISPLAY_RESOLUTION" desc="In Device Settings > Displays, the label for the control for changing a display's resolution.">
+      Resolution
+    </message>
+    <message name="IDS_SETTINGS_DISPLAY_ORIENTATION" desc="In Device Settings > Displays, the label for the control for changing a display's orientation.">
+      Orientation
+    </message>
+    <message name="IDS_SETTINGS_DISPLAY_ORIENTATION_STANDARD" desc="In Device Settings > Displays, the label for standard orientation (0 rotation).">
+      Standard
+    </message>
   </if>
 
   <!-- System Page -->
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index 4844d3f6..19b8ed38 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -776,6 +776,10 @@
      IDS_FLAGS_ENABLE_SYSTEM_DOWNLOAD_MANAGER_NAME,
      IDS_FLAGS_ENABLE_SYSTEM_DOWNLOAD_MANAGER_DESCRIPTION, kOsAndroid,
      FEATURE_VALUE_TYPE(chrome::android::kSystemDownloadManager)},
+    {"enable-media-document-download-button",
+     IDS_FLAGS_MEDIA_DOCUMENT_DOWNLOAD_BUTTON_NAME,
+     IDS_FLAGS_MEDIA_DOCUMENT_DOWNLOAD_BUTTON_DESCRIPTION, kOsAndroid,
+     FEATURE_VALUE_TYPE(features::kMediaDocumentDownloadButton)},
 #endif
 #if defined(OS_CHROMEOS)
     {"download-notification", IDS_FLAGS_DOWNLOAD_NOTIFICATION_NAME,
diff --git a/chrome/browser/android/compositor/scene_layer/tab_strip_scene_layer.cc b/chrome/browser/android/compositor/scene_layer/tab_strip_scene_layer.cc
index 034a6480..d5ff192 100644
--- a/chrome/browser/android/compositor/scene_layer/tab_strip_scene_layer.cc
+++ b/chrome/browser/android/compositor/scene_layer/tab_strip_scene_layer.cc
@@ -11,6 +11,7 @@
 #include "content/public/browser/android/compositor.h"
 #include "jni/TabStripSceneLayer_jni.h"
 #include "ui/android/resources/resource_manager_impl.h"
+#include "ui/gfx/transform.h"
 
 namespace chrome {
 namespace android {
@@ -18,7 +19,10 @@
 TabStripSceneLayer::TabStripSceneLayer(JNIEnv* env, jobject jobj)
     : SceneLayer(env, jobj),
       tab_strip_layer_(cc::SolidColorLayer::Create()),
+      scrollable_strip_layer_(cc::Layer::Create()),
       new_tab_button_(cc::UIResourceLayer::Create()),
+      left_fade_(cc::UIResourceLayer::Create()),
+      right_fade_(cc::UIResourceLayer::Create()),
       model_selector_button_(cc::UIResourceLayer::Create()),
       background_tab_brightness_(1.f),
       brightness_(1.f),
@@ -26,9 +30,20 @@
       content_tree_(nullptr) {
   new_tab_button_->SetIsDrawable(true);
   model_selector_button_->SetIsDrawable(true);
+  left_fade_->SetIsDrawable(true);
+  right_fade_->SetIsDrawable(true);
+
+  // When the ScrollingStripStacker is used, the new tab button and tabs scroll,
+  // while the incognito button and left/ride fade stay fixed. Put the new tab
+  // button and tabs in a separate layer placed visually below the others.
+  scrollable_strip_layer_->SetIsDrawable(true);
+  scrollable_strip_layer_->AddChild(new_tab_button_);
+
   tab_strip_layer_->SetBackgroundColor(SK_ColorBLACK);
   tab_strip_layer_->SetIsDrawable(true);
-  tab_strip_layer_->AddChild(new_tab_button_);
+  tab_strip_layer_->AddChild(scrollable_strip_layer_);
+  tab_strip_layer_->AddChild(left_fade_);
+  tab_strip_layer_->AddChild(right_fade_);
   tab_strip_layer_->AddChild(model_selector_button_);
   layer()->AddChild(tab_strip_layer_);
 }
@@ -90,6 +105,7 @@
   gfx::RectF content(0, y_offset, width, height);
   layer()->SetPosition(gfx::PointF(0, y_offset));
   tab_strip_layer_->SetBounds(gfx::Size(width, height));
+  scrollable_strip_layer_->SetBounds(gfx::Size(width, height));
 
   if (brightness != brightness_) {
     brightness_ = brightness;
@@ -168,6 +184,88 @@
   model_selector_button_->SetHideLayerAndSubtree(!visible);
 }
 
+void TabStripSceneLayer::UpdateTabStripLeftFade(
+    JNIEnv* env,
+    const JavaParamRef<jobject>& jobj,
+    jint resource_id,
+    jfloat opacity,
+    const JavaParamRef<jobject>& jresource_manager) {
+
+  // Hide layer if it's not visible.
+  if (opacity == 0.f) {
+    left_fade_->SetHideLayerAndSubtree(true);
+    return;
+  }
+
+  // Set UI resource.
+  ui::ResourceManager* resource_manager =
+      ui::ResourceManagerImpl::FromJavaObject(jresource_manager);
+  ui::ResourceManager::Resource* fade_resource =
+      resource_manager->GetResource(ui::ANDROID_RESOURCE_TYPE_STATIC,
+                                    resource_id);
+  left_fade_->SetUIResourceId(fade_resource->ui_resource->id());
+
+  // The same resource is used for both left and right fade, so the
+  // resource must be rotated for the left fade.
+  gfx::Transform fade_transform;
+  fade_transform.RotateAboutYAxis(180.0);
+  left_fade_->SetTransform(fade_transform);
+
+  // Set opacity.
+  left_fade_->SetOpacity(opacity);
+
+  // Set bounds. Use the parent layer height so the 1px fade resource is
+  // stretched vertically.
+  left_fade_->SetBounds(gfx::Size(fade_resource->size.width(),
+                                  scrollable_strip_layer_->bounds().height()));
+
+  // Set position. The rotation set above requires the layer to be offset
+  // by its width in order to display on the left edge.
+  left_fade_->SetPosition(gfx::PointF(fade_resource->size.width(), 0));
+
+  // Ensure layer is visible.
+  left_fade_->SetHideLayerAndSubtree(false);
+}
+
+void TabStripSceneLayer::UpdateTabStripRightFade(
+    JNIEnv* env,
+    const JavaParamRef<jobject>& jobj,
+    jint resource_id,
+    jfloat opacity,
+    const JavaParamRef<jobject>& jresource_manager) {
+
+  // Hide layer if it's not visible.
+  if (opacity == 0.f) {
+    right_fade_->SetHideLayerAndSubtree(true);
+    return;
+  }
+
+  // Set UI resource.
+  ui::ResourceManager* resource_manager =
+      ui::ResourceManagerImpl::FromJavaObject(jresource_manager);
+  ui::ResourceManager::Resource* fade_resource =
+      resource_manager->GetResource(ui::ANDROID_RESOURCE_TYPE_STATIC,
+                                    resource_id);
+  right_fade_->SetUIResourceId(fade_resource->ui_resource->id());
+
+  // Set opacity.
+  right_fade_->SetOpacity(opacity);
+
+  // Set bounds. Use the parent layer height so the 1px fade resource is
+  // stretched vertically.
+  right_fade_->SetBounds(gfx::Size(
+      fade_resource->size.width(),
+      scrollable_strip_layer_->bounds().height()));
+
+  // Set position. The right fade is positioned at the end of the tab strip.
+  float x =
+      scrollable_strip_layer_->bounds().width() - fade_resource->size.width();
+  right_fade_->SetPosition(gfx::PointF(x, 0));
+
+  // Ensure layer is visible.
+  right_fade_->SetHideLayerAndSubtree(false);
+}
+
 void TabStripSceneLayer::PutStripTabLayer(
     JNIEnv* env,
     const JavaParamRef<jobject>& jobj,
@@ -214,7 +312,7 @@
   scoped_refptr<TabHandleLayer> layer_tree =
       TabHandleLayer::Create(layer_title_cache);
   tab_handle_layers_.push_back(layer_tree);
-  tab_strip_layer_->AddChild(layer_tree->layer());
+  scrollable_strip_layer_->AddChild(layer_tree->layer());
   write_index_++;
   return layer_tree;
 }
diff --git a/chrome/browser/android/compositor/scene_layer/tab_strip_scene_layer.h b/chrome/browser/android/compositor/scene_layer/tab_strip_scene_layer.h
index 63fbd97..ce99e394 100644
--- a/chrome/browser/android/compositor/scene_layer/tab_strip_scene_layer.h
+++ b/chrome/browser/android/compositor/scene_layer/tab_strip_scene_layer.h
@@ -41,6 +41,7 @@
   void BeginBuildingFrame(JNIEnv* env,
                           const base::android::JavaParamRef<jobject>& jobj,
                           jboolean visible);
+
   void FinishBuildingFrame(JNIEnv* env,
                            const base::android::JavaParamRef<jobject>& jobj);
 
@@ -52,6 +53,7 @@
                            jfloat background_tab_brightness,
                            jfloat brightness,
                            jboolean should_readd_background);
+
   void UpdateNewTabButton(
       JNIEnv* env,
       const base::android::JavaParamRef<jobject>& jobj,
@@ -62,6 +64,7 @@
       jfloat height,
       jboolean visible,
       const base::android::JavaParamRef<jobject>& jresource_manager);
+
   void UpdateModelSelectorButton(
       JNIEnv* env,
       const base::android::JavaParamRef<jobject>& jobj,
@@ -73,6 +76,21 @@
       jboolean incognito,
       jboolean visible,
       const base::android::JavaParamRef<jobject>& jresource_manager);
+
+  void UpdateTabStripLeftFade(
+      JNIEnv* env,
+      const base::android::JavaParamRef<jobject>& jobj,
+      jint resource_id,
+      jfloat opacity,
+      const base::android::JavaParamRef<jobject>& jresource_manager);
+
+  void UpdateTabStripRightFade(
+      JNIEnv* env,
+      const base::android::JavaParamRef<jobject>& jobj,
+      jint resource_id,
+      jfloat opacity,
+      const base::android::JavaParamRef<jobject>& jresource_manager);
+
   void PutStripTabLayer(
       JNIEnv* env,
       const base::android::JavaParamRef<jobject>& jobj,
@@ -101,7 +119,10 @@
   typedef std::vector<scoped_refptr<TabHandleLayer>> TabHandleLayerList;
 
   scoped_refptr<cc::SolidColorLayer> tab_strip_layer_;
+  scoped_refptr<cc::Layer> scrollable_strip_layer_;
   scoped_refptr<cc::UIResourceLayer> new_tab_button_;
+  scoped_refptr<cc::UIResourceLayer> left_fade_;
+  scoped_refptr<cc::UIResourceLayer> right_fade_;
   scoped_refptr<cc::UIResourceLayer> model_selector_button_;
 
   float background_tab_brightness_;
diff --git a/chrome/browser/apps/guest_view/web_view_browsertest.cc b/chrome/browser/apps/guest_view/web_view_browsertest.cc
index 3def5c5..5b96222 100644
--- a/chrome/browser/apps/guest_view/web_view_browsertest.cc
+++ b/chrome/browser/apps/guest_view/web_view_browsertest.cc
@@ -733,6 +733,15 @@
 
 INSTANTIATE_TEST_CASE_P(WebViewTests, WebViewTest, testing::Bool());
 
+class WebViewNewWindowTest : public WebViewTest {};
+INSTANTIATE_TEST_CASE_P(WebViewTests, WebViewNewWindowTest, testing::Bool());
+
+class WebViewSizeTest : public WebViewTest {};
+INSTANTIATE_TEST_CASE_P(WebViewTests, WebViewSizeTest, testing::Bool());
+
+class WebViewVisibilityTest : public WebViewTest {};
+INSTANTIATE_TEST_CASE_P(WebViewTests, WebViewVisibilityTest, testing::Bool());
+
 // The following test suits are created to group tests based on specific
 // features of <webview>.
 // These features current would not work with
@@ -743,20 +752,11 @@
                         WebViewAccessibilityTest,
                         testing::Values(false));
 
-class WebViewNewWindowTest : public WebViewTest {};
-INSTANTIATE_TEST_CASE_P(WebViewTests, WebViewNewWindowTest, testing::Bool());
-
-class WebViewSizeTest : public WebViewTest {};
-INSTANTIATE_TEST_CASE_P(WebViewTests, WebViewSizeTest, testing::Values(false));
-
 class WebViewSpeechAPITest : public WebViewTest {};
 INSTANTIATE_TEST_CASE_P(WebViewTests,
                         WebViewSpeechAPITest,
                         testing::Values(false));
 
-class WebViewVisibilityTest : public WebViewTest {};
-INSTANTIATE_TEST_CASE_P(WebViewTests, WebViewVisibilityTest, testing::Bool());
-
 class WebViewDPITest : public WebViewTest {
  protected:
   void SetUpCommandLine(base::CommandLine* command_line) override {
@@ -1746,11 +1746,6 @@
 }
 
 IN_PROC_BROWSER_TEST_P(WebViewNewWindowTest, OpenURLFromTab_NewWindow_Abort) {
-  // This test is disabled because it attaches before the element is appended
-  // to the document. crbug.com/589896.
-  if (content::BrowserPluginGuestMode::UseCrossProcessFramesForGuests())
-    return;
-
   LoadAppWithGuest("web_view/simple");
 
   // Verify that OpenURLFromTab with a window disposition of NEW_BACKGROUND_TAB
diff --git a/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc b/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc
index 53bfdc5..5c57631 100644
--- a/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc
+++ b/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc
@@ -32,7 +32,6 @@
 #include "content/public/browser/render_widget_host_iterator.h"
 #include "content/public/browser/render_widget_host_view.h"
 #include "content/public/browser/web_contents.h"
-#include "content/public/common/browser_plugin_guest_mode.h"
 #include "content/public/common/content_switches.h"
 #include "content/public/test/browser_test_utils.h"
 #include "extensions/browser/api/extensions_api_client.h"
@@ -52,6 +51,42 @@
 using guest_view::TestGuestViewManager;
 using guest_view::TestGuestViewManagerFactory;
 
+namespace {
+// A helper class which polls the text input state of the given WebContents.
+class TextInputStateHelper {
+ public:
+  using Predicate =
+      base::Callback<bool(const content::TextInputStateTestExport&)>;
+
+  static void WaitForDesiredState(content::WebContents* web_contents,
+                                  const Predicate& predicate) {
+    content::TextInputStateTestExport state =
+        content::TextInputStateTestExport::FromWebContents(web_contents);
+    while (!predicate.Run(state)) {
+      scoped_refptr<content::MessageLoopRunner> loop =
+          new content::MessageLoopRunner();
+      content::BrowserThread::PostDelayedTask(
+          content::BrowserThread::UI, FROM_HERE, loop->QuitClosure(),
+          base::TimeDelta::FromMilliseconds(100LL));
+      loop->Run();
+      state = content::TextInputStateTestExport::FromWebContents(web_contents);
+    }
+  }
+
+  static bool IsStateOfGivenType(
+      ui::TextInputType type,
+      const content::TextInputStateTestExport& state) {
+    return type == state.type();
+  }
+
+  static bool HasGivenValue(const std::string& value,
+                            const content::TextInputStateTestExport& state) {
+    return value == state.value();
+  }
+};
+
+}  // namespace
+
 class WebViewInteractiveTestBase : public extensions::PlatformAppBrowserTest {
  public:
   WebViewInteractiveTestBase()
@@ -513,6 +548,9 @@
 class WebViewContextMenuInteractiveTest : public WebViewInteractiveTestBase {};
 class WebViewPointerLockInteractiveTest : public WebViewInteractiveTestBase {};
 class WebViewDragDropInteractiveTest : public WebViewInteractiveTestBase {};
+// TODO(ekaramad): The following tests fail of OOPIF due to focus issues.
+// see crbug.com/61060.
+class WebViewTextInputStateInteractiveTest : public WebViewInteractiveTest {};
 
 INSTANTIATE_TEST_CASE_P(WebViewInteractiveTests,
                         WebViewInteractiveTest,
@@ -522,6 +560,10 @@
                         WebViewNewWindowInteractiveTest,
                         testing::Bool());
 
+INSTANTIATE_TEST_CASE_P(WebViewInteractiveTests,
+                        WebViewTextInputStateInteractiveTest,
+                        testing::Values(false));
+
 // ui_test_utils::SendMouseMoveSync doesn't seem to work on OS_MACOSX, and
 // likely won't work on many other platforms as well, so for now this test
 // is for Windows and Linux only. As of Sept 17th, 2013 this test is disabled
@@ -751,11 +793,6 @@
 
 IN_PROC_BROWSER_TEST_P(WebViewNewWindowInteractiveTest,
                        NewWindow_AttachAfterOpenerDestroyed) {
-  // This test is disabled because it attaches before the element is appended
-  // to the document. crbug.com/589896.
-  if (content::BrowserPluginGuestMode::UseCrossProcessFramesForGuests())
-    return;
-
   TestHelper("testNewWindowAttachAfterOpenerDestroyed",
              "web_view/newwindow",
              NEEDS_TEST_SERVER);
@@ -801,11 +838,6 @@
 
 IN_PROC_BROWSER_TEST_P(WebViewNewWindowInteractiveTest,
                        NewWindow_DeferredAttachment) {
-  // This test is disabled because it attaches before the element is appended
-  // to the document. crbug.com/589896.
-  if (content::BrowserPluginGuestMode::UseCrossProcessFramesForGuests())
-    return;
-
   TestHelper("testNewWindowDeferredAttachment",
              "web_view/newwindow",
              NEEDS_TEST_SERVER);
@@ -1346,3 +1378,68 @@
   SendMessageToEmbedder("verify");
   EXPECT_TRUE(webview_button_not_focused_listener.WaitUntilSatisfied());
 }
+
+IN_PROC_BROWSER_TEST_P(WebViewTextInputStateInteractiveTest,
+                       TopLevelWebContentsTracksCorrectly) {
+  SetupTest("web_view/text_input_state",
+            "/extensions/platform_apps/web_view/text_input_state/guest.html");
+
+  auto press_tab_to_focus = [](WebViewTextInputStateInteractiveTest* test,
+                               const std::string& message) {
+    ExtensionTestMessageListener listener(message, false);
+    test->SendKeyPressToPlatformApp(ui::VKEY_TAB);
+    listener.WaitUntilSatisfied();
+  };
+
+  auto get_type_checker = [](ui::TextInputType target) {
+    return base::Bind(&TextInputStateHelper::IsStateOfGivenType, target);
+  };
+
+  // Press the tab key. The <input> in the embedder should get focused.
+  // Top level state type should be number.
+  press_tab_to_focus(this, "EMBEDDER-FOCUSED-1");
+  TextInputStateHelper::WaitForDesiredState(
+      embedder_web_contents(), get_type_checker(ui::TEXT_INPUT_TYPE_NUMBER));
+
+  // Press the tab key again and the <input> inside <webview> gets focused. The
+  // input type should text now.
+  press_tab_to_focus(this, "GUEST-FOCUSED");
+  TextInputStateHelper::WaitForDesiredState(
+      embedder_web_contents(), get_type_checker(ui::TEXT_INPUT_TYPE_TEXT));
+
+  // Press the tab key one more time to get back to embedder's second <input>.
+  // The value should be "last one".
+  press_tab_to_focus(this, "EMBEDDER-FOCUSED-2");
+  TextInputStateHelper::WaitForDesiredState(
+      embedder_web_contents(),
+      base::Bind(&TextInputStateHelper::HasGivenValue, "last one"));
+}
+
+// TODO(ekaramad): Activate this test for OOPIF when input event routing for
+// OOPIF-<webview> is fixed.
+IN_PROC_BROWSER_TEST_P(WebViewTextInputStateInteractiveTest,
+                       CrashingWebViewResetsState) {
+  SetupTest("web_view/text_input_state",
+            "/extensions/platform_apps/web_view/text_input_state/guest.html");
+
+  // Press tab key twice to end up in the <input> of the <webview>,
+  ExtensionTestMessageListener listener("GUEST-FOCUSED", false);
+  for (size_t i = 0; i < 2; ++i)
+    SendKeyPressToPlatformApp(ui::VKEY_TAB);
+
+  listener.WaitUntilSatisfied();
+
+  // Now wait for a text input state change.
+  TextInputStateHelper::WaitForDesiredState(
+      embedder_web_contents(),
+      base::Bind(&TextInputStateHelper::HasGivenValue, "guest"));
+
+  // Now crash the <webview>.
+  guest_web_contents()->GetRenderProcessHost()->Shutdown(false, 0);
+
+  // State should reset to none.
+  TextInputStateHelper::WaitForDesiredState(
+      embedder_web_contents(),
+      base::Bind(&TextInputStateHelper::IsStateOfGivenType,
+                 ui::TEXT_INPUT_TYPE_NONE));
+}
diff --git a/chrome/browser/printing/pdf_to_emf_converter.cc b/chrome/browser/printing/pdf_to_emf_converter.cc
index 17d2356..a261a9b 100644
--- a/chrome/browser/printing/pdf_to_emf_converter.cc
+++ b/chrome/browser/printing/pdf_to_emf_converter.cc
@@ -335,10 +335,9 @@
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
   if (!utility_process_host_ || !pdf)
     return OnFailed();
-  base::ProcessHandle process = utility_process_host_->GetData().handle;
   // Should reply with OnPageCount().
   Send(new ChromeUtilityMsg_RenderPDFPagesToMetafiles(
-      IPC::GetFileHandleForProcess(pdf->GetPlatformFile(), process, false),
+      IPC::GetPlatformFileForTransit(pdf->GetPlatformFile(), false),
       settings_));
 }
 
@@ -389,9 +388,8 @@
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
   if (!utility_process_host_ || !emf)
     return OnFailed();
-  base::ProcessHandle process = utility_process_host_->GetData().handle;
   IPC::PlatformFileForTransit transit =
-      IPC::GetFileHandleForProcess(emf->GetPlatformFile(), process, false);
+      IPC::GetPlatformFileForTransit(emf->GetPlatformFile(), false);
   callback_data->set_emf(std::move(emf));
   // Should reply with OnPageDone().
   Send(new ChromeUtilityMsg_RenderPDFPagesToMetafiles_GetPage(
diff --git a/chrome/browser/profiles/profile_statistics_aggregator.cc b/chrome/browser/profiles/profile_statistics_aggregator.cc
index 1335d01..519dcc79 100644
--- a/chrome/browser/profiles/profile_statistics_aggregator.cc
+++ b/chrome/browser/profiles/profile_statistics_aggregator.cc
@@ -197,7 +197,10 @@
   if (bookmark_model) {
     if (bookmark_model->loaded()) {
       CountBookmarks(bookmark_model);
-    } else {
+    } else if (!bookmark_model_helper_) {
+      // If |bookmark_model_helper_| is not null, it means a previous bookmark
+      // counting task still waiting for the bookmark model to load. Do nothing
+      // and continue to use the old |bookmark_model_helper_| in this case.
       AddRef();
       bookmark_model_helper_.reset(new BookmarkModelHelper(this));
       bookmark_model->AddObserver(bookmark_model_helper_.get());
diff --git a/chrome/browser/profiles/profile_statistics_unittest.cc b/chrome/browser/profiles/profile_statistics_unittest.cc
index 9fa316ff..158c48b 100644
--- a/chrome/browser/profiles/profile_statistics_unittest.cc
+++ b/chrome/browser/profiles/profile_statistics_unittest.cc
@@ -8,15 +8,67 @@
 #include <vector>
 
 #include "base/files/file_path.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/run_loop.h"
+#include "chrome/browser/bookmarks/bookmark_model_factory.h"
+#include "chrome/browser/bookmarks/chrome_bookmark_client.h"
+#include "chrome/browser/bookmarks/managed_bookmark_service_factory.h"
 #include "chrome/browser/profiles/profile_statistics.h"
+#include "chrome/browser/profiles/profile_statistics_aggregator.h"
 #include "chrome/browser/profiles/profile_statistics_common.h"
+#include "chrome/browser/profiles/profile_statistics_factory.h"
+#include "chrome/common/pref_names.h"
 #include "chrome/test/base/testing_browser_process.h"
 #include "chrome/test/base/testing_profile.h"
 #include "chrome/test/base/testing_profile_manager.h"
+#include "components/bookmarks/browser/bookmark_model.h"
+#include "components/prefs/pref_service.h"
+#include "content/public/browser/browser_thread.h"
 #include "content/public/test/test_browser_thread_bundle.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace {
+
+scoped_ptr<KeyedService> BuildBookmarkModelWithoutLoad(
+    content::BrowserContext* context) {
+  Profile* profile = Profile::FromBrowserContext(context);
+  scoped_ptr<bookmarks::BookmarkModel> bookmark_model(
+      new bookmarks::BookmarkModel(make_scoped_ptr(new ChromeBookmarkClient(
+          profile, ManagedBookmarkServiceFactory::GetForProfile(profile)))));
+  return std::move(bookmark_model);
+}
+
+void LoadBookmarkModel(Profile* profile,
+                       bookmarks::BookmarkModel* bookmark_model) {
+  bookmark_model->Load(profile->GetPrefs(),
+                       profile->GetPath(),
+                       profile->GetIOTaskRunner(),
+                       content::BrowserThread::GetMessageLoopProxyForThread(
+                           content::BrowserThread::UI));
+}
+
+bookmarks::BookmarkModel* CreateBookmarkModelWithoutLoad(Profile* profile) {
+  return static_cast<bookmarks::BookmarkModel*>(
+      BookmarkModelFactory::GetInstance()->SetTestingFactoryAndUse(
+          profile, BuildBookmarkModelWithoutLoad));
+}
+
+class BookmarkStatHelper {
+ public:
+  BookmarkStatHelper() : num_of_times_called_(0) {}
+
+  void StatsCallback(profiles::ProfileCategoryStats stats) {
+    if (stats.back().category == profiles::kProfileStatisticsBookmarks)
+      ++num_of_times_called_;
+  }
+
+  int GetNumOfTimesCalled() { return num_of_times_called_; }
+
+ private:
+  base::Closure quit_closure_;
+  int num_of_times_called_;
+};
+
 void VerifyStatisticsCache(const base::FilePath& profile_path,
     const std::map<std::string, int>& expected,
     const std::vector<std::string>& categories_to_check) {
@@ -86,3 +138,47 @@
     VerifyStatisticsCache(profile_path, expected, categories_to_check);
   }
 }
+
+TEST_F(ProfileStatisticsTest, WaitOrCountBookmarks) {
+  TestingProfile* profile = manager()->CreateTestingProfile("Test 1");
+  ASSERT_TRUE(profile);
+
+  bookmarks::BookmarkModel* bookmark_model =
+      CreateBookmarkModelWithoutLoad(profile);
+  ASSERT_TRUE(bookmark_model);
+
+  // Run ProfileStatisticsAggregator::WaitOrCountBookmarks.
+  ProfileStatisticsAggregator* aggregator;
+  BookmarkStatHelper bookmark_stat_helper;
+  base::RunLoop run_loop_aggregator_destruction;
+  // The following should run inside a scope, so the scoped_refptr gets deleted
+  // immediately.
+  {
+    scoped_refptr<ProfileStatisticsAggregator> aggregator_scoped =
+        new ProfileStatisticsAggregator(
+                profile,
+                base::Bind(&BookmarkStatHelper::StatsCallback,
+                           base::Unretained(&bookmark_stat_helper)),
+                run_loop_aggregator_destruction.QuitClosure());
+    aggregator = aggregator_scoped.get();
+  }
+  // Wait until ProfileStatisticsAggregator::WaitOrCountBookmarks is run.
+  base::RunLoop run_loop1;
+  run_loop1.RunUntilIdle();
+  EXPECT_EQ(0, bookmark_stat_helper.GetNumOfTimesCalled());
+
+  // Run ProfileStatisticsAggregator::WaitOrCountBookmarks again.
+  aggregator->AddCallbackAndStartAggregator(
+      profiles::ProfileStatisticsCallback());
+  // Wait until ProfileStatisticsAggregator::WaitOrCountBookmarks is run.
+  base::RunLoop run_loop2;
+  run_loop2.RunUntilIdle();
+  EXPECT_EQ(0, bookmark_stat_helper.GetNumOfTimesCalled());
+
+  // Load the bookmark model. When the model is loaded (asynchronously), the
+  // observer added by WaitOrCountBookmarks is run.
+  LoadBookmarkModel(profile, bookmark_model);
+
+  run_loop_aggregator_destruction.Run();
+  EXPECT_EQ(1, bookmark_stat_helper.GetNumOfTimesCalled());
+}
diff --git a/chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h b/chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h
index b8c28ccd..735da93c3 100644
--- a/chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h
+++ b/chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h
@@ -18,7 +18,7 @@
   explicit ChromeBrowserPepperHostFactory(content::BrowserPpapiHost* host);
   ~ChromeBrowserPepperHostFactory() override;
 
-  scoped_ptr<ppapi::host::ResourceHost> CreateResourceHost(
+  std::unique_ptr<ppapi::host::ResourceHost> CreateResourceHost(
       ppapi::host::PpapiHost* host,
       PP_Resource resource,
       PP_Instance instance,
diff --git a/chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc b/chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc
index 97ea95845..fa089eee 100644
--- a/chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc
+++ b/chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc
@@ -336,13 +336,26 @@
   EXPECT_NE(process3.Pid(), process2.Pid());
   EXPECT_TRUE(process1.IsProcessBackgrounded());
   EXPECT_FALSE(process2.IsProcessBackgrounded());
-  EXPECT_TRUE(process3.IsProcessBackgrounded());
+  // TODO(gab): The new background tab should be backgrounded but it currently
+  // intentionally isn't per a workaround to https://crbug.com/560446 in
+  // RenderProcessHostImpl::OnProcessLaunched().
+  EXPECT_FALSE(process3.IsProcessBackgrounded());
 
   // Navigate back to the first page. Its renderer should be in foreground
   // again while the other renderers should be backgrounded.
   EXPECT_EQ(process1.Pid(), ShowSingletonTab(page1).Pid());
   EXPECT_FALSE(process1.IsProcessBackgrounded());
   EXPECT_TRUE(process2.IsProcessBackgrounded());
+  // TODO(gab): Same as above.
+  EXPECT_FALSE(process3.IsProcessBackgrounded());
+
+  // TODO(gab): Remove this when https://crbug.com/560446 is fixed, but for now
+  // confirm that the correct state is at least achieved when tab #3 is
+  // explicitly foregrounded and re-backgrounded.
+  EXPECT_EQ(process3.Pid(), ShowSingletonTab(page3).Pid());
+  EXPECT_EQ(process1.Pid(), ShowSingletonTab(page1).Pid());
+  EXPECT_FALSE(process1.IsProcessBackgrounded());
+  EXPECT_TRUE(process2.IsProcessBackgrounded());
   EXPECT_TRUE(process3.IsProcessBackgrounded());
 }
 #endif
diff --git a/chrome/browser/resources/settings/certificate_manager_page/ca_trust_edit_dialog.html b/chrome/browser/resources/settings/certificate_manager_page/ca_trust_edit_dialog.html
index d5d4f81d..7069b21e 100644
--- a/chrome/browser/resources/settings/certificate_manager_page/ca_trust_edit_dialog.html
+++ b/chrome/browser/resources/settings/certificate_manager_page/ca_trust_edit_dialog.html
@@ -12,6 +12,7 @@
     <style include="settings-shared">
       paper-checkbox {
         display: block;
+        margin: 15px 0;
       }
     </style>
 
diff --git a/chrome/browser/resources/settings/certificate_manager_page/ca_trust_edit_dialog.js b/chrome/browser/resources/settings/certificate_manager_page/ca_trust_edit_dialog.js
index 3f911ec7..a7071316 100644
--- a/chrome/browser/resources/settings/certificate_manager_page/ca_trust_edit_dialog.js
+++ b/chrome/browser/resources/settings/certificate_manager_page/ca_trust_edit_dialog.js
@@ -3,12 +3,10 @@
 // found in the LICENSE file.
 
 /**
- * @fileoverview
- * 'settings-ca-trust-edit-dialog' is the a dialog allowing the user to edit the
- * trust lever of a given certificate authority.
- *
- * @group Chrome Settings Elements
- * @element settings-ca-trust-edit-dialog
+ * @fileoverview 'settings-ca-trust-edit-dialog' allows the user to
+ *  - specify the trust level of a certificate authority that is being
+ *    imported.
+ *  - edit the trust level of an already existing certificate authority.
  */
 Polymer({
   is: 'settings-ca-trust-edit-dialog',
@@ -17,7 +15,7 @@
     /** @private {!settings.CertificatesBrowserProxy} */
     browserProxy_: Object,
 
-    /** @type {!CertificateSubnode} */
+    /** @type {!CertificateSubnode|!NewCertificateSubNode} */
     model: Object,
 
     /** @private {?CaTrustInfo} */
@@ -37,12 +35,19 @@
     this.explanationText_ = loadTimeData.getStringF(
         'certificateManagerCaTrustEditDialogExplanation',
         this.model.name);
-    this.browserProxy_.getCaCertificateTrust(this.model.id).then(
-        /** @param {!CaTrustInfo} trustInfo */
-        function(trustInfo) {
-          this.trustInfo_ = trustInfo;
-          this.$.dialog.open();
-        }.bind(this));
+
+    // A non existing |model.id| indicates that a new certificate is being
+    // imported, otherwise an existing certificate is being edited.
+    if (this.model.id) {
+      this.browserProxy_.getCaCertificateTrust(this.model.id).then(
+          /** @param {!CaTrustInfo} trustInfo */
+          function(trustInfo) {
+            this.trustInfo_ = trustInfo;
+            this.$.dialog.open();
+          }.bind(this));
+    } else {
+      this.$.dialog.open();
+    }
   },
 
   /** @private */
@@ -53,17 +58,22 @@
   /** @private */
   onOkTap_: function() {
     this.$.spinner.active = true;
-    this.browserProxy_.editCaCertificateTrust(
-        this.model.id, this.$.ssl.checked,
-        this.$.email.checked, this.$.objSign.checked).then(
-            function() {
-              this.$.spinner.active = false;
-              this.$.dialog.close();
-            }.bind(this),
-            /** @param {!CertificatesError} error */
-            function(error) {
-              this.$.dialog.close();
-              this.fire('certificates-error', error);
-            }.bind(this));
+
+    var whenDone = this.model.id ?
+        this.browserProxy_.editCaCertificateTrust(
+            this.model.id, this.$.ssl.checked,
+            this.$.email.checked, this.$.objSign.checked) :
+        this.browserProxy_.importCaCertificateTrustSelected(
+            this.$.ssl.checked, this.$.email.checked, this.$.objSign.checked);
+
+    whenDone.then(function() {
+      this.$.spinner.active = false;
+      this.$.dialog.close();
+    }.bind(this),
+    /** @param {!CertificatesError} error */
+    function(error) {
+      this.$.dialog.close();
+      this.fire('certificates-error', error);
+    }.bind(this));
   },
 });
diff --git a/chrome/browser/resources/settings/certificate_manager_page/certificate_list.js b/chrome/browser/resources/settings/certificate_manager_page/certificate_list.js
index 94721d3d..59d1699 100644
--- a/chrome/browser/resources/settings/certificate_manager_page/certificate_list.js
+++ b/chrome/browser/resources/settings/certificate_manager_page/certificate_list.js
@@ -67,13 +67,16 @@
   },
 
 
-  /** @private */
-  dispatchImportActionEvent_: function() {
+  /**
+   * @param {?NewCertificateSubNode} subnode
+   * @private
+   */
+  dispatchImportActionEvent_: function(subnode) {
     this.fire(
         settings.CertificateActionEvent,
         /** @type {!CertificateActionEventDetail} */ ({
           action: settings.CertificateAction.IMPORT,
-          subnode: null,
+          subnode: subnode,
           certificateType: this.certificateType,
         }));
   },
@@ -85,13 +88,13 @@
       browserProxy.importPersonalCertificate(false).then(
           function(showPasswordPrompt) {
             if (showPasswordPrompt)
-              this.dispatchImportActionEvent_();
+              this.dispatchImportActionEvent_(null);
           }.bind(this),
           this.onRejected_.bind(this));
     } else if (this.certificateType == settings.CertificateType.CA) {
       browserProxy.importCaCertificate().then(
           function(certificateName) {
-            this.dispatchImportActionEvent_();
+            this.dispatchImportActionEvent_({name: certificateName});
           }.bind(this),
           this.onRejected_.bind(this));
     } else if (this.certificateType == settings.CertificateType.SERVER) {
diff --git a/chrome/browser/resources/settings/certificate_manager_page/certificate_manager_page.js b/chrome/browser/resources/settings/certificate_manager_page/certificate_manager_page.js
index 1ab76964..cc468ef 100644
--- a/chrome/browser/resources/settings/certificate_manager_page/certificate_manager_page.js
+++ b/chrome/browser/resources/settings/certificate_manager_page/certificate_manager_page.js
@@ -103,15 +103,23 @@
   /** @override */
   ready: function() {
     this.addEventListener(settings.CertificateActionEvent, function(event) {
+      this.dialogModel_ = event.detail.subnode;
+      this.dialogModelCertificateType_ = event.detail.certificateType;
+
       if (event.detail.action == settings.CertificateAction.IMPORT) {
-        this.handleImportAction_(event.detail);
+        if (event.detail.certificateType == settings.CertificateType.PERSONAL) {
+          this.openDialog_(
+              'settings-certificate-password-decryption-dialog',
+              'showPasswordDecryptionDialog_');
+        } else if (event.detail.certificateType ==
+            settings.CertificateType.CA) {
+          this.openDialog_(
+              'settings-ca-trust-edit-dialog', 'showCaTrustEditDialog_');
+        }
       } else {
-        this.dialogModel_ = event.detail.subnode;
-        this.dialogModelCertificateType_ = event.detail.certificateType;
         if (event.detail.action == settings.CertificateAction.EDIT) {
           this.openDialog_(
-              'settings-ca-trust-edit-dialog',
-              'showCaTrustEditDialog_');
+              'settings-ca-trust-edit-dialog', 'showCaTrustEditDialog_');
         } else if (event.detail.action == settings.CertificateAction.DELETE) {
           this.openDialog_(
               'settings-certificate-delete-confirmation-dialog',
@@ -137,22 +145,6 @@
   },
 
   /**
-   * Handles a |CertificateAction.IMPORT| for cases where a dialog needs to be
-   * displayed to the user.
-   * @param {!CertificateActionEventDetail} eventdetail
-   * @private
-   */
-  handleImportAction_: function(actionEvent) {
-    if (actionEvent.certificateType == settings.CertificateType.PERSONAL) {
-      this.openDialog_(
-          'settings-certificate-password-decryption-dialog',
-          'showPasswordDecryptionDialog_');
-    } else if (actionEvent.certificateType == settings.CertificateType.CA) {
-      // TODO(dpapad): Implement this.
-    }
-  },
-
-  /**
    * Opens a dialog and registers a listener for removing the dialog from the
    * DOM once is closed. The listener is destroyed when the dialog is removed
    * (because of 'restamp').
diff --git a/chrome/browser/resources/settings/certificate_manager_page/certificate_subentry.js b/chrome/browser/resources/settings/certificate_manager_page/certificate_subentry.js
index b1340bc..934a2242 100644
--- a/chrome/browser/resources/settings/certificate_manager_page/certificate_subentry.js
+++ b/chrome/browser/resources/settings/certificate_manager_page/certificate_subentry.js
@@ -12,7 +12,7 @@
  * component.
  * @typedef {{
  *   action: !settings.CertificateAction,
- *   subnode: ?CertificateSubnode,
+ *   subnode: null|CertificateSubnode|NewCertificateSubNode,
  *   certificateType: !settings.CertificateType
  * }}
  */
diff --git a/chrome/browser/resources/settings/certificate_manager_page/certificates_browser_proxy.js b/chrome/browser/resources/settings/certificate_manager_page/certificates_browser_proxy.js
index 3554426..d683375b 100644
--- a/chrome/browser/resources/settings/certificate_manager_page/certificates_browser_proxy.js
+++ b/chrome/browser/resources/settings/certificate_manager_page/certificates_browser_proxy.js
@@ -22,6 +22,15 @@
 var CertificateSubnode;
 
 /**
+ * A data structure describing a certificate that is currently being imported,
+ * therefore it has no ID yet, but it has a name. Used within JS only.
+ * @typedef {{
+ *   name: string,
+ * }}
+ */
+var NewCertificateSubNode;
+
+/**
  * @typedef {{
  *   id: string,
  *   name: string,
@@ -57,7 +66,7 @@
  * @typedef {{
  *   title: string,
  *   description: string
- *   certificateErrors: !Array<{certificateName: string, error: string}>
+ *   certificateErrors: !Array<{name: string, error: string}>
  * }}
  * @see chrome/browser/ui/webui/settings/certificates_handler.cc
  */
diff --git a/chrome/browser/resources/settings/certificate_manager_page/certificates_error_dialog.js b/chrome/browser/resources/settings/certificate_manager_page/certificates_error_dialog.js
index 1f9359dc..10069a2b 100644
--- a/chrome/browser/resources/settings/certificate_manager_page/certificates_error_dialog.js
+++ b/chrome/browser/resources/settings/certificate_manager_page/certificates_error_dialog.js
@@ -31,7 +31,6 @@
    */
   getCertificateErrorText_: function(importError) {
     return loadTimeData.getStringF(
-        'certificateImportErrorFormat',
-        importError.certificateName, importError.error);
+        'certificateImportErrorFormat', importError.name, importError.error);
   },
 });
diff --git a/chrome/browser/resources/settings/device_page/compiled_resources2.gyp b/chrome/browser/resources/settings/device_page/compiled_resources2.gyp
index cb163ec9..67a7d9c 100644
--- a/chrome/browser/resources/settings/device_page/compiled_resources2.gyp
+++ b/chrome/browser/resources/settings/device_page/compiled_resources2.gyp
@@ -20,7 +20,16 @@
       'dependencies': [
         '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:cr',
         '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:i18n_behavior',
-        '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:load_time_data',
+      ],
+      'includes': ['../../../../../third_party/closure_compiler/compile_js2.gypi'],
+    },
+    {
+      'target_name': 'display',
+      'dependencies': [
+        '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:cr',
+        '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:i18n_behavior',
+        '<(EXTERNS_GYP):system_display',
+        '<(INTERFACES_GYP):system_display_interface',
       ],
       'includes': ['../../../../../third_party/closure_compiler/compile_js2.gypi'],
     },
diff --git a/chrome/browser/resources/settings/device_page/device_page.html b/chrome/browser/resources/settings/device_page/device_page.html
index e4225d8..d541f8d2 100644
--- a/chrome/browser/resources/settings/device_page/device_page.html
+++ b/chrome/browser/resources/settings/device_page/device_page.html
@@ -1,10 +1,10 @@
-<link rel="import" href="chrome://resources/html/i18n_behavior.html">
 <link rel="import" href="chrome://resources/html/polymer.html">
 <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
 <link rel="import" href="chrome://resources/polymer/v1_0/iron-icons/hardware-icons.html">
 <link rel="import" href="chrome://resources/polymer/v1_0/iron-icons/image-icons.html">
 <link rel="import" href="chrome://resources/polymer/v1_0/neon-animation/neon-animatable.html">
 <link rel="import" href="chrome://md-settings/controls/settings_dropdown_menu.html">
+<link rel="import" href="chrome://md-settings/device_page/display.html">
 <link rel="import" href="chrome://md-settings/device_page/keyboard.html">
 <link rel="import" href="chrome://md-settings/device_page/touchpad.html">
 <link rel="import" href="chrome://md-settings/i18n_setup.html">
@@ -19,27 +19,35 @@
     <settings-animated-pages id="pages" section="device"
         current-route="{{currentRoute}}">
       <neon-animatable id="main">
-        <div id="touchpadRow" class="settings-box first"
-            on-tap="onTouchpadTap_">
+        <div class="settings-box first" on-tap="onTouchpadTap_">
           <!-- TODO(michaelpg): Get a touchpad icon. -->
           <iron-icon icon="image:brightness-1"></iron-icon>
-          <div class="middle">[[i18n('touchpadTitle')]]</div>
+          <div class="middle">$i18n{touchpadTitle}</div>
         </div>
         <div id="keyboardRow" class="settings-box" on-tap="onKeyboardTap_">
           <iron-icon icon="hardware:keyboard"></iron-icon>
-          <div class="middle">[[i18n('keyboardTitle')]]</div>
+          <div class="middle">$i18n{keyboardTitle}</div>
+        </div>
+        <div id="displayRow" class="settings-box" on-tap="onDisplayTap_">
+          <iron-icon icon="hardware:desktop-windows"></iron-icon>
+          <div class="middle">$i18n{displayTitle}</div>
         </div>
       </neon-animatable>
       <template is="dom-if" name="touchpad">
-        <settings-subpage page-title="[[i18n('touchpadTitle')]]">
+        <settings-subpage page-title="$i18n{touchpadTitle}">
           <settings-touchpad prefs="{{prefs}}"></settings-touchpad>
         </settings-subpage>
       </template>
       <template is="dom-if" name="keyboard">
-        <settings-subpage page-title="[[i18n('keyboardTitle')]]">
+        <settings-subpage page-title="$i18n{keyboardTitle}">
           <settings-keyboard prefs="{{prefs}}"></settings-keyboard>
         </settings-subpage>
       </template>
+      <template is="dom-if" name="display">
+        <settings-subpage page-title="$i18n{displayTitle}">
+          <settings-display></settings-display>
+        </settings-subpage>
+      </template>
     </settings-animated-pages>
   </template>
   <script src="device_page.js"></script>
diff --git a/chrome/browser/resources/settings/device_page/device_page.js b/chrome/browser/resources/settings/device_page/device_page.js
index 7049a69..f11e2a7 100644
--- a/chrome/browser/resources/settings/device_page/device_page.js
+++ b/chrome/browser/resources/settings/device_page/device_page.js
@@ -9,10 +9,6 @@
 Polymer({
   is: 'settings-device-page',
 
-  behaviors: [
-    I18nBehavior,
-  ],
-
   properties: {
     /** The current active route. */
     currentRoute: {
@@ -42,4 +38,12 @@
   onKeyboardTap_: function() {
     this.$.pages.setSubpageChain(['keyboard']);
   },
+
+  /**
+   * Handler for tapping the Display settings menu item.
+   * @private
+   */
+  onDisplayTap_: function() {
+    this.$.pages.setSubpageChain(['display']);
+  },
 });
diff --git a/chrome/browser/resources/settings/device_page/display.html b/chrome/browser/resources/settings/device_page/display.html
new file mode 100644
index 0000000..1459776
--- /dev/null
+++ b/chrome/browser/resources/settings/device_page/display.html
@@ -0,0 +1,72 @@
+<link rel="import" href="chrome://resources/html/i18n_behavior.html">
+<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/classes/iron-flex-layout.html">
+<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
+<link rel="import" href="chrome://resources/polymer/v1_0/paper-checkbox/paper-checkbox.html">
+<link rel="import" href="chrome://resources/polymer/v1_0/paper-dropdown-menu/paper-dropdown-menu.html">
+<link rel="import" href="chrome://resources/polymer/v1_0/paper-listbox/paper-listbox.html">
+<link rel="import" href="chrome://md-settings/settings_shared_css.html">
+
+<dom-module id="settings-display">
+  <template>
+    <style include="settings-shared">
+     .display-section {
+       @apply(--layout-self-start);
+       font-size: 100%;
+       font-weight: 500;
+       margin: 10px 0;
+     }
+
+     .settings-box.embedded {
+       margin-left: 20px;
+       padding: 0;
+     }
+
+     /* TODO(stevenjb): Placeholder */
+     .display-area {
+       border: lightgrey solid 1px;
+       height: 300px;
+       margin: 10px;
+       width: 600px;
+     }
+    </style>
+    <div class="settings-box first layout vertical">
+      <div class="display-section">$i18n{displayArrangement}</div>
+      <!-- TODO(stevenjb): Placeholder -->
+      <div class="display-area"></div>
+    </div>
+    <div class="settings-box layout vertical">
+      <div class="display-section">[[selectedDisplay.name]]</div>
+      <div class="settings-box embedded first self-stretch"
+           hidden$="[[!hasMultipleDisplays_(displays)]]">
+        <paper-checkbox class="flex" checked="[[isMirrored_(selectedDisplay)]]">
+          $i18n{displayMirror}
+        </paper-checkbox>
+        <paper-button hidden$="[[selectedDisplay.isPrimary]]">
+          $i18n{displayMakePrimary}
+        </paper-button>
+      </div>
+      <div class="settings-box embedded self-stretch">
+        <div class="start">$i18n{displayResolution}</div>
+        <!-- TODO(stevenjb): Implement -->
+        <paper-slider disabled></paper-slider>
+      </div>
+      <div class="settings-box embedded self-stretch">
+        <div class="start">$i18n{displayOrientation}</div>
+        <paper-dropdown-menu>
+          <paper-listbox class="dropdown-content"
+            selected="[[selectedDisplay.rotation]]"
+            attr-for-selected="value"
+            on-iron-activate="onSetOrientation_">
+            <paper-item value="0">$i18n{displayOrientationStandard}
+            </paper-item>
+            <paper-item value="90">90</paper-item>
+            <paper-item value="180">180</paper-item>
+            <paper-item value="270">270</paper-item>
+          </paper-listbox>
+        </paper-dropdown-menu>
+      </div>
+    </div>
+  </template>
+  <script src="display.js"></script>
+</dom-module>
diff --git a/chrome/browser/resources/settings/device_page/display.js b/chrome/browser/resources/settings/device_page/display.js
new file mode 100644
index 0000000..3c2edb2
--- /dev/null
+++ b/chrome/browser/resources/settings/device_page/display.js
@@ -0,0 +1,100 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * @fileoverview
+ * 'settings-display' is the settings subpage for display settings.
+ *
+ * @group Chrome Settings Elements
+ */
+
+cr.define('settings.display', function() {
+  var systemDisplayApi = /** @type {!SystemDisplay} */ (chrome.system.display);
+
+  return {
+    systemDisplayApi: systemDisplayApi,
+  };
+});
+
+Polymer({
+  is: 'settings-display',
+
+  behaviors: [
+    I18nBehavior,
+  ],
+
+  properties: {
+    /**
+     * Map of displays by id.
+     * @type {!Object<!chrome.system.display.DisplayUnitInfo>}
+     */
+    displays: Object,
+
+    /** Primary display id */
+    primaryDisplayId: String,
+
+    /**
+     * Selected display
+     * @type {!chrome.system.display.DisplayUnitInfo|undefined}
+     */
+    selectedDisplay: Object,
+  },
+
+  /**
+   * Listener for chrome.system.display.onDisplayChanged events.
+   * @type {function(void)|undefined}
+   * @private
+   */
+  displayChangedListener_: undefined,
+
+  /** @override */
+  attached: function() {
+    this.displayChangedListener_ = this.getDisplayInfo_.bind(this);
+    settings.display.systemDisplayApi.onDisplayChanged.addListener(
+        this.displayChangedListener_);
+    this.getDisplayInfo_();
+  },
+
+  /** @override */
+  detached: function() {
+    if (this.displayChangedListener_) {
+      settings.display.systemDisplayApi.onDisplayChanged.removeListener(
+          this.displayChangedListener_);
+    }
+  },
+
+  /** @private */
+  getDisplayInfo_: function() {
+    settings.display.systemDisplayApi.getInfo(
+        this.updateDisplayInfo_.bind(this));
+  },
+
+  /** @private */
+  hasMultipleDisplays_: function(displays) {
+    return Object.keys(displays).length > 1;
+  },
+
+  /** @private */
+  isMirrored_: function(selectedDisplay) {
+    return !!this.selectedDisplay.mirroringSourceId;
+  },
+
+  /**
+   * @param {!Array<!chrome.system.display.DisplayUnitInfo>} displaysArray
+   * @private
+   */
+  updateDisplayInfo_(displaysArray) {
+    var displays = {};
+    this.primaryDisplayId = '';
+    for (var i = 0; i < displaysArray.length; ++i) {
+      var display = displaysArray[i];
+      displays[display.id] = display;
+      if (display.isPrimary && !this.primaryDisplayId)
+        this.primaryDisplayId = display.id;
+    }
+    this.displays = displays;
+    // Always update selectedDisplay.
+    this.selectedDisplay = this.displays[this.primaryDisplayId];
+  },
+});
diff --git a/chrome/browser/resources/settings/on_startup_page/on_startup_page.html b/chrome/browser/resources/settings/on_startup_page/on_startup_page.html
index 07f90544..e51905bc 100644
--- a/chrome/browser/resources/settings/on_startup_page/on_startup_page.html
+++ b/chrome/browser/resources/settings/on_startup_page/on_startup_page.html
@@ -12,14 +12,14 @@
     <div class="settings-box block first">
       <settings-radio-group id="onStartupRadioGroup"
           pref="{{prefs.session.restore_on_startup}}">
-        <paper-radio-button name="[[prefValues_.OPEN_NEW_TAB]]"
-            i18n-content="onStartupOpenNewTab">
+        <paper-radio-button name="[[prefValues_.OPEN_NEW_TAB]]">
+          $i18n{onStartupOpenNewTab}
         </paper-radio-button>
-        <paper-radio-button name="[[prefValues_.CONTINUE]]"
-            i18n-content="onStartupContinue">
+        <paper-radio-button name="[[prefValues_.CONTINUE]]">
+          $i18n{onStartupContinue}
         </paper-radio-button>
-        <paper-radio-button name="[[prefValues_.OPEN_SPECIFIC]]"
-            i18n-content="onStartupOpenSpecific">
+        <paper-radio-button name="[[prefValues_.OPEN_SPECIFIC]]">
+          $i18n{onStartupOpenSpecific}
         </paper-radio-button>
       </settings-radio-group>
     </div>
diff --git a/chrome/browser/resources/settings/on_startup_page/startup_urls_page.html b/chrome/browser/resources/settings/on_startup_page/startup_urls_page.html
index 6819ca7..725325a 100644
--- a/chrome/browser/resources/settings/on_startup_page/startup_urls_page.html
+++ b/chrome/browser/resources/settings/on_startup_page/startup_urls_page.html
@@ -30,28 +30,27 @@
           <iron-icon on-tap="onRemoveUrlTap_" icon="clear"></iron-icon>
         </div>
       </template>
-      <div class="list-item list-button" id="addPage" on-tap="onAddPageTap_"
-          i18n-content="onStartupAddNewPage">
+      <div class="list-item list-button" id="addPage" on-tap="onAddPageTap_">
+        $i18n{onStartupAddNewPage}
       </div>
-      <div class="list-item list-button" on-tap="onUseCurrentPagesTap_"
-          i18n-content="onStartupUseCurrent">
+      <div class="list-item list-button" on-tap="onUseCurrentPagesTap_">
+        $i18n{onStartupUseCurrent}
       </div>
     </div>
 
     <settings-dialog id="addUrlDialog">
-      <div class="title" i18n-content="onStartupAddNewPage"></div>
+      <div class="title">$i18n{onStartupAddNewPage}</div>
       <div class="body">
         <paper-input class="flex" always-float-label id="newUrl"
-            i18n-values="label:onStartupSiteUrl" value="{{newUrl_}}">
+            label="$i18n{onStartupSiteUrl}" value="{{newUrl_}}">
         </paper-input>
       </div>
       <div class="button-container">
         <div class="action-buttons">
           <paper-button class="cancel-button" on-tap="onCancelTap_"
-              id="cancel" i18n-content="cancel"></paper-button>
+              id="cancel">$i18n{cancel}</paper-button>
           <paper-button id="add" class="action-button" on-tap="onAddTap_"
-              i18n-content="add" disabled="[[!isNewUrlValid_]]">
-          </paper-button>
+              disabled="[[!isNewUrlValid_]]">$i18n{add}</paper-button>
         </div>
       </div>
     </settings-dialog>
diff --git a/chrome/browser/resources/settings/settings_page/settings_router.js b/chrome/browser/resources/settings/settings_page/settings_router.js
index f3bc992..8c32e900 100644
--- a/chrome/browser/resources/settings/settings_page/settings_router.js
+++ b/chrome/browser/resources/settings/settings_page/settings_router.js
@@ -353,6 +353,12 @@
       section: 'device',
       subpage: ['keyboard'],
     },
+    {
+      url: '/display-overlay',
+      page: 'basic',
+      section: 'device',
+      subpage: ['display'],
+    },
 </if>
   ],
 
diff --git a/chrome/browser/resources/settings/settings_resources.grd b/chrome/browser/resources/settings/settings_resources.grd
index 60e4dc9..efb35a0 100644
--- a/chrome/browser/resources/settings/settings_resources.grd
+++ b/chrome/browser/resources/settings/settings_resources.grd
@@ -286,6 +286,12 @@
                    type="chrome_html" />
       </if>
       <if expr="chromeos">
+        <structure name="IDR_SETTINGS_DEVICE_DISPLAY_HTML"
+                   file="device_page/display.html"
+                   type="chrome_html" />
+        <structure name="IDR_SETTINGS_DEVICE_DISPLAY_JS"
+                   file="device_page/display.js"
+                   type="chrome_html" />
         <structure name="IDR_SETTINGS_DEVICE_KEYBOARD_HTML"
                    file="device_page/keyboard.html"
                    type="chrome_html" />
diff --git a/chrome/browser/rlz/chrome_rlz_tracker_delegate.cc b/chrome/browser/rlz/chrome_rlz_tracker_delegate.cc
index 9dac2723..2988886a 100644
--- a/chrome/browser/rlz/chrome_rlz_tracker_delegate.cc
+++ b/chrome/browser/rlz/chrome_rlz_tracker_delegate.cc
@@ -115,8 +115,10 @@
 #if defined(OS_WIN)
   return GoogleUpdateSettings::GetLanguage(language);
 #else
-  // TODO(thakis): Implement.
-  NOTIMPLEMENTED();
+  // On other systems, we don't know the install language of promotions. That's
+  // OK, for now all promotions on non-Windows systems will be reported as "en".
+  // If non-Windows promotions end up requiring language code reporting, that
+  // code will need to go here.
   return false;
 #endif
 }
diff --git a/chrome/browser/safe_browsing/sandboxed_zip_analyzer.cc b/chrome/browser/safe_browsing/sandboxed_zip_analyzer.cc
index f0ad87c..1779e4ee 100644
--- a/chrome/browser/safe_browsing/sandboxed_zip_analyzer.cc
+++ b/chrome/browser/safe_browsing/sandboxed_zip_analyzer.cc
@@ -148,9 +148,8 @@
   utility_process_host_->Send(
       new ChromeUtilityMsg_AnalyzeZipFileForDownloadProtection(
           IPC::TakeFileHandleForProcess(std::move(zip_file_), utility_process),
-          IPC::GetFileHandleForProcess(temp_file_.GetPlatformFile(),
-                                       utility_process,
-                                       false /* !close_source_handle */)));
+          IPC::GetPlatformFileForTransit(temp_file_.GetPlatformFile(),
+                                         false /* !close_source_handle */)));
 }
 
 void SandboxedZipAnalyzer::OnAnalyzeZipFileFinished(
diff --git a/chrome/browser/spellchecker/spellcheck_service.cc b/chrome/browser/spellchecker/spellcheck_service.cc
index 7360f06..dfc4898 100644
--- a/chrome/browser/spellchecker/spellcheck_service.cc
+++ b/chrome/browser/spellchecker/spellcheck_service.cc
@@ -191,9 +191,9 @@
     bdict_languages.back().language = hunspell_dictionary->GetLanguage();
     bdict_languages.back().file =
         hunspell_dictionary->GetDictionaryFile().IsValid()
-            ? IPC::GetFileHandleForProcess(
+            ? IPC::GetPlatformFileForTransit(
                   hunspell_dictionary->GetDictionaryFile().GetPlatformFile(),
-                  process->GetHandle(), false)
+                  false)
             : IPC::InvalidPlatformFileForTransit();
   }
 
diff --git a/chrome/browser/themes/theme_properties.cc b/chrome/browser/themes/theme_properties.cc
index cc56d3f..d4fb13a 100644
--- a/chrome/browser/themes/theme_properties.cc
+++ b/chrome/browser/themes/theme_properties.cc
@@ -42,7 +42,7 @@
 const SkColor kDefaultColorFrameIncognito[] = {SkColorSetRGB(0xA0, 0xA0, 0xA4),
                                                SkColorSetRGB(0x28, 0x2B, 0x2D)};
 const SkColor kDefaultColorFrameIncognitoInactive[] = {
-    SkColorSetRGB(0xAA, 0xAA, 0xAE), SkColorSetRGB(0x14, 0x17, 0x19)};
+    SkColorSetRGB(0xAA, 0xAA, 0xAE), SkColorSetRGB(0x38, 0x3B, 0x3D)};
 #elif defined(OS_MACOSX)
 const SkColor kDefaultColorFrameIncognito[] = {
     SkColorSetRGB(255, 0, 0), SkColorSetARGB(230, 20, 22, 24)};
@@ -52,7 +52,7 @@
 const SkColor kDefaultColorFrameIncognito[] = {SkColorSetRGB(83, 106, 139),
                                                SkColorSetRGB(0x28, 0x2B, 0x2D)};
 const SkColor kDefaultColorFrameIncognitoInactive[] = {
-    SkColorSetRGB(126, 139, 156), SkColorSetRGB(0x14, 0x17, 0x19)};
+    SkColorSetRGB(126, 139, 156), SkColorSetRGB(0x38, 0x3B, 0x3D)};
 #endif
 
 #if defined(OS_MACOSX)
diff --git a/chrome/browser/ui/app_list/arc/arc_app_icon.cc b/chrome/browser/ui/app_list/arc/arc_app_icon.cc
index 94e9d3f..301e040 100644
--- a/chrome/browser/ui/app_list/arc/arc_app_icon.cc
+++ b/chrome/browser/ui/app_list/arc/arc_app_icon.cc
@@ -16,12 +16,14 @@
 #include "content/public/browser/browser_thread.h"
 #include "extensions/grit/extensions_browser_resources.h"
 #include "ui/base/resource/resource_bundle.h"
+#include "ui/gfx/codec/png_codec.h"
 #include "ui/gfx/geometry/size.h"
+#include "ui/gfx/image/image_skia_operations.h"
 #include "ui/gfx/image/image_skia_source.h"
 
 namespace {
 
-bool g_disable_decoding = false;
+bool disable_safe_decoding = false;
 
 }  // namespace
 
@@ -59,7 +61,7 @@
 
 class ArcAppIcon::Source : public gfx::ImageSkiaSource {
  public:
-  explicit Source(const base::WeakPtr<ArcAppIcon>& host);
+  Source(const base::WeakPtr<ArcAppIcon>& host, int resource_size_in_dip);
   ~Source() override;
 
  private:
@@ -70,11 +72,15 @@
   // destroyed.
   base::WeakPtr<ArcAppIcon> host_;
 
+  const int resource_size_in_dip_;
+
   DISALLOW_COPY_AND_ASSIGN(Source);
 };
 
-ArcAppIcon::Source::Source(const base::WeakPtr<ArcAppIcon>& host)
-    : host_(host) {
+ArcAppIcon::Source::Source(const base::WeakPtr<ArcAppIcon>& host,
+                           int resource_size_in_dip)
+    : host_(host),
+      resource_size_in_dip_(resource_size_in_dip) {
 }
 
 ArcAppIcon::Source::~Source() {
@@ -88,8 +94,11 @@
   const gfx::ImageSkia* default_image = ResourceBundle::GetSharedInstance().
       GetImageSkiaNamed(IDR_APP_DEFAULT_ICON);
   CHECK(default_image);
-
-  return default_image->GetRepresentation(scale);
+  return gfx::ImageSkiaOperations::CreateResizedImage(
+      *default_image,
+      skia::ImageOperations::RESIZE_BEST,
+      gfx::Size(resource_size_in_dip_, resource_size_in_dip_)).
+          GetRepresentation(scale);
 }
 
 class ArcAppIcon::DecodeRequest : public ImageDecoder::ImageRequest {
@@ -162,8 +171,8 @@
 // ArcAppIcon
 
 // static
-void ArcAppIcon::DisableDecodingForTesting() {
-  g_disable_decoding = true;
+void ArcAppIcon::DisableSafeDecodingForTesting() {
+  disable_safe_decoding = true;
 }
 
 ArcAppIcon::ArcAppIcon(content::BrowserContext* context,
@@ -176,7 +185,7 @@
       observer_(observer),
       weak_ptr_factory_(this) {
   CHECK(observer_ != nullptr);
-  source_ = new Source(weak_ptr_factory_.GetWeakPtr());
+  source_ = new Source(weak_ptr_factory_.GetWeakPtr(), resource_size_in_dip);
   gfx::Size resource_size(resource_size_in_dip, resource_size_in_dip);
   image_skia_ = gfx::ImageSkia(source_, resource_size);
 }
@@ -238,11 +247,23 @@
 
   switch (read_result->status) {
   case ReadResult::Status::OK:
-    if (!g_disable_decoding) {
-      decode_requests_.push_back(
-          new DecodeRequest(weak_ptr_factory_.GetWeakPtr(),
-                            resource_size_in_dip_,
-                            read_result->scale_factor));
+    decode_requests_.push_back(
+        new DecodeRequest(weak_ptr_factory_.GetWeakPtr(),
+                          resource_size_in_dip_,
+                          read_result->scale_factor));
+    if (disable_safe_decoding) {
+      SkBitmap bitmap;
+      if (!read_result->unsafe_icon_data.empty() &&
+          gfx::PNGCodec::Decode(
+              reinterpret_cast<const unsigned char*>(
+                  &read_result->unsafe_icon_data.front()),
+              read_result->unsafe_icon_data.length(),
+              &bitmap)) {
+        decode_requests_.back()->OnImageDecoded(bitmap);
+      } else {
+        decode_requests_.back()->OnDecodeImageFailed();
+     }
+    } else {
       ImageDecoder::Start(decode_requests_.back(),
                           read_result->unsafe_icon_data);
     }
diff --git a/chrome/browser/ui/app_list/arc/arc_app_icon.h b/chrome/browser/ui/app_list/arc/arc_app_icon.h
index bd89381..c08d155 100644
--- a/chrome/browser/ui/app_list/arc/arc_app_icon.h
+++ b/chrome/browser/ui/app_list/arc/arc_app_icon.h
@@ -64,17 +64,17 @@
   // LoadImageForScaleFactor again.
   void LoadForScaleFactor(ui::ScaleFactor scale_factor);
 
-  // Disables decoding requests when unit tests are executed. This is done to
-  // avoid two problems. Problems come because icons are decoded at a separate
-  // process created by ImageDecoder. ImageDecoder has 5 seconds delay to stop
-  // since the last request (see its kBatchModeTimeoutSeconds for more details).
-  // This is unacceptably long for unit tests because the test framework waits
-  // until external process is finished. Another problem happens when we issue
-  // a decoding request, but the process has not started its processing yet by
-  // the time when a test exits. This might cause situation when
-  // g_one_utility_thread_lock from in_process_utility_thread.cc gets released
-  // in an acquired state which is crash condition in debug builds.
-  static void DisableDecodingForTesting();
+  // Disables async safe decoding requests when unit tests are executed. This is
+  // done to avoid two problems. Problems come because icons are decoded at a
+  // separate process created by ImageDecoder. ImageDecoder has 5 seconds delay
+  // to stop since the last request (see its kBatchModeTimeoutSeconds for more
+  // details). This is unacceptably long for unit tests because the test
+  // framework waits until external process is finished. Another problem happens
+  // when we issue a decoding request, but the process has not started its
+  // processing yet by the time when a test exits. This might cause situation
+  // when g_one_utility_thread_lock from in_process_utility_thread.cc gets
+  // released in an acquired state which is crash condition in debug builds.
+  static void DisableSafeDecodingForTesting();
 
  private:
   class Source;
diff --git a/chrome/browser/ui/app_list/arc/arc_app_icon_loader.cc b/chrome/browser/ui/app_list/arc/arc_app_icon_loader.cc
index 29619649..4e53b608 100644
--- a/chrome/browser/ui/app_list/arc/arc_app_icon_loader.cc
+++ b/chrome/browser/ui/app_list/arc/arc_app_icon_loader.cc
@@ -39,6 +39,7 @@
                                              this));
   icon->image_skia().EnsureRepsForSupportedScales();
   icon_map_[app_id] = std::move(icon);
+  UpdateImage(app_id);
 }
 
 void ArcAppIconLoader::ClearImage(const std::string& app_id) {
diff --git a/chrome/browser/ui/app_list/arc/arc_app_unittest.cc b/chrome/browser/ui/app_list/arc/arc_app_unittest.cc
index 3b5f4f3..c8f1951 100644
--- a/chrome/browser/ui/app_list/arc/arc_app_unittest.cc
+++ b/chrome/browser/ui/app_list/arc/arc_app_unittest.cc
@@ -18,6 +18,7 @@
 #include "base/task_runner_util.h"
 #include "chrome/browser/ui/app_list/app_list_test_util.h"
 #include "chrome/browser/ui/app_list/arc/arc_app_icon.h"
+#include "chrome/browser/ui/app_list/arc/arc_app_icon_loader.h"
 #include "chrome/browser/ui/app_list/arc/arc_app_item.h"
 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
 #include "chrome/browser/ui/app_list/arc/arc_app_model_builder.h"
@@ -29,9 +30,41 @@
 #include "components/arc/test/fake_arc_bridge_service.h"
 #include "content/public/browser/browser_thread.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "ui/app_list/app_list_constants.h"
 #include "ui/app_list/app_list_model.h"
+#include "ui/gfx/geometry/safe_integer_conversions.h"
 #include "ui/gfx/image/image_skia.h"
 
+namespace {
+
+class FakeAppIconLoaderDelegate : public AppIconLoaderDelegate {
+ public:
+  FakeAppIconLoaderDelegate() {}
+  ~FakeAppIconLoaderDelegate() override {}
+
+  void OnAppImageUpdated(const std::string& app_id,
+                         const gfx::ImageSkia& image) override {
+    app_id_ = app_id;
+    image_ = image;
+    ++update_image_cnt_;
+  }
+
+  size_t update_image_cnt() const { return update_image_cnt_; }
+
+  const std::string& app_id() const { return app_id_; }
+
+  const gfx::ImageSkia& image() { return image_; }
+
+ private:
+  size_t update_image_cnt_ = 0;
+  std::string app_id_;
+  gfx::ImageSkia image_;
+
+  DISALLOW_COPY_AND_ASSIGN(FakeAppIconLoaderDelegate);
+};
+
+}  // namespace
+
 class ArcAppModelBuilderTest : public AppListTestBase {
  public:
   ArcAppModelBuilderTest() {}
@@ -164,8 +197,29 @@
     }
   }
 
+  // Validates that provided image is acceptable as Arc app icon.
+  void ValidateIcon(const gfx::ImageSkia& image) {
+    EXPECT_EQ(app_list::kGridIconDimension, image.width());
+    EXPECT_EQ(app_list::kGridIconDimension, image.height());
+
+    const std::vector<ui::ScaleFactor>& scale_factors =
+        ui::GetSupportedScaleFactors();
+    for (auto& scale_factor : scale_factors) {
+      const float scale = ui::GetScaleForScaleFactor(scale_factor);
+      EXPECT_TRUE(image.HasRepresentation(scale));
+      const gfx::ImageSkiaRep& representation = image.GetRepresentation(scale);
+      EXPECT_FALSE(representation.is_null());
+      EXPECT_EQ(gfx::ToCeiledInt(app_list::kGridIconDimension * scale),
+          representation.pixel_width());
+      EXPECT_EQ(gfx::ToCeiledInt(app_list::kGridIconDimension * scale),
+          representation.pixel_height());
+    }
+  }
+
   AppListControllerDelegate* controller() { return controller_.get(); }
 
+  Profile* profile() { return profile_.get(); }
+
   const std::vector<arc::AppInfo>& fake_apps() const {
     return arc_test_.fake_apps();
   }
@@ -414,7 +468,7 @@
   base::RunLoop().RunUntilIdle();
 
   // Validating decoded content does not fit well for unit tests.
-  ArcAppIcon::DisableDecodingForTesting();
+  ArcAppIcon::DisableSafeDecodingForTesting();
 
   // Now send generated icon for the app.
   std::string png_data;
@@ -517,3 +571,48 @@
   ASSERT_LE(time_before, app_info->last_launch_time);
   ASSERT_GE(time_after, app_info->last_launch_time);
 }
+
+TEST_F(ArcAppModelBuilderTest, IconLoader) {
+  // Validating decoded content does not fit well for unit tests.
+  ArcAppIcon::DisableSafeDecodingForTesting();
+
+  const arc::AppInfo& app = fake_apps()[0];
+  const std::string app_id = ArcAppTest::GetAppId(app);
+
+  bridge_service()->SetReady();
+  app_instance()->RefreshAppList();
+  app_instance()->SendRefreshAppList(
+      std::vector<arc::AppInfo>(fake_apps().begin(), fake_apps().begin() + 1));
+
+  FakeAppIconLoaderDelegate delegate;
+  ArcAppIconLoader icon_loader(profile(), app_list::kListIconSize, &delegate);
+  EXPECT_EQ(0UL, delegate.update_image_cnt());
+  icon_loader.FetchImage(app_id);
+  EXPECT_EQ(1UL, delegate.update_image_cnt());
+  EXPECT_EQ(app_id, delegate.app_id());
+
+  // Validate default image.
+  ValidateIcon(delegate.image());
+
+  const std::vector<ui::ScaleFactor>& scale_factors =
+      ui::GetSupportedScaleFactors();
+  for (auto& scale_factor : scale_factors) {
+    std::string png_data;
+    EXPECT_TRUE(app_instance()->GenerateAndSendIcon(
+                    app, static_cast<arc::ScaleFactor>(scale_factor),
+                    &png_data));
+  }
+
+  // Process pending tasks, this installs icons.
+  content::BrowserThread::GetBlockingPool()->FlushForTesting();
+  base::RunLoop().RunUntilIdle();
+
+  // Allow one more circle to read and decode installed icons.
+  content::BrowserThread::GetBlockingPool()->FlushForTesting();
+  base::RunLoop().RunUntilIdle();
+
+  // Validate loaded image.
+  EXPECT_EQ(1 + scale_factors.size(), delegate.update_image_cnt());
+  EXPECT_EQ(app_id, delegate.app_id());
+  ValidateIcon(delegate.image());
+}
diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_view.h b/chrome/browser/ui/cocoa/tabs/tab_strip_view.h
index c919671..fe60df41 100644
--- a/chrome/browser/ui/cocoa/tabs/tab_strip_view.h
+++ b/chrome/browser/ui/cocoa/tabs/tab_strip_view.h
@@ -32,10 +32,12 @@
   // its tip.
   BOOL dropArrowShown_;
   NSPoint dropArrowPosition_;
+  BOOL inATabDraggingOverlayWindow_;
 }
 
 @property(assign, nonatomic) BOOL dropArrowShown;
 @property(assign, nonatomic) NSPoint dropArrowPosition;
+@property(assign, nonatomic) BOOL inATabDraggingOverlayWindow;
 
 // Name starts with "get" because methods staring with "new" return retained
 // objects according to Cocoa's create rule.
diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_view.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_view.mm
index 0b26910..e242b32 100644
--- a/chrome/browser/ui/cocoa/tabs/tab_strip_view.mm
+++ b/chrome/browser/ui/cocoa/tabs/tab_strip_view.mm
@@ -30,6 +30,7 @@
 
 @synthesize dropArrowShown = dropArrowShown_;
 @synthesize dropArrowPosition = dropArrowPosition_;
+@synthesize inATabDraggingOverlayWindow = inATabDraggingOverlayWindow_;
 
 - (id)initWithFrame:(NSRect)frame {
   self = [super initWithFrame:frame];
@@ -118,11 +119,15 @@
   BOOL supportsVibrancy = [self visualEffectView] != nil;
   BOOL isMainWindow = [[self window] isMainWindow];
 
-  if (themeProvider && !hasCustomThemeImage && isModeMaterial) {
+  // If in Material Design mode, decrease the tabstrip background's translucency
+  // by overlaying it with a partially-transparent gray (but only if not themed,
+  // and not being used to drag tabs between browser windows). The gray is
+  // somewhat opaque for Incognito mode, very opaque for non-Incognito mode, and
+  // completely opaque when the window is not active.
+  if (themeProvider && !hasCustomThemeImage && isModeMaterial &&
+      !inATabDraggingOverlayWindow_) {
     NSColor* theColor = nil;
     if (isMainWindow) {
-      // The vibrancy overlay makes the Incognito NSVisualEffectView
-      // somewhat darker, and the non-Incognito NSVisualEffectView much darker.
       if (supportsVibrancy &&
           !themeProvider->HasCustomColor(ThemeProperties::COLOR_FRAME)) {
         theColor = themeProvider->GetNSColor(
@@ -131,7 +136,6 @@
         theColor = themeProvider->GetNSColor(ThemeProperties::COLOR_FRAME);
       }
     } else {
-      // Inactive MD windows always draw a solid color.
       theColor = themeProvider->GetNSColor(
           ThemeProperties::COLOR_FRAME_INACTIVE);
     }
diff --git a/chrome/browser/ui/cocoa/tabs/tab_window_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_window_controller.mm
index db17dac8..01dcdc0 100644
--- a/chrome/browser/ui/cocoa/tabs/tab_window_controller.mm
+++ b/chrome/browser/ui/cocoa/tabs/tab_window_controller.mm
@@ -178,6 +178,7 @@
     // content view (rather than using setContentView:) because the overlay
     // window has a different content size (due to it being borderless).
     [[overlayWindow_ contentView] addSubview:[self tabStripView]];
+    [[self tabStripView] setInATabDraggingOverlayWindow:YES];
     [[overlayWindow_ contentView] addSubview:originalContentView_];
 
     [overlayWindow_ orderFront:nil];
@@ -193,6 +194,7 @@
                           relativeTo:nil];
     originalContentView_.frame = [[window contentView] bounds];
     [[window contentView] addSubview:[self tabStripView]];
+    [[self tabStripView] setInATabDraggingOverlayWindow:NO];
     [[window contentView] updateTrackingAreas];
 
     [focusBeforeOverlay_ restoreFocusInWindow:window];
diff --git a/chrome/browser/ui/cocoa/toolbar/toolbar_button_cocoa.mm b/chrome/browser/ui/cocoa/toolbar/toolbar_button_cocoa.mm
index e072674..3c22955 100644
--- a/chrome/browser/ui/cocoa/toolbar/toolbar_button_cocoa.mm
+++ b/chrome/browser/ui/cocoa/toolbar/toolbar_button_cocoa.mm
@@ -90,13 +90,13 @@
       fillColor = [NSColor colorWithCalibratedWhite:0 alpha:0.08];
       break;
     case ToolbarButtonImageBackgroundStyle::HOVER_THEMED:
-      fillColor = [NSColor colorWithCalibratedWhite:1 alpha:0.08];
+      fillColor = [NSColor colorWithCalibratedWhite:1 alpha:0.12];
       break;
     case ToolbarButtonImageBackgroundStyle::PRESSED:
       fillColor = [NSColor colorWithCalibratedWhite:0 alpha:0.12];
       break;
     case ToolbarButtonImageBackgroundStyle::PRESSED_THEMED:
-      fillColor = [NSColor colorWithCalibratedWhite:1 alpha:0.12];
+      fillColor = [NSColor colorWithCalibratedWhite:1 alpha:0.16];
       break;
   }
 
diff --git a/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc b/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc
index b4506f5..8686553f 100644
--- a/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc
+++ b/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc
@@ -324,13 +324,23 @@
 
 #if defined(OS_CHROMEOS)
 void AddDeviceStrings(content::WebUIDataSource* html_source) {
-  LocalizedString localized_strings[] = {
+  LocalizedString device_strings[] = {
       {"devicePageTitle", IDS_SETTINGS_DEVICE_TITLE},
+      {"scrollLabel", IDS_SETTINGS_SCROLL_LABEL},
+      {"traditionalScrollLabel", IDS_SETTINGS_TRADITIONAL_SCROLL_LABEL},
+  };
+  AddLocalizedStringsBulk(html_source, device_strings,
+                          arraysize(device_strings));
+
+  LocalizedString touchpad_strings[] = {
       {"touchpadTitle", IDS_SETTINGS_TOUCHPAD_TITLE},
       {"touchpadTapToClickEnabledLabel",
        IDS_SETTINGS_TOUCHPAD_TAP_TO_CLICK_ENABLED_LABEL},
-      {"scrollLabel", IDS_SETTINGS_SCROLL_LABEL},
-      {"traditionalScrollLabel", IDS_SETTINGS_TRADITIONAL_SCROLL_LABEL},
+  };
+  AddLocalizedStringsBulk(html_source, touchpad_strings,
+                          arraysize(touchpad_strings));
+
+  LocalizedString keyboard_strings[] = {
       {"keyboardTitle", IDS_SETTINGS_KEYBOARD_TITLE},
       {"keyboardKeySearch", IDS_SETTINGS_KEYBOARD_KEY_SEARCH},
       {"keyboardKeyCtrl", IDS_SETTINGS_KEYBOARD_KEY_LEFT_CTRL},
@@ -343,8 +353,21 @@
       {"keyboardSendFunctionKeysDescription",
        IDS_SETTINGS_KEYBOARD_SEND_FUNCTION_KEYS_DESCRIPTION},
   };
-  AddLocalizedStringsBulk(html_source, localized_strings,
-                          arraysize(localized_strings));
+  AddLocalizedStringsBulk(html_source, keyboard_strings,
+                          arraysize(keyboard_strings));
+
+  LocalizedString display_strings[] = {
+      {"devicePageTitle", IDS_SETTINGS_DEVICE_TITLE},
+      {"displayTitle", IDS_SETTINGS_DISPLAY_TITLE},
+      {"displayArrangement", IDS_SETTINGS_DISPLAY_ARRANGEMENT},
+      {"displayMirror", IDS_SETTINGS_DISPLAY_MIRROR},
+      {"displayMakePrimary", IDS_SETTINGS_DISPLAY_MAKE_PRIMARY},
+      {"displayResolution", IDS_SETTINGS_DISPLAY_RESOLUTION},
+      {"displayOrientation", IDS_SETTINGS_DISPLAY_ORIENTATION},
+      {"displayOrientationStandard", IDS_SETTINGS_DISPLAY_ORIENTATION_STANDARD},
+  };
+  AddLocalizedStringsBulk(html_source, display_strings,
+                          arraysize(display_strings));
 
   html_source->AddString(
       "naturalScrollLabel",
diff --git a/chrome/common/extensions/api/networking_private/networking_private_crypto.cc b/chrome/common/extensions/api/networking_private/networking_private_crypto.cc
index c3f82fe..9e71464 100644
--- a/chrome/common/extensions/api/networking_private/networking_private_crypto.cc
+++ b/chrome/common/extensions/api/networking_private/networking_private_crypto.cc
@@ -50,6 +50,19 @@
     const std::string& signature,
     const std::string& data,
     const std::string& connected_mac) {
+  base::Time::Exploded now;
+  base::Time::Now().UTCExplode(&now);
+  return VerifyCredentialsAtTime(certificate, intermediate_certificates,
+                                 signature, data, connected_mac, now);
+}
+
+bool VerifyCredentialsAtTime(
+    const std::string& certificate,
+    const std::vector<std::string>& intermediate_certificates,
+    const std::string& signature,
+    const std::string& data,
+    const std::string& connected_mac,
+    const base::Time::Exploded& time) {
   static const char kErrorPrefix[] = "Device verification failed. ";
 
   std::vector<std::string> headers;
@@ -61,29 +74,30 @@
     LOG(ERROR) << kErrorPrefix << "Failed to parse device certificate.";
     return false;
   }
-  std::string der_certificate = pem_tokenizer.data();
+
+  // |certs| is a vector with the DER for all the certificates.
+  std::vector<std::string> certs;
+  certs.push_back(pem_tokenizer.data());
 
   // Convert intermediate certificates from PEM to raw DER
-  std::vector<std::string> der_intermediate_certificates;
   for (size_t idx = 0; idx < intermediate_certificates.size(); ++idx) {
     net::PEMTokenizer ica_pem_tokenizer(intermediate_certificates[idx],
                                         headers);
     if (ica_pem_tokenizer.GetNext()) {
-      der_intermediate_certificates.push_back(ica_pem_tokenizer.data());
+      certs.push_back(ica_pem_tokenizer.data());
     } else {
       LOG(WARNING) << "Failed to parse intermediate certificates.";
     }
   }
 
-  // Verify device certificate
-  scoped_ptr<cast_crypto::CertVerificationContext> verification_context;
-  cast_crypto::VerificationResult verification_result =
-      cast_crypto::VerifyDeviceCert(der_certificate,
-                                    der_intermediate_certificates,
-                                    &verification_context);
+  // Note that the device certificate's policy is not enforced here. The goal
+  // is simply to verify that the device belongs to the Cast ecosystem.
+  cast_crypto::CastDeviceCertPolicy unused_policy;
 
-  if (verification_result.Failure()) {
-    LOG(ERROR) << kErrorPrefix << verification_result.error_message;
+  scoped_ptr<cast_crypto::CertVerificationContext> verification_context;
+  if (!cast_crypto::VerifyDeviceCert(certs, time, &verification_context,
+                                     &unused_policy)) {
+    LOG(ERROR) << kErrorPrefix << "Failed verifying cast device cert";
     return false;
   }
 
@@ -100,11 +114,9 @@
 
   // Use the public key from verified certificate to verify |signature| over
   // |data|.
-  verification_result =
-      verification_context->VerifySignatureOverData(signature, data);
-
-  if (verification_result.Failure()) {
-    LOG(ERROR) << kErrorPrefix << verification_result.error_message;
+  if (!verification_context->VerifySignatureOverData(signature, data)) {
+    LOG(ERROR) << kErrorPrefix
+               << "Failed verifying signature using cast device cert";
     return false;
   }
   return true;
diff --git a/chrome/common/extensions/api/networking_private/networking_private_crypto.h b/chrome/common/extensions/api/networking_private/networking_private_crypto.h
index ce6f317..c29241ea 100644
--- a/chrome/common/extensions/api/networking_private/networking_private_crypto.h
+++ b/chrome/common/extensions/api/networking_private/networking_private_crypto.h
@@ -10,6 +10,7 @@
 #include <string>
 #include <vector>
 
+#include "base/time/time.h"
 
 namespace networking_private_crypto {
 
@@ -26,6 +27,16 @@
     const std::string& data,
     const std::string& connected_mac);
 
+// The same as VerifyCredentials() above, but uses time |time| rather than the
+// current time for checking validity.
+bool VerifyCredentialsAtTime(
+    const std::string& certificate,
+    const std::vector<std::string>& intermediate_certificates,
+    const std::string& signature,
+    const std::string& data,
+    const std::string& connected_mac,
+    const base::Time::Exploded& time);
+
 // Encrypt |data| with |public_key|. |public_key| is a DER-encoded
 // RSAPublicKey. |data| is some string of bytes that is smaller than the
 // maximum length permissible for PKCS#1 v1.5 with a key of |public_key| size.
diff --git a/chrome/common/extensions/api/networking_private/networking_private_crypto_unittest.cc b/chrome/common/extensions/api/networking_private/networking_private_crypto_unittest.cc
index a81d1802..06a0c74 100644
--- a/chrome/common/extensions/api/networking_private/networking_private_crypto_unittest.cc
+++ b/chrome/common/extensions/api/networking_private/networking_private_crypto_unittest.cc
@@ -35,154 +35,192 @@
 
 // Test that networking_private_crypto::VerifyCredentials behaves as expected.
 TEST_F(NetworkingPrivateCryptoTest, VerifyCredentials) {
-  std::string keys =
-      "CrMCCiBSnZzWf+XraY5w3SbX2PEmWfHm5SNIv2pc9xbhP0EOcxKOAjCCAQoCggEBALwigL2A"
-      "9johADuudl41fz3DZFxVlIY0LwWHKM33aYwXs1CnuIL638dDLdZ+q6BvtxNygKRHFcEgmVDN"
-      "7BRiCVukmM3SQbY2Tv/oLjIwSoGoQqNsmzNuyrL1U2bgJ1OGGoUepzk/SneO+1RmZvtYVMBe"
-      "Ocf1UAYL4IrUzuFqVR+LFwDmaaMn5gglaTwSnY0FLNYuojHetFJQ1iBJ3nGg+a0gQBLx3SXr"
-      "1ea4NvTWj3/KQ9zXEFvmP1GKhbPz//YDLcsjT5ytGOeTBYysUpr3TOmZer5ufk0K48YcqZP6"
-      "OqWRXRy9ZuvMYNyGdMrP+JIcmH1X+mFHnquAt+RIgCqSxRsCAwEAAQqzAgogmNZt6BxWR4RN"
-      "lkNNN8SNws5/CHJQGee26JJ/VtaBqhgSjgIwggEKAoIBAQC8IoC9gPY6IQA7rnZeNX89w2Rc"
-      "VZSGNC8FhyjN92mMF7NQp7iC+t/HQy3Wfqugb7cTcoCkRxXBIJlQzewUYglbpJjN0kG2Nk7/"
-      "6C4yMEqBqEKjbJszbsqy9VNm4CdThhqFHqc5P0p3jvtUZmb7WFTAXjnH9VAGC+CK1M7halUf"
-      "ixcA5mmjJ+YIJWk8Ep2NBSzWLqIx3rRSUNYgSd5xoPmtIEAS8d0l69XmuDb01o9/ykPc1xBb"
-      "5j9RioWz8//2Ay3LI0+crRjnkwWMrFKa90zpmXq+bn5NCuPGHKmT+jqlkV0cvWbrzGDchnTK"
-      "z/iSHJh9V/phR56rgLfkSIAqksUbAgMBAAE=";
-  std::string signature =
-      "eHMoa7dP2ByNtDnxM/Q6yV3ZyUyihBFgOthq937yuiu2uwW2X/i8h1YrJFaWrA0iTTfSLAa6"
-      "PBAN1hhnwXlWYy8MvViJ9eJqf5FfCCkOjdRN0QIFPpmIJm/EcIv91bNMWnOGANgSW1Hons+s"
-      "C0/kROPbPABPLLwfgGizBDSZNapxgj8G+iDvi1JRRvvNdmjUs2AUIPNrSp3Knt3FyZ5F2Smk"
-      "Khpo7XVTWgSuWOzUJu6zNHn2krm64Ymd2HxRDyKTm1DBzy1MoXv4/8mbLYdj+KAvhqKJfRcr"
-      "GkUXVK++wCHERwxcvfk7e6lN6adcCVYP9pZPMhE/UyAJY6/uE1X0cw==";
-  EXPECT_TRUE(
-      cast_crypto::SetTrustedCertificateAuthoritiesForTest(keys, signature));
-
   static const char kCertData[] =
       "-----BEGIN CERTIFICATE-----"
-      "MIIDhzCCAm8CBFE2SCMwDQYJKoZIhvcNAQEFBQAwfTELMAkGA1UEBhMCVVMxEzARBgNVBAgM"
-      "CkNhbGlmb3JuaWExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxEzARBgNVBAoMCkdvb2dsZSBJ"
-      "bmMxEjAQBgNVBAsMCUdvb2dsZSBUVjEYMBYGA1UEAwwPRXVyZWthIEdlbjEgSUNBMB4XDTEz"
-      "MDMwNTE5MzE0N1oXDTMzMDIyODE5MzE0N1owgYMxFjAUBgNVBAcTDU1vdW50YWluIFZpZXcx"
-      "EjAQBgNVBAsTCUdvb2dsZSBUVjETMBEGA1UEChMKR29vZ2xlIEluYzETMBEGA1UECBMKQ2Fs"
-      "aWZvcm5pYTELMAkGA1UEBhMCVVMxHjAcBgNVBAMUFWV2dF9lMTYxIDAwMWExMWZmYWNkZjCC"
-      "ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAPHGDV0lLoTYK78q13y/2u77YTjgbBlW"
-      "AOxgrSNcMmGHx1K0aPyo50p99dGQnjapW6jtGrMzReWV2Wz3VL8rYlqY7oWjeJwsLQwo2tcn"
-      "7vIZ/PuvPz9xgnGMUbBOfhCf3Epb1N4Jz82pxxrOFhUawWAglC9C4fUeZLCZpOJsQd4QeAzn"
-      "kydl3xbqdSm74kwxE6vkGEzSCDnC7aYx0Rvvr1mZOKdl4AinYrxzWgmVsTnaFT1soSjmC5e/"
-      "i6Jcrs4dDFgY6mKy9Qtly2XPSCYljm6L4SgqgJNmlpY0qYJgO++BdofIbU2jsOiCMvIuKkbM"
-      "n72NsPQG0QhnVMwk7kYg6kkCAwEAAaMNMAswCQYDVR0TBAIwADANBgkqhkiG9w0BAQUFAAOC"
-      "AQEAW0bQl9yjBc7DgMp94i7ZDOUxKQrzthephuwzb3/wWiTHcw6KK6FRPefXn6NPWxKKeQmv"
-      "/tBxHbVlmYRXUbrhksnD0aUki4InvtL2m0H1fPfMxmJRFE+HoSXu+s0sGON831JaMcYRbAku"
-      "5uHnltaGNzOI0KPHFGoCDmjAZD+IuoR2LR4FuuTrECK7KLjkdf//z5d5j7nBDPZS7uTCwC/B"
-      "wM9asRj3tJA5VRFbLbsit1VI7IaRCk9rsSKkpBUaVeKbPLz+y/Z6JonXXT6AxsfgUSKDd4B7"
-      "MYLrTwMQfGuUaaaKko6ldKIrovjrcPloQr1Hxb2bipFcjLmG7nxQLoS6vQ=="
+      "MIIECjCCAvKgAwIBAgIBbTANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCVVMx"
+      "EzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxEzAR"
+      "BgNVBAoMCkdvb2dsZSBJbmMxDTALBgNVBAsMBENhc3QxIjAgBgNVBAMMGUF1ZGlv"
+      "IFJlZmVyZW5jZSBEZXYgTW9kZWwwHhcNMTYwMTIyMDYxMjU3WhcNMTYwNTAxMDYx"
+      "MjU3WjCBgTELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNV"
+      "BAcMDU1vdW50YWluIFZpZXcxEzARBgNVBAoMCkdvb2dsZSBJbmMxDTALBgNVBAsM"
+      "BENhc3QxITAfBgNVBAMMGEF1ZGlvIFJlZmVyZW5jZSBEZXYgVGVzdDCCASIwDQYJ"
+      "KoZIhvcNAQEBBQADggEPADCCAQoCggEBAKUks+y3cbT3MxuYrD10pEfGHVKfeWRY"
+      "1a2Ef6XyvSRD38cRrsDLzW9IEdpb2UOsvyusJ4HpqdQEs6xbl2wuwsqY63gUoWdj"
+      "kdWoKRoz5/vs0SfjwefN/8wuxs/wrV/UVycNoYvvYCwdERG7THrFGB8gINvsg4gv"
+      "h2lLDH1zJk9GYyTeIAWDpV08WotNKN5XUxigyFRPpymxLV3PW9qUiMInkXQjJAEt"
+      "dVFE5qRqAiGm7vxF72/0UywYzotrBka4VN7MUsOGzlN6kAFdFMjor+zNngsa7pbl"
+      "K/0Ew4uy5PhzGGQMhDU71kbT8nJVBvwymd8UyRpARe5hjIKrYmt+VTUCAwEAAaOB"
+      "iTCBhjAJBgNVHRMEAjAAMB0GA1UdDgQWBBRxGT9wLjw1GOGVKmzE7N9BmeHk/zAf"
+      "BgNVHSMEGDAWgBRgKi+tSIAsd/ynRBV9W+ebY6oR/jALBgNVHQ8EBAMCB4AwEwYD"
+      "VR0lBAwwCgYIKwYBBQUHAwIwFwYDVR0gBBAwDjAMBgorBgEEAdZ5AgUCMA0GCSqG"
+      "SIb3DQEBCwUAA4IBAQBOyNW90Wim20HXLi87BWTeISEEaGlWL9ptUPk7OaE04eRl"
+      "LJYUfWhNMYZdJm8gck7zlrM/lvDja/P+GD9YxyoXVQOvRJB9WTRRTGPceLXAqAw+"
+      "Ap7w8hdgw6bDlsUEisBAgX6RCo0Dr57wWd9qu83nUCQK8MYgjV6RjHWR3rc9YjOd"
+      "lh8KIb6kGSTcgbMC5WpbLVLYxOCyUHSpN1M/fSXxGYGgQJx/bZFF0LZQEn+9lU1w"
+      "AMzYwb6kjlRzqERQDebw7knPkhlDL9CHYNHdEEkYoQOqD0DGaxR5vaqB2QYJiN5B"
+      "/lQ8TqmvSr6pssHaknPh+jvohhtVMeee94VGlq2A"
       "-----END CERTIFICATE-----";
-  static const char kICAData[] =
+
+  static const char kICA1Data[] =
       "-----BEGIN CERTIFICATE-----"
-      "MIIDzTCCArWgAwIBAgIBAzANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQGEwJVUzET"
+      "MIID9jCCAt6gAwIBAgIBbDANBgkqhkiG9w0BAQsFADB/MQswCQYDVQQGEwJVUzET"
+      "MBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzETMBEG"
+      "A1UECgwKR29vZ2xlIEluYzENMAsGA1UECwwEQ2FzdDEfMB0GA1UEAwwWQ2FzdCBB"
+      "dWRpbyBEZXYgUm9vdCBDQTAeFw0xNjAxMjIwNjEyNDVaFw0xNjA1MDEwNjEyNDVa"
+      "MIGCMQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwN"
+      "TW91bnRhaW4gVmlldzETMBEGA1UECgwKR29vZ2xlIEluYzENMAsGA1UECwwEQ2Fz"
+      "dDEiMCAGA1UEAwwZQXVkaW8gUmVmZXJlbmNlIERldiBNb2RlbDCCASIwDQYJKoZI"
+      "hvcNAQEBBQADggEPADCCAQoCggEBAOaUGMZIMbWpqbcotxcyBOUMgyZzvJf46OF8"
+      "LuQjV+ZCDwuvL5aw2aVL24lZlJpS4xC16Us4vnkKSuxPkL3rO6/gg/eYNxtX4JFy"
+      "m9jaggk6nPAKxu/9kqOz5JIqaCM3itWmm9uavWjOKh6DDo1LsFLwPB9+3ZSHBkVb"
+      "uwxSUO3TcZsoUaftCfwsUnm7mKV+F0jB8jOQSwMbKBcRQOHEkz+FUfHJoecjE22B"
+      "p4a5xGAArVEulrNBrKkem5MYEfNr6Dq608n5fgLrxr+V3LYk+9dcjxZbFD2aMQ8L"
+      "pD7smT9NvOR/H2bWkddeFclgsWVkXKuhCTI/Z5p25vqqBwU6DJUCAwEAAaN5MHcw"
+      "DwYDVR0TBAgwBgEB/wIBADAdBgNVHQ4EFgQUYCovrUiALHf8p0QVfVvnm2OqEf4w"
+      "HwYDVR0jBBgwFoAUT5PquKZgr6uos163pjd+Zr1DvAYwCwYDVR0PBAQDAgEGMBcG"
+      "A1UdIAQQMA4wDAYKKwYBBAHWeQIFAjANBgkqhkiG9w0BAQsFAAOCAQEAJmkzx4JN"
+      "/g6n9VtpphzrLGpIK9vhrkC/+8SdU3Et5nRAfPbxwBaYcOIVlDhmnjFU15kz4Mpm"
+      "xRzdLdL/nnbBf2mssIn3RXD/J1/+7BClM2Ew/B0NStJ0aRV8gN+t6hkOmZz6Ikjn"
+      "dYaeAUvS1jCCskSCEE1hwQE3aJ8dAddng4V+bZiIO72LCHUMb+BywWIzEqlLeTnY"
+      "Th/2240ZdTIzwYpLD+A6+ft6uJFJTtv1E0tT3EJ5kDzrkZoQTwJbWR7YgK6UjafH"
+      "/9WmhhymOsmVnw43xJ0cEwWonitX8xq6wv3VWJvlYmJ6i0MMwktNTzVedaHa9nN/"
+      "zgfBYe0mPzwEvQ=="
+      "-----END CERTIFICATE-----";
+
+  static const char kICA2Data[] =
+      "-----BEGIN CERTIFICATE-----"
+      "MIID6DCCAtCgAwIBAgIBZDANBgkqhkiG9w0BAQsFADB1MQswCQYDVQQGEwJVUzET"
       "MBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzETMBEG"
       "A1UECgwKR29vZ2xlIEluYzENMAsGA1UECwwEQ2FzdDEVMBMGA1UEAwwMQ2FzdCBS"
-      "b290IENBMB4XDTE0MDQwMjIwNTg1NFoXDTE5MDQwMjIwNTg1NFowfTELMAkGA1UE"
+      "b290IENBMB4XDTE2MDEyMjA2MTAyN1oXDTE2MDUwMTA2MTAyN1owfzELMAkGA1UE"
       "BhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDU1vdW50YWluIFZp"
-      "ZXcxEzARBgNVBAoMCkdvb2dsZSBJbmMxEjAQBgNVBAsMCUdvb2dsZSBUVjEYMBYG"
-      "A1UEAwwPRXVyZWthIEdlbjEgSUNBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB"
-      "CgKCAQEAvCKAvYD2OiEAO652XjV/PcNkXFWUhjQvBYcozfdpjBezUKe4gvrfx0Mt"
-      "1n6roG+3E3KApEcVwSCZUM3sFGIJW6SYzdJBtjZO/+guMjBKgahCo2ybM27KsvVT"
-      "ZuAnU4YahR6nOT9Kd477VGZm+1hUwF45x/VQBgvgitTO4WpVH4sXAOZpoyfmCCVp"
-      "PBKdjQUs1i6iMd60UlDWIEnecaD5rSBAEvHdJevV5rg29NaPf8pD3NcQW+Y/UYqF"
-      "s/P/9gMtyyNPnK0Y55MFjKxSmvdM6Zl6vm5+TQrjxhypk/o6pZFdHL1m68xg3IZ0"
-      "ys/4khyYfVf6YUeeq4C35EiAKpLFGwIDAQABo2AwXjAPBgNVHRMECDAGAQH/AgEA"
-      "MB0GA1UdDgQWBBQyr35sod0oQuWz4VmnWjnJ/4pinzAfBgNVHSMEGDAWgBR8mh59"
-      "33lUvNfMXsqZhkV5ZXQoGTALBgNVHQ8EBAMCAQYwDQYJKoZIhvcNAQEFBQADggEB"
-      "ABPENY9iGt6qsc5yq4JOO6EEqYbKVtkSf1AqW2yJc4M4EZ65eA6bpj9EVIKvDxYq"
-      "NI7q40f7jCXiS+Y73OXFaC3Xue8+DV7WVjAvf9QYy79ohnbqadA4U/Sb7vw4AzwT"
-      "KCMlH2fUJ5PCNFfTj6lAkeZOhxtegnEMTIB8zvXEb42H0hN4UxRRhCeKS9tIlAmI"
-      "Ql1ib0jTDDN6IgQYslrx0dyZzBAsRocq/d3ycXX71iMykoIHZ7rNJ2bDMddRdFk2"
-      "D0Ljj4fZjrQNyD4mot/9mqSrF1Q2/AdWQO3pJONcXRWRynJ4Ian3sWdq2B5Dq8Iz"
-      "kqrjM7lOq9YEQ+hMRdmOHP4="
+      "ZXcxEzARBgNVBAoMCkdvb2dsZSBJbmMxDTALBgNVBAsMBENhc3QxHzAdBgNVBAMM"
+      "FkNhc3QgQXVkaW8gRGV2IFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw"
+      "ggEKAoIBAQC5hu6BmwfxxhVqMB5BvTtw9JaIfffTKWM9uMqh7D2BQwiFKzBfS2tU"
+      "GamSRpiaLir/nfNIsl3WCpxJgWpjGhLnjjw5dGdnx9XU83xFZQeEFbHfCxYNId5x"
+      "JLCIAIppz65wJIJkYEjIWlKGUHM24CRTXOhYE3opuIqoOWiYEr+fN99gZ+A/H/re"
+      "t9GkF8PCxbW+15jhPQ1ZZuUHSZq7nk/zNzg33wwZi839LPz1qQlrStMTIo/9+WTl"
+      "LF++WqWEMpzlKnP13KpXwn8+1nyfVfAonCG65plh/DkNMawUncGXtejOlxsZuMCu"
+      "UhoqRnos+MQYfWpzEiDsOUfg3uPVjYIPAgMBAAGjeTB3MA8GA1UdEwQIMAYBAf8C"
+      "AQEwHQYDVR0OBBYEFE+T6rimYK+rqLNet6Y3fma9Q7wGMB8GA1UdIwQYMBaAFHya"
+      "Hn3feVS818xeypmGRXlldCgZMAsGA1UdDwQEAwIBBjAXBgNVHSAEEDAOMAwGCisG"
+      "AQQB1nkCBQIwDQYJKoZIhvcNAQELBQADggEBALhO43XjmlqcZdNa3sMSHLxbl1ip"
+      "wRdTcRzaR7REUVnr05dWubZNy7q3h7jeGDP0eML5eyULy25qbN+g4IhPCCXssfVf"
+      "JNRHxspPx4a4hOrp0/Wybfq2HqL+r6xhkfB7GppSxYrWuZ8bTArlDEW529GXmW/M"
+      "7qbWQc7Uz2OI5AHuBadhbOhBvSlZVKu0lPccMMLqi5ie585qAiim1mHp6VgjKtUh"
+      "LAFi+BHdbo4txcau+onG/dngYr70/35YFcrb08vakkVp1EbGSLqWp+++nicIdZKU"
+      "hciORE5xdaHj9l4lWYBdng8Bfm1Bci2uLVaxbdayk/xsBSLfKA8JYmFlRi0="
       "-----END CERTIFICATE-----";
-  static const char kName[] = "eureka8997";
-  static const char kSsdpUdn[] = "c5b2a83b-5958-7ce6-b179-e1f44699429b";
-  static const char kHotspotBssid[] = "00:1A:11:FF:AC:DF";
-  static const char kPublicKey[] =
-      "MIGJAoGBAK3SXmWZBOhJibv8It05qIbgHXXhnCXxHkW+C6jNMHR5sZgDpFaOY1xwXERjKdJx"
-      "cwrEy3VAT5Uv9MgHPBvxxJku76HYh1yVfIw1rhLnHBTHSxwUzJNCrgc3l3t/UACacLjVNIzc"
-      "cDpYf2vnOcA+t1t6IXRjzuU2NdwY4dJXNtWPAgMBAAE=";
-  static const char kNonce[] = "+6KSGuRu833m1+TP";
-  static const char kSignedData[] =
-      "vwMBgANrp5XpCswLyk/OTXT56ORPeIWjH7xAdCk3qgjkwI6+8o56zJS02+tC5hhIHWh7oppT"
-      "mWYF4tKvBQ3GeCz7IW9f7HWDMtO7x7yRWxzJyehaJbCfXvLdfs0/WKllzvGVBgNpcIAwU2NS"
-      "FUG/jpXclntFzds0EUJG9wHxS6PXXSYRu+PlIFdCDcQJsUlnwO9AGFOJRV/aARGh8YUTWCFI"
-      "QPOtPEqT5eegt+TLf01Gq0YcrRwSTKy1I3twOnWiMfIdkJdQKPtBwwbvuAyGuqYFocfjKABb"
-      "nH9Tvl04yyO3euKbYlSqaF/l8CXmzDJTyO7tDOFK59bV9auE4KljrQ==";
-  static const char kBadSubjectCertData[] =
-      "-----BEGIN CERTIFICATE-----"
-      "MIIDejCCAmICBFEtN4wwDQYJKoZIhvcNAQEFBQAwfTELMAkGA1UEBhMCVVMxEzARBgNVBAgM"
-      "CkNhbGlmb3JuaWExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxEzARBgNVBAoMCkdvb2dsZSBJ"
-      "bmMxEjAQBgNVBAsMCUdvb2dsZSBUVjEYMBYGA1UEAwwPRXVyZWthIEdlbjEgSUNBMB4XDTEz"
-      "MDIyNjIyMzAzNloXDTMzMDIyMTIyMzAzNlowdzETMBEGA1UECBMKQ2FsaWZvcm5pYTELMAkG"
-      "A1UEBhMCVVMxFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxEjAQBgNVBAsTCUdvb2dsZSBUVjET"
-      "MBEGA1UEChMKR29vZ2xlIEluYzESMBAGA1UEAxQJZXZ0X2UxMjYyMIIBIjANBgkqhkiG9w0B"
-      "AQEFAAOCAQ8AMIIBCgKCAQEAo7Uu+bdyCjtiUYpmNU4ZvRjDg6VkEh/g0YPDG2pICBU4XKvs"
-      "qHH1i0hbtWp1J79hV9Rqst1yHT02Oeh3o1SOd2zeamYzmvXRVN7AZqfQlzWxwxk/ltpXGwew"
-      "m+EIR2bP4kpvyEKvvziTMtTxviOK+A395QyodMhMXClKTus/Gme2r1fBoQqJJR/zrmwXCsl5"
-      "kpdhj7FOIII3BCYV0zejjQquzywjsKfCVON28VGgJdaKgmXxkeRYYWVNnuTNna57vXe16FP6"
-      "hS1ty1U77ESffLTpNJ/M4tsd2dMVVTDuGeX3q8Ix4TN8cqpqu1AKEf59hygys9j6cHZRKR/d"
-      "iv0+uQIDAQABow0wCzAJBgNVHRMEAjAAMA0GCSqGSIb3DQEBBQUAA4IBAQAZx6XyEK9SLHE+"
-      "rbKCVsLN9+hTEa50aikPmxOZt+lFuB4+VJZ/GCPQCZJIde2tlWUe2YBgoZw2xUKgIsM3Yq42"
-      "Gawi35/oZ3qycTgYU8KJP9kUMbYNAH90mz9BDH7MmnRID5dFexHyBCG88EJ+ZvxmUVn0EVDc"
-      "sSMt11wIAZ/T+/gsE1120d/GxhjYQ9YZz7SZXBQfRdqCdcPNl2+QSHHl+WvYLzdJa2xYj39/"
-      "kQu47Vp7X5rZrHSBvzdVymH0Od2D18t+Q6lxbSdyUNhP1MVhdkT1Ct4OmRS3FJ4aannXMhfq"
-      "Ng7k4Sfif5iktYT4VRKpThe0EGJNfqKJKYtvHEVC"
-      "-----END CERTIFICATE-----";
+
+  unsigned char kData[] = {
+      0x5f, 0x76, 0x0d, 0xc8, 0x4b, 0xe7, 0x6e, 0xcb, 0x31, 0x58, 0xca, 0xd3,
+      0x7d, 0x23, 0x55, 0xbe, 0x8d, 0x52, 0x87, 0x83, 0x27, 0x52, 0x78, 0xfa,
+      0xa6, 0xdd, 0xdf, 0x13, 0x00, 0x51, 0x57, 0x6a, 0x83, 0x15, 0xcc, 0xc5,
+      0xb2, 0x5c, 0xdf, 0xe6, 0x81, 0xdc, 0x13, 0x58, 0x7b, 0x94, 0x0f, 0x69,
+      0xcc, 0xdf, 0x68, 0x41, 0x8a, 0x95, 0xe2, 0xcd, 0xf8, 0xde, 0x0f, 0x2f,
+      0x30, 0xcf, 0x73, 0xbf, 0x37, 0x52, 0x87, 0x23, 0xd7, 0xbe, 0xba, 0x7c,
+      0xde, 0x50, 0xd3, 0x77, 0x9c, 0x06, 0x82, 0x28, 0x67, 0xc1, 0x1a, 0xf5,
+      0x8a, 0xa0, 0xf2, 0x32, 0x09, 0x95, 0x41, 0x41, 0x93, 0x8e, 0x62, 0xaa,
+      0xf3, 0xe3, 0x22, 0x17, 0x43, 0x94, 0x9b, 0x63, 0xfa, 0x68, 0x20, 0x69,
+      0x38, 0xf6, 0x75, 0x6c, 0xe0, 0x3b, 0xe0, 0x8d, 0x63, 0xac, 0x7f, 0xe3,
+      0x09, 0xd8, 0xde, 0x91, 0xc8, 0x1e, 0x07, 0x4a, 0xb2, 0x1e, 0xe1, 0xe3,
+      0xf4, 0x4d, 0x3e, 0x8a, 0xf4, 0xf8, 0x83, 0x39, 0x2b, 0x50, 0x98, 0x61,
+      0x91, 0x50, 0x00, 0x34, 0x57, 0xd2, 0x0d, 0xf7, 0xfa, 0xc9, 0xcc, 0xd9,
+      0x7a, 0x3d, 0x39, 0x7a, 0x1a, 0xbd, 0xf8, 0xbe, 0x65, 0xb6, 0xea, 0x4e,
+      0x86, 0x74, 0xdd, 0x51, 0x74, 0x6e, 0xa6, 0x7f, 0x14, 0x6c, 0x6a, 0x46,
+      0xb8, 0xaf, 0xcd, 0x6c, 0x78, 0x43, 0x76, 0x47, 0x5b, 0xdc, 0xb6, 0xf6,
+      0x4d, 0x1b, 0xe0, 0xb5, 0xf9, 0xa2, 0xb8, 0x26, 0x3f, 0x3f, 0xb8, 0x80,
+      0xed, 0xce, 0xfd, 0x0e, 0xcb, 0x48, 0x7a, 0x3b, 0xdf, 0x92, 0x44, 0x04,
+      0x81, 0xe4, 0xd3, 0x1e, 0x07, 0x9b, 0x02, 0xae, 0x05, 0x5a, 0x11, 0xf2,
+      0xc2, 0x75, 0x85, 0xd5, 0xf1, 0x53, 0x4c, 0x09, 0xd0, 0x99, 0xf8, 0x3e,
+      0xf6, 0x24, 0x46, 0xae, 0x83, 0x35, 0x3e, 0x6c, 0x8c, 0x2a, 0x9f, 0x1c,
+      0x5b, 0xfb, 0x89, 0x56};
+
+  unsigned char kSignature[] = {
+      0x52, 0x56, 0xcd, 0x53, 0xfa, 0xd9, 0x44, 0x31, 0x00, 0x2e, 0x85, 0x18,
+      0x56, 0xae, 0xf9, 0xf2, 0x70, 0x16, 0xc9, 0x59, 0x53, 0xc0, 0x17, 0xd9,
+      0x09, 0x65, 0x75, 0xee, 0xba, 0xc8, 0x0d, 0x06, 0x2e, 0xb7, 0x1b, 0xd0,
+      0x6a, 0x4d, 0x58, 0xde, 0x8e, 0xbe, 0x92, 0x22, 0x53, 0x19, 0xbf, 0x74,
+      0x8f, 0xb8, 0xfc, 0x3c, 0x9b, 0x42, 0x14, 0x7d, 0xe1, 0xfc, 0xa3, 0x71,
+      0x91, 0x6c, 0x5d, 0x28, 0x69, 0x8d, 0xd2, 0xde, 0xd1, 0x8f, 0xac, 0x6d,
+      0xf6, 0x48, 0xd8, 0x6f, 0x0e, 0xc9, 0x0a, 0xfa, 0xde, 0x20, 0xe0, 0x9d,
+      0x7a, 0xf8, 0x30, 0xa8, 0xd4, 0x79, 0x15, 0x63, 0xfb, 0x97, 0xa9, 0xef,
+      0x9f, 0x9c, 0xac, 0x16, 0xba, 0x1b, 0x2c, 0x14, 0xb4, 0xa4, 0x54, 0x5e,
+      0xec, 0x04, 0x10, 0x84, 0xc2, 0xa0, 0xd9, 0x6f, 0x05, 0xd4, 0x09, 0x8c,
+      0x85, 0xe9, 0x7a, 0xd1, 0x5a, 0xa3, 0x70, 0x00, 0x30, 0x9b, 0x19, 0x44,
+      0x2a, 0x90, 0x7a, 0xcd, 0x91, 0x94, 0x90, 0x66, 0xf9, 0x2e, 0x5e, 0x43,
+      0x27, 0x33, 0x2c, 0x45, 0xa7, 0xe2, 0x3a, 0x6d, 0xc9, 0x44, 0x58, 0x39,
+      0x45, 0xcb, 0xbd, 0x2f, 0xc5, 0xb4, 0x08, 0x41, 0x4d, 0x45, 0x67, 0x55,
+      0x0d, 0x43, 0x3c, 0xb6, 0x81, 0xbb, 0xb4, 0x34, 0x07, 0x10, 0x28, 0x17,
+      0xc2, 0xad, 0x40, 0x3b, 0xaf, 0xcb, 0xc0, 0xf6, 0x9d, 0x0e, 0x9b, 0xca,
+      0x2b, 0x20, 0xdf, 0xd0, 0xa3, 0xbe, 0xea, 0x3e, 0xe0, 0x82, 0x7b, 0x93,
+      0xfd, 0x9c, 0xaf, 0x97, 0x00, 0x05, 0x44, 0x91, 0x73, 0x68, 0x92, 0x3a,
+      0x8b, 0xbc, 0x0e, 0x96, 0x5e, 0x92, 0x98, 0x70, 0xab, 0xaa, 0x6e, 0x9a,
+      0x8e, 0xb0, 0xf4, 0x92, 0xc5, 0xa0, 0xa0, 0x4b, 0xb3, 0xd5, 0x44, 0x99,
+      0x8e, 0xa1, 0xd1, 0x8f, 0xe3, 0xac, 0x71, 0x1e, 0x3f, 0xc2, 0xfd, 0x0a,
+      0x57, 0xed, 0xea, 0x04};
+
+  // TODO(eroman): This should look like 00:1A:11:FF:AC:DF. Instead this is
+  // using an existing test certificate. It works because the implementation is
+  // just doing a suffix test and not parsing the format.
+  static const char kHotspotBssid[] = "Reference Dev Test";
+
   static const char kBadCertData[] = "not a certificate";
-  static const char kBadNonce[] = "bad nonce";
   static const char kBadHotspotBssid[] = "bad bssid";
 
-  std::string unsigned_data = base::StringPrintf(
-      "%s,%s,%s,%s,%s", kName, kSsdpUdn, kHotspotBssid, kPublicKey, kNonce);
-  std::string signed_data;
-  base::Base64Decode(kSignedData, &signed_data);
+  // April 1, 2016
+  base::Time::Exploded time = {0};
+  time.year = 2016;
+  time.month = 4;
+  time.day_of_month = 1;
+
+  // September 1, 2035
+  base::Time::Exploded expired_time = {0};
+  expired_time.year = 2035;
+  expired_time.month = 9;
+  expired_time.day_of_month = 1;
+
+  std::string unsigned_data = std::string(std::begin(kData), std::end(kData));
+  std::string signed_data =
+      std::string(std::begin(kSignature), std::end(kSignature));
+
+  // Check that verification fails when the intermediaries are not provided.
+  EXPECT_FALSE(networking_private_crypto::VerifyCredentialsAtTime(
+      kCertData, std::vector<std::string>(), signed_data, unsigned_data,
+      kHotspotBssid, time));
 
   // Checking basic verification operation.
-  EXPECT_TRUE(networking_private_crypto::VerifyCredentials(
-      kCertData, std::vector<std::string>(), signed_data, unsigned_data,
-      kHotspotBssid));
-
-  // Checking verification operation with an ICA
   std::vector<std::string> icas;
-  icas.push_back(kICAData);
-  EXPECT_TRUE(networking_private_crypto::VerifyCredentials(
-      kCertData, icas, signed_data, unsigned_data, kHotspotBssid));
+  icas.push_back(kICA1Data);
+  icas.push_back(kICA2Data);
 
-  // Checking that verification fails when the certificate is signed, but
-  // subject is malformed.
-  EXPECT_FALSE(networking_private_crypto::VerifyCredentials(
-      kBadSubjectCertData, std::vector<std::string>(), signed_data,
-      unsigned_data, kHotspotBssid));
+  EXPECT_TRUE(networking_private_crypto::VerifyCredentialsAtTime(
+      kCertData, icas, signed_data, unsigned_data, kHotspotBssid, time));
+
+  // Checking that verification fails when the certificate is expired.
+  EXPECT_FALSE(networking_private_crypto::VerifyCredentialsAtTime(
+      kCertData, icas, signed_data, unsigned_data, kHotspotBssid,
+      expired_time));
 
   // Checking that verification fails when certificate has invalid format.
-  EXPECT_FALSE(networking_private_crypto::VerifyCredentials(
-      kBadCertData, std::vector<std::string>(), signed_data, unsigned_data,
-      kHotspotBssid));
+  EXPECT_FALSE(networking_private_crypto::VerifyCredentialsAtTime(
+      kBadCertData, icas, signed_data, unsigned_data, kHotspotBssid, time));
 
   // Checking that verification fails if we supply a bad ICA.
   std::vector<std::string> bad_icas;
   bad_icas.push_back(kCertData);
-  EXPECT_FALSE(networking_private_crypto::VerifyCredentials(
-      kCertData, bad_icas, signed_data, unsigned_data, kHotspotBssid));
+  EXPECT_FALSE(networking_private_crypto::VerifyCredentialsAtTime(
+      kCertData, bad_icas, signed_data, unsigned_data, kHotspotBssid, time));
 
-  // Checking that verification fails when Hotspot Bssid is invalid.
-  EXPECT_FALSE(networking_private_crypto::VerifyCredentials(
-      kCertData, std::vector<std::string>(), signed_data, unsigned_data,
-      kBadHotspotBssid));
+  // Checking that verification fails when Hotspot Bssid does not match the
+  // certificate's common name.
+  EXPECT_FALSE(networking_private_crypto::VerifyCredentialsAtTime(
+      kCertData, icas, signed_data, unsigned_data, kBadHotspotBssid, time));
 
-  // Checking that verification fails when there is bad nonce in unsigned_data.
-  unsigned_data = base::StringPrintf(
-      "%s,%s,%s,%s,%s", kName, kSsdpUdn, kHotspotBssid, kPublicKey, kBadNonce);
-  EXPECT_FALSE(networking_private_crypto::VerifyCredentials(
-      kCertData, std::vector<std::string>(), signed_data, unsigned_data,
-      kHotspotBssid));
+  // Checking that verification fails when the signature is wrong.
+  unsigned_data = "bad data";
+  EXPECT_FALSE(networking_private_crypto::VerifyCredentialsAtTime(
+      kCertData, icas, signed_data, unsigned_data, kHotspotBssid, time));
 }
 
 // Test that networking_private_crypto::EncryptByteString behaves as expected.
diff --git a/chrome/renderer/media/cast_rtp_stream.cc b/chrome/renderer/media/cast_rtp_stream.cc
index aaa9f691..7d4850d 100644
--- a/chrome/renderer/media/cast_rtp_stream.cc
+++ b/chrome/renderer/media/cast_rtp_stream.cc
@@ -9,18 +9,23 @@
 #include <utility>
 
 #include "base/bind.h"
+#include "base/bind_helpers.h"
 #include "base/callback_helpers.h"
 #include "base/command_line.h"
 #include "base/logging.h"
 #include "base/macros.h"
+#include "base/memory/ref_counted.h"
 #include "base/memory/weak_ptr.h"
 #include "base/strings/stringprintf.h"
 #include "base/sys_info.h"
+#include "base/thread_task_runner_handle.h"
+#include "base/timer/timer.h"
 #include "base/trace_event/trace_event.h"
 #include "chrome/common/chrome_switches.h"
 #include "chrome/renderer/media/cast_session.h"
 #include "chrome/renderer/media/cast_udp_transport.h"
 #include "content/public/renderer/media_stream_audio_sink.h"
+#include "content/public/renderer/media_stream_utils.h"
 #include "content/public/renderer/media_stream_video_sink.h"
 #include "content/public/renderer/render_thread.h"
 #include "content/public/renderer/video_encode_accelerator.h"
@@ -49,6 +54,14 @@
 // To convert from kilobits per second to bits to per second.
 const int kBitrateMultiplier = 1000;
 
+// The maximum number of milliseconds that should elapse since the last video
+// frame was received from the video source, before requesting refresh frames.
+const int kRefreshIntervalMilliseconds = 250;
+
+// The maximum number of refresh video frames to request/receive.  After this
+// limit (60 * 250ms = 15 seconds), refresh frame requests will stop being made.
+const int kMaxConsecutiveRefreshFrames = 60;
+
 CastRtpPayloadParams DefaultOpusPayload() {
   CastRtpPayloadParams payload;
   payload.payload_type = media::cast::kDefaultRtpAudioPayloadType;
@@ -301,11 +314,17 @@
 }  // namespace
 
 // This class receives MediaStreamTrack events and video frames from a
-// MediaStreamTrack.
+// MediaStreamVideoTrack.  It also includes a timer to request refresh frames
+// when the capturer halts (e.g., a screen capturer stops delivering frames
+// because the screen is not being updated).  When a halt is detected, refresh
+// frames will be requested at regular intervals for a short period of time.
+// This provides the video encoder, downstream, several copies of the last frame
+// so that it may clear up lossy encoding artifacts.
 //
 // Threading: Video frames are received on the IO thread and then
-// forwarded to media::cast::VideoFrameInput through a static method.
-// Member variables of this class are only accessed on the render thread.
+// forwarded to media::cast::VideoFrameInput.  The inner class, Deliverer,
+// handles this.  Otherwise, all methods and member variables of the outer class
+// must only be accessed on the render thread.
 class CastVideoSink : public base::SupportsWeakPtr<CastVideoSink>,
                       public content::MediaStreamVideoSink {
  public:
@@ -313,66 +332,130 @@
   // |error_callback| is called if video formats don't match.
   CastVideoSink(const blink::WebMediaStreamTrack& track,
                 const CastRtpStream::ErrorCallback& error_callback)
-      : track_(track),
-        sink_added_(false),
-        error_callback_(error_callback) {}
+      : track_(track), deliverer_(new Deliverer(error_callback)),
+        consecutive_refresh_count_(0),
+        expecting_a_refresh_frame_(false) {}
 
   ~CastVideoSink() override {
-    if (sink_added_)
-      RemoveFromVideoTrack(this, track_);
-  }
-
-  // This static method is used to forward video frames to |frame_input|.
-  static void OnVideoFrame(
-      // These parameters are already bound when callback is created.
-      const CastRtpStream::ErrorCallback& error_callback,
-      const scoped_refptr<media::cast::VideoFrameInput> frame_input,
-      // These parameters are passed for each frame.
-      const scoped_refptr<media::VideoFrame>& video_frame,
-      base::TimeTicks estimated_capture_time) {
-    const base::TimeTicks timestamp = estimated_capture_time.is_null()
-                                          ? base::TimeTicks::Now()
-                                          : estimated_capture_time;
-
-    if (!(video_frame->format() == media::PIXEL_FORMAT_I420 ||
-          video_frame->format() == media::PIXEL_FORMAT_YV12 ||
-          video_frame->format() == media::PIXEL_FORMAT_YV12A)) {
-      NOTREACHED();
-      return;
-    }
-    scoped_refptr<media::VideoFrame> frame = video_frame;
-    // Drop alpha channel since we do not support it yet.
-    if (frame->format() == media::PIXEL_FORMAT_YV12A)
-      frame = media::WrapAsI420VideoFrame(video_frame);
-
-    // Used by chrome/browser/extension/api/cast_streaming/performance_test.cc
-    TRACE_EVENT_INSTANT2(
-        "cast_perf_test", "MediaStreamVideoSink::OnVideoFrame",
-        TRACE_EVENT_SCOPE_THREAD,
-        "timestamp",  timestamp.ToInternalValue(),
-        "time_delta", frame->timestamp().ToInternalValue());
-    frame_input->InsertRawVideoFrame(frame, timestamp);
+    MediaStreamVideoSink::DisconnectFromTrack();
   }
 
   // Attach this sink to a video track represented by |track_|.
   // Data received from the track will be submitted to |frame_input|.
   void AddToTrack(
       const scoped_refptr<media::cast::VideoFrameInput>& frame_input) {
-    DCHECK(!sink_added_);
-    sink_added_ = true;
-    AddToVideoTrack(
-        this,
-        base::Bind(
-            &CastVideoSink::OnVideoFrame,
-            error_callback_,
-            frame_input),
-        track_);
+    DCHECK(deliverer_);
+    deliverer_->WillConnectToTrack(AsWeakPtr(), frame_input);
+    refresh_timer_.Start(
+        FROM_HERE,
+        base::TimeDelta::FromMilliseconds(kRefreshIntervalMilliseconds),
+        base::Bind(&CastVideoSink::OnRefreshTimerFired,
+                   base::Unretained(this)));
+    MediaStreamVideoSink::ConnectToTrack(track_,
+                                         base::Bind(&Deliverer::OnVideoFrame,
+                                                    deliverer_));
   }
 
  private:
-  blink::WebMediaStreamTrack track_;
-  bool sink_added_;
-  CastRtpStream::ErrorCallback error_callback_;
+  class Deliverer : public base::RefCountedThreadSafe<Deliverer> {
+   public:
+    explicit Deliverer(const CastRtpStream::ErrorCallback& error_callback)
+        : main_task_runner_(base::ThreadTaskRunnerHandle::Get()),
+          error_callback_(error_callback) {}
+
+    void WillConnectToTrack(
+        base::WeakPtr<CastVideoSink> sink,
+        scoped_refptr<media::cast::VideoFrameInput> frame_input) {
+      DCHECK(main_task_runner_->RunsTasksOnCurrentThread());
+      sink_ = sink;
+      frame_input_ = std::move(frame_input);
+    }
+
+    void OnVideoFrame(const scoped_refptr<media::VideoFrame>& video_frame,
+                      base::TimeTicks estimated_capture_time) {
+      main_task_runner_->PostTask(
+        FROM_HERE, base::Bind(&CastVideoSink::DidReceiveFrame, sink_));
+
+      const base::TimeTicks timestamp = estimated_capture_time.is_null()
+                                            ? base::TimeTicks::Now()
+                                            : estimated_capture_time;
+
+      if (!(video_frame->format() == media::PIXEL_FORMAT_I420 ||
+            video_frame->format() == media::PIXEL_FORMAT_YV12 ||
+            video_frame->format() == media::PIXEL_FORMAT_YV12A)) {
+        error_callback_.Run("Incompatible video frame format.");
+        return;
+      }
+      scoped_refptr<media::VideoFrame> frame = video_frame;
+      // Drop alpha channel since we do not support it yet.
+      if (frame->format() == media::PIXEL_FORMAT_YV12A)
+        frame = media::WrapAsI420VideoFrame(video_frame);
+
+      // Used by chrome/browser/extension/api/cast_streaming/performance_test.cc
+      TRACE_EVENT_INSTANT2(
+          "cast_perf_test", "MediaStreamVideoSink::OnVideoFrame",
+          TRACE_EVENT_SCOPE_THREAD,
+          "timestamp",  timestamp.ToInternalValue(),
+          "time_delta", frame->timestamp().ToInternalValue());
+      frame_input_->InsertRawVideoFrame(frame, timestamp);
+    }
+
+   private:
+    friend class base::RefCountedThreadSafe<Deliverer>;
+    ~Deliverer() {}
+
+    const scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
+    const CastRtpStream::ErrorCallback error_callback_;
+
+    // These are set on the main thread after construction, and before the first
+    // call to OnVideoFrame() on the IO thread.  |sink_| may be passed around on
+    // any thread, but must only be dereferenced on the main renderer thread.
+    base::WeakPtr<CastVideoSink> sink_;
+    scoped_refptr<media::cast::VideoFrameInput> frame_input_;
+
+    DISALLOW_COPY_AND_ASSIGN(Deliverer);
+  };
+
+ private:
+  void OnRefreshTimerFired() {
+    ++consecutive_refresh_count_;
+    if (consecutive_refresh_count_ >= kMaxConsecutiveRefreshFrames)
+      refresh_timer_.Stop();  // Stop timer until receiving a non-refresh frame.
+
+    DVLOG(1) << "CastVideoSink is requesting another refresh frame "
+                "(consecutive count=" << consecutive_refresh_count_ << ").";
+    expecting_a_refresh_frame_ = true;
+    content::RequestRefreshFrameFromVideoTrack(connected_track());
+  }
+
+  void DidReceiveFrame() {
+    if (expecting_a_refresh_frame_) {
+      // There is uncertainty as to whether the video frame was in response to a
+      // refresh request.  However, if it was not, more video frames will soon
+      // follow, and before the refresh timer can fire again.  Thus, the
+      // behavior resulting from this logic will be correct.
+      expecting_a_refresh_frame_ = false;
+    } else {
+      consecutive_refresh_count_ = 0;
+      // The following re-starts the timer, scheduling it to fire at
+      // kRefreshIntervalMilliseconds from now.
+      refresh_timer_.Reset();
+    }
+  }
+
+  const blink::WebMediaStreamTrack track_;
+  const scoped_refptr<Deliverer> deliverer_;
+
+  // Requests refresh frames at a constant rate while the source is paused, up
+  // to a consecutive maximum.
+  base::RepeatingTimer refresh_timer_;
+
+  // Counter for the number of consecutive "refresh frames" requested.
+  int consecutive_refresh_count_;
+
+  // Set to true when a request for a refresh frame has been made.  This is
+  // cleared once the next frame is received.
+  bool expecting_a_refresh_frame_;
 
   DISALLOW_COPY_AND_ASSIGN(CastVideoSink);
 };
diff --git a/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc b/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc
index a78d9ea3..c1e2d1a 100644
--- a/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc
+++ b/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc
@@ -5,6 +5,7 @@
 #include "chrome/renderer/pepper/chrome_renderer_pepper_host_factory.h"
 
 #include "base/logging.h"
+#include "base/memory/ptr_util.h"
 #include "chrome/renderer/pepper/pepper_flash_drm_renderer_host.h"
 #include "chrome/renderer/pepper/pepper_flash_font_file_host.h"
 #include "chrome/renderer/pepper/pepper_flash_fullscreen_host.h"
@@ -27,7 +28,8 @@
 
 ChromeRendererPepperHostFactory::~ChromeRendererPepperHostFactory() {}
 
-scoped_ptr<ResourceHost> ChromeRendererPepperHostFactory::CreateResourceHost(
+std::unique_ptr<ResourceHost>
+ChromeRendererPepperHostFactory::CreateResourceHost(
     ppapi::host::PpapiHost* host,
     PP_Resource resource,
     PP_Instance instance,
@@ -36,24 +38,24 @@
 
   // Make sure the plugin is giving us a valid instance for this resource.
   if (!host_->IsValidInstance(instance))
-    return scoped_ptr<ResourceHost>();
+    return nullptr;
 
   if (host_->GetPpapiHost()->permissions().HasPermission(
           ppapi::PERMISSION_FLASH)) {
     switch (message.type()) {
       case PpapiHostMsg_Flash_Create::ID: {
-        return scoped_ptr<ResourceHost>(
+        return base::WrapUnique(
             new PepperFlashRendererHost(host_, instance, resource));
       }
       case PpapiHostMsg_FlashFullscreen_Create::ID: {
-        return scoped_ptr<ResourceHost>(
+        return base::WrapUnique(
             new PepperFlashFullscreenHost(host_, instance, resource));
       }
       case PpapiHostMsg_FlashMenu_Create::ID: {
         ppapi::proxy::SerializedFlashMenu serialized_menu;
         if (ppapi::UnpackMessage<PpapiHostMsg_FlashMenu_Create>(
                 message, &serialized_menu)) {
-          return scoped_ptr<ResourceHost>(new PepperFlashMenuHost(
+          return base::WrapUnique(new PepperFlashMenuHost(
               host_, instance, resource, serialized_menu));
         }
         break;
@@ -74,13 +76,13 @@
         PP_PrivateFontCharset charset;
         if (ppapi::UnpackMessage<PpapiHostMsg_FlashFontFile_Create>(
                 message, &description, &charset)) {
-          return scoped_ptr<ResourceHost>(new PepperFlashFontFileHost(
+          return base::WrapUnique(new PepperFlashFontFileHost(
               host_, instance, resource, description, charset));
         }
         break;
       }
       case PpapiHostMsg_FlashDRM_Create::ID:
-        return scoped_ptr<ResourceHost>(
+        return base::WrapUnique(
             new PepperFlashDRMRendererHost(host_, instance, resource));
     }
   }
@@ -89,7 +91,7 @@
           ppapi::PERMISSION_PRIVATE)) {
     switch (message.type()) {
       case PpapiHostMsg_PDF_Create::ID: {
-        return scoped_ptr<ResourceHost>(
+        return base::WrapUnique(
             new pdf::PepperPDFHost(host_, instance, resource));
       }
     }
@@ -101,10 +103,9 @@
   // access to the other private interfaces.
   switch (message.type()) {
     case PpapiHostMsg_UMA_Create::ID: {
-      return scoped_ptr<ResourceHost>(
-          new PepperUMAHost(host_, instance, resource));
+      return base::WrapUnique(new PepperUMAHost(host_, instance, resource));
     }
   }
 
-  return scoped_ptr<ResourceHost>();
+  return nullptr;
 }
diff --git a/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.h b/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.h
index 4774f33cf..284131c 100644
--- a/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.h
+++ b/chrome/renderer/pepper/chrome_renderer_pepper_host_factory.h
@@ -19,7 +19,7 @@
   ~ChromeRendererPepperHostFactory() override;
 
   // HostFactory.
-  scoped_ptr<ppapi::host::ResourceHost> CreateResourceHost(
+  std::unique_ptr<ppapi::host::ResourceHost> CreateResourceHost(
       ppapi::host::PpapiHost* host,
       PP_Resource resource,
       PP_Instance instance,
diff --git a/chrome/renderer/pepper/pepper_helper.cc b/chrome/renderer/pepper/pepper_helper.cc
index a610a30..ccf2933a 100644
--- a/chrome/renderer/pepper/pepper_helper.cc
+++ b/chrome/renderer/pepper/pepper_helper.cc
@@ -4,6 +4,9 @@
 
 #include "chrome/renderer/pepper/pepper_helper.h"
 
+#include <memory>
+
+#include "base/memory/ptr_util.h"
 #include "chrome/renderer/pepper/chrome_renderer_pepper_host_factory.h"
 #include "chrome/renderer/pepper/pepper_shared_memory_message_filter.h"
 #include "content/public/renderer/renderer_ppapi_host.h"
@@ -18,9 +21,7 @@
   // TODO(brettw) figure out how to hook up the host factory. It needs some
   // kind of filter-like system to allow dynamic additions.
   host->GetPpapiHost()->AddHostFactoryFilter(
-      scoped_ptr<ppapi::host::HostFactory>(
-          new ChromeRendererPepperHostFactory(host)));
+      base::WrapUnique(new ChromeRendererPepperHostFactory(host)));
   host->GetPpapiHost()->AddInstanceMessageFilter(
-      scoped_ptr<ppapi::host::InstanceMessageFilter>(
-          new PepperSharedMemoryMessageFilter(host)));
+      base::WrapUnique(new PepperSharedMemoryMessageFilter(host)));
 }
diff --git a/chrome/service/service_utility_process_host.cc b/chrome/service/service_utility_process_host.cc
index ee38b9b..957f3e6 100644
--- a/chrome/service/service_utility_process_host.cc
+++ b/chrome/service/service_utility_process_host.cc
@@ -107,8 +107,8 @@
       emf_files_.push(CreateTempFile());
       host_->Send(new ChromeUtilityMsg_RenderPDFPagesToMetafiles_GetPage(
           current_page_++,
-          IPC::GetFileHandleForProcess(
-              emf_files_.back().GetPlatformFile(), host_->handle(), false)));
+          IPC::GetPlatformFileForTransit(
+              emf_files_.back().GetPlatformFile(), false)));
     }
   }
 
diff --git a/chrome/test/data/extensions/api_test/cast_channel/api/test_authority_keys.js b/chrome/test/data/extensions/api_test/cast_channel/api/test_authority_keys.js
index fce5f90..07f9a7f4 100644
--- a/chrome/test/data/extensions/api_test/cast_channel/api/test_authority_keys.js
+++ b/chrome/test/data/extensions/api_test/cast_channel/api/test_authority_keys.js
@@ -160,6 +160,11 @@
   function testInvalid() {
     chrome.cast.channel.setAuthorityKeys(
         generateBase64Data(INVALID_AUTHORITY_KEYS),
-        generateBase64Data(VALID_SIGNATURE), onInvalidAuthorityKeys);
+        // TODO(eroman): crbug.com/601171: Remove this entire test once
+        // chrome.cast.channel.setAuthorityKeys() is removed.
+        //
+        // For now the test has been modified so that even passing
+        // invalid keys is successful, as the API is deprecated.
+        generateBase64Data(VALID_SIGNATURE), onValidAuthorityKeys);
   }
 ]);
diff --git a/chrome/test/data/extensions/platform_apps/web_view/text_input_state/background.js b/chrome/test/data/extensions/platform_apps/web_view/text_input_state/background.js
new file mode 100644
index 0000000..598fc2e1
--- /dev/null
+++ b/chrome/test/data/extensions/platform_apps/web_view/text_input_state/background.js
@@ -0,0 +1,7 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+chrome.app.runtime.onLaunched.addListener(function() {
+  chrome.app.window.create('window.html', {}, function () {});
+});
diff --git a/chrome/test/data/extensions/platform_apps/web_view/text_input_state/guest.html b/chrome/test/data/extensions/platform_apps/web_view/text_input_state/guest.html
new file mode 100644
index 0000000..1b2a5ab
--- /dev/null
+++ b/chrome/test/data/extensions/platform_apps/web_view/text_input_state/guest.html
@@ -0,0 +1,22 @@
+<!doctype html>
+<!--
+ * Copyright 2016 The Chromium Authors. All rights reserved.  Use of this
+ * source code is governed by a BSD-style license that can be found in the
+ * LICENSE file.
+-->
+<html>
+<head>
+  <title> Guest page with text input field. </title>
+</head>
+
+<body>
+  <input type="text" value="guest"></input>
+  <script>
+    window.addEventListener('load', function() {
+      document.querySelector('input').addEventListener('focus', function() {
+        console.log('Guest input focused!');
+      });
+    });
+  </script>
+</body>
+</html>
diff --git a/chrome/test/data/extensions/platform_apps/web_view/text_input_state/manifest.json b/chrome/test/data/extensions/platform_apps/web_view/text_input_state/manifest.json
new file mode 100644
index 0000000..0382f97
--- /dev/null
+++ b/chrome/test/data/extensions/platform_apps/web_view/text_input_state/manifest.json
@@ -0,0 +1,12 @@
+{
+  "name": "<webview> - Text Input State Tracking Test",
+  "version": "1",
+  "permissions": [
+    "webview"
+  ],
+  "app": {
+    "background": {
+      "scripts": ["background.js"]
+    }
+  }
+}
diff --git a/chrome/test/data/extensions/platform_apps/web_view/text_input_state/window.html b/chrome/test/data/extensions/platform_apps/web_view/text_input_state/window.html
new file mode 100644
index 0000000..7ac32466
--- /dev/null
+++ b/chrome/test/data/extensions/platform_apps/web_view/text_input_state/window.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<!--
+ * Copyright 2016 The Chromium Authors. All rights reserved.  Use of this
+ * source code is governed by a BSD-style license that can be found in the
+ * LICENSE file.
+-->
+<html>
+<head>
+  <title>App Page Title</title>
+</head>
+<body>
+  <input id="first" type="number" value="2016"></input>
+  <div id="webview-container"></div>
+  <input id="second" type="text" value="last one"></input>
+  <script src="window.js"></script>
+</body>
+</html>
diff --git a/chrome/test/data/extensions/platform_apps/web_view/text_input_state/window.js b/chrome/test/data/extensions/platform_apps/web_view/text_input_state/window.js
new file mode 100644
index 0000000..e0afe73e
--- /dev/null
+++ b/chrome/test/data/extensions/platform_apps/web_view/text_input_state/window.js
@@ -0,0 +1,27 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+chrome.test.getConfig(function(config) {
+  var guestURL = 'http://localhost:' + config.testServer.port +
+      '/extensions/platform_apps/web_view/text_input_state/guest.html';
+  var webview = document.createElement('webview');
+  document.querySelector('#webview-container').appendChild(webview);
+  webview.onloadstop = function() {
+    chrome.test.sendMessage('connected');
+  };
+  webview.addEventListener('consolemessage', function(e) {
+    chrome.test.sendMessage('GUEST-FOCUSED');
+  });
+  webview.src = guestURL;
+});
+
+window.addEventListener('load', function() {
+  document.querySelector('#first').addEventListener('focus', function() {
+    chrome.test.sendMessage('EMBEDDER-FOCUSED-1');
+  });
+
+  document.querySelector('#second').addEventListener('focus', function() {
+    chrome.test.sendMessage('EMBEDDER-FOCUSED-2');
+  });
+});
diff --git a/chrome/test/data/webui/settings/certificate_manager_page_test.js b/chrome/test/data/webui/settings/certificate_manager_page_test.js
index 1f4316c8..139eaad 100644
--- a/chrome/test/data/webui/settings/certificate_manager_page_test.js
+++ b/chrome/test/data/webui/settings/certificate_manager_page_test.js
@@ -21,6 +21,7 @@
       'exportPersonalCertificatePasswordSelected',
       'getCaCertificateTrust',
       'importCaCertificate',
+      'importCaCertificateTrustSelected',
       'importPersonalCertificate',
       'importPersonalCertificatePasswordSelected',
       'importServerCertificate',
@@ -64,6 +65,14 @@
     },
 
     /** @override */
+    importCaCertificateTrustSelected: function(ssl, email, objSign) {
+      this.methodCalled('importCaCertificateTrustSelected', {
+        ssl: ssl, email: email, objSign: objSign,
+      });
+      return this.fulfillRequest_();
+    },
+
+    /** @override */
     editCaCertificateTrust: function(id, ssl, email, objSign) {
       this.methodCalled('editCaCertificateTrust', {
         id: id, ssl: ssl, email: email, objSign: objSign,
@@ -192,9 +201,6 @@
     /** @type {?TestCertificatesBrowserProxy} */
     var browserProxy = null;
 
-    /** @type {!CertificateSubnode} */
-    var model = createSampleCertificateSubnode();
-
     /** @type {!CaTrustInfo} */
     var caTrustInfo = { ssl: true, email: false, objSign: false };
 
@@ -206,16 +212,17 @@
         settings.CertificatesBrowserProxyImpl.instance_ = browserProxy;
         PolymerTest.clearBody();
         dialog = document.createElement('settings-ca-trust-edit-dialog');
-        dialog.model = model;
-        document.body.appendChild(dialog);
       });
 
       teardown(function() { dialog.remove(); });
 
       test('EditSuccess', function() {
+        dialog.model = createSampleCertificateSubnode();
+        document.body.appendChild(dialog);
+
         return browserProxy.whenCalled('getCaCertificateTrust').then(
             function(id) {
-              assertEquals(model.id, id);
+              assertEquals(dialog.model.id, id);
               assertEquals(caTrustInfo.ssl, dialog.$.ssl.checked);
               assertEquals(caTrustInfo.email, dialog.$.email.checked);
               assertEquals(caTrustInfo.objSign, dialog.$.objSign.checked);
@@ -229,9 +236,8 @@
               MockInteractions.tap(dialog.$.ok);
 
               return browserProxy.whenCalled('editCaCertificateTrust');
-            }).then(
-            function(args) {
-              assertEquals(model.id, args.id);
+            }).then(function(args) {
+              assertEquals(dialog.model.id, args.id);
               // Checking that the values sent to C++ are reflecting the
               // changes made by the user (toggling all checkboxes).
               assertEquals(caTrustInfo.ssl, !args.ssl);
@@ -242,8 +248,32 @@
             });
       });
 
+      test('ImportSuccess', function() {
+        dialog.model = {name: 'Dummy certificate name'};
+        document.body.appendChild(dialog);
+
+        assertFalse(dialog.$.ssl.checked);
+        assertFalse(dialog.$.email.checked);
+        assertFalse(dialog.$.objSign.checked);
+
+        MockInteractions.tap(dialog.$.ssl);
+        MockInteractions.tap(dialog.$.email);
+
+        // Simulate clicking 'OK'.
+        MockInteractions.tap(dialog.$.ok);
+        return browserProxy.whenCalled('importCaCertificateTrustSelected').then(
+            function(args) {
+              assertTrue(args.ssl);
+              assertTrue(args.email);
+              assertFalse(args.objSign);
+            });
+      });
+
       test('EditError', function() {
+        dialog.model = createSampleCertificateSubnode();
+        document.body.appendChild(dialog);
         browserProxy.forceCertificatesError();
+
         var whenErrorEventFired = eventToPromise('certificates-error', dialog);
 
         return browserProxy.whenCalled('getCaCertificateTrust').then(
@@ -651,30 +681,14 @@
       });
 
       /**
-       * Dispatches a settings.CertificateActionEvent.
-       * @param {!settings.CertificateAction} action The type of action to
-       *     simulate.
-       */
-      function dispatchCertificateActionEvent(action) {
-        page.fire(
-            settings.CertificateActionEvent,
-            /** @type {!CertificateActionEventDetail} */ ({
-          action: action,
-          subnode: createSampleCertificateSubnode(),
-          certificateType: settings.CertificateType.PERSONAL
-        }));
-      }
-
-      /**
        * Tests that a dialog opens as a response to a
        * settings.CertificateActionEvent.
        * @param {string} dialogTagName The type of dialog to test.
-       * @param {!settings.CertificateAction} action The action that is supposed
-       *     to trigger the dialog.
+       * @param {CertificateActionEventDetail} eventDetail
        */
-      function testDialogOpensOnAction(dialogTagName, action) {
+      function testDialogOpensOnAction(dialogTagName, eventDetail)  {
         assertFalse(!!page.shadowRoot.querySelector(dialogTagName));
-        dispatchCertificateActionEvent(action);
+        page.fire(settings.CertificateActionEvent, eventDetail);
         Polymer.dom.flush();
         assertTrue(!!page.shadowRoot.querySelector(dialogTagName));
       }
@@ -682,24 +696,51 @@
       test('OpensDialog_DeleteConfirmation', function() {
         testDialogOpensOnAction(
             'settings-certificate-delete-confirmation-dialog',
-            settings.CertificateAction.DELETE);
+            /** @type {!CertificateActionEventDetail} */ ({
+              action: settings.CertificateAction.DELETE,
+              subnode: createSampleCertificateSubnode(),
+              certificateType: settings.CertificateType.PERSONAL
+            }));
       });
 
       test('OpensDialog_PasswordEncryption', function() {
         testDialogOpensOnAction(
             'settings-certificate-password-encryption-dialog',
-            settings.CertificateAction.EXPORT_PERSONAL);
+            /** @type {!CertificateActionEventDetail} */ ({
+              action: settings.CertificateAction.EXPORT_PERSONAL,
+              subnode: createSampleCertificateSubnode(),
+              certificateType: settings.CertificateType.PERSONAL
+            }));
       });
 
       test('OpensDialog_PasswordDecryption', function() {
         testDialogOpensOnAction(
             'settings-certificate-password-decryption-dialog',
-            settings.CertificateAction.IMPORT);
+            /** @type {!CertificateActionEventDetail} */ ({
+              action: settings.CertificateAction.IMPORT,
+              subnode: createSampleCertificateSubnode(),
+              certificateType: settings.CertificateType.PERSONAL
+            }));
       });
 
       test('OpensDialog_CaTrustEdit', function() {
         testDialogOpensOnAction(
-            'settings-ca-trust-edit-dialog', settings.CertificateAction.EDIT);
+            'settings-ca-trust-edit-dialog',
+            /** @type {!CertificateActionEventDetail} */ ({
+              action: settings.CertificateAction.EDIT,
+              subnode: createSampleCertificateSubnode(),
+              certificateType: settings.CertificateType.CA
+            }));
+      });
+
+      test('OpensDialog_CaTrustImport', function() {
+        testDialogOpensOnAction(
+            'settings-ca-trust-edit-dialog',
+            /** @type {!CertificateActionEventDetail} */ ({
+              action: settings.CertificateAction.IMPORT,
+              subnode: {name: 'Dummy Certificate Name', id: null},
+              certificateType: settings.CertificateType.CA
+            }));
       });
     });
   }
diff --git a/chrome/test/data/webui/settings/cr_settings_browsertest.js b/chrome/test/data/webui/settings/cr_settings_browsertest.js
index cc40fa7..b60ff8b 100644
--- a/chrome/test/data/webui/settings/cr_settings_browsertest.js
+++ b/chrome/test/data/webui/settings/cr_settings_browsertest.js
@@ -279,6 +279,7 @@
   extraLibraries: PolymerTest.getLibraries(ROOT_PATH).concat([
     '../fake_chrome_event.js',
     'fake_settings_private.js',
+    'fake_system_display.js',
     'device_page_tests.js',
   ]),
 };
diff --git a/chrome/test/data/webui/settings/device_page_tests.js b/chrome/test/data/webui/settings/device_page_tests.js
index 208c53ae..b578234 100644
--- a/chrome/test/data/webui/settings/device_page_tests.js
+++ b/chrome/test/data/webui/settings/device_page_tests.js
@@ -42,23 +42,39 @@
       value: false,
     }];
 
+    /** @type {!SettingsDevicePage|undefined} */
     var devicePage;
 
+    /** @type {!FakeSystemDisplay|undefined} */
+    var fakeSystemDisplay;
+
     setup(function() {
+      fakeSystemDisplay = new settings.FakeSystemDisplay();
+      settings.display.systemDisplayApi = fakeSystemDisplay;
+
+      PolymerTest.clearBody();
       devicePage = document.createElement('settings-device-page');
       devicePage.currentRoute = {page: 'basic', section: '', subpage: []};
       devicePage.prefs = fakePrefs;
-      Polymer.dom.flush();
+      document.body.appendChild(devicePage);
     });
 
+    /** @return {!Element} */
+    function showAndGetDeviceSubpage(subpage) {
+      Polymer.dom.flush();
+      var row = devicePage.$$('#main #' + subpage + 'Row');
+      assertTrue(!!row);
+      MockInteractions.tap(row);
+      expectEquals('device', devicePage.currentRoute.section);
+      expectEquals(subpage, devicePage.currentRoute.subpage[0]);
+      var page = devicePage.$$('#' + subpage + ' settings-' + subpage);
+      assertTrue(!!page);
+      return page;
+    };
+
     test('keyboard subpage', function() {
       // Open the keyboard subpage.
-      var keyboardRow = devicePage.$$('#main #keyboardRow');
-      assertTrue(!!keyboardRow);
-      MockInteractions.tap(keyboardRow);
-      expectEquals(devicePage.currentRoute.section, 'device');
-      expectEquals(devicePage.currentRoute.subpage[0], 'keyboard');
-      var keyboardPage = devicePage.$$('#keyboard settings-keyboard');
+      var keyboardPage = showAndGetDeviceSubpage('keyboard');
       assertTrue(!!keyboardPage);
 
       // Initially, the optional keys are hidden.
@@ -82,5 +98,72 @@
       expectTrue(!!keyboardPage.$$('#capsLockKey'));
       expectTrue(!!keyboardPage.$$('#diamondKey'));
     });
+
+    test('display subpage', function() {
+      // Open the display subpage.
+      var displayPage = showAndGetDeviceSubpage('display');
+      assertTrue(!!displayPage);
+
+      var addDisplay = function(n) {
+        var display = {
+          id: 'fakeDisplayId' + n,
+          name: 'fakeDisplayName' + n,
+          mirroring: '',
+          isPrimary: n == 1,
+          rotation: 0
+        };
+        fakeSystemDisplay.addDisplayForTest(display);
+      };
+
+      // This promise will get resolved third, after a second display is added.
+      var promise3 = new PromiseResolver();
+      var onDisplayChanged2 = function() {
+        fakeSystemDisplay.getInfo(function(displays) {
+          Polymer.dom.flush();
+          expectEquals(2, Object.keys(displayPage.displays).length);
+          expectEquals(2, displays.length);
+          expectEquals(displays[1].id, displayPage.displays[displays[1].id].id);
+          expectEquals(displays[0].id, displayPage.selectedDisplay.id);
+          expectTrue(displayPage.hasMultipleDisplays_(displayPage.displays));
+          promise3.resolve();
+        });
+      };
+
+      // This promise will get resolved second, after a display gets added.
+      var promise2 = new PromiseResolver();
+      var onDisplayChanged1 = function() {
+        // Request the display info. The callback will be triggered after
+        // the SettingsDisplay callback has been called.
+        fakeSystemDisplay.getInfo(function(displays) {
+          Polymer.dom.flush();
+          expectEquals(1, Object.keys(displayPage.displays).length);
+          expectEquals(1, displays.length);
+          expectEquals(displays[0].id, displayPage.displays[displays[0].id].id);
+          expectEquals(displays[0].id, displayPage.selectedDisplay.id);
+          expectFalse(displayPage.isMirrored_(displayPage.selectedDisplay));
+          expectFalse(displayPage.hasMultipleDisplays_(displayPage.displays));
+          promise2.resolve();
+
+          fakeSystemDisplay.onDisplayChanged.removeListener(onDisplayChanged1);
+          fakeSystemDisplay.onDisplayChanged.addListener(onDisplayChanged2);
+          addDisplay(2);
+          fakeSystemDisplay.onDisplayChanged.callListeners();
+        });
+      };
+
+      // This promise will get resolved first, after the initial getInfo is
+      // called from SettingsDisplay.attached().
+      var promise1 = fakeSystemDisplay.getInfoCalled.promise.then(function() {
+        expectTrue(!!displayPage.displays);
+        expectEquals(0, Object.keys(displayPage.displays).length);
+        // Add a new listener, which will be called after the SettingsDisplay
+        // listener is called.
+        fakeSystemDisplay.onDisplayChanged.addListener(onDisplayChanged1);
+        addDisplay(1);
+        fakeSystemDisplay.onDisplayChanged.callListeners();
+      });
+
+      return Promise.all([promise1, promise2.promise, promise3.promise]);
+    });
   });
 });
diff --git a/chrome/test/data/webui/settings/fake_system_display.js b/chrome/test/data/webui/settings/fake_system_display.js
new file mode 100644
index 0000000..c42f9e4e
--- /dev/null
+++ b/chrome/test/data/webui/settings/fake_system_display.js
@@ -0,0 +1,45 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * @fileoverview Fake implementation of chrome.system.display for testing.
+ */
+cr.define('settings', function() {
+  /**
+   * Fake of the chrome.settings.display API.
+   * @constructor
+   * @implements {SystemDisplay}
+   */
+  function FakeSystemDisplay() {
+    /** @type {!Array<!chrome.system.display.DisplayUnitInfo>} */
+    this.fakeDisplays = [];
+    this.getInfoCalled = new PromiseResolver();
+  }
+
+  FakeSystemDisplay.prototype = {
+    // Public testing methods.
+    /**
+     * @param {!chrome.system.display.DisplayUnitInfo>} display
+     */
+    addDisplayForTest: function(display) {
+      this.fakeDisplays.push(display);
+    },
+
+    // SystemDisplay overrides.
+    /** @override */
+    getInfo: function(callback) {
+      setTimeout(function() {
+        callback(this.fakeDisplays);
+        this.getInfoCalled.resolve();
+        // Reset the promise resolver.
+        this.getInfoCalled = new PromiseResolver();
+      }.bind(this));
+    },
+
+    /** @override */
+    onDisplayChanged: new FakeChromeEvent(),
+  };
+
+  return {FakeSystemDisplay: FakeSystemDisplay};
+});
diff --git a/chrome/third_party/mozilla_security_manager/nsNSSCertHelper.cpp b/chrome/third_party/mozilla_security_manager/nsNSSCertHelper.cpp
index b824420..ec68c343 100644
--- a/chrome/third_party/mozilla_security_manager/nsNSSCertHelper.cpp
+++ b/chrome/third_party/mozilla_security_manager/nsNSSCertHelper.cpp
@@ -55,8 +55,7 @@
 #include "chrome/common/net/x509_certificate_model.h"
 #include "chrome/grit/generated_resources.h"
 #include "crypto/scoped_nss_types.h"
-#include "net/base/address_family.h"
-#include "net/base/ip_address_number.h"
+#include "net/base/ip_address.h"
 #include "net/base/ip_endpoint.h"
 #include "ui/base/l10n/l10n_util.h"
 
@@ -548,12 +547,9 @@
     case certIPAddress: {
       key = l10n_util::GetStringUTF8(IDS_CERT_GENERAL_NAME_IP_ADDRESS);
 
-      net::IPAddressNumber ip(
-          current->name.other.data,
-          current->name.other.data + current->name.other.len);
-
-      if (net::GetAddressFamily(ip) != net::ADDRESS_FAMILY_UNSPECIFIED) {
-        value = net::IPAddressToString(ip);
+      net::IPAddress ip(current->name.other.data, current->name.other.len);
+      if (ip.IsValid()) {
+        value = ip.ToString();
       } else {
         // Invalid IP address.
         value = ProcessRawBytes(&current->name.other);
diff --git a/chromecast/browser/cast_browser_main_parts.cc b/chromecast/browser/cast_browser_main_parts.cc
index 5c3862b6..075521dd 100644
--- a/chromecast/browser/cast_browser_main_parts.cc
+++ b/chromecast/browser/cast_browser_main_parts.cc
@@ -271,6 +271,15 @@
   }
   return media_resource_tracker_;
 }
+
+media::MediaPipelineBackendManager*
+CastBrowserMainParts::media_pipeline_backend_manager() {
+  if (!media_pipeline_backend_manager_) {
+    media_pipeline_backend_manager_.reset(
+        new media::MediaPipelineBackendManager(GetMediaTaskRunner()));
+  }
+  return media_pipeline_backend_manager_.get();
+}
 #endif
 
 void CastBrowserMainParts::PreMainMessageLoopStart() {
@@ -337,7 +346,8 @@
 
   // AudioManager is created immediately after threads are created, requiring
   // AudioManagerFactory to be set beforehand.
-  ::media::AudioManager::SetFactory(new media::CastAudioManagerFactory());
+  ::media::AudioManager::SetFactory(
+      new media::CastAudioManagerFactory(media_pipeline_backend_manager()));
 
   // Set GL strings so GPU config code can make correct feature blacklisting/
   // whitelisting decisions.
@@ -485,6 +495,7 @@
 #if !defined(OS_ANDROID)
   media_resource_tracker_->FinalizeAndDestroy();
   media_resource_tracker_ = nullptr;
+  media_pipeline_backend_manager_.reset();
 #endif
 }
 
diff --git a/chromecast/browser/cast_browser_main_parts.h b/chromecast/browser/cast_browser_main_parts.h
index 1466b047..5c6e3ee 100644
--- a/chromecast/browser/cast_browser_main_parts.h
+++ b/chromecast/browser/cast_browser_main_parts.h
@@ -22,6 +22,7 @@
 namespace chromecast {
 
 namespace media {
+class MediaPipelineBackendManager;
 class MediaResourceTracker;
 class VideoPlaneController;
 }  // namespace media
@@ -38,8 +39,10 @@
   ~CastBrowserMainParts() override;
 
   scoped_refptr<base::SingleThreadTaskRunner> GetMediaTaskRunner() const;
+
 #if !defined(OS_ANDROID)
   media::MediaResourceTracker* media_resource_tracker();
+  media::MediaPipelineBackendManager* media_pipeline_backend_manager();
 #endif
 
   // content::BrowserMainParts implementation:
@@ -62,6 +65,10 @@
 #if !defined(OS_ANDROID)
   // Tracks usage of media resource by e.g. CMA pipeline, CDM.
   media::MediaResourceTracker* media_resource_tracker_;
+
+  // Tracks all media pipeline backends.
+  scoped_ptr<media::MediaPipelineBackendManager>
+      media_pipeline_backend_manager_;
 #endif
 
   DISALLOW_COPY_AND_ASSIGN(CastBrowserMainParts);
diff --git a/chromecast/browser/cast_content_browser_client.cc b/chromecast/browser/cast_content_browser_client.cc
index 4f0d3d9b..70881c6 100644
--- a/chromecast/browser/cast_content_browser_client.cc
+++ b/chromecast/browser/cast_content_browser_client.cc
@@ -114,15 +114,20 @@
 scoped_ptr<media::MediaPipelineBackend>
 CastContentBrowserClient::CreateMediaPipelineBackend(
     const media::MediaPipelineDeviceParams& params) {
-  return make_scoped_ptr(
-      media::MediaPipelineBackendManager::CreateMediaPipelineBackend(params));
+  return media_pipeline_backend_manager()->CreateMediaPipelineBackend(params);
 }
 
 media::MediaResourceTracker*
 CastContentBrowserClient::media_resource_tracker() {
   return cast_browser_main_parts_->media_resource_tracker();
 }
-#endif  // OS_ANDROID
+
+media::MediaPipelineBackendManager*
+CastContentBrowserClient::media_pipeline_backend_manager() {
+  DCHECK(cast_browser_main_parts_);
+  return cast_browser_main_parts_->media_pipeline_backend_manager();
+}
+#endif  // !defined(OS_ANDROID)
 
 void CastContentBrowserClient::SetMetricsClientId(
     const std::string& client_id) {
diff --git a/chromecast/browser/cast_content_browser_client.h b/chromecast/browser/cast_content_browser_client.h
index a4694f4..31d6e57 100644
--- a/chromecast/browser/cast_content_browser_client.h
+++ b/chromecast/browser/cast_content_browser_client.h
@@ -33,6 +33,7 @@
 
 namespace media {
 class MediaPipelineBackend;
+class MediaPipelineBackendManager;
 struct MediaPipelineDeviceParams;
 class MediaResourceTracker;
 class VideoPlaneController;
@@ -76,6 +77,8 @@
       const media::MediaPipelineDeviceParams& params);
 
   media::MediaResourceTracker* media_resource_tracker();
+
+  media::MediaPipelineBackendManager* media_pipeline_backend_manager();
 #endif
 
   // Invoked when the metrics client ID changes.
diff --git a/chromecast/media/audio/cast_audio_manager.cc b/chromecast/media/audio/cast_audio_manager.cc
index 54cd794..1321e90 100644
--- a/chromecast/media/audio/cast_audio_manager.cc
+++ b/chromecast/media/audio/cast_audio_manager.cc
@@ -8,10 +8,7 @@
 #include <string>
 
 #include "chromecast/media/audio/cast_audio_output_stream.h"
-#include "chromecast/media/base/media_message_loop.h"
 #include "chromecast/media/cma/backend/media_pipeline_backend_manager.h"
-#include "chromecast/public/cast_media_shlib.h"
-#include "chromecast/public/media/media_pipeline_backend.h"
 
 namespace {
 // TODO(alokp): Query the preferred value from media backend.
@@ -28,8 +25,10 @@
 namespace chromecast {
 namespace media {
 
-CastAudioManager::CastAudioManager(::media::AudioLogFactory* audio_log_factory)
-    : AudioManagerBase(audio_log_factory) {}
+CastAudioManager::CastAudioManager(::media::AudioLogFactory* audio_log_factory,
+                                   MediaPipelineBackendManager* backend_manager)
+    : AudioManagerBase(audio_log_factory), backend_manager_(backend_manager) {
+}
 
 CastAudioManager::~CastAudioManager() {
   Shutdown();
@@ -64,10 +63,7 @@
 
 scoped_ptr<MediaPipelineBackend> CastAudioManager::CreateMediaPipelineBackend(
     const MediaPipelineDeviceParams& params) {
-  DCHECK(media::MediaMessageLoop::GetTaskRunner()->BelongsToCurrentThread());
-
-  return scoped_ptr<MediaPipelineBackend>(
-      MediaPipelineBackendManager::CreateMediaPipelineBackend(params));
+  return backend_manager_->CreateMediaPipelineBackend(params);
 }
 
 ::media::AudioOutputStream* CastAudioManager::MakeLinearOutputStream(
diff --git a/chromecast/media/audio/cast_audio_manager.h b/chromecast/media/audio/cast_audio_manager.h
index f2cec7e1..ecff317 100644
--- a/chromecast/media/audio/cast_audio_manager.h
+++ b/chromecast/media/audio/cast_audio_manager.h
@@ -15,11 +15,13 @@
 namespace media {
 
 class MediaPipelineBackend;
+class MediaPipelineBackendManager;
 struct MediaPipelineDeviceParams;
 
 class CastAudioManager : public ::media::AudioManagerBase {
  public:
-  explicit CastAudioManager(::media::AudioLogFactory* audio_log_factory);
+  CastAudioManager(::media::AudioLogFactory* audio_log_factory,
+                   MediaPipelineBackendManager* backend_manager);
   ~CastAudioManager() override;
 
   // AudioManager implementation.
@@ -53,6 +55,8 @@
       const std::string& output_device_id,
       const ::media::AudioParameters& input_params) override;
 
+  MediaPipelineBackendManager* const backend_manager_;
+
   DISALLOW_COPY_AND_ASSIGN(CastAudioManager);
 };
 
diff --git a/chromecast/media/audio/cast_audio_manager_factory.cc b/chromecast/media/audio/cast_audio_manager_factory.cc
index 7151f213..c932c4b 100644
--- a/chromecast/media/audio/cast_audio_manager_factory.cc
+++ b/chromecast/media/audio/cast_audio_manager_factory.cc
@@ -5,17 +5,21 @@
 #include "chromecast/media/audio/cast_audio_manager_factory.h"
 
 #include "chromecast/media/audio/cast_audio_manager.h"
+#include "chromecast/media/cma/backend/media_pipeline_backend_manager.h"
 
 namespace chromecast {
 namespace media {
 
-CastAudioManagerFactory::CastAudioManagerFactory() {}
+CastAudioManagerFactory::CastAudioManagerFactory(
+    MediaPipelineBackendManager* backend_manager)
+    : backend_manager_(backend_manager) {
+}
 
 CastAudioManagerFactory::~CastAudioManagerFactory() {}
 
 ::media::AudioManager* CastAudioManagerFactory::CreateInstance(
     ::media::AudioLogFactory* audio_log_factory) {
-  return new CastAudioManager(audio_log_factory);
+  return new CastAudioManager(audio_log_factory, backend_manager_);
 }
 
 }  // namespace media
diff --git a/chromecast/media/audio/cast_audio_manager_factory.h b/chromecast/media/audio/cast_audio_manager_factory.h
index 85e8160..627a68d 100644
--- a/chromecast/media/audio/cast_audio_manager_factory.h
+++ b/chromecast/media/audio/cast_audio_manager_factory.h
@@ -11,9 +11,12 @@
 namespace chromecast {
 namespace media {
 
+class MediaPipelineBackendManager;
+
 class CastAudioManagerFactory : public ::media::AudioManagerFactory {
  public:
-  CastAudioManagerFactory();
+  explicit CastAudioManagerFactory(
+      MediaPipelineBackendManager* backend_manager);
   ~CastAudioManagerFactory() override;
 
   // ::media::AudioManagerFactory overrides.
@@ -21,6 +24,8 @@
       ::media::AudioLogFactory* audio_log_factory) override;
 
  private:
+  MediaPipelineBackendManager* const backend_manager_;
+
   DISALLOW_COPY_AND_ASSIGN(CastAudioManagerFactory);
 };
 
diff --git a/chromecast/media/audio/cast_audio_output_stream_unittest.cc b/chromecast/media/audio/cast_audio_output_stream_unittest.cc
index 8402a6a..f8c46cbd 100644
--- a/chromecast/media/audio/cast_audio_output_stream_unittest.cc
+++ b/chromecast/media/audio/cast_audio_output_stream_unittest.cc
@@ -185,7 +185,7 @@
 class FakeAudioManager : public CastAudioManager {
  public:
   FakeAudioManager()
-      : CastAudioManager(nullptr), media_pipeline_backend_(nullptr) {}
+      : CastAudioManager(nullptr, nullptr), media_pipeline_backend_(nullptr) {}
   ~FakeAudioManager() override {}
 
   // CastAudioManager overrides.
diff --git a/chromecast/media/cma/backend/media_pipeline_backend_manager.cc b/chromecast/media/cma/backend/media_pipeline_backend_manager.cc
index d0db5adf..2013384a 100644
--- a/chromecast/media/cma/backend/media_pipeline_backend_manager.cc
+++ b/chromecast/media/cma/backend/media_pipeline_backend_manager.cc
@@ -6,65 +6,58 @@
 
 #include <algorithm>
 
-#include "base/bind.h"
-#include "base/lazy_instance.h"
-#include "base/location.h"
-#include "chromecast/media/base/media_message_loop.h"
 #include "chromecast/media/cma/backend/media_pipeline_backend_wrapper.h"
 #include "chromecast/public/cast_media_shlib.h"
 
 namespace chromecast {
 namespace media {
 
-namespace {
+MediaPipelineBackendManager::MediaPipelineBackendManager(
+    scoped_refptr<base::SingleThreadTaskRunner> media_task_runner)
+    : media_task_runner_(std::move(media_task_runner)) {
+}
 
-base::LazyInstance<MediaPipelineBackendManager> g_instance =
-    LAZY_INSTANCE_INITIALIZER;
+MediaPipelineBackendManager::~MediaPipelineBackendManager() {
+}
 
-}  // namespace
-
-// static
-MediaPipelineBackend* MediaPipelineBackendManager::CreateMediaPipelineBackend(
+scoped_ptr<MediaPipelineBackend>
+MediaPipelineBackendManager::CreateMediaPipelineBackend(
     const media::MediaPipelineDeviceParams& params) {
-  DCHECK(MediaMessageLoop::GetTaskRunner()->BelongsToCurrentThread());
+  DCHECK(media_task_runner_->BelongsToCurrentThread());
   return CreateMediaPipelineBackend(params, 0);
 }
 
-// static
-MediaPipelineBackend* MediaPipelineBackendManager::CreateMediaPipelineBackend(
+scoped_ptr<MediaPipelineBackend>
+MediaPipelineBackendManager::CreateMediaPipelineBackend(
     const media::MediaPipelineDeviceParams& params,
     int stream_type) {
-  DCHECK(MediaMessageLoop::GetTaskRunner()->BelongsToCurrentThread());
-  MediaPipelineBackendManager* backend_manager = Get();
-  MediaPipelineBackendWrapper* backend_ptr = new MediaPipelineBackendWrapper(
-      media::CastMediaShlib::CreateMediaPipelineBackend(params), stream_type,
-      backend_manager->GetVolumeMultiplier(stream_type));
-  backend_manager->media_pipeline_backends_.push_back(backend_ptr);
+  DCHECK(media_task_runner_->BelongsToCurrentThread());
+  scoped_ptr<MediaPipelineBackend> backend_ptr(new MediaPipelineBackendWrapper(
+      make_scoped_ptr(
+          media::CastMediaShlib::CreateMediaPipelineBackend(params)),
+      stream_type, GetVolumeMultiplier(stream_type), this));
+  media_pipeline_backends_.push_back(backend_ptr.get());
   return backend_ptr;
 }
 
-// static
 void MediaPipelineBackendManager::OnMediaPipelineBackendDestroyed(
     const MediaPipelineBackend* backend) {
-  DCHECK(MediaMessageLoop::GetTaskRunner()->BelongsToCurrentThread());
-  MediaPipelineBackendManager* backend_manager = Get();
-  backend_manager->media_pipeline_backends_.erase(
-      std::remove(backend_manager->media_pipeline_backends_.begin(),
-                  backend_manager->media_pipeline_backends_.end(), backend),
-      backend_manager->media_pipeline_backends_.end());
+  DCHECK(media_task_runner_->BelongsToCurrentThread());
+  media_pipeline_backends_.erase(
+      std::remove(media_pipeline_backends_.begin(),
+                  media_pipeline_backends_.end(), backend),
+      media_pipeline_backends_.end());
 }
 
-// static
 void MediaPipelineBackendManager::SetVolumeMultiplier(int stream_type,
                                                       float volume) {
-  DCHECK(MediaMessageLoop::GetTaskRunner()->BelongsToCurrentThread());
-  MediaPipelineBackendManager* backend_manager = Get();
+  DCHECK(media_task_runner_->BelongsToCurrentThread());
   volume = std::max(0.0f, std::min(volume, 1.0f));
-  backend_manager->volume_by_stream_type_[stream_type] = volume;
+  volume_by_stream_type_[stream_type] = volume;
 
   // Set volume for each open media pipeline backends.
-  for (auto it = backend_manager->media_pipeline_backends_.begin();
-       it != backend_manager->media_pipeline_backends_.end(); it++) {
+  for (auto it = media_pipeline_backends_.begin();
+       it != media_pipeline_backends_.end(); it++) {
     MediaPipelineBackendWrapper* wrapper =
         static_cast<MediaPipelineBackendWrapper*>(*it);
     if (wrapper->GetStreamType() == stream_type)
@@ -72,22 +65,10 @@
   }
 }
 
-// static
-MediaPipelineBackendManager* MediaPipelineBackendManager::Get() {
-  return g_instance.Pointer();
-}
-
-MediaPipelineBackendManager::MediaPipelineBackendManager() {
-}
-
-MediaPipelineBackendManager::~MediaPipelineBackendManager() {
-}
-
 float MediaPipelineBackendManager::GetVolumeMultiplier(int stream_type) {
-  DCHECK(MediaMessageLoop::GetTaskRunner()->BelongsToCurrentThread());
-  MediaPipelineBackendManager* backend_manager = Get();
-  auto it = backend_manager->volume_by_stream_type_.find(stream_type);
-  if (it == backend_manager->volume_by_stream_type_.end()) {
+  DCHECK(media_task_runner_->BelongsToCurrentThread());
+  auto it = volume_by_stream_type_.find(stream_type);
+  if (it == volume_by_stream_type_.end()) {
     return 1.0;
   } else {
     return it->second;
diff --git a/chromecast/media/cma/backend/media_pipeline_backend_manager.h b/chromecast/media/cma/backend/media_pipeline_backend_manager.h
index 890dfc86..16216f0 100644
--- a/chromecast/media/cma/backend/media_pipeline_backend_manager.h
+++ b/chromecast/media/cma/backend/media_pipeline_backend_manager.h
@@ -9,15 +9,12 @@
 #include <vector>
 
 #include "base/macros.h"
+#include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
+#include "base/single_thread_task_runner.h"
 #include "chromecast/public/media/media_pipeline_backend.h"
 #include "chromecast/public/media/media_pipeline_device_params.h"
 
-namespace base {
-template <typename T>
-struct DefaultLazyInstanceTraits;
-}  // namespace base
-
 namespace chromecast {
 namespace media {
 
@@ -26,37 +23,39 @@
 // All functions in this class should be called on the media thread.
 class MediaPipelineBackendManager {
  public:
+  explicit MediaPipelineBackendManager(
+      scoped_refptr<base::SingleThreadTaskRunner> media_task_runner);
+  ~MediaPipelineBackendManager();
+
   // Create media pipeline backend.
-  static MediaPipelineBackend* CreateMediaPipelineBackend(
+  scoped_ptr<MediaPipelineBackend> CreateMediaPipelineBackend(
       const MediaPipelineDeviceParams& params);
 
   // Create media pipeline backend with a specific stream_type.
-  static MediaPipelineBackend* CreateMediaPipelineBackend(
+  scoped_ptr<MediaPipelineBackend> CreateMediaPipelineBackend(
       const MediaPipelineDeviceParams& params,
       int stream_type);
 
-  // Internal clean up when a new media pipeline backend is destroyed.
-  static void OnMediaPipelineBackendDestroyed(
-      const MediaPipelineBackend* backend);
-
   // Sets the relative volume for a specified stream type,
   // with range [0.0, 1.0] inclusive. If |multiplier| is outside the
   // range [0.0, 1.0], it is clamped to that range.
   // TODO(tianyuwang): change stream_type to use a enum.
-  static void SetVolumeMultiplier(int stream_type, float volume);
+  void SetVolumeMultiplier(int stream_type, float volume);
+
+  base::SingleThreadTaskRunner* task_runner() const {
+    return media_task_runner_.get();
+  }
 
  private:
-  friend struct base::DefaultLazyInstanceTraits<MediaPipelineBackendManager>;
+  friend class MediaPipelineBackendWrapper;
 
-  // Returns a pointer to a singleton instance of the
-  // MediaPipelineBackendManager.
-  static MediaPipelineBackendManager* Get();
-
-  MediaPipelineBackendManager();
-  ~MediaPipelineBackendManager();
+  // Internal clean up when a new media pipeline backend is destroyed.
+  void OnMediaPipelineBackendDestroyed(const MediaPipelineBackend* backend);
 
   float GetVolumeMultiplier(int stream_type);
 
+  const scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_;
+
   // A vector that stores all of the existing media_pipeline_backends_.
   std::vector<MediaPipelineBackend*> media_pipeline_backends_;
 
diff --git a/chromecast/media/cma/backend/media_pipeline_backend_wrapper.cc b/chromecast/media/cma/backend/media_pipeline_backend_wrapper.cc
index ef86099..4cd53ea 100644
--- a/chromecast/media/cma/backend/media_pipeline_backend_wrapper.cc
+++ b/chromecast/media/cma/backend/media_pipeline_backend_wrapper.cc
@@ -11,19 +11,21 @@
 namespace media {
 
 MediaPipelineBackendWrapper::MediaPipelineBackendWrapper(
-    MediaPipelineBackend* backend,
+    scoped_ptr<MediaPipelineBackend> backend,
     int stream_type,
-    float stream_type_volume)
-    : backend_(backend),
+    float stream_type_volume,
+    MediaPipelineBackendManager* backend_manager)
+    : backend_(std::move(backend)),
       stream_type_(stream_type),
       audio_decoder_wrapper_(nullptr),
       stream_type_volume_(stream_type_volume),
-      is_initialized_(false) {
+      is_initialized_(false),
+      backend_manager_(backend_manager) {
   DCHECK(backend_);
 }
 
 MediaPipelineBackendWrapper::~MediaPipelineBackendWrapper() {
-  MediaPipelineBackendManager::OnMediaPipelineBackendDestroyed(this);
+  backend_manager_->OnMediaPipelineBackendDestroyed(this);
 }
 
 MediaPipelineBackend::AudioDecoder*
diff --git a/chromecast/media/cma/backend/media_pipeline_backend_wrapper.h b/chromecast/media/cma/backend/media_pipeline_backend_wrapper.h
index f2befb8a..0b3d2cb7 100644
--- a/chromecast/media/cma/backend/media_pipeline_backend_wrapper.h
+++ b/chromecast/media/cma/backend/media_pipeline_backend_wrapper.h
@@ -15,18 +15,17 @@
 #include "chromecast/public/media/media_pipeline_backend.h"
 #include "chromecast/public/media/media_pipeline_device_params.h"
 
-namespace base {
-class SingleThreadTaskRunner;
-}  // namespace base
-
 namespace chromecast {
 namespace media {
 
+class MediaPipelineBackendManager;
+
 class MediaPipelineBackendWrapper : public MediaPipelineBackend {
  public:
-  MediaPipelineBackendWrapper(MediaPipelineBackend* backend,
+  MediaPipelineBackendWrapper(scoped_ptr<MediaPipelineBackend> backend,
                               int stream_type,
-                              float stream_type_volume);
+                              float stream_type_volume,
+                              MediaPipelineBackendManager* backend_manager);
   ~MediaPipelineBackendWrapper() override;
 
   // MediaPipelineBackend implementation:
@@ -49,6 +48,7 @@
   scoped_ptr<AudioDecoderWrapper> audio_decoder_wrapper_;
   float stream_type_volume_;
   bool is_initialized_;
+  MediaPipelineBackendManager* const backend_manager_;
 
   DISALLOW_COPY_AND_ASSIGN(MediaPipelineBackendWrapper);
 };
diff --git a/components/cronet/android/test/javatests/src/org/chromium/net/DiskStorageTest.java b/components/cronet/android/test/javatests/src/org/chromium/net/DiskStorageTest.java
index 1439f70..58dc713 100644
--- a/components/cronet/android/test/javatests/src/org/chromium/net/DiskStorageTest.java
+++ b/components/cronet/android/test/javatests/src/org/chromium/net/DiskStorageTest.java
@@ -6,6 +6,7 @@
 
 import android.test.suitebuilder.annotation.SmallTest;
 
+import org.chromium.base.FileUtils;
 import org.chromium.base.PathUtils;
 import org.chromium.base.test.util.Feature;
 
@@ -20,7 +21,8 @@
  * Test CronetEngine disk storage.
  */
 public class DiskStorageTest extends CronetTestBase {
-    CronetTestFramework mTestFramework;
+    private CronetTestFramework mTestFramework;
+    private String mReadOnlyStoragePath;
 
     @Override
     protected void setUp() throws Exception {
@@ -31,6 +33,9 @@
 
     @Override
     protected void tearDown() throws Exception {
+        if (mReadOnlyStoragePath != null) {
+            FileUtils.recursivelyDeleteFile(new File(mReadOnlyStoragePath));
+        }
         NativeTestServer.shutdownNativeTestServer();
         super.tearDown();
     }
@@ -39,13 +44,13 @@
     @Feature({"Cronet"})
     @OnlyRunNativeCronet
     public void testReadOnlyStorageDirectory() throws Exception {
-        String readOnlyStoragePath = PathUtils.getDataDirectory(getContext()) + "/read_only";
-        File readOnlyStorage = new File(readOnlyStoragePath);
+        mReadOnlyStoragePath = PathUtils.getDataDirectory(getContext()) + "/read_only";
+        File readOnlyStorage = new File(mReadOnlyStoragePath);
         assertTrue(readOnlyStorage.mkdir());
         // Setting the storage directory as readonly has no effect.
         assertTrue(readOnlyStorage.setReadOnly());
         CronetEngine.Builder builder = new CronetEngine.Builder(getContext());
-        builder.setStoragePath(readOnlyStoragePath);
+        builder.setStoragePath(mReadOnlyStoragePath);
         builder.enableHttpCache(CronetEngine.Builder.HTTP_CACHE_DISK, 1024 * 1024);
 
         mTestFramework = new CronetTestFramework(null, null, getContext(), builder);
@@ -60,7 +65,7 @@
         mTestFramework.mCronetEngine.shutdown();
         FileInputStream newVersionFile = null;
         // Make sure that version file is in readOnlyStoragePath.
-        File versionFile = new File(readOnlyStoragePath + "/version");
+        File versionFile = new File(mReadOnlyStoragePath + "/version");
         try {
             newVersionFile = new FileInputStream(versionFile);
             byte[] buffer = new byte[] {0, 0, 0, 0};
@@ -72,9 +77,9 @@
                 newVersionFile.close();
             }
         }
-        File diskCacheDir = new File(readOnlyStoragePath + "/disk_cache");
+        File diskCacheDir = new File(mReadOnlyStoragePath + "/disk_cache");
         assertTrue(diskCacheDir.exists());
-        File prefsDir = new File(readOnlyStoragePath + "/prefs");
+        File prefsDir = new File(mReadOnlyStoragePath + "/prefs");
         assertTrue(prefsDir.exists());
     }
 
diff --git a/components/exo/shell_surface.cc b/components/exo/shell_surface.cc
index ce15711..51f5b62 100644
--- a/components/exo/shell_surface.cc
+++ b/components/exo/shell_surface.cc
@@ -104,6 +104,50 @@
 
 }  // namespace
 
+// Helper class used to coalesce a number of changes into one "configure"
+// callback. Callbacks are suppressed while an instance of this class is
+// instantiated and instead called when the instance is destroyed.
+// If |force_configure_| is true ShellSurface::Configure() will be called
+// even if no changes to shell surface took place during the lifetime of the
+// ScopedConfigure instance.
+class ShellSurface::ScopedConfigure {
+ public:
+  ScopedConfigure(ShellSurface* shell_surface, bool force_configure);
+  ~ScopedConfigure();
+
+  void set_needs_configure() { needs_configure_ = true; }
+
+ private:
+  ShellSurface* const shell_surface_;
+  const bool force_configure_;
+  bool needs_configure_;
+
+  DISALLOW_COPY_AND_ASSIGN(ScopedConfigure);
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// ShellSurface, ScopedConfigure:
+
+ShellSurface::ScopedConfigure::ScopedConfigure(ShellSurface* shell_surface,
+                                               bool force_configure)
+    : shell_surface_(shell_surface),
+      force_configure_(force_configure),
+      needs_configure_(false) {
+  // ScopedConfigure instances cannot be nested.
+  DCHECK(!shell_surface_->scoped_configure_);
+  shell_surface_->scoped_configure_ = this;
+}
+
+ShellSurface::ScopedConfigure::~ScopedConfigure() {
+  DCHECK_EQ(shell_surface_->scoped_configure_, this);
+  shell_surface_->scoped_configure_ = nullptr;
+  if (needs_configure_ || force_configure_)
+    shell_surface_->Configure();
+  // ScopedConfigure instance might have suppressed a widget bounds update.
+  if (shell_surface_->widget_)
+    shell_surface_->UpdateWidgetBounds();
+}
+
 ////////////////////////////////////////////////////////////////////////////////
 // ShellSurface, public:
 
@@ -119,6 +163,7 @@
       parent_(parent ? parent->GetWidget()->GetNativeWindow() : nullptr),
       initial_bounds_(initial_bounds),
       activatable_(activatable),
+      scoped_configure_(nullptr),
       ignore_window_bounds_changes_(false),
       resize_component_(HTCAPTION),
       pending_resize_component_(HTCAPTION) {
@@ -135,6 +180,7 @@
     : ShellSurface(surface, nullptr, gfx::Rect(), true) {}
 
 ShellSurface::~ShellSurface() {
+  DCHECK(!scoped_configure_);
   ash::Shell::GetInstance()->activation_client()->RemoveObserver(this);
   if (surface_) {
     surface_->SetSurfaceDelegate(nullptr);
@@ -174,6 +220,9 @@
     if (config.serial == serial)
       break;
   }
+
+  if (widget_)
+    UpdateWidgetBounds();
 }
 
 void ShellSurface::SetParent(ShellSurface* parent) {
@@ -199,12 +248,9 @@
   if (!widget_)
     CreateShellSurfaceWidget();
 
-  // Ask client to configure its surface if already maximized.
-  if (widget_->IsMaximized()) {
-    Configure();
-    return;
-  }
-
+  // Note: This will ask client to configure its surface even if already
+  // maximized.
+  ScopedConfigure scoped_configure(this, true);
   widget_->Maximize();
 }
 
@@ -214,12 +260,9 @@
   if (!widget_)
     return;
 
-  // Ask client to configure its surface if already restored.
-  if (!widget_->IsMaximized()) {
-    Configure();
-    return;
-  }
-
+  // Note: This will ask client to configure its surface even if not already
+  // maximized.
+  ScopedConfigure scoped_configure(this, true);
   widget_->Restore();
 }
 
@@ -229,12 +272,9 @@
   if (!widget_)
     CreateShellSurfaceWidget();
 
-  // Ask client to configure its surface if fullscreen state is not changing.
-  if (widget_->IsFullscreen() == fullscreen) {
-    Configure();
-    return;
-  }
-
+  // Note: This will ask client to configure its surface even if fullscreen
+  // state doesn't change.
+  ScopedConfigure scoped_configure(this, true);
   widget_->SetFullscreen(fullscreen);
 }
 
@@ -476,6 +516,8 @@
 
     surface_->SetBounds(
         gfx::Rect(GetSurfaceOrigin(), surface_->layer()->size()));
+
+    Configure();
   }
 }
 
@@ -548,17 +590,16 @@
       aura::Window::ConvertPointToTarget(widget_->GetNativeWindow(),
                                          widget_->GetNativeWindow()->parent(),
                                          &location);
+      ScopedConfigure scoped_configure(this, false);
       resizer_->Drag(location, event->flags());
       event->StopPropagation();
-      // Ask client to configure its surface for the new size.
-      if (IsResizing())
-        Configure();
-
       break;
     }
-    case ui::ET_MOUSE_RELEASED:
+    case ui::ET_MOUSE_RELEASED: {
+      ScopedConfigure scoped_configure(this, false);
       EndDrag(false /* revert */);
       break;
+    }
     case ui::ET_MOUSE_MOVED:
     case ui::ET_MOUSE_PRESSED:
     case ui::ET_MOUSE_ENTERED:
@@ -629,6 +670,12 @@
 void ShellSurface::Configure() {
   DCHECK(widget_);
 
+  // Delay configure callback if |scoped_configure_| is set.
+  if (scoped_configure_) {
+    scoped_configure_->set_needs_configure();
+    return;
+  }
+
   gfx::Vector2d origin_offset = pending_origin_config_offset_;
   pending_origin_config_offset_ = gfx::Vector2d();
 
@@ -803,6 +850,10 @@
   if (widget_->IsMaximized() || widget_->IsFullscreen() || IsResizing())
     return;
 
+  // Return early if there is pending configure requests.
+  if (!pending_configs_.empty() || scoped_configure_)
+    return;
+
   gfx::Rect visible_bounds = GetVisibleBounds();
   gfx::Rect new_widget_bounds(widget_->GetNativeWindow()->bounds().origin(),
                               visible_bounds.size());
diff --git a/components/exo/shell_surface.h b/components/exo/shell_surface.h
index 81927a4e..94071208 100644
--- a/components/exo/shell_surface.h
+++ b/components/exo/shell_surface.h
@@ -174,6 +174,8 @@
   void OnMouseEvent(ui::MouseEvent* event) override;
 
  private:
+  class ScopedConfigure;
+
   // Surface state associated with each configure request.
   struct Config {
     uint32_t serial;
@@ -219,6 +221,7 @@
   base::Closure close_callback_;
   base::Closure surface_destroyed_callback_;
   ConfigureCallback configure_callback_;
+  ScopedConfigure* scoped_configure_;
   bool ignore_window_bounds_changes_;
   gfx::Point origin_;
   gfx::Vector2d pending_origin_offset_;
diff --git a/components/metrics/leak_detector/leak_detector.cc b/components/metrics/leak_detector/leak_detector.cc
index 0aa24e0..d1ae9c4 100644
--- a/components/metrics/leak_detector/leak_detector.cc
+++ b/components/metrics/leak_detector/leak_detector.cc
@@ -57,8 +57,6 @@
   // to handle recursive hook calls. Anything allocated when this flag is set
   // should also be freed when this flag is set.
   bool entered_hook;
-
-  HookData() : alloc_size(0), entered_hook(false) {}
 };
 
 #if defined(OS_CHROMEOS)
@@ -92,24 +90,6 @@
 }
 #endif  // defined(OS_CHROMEOS)
 
-// Populates |*tls_data| with a heap-allocated HookData object. Returns the
-// address of the allocated object.
-HookData* CreateTLSHookData(base::ThreadLocalPointer<HookData>* tls_data) {
-  // Allocating a new object will result in a recursive hook function call, when
-  // there is no TLS HookData available. This would turn into an infinite loop
-  // as this function gets called repeatedly in a futile attempt to create the
-  // HookData for the first time, ultimately causing a stack overflow.
-  //
-  // To get around this, fill |*tls_data| with a temporary HookData object
-  // first, and then call the allocator.
-  HookData temp_hook_data;
-  temp_hook_data.entered_hook = true;
-  tls_data->Set(&temp_hook_data);
-
-  tls_data->Set(new HookData);
-  return tls_data->Get();
-}
-
 // Convert a pointer to a hash value. Returns only the upper eight bits.
 inline uint64_t PointerToHash(const void* ptr) {
   // The input data is the pointer address, not the location in memory pointed
@@ -145,7 +125,31 @@
 base::LazyInstance<LeakDetector>::Leaky g_instance = LAZY_INSTANCE_INITIALIZER;
 
 // Thread-specific data to be used by hook functions.
-base::LazyInstance<base::ThreadLocalPointer<HookData>>::Leaky g_hook_data_tls;
+base::LazyInstance<base::ThreadLocalPointer<void>>::Leaky g_hook_data_tls =
+    LAZY_INSTANCE_INITIALIZER;
+
+// Returns the contents of |g_hook_data_tls| as a HookData structure.
+inline HookData LoadHookDataFromTLS() {
+  uintptr_t ptr_value =
+      reinterpret_cast<uintptr_t>(g_hook_data_tls.Get().Get());
+
+  // The lower bit of |ptr_value| indicates whether a hook has already been
+  // entered. The remaining bits store the alloc size.
+  HookData result;
+  result.entered_hook = ptr_value & 0x01;
+  result.alloc_size = ptr_value >> 1;
+  return result;
+}
+
+// Stores a HookData structure in |g_hook_data_tls|. HookData is a trivial
+// struct so it is faster to pass by value.
+inline void StoreHookDataToTLS(HookData hook_data) {
+  // NOTE: |alloc_size| loses its upper bit when it gets stored in the TLS here.
+  // The effective max value of |alloc_size| is thus half its nominal max value.
+  uintptr_t ptr_value =
+      (hook_data.entered_hook ? 1 : 0) | (hook_data.alloc_size << 1);
+  g_hook_data_tls.Get().Set(reinterpret_cast<void*>(ptr_value));
+}
 
 }  // namespace
 
@@ -188,7 +192,8 @@
       mapping.addr, mapping.size, size_suspicion_threshold,
       call_stack_suspicion_threshold));
 
-  // Register allocator hook functions.
+  // Register allocator hook functions. This must be done last since the
+  // preceding code will need to call the allocator.
   base::allocator::SetHooks(&AllocHook, &FreeHook);
 }
 
@@ -213,22 +218,20 @@
 
 // static
 void LeakDetector::AllocHook(const void* ptr, size_t size) {
-  base::ThreadLocalPointer<HookData>& hook_data_ptr = g_hook_data_tls.Get();
-  HookData* hook_data = hook_data_ptr.Get();
-  if (!hook_data) {
-    hook_data = CreateTLSHookData(&hook_data_ptr);
-  }
-
-  if (hook_data->entered_hook)
+  HookData hook_data = LoadHookDataFromTLS();
+  if (hook_data.entered_hook)
     return;
 
-  hook_data->alloc_size += size;
+  hook_data.alloc_size += size;
 
   LeakDetector* detector = GetInstance();
-  if (!detector->ShouldSample(ptr))
+  if (!detector->ShouldSample(ptr)) {
+    StoreHookDataToTLS(hook_data);
     return;
+  }
 
-  hook_data->entered_hook = true;
+  hook_data.entered_hook = true;
+  StoreHookDataToTLS(hook_data);
 
   // Get stack trace if necessary.
   std::vector<void*> stack;
@@ -251,10 +254,10 @@
     // shared counter is updated with sufficient granularity. This way, even if
     // a few threads were slow to reach the threshold, the leak analysis would
     // not be delayed by too much.
-    if (hook_data->alloc_size >=
+    if (hook_data.alloc_size >=
         analysis_interval_bytes / kTotalAllocSizeUpdateIntervalDivisor) {
-      total_alloc_size += hook_data->alloc_size;
-      hook_data->alloc_size = 0;
+      total_alloc_size += hook_data.alloc_size;
+      hook_data.alloc_size = 0;
     }
 
     // Check for leaks after |analysis_interval_bytes_| bytes have been
@@ -284,7 +287,8 @@
     dummy_stack.swap(stack);
   }
 
-  hook_data->entered_hook = false;
+  hook_data.entered_hook = false;
+  StoreHookDataToTLS(hook_data);
 }
 
 // static
@@ -293,23 +297,20 @@
   if (!detector->ShouldSample(ptr))
     return;
 
-  base::ThreadLocalPointer<HookData>& hook_data_ptr = g_hook_data_tls.Get();
-  HookData* hook_data = hook_data_ptr.Get();
-  if (!hook_data) {
-    hook_data = CreateTLSHookData(&hook_data_ptr);
-  }
-
-  if (hook_data->entered_hook)
+  HookData hook_data = LoadHookDataFromTLS();
+  if (hook_data.entered_hook)
     return;
 
-  hook_data->entered_hook = true;
+  hook_data.entered_hook = true;
+  StoreHookDataToTLS(hook_data);
 
   {
     base::AutoLock lock(detector->recording_lock_);
     detector->impl_->RecordFree(ptr);
   }
 
-  hook_data->entered_hook = false;
+  hook_data.entered_hook = false;
+  StoreHookDataToTLS(hook_data);
 }
 
 inline bool LeakDetector::ShouldSample(const void* ptr) const {
diff --git a/components/metrics/leak_detector/leak_detector_impl.cc b/components/metrics/leak_detector/leak_detector_impl.cc
index 8aa3b4ec..edde53b3 100644
--- a/components/metrics/leak_detector/leak_detector_impl.cc
+++ b/components/metrics/leak_detector/leak_detector_impl.cc
@@ -33,6 +33,14 @@
 // are rare if not nonexistent.
 const int kNumSizeEntries = 2048;
 
+// Record only the first |kNumSizeEntriesInHistory| size classes in
+// |LeakDetectorImpl::size_breakdown_history_|.
+const int kNumSizeEntriesInHistory = 32;
+
+// |LeakDetectorImpl::size_breakdown_history_| can have up to this many entries.
+// Any older entries must be discarded to make way for new ones.
+const int kMaxNumHistoryEntries = 32;
+
 using ValueType = LeakDetectorValueType;
 
 // Functions to convert an allocation size to/from the array index used for
@@ -153,10 +161,22 @@
   for (size_t i = 0; i < size_entries_.size(); ++i) {
     const AllocSizeEntry& entry = size_entries_[i];
     ValueType size_value(IndexToSize(i));
-    size_ranked_set.Add(size_value, entry.num_allocs - entry.num_frees);
+    size_ranked_set.Add(size_value, entry.GetNetAllocs());
   }
   size_leak_analyzer_.AddSample(std::move(size_ranked_set));
 
+  // Record a snapshot of the current size table.
+  InternalVector<uint32_t> current_size_table_record;
+  current_size_table_record.reserve(kNumSizeEntriesInHistory);
+  for (const AllocSizeEntry& entry : size_entries_) {
+    if (current_size_table_record.size() == kNumSizeEntriesInHistory)
+      break;
+    current_size_table_record.push_back(entry.GetNetAllocs());
+  }
+  size_breakdown_history_.emplace_back(std::move(current_size_table_record));
+  if (size_breakdown_history_.size() > kMaxNumHistoryEntries)
+    size_breakdown_history_.pop_front();
+
   // Get suspected leaks by size.
   for (const ValueType& size_value : size_leak_analyzer_.suspected_leaks()) {
     uint32_t size = size_value.size();
@@ -196,6 +216,10 @@
       for (size_t j = 0; j < call_stack->depth; ++j) {
         report->call_stack_[j] = GetOffset(call_stack->stack[j]);
       }
+      // Copy over the historical size data.
+      report->size_breakdown_history_.reserve(size_breakdown_history_.size());
+      report->size_breakdown_history_.assign(size_breakdown_history_.begin(),
+                                             size_breakdown_history_.end());
     }
   }
 }
diff --git a/components/metrics/leak_detector/leak_detector_impl.h b/components/metrics/leak_detector/leak_detector_impl.h
index 8af99ff0..7c3ec24 100644
--- a/components/metrics/leak_detector/leak_detector_impl.h
+++ b/components/metrics/leak_detector/leak_detector_impl.h
@@ -8,6 +8,7 @@
 #include <stddef.h>
 #include <stdint.h>
 
+#include <list>
 #include <vector>
 
 #include "base/containers/hash_tables.h"
@@ -26,10 +27,12 @@
 // Not thread-safe.
 class LeakDetectorImpl {
  public:
-  // Vector type that's safe to use within the memory leak detector. Uses
+  // STL types that are safe to use within the memory leak detector. They use
   // CustomAllocator to avoid recursive malloc hook invocation when analyzing
   // allocs and frees.
   template <typename T>
+  using InternalList = std::list<T, STLAllocator<T, CustomAllocator>>;
+  template <typename T>
   using InternalVector = std::vector<T, STLAllocator<T, CustomAllocator>>;
 
   // Leak report generated by LeakDetectorImpl.
@@ -42,6 +45,11 @@
 
     const InternalVector<uintptr_t>& call_stack() const { return call_stack_; }
 
+    const InternalVector<InternalVector<uint32_t>>& size_breakdown_history()
+        const {
+      return size_breakdown_history_;
+    }
+
     // Used to compare the contents of two leak reports.
     bool operator<(const LeakReport& other) const;
 
@@ -57,7 +65,9 @@
     // will contain offsets in the executable binary.
     InternalVector<uintptr_t> call_stack_;
 
-    // TODO(sque): Add leak detector parameters.
+    // A snapshot of LeakDetectorImpl::size_breakdown_history_ when this report
+    // was generated. See comment description of that variable.
+    InternalVector<InternalVector<uint32_t>> size_breakdown_history_;
   };
 
   LeakDetectorImpl(uintptr_t mapping_addr,
@@ -89,6 +99,9 @@
 
     // A stack table, if this size is being profiled for stack as well.
     CallStackTable* stack_table;
+
+    // Returns net number of allocs.
+    uint32_t GetNetAllocs() const { return num_allocs - num_frees; }
   };
 
   // Info for a single allocation.
@@ -143,6 +156,13 @@
   // Allocation stats for each size.
   InternalVector<AllocSizeEntry> size_entries_;
 
+  // Tracks the net number of allocations per size over time. Each list item is
+  // a vector containing the allocation counts for each size. The vector element
+  // with index i corresponds to sizes |i * 4| to |i * 4 + 3|. The oldest size
+  // breakdowns is at the head of the list, and new size breakdowns should be
+  // added to the tail of the list.
+  InternalList<InternalVector<uint32_t>> size_breakdown_history_;
+
   // Address mapping info of the current binary.
   uintptr_t mapping_addr_;
   size_t mapping_size_;
diff --git a/components/metrics/leak_detector/leak_detector_impl_unittest.cc b/components/metrics/leak_detector/leak_detector_impl_unittest.cc
index 4d8e77f8..7a7e30a4 100644
--- a/components/metrics/leak_detector/leak_detector_impl_unittest.cc
+++ b/components/metrics/leak_detector/leak_detector_impl_unittest.cc
@@ -22,6 +22,8 @@
 namespace leak_detector {
 
 using InternalLeakReport = LeakDetectorImpl::LeakReport;
+template <typename T>
+using InternalVector = LeakDetectorImpl::InternalVector<T>;
 
 namespace {
 
@@ -78,7 +80,25 @@
 // The interval between consecutive analyses (LeakDetectorImpl::TestForLeaks),
 // in number of bytes allocated. e.g. if |kAllocedSizeAnalysisInterval| = 1024
 // then call TestForLeaks() every 1024 bytes of allocation that occur.
-static const size_t kAllocedSizeAnalysisInterval = 8192;
+const size_t kAllocedSizeAnalysisInterval = 8192;
+
+// Suspicion thresholds used by LeakDetectorImpl for size and call stacks.
+const uint32_t kSizeSuspicionThreshold = 4;
+const uint32_t kCallStackSuspicionThreshold = 4;
+
+// Returns the offset within [kMappingAddr, kMappingAddr + kMappingSize) if
+// |addr| falls in that range. Otherwise, returns |addr|.
+uintptr_t GetOffsetInMapping(uintptr_t addr) {
+  if (addr >= kMappingAddr && addr < kMappingAddr + kMappingSize)
+    return addr - kMappingAddr;
+  return addr;
+}
+
+// Copied from leak_detector_impl.cc. Converts a size to a size class index.
+// Any size in the range [index * 4, index * 4 + 3] falls into that size class.
+uint32_t SizeToIndex(size_t size) {
+  return size / sizeof(uint32_t);
+}
 
 }  // namespace
 
@@ -99,8 +119,6 @@
   void SetUp() override {
     CustomAllocator::Initialize();
 
-    const int kSizeSuspicionThreshold = 4;
-    const int kCallStackSuspicionThreshold = 4;
     detector_.reset(new LeakDetectorImpl(kMappingAddr, kMappingSize,
                                          kSizeSuspicionThreshold,
                                          kCallStackSuspicionThreshold));
@@ -140,10 +158,21 @@
     ++total_num_allocs_;
     total_alloced_size_ += size;
     if (total_alloced_size_ >= next_analysis_total_alloced_size_) {
-      LeakDetectorImpl::InternalVector<InternalLeakReport> reports;
+      InternalVector<InternalLeakReport> reports;
       detector_->TestForLeaks(&reports);
-      for (const InternalLeakReport& report : reports)
-        stored_reports_.insert(report);
+      for (const InternalLeakReport& report : reports) {
+        auto iter = stored_reports_.find(report);
+        if (iter == stored_reports_.end()) {
+          stored_reports_.insert(report);
+        } else {
+          // InternalLeakReports are uniquely identified by |alloc_size_bytes_|
+          // and |call_stack_|. See InternalLeakReport::operator<().
+          // If a report with the same size and call stack already exists,
+          // overwrite it with the new report, which has a newer history.
+          stored_reports_.erase(iter);
+          stored_reports_.insert(report);
+        }
+      }
 
       // Determine when the next leak analysis should occur.
       while (total_alloced_size_ >= next_analysis_total_alloced_size_)
@@ -166,6 +195,10 @@
     delete[] reinterpret_cast<char*>(ptr);
   }
 
+  // TEST CASE: Simple program that leaks memory regularly. Pass in
+  // enable_leaks=true to trigger some memory leaks.
+  void SimpleLeakyFunction(bool enable_leaks);
+
   // TEST CASE: Julia set fractal computation. Pass in enable_leaks=true to
   // trigger some memory leaks.
   void JuliaSet(bool enable_leaks);
@@ -196,6 +229,48 @@
   DISALLOW_COPY_AND_ASSIGN(LeakDetectorImplTest);
 };
 
+void LeakDetectorImplTest::SimpleLeakyFunction(bool enable_leaks) {
+  std::vector<uint32_t*> ptrs(7);
+
+  const int kNumOuterIterations = 20;
+  for (int j = 0; j < kNumOuterIterations; ++j) {
+    // The inner loop allocates 256 bytes. Run it 32 times so that 8192 bytes
+    // (|kAllocedSizeAnalysisInterval|) are allocated for each iteration of the
+    // outer loop.
+    const int kNumInnerIterations = 32;
+    static_assert(kNumInnerIterations * 256 == kAllocedSizeAnalysisInterval,
+                  "Inner loop iterations do not allocate the correct number of "
+                  "bytes.");
+    for (int i = 0; i < kNumInnerIterations; ++i) {
+      size_t alloc_size_at_beginning = total_alloced_size_;
+
+      ptrs[0] = new(Alloc(16, kStack0)) uint32_t;
+      ptrs[1] = new(Alloc(32, kStack1)) uint32_t;
+      ptrs[2] = new(Alloc(48, kStack2)) uint32_t;
+      // Allocate two 32-byte blocks and record them as from the same call site.
+      ptrs[3] = new(Alloc(32, kStack3)) uint32_t;
+      ptrs[4] = new(Alloc(32, kStack3)) uint32_t;
+      // Allocate two 48-byte blocks and record them as from the same call site.
+      ptrs[5] = new(Alloc(48, kStack4)) uint32_t;
+      ptrs[6] = new(Alloc(48, kStack4)) uint32_t;
+
+      // Now free these pointers.
+      Free(ptrs[0]);
+      if (!enable_leaks)  // Leak with size=32, call_stack=kStack1.
+        Free(ptrs[1]);
+      if (!enable_leaks)  // Leak with size=48, call_stack=kStack2.
+        Free(ptrs[2]);
+      Free(ptrs[3]);
+      Free(ptrs[4]);
+      Free(ptrs[5]);
+      Free(ptrs[6]);
+
+      // Make sure that the above code actually allocates 256 bytes.
+      EXPECT_EQ(alloc_size_at_beginning + 256, total_alloced_size_);
+    }
+  }
+}
+
 void LeakDetectorImplTest::JuliaSet(bool enable_leaks) {
   // The center region of the complex plane that is the basis for our Julia set
   // computations is a circle of radius kRadius.
@@ -254,6 +329,10 @@
   // Create a new grid for the result of the transformation.
   std::vector<Complex*> next_grid(width * height, nullptr);
 
+  // Number of times to run the Julia set iteration. This is not the same as the
+  // number of analyses performed by LeakDetectorImpl, which is determined by
+  // the total number of bytes allocated divided by
+  // |kAllocedSizeAnalysisInterval|.
   const int kNumIterations = 20;
   for (int n = 0; n < kNumIterations; ++n) {
     for (int i = 0; i < kNumPoints; ++i) {
@@ -405,6 +484,78 @@
   EXPECT_EQ(0U, alloced_ptrs_.size());
 }
 
+TEST_F(LeakDetectorImplTest, SimpleLeakyFunctionNoLeak) {
+  SimpleLeakyFunction(false /* enable_leaks */);
+
+  // SimpleLeakyFunction() should have run cleanly without leaking.
+  EXPECT_EQ(total_num_allocs_, total_num_frees_);
+  EXPECT_EQ(0U, alloced_ptrs_.size());
+  ASSERT_EQ(0U, stored_reports_.size());
+}
+
+TEST_F(LeakDetectorImplTest, SimpleLeakyFunctionWithLeak) {
+  SimpleLeakyFunction(true /* enable_leaks */);
+
+  // SimpleLeakyFunction() should generated some leak reports.
+  EXPECT_GT(total_num_allocs_, total_num_frees_);
+  EXPECT_GT(alloced_ptrs_.size(), 0U);
+  ASSERT_EQ(2U, stored_reports_.size());
+
+  // The reports should be stored in order of size.
+
+  // |report1| comes from the call site marked with kStack1, with size=32.
+  const InternalLeakReport& report1 = *stored_reports_.begin();
+  EXPECT_EQ(32U, report1.alloc_size_bytes());
+  ASSERT_EQ(kStack1.depth, report1.call_stack().size());
+  for (size_t i = 0; i < kStack1.depth; ++i) {
+    EXPECT_EQ(GetOffsetInMapping(kStack1.stack[i]),
+              report1.call_stack()[i]) << i;
+  }
+
+  // |report2| comes from the call site marked with kStack2, with size=48.
+  const InternalLeakReport& report2 = *(++stored_reports_.begin());
+  EXPECT_EQ(48U, report2.alloc_size_bytes());
+  ASSERT_EQ(kStack2.depth, report2.call_stack().size());
+  for (size_t i = 0; i < kStack2.depth; ++i) {
+    EXPECT_EQ(GetOffsetInMapping(kStack2.stack[i]),
+              report2.call_stack()[i]) << i;
+  }
+
+  // Check historical data recorded in the reports.
+  // - Each inner loop iteration allocates a net of 1x 32 bytes and 1x 48 bytes.
+  // - Each outer loop iteration allocates a net of 32x 32 bytes and 32x 48
+  //   bytes.
+  // - However, the leak analysis happens after the allocs but before the frees
+  //   that come right after. So it should count the two extra allocs made at
+  //   call sites |kStack3| and |kStack4|. The formula is |(i + 1) * 32 + 2|,
+  //   where |i| is the iteration index.
+  // There should have been one leak analysis per outer loop iteration, for a
+  // total of 20 history records (|kNumOuterIterations|) per report.
+
+  const auto& report1_size_history = report1.size_breakdown_history();
+  EXPECT_EQ(20U, report1_size_history.size());
+
+  size_t index = 0;
+  for (const InternalVector<uint32_t>& entry : report1_size_history) {
+    ASSERT_GT(entry.size(), SizeToIndex(48));
+
+    // Check the two leaky sizes, 32 and 48.
+    EXPECT_EQ((index + 1) * 32 + 2, entry[SizeToIndex(32)]);
+    EXPECT_EQ((index + 1) * 32 + 2, entry[SizeToIndex(48)]);
+
+    // Not related to the leaks, but there should be a dangling 16-byte
+    // allocation during each leak analysis, because it hasn't yet been freed.
+    EXPECT_EQ(1U, entry[SizeToIndex(16)]);
+    ++index;
+  }
+
+  // |report2| should have the same size history as |report1|.
+  const auto& report2_size_history = report2.size_breakdown_history();
+  EXPECT_TRUE(std::equal(report1_size_history.begin(),
+                         report1_size_history.end(),
+                         report2_size_history.begin()));
+}
+
 TEST_F(LeakDetectorImplTest, JuliaSetNoLeak) {
   JuliaSet(false /* enable_leaks */);
 
@@ -430,35 +581,48 @@
   // |kStack3|.
   const InternalLeakReport& report1 = *stored_reports_.begin();
   EXPECT_EQ(sizeof(Complex) + 40, report1.alloc_size_bytes());
-  EXPECT_EQ(kStack3.depth, report1.call_stack().size());
-  for (size_t i = 0; i < kStack3.depth && i < report1.call_stack().size();
-       ++i) {
-    // The call stack's addresses may not fall within the mapping address.
-    // Those that don't will not be converted to mapping offsets.
-    if (kStack3.stack[i] >= kMappingAddr &&
-        kStack3.stack[i] <= kMappingAddr + kMappingSize) {
-      EXPECT_EQ(kStack3.stack[i] - kMappingAddr, report1.call_stack()[i]);
-    } else {
-      EXPECT_EQ(kStack3.stack[i], report1.call_stack()[i]);
-    }
+  ASSERT_EQ(kStack3.depth, report1.call_stack().size());
+  for (size_t i = 0; i < kStack3.depth; ++i) {
+    EXPECT_EQ(GetOffsetInMapping(kStack3.stack[i]),
+              report1.call_stack()[i]) << i;
   }
 
   // |report2| comes from the call site in JuliaSet() corresponding to
   // |kStack4|.
   const InternalLeakReport& report2 = *(++stored_reports_.begin());
   EXPECT_EQ(sizeof(Complex) + 52, report2.alloc_size_bytes());
-  EXPECT_EQ(kStack4.depth, report2.call_stack().size());
-  for (size_t i = 0; i < kStack4.depth && i < report2.call_stack().size();
-       ++i) {
-    // The call stack's addresses may not fall within the mapping address.
-    // Those that don't will not be converted to mapping offsets.
-    if (kStack4.stack[i] >= kMappingAddr &&
-        kStack4.stack[i] <= kMappingAddr + kMappingSize) {
-      EXPECT_EQ(kStack4.stack[i] - kMappingAddr, report2.call_stack()[i]);
-    } else {
-      EXPECT_EQ(kStack4.stack[i], report2.call_stack()[i]);
-    }
+  ASSERT_EQ(kStack4.depth, report2.call_stack().size());
+  for (size_t i = 0; i < kStack4.depth; ++i) {
+    EXPECT_EQ(GetOffsetInMapping(kStack4.stack[i]),
+              report2.call_stack()[i]) << i;
   }
+
+  // Check |report1|'s historical data.
+  const auto& report1_size_history = report1.size_breakdown_history();
+  // Computing the exact number of leak analyses is not trivial, but we know it
+  // must be at least |kSizeSuspicionThreshold + kCallStackSuspicionThreshold|
+  // in order to have generated a report.
+  EXPECT_GT(report1_size_history.size(),
+            kSizeSuspicionThreshold + kCallStackSuspicionThreshold);
+
+  // Make sure that the final allocation counts for the leaky sizes are larger
+  // than that of the non-leaky size by at least an order of magnitude.
+  const InternalVector<uint32_t>& final_entry = *report1_size_history.rbegin();
+  uint32_t size_0_index = SizeToIndex(sizeof(Complex) + 24);
+  uint32_t size_1_index = SizeToIndex(sizeof(Complex) + 40);
+  uint32_t size_2_index = SizeToIndex(sizeof(Complex) + 52);
+  ASSERT_LT(size_0_index, final_entry.size());
+  ASSERT_LT(size_1_index, final_entry.size());
+  ASSERT_LT(size_2_index, final_entry.size());
+
+  EXPECT_GT(final_entry[size_1_index], final_entry[size_0_index] * 10);
+  EXPECT_GT(final_entry[size_2_index], final_entry[size_0_index] * 10);
+
+  // |report2| should have the same size history as |report1|.
+  const auto& report2_size_history = report2.size_breakdown_history();
+  EXPECT_TRUE(std::equal(report1_size_history.begin(),
+                         report1_size_history.end(),
+                         report2_size_history.begin()));
 }
 
 }  // namespace leak_detector
diff --git a/components/mus/gles2/BUILD.gn b/components/mus/gles2/BUILD.gn
index 284fc43..8d9e61e 100644
--- a/components/mus/gles2/BUILD.gn
+++ b/components/mus/gles2/BUILD.gn
@@ -24,6 +24,8 @@
     "command_buffer_local_client.h",
     "command_buffer_task_runner.cc",
     "command_buffer_task_runner.h",
+    "gl_helper.cc",
+    "gl_helper.h",
     "gl_surface_adapter.cc",
     "gl_surface_adapter.h",
     "gpu_impl.cc",
@@ -41,6 +43,7 @@
     "//base",
     "//components/mus/public/interfaces",
     "//gpu/command_buffer/client",
+    "//gpu/command_buffer/client:gles2_interface",
     "//gpu/command_buffer/common:gles2_utils",
     "//gpu/command_buffer/service",
     "//gpu/config:config",
diff --git a/components/mus/gles2/command_buffer_driver.cc b/components/mus/gles2/command_buffer_driver.cc
index 9fba1fa2..ea0f540 100644
--- a/components/mus/gles2/command_buffer_driver.cc
+++ b/components/mus/gles2/command_buffer_driver.cc
@@ -15,11 +15,11 @@
 #include "components/mus/gles2/gpu_memory_tracker.h"
 #include "components/mus/gles2/gpu_state.h"
 #include "components/mus/gles2/mojo_buffer_backing.h"
+#include "gpu/command_buffer/common/gpu_memory_buffer_support.h"
 #include "gpu/command_buffer/service/command_buffer_service.h"
 #include "gpu/command_buffer/service/command_executor.h"
 #include "gpu/command_buffer/service/context_group.h"
 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
-#include "gpu/command_buffer/service/image_factory.h"
 #include "gpu/command_buffer/service/image_manager.h"
 #include "gpu/command_buffer/service/mailbox_manager.h"
 #include "gpu/command_buffer/service/query_manager.h"
@@ -222,21 +222,20 @@
   }
 
   gfx::BufferFormat gpu_format = static_cast<gfx::BufferFormat>(format);
-  if (!gpu::ImageFactory::IsGpuMemoryBufferFormatSupported(
-          gpu_format, decoder_->GetCapabilities())) {
+  if (!gpu::IsGpuMemoryBufferFormatSupported(gpu_format,
+                                             decoder_->GetCapabilities())) {
     LOG(ERROR) << "Format is not supported.";
     return;
   }
 
   gfx::Size gfx_size = size.To<gfx::Size>();
-  if (!gpu::ImageFactory::IsImageSizeValidForGpuMemoryBufferFormat(
-          gfx_size, gpu_format)) {
+  if (!gpu::IsImageSizeValidForGpuMemoryBufferFormat(gfx_size, gpu_format)) {
     LOG(ERROR) << "Invalid image size for format.";
     return;
   }
 
-  if (!gpu::ImageFactory::IsImageFormatCompatibleWithGpuMemoryBufferFormat(
-          internal_format, gpu_format)) {
+  if (!gpu::IsImageFormatCompatibleWithGpuMemoryBufferFormat(internal_format,
+                                                             gpu_format)) {
     LOG(ERROR) << "Incompatible image format.";
     return;
   }
diff --git a/components/mus/gles2/command_buffer_local.cc b/components/mus/gles2/command_buffer_local.cc
index 719ffdd..23a8fd1e 100644
--- a/components/mus/gles2/command_buffer_local.cc
+++ b/components/mus/gles2/command_buffer_local.cc
@@ -16,10 +16,10 @@
 #include "components/mus/gles2/gpu_state.h"
 #include "components/mus/gles2/mojo_buffer_backing.h"
 #include "components/mus/gles2/mojo_gpu_memory_buffer.h"
+#include "gpu/command_buffer/common/gpu_memory_buffer_support.h"
 #include "gpu/command_buffer/common/sync_token.h"
 #include "gpu/command_buffer/service/command_buffer_service.h"
 #include "gpu/command_buffer/service/context_group.h"
-#include "gpu/command_buffer/service/image_factory.h"
 #include "gpu/command_buffer/service/image_manager.h"
 #include "gpu/command_buffer/service/memory_tracking.h"
 #include "gpu/command_buffer/service/shader_translator_cache.h"
@@ -295,7 +295,7 @@
   DCHECK_EQ(usage, static_cast<unsigned>(GL_READ_WRITE_CHROMIUM));
   scoped_ptr<gfx::GpuMemoryBuffer> buffer(MojoGpuMemoryBufferImpl::Create(
       gfx::Size(static_cast<int>(width), static_cast<int>(height)),
-      gpu::ImageFactory::DefaultBufferFormatForImageFormat(internal_format),
+      gpu::DefaultBufferFormatForImageFormat(internal_format),
       gfx::BufferUsage::SCANOUT));
   if (!buffer)
     return -1;
diff --git a/components/mus/gles2/gl_helper.cc b/components/mus/gles2/gl_helper.cc
new file mode 100644
index 0000000..bbfef3f8
--- /dev/null
+++ b/components/mus/gles2/gl_helper.cc
@@ -0,0 +1,108 @@
+// Copyright (c) 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/mus/gles2/gl_helper.h"
+
+#include "base/macros.h"
+#include "third_party/skia/include/core/SkRect.h"
+#include "third_party/skia/include/core/SkRegion.h"
+
+namespace mus {
+
+namespace {
+
+class ScopedGLuint {
+ public:
+  typedef void (gpu::gles2::GLES2Interface::*GenFunc)(GLsizei n, GLuint* ids);
+  typedef void (gpu::gles2::GLES2Interface::*DeleteFunc)(GLsizei n,
+                                                         const GLuint* ids);
+  ScopedGLuint(gpu::gles2::GLES2Interface* gl,
+               GenFunc gen_func,
+               DeleteFunc delete_func)
+      : gl_(gl), id_(0u), delete_func_(delete_func) {
+    (gl_->*gen_func)(1, &id_);
+  }
+
+  operator GLuint() const { return id_; }
+
+  GLuint id() const { return id_; }
+
+  ~ScopedGLuint() {
+    if (id_ != 0) {
+      (gl_->*delete_func_)(1, &id_);
+    }
+  }
+
+ private:
+  gpu::gles2::GLES2Interface* gl_;
+  GLuint id_;
+  DeleteFunc delete_func_;
+
+  DISALLOW_COPY_AND_ASSIGN(ScopedGLuint);
+};
+
+class ScopedFramebuffer : public ScopedGLuint {
+ public:
+  explicit ScopedFramebuffer(gpu::gles2::GLES2Interface* gl)
+      : ScopedGLuint(gl,
+                     &gpu::gles2::GLES2Interface::GenFramebuffers,
+                     &gpu::gles2::GLES2Interface::DeleteFramebuffers) {}
+};
+
+template <GLenum Target>
+class ScopedBinder {
+ public:
+  typedef void (gpu::gles2::GLES2Interface::*BindFunc)(GLenum target,
+                                                       GLuint id);
+  ScopedBinder(gpu::gles2::GLES2Interface* gl, GLuint id, BindFunc bind_func)
+      : gl_(gl), bind_func_(bind_func) {
+    (gl_->*bind_func_)(Target, id);
+  }
+
+  virtual ~ScopedBinder() { (gl_->*bind_func_)(Target, 0); }
+
+ private:
+  gpu::gles2::GLES2Interface* gl_;
+  BindFunc bind_func_;
+
+  DISALLOW_COPY_AND_ASSIGN(ScopedBinder);
+};
+
+template <GLenum Target>
+class ScopedFramebufferBinder : ScopedBinder<Target> {
+ public:
+  ScopedFramebufferBinder(gpu::gles2::GLES2Interface* gl, GLuint id)
+      : ScopedBinder<Target>(gl,
+                             id,
+                             &gpu::gles2::GLES2Interface::BindFramebuffer) {}
+};
+
+}  // namespace
+
+// Cribbed from content/common/gpu/client/gl_helper.cc
+void GLCopySubBufferDamage(gpu::gles2::GLES2Interface* gl,
+                           GLenum target,
+                           GLuint texture,
+                           GLuint previous_texture,
+                           const SkRegion& new_damage,
+                           const SkRegion& old_damage) {
+  SkRegion region(old_damage);
+  if (region.op(new_damage, SkRegion::kDifference_Op)) {
+    ScopedFramebuffer dst_framebuffer(gl);
+    ScopedFramebufferBinder<GL_FRAMEBUFFER> framebuffer_binder(gl,
+                                                               dst_framebuffer);
+    gl->BindTexture(target, texture);
+    gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, target,
+                             previous_texture, 0);
+    for (SkRegion::Iterator it(region); !it.done(); it.next()) {
+      const SkIRect& rect = it.rect();
+      gl->CopyTexSubImage2D(target, 0, rect.x(), rect.y(), rect.x(), rect.y(),
+                            rect.width(), rect.height());
+    }
+    gl->BindTexture(target, 0);
+    gl->Flush();
+  }
+}
+
+}  // namespace mus
\ No newline at end of file
diff --git a/components/mus/gles2/gl_helper.h b/components/mus/gles2/gl_helper.h
new file mode 100644
index 0000000..e067cb3
--- /dev/null
+++ b/components/mus/gles2/gl_helper.h
@@ -0,0 +1,23 @@
+// Copyright (c) 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_MUS_GLES2_GL_HELPER_H_
+#define COMPONENTS_MUS_GLES2_GL_HELPER_H_
+
+#include "gpu/command_buffer/client/gles2_interface.h"
+
+class SkRegion;
+
+namespace mus {
+
+void GLCopySubBufferDamage(gpu::gles2::GLES2Interface* gl,
+                           GLenum target,
+                           GLuint texture,
+                           GLuint previous_texture,
+                           const SkRegion& new_damage,
+                           const SkRegion& old_damage);
+
+}  // namespace mus
+
+#endif  // COMPONENTS_MUS_GLES2_GL_HELPER_H_
\ No newline at end of file
diff --git a/components/mus/public/cpp/lib/window_tree_client_impl.cc b/components/mus/public/cpp/lib/window_tree_client_impl.cc
index 3567b52..4218528 100644
--- a/components/mus/public/cpp/lib/window_tree_client_impl.cc
+++ b/components/mus/public/cpp/lib/window_tree_client_impl.cc
@@ -524,6 +524,13 @@
   return focused_window_;
 }
 
+void WindowTreeClientImpl::ClearFocus() {
+  if (!focused_window_)
+    return;
+
+  SetFocus(nullptr);
+}
+
 Window* WindowTreeClientImpl::NewWindow(
     const Window::SharedProperties* properties) {
   return NewWindowImpl(NewWindowType::CHILD, properties);
diff --git a/components/mus/public/cpp/lib/window_tree_client_impl.h b/components/mus/public/cpp/lib/window_tree_client_impl.h
index df214078..8ed19e3 100644
--- a/components/mus/public/cpp/lib/window_tree_client_impl.h
+++ b/components/mus/public/cpp/lib/window_tree_client_impl.h
@@ -163,6 +163,7 @@
   const std::set<Window*>& GetRoots() override;
   Window* GetWindowById(Id id) override;
   Window* GetFocusedWindow() override;
+  void ClearFocus() override;
   Window* NewWindow(const Window::SharedProperties* properties) override;
   Window* NewTopLevelWindow(
       const Window::SharedProperties* properties) override;
diff --git a/components/mus/public/cpp/window.h b/components/mus/public/cpp/window.h
index 3ff669b..3737d40 100644
--- a/components/mus/public/cpp/window.h
+++ b/components/mus/public/cpp/window.h
@@ -196,7 +196,7 @@
   void SetCapture();
   void ReleaseCapture();
 
-  // Focus.
+  // Focus. See WindowTreeConnection::ClearFocus() to reset focus.
   void SetFocus();
   bool HasFocus() const;
   void SetCanFocus(bool can_focus);
diff --git a/components/mus/public/cpp/window_tree_connection.h b/components/mus/public/cpp/window_tree_connection.h
index 43db0f1..8132bfc 100644
--- a/components/mus/public/cpp/window_tree_connection.h
+++ b/components/mus/public/cpp/window_tree_connection.h
@@ -77,6 +77,9 @@
   // is focused.
   virtual Window* GetFocusedWindow() = 0;
 
+  // Sets focus to null. This does nothing if focus is currently null.
+  virtual void ClearFocus() = 0;
+
   // Creates and returns a new Window (which is owned by the window server).
   // Windows are initially hidden, use SetVisible(true) to show.
   Window* NewWindow() { return NewWindow(nullptr); }
diff --git a/components/mus/public/interfaces/window_tree.mojom b/components/mus/public/interfaces/window_tree.mojom
index 2583e91..90bdec0 100644
--- a/components/mus/public/interfaces/window_tree.mojom
+++ b/components/mus/public/interfaces/window_tree.mojom
@@ -215,7 +215,14 @@
   // The callback returns whether the embedding was successful.
   Embed(uint32 window_id, WindowTreeClient client) => (bool success);
 
+  // Sets focus to the specified window, use 0 to clear focus. For a window to
+  // get focus the following has to happen: the window is drawn, the window has
+  // been marked as focusable (see SetCanFocus()) and the window is in a
+  // container the WindowManager has identified as allowing activation
+  // (see WindowManagerClient::AddActivationParent()).
   SetFocus(uint32 change_id, uint32 window_id);
+
+  // Marks the specified window as being able to receive focus.
   SetCanFocus(uint32 window_id, bool can_focus);
 
   // Sets the cursor when the pointer is inside |window_id| to a system standard
diff --git a/components/mus/ws/default_access_policy.cc b/components/mus/ws/default_access_policy.cc
index 347a058b..c45a969 100644
--- a/components/mus/ws/default_access_policy.cc
+++ b/components/mus/ws/default_access_policy.cc
@@ -129,7 +129,7 @@
 }
 
 bool DefaultAccessPolicy::CanSetFocus(const ServerWindow* window) const {
-  return WasCreatedByThisConnection(window) ||
+  return !window || WasCreatedByThisConnection(window) ||
          delegate_->HasRootForAccessPolicy(window);
 }
 
diff --git a/components/mus/ws/window_manager_client_unittest.cc b/components/mus/ws/window_manager_client_unittest.cc
index a064f07..86e096e 100644
--- a/components/mus/ws/window_manager_client_unittest.cc
+++ b/components/mus/ws/window_manager_client_unittest.cc
@@ -758,6 +758,44 @@
   }
 }
 
+TEST_F(WindowServerTest, ClearFocus) {
+  Window* window1 = window_manager()->NewWindow();
+  window1->SetVisible(true);
+  GetFirstWMRoot()->AddChild(window1);
+
+  WindowTreeConnection* embedded = Embed(window1).connection;
+  ASSERT_NE(nullptr, embedded);
+  Window* window11 = embedded->NewWindow();
+  window11->SetVisible(true);
+  GetFirstRoot(embedded)->AddChild(window11);
+
+  // Focus the embed root in |embedded|.
+  Window* embedded_root = GetFirstRoot(embedded);
+  {
+    FocusChangeObserver observer(embedded_root);
+    observer.set_quit_on_change(false);
+    embedded_root->SetFocus();
+    ASSERT_TRUE(embedded_root->HasFocus());
+    ASSERT_NE(nullptr, observer.last_gained_focus());
+    EXPECT_EQ(embedded_root->id(), observer.last_gained_focus()->id());
+
+    // |embedded_root| is the same as |window1|, make sure |window1| got
+    // focus too.
+    ASSERT_TRUE(WaitForWindowToHaveFocus(window1));
+  }
+
+  {
+    FocusChangeObserver observer(window1);
+    embedded->ClearFocus();
+    ASSERT_FALSE(embedded_root->HasFocus());
+    EXPECT_FALSE(embedded->GetFocusedWindow());
+
+    ASSERT_TRUE(WindowServerTestBase::DoRunLoopWithTimeout());
+    EXPECT_FALSE(window1->HasFocus());
+    EXPECT_FALSE(window_manager()->GetFocusedWindow());
+  }
+}
+
 TEST_F(WindowServerTest, FocusNonFocusableWindow) {
   Window* window = window_manager()->NewWindow();
   window->SetVisible(true);
diff --git a/components/mus/ws/window_server.cc b/components/mus/ws/window_server.cc
index fdef43c..14e2c9af 100644
--- a/components/mus/ws/window_server.cc
+++ b/components/mus/ws/window_server.cc
@@ -240,12 +240,15 @@
 void WindowServer::SetFocusedWindow(ServerWindow* window) {
   // TODO(sky): this should fail if there is modal dialog active and |window|
   // is outside that.
-  Display* focused_display = nullptr;
-  for (Display* display : display_manager_->displays()) {
-    if (display->GetFocusedWindow()) {
-      focused_display = display;
-      break;
-    }
+  ServerWindow* currently_focused = GetFocusedWindow();
+  Display* focused_display =
+      currently_focused
+          ? display_manager_->GetDisplayContaining(currently_focused)
+          : nullptr;
+  if (!window) {
+    if (focused_display)
+      focused_display->SetFocusedWindow(nullptr);
+    return;
   }
   Display* display = display_manager_->GetDisplayContaining(window);
   DCHECK(display);  // It's assumed callers do validation before calling this.
@@ -259,6 +262,15 @@
   }
 }
 
+ServerWindow* WindowServer::GetFocusedWindow() {
+  for (Display* display : display_manager_->displays()) {
+    ServerWindow* focused_window = display->GetFocusedWindow();
+    if (focused_window)
+      return focused_window;
+  }
+  return nullptr;
+}
+
 uint32_t WindowServer::GenerateWindowManagerChangeId(
     WindowTree* source,
     uint32_t client_change_id) {
diff --git a/components/mus/ws/window_server.h b/components/mus/ws/window_server.h
index 2f9aee1..b05efb8e 100644
--- a/components/mus/ws/window_server.h
+++ b/components/mus/ws/window_server.h
@@ -134,8 +134,8 @@
     return &window_manager_factory_registry_;
   }
 
-  // Sets focus to the specified window.
   void SetFocusedWindow(ServerWindow* window);
+  ServerWindow* GetFocusedWindow();
 
   // Returns a change id for the window manager that is associated with
   // |source| and |client_change_id|. When the window manager replies
diff --git a/components/mus/ws/window_tree.cc b/components/mus/ws/window_tree.cc
index 5cde328..b582d85 100644
--- a/components/mus/ws/window_tree.cc
+++ b/components/mus/ws/window_tree.cc
@@ -269,15 +269,16 @@
 
 bool WindowTree::SetFocus(const ClientWindowId& window_id) {
   ServerWindow* window = GetWindowByClientId(window_id);
-  // TODO(beng): consider shifting non-policy drawn check logic to VTH's
-  //             FocusController.
-  // TODO(sky): this doesn't work to clear focus. That is because if window is
-  // null, then |host| is null and we fail.
-  Display* display = GetDisplay(window);
-  if (!window || !display || !window->IsDrawn() || !window->can_focus() ||
-      !access_policy_->CanSetFocus(window)) {
+  ServerWindow* currently_focused = window_server_->GetFocusedWindow();
+  if (!currently_focused && !window)
     return false;
-  }
+
+  Display* display = GetDisplay(window);
+  if (window && (!display || !window->can_focus() || !window->IsDrawn()))
+    return false;
+
+  if (!access_policy_->CanSetFocus(window))
+    return false;
 
   Operation op(this, window_server_, OperationType::SET_FOCUS);
   window_server_->SetFocusedWindow(window);
@@ -673,8 +674,9 @@
 }
 
 bool WindowTree::IsValidIdForNewWindow(const ClientWindowId& id) const {
+  // Reserve 0 to indicate a null window.
   return client_id_to_window_id_map_.count(id) == 0u &&
-         access_policy_->IsValidIdForNewWindow(id);
+         access_policy_->IsValidIdForNewWindow(id) && id != ClientWindowId();
 }
 
 WindowId WindowTree::GenerateNewWindowId() {
diff --git a/components/nacl/browser/nacl_host_message_filter.cc b/components/nacl/browser/nacl_host_message_filter.cc
index aab275d..72a9565 100644
--- a/components/nacl/browser/nacl_host_message_filter.cc
+++ b/components/nacl/browser/nacl_host_message_filter.cc
@@ -325,8 +325,7 @@
   if (file.IsValid()) {
     // Don't close our copy of the handle, because PnaclHost will use it
     // when the translation finishes.
-    fd = IPC::GetFileHandleForProcess(file.GetPlatformFile(), PeerHandle(),
-                                      false);
+    fd = IPC::GetPlatformFileForTransit(file.GetPlatformFile(), false);
   }
   Send(new NaClViewMsg_NexeTempFileReply(pp_instance, is_hit, fd));
 }
diff --git a/components/nacl/browser/nacl_process_host.cc b/components/nacl/browser/nacl_process_host.cc
index 84e48f3..7d604dc 100644
--- a/components/nacl/browser/nacl_process_host.cc
+++ b/components/nacl/browser/nacl_process_host.cc
@@ -883,12 +883,11 @@
     params.version = NaClBrowser::GetDelegate()->GetVersionString();
     params.enable_debug_stub = enable_nacl_debug;
 
-    const ChildProcessData& data = process_->GetData();
     const base::File& irt_file = nacl_browser->IrtFile();
     CHECK(irt_file.IsValid());
     // Send over the IRT file handle.  We don't close our own copy!
-    params.irt_handle = IPC::GetFileHandleForProcess(
-        irt_file.GetPlatformFile(), data.handle, false);
+    params.irt_handle = IPC::GetPlatformFileForTransit(
+        irt_file.GetPlatformFile(), false);
     if (params.irt_handle == IPC::InvalidPlatformFileForTransit()) {
       return false;
     }
@@ -918,16 +917,16 @@
       DLOG(ERROR) << "Failed to dup() a file descriptor";
       return false;
     }
-    params.mac_shm_fd = IPC::GetFileHandleForProcess(
-        memory_fd.release(), data.handle, true);
+    params.mac_shm_fd = IPC::GetPlatformFileForTransit(
+        memory_fd.release(), true);
 #endif
 
 #if defined(OS_POSIX)
     if (params.enable_debug_stub) {
       net::SocketDescriptor server_bound_socket = GetDebugStubSocketHandle();
       if (server_bound_socket != net::kInvalidSocket) {
-        params.debug_stub_server_bound_socket = IPC::GetFileHandleForProcess(
-            server_bound_socket, data.handle, true);
+        params.debug_stub_server_bound_socket = IPC::GetPlatformFileForTransit(
+            server_bound_socket, true);
       }
     }
 #endif
diff --git a/components/nacl/browser/pnacl_host.h b/components/nacl/browser/pnacl_host.h
index 2a0bb87..c9e93c6 100644
--- a/components/nacl/browser/pnacl_host.h
+++ b/components/nacl/browser/pnacl_host.h
@@ -66,8 +66,8 @@
   // TranslationFinished after it finishes translation to allow the nexe to be
   // stored in the cache.
   // The returned temp fd may be closed at any time by PnaclHost, so it should
-  // be duplicated (e.g. with IPC::GetFileHandleForProcess) before the callback
-  // returns.
+  // be duplicated (e.g. with IPC::GetPlatformFileForTransit) before the
+  // callback returns.
   // If |is_incognito| is true, the nexe will not be stored
   // in the cache, but the renderer is still expected to call
   // TranslationFinished.
diff --git a/components/translate/content/browser/data_file_browser_cld_data_provider.cc b/components/translate/content/browser/data_file_browser_cld_data_provider.cc
index dcfe4ce..ca658036 100644
--- a/components/translate/content/browser/data_file_browser_cld_data_provider.cc
+++ b/components/translate/content/browser/data_file_browser_cld_data_provider.cc
@@ -160,10 +160,8 @@
   }
 
   // Data available, respond to the request.
-  base::ProcessHandle render_process_handle = render_process_host->GetHandle();
   IPC::PlatformFileForTransit ipc_platform_file =
-      IPC::GetFileHandleForProcess(handle->GetPlatformFile(),
-                                   render_process_handle, false);
+      IPC::GetPlatformFileForTransit(handle->GetPlatformFile(), false);
 
   // In general, sending a response from within the code path that is processing
   // a request is discouraged because there is potential for deadlock (if the
diff --git a/components/translate/content/common/data_file_cld_data_provider_messages.h b/components/translate/content/common/data_file_cld_data_provider_messages.h
index 1faa3b6..2e8db3f 100644
--- a/components/translate/content/common/data_file_cld_data_provider_messages.h
+++ b/components/translate/content/common/data_file_cld_data_provider_messages.h
@@ -29,7 +29,7 @@
 
 // Informs the renderer process that Compact Language Detector (CLD) data is
 // available and provides an IPC::PlatformFileForTransit obtained from
-// IPC::GetFileHandleForProcess(...)
+// IPC::GetPlatformFileForTransit(...)
 // This message is sent by a DataFileBrowserCldDataProvider to a
 // DataFileRendererCldDataProvider.
 IPC_MESSAGE_ROUTED3(ChromeFrameMsg_CldDataFileAvailable,
diff --git a/components/url_formatter/elide_url.cc b/components/url_formatter/elide_url.cc
index bcc8840..6e164f9 100644
--- a/components/url_formatter/elide_url.cc
+++ b/components/url_formatter/elide_url.cc
@@ -78,15 +78,17 @@
                base::string16* url_host,
                base::string16* url_domain,
                base::string16* url_subdomain) {
-  // Get Host.
-  *url_host = base::UTF8ToUTF16(url.host());
+  // GURL stores IDN hostnames in punycode.  Convert back to Unicode for
+  // display to the user.  (IDNToUnicode() will only perform this conversion
+  // if it's safe to display this host/domain in Unicode.)
+  *url_host = url_formatter::IDNToUnicode(url.host());
 
   // Get domain and registry information from the URL.
-  *url_domain =
-      base::UTF8ToUTF16(net::registry_controlled_domains::GetDomainAndRegistry(
-          url, net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES));
-  if (url_domain->empty())
-    *url_domain = *url_host;
+  std::string domain_puny =
+      net::registry_controlled_domains::GetDomainAndRegistry(
+          url, net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES);
+  *url_domain = domain_puny.empty() ?
+      *url_host : url_formatter::IDNToUnicode(domain_puny);
 
   // Add port if required.
   if (!url.port().empty()) {
diff --git a/components/url_formatter/elide_url_unittest.cc b/components/url_formatter/elide_url_unittest.cc
index 1d911a8e..2a62f1f62 100644
--- a/components/url_formatter/elide_url_unittest.cc
+++ b/components/url_formatter/elide_url_unittest.cc
@@ -196,6 +196,9 @@
       {"http://subdomain.reallylongdomainname.com",
        kEllipsisStr + "ain.reallylongdomainname.com", Testcase::NO_IOS},
       {"http://a.b.c.d.e.f.com", kEllipsisStr + ".e.f.com", Testcase::NO_IOS},
+      // IDN - Greek alpha.beta.gamma.delta.epsilon.zeta.com
+      {"http://xn--mxa.xn--nxa.xn--oxa.xn--pxa.xn--qxa.xn--rxa.com",
+       kEllipsisStr + ".\xCE\xB5.\xCE\xB6.com", Testcase::NO_IOS},
   };
 
   for (size_t i = 0; i < arraysize(testcases); ++i) {
diff --git a/content/DEPS b/content/DEPS
index 531e5ed..1d6f952 100644
--- a/content/DEPS
+++ b/content/DEPS
@@ -114,7 +114,7 @@
 
 # content -> content/shell dependency is not allowed, except for browser tests.
 specific_include_rules = {
-  ".*_browsertest[a-z_]*\.cc": [
+  ".*_browsertest[a-z_]*\.(cc|h)": [
     "+content/shell/browser",
     "+content/shell/common",
   ],
diff --git a/content/app/strings/content_strings.grd b/content/app/strings/content_strings.grd
index 51f16efe..9219357a 100644
--- a/content/app/strings/content_strings.grd
+++ b/content/app/strings/content_strings.grd
@@ -168,6 +168,9 @@
       <message name="IDS_DETAILS_WITHOUT_SUMMARY_LABEL" desc="Clickable label to show detailed information or to hide the detailed information.">
         Details
       </message>
+      <message name="IDS_DOWNLOAD_BUTTON_LABEL" desc="Clickable button label to download media file.">
+        Save
+      </message>
       <message name="IDS_SEARCHABLE_INDEX_INTRO" desc="Text that appears at the start of nearly-obsolete webpages in the form of a 'searchable index'.">
         This is a searchable index. Enter search keywords: '''
       </message>
diff --git a/content/browser/browser_child_process_host_impl.cc b/content/browser/browser_child_process_host_impl.cc
index 6385e9a..76b63e5 100644
--- a/content/browser/browser_child_process_host_impl.cc
+++ b/content/browser/browser_child_process_host_impl.cc
@@ -409,8 +409,8 @@
 
   mojo::edk::ScopedPlatformHandle client_pipe =
       mojo::edk::ChildProcessLaunched(process.Handle());
-  Send(new ChildProcessMsg_SetMojoParentPipeHandle(IPC::GetFileHandleForProcess(
-      client_pipe.release().handle, process.Handle(), true)));
+  Send(new ChildProcessMsg_SetMojoParentPipeHandle(
+      IPC::GetPlatformFileForTransit(client_pipe.release().handle, true)));
 
 #if defined(OS_WIN)
   // Start a WaitableEventWatcher that will invoke OnProcessExitedEarly if the
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc
index fd0c173e..ad4474f 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.cc
+++ b/content/browser/browser_plugin/browser_plugin_guest.cc
@@ -979,10 +979,9 @@
       new BrowserPluginMsg_AdvanceFocus(browser_plugin_instance_id(), reverse));
 }
 
-void BrowserPluginGuest::OnTextInputStateChanged(
-    const ViewHostMsg_TextInputState_Params& params) {
+void BrowserPluginGuest::OnTextInputStateChanged(const TextInputState& params) {
   // Save the state of text input so we can restore it on focus.
-  last_text_input_state_.reset(new ViewHostMsg_TextInputState_Params(params));
+  last_text_input_state_.reset(new TextInputState(params));
 
   SendTextInputTypeChangedToView(
       static_cast<RenderWidgetHostViewBase*>(
diff --git a/content/browser/browser_plugin/browser_plugin_guest.h b/content/browser/browser_plugin/browser_plugin_guest.h
index e6676f7..9158709 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.h
+++ b/content/browser/browser_plugin/browser_plugin_guest.h
@@ -45,7 +45,6 @@
 #include "ui/gfx/geometry/rect.h"
 
 struct BrowserPluginHostMsg_Attach_Params;
-struct ViewHostMsg_TextInputState_Params;
 
 #if defined(OS_MACOSX)
 struct FrameHostMsg_ShowPopup_Params;
@@ -70,6 +69,7 @@
 class RenderWidgetHostViewBase;
 class SiteInstance;
 struct DropData;
+struct TextInputState;
 
 // A browser plugin guest provides functionality for WebContents to operate in
 // the guest role and implements guest-specific overrides for ViewHostMsg_*
@@ -332,8 +332,7 @@
   void OnUnlockMouseAck(int instance_id);
   void OnUpdateGeometry(int instance_id, const gfx::Rect& view_rect);
 
-  void OnTextInputStateChanged(
-      const ViewHostMsg_TextInputState_Params& params);
+  void OnTextInputStateChanged(const TextInputState& params);
   void OnImeSetComposition(
       int instance_id,
       const std::string& text,
@@ -426,7 +425,7 @@
 
   // Text input type states.
   // Using scoped_ptr to avoid including the header file: view_messages.h.
-  scoped_ptr<const ViewHostMsg_TextInputState_Params> last_text_input_state_;
+  scoped_ptr<const TextInputState> last_text_input_state_;
 
   // The is the routing ID for a swapped out RenderView for the guest
   // WebContents in the embedder's process.
diff --git a/content/browser/compositor/buffer_queue.cc b/content/browser/compositor/buffer_queue.cc
index fe306aa..bb1919e 100644
--- a/content/browser/compositor/buffer_queue.cc
+++ b/content/browser/compositor/buffer_queue.cc
@@ -12,6 +12,7 @@
 #include "content/common/gpu/client/context_provider_command_buffer.h"
 #include "gpu/GLES2/gl2extchromium.h"
 #include "gpu/command_buffer/client/gles2_interface.h"
+#include "gpu/command_buffer/common/gpu_memory_buffer_support.h"
 #include "gpu/command_buffer/service/image_factory.h"
 #include "third_party/skia/include/core/SkRect.h"
 #include "third_party/skia/include/core/SkRegion.h"
@@ -223,8 +224,7 @@
 
   scoped_ptr<gfx::GpuMemoryBuffer> buffer(
       gpu_memory_buffer_manager_->AllocateGpuMemoryBufferForScanout(
-          size_, gpu::ImageFactory::DefaultBufferFormatForImageFormat(
-                     internal_format_),
+          size_, gpu::DefaultBufferFormatForImageFormat(internal_format_),
           surface_id_));
   if (!buffer.get()) {
     gl->DeleteTextures(1, &texture);
diff --git a/content/browser/dom_storage/dom_storage_context_wrapper.cc b/content/browser/dom_storage/dom_storage_context_wrapper.cc
index 0490d2e0..b0ec4d5a 100644
--- a/content/browser/dom_storage/dom_storage_context_wrapper.cc
+++ b/content/browser/dom_storage/dom_storage_context_wrapper.cc
@@ -84,10 +84,11 @@
         weak_ptr_factory_(this) {}
 
   void OpenLocalStorage(const url::Origin& origin,
+                        mojom::LevelDBObserverPtr observer,
                         mojom::LevelDBWrapperRequest request);
 
  private:
-  void LevelDBWrapperImplHasNoBindings(const url::Origin& origin) {
+  void OnLevelDDWrapperHasNoBindings(const url::Origin& origin) {
     DCHECK(level_db_wrappers_.find(origin) != level_db_wrappers_.end());
     level_db_wrappers_.erase(origin);
   }
@@ -99,6 +100,7 @@
   // The (possibly delayed) implementation of OpenLocalStorage(). Can be called
   // directly from that function, or through |on_database_open_callbacks_|.
   void BindLocalStorage(const url::Origin& origin,
+                        mojom::LevelDBObserverPtr observer,
                         mojom::LevelDBWrapperRequest request);
 
   // Maps between an origin and its prefixed LevelDB view.
@@ -127,6 +129,7 @@
 
 void DOMStorageContextWrapper::MojoState::OpenLocalStorage(
     const url::Origin& origin,
+    mojom::LevelDBObserverPtr observer,
     mojom::LevelDBWrapperRequest request) {
   // If we don't have a filesystem_connection_, we'll need to establish one.
   if (connection_state_ == NO_CONNECTION) {
@@ -158,11 +161,11 @@
     // Queue this OpenLocalStorage call for when we have a level db pointer.
     on_database_opened_callbacks_.push_back(
         base::Bind(&MojoState::BindLocalStorage, weak_ptr_factory_.GetWeakPtr(),
-                   origin, base::Passed(&request)));
+                   origin, base::Passed(&observer), base::Passed(&request)));
     return;
   }
 
-  BindLocalStorage(origin, std::move(request));
+  BindLocalStorage(origin, std::move(observer), std::move(request));
 }
 
 void DOMStorageContextWrapper::MojoState::OnDirectoryOpened(
@@ -208,17 +211,22 @@
 
 void DOMStorageContextWrapper::MojoState::BindLocalStorage(
     const url::Origin& origin,
+    mojom::LevelDBObserverPtr observer,
     mojom::LevelDBWrapperRequest request) {
-  if (level_db_wrappers_.find(origin) == level_db_wrappers_.end()) {
+  auto found = level_db_wrappers_.find(origin);
+  if (found == level_db_wrappers_.end()) {
     level_db_wrappers_[origin] = make_scoped_ptr(new LevelDBWrapperImpl(
         database_.get(),
         origin.Serialize(),
-        base::Bind(&MojoState::LevelDBWrapperImplHasNoBindings,
+        kPerStorageAreaQuota + kPerStorageAreaOverQuotaAllowance,
+        base::Bind(&MojoState::OnLevelDDWrapperHasNoBindings,
                    base::Unretained(this),
                    origin)));
+    found = level_db_wrappers_.find(origin);
   }
 
-  level_db_wrappers_[origin]->Bind(std::move(request));
+  found->second->Bind(std::move(request));
+  found->second->AddObserver(std::move(observer));
 }
 
 DOMStorageContextWrapper::DOMStorageContextWrapper(
@@ -336,8 +344,10 @@
 
 void DOMStorageContextWrapper::OpenLocalStorage(
     const url::Origin& origin,
+    mojom::LevelDBObserverPtr observer,
     mojom::LevelDBWrapperRequest request) {
-  mojo_state_->OpenLocalStorage(origin, std::move(request));
+  mojo_state_->OpenLocalStorage(
+      origin, std::move(observer), std::move(request));
 }
 
 }  // namespace content
diff --git a/content/browser/dom_storage/dom_storage_context_wrapper.h b/content/browser/dom_storage/dom_storage_context_wrapper.h
index 83b811d..56196a1 100644
--- a/content/browser/dom_storage/dom_storage_context_wrapper.h
+++ b/content/browser/dom_storage/dom_storage_context_wrapper.h
@@ -66,6 +66,7 @@
 
   // See mojom::StoragePartitionService interface.
   void OpenLocalStorage(const url::Origin& origin,
+                        mojom::LevelDBObserverPtr observer,
                         mojom::LevelDBWrapperRequest request);
 
  private:
diff --git a/content/browser/download/mhtml_generation_manager.cc b/content/browser/download/mhtml_generation_manager.cc
index ef92023..623ab535 100644
--- a/content/browser/download/mhtml_generation_manager.cc
+++ b/content/browser/download/mhtml_generation_manager.cc
@@ -188,9 +188,8 @@
   ipc_params.salt = salt_;
   ipc_params.digests_of_uris_to_skip = digests_of_already_serialized_uris_;
 
-  ipc_params.destination_file = IPC::GetFileHandleForProcess(
-      browser_file_.GetPlatformFile(), rfh->GetProcess()->GetHandle(),
-      false);  // |close_source_handle|.
+  ipc_params.destination_file = IPC::GetPlatformFileForTransit(
+      browser_file_.GetPlatformFile(), false);  // |close_source_handle|.
   ipc_params.frame_routing_id_to_content_id =
       CreateFrameRoutingIdToContentId(rfh->GetSiteInstance());
 
diff --git a/content/browser/frame_host/interstitial_page_impl.cc b/content/browser/frame_host/interstitial_page_impl.cc
index 784c9b48..62fd22e6 100644
--- a/content/browser/frame_host/interstitial_page_impl.cc
+++ b/content/browser/frame_host/interstitial_page_impl.cc
@@ -33,6 +33,7 @@
 #include "content/browser/web_contents/web_contents_view.h"
 #include "content/common/frame_messages.h"
 #include "content/common/input_messages.h"
+#include "content/common/text_input_state.h"
 #include "content/common/view_messages.h"
 #include "content/public/browser/browser_context.h"
 #include "content/public/browser/browser_thread.h"
@@ -171,6 +172,7 @@
       create_view_(true),
       pause_throbber_(false),
       delegate_(delegate),
+      text_input_state_(new TextInputState()),
       weak_ptr_factory_(this) {
   InitInterstitialPageMap();
 }
@@ -537,6 +539,19 @@
   CHECK(!web_contents_);
 }
 
+const TextInputState* InterstitialPageImpl::GetTextInputState() {
+  return text_input_state_.get();
+}
+
+void InterstitialPageImpl::UpdateTextInputState(RenderWidgetHostViewBase* rwhv,
+                                                bool text_input_state_changed) {
+  if (web_contents_) {
+    WebContentsImpl* contents = static_cast<WebContentsImpl*>(web_contents_);
+    contents->UpdateTextInputState(rwhv, text_input_state_changed);
+    *text_input_state_ = *contents->GetTextInputState();
+  }
+}
+
 bool InterstitialPageImpl::PreHandleKeyboardEvent(
     const NativeWebKeyboardEvent& event,
     bool* is_keyboard_shortcut) {
diff --git a/content/browser/frame_host/interstitial_page_impl.h b/content/browser/frame_host/interstitial_page_impl.h
index f619d05..18e3df7e7 100644
--- a/content/browser/frame_host/interstitial_page_impl.h
+++ b/content/browser/frame_host/interstitial_page_impl.h
@@ -30,6 +30,7 @@
 class RenderViewHostImpl;
 class RenderWidgetHostView;
 class WebContentsView;
+struct TextInputState;
 
 enum ResourceRequestAction {
   BLOCK,
@@ -153,6 +154,9 @@
 
   // RenderWidgetHostDelegate implementation:
   void RenderWidgetDeleted(RenderWidgetHostImpl* render_widget_host) override;
+  const TextInputState* GetTextInputState() override;
+  void UpdateTextInputState(RenderWidgetHostViewBase* rwhv,
+                            bool text_input_state_changed) override;
   bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event,
                               bool* is_keyboard_shortcut) override;
   void HandleKeyboardEvent(const NativeWebKeyboardEvent& event) override;
@@ -295,6 +299,8 @@
 
   scoped_refptr<SessionStorageNamespace> session_storage_namespace_;
 
+  scoped_ptr<TextInputState> text_input_state_;
+
   base::WeakPtrFactory<InterstitialPageImpl> weak_ptr_factory_;
 
   DISALLOW_COPY_AND_ASSIGN(InterstitialPageImpl);
diff --git a/content/browser/frame_host/render_widget_host_view_child_frame.cc b/content/browser/frame_host/render_widget_host_view_child_frame.cc
index 6c022fb..5a3c8f7 100644
--- a/content/browser/frame_host/render_widget_host_view_child_frame.cc
+++ b/content/browser/frame_host/render_widget_host_view_child_frame.cc
@@ -218,11 +218,6 @@
   NOTREACHED();
 }
 
-void RenderWidgetHostViewChildFrame::TextInputStateChanged(
-    const ViewHostMsg_TextInputState_Params& params) {
-  // TODO(kenrb): Implement.
-}
-
 void RenderWidgetHostViewChildFrame::RenderProcessGone(
     base::TerminationStatus status,
     int error_code) {
@@ -245,6 +240,10 @@
   // RenderWidgetHostInputEventRouter afterwards.
   NotifyObserversAboutShutdown();
 
+  // If this view has an active text input, the RenderWidgetHostDelegate should
+  // be notified.
+  NotifyHostDelegateAboutShutdown();
+
   host_->SetView(NULL);
   host_ = NULL;
   base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
diff --git a/content/browser/frame_host/render_widget_host_view_child_frame.h b/content/browser/frame_host/render_widget_host_view_child_frame.h
index 825ca060..f4dc64a 100644
--- a/content/browser/frame_host/render_widget_host_view_child_frame.h
+++ b/content/browser/frame_host/render_widget_host_view_child_frame.h
@@ -97,8 +97,6 @@
   void InitAsFullscreen(RenderWidgetHostView* reference_host_view) override;
   void UpdateCursor(const WebCursor& cursor) override;
   void SetIsLoading(bool is_loading) override;
-  void TextInputStateChanged(
-      const ViewHostMsg_TextInputState_Params& params) override;
   void ImeCancelComposition() override;
   void ImeCompositionRangeChanged(
       const gfx::Range& range,
diff --git a/content/browser/frame_host/render_widget_host_view_child_frame_unittest.cc b/content/browser/frame_host/render_widget_host_view_child_frame_unittest.cc
index 4584e08..abd4423 100644
--- a/content/browser/frame_host/render_widget_host_view_child_frame_unittest.cc
+++ b/content/browser/frame_host/render_widget_host_view_child_frame_unittest.cc
@@ -19,6 +19,7 @@
 #include "content/browser/gpu/compositor_util.h"
 #include "content/browser/renderer_host/render_widget_host_delegate.h"
 #include "content/browser/renderer_host/render_widget_host_impl.h"
+#include "content/common/text_input_state.h"
 #include "content/common/view_messages.h"
 #include "content/public/browser/render_widget_host_view.h"
 #include "content/public/test/mock_render_process_host.h"
@@ -30,13 +31,20 @@
 namespace {
 class MockRenderWidgetHostDelegate : public RenderWidgetHostDelegate {
  public:
-  MockRenderWidgetHostDelegate() {}
+  MockRenderWidgetHostDelegate() : text_input_state_(new TextInputState()) {}
   ~MockRenderWidgetHostDelegate() override {}
+
+  const TextInputState* GetTextInputState() override {
+    return text_input_state_.get();
+  }
+
  private:
   void Cut() override {}
   void Copy() override {}
   void Paste() override {}
   void SelectAll() override {}
+
+  scoped_ptr<TextInputState> text_input_state_;
 };
 
 class MockCrossProcessFrameConnector : public CrossProcessFrameConnector {
diff --git a/content/browser/frame_host/render_widget_host_view_guest.cc b/content/browser/frame_host/render_widget_host_view_guest.cc
index e90f44b..41e31c0a 100644
--- a/content/browser/frame_host/render_widget_host_view_guest.cc
+++ b/content/browser/frame_host/render_widget_host_view_guest.cc
@@ -348,18 +348,6 @@
   platform_view_->SetIsLoading(is_loading);
 }
 
-void RenderWidgetHostViewGuest::TextInputStateChanged(
-    const ViewHostMsg_TextInputState_Params& params) {
-  if (!guest_)
-    return;
-
-  RenderWidgetHostViewBase* rwhv = GetOwnerRenderWidgetHostView();
-  if (!rwhv)
-    return;
-  // Forward the information to embedding RWHV.
-  rwhv->TextInputStateChanged(params);
-}
-
 void RenderWidgetHostViewGuest::ImeCancelComposition() {
   if (!guest_)
     return;
@@ -506,6 +494,10 @@
   // processing calls coming in after we release host_.
   NotifyObserversAboutShutdown();
 
+  // The WebContentsImpl should be notified about us so that it will not hold
+  // an invalid text input state which was due to active text on this view.
+  NotifyHostDelegateAboutShutdown();
+
   host_->SetView(NULL);
   host_ = NULL;
   base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
diff --git a/content/browser/frame_host/render_widget_host_view_guest.h b/content/browser/frame_host/render_widget_host_view_guest.h
index 4e800c8..7581832 100644
--- a/content/browser/frame_host/render_widget_host_view_guest.h
+++ b/content/browser/frame_host/render_widget_host_view_guest.h
@@ -24,8 +24,6 @@
 #include "ui/gfx/geometry/vector2d_f.h"
 #include "ui/gfx/native_widget_types.h"
 
-struct ViewHostMsg_TextInputState_Params;
-
 namespace content {
 class BrowserPluginGuest;
 class RenderWidgetHost;
@@ -78,8 +76,6 @@
   void InitAsFullscreen(RenderWidgetHostView* reference_host_view) override;
   void UpdateCursor(const WebCursor& cursor) override;
   void SetIsLoading(bool is_loading) override;
-  void TextInputStateChanged(
-      const ViewHostMsg_TextInputState_Params& params) override;
   void ImeCancelComposition() override;
 #if defined(OS_MACOSX) || defined(USE_AURA)
   void ImeCompositionRangeChanged(
diff --git a/content/browser/frame_host/render_widget_host_view_guest_unittest.cc b/content/browser/frame_host/render_widget_host_view_guest_unittest.cc
index 3d772d4..20db376 100644
--- a/content/browser/frame_host/render_widget_host_view_guest_unittest.cc
+++ b/content/browser/frame_host/render_widget_host_view_guest_unittest.cc
@@ -20,6 +20,7 @@
 #include "content/browser/gpu/compositor_util.h"
 #include "content/browser/renderer_host/render_widget_host_delegate.h"
 #include "content/browser/renderer_host/render_widget_host_impl.h"
+#include "content/common/text_input_state.h"
 #include "content/common/view_messages.h"
 #include "content/public/browser/browser_plugin_guest_delegate.h"
 #include "content/public/browser/render_widget_host_view.h"
@@ -33,15 +34,21 @@
 namespace {
 class MockRenderWidgetHostDelegate : public RenderWidgetHostDelegate {
  public:
-  MockRenderWidgetHostDelegate() {}
+  MockRenderWidgetHostDelegate() : text_input_state_(new TextInputState()) {}
   ~MockRenderWidgetHostDelegate() override {}
 
+  const TextInputState* GetTextInputState() override {
+    return text_input_state_.get();
+  }
+
  private:
   // RenderWidgetHostDelegate:
   void Cut() override {}
   void Copy() override {}
   void Paste() override {}
   void SelectAll() override {}
+
+  scoped_ptr<TextInputState> text_input_state_;
 };
 
 class RenderWidgetHostViewGuestTest : public testing::Test {
diff --git a/content/browser/leveldb_wrapper_impl.cc b/content/browser/leveldb_wrapper_impl.cc
index ed58624..0d393891 100644
--- a/content/browser/leveldb_wrapper_impl.cc
+++ b/content/browser/leveldb_wrapper_impl.cc
@@ -5,16 +5,20 @@
 #include "content/browser/leveldb_wrapper_impl.h"
 
 #include "base/bind.h"
+#include "mojo/common/common_type_converters.h"
 
 namespace content {
 
 LevelDBWrapperImpl::LevelDBWrapperImpl(
     leveldb::LevelDBDatabase* database,
     const std::string& prefix,
+    size_t max_size,
     const base::Closure& no_bindings_callback)
     : prefix_(prefix),
       no_bindings_callback_(no_bindings_callback),
-      database_(database) {
+      database_(database),
+      bytes_used_(0),
+      max_size_(max_size) {
   bindings_.set_connection_error_handler(base::Bind(
       &LevelDBWrapperImpl::OnConnectionError, base::Unretained(this)));
 }
@@ -23,43 +27,110 @@
   bindings_.AddBinding(this, std::move(request));
 }
 
+void LevelDBWrapperImpl::AddObserver(mojom::LevelDBObserverPtr observer) {
+  observers_.AddInterfacePtr(std::move(observer));
+}
+
 LevelDBWrapperImpl::~LevelDBWrapperImpl() {}
 
 void LevelDBWrapperImpl::Put(mojo::Array<uint8_t> key,
                              mojo::Array<uint8_t> value,
                              const mojo::String& source,
                              const PutCallback& callback) {
-  NOTIMPLEMENTED();
-  callback.Run(leveldb::DatabaseError::NOT_SUPPORTED);
+  bool has_old_item = false;
+  mojo::Array<uint8_t> old_value;
+  size_t old_item_size = 0;
+  auto found = map_.find(key);
+  if (found != map_.end()) {
+    old_value = std::move(found->second);
+    old_item_size = key.size() + old_value.size();
+    has_old_item = true;
+  }
+  size_t new_item_size = key.size() + value.size();
+  size_t new_bytes_used = bytes_used_ - old_item_size + new_item_size;
+
+  // Only check quota if the size is increasing, this allows
+  // shrinking changes to pre-existing maps that are over budget.
+  if (new_item_size > old_item_size && new_bytes_used > max_size_) {
+    callback.Run(false);
+    return;
+  }
+
+  map_[key.Clone()] = value.Clone();
+  bytes_used_ = new_bytes_used;
+  if (!has_old_item) {
+    // We added a new key/value pair.
+    observers_.ForAllPtrs(
+        [&key, &value, &source](mojom::LevelDBObserver* observer) {
+          observer->KeyAdded(key.Clone(), value.Clone(), source);
+        });
+  } else {
+    // We changed the value for an existing key.
+    observers_.ForAllPtrs(
+        [&key, &value, &source, &old_value](mojom::LevelDBObserver* observer) {
+          observer->KeyChanged(
+              key.Clone(), value.Clone(), old_value.Clone(), source);
+        });
+  }
+  callback.Run(true);
 }
 
 void LevelDBWrapperImpl::Delete(mojo::Array<uint8_t> key,
                                 const mojo::String& source,
                                 const DeleteCallback& callback) {
-  NOTIMPLEMENTED();
-  callback.Run(leveldb::DatabaseError::NOT_SUPPORTED);
+  auto found = map_.find(key);
+  if (found == map_.end()) {
+    callback.Run(true);
+    return;
+  }
+
+  mojo::Array<uint8_t> old_value = std::move(found->second);
+  map_.erase(found);
+  bytes_used_ -= key.size() + old_value.size();
+  observers_.ForAllPtrs(
+      [&key, &source, &old_value](mojom::LevelDBObserver* observer) {
+        observer->KeyDeleted(
+            key.Clone(), old_value.Clone(), source);
+      });
+  callback.Run(true);
 }
 
-void LevelDBWrapperImpl::DeleteAll(mojom::LevelDBObserverPtr observer,
-                                   const mojo::String& source,
+void LevelDBWrapperImpl::DeleteAll(const mojo::String& source,
                                    const DeleteAllCallback& callback) {
-  // TODO(jam): store observer and call it when changes occur.
-  NOTIMPLEMENTED();
-  callback.Run(leveldb::DatabaseError::NOT_SUPPORTED);
+  map_.clear();
+  bytes_used_ = 0;
+  observers_.ForAllPtrs(
+      [&source](mojom::LevelDBObserver* observer) {
+        observer->AllDeleted(source);
+      });
+  callback.Run(true);
 }
 
 void LevelDBWrapperImpl::Get(mojo::Array<uint8_t> key,
                              const GetCallback& callback) {
-  NOTIMPLEMENTED();
-  callback.Run(leveldb::DatabaseError::NOT_SUPPORTED, mojo::Array<uint8_t>());
+  auto found = map_.find(key);
+  if (found == map_.end()) {
+    callback.Run(false, mojo::Array<uint8_t>());
+    return;
+  }
+  callback.Run(true, found->second.Clone());
 }
 
-void LevelDBWrapperImpl::GetAll(mojom::LevelDBObserverPtr observer,
+void LevelDBWrapperImpl::GetAll(const mojo::String& source,
                                 const GetAllCallback& callback) {
-  // TODO(jam): store observer and call it when changes occur.
-  NOTIMPLEMENTED();
-  callback.Run(leveldb::DatabaseError::NOT_SUPPORTED,
-               mojo::Array<mojom::KeyValuePtr>());
+
+  mojo::Array<mojom::KeyValuePtr> all(map_.size());
+  for (const auto& it : map_) {
+    mojom::KeyValuePtr kv = mojom::KeyValue::New();
+    kv->key = it.first.Clone();
+    kv->value = it.second.Clone();
+    all.push_back(std::move(kv));
+  }
+  callback.Run(leveldb::DatabaseError::OK, std::move(all));
+  observers_.ForAllPtrs(
+      [source](mojom::LevelDBObserver* observer) {
+        observer->GetAllComplete(source);
+      });
 }
 
 void LevelDBWrapperImpl::OnConnectionError() {
diff --git a/content/browser/leveldb_wrapper_impl.h b/content/browser/leveldb_wrapper_impl.h
index 9c4434b..c96edf9 100644
--- a/content/browser/leveldb_wrapper_impl.h
+++ b/content/browser/leveldb_wrapper_impl.h
@@ -9,6 +9,7 @@
 #include "base/macros.h"
 #include "content/common/leveldb_wrapper.mojom.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
+#include "mojo/public/cpp/bindings/interface_ptr_set.h"
 
 namespace content {
 
@@ -17,19 +18,21 @@
 // 1) Adds the given prefix, if any, to all keys. This allows the sharing of one
 //    database across many, possibly untrusted, consumers and ensuring that they
 //    can't access each other's values.
-// 2) Informs an observer when the given prefix' values are modified by another
-//    process.
-// 3) Throttles requests to avoid overwhelming the disk.
+// 2) Enforces a max_size constraint.
+// 3) Informs an observer when the given prefix' values are modified.
+// 4) Throttles requests to avoid overwhelming the disk.
 class LevelDBWrapperImpl : public mojom::LevelDBWrapper {
  public:
   // |no_bindings_callback| will be called when this object has no more
   // bindings.
   LevelDBWrapperImpl(leveldb::LevelDBDatabase* database,
                      const std::string& prefix,
+                     size_t max_size,
                      const base::Closure& no_bindings_callback);
   ~LevelDBWrapperImpl() override;
 
   void Bind(mojom::LevelDBWrapperRequest request);
+  void AddObserver(mojom::LevelDBObserverPtr observer);
 
  private:
   // LevelDBWrapperImpl:
@@ -40,19 +43,22 @@
   void Delete(mojo::Array<uint8_t> key,
               const mojo::String& source,
               const DeleteCallback& callback) override;
-  void DeleteAll(mojom::LevelDBObserverPtr observer,
-                 const mojo::String& source,
+  void DeleteAll(const mojo::String& source,
                  const DeleteAllCallback& callback) override;
   void Get(mojo::Array<uint8_t> key, const GetCallback& callback) override;
-  void GetAll(mojom::LevelDBObserverPtr observer,
+  void GetAll(const mojo::String& source,
               const GetAllCallback& callback) override;
 
   void OnConnectionError();
 
   std::string prefix_;
   mojo::BindingSet<mojom::LevelDBWrapper> bindings_;
+  mojo::InterfacePtrSet<mojom::LevelDBObserver> observers_;
   base::Closure no_bindings_callback_;
   leveldb::LevelDBDatabase* database_;
+  std::map<mojo::Array<uint8_t>, mojo::Array<uint8_t>> map_;
+  size_t bytes_used_;
+  size_t max_size_;
 
   DISALLOW_COPY_AND_ASSIGN(LevelDBWrapperImpl);
 };
diff --git a/content/browser/mojo/mojo_application_host.cc b/content/browser/mojo/mojo_application_host.cc
index ff2c0c2..427d6b1a 100644
--- a/content/browser/mojo/mojo_application_host.cc
+++ b/content/browser/mojo/mojo_application_host.cc
@@ -81,7 +81,7 @@
 
   base::PlatformFile client_file = client_handle_.release().handle;
   did_activate_ = sender->Send(new MojoMsg_Activate(
-      IPC::GetFileHandleForProcess(client_file, process_handle, true)));
+      IPC::GetPlatformFileForTransit(client_file, true)));
 }
 
 void MojoApplicationHost::OverrideIOTaskRunnerForTest(
diff --git a/content/browser/renderer_host/database_message_filter.cc b/content/browser/renderer_host/database_message_filter.cc
index 98d93062..d29b294 100644
--- a/content/browser/renderer_host/database_message_filter.cc
+++ b/content/browser/renderer_host/database_message_filter.cc
@@ -167,8 +167,7 @@
   } else if (tracked_file) {
     DCHECK(tracked_file->IsValid());
     *handle =
-        IPC::GetFileHandleForProcess(tracked_file->GetPlatformFile(),
-                                     PeerHandle(), false);
+        IPC::GetPlatformFileForTransit(tracked_file->GetPlatformFile(), false);
   }
 }
 
diff --git a/content/browser/renderer_host/media/video_capture_host.cc b/content/browser/renderer_host/media/video_capture_host.cc
index ed3fea6..3720897 100644
--- a/content/browser/renderer_host/media/video_capture_host.cc
+++ b/content/browser/renderer_host/media/video_capture_host.cc
@@ -147,6 +147,8 @@
     IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Start, OnStartCapture)
     IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Pause, OnPauseCapture)
     IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Resume, OnResumeCapture)
+    IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_RequestRefreshFrame,
+                        OnRequestRefreshFrame)
     IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_Stop, OnStopCapture)
     IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_BufferReady,
                         OnRendererFinishedWithBuffer)
@@ -262,6 +264,22 @@
   }
 }
 
+void VideoCaptureHost::OnRequestRefreshFrame(int device_id) {
+  DCHECK_CURRENTLY_ON(BrowserThread::IO);
+  DVLOG(1) << "VideoCaptureHost::OnRequestRefreshFrame, device_id "
+           << device_id;
+
+  VideoCaptureControllerID controller_id(device_id);
+  EntryMap::iterator it = entries_.find(controller_id);
+  if (it == entries_.end())
+    return;
+
+  if (VideoCaptureController* controller = it->second.get()) {
+    media_stream_manager_->video_capture_manager()
+        ->RequestRefreshFrameForClient(controller);
+  }
+}
+
 void VideoCaptureHost::OnRendererFinishedWithBuffer(
     int device_id,
     int buffer_id,
diff --git a/content/browser/renderer_host/media/video_capture_host.h b/content/browser/renderer_host/media/video_capture_host.h
index c35153f..800f562e 100644
--- a/content/browser/renderer_host/media/video_capture_host.h
+++ b/content/browser/renderer_host/media/video_capture_host.h
@@ -127,6 +127,10 @@
                        media::VideoCaptureSessionId session_id,
                        const media::VideoCaptureParams& params);
 
+  // IPC message: Requests that the video capture send a frame "soon" (e.g., to
+  // resolve picture loss or quality issues).
+  void OnRequestRefreshFrame(int device_id);
+
   // IPC message: Called when a renderer is finished using a buffer. Notifies
   // the controller.
   void OnRendererFinishedWithBuffer(int device_id,
diff --git a/content/browser/renderer_host/media/video_capture_manager.cc b/content/browser/renderer_host/media/video_capture_manager.cc
index 124a806..629d8d63 100644
--- a/content/browser/renderer_host/media/video_capture_manager.cc
+++ b/content/browser/renderer_host/media/video_capture_manager.cc
@@ -678,6 +678,24 @@
   controller->ResumeClient(client_id, client_handler);
 }
 
+void VideoCaptureManager::RequestRefreshFrameForClient(
+    VideoCaptureController* controller) {
+  DCHECK_CURRENTLY_ON(BrowserThread::IO);
+
+  if (DeviceEntry* entry = GetDeviceEntryForController(controller)) {
+    if (media::VideoCaptureDevice* device = entry->video_capture_device()) {
+      device_task_runner_->PostTask(
+          FROM_HERE,
+          base::Bind(&media::VideoCaptureDevice::RequestRefreshFrame,
+                     // Unretained is safe to use here because |device| would be
+                     // null if it was scheduled for shutdown and destruction,
+                     // and because this task is guaranteed to run before the
+                     // task that destroys the |device|.
+                     base::Unretained(device)));
+    }
+  }
+}
+
 bool VideoCaptureManager::GetDeviceSupportedFormats(
     media::VideoCaptureSessionId capture_session_id,
     media::VideoCaptureFormats* supported_formats) {
diff --git a/content/browser/renderer_host/media/video_capture_manager.h b/content/browser/renderer_host/media/video_capture_manager.h
index dd6bac9..c1d2403 100644
--- a/content/browser/renderer_host/media/video_capture_manager.h
+++ b/content/browser/renderer_host/media/video_capture_manager.h
@@ -116,6 +116,10 @@
       VideoCaptureControllerID client_id,
       VideoCaptureControllerEventHandler* client_handler);
 
+  // Called by VideoCaptureHost to request a refresh frame from the video
+  // capture device.
+  void RequestRefreshFrameForClient(VideoCaptureController* controller);
+
   // Retrieves all capture supported formats for a particular device. Returns
   // false if the |capture_session_id| is not found. The supported formats are
   // cached during device(s) enumeration, and depending on the underlying
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 5ba612b1..5ba1bc8e8 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -2554,15 +2554,12 @@
     is_process_backgrounded_ =
         child_process_launcher_->GetProcess().IsProcessBackgrounded();
 
-#if defined(OS_WIN)
-    // Experiment with not setting the initial priority of a renderer, as this
-    // might be a visible tab but since no widgets are currently present, it
-    // will get backgrounded. See https://crbug.com/560446.
-    if (base::FeatureList::IsEnabled(
-            features::kUpdateRendererPriorityOnStartup)) {
-      UpdateProcessPriority();
-    }
-#else
+    // Disable updating process priority on startup for now as it incorrectly
+    // results in backgrounding foreground navigations until their first commit
+    // is made. A better long term solution would be to be aware of the tab's
+    // visibility at this point. https://crbug.com/560446.
+    // Except on Android for now because of https://crbug.com/601184 :-(.
+#if defined(OS_ANDROID)
     UpdateProcessPriority();
 #endif
   }
diff --git a/content/browser/renderer_host/render_widget_host_delegate.cc b/content/browser/renderer_host/render_widget_host_delegate.cc
index e08c7da3..212a5686 100644
--- a/content/browser/renderer_host/render_widget_host_delegate.cc
+++ b/content/browser/renderer_host/render_widget_host_delegate.cc
@@ -48,6 +48,10 @@
   return receiving_widget;
 }
 
+const TextInputState* RenderWidgetHostDelegate::GetTextInputState() {
+  return nullptr;
+}
+
 gfx::Rect RenderWidgetHostDelegate::GetRootWindowResizerRect(
     RenderWidgetHostImpl* render_widget_host) const {
   return gfx::Rect();
diff --git a/content/browser/renderer_host/render_widget_host_delegate.h b/content/browser/renderer_host/render_widget_host_delegate.h
index aa38066..440584df 100644
--- a/content/browser/renderer_host/render_widget_host_delegate.h
+++ b/content/browser/renderer_host/render_widget_host_delegate.h
@@ -31,7 +31,9 @@
 class BrowserAccessibilityManager;
 class RenderWidgetHostImpl;
 class RenderWidgetHostInputEventRouter;
+class RenderWidgetHostViewBase;
 struct NativeWebKeyboardEvent;
+struct TextInputState;
 
 //
 // RenderWidgetHostDelegate
@@ -132,6 +134,16 @@
   virtual RenderWidgetHostImpl* GetFocusedRenderWidgetHost(
       RenderWidgetHostImpl* receiving_widget);
 
+  // Returns the current value of text input state. This should be the value
+  // obtained from the focused RWHV.
+  virtual const TextInputState* GetTextInputState();
+
+  // This method is called by any RWHV which receives an IPC regarding a change
+  // in the text input state. The IPC might or might not have lead to a change
+  // in state but this method must be called for IME related logic.
+  virtual void UpdateTextInputState(RenderWidgetHostViewBase* rwhv,
+                                    bool text_input_state_changed) {}
+
   // Notification that the renderer has become unresponsive. The
   // delegate can use this notification to show a warning to the user.
   virtual void RendererUnresponsive(RenderWidgetHostImpl* render_widget_host) {}
@@ -167,12 +179,12 @@
   // Notification that the widget has lost the mouse lock.
   virtual void LostMouseLock(RenderWidgetHostImpl* render_widget_host) {}
 
-  // Called when the widget has sent a compositor proto.  This is used in Btlimp
+  // Called when the widget has sent a compositor proto.  This is used in Blimp
   // mode with the RemoteChannel compositor.
   virtual void ForwardCompositorProto(RenderWidgetHostImpl* render_widget_host,
                                       const std::vector<uint8_t>& proto) {}
 
-  // Called when the visibility of the RenderFrameProxyHost in outter
+  // Called when the visibility of the RenderFrameProxyHost in outer
   // WebContents changes. This method is only called on an inner WebContents and
   // will eventually notify all the RenderWidgetHostViews belonging to that
   // WebContents.
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index 88a1a613..a8ac8a6 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -1726,7 +1726,7 @@
 }
 
 void RenderWidgetHostImpl::OnTextInputStateChanged(
-    const ViewHostMsg_TextInputState_Params& params) {
+    const TextInputState& params) {
   if (view_)
     view_->TextInputStateChanged(params);
 }
diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h
index f4e94d4..2d6a4d8 100644
--- a/content/browser/renderer_host/render_widget_host_impl.h
+++ b/content/browser/renderer_host/render_widget_host_impl.h
@@ -48,7 +48,7 @@
 
 struct FrameHostMsg_HittestData_Params;
 struct ViewHostMsg_SelectionBounds_Params;
-struct ViewHostMsg_TextInputState_Params;
+struct TextInputState;
 struct ViewHostMsg_UpdateRect_Params;
 
 namespace base {
@@ -571,8 +571,7 @@
   void OnUpdateRect(const ViewHostMsg_UpdateRect_Params& params);
   void OnQueueSyntheticGesture(const SyntheticGesturePacket& gesture_packet);
   void OnSetCursor(const WebCursor& cursor);
-  void OnTextInputStateChanged(
-      const ViewHostMsg_TextInputState_Params& params);
+  void OnTextInputStateChanged(const TextInputState& params);
 
   void OnImeCompositionRangeChanged(
       const gfx::Range& range,
diff --git a/content/browser/renderer_host/render_widget_host_unittest.cc b/content/browser/renderer_host/render_widget_host_unittest.cc
index c56ec9a..c460898 100644
--- a/content/browser/renderer_host/render_widget_host_unittest.cc
+++ b/content/browser/renderer_host/render_widget_host_unittest.cc
@@ -23,6 +23,7 @@
 #include "content/common/input/synthetic_web_input_event_builders.h"
 #include "content/common/input_messages.h"
 #include "content/common/resize_params.h"
+#include "content/common/text_input_state.h"
 #include "content/common/view_messages.h"
 #include "content/public/common/content_switches.h"
 #include "content/public/test/mock_render_process_host.h"
@@ -347,7 +348,8 @@
         unhandled_keyboard_event_type_(WebInputEvent::Undefined),
         handle_wheel_event_(false),
         handle_wheel_event_called_(false),
-        unresponsive_timer_fired_(false) {}
+        unresponsive_timer_fired_(false),
+        text_input_state_(new TextInputState()) {}
   ~MockRenderWidgetHostDelegate() override {}
 
   // Tests that make sure we ignore keyboard event acknowledgments to events we
@@ -384,6 +386,10 @@
 
   bool unresponsive_timer_fired() const { return unresponsive_timer_fired_; }
 
+  const TextInputState* GetTextInputState() override {
+    return text_input_state_.get();
+  }
+
  protected:
   bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event,
                               bool* is_keyboard_shortcut) override {
@@ -425,6 +431,8 @@
   bool handle_wheel_event_called_;
 
   bool unresponsive_timer_fired_;
+
+  scoped_ptr<TextInputState> text_input_state_;
 };
 
 // RenderWidgetHostTest --------------------------------------------------------
diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc
index acb9d446..46113c7 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.cc
+++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -652,22 +652,19 @@
   return reinterpret_cast<intptr_t>(&ime_adapter_android_);
 }
 
-void RenderWidgetHostViewAndroid::TextInputStateChanged(
-    const ViewHostMsg_TextInputState_Params& params) {
-  if (params.is_non_ime_change) {
-    // Sends an acknowledgement to the renderer of a processed IME event.
-    host_->Send(new InputMsg_ImeEventAck(host_->GetRoutingID()));
-  }
-
+void RenderWidgetHostViewAndroid::UpdateInputMethodIfNecessary(
+    bool text_input_state_changed) {
+  DCHECK(text_input_state_changed);
   if (!content_view_core_)
     return;
 
+  const TextInputState* state = host_->delegate()->GetTextInputState();
+
   content_view_core_->UpdateImeAdapter(
-      GetNativeImeAdapter(),
-      static_cast<int>(params.type), params.flags,
-      params.value, params.selection_start, params.selection_end,
-      params.composition_start, params.composition_end,
-      params.show_ime_if_needed, params.is_non_ime_change);
+      GetNativeImeAdapter(), static_cast<int>(state->type), state->flags,
+      state->value, state->selection_start, state->selection_end,
+      state->composition_start, state->composition_end,
+      state->show_ime_if_needed, state->is_non_ime_change);
 }
 
 void RenderWidgetHostViewAndroid::UpdateBackgroundColor(SkColor color) {
@@ -813,6 +810,10 @@
   }
   surface_factory_.reset();
 
+  // The WebContentsImpl should be notified about us so that it will not hold
+  // an invalid text input state which was due to active text on this view.
+  NotifyHostDelegateAboutShutdown();
+
   // The RenderWidgetHost's destruction led here, so don't call it.
   host_ = NULL;
 
diff --git a/content/browser/renderer_host/render_widget_host_view_android.h b/content/browser/renderer_host/render_widget_host_view_android.h
index ed0cd31..1f3281e 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.h
+++ b/content/browser/renderer_host/render_widget_host_view_android.h
@@ -109,8 +109,7 @@
   float GetTopControlsHeight() const override;
   void UpdateCursor(const WebCursor& cursor) override;
   void SetIsLoading(bool is_loading) override;
-  void TextInputStateChanged(
-      const ViewHostMsg_TextInputState_Params& params) override;
+  void UpdateInputMethodIfNecessary(bool text_input_state_changed) override;
   void ImeCancelComposition() override;
   void ImeCompositionRangeChanged(
       const gfx::Range& range,
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index 30b0778..29e1eef0 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -370,10 +370,6 @@
       popup_parent_host_view_(NULL),
       popup_child_host_view_(NULL),
       is_loading_(false),
-      text_input_type_(ui::TEXT_INPUT_TYPE_NONE),
-      text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT),
-      text_input_flags_(0),
-      can_compose_inline_(true),
       has_composition_text_(false),
       accept_return_character_(false),
       last_swapped_software_frame_scale_factor_(1.f),
@@ -860,23 +856,18 @@
   UpdateCursorIfOverSelf();
 }
 
-void RenderWidgetHostViewAura::TextInputStateChanged(
-    const ViewHostMsg_TextInputState_Params& params) {
-  if (text_input_type_ != params.type ||
-      text_input_mode_ != params.mode ||
-      can_compose_inline_ != params.can_compose_inline ||
-      text_input_flags_ != params.flags) {
-    text_input_type_ = params.type;
-    text_input_mode_ = params.mode;
-    can_compose_inline_ = params.can_compose_inline;
-    text_input_flags_ = params.flags;
-    if (GetInputMethod())
-      GetInputMethod()->OnTextInputTypeChanged(this);
-  }
-  if (params.show_ime_if_needed && params.type != ui::TEXT_INPUT_TYPE_NONE) {
-    if (GetInputMethod())
-      GetInputMethod()->ShowImeIfNeeded();
-  }
+void RenderWidgetHostViewAura::UpdateInputMethodIfNecessary(
+    bool text_input_state_changed) {
+  if (!GetInputMethod())
+    return;
+
+  if (text_input_state_changed)
+    GetInputMethod()->OnTextInputTypeChanged(this);
+
+  const TextInputState* state = host_->delegate()->GetTextInputState();
+
+  if (state->show_ime_if_needed && state->type != ui::TEXT_INPUT_TYPE_NONE)
+    GetInputMethod()->ShowImeIfNeeded();
 }
 
 void RenderWidgetHostViewAura::ImeCancelComposition() {
@@ -1473,7 +1464,10 @@
 }
 
 void RenderWidgetHostViewAura::InsertText(const base::string16& text) {
-  DCHECK(text_input_type_ != ui::TEXT_INPUT_TYPE_NONE);
+  DCHECK(RenderWidgetHostImpl::From(GetRenderWidgetHost())
+             ->delegate()
+             ->GetTextInputState()
+             ->type != ui::TEXT_INPUT_TYPE_NONE);
   // TODO(wjmaclean): can host_ ever be null?
   if (host_)
     host_->ImeConfirmComposition(text, gfx::Range::InvalidRange(), false);
@@ -1496,19 +1490,27 @@
 }
 
 ui::TextInputType RenderWidgetHostViewAura::GetTextInputType() const {
-  return text_input_type_;
+  if (host_->delegate())
+    return host_->delegate()->GetTextInputState()->type;
+  return text_input_state()->type;
 }
 
 ui::TextInputMode RenderWidgetHostViewAura::GetTextInputMode() const {
-  return text_input_mode_;
+  if (host_->delegate())
+    return host_->delegate()->GetTextInputState()->mode;
+  return text_input_state()->mode;
 }
 
 int RenderWidgetHostViewAura::GetTextInputFlags() const {
-  return text_input_flags_;
+  if (host_->delegate())
+    return host_->delegate()->GetTextInputState()->flags;
+  return text_input_state()->flags;
 }
 
 bool RenderWidgetHostViewAura::CanComposeInline() const {
-  return can_compose_inline_;
+  if (host_->delegate())
+    return host_->delegate()->GetTextInputState()->can_compose_inline;
+  return text_input_state()->can_compose_inline;
 }
 
 gfx::Rect RenderWidgetHostViewAura::ConvertRectToScreen(
@@ -2328,6 +2330,10 @@
 // RenderWidgetHostViewAura, private:
 
 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() {
+  // The WebContentsImpl should be notified about us so that it will not hold
+  // an invalid text input state which was due to active text on this view.
+  NotifyHostDelegateAboutShutdown();
+
   // Ask the RWH to drop reference to us.
   if (!is_guest_view_hack_)
     host_->ViewDestroyed();
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.h b/content/browser/renderer_host/render_widget_host_view_aura.h
index 05de299..2518c5224 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.h
+++ b/content/browser/renderer_host/render_widget_host_view_aura.h
@@ -43,8 +43,6 @@
 #include "ui/gfx/geometry/rect.h"
 #include "ui/wm/public/activation_delegate.h"
 
-struct ViewHostMsg_TextInputState_Params;
-
 namespace aura {
 class WindowTracker;
 namespace client {
@@ -136,8 +134,7 @@
   void Focus() override;
   void UpdateCursor(const WebCursor& cursor) override;
   void SetIsLoading(bool is_loading) override;
-  void TextInputStateChanged(
-      const ViewHostMsg_TextInputState_Params& params) override;
+  void UpdateInputMethodIfNecessary(bool text_input_state_changed) override;
   void ImeCancelComposition() override;
   void ImeCompositionRangeChanged(
       const gfx::Range& range,
@@ -566,14 +563,6 @@
   // object.
   ui::MotionEventAura pointer_state_;
 
-  // The current text input type.
-  ui::TextInputType text_input_type_;
-  // The current text input mode corresponding to HTML5 inputmode attribute.
-  ui::TextInputMode text_input_mode_;
-  // The current text input flags.
-  int text_input_flags_;
-  bool can_compose_inline_;
-
   // Bounds for the selection.
   ui::SelectionBound selection_anchor_;
   ui::SelectionBound selection_focus_;
diff --git a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
index da44286..e743f1a 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
@@ -41,6 +41,7 @@
 #include "content/common/input/input_event_utils.h"
 #include "content/common/input/synthetic_web_input_event_builders.h"
 #include "content/common/input_messages.h"
+#include "content/common/text_input_state.h"
 #include "content/common/view_messages.h"
 #include "content/public/browser/render_widget_host_view.h"
 #include "content/public/browser/render_widget_host_view_frame_subscriber.h"
@@ -152,7 +153,8 @@
 
 class MockRenderWidgetHostDelegate : public RenderWidgetHostDelegate {
  public:
-  MockRenderWidgetHostDelegate() : rwh_(nullptr) {}
+  MockRenderWidgetHostDelegate()
+      : rwh_(nullptr), text_input_state_(new TextInputState()) {}
   ~MockRenderWidgetHostDelegate() override {}
   const NativeWebKeyboardEvent* last_event() const { return last_event_.get(); }
   void set_widget_host(RenderWidgetHostImpl* rwh) { rwh_ = rwh; }
@@ -164,6 +166,11 @@
     last_event_.reset(new NativeWebKeyboardEvent(event));
     return true;
   }
+
+  const TextInputState* GetTextInputState() override {
+    return text_input_state_.get();
+  }
+
   void Cut() override {}
   void Copy() override {}
   void Paste() override {}
@@ -176,6 +183,8 @@
  private:
   scoped_ptr<NativeWebKeyboardEvent> last_event_;
   RenderWidgetHostImpl* rwh_;
+  scoped_ptr<TextInputState> text_input_state_;
+
   DISALLOW_COPY_AND_ASSIGN(MockRenderWidgetHostDelegate);
 };
 
diff --git a/content/browser/renderer_host/render_widget_host_view_base.cc b/content/browser/renderer_host/render_widget_host_view_base.cc
index b411ca10..febe5160 100644
--- a/content/browser/renderer_host/render_widget_host_view_base.cc
+++ b/content/browser/renderer_host/render_widget_host_view_base.cc
@@ -10,11 +10,18 @@
 #include "content/browser/gpu/gpu_data_manager_impl.h"
 #include "content/browser/renderer_host/input/synthetic_gesture_target_base.h"
 #include "content/browser/renderer_host/render_process_host_impl.h"
+#include "content/browser/renderer_host/render_view_host_delegate.h"
+#include "content/browser/renderer_host/render_view_host_impl.h"
 #include "content/browser/renderer_host/render_widget_host_delegate.h"
 #include "content/browser/renderer_host/render_widget_host_impl.h"
 #include "content/browser/renderer_host/render_widget_host_view_base_observer.h"
 #include "content/common/content_switches_internal.h"
+#include "content/common/input_messages.h"
+#include "content/common/site_isolation_policy.h"
+#include "content/common/text_input_state.h"
+#include "content/common/view_messages.h"
 #include "content/public/browser/render_widget_host_view_frame_subscriber.h"
+#include "content/public/common/browser_plugin_guest_mode.h"
 #include "ui/gfx/display.h"
 #include "ui/gfx/geometry/point_conversions.h"
 #include "ui/gfx/geometry/size_conversions.h"
@@ -41,6 +48,7 @@
       current_display_rotation_(gfx::Display::ROTATE_0),
       pinch_zoom_enabled_(content::IsPinchToZoomEnabled()),
       renderer_frame_number_(0),
+      text_input_state_(new TextInputState()),
       weak_factory_(this) {}
 
 RenderWidgetHostViewBase::~RenderWidgetHostViewBase() {
@@ -65,6 +73,19 @@
   DCHECK(!observers_.might_have_observers());
 }
 
+void RenderWidgetHostViewBase::NotifyHostDelegateAboutShutdown() {
+  RenderWidgetHostImpl* host =
+      RenderWidgetHostImpl::From(GetRenderWidgetHost());
+
+  if (!host || !host->delegate())
+    return;
+
+  bool has_active_text = text_input_state()->type != ui::TEXT_INPUT_TYPE_NONE;
+  text_input_state_.reset(new TextInputState());
+
+  host->delegate()->UpdateTextInputState(this, has_active_text);
+}
+
 bool RenderWidgetHostViewBase::OnMessageReceived(const IPC::Message& msg){
   return false;
 }
@@ -228,6 +249,35 @@
   return true;
 }
 
+void RenderWidgetHostViewBase::TextInputStateChanged(
+    const TextInputState& params) {
+  bool text_input_state_changed = true;
+#if !defined(OS_ANDROID)
+  if (params.type == text_input_state_->type &&
+      params.can_compose_inline == text_input_state_->can_compose_inline
+#if !defined(OS_MACOSX)
+      && params.mode == text_input_state_->mode &&
+      params.flags == text_input_state_->flags
+#endif
+      )
+    text_input_state_changed = false;
+#else
+  if (params.is_non_ime_change) {
+    // Sends an acknowledgement to the renderer of a processed IME event.
+    GetRenderWidgetHost()->Send(
+        new InputMsg_ImeEventAck(GetRenderWidgetHost()->GetRoutingID()));
+  }
+#endif
+
+  if (text_input_state_changed) {
+    *text_input_state_ = params;
+    RenderWidgetHostImpl* host =
+        RenderWidgetHostImpl::From(GetRenderWidgetHost());
+    if (host && host->delegate())
+      host->delegate()->UpdateTextInputState(this, text_input_state_changed);
+  }
+}
+
 base::WeakPtr<RenderWidgetHostViewBase> RenderWidgetHostViewBase::GetWeakPtr() {
   return weak_factory_.GetWeakPtr();
 }
diff --git a/content/browser/renderer_host/render_widget_host_view_base.h b/content/browser/renderer_host/render_widget_host_view_base.h
index c6d15c1c..c11775b 100644
--- a/content/browser/renderer_host/render_widget_host_view_base.h
+++ b/content/browser/renderer_host/render_widget_host_view_base.h
@@ -41,7 +41,6 @@
 
 struct AccessibilityHostMsg_EventParams;
 struct ViewHostMsg_SelectionBounds_Params;
-struct ViewHostMsg_TextInputState_Params;
 
 namespace media {
 class VideoFrame;
@@ -70,6 +69,7 @@
 class WebCursor;
 struct DidOverscrollParams;
 struct NativeWebKeyboardEvent;
+struct TextInputState;
 
 // Basic implementation shared by concrete RenderWidgetHostView subclasses.
 class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
@@ -126,6 +126,22 @@
   // changed since the last time.
   bool HasDisplayPropertyChanged(gfx::NativeView view);
 
+  // This method is exclusively called by the owner RenderWidgetHost to inform
+  // the view about a change in the input state which originated in the
+  // corresponding RenderWidget. This state is stored at the RWHV.
+  // Also, this change does not necessarily reflect the current state of the
+  // input since the text input could be due to a change in the focused
+  // child-frame's (in OOPIF) or the out of process content managed by
+  // BrowserPlugin.
+  void TextInputStateChanged(const TextInputState& params);
+
+  // The current text input state for the corresponding widget. This is used by
+  // the WebContents in determining the top level text input state, which is
+  // in turn used by the IME.
+  const TextInputState* text_input_state() const {
+    return text_input_state_.get();
+  }
+
   base::WeakPtr<RenderWidgetHostViewBase> GetWeakPtr();
 
   //----------------------------------------------------------------------------
@@ -238,6 +254,12 @@
                                                cc::SurfaceId original_surface,
                                                gfx::Point* transformed_point);
 
+  // This method is used by the WebContents owning this view to notify the view
+  // of a text input change in the tab. This method is called by the
+  // WebContentsImpl if the RenderWidgetHostView is a top-level view. The
+  // implementation is platform-specific.
+  virtual void UpdateInputMethodIfNecessary(bool text_input_state_changed) {}
+
   //----------------------------------------------------------------------------
   // The following static methods are implemented by each platform.
 
@@ -263,10 +285,6 @@
   // Indicates whether the page has finished loading.
   virtual void SetIsLoading(bool is_loading) = 0;
 
-  // Updates the state of the input method attached to the view.
-  virtual void TextInputStateChanged(
-      const ViewHostMsg_TextInputState_Params& params) = 0;
-
   // Cancel the ongoing composition of the input method attached to the view.
   virtual void ImeCancelComposition() = 0;
 
@@ -384,6 +402,11 @@
 
   void NotifyObserversAboutShutdown();
 
+  // This method should be called by RWHV during destruction or after a crash
+  // to make sure WebContents does not hold invalid text input state.
+  // TODO(ekaramad): Do we need to call this for top-level RWHV as well?
+  void NotifyHostDelegateAboutShutdown();
+
   // Whether this view is a popup and what kind of popup it is (select,
   // autofill...).
   blink::WebPopupType popup_type_;
@@ -411,7 +434,6 @@
   // The current selection range relative to the start of the web page.
   gfx::Range selection_range_;
 
- protected:
   // The scale factor of the display the renderer is currently on.
   float current_device_scale_factor_;
 
@@ -433,6 +455,9 @@
 
   base::ObserverList<RenderWidgetHostViewBaseObserver> observers_;
 
+  // The last reported input state by the RenderWidget.
+  scoped_ptr<TextInputState> text_input_state_;
+
   base::WeakPtrFactory<RenderWidgetHostViewBase> weak_factory_;
 
   DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewBase);
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.h b/content/browser/renderer_host/render_widget_host_view_mac.h
index 0c1b9a9c..79b76d6 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.h
+++ b/content/browser/renderer_host/render_widget_host_view_mac.h
@@ -38,8 +38,6 @@
 #import "ui/base/cocoa/tool_tip_base_view.h"
 #include "ui/gfx/display_observer.h"
 
-struct ViewHostMsg_TextInputState_Params;
-
 namespace content {
 class RenderWidgetHostImpl;
 class RenderWidgetHostViewMac;
@@ -284,8 +282,7 @@
   void Focus() override;
   void UpdateCursor(const WebCursor& cursor) override;
   void SetIsLoading(bool is_loading) override;
-  void TextInputStateChanged(
-      const ViewHostMsg_TextInputState_Params& params) override;
+  void UpdateInputMethodIfNecessary(bool text_input_state_changed) override;
   void ImeCancelComposition() override;
   void ImeCompositionRangeChanged(
       const gfx::Range& range,
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm
index 0581389..09859f1 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -1010,23 +1010,23 @@
   // like Chrome does on Windows, call |UpdateCursor()| here.
 }
 
-void RenderWidgetHostViewMac::TextInputStateChanged(
-const ViewHostMsg_TextInputState_Params& params) {
-  if (text_input_type_ != params.type
-      || can_compose_inline_ != params.can_compose_inline) {
-    text_input_type_ = params.type;
-    can_compose_inline_ = params.can_compose_inline;
-    if (HasFocus()) {
-      SetTextInputActive(true);
+void RenderWidgetHostViewMac::UpdateInputMethodIfNecessary(
+    bool text_input_state_changed) {
+  if (!text_input_state_changed)
+    return;
 
-      // Let AppKit cache the new input context to make IMEs happy.
-      // See http://crbug.com/73039.
-      [NSApp updateWindows];
+  if (HasFocus()) {
+    SetTextInputActive(true);
+
+    // Let AppKit cache the new input context to make IMEs happy.
+    // See http://crbug.com/73039.
+    [NSApp updateWindows];
 
 #ifndef __LP64__
-      UseInputWindow(TSMGetActiveDocument(), !can_compose_inline_);
+    UseInputWindow(TSMGetActiveDocument(), !render_widget_host_->delegate()
+                                                ->GetTextInputState()
+                                                ->can_compose_inline);
 #endif
-    }
   }
 }
 
@@ -1083,6 +1083,10 @@
   // we release render_widget_host_.
   NotifyObserversAboutShutdown();
 
+  // The WebContentsImpl should be notified about us so that it will not hold
+  // an invalid text input state which was due to active text on this view.
+  NotifyHostDelegateAboutShutdown();
+
   // We get this call just before |render_widget_host_| deletes
   // itself.  But we are owned by |cocoa_view_|, which may be retained
   // by some other code.  Examples are WebContentsViewMac's
diff --git a/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm b/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm
index 5cc1841..c94bcf3 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm
@@ -20,6 +20,7 @@
 #include "content/browser/gpu/compositor_util.h"
 #include "content/browser/renderer_host/render_widget_host_delegate.h"
 #include "content/common/input_messages.h"
+#include "content/common/text_input_state.h"
 #include "content/common/view_messages.h"
 #include "content/public/browser/notification_types.h"
 #include "content/public/browser/render_widget_host_view_mac_delegate.h"
@@ -142,14 +143,20 @@
 
 class MockRenderWidgetHostDelegate : public RenderWidgetHostDelegate {
  public:
-  MockRenderWidgetHostDelegate() {}
+  MockRenderWidgetHostDelegate() : text_input_state_(new TextInputState()) {}
   ~MockRenderWidgetHostDelegate() override {}
 
+  const TextInputState* GetTextInputState() override {
+    return text_input_state_.get();
+  }
+
  private:
   void Cut() override {}
   void Copy() override {}
   void Paste() override {}
   void SelectAll() override {}
+
+  scoped_ptr<TextInputState> text_input_state_;
 };
 
 class MockRenderWidgetHostImpl : public RenderWidgetHostImpl {
diff --git a/content/browser/renderer_host/render_widget_host_view_mus.cc b/content/browser/renderer_host/render_widget_host_view_mus.cc
index eb29bde..8e638510 100644
--- a/content/browser/renderer_host/render_widget_host_view_mus.cc
+++ b/content/browser/renderer_host/render_widget_host_view_mus.cc
@@ -13,6 +13,7 @@
 #include "content/browser/renderer_host/render_process_host_impl.h"
 #include "content/browser/renderer_host/render_widget_host_impl.h"
 #include "content/common/render_widget_window_tree_client_factory.mojom.h"
+#include "content/common/text_input_state.h"
 #include "content/public/common/mojo_shell_connection.h"
 #include "mojo/shell/public/cpp/connector.h"
 #include "ui/aura/client/screen_position_client.h"
@@ -124,6 +125,10 @@
 }
 
 void RenderWidgetHostViewMus::Destroy() {
+  // The WebContentsImpl should be notified about us so that it will not hold
+  // an invalid text input state which was due to active text on this view.
+  NotifyHostDelegateAboutShutdown();
+
   delete aura_window_;
 }
 
@@ -187,9 +192,9 @@
 void RenderWidgetHostViewMus::SetIsLoading(bool is_loading) {
 }
 
-void RenderWidgetHostViewMus::TextInputStateChanged(
-    const ViewHostMsg_TextInputState_Params& params) {
-  // TODO(fsamuel): Implement an IME mojo app.
+void RenderWidgetHostViewMus::UpdateInputMethodIfNecessary(
+    bool text_input_state_changed) {
+  // TODO: Implement the IME logic when input state changes.
 }
 
 void RenderWidgetHostViewMus::ImeCancelComposition() {
diff --git a/content/browser/renderer_host/render_widget_host_view_mus.h b/content/browser/renderer_host/render_widget_host_view_mus.h
index 3a96b9f..bc91820 100644
--- a/content/browser/renderer_host/render_widget_host_view_mus.h
+++ b/content/browser/renderer_host/render_widget_host_view_mus.h
@@ -67,8 +67,7 @@
   void InitAsFullscreen(RenderWidgetHostView* reference_host_view) override;
   void UpdateCursor(const WebCursor& cursor) override;
   void SetIsLoading(bool is_loading) override;
-  void TextInputStateChanged(
-      const ViewHostMsg_TextInputState_Params& params) override;
+  void UpdateInputMethodIfNecessary(bool text_input_state_changed) override;
   void ImeCancelComposition() override;
 #if defined(OS_MACOSX) || defined(USE_AURA)
   void ImeCompositionRangeChanged(
diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc
index 9143f47..f9266bd 100644
--- a/content/browser/site_per_process_browsertest.cc
+++ b/content/browser/site_per_process_browsertest.cc
@@ -31,7 +31,6 @@
 #include "content/browser/renderer_host/render_view_host_impl.h"
 #include "content/browser/renderer_host/render_widget_host_input_event_router.h"
 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
-#include "content/browser/web_contents/web_contents_impl.h"
 #include "content/common/frame_messages.h"
 #include "content/common/input/synthetic_tap_gesture_params.h"
 #include "content/common/view_messages.h"
@@ -47,7 +46,6 @@
 #include "content/public/test/content_browser_test_utils.h"
 #include "content/public/test/test_navigation_observer.h"
 #include "content/public/test/test_utils.h"
-#include "content/shell/browser/shell.h"
 #include "content/test/content_browser_test_utils_internal.h"
 #include "content/test/test_frame_navigation_observer.h"
 #include "ipc/ipc_security_test_util.h"
@@ -6322,4 +6320,217 @@
   EXPECT_FALSE(rvh->is_swapped_out_);
 }
 
+// This class will sniff incoming IPC for ViewHostMsg_TextInputStateChanged.
+class TextInputStateChangedMessageFilter : public BrowserMessageFilter {
+ public:
+  explicit TextInputStateChangedMessageFilter(
+      RenderWidgetHostImpl* render_widget_host)
+      : BrowserMessageFilter(ViewMsgStart), text_input_state_changed_(false) {
+    if (!render_widget_host || !render_widget_host->GetProcess())
+      text_input_state_changed_ = true;
+    old_state = *render_widget_host->GetView()->text_input_state();
+    render_widget_host->GetProcess()->AddFilter(this);
+  }
+
+  void WaitUntilTextInputStateChanges() {
+    if (!text_input_state_changed_) {
+      message_loop_runner_ = new MessageLoopRunner;
+      message_loop_runner_->Run();
+    }
+  }
+
+ private:
+  ~TextInputStateChangedMessageFilter() override {}
+
+  bool OnMessageReceived(const IPC::Message& msg) override {
+    IPC_BEGIN_MESSAGE_MAP(TextInputStateChangedMessageFilter, msg)
+      IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged,
+                          OnTextInputStateChangedMessageReceived)
+    IPC_END_MESSAGE_MAP()
+    return false;
+  }
+
+  void OnTextInputStateChangedMessageReceived(const TextInputState& new_state) {
+    if (new_state.type != old_state.type || new_state.mode != old_state.mode ||
+        new_state.value != old_state.value) {
+      text_input_state_changed_ = true;
+      if (message_loop_runner_)
+        BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
+                                message_loop_runner_->QuitClosure());
+    }
+  }
+
+  bool text_input_state_changed_;
+  scoped_refptr<MessageLoopRunner> message_loop_runner_;
+  TextInputState old_state;
+
+  DISALLOW_COPY_AND_ASSIGN(TextInputStateChangedMessageFilter);
+};
+
+// Verify that when moving the focus between different frames, the WebContents
+// properly keeps track of the text input state.
+// The test loads a page with one input field, two out of process frames, and a
+// second input field positioned after the last <iframe>. Then a sequence of TAB
+// inputs are faked to navigate focus in between the different <input> elements.
+// After each change, we check with the RWHV of the frame as well as the
+// WebContents to make sure the text input state is as expected.
+IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, TextInputStateChanged) {
+  GURL main_page_url(embedded_test_server()->GetURL(
+      "a.com", "/textinput/page_with_input_iframeX2_input.html"));
+  NavigateToURL(shell(), main_page_url);
+
+  WebContents* contents = shell()->web_contents();
+
+  FrameTreeNode* root = web_contents()->GetFrameTree()->root();
+
+  FrameTreeNode* child_b = root->child_at(0);
+  GURL child_b_url(embedded_test_server()->GetURL(
+      "b.com", "/textinput/page_with_input.html"));
+  NavigateFrameToURL(child_b, child_b_url);
+  EXPECT_TRUE(WaitForRenderFrameReady(child_b->current_frame_host()));
+
+  FrameTreeNode* child_c = root->child_at(1);
+  GURL child_c_url(embedded_test_server()->GetURL(
+      "c.com", "/textinput/page_with_input.html"));
+  NavigateFrameToURL(child_c, child_c_url);
+  EXPECT_TRUE(WaitForRenderFrameReady(child_c->current_frame_host()));
+
+  RenderWidgetHostImpl* root_rwh =
+      root->current_frame_host()->GetRenderWidgetHost();
+  RenderWidgetHostViewBase* root_rwhv = root_rwh->GetView();
+
+  RenderWidgetHostImpl* child_b_rwh =
+      child_b->current_frame_host()->GetRenderWidgetHost();
+  RenderWidgetHostViewBase* child_b_rwhv = child_b_rwh->GetView();
+
+  RenderWidgetHostImpl* child_c_rwh =
+      child_c->current_frame_host()->GetRenderWidgetHost();
+  RenderWidgetHostViewBase* child_c_rwhv = child_c_rwh->GetView();
+
+  // Change the text value in <input> field of either frame so that we can
+  // later track the changes.
+  EXPECT_TRUE(
+      ExecuteScript(child_b->current_frame_host(),
+                    "document.querySelector('input').value = 'second';"));
+  EXPECT_TRUE(
+      ExecuteScript(child_c->current_frame_host(),
+                    "document.querySelector('input').value = 'third';"));
+
+  // Verify the input type is none in the beginning.
+  EXPECT_EQ(ui::TEXT_INPUT_TYPE_NONE, root_rwhv->text_input_state()->type);
+
+  // A helper function to send a tab key to the frame and wait for a state
+  // changed message.
+  auto press_tab_and_wait_for_text_input_state_change =
+      [contents](RenderWidgetHostImpl* rwh) {
+        scoped_refptr<TextInputStateChangedMessageFilter> filter =
+            new TextInputStateChangedMessageFilter(rwh);
+        SimulateKeyPress(contents, ui::VKEY_TAB, false, false, false, false);
+        filter->WaitUntilTextInputStateChanges();
+      };
+
+  // Send focus to the first input field.
+  press_tab_and_wait_for_text_input_state_change(root_rwh);
+  EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT, root_rwhv->text_input_state()->type);
+  EXPECT_EQ("first", root_rwhv->text_input_state()->value);
+
+  // Verify the top-level state is changed.
+  EXPECT_EQ("first", web_contents()->GetTextInputState()->value);
+
+  // Send focus to the input field in frame b.
+  press_tab_and_wait_for_text_input_state_change(child_b_rwh);
+  EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT, child_b_rwhv->text_input_state()->type);
+  EXPECT_EQ("second", child_b_rwhv->text_input_state()->value);
+
+  EXPECT_EQ("second", web_contents()->GetTextInputState()->value);
+
+  // Send focus to the input field in frame c.
+  press_tab_and_wait_for_text_input_state_change(child_c_rwh);
+  EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT, child_c_rwhv->text_input_state()->type);
+  EXPECT_EQ("third", child_c_rwhv->text_input_state()->value);
+
+  EXPECT_EQ("third", web_contents()->GetTextInputState()->value);
+
+  // Send focus to the last input field in top frame.
+  press_tab_and_wait_for_text_input_state_change(root_rwh);
+  EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT, root_rwhv->text_input_state()->type);
+  EXPECT_EQ("fourth", root_rwhv->text_input_state()->value);
+
+  EXPECT_EQ("fourth", web_contents()->GetTextInputState()->value);
+}
+
+IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
+                       TextInputStateChangesAfterRendererCrashes) {
+  GURL main_url(
+      embedded_test_server()->GetURL("a.com", "/page_with_iframe.html"));
+  NavigateToURL(shell(), main_url);
+  WebContentsImpl* contents = web_contents();
+
+  FrameTreeNode* root = contents->GetFrameTree()->root();
+
+  FrameTreeNode* child = root->child_at(0);
+  GURL child_url(embedded_test_server()->GetURL(
+      "b.com", "/textinput/page_with_input.html"));
+  NavigateFrameToURL(child, child_url);
+  EXPECT_TRUE(WaitForRenderFrameReady(child->current_frame_host()));
+
+  // Verify that the text input state is initially none.
+  EXPECT_EQ(ui::TEXT_INPUT_TYPE_NONE, contents->GetTextInputState()->type);
+
+  auto press_tab_and_wait_for_state_change =
+      [contents](RenderWidgetHostImpl* rwh) {
+        scoped_refptr<TextInputStateChangedMessageFilter> filter =
+            new TextInputStateChangedMessageFilter(rwh);
+        SimulateKeyPress(contents, ui::VKEY_TAB, false, false, false, false);
+        filter->WaitUntilTextInputStateChanges();
+      };
+
+  auto crash_renderer_and_wait_for_input_state_none = [contents](
+      RenderProcessHost* host) {
+    RenderProcessHostWatcher crash_observer(
+        host, RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
+    host->Shutdown(0, false);
+    crash_observer.Wait();
+
+    // We need to wait until the actual text input state update occurs.
+    while (contents->GetTextInputState()->type != ui::TEXT_INPUT_TYPE_NONE) {
+      scoped_refptr<MessageLoopRunner> loop_runner_ = new MessageLoopRunner();
+      BrowserThread::PostDelayedTask(BrowserThread::UI, FROM_HERE,
+                                     loop_runner_->QuitClosure(),
+                                     base::TimeDelta::FromMilliseconds(0LL));
+      loop_runner_->Run();
+    }
+  };
+
+  // Press a tab key to focus the <input> and verify that the top level
+  // WebContents sees it.
+  RenderWidgetHostImpl* child_rwh =
+      child->current_frame_host()->GetRenderWidgetHost();
+  press_tab_and_wait_for_state_change(child_rwh);
+  EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT, contents->GetTextInputState()->type);
+
+  // Crash the renderer and wait until WebContentsImpl has updates the
+  // state.
+  RenderProcessHost* child_process = child_rwh->GetProcess();
+  crash_renderer_and_wait_for_input_state_none(child_process);
+
+  // Now repeat the same test for the top level RWHV.
+  // First remove the <iframe> and append an <input>
+  EXPECT_TRUE(ExecuteScript(contents,
+                            "var f = document.querySelector('iframe'); "
+                            "f.parentNode.removeChild(f);"));
+  EXPECT_TRUE(ExecuteScript(
+      contents, "document.body.appendChild(document.createElement('input'));"));
+
+  // Press tab to focus the <input> and observe the state change.
+  RenderWidgetHostImpl* root_rwh =
+      root->current_frame_host()->GetRenderWidgetHost();
+  press_tab_and_wait_for_state_change(root_rwh);
+  EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT, contents->GetTextInputState()->type);
+
+  // Crash the tab renderer and observer the input state going back to none.
+  RenderProcessHost* host_process = root_rwh->GetProcess();
+  crash_renderer_and_wait_for_input_state_none(host_process);
+}
+
 }  // namespace content
diff --git a/content/browser/site_per_process_browsertest.h b/content/browser/site_per_process_browsertest.h
index 16db097..5753e19 100644
--- a/content/browser/site_per_process_browsertest.h
+++ b/content/browser/site_per_process_browsertest.h
@@ -7,14 +7,15 @@
 
 #include <string>
 
+#include "content/browser/web_contents/web_contents_impl.h"
 #include "content/public/test/content_browser_test.h"
+#include "content/shell/browser/shell.h"
 #include "content/test/content_browser_test_utils_internal.h"
 #include "url/gurl.h"
 
 namespace content {
 
 class FrameTreeNode;
-class Shell;
 
 class SitePerProcessBrowserTest : public ContentBrowserTest {
  public:
@@ -26,6 +27,10 @@
   void SetUpCommandLine(base::CommandLine* command_line) override;
   void SetUpOnMainThread() override;
 
+  WebContentsImpl* web_contents() {
+    return static_cast<WebContentsImpl*>(shell()->web_contents());
+  }
+
  private:
   FrameTreeVisualizer visualizer_;
 };
diff --git a/content/browser/storage_partition_impl.cc b/content/browser/storage_partition_impl.cc
index 32f552ed7..28b0eb13 100644
--- a/content/browser/storage_partition_impl.cc
+++ b/content/browser/storage_partition_impl.cc
@@ -587,8 +587,10 @@
 
 void StoragePartitionImpl::OpenLocalStorage(
     const url::Origin& origin,
+    mojom::LevelDBObserverPtr observer,
     mojo::InterfaceRequest<mojom::LevelDBWrapper> request) {
-  dom_storage_context_->OpenLocalStorage(origin, std::move(request));
+  dom_storage_context_->OpenLocalStorage(
+      origin, std::move(observer), std::move(request));
 }
 
 void StoragePartitionImpl::ClearDataImpl(
diff --git a/content/browser/storage_partition_impl.h b/content/browser/storage_partition_impl.h
index 45efae4..d564f9ec 100644
--- a/content/browser/storage_partition_impl.h
+++ b/content/browser/storage_partition_impl.h
@@ -65,6 +65,7 @@
   // mojom::StoragePartitionService interface.
   void OpenLocalStorage(
       const url::Origin& origin,
+      mojom::LevelDBObserverPtr observer,
       mojo::InterfaceRequest<mojom::LevelDBWrapper> request) override;
 
   void ClearDataForOrigin(uint32_t remove_mask,
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index fd293b7..1a345ab 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -77,6 +77,7 @@
 #include "content/common/page_messages.h"
 #include "content/common/site_isolation_policy.h"
 #include "content/common/ssl_status_serialization.h"
+#include "content/common/text_input_state.h"
 #include "content/common/view_messages.h"
 #include "content/public/browser/ax_event_notification_details.h"
 #include "content/public/browser/browser_context.h"
@@ -361,6 +362,7 @@
       bluetooth_device_connected_(false),
       virtual_keyboard_requested_(false),
       page_scale_factor_is_one_(true),
+      text_input_state_(new TextInputState()),
       loading_weak_factory_(this),
       weak_factory_(this) {
   frame_tree_.SetFrameRemoveListener(
@@ -2244,6 +2246,44 @@
     browser_plugin_embedder_->DidSendScreenRects();
 }
 
+const TextInputState* WebContentsImpl::GetTextInputState() {
+  if (GetOuterWebContents())
+    return GetOuterWebContents()->GetTextInputState();
+  // A RWHV should update WebContentsImpl in its destruction path so that state
+  // type is reset to none.
+  DCHECK(view_with_active_text_input_ ||
+         text_input_state_->type == ui::TEXT_INPUT_TYPE_NONE);
+  return text_input_state_.get();
+}
+
+void WebContentsImpl::UpdateTextInputState(RenderWidgetHostViewBase* rwhv,
+                                           bool text_input_state_changed) {
+  // If there is an outer WebContents, let it process this update.
+  if (GetOuterWebContents()) {
+    return GetOuterWebContents()->UpdateTextInputState(
+        rwhv, text_input_state_changed);
+  }
+
+  // If this RWHV has a text input type of NONE, then there is nothing to
+  // report to the tab RWHV.
+  if (view_with_active_text_input_.get() != rwhv &&
+      rwhv->text_input_state()->type == ui::TEXT_INPUT_TYPE_NONE)
+    return;
+
+  if (rwhv->text_input_state()->type != ui::TEXT_INPUT_TYPE_NONE)
+    view_with_active_text_input_ = rwhv->GetWeakPtr();
+  else
+    view_with_active_text_input_.reset();
+
+  *text_input_state_ = *rwhv->text_input_state();
+
+  // The top level RWHV should know about the change.
+  RenderWidgetHostViewBase* tab_rwhv =
+      static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView());
+  if (tab_rwhv)
+    tab_rwhv->UpdateInputMethodIfNecessary(text_input_state_changed);
+}
+
 BrowserAccessibilityManager*
     WebContentsImpl::GetRootBrowserAccessibilityManager() {
   RenderFrameHostImpl* rfh = GetMainFrame();
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h
index ee82a54..581f346 100644
--- a/content/browser/web_contents/web_contents_impl.h
+++ b/content/browser/web_contents/web_contents_impl.h
@@ -607,6 +607,9 @@
                               const std::vector<uint8_t>& proto) override;
   void OnRenderFrameProxyVisibilityChanged(bool visible) override;
   void SendScreenRects() override;
+  const TextInputState* GetTextInputState() override;
+  void UpdateTextInputState(RenderWidgetHostViewBase* rwhv,
+                            bool text_input_state_changed) override;
 
   // RenderFrameHostManager::Delegate ------------------------------------------
 
@@ -1326,6 +1329,13 @@
 
   bool page_scale_factor_is_one_;
 
+  // The RWHV which is currently focused.
+  base::WeakPtr<RenderWidgetHostViewBase> view_with_active_text_input_;
+
+  // A copy of the text input state from |view_with_active_text_input_| when
+  // there exists one, or empty (type == ui::TEXT_INPUT_TYPE_NONE) if otherwise.
+  scoped_ptr<TextInputState> text_input_state_;
+
   base::WeakPtrFactory<WebContentsImpl> loading_weak_factory_;
   base::WeakPtrFactory<WebContentsImpl> weak_factory_;
 
diff --git a/content/browser/web_contents/web_contents_impl_browsertest.cc b/content/browser/web_contents/web_contents_impl_browsertest.cc
index 93ae205c..4ef56690 100644
--- a/content/browser/web_contents/web_contents_impl_browsertest.cc
+++ b/content/browser/web_contents/web_contents_impl_browsertest.cc
@@ -968,14 +968,6 @@
   dialog_manager.Wait();
   EXPECT_EQ("about:blank", dialog_manager.last_message());
 
-  // Dialogs do not work with out-of-process iframes yet.
-  // http://crbug.com/453893
-  if (SiteIsolationPolicy::UseSubframeNavigationEntries()) {
-    wc->SetDelegate(nullptr);
-    wc->SetJavaScriptDialogManagerForTesting(nullptr);
-    return;  // :(
-  }
-
   // Navigate cross-domain.
   NavigateFrameToURL(frame,
                      embedded_test_server()->GetURL("b.com", "/title2.html"));
@@ -988,6 +980,14 @@
   EXPECT_EQ(GURL("http://b.com/title2.html"),
             GURL(dialog_manager.last_message()).ReplaceComponents(clear_port));
 
+  // Dialogs do not work with out-of-process iframes yet.
+  // http://crbug.com/453893
+  if (SiteIsolationPolicy::UseSubframeNavigationEntries()) {
+    wc->SetDelegate(nullptr);
+    wc->SetJavaScriptDialogManagerForTesting(nullptr);
+    return;  // :(
+  }
+
   // A dialog from the main frame.
   EXPECT_TRUE(
       content::ExecuteScript(root->current_frame_host(), alert_location));
diff --git a/content/child/blink_platform_impl.cc b/content/child/blink_platform_impl.cc
index 59a73c2..aba472d 100644
--- a/content/child/blink_platform_impl.cc
+++ b/content/child/blink_platform_impl.cc
@@ -225,6 +225,8 @@
       return IDS_FORM_DATE_FORMAT_YEAR;
     case WebLocalizedString::DetailsLabel:
       return IDS_DETAILS_WITHOUT_SUMMARY_LABEL;
+    case WebLocalizedString::DownloadButtonLabel:
+      return IDS_DOWNLOAD_BUTTON_LABEL;
     case WebLocalizedString::FileButtonChooseFileLabel:
       return IDS_FORM_FILE_BUTTON_LABEL;
     case WebLocalizedString::FileButtonChooseMultipleFilesLabel:
diff --git a/content/child/runtime_features.cc b/content/child/runtime_features.cc
index 6a34831..e076bda4 100644
--- a/content/child/runtime_features.cc
+++ b/content/child/runtime_features.cc
@@ -188,6 +188,9 @@
   if (base::FeatureList::IsEnabled(features::kDocumentWriteEvaluator))
     WebRuntimeFeatures::enableDocumentWriteEvaluator(true);
 
+  WebRuntimeFeatures::enableMediaDocumentDownloadButton(
+      base::FeatureList::IsEnabled(features::kMediaDocumentDownloadButton));
+
   // Enable explicitly enabled features, and then disable explicitly disabled
   // ones.
   if (command_line.HasSwitch(switches::kEnableBlinkFeatures)) {
diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc
index ea4d9442..0ff8e11 100644
--- a/content/common/gpu/gpu_command_buffer_stub.cc
+++ b/content/common/gpu/gpu_command_buffer_stub.cc
@@ -23,11 +23,11 @@
 #include "content/common/gpu/gpu_watchdog.h"
 #include "content/common/gpu/image_transport_surface.h"
 #include "gpu/command_buffer/common/constants.h"
+#include "gpu/command_buffer/common/gpu_memory_buffer_support.h"
 #include "gpu/command_buffer/common/mailbox.h"
 #include "gpu/command_buffer/common/sync_token.h"
 #include "gpu/command_buffer/service/gl_context_virtual.h"
 #include "gpu/command_buffer/service/gl_state_restorer_impl.h"
-#include "gpu/command_buffer/service/image_factory.h"
 #include "gpu/command_buffer/service/image_manager.h"
 #include "gpu/command_buffer/service/logger.h"
 #include "gpu/command_buffer/service/mailbox_manager.h"
@@ -1003,20 +1003,19 @@
     return;
   }
 
-  if (!gpu::ImageFactory::IsGpuMemoryBufferFormatSupported(
-          format, decoder_->GetCapabilities())) {
+  if (!gpu::IsGpuMemoryBufferFormatSupported(format,
+                                             decoder_->GetCapabilities())) {
     LOG(ERROR) << "Format is not supported.";
     return;
   }
 
-  if (!gpu::ImageFactory::IsImageSizeValidForGpuMemoryBufferFormat(size,
-                                                                   format)) {
+  if (!gpu::IsImageSizeValidForGpuMemoryBufferFormat(size, format)) {
     LOG(ERROR) << "Invalid image size for format.";
     return;
   }
 
-  if (!gpu::ImageFactory::IsImageFormatCompatibleWithGpuMemoryBufferFormat(
-          internalformat, format)) {
+  if (!gpu::IsImageFormatCompatibleWithGpuMemoryBufferFormat(internalformat,
+                                                             format)) {
     LOG(ERROR) << "Incompatible image format.";
     return;
   }
diff --git a/content/common/gpu/media/dxva_video_decode_accelerator_win.cc b/content/common/gpu/media/dxva_video_decode_accelerator_win.cc
index af0285b..e55c900 100644
--- a/content/common/gpu/media/dxva_video_decode_accelerator_win.cc
+++ b/content/common/gpu/media/dxva_video_decode_accelerator_win.cc
@@ -116,6 +116,51 @@
   0x604F8E68, 0x4951, 0x4c54,{ 0x88, 0xFE, 0xAB, 0xD2, 0x5C, 0x15, 0xB3, 0xD6}
 };
 
+// R600, R700, Evergreen and Cayman AMD cards. These support DXVA via UVD3
+// or earlier, and don't handle resolutions higher than 1920 x 1088 well.
+static const DWORD g_AMDUVD3GPUList[] = {
+  0x9400, 0x9401, 0x9402, 0x9403, 0x9405, 0x940a, 0x940b, 0x940f, 0x94c0,
+  0x94c1, 0x94c3, 0x94c4, 0x94c5, 0x94c6, 0x94c7, 0x94c8, 0x94c9, 0x94cb,
+  0x94cc, 0x94cd, 0x9580, 0x9581, 0x9583, 0x9586, 0x9587, 0x9588, 0x9589,
+  0x958a, 0x958b, 0x958c, 0x958d, 0x958e, 0x958f, 0x9500, 0x9501, 0x9504,
+  0x9505, 0x9506, 0x9507, 0x9508, 0x9509, 0x950f, 0x9511, 0x9515, 0x9517,
+  0x9519, 0x95c0, 0x95c2, 0x95c4, 0x95c5, 0x95c6, 0x95c7, 0x95c9, 0x95cc,
+  0x95cd, 0x95ce, 0x95cf, 0x9590, 0x9591, 0x9593, 0x9595, 0x9596, 0x9597,
+  0x9598, 0x9599, 0x959b, 0x9610, 0x9611, 0x9612, 0x9613, 0x9614, 0x9615,
+  0x9616, 0x9710, 0x9711, 0x9712, 0x9713, 0x9714, 0x9715, 0x9440, 0x9441,
+  0x9442, 0x9443, 0x9444, 0x9446, 0x944a, 0x944b, 0x944c, 0x944e, 0x9450,
+  0x9452, 0x9456, 0x945a, 0x945b, 0x945e, 0x9460, 0x9462, 0x946a, 0x946b,
+  0x947a, 0x947b, 0x9480, 0x9487, 0x9488, 0x9489, 0x948a, 0x948f, 0x9490,
+  0x9491, 0x9495, 0x9498, 0x949c, 0x949e, 0x949f, 0x9540, 0x9541, 0x9542,
+  0x954e, 0x954f, 0x9552, 0x9553, 0x9555, 0x9557, 0x955f, 0x94a0, 0x94a1,
+  0x94a3, 0x94b1, 0x94b3, 0x94b4, 0x94b5, 0x94b9, 0x68e0, 0x68e1, 0x68e4,
+  0x68e5, 0x68e8, 0x68e9, 0x68f1, 0x68f2, 0x68f8, 0x68f9, 0x68fa, 0x68fe,
+  0x68c0, 0x68c1, 0x68c7, 0x68c8, 0x68c9, 0x68d8, 0x68d9, 0x68da, 0x68de,
+  0x68a0, 0x68a1, 0x68a8, 0x68a9, 0x68b0, 0x68b8, 0x68b9, 0x68ba, 0x68be,
+  0x68bf, 0x6880, 0x6888, 0x6889, 0x688a, 0x688c, 0x688d, 0x6898, 0x6899,
+  0x689b, 0x689e, 0x689c, 0x689d, 0x9802, 0x9803, 0x9804, 0x9805, 0x9806,
+  0x9807, 0x9808, 0x9809, 0x980a, 0x9640, 0x9641, 0x9647, 0x9648, 0x964a,
+  0x964b, 0x964c, 0x964e, 0x964f, 0x9642, 0x9643, 0x9644, 0x9645, 0x9649,
+  0x6720, 0x6721, 0x6722, 0x6723, 0x6724, 0x6725, 0x6726, 0x6727, 0x6728,
+  0x6729, 0x6738, 0x6739, 0x673e, 0x6740, 0x6741, 0x6742, 0x6743, 0x6744,
+  0x6745, 0x6746, 0x6747, 0x6748, 0x6749, 0x674a, 0x6750, 0x6751, 0x6758,
+  0x6759, 0x675b, 0x675d, 0x675f, 0x6840, 0x6841, 0x6842, 0x6843, 0x6849,
+  0x6850, 0x6858, 0x6859, 0x6760, 0x6761, 0x6762, 0x6763, 0x6764, 0x6765,
+  0x6766, 0x6767, 0x6768, 0x6770, 0x6771, 0x6772, 0x6778, 0x6779, 0x677b,
+  0x6700, 0x6701, 0x6702, 0x6703, 0x6704, 0x6705, 0x6706, 0x6707, 0x6708,
+  0x6709, 0x6718, 0x6719, 0x671c, 0x671d, 0x671f, 0x683D, 0x9900, 0x9901,
+  0x9903, 0x9904, 0x9905, 0x9906, 0x9907, 0x9908, 0x9909, 0x990a, 0x990b,
+  0x990c, 0x990d, 0x990e, 0x990f, 0x9910, 0x9913, 0x9917, 0x9918, 0x9919,
+  0x9990, 0x9991, 0x9992, 0x9993, 0x9994, 0x9995, 0x9996, 0x9997, 0x9998,
+  0x9999, 0x999a, 0x999b, 0x999c, 0x999d, 0x99a0, 0x99a2, 0x99a4,
+};
+
+// Legacy Intel GPUs (Second generation) which have trouble with resolutions
+// higher than 1920 x 1088
+static const DWORD g_IntelLegacyGPUList[] = {
+  0x102, 0x106, 0x116, 0x126,
+};
+
 // Provides scoped access to the underlying buffer in an IMFMediaBuffer
 // instance.
 class MediaBufferScopedPointer {
@@ -1515,6 +1560,11 @@
       return max_resolution;
   }
 
+  // Legacy AMD drivers with UVD3 or earlier and some Intel GPU's crash while
+  // creating surfaces larger than 1920 x 1088.
+  if (IsLegacyGPU(device.get()))
+    return max_resolution;
+
   // We look for the following resolutions in the driver.
   // TODO(ananta)
   // Look into whether this list needs to be expanded.
@@ -1560,6 +1610,63 @@
   return max_resolution;
 }
 
+// static
+bool DXVAVideoDecodeAccelerator::IsLegacyGPU(ID3D11Device* device) {
+  static const int kAMDGPUId1 = 0x1002;
+  static const int kAMDGPUId2 = 0x1022;
+  static const int kIntelGPU = 0x8086;
+
+  static bool legacy_gpu = true;
+  // This flag ensures that we determine the GPU type once.
+  static bool legacy_gpu_determined = false;
+
+  if (legacy_gpu_determined)
+    return legacy_gpu;
+
+  legacy_gpu_determined = true;
+
+  base::win::ScopedComPtr<IDXGIDevice> dxgi_device;
+  HRESULT hr = dxgi_device.QueryFrom(device);
+  if (FAILED(hr))
+    return legacy_gpu;
+
+  base::win::ScopedComPtr<IDXGIAdapter> adapter;
+  hr = dxgi_device->GetAdapter(adapter.Receive());
+  if (FAILED(hr))
+    return legacy_gpu;
+
+  DXGI_ADAPTER_DESC adapter_desc = {};
+  hr = adapter->GetDesc(&adapter_desc);
+  if (FAILED(hr))
+    return legacy_gpu;
+
+  // We check if the device is an Intel or an AMD device and whether it is in
+  // the global list defined by the g_AMDUVD3GPUList and g_IntelLegacyGPUList
+  // arrays above. If yes then the device is treated as a legacy device.
+  if ((adapter_desc.VendorId == kAMDGPUId1) ||
+       adapter_desc.VendorId == kAMDGPUId2) {
+    {
+      TRACE_EVENT0("gpu,startup",
+                   "DXVAVideoDecodeAccelerator::IsLegacyGPU. AMD check");
+      for (size_t i = 0; i < arraysize(g_AMDUVD3GPUList); i++) {
+        if (adapter_desc.DeviceId == g_AMDUVD3GPUList[i])
+          return legacy_gpu;
+      }
+    }
+  } else if (adapter_desc.VendorId == kIntelGPU) {
+    {
+      TRACE_EVENT0("gpu,startup",
+        "DXVAVideoDecodeAccelerator::IsLegacyGPU. Intel check");
+      for (size_t i = 0; i < arraysize(g_IntelLegacyGPUList); i++) {
+        if (adapter_desc.DeviceId == g_IntelLegacyGPUList[i])
+          return legacy_gpu;
+      }
+    }
+  }
+  legacy_gpu = false;
+  return legacy_gpu;
+}
+
 bool DXVAVideoDecodeAccelerator::InitDecoder(media::VideoCodecProfile profile) {
   HMODULE decoder_dll = NULL;
 
diff --git a/content/common/gpu/media/dxva_video_decode_accelerator_win.h b/content/common/gpu/media/dxva_video_decode_accelerator_win.h
index dabe118..01c15e6 100644
--- a/content/common/gpu/media/dxva_video_decode_accelerator_win.h
+++ b/content/common/gpu/media/dxva_video_decode_accelerator_win.h
@@ -143,6 +143,12 @@
   // Returns the maximum resolution for H264 video.
   static std::pair<int, int> GetMaxH264Resolution();
 
+  // Certain AMD GPU drivers like R600, R700, Evergreen and Cayman and
+  // some second generation Intel GPU drivers crash if we create a video
+  // device with a resolution higher then 1920 x 1088. This function
+  // checks if the GPU is in this list and if yes returns true.
+  static bool IsLegacyGPU(ID3D11Device* device);
+
   // Creates and initializes an instance of the D3D device and the
   // corresponding device manager. The device manager instance is eventually
   // passed to the IMFTransform interface implemented by the decoder.
diff --git a/content/common/leveldb_wrapper.mojom b/content/common/leveldb_wrapper.mojom
index b3949ca8..0035ebc 100644
--- a/content/common/leveldb_wrapper.mojom
+++ b/content/common/leveldb_wrapper.mojom
@@ -7,19 +7,19 @@
 import "components/leveldb/public/interfaces/leveldb.mojom";
 
 // Gives information about changes to a LevelDB database.
-// The reason this is a parameter to DeleteAll and GetAll below, instead of
-// being specified when opening a LevelDBWrapper, is to avoid the client getting
-// callbacks for changes that have already been applied to its database that
-// it's fetching via GetAll or it's clearing via DeleteAll.
-// In the methods below, |source| is a user-defined string which was passed to
-// the various LevelDBWrapper methods.
 // Note that observer methods are called before the callbacks for the
 // LevelDBWrapper methods are run.
 interface LevelDBObserver {
+  KeyAdded(array<uint8> key, array<uint8> value, string source);
   KeyChanged(array<uint8> key, array<uint8> new_value, array<uint8> old_value,
              string source);
   KeyDeleted(array<uint8> key, array<uint8> old_value, string source);
   AllDeleted(string source);
+
+  // Since the GetAll call is synchronous, observers need this asynchronously
+  // delivered notification to avoid applying changes to the returned array
+  // that it already contains.
+  GetAllComplete(string source);
 };
 
 struct KeyValue {
@@ -31,23 +31,21 @@
 // change.
 interface LevelDBWrapper {
   // Sets the database entry for |key| to |value|. Returns OK on success.
-  Put(array<uint8> key, array<uint8> value, string source)
-    => (leveldb.DatabaseError status);
+  Put(array<uint8> key, array<uint8> value, string source) => (bool success);
 
   // Remove the database entry (if any) for |key|.  Returns OK on success, and a
   // non-OK status on error.  It is not an error if |key| did not exist in the
   // database.
-  Delete(array<uint8> key, string source) => (leveldb.DatabaseError status);
+  Delete(array<uint8> key, string source) => (bool success);
 
   // Removes all the entries.
-  DeleteAll(LevelDBObserver observer, string source)
-    => (leveldb.DatabaseError status);
+  DeleteAll(string source) => (bool success);
 
   // Returns the value of the |key|.
-  Get(array<uint8> key) => (leveldb.DatabaseError status, array<uint8> value);
+  Get(array<uint8> key) => (bool success, array<uint8> value);
 
   // Only used with small databases. Returns all key/value pairs.
   [Sync]
-  GetAll(LevelDBObserver observer)
+  GetAll(string source)
     => (leveldb.DatabaseError status, array<KeyValue> data);
 };
diff --git a/content/common/media/video_capture_messages.h b/content/common/media/video_capture_messages.h
index 340b4c9a..d54851a 100644
--- a/content/common/media/video_capture_messages.h
+++ b/content/common/media/video_capture_messages.h
@@ -107,6 +107,11 @@
                      media::VideoCaptureSessionId, /* session_id */
                      media::VideoCaptureParams /* params */)
 
+// Requests that the video capturer send a frame "soon" (e.g., to resolve
+// picture loss or quality issues).
+IPC_MESSAGE_CONTROL1(VideoCaptureHostMsg_RequestRefreshFrame,
+                     int /* device_id */);
+
 // Close the video capture specified by |device_id|.
 IPC_MESSAGE_CONTROL1(VideoCaptureHostMsg_Stop,
                      int /* device_id */)
diff --git a/content/common/storage_partition_service.mojom b/content/common/storage_partition_service.mojom
index e4048a5..3338658 100644
--- a/content/common/storage_partition_service.mojom
+++ b/content/common/storage_partition_service.mojom
@@ -9,5 +9,7 @@
 
 // Returns services related to the current storage partition.
 interface StoragePartitionService {
-  OpenLocalStorage(url.mojom.Origin origin, LevelDBWrapper& database);
+  OpenLocalStorage(url.mojom.Origin origin,
+                   LevelDBObserver observer,
+                   LevelDBWrapper& database);
 };
diff --git a/content/common/text_input_state.cc b/content/common/text_input_state.cc
new file mode 100644
index 0000000..cfe92ed
--- /dev/null
+++ b/content/common/text_input_state.cc
@@ -0,0 +1,15 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/common/text_input_state.h"
+
+namespace content {
+
+TextInputState::TextInputState()
+    : type(ui::TEXT_INPUT_TYPE_NONE),
+      mode(ui::TEXT_INPUT_MODE_DEFAULT),
+      flags(0),
+      can_compose_inline(true) {}
+
+}  //  namespace content
diff --git a/content/common/text_input_state.h b/content/common/text_input_state.h
new file mode 100644
index 0000000..9b9c92b
--- /dev/null
+++ b/content/common/text_input_state.h
@@ -0,0 +1,60 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_COMMON_TEXT_INPUT_STATE_H_
+#define CONTENT_COMMON_TEXT_INPUT_STATE_H_
+
+#include <string>
+
+#include "content/common/content_export.h"
+#include "ui/base/ime/text_input_mode.h"
+#include "ui/base/ime/text_input_type.h"
+
+namespace content {
+
+struct CONTENT_EXPORT TextInputState {
+  TextInputState();
+
+  // Type of the input field.
+  ui::TextInputType type;
+
+  // The mode of input field.
+  ui::TextInputMode mode;
+
+  // The flags of input field (autocorrect, autocomplete, etc.)
+  int flags;
+
+  // The value of input field.
+  std::string value;
+
+  // The cursor position of the current selection start, or the caret position
+  // if nothing is selected.
+  int selection_start;
+
+  // The cursor position of the current selection end, or the caret position if
+  // nothing is selected.
+  int selection_end;
+
+  // The start position of the current composition, or -1 if there is none.
+  int composition_start;
+
+  // The end position of the current composition, or -1 if there is none.
+  int composition_end;
+
+  // Whether or not inline composition can be performed for the current input.
+  bool can_compose_inline;
+
+  // Whether or not the IME should be shown as a result of this update. Even if
+  // true, the IME will only be shown if the input is appropriate (e.g. not
+  // TEXT_INPUT_TYPE_NONE).
+  bool show_ime_if_needed;
+
+  // Whether this change is originated from non-IME (e.g., Javascript,
+  // Autofill).
+  bool is_non_ime_change;
+};
+
+}  // namespace content
+
+#endif  // CONTENT_COMMON_TEXT_INPUT_STATE_H_
diff --git a/content/common/view_messages.h b/content/common/view_messages.h
index 71d9753..a24a408 100644
--- a/content/common/view_messages.h
+++ b/content/common/view_messages.h
@@ -23,6 +23,7 @@
 #include "content/common/media/media_param_traits.h"
 #include "content/common/navigation_gesture.h"
 #include "content/common/resize_params.h"
+#include "content/common/text_input_state.h"
 #include "content/common/view_message_enums.h"
 #include "content/public/common/common_param_traits.h"
 #include "content/public/common/favicon_url.h"
@@ -292,6 +293,20 @@
   IPC_STRUCT_TRAITS_MEMBER(time)
 IPC_STRUCT_TRAITS_END()
 
+IPC_STRUCT_TRAITS_BEGIN(content::TextInputState)
+  IPC_STRUCT_TRAITS_MEMBER(type)
+  IPC_STRUCT_TRAITS_MEMBER(mode)
+  IPC_STRUCT_TRAITS_MEMBER(flags)
+  IPC_STRUCT_TRAITS_MEMBER(value)
+  IPC_STRUCT_TRAITS_MEMBER(selection_start)
+  IPC_STRUCT_TRAITS_MEMBER(selection_end)
+  IPC_STRUCT_TRAITS_MEMBER(composition_start)
+  IPC_STRUCT_TRAITS_MEMBER(composition_end)
+  IPC_STRUCT_TRAITS_MEMBER(can_compose_inline)
+  IPC_STRUCT_TRAITS_MEMBER(show_ime_if_needed)
+  IPC_STRUCT_TRAITS_MEMBER(is_non_ime_change)
+IPC_STRUCT_TRAITS_END()
+
 IPC_STRUCT_BEGIN(ViewHostMsg_CreateWindow_Params)
   // Routing ID of the view initiating the open.
   IPC_STRUCT_MEMBER(int, opener_id)
@@ -413,45 +428,6 @@
   IPC_STRUCT_MEMBER(bool, is_anchor_first)
 IPC_STRUCT_END()
 
-IPC_STRUCT_BEGIN(ViewHostMsg_TextInputState_Params)
-  // The type of input field
-  IPC_STRUCT_MEMBER(ui::TextInputType, type)
-
-  // The mode of input field
-  IPC_STRUCT_MEMBER(ui::TextInputMode, mode)
-
-  // The flags of the input field (autocorrect, autocomplete, etc.)
-  IPC_STRUCT_MEMBER(int, flags)
-
-  // The value of the input field
-  IPC_STRUCT_MEMBER(std::string, value)
-
-  // The cursor position of the current selection start, or the caret position
-  // if nothing is selected
-  IPC_STRUCT_MEMBER(int, selection_start)
-
-  // The cursor position of the current selection end, or the caret position
-  // if nothing is selected
-  IPC_STRUCT_MEMBER(int, selection_end)
-
-  // The start position of the current composition, or -1 if there is none
-  IPC_STRUCT_MEMBER(int, composition_start)
-
-  // The end position of the current composition, or -1 if there is none
-  IPC_STRUCT_MEMBER(int, composition_end)
-
-  // Whether or not inline composition can be performed for the current input.
-  IPC_STRUCT_MEMBER(bool, can_compose_inline)
-
-  // Whether or not the IME should be shown as a result of this update. Even if
-  // true, the IME will only be shown if the type is appropriate (e.g. not
-  // TEXT_INPUT_TYPE_NONE).
-  IPC_STRUCT_MEMBER(bool, show_ime_if_needed)
-
-  // Whether this change is originated from non-IME (e.g. Javascript, Autofill).
-  IPC_STRUCT_MEMBER(bool, is_non_ime_change)
-IPC_STRUCT_END()
-
 IPC_STRUCT_BEGIN(ViewHostMsg_UpdateRect_Params)
   // The size of the RenderView when this message was generated.  This is
   // included so the host knows how large the view is from the perspective of
@@ -1162,7 +1138,7 @@
 
 // Required for updating text input state.
 IPC_MESSAGE_ROUTED1(ViewHostMsg_TextInputStateChanged,
-                    ViewHostMsg_TextInputState_Params /* input state params */)
+                    content::TextInputState /* input state */)
 
 // Sent when the renderer changes the zoom level for a particular url, so the
 // browser can update its records.  If the view is a plugin doc, then url is
diff --git a/content/content_common.gypi b/content/content_common.gypi
index 0ff96b5..7248199 100644
--- a/content/content_common.gypi
+++ b/content/content_common.gypi
@@ -609,6 +609,8 @@
       'common/swapped_out_messages.cc',
       'common/swapped_out_messages.h',
       'common/text_input_client_messages.h',
+      'common/text_input_state.cc',
+      'common/text_input_state.h',
       'common/url_schemes.cc',
       'common/url_schemes.h',
       'common/user_agent.cc',
diff --git a/content/ppapi_plugin/ppapi_thread.cc b/content/ppapi_plugin/ppapi_thread.cc
index ccd4f7bb..8e0724b 100644
--- a/content/ppapi_plugin/ppapi_thread.cc
+++ b/content/ppapi_plugin/ppapi_thread.cc
@@ -195,8 +195,7 @@
 #if defined(OS_WIN)
   if (peer_handle_.IsValid()) {
     DCHECK(is_broker_);
-    return IPC::GetFileHandleForProcess(handle, peer_handle_.Get(),
-                                        should_close_source);
+    return IPC::GetPlatformFileForTransit(handle, should_close_source);
   }
 #endif
 
diff --git a/content/public/common/common_param_traits_macros.h b/content/public/common/common_param_traits_macros.h
index 2050643..ae29c73 100644
--- a/content/public/common/common_param_traits_macros.h
+++ b/content/public/common/common_param_traits_macros.h
@@ -225,6 +225,7 @@
   IPC_STRUCT_TRAITS_MEMBER(clobber_user_agent_initial_scale_quirk)
   IPC_STRUCT_TRAITS_MEMBER(ignore_main_frame_overflow_hidden_quirk)
   IPC_STRUCT_TRAITS_MEMBER(report_screen_size_in_physical_pixels_quirk)
+  IPC_STRUCT_TRAITS_MEMBER(resue_global_for_unowned_main_frame)
   IPC_STRUCT_TRAITS_MEMBER(autoplay_experiment_mode)
 #endif
   IPC_STRUCT_TRAITS_MEMBER(default_minimum_page_scale_factor)
diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc
index 5fe9424..920694e 100644
--- a/content/public/common/content_features.cc
+++ b/content/public/common/content_features.cc
@@ -39,6 +39,13 @@
 const base::Feature kNewMediaPlaybackUi{"NewMediaPlaybackUi",
                                         base::FEATURE_DISABLED_BY_DEFAULT};
 
+// FeatureList definition for trials to enable the download button on
+// MediaDocument.
+const base::Feature kMediaDocumentDownloadButton{
+    "MediaDocumentDownloadButton",
+    base::FEATURE_DISABLED_BY_DEFAULT
+};
+
 // Non-validating reload on reload-to-refresh-content (e.g. pull-to-refresh).
 // See https://crbug.com/558829
 const base::Feature kNonValidatingReloadOnRefreshContent{
@@ -70,12 +77,6 @@
 const base::Feature kTokenBinding{"token-binding",
                                   base::FEATURE_DISABLED_BY_DEFAULT};
 
-// Control whether the priority of a renderer is set when the process is
-// launched. This is in response to a bug seen on Windows. See
-// https://crbug.com/560446
-const base::Feature kUpdateRendererPriorityOnStartup{
-    "UpdateRendererPriorityOnStartup", base::FEATURE_ENABLED_BY_DEFAULT};
-
 // An experimental User Agent Intervention on WebFonts loading.
 const base::Feature kWebFontsIntervention{"WebFontsIntervention",
                                           base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/content/public/common/content_features.h b/content/public/common/content_features.h
index 49e3ab2..72c93b3 100644
--- a/content/public/common/content_features.h
+++ b/content/public/common/content_features.h
@@ -22,13 +22,13 @@
 CONTENT_EXPORT extern const base::Feature kDocumentWriteEvaluator;
 CONTENT_EXPORT extern const base::Feature kExperimentalFramework;
 CONTENT_EXPORT extern const base::Feature kNewMediaPlaybackUi;
+CONTENT_EXPORT extern const base::Feature kMediaDocumentDownloadButton;
 CONTENT_EXPORT extern const base::Feature kNonValidatingReloadOnRefreshContent;
 CONTENT_EXPORT extern const base::Feature kOptimizeIPCForSmallResource;
 CONTENT_EXPORT extern const base::Feature kRenderingPipelineThrottling;
 CONTENT_EXPORT extern const base::Feature kScrollAnchoring;
 CONTENT_EXPORT extern const base::Feature kStaleWhileRevalidate;
 CONTENT_EXPORT extern const base::Feature kTokenBinding;
-CONTENT_EXPORT extern const base::Feature kUpdateRendererPriorityOnStartup;
 CONTENT_EXPORT extern const base::Feature kWebFontsIntervention;
 CONTENT_EXPORT extern const base::Feature kWebUsb;
 
diff --git a/content/public/common/web_preferences.cc b/content/public/common/web_preferences.cc
index 761d994..c1cdd19 100644
--- a/content/public/common/web_preferences.cc
+++ b/content/public/common/web_preferences.cc
@@ -184,6 +184,7 @@
       clobber_user_agent_initial_scale_quirk(false),
       ignore_main_frame_overflow_hidden_quirk(false),
       report_screen_size_in_physical_pixels_quirk(false),
+      resue_global_for_unowned_main_frame(false),
 #endif
 #if defined(OS_ANDROID)
       default_minimum_page_scale_factor(0.25f),
diff --git a/content/public/common/web_preferences.h b/content/public/common/web_preferences.h
index 0ea55b2..7b72351 100644
--- a/content/public/common/web_preferences.h
+++ b/content/public/common/web_preferences.h
@@ -218,6 +218,9 @@
   bool clobber_user_agent_initial_scale_quirk;
   bool ignore_main_frame_overflow_hidden_quirk;
   bool report_screen_size_in_physical_pixels_quirk;
+  // Used by Android_WebView only to support legacy apps that inject script into
+  // a top-level initial empty document and expect it to persist on navigation.
+  bool resue_global_for_unowned_main_frame;
   std::string autoplay_experiment_mode;
 #endif
 
diff --git a/content/public/renderer/media_stream_utils.cc b/content/public/renderer/media_stream_utils.cc
index d48654198..5b91b18 100644
--- a/content/public/renderer/media_stream_utils.cc
+++ b/content/public/renderer/media_stream_utils.cc
@@ -118,12 +118,22 @@
   if (video_track.isNull())
     return nullptr;
 
-  content::MediaStreamVideoSource* source =
-      content::MediaStreamVideoSource::GetVideoSource(video_track.source());
+  MediaStreamVideoSource* const source =
+      MediaStreamVideoSource::GetVideoSource(video_track.source());
   if (!source)
     return nullptr;
 
   return source->GetCurrentFormat();
 }
 
+void RequestRefreshFrameFromVideoTrack(
+    const blink::WebMediaStreamTrack& video_track) {
+  if (video_track.isNull())
+    return;
+  MediaStreamVideoSource* const source =
+      MediaStreamVideoSource::GetVideoSource(video_track.source());
+  if (source)
+    source->RequestRefreshFrame();
+}
+
 }  // namespace content
diff --git a/content/public/renderer/media_stream_utils.h b/content/public/renderer/media_stream_utils.h
index 5df43edc..8b94b72 100644
--- a/content/public/renderer/media_stream_utils.h
+++ b/content/public/renderer/media_stream_utils.h
@@ -54,6 +54,11 @@
 CONTENT_EXPORT const media::VideoCaptureFormat* GetCurrentVideoTrackFormat(
     const blink::WebMediaStreamTrack& video_track);
 
+// Requests that a refresh frame be sent "soon" (e.g., to resolve picture loss
+// or quality issues).
+CONTENT_EXPORT void RequestRefreshFrameFromVideoTrack(
+    const blink::WebMediaStreamTrack& video_track);
+
 }  // namespace content
 
 #endif  // CONTENT_PUBLIC_RENDERER_MEDIA_STREAM_UTILS_H_
diff --git a/content/public/renderer/media_stream_video_sink.cc b/content/public/renderer/media_stream_video_sink.cc
index 118d732c..d2c3488 100644
--- a/content/public/renderer/media_stream_video_sink.cc
+++ b/content/public/renderer/media_stream_video_sink.cc
@@ -4,29 +4,34 @@
 
 #include "content/public/renderer/media_stream_video_sink.h"
 
-#include "base/logging.h"
 #include "content/renderer/media/media_stream_video_track.h"
-#include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
 
 namespace content {
 
-void MediaStreamVideoSink::AddToVideoTrack(
-    MediaStreamVideoSink* sink,
-    const VideoCaptureDeliverFrameCB& callback,
-    const blink::WebMediaStreamTrack& track) {
-  DCHECK_EQ(blink::WebMediaStreamSource::TypeVideo, track.source().getType());
-  MediaStreamVideoTrack* const video_track =
-      static_cast<MediaStreamVideoTrack*>(track.getExtraData());
-  video_track->AddSink(sink, callback);
+MediaStreamVideoSink::MediaStreamVideoSink() : MediaStreamSink() {}
+
+MediaStreamVideoSink::~MediaStreamVideoSink() {
+  // Ensure this sink has disconnected from the track.
+  DisconnectFromTrack();
 }
 
-void MediaStreamVideoSink::RemoveFromVideoTrack(
-    MediaStreamVideoSink* sink,
-    const blink::WebMediaStreamTrack& track) {
-  DCHECK_EQ(blink::WebMediaStreamSource::TypeVideo, track.source().getType());
+void MediaStreamVideoSink::ConnectToTrack(
+    const blink::WebMediaStreamTrack& track,
+    const VideoCaptureDeliverFrameCB& callback) {
+  DCHECK(connected_track_.isNull());
+  connected_track_ = track;
   MediaStreamVideoTrack* const video_track =
-      static_cast<MediaStreamVideoTrack*>(track.getExtraData());
-  video_track->RemoveSink(sink);
+      MediaStreamVideoTrack::GetVideoTrack(connected_track_);
+  DCHECK(video_track);
+  video_track->AddSink(this, callback);
+}
+
+void MediaStreamVideoSink::DisconnectFromTrack() {
+  MediaStreamVideoTrack* const video_track =
+      MediaStreamVideoTrack::GetVideoTrack(connected_track_);
+  if (video_track)
+    video_track->RemoveSink(this);
+  connected_track_.reset();
 }
 
 }  // namespace content
diff --git a/content/public/renderer/media_stream_video_sink.h b/content/public/renderer/media_stream_video_sink.h
index b1dda9c..fd5334c 100644
--- a/content/public/renderer/media_stream_video_sink.h
+++ b/content/public/renderer/media_stream_video_sink.h
@@ -13,37 +13,46 @@
 #include "content/common/media/video_capture.h"
 #include "content/public/renderer/media_stream_sink.h"
 #include "media/base/video_capturer_source.h"
-
-namespace blink {
-class WebMediaStreamTrack;
-}
+#include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
 
 namespace content {
 
 // MediaStreamVideoSink is an interface used for receiving video frames from a
-// Video Stream Track or a Video Source.
+// Video Stream Track or a Video Source. It should be extended by embedders,
+// which connect/disconnect the sink implementation to a track to start/stop the
+// flow of video frames.
+//
 // http://dev.w3.org/2011/webrtc/editor/getusermedia.html
 // All methods calls will be done from the main render thread.
 class CONTENT_EXPORT MediaStreamVideoSink : public MediaStreamSink {
- public:
-  // An implementation of MediaStreamVideoSink should call AddToVideoTrack when
+ protected:
+  MediaStreamVideoSink();
+  ~MediaStreamVideoSink() override;
+
+  // An implementation of MediaStreamVideoSink should call ConnectToTrack when
   // it is ready to receive data from a video track. Before the implementation
-  // is destroyed, RemoveFromVideoTrack must be called.
+  // is destroyed, DisconnectFromTrack must be called. This MediaStreamVideoSink
+  // base class holds a reference to the WebMediaStreamTrack until
+  // DisconnectFromTrack is called.
   //
   // Calls to these methods must be done on the main render thread.
   // Note that |callback| for frame delivery happens on the IO thread.
   //
-  // Calling RemoveFromVideoTrack also not stop frame delivery through the
-  // callback immediately because it may happen on another thread.
-  // The added callback will be reset on the render thread.
-  static void AddToVideoTrack(MediaStreamVideoSink* sink,
-                              const VideoCaptureDeliverFrameCB& callback,
-                              const blink::WebMediaStreamTrack& track);
-  static void RemoveFromVideoTrack(MediaStreamVideoSink* sink,
-                                   const blink::WebMediaStreamTrack& track);
+  // Warning: Calling DisconnectFromTrack does not immediately stop frame
+  // delivery through the |callback|, since frames are being delivered on a
+  // different thread.
+  void ConnectToTrack(const blink::WebMediaStreamTrack& track,
+                      const VideoCaptureDeliverFrameCB& callback);
+  void DisconnectFromTrack();
 
- protected:
-  ~MediaStreamVideoSink() override {}
+  // Returns the currently-connected track, or a null instance otherwise.
+  const blink::WebMediaStreamTrack& connected_track() const {
+    return connected_track_;
+  }
+
+ private:
+  // Set by ConnectToTrack() and cleared by DisconnectFromTrack().
+  blink::WebMediaStreamTrack connected_track_;
 };
 
 
diff --git a/content/public/test/browser_test_utils.cc b/content/public/test/browser_test_utils.cc
index fac8957d..8021ad42 100644
--- a/content/public/test/browser_test_utils.cc
+++ b/content/public/test/browser_test_utils.cc
@@ -29,6 +29,7 @@
 #include "content/browser/web_contents/web_contents_view.h"
 #include "content/common/input/synthetic_web_input_event_builders.h"
 #include "content/common/input_messages.h"
+#include "content/common/text_input_state.h"
 #include "content/common/view_messages.h"
 #include "content/public/browser/browser_context.h"
 #include "content/public/browser/histogram_fetcher.h"
@@ -1223,4 +1224,18 @@
   return ack_result_;
 }
 
+TextInputStateTestExport::TextInputStateTestExport(
+    const ui::TextInputType& type,
+    const std::string& value)
+    : type_(type), value_(value) {}
+
+// static
+TextInputStateTestExport TextInputStateTestExport::FromWebContents(
+    WebContents* web_contents) {
+  const TextInputState* state =
+      static_cast<WebContentsImpl*>(web_contents)->GetTextInputState();
+
+  return TextInputStateTestExport(state->type, state->value);
+}
+
 }  // namespace content
diff --git a/content/public/test/browser_test_utils.h b/content/public/test/browser_test_utils.h
index a07ed26..1fa6691 100644
--- a/content/public/test/browser_test_utils.h
+++ b/content/public/test/browser_test_utils.h
@@ -27,6 +27,7 @@
 #include "ipc/message_filter.h"
 #include "third_party/WebKit/public/web/WebInputEvent.h"
 #include "ui/accessibility/ax_node_data.h"
+#include "ui/base/ime/text_input_type.h"
 #include "ui/events/keycodes/keyboard_codes.h"
 #include "url/gurl.h"
 
@@ -505,6 +506,23 @@
   DISALLOW_COPY_AND_ASSIGN(InputMsgWatcher);
 };
 
+class TextInputStateTestExport {
+ public:
+  static TextInputStateTestExport FromWebContents(
+      content::WebContents* web_contents);
+
+  const ui::TextInputType& type() const { return type_; }
+
+  const std::string& value() const { return value_; }
+
+ private:
+  TextInputStateTestExport(const ui::TextInputType& type,
+                           const std::string& value);
+
+  ui::TextInputType type_;
+  std::string value_;
+};
+
 }  // namespace content
 
 #endif  // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_
diff --git a/content/public/test/mock_render_process_host.cc b/content/public/test/mock_render_process_host.cc
index 0fa30ed..50378931 100644
--- a/content/public/test/mock_render_process_host.cc
+++ b/content/public/test/mock_render_process_host.cc
@@ -172,7 +172,7 @@
 }
 
 base::ProcessHandle MockRenderProcessHost::GetHandle() const {
-  // Return the current-process handle for the IPC::GetFileHandleForProcess
+  // Return the current-process handle for the IPC::GetPlatformFileForTransit
   // function.
   if (process_handle)
     return *process_handle;
diff --git a/content/renderer/dom_storage/local_storage_cached_area.cc b/content/renderer/dom_storage/local_storage_cached_area.cc
index cb975a1..1f191a2 100644
--- a/content/renderer/dom_storage/local_storage_cached_area.cc
+++ b/content/renderer/dom_storage/local_storage_cached_area.cc
@@ -6,6 +6,8 @@
 
 #include "base/bind.h"
 #include "base/metrics/histogram_macros.h"
+#include "base/rand_util.h"
+#include "base/strings/string_number_conversions.h"
 #include "base/strings/string_split.h"
 #include "base/time/time.h"
 #include "content/common/dom_storage/dom_storage_map.h"
@@ -41,9 +43,10 @@
     const url::Origin& origin,
     mojom::StoragePartitionService* storage_partition_service,
     LocalStorageCachedAreas* cached_areas)
-    : origin_(origin), binding_(this), cached_areas_(cached_areas) {
+    : origin_(origin), binding_(this),
+      cached_areas_(cached_areas), weak_factory_(this) {
   storage_partition_service->OpenLocalStorage(
-      origin_, mojo::GetProxy(&leveldb_));
+      origin_, binding_.CreateInterfacePtrAndBind(), mojo::GetProxy(&leveldb_));
 }
 
 LocalStorageCachedArea::~LocalStorageCachedArea() {
@@ -86,7 +89,7 @@
                 mojo::Array<uint8_t>::From(value),
                 PackSource(page_url, storage_area_id),
                 base::Bind(&LocalStorageCachedArea::OnSetItemComplete,
-                           base::Unretained(this), key));
+                           weak_factory_.GetWeakPtr(), key));
   return true;
 }
 
@@ -103,7 +106,7 @@
   leveldb_->Delete(mojo::Array<uint8_t>::From(key),
                    PackSource(page_url, storage_area_id),
                    base::Bind(&LocalStorageCachedArea::OnRemoveItemComplete,
-                              base::Unretained(this), key));
+                              weak_factory_.GetWeakPtr(), key));
 }
 
 void LocalStorageCachedArea::Clear(const GURL& page_url,
@@ -112,11 +115,10 @@
 
   Reset();
   map_ = new DOMStorageMap(kPerStorageAreaQuota);
-
-  leveldb_->DeleteAll(binding_.CreateInterfacePtrAndBind(),
-                      PackSource(page_url, storage_area_id),
+  ignore_all_mutations_ = true;
+  leveldb_->DeleteAll(PackSource(page_url, storage_area_id),
                       base::Bind(&LocalStorageCachedArea::OnClearComplete,
-                                  base::Unretained(this)));
+                                  weak_factory_.GetWeakPtr()));
 }
 
 void LocalStorageCachedArea::AreaCreated(LocalStorageArea* area) {
@@ -127,39 +129,21 @@
   areas_.erase(area->id());
 }
 
+void LocalStorageCachedArea::KeyAdded(mojo::Array<uint8_t> key,
+                                      mojo::Array<uint8_t> value,
+                                      const mojo::String& source) {
+  base::NullableString16 null_value;
+  KeyAddedOrChanged(std::move(key), std::move(value),
+                    null_value, source);
+}
+
 void LocalStorageCachedArea::KeyChanged(mojo::Array<uint8_t> key,
                                         mojo::Array<uint8_t> new_value,
                                         mojo::Array<uint8_t> old_value,
                                         const mojo::String& source) {
-  GURL page_url;
-  std::string storage_area_id;
-  UnpackSource(source, &page_url, &storage_area_id);
-
-  base::string16 key_string = key.To<base::string16>();
-  base::string16 new_value_string = new_value.To<base::string16>();
-
-  blink::WebStorageArea* originating_area = nullptr;
-  if (areas_.find(storage_area_id) != areas_.end()) {
-    // The source storage area is in this process.
-    originating_area = areas_[storage_area_id];
-  } else {
-    // This was from another process or the storage area is gone. If the former,
-    // apply it to our cache if we haven't already changed it and are waiting
-    // for the confirmation callback. In the latter case, we won't do anything
-    // because ignore_key_mutations_ won't be updated until the callback runs.
-    if (ignore_key_mutations_.find(key_string) != ignore_key_mutations_.end()) {
-      // We turn off quota checking here to accomodate the over budget allowance
-      // that's provided in the browser process.
-      base::NullableString16 unused;
-      map_->set_quota(std::numeric_limits<int32_t>::max());
-      map_->SetItem(key_string, new_value_string, &unused);
-      map_->set_quota(kPerStorageAreaQuota);
-    }
-  }
-
-  blink::WebStorageEventDispatcher::dispatchLocalStorageEvent(
-      key_string, old_value.To<base::string16>(), new_value_string,
-      GURL(origin_.Serialize()), page_url, originating_area);
+  base::NullableString16 old_value_str(old_value.To<base::string16>(), false);
+  KeyAddedOrChanged(std::move(key), std::move(new_value),
+                    old_value_str, source);
 }
 
 void LocalStorageCachedArea::KeyDeleted(mojo::Array<uint8_t> key,
@@ -175,7 +159,7 @@
   if (areas_.find(storage_area_id) != areas_.end()) {
     // The source storage area is in this process.
     originating_area = areas_[storage_area_id];
-  } else {
+  } else if (map_ && !ignore_all_mutations_) {
     // This was from another process or the storage area is gone. If the former,
     // remove it from our cache if we haven't already changed it and are waiting
     // for the confirmation callback. In the latter case, we won't do anything
@@ -200,7 +184,7 @@
   if (areas_.find(storage_area_id) != areas_.end()) {
     // The source storage area is in this process.
     originating_area = areas_[storage_area_id];
-  } else {
+  } else if (map_ && !ignore_all_mutations_) {
     scoped_refptr<DOMStorageMap> old = map_;
     map_ = new DOMStorageMap(kPerStorageAreaQuota);
 
@@ -223,14 +207,65 @@
       originating_area);
 }
 
+void LocalStorageCachedArea::GetAllComplete(const mojo::String& source) {
+  // Since the GetAll method is synchronous, we need this asynchronously
+  // delivered notification to avoid applying changes to the returned array
+  // that we already have.
+  if (source.To<std::string>() == get_all_request_id_) {
+    DCHECK(ignore_all_mutations_);
+    DCHECK(!get_all_request_id_.empty());
+    ignore_all_mutations_ = false;
+    get_all_request_id_.clear();
+  }
+}
+
+void LocalStorageCachedArea::KeyAddedOrChanged(
+    mojo::Array<uint8_t> key,
+    mojo::Array<uint8_t> new_value,
+    const base::NullableString16& old_value,
+    const mojo::String& source) {
+  GURL page_url;
+  std::string storage_area_id;
+  UnpackSource(source, &page_url, &storage_area_id);
+
+  base::string16 key_string = key.To<base::string16>();
+  base::string16 new_value_string = new_value.To<base::string16>();
+
+  blink::WebStorageArea* originating_area = nullptr;
+  if (areas_.find(storage_area_id) != areas_.end()) {
+    // The source storage area is in this process.
+    originating_area = areas_[storage_area_id];
+  } else if (map_ && !ignore_all_mutations_) {
+    // This was from another process or the storage area is gone. If the former,
+    // apply it to our cache if we haven't already changed it and are waiting
+    // for the confirmation callback. In the latter case, we won't do anything
+    // because ignore_key_mutations_ won't be updated until the callback runs.
+    if (ignore_key_mutations_.find(key_string) != ignore_key_mutations_.end()) {
+      // We turn off quota checking here to accomodate the over budget allowance
+      // that's provided in the browser process.
+      base::NullableString16 unused;
+      map_->set_quota(std::numeric_limits<int32_t>::max());
+      map_->SetItem(key_string, new_value_string, &unused);
+      map_->set_quota(kPerStorageAreaQuota);
+    }
+  }
+
+  blink::WebStorageEventDispatcher::dispatchLocalStorageEvent(
+      key_string, old_value, new_value_string,
+      GURL(origin_.Serialize()), page_url, originating_area);
+
+}
+
 void LocalStorageCachedArea::EnsureLoaded() {
   if (map_)
     return;
 
   base::TimeTicks before = base::TimeTicks::Now();
+  ignore_all_mutations_ = true;
+  get_all_request_id_ = base::Uint64ToString(base::RandUint64());
   leveldb::DatabaseError status = leveldb::DatabaseError::OK;
   mojo::Array<content::mojom::KeyValuePtr> data;
-  leveldb_->GetAll(binding_.CreateInterfacePtrAndBind(), &status, &data);
+  leveldb_->GetAll(get_all_request_id_, &status, &data);
 
   DOMStorageValuesMap values;
   for (size_t i = 0; i < data.size(); ++i) {
@@ -264,8 +299,8 @@
 }
 
 void LocalStorageCachedArea::OnSetItemComplete(const base::string16& key,
-                                               leveldb::DatabaseError result) {
-  if (result != leveldb::DatabaseError::OK) {
+                                               bool success) {
+  if (!success) {
     Reset();
     return;
   }
@@ -277,22 +312,25 @@
 }
 
 void LocalStorageCachedArea::OnRemoveItemComplete(
-    const base::string16& key, leveldb::DatabaseError result) {
-  DCHECK_EQ(result, leveldb::DatabaseError::OK);
+    const base::string16& key, bool success) {
+  DCHECK(success);
   auto found = ignore_key_mutations_.find(key);
   DCHECK(found != ignore_key_mutations_.end());
   if (--found->second == 0)
     ignore_key_mutations_.erase(found);
 }
 
-void LocalStorageCachedArea::OnClearComplete(leveldb::DatabaseError result) {
-  DCHECK_EQ(result, leveldb::DatabaseError::OK);
+void LocalStorageCachedArea::OnClearComplete(bool success) {
+  DCHECK(success);
+  DCHECK(ignore_all_mutations_);
+  ignore_all_mutations_ = false;
 }
 
 void LocalStorageCachedArea::Reset() {
-  binding_.Close();
   map_ = NULL;
   ignore_key_mutations_.clear();
+  ignore_all_mutations_ = false;
+  weak_factory_.InvalidateWeakPtrs();
 }
 
 }  // namespace content
diff --git a/content/renderer/dom_storage/local_storage_cached_area.h b/content/renderer/dom_storage/local_storage_cached_area.h
index 2797769..316f4e81 100644
--- a/content/renderer/dom_storage/local_storage_cached_area.h
+++ b/content/renderer/dom_storage/local_storage_cached_area.h
@@ -65,6 +65,9 @@
   ~LocalStorageCachedArea() override;
 
   // LevelDBObserver:
+  void KeyAdded(mojo::Array<uint8_t> key,
+                mojo::Array<uint8_t> value,
+                const mojo::String& source) override;
   void KeyChanged(mojo::Array<uint8_t> key,
                   mojo::Array<uint8_t> new_value,
                   mojo::Array<uint8_t> old_value,
@@ -73,16 +76,21 @@
                   mojo::Array<uint8_t> old_value,
                   const mojo::String& source) override;
   void AllDeleted(const mojo::String& source) override;
+  void GetAllComplete(const mojo::String& source) override;
+
+  // Common helper for KeyAdded() and KeyChanged()
+  void KeyAddedOrChanged(mojo::Array<uint8_t> key,
+                         mojo::Array<uint8_t> new_value,
+                         const base::NullableString16& old_value,
+                         const mojo::String& source);
 
   // Synchronously fetches the origin's local storage data if it hasn't been
   // fetched already.
   void EnsureLoaded();
 
-  void OnSetItemComplete(const base::string16& key,
-                         leveldb::DatabaseError result);
-  void OnRemoveItemComplete(const base::string16& key,
-                            leveldb::DatabaseError result);
-  void OnClearComplete(leveldb::DatabaseError result);
+  void OnSetItemComplete(const base::string16& key, bool success);
+  void OnRemoveItemComplete(const base::string16& key, bool success);
+  void OnClearComplete(bool success);
 
   // Resets the object back to its newly constructed state.
   void Reset();
@@ -90,10 +98,13 @@
   url::Origin origin_;
   scoped_refptr<DOMStorageMap> map_;
   std::map<base::string16, int> ignore_key_mutations_;
+  bool ignore_all_mutations_ = false;
+  std::string get_all_request_id_;
   mojom::LevelDBWrapperPtr leveldb_;
   mojo::Binding<mojom::LevelDBObserver> binding_;
   LocalStorageCachedAreas* cached_areas_;
   std::map<std::string, LocalStorageArea*> areas_;
+  base::WeakPtrFactory<LocalStorageCachedArea> weak_factory_;
 
   DISALLOW_COPY_AND_ASSIGN(LocalStorageCachedArea);
 };
diff --git a/content/renderer/gpu/compositor_output_surface.cc b/content/renderer/gpu/compositor_output_surface.cc
index 5546d58..72e0d01 100644
--- a/content/renderer/gpu/compositor_output_surface.cc
+++ b/content/renderer/gpu/compositor_output_surface.cc
@@ -33,16 +33,22 @@
     uint32_t output_surface_id,
     const scoped_refptr<ContextProviderCommandBuffer>& context_provider,
     const scoped_refptr<ContextProviderCommandBuffer>& worker_context_provider,
+#if defined(ENABLE_VULKAN)
+    const scoped_refptr<cc::VulkanContextProvider>& vulkan_context_provider,
+#endif
     scoped_ptr<cc::SoftwareOutputDevice> software_device,
     scoped_refptr<FrameSwapMessageQueue> swap_frame_message_queue,
     bool use_swap_compositor_frame_message)
     : OutputSurface(context_provider,
                     worker_context_provider,
+#if defined(ENABLE_VULKAN)
+                    vulkan_context_provider,
+#endif
                     std::move(software_device)),
       output_surface_id_(output_surface_id),
       use_swap_compositor_frame_message_(use_swap_compositor_frame_message),
-      output_surface_filter_(RenderThreadImpl::current()
-                                 ->compositor_message_filter()),
+      output_surface_filter_(
+          RenderThreadImpl::current()->compositor_message_filter()),
       frame_swap_message_queue_(swap_frame_message_queue),
       routing_id_(routing_id),
       layout_test_mode_(RenderThreadImpl::current()->layout_test_mode()),
diff --git a/content/renderer/gpu/compositor_output_surface.h b/content/renderer/gpu/compositor_output_surface.h
index f407312..97a14c0 100644
--- a/content/renderer/gpu/compositor_output_surface.h
+++ b/content/renderer/gpu/compositor_output_surface.h
@@ -47,6 +47,9 @@
       const scoped_refptr<ContextProviderCommandBuffer>& context_provider,
       const scoped_refptr<ContextProviderCommandBuffer>&
           worker_context_provider,
+#if defined(ENABLE_VULKAN)
+      const scoped_refptr<cc::VulkanContextProvider>& vulkan_context_provider,
+#endif
       scoped_ptr<cc::SoftwareOutputDevice> software,
       scoped_refptr<FrameSwapMessageQueue> swap_frame_message_queue,
       bool use_swap_compositor_frame_message);
diff --git a/content/renderer/gpu/delegated_compositor_output_surface.cc b/content/renderer/gpu/delegated_compositor_output_surface.cc
index 9e8ad78a..aff1ba5 100644
--- a/content/renderer/gpu/delegated_compositor_output_surface.cc
+++ b/content/renderer/gpu/delegated_compositor_output_surface.cc
@@ -12,11 +12,17 @@
     uint32_t output_surface_id,
     const scoped_refptr<ContextProviderCommandBuffer>& context_provider,
     const scoped_refptr<ContextProviderCommandBuffer>& worker_context_provider,
+#if defined(ENABLE_VULKAN)
+    const scoped_refptr<cc::VulkanContextProvider>& vulkan_context_provider,
+#endif
     scoped_refptr<FrameSwapMessageQueue> swap_frame_message_queue)
     : CompositorOutputSurface(routing_id,
                               output_surface_id,
                               context_provider,
                               worker_context_provider,
+#if defined(ENABLE_VULKAN)
+                              vulkan_context_provider,
+#endif
                               scoped_ptr<cc::SoftwareOutputDevice>(),
                               swap_frame_message_queue,
                               true) {
diff --git a/content/renderer/gpu/delegated_compositor_output_surface.h b/content/renderer/gpu/delegated_compositor_output_surface.h
index f98d60a..cfa3961c 100644
--- a/content/renderer/gpu/delegated_compositor_output_surface.h
+++ b/content/renderer/gpu/delegated_compositor_output_surface.h
@@ -21,6 +21,9 @@
       const scoped_refptr<ContextProviderCommandBuffer>& context_provider,
       const scoped_refptr<ContextProviderCommandBuffer>&
           worker_context_provider,
+#if defined(ENABLE_VULKAN)
+      const scoped_refptr<cc::VulkanContextProvider>& vulkan_context_provider,
+#endif
       scoped_refptr<FrameSwapMessageQueue> swap_frame_message_queue);
   ~DelegatedCompositorOutputSurface() override {}
 };
diff --git a/content/renderer/gpu/mailbox_output_surface.cc b/content/renderer/gpu/mailbox_output_surface.cc
index 0b715987..8ef6f29 100644
--- a/content/renderer/gpu/mailbox_output_surface.cc
+++ b/content/renderer/gpu/mailbox_output_surface.cc
@@ -33,6 +33,9 @@
                               output_surface_id,
                               context_provider,
                               worker_context_provider,
+#if defined(ENABLE_VULKAN)
+                              nullptr,
+#endif
                               nullptr,
                               swap_frame_message_queue,
                               true),
diff --git a/content/renderer/media/media_stream_constraints_util.cc b/content/renderer/media/media_stream_constraints_util.cc
index 1884f75..d313f3b9 100644
--- a/content/renderer/media/media_stream_constraints_util.cc
+++ b/content/renderer/media/media_stream_constraints_util.cc
@@ -107,11 +107,18 @@
   return ScanConstraintsForExactValue(constraints, picker, value);
 }
 
+bool GetConstraintMinAsDouble(
+    const blink::WebMediaConstraints& constraints,
+    const blink::DoubleConstraint blink::WebMediaTrackConstraintSet::*picker,
+    double* value) {
+  return ScanConstraintsForMinValue(constraints, picker, value);
+}
+
 bool GetConstraintMaxAsDouble(
     const blink::WebMediaConstraints& constraints,
     const blink::DoubleConstraint blink::WebMediaTrackConstraintSet::*picker,
     double* value) {
-  return ScanConstraintsForExactValue(constraints, picker, value);
+  return ScanConstraintsForMaxValue(constraints, picker, value);
 }
 
 bool GetConstraintValueAsString(
diff --git a/content/renderer/media/media_stream_constraints_util.h b/content/renderer/media/media_stream_constraints_util.h
index bd2d818..7b24be2 100644
--- a/content/renderer/media/media_stream_constraints_util.h
+++ b/content/renderer/media/media_stream_constraints_util.h
@@ -47,6 +47,11 @@
     const blink::DoubleConstraint blink::WebMediaTrackConstraintSet::*picker,
     double* value);
 
+bool CONTENT_EXPORT GetConstraintMinAsDouble(
+    const blink::WebMediaConstraints& constraints,
+    const blink::DoubleConstraint blink::WebMediaTrackConstraintSet::*picker,
+    double* value);
+
 bool CONTENT_EXPORT GetConstraintMaxAsDouble(
     const blink::WebMediaConstraints& constraints,
     const blink::DoubleConstraint blink::WebMediaTrackConstraintSet::*picker,
diff --git a/content/renderer/media/media_stream_video_capturer_source.cc b/content/renderer/media/media_stream_video_capturer_source.cc
index 405e26a..b4805c73 100644
--- a/content/renderer/media/media_stream_video_capturer_source.cc
+++ b/content/renderer/media/media_stream_video_capturer_source.cc
@@ -210,6 +210,7 @@
   void StartCapture(const media::VideoCaptureParams& params,
                     const VideoCaptureDeliverFrameCB& new_frame_callback,
                     const RunningCallback& running_callback) override;
+  void RequestRefreshFrame() override;
   void StopCapture() override;
 
  private:
@@ -309,6 +310,15 @@
       new_frame_callback);
 }
 
+void LocalVideoCapturerSource::RequestRefreshFrame() {
+  DVLOG(3) << __FUNCTION__;
+  DCHECK(thread_checker_.CalledOnValidThread());
+  if (stop_capture_cb_.is_null())
+    return;  // Do not request frames if the source is stopped.
+  manager_->RequestRefreshFrame(session_id_);
+}
+
+
 void LocalVideoCapturerSource::StopCapture() {
   DVLOG(3) << __FUNCTION__;
   DCHECK(thread_checker_.CalledOnValidThread());
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 fe24e66..d631ced6 100644
--- a/content/renderer/media/media_stream_video_capturer_source_unittest.cc
+++ b/content/renderer/media/media_stream_video_capturer_source_unittest.cc
@@ -335,6 +335,17 @@
         metadata_(metadata),
         got_frame_cb_(got_frame_cb) {}
 
+  void ConnectToTrack(const blink::WebMediaStreamTrack& track) {
+    MediaStreamVideoSink::ConnectToTrack(
+        track,
+        base::Bind(&FakeMediaStreamVideoSink::OnVideoFrame,
+                   base::Unretained(this)));
+  }
+
+  void DisconnectFromTrack() {
+    MediaStreamVideoSink::DisconnectFromTrack();
+  }
+
   void OnVideoFrame(const scoped_refptr<media::VideoFrame>& frame,
                     base::TimeTicks capture_time) {
     *capture_time_ = capture_time;
@@ -377,17 +388,14 @@
   FakeMediaStreamVideoSink fake_sink(
       &capture_time, &metadata,
       media::BindToCurrentLoop(run_loop.QuitClosure()));
-  FakeMediaStreamVideoSink::AddToVideoTrack(
-      &fake_sink, base::Bind(&FakeMediaStreamVideoSink::OnVideoFrame,
-                             base::Unretained(&fake_sink)),
-      track);
+  fake_sink.ConnectToTrack(track);
   const scoped_refptr<media::VideoFrame> frame =
       media::VideoFrame::CreateBlackFrame(gfx::Size(2, 2));
   frame->metadata()->SetDouble(media::VideoFrameMetadata::FRAME_RATE, 30.0);
   child_process_->io_task_runner()->PostTask(
       FROM_HERE, base::Bind(deliver_frame_cb, frame, reference_capture_time));
   run_loop.Run();
-  FakeMediaStreamVideoSink::RemoveFromVideoTrack(&fake_sink, track);
+  fake_sink.DisconnectFromTrack();
   EXPECT_EQ(reference_capture_time, capture_time);
   double metadata_value;
   EXPECT_TRUE(metadata.GetDouble(media::VideoFrameMetadata::FRAME_RATE,
diff --git a/content/renderer/media/media_stream_video_renderer_sink.cc b/content/renderer/media/media_stream_video_renderer_sink.cc
index beaff40..8e9eccd 100644
--- a/content/renderer/media/media_stream_video_renderer_sink.cc
+++ b/content/renderer/media/media_stream_video_renderer_sink.cc
@@ -50,13 +50,11 @@
   DCHECK(task_runner_->BelongsToCurrentThread());
   DCHECK_EQ(state_, STOPPED);
 
-  AddToVideoTrack(
-      this,
+  MediaStreamVideoSink::ConnectToTrack(video_track_,
       media::BindToCurrentLoop(
           base::Bind(
               &MediaStreamVideoRendererSink::OnVideoFrame,
-              weak_factory_.GetWeakPtr())),
-      video_track_);
+              weak_factory_.GetWeakPtr())));
   state_ = STARTED;
 
   if (video_track_.source().getReadyState() ==
@@ -69,7 +67,7 @@
 void MediaStreamVideoRendererSink::Stop() {
   DCHECK(task_runner_->BelongsToCurrentThread());
   DCHECK(state_ == STARTED || state_ == PAUSED);
-  RemoveFromVideoTrack(this, video_track_);
+  MediaStreamVideoSink::DisconnectFromTrack();
   weak_factory_.InvalidateWeakPtrs();
   state_ = STOPPED;
   frame_size_.set_width(kMinFrameSize);
diff --git a/content/renderer/media/media_stream_video_renderer_sink.h b/content/renderer/media/media_stream_video_renderer_sink.h
index ad3c9eb..ac332969 100644
--- a/content/renderer/media/media_stream_video_renderer_sink.h
+++ b/content/renderer/media/media_stream_video_renderer_sink.h
@@ -30,9 +30,9 @@
 // MediaStreamVideoRendererSink is a VideoFrameProvider designed for rendering
 // Video MediaStreamTracks [1], MediaStreamVideoRendererSink implements
 // MediaStreamVideoSink in order to render video frames provided from a
-// MediaStreamVideoTrack, to which it AddToVideoTrack()s itself when the
-// VideoFrameProvider is Start()ed and RemoveFromVideoTrack()s itself when the
-// latter is Stop()ed.
+// MediaStreamVideoTrack, to which it connects itself when the
+// VideoFrameProvider is Start()ed, and disconnects itself when the latter is
+// Stop()ed.
 //
 // [1] http://dev.w3.org/2011/webrtc/editor/getusermedia.html#mediastreamtrack
 //
diff --git a/content/renderer/media/media_stream_video_source.cc b/content/renderer/media/media_stream_video_source.cc
index 9e4eeb9..c40638c 100644
--- a/content/renderer/media/media_stream_video_source.cc
+++ b/content/renderer/media/media_stream_video_source.cc
@@ -298,6 +298,10 @@
 // static
 MediaStreamVideoSource* MediaStreamVideoSource::GetVideoSource(
     const blink::WebMediaStreamSource& source) {
+  if (source.isNull() ||
+      source.getType() != blink::WebMediaStreamSource::TypeVideo) {
+    return nullptr;
+  }
   return static_cast<MediaStreamVideoSource*>(source.getExtraData());
 }
 
diff --git a/content/renderer/media/media_stream_video_source_unittest.cc b/content/renderer/media/media_stream_video_source_unittest.cc
index a8d5c98e..d767f81 100644
--- a/content/renderer/media/media_stream_video_source_unittest.cc
+++ b/content/renderer/media/media_stream_video_source_unittest.cc
@@ -122,15 +122,14 @@
                                   30);
 
     MockMediaStreamVideoSink sink;
-    MediaStreamVideoSink::AddToVideoTrack(
-        &sink, sink.GetDeliverFrameCB(), track);
+    sink.ConnectToTrack(track);
     DeliverVideoFrameAndWaitForRenderer(capture_width, capture_height, &sink);
     EXPECT_EQ(1, sink.number_of_frames());
 
     // Expect the delivered frame to be cropped.
     EXPECT_EQ(expected_height, sink.frame_size().height());
     EXPECT_EQ(expected_width, sink.frame_size().width());
-    MediaStreamVideoSink::RemoveFromVideoTrack(&sink, track);
+    sink.DisconnectFromTrack();
   }
 
   void DeliverVideoFrameAndWaitForRenderer(int width, int height,
@@ -177,13 +176,11 @@
     blink::WebMediaStreamTrack track2 = CreateTrack("dummy", constraints2);
 
     MockMediaStreamVideoSink sink1;
-    MediaStreamVideoSink::AddToVideoTrack(&sink1, sink1.GetDeliverFrameCB(),
-                                          track1);
+    sink1.ConnectToTrack(track1);
     EXPECT_EQ(0, sink1.number_of_frames());
 
     MockMediaStreamVideoSink sink2;
-    MediaStreamVideoSink::AddToVideoTrack(&sink2, sink2.GetDeliverFrameCB(),
-                                          track2);
+    sink2.ConnectToTrack(track2);
     EXPECT_EQ(0, sink2.number_of_frames());
 
     DeliverVideoFrameAndWaitForTwoRenderers(capture_width,
@@ -199,8 +196,8 @@
     EXPECT_EQ(expected_width2, sink2.frame_size().width());
     EXPECT_EQ(expected_height2, sink2.frame_size().height());
 
-    MediaStreamVideoSink::RemoveFromVideoTrack(&sink1, track1);
-    MediaStreamVideoSink::RemoveFromVideoTrack(&sink2, track2);
+    sink1.DisconnectFromTrack();
+    sink2.DisconnectFromTrack();
   }
 
   void SetSourceSupportedFormats(const media::VideoCaptureFormats& formats) {
@@ -658,8 +655,7 @@
                                 640, 480, 30);
 
   MockMediaStreamVideoSink sink;
-  MediaStreamVideoSink::AddToVideoTrack(
-      &sink, sink.GetDeliverFrameCB(), track);
+  sink.ConnectToTrack(track);
   EXPECT_EQ(0, sink.number_of_frames());
   DeliverVideoFrameAndWaitForRenderer(320, 240, &sink);
   EXPECT_EQ(1, sink.number_of_frames());
@@ -682,7 +678,7 @@
   EXPECT_EQ(800, sink.frame_size().width());
   EXPECT_EQ(700, sink.frame_size().height());
 
-  MediaStreamVideoSink::RemoveFromVideoTrack(&sink, track);
+  sink.DisconnectFromTrack();
 }
 
 TEST_F(MediaStreamVideoSourceTest, IsConstraintSupported) {
@@ -724,8 +720,7 @@
   EXPECT_EQ(1, NumberOfSuccessConstraintsCallbacks());
 
   MockMediaStreamVideoSink sink;
-  MediaStreamVideoSink::AddToVideoTrack(
-      &sink, sink.GetDeliverFrameCB(), track);
+  sink.ConnectToTrack(track);
   EXPECT_EQ(0, sink.number_of_frames());
   DeliverVideoFrameAndWaitForRenderer(320, 240, &sink);
   EXPECT_EQ(1, sink.number_of_frames());
@@ -733,7 +728,7 @@
   // max requested.
   EXPECT_EQ(320, sink.frame_size().width());
   EXPECT_EQ(240, sink.frame_size().height());
-  MediaStreamVideoSink::RemoveFromVideoTrack(&sink, track);
+  sink.DisconnectFromTrack();
 }
 
 // Test that a source producing no frames change the source ReadyState to muted.
@@ -754,7 +749,7 @@
       CreateTrackAndStartSource(factory.CreateWebMediaConstraints(), 640, 480,
                                 media::limits::kMaxFramesPerSecond - 1);
   MockMediaStreamVideoSink sink;
-  MediaStreamVideoSink::AddToVideoTrack(&sink, sink.GetDeliverFrameCB(), track);
+  sink.ConnectToTrack(track);
   EXPECT_EQ(track.source().getReadyState(),
             blink::WebMediaStreamSource::ReadyStateLive);
 
@@ -780,7 +775,7 @@
   EXPECT_EQ(track.source().getReadyState(),
             blink::WebMediaStreamSource::ReadyStateLive);
 
-  MediaStreamVideoSink::RemoveFromVideoTrack(&sink, track);
+  sink.DisconnectFromTrack();
 }
 
 }  // namespace content
diff --git a/content/renderer/media/media_stream_video_track.cc b/content/renderer/media/media_stream_video_track.cc
index 00e75fab..b85a5b8 100644
--- a/content/renderer/media/media_stream_video_track.cc
+++ b/content/renderer/media/media_stream_video_track.cc
@@ -212,6 +212,10 @@
 // static
 MediaStreamVideoTrack* MediaStreamVideoTrack::GetVideoTrack(
      const blink::WebMediaStreamTrack& track) {
+  if (track.isNull() ||
+      track.source().getType() != blink::WebMediaStreamSource::TypeVideo) {
+    return nullptr;
+  }
   return static_cast<MediaStreamVideoTrack*>(track.getExtraData());
 }
 
diff --git a/content/renderer/media/media_stream_video_track.h b/content/renderer/media/media_stream_video_track.h
index c6550926..9769d3bb7 100644
--- a/content/renderer/media/media_stream_video_track.h
+++ b/content/renderer/media/media_stream_video_track.h
@@ -49,8 +49,8 @@
       bool enabled);
   ~MediaStreamVideoTrack() override;
 
+  // MediaStreamTrack overrides.
   void SetEnabled(bool enabled) override;
-
   void Stop() override;
 
   void OnReadyStateChanged(blink::WebMediaStreamSource::ReadyState state);
diff --git a/content/renderer/media/media_stream_video_track_unittest.cc b/content/renderer/media/media_stream_video_track_unittest.cc
index 1b5071b..3d24352e 100644
--- a/content/renderer/media/media_stream_video_track_unittest.cc
+++ b/content/renderer/media/media_stream_video_track_unittest.cc
@@ -109,14 +109,14 @@
 TEST_F(MediaStreamVideoTrackTest, AddAndRemoveSink) {
   MockMediaStreamVideoSink sink;
   blink::WebMediaStreamTrack track = CreateTrack();
-  MediaStreamVideoSink::AddToVideoTrack(&sink, sink.GetDeliverFrameCB(), track);
+  sink.ConnectToTrack(track);
 
   DeliverVideoFrameAndWaitForRenderer(&sink);
   EXPECT_EQ(1, sink.number_of_frames());
 
   DeliverVideoFrameAndWaitForRenderer(&sink);
 
-  MediaStreamVideoSink::RemoveFromVideoTrack(&sink, track);
+  sink.DisconnectFromTrack();
 
   scoped_refptr<media::VideoFrame> frame =
       media::VideoFrame::CreateBlackFrame(
@@ -160,13 +160,12 @@
 
   base::RunLoop run_loop;
   bool correct = false;
-  MediaStreamVideoSink::AddToVideoTrack(
-      &sink,
-      base::Bind(
-          &CheckThreadVideoFrameReceiver,
-          base::Owned(new CheckThreadHelper(run_loop.QuitClosure(), &correct))),
-      track);
-  MediaStreamVideoSink::RemoveFromVideoTrack(&sink, track);
+  sink.ConnectToTrackWithCallback(
+      track,
+      base::Bind(&CheckThreadVideoFrameReceiver,
+                 base::Owned(new CheckThreadHelper(run_loop.QuitClosure(),
+                                                   &correct))));
+  sink.DisconnectFromTrack();
   run_loop.Run();
   EXPECT_TRUE(correct) << "Not called on correct thread.";
 }
@@ -174,7 +173,7 @@
 TEST_F(MediaStreamVideoTrackTest, SetEnabled) {
   MockMediaStreamVideoSink sink;
   blink::WebMediaStreamTrack track = CreateTrack();
-  MediaStreamVideoSink::AddToVideoTrack(&sink, sink.GetDeliverFrameCB(), track);
+  sink.ConnectToTrack(track);
 
   MediaStreamVideoTrack* video_track =
       MediaStreamVideoTrack::GetVideoTrack(track);
@@ -195,25 +194,24 @@
   DeliverVideoFrameAndWaitForRenderer(&sink);
   EXPECT_EQ(3, sink.number_of_frames());
   EXPECT_EQ(kColorValue, *sink.last_frame()->data(media::VideoFrame::kYPlane));
-  MediaStreamVideoSink::RemoveFromVideoTrack(&sink, track);
+  sink.DisconnectFromTrack();
 }
 
 TEST_F(MediaStreamVideoTrackTest, SourceStopped) {
   MockMediaStreamVideoSink sink;
   blink::WebMediaStreamTrack track = CreateTrack();
-  MediaStreamVideoSink::AddToVideoTrack(&sink, sink.GetDeliverFrameCB(), track);
+  sink.ConnectToTrack(track);
   EXPECT_EQ(blink::WebMediaStreamSource::ReadyStateLive, sink.state());
 
   mock_source()->StopSource();
   EXPECT_EQ(blink::WebMediaStreamSource::ReadyStateEnded, sink.state());
-  MediaStreamVideoSink::RemoveFromVideoTrack(&sink, track);
+  sink.DisconnectFromTrack();
 }
 
 TEST_F(MediaStreamVideoTrackTest, StopLastTrack) {
   MockMediaStreamVideoSink sink1;
   blink::WebMediaStreamTrack track1 = CreateTrack();
-  MediaStreamVideoSink::AddToVideoTrack(
-      &sink1, sink1.GetDeliverFrameCB(), track1);
+  sink1.ConnectToTrack(track1);
   EXPECT_EQ(blink::WebMediaStreamSource::ReadyStateLive, sink1.state());
 
   EXPECT_EQ(blink::WebMediaStreamSource::ReadyStateLive,
@@ -221,8 +219,7 @@
 
   MockMediaStreamVideoSink sink2;
   blink::WebMediaStreamTrack track2 = CreateTrack();
-  MediaStreamVideoSink::AddToVideoTrack(
-      &sink2, sink2.GetDeliverFrameCB(), track2);
+  sink2.ConnectToTrack(track2);
   EXPECT_EQ(blink::WebMediaStreamSource::ReadyStateLive, sink2.state());
 
   MediaStreamVideoTrack* const native_track1 =
@@ -231,7 +228,7 @@
   EXPECT_EQ(blink::WebMediaStreamSource::ReadyStateEnded, sink1.state());
   EXPECT_EQ(blink::WebMediaStreamSource::ReadyStateLive,
             blink_source().getReadyState());
-  MediaStreamVideoSink::RemoveFromVideoTrack(&sink1, track1);
+  sink1.DisconnectFromTrack();
 
   MediaStreamVideoTrack* const native_track2 =
         MediaStreamVideoTrack::GetVideoTrack(track2);
@@ -239,7 +236,7 @@
   EXPECT_EQ(blink::WebMediaStreamSource::ReadyStateEnded, sink2.state());
   EXPECT_EQ(blink::WebMediaStreamSource::ReadyStateEnded,
             blink_source().getReadyState());
-  MediaStreamVideoSink::RemoveFromVideoTrack(&sink2, track2);
+  sink2.DisconnectFromTrack();
 }
 
 TEST_F(MediaStreamVideoTrackTest, CheckTrackRequestsFrame) {
@@ -251,11 +248,11 @@
   base::RunLoop run_loop;
   base::Closure quit_closure = run_loop.QuitClosure();
   EXPECT_CALL(sink, OnVideoFrame()).WillOnce(RunClosure(quit_closure));
-  MediaStreamVideoSink::AddToVideoTrack(&sink, sink.GetDeliverFrameCB(), track);
+  sink.ConnectToTrack(track);
   run_loop.Run();
   EXPECT_EQ(1, sink.number_of_frames());
 
-  MediaStreamVideoSink::RemoveFromVideoTrack(&sink, track);
+  sink.DisconnectFromTrack();
 }
 
 }  // namespace content
diff --git a/content/renderer/media/mock_media_stream_video_sink.h b/content/renderer/media/mock_media_stream_video_sink.h
index 91270190..b637b891 100644
--- a/content/renderer/media/mock_media_stream_video_sink.h
+++ b/content/renderer/media/mock_media_stream_video_sink.h
@@ -19,6 +19,19 @@
   MockMediaStreamVideoSink();
   ~MockMediaStreamVideoSink() override;
 
+  void ConnectToTrack(const blink::WebMediaStreamTrack& track) {
+    MediaStreamVideoSink::ConnectToTrack(track, GetDeliverFrameCB());
+  }
+
+  void ConnectToTrackWithCallback(const blink::WebMediaStreamTrack& track,
+                                  const VideoCaptureDeliverFrameCB& callback) {
+    MediaStreamVideoSink::ConnectToTrack(track, callback);
+  }
+
+  void DisconnectFromTrack() {
+    MediaStreamVideoSink::DisconnectFromTrack();
+  }
+
   void OnReadyStateChanged(
       blink::WebMediaStreamSource::ReadyState state) override;
   void OnEnabledChanged(bool enabled) override;
diff --git a/content/renderer/media/rtc_video_decoder.cc b/content/renderer/media/rtc_video_decoder.cc
index 472867a..ed9eb25 100644
--- a/content/renderer/media/rtc_video_decoder.cc
+++ b/content/renderer/media/rtc_video_decoder.cc
@@ -28,7 +28,7 @@
 const int32_t RTCVideoDecoder::ID_LAST = 0x3FFFFFFF;
 const int32_t RTCVideoDecoder::ID_HALF = 0x20000000;
 const int32_t RTCVideoDecoder::ID_INVALID = -1;
-const uint32_t kNumVDAResetsBeforeSWFallback = 5;
+const uint32_t kNumVDAErrorsBeforeSWFallback = 50;
 
 // Maximum number of concurrent VDA::Decode() operations RVD will maintain.
 // Higher values allow better pipelining in the GPU, but also require more
@@ -56,7 +56,7 @@
 
 RTCVideoDecoder::RTCVideoDecoder(webrtc::VideoCodecType type,
                                  media::GpuVideoAcceleratorFactories* factories)
-    : num_vda_errors_(0),
+    : vda_error_counter_(0),
       video_codec_type_(type),
       factories_(factories),
       decoder_texture_target_(0),
@@ -162,9 +162,9 @@
 
   if (state_ == DECODE_ERROR) {
     LOG(ERROR) << "Decoding error occurred.";
-    // Try reseting the session |kNumVDAErrorsHandled| times.
-    if (num_vda_errors_ > kNumVDAResetsBeforeSWFallback) {
-      DLOG(ERROR) << num_vda_errors_
+    // Try reseting the session up to |kNumVDAErrorsHandled| times.
+    if (vda_error_counter_ > kNumVDAErrorsBeforeSWFallback) {
+      DLOG(ERROR) << vda_error_counter_
                   << " errors reported by VDA, falling back to software decode";
       return WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE;
     }
@@ -248,6 +248,7 @@
       Release();
     }
 
+    TryResetVDAErrorCounter_Locked();
     return WEBRTC_VIDEO_CODEC_OK;
   }
 
@@ -256,6 +257,7 @@
       FROM_HERE,
       base::Bind(&RTCVideoDecoder::RequestBufferDecode,
                  weak_factory_.GetWeakPtr()));
+  TryResetVDAErrorCounter_Locked();
   return WEBRTC_VIDEO_CODEC_OK;
 }
 
@@ -492,7 +494,7 @@
 
   base::AutoLock auto_lock(lock_);
   state_ = DECODE_ERROR;
-  ++num_vda_errors_;
+  ++vda_error_counter_;
 }
 
 void RTCVideoDecoder::RequestBufferDecode() {
@@ -845,4 +847,12 @@
   pending_buffers_.clear();
 }
 
+void RTCVideoDecoder::TryResetVDAErrorCounter_Locked() {
+  lock_.AssertAcquired();
+
+  if (vda_error_counter_ == 0)
+    return;
+  vda_error_counter_ = 0;
+}
+
 }  // namespace content
diff --git a/content/renderer/media/rtc_video_decoder.h b/content/renderer/media/rtc_video_decoder.h
index d1ea581..6b86d25 100644
--- a/content/renderer/media/rtc_video_decoder.h
+++ b/content/renderer/media/rtc_video_decoder.h
@@ -109,6 +109,7 @@
 
   FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, IsBufferAfterReset);
   FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, IsFirstBufferAfterReset);
+  FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, GetVDAErrorCounterForTesting);
 
   RTCVideoDecoder(webrtc::VideoCodecType type,
                   media::GpuVideoAcceleratorFactories* factories);
@@ -126,6 +127,8 @@
   // |id_reset|.
   bool IsFirstBufferAfterReset(int32_t id_buffer, int32_t id_reset);
 
+  int GetVDAErrorCounterForTesting() { return vda_error_counter_; }
+
   // Saves a WebRTC buffer in |decode_buffers_| for decode.
   void SaveToDecodeBuffers_Locked(const webrtc::EncodedImage& input_image,
                                   scoped_ptr<base::SharedMemory> shm_buffer,
@@ -157,7 +160,7 @@
   // Tells VDA that a picture buffer can be recycled.
   void ReusePictureBuffer(int64_t picture_buffer_id);
 
-  // Create |vda_| on |vda_loop_proxy_|.
+  // Creates |vda_| on |vda_loop_proxy_|.
   void CreateVDA(media::VideoCodecProfile profile, base::WaitableEvent* waiter);
 
   void DestroyTextures();
@@ -184,17 +187,20 @@
   // Records the result of InitDecode to UMA and returns |status|.
   int32_t RecordInitDecodeUMA(int32_t status);
 
-  // Assert the contract that this class is operated on the right thread.
+  // Asserts the contract that this class is operated on the right thread.
   void DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() const;
 
-  // Query factories_ whether |profile| is supported and return true is so,
+  // Queries factories_ whether |profile| is supported and return true is so,
   // false otherwise. If true, also set resolution limits for |profile|
   // in min/max_resolution_.
   bool IsProfileSupported(media::VideoCodecProfile profile);
 
-  // Clear the pending_buffers_ queue, freeing memory.
+  // Clears the pending_buffers_ queue, freeing memory.
   void ClearPendingBuffers();
 
+  // Resets |vda_error_counter_| after a successfull run of decode.
+  void TryResetVDAErrorCounter_Locked();
+
   enum State {
     UNINITIALIZED,  // The decoder has not initialized.
     INITIALIZED,    // The decoder has initialized.
@@ -212,7 +218,7 @@
   media::VideoCodecProfile vda_codec_profile_;
 
   // Number of times that |vda_| notified of an error.
-  uint32_t num_vda_errors_;
+  uint32_t vda_error_counter_;
 
   // The video codec type, as reported by WebRTC.
   const webrtc::VideoCodecType video_codec_type_;
@@ -247,7 +253,8 @@
 
   // Protects |state_|, |decode_complete_callback_| , |num_shm_buffers_|,
   // |available_shm_segments_|, |pending_buffers_|, |decode_buffers_|,
-  // |next_bitstream_buffer_id_| and |reset_bitstream_buffer_id_|.
+  // |next_bitstream_buffer_id_|, |reset_bitstream_buffer_id_| and
+  // |vda_error_counter_|.
   base::Lock lock_;
 
   // The state of RTCVideoDecoder. Guarded by |lock_|.
diff --git a/content/renderer/media/rtc_video_decoder_unittest.cc b/content/renderer/media/rtc_video_decoder_unittest.cc
index 5c5d80e..0c2523747 100644
--- a/content/renderer/media/rtc_video_decoder_unittest.cc
+++ b/content/renderer/media/rtc_video_decoder_unittest.cc
@@ -272,7 +272,7 @@
 }
 
 
-TEST_P(RTCVideoDecoderTest, DecodeResetsAfterError) {
+TEST_P(RTCVideoDecoderTest, GetVDAErrorCounterForTesting) {
   const webrtc::VideoCodecType codec_type = GetParam();
   CreateDecoder(codec_type);
   Initialize();
@@ -289,11 +289,24 @@
   // Notify the decoder about a platform error.
   NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE);
   RunUntilIdle();
+  EXPECT_EQ(1, rtc_decoder_->GetVDAErrorCounterForTesting());
 
   // Expect decode call to reset decoder, and set up a new VDA to track it.
   SetUpResetVDA();
   EXPECT_EQ(WEBRTC_VIDEO_CODEC_ERROR,
             rtc_decoder_->Decode(input_image, false, nullptr, nullptr, 0));
+  EXPECT_EQ(1, rtc_decoder_->GetVDAErrorCounterForTesting());
+
+  // Decoder expects a keyframe after reset, so drops any other frames.
+  EXPECT_EQ(WEBRTC_VIDEO_CODEC_ERROR,
+            rtc_decoder_->Decode(input_image, false, nullptr, nullptr, 0));
+  EXPECT_EQ(1, rtc_decoder_->GetVDAErrorCounterForTesting());
+
+  // Decoder resets error counter after a successfull decode.
+  input_image._frameType = webrtc::kVideoFrameKey;
+  EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
+            rtc_decoder_->Decode(input_image, false, nullptr, nullptr, 10));
+  EXPECT_EQ(0, rtc_decoder_->GetVDAErrorCounterForTesting());
 }
 
 INSTANTIATE_TEST_CASE_P(CodecProfiles,
diff --git a/content/renderer/media/video_capture_impl.cc b/content/renderer/media/video_capture_impl.cc
index 2f5a6ac6..5f1cc11 100644
--- a/content/renderer/media/video_capture_impl.cc
+++ b/content/renderer/media/video_capture_impl.cc
@@ -217,6 +217,11 @@
   }
 }
 
+void VideoCaptureImpl::RequestRefreshFrame() {
+  DCHECK(io_task_runner_->BelongsToCurrentThread());
+  Send(new VideoCaptureHostMsg_RequestRefreshFrame(device_id_));
+}
+
 void VideoCaptureImpl::GetDeviceSupportedFormats(
     const VideoCaptureDeviceFormatsCB& callback) {
   DCHECK(io_task_runner_->BelongsToCurrentThread());
diff --git a/content/renderer/media/video_capture_impl.h b/content/renderer/media/video_capture_impl.h
index c320775..0699051 100644
--- a/content/renderer/media/video_capture_impl.h
+++ b/content/renderer/media/video_capture_impl.h
@@ -73,6 +73,10 @@
   // Stop capturing. |client_id| is the identifier used to call StartCapture.
   void StopCapture(int client_id);
 
+  // Requests that the video capturer send a frame "soon" (e.g., to resolve
+  // picture loss or quality issues).
+  void RequestRefreshFrame();
+
   // Get capturing formats supported by this device.
   // |callback| will be invoked with the results.
   void GetDeviceSupportedFormats(const VideoCaptureDeviceFormatsCB& callback);
diff --git a/content/renderer/media/video_capture_impl_manager.cc b/content/renderer/media/video_capture_impl_manager.cc
index 1ce78d6..478a169 100644
--- a/content/renderer/media/video_capture_impl_manager.cc
+++ b/content/renderer/media/video_capture_impl_manager.cc
@@ -96,6 +96,19 @@
                     weak_factory_.GetWeakPtr(), client_id, id);
 }
 
+void VideoCaptureImplManager::RequestRefreshFrame(
+    media::VideoCaptureSessionId id) {
+  DCHECK(render_main_task_runner_->BelongsToCurrentThread());
+  const VideoCaptureDeviceMap::const_iterator it = devices_.find(id);
+  DCHECK(it != devices_.end());
+  VideoCaptureImpl* const impl = it->second.second;
+  ChildProcess::current()->io_task_runner()->PostTask(
+      FROM_HERE,
+      base::Bind(&VideoCaptureImpl::RequestRefreshFrame,
+                 base::Unretained(impl)));
+}
+
+
 void VideoCaptureImplManager::GetDeviceSupportedFormats(
     media::VideoCaptureSessionId id,
     const VideoCaptureDeviceFormatsCB& callback) {
diff --git a/content/renderer/media/video_capture_impl_manager.h b/content/renderer/media/video_capture_impl_manager.h
index ef1a168..c6f9b90b 100644
--- a/content/renderer/media/video_capture_impl_manager.h
+++ b/content/renderer/media/video_capture_impl_manager.h
@@ -73,6 +73,10 @@
       const VideoCaptureStateUpdateCB& state_update_cb,
       const VideoCaptureDeliverFrameCB& deliver_frame_cb);
 
+  // Requests that the video capturer send a frame "soon" (e.g., to resolve
+  // picture loss or quality issues).
+  void RequestRefreshFrame(media::VideoCaptureSessionId id);
+
   // Get supported formats supported by the device for the given session
   // ID. |callback| will be called on the IO thread.
   void GetDeviceSupportedFormats(media::VideoCaptureSessionId id,
diff --git a/content/renderer/media/video_track_recorder.cc b/content/renderer/media/video_track_recorder.cc
index af389f80..59ee58c 100644
--- a/content/renderer/media/video_track_recorder.cc
+++ b/content/renderer/media/video_track_recorder.cc
@@ -394,15 +394,14 @@
   DCHECK(track_.getExtraData());
 
   // StartFrameEncode() will be called on Render IO thread.
-  AddToVideoTrack(this,
-                  base::Bind(&VideoTrackRecorder::VpxEncoder::StartFrameEncode,
-                             encoder_),
-                  track_);
+  MediaStreamVideoSink::ConnectToTrack(
+      track_,
+      base::Bind(&VideoTrackRecorder::VpxEncoder::StartFrameEncode, encoder_));
 }
 
 VideoTrackRecorder::~VideoTrackRecorder() {
   DCHECK(main_render_thread_checker_.CalledOnValidThread());
-  RemoveFromVideoTrack(this, track_);
+  MediaStreamVideoSink::DisconnectFromTrack();
   track_.reset();
 }
 
diff --git a/content/renderer/media/video_track_to_pepper_adapter.cc b/content/renderer/media/video_track_to_pepper_adapter.cc
index c59155f..1b0a243 100644
--- a/content/renderer/media/video_track_to_pepper_adapter.cc
+++ b/content/renderer/media/video_track_to_pepper_adapter.cc
@@ -40,13 +40,13 @@
     DCHECK((reader_ && !reader) || (!reader_ && reader))
         << " |reader| = " << reader << ", |reader_| = " << reader_;
     if (reader) {
-      AddToVideoTrack(this,
-                      media::BindToCurrentLoop(
-                          base::Bind(&PpFrameReceiver::OnVideoFrame,
-                                     weak_factory_.GetWeakPtr())),
-                      track_);
+      MediaStreamVideoSink::ConnectToTrack(
+          track_,
+          media::BindToCurrentLoop(
+              base::Bind(&PpFrameReceiver::OnVideoFrame,
+                         weak_factory_.GetWeakPtr())));
     } else {
-      RemoveFromVideoTrack(this, track_);
+      MediaStreamVideoSink::DisconnectFromTrack();
       weak_factory_.InvalidateWeakPtrs();
     }
     reader_ = reader;
diff --git a/content/renderer/media/webrtc/media_stream_video_webrtc_sink.cc b/content/renderer/media/webrtc/media_stream_video_webrtc_sink.cc
index c767c41d..2fc6e2ae 100644
--- a/content/renderer/media/webrtc/media_stream_video_webrtc_sink.cc
+++ b/content/renderer/media/webrtc/media_stream_video_webrtc_sink.cc
@@ -5,17 +5,34 @@
 #include "content/renderer/media/webrtc/media_stream_video_webrtc_sink.h"
 
 #include "base/location.h"
+#include "base/numerics/safe_conversions.h"
 #include "base/single_thread_task_runner.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/synchronization/lock.h"
 #include "base/thread_task_runner_handle.h"
+#include "base/timer/timer.h"
 #include "content/common/media/media_stream_options.h"
+#include "content/public/renderer/media_stream_utils.h"
 #include "content/renderer/media/media_stream_constraints_util.h"
 #include "content/renderer/media/media_stream_video_track.h"
 #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h"
+#include "media/base/limits.h"
 
 namespace content {
 
+namespace {
+
+// The default number of microseconds that should elapse since the last video
+// frame was received, before requesting a refresh frame.
+const int64_t kDefaultRefreshIntervalMicros =
+    base::Time::kMicrosecondsPerSecond;
+
+// A lower-bound for the refresh interval.
+const int64_t kLowerBoundRefreshIntervalMicros =
+    base::Time::kMicrosecondsPerSecond / media::limits::kMaxFramesPerSecond;
+
+}  // namespace
+
 // Simple help class used for receiving video frames on the IO-thread from a
 // MediaStreamVideoTrack and forward the frames to a WebRtcVideoCapturerAdapter
 // on libjingle's worker thread. WebRtcVideoCapturerAdapter implements a video
@@ -27,7 +44,9 @@
       const scoped_refptr<base::SingleThreadTaskRunner>&
           libjingle_worker_thread,
       const scoped_refptr<webrtc::VideoTrackSourceInterface>& source,
-      WebRtcVideoCapturerAdapter* capture_adapter);
+      WebRtcVideoCapturerAdapter* capture_adapter,
+      base::TimeDelta refresh_interval,
+      const base::Closure& refresh_callback);
 
   // MediaStreamVideoWebRtcSink can be destroyed on the main render thread or
   // libjingles worker thread since it posts video frames on that thread. But
@@ -46,6 +65,11 @@
   friend class base::RefCountedThreadSafe<WebRtcVideoSourceAdapter>;
   virtual ~WebRtcVideoSourceAdapter();
 
+  // Called whenever a video frame was just delivered on the IO thread. This
+  // restarts the delay period before the |refresh_timer_| will fire the next
+  // time.
+  void ResetRefreshTimerOnMainThread();
+
   scoped_refptr<base::SingleThreadTaskRunner> render_thread_task_runner_;
 
   // |render_thread_checker_| is bound to the main render thread.
@@ -66,17 +90,38 @@
   base::Lock capture_adapter_stop_lock_;
   // |capture_adapter_| is owned by |video_source_|
   WebRtcVideoCapturerAdapter* capture_adapter_;
+
+  // Requests a refresh frame at regular intervals. The delay on this timer is
+  // reset each time a frame is received so that it will not fire for at least
+  // an additional period. This means refresh frames will only be requested when
+  // the source has halted delivery (e.g., a screen capturer stops sending
+  // frames because the screen is not being updated).
+  //
+  // This mechanism solves a number of problems. First, it will ensure that
+  // remote clients that join a distributed session receive a first video frame
+  // in a timely manner. Second, it will allow WebRTC's internal bandwidth
+  // estimation logic to maintain a more optimal state, since sending a video
+  // frame will "prime it." Third, it allows lossy encoders to clean up
+  // artifacts in a still image.  http://crbug.com/486274
+  base::RepeatingTimer refresh_timer_;
 };
 
 MediaStreamVideoWebRtcSink::WebRtcVideoSourceAdapter::WebRtcVideoSourceAdapter(
     const scoped_refptr<base::SingleThreadTaskRunner>& libjingle_worker_thread,
     const scoped_refptr<webrtc::VideoTrackSourceInterface>& source,
-    WebRtcVideoCapturerAdapter* capture_adapter)
+    WebRtcVideoCapturerAdapter* capture_adapter,
+    base::TimeDelta refresh_interval,
+    const base::Closure& refresh_callback)
     : render_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()),
       libjingle_worker_thread_(libjingle_worker_thread),
       video_source_(source),
       capture_adapter_(capture_adapter) {
   io_thread_checker_.DetachFromThread();
+  if (!refresh_interval.is_zero()) {
+    VLOG(1) << "Starting frame refresh timer with interval "
+            << refresh_interval.InMillisecondsF() << " ms.";
+    refresh_timer_.Start(FROM_HERE, refresh_interval, refresh_callback);
+  }
 }
 
 MediaStreamVideoWebRtcSink::WebRtcVideoSourceAdapter::
@@ -91,6 +136,13 @@
 }
 
 void MediaStreamVideoWebRtcSink::WebRtcVideoSourceAdapter::
+ResetRefreshTimerOnMainThread() {
+  DCHECK(render_thread_checker_.CalledOnValidThread());
+  if (refresh_timer_.IsRunning())
+    refresh_timer_.Reset();
+}
+
+void MediaStreamVideoWebRtcSink::WebRtcVideoSourceAdapter::
 ReleaseSourceOnMainThread() {
   DCHECK(render_thread_checker_.CalledOnValidThread());
   // Since frames are posted to the worker thread, this object might be deleted
@@ -106,6 +158,10 @@
     const scoped_refptr<media::VideoFrame>& frame,
     base::TimeTicks estimated_capture_time) {
   DCHECK(io_thread_checker_.CalledOnValidThread());
+  render_thread_task_runner_->PostTask(
+      FROM_HERE,
+      base::Bind(&WebRtcVideoSourceAdapter::ResetRefreshTimerOnMainThread,
+                 this));
   libjingle_worker_thread_->PostTask(
       FROM_HERE,
       base::Bind(&WebRtcVideoSourceAdapter::OnVideoFrameOnWorkerThread,
@@ -124,7 +180,7 @@
 MediaStreamVideoWebRtcSink::MediaStreamVideoWebRtcSink(
     const blink::WebMediaStreamTrack& track,
     PeerConnectionDependencyFactory* factory)
-    : web_track_(track) {
+    : weak_factory_(this) {
   const blink::WebMediaConstraints& constraints =
       MediaStreamVideoTrack::GetVideoTrack(track)->constraints();
 
@@ -133,6 +189,41 @@
   bool is_screencast = GetConstraintValueAsString(
       constraints, &blink::WebMediaTrackConstraintSet::mediaStreamSource,
       &value);
+
+  // Enable automatic frame refreshes for the screen capture sources, which will
+  // stop producing frames whenever screen content is not changing. Check the
+  // frameRate constraint to determine the rate of refreshes. If a minimum
+  // frameRate is provided, use that. Otherwise, use the maximum frameRate if it
+  // happens to be less than the default.
+  base::TimeDelta refresh_interval = base::TimeDelta::FromMicroseconds(0);
+  if (is_screencast) {
+    // Start with the default refresh interval, and refine based on constraints.
+    refresh_interval =
+        base::TimeDelta::FromMicroseconds(kDefaultRefreshIntervalMicros);
+    double value = 0.0;
+    if (GetConstraintMinAsDouble(
+            constraints, &blink::WebMediaTrackConstraintSet::frameRate,
+            &value) &&
+        value > 0.0) {
+      refresh_interval =
+          base::TimeDelta::FromMicroseconds(base::saturated_cast<int64_t>(
+              base::Time::kMicrosecondsPerSecond / value));
+    }
+    if (GetConstraintMaxAsDouble(
+            constraints, &blink::WebMediaTrackConstraintSet::frameRate,
+            &value) &&
+        value > 0.0) {
+      const base::TimeDelta alternate_refresh_interval =
+          base::TimeDelta::FromMicroseconds(base::saturated_cast<int64_t>(
+              base::Time::kMicrosecondsPerSecond / value));
+      refresh_interval = std::max(refresh_interval, alternate_refresh_interval);
+    }
+    if (refresh_interval.InMicroseconds() < kLowerBoundRefreshIntervalMicros) {
+      refresh_interval =
+          base::TimeDelta::FromMicroseconds(kLowerBoundRefreshIntervalMicros);
+    }
+  }
+
   WebRtcVideoCapturerAdapter* capture_adapter =
       factory->CreateVideoCapturer(is_screencast);
 
@@ -140,20 +231,22 @@
   scoped_refptr<webrtc::VideoTrackSourceInterface> video_source(
       factory->CreateVideoSource(capture_adapter));
 
-  video_track_ = factory->CreateLocalVideoTrack(web_track_.id().utf8(),
+  video_track_ = factory->CreateLocalVideoTrack(track.id().utf8(),
                                                 video_source.get());
 
-  video_track_->set_enabled(web_track_.isEnabled());
+  video_track_->set_enabled(track.isEnabled());
 
   source_adapter_ = new WebRtcVideoSourceAdapter(
       factory->GetWebRtcWorkerThread(),
       video_source,
-      capture_adapter);
+      capture_adapter,
+      refresh_interval,
+      base::Bind(&MediaStreamVideoWebRtcSink::RequestRefreshFrame,
+                 weak_factory_.GetWeakPtr()));
 
-  AddToVideoTrack(
-      this,
-      base::Bind(&WebRtcVideoSourceAdapter::OnVideoFrameOnIO, source_adapter_),
-      web_track_);
+  MediaStreamVideoSink::ConnectToTrack(
+      track,
+      base::Bind(&WebRtcVideoSourceAdapter::OnVideoFrameOnIO, source_adapter_));
 
   DVLOG(3) << "MediaStreamVideoWebRtcSink ctor() : is_screencast "
            << is_screencast;
@@ -162,7 +255,8 @@
 MediaStreamVideoWebRtcSink::~MediaStreamVideoWebRtcSink() {
   DCHECK(thread_checker_.CalledOnValidThread());
   DVLOG(3) << "MediaStreamVideoWebRtcSink dtor().";
-  RemoveFromVideoTrack(this, web_track_);
+  weak_factory_.InvalidateWeakPtrs();
+  MediaStreamVideoSink::DisconnectFromTrack();
   source_adapter_->ReleaseSourceOnMainThread();
 }
 
@@ -171,4 +265,9 @@
   video_track_->set_enabled(enabled);
 }
 
+void MediaStreamVideoWebRtcSink::RequestRefreshFrame() {
+  DCHECK(thread_checker_.CalledOnValidThread());
+  content::RequestRefreshFrameFromVideoTrack(connected_track());
+}
+
 }  // namespace content
diff --git a/content/renderer/media/webrtc/media_stream_video_webrtc_sink.h b/content/renderer/media/webrtc/media_stream_video_webrtc_sink.h
index 2a25d248..9713731 100644
--- a/content/renderer/media/webrtc/media_stream_video_webrtc_sink.h
+++ b/content/renderer/media/webrtc/media_stream_video_webrtc_sink.h
@@ -6,6 +6,7 @@
 #define CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_VIDEO_TRACK_ADAPTER_H_
 
 #include "base/macros.h"
+#include "base/memory/weak_ptr.h"
 #include "base/threading/thread_checker.h"
 #include "content/public/renderer/media_stream_video_sink.h"
 #include "content/renderer/media/webrtc/webrtc_video_capturer_adapter.h"
@@ -41,15 +42,23 @@
   void OnEnabledChanged(bool enabled) override;
 
  private:
+  // Helper to request a refresh frame from the source. Called via the callback
+  // passed to WebRtcVideoSourceAdapter.
+  void RequestRefreshFrame();
+
   // Used to DCHECK that we are called on the correct thread.
   base::ThreadChecker thread_checker_;
 
   scoped_refptr<webrtc::VideoTrackInterface> video_track_;
-  blink::WebMediaStreamTrack web_track_;
 
   class WebRtcVideoSourceAdapter;
   scoped_refptr<WebRtcVideoSourceAdapter> source_adapter_;
 
+  // Provides WebRtcVideoSourceAdapter a weak reference to
+  // MediaStreamVideoWebRtcSink in order to allow it to request refresh frames.
+  // See comments in media_stream_video_webrtc_sink.cc.
+  base::WeakPtrFactory<MediaStreamVideoWebRtcSink> weak_factory_;
+
   DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoWebRtcSink);
 };
 
diff --git a/content/renderer/pepper/content_renderer_pepper_host_factory.cc b/content/renderer/pepper/content_renderer_pepper_host_factory.cc
index fc216e1c..8f13230a 100644
--- a/content/renderer/pepper/content_renderer_pepper_host_factory.cc
+++ b/content/renderer/pepper/content_renderer_pepper_host_factory.cc
@@ -7,6 +7,7 @@
 #include <utility>
 
 #include "base/logging.h"
+#include "base/memory/ptr_util.h"
 #include "base/strings/string_util.h"
 #include "build/build_config.h"
 #include "content/common/content_switches_internal.h"
@@ -101,7 +102,8 @@
 
 ContentRendererPepperHostFactory::~ContentRendererPepperHostFactory() {}
 
-scoped_ptr<ResourceHost> ContentRendererPepperHostFactory::CreateResourceHost(
+std::unique_ptr<ResourceHost>
+ContentRendererPepperHostFactory::CreateResourceHost(
     ppapi::host::PpapiHost* host,
     PP_Resource resource,
     PP_Instance instance,
@@ -110,19 +112,19 @@
 
   // Make sure the plugin is giving us a valid instance for this resource.
   if (!host_->IsValidInstance(instance))
-    return scoped_ptr<ResourceHost>();
+    return nullptr;
 
   PepperPluginInstanceImpl* instance_impl =
       host_->GetPluginInstanceImpl(instance);
   if (!instance_impl->render_frame())
-    return scoped_ptr<ResourceHost>();
+    return nullptr;
 
   // Public interfaces.
   switch (message.type()) {
     case PpapiHostMsg_Compositor_Create::ID: {
       if (!CanUseCompositorAPI(host_, instance))
-        return scoped_ptr<ResourceHost>();
-      return scoped_ptr<ResourceHost>(
+        return nullptr;
+      return base::WrapUnique(
           new PepperCompositorHost(host_, instance, resource));
     }
     case PpapiHostMsg_FileRef_CreateForFileAPI::ID: {
@@ -131,9 +133,9 @@
       if (!UnpackMessage<PpapiHostMsg_FileRef_CreateForFileAPI>(
               message, &file_system, &internal_path)) {
         NOTREACHED();
-        return scoped_ptr<ResourceHost>();
+        return nullptr;
       }
-      return scoped_ptr<ResourceHost>(new PepperFileRefRendererHost(
+      return base::WrapUnique(new PepperFileRefRendererHost(
           host_, instance, resource, file_system, internal_path));
     }
     case PpapiHostMsg_FileSystem_Create::ID: {
@@ -141,9 +143,9 @@
       if (!UnpackMessage<PpapiHostMsg_FileSystem_Create>(message,
                                                          &file_system_type)) {
         NOTREACHED();
-        return scoped_ptr<ResourceHost>();
+        return nullptr;
       }
-      return scoped_ptr<ResourceHost>(new PepperFileSystemHost(
+      return base::WrapUnique(new PepperFileSystemHost(
           host_, instance, resource, file_system_type));
     }
     case PpapiHostMsg_Graphics2D_Create::ID: {
@@ -152,7 +154,7 @@
       if (!UnpackMessage<PpapiHostMsg_Graphics2D_Create>(
               message, &size, &is_always_opaque)) {
         NOTREACHED();
-        return scoped_ptr<ResourceHost>();
+        return nullptr;
       }
       ppapi::PPB_ImageData_Shared::ImageDataType image_type =
           ppapi::PPB_ImageData_Shared::PLATFORM;
@@ -169,35 +171,35 @@
 #endif
       scoped_refptr<PPB_ImageData_Impl> image_data(new PPB_ImageData_Impl(
           instance, image_type));
-      return scoped_ptr<ResourceHost>(PepperGraphics2DHost::Create(
+      return base::WrapUnique(PepperGraphics2DHost::Create(
           host_, instance, resource, size, is_always_opaque, image_data));
     }
     case PpapiHostMsg_URLLoader_Create::ID:
-      return scoped_ptr<ResourceHost>(
+      return base::WrapUnique(
           new PepperURLLoaderHost(host_, false, instance, resource));
     case PpapiHostMsg_VideoDecoder_Create::ID:
-      return scoped_ptr<ResourceHost>(
+      return base::WrapUnique(
           new PepperVideoDecoderHost(host_, instance, resource));
     case PpapiHostMsg_VideoEncoder_Create::ID:
-      return scoped_ptr<ResourceHost>(
+      return base::WrapUnique(
           new PepperVideoEncoderHost(host_, instance, resource));
     case PpapiHostMsg_WebSocket_Create::ID:
-      return scoped_ptr<ResourceHost>(
+      return base::WrapUnique(
           new PepperWebSocketHost(host_, instance, resource));
 #if defined(ENABLE_WEBRTC)
     case PpapiHostMsg_MediaStreamVideoTrack_Create::ID:
-      return scoped_ptr<ResourceHost>(
+      return base::WrapUnique(
           new PepperMediaStreamVideoTrackHost(host_, instance, resource));
     // These private MediaStream interfaces are exposed as if they were public
     // so they can be used by NaCl plugins. However, they are available only
     // for whitelisted apps.
     case PpapiHostMsg_VideoDestination_Create::ID:
       if (CanUseMediaStreamAPI(host_, instance))
-        return scoped_ptr<ResourceHost>(
+        return base::WrapUnique(
             new PepperVideoDestinationHost(host_, instance, resource));
     case PpapiHostMsg_VideoSource_Create::ID:
       if (CanUseMediaStreamAPI(host_, instance))
-        return scoped_ptr<ResourceHost>(
+        return base::WrapUnique(
             new PepperVideoSourceHost(host_, instance, resource));
 #endif  // defined(ENABLE_WEBRTC)
   }
@@ -206,22 +208,18 @@
   if (GetPermissions().HasPermission(ppapi::PERMISSION_DEV)) {
     switch (message.type()) {
       case PpapiHostMsg_AudioEncoder_Create::ID:
-        return scoped_ptr<ResourceHost>(
+        return base::WrapUnique(
             new PepperAudioEncoderHost(host_, instance, resource));
       case PpapiHostMsg_AudioInput_Create::ID:
-        return scoped_ptr<ResourceHost>(
+        return base::WrapUnique(
             new PepperAudioInputHost(host_, instance, resource));
       case PpapiHostMsg_FileChooser_Create::ID:
-        return scoped_ptr<ResourceHost>(
+        return base::WrapUnique(
             new PepperFileChooserHost(host_, instance, resource));
       case PpapiHostMsg_VideoCapture_Create::ID: {
-        PepperVideoCaptureHost* host =
-            new PepperVideoCaptureHost(host_, instance, resource);
-        if (!host->Init()) {
-          delete host;
-          return scoped_ptr<ResourceHost>();
-        }
-        return scoped_ptr<ResourceHost>(host);
+        std::unique_ptr<PepperVideoCaptureHost> host(
+            new PepperVideoCaptureHost(host_, instance, resource));
+        return host->Init() ? std::move(host) : nullptr;
       }
     }
   }
@@ -232,12 +230,12 @@
     if (!GetPermissions().HasPermission(ppapi::PERMISSION_PRIVATE) &&
         !CanUseCameraDeviceAPI(host_, instance))
       return nullptr;
-    scoped_ptr<PepperCameraDeviceHost> host(
+    std::unique_ptr<PepperCameraDeviceHost> host(
         new PepperCameraDeviceHost(host_, instance, resource));
     return host->Init() ? std::move(host) : nullptr;
   }
 
-  return scoped_ptr<ResourceHost>();
+  return nullptr;
 }
 
 const ppapi::PpapiPermissions&
diff --git a/content/renderer/pepper/content_renderer_pepper_host_factory.h b/content/renderer/pepper/content_renderer_pepper_host_factory.h
index 41ff02a5..db1f7f2 100644
--- a/content/renderer/pepper/content_renderer_pepper_host_factory.h
+++ b/content/renderer/pepper/content_renderer_pepper_host_factory.h
@@ -24,7 +24,7 @@
   explicit ContentRendererPepperHostFactory(RendererPpapiHostImpl* host);
   ~ContentRendererPepperHostFactory() override;
 
-  scoped_ptr<ppapi::host::ResourceHost> CreateResourceHost(
+  std::unique_ptr<ppapi::host::ResourceHost> CreateResourceHost(
       ppapi::host::PpapiHost* host,
       PP_Resource resource,
       PP_Instance instance,
diff --git a/content/renderer/pepper/pepper_compositor_host.h b/content/renderer/pepper/pepper_compositor_host.h
index 599f3469..a8a413bd 100644
--- a/content/renderer/pepper/pepper_compositor_host.h
+++ b/content/renderer/pepper/pepper_compositor_host.h
@@ -38,6 +38,8 @@
   PepperCompositorHost(RendererPpapiHost* host,
                        PP_Instance instance,
                        PP_Resource resource);
+  ~PepperCompositorHost() override;
+
   // Associates this device with the given plugin instance. You can pass NULL
   // to clear the existing device. Returns true on success. In this case, a
   // repaint of the page will also be scheduled. Failure means that the device
@@ -49,8 +51,6 @@
   void ViewInitiatedPaint();
 
  private:
-  ~PepperCompositorHost() override;
-
   void ImageReleased(int32_t id,
                      scoped_ptr<base::SharedMemory> shared_memory,
                      scoped_ptr<cc::SharedBitmap> bitmap,
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 e834b10..9907cf4 100644
--- a/content/renderer/pepper/pepper_media_stream_video_track_host.cc
+++ b/content/renderer/pepper/pepper_media_stream_video_track_host.cc
@@ -229,7 +229,6 @@
     const blink::WebMediaStreamTrack& track)
     : PepperMediaStreamTrackHostBase(host, instance, resource),
       track_(track),
-      connected_(false),
       number_of_buffers_(kDefaultNumberOfBuffers),
       source_frame_format_(PP_VIDEOFRAME_FORMAT_UNKNOWN),
       plugin_frame_format_(PP_VIDEOFRAME_FORMAT_UNKNOWN),
@@ -245,7 +244,6 @@
     PP_Instance instance,
     PP_Resource resource)
     : PepperMediaStreamTrackHostBase(host, instance, resource),
-      connected_(false),
       number_of_buffers_(kDefaultNumberOfBuffers),
       source_frame_format_(PP_VIDEOFRAME_FORMAT_UNKNOWN),
       plugin_frame_format_(PP_VIDEOFRAME_FORMAT_UNKNOWN),
@@ -257,14 +255,14 @@
   DCHECK(!track_.isNull());
 }
 
-bool PepperMediaStreamVideoTrackHost::IsMediaStreamVideoTrackHost() {
-  return true;
-}
-
 PepperMediaStreamVideoTrackHost::~PepperMediaStreamVideoTrackHost() {
   OnClose();
 }
 
+bool PepperMediaStreamVideoTrackHost::IsMediaStreamVideoTrackHost() {
+  return true;
+}
+
 void PepperMediaStreamVideoTrackHost::InitBuffers() {
   gfx::Size size = GetTargetSize(source_frame_size_, plugin_frame_size_);
   DCHECK(!size.IsEmpty());
@@ -307,11 +305,8 @@
 }
 
 void PepperMediaStreamVideoTrackHost::OnClose() {
-  if (connected_) {
-    MediaStreamVideoSink::RemoveFromVideoTrack(this, track_);
-    weak_factory_.InvalidateWeakPtrs();
-    connected_ = false;
-  }
+  MediaStreamVideoSink::DisconnectFromTrack();
+  weak_factory_.InvalidateWeakPtrs();
 }
 
 int32_t PepperMediaStreamVideoTrackHost::OnHostMsgEnqueueBuffer(
@@ -447,16 +442,14 @@
 }
 
 void PepperMediaStreamVideoTrackHost::DidConnectPendingHostToResource() {
-  if (!connected_) {
-    MediaStreamVideoSink::AddToVideoTrack(
-        this,
-        media::BindToCurrentLoop(
-            base::Bind(
-                &PepperMediaStreamVideoTrackHost::OnVideoFrame,
-                weak_factory_.GetWeakPtr())),
-        track_);
-    connected_ = true;
-  }
+  if (!MediaStreamVideoSink::connected_track().isNull())
+    return;
+  MediaStreamVideoSink::ConnectToTrack(
+      track_,
+      media::BindToCurrentLoop(
+          base::Bind(
+              &PepperMediaStreamVideoTrackHost::OnVideoFrame,
+              weak_factory_.GetWeakPtr())));
 }
 
 int32_t PepperMediaStreamVideoTrackHost::OnResourceMessageReceived(
diff --git a/content/renderer/pepper/pepper_media_stream_video_track_host.h b/content/renderer/pepper/pepper_media_stream_video_track_host.h
index 81422146..b510377 100644
--- a/content/renderer/pepper/pepper_media_stream_video_track_host.h
+++ b/content/renderer/pepper/pepper_media_stream_video_track_host.h
@@ -40,13 +40,13 @@
                                   PP_Instance instance,
                                   PP_Resource resource);
 
+  ~PepperMediaStreamVideoTrackHost() override;
+
   bool IsMediaStreamVideoTrackHost() override;
 
   blink::WebMediaStreamTrack track() { return track_; }
 
  private:
-  ~PepperMediaStreamVideoTrackHost() override;
-
   void InitBuffers();
 
   // PepperMediaStreamTrackHostBase overrides:
@@ -94,9 +94,6 @@
 
   blink::WebMediaStreamTrack track_;
 
-  // True if it has been added to |blink::WebMediaStreamTrack| as a sink.
-  bool connected_;
-
   // Number of buffers.
   int32_t number_of_buffers_;
 
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 2f10531f..f4a1764 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -2132,6 +2132,18 @@
       surroundingText.endOffsetInTextContent()));
 }
 
+bool RenderFrameImpl::SendAndRunNestedMessageLoop(IPC::SyncMessage* message) {
+  // Before Blink asks us to show an alert (etc.), it takes care of doing the
+  // equivalent of WebView::willEnterModalLoop.  In this case it is particularly
+  // important that we do not call willEnterModalLoop as that would defer
+  // resource loads for the dialog itself.
+  if (RenderThreadImpl::current())  // Will be NULL during unit tests.
+    RenderThreadImpl::current()->DoNotNotifyWebKitOfModalLoop();
+
+  message->EnableMessagePumping();  // Runs a nested message loop.
+  return Send(message);
+}
+
 bool RenderFrameImpl::RunJavaScriptMessage(JavaScriptMessageType type,
                                            const base::string16& message,
                                            const base::string16& default_value,
@@ -2147,10 +2159,8 @@
   if (!result)
     result = &result_temp;
 
-  render_view()->SendAndRunNestedMessageLoop(
-      new FrameHostMsg_RunJavaScriptMessage(
-        routing_id_, message, default_value, frame_url, type, &success,
-        result));
+  SendAndRunNestedMessageLoop(new FrameHostMsg_RunJavaScriptMessage(
+      routing_id_, message, default_value, frame_url, type, &success, result));
   return success;
 }
 
@@ -3612,10 +3622,9 @@
   // This is an ignored return value, but is included so we can accept the same
   // response as RunJavaScriptMessage.
   base::string16 ignored_result;
-  render_view()->SendAndRunNestedMessageLoop(
-      new FrameHostMsg_RunBeforeUnloadConfirm(
-          routing_id_, frame_->document().url(), is_reload,
-          &success, &ignored_result));
+  SendAndRunNestedMessageLoop(new FrameHostMsg_RunBeforeUnloadConfirm(
+      routing_id_, frame_->document().url(), is_reload, &success,
+      &ignored_result));
   return success;
 }
 
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h
index 9532978..f572f3e 100644
--- a/content/renderer/render_frame_impl.h
+++ b/content/renderer/render_frame_impl.h
@@ -72,6 +72,10 @@
 struct FrameMsg_SerializeAsMHTML_Params;
 struct FrameMsg_TextTrackSettings_Params;
 
+namespace IPC {
+class SyncMessage;
+}
+
 namespace blink {
 class WebGeolocationClient;
 class WebMouseEvent;
@@ -852,6 +856,9 @@
   // selection handles in sync with the webpage.
   void SyncSelectionIfRequired();
 
+  // Sends a message and runs a nested message loop.
+  bool SendAndRunNestedMessageLoop(IPC::SyncMessage* message);
+
   bool RunJavaScriptMessage(JavaScriptMessageType type,
                             const base::string16& message,
                             const base::string16& default_value,
diff --git a/content/renderer/render_view_browsertest.cc b/content/renderer/render_view_browsertest.cc
index 42a4b37..9f51c44 100644
--- a/content/renderer/render_view_browsertest.cc
+++ b/content/renderer/render_view_browsertest.cc
@@ -25,6 +25,7 @@
 #include "content/common/frame_replication_state.h"
 #include "content/common/site_isolation_policy.h"
 #include "content/common/ssl_status_serialization.h"
+#include "content/common/text_input_state.h"
 #include "content/common/view_messages.h"
 #include "content/public/browser/browser_context.h"
 #include "content/public/browser/native_web_keyboard_event.h"
@@ -1094,7 +1095,7 @@
     EXPECT_EQ(ViewHostMsg_TextInputStateChanged::ID, msg->type());
     ViewHostMsg_TextInputStateChanged::Param params;
     ViewHostMsg_TextInputStateChanged::Read(msg, &params);
-    ViewHostMsg_TextInputState_Params p = base::get<0>(params);
+    TextInputState p = base::get<0>(params);
     ui::TextInputType type = p.type;
     ui::TextInputMode input_mode = p.mode;
     bool can_compose_inline = p.can_compose_inline;
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index bb6f2636..88b8ed4 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -1085,6 +1085,8 @@
       prefs.ignore_main_frame_overflow_hidden_quirk);
   settings->setReportScreenSizeInPhysicalPixelsQuirk(
       prefs.report_screen_size_in_physical_pixels_quirk);
+  settings->setShouldReuseGlobalForUnownedMainFrame(
+      prefs.resue_global_for_unowned_main_frame);
   settings->setPreferHiddenVolumeControls(true);
   settings->setShrinksViewportContentToFit(true);
   settings->setUseMobileViewportStyle(true);
@@ -1492,18 +1494,6 @@
 #endif
 }
 
-bool RenderViewImpl::SendAndRunNestedMessageLoop(IPC::SyncMessage* message) {
-  // Before WebKit asks us to show an alert (etc.), it takes care of doing the
-  // equivalent of WebView::willEnterModalLoop.  In the case of showModalDialog
-  // it is particularly important that we do not call willEnterModalLoop as
-  // that would defer resource loads for the dialog itself.
-  if (RenderThreadImpl::current())  // Will be NULL during unit tests.
-    RenderThreadImpl::current()->DoNotNotifyWebKitOfModalLoop();
-
-  message->EnableMessagePumping();  // Runs a nested message loop.
-  return Send(message);
-}
-
 void RenderViewImpl::OnForceRedraw(int id) {
   ui::LatencyInfo latency_info;
   if (id) {
diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h
index c3688b56..3096071b 100644
--- a/content/renderer/render_view_impl.h
+++ b/content/renderer/render_view_impl.h
@@ -591,9 +591,6 @@
                                    blink::WebView* web_view,
                                    CompositorDependencies* compositor_deps);
 
-  // Sends a message and runs a nested message loop.
-  bool SendAndRunNestedMessageLoop(IPC::SyncMessage* message);
-
   // IPC message handlers ------------------------------------------------------
   //
   // The documentation for these functions should be in
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 0f53306..ecf8ae40 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -37,6 +37,7 @@
 #include "content/common/input/web_input_event_traits.h"
 #include "content/common/input_messages.h"
 #include "content/common/swapped_out_messages.h"
+#include "content/common/text_input_state.h"
 #include "content/common/view_messages.h"
 #include "content/public/common/content_features.h"
 #include "content/public/common/content_switches.h"
@@ -106,6 +107,10 @@
 #include "content/renderer/mus/render_widget_mus_connection.h"
 #endif
 
+#if defined(ENABLE_VULKAN)
+#include "cc/output/vulkan_in_process_context_provider.h"
+#endif
+
 #include "third_party/WebKit/public/web/WebWidget.h"
 
 using blink::WebCompositionUnderline;
@@ -734,9 +739,23 @@
       use_software = true;
   }
 
+#if defined(ENABLE_VULKAN)
+  scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider;
+#endif
   scoped_refptr<ContextProviderCommandBuffer> context_provider;
   scoped_refptr<ContextProviderCommandBuffer> worker_context_provider;
   if (!use_software) {
+#if defined(ENABLE_VULKAN)
+    vulkan_context_provider = cc::VulkanInProcessContextProvider::Create();
+    if (vulkan_context_provider) {
+      uint32_t output_surface_id = next_output_surface_id_++;
+      return scoped_ptr<cc::OutputSurface>(new DelegatedCompositorOutputSurface(
+          routing_id(), output_surface_id, context_provider,
+          worker_context_provider, vulkan_context_provider,
+          frame_swap_message_queue_));
+    }
+#endif
+
     context_provider = ContextProviderCommandBuffer::Create(
         CreateGraphicsContext3D(gpu_channel_host.get()),
         RENDER_COMPOSITOR_CONTEXT);
@@ -775,7 +794,11 @@
     DCHECK(compositor_deps_->GetCompositorImplThreadTaskRunner());
     return make_scoped_ptr(new DelegatedCompositorOutputSurface(
         routing_id(), output_surface_id, context_provider,
-        worker_context_provider, frame_swap_message_queue_));
+        worker_context_provider,
+#if defined(ENABLE_VULKAN)
+        vulkan_context_provider,
+#endif
+        frame_swap_message_queue_));
   }
 
   if (!context_provider.get()) {
@@ -784,6 +807,9 @@
 
     return make_scoped_ptr(new CompositorOutputSurface(
         routing_id(), output_surface_id, nullptr, nullptr,
+#if defined(ENABLE_VULKAN)
+        nullptr,
+#endif
         std::move(software_device), frame_swap_message_queue_, true));
   }
 
@@ -1044,7 +1070,7 @@
       || text_field_is_dirty_
 #endif
       ) {
-    ViewHostMsg_TextInputState_Params params;
+    TextInputState params;
     params.type = new_type;
     params.mode = new_mode;
     params.flags = new_info.flags;
diff --git a/content/test/data/gpu/pixel_canvas2d_webgl.html b/content/test/data/gpu/pixel_canvas2d_webgl.html
index dcd1f9a..4f42527 100644
--- a/content/test/data/gpu/pixel_canvas2d_webgl.html
+++ b/content/test/data/gpu/pixel_canvas2d_webgl.html
@@ -46,6 +46,8 @@
     return;
   }
 
+  gl.viewport(0, 0, 50, 50);
+
   waitForFinish();
 }
 
@@ -64,14 +66,14 @@
 </script>
 </head>
 <body onload="main()">
-<div style="position:relative; width:400px; height:400px; background-color:black">
+<div style="position:relative; width:300px; height:300px; background-color:black">
 </div>
 <div id="container" style="position:absolute; top:0px; left:0px">
+<canvas id="c2" width="50" height="50" class="nomargin"></canvas>
 <!--
 Canvas acceleration requires that the canvas be at least 256x257.
 -->
 <canvas id="c" width="300" height="300" class="nomargin"></canvas>
-<canvas id="c2" width="300" height="300" class="nomargin"></canvas>
 </div>
 </body>
 </html>
diff --git a/content/test/data/textinput/page_with_input.html b/content/test/data/textinput/page_with_input.html
new file mode 100644
index 0000000..8491366f
--- /dev/null
+++ b/content/test/data/textinput/page_with_input.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <title> Page with input field. </title>
+</head>
+<body>
+  <input type="text"/>
+</body>
+</html>
diff --git a/content/test/data/textinput/page_with_input_iframeX2_input.html b/content/test/data/textinput/page_with_input_iframeX2_input.html
new file mode 100644
index 0000000..c21a22de
--- /dev/null
+++ b/content/test/data/textinput/page_with_input_iframeX2_input.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <title> Page with input, two iframes, and another input. </title>
+</head>
+<body>
+  <input type="text" value="first"/>
+  <iframe></iframe>
+  <iframe></iframe>
+  <input type="text" value="fourth"/>
+</body>
+</html>
diff --git a/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py b/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py
index 7eca698..9cebea2 100644
--- a/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py
+++ b/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py
@@ -68,62 +68,62 @@
     self.Fail('conformance2/vertex_arrays/vertex-array-object.html', bug=483282)
 
     # Windows only.
-    self.Fail('conformance2/textures/canvas/tex-image-and-sub-image-2d' +
-        '-with-canvas-r8-red-unsigned_byte.html',
+    self.Fail('conformance2/textures/canvas/' +
+        'tex-2d-r8-red-unsigned_byte.html',
         ['win'], bug=483282)
-    self.Fail('conformance2/textures/canvas/tex-image-and-sub-image-2d' +
-        '-with-canvas-rg8-rg-unsigned_byte.html',
+    self.Fail('conformance2/textures/canvas/' +
+        'tex-2d-rg8-rg-unsigned_byte.html',
         ['win'], bug=483282)
-    self.Fail('conformance2/textures/canvas/tex-image-and-sub-image-2d' +
-        '-with-canvas-rgb8-rgb-unsigned_byte.html',
+    self.Fail('conformance2/textures/canvas/' +
+        'tex-2d-rgb8-rgb-unsigned_byte.html',
         ['win'], bug=483282)
-    self.Fail('conformance2/textures/canvas/tex-image-and-sub-image-2d' +
-        '-with-canvas-rgb565-rgb-unsigned_byte.html',
+    self.Fail('conformance2/textures/canvas/' +
+        'tex-2d-rgb565-rgb-unsigned_byte.html',
         ['win'], bug=483282)
-    self.Fail('conformance2/textures/canvas/tex-image-and-sub-image-2d' +
-        '-with-canvas-rgb565-rgb-unsigned_short_5_6_5.html',
+    self.Fail('conformance2/textures/canvas/' +
+        'tex-2d-rgb565-rgb-unsigned_short_5_6_5.html',
         ['win'], bug=483282)
-    self.Fail('conformance2/textures/canvas/tex-image-and-sub-image-2d' +
-        '-with-canvas-rgb5_a1-rgba-unsigned_byte.html',
+    self.Fail('conformance2/textures/canvas/' +
+        'tex-2d-rgb5_a1-rgba-unsigned_byte.html',
         ['win'], bug=483282)
-    self.Fail('conformance2/textures/canvas/tex-image-and-sub-image-2d' +
-        '-with-canvas-rgb5_a1-rgba-unsigned_short_5_5_5_1.html',
+    self.Fail('conformance2/textures/canvas/' +
+        'tex-2d-rgb5_a1-rgba-unsigned_short_5_5_5_1.html',
         ['win'], bug=483282)
-    self.Fail('conformance2/textures/canvas/tex-image-and-sub-image-2d' +
-        '-with-canvas-rgba4-rgba-unsigned_byte.html',
+    self.Fail('conformance2/textures/canvas/' +
+        'tex-2d-rgba4-rgba-unsigned_byte.html',
         ['win'], bug=483282)
-    self.Fail('conformance2/textures/canvas/tex-image-and-sub-image-2d' +
-        '-with-canvas-rgba4-rgba-unsigned_short_4_4_4_4.html',
+    self.Fail('conformance2/textures/canvas/' +
+        'tex-2d-rgba4-rgba-unsigned_short_4_4_4_4.html',
         ['win'], bug=483282)
     self.Fail('conformance2/textures/misc/tex-unpack-params.html',
         ['win'], bug=483282)
 
-    self.Fail('conformance2/textures/webgl_canvas/tex-image-and-sub-image-2d' +
-        '-with-webgl-canvas-r8-red-unsigned_byte.html',
+    self.Fail('conformance2/textures/webgl_canvas/' +
+        'tex-2d-r8-red-unsigned_byte.html',
         ['win'], bug=483282)
-    self.Fail('conformance2/textures/webgl_canvas/tex-image-and-sub-image-2d' +
-        '-with-webgl-canvas-rg8-rg-unsigned_byte.html',
+    self.Fail('conformance2/textures/webgl_canvas/' +
+        'tex-2d-rg8-rg-unsigned_byte.html',
         ['win'], bug=483282)
-    self.Fail('conformance2/textures/webgl_canvas/tex-image-and-sub-image-2d' +
-        '-with-webgl-canvas-rgb8-rgb-unsigned_byte.html',
+    self.Fail('conformance2/textures/webgl_canvas/' +
+        'tex-2d-rgb8-rgb-unsigned_byte.html',
         ['win'], bug=483282)
-    self.Fail('conformance2/textures/webgl_canvas/tex-image-and-sub-image-2d' +
-        '-with-webgl-canvas-rgb565-rgb-unsigned_byte.html',
+    self.Fail('conformance2/textures/webgl_canvas/' +
+        'tex-2d-rgb565-rgb-unsigned_byte.html',
         ['win'], bug=483282)
-    self.Fail('conformance2/textures/webgl_canvas/tex-image-and-sub-image-2d' +
-        '-with-webgl-canvas-rgb565-rgb-unsigned_short_5_6_5.html',
+    self.Fail('conformance2/textures/webgl_canvas/' +
+        'tex-2d-rgb565-rgb-unsigned_short_5_6_5.html',
         ['win'], bug=483282)
-    self.Fail('conformance2/textures/webgl_canvas/tex-image-and-sub-image-2d' +
-        '-with-webgl-canvas-rgb5_a1-rgba-unsigned_byte.html',
+    self.Fail('conformance2/textures/webgl_canvas/' +
+        'tex-2d-rgb5_a1-rgba-unsigned_byte.html',
         ['win'], bug=483282)
-    self.Fail('conformance2/textures/webgl_canvas/tex-image-and-sub-image-2d' +
-        '-with-webgl-canvas-rgb5_a1-rgba-unsigned_short_5_5_5_1.html',
+    self.Fail('conformance2/textures/webgl_canvas/' +
+        'tex-2d-rgb5_a1-rgba-unsigned_short_5_5_5_1.html',
         ['win'], bug=483282)
-    self.Fail('conformance2/textures/webgl_canvas/tex-image-and-sub-image-2d' +
-        '-with-webgl-canvas-rgba4-rgba-unsigned_byte.html',
+    self.Fail('conformance2/textures/webgl_canvas/' +
+        'tex-2d-rgba4-rgba-unsigned_byte.html',
         ['win'], bug=483282)
-    self.Fail('conformance2/textures/webgl_canvas/tex-image-and-sub-image-2d' +
-        '-with-webgl-canvas-rgba4-rgba-unsigned_short_4_4_4_4.html',
+    self.Fail('conformance2/textures/webgl_canvas/' +
+        'tex-2d-rgba4-rgba-unsigned_short_4_4_4_4.html',
         ['win'], bug=483282)
 
     self.Flaky('deqp/functional/gles3/buffercopy.html', ['win'], bug=587601)
@@ -155,169 +155,145 @@
         ['win'], bug=483282)
 
     # Windows 8 only.
-    self.Fail('conformance2/textures/image_data/tex-image-and-sub-image-2d' +
-        '-with-image-data-rgb565-rgb-unsigned_byte.html',
+    self.Fail('conformance2/textures/image_data/' +
+        'tex-2d-rgb565-rgb-unsigned_byte.html',
         ['win8'], bug=483282)
-    self.Fail('conformance2/textures/image_data/tex-image-and-sub-image-2d' +
-        '-with-image-data-rgb5_a1-rgba-unsigned_byte.html',
+    self.Fail('conformance2/textures/image_data/' +
+        'tex-2d-rgb5_a1-rgba-unsigned_byte.html',
         ['win8'], bug=483282)
-    self.Fail('conformance2/textures/image/tex-image-and-sub-image-2d' +
-        '-with-image-rgb565-rgb-unsigned_byte.html',
+    self.Fail('conformance2/textures/image/' +
+        'tex-2d-rgb565-rgb-unsigned_byte.html',
         ['win8'], bug=483282)
-    self.Fail('conformance2/textures/image/tex-image-and-sub-image-2d' +
-        '-with-image-rgb5_a1-rgba-unsigned_byte.html',
+    self.Fail('conformance2/textures/image/' +
+        'tex-2d-rgb5_a1-rgba-unsigned_byte.html',
         ['win8'], bug=483282)
-    self.Fail('conformance2/textures/svg_image/tex-image-and-sub-image-2d' +
-        '-with-svg-image-rgb565-rgb-unsigned_byte.html',
+    self.Fail('conformance2/textures/svg_image/' +
+        'tex-2d-rgb565-rgb-unsigned_byte.html',
         ['win8'], bug=483282)
-    self.Fail('conformance2/textures/svg_image/tex-image-and-sub-image-2d' +
-        '-with-svg-image-rgb5_a1-rgba-unsigned_byte.html',
+    self.Fail('conformance2/textures/svg_image/' +
+        'tex-2d-rgb5_a1-rgba-unsigned_byte.html',
         ['win8'], bug=483282)
-    self.Fail('conformance2/textures/video/tex-image-and-sub-image-2d' +
-        '-with-video-rgb565-rgb-unsigned_byte.html',
+    self.Fail('conformance2/textures/video/' +
+        'tex-2d-rgb565-rgb-unsigned_byte.html',
         ['win8'], bug=483282)
-    self.Fail('conformance2/textures/video/tex-image-and-sub-image-2d' +
-        '-with-video-rgb5_a1-rgba-unsigned_byte.html',
+    self.Fail('conformance2/textures/video/' +
+        'tex-2d-rgb5_a1-rgba-unsigned_byte.html',
         ['win8'], bug=483282)
     self.Fail('conformance2/textures/image_bitmap_from_image_data/' +
-        'tex-image-and-sub-image-2d-with-image-bitmap-from-image-data-' +
-        'rgb565-rgb-unsigned_byte.html',
+        'tex-2d-rgb565-rgb-unsigned_byte.html',
         ['win8'], bug=483282)
     self.Fail('conformance2/textures/image_bitmap_from_image_data/' +
-        'tex-image-and-sub-image-2d-with-image-bitmap-from-image-data-' +
-        'rgb5_a1-rgba-unsigned_byte.html',
+        'tex-2d-rgb5_a1-rgba-unsigned_byte.html',
         ['win8'], bug=483282)
     self.Fail('conformance2/textures/image_bitmap_from_image/' +
-        'tex-image-and-sub-image-2d-with-image-bitmap-from-image-' +
-        'rgb565-rgb-unsigned_byte.html',
+        'tex-2d-rgb565-rgb-unsigned_byte.html',
         ['win8'], bug=483282)
     self.Fail('conformance2/textures/image_bitmap_from_image/' +
-        'tex-image-and-sub-image-2d-with-image-bitmap-from-image-' +
-        'rgb5_a1-rgba-unsigned_byte.html',
+        'tex-2d-rgb5_a1-rgba-unsigned_byte.html',
         ['win8'], bug=483282)
     self.Fail('conformance2/textures/image_bitmap_from_video/' +
-        'tex-image-and-sub-image-2d-with-image-bitmap-from-video-' +
-        'rgb565-rgb-unsigned_byte.html',
+        'tex-2d-rgb565-rgb-unsigned_byte.html',
         ['win8'], bug=483282)
     self.Fail('conformance2/textures/image_bitmap_from_video/' +
-        'tex-image-and-sub-image-2d-with-image-bitmap-from-video-' +
-        'rgb5_a1-rgba-unsigned_byte.html',
+        'tex-2d-rgb5_a1-rgba-unsigned_byte.html',
         ['win8'], bug=483282)
     self.Fail('conformance2/textures/image_bitmap_from_canvas/' +
-        'tex-image-and-sub-image-2d-with-image-bitmap-from-canvas-' +
-        'rgb565-rgb-unsigned_byte.html',
+        'tex-2d-rgb565-rgb-unsigned_byte.html',
         ['win8'], bug=483282)
     self.Fail('conformance2/textures/image_bitmap_from_canvas/' +
-        'tex-image-and-sub-image-2d-with-image-bitmap-from-canvas-' +
-        'rgb5_a1-rgba-unsigned_byte.html',
+        'tex-2d-rgb5_a1-rgba-unsigned_byte.html',
         ['win8'], bug=483282)
     self.Fail('conformance2/textures/image_bitmap_from_blob/' +
-        'tex-image-and-sub-image-2d-with-image-bitmap-from-blob-' +
-        'rgb565-rgb-unsigned_byte.html',
+        'tex-2d-rgb565-rgb-unsigned_byte.html',
         ['win8'], bug=483282)
     self.Fail('conformance2/textures/image_bitmap_from_blob/' +
-        'tex-image-and-sub-image-2d-with-image-bitmap-from-blob-' +
-        'rgb5_a1-rgba-unsigned_byte.html',
+        'tex-2d-rgb5_a1-rgba-unsigned_byte.html',
         ['win8'], bug=483282)
     self.Fail('conformance2/textures/image_bitmap_from_image_bitmap/' +
-        'tex-image-and-sub-image-2d-with-image-bitmap-from-image-bitmap-' +
-        'rgb565-rgb-unsigned_byte.html',
+        'tex-2d-rgb565-rgb-unsigned_byte.html',
         ['win8'], bug=483282)
     self.Fail('conformance2/textures/image_bitmap_from_image_bitmap/' +
-        'tex-image-and-sub-image-2d-with-image-bitmap-from-image-bitmap-' +
-        'rgb5_a1-rgba-unsigned_byte.html',
+        'tex-2d-rgb5_a1-rgba-unsigned_byte.html',
         ['win8'], bug=483282)
 
-    self.Fail('conformance2/textures/video/tex-image-and-sub-image-3d' +
-        '-with-video-rgb5_a1-rgba-unsigned_byte.html',
+    self.Fail('conformance2/textures/video/' +
+        'tex-3d-rgb5_a1-rgba-unsigned_byte.html',
         ['win8'], bug=560555)
-    self.Fail('conformance2/textures/video/tex-image-and-sub-image-3d' +
-        '-with-video-rgb565-rgb-unsigned_byte.html',
+    self.Fail('conformance2/textures/video/' +
+        'tex-3d-rgb565-rgb-unsigned_byte.html',
         ['win8'], bug=560555)
-    self.Fail('conformance2/textures/image_data/tex-image-and-sub-image-3d' +
-        '-with-image-data-rgb565-rgb-unsigned_byte.html',
+    self.Fail('conformance2/textures/image_data/' +
+        'tex-3d-rgb565-rgb-unsigned_byte.html',
         ['win8'], bug=560555)
-    self.Fail('conformance2/textures/image_data/tex-image-and-sub-image-3d' +
-        '-with-image-data-rgb5_a1-rgba-unsigned_byte.html',
+    self.Fail('conformance2/textures/image_data/' +
+        'tex-3d-rgb5_a1-rgba-unsigned_byte.html',
         ['win8'], bug=560555)
-    self.Fail('conformance2/textures/image/tex-image-and-sub-image-3d' +
-        '-with-image-rgb5_a1-rgba-unsigned_byte.html',
+    self.Fail('conformance2/textures/image/' +
+        'tex-3d-rgb5_a1-rgba-unsigned_byte.html',
         ['win8'], bug=560555)
-    self.Fail('conformance2/textures/image/tex-image-and-sub-image-3d' +
-        '-with-image-rgb565-rgb-unsigned_byte.html',
+    self.Fail('conformance2/textures/image/' +
+        'tex-3d-rgb565-rgb-unsigned_byte.html',
         ['win8'], bug=560555)
-    self.Fail('conformance2/textures/svg_image/tex-image-and-sub-image-3d' +
-        '-with-svg-image-rgb565-rgb-unsigned_byte.html',
+    self.Fail('conformance2/textures/svg_image/' +
+        'tex-3d-rgb565-rgb-unsigned_byte.html',
         ['win8'], bug=560555)
-    self.Fail('conformance2/textures/svg_image/tex-image-and-sub-image-3d' +
-        '-with-svg-image-rgb5_a1-rgba-unsigned_byte.html',
+    self.Fail('conformance2/textures/svg_image/' +
+        'tex-3d-rgb5_a1-rgba-unsigned_byte.html',
         ['win8'], bug=560555)
     self.Fail('conformance2/textures/image_bitmap_from_image_data/' +
-        'tex-image-and-sub-image-3d-with-image-bitmap-from-image-data-' +
-        'rgb565-rgb-unsigned_byte.html',
+        'tex-3d-rgb565-rgb-unsigned_byte.html',
         ['win8'], bug=483282)
     self.Fail('conformance2/textures/image_bitmap_from_image_data/' +
-        'tex-image-and-sub-image-3d-with-image-bitmap-from-image-data-' +
-        'rgb5_a1-rgba-unsigned_byte.html',
+        'tex-3d-rgb5_a1-rgba-unsigned_byte.html',
         ['win8'], bug=483282)
     self.Fail('conformance2/textures/image_bitmap_from_image/' +
-        'tex-image-and-sub-image-3d-with-image-bitmap-from-image-' +
-        'rgb565-rgb-unsigned_byte.html',
+        'tex-3d-rgb565-rgb-unsigned_byte.html',
         ['win8'], bug=483282)
     self.Fail('conformance2/textures/image_bitmap_from_image/' +
-        'tex-image-and-sub-image-3d-with-image-bitmap-from-image-' +
-        'rgb5_a1-rgba-unsigned_byte.html',
+        'tex-3d-rgb5_a1-rgba-unsigned_byte.html',
         ['win8'], bug=483282)
     self.Fail('conformance2/textures/image_bitmap_from_video/' +
-        'tex-image-and-sub-image-3d-with-image-bitmap-from-video-' +
-        'rgb565-rgb-unsigned_byte.html',
+        'tex-3d-rgb565-rgb-unsigned_byte.html',
         ['win8'], bug=483282)
     self.Fail('conformance2/textures/image_bitmap_from_video/' +
-        'tex-image-and-sub-image-3d-with-image-bitmap-from-video-' +
-        'rgb5_a1-rgba-unsigned_byte.html',
+        'tex-3d-rgb5_a1-rgba-unsigned_byte.html',
         ['win8'], bug=483282)
-    self.Fail('conformance2/textures/canvas/tex-image-and-sub-image-3d' +
-        '-with-canvas-rgb5_a1-rgba-unsigned_byte.html',
+    self.Fail('conformance2/textures/canvas/' +
+        'tex-3d-rgb5_a1-rgba-unsigned_byte.html',
         ['win8'], bug=560555)
-    self.Fail('conformance2/textures/canvas/tex-image-and-sub-image-3d' +
-        '-with-canvas-rgb565-rgb-unsigned_byte.html',
+    self.Fail('conformance2/textures/canvas/' +
+        'tex-3d-rgb565-rgb-unsigned_byte.html',
         ['win8'], bug=560555)
-    self.Fail('conformance2/textures/webgl_canvas/tex-image-and-sub-image-3d' +
-        '-with-webgl-canvas-rgb5_a1-rgba-unsigned_byte.html',
+    self.Fail('conformance2/textures/webgl_canvas/' +
+        'tex-3d-rgb5_a1-rgba-unsigned_byte.html',
         ['win8'], bug=560555)
-    self.Fail('conformance2/textures/webgl_canvas/tex-image-and-sub-image-3d' +
-        '-with-webgl-canvas-rgb565-rgb-unsigned_byte.html',
+    self.Fail('conformance2/textures/webgl_canvas/' +
+        'tex-3d-rgb565-rgb-unsigned_byte.html',
         ['win8'], bug=560555)
     self.Fail('conformance2/textures/image_bitmap_from_canvas/' +
-        'tex-image-and-sub-image-3d-with-image-bitmap-from-canvas-' +
-        'rgb565-rgb-unsigned_byte.html',
+        'tex-3d-rgb565-rgb-unsigned_byte.html',
         ['win8'], bug=483282)
     self.Fail('conformance2/textures/image_bitmap_from_canvas/' +
-        'tex-image-and-sub-image-3d-with-image-bitmap-from-canvas-' +
-        'rgb5_a1-rgba-unsigned_byte.html',
+        'tex-3d-rgb5_a1-rgba-unsigned_byte.html',
         ['win8'], bug=483282)
     self.Fail('conformance2/textures/image_bitmap_from_blob/' +
-        'tex-image-and-sub-image-3d-with-image-bitmap-from-blob-' +
-        'rgb565-rgb-unsigned_byte.html',
+        'tex-3d-rgb565-rgb-unsigned_byte.html',
         ['win8'], bug=483282)
     self.Fail('conformance2/textures/image_bitmap_from_blob/' +
-        'tex-image-and-sub-image-3d-with-image-bitmap-from-blob-' +
-        'rgb5_a1-rgba-unsigned_byte.html',
+        'tex-3d-rgb5_a1-rgba-unsigned_byte.html',
         ['win8'], bug=483282)
     self.Fail('conformance2/textures/image_bitmap_from_image_bitmap/' +
-        'tex-image-and-sub-image-3d-with-image-bitmap-from-image-bitmap-' +
-        'rgb565-rgb-unsigned_byte.html',
+        'tex-3d-rgb565-rgb-unsigned_byte.html',
         ['win8'], bug=483282)
     self.Fail('conformance2/textures/image_bitmap_from_image_bitmap/' +
-        'tex-image-and-sub-image-3d-with-image-bitmap-from-image-bitmap-' +
-        'rgb5_a1-rgba-unsigned_byte.html',
+        'tex-3d-rgb5_a1-rgba-unsigned_byte.html',
         ['win8'], bug=483282)
 
     # Windows Debug. Causing assertions in the GPU process which raise
     # a dialog box, so have to skip them rather than mark them as
     # failing.
-    self.Skip('conformance2/textures/canvas/tex-image-and-sub-image-2d' +
-        '-with-canvas-rgba8-rgba-unsigned_byte.html',
+    self.Skip('conformance2/textures/canvas/' +
+        'tex-2d-rgba8-rgba-unsigned_byte.html',
         ['win', 'debug'], bug=542901)
 
     # Win / AMD flakiness seen on the FYI waterfall.
@@ -331,18 +307,6 @@
     self.Fail('conformance2/buffers/uniform-buffers.html',
         ['win', 'intel'], bug=483282)
 
-    # Win7 / NVidia / GeForce GT 730
-    # The following two use wildcards because the file names are over
-    # 255 characters and are causing problems on the Windows bots.
-    self.Fail('conformance2/textures/image_bitmap_from_image_bitmap/' +
-        'tex-image-and-sub-image-2d-with-image-bitmap-from-image-bitmap-' +
-        'r11f_g11f_b10f-*.html',
-        ['win7', ('nvidia', 0xf02)], bug=483282)
-    self.Fail('conformance2/textures/image_bitmap_from_image_bitmap/' +
-        'tex-image-and-sub-image-3d-with-image-bitmap-from-image-bitmap-' +
-        'r11f_g11f_b10f-*.html',
-        ['win7', ('nvidia', 0xf02)], bug=483282)
-
     # Mac only.
     self.Skip('deqp/data/gles3/shaders/qualification_order.html',
         ['mac'], bug=483282)
diff --git a/content/test/gpu/gpu_tests/webgl_conformance_expectations.py b/content/test/gpu/gpu_tests/webgl_conformance_expectations.py
index 5393589..c350d15 100644
--- a/content/test/gpu/gpu_tests/webgl_conformance_expectations.py
+++ b/content/test/gpu/gpu_tests/webgl_conformance_expectations.py
@@ -141,22 +141,18 @@
 
     # Mac AMD failures
     self.Fail('conformance/textures/image_bitmap_from_image/' +
-        'tex-image-and-sub-image-2d-with-image-bitmap-from-image-' +
-        'rgb-rgb-unsigned_byte.html',
+        'tex-2d-rgb-rgb-unsigned_byte.html',
         ['mac', ('amd', 0x679e)], bug=589930)
     self.Fail('conformance/textures/image_bitmap_from_image/' +
-        'tex-image-and-sub-image-2d-with-image-bitmap-from-image-' +
-        'rgba-rgba-unsigned_byte.html',
+        'tex-2d-rgba-rgba-unsigned_byte.html',
         ['mac', ('amd', 0x679e)], bug=589930)
 
     # Mac Intel failures
     self.Fail('conformance/textures/image_bitmap_from_image/' +
-        'tex-image-and-sub-image-2d-with-image-bitmap-from-image-' +
-        'rgb-rgb-unsigned_byte.html',
+        'tex-2d-rgb-rgb-unsigned_byte.html',
         ['mac', 'intel'], bug=589930)
     self.Fail('conformance/textures/image_bitmap_from_image/' +
-        'tex-image-and-sub-image-2d-with-image-bitmap-from-image-' +
-        'rgba-rgba-unsigned_byte.html',
+        'tex-2d-rgba-rgba-unsigned_byte.html',
         ['mac', 'intel'], bug=589930)
 
     # Linux failures
@@ -166,8 +162,7 @@
     self.Flaky('conformance/extensions/oes-element-index-uint.html',
                ['linux', 'nvidia'], bug=524144)
     self.Flaky('conformance/textures/image/' +
-               'tex-image-and-sub-image-2d-with-image-' +
-               'rgb-rgb-unsigned_byte.html',
+               'tex-2d-rgb-rgb-unsigned_byte.html',
                ['linux', 'nvidia'], bug=596622)
     # AMD
     self.Flaky('conformance/more/functions/uniformi.html',
@@ -233,28 +228,27 @@
         ['android'], bug=478572)
     self.Fail('deqp/data/gles2/shaders/linkage.html',
         ['android'], bug=478572)
-    self.Fail('conformance/textures/image/tex-image-and-sub-image-2d-' +
-              'with-image-rgb-rgb-unsigned_byte.html',
+    self.Fail('conformance/textures/image/tex-2d-rgb-rgb-unsigned_byte.html',
         ['android'], bug=586183)
     # The following tests timed out on android, so skip them for now.
     self.Skip('conformance/textures/image_bitmap_from_video/*',
         ['android'], bug=585108)
     # The following WebView crashes are causing problems with further
     # tests in the suite, so skip them for now.
-    self.Skip('conformance/textures/video/tex-image-and-sub-image-2d-with-' +
-        'video-rgb-rgb-unsigned_byte.html',
+    self.Skip('conformance/textures/video/' +
+        'tex-2d-rgb-rgb-unsigned_byte.html',
         ['android', 'android-webview-shell'], bug=352645)
-    self.Skip('conformance/textures/video/tex-image-and-sub-image-2d-with-' +
-        'video-rgb-rgb-unsigned_short_5_6_5.html',
+    self.Skip('conformance/textures/video/' +
+        'tex-2d-rgb-rgb-unsigned_short_5_6_5.html',
         ['android', 'android-webview-shell'], bug=352645)
-    self.Skip('conformance/textures/video/tex-image-and-sub-image-2d-with-' +
-        'video-rgba-rgba-unsigned_byte.html',
+    self.Skip('conformance/textures/video/' +
+        'tex-2d-rgba-rgba-unsigned_byte.html',
         ['android', 'android-webview-shell'], bug=352645)
-    self.Skip('conformance/textures/video/tex-image-and-sub-image-2d-with-' +
-        'video-rgba-rgba-unsigned_short_4_4_4_4.html',
+    self.Skip('conformance/textures/video/' +
+        'tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html',
         ['android', 'android-webview-shell'], bug=352645)
-    self.Skip('conformance/textures/video/tex-image-and-sub-image-2d-with-' +
-        'video-rgba-rgba-unsigned_short_5_5_5_1.html',
+    self.Skip('conformance/textures/video/' +
+        'tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html',
         ['android', 'android-webview-shell'], bug=352645)
     self.Skip('conformance/textures/misc/texture-npot-video.html',
         ['android', 'android-webview-shell'], bug=352645)
@@ -294,24 +288,24 @@
         ['android', ('qualcomm', 'Adreno (TM) 420')], bug=585108)
     self.Fail('conformance/textures/image_bitmap_from_image_bitmap/*',
         ['android', ('qualcomm', 'Adreno (TM) 420')], bug=598262)
-    self.Fail('conformance/textures/video/tex-image-and-sub-image-2d-with-' +
-        'video-rgb-rgb-unsigned_byte.html',
+    self.Fail('conformance/textures/video/' +
+        'tex-2d-rgb-rgb-unsigned_byte.html',
         ['android', 'android-content-shell',
          ('qualcomm', 'Adreno (TM) 420')], bug=499555)
-    self.Fail('conformance/textures/video/tex-image-and-sub-image-2d-with-' +
-        'video-rgba-rgba-unsigned_byte.html',
+    self.Fail('conformance/textures/video/' +
+        'tex-2d-rgba-rgba-unsigned_byte.html',
         ['android', 'android-content-shell',
          ('qualcomm', 'Adreno (TM) 420')], bug=499555)
-    self.Fail('conformance/textures/video/tex-image-and-sub-image-2d-with-' +
-        'video-rgb-rgb-unsigned_short_5_6_5.html',
+    self.Fail('conformance/textures/video/' +
+        'tex-2d-rgb-rgb-unsigned_short_5_6_5.html',
         ['android', 'android-content-shell',
          ('qualcomm', 'Adreno (TM) 420')], bug=499555)
-    self.Fail('conformance/textures/video/tex-image-and-sub-image-2d-with-' +
-        'video-rgba-rgba-unsigned_short_4_4_4_4.html',
+    self.Fail('conformance/textures/video/' +
+        'tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html',
         ['android', 'android-content-shell',
          ('qualcomm', 'Adreno (TM) 420')], bug=499555)
-    self.Fail('conformance/textures/video/tex-image-and-sub-image-2d-with-' +
-        'video-rgba-rgba-unsigned_short_5_5_5_1.html',
+    self.Fail('conformance/textures/video/' +
+        'tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html',
         ['android', 'android-content-shell',
          ('qualcomm', 'Adreno (TM) 420')], bug=499555)
     # bindBufferBadArgs is causing the GPU thread to crash, taking
diff --git a/content/test/gpu/page_sets/pixel_tests.py b/content/test/gpu/page_sets/pixel_tests.py
index 3be192a..8a6de02 100644
--- a/content/test/gpu/page_sets/pixel_tests.py
+++ b/content/test/gpu/page_sets/pixel_tests.py
@@ -74,8 +74,8 @@
       self.AddStory(PixelTestsPage(
         url='file://../../data/gpu/pixel_canvas2d_webgl.html',
         name=base_name + '.IOSurface2DCanvasWebGL',
-        test_rect=[0, 0, 400, 400],
-        revision=1,
+        test_rect=[0, 0, 300, 300],
+        revision=2,
         story_set=self,
         shared_page_state_class=IOSurface2DCanvasSharedPageState,
         expectations=expectations))
@@ -128,8 +128,8 @@
     self.AddStory(PixelTestsPage(
       url='file://../../data/gpu/pixel_canvas2d_webgl.html',
       name=base_name + '.2DCanvasWebGL',
-      test_rect=[0, 0, 400, 400],
-      revision=1,
+      test_rect=[0, 0, 300, 300],
+      revision=2,
       story_set=self,
       shared_page_state_class=shared_page_state_class,
       expectations=expectations))
diff --git a/content/test/test_render_view_host.cc b/content/test/test_render_view_host.cc
index a0f3e13..cce3414 100644
--- a/content/test/test_render_view_host.cc
+++ b/content/test/test_render_view_host.cc
@@ -121,7 +121,10 @@
   delete this;
 }
 
-void TestRenderWidgetHostView::Destroy() { delete this; }
+void TestRenderWidgetHostView::Destroy() {
+  NotifyHostDelegateAboutShutdown();
+  delete this;
+}
 
 gfx::Rect TestRenderWidgetHostView::GetViewBounds() const {
   return gfx::Rect();
diff --git a/content/test/test_render_view_host.h b/content/test/test_render_view_host.h
index 75a03cd..831773bb 100644
--- a/content/test/test_render_view_host.h
+++ b/content/test/test_render_view_host.h
@@ -31,7 +31,7 @@
 // To use, derive your test base class from RenderViewHostImplTestHarness.
 
 struct FrameHostMsg_DidCommitProvisionalLoad_Params;
-struct ViewHostMsg_TextInputState_Params;
+struct TextInputState;
 
 namespace gfx {
 class Rect;
@@ -99,8 +99,7 @@
   void Focus() override {}
   void SetIsLoading(bool is_loading) override {}
   void UpdateCursor(const WebCursor& cursor) override {}
-  void TextInputStateChanged(
-      const ViewHostMsg_TextInputState_Params& params) override {}
+  void UpdateInputMethodIfNecessary(bool text_input_state_changed) override {}
   void ImeCancelComposition() override {}
   void ImeCompositionRangeChanged(
       const gfx::Range& range,
diff --git a/device/bluetooth/bluetooth_low_energy_win.cc b/device/bluetooth/bluetooth_low_energy_win.cc
index 92c9a97..8c652ce 100644
--- a/device/bluetooth/bluetooth_low_energy_win.cc
+++ b/device/bluetooth/bluetooth_low_energy_win.cc
@@ -469,7 +469,7 @@
           device_info_handle, &device_info_data, result, error)) {
     // Only fail if not the GATT service device interface, which doesn't have a
     // friendly name.
-    if (device_info_data.ClassGuid !=
+    if (device_interface_data->InterfaceClassGuid !=
         GUID_BLUETOOTH_GATT_SERVICE_DEVICE_INTERFACE)
       return false;
   }
diff --git a/device/usb/usb_device_handle_impl.cc b/device/usb/usb_device_handle_impl.cc
index 276da10..8f40f4b 100644
--- a/device/usb/usb_device_handle_impl.cc
+++ b/device/usb/usb_device_handle_impl.cc
@@ -560,8 +560,29 @@
 
 void UsbDeviceHandleImpl::Close() {
   DCHECK(thread_checker_.CalledOnValidThread());
-  if (device_)
-    device_->Close(this);
+  if (!device_)
+    return;
+
+  // Cancel all the transfers, their callbacks will be called some time later.
+  for (Transfer* transfer : transfers_)
+    transfer->Cancel();
+
+  // Release all remaining interfaces once their transfers have completed.
+  // This loop must ensure that what may be the final reference is released on
+  // the right thread.
+  for (auto& map_entry : claimed_interfaces_) {
+    InterfaceClaimer* interface_claimer = map_entry.second.get();
+    interface_claimer->AddRef();
+    map_entry.second = nullptr;
+    blocking_task_runner_->ReleaseSoon(FROM_HERE, interface_claimer);
+  }
+
+  device_->HandleClosed(this);
+  device_ = nullptr;
+
+  // The device handle cannot be closed here. When libusb_cancel_transfer is
+  // finished the last references to this device will be released and the
+  // destructor will close the handle.
 }
 
 void UsbDeviceHandleImpl::SetConfiguration(int configuration_value,
@@ -779,6 +800,8 @@
 }
 
 UsbDeviceHandleImpl::~UsbDeviceHandleImpl() {
+  DCHECK(!device_) << "UsbDeviceHandle must be closed before it is destroyed.";
+
   // This class is RefCountedThreadSafe and so the destructor may be called on
   // any thread. libusb is not safe to reentrancy so be sure not to try to close
   // the device from inside a transfer completion callback.
@@ -1103,30 +1126,4 @@
   blocking_task_runner_->DeleteSoon(FROM_HERE, transfer);
 }
 
-void UsbDeviceHandleImpl::InternalClose() {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  if (!device_)
-    return;
-
-  // Cancel all the transfers.
-  for (Transfer* transfer : transfers_) {
-    // The callback will be called some time later.
-    transfer->Cancel();
-  }
-
-  // Release all remaining interfaces once their transfers have completed.
-  // This loop must ensure that what may be the final reference is released on
-  // the right thread.
-  for (auto& map_entry : claimed_interfaces_) {
-    InterfaceClaimer* interface_claimer = map_entry.second.get();
-    interface_claimer->AddRef();
-    map_entry.second = nullptr;
-    blocking_task_runner_->ReleaseSoon(FROM_HERE, interface_claimer);
-  }
-
-  // Cannot close device handle here. Need to wait for libusb_cancel_transfer to
-  // finish.
-  device_ = nullptr;
-}
-
 }  // namespace device
diff --git a/device/usb/usb_device_handle_impl.h b/device/usb/usb_device_handle_impl.h
index ed722bbd..6365383a 100644
--- a/device/usb/usb_device_handle_impl.h
+++ b/device/usb/usb_device_handle_impl.h
@@ -185,9 +185,6 @@
   // completion callback.
   void TransferComplete(Transfer* transfer, const base::Closure& callback);
 
-  // Informs the object to drop internal references.
-  void InternalClose();
-
   scoped_refptr<UsbDeviceImpl> device_;
 
   PlatformUsbDeviceHandle handle_;
diff --git a/device/usb/usb_device_impl.cc b/device/usb/usb_device_impl.cc
index d613204..0b8be8143 100644
--- a/device/usb/usb_device_impl.cc
+++ b/device/usb/usb_device_impl.cc
@@ -197,17 +197,10 @@
 #endif  // defined(OS_CHROMEOS)
 }
 
-void UsbDeviceImpl::Close(scoped_refptr<UsbDeviceHandle> handle) {
+void UsbDeviceImpl::HandleClosed(scoped_refptr<UsbDeviceHandle> handle) {
   DCHECK(thread_checker_.CalledOnValidThread());
-
-  for (HandlesVector::iterator it = handles_.begin(); it != handles_.end();
-       ++it) {
-    if (it->get() == handle.get()) {
-      (*it)->InternalClose();
-      handles_.erase(it);
-      return;
-    }
-  }
+  DCHECK(ContainsValue(handles_, handle.get()));
+  handles_.remove(handle.get());
 }
 
 const UsbConfigDescriptor* UsbDeviceImpl::GetActiveConfiguration() const {
@@ -217,15 +210,8 @@
 
 void UsbDeviceImpl::OnDisconnect() {
   DCHECK(thread_checker_.CalledOnValidThread());
-
-  // Swap the list of handles into a local variable because closing all open
-  // handles may release the last reference to this object.
-  HandlesVector handles;
-  swap(handles, handles_);
-
-  for (const scoped_refptr<UsbDeviceHandleImpl>& handle : handles_) {
-    handle->InternalClose();
-  }
+  for (UsbDeviceHandle* handle : handles_)
+    handle->Close();
 }
 
 void UsbDeviceImpl::ReadAllConfigurations() {
@@ -333,7 +319,7 @@
   DCHECK(thread_checker_.CalledOnValidThread());
   scoped_refptr<UsbDeviceHandleImpl> device_handle = new UsbDeviceHandleImpl(
       context_, this, platform_handle, blocking_task_runner_);
-  handles_.push_back(device_handle);
+  handles_.push_back(device_handle.get());
   callback.Run(device_handle);
 }
 
diff --git a/device/usb/usb_device_impl.h b/device/usb/usb_device_impl.h
index 9a4f8c3..f606816 100644
--- a/device/usb/usb_device_impl.h
+++ b/device/usb/usb_device_impl.h
@@ -7,9 +7,9 @@
 
 #include <stdint.h>
 
+#include <list>
 #include <string>
 #include <utility>
-#include <vector>
 
 #include "base/callback.h"
 #include "base/macros.h"
@@ -89,7 +89,7 @@
   void ReadAllConfigurations();
 
   // Called by UsbDeviceHandleImpl.
-  void Close(scoped_refptr<UsbDeviceHandle> handle);
+  void HandleClosed(scoped_refptr<UsbDeviceHandle> handle);
   void RefreshActiveConfiguration();
 
  private:
@@ -124,8 +124,7 @@
   scoped_refptr<UsbContext> context_;
 
   // Opened handles.
-  typedef std::vector<scoped_refptr<UsbDeviceHandleImpl> > HandlesVector;
-  HandlesVector handles_;
+  std::list<UsbDeviceHandle*> handles_;
 
   scoped_refptr<base::SequencedTaskRunner> task_runner_;
   scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
diff --git a/extensions/browser/api/cast_channel/cast_auth_ica.cc b/extensions/browser/api/cast_channel/cast_auth_ica.cc
deleted file mode 100644
index 8e6b38ab..0000000
--- a/extensions/browser/api/cast_channel/cast_auth_ica.cc
+++ /dev/null
@@ -1,164 +0,0 @@
-// Copyright 2014 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 "extensions/browser/api/cast_channel/cast_auth_ica.h"
-
-#include <stdint.h>
-
-#include "base/base64.h"
-#include "base/lazy_instance.h"
-#include "crypto/signature_verifier.h"
-#include "extensions/browser/api/cast_channel/cast_auth_util.h"
-#include "extensions/common/api/cast_channel/authority_keys.pb.h"
-#include "net/base/hash_value.h"
-#include "net/cert/x509_certificate.h"
-
-namespace extensions {
-namespace api {
-namespace cast_channel {
-namespace {
-
-// Fingerprint of the default ICA.
-static const net::SHA256HashValue kDefaultFingerprintICA = { {
-    0x52, 0x9D, 0x9C, 0xD6, 0x7F, 0xE5, 0xEB, 0x69, 0x8E, 0x70, 0xDD, 0x26,
-    0xD7, 0xD8, 0xF1, 0x26, 0x59, 0xF1, 0xE6, 0xE5, 0x23, 0x48, 0xBF, 0x6A,
-    0x5C, 0xF7, 0x16, 0xE1, 0x3F, 0x41, 0x0E, 0x73
-} };
-
-// Built in public key for verifying trusted authorities data.
-const uint8_t kPublicKey[] = {
-    0x30, 0x82, 0x01, 0x22, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86,
-    0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0F, 0x00,
-    0x30, 0x82, 0x01, 0x0A, 0x02, 0x82, 0x01, 0x01, 0x00, 0xC3, 0x8D, 0xEC,
-    0xF5, 0x94, 0x4C, 0x66, 0x90, 0xFC, 0x08, 0xED, 0x6E, 0x7D, 0xD0, 0xD6,
-    0x93, 0x62, 0x94, 0x86, 0xFB, 0xBA, 0x6F, 0x06, 0xD5, 0x26, 0xAD, 0x52,
-    0x84, 0x5A, 0x68, 0x52, 0xF1, 0xA9, 0x46, 0x04, 0x78, 0xC0, 0xA1, 0x0F,
-    0x72, 0xCE, 0x1C, 0xB3, 0xD2, 0x34, 0xFA, 0x28, 0xD0, 0xA6, 0x2D, 0xDF,
-    0xDF, 0x0C, 0x6C, 0x30, 0xCF, 0xF3, 0x67, 0x0E, 0xCE, 0xDD, 0x2D, 0x02,
-    0x20, 0x05, 0x7D, 0x7F, 0x81, 0x19, 0xBC, 0x42, 0x74, 0xC0, 0x11, 0xC4,
-    0x7F, 0x31, 0x0B, 0x63, 0xE7, 0x2E, 0xFE, 0xA4, 0x20, 0xE5, 0xD8, 0x19,
-    0xE1, 0xBE, 0x25, 0x41, 0x88, 0xFA, 0xBB, 0x51, 0xFF, 0x84, 0x9E, 0x37,
-    0x03, 0xAE, 0xAF, 0x41, 0x4E, 0x4B, 0x75, 0xF8, 0x73, 0x79, 0x20, 0x2B,
-    0xA0, 0xE9, 0xFC, 0xD6, 0x03, 0x50, 0x1B, 0x2A, 0x6B, 0x31, 0xE8, 0x75,
-    0x13, 0xB6, 0xEC, 0xE4, 0x5D, 0x2A, 0x3E, 0xE5, 0x49, 0x44, 0xBF, 0xE2,
-    0xC2, 0x4A, 0x7B, 0xC8, 0xC2, 0xC9, 0x89, 0xEF, 0x1A, 0x67, 0x37, 0xB7,
-    0x52, 0x93, 0x86, 0x69, 0xA4, 0x1A, 0x2C, 0x69, 0xD2, 0x03, 0x93, 0x15,
-    0x02, 0x97, 0xB6, 0xF7, 0x55, 0x87, 0x5B, 0xAA, 0x73, 0x12, 0x3F, 0xDD,
-    0x32, 0x16, 0x3B, 0x8E, 0xD9, 0xD9, 0x49, 0x06, 0x65, 0xAD, 0x28, 0x49,
-    0xEA, 0x0F, 0x7E, 0x6A, 0x04, 0xF7, 0x89, 0x79, 0x8F, 0xCE, 0x3E, 0xD2,
-    0x89, 0x6C, 0x43, 0x4B, 0x34, 0xBF, 0x42, 0x65, 0x2B, 0x09, 0x2F, 0x5C,
-    0xCA, 0x46, 0x1C, 0x22, 0x36, 0x78, 0xEA, 0x98, 0x49, 0xA4, 0x0E, 0xAB,
-    0x97, 0x0A, 0x76, 0xCD, 0x52, 0x99, 0x42, 0x44, 0xC2, 0x52, 0x40, 0x62,
-    0x34, 0xC4, 0xCD, 0xE3, 0x3D, 0xCA, 0xE1, 0x33, 0x99, 0xE9, 0xF4, 0x6E,
-    0xEB, 0xB0, 0x5D, 0xA5, 0x84, 0xA2, 0x5C, 0xC7, 0xBB, 0x14, 0x67, 0x0C,
-    0x4F, 0x02, 0x03, 0x01, 0x00, 0x01};
-
-// Verifies signature of the data using built-in public key.
-bool VerifySignature(const std::string& signature, const std::string& data) {
-  if (signature.size() != 256)
-    return false;
-
-  crypto::SignatureVerifier verifier;
-  crypto::SignatureVerifier::HashAlgorithm hash_alg =
-      crypto::SignatureVerifier::SHA256;
-  crypto::SignatureVerifier::HashAlgorithm mask_hash_alg = hash_alg;
-  unsigned int hash_len = 32;
-
-  if (!verifier.VerifyInitRSAPSS(
-          hash_alg, mask_hash_alg, hash_len,
-          reinterpret_cast<const uint8_t*>(signature.data()), signature.size(),
-          kPublicKey, sizeof(kPublicKey))) {
-    return false;
-  }
-
-  verifier.VerifyUpdate(reinterpret_cast<const uint8_t*>(data.data()),
-                        data.size());
-
-  return verifier.VerifyFinal();
-}
-
-}  // namespace
-
-AuthorityKeyStore::AuthorityKeyStore() {
-}
-
-AuthorityKeyStore::~AuthorityKeyStore() {
-}
-
-base::StringPiece AuthorityKeyStore::GetICAPublicKeyFromFingerprint(
-    const net::SHA256HashValue& fingerprint) {
-  AuthorityKeysMap::const_iterator it =
-      certificate_authorities_.find(fingerprint);
-  return (it == certificate_authorities_.end()) ? base::StringPiece()
-                                                : (*it).second;
-}
-
-base::StringPiece AuthorityKeyStore::GetDefaultICAPublicKey() {
-  return GetICAPublicKeyFromFingerprint(kDefaultFingerprintICA);
-}
-
-bool AuthorityKeyStore::Load(const std::string& keys) {
-  certificate_authorities_.clear();
-  authority_keys_.reset(new proto::AuthorityKeys());
-
-  if (!authority_keys_->ParseFromString(keys))
-    return false;
-
-  for (int i = 0; i < authority_keys_->keys_size(); i++) {
-    const std::string& fingerprint = authority_keys_->keys(i).fingerprint();
-    net::SHA256HashValue hash;
-    // Ensure it's the size of SHA-256 fingerprint data.
-    if (fingerprint.size() != sizeof(hash.data)) {
-      return false;
-    }
-    memcpy(hash.data, fingerprint.data(), sizeof(hash.data));
-    const std::string& public_key = authority_keys_->keys(i).public_key();
-    certificate_authorities_.insert(
-        make_pair(hash, base::StringPiece(public_key)));
-  }
-
-  return true;
-}
-
-// Trusted certificate authorities.
-static base::LazyInstance<AuthorityKeyStore>::Leaky g_authority_keys_store =
-    LAZY_INSTANCE_INITIALIZER;
-
-bool SetTrustedCertificateAuthorities(const std::string& keys,
-                                      const std::string& signature) {
-  std::string decoded_keys;
-  if (!base::Base64Decode(keys, &decoded_keys))
-    return false;
-
-  std::string decoded_signature;
-  if (!base::Base64Decode(signature, &decoded_signature))
-    return false;
-
-  if (!VerifySignature(decoded_signature, decoded_keys))
-    return false;
-
-  return g_authority_keys_store.Get().Load(decoded_keys);
-}
-
-base::StringPiece GetTrustedICAPublicKey(const base::StringPiece& data) {
-  AuthorityKeyStore& authority_keys_store = g_authority_keys_store.Get();
-  scoped_refptr<net::X509Certificate> ica_cert =
-      net::X509Certificate::CreateFromBytes(data.data(), data.size());
-  if (!ica_cert.get()) {
-    LOG(ERROR) << "Invalid ICA certificate.";
-    return "";
-  }
-  return authority_keys_store.GetICAPublicKeyFromFingerprint(
-      net::X509Certificate::CalculateFingerprint256(
-          ica_cert->os_cert_handle()));
-}
-
-base::StringPiece GetDefaultTrustedICAPublicKey() {
-  AuthorityKeyStore& authority_keys_store = g_authority_keys_store.Get();
-  return authority_keys_store.GetDefaultICAPublicKey();
-}
-
-}  // namespace cast_channel
-}  // namespace api
-}  // namespace extensions
diff --git a/extensions/browser/api/cast_channel/cast_auth_ica.h b/extensions/browser/api/cast_channel/cast_auth_ica.h
deleted file mode 100644
index ec51f66..0000000
--- a/extensions/browser/api/cast_channel/cast_auth_ica.h
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2014 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 EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_AUTH_ICA_H_
-#define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_AUTH_ICA_H_
-
-#include <stddef.h>
-
-#include <map>
-#include <string>
-
-#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/strings/string_piece.h"
-#include "net/base/hash_value.h"
-
-namespace extensions {
-namespace api {
-namespace cast_channel {
-
-typedef std::map<net::SHA256HashValue,
-                 base::StringPiece,
-                 net::SHA256HashValueLessThan> AuthorityKeysMap;
-
-namespace proto {
-
-// Forward declaration to avoid including generated protobuf header.
-class AuthorityKeys;
-
-}  // namespace proto
-
-// AuthorityKeyStore is a helper class that is used to store and manipulate
-// intermediate CAs (ICAs) information used to authenticate cast devices.
-// A static list of ICAs is hardcoded and may optionally be replaced during
-// runtime by an extension supplying a protobuf of ICAs information signed with
-// known key.
-class AuthorityKeyStore {
- public:
-  AuthorityKeyStore();
-  ~AuthorityKeyStore();
-
-  // Returns the public key of the ICA whose fingerprint matches |fingerprint|.
-  // Returns an empty StringPiece if no such ICA is found.
-  // Note: the returned StringPiece is invalidated if Load() is called.
-  base::StringPiece GetICAPublicKeyFromFingerprint(
-      const net::SHA256HashValue& fingerprint);
-
-  // Returns the public key of the default / original cast ICA.
-  // Returns an empty StringPiece if the default cast ICA is not found.
-  // Note: the returned StringPiece is invalidated if Load() is called.
-  base::StringPiece GetDefaultICAPublicKey();
-
-  // Replaces stored authority keys with the keys loaded from a serialized
-  // protobuf.
-  bool Load(const std::string& keys);
-
- private:
-  // The map of trusted certificate authorities - fingerprints to public keys.
-  AuthorityKeysMap certificate_authorities_;
-
-  // Trusted certificate authorities data passed from the extension.
-  scoped_ptr<proto::AuthorityKeys> authority_keys_;
-
-  DISALLOW_COPY_AND_ASSIGN(AuthorityKeyStore);
-};
-
-// Sets trusted certificate authorities.
-bool SetTrustedCertificateAuthorities(const std::string& keys,
-                                      const std::string& signature);
-
-// Gets the trusted ICA entry for the cert represented by |data|.
-// Returns the serialized certificate as bytes if the ICA was found.
-// Returns an empty-length StringPiece if the ICA was not found.
-base::StringPiece GetTrustedICAPublicKey(const base::StringPiece& data);
-
-// Gets the default trusted ICA for legacy compatibility.
-base::StringPiece GetDefaultTrustedICAPublicKey();
-
-}  // namespace cast_channel
-}  // namespace api
-}  // namespace extensions
-
-#endif  // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_AUTH_ICA_H_
diff --git a/extensions/browser/api/cast_channel/cast_auth_ica_unittest.cc b/extensions/browser/api/cast_channel/cast_auth_ica_unittest.cc
deleted file mode 100644
index 9005242..0000000
--- a/extensions/browser/api/cast_channel/cast_auth_ica_unittest.cc
+++ /dev/null
@@ -1,151 +0,0 @@
-// Copyright 2014 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 "extensions/browser/api/cast_channel/cast_auth_ica.h"
-
-#include <string>
-
-#include "base/base64.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace extensions {
-
-namespace api {
-
-namespace cast_channel {
-
-namespace {
-
-static const net::SHA256HashValue kFingerprintValid1 = {{
-    0x52, 0x9D, 0x9C, 0xD6, 0x7F, 0xE5, 0xEB, 0x69, 0x8E, 0x70, 0xDD, 0x26,
-    0xD7, 0xD8, 0xF1, 0x26, 0x59, 0xF1, 0xE6, 0xE5, 0x23, 0x48, 0xBF, 0x6A,
-    0x5C, 0xF7, 0x16, 0xE1, 0x3F, 0x41, 0x0E, 0x73
-}};
-
-static const net::SHA256HashValue kFingerprintValid2 = {{
-    0xA2, 0x48, 0xC2, 0xE8, 0x54, 0xE6, 0x56, 0xA5, 0x6D, 0xE8, 0x23, 0x1F,
-    0x1E, 0xE1, 0x75, 0x6F, 0xDB, 0xE4, 0x07, 0xF9, 0xFE, 0xD4, 0x65, 0x0D,
-    0x60, 0xCC, 0x5A, 0xCB, 0x65, 0x11, 0xC7, 0x20
-}};
-
-static const net::SHA256HashValue kFingerprintInvalid = {{
-    0x00, 0x9D, 0x9C, 0xD6, 0x7F, 0xE5, 0xEB, 0x69, 0x8E, 0x70, 0xDD, 0x26,
-    0xD7, 0xD8, 0xF1, 0x26, 0x59, 0xF1, 0xE6, 0xE5, 0x23, 0x48, 0xBF, 0x6A,
-    0x5C, 0xF7, 0x16, 0xE1, 0x3F, 0x41, 0x0E, 0x73
-}};
-
-}  // namespace
-
-class CastChannelAuthorityKeysTest : public testing::Test {
- public:
-  CastChannelAuthorityKeysTest() {}
-  ~CastChannelAuthorityKeysTest() override {}
-
- protected:
-  void ExpectKeysLoaded();
-  AuthorityKeyStore authority_keys_store_;
-};
-
-void CastChannelAuthorityKeysTest::ExpectKeysLoaded() {
-  base::StringPiece key = authority_keys_store_.GetDefaultICAPublicKey();
-  EXPECT_FALSE(key.empty());
-
-  key =
-      authority_keys_store_.GetICAPublicKeyFromFingerprint(kFingerprintValid1);
-  EXPECT_FALSE(key.empty());
-
-  key =
-      authority_keys_store_.GetICAPublicKeyFromFingerprint(kFingerprintInvalid);
-  EXPECT_TRUE(key.empty());
-}
-
-TEST_F(CastChannelAuthorityKeysTest, TestDefaultKeys) {
-  base::StringPiece key = authority_keys_store_.GetDefaultICAPublicKey();
-  EXPECT_TRUE(key.empty());
-}
-
-TEST_F(CastChannelAuthorityKeysTest, TestInvalidProtobuf) {
-  std::string keys = "test";
-  EXPECT_EQ(authority_keys_store_.Load(keys), false);
-
-  base::StringPiece key = authority_keys_store_.GetDefaultICAPublicKey();
-  EXPECT_TRUE(key.empty());
-}
-
-TEST_F(CastChannelAuthorityKeysTest, TestValidProtobuf) {
-  std::string keys =
-      "CrMCCiBSnZzWf+XraY5w3SbX2PEmWfHm5SNIv2pc9xbhP0EOcxKOAjCCAQoCggEBALwigL"
-      "2A9johADuudl41fz3DZFxVlIY0LwWHKM33aYwXs1CnuIL638dDLdZ+q6BvtxNygKRHFcEg"
-      "mVDN7BRiCVukmM3SQbY2Tv/oLjIwSoGoQqNsmzNuyrL1U2bgJ1OGGoUepzk/SneO+1RmZv"
-      "tYVMBeOcf1UAYL4IrUzuFqVR+LFwDmaaMn5gglaTwSnY0FLNYuojHetFJQ1iBJ3nGg+a0g"
-      "QBLx3SXr1ea4NvTWj3/KQ9zXEFvmP1GKhbPz//YDLcsjT5ytGOeTBYysUpr3TOmZer5ufk"
-      "0K48YcqZP6OqWRXRy9ZuvMYNyGdMrP+JIcmH1X+mFHnquAt+RIgCqSxRsCAwEAAQqzAgog"
-      "okjC6FTmVqVt6CMfHuF1b9vkB/n+1GUNYMxay2URxyASjgIwggEKAoIBAQCwDl4HOt+kX2"
-      "j3Icdk27Z27+6Lk/j2G4jhk7cX8BUeflJVdzwCjXtKbNO91sGccsizFc8RwfVGxNUgR/sw"
-      "9ORhDGjwXqs3jpvhvIHDcIp41oM0MpwZYuvknO3jZGxBHZzSi0hMI5CVs+dS6gVXzGCzuh"
-      "TkugA55EZVdM5ajnpnI9poCvrEhB60xaGianMfbsguL5qeqLEO/Yemj009SwXVNVp0TbyO"
-      "gkSW9LWVYE6l3yc9QVwHo7Q1WrOe8gUkys0xWg0mTNTT/VDhNOlMgVgwssd63YGJptQ6OI"
-      "QDtzSedz//eAdbmcGyHzVWbjo8DCXhV/aKfknAzIMRNeeRbS5lAgMBAAE=";
-
-  std::string decoded_keys;
-  EXPECT_EQ(base::Base64Decode(keys, &decoded_keys), true);
-  EXPECT_EQ(authority_keys_store_.Load(decoded_keys), true);
-
-  ExpectKeysLoaded();
-
-  base::StringPiece key =
-      authority_keys_store_.GetICAPublicKeyFromFingerprint(kFingerprintValid2);
-  EXPECT_FALSE(key.empty());
-}
-
-TEST_F(CastChannelAuthorityKeysTest, TestSetTrustedCertificateAuthorities) {
-  std::string keys =
-      "CrMCCiBSnZzWf+XraY5w3SbX2PEmWfHm5SNIv2pc9xbhP0EOcxKOAjCCAQoCggEBALwigL"
-      "2A9johADuudl41fz3DZFxVlIY0LwWHKM33aYwXs1CnuIL638dDLdZ+q6BvtxNygKRHFcEg"
-      "mVDN7BRiCVukmM3SQbY2Tv/oLjIwSoGoQqNsmzNuyrL1U2bgJ1OGGoUepzk/SneO+1RmZv"
-      "tYVMBeOcf1UAYL4IrUzuFqVR+LFwDmaaMn5gglaTwSnY0FLNYuojHetFJQ1iBJ3nGg+a0g"
-      "QBLx3SXr1ea4NvTWj3/KQ9zXEFvmP1GKhbPz//YDLcsjT5ytGOeTBYysUpr3TOmZer5ufk"
-      "0K48YcqZP6OqWRXRy9ZuvMYNyGdMrP+JIcmH1X+mFHnquAt+RIgCqSxRsCAwEAAQ==";
-  std::string signature =
-      "chCUHZKkykcwU8HzU+hm027fUTBL0dqPMtrzppwExQwK9+"
-      "XlmCjJswfce2sUUfhR1OL1tyW4hWFwu4JnuQCJ+CvmSmAh2bzRpnuSKzBfgvIDjNOAGUs7"
-      "ADaNSSWPLxp+6ko++2Dn4S9HpOt8N1v6gMWqj3Ru5IqFSQPZSvGH2ois6uE50CFayPcjQE"
-      "OVZt41noQdFd15RmKTvocoCC5tHNlaikeQ52yi0IScOlad1B1lMhoplW3rWophQaqxMumr"
-      "OcHIZ+Y+p858x5f8Pny/kuqUClmFh9B/vF07NsUHwoSL9tA5t5jCY3L5iUc/v7o3oFcW/T"
-      "gojKkX2Kg7KQ86QA==";
-  EXPECT_FALSE(SetTrustedCertificateAuthorities(keys, "signature"));
-  EXPECT_FALSE(SetTrustedCertificateAuthorities("keys", signature));
-  EXPECT_FALSE(SetTrustedCertificateAuthorities(keys, signature));
-  EXPECT_FALSE(SetTrustedCertificateAuthorities(std::string(), std::string()));
-
-  keys =
-      "CrMCCiBSnZzWf+XraY5w3SbX2PEmWfHm5SNIv2pc9xbhP0EOcxKOAjCCAQoCggEBALwigL"
-      "2A9johADuudl41fz3DZFxVlIY0LwWHKM33aYwXs1CnuIL638dDLdZ+q6BvtxNygKRHFcEg"
-      "mVDN7BRiCVukmM3SQbY2Tv/oLjIwSoGoQqNsmzNuyrL1U2bgJ1OGGoUepzk/SneO+1RmZv"
-      "tYVMBeOcf1UAYL4IrUzuFqVR+LFwDmaaMn5gglaTwSnY0FLNYuojHetFJQ1iBJ3nGg+a0g"
-      "QBLx3SXr1ea4NvTWj3/KQ9zXEFvmP1GKhbPz//YDLcsjT5ytGOeTBYysUpr3TOmZer5ufk"
-      "0K48YcqZP6OqWRXRy9ZuvMYNyGdMrP+JIcmH1X+mFHnquAt+RIgCqSxRsCAwEAAQqzAgog"
-      "okjC6FTmVqVt6CMfHuF1b9vkB/n+1GUNYMxay2URxyASjgIwggEKAoIBAQCwDl4HOt+kX2"
-      "j3Icdk27Z27+6Lk/j2G4jhk7cX8BUeflJVdzwCjXtKbNO91sGccsizFc8RwfVGxNUgR/sw"
-      "9ORhDGjwXqs3jpvhvIHDcIp41oM0MpwZYuvknO3jZGxBHZzSi0hMI5CVs+dS6gVXzGCzuh"
-      "TkugA55EZVdM5ajnpnI9poCvrEhB60xaGianMfbsguL5qeqLEO/Yemj009SwXVNVp0TbyO"
-      "gkSW9LWVYE6l3yc9QVwHo7Q1WrOe8gUkys0xWg0mTNTT/VDhNOlMgVgwssd63YGJptQ6OI"
-      "QDtzSedz//eAdbmcGyHzVWbjo8DCXhV/aKfknAzIMRNeeRbS5lAgMBAAE=";
-  signature =
-      "o83oku3jP+xjTysNBalqp/ZfJRPLt8R+IUhZMepbARFSRVizLoeFW5XyUwe6lQaC+PFFQH"
-      "SZeGZyeeGRpwCJ/lef0xh6SWJlVMWNTk5+z0U84GQdizJP/CTCeHpIwMobN+kyDajgOyfD"
-      "DLhktc6LHmSlFGG6J7B8W67oziS8ZFEdrcT9WSXFrjLVyURHjvidZD5iFtuImI6k9R9OoX"
-      "LR6SyAwpjdrL+vlHMk3Gol6KQ98YpF0ghHnN3/FFW4ibvIwjmRbp+tUV3h8TRcCOjlXVGp"
-      "bzPtNRRlTqfv7Rxm5YXkZMLmJJMZiTs5+o8FMRMTQZT4hRR3DQ+A/jofViyTGA==";
-  EXPECT_TRUE(SetTrustedCertificateAuthorities(keys, signature));
-
-  base::StringPiece result = GetDefaultTrustedICAPublicKey();
-  EXPECT_FALSE(result.empty());
-}
-
-}  // namespace cast_channel
-
-}  // namespace api
-
-}  // namespace extensions
diff --git a/extensions/browser/api/cast_channel/cast_auth_util.cc b/extensions/browser/api/cast_channel/cast_auth_util.cc
index bff63363..afc433e 100644
--- a/extensions/browser/api/cast_channel/cast_auth_util.cc
+++ b/extensions/browser/api/cast_channel/cast_auth_util.cc
@@ -14,6 +14,7 @@
 #include "extensions/common/api/cast_channel/cast_channel.pb.h"
 #include "extensions/common/cast/cast_cert_validator.h"
 #include "net/cert/x509_certificate.h"
+#include "net/der/parse_values.h"
 
 namespace extensions {
 namespace api {
@@ -22,9 +23,6 @@
 
 const char* const kParseErrorPrefix = "Failed to parse auth message: ";
 
-const unsigned char kAudioOnlyPolicy[] =
-    {0x06, 0x0A, 0x2B, 0x06, 0x01, 0x04, 0x01, 0xD6, 0x79, 0x02, 0x05, 0x02};
-
 // The maximum number of days a cert can live for.
 const int kMaxSelfSignedCertLifetimeInDays = 4;
 
@@ -65,32 +63,6 @@
   return AuthResult();
 }
 
-AuthResult TranslateVerificationResult(
-    const cast_crypto::VerificationResult& result) {
-  AuthResult translated;
-  translated.error_message = result.error_message;
-  switch (result.error_type) {
-    case cast_crypto::VerificationResult::ERROR_NONE:
-      translated.error_type = AuthResult::ERROR_NONE;
-      break;
-    case cast_crypto::VerificationResult::ERROR_CERT_INVALID:
-      translated.error_type = AuthResult::ERROR_CERT_PARSING_FAILED;
-      break;
-    case cast_crypto::VerificationResult::ERROR_CERT_UNTRUSTED:
-      translated.error_type = AuthResult::ERROR_CERT_NOT_SIGNED_BY_TRUSTED_CA;
-      break;
-    case cast_crypto::VerificationResult::ERROR_SIGNATURE_INVALID:
-      translated.error_type = AuthResult::ERROR_SIGNED_BLOBS_MISMATCH;
-      break;
-    case cast_crypto::VerificationResult::ERROR_INTERNAL:
-      translated.error_type = AuthResult::ERROR_UNEXPECTED_AUTH_LIBRARY_RESULT;
-      break;
-    default:
-      translated.error_type = AuthResult::ERROR_CERT_NOT_SIGNED_BY_TRUSTED_CA;
-  }
-  return translated;
-}
-
 }  // namespace
 
 AuthResult::AuthResult()
@@ -151,27 +123,15 @@
   }
 
   const AuthResponse& response = auth_message.response();
-  result = VerifyCredentials(response, peer_cert_der);
-  if (!result.success()) {
-    return result;
-  }
-
-  std::string audio_policy(
-      reinterpret_cast<const char*>(kAudioOnlyPolicy),
-      (arraysize(kAudioOnlyPolicy) / sizeof(unsigned char)));
-  if (response.client_auth_certificate().find(audio_policy) !=
-      std::string::npos) {
-    result.channel_policies |= AuthResult::POLICY_AUDIO_ONLY;
-  }
-
-  return result;
+  return VerifyCredentials(response, peer_cert_der);
 }
 
 // This function does the following
-// * Verifies that the trusted CA |response.intermediate_certificate| is
-//   whitelisted for use.
-// * Verifies that |response.client_auth_certificate| is signed
-//   by the trusted CA certificate.
+//
+// * Verifies that the certificate chain |response.client_auth_certificate| +
+//   |response.intermediate_certificate| is valid and chains to a trusted
+//   Cast root.
+//
 // * Verifies that |response.signature| matches the signature
 //   of |signature_input| by |response.client_auth_certificate|'s public
 //   key.
@@ -179,17 +139,45 @@
                              const std::string& signature_input) {
   // Verify the certificate
   scoped_ptr<cast_crypto::CertVerificationContext> verification_context;
-  cast_crypto::VerificationResult ret = cast_crypto::VerifyDeviceCert(
-      response.client_auth_certificate(),
-      std::vector<std::string>(response.intermediate_certificate().begin(),
-                               response.intermediate_certificate().end()),
-      &verification_context);
 
-  if (ret.Success())
-    ret = verification_context->VerifySignatureOverData(response.signature(),
-                                                        signature_input);
+  // Build a single vector containing the certificate chain.
+  std::vector<std::string> cert_chain;
+  cert_chain.push_back(response.client_auth_certificate());
+  cert_chain.insert(cert_chain.end(),
+                    response.intermediate_certificate().begin(),
+                    response.intermediate_certificate().end());
 
-  return TranslateVerificationResult(ret);
+  // Use the current time when checking certificate validity.
+  base::Time::Exploded now;
+  base::Time::Now().UTCExplode(&now);
+
+  cast_crypto::CastDeviceCertPolicy device_policy;
+  if (!cast_crypto::VerifyDeviceCert(cert_chain, now, &verification_context,
+                                     &device_policy)) {
+    // TODO(eroman): The error information was lost; this error is ambiguous.
+    return AuthResult("Failed verifying cast device certificate",
+                      AuthResult::ERROR_CERT_NOT_SIGNED_BY_TRUSTED_CA);
+  }
+
+  if (!verification_context->VerifySignatureOverData(response.signature(),
+                                                     signature_input)) {
+    return AuthResult("Failed verifying signature over data",
+                      AuthResult::ERROR_SIGNED_BLOBS_MISMATCH);
+  }
+
+  AuthResult success;
+
+  // Set the policy into the result.
+  switch (device_policy) {
+    case cast_crypto::CastDeviceCertPolicy::AUDIO_ONLY:
+      success.channel_policies = AuthResult::POLICY_AUDIO_ONLY;
+      break;
+    case cast_crypto::CastDeviceCertPolicy::NONE:
+      success.channel_policies = AuthResult::POLICY_NONE;
+      break;
+  }
+
+  return success;
 }
 
 }  // namespace cast_channel
diff --git a/extensions/browser/api/cast_channel/cast_auth_util_unittest.cc b/extensions/browser/api/cast_channel/cast_auth_util_unittest.cc
index 61b4a09..c474613c 100644
--- a/extensions/browser/api/cast_channel/cast_auth_util_unittest.cc
+++ b/extensions/browser/api/cast_channel/cast_auth_util_unittest.cc
@@ -6,9 +6,12 @@
 
 #include <string>
 
+#include "base/files/file_util.h"
 #include "base/macros.h"
-#include "extensions/browser/api/cast_channel/cast_auth_ica.h"
+#include "base/path_service.h"
 #include "extensions/common/api/cast_channel/cast_channel.pb.h"
+#include "extensions/common/extension_paths.h"
+#include "net/cert/pem_tokenizer.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace extensions {
@@ -16,398 +19,170 @@
 namespace cast_channel {
 namespace {
 
-const unsigned char kIntermediateCertificate[] = {
-  0x30, 0x82, 0x03, 0x87, 0x30, 0x82, 0x02, 0x6f, 0xa0, 0x03,
-  0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x30, 0x0d, 0x06, 0x09,
-  0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05,
-  0x00, 0x30, 0x7c, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55,
-  0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11,
-  0x06, 0x03, 0x55, 0x04, 0x08, 0x0c, 0x0a, 0x43, 0x61, 0x6c,
-  0x69, 0x66, 0x6f, 0x72, 0x6e, 0x69, 0x61, 0x31, 0x16, 0x30,
-  0x14, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0c, 0x0d, 0x4d, 0x6f,
-  0x75, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x20, 0x56, 0x69, 0x65,
-  0x77, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x0a,
-  0x0c, 0x0a, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x49,
-  0x6e, 0x63, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04,
-  0x0b, 0x0c, 0x09, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20,
-  0x54, 0x56, 0x31, 0x17, 0x30, 0x15, 0x06, 0x03, 0x55, 0x04,
-  0x03, 0x0c, 0x0e, 0x45, 0x75, 0x72, 0x65, 0x6b, 0x61, 0x20,
-  0x52, 0x6f, 0x6f, 0x74, 0x20, 0x43, 0x41, 0x30, 0x1e, 0x17,
-  0x0d, 0x31, 0x32, 0x31, 0x32, 0x31, 0x39, 0x30, 0x30, 0x34,
-  0x37, 0x31, 0x32, 0x5a, 0x17, 0x0d, 0x33, 0x32, 0x31, 0x32,
-  0x31, 0x34, 0x30, 0x30, 0x34, 0x37, 0x31, 0x32, 0x5a, 0x30,
-  0x7d, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06,
-  0x13, 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03,
-  0x55, 0x04, 0x08, 0x0c, 0x0a, 0x43, 0x61, 0x6c, 0x69, 0x66,
-  0x6f, 0x72, 0x6e, 0x69, 0x61, 0x31, 0x16, 0x30, 0x14, 0x06,
-  0x03, 0x55, 0x04, 0x07, 0x0c, 0x0d, 0x4d, 0x6f, 0x75, 0x6e,
-  0x74, 0x61, 0x69, 0x6e, 0x20, 0x56, 0x69, 0x65, 0x77, 0x31,
-  0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x0a,
-  0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63,
-  0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x0c,
-  0x09, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x54, 0x56,
-  0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c,
-  0x0f, 0x45, 0x75, 0x72, 0x65, 0x6b, 0x61, 0x20, 0x47, 0x65,
-  0x6e, 0x31, 0x20, 0x49, 0x43, 0x41, 0x30, 0x82, 0x01, 0x22,
-  0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d,
-  0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00,
-  0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xbc,
-  0x22, 0x80, 0xbd, 0x80, 0xf6, 0x3a, 0x21, 0x00, 0x3b, 0xae,
-  0x76, 0x5e, 0x35, 0x7f, 0x3d, 0xc3, 0x64, 0x5c, 0x55, 0x94,
-  0x86, 0x34, 0x2f, 0x05, 0x87, 0x28, 0xcd, 0xf7, 0x69, 0x8c,
-  0x17, 0xb3, 0x50, 0xa7, 0xb8, 0x82, 0xfa, 0xdf, 0xc7, 0x43,
-  0x2d, 0xd6, 0x7e, 0xab, 0xa0, 0x6f, 0xb7, 0x13, 0x72, 0x80,
-  0xa4, 0x47, 0x15, 0xc1, 0x20, 0x99, 0x50, 0xcd, 0xec, 0x14,
-  0x62, 0x09, 0x5b, 0xa4, 0x98, 0xcd, 0xd2, 0x41, 0xb6, 0x36,
-  0x4e, 0xff, 0xe8, 0x2e, 0x32, 0x30, 0x4a, 0x81, 0xa8, 0x42,
-  0xa3, 0x6c, 0x9b, 0x33, 0x6e, 0xca, 0xb2, 0xf5, 0x53, 0x66,
-  0xe0, 0x27, 0x53, 0x86, 0x1a, 0x85, 0x1e, 0xa7, 0x39, 0x3f,
-  0x4a, 0x77, 0x8e, 0xfb, 0x54, 0x66, 0x66, 0xfb, 0x58, 0x54,
-  0xc0, 0x5e, 0x39, 0xc7, 0xf5, 0x50, 0x06, 0x0b, 0xe0, 0x8a,
-  0xd4, 0xce, 0xe1, 0x6a, 0x55, 0x1f, 0x8b, 0x17, 0x00, 0xe6,
-  0x69, 0xa3, 0x27, 0xe6, 0x08, 0x25, 0x69, 0x3c, 0x12, 0x9d,
-  0x8d, 0x05, 0x2c, 0xd6, 0x2e, 0xa2, 0x31, 0xde, 0xb4, 0x52,
-  0x50, 0xd6, 0x20, 0x49, 0xde, 0x71, 0xa0, 0xf9, 0xad, 0x20,
-  0x40, 0x12, 0xf1, 0xdd, 0x25, 0xeb, 0xd5, 0xe6, 0xb8, 0x36,
-  0xf4, 0xd6, 0x8f, 0x7f, 0xca, 0x43, 0xdc, 0xd7, 0x10, 0x5b,
-  0xe6, 0x3f, 0x51, 0x8a, 0x85, 0xb3, 0xf3, 0xff, 0xf6, 0x03,
-  0x2d, 0xcb, 0x23, 0x4f, 0x9c, 0xad, 0x18, 0xe7, 0x93, 0x05,
-  0x8c, 0xac, 0x52, 0x9a, 0xf7, 0x4c, 0xe9, 0x99, 0x7a, 0xbe,
-  0x6e, 0x7e, 0x4d, 0x0a, 0xe3, 0xc6, 0x1c, 0xa9, 0x93, 0xfa,
-  0x3a, 0xa5, 0x91, 0x5d, 0x1c, 0xbd, 0x66, 0xeb, 0xcc, 0x60,
-  0xdc, 0x86, 0x74, 0xca, 0xcf, 0xf8, 0x92, 0x1c, 0x98, 0x7d,
-  0x57, 0xfa, 0x61, 0x47, 0x9e, 0xab, 0x80, 0xb7, 0xe4, 0x48,
-  0x80, 0x2a, 0x92, 0xc5, 0x1b, 0x02, 0x03, 0x01, 0x00, 0x01,
-  0xa3, 0x13, 0x30, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x1d,
-  0x13, 0x04, 0x08, 0x30, 0x06, 0x01, 0x01, 0xff, 0x02, 0x01,
-  0x01, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,
-  0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01,
-  0x00, 0x8b, 0xd4, 0xa1, 0xb1, 0xcf, 0x5d, 0xcd, 0x7b, 0x6c,
-  0x48, 0x4a, 0x41, 0x1f, 0x53, 0x2f, 0x18, 0x2d, 0x32, 0x45,
-  0xff, 0x9e, 0xab, 0xd3, 0x73, 0x3e, 0x1f, 0x22, 0xd7, 0xea,
-  0xfa, 0x01, 0xe6, 0x73, 0x03, 0x0f, 0x2b, 0xc6, 0x25, 0xbb,
-  0xa5, 0xee, 0xc5, 0xf5, 0x45, 0xcb, 0x24, 0x12, 0x2a, 0xad,
-  0xc2, 0x5d, 0x05, 0xf4, 0x7a, 0xf5, 0xc2, 0x9b, 0x10, 0x16,
-  0x5a, 0xd1, 0x0a, 0x73, 0xc5, 0x16, 0x39, 0xa0, 0x10, 0xca,
-  0xd1, 0x68, 0x85, 0x9e, 0xfb, 0x9e, 0x26, 0x83, 0x8e, 0x58,
-  0xf3, 0x77, 0xa0, 0x4e, 0xe5, 0xdb, 0x97, 0xbe, 0x2d, 0x00,
-  0x5f, 0xf5, 0x94, 0xdb, 0xb1, 0x9d, 0x65, 0x6b, 0xfd, 0xf0,
-  0xd1, 0x04, 0x51, 0xdf, 0xcc, 0x92, 0xa6, 0x99, 0x2d, 0x71,
-  0xf5, 0x4d, 0xd5, 0x23, 0xfe, 0x33, 0x1c, 0xa9, 0xb4, 0xab,
-  0xc5, 0xbf, 0x1a, 0xb8, 0xd1, 0x80, 0xef, 0x89, 0xc9, 0xe2,
-  0x1f, 0x9c, 0x4c, 0x48, 0x3b, 0xa2, 0xfa, 0x02, 0x0a, 0xdc,
-  0x84, 0x01, 0x8a, 0x87, 0x02, 0xfb, 0x59, 0xee, 0xa7, 0x4c,
-  0x04, 0x7d, 0x74, 0x99, 0x87, 0x6a, 0x25, 0x44, 0xad, 0x16,
-  0xaa, 0xec, 0x4e, 0x35, 0x1b, 0x7c, 0x7b, 0x84, 0xc9, 0xb1,
-  0x3f, 0xe1, 0x82, 0x70, 0xe5, 0x0d, 0xe7, 0xd9, 0x6d, 0xfa,
-  0x95, 0xb6, 0xc5, 0xe4, 0x1e, 0xe8, 0x11, 0x9b, 0xd8, 0xb2,
-  0xf3, 0xa4, 0xfd, 0x13, 0xf3, 0x83, 0x4f, 0xf7, 0x07, 0x14,
-  0x20, 0xbb, 0x22, 0xa5, 0xa6, 0x8f, 0xd6, 0xb5, 0xdb, 0xa9,
-  0x74, 0x78, 0xe2, 0x93, 0x0d, 0xe5, 0x23, 0x2f, 0x05, 0x17,
-  0xe0, 0xb2, 0x97, 0x67, 0x34, 0x4d, 0x0f, 0x9c, 0x76, 0x43,
-  0x7b, 0xa6, 0x21, 0x4a, 0x56, 0x05, 0xf6, 0x2a, 0x7c, 0xf2,
-  0x7f, 0x12, 0x94, 0x82, 0x26, 0x29, 0x07, 0xf0, 0x0b, 0x6c,
-  0x6c, 0x79, 0x14, 0xb0, 0x74, 0xd5, 0x6c,
-};
+// Creates an std::string given a uint8_t array.
+template <size_t N>
+std::string CreateString(const uint8_t (&data)[N]) {
+  return std::string(reinterpret_cast<const char*>(data), N);
+}
 
-const unsigned char kClientAuthCertificate[] = {
-  0x30, 0x82, 0x03, 0x7a, 0x30, 0x82, 0x02, 0x62, 0x02, 0x04,
-  0x51, 0x1d, 0x0e, 0xe2, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86,
-  0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30,
-  0x7d, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06,
-  0x13, 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03,
-  0x55, 0x04, 0x08, 0x0c, 0x0a, 0x43, 0x61, 0x6c, 0x69, 0x66,
-  0x6f, 0x72, 0x6e, 0x69, 0x61, 0x31, 0x16, 0x30, 0x14, 0x06,
-  0x03, 0x55, 0x04, 0x07, 0x0c, 0x0d, 0x4d, 0x6f, 0x75, 0x6e,
-  0x74, 0x61, 0x69, 0x6e, 0x20, 0x56, 0x69, 0x65, 0x77, 0x31,
-  0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x0a,
-  0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63,
-  0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x0c,
-  0x09, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x54, 0x56,
-  0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c,
-  0x0f, 0x45, 0x75, 0x72, 0x65, 0x6b, 0x61, 0x20, 0x47, 0x65,
-  0x6e, 0x31, 0x20, 0x49, 0x43, 0x41, 0x30, 0x1e, 0x17, 0x0d,
-  0x31, 0x33, 0x30, 0x32, 0x31, 0x34, 0x31, 0x36, 0x32, 0x30,
-  0x35, 0x30, 0x5a, 0x17, 0x0d, 0x33, 0x33, 0x30, 0x32, 0x30,
-  0x39, 0x31, 0x36, 0x32, 0x30, 0x35, 0x30, 0x5a, 0x30, 0x77,
-  0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13,
-  0x09, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x20, 0x54, 0x56,
-  0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13,
-  0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55,
-  0x04, 0x08, 0x13, 0x0a, 0x43, 0x61, 0x6c, 0x69, 0x66, 0x6f,
-  0x72, 0x6e, 0x69, 0x61, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03,
-  0x55, 0x04, 0x0a, 0x13, 0x0a, 0x47, 0x6f, 0x6f, 0x67, 0x6c,
-  0x65, 0x20, 0x49, 0x6e, 0x63, 0x31, 0x16, 0x30, 0x14, 0x06,
-  0x03, 0x55, 0x04, 0x07, 0x13, 0x0d, 0x4d, 0x6f, 0x75, 0x6e,
-  0x74, 0x61, 0x69, 0x6e, 0x20, 0x56, 0x69, 0x65, 0x77, 0x31,
-  0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x03, 0x14, 0x09,
-  0x65, 0x76, 0x74, 0x5f, 0x65, 0x31, 0x32, 0x36, 0x36, 0x30,
-  0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48,
-  0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82,
-  0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01,
-  0x01, 0x00, 0xb8, 0x7d, 0x8a, 0x50, 0xfc, 0x58, 0xf2, 0x03,
-  0x67, 0x7f, 0x9f, 0xe4, 0xab, 0xd0, 0xd6, 0xd2, 0xd5, 0x8a,
-  0x7e, 0x30, 0x26, 0x4c, 0x54, 0xd1, 0xd0, 0xd4, 0x40, 0x92,
-  0x6c, 0x7d, 0x18, 0x78, 0xe3, 0x96, 0xc1, 0x0d, 0xd6, 0x7d,
-  0xca, 0x20, 0x32, 0x51, 0x30, 0xb5, 0x51, 0xcc, 0xe5, 0x21,
-  0xf1, 0x61, 0x20, 0x5f, 0x18, 0x60, 0x42, 0x94, 0x8d, 0x8b,
-  0x4c, 0x7a, 0x3f, 0xea, 0x11, 0xf6, 0x5a, 0xa0, 0x17, 0x60,
-  0x7b, 0x55, 0xcf, 0x96, 0x6e, 0x59, 0xaa, 0x0a, 0xd7, 0x3c,
-  0x69, 0xd9, 0x9d, 0x24, 0x4b, 0xc2, 0xde, 0xc1, 0x4c, 0xaa,
-  0x14, 0xd3, 0x77, 0xa9, 0x7a, 0x94, 0x68, 0x79, 0x73, 0xb3,
-  0xf5, 0x09, 0x28, 0xfc, 0x18, 0x20, 0xbd, 0xef, 0xf5, 0xf0,
-  0xf8, 0xd3, 0x53, 0x9e, 0x5f, 0x55, 0xcb, 0x11, 0xab, 0xea,
-  0x7b, 0xfe, 0x21, 0x44, 0x30, 0x2a, 0xd4, 0x46, 0x06, 0xd5,
-  0x26, 0xd9, 0xb9, 0xa8, 0xc6, 0x8a, 0xc8, 0x3a, 0x93, 0xef,
-  0xe8, 0xa0, 0x48, 0xb9, 0x41, 0x26, 0x69, 0x3e, 0x84, 0x36,
-  0x20, 0xeb, 0xc7, 0x1d, 0x6e, 0xc7, 0xd6, 0x1e, 0x4d, 0x2d,
-  0xe2, 0x56, 0x25, 0xcf, 0xf3, 0x03, 0xb1, 0xc8, 0x47, 0x53,
-  0x63, 0xe9, 0x0f, 0x67, 0x34, 0x12, 0xd3, 0x50, 0xea, 0xb3,
-  0x0a, 0x43, 0xc4, 0x3f, 0x5a, 0xbe, 0xd2, 0x88, 0x7e, 0xc8,
-  0x02, 0xc7, 0xf7, 0x21, 0x31, 0xab, 0x62, 0xbd, 0xb1, 0x17,
-  0xa9, 0x77, 0x80, 0x7d, 0x95, 0x6f, 0x66, 0x33, 0x82, 0xc1,
-  0x2f, 0xaa, 0x72, 0xb7, 0xbf, 0x23, 0xef, 0x93, 0x04, 0x33,
-  0x29, 0xc0, 0x68, 0x3f, 0x39, 0xaa, 0x35, 0x23, 0x8a, 0xbe,
-  0x07, 0x2d, 0x96, 0x80, 0x13, 0x81, 0x33, 0x6c, 0xb4, 0xca,
-  0x77, 0xa1, 0xca, 0x0d, 0xd4, 0x6a, 0xd6, 0xf3, 0xc7, 0x81,
-  0xcd, 0x38, 0xc6, 0xf1, 0xf5, 0xd0, 0x1a, 0x85, 0x02, 0x03,
-  0x01, 0x00, 0x01, 0xa3, 0x0d, 0x30, 0x0b, 0x30, 0x09, 0x06,
-  0x03, 0x55, 0x1d, 0x13, 0x04, 0x02, 0x30, 0x00, 0x30, 0x0d,
-  0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01,
-  0x05, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x4a, 0xb0,
-  0xb2, 0xb3, 0x3c, 0x3c, 0x64, 0x80, 0x4d, 0xc0, 0x4a, 0x4f,
-  0xc2, 0xb7, 0x8c, 0xb2, 0x8b, 0x6a, 0x9a, 0x0a, 0x44, 0xbc,
-  0x28, 0x1c, 0x61, 0xb0, 0x4f, 0xd5, 0x85, 0x36, 0x5f, 0xe9,
-  0xa1, 0x66, 0x83, 0x6f, 0xd9, 0x88, 0x49, 0x30, 0x7a, 0x64,
-  0x7c, 0x20, 0x20, 0xb7, 0x71, 0xa9, 0xcd, 0x13, 0x5a, 0x2e,
-  0xfd, 0xdc, 0xa6, 0x04, 0x80, 0xc3, 0xa0, 0xa4, 0x71, 0xfd,
-  0xd5, 0x96, 0x80, 0x24, 0x30, 0xea, 0xd6, 0x3a, 0x7a, 0x67,
-  0xa9, 0xb2, 0xfc, 0x8d, 0xdf, 0x4e, 0xe1, 0x5d, 0x5d, 0x92,
-  0xc6, 0xc1, 0xc9, 0x87, 0x9a, 0xde, 0x92, 0xa1, 0x78, 0x3e,
-  0xb9, 0x30, 0xa4, 0x1d, 0xb7, 0x9b, 0xc3, 0x5f, 0x05, 0x48,
-  0x37, 0x9c, 0x2a, 0xd0, 0x28, 0x5f, 0xf1, 0x54, 0xf6, 0xa7,
-  0x71, 0x54, 0xbe, 0xf3, 0x1a, 0x0b, 0x4b, 0x07, 0x8c, 0xaf,
-  0xa0, 0x3d, 0x44, 0x3a, 0xac, 0x7b, 0x69, 0x12, 0x2c, 0xeb,
-  0x17, 0x9b, 0x96, 0x23, 0x99, 0xf0, 0xae, 0x07, 0xbc, 0x13,
-  0x46, 0x7d, 0xb2, 0x0a, 0xeb, 0x92, 0xa8, 0x0f, 0xa7, 0x31,
-  0xe6, 0xce, 0x66, 0xf3, 0xf6, 0xf4, 0xd7, 0xeb, 0xbd, 0x89,
-  0xed, 0xa3, 0xcf, 0x08, 0xc7, 0xad, 0xfe, 0x09, 0x89, 0x0a,
-  0xf3, 0x27, 0x70, 0x6d, 0x84, 0x34, 0xff, 0x0e, 0xe1, 0xf0,
-  0x6f, 0x4a, 0x53, 0x46, 0x1d, 0x24, 0x12, 0x0c, 0x0a, 0x38,
-  0xfa, 0xec, 0x73, 0x55, 0xe2, 0x3f, 0xd8, 0xfb, 0x8a, 0xb4,
-  0x09, 0xb2, 0xe3, 0xdd, 0x76, 0x82, 0x6e, 0xce, 0x6e, 0xaa,
-  0x15, 0xe2, 0x41, 0x6a, 0x67, 0x06, 0x16, 0x59, 0xf6, 0x07,
-  0xef, 0xe2, 0x0b, 0x5d, 0x1c, 0x43, 0x0d, 0x65, 0x32, 0x7b,
-  0x08, 0x03, 0x67, 0xe8, 0xb6, 0xec, 0xf7, 0xd2, 0x17, 0xef,
-  0xe0, 0x79, 0x1c, 0xf0, 0x8b, 0xfd, 0xce, 0x09, 0x3e, 0xaa,
-  0x3d, 0x25, 0xd7, 0xd1,
-};
+// Reads a file from the cast certificates test data directory:
+//     src/extensions/test/data/cast_certificates/
+std::string ReadTestFileToString(const std::string& file_name) {
+  base::FilePath filepath;
+  if (!PathService::Get(DIR_TEST_DATA, &filepath)) {
+    ADD_FAILURE() << "Couldn't retrieve test data root";
+    return std::string();
+  }
+  filepath = filepath.AppendASCII("cast_certificates/" + file_name);
 
-const unsigned char kSignature[] = {
-  0x76, 0x93, 0x7f, 0x8e, 0x3e, 0x8f, 0x77, 0x64, 0x33, 0xb4,
-  0x6d, 0x09, 0xf5, 0x38, 0xa2, 0xde, 0x1b, 0xaa, 0x3e, 0x1f,
-  0xfc, 0x5c, 0xd7, 0x17, 0xaa, 0x28, 0x2a, 0xf3, 0x9f, 0x76,
-  0xa1, 0x4e, 0x41, 0xab, 0xd2, 0x03, 0xf2, 0x63, 0xf6, 0x24,
-  0x61, 0x97, 0xc0, 0x8a, 0xde, 0x11, 0x2e, 0x72, 0xff, 0x98,
-  0xeb, 0xd8, 0x18, 0xd5, 0x75, 0x91, 0xcd, 0x08, 0x43, 0x84,
-  0xe2, 0xc4, 0x1e, 0x7c, 0xe4, 0x9e, 0xeb, 0xe8, 0x09, 0x45,
-  0xe5, 0x6d, 0x62, 0x37, 0x02, 0xeb, 0xfc, 0x0a, 0x12, 0xf5,
-  0x91, 0x19, 0x4c, 0x17, 0xfa, 0x5e, 0x2d, 0x4b, 0x80, 0xb9,
-  0x1a, 0xd2, 0x47, 0xf7, 0xf9, 0x2f, 0x9f, 0xed, 0xd8, 0x2c,
-  0xbf, 0x2e, 0x16, 0x3b, 0x5b, 0x96, 0x5b, 0x9c, 0xe0, 0x73,
-  0x4e, 0x15, 0x34, 0x99, 0xde, 0xce, 0x88, 0x5e, 0x6f, 0xcb,
-  0x01, 0x36, 0x10, 0x07, 0x71, 0x6a, 0x86, 0xf6, 0x3a, 0x9d,
-  0x7f, 0xef, 0xa3, 0x81, 0xd8, 0xff, 0xc0, 0x8c, 0x75, 0x9f,
-  0xa0, 0xe4, 0xd0, 0x94, 0x9b, 0x11, 0xe4, 0x68, 0x44, 0x43,
-  0xcf, 0x9b, 0x39, 0x3a, 0xb5, 0xa7, 0xa4, 0xd4, 0x74, 0x7f,
-  0x86, 0x2a, 0x6a, 0x4b, 0x25, 0x00, 0x15, 0xee, 0x55, 0x30,
-  0x87, 0xef, 0x3d, 0xcb, 0x53, 0xfe, 0x88, 0x5e, 0x71, 0x82,
-  0x09, 0x0c, 0x5b, 0xef, 0x43, 0xda, 0xc8, 0x98, 0x23, 0x54,
-  0x6a, 0xc4, 0x47, 0x8e, 0xbb, 0x4d, 0x5f, 0x2c, 0x1e, 0xaa,
-  0x3f, 0xc2, 0xdb, 0xbe, 0x34, 0xf8, 0xac, 0xca, 0x0c, 0x0d,
-  0xf8, 0x04, 0xec, 0xba, 0xc4, 0x44, 0xd6, 0x22, 0x9e, 0x12,
-  0xc7, 0x14, 0x70, 0x77, 0x56, 0xc6, 0x56, 0xcc, 0x23, 0x12,
-  0x7a, 0xef, 0xb0, 0xa0, 0x87, 0x21, 0x05, 0x15, 0xb4, 0xb7,
-  0x9e, 0xb0, 0xe1, 0x56, 0xe6, 0x36, 0x73, 0x29, 0xb8, 0x81,
-  0x94, 0x26, 0x3d, 0xa4, 0x4c, 0xd6,
-};
+  // Read the full contents of the file.
+  std::string file_data;
+  if (!base::ReadFileToString(filepath, &file_data)) {
+    ADD_FAILURE() << "Couldn't read file: " << filepath.value();
+    return std::string();
+  }
 
-const unsigned char kPeerCert[] = {
-  0x30, 0x82, 0x02, 0xda, 0x30, 0x82, 0x01, 0xc2, 0xa0, 0x03,
-  0x02, 0x01, 0x02, 0x02, 0x04, 0x01, 0xc1, 0x6f, 0x87, 0x30,
-  0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01,
-  0x01, 0x0b, 0x05, 0x00, 0x30, 0x2f, 0x31, 0x2d, 0x30, 0x2b,
-  0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x24, 0x31, 0x37, 0x63,
-  0x63, 0x36, 0x62, 0x35, 0x35, 0x2d, 0x33, 0x38, 0x33, 0x34,
-  0x2d, 0x31, 0x31, 0x30, 0x63, 0x2d, 0x64, 0x62, 0x64, 0x64,
-  0x2d, 0x65, 0x32, 0x32, 0x61, 0x61, 0x37, 0x32, 0x37, 0x62,
-  0x31, 0x39, 0x62, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x34, 0x31,
-  0x30, 0x33, 0x30, 0x30, 0x38, 0x35, 0x30, 0x30, 0x37, 0x5a,
-  0x17, 0x0d, 0x31, 0x34, 0x31, 0x31, 0x30, 0x31, 0x30, 0x38,
-  0x35, 0x30, 0x30, 0x37, 0x5a, 0x30, 0x2f, 0x31, 0x2d, 0x30,
-  0x2b, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x24, 0x31, 0x37,
-  0x63, 0x63, 0x36, 0x62, 0x35, 0x35, 0x2d, 0x33, 0x38, 0x33,
-  0x34, 0x2d, 0x31, 0x31, 0x30, 0x63, 0x2d, 0x64, 0x62, 0x64,
-  0x64, 0x2d, 0x65, 0x32, 0x32, 0x61, 0x61, 0x37, 0x32, 0x37,
-  0x62, 0x31, 0x39, 0x62, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d,
-  0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01,
-  0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82,
-  0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xb9, 0x3b, 0x11,
-  0x16, 0xe0, 0x76, 0xc3, 0x19, 0xe9, 0x25, 0xb2, 0x59, 0x46,
-  0x7d, 0xcf, 0x4f, 0xf5, 0x86, 0x3d, 0x73, 0xd7, 0x6e, 0x78,
-  0x20, 0x95, 0x38, 0x80, 0x58, 0x02, 0xe7, 0x05, 0x80, 0x8b,
-  0x06, 0x54, 0x75, 0xa0, 0x7e, 0x2a, 0x43, 0x5e, 0x72, 0xa4,
-  0x6e, 0x07, 0xf2, 0x9a, 0x98, 0x39, 0x86, 0x81, 0x1e, 0x62,
-  0xd7, 0x16, 0xa7, 0x18, 0x14, 0xa7, 0x59, 0xa5, 0xc6, 0x49,
-  0x56, 0xd1, 0x0d, 0x45, 0xea, 0x0d, 0xa6, 0x6a, 0x7c, 0xae,
-  0xac, 0xc8, 0xdc, 0x39, 0xb6, 0xa6, 0xb4, 0xa1, 0x71, 0x71,
-  0xff, 0xfb, 0xa0, 0xb3, 0x02, 0xb3, 0xaa, 0x20, 0xfe, 0xfa,
-  0xcd, 0x18, 0xff, 0x8a, 0xa2, 0x19, 0x82, 0x4f, 0x44, 0x9c,
-  0x97, 0xa4, 0x63, 0xce, 0xe5, 0x76, 0xe5, 0x96, 0x92, 0xc1,
-  0x92, 0x88, 0x2a, 0x5a, 0xb9, 0xde, 0xf3, 0x24, 0xf5, 0xc5,
-  0xfe, 0xfd, 0x42, 0x81, 0x07, 0x51, 0x47, 0x23, 0x15, 0x15,
-  0x5e, 0x5e, 0xf0, 0xf9, 0xac, 0xbe, 0xdb, 0xb6, 0x9d, 0xee,
-  0x92, 0xab, 0xf8, 0xcf, 0x08, 0x1a, 0xf6, 0x14, 0xf2, 0x9c,
-  0x5a, 0xbd, 0x73, 0xa4, 0xd1, 0x02, 0x0b, 0xff, 0xbc, 0x31,
-  0x91, 0xa5, 0xf3, 0x07, 0xef, 0x9f, 0xc4, 0xad, 0x56, 0xf9,
-  0x86, 0xf9, 0xc6, 0xee, 0x27, 0xeb, 0xd7, 0xe9, 0xd8, 0x57,
-  0xb3, 0x0f, 0x96, 0x8e, 0x57, 0x27, 0x5e, 0x5e, 0x75, 0x4e,
-  0x00, 0xd5, 0x4c, 0xbb, 0x2f, 0xb3, 0xcc, 0xd5, 0x91, 0xa5,
-  0x89, 0x62, 0x47, 0x7d, 0x4c, 0x43, 0x77, 0xd9, 0x3d, 0x75,
-  0xcb, 0x6c, 0x85, 0xaa, 0x9c, 0x4f, 0xec, 0x80, 0x30, 0xf2,
-  0xeb, 0x6f, 0xec, 0xe7, 0xd1, 0xd8, 0xbe, 0xc8, 0x9d, 0x14,
-  0x6d, 0x09, 0xc8, 0xc4, 0x95, 0xcf, 0x21, 0xe6, 0xf8, 0xf0,
-  0x25, 0xa3, 0xa2, 0xf6, 0x4f, 0x44, 0xbf, 0x00, 0xca, 0xe7,
-  0x68, 0x7b, 0x33, 0x02, 0x03, 0x01, 0x00, 0x01, 0x30, 0x0d,
-  0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01,
-  0x0b, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x02, 0xd1,
-  0x74, 0x56, 0x74, 0x82, 0x03, 0x2b, 0x53, 0x34, 0x82, 0x9e,
-  0x16, 0xa2, 0x43, 0x24, 0x6c, 0xf1, 0x2c, 0x5f, 0xc2, 0xa5,
-  0x09, 0xc4, 0x72, 0x62, 0x1d, 0xc7, 0x10, 0x57, 0x9a, 0x40,
-  0x55, 0x83, 0xa7, 0x5f, 0x46, 0x44, 0x96, 0xeb, 0xcd, 0x09,
-  0x40, 0xdd, 0xa8, 0xdb, 0x6a, 0xaa, 0xb5, 0xaf, 0x8d, 0x7c,
-  0xb1, 0xa2, 0xc4, 0xff, 0xcc, 0xa5, 0x70, 0x85, 0xa6, 0x30,
-  0x95, 0x69, 0x8b, 0x61, 0x7f, 0x4c, 0x34, 0x95, 0xeb, 0xb1,
-  0x7f, 0x07, 0x4e, 0x60, 0x90, 0x34, 0xc5, 0x3b, 0x37, 0x66,
-  0x94, 0xd7, 0x18, 0x8d, 0x39, 0x64, 0x3b, 0x6e, 0xdc, 0x52,
-  0xf6, 0x46, 0x64, 0x33, 0x50, 0x97, 0xc4, 0xce, 0xba, 0x66,
-  0xc2, 0x91, 0x2a, 0x1b, 0xde, 0xdc, 0x37, 0x26, 0x31, 0x12,
-  0xa8, 0x70, 0x77, 0x7f, 0x4d, 0xc0, 0x65, 0x8e, 0x25, 0x09,
-  0xc5, 0x90, 0x77, 0xf3, 0x60, 0x4d, 0x20, 0xf3, 0x27, 0x7a,
-  0x34, 0x02, 0xea, 0xfe, 0xa1, 0x48, 0x8b, 0x63, 0xc2, 0xf7,
-  0x70, 0xb2, 0x23, 0x65, 0x55, 0xc8, 0x1b, 0xd1, 0x21, 0xe3,
-  0x1b, 0xf0, 0x50, 0xbb, 0x63, 0xe2, 0x7f, 0x02, 0xe0, 0xa5,
-  0xb7, 0x33, 0x67, 0x16, 0x0b, 0xba, 0xfe, 0x5f, 0x9d, 0xa2,
-  0x6f, 0x38, 0xb7, 0x3e, 0x3f, 0x17, 0x6a, 0x6d, 0xe1, 0xa2,
-  0xc4, 0xee, 0x77, 0xe6, 0x80, 0xe1, 0x2c, 0x3d, 0x93, 0x3d,
-  0x17, 0xc3, 0x58, 0x6f, 0x87, 0x0a, 0xe5, 0xa9, 0x7e, 0xef,
-  0xd4, 0x33, 0x94, 0xc3, 0xeb, 0xd5, 0xb4, 0x1a, 0xef, 0x38,
-  0xfb, 0xb4, 0xa9, 0x40, 0xa9, 0x56, 0x41, 0x32, 0xd8, 0xd5,
-  0x16, 0x42, 0xcd, 0xb5, 0xdc, 0x49, 0x64, 0x01, 0x68, 0x2b,
-  0x42, 0xa9, 0xcf, 0x64, 0x12, 0x6a, 0x7c, 0xc8, 0xd8, 0x3b,
-  0xfc, 0x14, 0x67, 0xb4, 0x4e, 0x3a, 0x75, 0x32, 0xda, 0xfe,
-  0x43, 0xb2, 0x35, 0xa1,
-};
+  return file_data;
+}
+
+// Reads a PEM file containing "CERTIFICATE" blocks to a vector of certificate
+// data.
+std::vector<std::string> ReadCertificateChainFromFile(
+    const std::string& file_name) {
+  std::string file_data = ReadTestFileToString(file_name);
+
+  // Read the certificate chain from the test file, which is comprised of PEM
+  // blocks titled "CERTIFICATE".
+  std::vector<std::string> pem_headers;
+  pem_headers.push_back("CERTIFICATE");
+
+  std::vector<std::string> certs;
+  net::PEMTokenizer pem_tokenizer(file_data, pem_headers);
+  while (pem_tokenizer.GetNext())
+    certs.push_back(pem_tokenizer.data());
+
+  return certs;
+}
+
+static const unsigned char kSignedData[] = {
+    0x5f, 0x76, 0x0d, 0xc8, 0x4b, 0xe7, 0x6e, 0xcb, 0x31, 0x58, 0xca, 0xd3,
+    0x7d, 0x23, 0x55, 0xbe, 0x8d, 0x52, 0x87, 0x83, 0x27, 0x52, 0x78, 0xfa,
+    0xa6, 0xdd, 0xdf, 0x13, 0x00, 0x51, 0x57, 0x6a, 0x83, 0x15, 0xcc, 0xc5,
+    0xb2, 0x5c, 0xdf, 0xe6, 0x81, 0xdc, 0x13, 0x58, 0x7b, 0x94, 0x0f, 0x69,
+    0xcc, 0xdf, 0x68, 0x41, 0x8a, 0x95, 0xe2, 0xcd, 0xf8, 0xde, 0x0f, 0x2f,
+    0x30, 0xcf, 0x73, 0xbf, 0x37, 0x52, 0x87, 0x23, 0xd7, 0xbe, 0xba, 0x7c,
+    0xde, 0x50, 0xd3, 0x77, 0x9c, 0x06, 0x82, 0x28, 0x67, 0xc1, 0x1a, 0xf5,
+    0x8a, 0xa0, 0xf2, 0x32, 0x09, 0x95, 0x41, 0x41, 0x93, 0x8e, 0x62, 0xaa,
+    0xf3, 0xe3, 0x22, 0x17, 0x43, 0x94, 0x9b, 0x63, 0xfa, 0x68, 0x20, 0x69,
+    0x38, 0xf6, 0x75, 0x6c, 0xe0, 0x3b, 0xe0, 0x8d, 0x63, 0xac, 0x7f, 0xe3,
+    0x09, 0xd8, 0xde, 0x91, 0xc8, 0x1e, 0x07, 0x4a, 0xb2, 0x1e, 0xe1, 0xe3,
+    0xf4, 0x4d, 0x3e, 0x8a, 0xf4, 0xf8, 0x83, 0x39, 0x2b, 0x50, 0x98, 0x61,
+    0x91, 0x50, 0x00, 0x34, 0x57, 0xd2, 0x0d, 0xf7, 0xfa, 0xc9, 0xcc, 0xd9,
+    0x7a, 0x3d, 0x39, 0x7a, 0x1a, 0xbd, 0xf8, 0xbe, 0x65, 0xb6, 0xea, 0x4e,
+    0x86, 0x74, 0xdd, 0x51, 0x74, 0x6e, 0xa6, 0x7f, 0x14, 0x6c, 0x6a, 0x46,
+    0xb8, 0xaf, 0xcd, 0x6c, 0x78, 0x43, 0x76, 0x47, 0x5b, 0xdc, 0xb6, 0xf6,
+    0x4d, 0x1b, 0xe0, 0xb5, 0xf9, 0xa2, 0xb8, 0x26, 0x3f, 0x3f, 0xb8, 0x80,
+    0xed, 0xce, 0xfd, 0x0e, 0xcb, 0x48, 0x7a, 0x3b, 0xdf, 0x92, 0x44, 0x04,
+    0x81, 0xe4, 0xd3, 0x1e, 0x07, 0x9b, 0x02, 0xae, 0x05, 0x5a, 0x11, 0xf2,
+    0xc2, 0x75, 0x85, 0xd5, 0xf1, 0x53, 0x4c, 0x09, 0xd0, 0x99, 0xf8, 0x3e,
+    0xf6, 0x24, 0x46, 0xae, 0x83, 0x35, 0x3e, 0x6c, 0x8c, 0x2a, 0x9f, 0x1c,
+    0x5b, 0xfb, 0x89, 0x56};
+
+static const unsigned char kSha1Signature[] = {
+    0x52, 0x56, 0xcd, 0x53, 0xfa, 0xd9, 0x44, 0x31, 0x00, 0x2e, 0x85, 0x18,
+    0x56, 0xae, 0xf9, 0xf2, 0x70, 0x16, 0xc9, 0x59, 0x53, 0xc0, 0x17, 0xd9,
+    0x09, 0x65, 0x75, 0xee, 0xba, 0xc8, 0x0d, 0x06, 0x2e, 0xb7, 0x1b, 0xd0,
+    0x6a, 0x4d, 0x58, 0xde, 0x8e, 0xbe, 0x92, 0x22, 0x53, 0x19, 0xbf, 0x74,
+    0x8f, 0xb8, 0xfc, 0x3c, 0x9b, 0x42, 0x14, 0x7d, 0xe1, 0xfc, 0xa3, 0x71,
+    0x91, 0x6c, 0x5d, 0x28, 0x69, 0x8d, 0xd2, 0xde, 0xd1, 0x8f, 0xac, 0x6d,
+    0xf6, 0x48, 0xd8, 0x6f, 0x0e, 0xc9, 0x0a, 0xfa, 0xde, 0x20, 0xe0, 0x9d,
+    0x7a, 0xf8, 0x30, 0xa8, 0xd4, 0x79, 0x15, 0x63, 0xfb, 0x97, 0xa9, 0xef,
+    0x9f, 0x9c, 0xac, 0x16, 0xba, 0x1b, 0x2c, 0x14, 0xb4, 0xa4, 0x54, 0x5e,
+    0xec, 0x04, 0x10, 0x84, 0xc2, 0xa0, 0xd9, 0x6f, 0x05, 0xd4, 0x09, 0x8c,
+    0x85, 0xe9, 0x7a, 0xd1, 0x5a, 0xa3, 0x70, 0x00, 0x30, 0x9b, 0x19, 0x44,
+    0x2a, 0x90, 0x7a, 0xcd, 0x91, 0x94, 0x90, 0x66, 0xf9, 0x2e, 0x5e, 0x43,
+    0x27, 0x33, 0x2c, 0x45, 0xa7, 0xe2, 0x3a, 0x6d, 0xc9, 0x44, 0x58, 0x39,
+    0x45, 0xcb, 0xbd, 0x2f, 0xc5, 0xb4, 0x08, 0x41, 0x4d, 0x45, 0x67, 0x55,
+    0x0d, 0x43, 0x3c, 0xb6, 0x81, 0xbb, 0xb4, 0x34, 0x07, 0x10, 0x28, 0x17,
+    0xc2, 0xad, 0x40, 0x3b, 0xaf, 0xcb, 0xc0, 0xf6, 0x9d, 0x0e, 0x9b, 0xca,
+    0x2b, 0x20, 0xdf, 0xd0, 0xa3, 0xbe, 0xea, 0x3e, 0xe0, 0x82, 0x7b, 0x93,
+    0xfd, 0x9c, 0xaf, 0x97, 0x00, 0x05, 0x44, 0x91, 0x73, 0x68, 0x92, 0x3a,
+    0x8b, 0xbc, 0x0e, 0x96, 0x5e, 0x92, 0x98, 0x70, 0xab, 0xaa, 0x6e, 0x9a,
+    0x8e, 0xb0, 0xf4, 0x92, 0xc5, 0xa0, 0xa0, 0x4b, 0xb3, 0xd5, 0x44, 0x99,
+    0x8e, 0xa1, 0xd1, 0x8f, 0xe3, 0xac, 0x71, 0x1e, 0x3f, 0xc2, 0xfd, 0x0a,
+    0x57, 0xed, 0xea, 0x04};
 
 class CastAuthUtilTest : public testing::Test {
  public:
-  CastAuthUtilTest () {}
-  ~CastAuthUtilTest () override {}
+  CastAuthUtilTest() {}
+  ~CastAuthUtilTest() override {}
 
-  void SetUp() override {
-  }
+  void SetUp() override {}
 
  protected:
-  static AuthResponse CreateAuthResponse() {
-    std::string keys =
-        "CrMCCiBSnZzWf+XraY5w3SbX2PEmWfHm5SNIv2pc9xbhP0EOcxKOAjCCAQoCggEBALwigL"
-        "2A9johADuudl41fz3DZFxVlIY0LwWHKM33aYwXs1CnuIL638dDLdZ+q6BvtxNygKRHFcEg"
-        "mVDN7BRiCVukmM3SQbY2Tv/oLjIwSoGoQqNsmzNuyrL1U2bgJ1OGGoUepzk/SneO+1RmZv"
-        "tYVMBeOcf1UAYL4IrUzuFqVR+LFwDmaaMn5gglaTwSnY0FLNYuojHetFJQ1iBJ3nGg+a0g"
-        "QBLx3SXr1ea4NvTWj3/KQ9zXEFvmP1GKhbPz//YDLcsjT5ytGOeTBYysUpr3TOmZer5ufk"
-        "0K48YcqZP6OqWRXRy9ZuvMYNyGdMrP+JIcmH1X+mFHnquAt+RIgCqSxRsCAwEAAQqzAgog"
-        "mNZt6BxWR4RNlkNNN8SNws5/CHJQGee26JJ/VtaBqhgSjgIwggEKAoIBAQC8IoC9gPY6IQ"
-        "A7rnZeNX89w2RcVZSGNC8FhyjN92mMF7NQp7iC+t/HQy3Wfqugb7cTcoCkRxXBIJlQzewU"
-        "YglbpJjN0kG2Nk7/6C4yMEqBqEKjbJszbsqy9VNm4CdThhqFHqc5P0p3jvtUZmb7WFTAXj"
-        "nH9VAGC+CK1M7halUfixcA5mmjJ+YIJWk8Ep2NBSzWLqIx3rRSUNYgSd5xoPmtIEAS8d0l"
-        "69XmuDb01o9/ykPc1xBb5j9RioWz8//2Ay3LI0+crRjnkwWMrFKa90zpmXq+bn5NCuPGHK"
-        "mT+jqlkV0cvWbrzGDchnTKz/iSHJh9V/phR56rgLfkSIAqksUbAgMBAAE=";
-    std::string signature =
-        "eHMoa7dP2ByNtDnxM/Q6yV3ZyUyihBFgOthq937yuiu2uwW2X/i8h1YrJFaWrA0iTTfSLA"
-        "a6PBAN1hhnwXlWYy8MvViJ9eJqf5FfCCkOjdRN0QIFPpmIJm/EcIv91bNMWnOGANgSW1Ho"
-        "ns+sC0/kROPbPABPLLwfgGizBDSZNapxgj8G+iDvi1JRRvvNdmjUs2AUIPNrSp3Knt3FyZ"
-        "5F2SmkKhpo7XVTWgSuWOzUJu6zNHn2krm64Ymd2HxRDyKTm1DBzy1MoXv4/8mbLYdj+KAv"
-        "hqKJfRcrGkUXVK++wCHERwxcvfk7e6lN6adcCVYP9pZPMhE/UyAJY6/uE1X0cw==";
-    EXPECT_TRUE(SetTrustedCertificateAuthorities(keys, signature));
+  static AuthResponse CreateAuthResponse(std::string* signed_data) {
+    auto chain = ReadCertificateChainFromFile("audio_ref_dev_test_chain_3.pem");
+    CHECK(!chain.empty());
 
     AuthResponse response;
-    response.add_intermediate_certificate(
-        std::string(reinterpret_cast<const char*>(kIntermediateCertificate),
-                    arraysize(kIntermediateCertificate)));
-    response.set_client_auth_certificate(
-        std::string(reinterpret_cast<const char*>(kClientAuthCertificate),
-                    arraysize(kClientAuthCertificate)));
-    response.set_signature(std::string(
-        reinterpret_cast<const char*>(kSignature), arraysize(kSignature)));
+
+    response.set_client_auth_certificate(chain[0]);
+    for (size_t i = 1; i < chain.size(); ++i)
+      response.add_intermediate_certificate(chain[i]);
+
+    response.set_signature(CreateString(kSha1Signature));
+    *signed_data = CreateString(kSignedData);
+
     return response;
   }
 
-  static std::string CreatePeerCert() {
-    return std::string(reinterpret_cast<const char*>(kPeerCert),
-                       arraysize(kPeerCert));
-  }
-
   // Mangles a string by inverting the first byte.
-  static void MangleString(std::string* str) {
-    (*str)[0] = ~(*str)[0];
-  }
+  static void MangleString(std::string* str) { (*str)[0] = ~(*str)[0]; }
 };
 
 TEST_F(CastAuthUtilTest, VerifySuccess) {
-  AuthResponse auth_response = CreateAuthResponse();
-  AuthResult result = VerifyCredentials(
-      auth_response, CreatePeerCert());
+  std::string signed_data;
+  AuthResponse auth_response = CreateAuthResponse(&signed_data);
+  AuthResult result = VerifyCredentials(auth_response, signed_data);
   EXPECT_TRUE(result.success());
+  EXPECT_EQ(AuthResult::POLICY_AUDIO_ONLY, result.channel_policies);
 }
 
 TEST_F(CastAuthUtilTest, VerifyBadCA) {
-  AuthResponse auth_response = CreateAuthResponse();
+  std::string signed_data;
+  AuthResponse auth_response = CreateAuthResponse(&signed_data);
   MangleString(auth_response.mutable_intermediate_certificate(0));
-  AuthResult result = VerifyCredentials(
-      auth_response, CreatePeerCert());
+  AuthResult result = VerifyCredentials(auth_response, signed_data);
   EXPECT_FALSE(result.success());
   EXPECT_EQ(AuthResult::ERROR_CERT_NOT_SIGNED_BY_TRUSTED_CA, result.error_type);
 }
 
 TEST_F(CastAuthUtilTest, VerifyBadClientAuthCert) {
-  AuthResponse auth_response = CreateAuthResponse();
+  std::string signed_data;
+  AuthResponse auth_response = CreateAuthResponse(&signed_data);
   MangleString(auth_response.mutable_client_auth_certificate());
-  AuthResult result = VerifyCredentials(
-      auth_response, CreatePeerCert());
+  AuthResult result = VerifyCredentials(auth_response, signed_data);
   EXPECT_FALSE(result.success());
-  EXPECT_EQ(AuthResult::ERROR_CERT_PARSING_FAILED,
-            result.error_type);
+  // TODO(eroman): Not quite right of an error.
+  EXPECT_EQ(AuthResult::ERROR_CERT_NOT_SIGNED_BY_TRUSTED_CA, result.error_type);
 }
 
 TEST_F(CastAuthUtilTest, VerifyBadSignature) {
-  AuthResponse auth_response = CreateAuthResponse();
+  std::string signed_data;
+  AuthResponse auth_response = CreateAuthResponse(&signed_data);
   MangleString(auth_response.mutable_signature());
-  AuthResult result = VerifyCredentials(
-      auth_response, CreatePeerCert());
+  AuthResult result = VerifyCredentials(auth_response, signed_data);
   EXPECT_FALSE(result.success());
-  EXPECT_EQ(AuthResult::ERROR_SIGNED_BLOBS_MISMATCH,
-            result.error_type);
+  EXPECT_EQ(AuthResult::ERROR_SIGNED_BLOBS_MISMATCH, result.error_type);
 }
 
 TEST_F(CastAuthUtilTest, VerifyBadPeerCert) {
-  AuthResponse auth_response = CreateAuthResponse();
-  std::string peer_cert = CreatePeerCert();
-  MangleString(&peer_cert);
-  AuthResult result = VerifyCredentials(
-      auth_response, peer_cert);
+  std::string signed_data;
+  AuthResponse auth_response = CreateAuthResponse(&signed_data);
+  MangleString(&signed_data);
+  AuthResult result = VerifyCredentials(auth_response, signed_data);
   EXPECT_FALSE(result.success());
-  EXPECT_EQ(AuthResult::ERROR_SIGNED_BLOBS_MISMATCH,
-            result.error_type);
+  EXPECT_EQ(AuthResult::ERROR_SIGNED_BLOBS_MISMATCH, result.error_type);
 }
 
 }  // namespace
diff --git a/extensions/browser/api/cast_channel/cast_channel_api.cc b/extensions/browser/api/cast_channel/cast_channel_api.cc
index 809fdaf..2c57b39 100644
--- a/extensions/browser/api/cast_channel/cast_channel_api.cc
+++ b/extensions/browser/api/cast_channel/cast_channel_api.cc
@@ -18,7 +18,6 @@
 #include "base/time/default_clock.h"
 #include "base/values.h"
 #include "content/public/browser/browser_thread.h"
-#include "extensions/browser/api/cast_channel/cast_auth_ica.h"
 #include "extensions/browser/api/cast_channel/cast_message_util.h"
 #include "extensions/browser/api/cast_channel/cast_socket.h"
 #include "extensions/browser/api/cast_channel/keep_alive_delegate.h"
@@ -552,19 +551,12 @@
 }
 
 bool CastChannelSetAuthorityKeysFunction::Prepare() {
-  params_ = cast_channel::SetAuthorityKeys::Params::Create(*args_);
-  EXTENSION_FUNCTION_VALIDATE(params_.get());
   return true;
 }
 
 void CastChannelSetAuthorityKeysFunction::AsyncWorkStart() {
-  std::string& keys = params_->keys;
-  std::string& signature = params_->signature;
-  if (signature.empty() || keys.empty() ||
-      !cast_channel::SetTrustedCertificateAuthorities(keys, signature)) {
-    SetError("Unable to set authority keys.");
-  }
-
+  // TODO(eroman): crbug.com/601171: Delete this once the API is
+  // removed. It is currently a no-op.
   AsyncWorkCompleted();
 }
 
diff --git a/extensions/browser/api/cast_channel/cast_channel_api.h b/extensions/browser/api/cast_channel/cast_channel_api.h
index 9e3b799..b4cbba6 100644
--- a/extensions/browser/api/cast_channel/cast_channel_api.h
+++ b/extensions/browser/api/cast_channel/cast_channel_api.h
@@ -273,6 +273,8 @@
   DISALLOW_COPY_AND_ASSIGN(CastChannelGetLogsFunction);
 };
 
+// TODO(eroman): crbug.com/601171: Delete this entire extension API. It
+// is currently deprecated and calling the function has no effect.
 class CastChannelSetAuthorityKeysFunction : public CastChannelAsyncApiFunction {
  public:
   CastChannelSetAuthorityKeysFunction();
@@ -288,8 +290,6 @@
   DECLARE_EXTENSION_FUNCTION("cast.channel.setAuthorityKeys",
                              CAST_CHANNEL_SETAUTHORITYKEYS)
 
-  scoped_ptr<cast_channel::SetAuthorityKeys::Params> params_;
-
   DISALLOW_COPY_AND_ASSIGN(CastChannelSetAuthorityKeysFunction);
 };
 
diff --git a/extensions/browser/api/cast_channel/cast_channel_apitest.cc b/extensions/browser/api/cast_channel/cast_channel_apitest.cc
index 18a1fe2..84958b26 100644
--- a/extensions/browser/api/cast_channel/cast_channel_apitest.cc
+++ b/extensions/browser/api/cast_channel/cast_channel_apitest.cc
@@ -472,7 +472,11 @@
       extensions::test_util::CreateEmptyExtension());
   scoped_refptr<extensions::CastChannelSetAuthorityKeysFunction>
       cast_channel_set_authority_keys_function;
-  std::string errorResult = "Unable to set authority keys.";
+  // TODO(eroman): crbug.com/601171: Delete this test once the API has
+  // been removed. The API is deprecated and will trivially return
+  // success. So this is just testing that it succeeds for all inputs
+  // (even invalid ones).
+  std::string errorResult = "";
 
   cast_channel_set_authority_keys_function =
       CreateSetAuthorityKeysFunction(empty_extension);
diff --git a/extensions/browser/api/messaging/native_messaging_channel.h b/extensions/browser/api/messaging/native_messaging_channel.h
index 90425ba5..b368706 100644
--- a/extensions/browser/api/messaging/native_messaging_channel.h
+++ b/extensions/browser/api/messaging/native_messaging_channel.h
@@ -6,6 +6,7 @@
 #define EXTENSIONS_BROWSER_API_MESSAGING_NATIVE_MESSAGING_CHANNEL_H_
 
 #include "base/callback.h"
+#include "base/memory/scoped_ptr.h"
 
 namespace base {
 class Value;
diff --git a/extensions/browser/guest_view/extension_options/extension_options_apitest.cc b/extensions/browser/guest_view/extension_options/extension_options_apitest.cc
index 150e41b..264cde97 100644
--- a/extensions/browser/guest_view/extension_options/extension_options_apitest.cc
+++ b/extensions/browser/guest_view/extension_options/extension_options_apitest.cc
@@ -7,23 +7,37 @@
 #include "build/build_config.h"
 #include "chrome/browser/extensions/extension_apitest.h"
 #include "chrome/test/base/ui_test_utils.h"
+#include "content/public/common/content_switches.h"
 #include "extensions/common/feature_switch.h"
 #include "extensions/common/switches.h"
 #include "extensions/test/result_catcher.h"
+#include "testing/gtest/include/gtest/gtest.h"
 
 using extensions::Extension;
 using extensions::FeatureSwitch;
 
-class ExtensionOptionsApiTest : public ExtensionApiTest {
+class ExtensionOptionsApiTest : public ExtensionApiTest,
+                                public testing::WithParamInterface<bool> {
+  void SetUpCommandLine(base::CommandLine* command_line) override {
+    ExtensionApiTest::SetUpCommandLine(command_line);
+
+    bool use_cross_process_frames_for_guests = GetParam();
+    if (use_cross_process_frames_for_guests)
+      command_line->AppendSwitch(switches::kUseCrossProcessFramesForGuests);
+  }
 };
 
+INSTANTIATE_TEST_CASE_P(ExtensionOptionsApiTests,
+                        ExtensionOptionsApiTest,
+                        testing::Bool());
+
 // crbug/415949.
 #if defined(OS_MACOSX)
 #define MAYBE_ExtensionCanEmbedOwnOptions DISABLED_ExtensionCanEmbedOwnOptions
 #else
 #define MAYBE_ExtensionCanEmbedOwnOptions ExtensionCanEmbedOwnOptions
 #endif
-IN_PROC_BROWSER_TEST_F(ExtensionOptionsApiTest,
+IN_PROC_BROWSER_TEST_P(ExtensionOptionsApiTest,
                        MAYBE_ExtensionCanEmbedOwnOptions) {
   base::FilePath extension_dir =
       test_data_dir_.AppendASCII("extension_options").AppendASCII("embed_self");
@@ -31,7 +45,7 @@
   ASSERT_TRUE(RunExtensionSubtest("extension_options/embed_self", "test.html"));
 }
 
-IN_PROC_BROWSER_TEST_F(ExtensionOptionsApiTest,
+IN_PROC_BROWSER_TEST_P(ExtensionOptionsApiTest,
                        ShouldNotEmbedOtherExtensionsOptions) {
   base::FilePath dir = test_data_dir_.AppendASCII("extension_options")
                            .AppendASCII("embed_other");
@@ -57,7 +71,7 @@
   ASSERT_TRUE(catcher.GetNextResult());
 }
 
-IN_PROC_BROWSER_TEST_F(ExtensionOptionsApiTest,
+IN_PROC_BROWSER_TEST_P(ExtensionOptionsApiTest,
                        CannotEmbedUsingInvalidExtensionIds) {
   ASSERT_TRUE(InstallExtension(test_data_dir_.AppendASCII("extension_options")
                                    .AppendASCII("embed_invalid"),
diff --git a/extensions/browser/value_store/lazy_leveldb.cc b/extensions/browser/value_store/lazy_leveldb.cc
index da37f08..6061bd32 100644
--- a/extensions/browser/value_store/lazy_leveldb.cc
+++ b/extensions/browser/value_store/lazy_leveldb.cc
@@ -48,6 +48,15 @@
   return ValueStore::OTHER_ERROR;
 }
 
+leveldb::Status DeleteValue(leveldb::DB* db, const std::string& key) {
+  DCHECK_CURRENTLY_ON(BrowserThread::FILE);
+
+  leveldb::WriteBatch batch;
+  batch.Delete(key);
+
+  return db->Write(leveldb::WriteOptions(), &batch);
+}
+
 }  // namespace
 
 LazyLevelDb::LazyLevelDb(const std::string& uma_client_name,
@@ -106,14 +115,14 @@
   return ValueStore::Status();
 }
 
-leveldb::Status LazyLevelDb::Delete(const std::string& key) {
+ValueStore::Status LazyLevelDb::Delete(const std::string& key) {
   DCHECK_CURRENTLY_ON(BrowserThread::FILE);
-  DCHECK(db_.get());
 
-  leveldb::WriteBatch batch;
-  batch.Delete(key);
+  ValueStore::Status status = EnsureDbIsOpen();
+  if (!status.ok())
+    return status;
 
-  return db_->Write(leveldb::WriteOptions(), &batch);
+  return ToValueStoreError(DeleteValue(db_.get(), key));
 }
 
 ValueStore::BackingStoreRestoreStatus LazyLevelDb::LogRestoreStatus(
@@ -146,7 +155,7 @@
   DCHECK_CURRENTLY_ON(BrowserThread::FILE);
   leveldb::Status s;
   if (key && db_) {
-    s = Delete(*key);
+    s = DeleteValue(db_.get(), *key);
     // Deleting involves writing to the log, so it's possible to have a
     // perfectly OK database but still have a delete fail.
     if (s.ok())
@@ -191,7 +200,7 @@
     db_unrecoverable_ = true;
 
   if (s.ok() && key) {
-    s = Delete(*key);
+    s = DeleteValue(db_.get(), *key);
     if (s.ok()) {
       restore_status = ValueStore::VALUE_RESTORE_DELETE_SUCCESS;
     } else if (s.IsIOError()) {
@@ -263,9 +272,12 @@
   return true;
 }
 
-scoped_ptr<leveldb::Iterator> LazyLevelDb::CreateIterator(
-    const leveldb::ReadOptions& read_options) {
-  if (!EnsureDbIsOpen().ok())
-    return nullptr;
-  return make_scoped_ptr(db_->NewIterator(read_options));
+ValueStore::Status LazyLevelDb::CreateIterator(
+    const leveldb::ReadOptions& read_options,
+    scoped_ptr<leveldb::Iterator>* iterator) {
+  ValueStore::Status status = EnsureDbIsOpen();
+  if (!status.ok())
+    return status;
+  *iterator = make_scoped_ptr(db_->NewIterator(read_options));
+  return ValueStore::Status();
 }
diff --git a/extensions/browser/value_store/lazy_leveldb.h b/extensions/browser/value_store/lazy_leveldb.h
index f435faf..4fb93a63 100644
--- a/extensions/browser/value_store/lazy_leveldb.h
+++ b/extensions/browser/value_store/lazy_leveldb.h
@@ -18,37 +18,46 @@
 class Iterator;
 }  // namespace leveldb
 
+// Manages a lazy connection to a leveldb database. "lazy" means that the
+// leveldb database will be opened, when necessary, when any *public* method is
+// called. Derived classes are responsible for calling EnsureDbIsOpen() before
+// calling any other *protected* method.
 class LazyLevelDb {
  public:
-  // Create a new database iterator. This iterator *must* be deleted before
+  // Creates a new database iterator. This iterator *must* be deleted before
   // this database is closed.
-  scoped_ptr<leveldb::Iterator> CreateIterator(
-      const leveldb::ReadOptions& read_options);
+  ValueStore::Status CreateIterator(const leveldb::ReadOptions& read_options,
+                                    scoped_ptr<leveldb::Iterator>* iterator);
 
-  // Convert a leveldb::Status to a ValueStore::Status. Will also sanitize path
+  // Converts a leveldb::Status to a ValueStore::Status. Will also sanitize path
   // to eliminate user data path.
   ValueStore::Status ToValueStoreError(const leveldb::Status& status);
 
+  // Deletes a value (identified by |key|) from the database.
+  ValueStore::Status Delete(const std::string& key);
+
  protected:
   LazyLevelDb(const std::string& uma_client_name, const base::FilePath& path);
   ~LazyLevelDb();
 
-  // Close, if necessary, and delete the database directory.
+  // Closes, if necessary, and deletes the database directory.
   bool DeleteDbFile();
 
-  // Fix the |key| or database. If |key| is not null and the database is open
+  // Fixes the |key| or database. If |key| is not null and the database is open
   // then the key will be deleted. Otherwise the database will be repaired, and
   // failing that will be deleted.
   ValueStore::BackingStoreRestoreStatus FixCorruption(const std::string* key);
 
-  // Delete a value (identified by |key|) from the database.
-  leveldb::Status Delete(const std::string& key);
-
-  // Read a value from the database.
+  // Reads a |key| from the database, and populates |value| with the result. If
+  // the specified value does not exist in the database then an "OK" status will
+  // be returned and value will be unchanged. Caller must ensure the database is
+  // open before calling this method.
   ValueStore::Status Read(const std::string& key,
                           scoped_ptr<base::Value>* value);
 
-  // Ensure that the database is open.
+  // Opens the underlying database if not yet open. If the open fails due to
+  // corruption will attempt to repair the database. Failing that, will attempt
+  // to delete the database. Will only attempt a single recovery.
   ValueStore::Status EnsureDbIsOpen();
 
   const std::string& open_histogram_name() const {
diff --git a/extensions/browser/value_store/leveldb_scoped_database.cc b/extensions/browser/value_store/leveldb_scoped_database.cc
new file mode 100644
index 0000000..2fb8a9b7
--- /dev/null
+++ b/extensions/browser/value_store/leveldb_scoped_database.cc
@@ -0,0 +1,168 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "extensions/browser/value_store/leveldb_scoped_database.h"
+
+#include "base/json/json_reader.h"
+#include "base/json/json_writer.h"
+#include "content/public/browser/browser_thread.h"
+#include "third_party/leveldatabase/src/include/leveldb/write_batch.h"
+
+using content::BrowserThread;
+
+namespace {
+
+// Note: Changing the delimiter will change the database schema.
+const char kKeyDelimiter = ':';  // delimits scope and key
+const char kCannotSerialize[] = "Cannot serialize value to JSON";
+const char kInvalidJson[] = "Invalid JSON";
+const char kInvalidScope[] = "Invalid scope";
+
+}  // namespace
+
+bool LeveldbScopedDatabase::SplitKey(const std::string& full_key,
+                                     std::string* scope,
+                                     std::string* key) {
+  size_t pos = full_key.find(kKeyDelimiter);
+  if (pos == std::string::npos)
+    return false;
+  if (pos == 0)
+    return false;
+  *scope = full_key.substr(0, pos);
+  *key = full_key.substr(pos + 1);
+  return true;
+}
+
+bool LeveldbScopedDatabase::CreateKey(const std::string& scope,
+                                      const std::string& key,
+                                      std::string* scoped_key) {
+  if (scope.empty() || scope.find(kKeyDelimiter) != std::string::npos)
+    return false;
+  *scoped_key = scope + kKeyDelimiter + key;
+  return true;
+}
+
+LeveldbScopedDatabase::LeveldbScopedDatabase(const std::string& uma_client_name,
+                                             const base::FilePath& path)
+    : LazyLevelDb(uma_client_name, path) {}
+
+LeveldbScopedDatabase::~LeveldbScopedDatabase() {}
+
+ValueStore::Status LeveldbScopedDatabase::Read(const std::string& scope,
+                                               const std::string& key,
+                                               scoped_ptr<base::Value>* value) {
+  DCHECK_CURRENTLY_ON(BrowserThread::FILE);
+
+  ValueStore::Status status = EnsureDbIsOpen();
+  if (!status.ok())
+    return status;
+  std::string scoped_key;
+  if (!CreateKey(scope, key, &scoped_key))
+    return ValueStore::Status(ValueStore::OTHER_ERROR, kInvalidScope);
+
+  return LazyLevelDb::Read(scoped_key, value);
+}
+
+ValueStore::Status LeveldbScopedDatabase::Read(const std::string& scope,
+                                               base::DictionaryValue* values) {
+  DCHECK_CURRENTLY_ON(BrowserThread::FILE);
+
+  ValueStore::Status status = EnsureDbIsOpen();
+  if (!status.ok())
+    return status;
+
+  std::string prefix;
+  if (!CreateKey(scope, "", &prefix))
+    return ValueStore::Status(ValueStore::OTHER_ERROR, kInvalidScope);
+
+  scoped_ptr<leveldb::Iterator> it(db()->NewIterator(read_options()));
+
+  base::JSONReader json_reader;
+  scoped_ptr<base::DictionaryValue> settings(new base::DictionaryValue());
+
+  for (it->Seek(prefix); it->Valid() && it->key().starts_with(prefix);
+       it->Next()) {
+    leveldb::Slice descoped_key(it->key());
+    descoped_key.remove_prefix(prefix.size());
+    scoped_ptr<base::Value> value = json_reader.Read(
+        base::StringPiece(it->value().data(), it->value().size()));
+    if (!value) {
+      return ValueStore::Status(ValueStore::CORRUPTION,
+                                LazyLevelDb::Delete(it->key().ToString()).ok()
+                                    ? ValueStore::VALUE_RESTORE_DELETE_SUCCESS
+                                    : ValueStore::VALUE_RESTORE_DELETE_FAILURE,
+                                kInvalidJson);
+    }
+    values->SetWithoutPathExpansion(descoped_key.ToString(), std::move(value));
+  }
+
+  return status;
+}
+
+ValueStore::Status LeveldbScopedDatabase::Write(const std::string& scope,
+                                                const std::string& key,
+                                                const base::Value& value) {
+  ValueStore::Status status = EnsureDbIsOpen();
+  if (!status.ok())
+    return status;
+
+  leveldb::WriteBatch batch;
+  status = AddToWriteBatch(&batch, scope, key, value);
+  if (!status.ok())
+    return status;
+  return ToValueStoreError(db()->Write(write_options(), &batch));
+}
+
+ValueStore::Status LeveldbScopedDatabase::Write(
+    const std::string& scope,
+    const base::DictionaryValue& values) {
+  ValueStore::Status status = EnsureDbIsOpen();
+  if (!status.ok())
+    return status;
+
+  leveldb::WriteBatch batch;
+  for (base::DictionaryValue::Iterator it(values); !it.IsAtEnd();
+       it.Advance()) {
+    status = AddToWriteBatch(&batch, scope, it.key(), it.value());
+    if (!status.ok())
+      return status;
+  }
+
+  return ToValueStoreError(db()->Write(write_options(), &batch));
+}
+
+ValueStore::Status LeveldbScopedDatabase::DeleteValues(
+    const std::string& scope,
+    const std::vector<std::string>& keys) {
+  ValueStore::Status status = EnsureDbIsOpen();
+  if (!status.ok())
+    return status;
+
+  leveldb::WriteBatch batch;
+  std::string scoped_key;
+  for (const auto& key : keys) {
+    if (!CreateKey(scope, key, &scoped_key))
+      return ValueStore::Status(ValueStore::OTHER_ERROR, kInvalidScope);
+    batch.Delete(scoped_key);
+  }
+
+  return ToValueStoreError(db()->Write(write_options(), &batch));
+}
+
+ValueStore::Status LeveldbScopedDatabase::AddToWriteBatch(
+    leveldb::WriteBatch* batch,
+    const std::string& scope,
+    const std::string& key,
+    const base::Value& value) {
+  std::string scoped_key;
+  if (!CreateKey(scope, key, &scoped_key))
+    return ValueStore::Status(ValueStore::OTHER_ERROR, kInvalidScope);
+
+  std::string value_as_json;
+  if (!base::JSONWriter::Write(value, &value_as_json))
+    return ValueStore::Status(ValueStore::OTHER_ERROR, kCannotSerialize);
+
+  batch->Put(scoped_key, value_as_json);
+  return ValueStore::Status();
+}
diff --git a/extensions/browser/value_store/leveldb_scoped_database.h b/extensions/browser/value_store/leveldb_scoped_database.h
new file mode 100644
index 0000000..ef52f1d7
--- /dev/null
+++ b/extensions/browser/value_store/leveldb_scoped_database.h
@@ -0,0 +1,81 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef EXTENSIONS_BROWSER_VALUE_STORE_LEVELDB_SCOPED_DATABASE_H_
+#define EXTENSIONS_BROWSER_VALUE_STORE_LEVELDB_SCOPED_DATABASE_H_
+
+#include <string>
+
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "extensions/browser/value_store/lazy_leveldb.h"
+#include "extensions/browser/value_store/value_store.h"
+
+// This database is used to persist values with their keys scoped within a
+// specified namespace - AKA |scope|. Values will be written as follows:
+//
+// <scope><delimiter><scoped-key> -> <value>
+//
+// Note: |scope| must not contain the delimiter, but the |key| may.
+//
+class LeveldbScopedDatabase
+    : public LazyLevelDb,
+      public base::RefCountedThreadSafe<LeveldbScopedDatabase> {
+ public:
+  // Splits the full key into the scope and inner (scoped) key.
+  // Returns true if successfully split, and false if not and leaves |scope| and
+  // |key| unchanged.
+  static bool SplitKey(const std::string& full_key,
+                       std::string* scope,
+                       std::string* key);
+
+  // Creates a fully scoped key. |scope| cannot be an empty key and cannot
+  // contain the delimiter. |scoped_key| will be set to:
+  //
+  //   <scope><delimiter><key>
+  //
+  // Will return true when successful, false if not.
+  static bool CreateKey(const std::string& scope,
+                        const std::string& key,
+                        std::string* scoped_key);
+
+  LeveldbScopedDatabase(const std::string& uma_client_name,
+                        const base::FilePath& path);
+
+  // Reads a single |value| from the database for the specified |key|.
+  ValueStore::Status Read(const std::string& scope,
+                          const std::string& key,
+                          scoped_ptr<base::Value>* value);
+
+  // Reads all |values| from the database stored within the specified |scope|.
+  ValueStore::Status Read(const std::string& scope,
+                          base::DictionaryValue* values);
+
+  // Writes a single |key| => |value| to the database.
+  ValueStore::Status Write(const std::string& scope,
+                           const std::string& key,
+                           const base::Value& value);
+
+  // Writes all |values| to the database with the keys scoped with |scope|.
+  ValueStore::Status Write(const std::string& scope,
+                           const base::DictionaryValue& values);
+
+  // Deletes all |keys| from the databases withing the specified |scope|.
+  ValueStore::Status DeleteValues(const std::string& scope,
+                                  const std::vector<std::string>& keys);
+
+ protected:
+  friend class base::RefCountedThreadSafe<LeveldbScopedDatabase>;
+  virtual ~LeveldbScopedDatabase();
+
+  static ValueStore::Status AddToWriteBatch(leveldb::WriteBatch* batch,
+                                            const std::string& scope,
+                                            const std::string& key,
+                                            const base::Value& value);
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(LeveldbScopedDatabase);
+};
+
+#endif  // EXTENSIONS_BROWSER_VALUE_STORE_LEVELDB_SCOPED_DATABASE_H_
diff --git a/extensions/browser/value_store/leveldb_scoped_database_unittest.cc b/extensions/browser/value_store/leveldb_scoped_database_unittest.cc
new file mode 100644
index 0000000..738802b
--- /dev/null
+++ b/extensions/browser/value_store/leveldb_scoped_database_unittest.cc
@@ -0,0 +1,205 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "extensions/browser/value_store/leveldb_scoped_database.h"
+
+#include <stddef.h>
+
+#include <map>
+#include <string>
+
+#include "base/files/file_util.h"
+#include "base/files/scoped_temp_dir.h"
+#include "base/memory/ref_counted.h"
+#include "base/values.h"
+#include "content/public/test/test_browser_thread_bundle.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace {
+const char kTestUMAClientName[] = "Test";
+}  // namespace
+
+class LeveldbScopedDatabaseUnitTest : public testing::Test {
+ public:
+  LeveldbScopedDatabaseUnitTest() {}
+  ~LeveldbScopedDatabaseUnitTest() override {}
+
+ protected:
+  void SetUp() override {
+    ASSERT_TRUE(database_dir_.CreateUniqueTempDir());
+    db_ = new LeveldbScopedDatabase(kTestUMAClientName, database_dir_.path());
+  }
+
+  void TearDown() override {
+    db_ = nullptr;
+    base::DeleteFile(database_dir_.path(), true);
+  }
+
+  ValueStore::Status ReadAllValues(
+      std::map<std::string, std::string>* values) const {
+    values->clear();
+    leveldb::ReadOptions read_options;
+    read_options.verify_checksums = true;
+    scoped_ptr<leveldb::Iterator> iterator;
+    ValueStore::Status status = db_->CreateIterator(read_options, &iterator);
+    if (!status.ok())
+      return status;
+    iterator->SeekToFirst();
+    while (iterator->Valid()) {
+      // The LeveldbProfileDatabase writes all values as JSON strings.
+      // This method returns the encoded strings.
+      (*values)[iterator->key().ToString()] = iterator->value().ToString();
+      iterator->Next();
+    }
+    return db_->ToValueStoreError(iterator->status());
+  }
+
+  content::TestBrowserThreadBundle thread_bundle_;
+  base::ScopedTempDir database_dir_;
+  scoped_refptr<LeveldbScopedDatabase> db_;
+};
+
+TEST_F(LeveldbScopedDatabaseUnitTest, TestSplitKey) {
+  std::string scope;
+  std::string key;
+  EXPECT_TRUE(LeveldbScopedDatabase::SplitKey("s:k", &scope, &key));
+  EXPECT_EQ(scope, "s");
+  EXPECT_EQ(key, "k");
+  EXPECT_TRUE(LeveldbScopedDatabase::SplitKey("s:", &scope, &key));
+  EXPECT_EQ(scope, "s");
+  EXPECT_EQ(key, "");
+  EXPECT_TRUE(LeveldbScopedDatabase::SplitKey("s:k:o", &scope, &key));
+  EXPECT_EQ(scope, "s");
+  EXPECT_EQ(key, "k:o");
+  EXPECT_FALSE(LeveldbScopedDatabase::SplitKey("s-k", &scope, &key));
+  EXPECT_FALSE(LeveldbScopedDatabase::SplitKey("", &scope, &key));
+  EXPECT_FALSE(LeveldbScopedDatabase::SplitKey(":k", &scope, &key));
+}
+
+TEST_F(LeveldbScopedDatabaseUnitTest, TestCreateKey) {
+  std::string scoped_key;
+
+  EXPECT_TRUE(LeveldbScopedDatabase::CreateKey("scope", "key", &scoped_key));
+  EXPECT_EQ("scope:key", scoped_key);
+  EXPECT_TRUE(LeveldbScopedDatabase::CreateKey("scope", "", &scoped_key));
+  EXPECT_EQ("scope:", scoped_key);
+  EXPECT_TRUE(LeveldbScopedDatabase::CreateKey("scope", "key:o", &scoped_key));
+  EXPECT_EQ("scope:key:o", scoped_key);
+
+  EXPECT_FALSE(LeveldbScopedDatabase::CreateKey("", "key", &scoped_key));
+  EXPECT_FALSE(
+      LeveldbScopedDatabase::CreateKey("scope:withdelim", "key", &scoped_key));
+}
+
+TEST_F(LeveldbScopedDatabaseUnitTest, TestWrite) {
+  std::map<std::string, std::string> db_values;
+  EXPECT_TRUE(ReadAllValues(&db_values).ok());
+  EXPECT_EQ(0u, db_values.size());
+
+  base::DictionaryValue scope1_values;
+  scope1_values.SetString("s1_key1", "s1_value1");
+  scope1_values.SetString("s1_key2", "s1_value2");
+  EXPECT_FALSE(db_->Write("", scope1_values).ok());
+  EXPECT_TRUE(db_->Write("scope1", scope1_values).ok());
+
+  base::DictionaryValue scope2_values;
+  scope2_values.SetString("s2_key1", "s2_value1");
+  scope2_values.SetString("s2_key2", "s2_value2");
+  EXPECT_TRUE(db_->Write("scope2", scope2_values).ok());
+
+  // Read all values using raw leveldb. Values are JSON strings.
+  EXPECT_TRUE(ReadAllValues(&db_values).ok());
+  EXPECT_EQ(4u, db_values.size());
+  EXPECT_EQ("\"s1_value1\"", db_values["scope1:s1_key1"]);
+  EXPECT_EQ("\"s1_value2\"", db_values["scope1:s1_key2"]);
+  EXPECT_EQ("\"s2_value1\"", db_values["scope2:s2_key1"]);
+  EXPECT_EQ("\"s2_value2\"", db_values["scope2:s2_key2"]);
+
+  // Intentionally overwrite value (with a new value).
+  base::DictionaryValue changed_scope2_values;
+  changed_scope2_values.SetString("s2_key1", "s2_value1");
+  changed_scope2_values.SetString("s2_key2", "s2_value3");
+  EXPECT_TRUE(db_->Write("scope2", changed_scope2_values).ok());
+
+  EXPECT_TRUE(ReadAllValues(&db_values).ok());
+  EXPECT_EQ(4u, db_values.size());
+  EXPECT_EQ("\"s1_value1\"", db_values["scope1:s1_key1"]);
+  EXPECT_EQ("\"s1_value2\"", db_values["scope1:s1_key2"]);
+  EXPECT_EQ("\"s2_value1\"", db_values["scope2:s2_key1"]);
+  EXPECT_EQ("\"s2_value3\"", db_values["scope2:s2_key2"]);
+}
+
+TEST_F(LeveldbScopedDatabaseUnitTest, TestRead) {
+  base::DictionaryValue scope1_values;
+  scope1_values.SetString("s1_key1", "s1_value1");
+  scope1_values.SetString("s1_key2", "s1_value2");
+  EXPECT_TRUE(db_->Write("scope1", scope1_values).ok());
+
+  base::DictionaryValue scope2_values;
+  scope2_values.SetString("s2_key1", "s2_value1");
+  scope2_values.SetString("s2_key2", "s2_value2");
+  EXPECT_TRUE(db_->Write("scope2", scope2_values).ok());
+
+  // And test an empty scope.
+  EXPECT_FALSE(db_->Write("", scope2_values).ok());
+
+  base::DictionaryValue read_s1_vals;
+  EXPECT_FALSE(db_->Read("", &read_s1_vals).ok());
+  EXPECT_TRUE(db_->Read("scope1", &read_s1_vals).ok());
+  EXPECT_TRUE(scope1_values.Equals(&read_s1_vals));
+
+  base::DictionaryValue read_s2_vals;
+  EXPECT_TRUE(db_->Read("scope2", &read_s2_vals).ok());
+  EXPECT_TRUE(scope2_values.Equals(&read_s2_vals));
+}
+
+TEST_F(LeveldbScopedDatabaseUnitTest, TestEmptyValue) {
+  base::DictionaryValue values;
+  values.SetString("s1_key1", "");
+  EXPECT_TRUE(db_->Write("scope1", values).ok());
+
+  scoped_ptr<base::Value> value;
+  ASSERT_TRUE(db_->Read("scope1", "s1_key1", &value).ok());
+  std::string str;
+  EXPECT_TRUE(value->GetAsString(&str));
+  EXPECT_EQ(str, "");
+}
+
+TEST_F(LeveldbScopedDatabaseUnitTest, TestValueContainingDelimiter) {
+  base::DictionaryValue values;
+  values.SetString("s1_key1", "with:delimiter");
+  EXPECT_TRUE(db_->Write("scope1", values).ok());
+
+  scoped_ptr<base::Value> value;
+  ASSERT_TRUE(db_->Read("scope1", "s1_key1", &value).ok());
+  std::string str;
+  EXPECT_TRUE(value->GetAsString(&str));
+  EXPECT_EQ(str, "with:delimiter");
+}
+
+TEST_F(LeveldbScopedDatabaseUnitTest, TestDeleteValues) {
+  base::DictionaryValue scope1_values;
+  scope1_values.SetString("s1_key1", "s1_value1");
+  scope1_values.SetString("s1_key2", "s1_value2");
+  EXPECT_TRUE(db_->Write("scope1", scope1_values).ok());
+
+  base::DictionaryValue scope2_values;
+  scope2_values.SetString("s2_key1", "s2_value1");
+  scope2_values.SetString("s2_key2", "s2_value2");
+  EXPECT_TRUE(db_->Write("scope2", scope2_values).ok());
+
+  std::vector<std::string> keys;
+  keys.push_back("s2_key1");
+  keys.push_back("s2_key2");
+  keys.push_back("s1_key1");
+  EXPECT_TRUE(db_->DeleteValues("scope2", keys).ok());
+
+  base::DictionaryValue read_s1_vals;
+  EXPECT_TRUE(db_->Read("scope1", &read_s1_vals).ok());
+  EXPECT_TRUE(scope1_values.Equals(&read_s1_vals));
+
+  base::DictionaryValue read_s2_vals;
+  EXPECT_TRUE(db_->Read("scope2", &read_s2_vals).ok());
+  EXPECT_TRUE(read_s2_vals.empty());
+}
diff --git a/extensions/browser/value_store/leveldb_value_store.cc b/extensions/browser/value_store/leveldb_value_store.cc
index c5a989a..a65aa8b 100644
--- a/extensions/browser/value_store/leveldb_value_store.cc
+++ b/extensions/browser/value_store/leveldb_value_store.cc
@@ -25,6 +25,7 @@
 #include "third_party/leveldatabase/src/include/leveldb/iterator.h"
 #include "third_party/leveldatabase/src/include/leveldb/write_batch.h"
 
+using base::StringPiece;
 using content::BrowserThread;
 
 namespace {
@@ -67,21 +68,7 @@
 }
 
 ValueStore::ReadResult LeveldbValueStore::Get(const std::string& key) {
-  DCHECK_CURRENTLY_ON(BrowserThread::FILE);
-
-  Status status = EnsureDbIsOpen();
-  if (!status.ok())
-    return MakeReadResult(status);
-
-  scoped_ptr<base::Value> setting;
-  status.Merge(Read(key, &setting));
-  if (!status.ok())
-    return MakeReadResult(status);
-
-  base::DictionaryValue* settings = new base::DictionaryValue();
-  if (setting)
-    settings->SetWithoutPathExpansion(key, setting.release());
-  return MakeReadResult(make_scoped_ptr(settings), status);
+  return Get(std::vector<std::string>(1, key));
 }
 
 ValueStore::ReadResult LeveldbValueStore::Get(
@@ -120,7 +107,7 @@
   for (it->SeekToFirst(); it->Valid(); it->Next()) {
     std::string key = it->key().ToString();
     scoped_ptr<base::Value> value =
-        json_reader.ReadToValue(it->value().ToString());
+        json_reader.Read(StringPiece(it->value().data(), it->value().size()));
     if (!value) {
       return MakeReadResult(
           Status(CORRUPTION, Delete(key).ok() ? VALUE_RESTORE_DELETE_SUCCESS
@@ -130,11 +117,6 @@
     settings->SetWithoutPathExpansion(key, std::move(value));
   }
 
-  if (it->status().IsNotFound()) {
-    NOTREACHED() << "IsNotFound() but iterating over all keys?!";
-    return MakeReadResult(std::move(settings), status);
-  }
-
   if (!it->status().ok()) {
     status.Merge(ToValueStoreError(it->status()));
     return MakeReadResult(status);
diff --git a/extensions/common/cast/cast_cert_validator.cc b/extensions/common/cast/cast_cert_validator.cc
index 10663950..2211bb6 100644
--- a/extensions/common/cast/cast_cert_validator.cc
+++ b/extensions/common/cast/cast_cert_validator.cc
@@ -4,22 +4,11 @@
 
 #include "extensions/common/cast/cast_cert_validator.h"
 
-#include <openssl/digest.h>
-#include <openssl/evp.h>
-#include <openssl/rsa.h>
-#include <openssl/x509.h>
 #include <stddef.h>
 #include <stdint.h>
 #include <algorithm>
 #include <utility>
 
-#include "base/logging.h"
-#include "base/strings/string_number_conversions.h"
-#include "base/strings/string_util.h"
-#include "base/strings/stringprintf.h"
-#include "crypto/openssl_util.h"
-#include "crypto/scoped_openssl_types.h"
-#include "extensions/browser/api/cast_channel/cast_auth_ica.h"
 #include "net/cert/internal/certificate_policies.h"
 #include "net/cert/internal/extended_key_usage.h"
 #include "net/cert/internal/parse_certificate.h"
@@ -28,10 +17,7 @@
 #include "net/cert/internal/signature_policy.h"
 #include "net/cert/internal/verify_certificate_chain.h"
 #include "net/cert/internal/verify_signed_data.h"
-#include "net/cert/x509_certificate.h"
-#include "net/cert/x509_util_openssl.h"
 #include "net/der/input.h"
-#include "net/ssl/scoped_openssl_types.h"
 
 namespace extensions {
 namespace api {
@@ -196,18 +182,15 @@
   return make_scoped_ptr(new net::SimpleSignaturePolicy(2048));
 }
 
-// TODO(eroman): Remove "2" from the name once the old approach is no longer
-// used.
-class CertVerificationContextImpl2 : public CertVerificationContext {
+class CertVerificationContextImpl : public CertVerificationContext {
  public:
   // Save a copy of the passed in public key (DER) and common name (text).
-  CertVerificationContextImpl2(const net::der::Input& spki,
-                               const base::StringPiece& common_name)
+  CertVerificationContextImpl(const net::der::Input& spki,
+                              const base::StringPiece& common_name)
       : spki_(spki.AsString()), common_name_(common_name.as_string()) {}
 
-  VerificationResult VerifySignatureOverData(
-      const base::StringPiece& signature,
-      const base::StringPiece& data) const override {
+  bool VerifySignatureOverData(const base::StringPiece& signature,
+                               const base::StringPiece& data) const override {
     // This code assumes the signature algorithm was RSASSA PKCS#1 v1.5 with
     // SHA-1.
     // TODO(eroman): Is it possible to use other hash algorithms?
@@ -219,19 +202,10 @@
     // least 2048-bits long.
     auto signature_policy = CreateCastSignaturePolicy();
 
-    bool success = net::VerifySignedData(
+    return net::VerifySignedData(
         *signature_algorithm, net::der::Input(data),
         net::der::BitString(net::der::Input(signature), 0),
         net::der::Input(&spki_), signature_policy.get());
-
-    if (success)
-      return VerificationResult();
-
-    // TODO(eroman): This error is ambiguous. Could have failed for a number of
-    // reasons, not just invalid signatures (i.e. SPKI parsing, signature
-    // policy, etc).
-    return VerificationResult("Signature verification failed.",
-                              VerificationResult::ERROR_SIGNATURE_INVALID);
   }
 
   std::string GetCommonName() const override { return common_name_; }
@@ -342,68 +316,10 @@
   if (!GetCommonNameFromSubject(tbs.subject_tlv, &common_name))
     return false;
 
-  context->reset(new CertVerificationContextImpl2(tbs.spki_tlv, common_name));
+  context->reset(new CertVerificationContextImpl(tbs.spki_tlv, common_name));
   return true;
 }
 
-class CertVerificationContextImpl : public CertVerificationContext {
- public:
-  // Takes ownership of the passed-in x509 object
-  explicit CertVerificationContextImpl(net::ScopedX509 x509)
-      : x509_(std::move(x509)) {}
-
-  VerificationResult VerifySignatureOverData(
-      const base::StringPiece& signature,
-      const base::StringPiece& data) const override {
-    // Retrieve public key object.
-    crypto::ScopedEVP_PKEY public_key(X509_get_pubkey(x509_.get()));
-    if (!public_key) {
-      return VerificationResult(
-          "Failed to extract device certificate public key.",
-          VerificationResult::ERROR_CERT_INVALID);
-    }
-    // Make sure the key is RSA.
-    const int public_key_type = EVP_PKEY_id(public_key.get());
-    if (public_key_type != EVP_PKEY_RSA) {
-      return VerificationResult(
-          std::string("Expected RSA key type for client certificate, got ") +
-              base::IntToString(public_key_type) + " instead.",
-          VerificationResult::ERROR_CERT_INVALID);
-    }
-    // Verify signature.
-    const crypto::ScopedEVP_MD_CTX ctx(EVP_MD_CTX_create());
-    if (!ctx ||
-        !EVP_DigestVerifyInit(ctx.get(), nullptr, EVP_sha1(), nullptr,
-                              public_key.get()) ||
-        !EVP_DigestVerifyUpdate(ctx.get(), data.data(), data.size()) ||
-        !EVP_DigestVerifyFinal(
-            ctx.get(), reinterpret_cast<const uint8_t*>(signature.data()),
-            signature.size())) {
-      return VerificationResult("Signature verification failed.",
-                                VerificationResult::ERROR_SIGNATURE_INVALID);
-    }
-    return VerificationResult();
-  }
-
-  std::string GetCommonName() const override {
-    int common_name_length = X509_NAME_get_text_by_NID(
-        x509_->cert_info->subject, NID_commonName, NULL, 0);
-    if (common_name_length < 0)
-      return std::string();
-    std::string common_name;
-    common_name_length = X509_NAME_get_text_by_NID(
-        x509_->cert_info->subject, NID_commonName,
-        base::WriteInto(&common_name,
-                        static_cast<size_t>(common_name_length) + 1),
-        common_name_length + 1);
-    if (common_name_length < 0)
-      return std::string();
-    return common_name;
-  }
-
- private:
-  net::ScopedX509 x509_;
-};
 
 // Converts a base::Time::Exploded to a net::der::GeneralizedTime.
 net::der::GeneralizedTime ConvertExplodedTime(
@@ -420,78 +336,10 @@
 
 }  // namespace
 
-VerificationResult::VerificationResult() : VerificationResult("", ERROR_NONE) {}
-
-VerificationResult::VerificationResult(const std::string& in_error_message,
-                                       ErrorType in_error_type)
-    : error_type(in_error_type), error_message(in_error_message) {}
-
-VerificationResult VerifyDeviceCert(
-    const base::StringPiece& device_cert,
-    const std::vector<std::string>& ica_certs,
-    scoped_ptr<CertVerificationContext>* context) {
-  crypto::EnsureOpenSSLInit();
-  crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE);
-
-  // If the list of intermediates is empty then use kPublicKeyICA1 as
-  // the trusted CA (legacy case).
-  // Otherwise, use the first intermediate in the list as long as it
-  // is in the allowed list of intermediates.
-  base::StringPiece ica_public_key_der =
-      (ica_certs.size() == 0)
-          ? cast_channel::GetDefaultTrustedICAPublicKey()
-          : cast_channel::GetTrustedICAPublicKey(ica_certs[0]);
-
-  if (ica_public_key_der.empty()) {
-    return VerificationResult(
-        "Device certificate is not signed by a trusted CA",
-        VerificationResult::ERROR_CERT_UNTRUSTED);
-  }
-
-  // Initialize the ICA public key.
-  crypto::ScopedRSA ica_public_key_rsa(RSA_public_key_from_bytes(
-      reinterpret_cast<const uint8_t*>(ica_public_key_der.data()),
-      ica_public_key_der.size()));
-  if (!ica_public_key_rsa) {
-    return VerificationResult("Failed to import trusted public key.",
-                              VerificationResult::ERROR_INTERNAL);
-  }
-  crypto::ScopedEVP_PKEY ica_public_key_evp(EVP_PKEY_new());
-  if (!ica_public_key_evp ||
-      !EVP_PKEY_set1_RSA(ica_public_key_evp.get(), ica_public_key_rsa.get())) {
-    return VerificationResult("Failed to import trusted public key.",
-                              VerificationResult::ERROR_INTERNAL);
-  }
-
-  // Parse the device certificate.
-  const uint8_t* device_cert_der_ptr =
-      reinterpret_cast<const uint8_t*>(device_cert.data());
-  const uint8_t* device_cert_der_end = device_cert_der_ptr + device_cert.size();
-  net::ScopedX509 device_cert_x509(
-      d2i_X509(NULL, &device_cert_der_ptr, device_cert.size()));
-  if (!device_cert_x509 || device_cert_der_ptr != device_cert_der_end) {
-    return VerificationResult("Failed to parse device certificate.",
-                              VerificationResult::ERROR_CERT_INVALID);
-  }
-
-  // Verify device certificate.
-  if (X509_verify(device_cert_x509.get(), ica_public_key_evp.get()) != 1) {
-    return VerificationResult(
-        "Device certificate signature verification failed.",
-        VerificationResult::ERROR_CERT_INVALID);
-  }
-
-  if (context)
-    context->reset(
-        new CertVerificationContextImpl(std::move(device_cert_x509)));
-
-  return VerificationResult();
-}
-
-bool VerifyDeviceCert2(const std::vector<std::string>& certs,
-                       const base::Time::Exploded& time,
-                       scoped_ptr<CertVerificationContext>* context,
-                       CastDeviceCertPolicy* policy) {
+bool VerifyDeviceCert(const std::vector<std::string>& certs,
+                      const base::Time::Exploded& time,
+                      scoped_ptr<CertVerificationContext>* context,
+                      CastDeviceCertPolicy* policy) {
   // Initialize the trust store used for verifying Cast
   // device certificates.
   //
@@ -527,13 +375,7 @@
   // Use a bogus CommonName, since this is just exposed for testing signature
   // verification by unittests.
   return make_scoped_ptr(
-      new CertVerificationContextImpl2(net::der::Input(spki), "CommonName"));
-}
-
-bool SetTrustedCertificateAuthoritiesForTest(const std::string& keys,
-                                             const std::string& signature) {
-  return extensions::api::cast_channel::SetTrustedCertificateAuthorities(
-      keys, signature);
+      new CertVerificationContextImpl(net::der::Input(spki), "CommonName"));
 }
 
 }  // namespace cast_crypto
diff --git a/extensions/common/cast/cast_cert_validator.h b/extensions/common/cast/cast_cert_validator.h
index f89a946..c435ebb8 100644
--- a/extensions/common/cast/cast_cert_validator.h
+++ b/extensions/common/cast/cast_cert_validator.h
@@ -18,39 +18,6 @@
 namespace api {
 namespace cast_crypto {
 
-// Status of a certificate or certificate verification operation.
-struct VerificationResult {
-  // Mapped to extensions::api::cast_channel::AuthResult::ErrorType in
-  // cast_auto_util.cc. Update the mapping code when modifying this enum.
-  enum ErrorType {
-    // Verification has succeeded.
-    ERROR_NONE = 0,
-    // There was a problem with the certificate, such as invalid or corrupt
-    // certificate data or invalid issuing certificate signature.
-    ERROR_CERT_INVALID,
-    // Certificate may be valid, but not trusted in this context.
-    ERROR_CERT_UNTRUSTED,
-    // Signature verification failed
-    ERROR_SIGNATURE_INVALID,
-    // Catch-all for internal errors that are not covered by the other error
-    // types.
-    ERROR_INTERNAL
-  };
-
-  // Constructs a VerificationResult that corresponds to success.
-  VerificationResult();
-
-  // Construct error-related objects
-  VerificationResult(const std::string& error_message, ErrorType error_type);
-
-  bool Success() const { return error_type == ERROR_NONE; }
-  bool Failure() const { return error_type != ERROR_NONE; }
-
-  ErrorType error_type;
-  // Human-readable description of the problem if error_type != ERROR_NONE
-  std::string error_message;
-};
-
 // Describes the policy for a Device certificate.
 enum class CastDeviceCertPolicy {
   // The device certificate is unrestricted.
@@ -70,10 +37,10 @@
 
   // Use the public key from the verified certificate to verify a
   // sha1WithRSAEncryption |signature| over arbitrary |data|. Both |signature|
-  // and |data| hold raw binary data.
-  virtual VerificationResult VerifySignatureOverData(
-      const base::StringPiece& signature,
-      const base::StringPiece& data) const = 0;
+  // and |data| hold raw binary data. Returns true if the signature was
+  // correct.
+  virtual bool VerifySignatureOverData(const base::StringPiece& signature,
+                                       const base::StringPiece& data) const = 0;
 
   // Retrieve the Common Name attribute of the subject's distinguished name from
   // the verified certificate, if present.  Returns an empty string if no Common
@@ -84,15 +51,6 @@
   DISALLOW_COPY_AND_ASSIGN(CertVerificationContext);
 };
 
-// Verify a cast device certificate, using optional intermediate certificate
-// authority certificates. |context| will be populated with an instance of
-// CertVerificationContext, which allows to perform additional verification
-// steps as required.
-VerificationResult VerifyDeviceCert(
-    const base::StringPiece& device_cert,
-    const std::vector<std::string>& ica_certs,
-    scoped_ptr<CertVerificationContext>* context);
-
 // Verifies a cast device certficate given a chain of DER-encoded certificates.
 //
 // Inputs:
@@ -115,13 +73,10 @@
 //     properties from the device certificate (Common Name).
 //   * |policy| is filled with an indication of the device certificate's policy
 //     (i.e. is it for audio-only devices or is it unrestricted?)
-//
-// TODO(eroman): Remove "2" from the name once the old approach is no longer
-// used.
-bool VerifyDeviceCert2(const std::vector<std::string>& certs,
-                       const base::Time::Exploded& time,
-                       scoped_ptr<CertVerificationContext>* context,
-                       CastDeviceCertPolicy* policy) WARN_UNUSED_RESULT;
+bool VerifyDeviceCert(const std::vector<std::string>& certs,
+                      const base::Time::Exploded& time,
+                      scoped_ptr<CertVerificationContext>* context,
+                      CastDeviceCertPolicy* policy) WARN_UNUSED_RESULT;
 
 // Exposed only for unit-tests, not for use in production code.
 // Production code would get a context from VerifyDeviceCert().
@@ -131,9 +86,6 @@
 scoped_ptr<CertVerificationContext> CertVerificationContextImplForTest(
     const base::StringPiece& spki);
 
-// Sets trusted certificate authorities. Only exposed for tests.
-bool SetTrustedCertificateAuthoritiesForTest(const std::string& keys,
-                                             const std::string& signature);
 
 }  // namespace cast_crypto
 }  // namespace api
diff --git a/extensions/common/cast/cast_cert_validator_unittest.cc b/extensions/common/cast/cast_cert_validator_unittest.cc
index 1ff2bef..b2bc8ed8 100644
--- a/extensions/common/cast/cast_cert_validator_unittest.cc
+++ b/extensions/common/cast/cast_cert_validator_unittest.cc
@@ -85,7 +85,7 @@
 
   scoped_ptr<CertVerificationContext> context;
   CastDeviceCertPolicy policy;
-  bool result = VerifyDeviceCert2(certs, time, &context, &policy);
+  bool result = VerifyDeviceCert(certs, time, &context, &policy);
 
   if (expected_result == RESULT_SUCCESS) {
     ASSERT_TRUE(result);
@@ -98,8 +98,7 @@
     // Test that an invalid signature fails.
 
     EXPECT_FALSE(
-        context->VerifySignatureOverData("bogus signature", "bogus data")
-            .Success());
+        context->VerifySignatureOverData("bogus signature", "bogus data"));
 
     // Note that testing that a correct signature succeeds would be a natural
     // test to follow with, but we don't have signed data for these device
@@ -299,7 +298,7 @@
 
   scoped_ptr<CertVerificationContext> context;
   CastDeviceCertPolicy policy;
-  ASSERT_TRUE(VerifyDeviceCert2(certs, AprilFirst2016(), &context, &policy));
+  ASSERT_TRUE(VerifyDeviceCert(certs, AprilFirst2016(), &context, &policy));
 
   unsigned char kData[] = {
       0x5f, 0x76, 0x0d, 0xc8, 0x4b, 0xe7, 0x6e, 0xcb, 0x31, 0x58, 0xca, 0xd3,
@@ -373,17 +372,13 @@
       0x15, 0x0e, 0xf0, 0x4e, 0x4a, 0x10, 0x99, 0x62, 0xdd, 0xf4, 0x32, 0x6b,
       0xf6, 0x23, 0x12, 0x90};
 
-  EXPECT_TRUE(context
-                  ->VerifySignatureOverData(CreateString(kSha1Signature),
-                                            CreateString(kData))
-                  .Success());
+  EXPECT_TRUE(context->VerifySignatureOverData(CreateString(kSha1Signature),
+                                               CreateString(kData)));
 
   // Verify using a VALID SHA-256 signature. This only fails because it is
   // expecting a SHA-1 signature not a SHA-256 signature.
-  EXPECT_FALSE(context
-                   ->VerifySignatureOverData(CreateString(kSha256Signature),
-                                             CreateString(kData))
-                   .Success());
+  EXPECT_FALSE(context->VerifySignatureOverData(CreateString(kSha256Signature),
+                                                CreateString(kData)));
 }
 
 // ------------------------------------------------------
@@ -440,10 +435,8 @@
   auto context =
       CertVerificationContextImplForTest(CreateString(kEx1PublicKeySpki));
 
-  EXPECT_FALSE(context
-                   ->VerifySignatureOverData(CreateString(kEx1Signature),
-                                             CreateString(kEx1Message))
-                   .Success());
+  EXPECT_FALSE(context->VerifySignatureOverData(CreateString(kEx1Signature),
+                                                CreateString(kEx1Message)));
 }
 
 // ------------------------------------------------------
@@ -516,10 +509,8 @@
   auto context =
       CertVerificationContextImplForTest(CreateString(kEx2PublicKeySpki));
 
-  EXPECT_TRUE(context
-                  ->VerifySignatureOverData(CreateString(kEx2Signature),
-                                            CreateString(kEx2Message))
-                  .Success());
+  EXPECT_TRUE(context->VerifySignatureOverData(CreateString(kEx2Signature),
+                                               CreateString(kEx2Message)));
 }
 
 }  // namespace
diff --git a/extensions/extensions.gypi b/extensions/extensions.gypi
index 69963fa..7f00e251 100644
--- a/extensions/extensions.gypi
+++ b/extensions/extensions.gypi
@@ -272,8 +272,6 @@
       'browser/api/bluetooth_socket/bluetooth_socket_api.h',
       'browser/api/bluetooth_socket/bluetooth_socket_event_dispatcher.cc',
       'browser/api/bluetooth_socket/bluetooth_socket_event_dispatcher.h',
-      'browser/api/cast_channel/cast_auth_ica.cc',
-      'browser/api/cast_channel/cast_auth_ica.h',
       'browser/api/cast_channel/cast_auth_util.cc',
       'browser/api/cast_channel/cast_auth_util.h',
       'browser/api/cast_channel/cast_channel_api.cc',
@@ -789,6 +787,8 @@
       'browser/value_store/lazy_leveldb.h',
       'browser/value_store/legacy_value_store_factory.cc',
       'browser/value_store/legacy_value_store_factory.h',
+      'browser/value_store/leveldb_scoped_database.cc',
+      'browser/value_store/leveldb_scoped_database.h',
       'browser/value_store/leveldb_value_store.cc',
       'browser/value_store/leveldb_value_store.h',
       'browser/value_store/test_value_store_factory.cc',
diff --git a/extensions/extensions_tests.gypi b/extensions/extensions_tests.gypi
index 422c2f5..4fa5de5 100644
--- a/extensions/extensions_tests.gypi
+++ b/extensions/extensions_tests.gypi
@@ -42,7 +42,6 @@
       'browser/api/alarms/alarms_api_unittest.cc',
       'browser/api/api_resource_manager_unittest.cc',
       'browser/api/bluetooth/bluetooth_event_router_unittest.cc',
-      'browser/api/cast_channel/cast_auth_ica_unittest.cc',
       'browser/api/cast_channel/cast_auth_util_unittest.cc',
       'browser/api/cast_channel/cast_channel_api_unittest.cc',
       'browser/api/cast_channel/cast_framer_unittest.cc',
@@ -100,6 +99,7 @@
       'browser/extension_throttle_unittest.cc',
       'browser/sandboxed_unpacker_unittest.cc',
       'browser/updater/update_service_unittest.cc',
+      'browser/value_store/leveldb_scoped_database_unittest.cc',
       'browser/value_store/leveldb_value_store_unittest.cc',
       'browser/value_store/testing_value_store_unittest.cc',
       'browser/value_store/value_store_change_unittest.cc',
diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc
index f841ee98..a31eda7 100644
--- a/extensions/renderer/dispatcher.cc
+++ b/extensions/renderer/dispatcher.cc
@@ -719,10 +719,6 @@
                                      IDR_WEB_VIEW_INTERNAL_CUSTOM_BINDINGS_JS));
   resources.push_back(
       std::make_pair("webViewExperimental", IDR_WEB_VIEW_EXPERIMENTAL_JS));
-  if (content::BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) {
-    resources.push_back(std::make_pair("webViewIframe",
-                                       IDR_WEB_VIEW_IFRAME_JS));
-  }
   resources.push_back(
       std::make_pair(mojo::kBindingsModuleName, IDR_MOJO_BINDINGS_JS));
   resources.push_back(
@@ -1579,6 +1575,10 @@
   Feature::Context context_type = context->context_type();
   ModuleSystem* module_system = context->module_system();
 
+  // Only set if |context| is capable of running guests in OOPIF. Used to
+  // require additional module overrides.
+  bool guest_view_required = false;
+
   // Require AppView.
   if (context->GetAvailability("appViewEmbedderInternal").is_available()) {
     module_system->Require("appView");
@@ -1588,6 +1588,8 @@
   if (context->GetAvailability("extensionOptionsInternal").is_available()) {
     module_system->Require("extensionOptions");
     module_system->Require("extensionOptionsAttributes");
+
+    guest_view_required = true;
   }
 
   // Require ExtensionView.
@@ -1607,9 +1609,13 @@
       module_system->Require("webViewExperimental");
     }
 
-    if (content::BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) {
-      module_system->Require("webViewIframe");
-    }
+    guest_view_required = true;
+  }
+
+  if (guest_view_required &&
+      content::BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) {
+    module_system->Require("guestViewIframe");
+    module_system->Require("guestViewIframeContainer");
   }
 
   // The "guestViewDeny" module must always be loaded last. It registers
diff --git a/extensions/renderer/resources/extensions_renderer_resources.grd b/extensions/renderer/resources/extensions_renderer_resources.grd
index 7108db6..808b931 100644
--- a/extensions/renderer/resources/extensions_renderer_resources.grd
+++ b/extensions/renderer/resources/extensions_renderer_resources.grd
@@ -62,7 +62,6 @@
       <include name="IDR_WEB_VIEW_CONSTANTS_JS" file="guest_view/web_view/web_view_constants.js" type="BINDATA" />
       <include name="IDR_WEB_VIEW_EVENTS_JS" file="guest_view/web_view/web_view_events.js" type="BINDATA" />
       <include name="IDR_WEB_VIEW_EXPERIMENTAL_JS" file="guest_view/web_view/web_view_experimental.js" type="BINDATA" />
-      <include name="IDR_WEB_VIEW_IFRAME_JS" file="guest_view/web_view/web_view_iframe.js" type="BINDATA" />
       <include name="IDR_WEB_VIEW_INTERNAL_CUSTOM_BINDINGS_JS" file="guest_view/web_view/web_view_internal.js" type="BINDATA" />
       <include name="IDR_WEB_VIEW_JS" file="guest_view/web_view/web_view.js" type="BINDATA" />
 
diff --git a/extensions/renderer/resources/guest_view/guest_view_container.js b/extensions/renderer/resources/guest_view/guest_view_container.js
index 5e1aac9..acba9fb 100644
--- a/extensions/renderer/resources/guest_view/guest_view_container.js
+++ b/extensions/renderer/resources/guest_view/guest_view_container.js
@@ -198,6 +198,7 @@
 
 // Implemented by the specific view type, if needed.
 GuestViewContainer.prototype.buildContainerParams = function() { return {}; };
+GuestViewContainer.prototype.willAttachElement = function() {};
 GuestViewContainer.prototype.onElementAttached = function() {};
 GuestViewContainer.prototype.onElementDetached = function() {};
 GuestViewContainer.prototype.setupAttributes = function() {};
@@ -253,6 +254,7 @@
       return;
     }
     internal.elementAttached = true;
+    internal.willAttachElement();
     internal.onElementAttached();
   };
 
diff --git a/extensions/renderer/resources/guest_view/guest_view_iframe.js b/extensions/renderer/resources/guest_view/guest_view_iframe.js
index dba1b913..a73de791 100644
--- a/extensions/renderer/resources/guest_view/guest_view_iframe.js
+++ b/extensions/renderer/resources/guest_view/guest_view_iframe.js
@@ -24,6 +24,14 @@
 // Internal implementation of attach().
 GuestViewImpl.prototype.attachImpl$ = function(
     internalInstanceId, viewInstanceId, attachParams, callback) {
+  var view = GuestViewInternalNatives.GetViewFromID(viewInstanceId);
+  if (!view.elementAttached) {
+    // Defer the attachment until the <webview> element is attached.
+    view.deferredAttachCallback = this.attachImpl$.bind(
+        this, internalInstanceId, viewInstanceId, attachParams, callback);
+    return;
+  };
+
   // Check the current state.
   if (!this.checkState('attach')) {
     this.handleCallback(callback);
diff --git a/extensions/renderer/resources/guest_view/guest_view_iframe_container.js b/extensions/renderer/resources/guest_view/guest_view_iframe_container.js
index 4cb27af..4cd628b 100644
--- a/extensions/renderer/resources/guest_view/guest_view_iframe_container.js
+++ b/extensions/renderer/resources/guest_view/guest_view_iframe_container.js
@@ -21,3 +21,10 @@
   this.onInternalInstanceId(generatedId);
   return true;
 };
+
+GuestViewContainer.prototype.willAttachElement = function () {
+  if (this.deferredAttachCallback) {
+    this.deferredAttachCallback();
+    this.deferredAttachCallback = null;
+  }
+};
diff --git a/extensions/renderer/resources/guest_view/web_view/web_view_iframe.js b/extensions/renderer/resources/guest_view/web_view/web_view_iframe.js
deleted file mode 100644
index 0988253..0000000
--- a/extensions/renderer/resources/guest_view/web_view/web_view_iframe.js
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// This module provides --site-per-process overrides for WebView (<webview>).
-// See web_view.js for details.
-
-// NOTE: Do not remove these, we implicitly depend on these in
-// --site-per-process.
-var GuestViewIframe = require('guestViewIframe');
-var GuestViewIframeContainer = require('guestViewIframeContainer');
diff --git a/gpu/command_buffer/common/BUILD.gn b/gpu/command_buffer/common/BUILD.gn
index 5952a94..445ca06 100644
--- a/gpu/command_buffer/common/BUILD.gn
+++ b/gpu/command_buffer/common/BUILD.gn
@@ -41,6 +41,8 @@
     "gles2_cmd_format_autogen.h",
     "gles2_cmd_ids.h",
     "gles2_cmd_ids_autogen.h",
+    "gpu_memory_buffer_support.cc",
+    "gpu_memory_buffer_support.h",
     "id_allocator.cc",
     "id_allocator.h",
     "id_type.h",
@@ -58,6 +60,11 @@
 
   configs += [ "//gpu:gpu_implementation" ]
 
+  public_deps = [
+    "//ui/gfx:memory_buffer",
+    "//ui/gfx/geometry",
+  ]
+
   deps = [
     ":gles2_utils",
     "//base",
diff --git a/gpu/command_buffer/common/gles2_cmd_utils.cc b/gpu/command_buffer/common/gles2_cmd_utils.cc
index cf693105..8eeaf24 100644
--- a/gpu/command_buffer/common/gles2_cmd_utils.cc
+++ b/gpu/command_buffer/common/gles2_cmd_utils.cc
@@ -216,12 +216,14 @@
       return 1;
     case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
       return 1;
-    case GL_UNIFORM_BUFFER_BINDING:
+    case GL_TRANSFORM_FEEDBACK_BUFFER_MODE:
       return 1;
     case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE:
       return 1;
     case GL_TRANSFORM_FEEDBACK_BUFFER_START:
       return 1;
+    case GL_UNIFORM_BUFFER_BINDING:
+      return 1;
     case GL_UNIFORM_BUFFER_SIZE:
       return 1;
     case GL_UNIFORM_BUFFER_START:
diff --git a/gpu/command_buffer/common/gpu_memory_buffer_support.cc b/gpu/command_buffer/common/gpu_memory_buffer_support.cc
new file mode 100644
index 0000000..78c3e488
--- /dev/null
+++ b/gpu/command_buffer/common/gpu_memory_buffer_support.cc
@@ -0,0 +1,151 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "gpu/command_buffer/common/gpu_memory_buffer_support.h"
+
+#include <GLES2/gl2.h>
+#include <GLES2/gl2extchromium.h>
+
+#include "base/logging.h"
+#include "gpu/command_buffer/common/capabilities.h"
+
+namespace gpu {
+
+namespace {
+
+gfx::BufferFormat BufferFormatForInternalFormat(unsigned internalformat) {
+  switch (internalformat) {
+    case GL_RED_EXT:
+      return gfx::BufferFormat::R_8;
+    case GL_RGB:
+      return gfx::BufferFormat::BGRX_8888;
+    case GL_RGBA:
+      return gfx::BufferFormat::RGBA_8888;
+    case GL_BGRA_EXT:
+      return gfx::BufferFormat::BGRA_8888;
+    case GL_ATC_RGB_AMD:
+      return gfx::BufferFormat::ATC;
+    case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD:
+      return gfx::BufferFormat::ATCIA;
+    case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+      return gfx::BufferFormat::DXT1;
+    case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
+      return gfx::BufferFormat::DXT5;
+    case GL_ETC1_RGB8_OES:
+      return gfx::BufferFormat::ETC1;
+    case GL_RGB_YUV_420_CHROMIUM:
+      return gfx::BufferFormat::YUV_420;
+    case GL_RGB_YCBCR_420V_CHROMIUM:
+      return gfx::BufferFormat::YUV_420_BIPLANAR;
+    case GL_RGB_YCBCR_422_CHROMIUM:
+      return gfx::BufferFormat::UYVY_422;
+    default:
+      NOTREACHED();
+      return gfx::BufferFormat::RGBA_8888;
+  }
+}
+
+}  // namespace
+
+gfx::BufferFormat DefaultBufferFormatForImageFormat(unsigned internalformat) {
+  switch (internalformat) {
+    case GL_RGB:
+      return gfx::BufferFormat::BGRX_8888;
+    case GL_RGBA:
+      return gfx::BufferFormat::RGBA_8888;
+    default:
+      NOTREACHED();
+      return gfx::BufferFormat::RGBA_8888;
+  }
+}
+
+bool IsImageFormatCompatibleWithGpuMemoryBufferFormat(
+    unsigned internalformat,
+    gfx::BufferFormat format) {
+  switch (format) {
+    case gfx::BufferFormat::ATC:
+    case gfx::BufferFormat::ATCIA:
+    case gfx::BufferFormat::BGRA_8888:
+    case gfx::BufferFormat::BGRX_8888:
+    case gfx::BufferFormat::DXT1:
+    case gfx::BufferFormat::DXT5:
+    case gfx::BufferFormat::ETC1:
+    case gfx::BufferFormat::R_8:
+    case gfx::BufferFormat::RGBA_8888:
+    case gfx::BufferFormat::RGBX_8888:
+    case gfx::BufferFormat::YUV_420:
+    case gfx::BufferFormat::YUV_420_BIPLANAR:
+    case gfx::BufferFormat::UYVY_422:
+      return format == BufferFormatForInternalFormat(internalformat);
+    case gfx::BufferFormat::RGBA_4444:
+      return internalformat == GL_RGBA;
+  }
+
+  NOTREACHED();
+  return false;
+}
+
+bool IsGpuMemoryBufferFormatSupported(gfx::BufferFormat format,
+                                      const gpu::Capabilities& capabilities) {
+  switch (format) {
+    case gfx::BufferFormat::ATC:
+    case gfx::BufferFormat::ATCIA:
+      return capabilities.texture_format_atc;
+    case gfx::BufferFormat::BGRA_8888:
+    case gfx::BufferFormat::BGRX_8888:
+      return capabilities.texture_format_bgra8888;
+    case gfx::BufferFormat::DXT1:
+      return capabilities.texture_format_dxt1;
+    case gfx::BufferFormat::DXT5:
+      return capabilities.texture_format_dxt5;
+    case gfx::BufferFormat::ETC1:
+      return capabilities.texture_format_etc1;
+    case gfx::BufferFormat::R_8:
+      return capabilities.texture_rg;
+    case gfx::BufferFormat::UYVY_422:
+      return capabilities.image_ycbcr_422;
+    case gfx::BufferFormat::RGBA_4444:
+    case gfx::BufferFormat::RGBA_8888:
+    case gfx::BufferFormat::RGBX_8888:
+    case gfx::BufferFormat::YUV_420:
+      return true;
+    case gfx::BufferFormat::YUV_420_BIPLANAR:
+      return capabilities.image_ycbcr_420v;
+  }
+
+  NOTREACHED();
+  return false;
+}
+
+bool IsImageSizeValidForGpuMemoryBufferFormat(const gfx::Size& size,
+                                              gfx::BufferFormat format) {
+  switch (format) {
+    case gfx::BufferFormat::ATC:
+    case gfx::BufferFormat::ATCIA:
+    case gfx::BufferFormat::DXT1:
+    case gfx::BufferFormat::DXT5:
+    case gfx::BufferFormat::ETC1:
+      // Compressed images must have a width and height that's evenly divisible
+      // by the block size.
+      return size.width() % 4 == 0 && size.height() % 4 == 0;
+    case gfx::BufferFormat::R_8:
+    case gfx::BufferFormat::RGBA_4444:
+    case gfx::BufferFormat::RGBA_8888:
+    case gfx::BufferFormat::RGBX_8888:
+    case gfx::BufferFormat::BGRA_8888:
+    case gfx::BufferFormat::BGRX_8888:
+      return true;
+    case gfx::BufferFormat::YUV_420:
+    case gfx::BufferFormat::YUV_420_BIPLANAR:
+      // U and V planes are subsampled by a factor of 2.
+      return size.width() % 2 == 0 && size.height() % 2 == 0;
+    case gfx::BufferFormat::UYVY_422:
+      return size.width() % 2 == 0;
+  }
+
+  NOTREACHED();
+  return false;
+}
+
+}  // namespace gpu
diff --git a/gpu/command_buffer/common/gpu_memory_buffer_support.h b/gpu/command_buffer/common/gpu_memory_buffer_support.h
new file mode 100644
index 0000000..7539de3
--- /dev/null
+++ b/gpu/command_buffer/common/gpu_memory_buffer_support.h
@@ -0,0 +1,39 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef GPU_COMMAND_BUFFER_COMMON_GPU_MEMORY_BUFFER_SUPPORT_H_
+#define GPU_COMMAND_BUFFER_COMMON_GPU_MEMORY_BUFFER_SUPPORT_H_
+
+#include "gpu/gpu_export.h"
+#include "ui/gfx/buffer_types.h"
+#include "ui/gfx/geometry/size.h"
+#include "ui/gfx/gpu_memory_buffer.h"
+
+namespace gpu {
+
+struct Capabilities;
+
+// Returns a valid GpuMemoryBuffer format given a valid internalformat as
+// defined by CHROMIUM_gpu_memory_buffer_image.
+GPU_EXPORT gfx::BufferFormat DefaultBufferFormatForImageFormat(
+    unsigned internalformat);
+
+// Returns true if |internalformat| is compatible with |format|.
+GPU_EXPORT bool IsImageFormatCompatibleWithGpuMemoryBufferFormat(
+    unsigned internalformat,
+    gfx::BufferFormat format);
+
+// Returns true if |format| is supported by |capabilities|.
+GPU_EXPORT bool IsGpuMemoryBufferFormatSupported(
+    gfx::BufferFormat format,
+    const Capabilities& capabilities);
+
+// Returns true if |size| is valid for |format|.
+GPU_EXPORT bool IsImageSizeValidForGpuMemoryBufferFormat(
+    const gfx::Size& size,
+    gfx::BufferFormat format);
+
+}  // namespace gpu
+
+#endif  // GPU_COMMAND_BUFFER_COMMON_GPU_MEMORY_BUFFER_SUPPORT_H_
diff --git a/gpu/command_buffer/service/image_factory.cc b/gpu/command_buffer/service/image_factory.cc
index fd06d3f..8990bb1 100644
--- a/gpu/command_buffer/service/image_factory.cc
+++ b/gpu/command_buffer/service/image_factory.cc
@@ -4,157 +4,12 @@
 
 #include "gpu/command_buffer/service/image_factory.h"
 
-#include "gpu/command_buffer/common/capabilities.h"
-#include "ui/gl/gl_bindings.h"
-
 namespace gpu {
 
-namespace {
-gfx::BufferFormat BufferFormatForInternalFormat(unsigned internalformat) {
-  switch (internalformat) {
-    case GL_RED:
-      return gfx::BufferFormat::R_8;
-    case GL_RGB:
-      return gfx::BufferFormat::BGRX_8888;
-    case GL_RGBA:
-      return gfx::BufferFormat::RGBA_8888;
-    case GL_BGRA_EXT:
-      return gfx::BufferFormat::BGRA_8888;
-    case GL_ATC_RGB_AMD:
-      return gfx::BufferFormat::ATC;
-    case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD:
-      return gfx::BufferFormat::ATCIA;
-    case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
-      return gfx::BufferFormat::DXT1;
-    case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
-      return gfx::BufferFormat::DXT5;
-    case GL_ETC1_RGB8_OES:
-      return gfx::BufferFormat::ETC1;
-    case GL_RGB_YUV_420_CHROMIUM:
-      return gfx::BufferFormat::YUV_420;
-    case GL_RGB_YCBCR_420V_CHROMIUM:
-      return gfx::BufferFormat::YUV_420_BIPLANAR;
-    case GL_RGB_YCBCR_422_CHROMIUM:
-      return gfx::BufferFormat::UYVY_422;
-    default:
-      NOTREACHED();
-      return gfx::BufferFormat::RGBA_8888;
-  }
-}
-
-}  // namespace
-
 ImageFactory::ImageFactory() {
 }
 
 ImageFactory::~ImageFactory() {
 }
 
-// static
-gfx::BufferFormat ImageFactory::DefaultBufferFormatForImageFormat(
-    unsigned internalformat) {
-  switch (internalformat) {
-    case GL_RGB:
-      return gfx::BufferFormat::BGRX_8888;
-    case GL_RGBA:
-      return gfx::BufferFormat::RGBA_8888;
-    default:
-      NOTREACHED();
-      return gfx::BufferFormat::RGBA_8888;
-  }
-}
-
-// static
-bool ImageFactory::IsImageFormatCompatibleWithGpuMemoryBufferFormat(
-    unsigned internalformat,
-    gfx::BufferFormat format) {
-  switch (format) {
-    case gfx::BufferFormat::ATC:
-    case gfx::BufferFormat::ATCIA:
-    case gfx::BufferFormat::BGRA_8888:
-    case gfx::BufferFormat::BGRX_8888:
-    case gfx::BufferFormat::DXT1:
-    case gfx::BufferFormat::DXT5:
-    case gfx::BufferFormat::ETC1:
-    case gfx::BufferFormat::R_8:
-    case gfx::BufferFormat::RGBA_8888:
-    case gfx::BufferFormat::RGBX_8888:
-    case gfx::BufferFormat::YUV_420:
-    case gfx::BufferFormat::YUV_420_BIPLANAR:
-    case gfx::BufferFormat::UYVY_422:
-      return format == BufferFormatForInternalFormat(internalformat);
-    case gfx::BufferFormat::RGBA_4444:
-      return internalformat == GL_RGBA;
-  }
-
-  NOTREACHED();
-  return false;
-}
-
-// static
-bool ImageFactory::IsGpuMemoryBufferFormatSupported(
-    gfx::BufferFormat format,
-    const gpu::Capabilities& capabilities) {
-  switch (format) {
-    case gfx::BufferFormat::ATC:
-    case gfx::BufferFormat::ATCIA:
-      return capabilities.texture_format_atc;
-    case gfx::BufferFormat::BGRA_8888:
-    case gfx::BufferFormat::BGRX_8888:
-      return capabilities.texture_format_bgra8888;
-    case gfx::BufferFormat::DXT1:
-      return capabilities.texture_format_dxt1;
-    case gfx::BufferFormat::DXT5:
-      return capabilities.texture_format_dxt5;
-    case gfx::BufferFormat::ETC1:
-      return capabilities.texture_format_etc1;
-    case gfx::BufferFormat::R_8:
-      return capabilities.texture_rg;
-    case gfx::BufferFormat::UYVY_422:
-      return capabilities.image_ycbcr_422;
-    case gfx::BufferFormat::RGBA_4444:
-    case gfx::BufferFormat::RGBA_8888:
-    case gfx::BufferFormat::RGBX_8888:
-    case gfx::BufferFormat::YUV_420:
-      return true;
-    case gfx::BufferFormat::YUV_420_BIPLANAR:
-      return capabilities.image_ycbcr_420v;
-  }
-
-  NOTREACHED();
-  return false;
-}
-
-// static
-bool ImageFactory::IsImageSizeValidForGpuMemoryBufferFormat(
-    const gfx::Size& size,
-    gfx::BufferFormat format) {
-  switch (format) {
-    case gfx::BufferFormat::ATC:
-    case gfx::BufferFormat::ATCIA:
-    case gfx::BufferFormat::DXT1:
-    case gfx::BufferFormat::DXT5:
-    case gfx::BufferFormat::ETC1:
-      // Compressed images must have a width and height that's evenly divisible
-      // by the block size.
-      return size.width() % 4 == 0 && size.height() % 4 == 0;
-    case gfx::BufferFormat::R_8:
-    case gfx::BufferFormat::RGBA_4444:
-    case gfx::BufferFormat::RGBA_8888:
-    case gfx::BufferFormat::RGBX_8888:
-    case gfx::BufferFormat::BGRA_8888:
-    case gfx::BufferFormat::BGRX_8888:
-      return true;
-    case gfx::BufferFormat::YUV_420:
-    case gfx::BufferFormat::YUV_420_BIPLANAR:
-      // U and V planes are subsampled by a factor of 2.
-      return size.width() % 2 == 0 && size.height() % 2 == 0;
-    case gfx::BufferFormat::UYVY_422:
-      return size.width() % 2 == 0;
-  }
-
-  NOTREACHED();
-  return false;
-}
-
 }  // namespace gpu
diff --git a/gpu/command_buffer/service/image_factory.h b/gpu/command_buffer/service/image_factory.h
index c27c2459..cfa4cef 100644
--- a/gpu/command_buffer/service/image_factory.h
+++ b/gpu/command_buffer/service/image_factory.h
@@ -15,32 +15,11 @@
 }
 
 namespace gpu {
-struct Capabilities;
 
 class GPU_EXPORT ImageFactory {
  public:
   ImageFactory();
 
-  // Returns a valid GpuMemoryBuffer format given a valid internalformat as
-  // defined by CHROMIUM_gpu_memory_buffer_image.
-  static gfx::BufferFormat DefaultBufferFormatForImageFormat(
-      unsigned internalformat);
-
-  // Returns true if |internalformat| is compatible with |format|.
-  static bool IsImageFormatCompatibleWithGpuMemoryBufferFormat(
-      unsigned internalformat,
-      gfx::BufferFormat format);
-
-  // Returns true if |format| is supported by |capabilities|.
-  static bool IsGpuMemoryBufferFormatSupported(
-      gfx::BufferFormat format,
-      const Capabilities& capabilities);
-
-  // Returns true if |size| is valid for |format|.
-  static bool IsImageSizeValidForGpuMemoryBufferFormat(
-      const gfx::Size& size,
-      gfx::BufferFormat format);
-
   // Creates a GLImage instance for GPU memory buffer identified by |handle|.
   // |client_id| should be set to the client requesting the creation of instance
   // and can be used by factory implementation to verify access rights.
diff --git a/gpu/command_buffer/service/in_process_command_buffer.cc b/gpu/command_buffer/service/in_process_command_buffer.cc
index 010c0fbb..55e5a19 100644
--- a/gpu/command_buffer/service/in_process_command_buffer.cc
+++ b/gpu/command_buffer/service/in_process_command_buffer.cc
@@ -23,6 +23,7 @@
 #include "base/single_thread_task_runner.h"
 #include "base/thread_task_runner_handle.h"
 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
+#include "gpu/command_buffer/common/gpu_memory_buffer_support.h"
 #include "gpu/command_buffer/common/sync_token.h"
 #include "gpu/command_buffer/common/value_state.h"
 #include "gpu/command_buffer/service/command_buffer_service.h"
@@ -685,9 +686,9 @@
 
   int32_t new_id = next_image_id_.GetNext();
 
-  DCHECK(gpu::ImageFactory::IsGpuMemoryBufferFormatSupported(
-      gpu_memory_buffer->GetFormat(), capabilities_));
-  DCHECK(gpu::ImageFactory::IsImageFormatCompatibleWithGpuMemoryBufferFormat(
+  DCHECK(gpu::IsGpuMemoryBufferFormatSupported(gpu_memory_buffer->GetFormat(),
+                                               capabilities_));
+  DCHECK(gpu::IsImageFormatCompatibleWithGpuMemoryBufferFormat(
       internalformat, gpu_memory_buffer->GetFormat()));
 
   // This handle is owned by the GPU thread and must be passed to it or it
@@ -824,7 +825,7 @@
   scoped_ptr<gfx::GpuMemoryBuffer> buffer(
       gpu_memory_buffer_manager_->AllocateGpuMemoryBuffer(
           gfx::Size(width, height),
-          gpu::ImageFactory::DefaultBufferFormatForImageFormat(internalformat),
+          gpu::DefaultBufferFormatForImageFormat(internalformat),
           gfx::BufferUsage::SCANOUT));
   if (!buffer)
     return -1;
diff --git a/gpu/command_buffer_common.gypi b/gpu/command_buffer_common.gypi
index 1831a92..43fc596 100644
--- a/gpu/command_buffer_common.gypi
+++ b/gpu/command_buffer_common.gypi
@@ -24,6 +24,8 @@
     'command_buffer/common/gles2_cmd_format_autogen.h',
     'command_buffer/common/gles2_cmd_ids.h',
     'command_buffer/common/gles2_cmd_ids_autogen.h',
+    'command_buffer/common/gpu_memory_buffer_support.cc',
+    'command_buffer/common/gpu_memory_buffer_support.h',
     'command_buffer/common/id_allocator.cc',
     'command_buffer/common/id_allocator.h',
     'command_buffer/common/id_type.h',
diff --git a/gpu/ipc/client/BUILD.gn b/gpu/ipc/client/BUILD.gn
index 8baf7e50..f77d1fe 100644
--- a/gpu/ipc/client/BUILD.gn
+++ b/gpu/ipc/client/BUILD.gn
@@ -49,13 +49,11 @@
   configs += [
     "//build/config/compiler:no_size_t_to_int_warning",
     "//gpu:gpu_implementation",
-    "//third_party/khronos:khronos_headers",
   ]
   deps = [
     "//base",
     "//gpu/command_buffer/client:client_sources",
     "//gpu/command_buffer/common:common_sources",
-    "//gpu/command_buffer/service:service_sources",
     "//gpu/config:config_sources",
     "//gpu/ipc/common:ipc_common_sources",
     "//ipc",
diff --git a/gpu/ipc/client/command_buffer_proxy_impl.cc b/gpu/ipc/client/command_buffer_proxy_impl.cc
index 34731027..07fc636 100644
--- a/gpu/ipc/client/command_buffer_proxy_impl.cc
+++ b/gpu/ipc/client/command_buffer_proxy_impl.cc
@@ -18,8 +18,8 @@
 #include "gpu/command_buffer/common/command_buffer_id.h"
 #include "gpu/command_buffer/common/command_buffer_shared.h"
 #include "gpu/command_buffer/common/gpu_memory_allocation.h"
+#include "gpu/command_buffer/common/gpu_memory_buffer_support.h"
 #include "gpu/command_buffer/common/sync_token.h"
-#include "gpu/command_buffer/service/image_factory.h"
 #include "gpu/ipc/client/gpu_channel_host.h"
 #include "gpu/ipc/common/gpu_messages.h"
 #include "gpu/ipc/common/gpu_param_traits.h"
@@ -430,11 +430,11 @@
     DCHECK_LE(image_fence_sync - 1, flushed_fence_sync_release_);
   }
 
-  DCHECK(gpu::ImageFactory::IsGpuMemoryBufferFormatSupported(
-      gpu_memory_buffer->GetFormat(), capabilities_));
-  DCHECK(gpu::ImageFactory::IsImageSizeValidForGpuMemoryBufferFormat(
+  DCHECK(gpu::IsGpuMemoryBufferFormatSupported(gpu_memory_buffer->GetFormat(),
+                                               capabilities_));
+  DCHECK(gpu::IsImageSizeValidForGpuMemoryBufferFormat(
       gfx::Size(width, height), gpu_memory_buffer->GetFormat()));
-  DCHECK(gpu::ImageFactory::IsImageFormatCompatibleWithGpuMemoryBufferFormat(
+  DCHECK(gpu::IsImageFormatCompatibleWithGpuMemoryBufferFormat(
       internal_format, gpu_memory_buffer->GetFormat()));
 
   GpuCommandBufferMsg_CreateImage_Params params;
@@ -479,7 +479,7 @@
   scoped_ptr<gfx::GpuMemoryBuffer> buffer(
       channel_->gpu_memory_buffer_manager()->AllocateGpuMemoryBuffer(
           gfx::Size(width, height),
-          gpu::ImageFactory::DefaultBufferFormatForImageFormat(internal_format),
+          gpu::DefaultBufferFormatForImageFormat(internal_format),
           gfx::BufferUsage::SCANOUT));
   if (!buffer)
     return -1;
diff --git a/gpu/vulkan/BUILD.gn b/gpu/vulkan/BUILD.gn
index 70ab228..ff65fa4 100644
--- a/gpu/vulkan/BUILD.gn
+++ b/gpu/vulkan/BUILD.gn
@@ -5,6 +5,10 @@
 import("//build/config/ui.gni")
 import("//testing/test.gni")
 
+config("vulkan_config") {
+  defines = [ "ENABLE_VULKAN" ]
+}
+
 if (enable_vulkan) {
   component("vulkan") {
     output_name = "vulkan_wrapper"
@@ -35,9 +39,12 @@
       configs += [ "//build/config:precompiled_headers" ]
       defines = [ "VULKAN_IMPLEMENTATION" ]
 
+      all_dependent_configs = [
+        ":vulkan_config",
+        "//third_party/vulkan:vulkan_headers",
+      ]
       libs = [ "vulkan" ]
 
-      include_dirs = [ "/usr/include" ]
       if (target_cpu == "x64") {
         lib_dirs = [ "/usr/lib/x86_64-linux-gnu" ]
       } else {
diff --git a/gpu/vulkan/vulkan_implementation.cc b/gpu/vulkan/vulkan_implementation.cc
index fad996f..db6a3d5 100644
--- a/gpu/vulkan/vulkan_implementation.cc
+++ b/gpu/vulkan/vulkan_implementation.cc
@@ -6,8 +6,6 @@
 
 #include <unordered_set>
 #include <vector>
-#include <vulkan/vulkan.h>
-
 #include "base/logging.h"
 #include "base/macros.h"
 #include "gpu/vulkan/vulkan_platform.h"
diff --git a/gpu/vulkan/vulkan_render_pass.h b/gpu/vulkan/vulkan_render_pass.h
index 7f47dee..326e99b 100644
--- a/gpu/vulkan/vulkan_render_pass.h
+++ b/gpu/vulkan/vulkan_render_pass.h
@@ -5,8 +5,8 @@
 #ifndef GPU_VULKAN_VULKAN_RENDER_PASS_H_
 #define GPU_VULKAN_VULKAN_RENDER_PASS_H_
 
-#include <vulkan/vulkan.h>
 #include <vector>
+#include <vulkan/vulkan.h>
 
 #include "base/macros.h"
 #include "gpu/vulkan/vulkan_export.h"
diff --git a/gpu/vulkan/vulkan_swap_chain.h b/gpu/vulkan/vulkan_swap_chain.h
index 345e4beb..e084716 100644
--- a/gpu/vulkan/vulkan_swap_chain.h
+++ b/gpu/vulkan/vulkan_swap_chain.h
@@ -5,8 +5,8 @@
 #ifndef GPU_VULKAN_VULKAN_SWAP_CHAIN_H_
 #define GPU_VULKAN_VULKAN_SWAP_CHAIN_H_
 
-#include <vulkan/vulkan.h>
 #include <vector>
+#include <vulkan/vulkan.h>
 
 #include "base/memory/scoped_ptr.h"
 #include "gpu/vulkan/vulkan_export.h"
diff --git a/infra/config/cq.cfg b/infra/config/cq.cfg
index eaa46cf..2cd7c29 100644
--- a/infra/config/cq.cfg
+++ b/infra/config/cq.cfg
@@ -54,10 +54,6 @@
       builders { name: "linux_chromium_compile_dbg_ng" }
       builders { name: "linux_chromium_gn_chromeos_rel" }
       builders { name: "linux_chromium_rel_ng" }
-      builders {
-        name: "linux_chromium_chromeos_asan_rel_ng"
-        experiment_percentage: 10
-      }
     }
     buckets {
       name: "tryserver.chromium.mac"
diff --git a/ios/web/web_state/ui/crw_web_controller.mm b/ios/web/web_state/ui/crw_web_controller.mm
index 46ccc90..7af8b46 100644
--- a/ios/web/web_state/ui/crw_web_controller.mm
+++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -143,6 +143,9 @@
 
 namespace {
 
+// Key of UMA IOSFix.ViewportZoomBugCount histogram.
+const char kUMAViewportZoomBugCount[] = "Renderer.ViewportZoomBugCount";
+
 // A tag for the web view, so that tests can identify it. This is used instead
 // of exposing a getter (and deliberately not exposed in the header) to make it
 // *very* clear that this is a hack which should only be used as a last resort.
@@ -3350,6 +3353,19 @@
 - (void)webViewScrollViewDidZoom:
         (CRWWebViewScrollViewProxy*)webViewScrollViewProxy {
   _pageHasZoomed = YES;
+
+  base::WeakNSObject<UIScrollView> weakScrollView(self.webScrollView);
+  [self extractViewportTagWithCompletion:^(
+            const web::PageViewportState* viewportState) {
+    if (!weakScrollView)
+      return;
+    base::scoped_nsobject<UIScrollView> scrollView([weakScrollView retain]);
+    if (viewportState && !viewportState->viewport_tag_present() &&
+        [scrollView minimumZoomScale] == [scrollView maximumZoomScale] &&
+        [scrollView zoomScale] > 1.0) {
+      UMA_HISTOGRAM_BOOLEAN(kUMAViewportZoomBugCount, true);
+    }
+  }];
 }
 
 - (void)webViewScrollViewDidResetContentSize:
diff --git a/ipc/ipc_platform_file.cc b/ipc/ipc_platform_file.cc
index c8fde86f..2dcc9aa 100644
--- a/ipc/ipc_platform_file.cc
+++ b/ipc/ipc_platform_file.cc
@@ -11,9 +11,8 @@
 
 namespace IPC {
 
-PlatformFileForTransit GetFileHandleForProcess(base::PlatformFile handle,
-                                               base::ProcessHandle process,
-                                               bool close_source_handle) {
+PlatformFileForTransit GetPlatformFileForTransit(base::PlatformFile handle,
+                                                 bool close_source_handle) {
 #if defined(OS_WIN)
   HANDLE raw_handle = INVALID_HANDLE_VALUE;
   DWORD options = DUPLICATE_SAME_ACCESS;
@@ -47,7 +46,7 @@
 
 PlatformFileForTransit TakeFileHandleForProcess(base::File file,
                                                 base::ProcessHandle process) {
-  return GetFileHandleForProcess(file.TakePlatformFile(), process, true);
+  return GetPlatformFileForTransit(file.TakePlatformFile(), true);
 }
 
 }  // namespace IPC
diff --git a/ipc/ipc_platform_file.h b/ipc/ipc_platform_file.h
index 045655a1..3d60983 100644
--- a/ipc/ipc_platform_file.h
+++ b/ipc/ipc_platform_file.h
@@ -55,10 +55,10 @@
 #endif
 }
 
-// Returns a file handle equivalent to |file| that can be used in |process|.
-IPC_EXPORT PlatformFileForTransit GetFileHandleForProcess(
+// Creates a new handle that can be passed through IPC. The result must be
+// passed to the IPC layer as part of a message, or else it will leak.
+IPC_EXPORT PlatformFileForTransit GetPlatformFileForTransit(
     base::PlatformFile file,
-    base::ProcessHandle process,
     bool close_source_handle);
 
 // Returns a file handle equivalent to |file| that can be used in |process|.
diff --git a/mojo/gles2/BUILD.gn b/mojo/gles2/BUILD.gn
index 705a8eb..8ab33f2 100644
--- a/mojo/gles2/BUILD.gn
+++ b/mojo/gles2/BUILD.gn
@@ -55,9 +55,5 @@
     "//mojo/public/cpp/system",
   ]
 
-  if (!is_component_build) {
-    deps += [ "//gpu/command_buffer/service" ]
-  }
-
   include_dirs = [ ".." ]
 }
diff --git a/mojo/gles2/command_buffer_client_impl.cc b/mojo/gles2/command_buffer_client_impl.cc
index fecd6aa21..14f0569c 100644
--- a/mojo/gles2/command_buffer_client_impl.cc
+++ b/mojo/gles2/command_buffer_client_impl.cc
@@ -17,8 +17,8 @@
 #include "components/mus/gles2/mojo_buffer_backing.h"
 #include "components/mus/gles2/mojo_gpu_memory_buffer.h"
 #include "gpu/command_buffer/common/command_buffer_id.h"
+#include "gpu/command_buffer/common/gpu_memory_buffer_support.h"
 #include "gpu/command_buffer/common/sync_token.h"
-#include "gpu/command_buffer/service/image_factory.h"
 #include "mojo/platform_handle/platform_handle_functions.h"
 
 namespace gles2 {
@@ -270,7 +270,7 @@
     unsigned usage) {
   scoped_ptr<gfx::GpuMemoryBuffer> buffer(mus::MojoGpuMemoryBufferImpl::Create(
       gfx::Size(static_cast<int>(width), static_cast<int>(height)),
-      gpu::ImageFactory::DefaultBufferFormatForImageFormat(internalformat),
+      gpu::DefaultBufferFormatForImageFormat(internalformat),
       gfx::BufferUsage::SCANOUT));
   if (!buffer)
     return -1;
diff --git a/mojo/mojom_bindings_generator_explicit.gypi b/mojo/mojom_bindings_generator_explicit.gypi
index 599ee3b4..e3bb2e8 100644
--- a/mojo/mojom_bindings_generator_explicit.gypi
+++ b/mojo/mojom_bindings_generator_explicit.gypi
@@ -61,9 +61,6 @@
       ],
       'inputs': [
         '<@(mojom_files)',
-        '<(SHARED_INTERMEDIATE_DIR)/mojo/public/tools/bindings/cpp_templates.zip',
-        '<(SHARED_INTERMEDIATE_DIR)/mojo/public/tools/bindings/java_templates.zip',
-        '<(SHARED_INTERMEDIATE_DIR)/mojo/public/tools/bindings/js_templates.zip',
       ],
       'outputs': [ '<(stamp_filename)' ],
     },
@@ -82,6 +79,9 @@
         '<@(mojom_bindings_generator_sources)',
         '<@(mojom_files)',
         '<(stamp_filename)',
+        '<(SHARED_INTERMEDIATE_DIR)/mojo/public/tools/bindings/cpp_templates.zip',
+        '<(SHARED_INTERMEDIATE_DIR)/mojo/public/tools/bindings/java_templates.zip',
+        '<(SHARED_INTERMEDIATE_DIR)/mojo/public/tools/bindings/js_templates.zip',
       ],
       'outputs': [
         '<@(mojom_generated_outputs)',
diff --git a/mojo/public/cpp/bindings/array.h b/mojo/public/cpp/bindings/array.h
index f522faa..e9bd6838 100644
--- a/mojo/public/cpp/bindings/array.h
+++ b/mojo/public/cpp/bindings/array.h
@@ -295,6 +295,16 @@
   }
 };
 
+// Less than operator to allow Arrays as keys in std maps and sets.
+template <typename T>
+inline bool operator<(const Array<T>& a, const Array<T>& b) {
+  if (a.is_null())
+    return !b.is_null();
+  if (b.is_null())
+    return false;
+  return a.storage() < b.storage();
+}
+
 }  // namespace mojo
 
 #endif  // MOJO_PUBLIC_CPP_BINDINGS_ARRAY_H_
diff --git a/mojo/public/cpp/bindings/tests/struct_with_traits_impl_traits.cc b/mojo/public/cpp/bindings/tests/struct_with_traits_impl_traits.cc
index f58ce84..8d4f97d4 100644
--- a/mojo/public/cpp/bindings/tests/struct_with_traits_impl_traits.cc
+++ b/mojo/public/cpp/bindings/tests/struct_with_traits_impl_traits.cc
@@ -15,7 +15,7 @@
   out->set_uint32(r.f_uint32());
   out->set_uint64(r.f_uint64());
   out->set_string(r.f_string().as_string());
-  return true;
+  return r.f_string() == r.f_string2();
 }
 
 }  // namespace mojo
diff --git a/mojo/public/cpp/bindings/tests/struct_with_traits_impl_traits.h b/mojo/public/cpp/bindings/tests/struct_with_traits_impl_traits.h
index 9433052..e945abca 100644
--- a/mojo/public/cpp/bindings/tests/struct_with_traits_impl_traits.h
+++ b/mojo/public/cpp/bindings/tests/struct_with_traits_impl_traits.h
@@ -38,6 +38,10 @@
   static base::StringPiece f_string(const test::StructWithTraitsImpl& value) {
     return value.get_string();
   }
+
+  static base::StringPiece f_string2(const test::StructWithTraitsImpl& value) {
+    return value.get_string();
+  }
 };
 
 }  // namespace mojo
diff --git a/mojo/public/interfaces/bindings/tests/struct_with_traits.mojom b/mojo/public/interfaces/bindings/tests/struct_with_traits.mojom
index 1ac8fe8..f4ae0ce 100644
--- a/mojo/public/interfaces/bindings/tests/struct_with_traits.mojom
+++ b/mojo/public/interfaces/bindings/tests/struct_with_traits.mojom
@@ -9,6 +9,7 @@
   uint32 f_uint32;
   uint64 f_uint64;
   string f_string;
+  string f_string2;
 };
 
 interface TraitsTestService {
diff --git a/mojo/public/tools/bindings/bindings.gyp b/mojo/public/tools/bindings/bindings.gyp
index 77403c80..6b28e78b 100644
--- a/mojo/public/tools/bindings/bindings.gyp
+++ b/mojo/public/tools/bindings/bindings.gyp
@@ -29,9 +29,17 @@
             'generators/cpp_templates/struct_declaration.tmpl',
             'generators/cpp_templates/struct_definition.tmpl',
             'generators/cpp_templates/struct_macros.tmpl',
+            'generators/cpp_templates/struct_serialization_declaration.tmpl',
             'generators/cpp_templates/struct_serialization_definition.tmpl',
+            'generators/cpp_templates/union_declaration.tmpl',
+            'generators/cpp_templates/union_definition.tmpl',
+            'generators/cpp_templates/union_serialization_declaration.tmpl',
+            'generators/cpp_templates/union_serialization_definition.tmpl',
+            'generators/cpp_templates/validation_macros.tmpl',
             'generators/cpp_templates/wrapper_class_declaration.tmpl',
             'generators/cpp_templates/wrapper_class_definition.tmpl',
+            'generators/cpp_templates/wrapper_union_class_declaration.tmpl',
+            'generators/cpp_templates/wrapper_union_class_definition.tmpl',
             'generators/java_templates/constant_definition.tmpl',
             'generators/java_templates/constants.java.tmpl',
             'generators/java_templates/data_types_definition.tmpl',
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_declaration.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_declaration.tmpl
index 16e601d..00390a8 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_declaration.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_declaration.tmpl
@@ -100,9 +100,11 @@
         break;
 {%-   endif %}
 {%-   if pf.field.kind|is_string_kind %}
-      size += mojo::internal::String_Data::Traits::GetStorageSize(
-          static_cast<uint32_t>(mojo::StructTraits<{{struct.name}}, NativeType>
-              ::{{pf.field.name}}(input).size()));
+      size += mojo::internal::Align(
+          mojo::internal::String_Data::Traits::GetStorageSize(
+              static_cast<uint32_t>(
+                  mojo::StructTraits<{{struct.name}}, NativeType>
+                      ::{{pf.field.name}}(input).size())));
 {%-   elif pf.field.kind|is_object_kind %}
       NOTREACHED() << "Unsupported field type for StructTraits: "
                    << "{{pf.field.name}}";
diff --git a/net/android/java/src/org/chromium/net/AndroidKeyStore.java b/net/android/java/src/org/chromium/net/AndroidKeyStore.java
index 380bc29..b238d78 100644
--- a/net/android/java/src/org/chromium/net/AndroidKeyStore.java
+++ b/net/android/java/src/org/chromium/net/AndroidKeyStore.java
@@ -220,10 +220,10 @@
      * based on OpenSSL (fortunately, no OEM has apperently changed to
      * a different implementation, according to the Android team).
      *
-     * Note that the object returned was created with the platform version
-     * of OpenSSL, and _not_ the one that comes with Chromium. Whether the
-     * object can be used safely with the Chromium OpenSSL library depends
-     * on differences between their actual ABI / implementation details.
+     * Note that the object returned was created with the platform version of
+     * OpenSSL, and _not_ the one that comes with Chromium. It may not be used
+     * with the Chromium version of OpenSSL (BoringSSL). See AndroidEVP_PKEY in
+     * net/android/legacy_openssl.h.
      *
      * To better understand what's going on below, please refer to the
      * following source files in the Android 4.0.4 and 4.1 source trees:
diff --git a/net/android/legacy_openssl.h b/net/android/legacy_openssl.h
index e874135..75c77b8 100644
--- a/net/android/legacy_openssl.h
+++ b/net/android/legacy_openssl.h
@@ -78,9 +78,8 @@
 struct AndroidEVP_PKEY {
   int type;
   int save_type;
-  // Note: this value must NOT be modified using Chromium's CRYPTO_add
-  // function. That may not necessarily use the same locking implementation as
-  // system OpenSSL.
+  // Note: this value is protected by threading functions in the Android system
+  // OpenSSL. It should not be accessed or modified directly.
   int references;
   const AndroidEVP_PKEY_ASN1_METHOD* ameth;
   AndroidENGINE* engine;
diff --git a/net/cookies/canonical_cookie_unittest.cc b/net/cookies/canonical_cookie_unittest.cc
index a7e82fd..80b772e 100644
--- a/net/cookies/canonical_cookie_unittest.cc
+++ b/net/cookies/canonical_cookie_unittest.cc
@@ -93,12 +93,6 @@
   EXPECT_EQ(CookieSameSite::STRICT_MODE, cookie->SameSite());
   cookie = CanonicalCookie::Create(url, "A=2; SameSite=Lax", creation_time,
                                    same_site_options);
-  EXPECT_TRUE(cookie.get());
-  EXPECT_EQ(CookieSameSite::LAX_MODE, cookie->SameSite());
-  cookie = CanonicalCookie::Create(url, "A=2; SameSite", creation_time,
-                                   same_site_options);
-  EXPECT_TRUE(cookie.get());
-  EXPECT_EQ(CookieSameSite::NO_RESTRICTION, cookie->SameSite());
 
   // Test the creating cookies using specific parameter instead of a cookie
   // string.
@@ -129,6 +123,23 @@
   EXPECT_EQ(CookieSameSite::NO_RESTRICTION, cookie->SameSite());
 }
 
+TEST(CanonicalCookieTest, CreateInvalidSameSite) {
+  GURL url("http://www.example.com/test/foo.html");
+  base::Time now = base::Time::Now();
+  scoped_ptr<CanonicalCookie> cookie;
+  CookieOptions options;
+
+  // Invalid 'SameSite' attribute values.
+  options.set_same_site_cookie_mode(
+      CookieOptions::SameSiteCookieMode::INCLUDE_STRICT_AND_LAX);
+
+  cookie = CanonicalCookie::Create(url, "A=2; SameSite=Invalid", now, options);
+  EXPECT_EQ(nullptr, cookie.get());
+
+  cookie = CanonicalCookie::Create(url, "A=2; SameSite", now, options);
+  EXPECT_EQ(nullptr, cookie.get());
+}
+
 TEST(CanonicalCookieTest, EmptyExpiry) {
   GURL url("http://www7.ipdl.inpit.go.jp/Tokujitu/tjkta.ipdl?N0000=108");
   base::Time creation_time = base::Time::Now();
diff --git a/net/cookies/parsed_cookie.cc b/net/cookies/parsed_cookie.cc
index a6c1e95..2175692 100644
--- a/net/cookies/parsed_cookie.cc
+++ b/net/cookies/parsed_cookie.cc
@@ -179,7 +179,7 @@
 }
 
 bool ParsedCookie::IsValid() const {
-  return !pairs_.empty();
+  return !pairs_.empty() && IsSameSiteAttributeValid();
 }
 
 CookieSameSite ParsedCookie::SameSite() const {
@@ -506,4 +506,8 @@
   pairs_.erase(pairs_.begin() + index);
 }
 
+bool ParsedCookie::IsSameSiteAttributeValid() const {
+  return same_site_index_ == 0 || SameSite() != CookieSameSite::DEFAULT_MODE;
+}
+
 }  // namespace
diff --git a/net/cookies/parsed_cookie.h b/net/cookies/parsed_cookie.h
index ebb14de..f48015d 100644
--- a/net/cookies/parsed_cookie.h
+++ b/net/cookies/parsed_cookie.h
@@ -129,6 +129,10 @@
   // |index| refers to a position in |pairs_|.
   void ClearAttributePair(size_t index);
 
+  // Returns false if a 'SameSite' attribute is present, but has an unrecognized
+  // value. In particular, this includes attributes with empty values.
+  bool IsSameSiteAttributeValid() const;
+
   PairList pairs_;
   // These will default to 0, but that should never be valid since the
   // 0th index is the user supplied token/value, not an attribute.
diff --git a/net/cookies/parsed_cookie_unittest.cc b/net/cookies/parsed_cookie_unittest.cc
index 0a3048e..27efb99 100644
--- a/net/cookies/parsed_cookie_unittest.cc
+++ b/net/cookies/parsed_cookie_unittest.cc
@@ -460,27 +460,43 @@
   EXPECT_TRUE(pc.SetSameSite("strict"));
   EXPECT_EQ("name=value; samesite=strict", pc.ToCookieLine());
   EXPECT_EQ(CookieSameSite::STRICT_MODE, pc.SameSite());
+  EXPECT_TRUE(pc.IsValid());
 
   EXPECT_TRUE(pc.SetSameSite("lAx"));
   EXPECT_EQ("name=value; samesite=lAx", pc.ToCookieLine());
   EXPECT_EQ(CookieSameSite::LAX_MODE, pc.SameSite());
+  EXPECT_TRUE(pc.IsValid());
 
   EXPECT_TRUE(pc.SetSameSite("LAX"));
   EXPECT_EQ("name=value; samesite=LAX", pc.ToCookieLine());
   EXPECT_EQ(CookieSameSite::LAX_MODE, pc.SameSite());
-
-  // Interpret invalid priority values as CookieSameSite::DEFAULT_MODE.
-  EXPECT_TRUE(pc.SetSameSite("Blah"));
-  EXPECT_EQ("name=value; samesite=Blah", pc.ToCookieLine());
-  EXPECT_EQ(CookieSameSite::DEFAULT_MODE, pc.SameSite());
-
-  EXPECT_TRUE(pc.SetSameSite("lowerest"));
-  EXPECT_EQ("name=value; samesite=lowerest", pc.ToCookieLine());
-  EXPECT_EQ(CookieSameSite::DEFAULT_MODE, pc.SameSite());
+  EXPECT_TRUE(pc.IsValid());
 
   EXPECT_TRUE(pc.SetSameSite(""));
   EXPECT_EQ("name=value", pc.ToCookieLine());
   EXPECT_EQ(CookieSameSite::DEFAULT_MODE, pc.SameSite());
+  EXPECT_TRUE(pc.IsValid());
+
+  EXPECT_TRUE(pc.SetSameSite("Blah"));
+  EXPECT_FALSE(pc.IsValid());
+}
+
+TEST(ParsedCookieTest, InvalidSameSiteValue) {
+  struct TestCase {
+    const char* cookie;
+    bool valid;
+    CookieSameSite mode;
+  } cases[]{{"n=v; samesite=strict", true, CookieSameSite::STRICT_MODE},
+            {"n=v; samesite=lax", true, CookieSameSite::LAX_MODE},
+            {"n=v; samesite=boo", false, CookieSameSite::DEFAULT_MODE},
+            {"n=v; samesite", false, CookieSameSite::DEFAULT_MODE}};
+
+  for (const auto& test : cases) {
+    SCOPED_TRACE(test.cookie);
+    ParsedCookie pc(test.cookie);
+    EXPECT_EQ(test.valid, pc.IsValid());
+    EXPECT_EQ(test.mode, pc.SameSite());
+  }
 }
 
 TEST(ParsedCookieTest, InvalidNonAlphanumericChars) {
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc
index 12043644..ebbe1552 100644
--- a/net/http/http_network_transaction.cc
+++ b/net/http/http_network_transaction.cc
@@ -163,11 +163,10 @@
     response_.unused_since_prefetch = true;
 
   // Channel ID is disabled if privacy mode is enabled for this request.
-  if (request_->privacy_mode == PRIVACY_MODE_ENABLED)
+  if (request_->privacy_mode == PRIVACY_MODE_ENABLED) {
     server_ssl_config_.channel_id_enabled = false;
-
-  if (session_->params().enable_token_binding &&
-      session_->params().channel_id_service) {
+  } else if (session_->params().enable_token_binding &&
+             session_->params().channel_id_service) {
     server_ssl_config_.token_binding_params.push_back(TB_PARAM_ECDSAP256);
   }
 
diff --git a/net/quic/quic_chromium_client_session.h b/net/quic/quic_chromium_client_session.h
index 7c7ecd7f..a9e636b6 100644
--- a/net/quic/quic_chromium_client_session.h
+++ b/net/quic/quic_chromium_client_session.h
@@ -14,7 +14,6 @@
 
 #include <string>
 
-#include "base/containers/hash_tables.h"
 #include "base/containers/mru_cache.h"
 #include "base/macros.h"
 #include "base/memory/scoped_ptr.h"
diff --git a/net/quic/quic_connection.cc b/net/quic/quic_connection.cc
index d5a28d0..7ce76a8 100644
--- a/net/quic/quic_connection.cc
+++ b/net/quic/quic_connection.cc
@@ -38,8 +38,6 @@
 
 using base::StringPiece;
 using base::StringPrintf;
-using base::hash_map;
-using base::hash_set;
 using std::list;
 using std::make_pair;
 using std::max;
diff --git a/net/quic/quic_framer_test.cc b/net/quic/quic_framer_test.cc
index 80f7683..07ad276 100644
--- a/net/quic/quic_framer_test.cc
+++ b/net/quic/quic_framer_test.cc
@@ -10,7 +10,6 @@
 #include <string>
 #include <vector>
 
-#include "base/containers/hash_tables.h"
 #include "base/logging.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/stl_util.h"
@@ -22,7 +21,6 @@
 #include "net/quic/test_tools/quic_test_utils.h"
 #include "net/test/gtest_util.h"
 
-using base::hash_set;
 using base::StringPiece;
 using std::make_pair;
 using std::map;
diff --git a/net/quic/quic_multipath_transmissions_map.h b/net/quic/quic_multipath_transmissions_map.h
index cca82a4..203fb28 100644
--- a/net/quic/quic_multipath_transmissions_map.h
+++ b/net/quic/quic_multipath_transmissions_map.h
@@ -15,7 +15,6 @@
 #include <deque>
 #include <unordered_map>
 
-#include "base/containers/hash_tables.h"
 #include "base/macros.h"
 #include "net/quic/quic_protocol.h"
 #include "net/quic/quic_utils.h"
diff --git a/net/quic/quic_packet_creator.h b/net/quic/quic_packet_creator.h
index aca9719..f74244f 100644
--- a/net/quic/quic_packet_creator.h
+++ b/net/quic/quic_packet_creator.h
@@ -23,8 +23,6 @@
 #include "net/quic/quic_framer.h"
 #include "net/quic/quic_protocol.h"
 
-using base::hash_map;
-
 namespace net {
 namespace test {
 class QuicPacketCreatorPeer;
diff --git a/net/quic/quic_protocol.h b/net/quic/quic_protocol.h
index 1daad1b..44bcbac 100644
--- a/net/quic/quic_protocol.h
+++ b/net/quic/quic_protocol.h
@@ -17,7 +17,6 @@
 #include <utility>
 #include <vector>
 
-#include "base/containers/hash_tables.h"
 #include "base/logging.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
diff --git a/net/quic/quic_sent_packet_manager.h b/net/quic/quic_sent_packet_manager.h
index c4484702..6d4241e 100644
--- a/net/quic/quic_sent_packet_manager.h
+++ b/net/quic/quic_sent_packet_manager.h
@@ -12,7 +12,6 @@
 #include <utility>
 #include <vector>
 
-#include "base/containers/hash_tables.h"
 #include "base/macros.h"
 #include "base/memory/scoped_ptr.h"
 #include "net/base/linked_hash_map.h"
diff --git a/net/quic/quic_session.cc b/net/quic/quic_session.cc
index 2967c76c..de558968 100644
--- a/net/quic/quic_session.cc
+++ b/net/quic/quic_session.cc
@@ -16,8 +16,6 @@
 
 using base::IntToString;
 using base::StringPiece;
-using base::hash_map;
-using base::hash_set;
 using std::make_pair;
 using std::map;
 using std::max;
diff --git a/net/quic/quic_session.h b/net/quic/quic_session.h
index f6a5614cc..b072c9b 100644
--- a/net/quic/quic_session.h
+++ b/net/quic/quic_session.h
@@ -16,7 +16,6 @@
 #include <vector>
 
 #include "base/compiler_specific.h"
-#include "base/containers/hash_tables.h"
 #include "base/macros.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/strings/string_piece.h"
diff --git a/net/quic/quic_session_test.cc b/net/quic/quic_session_test.cc
index 4d4004b3..2c18073 100644
--- a/net/quic/quic_session_test.cc
+++ b/net/quic/quic_session_test.cc
@@ -6,7 +6,6 @@
 
 #include <set>
 
-#include "base/containers/hash_tables.h"
 #include "base/rand_util.h"
 #include "base/stl_util.h"
 #include "base/strings/string_number_conversions.h"
@@ -31,7 +30,6 @@
 #include "testing/gmock_mutant.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
-using base::hash_map;
 using std::set;
 using std::string;
 using std::vector;
diff --git a/net/quic/quic_stream_factory.cc b/net/quic/quic_stream_factory.cc
index 3a4d135..65d7f27 100644
--- a/net/quic/quic_stream_factory.cc
+++ b/net/quic/quic_stream_factory.cc
@@ -135,10 +135,9 @@
  public:
   Job(QuicStreamFactory* factory,
       HostResolver* host_resolver,
-      const HostPortPair& host_port_pair,
+      const QuicServerId& server_id,
       bool server_and_origin_have_same_host,
       bool was_alternative_service_recently_broken,
-      PrivacyMode privacy_mode,
       int cert_verify_flags,
       bool is_post,
       QuicServerInfo* server_info,
@@ -212,10 +211,9 @@
 
 QuicStreamFactory::Job::Job(QuicStreamFactory* factory,
                             HostResolver* host_resolver,
-                            const HostPortPair& host_port_pair,
+                            const QuicServerId& server_id,
                             bool server_and_origin_have_same_host,
                             bool was_alternative_service_recently_broken,
-                            PrivacyMode privacy_mode,
                             int cert_verify_flags,
                             bool is_post,
                             QuicServerInfo* server_info,
@@ -223,7 +221,7 @@
     : io_state_(STATE_RESOLVE_HOST),
       factory_(factory),
       host_resolver_(host_resolver),
-      server_id_(host_port_pair, privacy_mode),
+      server_id_(server_id),
       cert_verify_flags_(cert_verify_flags),
       server_and_origin_have_same_host_(server_and_origin_have_same_host),
       is_post_(is_post),
@@ -833,8 +831,7 @@
   if (quic_server_info_factory_.get()) {
     bool load_from_disk_cache = !disable_disk_cache_;
     MaybeInitialize();
-    if (!ContainsKey(quic_supported_servers_at_startup_,
-                     server_id.host_port_pair())) {
+    if (!ContainsKey(quic_supported_servers_at_startup_, host_port_pair)) {
       // If there is no entry for QUIC, consider that as a new server and
       // don't wait for Cache thread to load the data for that server.
       load_from_disk_cache = false;
@@ -845,10 +842,10 @@
   }
 
   bool server_and_origin_have_same_host = host_port_pair.host() == url.host();
-  scoped_ptr<Job> job(new Job(
-      this, host_resolver_, host_port_pair, server_and_origin_have_same_host,
-      WasQuicRecentlyBroken(server_id), privacy_mode, cert_verify_flags,
-      method == "POST" /* is_post */, quic_server_info, net_log));
+  scoped_ptr<Job> job(
+      new Job(this, host_resolver_, server_id, server_and_origin_have_same_host,
+              WasQuicRecentlyBroken(server_id), cert_verify_flags,
+              method == "POST" /* is_post */, quic_server_info, net_log));
   int rv = job->Run(base::Bind(&QuicStreamFactory::OnJobComplete,
                                base::Unretained(this), job.get()));
   if (rv == ERR_IO_PENDING) {
@@ -879,10 +876,10 @@
                                           bool server_and_origin_have_same_host,
                                           bool is_post,
                                           const BoundNetLog& net_log) {
-  Job* aux_job = new Job(
-      this, host_resolver_, server_id.host_port_pair(),
-      server_and_origin_have_same_host, WasQuicRecentlyBroken(server_id),
-      server_id.privacy_mode(), cert_verify_flags, is_post, nullptr, net_log);
+  Job* aux_job =
+      new Job(this, host_resolver_, server_id, server_and_origin_have_same_host,
+              WasQuicRecentlyBroken(server_id), cert_verify_flags, is_post,
+              nullptr, net_log);
   active_jobs_[server_id].insert(aux_job);
   task_runner_->PostTask(FROM_HERE,
                          base::Bind(&QuicStreamFactory::Job::RunAuxilaryJob,
diff --git a/net/quic/test_tools/quic_session_peer.h b/net/quic/test_tools/quic_session_peer.h
index ac971872..dcc60b9 100644
--- a/net/quic/test_tools/quic_session_peer.h
+++ b/net/quic/test_tools/quic_session_peer.h
@@ -9,7 +9,6 @@
 
 #include <map>
 
-#include "base/containers/hash_tables.h"
 #include "base/macros.h"
 #include "net/quic/quic_protocol.h"
 #include "net/quic/quic_session.h"
diff --git a/net/spdy/spdy_framer.cc b/net/spdy/spdy_framer.cc
index 2994ae6d..ab242b8e1 100644
--- a/net/spdy/spdy_framer.cc
+++ b/net/spdy/spdy_framer.cc
@@ -423,6 +423,8 @@
       return "INVALID_CONTROL_FRAME";
     case SPDY_CONTROL_PAYLOAD_TOO_LARGE:
       return "CONTROL_PAYLOAD_TOO_LARGE";
+    case SPDY_INVALID_CONTROL_FRAME_SIZE:
+      return "INVALID_CONTROL_FRAME_SIZE";
     case SPDY_ZLIB_INIT_FAILURE:
       return "ZLIB_INIT_FAILURE";
     case SPDY_UNSUPPORTED_VERSION:
@@ -903,13 +905,11 @@
       }
       break;
     case RST_STREAM:
-      // TODO(bnc): Enforce the length of the header, and change error to
-      // FRAME_SIZE_ERROR.
       if ((current_frame_length_ != GetRstStreamMinimumSize() &&
            protocol_version_ == SPDY3) ||
           (current_frame_length_ < GetRstStreamMinimumSize() &&
            protocol_version_ == HTTP2)) {
-        set_error(SPDY_INVALID_CONTROL_FRAME);
+        set_error(SPDY_INVALID_CONTROL_FRAME_SIZE);
       } else if (current_frame_flags_ != 0) {
         set_error(SPDY_INVALID_CONTROL_FRAME_FLAGS);
       }
@@ -926,7 +926,7 @@
           % setting_size != values_prefix_size) {
         DLOG(WARNING) << "Invalid length for SETTINGS frame: "
                       << current_frame_length_;
-        set_error(SPDY_INVALID_CONTROL_FRAME);
+        set_error(SPDY_INVALID_CONTROL_FRAME_SIZE);
       } else if (protocol_version_ == SPDY3 &&
                  current_frame_flags_ &
                      ~SETTINGS_FLAG_CLEAR_PREVIOUSLY_PERSISTED_SETTINGS) {
@@ -937,13 +937,13 @@
       } else if (protocol_version_ == HTTP2 &&
                  current_frame_flags_ & SETTINGS_FLAG_ACK &&
                  current_frame_length_ > GetSettingsMinimumSize()) {
-        set_error(SPDY_INVALID_CONTROL_FRAME);
+        set_error(SPDY_INVALID_CONTROL_FRAME_SIZE);
       }
       break;
     }
     case PING:
       if (current_frame_length_ != GetPingSize()) {
-        set_error(SPDY_INVALID_CONTROL_FRAME);
+        set_error(SPDY_INVALID_CONTROL_FRAME_SIZE);
       } else if ((protocol_version_ == SPDY3 && current_frame_flags_ != 0) ||
                  (current_frame_flags_ & ~PING_FLAG_ACK)) {
         set_error(SPDY_INVALID_CONTROL_FRAME_FLAGS);
@@ -989,7 +989,7 @@
       break;
     case WINDOW_UPDATE:
       if (current_frame_length_ != GetWindowUpdateSize()) {
-        set_error(SPDY_INVALID_CONTROL_FRAME);
+        set_error(SPDY_INVALID_CONTROL_FRAME_SIZE);
       } else if (current_frame_flags_ != 0) {
         set_error(SPDY_INVALID_CONTROL_FRAME_FLAGS);
       }
@@ -1032,7 +1032,7 @@
     case PRIORITY:
       if (protocol_version_ == SPDY3 ||
           current_frame_length_ != GetPrioritySize()) {
-        set_error(SPDY_INVALID_CONTROL_FRAME);
+        set_error(SPDY_INVALID_CONTROL_FRAME_SIZE);
       } else if (current_frame_flags_ != 0) {
         set_error(SPDY_INVALID_CONTROL_FRAME_FLAGS);
       }
diff --git a/net/spdy/spdy_framer.h b/net/spdy/spdy_framer.h
index 27384ce8..7375333 100644
--- a/net/spdy/spdy_framer.h
+++ b/net/spdy/spdy_framer.h
@@ -340,6 +340,7 @@
     SPDY_INVALID_DATA_FRAME_FLAGS,     // Data frame has invalid flags.
     SPDY_INVALID_CONTROL_FRAME_FLAGS,  // Control frame has invalid flags.
     SPDY_UNEXPECTED_FRAME,             // Frame received out of order.
+    SPDY_INVALID_CONTROL_FRAME_SIZE,   // Control frame not sized to spec
 
     LAST_ERROR,  // Must be the last entry in the enum.
   };
diff --git a/net/spdy/spdy_framer_test.cc b/net/spdy/spdy_framer_test.cc
index 386f2b94..3c4724e 100644
--- a/net/spdy/spdy_framer_test.cc
+++ b/net/spdy/spdy_framer_test.cc
@@ -3471,6 +3471,9 @@
   // Should generate an error, since its not possible to have a
   // settings frame of length kNewLength.
   EXPECT_EQ(1, visitor.error_count_);
+  EXPECT_EQ(SpdyFramer::SPDY_INVALID_CONTROL_FRAME_SIZE,
+            visitor.framer_.error_code())
+      << SpdyFramer::ErrorCodeToString(visitor.framer_.error_code());
 }
 
 // Tests handling of SETTINGS frames larger than the frame buffer size.
@@ -4228,6 +4231,9 @@
   EXPECT_STREQ("CONTROL_PAYLOAD_TOO_LARGE",
                SpdyFramer::ErrorCodeToString(
                    SpdyFramer::SPDY_CONTROL_PAYLOAD_TOO_LARGE));
+  EXPECT_STREQ("INVALID_CONTROL_FRAME_SIZE",
+               SpdyFramer::ErrorCodeToString(
+                   SpdyFramer::SPDY_INVALID_CONTROL_FRAME_SIZE));
   EXPECT_STREQ("ZLIB_INIT_FAILURE",
                SpdyFramer::ErrorCodeToString(
                    SpdyFramer::SPDY_ZLIB_INIT_FAILURE));
@@ -4832,7 +4838,7 @@
     } else if (flags & SETTINGS_FLAG_ACK) {
       // The frame is invalid because ACK frames should have no payload.
       EXPECT_EQ(SpdyFramer::SPDY_ERROR, framer.state());
-      EXPECT_EQ(SpdyFramer::SPDY_INVALID_CONTROL_FRAME,
+      EXPECT_EQ(SpdyFramer::SPDY_INVALID_CONTROL_FRAME_SIZE,
                 framer.error_code())
           << SpdyFramer::ErrorCodeToString(framer.error_code());
     } else {
@@ -5660,7 +5666,68 @@
   visitor.SimulateInFramer(kFrameData, sizeof(kFrameData));
 
   EXPECT_EQ(SpdyFramer::SPDY_ERROR, visitor.framer_.state());
-  EXPECT_EQ(SpdyFramer::SPDY_INVALID_CONTROL_FRAME,
+  EXPECT_EQ(SpdyFramer::SPDY_INVALID_CONTROL_FRAME_SIZE,
+            visitor.framer_.error_code())
+      << SpdyFramer::ErrorCodeToString(visitor.framer_.error_code());
+}
+
+// Tests handling of PING frame with incorrect size.
+TEST_P(SpdyFramerTest, ReadIncorrectlySizedPing) {
+  if (!IsHttp2()) {
+    return;
+  }
+
+  // PING frame of size 4, which isn't correct.
+  const unsigned char kFrameData[] = {
+      0x00, 0x00, 0x04, 0x06, 0x00, 0x00, 0x00,
+      0x00, 0x03, 0x00, 0x00, 0x00, 0x01,
+  };
+
+  TestSpdyVisitor visitor(spdy_version_);
+  visitor.SimulateInFramer(kFrameData, sizeof(kFrameData));
+
+  EXPECT_EQ(SpdyFramer::SPDY_ERROR, visitor.framer_.state());
+  EXPECT_EQ(SpdyFramer::SPDY_INVALID_CONTROL_FRAME_SIZE,
+            visitor.framer_.error_code())
+      << SpdyFramer::ErrorCodeToString(visitor.framer_.error_code());
+}
+
+// Tests handling of WINDOW_UPDATE frame with incorrect size.
+TEST_P(SpdyFramerTest, ReadIncorrectlySizedWindowUpdate) {
+  if (!IsHttp2()) {
+    return;
+  }
+
+  // WINDOW_UPDATE frame of size 3, which isn't correct.
+  const unsigned char kFrameData[] = {
+      0x00, 0x00, 0x03, 0x08, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01,
+  };
+
+  TestSpdyVisitor visitor(spdy_version_);
+  visitor.SimulateInFramer(kFrameData, sizeof(kFrameData));
+
+  EXPECT_EQ(SpdyFramer::SPDY_ERROR, visitor.framer_.state());
+  EXPECT_EQ(SpdyFramer::SPDY_INVALID_CONTROL_FRAME_SIZE,
+            visitor.framer_.error_code())
+      << SpdyFramer::ErrorCodeToString(visitor.framer_.error_code());
+}
+
+// Tests handling of RST_STREAM frame with incorrect size.
+TEST_P(SpdyFramerTest, ReadIncorrectlySizedRstStream) {
+  if (!IsHttp2()) {
+    return;
+  }
+
+  // RST_STREAM frame of size 3, which isn't correct.
+  const unsigned char kFrameData[] = {
+      0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01,
+  };
+
+  TestSpdyVisitor visitor(spdy_version_);
+  visitor.SimulateInFramer(kFrameData, sizeof(kFrameData));
+
+  EXPECT_EQ(SpdyFramer::SPDY_ERROR, visitor.framer_.state());
+  EXPECT_EQ(SpdyFramer::SPDY_INVALID_CONTROL_FRAME_SIZE,
             visitor.framer_.error_code())
       << SpdyFramer::ErrorCodeToString(visitor.framer_.error_code());
 }
diff --git a/net/spdy/spdy_network_transaction_unittest.cc b/net/spdy/spdy_network_transaction_unittest.cc
index e87ba46..900f103 100644
--- a/net/spdy/spdy_network_transaction_unittest.cc
+++ b/net/spdy/spdy_network_transaction_unittest.cc
@@ -3599,12 +3599,11 @@
   scoped_ptr<SpdySerializedFrame> req(
       spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST, true));
   scoped_ptr<SpdySerializedFrame> goaway(spdy_util_.ConstructSpdyGoAway(
-      0, GOAWAY_PROTOCOL_ERROR, "Framer error: 1 (INVALID_CONTROL_FRAME)."));
+      0, GOAWAY_FRAME_SIZE_ERROR,
+      "Framer error: 12 (INVALID_CONTROL_FRAME_SIZE)."));
   MockWrite writes[] = {CreateMockWrite(*req, 0), CreateMockWrite(*goaway, 2)};
 
   // Read WINDOW_UPDATE with incorrectly-sized payload.
-  // TODO(jgraettinger): SpdyFramer signals this as an INVALID_CONTROL_FRAME,
-  // which is mapped to a protocol error, and not a frame size error.
   scoped_ptr<SpdySerializedFrame> bad_window_update(
       spdy_util_.ConstructSpdyWindowUpdate(1, 1));
   test::SetFrameLength(bad_window_update.get(),
@@ -3617,7 +3616,7 @@
       CreateGetRequest(), DEFAULT_PRIORITY, BoundNetLog(), GetParam(), NULL);
   helper.RunToCompletion(&data);
   TransactionHelperResult out = helper.output();
-  EXPECT_EQ(ERR_SPDY_PROTOCOL_ERROR, out.rv);
+  EXPECT_EQ(ERR_SPDY_FRAME_SIZE_ERROR, out.rv);
 }
 
 // Test that we shutdown correctly on write errors.
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index 1a3a3ac..d4c6f06 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -374,6 +374,8 @@
       return SPDY_ERROR_INVALID_CONTROL_FRAME_FLAGS;
     case SpdyFramer::SPDY_UNEXPECTED_FRAME:
       return SPDY_ERROR_UNEXPECTED_FRAME;
+    case SpdyFramer::SPDY_INVALID_CONTROL_FRAME_SIZE:
+      return SPDY_ERROR_INVALID_CONTROL_FRAME_SIZE;
     default:
       NOTREACHED();
       return static_cast<SpdyProtocolErrorDetails>(-1);
@@ -406,6 +408,8 @@
       return ERR_SPDY_PROTOCOL_ERROR;
     case SpdyFramer::SPDY_UNEXPECTED_FRAME:
       return ERR_SPDY_PROTOCOL_ERROR;
+    case SpdyFramer::SPDY_INVALID_CONTROL_FRAME_SIZE:
+      return ERR_SPDY_FRAME_SIZE_ERROR;
     default:
       NOTREACHED();
       return ERR_SPDY_PROTOCOL_ERROR;
diff --git a/net/spdy/spdy_session.h b/net/spdy/spdy_session.h
index 57e16d7..d99ae0b 100644
--- a/net/spdy/spdy_session.h
+++ b/net/spdy/spdy_session.h
@@ -97,6 +97,7 @@
   SPDY_ERROR_INVALID_DATA_FRAME_FLAGS = 8,
   SPDY_ERROR_INVALID_CONTROL_FRAME_FLAGS = 9,
   SPDY_ERROR_UNEXPECTED_FRAME = 31,
+  SPDY_ERROR_INVALID_CONTROL_FRAME_SIZE = 37,
   // SpdyRstStreamStatus mappings.
   // RST_STREAM_INVALID not mapped.
   STATUS_CODE_PROTOCOL_ERROR = 11,
@@ -125,7 +126,7 @@
   PROTOCOL_ERROR_RECEIVE_WINDOW_VIOLATION = 28,
 
   // Next free value.
-  NUM_SPDY_PROTOCOL_ERROR_DETAILS = 37,
+  NUM_SPDY_PROTOCOL_ERROR_DETAILS = 38,
 };
 SpdyProtocolErrorDetails NET_EXPORT_PRIVATE
     MapFramerErrorToProtocolError(SpdyFramer::SpdyError error);
@@ -136,7 +137,7 @@
 
 // If these compile asserts fail then SpdyProtocolErrorDetails needs
 // to be updated with new values, as do the mapping functions above.
-static_assert(12 == SpdyFramer::LAST_ERROR,
+static_assert(13 == SpdyFramer::LAST_ERROR,
               "SpdyProtocolErrorDetails / Spdy Errors mismatch");
 static_assert(17 == RST_STREAM_NUM_STATUS_CODES,
               "SpdyProtocolErrorDetails / RstStreamStatus mismatch");
diff --git a/ppapi/host/host_factory.h b/ppapi/host/host_factory.h
index e2dcce7..0beaa4c 100644
--- a/ppapi/host/host_factory.h
+++ b/ppapi/host/host_factory.h
@@ -5,7 +5,8 @@
 #ifndef PPAPI_HOST_HOST_FACTORY_H_
 #define PPAPI_HOST_HOST_FACTORY_H_
 
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
 #include "ppapi/c/pp_instance.h"
 #include "ppapi/c/pp_resource.h"
 
@@ -31,7 +32,7 @@
  public:
   virtual ~HostFactory() {}
 
-  virtual scoped_ptr<ResourceHost> CreateResourceHost(
+  virtual std::unique_ptr<ResourceHost> CreateResourceHost(
       PpapiHost* host,
       PP_Resource resource,
       PP_Instance instance,
diff --git a/ppapi/host/ppapi_host.cc b/ppapi/host/ppapi_host.cc
index a194c23..f3c68fa 100644
--- a/ppapi/host/ppapi_host.cc
+++ b/ppapi/host/ppapi_host.cc
@@ -126,11 +126,11 @@
   Send(new PpapiPluginMsg_ResourceReply(params, msg));
 }
 
-scoped_ptr<ResourceHost> PpapiHost::CreateResourceHost(
+std::unique_ptr<ResourceHost> PpapiHost::CreateResourceHost(
     PP_Resource resource,
     PP_Instance instance,
     const IPC::Message& nested_msg) {
-  scoped_ptr<ResourceHost> resource_host;
+  std::unique_ptr<ResourceHost> resource_host;
   DCHECK(!host_factory_filters_.empty());  // Caller forgot to add a factory.
   for (size_t i = 0; i < host_factory_filters_.size(); i++) {
     resource_host = host_factory_filters_[i]->CreateResourceHost(
@@ -141,7 +141,8 @@
   return resource_host;
 }
 
-int PpapiHost::AddPendingResourceHost(scoped_ptr<ResourceHost> resource_host) {
+int PpapiHost::AddPendingResourceHost(
+    std::unique_ptr<ResourceHost> resource_host) {
   // The resource ID should not be assigned.
   if (!resource_host.get() || resource_host->pp_resource() != 0) {
     NOTREACHED();
@@ -158,12 +159,12 @@
   return pending_id;
 }
 
-void PpapiHost::AddHostFactoryFilter(scoped_ptr<HostFactory> filter) {
+void PpapiHost::AddHostFactoryFilter(std::unique_ptr<HostFactory> filter) {
   host_factory_filters_.push_back(std::move(filter));
 }
 
 void PpapiHost::AddInstanceMessageFilter(
-    scoped_ptr<InstanceMessageFilter> filter) {
+    std::unique_ptr<InstanceMessageFilter> filter) {
   instance_message_filters_.push_back(std::move(filter));
 }
 
@@ -235,7 +236,7 @@
   }
 
   // Run through all filters until one grabs this message.
-  scoped_ptr<ResourceHost> resource_host =
+  std::unique_ptr<ResourceHost> resource_host =
       CreateResourceHost(params.pp_resource(), instance, nested_msg);
 
   if (!resource_host.get()) {
@@ -274,7 +275,8 @@
   // element will be there or not. Therefore, we delay destruction of the
   // HostResource until after we've made sure the map no longer contains
   // |resource|.
-  scoped_ptr<ResourceHost> delete_at_end_of_scope(std::move(found->second));
+  std::unique_ptr<ResourceHost> delete_at_end_of_scope(
+      std::move(found->second));
   resources_.erase(found);
 }
 
diff --git a/ppapi/host/ppapi_host.h b/ppapi/host/ppapi_host.h
index 81121a3..5b21beb 100644
--- a/ppapi/host/ppapi_host.h
+++ b/ppapi/host/ppapi_host.h
@@ -6,11 +6,11 @@
 #define PPAPI_HOST_PPAPI_HOST_H_
 
 #include <map>
+#include <memory>
 #include <vector>
 
 #include "base/compiler_specific.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/observer_list.h"
 #include "ipc/ipc_listener.h"
 #include "ipc/ipc_sender.h"
@@ -69,22 +69,23 @@
       const std::vector<proxy::SerializedHandle>& handles);
 
   // Create a ResourceHost with the given |nested_msg|.
-  scoped_ptr<ResourceHost> CreateResourceHost(PP_Resource resource,
-                                              PP_Instance instance,
-                                              const IPC::Message& nested_msg);
+  std::unique_ptr<ResourceHost> CreateResourceHost(
+      PP_Resource resource,
+      PP_Instance instance,
+      const IPC::Message& nested_msg);
 
   // Adds the given host resource as a pending one (with no corresponding
   // PluginResource object and no PP_Resource ID yet). The pending resource ID
   // is returned. See PpapiHostMsg_AttachToPendingHost.
-  int AddPendingResourceHost(scoped_ptr<ResourceHost> resource_host);
+  int AddPendingResourceHost(std::unique_ptr<ResourceHost> resource_host);
 
   // Adds the given host factory filter to the host. The PpapiHost will take
   // ownership of the pointer.
-  void AddHostFactoryFilter(scoped_ptr<HostFactory> filter);
+  void AddHostFactoryFilter(std::unique_ptr<HostFactory> filter);
 
   // Adds the given message filter to the host. The PpapiHost will take
   // ownership of the pointer.
-  void AddInstanceMessageFilter(scoped_ptr<InstanceMessageFilter> filter);
+  void AddInstanceMessageFilter(std::unique_ptr<InstanceMessageFilter> filter);
 
   // Returns null if the resource doesn't exist.
   host::ResourceHost* GetResourceHost(PP_Resource resource) const;
@@ -123,21 +124,21 @@
   // deleting these dynamically we don't need to worry about modifications
   // during iteration. If we add that capability, this should be replaced with
   // an base::ObserverList.
-  std::vector<scoped_ptr<HostFactory>> host_factory_filters_;
+  std::vector<std::unique_ptr<HostFactory>> host_factory_filters_;
 
   // Filters for instance messages. Note that since we don't support deleting
   // these dynamically we don't need to worry about modifications during
   // iteration. If we add that capability, this should be replaced with an
   // base::ObserverList.
-  std::vector<scoped_ptr<InstanceMessageFilter>> instance_message_filters_;
+  std::vector<std::unique_ptr<InstanceMessageFilter>> instance_message_filters_;
 
-  typedef std::map<PP_Resource, scoped_ptr<ResourceHost>> ResourceMap;
+  typedef std::map<PP_Resource, std::unique_ptr<ResourceHost>> ResourceMap;
   ResourceMap resources_;
 
   // Resources that have been created in the host and have not yet had the
   // corresponding PluginResource associated with them.
   // See PpapiHostMsg_AttachToPendingHost.
-  typedef std::map<int, scoped_ptr<ResourceHost>> PendingHostResourceMap;
+  typedef std::map<int, std::unique_ptr<ResourceHost>> PendingHostResourceMap;
   PendingHostResourceMap pending_resource_hosts_;
   int next_pending_resource_host_id_;
 
diff --git a/ppapi/nacl_irt/irt_pnacl_translator_compile.cc b/ppapi/nacl_irt/irt_pnacl_translator_compile.cc
index 80a7464..a79dd959 100644
--- a/ppapi/nacl_irt/irt_pnacl_translator_compile.cc
+++ b/ppapi/nacl_irt/irt_pnacl_translator_compile.cc
@@ -92,7 +92,7 @@
     Send(reply_msg);
   }
 
-  scoped_ptr<IPC::Channel> channel_;
+  std::unique_ptr<IPC::Channel> channel_;
   const struct nacl_irt_pnacl_compile_funcs* funcs_;
 
   DISALLOW_COPY_AND_ASSIGN(TranslatorCompileListener);
diff --git a/ppapi/nacl_irt/irt_pnacl_translator_link.cc b/ppapi/nacl_irt/irt_pnacl_translator_link.cc
index b3e13ec..dc88a7a2 100644
--- a/ppapi/nacl_irt/irt_pnacl_translator_link.cc
+++ b/ppapi/nacl_irt/irt_pnacl_translator_link.cc
@@ -63,7 +63,7 @@
     Send(reply_msg);
   }
 
-  scoped_ptr<IPC::Channel> channel_;
+  std::unique_ptr<IPC::Channel> channel_;
   CallbackFunc func_;
 
   DISALLOW_COPY_AND_ASSIGN(TranslatorLinkListener);
diff --git a/ppapi/nacl_irt/manifest_service.h b/ppapi/nacl_irt/manifest_service.h
index 7a869e7..cd2e233 100644
--- a/ppapi/nacl_irt/manifest_service.h
+++ b/ppapi/nacl_irt/manifest_service.h
@@ -5,9 +5,10 @@
 #ifndef PPAPI_NACL_IRT_MANIFEST_SERVICE_H_
 #define PPAPI_NACL_IRT_MANIFEST_SERVICE_H_
 
+#include <memory>
+
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/synchronization/lock.h"
 
 namespace base {
@@ -34,7 +35,7 @@
   bool OpenResource(const char* file, int* fd);
 
  private:
-  scoped_ptr<IPC::ChannelProxy> channel_;
+  std::unique_ptr<IPC::ChannelProxy> channel_;
   scoped_refptr<IPC::SyncMessageFilter> filter_;
 
   base::Lock open_resource_lock_;
diff --git a/ppapi/nacl_irt/ppapi_dispatcher.h b/ppapi/nacl_irt/ppapi_dispatcher.h
index d719d87..4cb3b11 100644
--- a/ppapi/nacl_irt/ppapi_dispatcher.h
+++ b/ppapi/nacl_irt/ppapi_dispatcher.h
@@ -95,7 +95,7 @@
   scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
   base::WaitableEvent* shutdown_event_;
   int renderer_ipc_fd_;
-  scoped_ptr<IPC::SyncChannel> channel_;
+  std::unique_ptr<IPC::SyncChannel> channel_;
 };
 
 }  // namespace ppapi
diff --git a/ppapi/proxy/audio_encoder_resource.cc b/ppapi/proxy/audio_encoder_resource.cc
index 233af5a..a5c2ec0 100644
--- a/ppapi/proxy/audio_encoder_resource.cc
+++ b/ppapi/proxy/audio_encoder_resource.cc
@@ -2,11 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "ppapi/proxy/audio_encoder_resource.h"
+
+#include "base/memory/ptr_util.h"
 #include "base/memory/shared_memory.h"
 #include "ppapi/c/pp_array_output.h"
 #include "ppapi/c/pp_codecs.h"
 #include "ppapi/proxy/audio_buffer_resource.h"
-#include "ppapi/proxy/audio_encoder_resource.h"
 #include "ppapi/proxy/ppapi_messages.h"
 #include "ppapi/shared_impl/array_writer.h"
 #include "ppapi/shared_impl/media_stream_buffer.h"
@@ -230,7 +232,7 @@
   if (!params.TakeSharedMemoryHandleAtIndex(0, &buffer_handle) ||
       !audio_buffer_manager_.SetBuffers(
           audio_buffer_count, audio_buffer_size,
-          make_scoped_ptr(new base::SharedMemory(buffer_handle, false)),
+          base::WrapUnique(new base::SharedMemory(buffer_handle, false)),
           true)) {
     RunCallback(&initialize_callback_, PP_ERROR_NOMEMORY);
     return;
@@ -240,7 +242,7 @@
   if (!params.TakeSharedMemoryHandleAtIndex(1, &buffer_handle) ||
       !bitstream_buffer_manager_.SetBuffers(
           bitstream_buffer_count, bitstream_buffer_size,
-          make_scoped_ptr(new base::SharedMemory(buffer_handle, false)),
+          base::WrapUnique(new base::SharedMemory(buffer_handle, false)),
           false)) {
     RunCallback(&initialize_callback_, PP_ERROR_NOMEMORY);
     return;
diff --git a/ppapi/proxy/audio_encoder_resource.h b/ppapi/proxy/audio_encoder_resource.h
index f1ba9f3..0290d21be 100644
--- a/ppapi/proxy/audio_encoder_resource.h
+++ b/ppapi/proxy/audio_encoder_resource.h
@@ -9,7 +9,6 @@
 
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/scoped_vector.h"
 #include "ppapi/proxy/connection.h"
 #include "ppapi/proxy/plugin_resource.h"
diff --git a/ppapi/proxy/audio_input_resource.h b/ppapi/proxy/audio_input_resource.h
index 3a3b40b7..809c0dbe 100644
--- a/ppapi/proxy/audio_input_resource.h
+++ b/ppapi/proxy/audio_input_resource.h
@@ -8,10 +8,11 @@
 #include <stddef.h>
 #include <stdint.h>
 
+#include <memory>
+
 #include "base/compiler_specific.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/shared_memory.h"
 #include "base/sync_socket.h"
 #include "base/threading/simple_thread.h"
@@ -104,18 +105,18 @@
 
   // Socket used to notify us when new samples are available. This pointer is
   // created in SetStreamInfo().
-  scoped_ptr<base::CancelableSyncSocket> socket_;
+  std::unique_ptr<base::CancelableSyncSocket> socket_;
 
   // Sample buffer in shared memory. This pointer is created in
   // SetStreamInfo(). The memory is only mapped when the audio thread is
   // created.
-  scoped_ptr<base::SharedMemory> shared_memory_;
+  std::unique_ptr<base::SharedMemory> shared_memory_;
 
   // The size of the sample buffer in bytes.
   size_t shared_memory_size_;
 
   // When the callback is set, this thread is spawned for calling it.
-  scoped_ptr<base::DelegateSimpleThread> audio_input_thread_;
+  std::unique_ptr<base::DelegateSimpleThread> audio_input_thread_;
 
   // Callback to call when new samples are available.
   PPB_AudioInput_Callback_0_3 audio_input_callback_0_3_;
@@ -139,12 +140,12 @@
   size_t bytes_per_second_;
 
   // AudioBus for shuttling data across the shared memory.
-  scoped_ptr<media::AudioBus> audio_bus_;
+  std::unique_ptr<media::AudioBus> audio_bus_;
   int sample_frame_count_;
 
   // Internal buffer for client's integer audio data.
   int client_buffer_size_bytes_;
-  scoped_ptr<uint8_t[]> client_buffer_;
+  std::unique_ptr<uint8_t[]> client_buffer_;
 
   DISALLOW_COPY_AND_ASSIGN(AudioInputResource);
 };
diff --git a/ppapi/proxy/camera_capabilities_resource.h b/ppapi/proxy/camera_capabilities_resource.h
index 14431ce1..ba92d4ae4 100644
--- a/ppapi/proxy/camera_capabilities_resource.h
+++ b/ppapi/proxy/camera_capabilities_resource.h
@@ -8,10 +8,10 @@
 #include <stddef.h>
 #include <stdint.h>
 
+#include <memory>
 #include <vector>
 
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "ppapi/proxy/ppapi_proxy_export.h"
 #include "ppapi/shared_impl/resource.h"
 #include "ppapi/thunk/ppb_camera_capabilities_api.h"
@@ -38,7 +38,7 @@
 
  private:
   size_t num_video_capture_formats_;
-  scoped_ptr<PP_VideoCaptureFormat[]> video_capture_formats_;
+  std::unique_ptr<PP_VideoCaptureFormat[]> video_capture_formats_;
 
   DISALLOW_COPY_AND_ASSIGN(CameraCapabilitiesResource);
 };
diff --git a/ppapi/proxy/device_enumeration_resource_helper.cc b/ppapi/proxy/device_enumeration_resource_helper.cc
index 45eee0e..3ff87b6 100644
--- a/ppapi/proxy/device_enumeration_resource_helper.cc
+++ b/ppapi/proxy/device_enumeration_resource_helper.cc
@@ -6,9 +6,10 @@
 
 #include <stddef.h>
 
+#include <memory>
+
 #include "base/bind.h"
 #include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
 #include "ipc/ipc_message.h"
 #include "ipc/ipc_message_macros.h"
 #include "ppapi/c/pp_array_output.h"
@@ -147,7 +148,7 @@
 
   CHECK(monitor_callback_.get());
 
-  scoped_ptr<PP_Resource[]> elements;
+  std::unique_ptr<PP_Resource[]> elements;
   uint32_t size = static_cast<uint32_t>(devices.size());
   if (size > 0) {
     elements.reset(new PP_Resource[size]);
diff --git a/ppapi/proxy/device_enumeration_resource_helper.h b/ppapi/proxy/device_enumeration_resource_helper.h
index ea96ea2..5c4fe72 100644
--- a/ppapi/proxy/device_enumeration_resource_helper.h
+++ b/ppapi/proxy/device_enumeration_resource_helper.h
@@ -7,6 +7,7 @@
 
 #include <stdint.h>
 
+#include <memory>
 #include <vector>
 
 #include "base/macros.h"
@@ -70,7 +71,7 @@
   bool pending_enumerate_devices_;
 
   uint32_t monitor_callback_id_;
-  scoped_ptr<ThreadAwareCallback<PP_MonitorDeviceChangeCallback> >
+  std::unique_ptr<ThreadAwareCallback<PP_MonitorDeviceChangeCallback>>
       monitor_callback_;
   void* monitor_user_data_;
 
diff --git a/ppapi/proxy/dispatcher.h b/ppapi/proxy/dispatcher.h
index a00c550b..47e1317 100644
--- a/ppapi/proxy/dispatcher.h
+++ b/ppapi/proxy/dispatcher.h
@@ -92,7 +92,7 @@
   friend class PluginDispatcherTest;
 
   // Lists all lazily-created interface proxies.
-  scoped_ptr<InterfaceProxy> proxies_[API_ID_COUNT];
+  std::unique_ptr<InterfaceProxy> proxies_[API_ID_COUNT];
 
   PP_GetInterface_Func local_get_interface_;
 
diff --git a/ppapi/proxy/file_io_resource.cc b/ppapi/proxy/file_io_resource.cc
index 1279c46..519389e 100644
--- a/ppapi/proxy/file_io_resource.cc
+++ b/ppapi/proxy/file_io_resource.cc
@@ -82,7 +82,7 @@
 
 FileIOResource::WriteOp::WriteOp(scoped_refptr<FileHolder> file_holder,
                                  int64_t offset,
-                                 scoped_ptr<char[]> buffer,
+                                 std::unique_ptr<char[]> buffer,
                                  int32_t bytes_to_write,
                                  bool append)
     : file_holder_(file_holder),
@@ -301,7 +301,7 @@
     if (increase > 0) {
       // Request a quota reservation. This makes the Write asynchronous, so we
       // must copy the plugin's buffer.
-      scoped_ptr<char[]> copy(new char[bytes_to_write]);
+      std::unique_ptr<char[]> copy(new char[bytes_to_write]);
       memcpy(copy.get(), buffer, bytes_to_write);
       int64_t result =
           file_system_resource_->AsPPB_FileSystem_API()->RequestQuota(
@@ -515,7 +515,7 @@
 
   // For the non-blocking case, post a task to the file thread. We must copy the
   // plugin's buffer at this point.
-  scoped_ptr<char[]> copy(new char[bytes_to_write]);
+  std::unique_ptr<char[]> copy(new char[bytes_to_write]);
   memcpy(copy.get(), buffer, bytes_to_write);
   scoped_refptr<WriteOp> write_op(new WriteOp(
       file_holder_, offset, std::move(copy), bytes_to_write, append));
@@ -582,7 +582,7 @@
 
 void FileIOResource::OnRequestWriteQuotaComplete(
     int64_t offset,
-    scoped_ptr<char[]> buffer,
+    std::unique_ptr<char[]> buffer,
     int32_t bytes_to_write,
     scoped_refptr<TrackedCallback> callback,
     int64_t granted) {
diff --git a/ppapi/proxy/file_io_resource.h b/ppapi/proxy/file_io_resource.h
index 9834c8e7..f20f134 100644
--- a/ppapi/proxy/file_io_resource.h
+++ b/ppapi/proxy/file_io_resource.h
@@ -7,12 +7,12 @@
 
 #include <stdint.h>
 
+#include <memory>
 #include <string>
 
 #include "base/files/file.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "ppapi/c/private/pp_file_handle.h"
 #include "ppapi/proxy/connection.h"
 #include "ppapi/proxy/plugin_resource.h"
@@ -147,7 +147,7 @@
     scoped_refptr<FileHolder> file_holder_;
     int64_t offset_;
     int32_t bytes_to_read_;
-    scoped_ptr<char[]> buffer_;
+    std::unique_ptr<char[]> buffer_;
   };
 
   // Class to perform file write operations across multiple threads.
@@ -155,7 +155,7 @@
    public:
     WriteOp(scoped_refptr<FileHolder> file_holder,
             int64_t offset,
-            scoped_ptr<char[]> buffer,
+            std::unique_ptr<char[]> buffer,
             int32_t bytes_to_write,
             bool append);
 
@@ -169,13 +169,13 @@
 
     scoped_refptr<FileHolder> file_holder_;
     int64_t offset_;
-    scoped_ptr<char[]> buffer_;
+    std::unique_ptr<char[]> buffer_;
     int32_t bytes_to_write_;
     bool append_;
   };
 
   void OnRequestWriteQuotaComplete(int64_t offset,
-                                   scoped_ptr<char[]> buffer,
+                                   std::unique_ptr<char[]> buffer,
                                    int32_t bytes_to_write,
                                    scoped_refptr<TrackedCallback> callback,
                                    int64_t granted);
diff --git a/ppapi/proxy/file_ref_resource.h b/ppapi/proxy/file_ref_resource.h
index 2ed2cc7..1639655 100644
--- a/ppapi/proxy/file_ref_resource.h
+++ b/ppapi/proxy/file_ref_resource.h
@@ -10,7 +10,6 @@
 #include <string>
 
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "ppapi/c/pp_instance.h"
 #include "ppapi/c/pp_resource.h"
 #include "ppapi/c/pp_time.h"
diff --git a/ppapi/proxy/flash_font_file_resource.cc b/ppapi/proxy/flash_font_file_resource.cc
index 34c22eb..9e2e4724 100644
--- a/ppapi/proxy/flash_font_file_resource.cc
+++ b/ppapi/proxy/flash_font_file_resource.cc
@@ -6,6 +6,7 @@
 
 #include <cstring>
 
+#include "base/memory/ptr_util.h"
 #include "ppapi/c/pp_errors.h"
 #include "ppapi/proxy/ppapi_messages.h"
 
@@ -72,7 +73,7 @@
     uint32_t table,
     const std::string& contents) {
   FontTableMap::const_iterator it =
-      font_tables_.set(table, make_scoped_ptr(new std::string(contents)));
+      font_tables_.set(table, base::WrapUnique(new std::string(contents)));
   return it->second;
 }
 
diff --git a/ppapi/proxy/flash_font_file_resource.h b/ppapi/proxy/flash_font_file_resource.h
index 4694734b..3e97671 100644
--- a/ppapi/proxy/flash_font_file_resource.h
+++ b/ppapi/proxy/flash_font_file_resource.h
@@ -47,7 +47,7 @@
   const std::string* AddFontTable(uint32_t table, const std::string& contents);
 
   using FontTableMap =
-      base::ScopedPtrHashMap<uint32_t, scoped_ptr<std::string>>;
+      base::ScopedPtrHashMap<uint32_t, std::unique_ptr<std::string>>;
   FontTableMap font_tables_;
 
   SerializedFontDescription description_;
diff --git a/ppapi/proxy/gamepad_resource.h b/ppapi/proxy/gamepad_resource.h
index b2aeca4..b17501f 100644
--- a/ppapi/proxy/gamepad_resource.h
+++ b/ppapi/proxy/gamepad_resource.h
@@ -5,9 +5,10 @@
 #ifndef PPAPI_PROXY_GAMEPAD_RESOURCE_H_
 #define PPAPI_PROXY_GAMEPAD_RESOURCE_H_
 
+#include <memory>
+
 #include "base/compiler_specific.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/shared_memory.h"
 #include "ppapi/c/ppb_gamepad.h"
 #include "ppapi/proxy/plugin_resource.h"
@@ -44,7 +45,7 @@
  private:
   void OnPluginMsgSendMemory(const ResourceMessageReplyParams& params);
 
-  scoped_ptr<base::SharedMemory> shared_memory_;
+  std::unique_ptr<base::SharedMemory> shared_memory_;
   const ContentGamepadHardwareBuffer* buffer_;
 
   // Last data returned so we can use this in the event of a read failure.
diff --git a/ppapi/proxy/interface_list.cc b/ppapi/proxy/interface_list.cc
index 8fb4cfe..b235974 100644
--- a/ppapi/proxy/interface_list.cc
+++ b/ppapi/proxy/interface_list.cc
@@ -398,15 +398,15 @@
                            Permission perm) {
   DCHECK(name_to_browser_info_.find(name) == name_to_browser_info_.end());
   name_to_browser_info_.add(
-      name, scoped_ptr<InterfaceInfo>(new InterfaceInfo(iface, perm)));
+      name, std::unique_ptr<InterfaceInfo>(new InterfaceInfo(iface, perm)));
 }
 
 void InterfaceList::AddPPP(const char* name,
                            const void* iface) {
   DCHECK(name_to_plugin_info_.find(name) == name_to_plugin_info_.end());
-  name_to_plugin_info_.add(
-      name,
-      scoped_ptr<InterfaceInfo>(new InterfaceInfo(iface, PERMISSION_NONE)));
+  name_to_plugin_info_.add(name,
+                           std::unique_ptr<InterfaceInfo>(
+                               new InterfaceInfo(iface, PERMISSION_NONE)));
 }
 
 int InterfaceList::HashInterfaceName(const std::string& name) {
diff --git a/ppapi/proxy/interface_list.h b/ppapi/proxy/interface_list.h
index ac05aa5..85518d8ce 100644
--- a/ppapi/proxy/interface_list.h
+++ b/ppapi/proxy/interface_list.h
@@ -6,11 +6,11 @@
 #define PPAPI_PROXY_INTERFACE_LIST_H_
 
 #include <map>
+#include <memory>
 #include <string>
 
 #include "base/containers/scoped_ptr_hash_map.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/synchronization/lock.h"
 #include "ppapi/proxy/interface_proxy.h"
 #include "ppapi/proxy/ppapi_proxy_export.h"
@@ -81,7 +81,7 @@
   // Give friendship for HashInterfaceName.
   friend class InterfaceInfo;
 
-  typedef base::ScopedPtrHashMap<std::string, scoped_ptr<InterfaceInfo>>
+  typedef base::ScopedPtrHashMap<std::string, std::unique_ptr<InterfaceInfo>>
       NameToInterfaceInfoMap;
 
   void AddProxy(ApiID id, InterfaceProxy::Factory factory);
diff --git a/ppapi/proxy/media_stream_audio_track_resource.cc b/ppapi/proxy/media_stream_audio_track_resource.cc
index 5d30362..e2435e1 100644
--- a/ppapi/proxy/media_stream_audio_track_resource.cc
+++ b/ppapi/proxy/media_stream_audio_track_resource.cc
@@ -171,7 +171,7 @@
   scoped_refptr<AudioBufferResource> resource =
       new AudioBufferResource(pp_instance(), index, buffer);
   // Add |pp_resource()| and |resource| into |buffers_|.
-  // |buffers_| uses scoped_ptr<> to hold a ref of |resource|. It keeps the
+  // |buffers_| uses std::unique_ptr<> to hold a ref of |resource|. It keeps the
   // resource alive.
   buffers_.insert(BufferMap::value_type(resource->pp_resource(), resource));
   return resource->GetReference();
diff --git a/ppapi/proxy/media_stream_track_resource_base.cc b/ppapi/proxy/media_stream_track_resource_base.cc
index 16d5499..4e20325 100644
--- a/ppapi/proxy/media_stream_track_resource_base.cc
+++ b/ppapi/proxy/media_stream_track_resource_base.cc
@@ -73,9 +73,9 @@
   base::SharedMemoryHandle shm_handle = base::SharedMemory::NULLHandle();
   params.TakeSharedMemoryHandleAtIndex(0, &shm_handle);
   buffer_manager_.SetBuffers(number_of_buffers, buffer_size,
-      scoped_ptr<base::SharedMemory>(new base::SharedMemory(shm_handle,
-                                                            readonly)),
-      false);
+                             std::unique_ptr<base::SharedMemory>(
+                                 new base::SharedMemory(shm_handle, readonly)),
+                             false);
 }
 
 void MediaStreamTrackResourceBase::OnPluginMsgEnqueueBuffer(
diff --git a/ppapi/proxy/media_stream_video_track_resource.cc b/ppapi/proxy/media_stream_video_track_resource.cc
index 2942ff5..0f68000 100644
--- a/ppapi/proxy/media_stream_video_track_resource.cc
+++ b/ppapi/proxy/media_stream_video_track_resource.cc
@@ -191,7 +191,7 @@
   scoped_refptr<VideoFrameResource> resource =
       new VideoFrameResource(pp_instance(), index, buffer);
   // Add |pp_resource()| and |resource| into |frames_|.
-  // |frames_| uses scoped_ptr<> to hold a ref of |resource|. It keeps the
+  // |frames_| uses std::unique_ptr<> to hold a ref of |resource|. It keeps the
   // resource alive.
   frames_.insert(FrameMap::value_type(resource->pp_resource(), resource));
   return resource->GetReference();
diff --git a/ppapi/proxy/message_handler.cc b/ppapi/proxy/message_handler.cc
index b2f3929c..909123b 100644
--- a/ppapi/proxy/message_handler.cc
+++ b/ppapi/proxy/message_handler.cc
@@ -36,7 +36,7 @@
                                   PP_Instance instance,
                                   void* user_data,
                                   ScopedPPVar message_data,
-                                  scoped_ptr<IPC::Message> reply_msg) {
+                                  std::unique_ptr<IPC::Message> reply_msg) {
   PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
   if (!dispatcher)
     return;
@@ -57,13 +57,13 @@
 }  // namespace
 
 // static
-scoped_ptr<MessageHandler> MessageHandler::Create(
-      PP_Instance instance,
-      const PPP_MessageHandler_0_2* handler_if,
-      void* user_data,
-      PP_Resource message_loop,
-      int32_t* error) {
-  scoped_ptr<MessageHandler> result;
+std::unique_ptr<MessageHandler> MessageHandler::Create(
+    PP_Instance instance,
+    const PPP_MessageHandler_0_2* handler_if,
+    void* user_data,
+    PP_Resource message_loop,
+    int32_t* error) {
+  std::unique_ptr<MessageHandler> result;
   // The interface and all function pointers must be valid.
   if (!handler_if ||
       !handler_if->HandleMessage ||
@@ -113,8 +113,9 @@
                                            instance_, user_data_, var)));
 }
 
-void MessageHandler::HandleBlockingMessage(ScopedPPVar var,
-                                           scoped_ptr<IPC::Message> reply_msg) {
+void MessageHandler::HandleBlockingMessage(
+    ScopedPPVar var,
+    std::unique_ptr<IPC::Message> reply_msg) {
   message_loop_->task_runner()->PostTask(
       FROM_HERE,
       RunWhileLocked(base::Bind(
diff --git a/ppapi/proxy/message_handler.h b/ppapi/proxy/message_handler.h
index 6a83f21..363312e 100644
--- a/ppapi/proxy/message_handler.h
+++ b/ppapi/proxy/message_handler.h
@@ -7,9 +7,10 @@
 
 #include <stdint.h>
 
+#include <memory>
+
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "ppapi/c/pp_resource.h"
 #include "ppapi/c/ppp_message_handler.h"
 #include "ppapi/proxy/ppapi_proxy_export.h"
@@ -44,7 +45,7 @@
   //                thread. If it's the main thread loop, |error| will be set
   //                to PP_ERROR_WRONGTHREAD.
   // |error| is an out-param that will be set on failure.
-  static scoped_ptr<MessageHandler> Create(
+  static std::unique_ptr<MessageHandler> Create(
       PP_Instance instance,
       const PPP_MessageHandler_0_2* handler_if,
       void* user_data,
@@ -56,7 +57,7 @@
 
   void HandleMessage(ScopedPPVar var);
   void HandleBlockingMessage(ScopedPPVar var,
-                             scoped_ptr<IPC::Message> reply_msg);
+                             std::unique_ptr<IPC::Message> reply_msg);
 
  private:
   MessageHandler(PP_Instance instance,
diff --git a/ppapi/proxy/nacl_message_scanner.cc b/ppapi/proxy/nacl_message_scanner.cc
index bd29ae6..e31ee38 100644
--- a/ppapi/proxy/nacl_message_scanner.cc
+++ b/ppapi/proxy/nacl_message_scanner.cc
@@ -45,7 +45,7 @@
   // check for NULL before writing to it. In some cases, a ScanParam overload
   // may set this to NULL when it can determine that there are no parameters
   // that need conversion. (See the ResourceMessageReplyParams overload.)
-  scoped_ptr<IPC::Message> new_msg;
+  std::unique_ptr<IPC::Message> new_msg;
   // Resource id for resource messages. Save this when scanning resource replies
   // so when we audit the nested message, we know which resource it is for.
   PP_Resource pp_resource;
@@ -338,7 +338,7 @@
     const IPC::Message& msg,
     uint32_t type,
     std::vector<SerializedHandle>* handles,
-    scoped_ptr<IPC::Message>* new_msg_ptr) {
+    std::unique_ptr<IPC::Message>* new_msg_ptr) {
   DCHECK(handles);
   DCHECK(handles->empty());
   DCHECK(new_msg_ptr);
@@ -389,7 +389,7 @@
 
 void NaClMessageScanner::ScanUntrustedMessage(
     const IPC::Message& untrusted_msg,
-    scoped_ptr<IPC::Message>* new_msg_ptr) {
+    std::unique_ptr<IPC::Message>* new_msg_ptr) {
   // Audit FileIO and FileSystem messages to ensure that the plugin doesn't
   // exceed its file quota. If we find the message is malformed, just pass it
   // through - we only care about well formed messages to the host.
diff --git a/ppapi/proxy/nacl_message_scanner.h b/ppapi/proxy/nacl_message_scanner.h
index 8c5f766..9f9d73a 100644
--- a/ppapi/proxy/nacl_message_scanner.h
+++ b/ppapi/proxy/nacl_message_scanner.h
@@ -8,10 +8,10 @@
 #include <stdint.h>
 
 #include <map>
+#include <memory>
 #include <vector>
 
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/synchronization/lock.h"
 #include "ppapi/c/pp_resource.h"
 #include "ppapi/proxy/ppapi_proxy_export.h"
@@ -47,12 +47,12 @@
   bool ScanMessage(const IPC::Message& msg,
                    uint32_t type,
                    std::vector<SerializedHandle>* handles,
-                   scoped_ptr<IPC::Message>* new_msg_ptr);
+                   std::unique_ptr<IPC::Message>* new_msg_ptr);
 
   // Scans an untrusted message for items that require special handling. If the
   // message had to be rewritten, sets |new_msg_ptr| to the new message.
   void ScanUntrustedMessage(const IPC::Message& untrusted_msg,
-                            scoped_ptr<IPC::Message>* new_msg_ptr);
+                            std::unique_ptr<IPC::Message>* new_msg_ptr);
 
   // FileSystem information for quota auditing.
   class PPAPI_PROXY_EXPORT FileSystem {
diff --git a/ppapi/proxy/nacl_message_scanner_unittest.cc b/ppapi/proxy/nacl_message_scanner_unittest.cc
index 2ca5a289..d2c4103 100644
--- a/ppapi/proxy/nacl_message_scanner_unittest.cc
+++ b/ppapi/proxy/nacl_message_scanner_unittest.cc
@@ -46,7 +46,7 @@
                      PP_Resource file_system) {
     std::vector<SerializedHandle> unused_handles;
     ResourceMessageReplyParams fio_reply_params(file_io, 0);
-    scoped_ptr<IPC::Message> new_msg_ptr;
+    std::unique_ptr<IPC::Message> new_msg_ptr;
     scanner->ScanMessage(
         PpapiPluginMsg_ResourceReply(
             fio_reply_params,
@@ -65,7 +65,7 @@
   ResourceMessageCallParams fs_call_params(kFileSystem, 0);
   ResourceMessageReplyParams fio_reply_params(kFileIO, 0);
   ResourceMessageReplyParams fs_reply_params(kFileSystem, 0);
-  scoped_ptr<IPC::Message> new_msg_ptr;
+  std::unique_ptr<IPC::Message> new_msg_ptr;
 
   EXPECT_EQ(NULL, FindFileSystem(test, kFileSystem));
   EXPECT_EQ(NULL, FindFileIO(test, kFileIO));
@@ -143,7 +143,7 @@
   ResourceMessageCallParams fs_call_params(kFileSystem, 0);
   ResourceMessageReplyParams fio_reply_params(kFileIO, 0);
   ResourceMessageReplyParams fs_reply_params(kFileSystem, 0);
-  scoped_ptr<IPC::Message> new_msg_ptr;
+  std::unique_ptr<IPC::Message> new_msg_ptr;
 
   OpenQuotaFile(&test, kFileIO, kFileSystem);
   NaClMessageScanner::FileSystem* fs = FindFileSystem(test, kFileSystem);
@@ -215,7 +215,7 @@
   ResourceMessageCallParams fs_call_params(kFileSystem, 0);
   ResourceMessageReplyParams fio_reply_params(kFileIO, 0);
   ResourceMessageReplyParams fs_reply_params(kFileSystem, 0);
-  scoped_ptr<IPC::Message> new_msg_ptr;
+  std::unique_ptr<IPC::Message> new_msg_ptr;
 
   OpenQuotaFile(&test, kFileIO, kFileSystem);
   NaClMessageScanner::FileSystem* fs = FindFileSystem(test, kFileSystem);
diff --git a/ppapi/proxy/plugin_array_buffer_var.h b/ppapi/proxy/plugin_array_buffer_var.h
index 8f6fe198..57c8d5aa 100644
--- a/ppapi/proxy/plugin_array_buffer_var.h
+++ b/ppapi/proxy/plugin_array_buffer_var.h
@@ -5,10 +5,10 @@
 #ifndef PPAPI_PROXY_PLUGIN_ARRAY_BUFFER_VAR_H_
 #define PPAPI_PROXY_PLUGIN_ARRAY_BUFFER_VAR_H_
 
+#include <memory>
 #include <vector>
 
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/shared_memory.h"
 #include "ppapi/c/pp_instance.h"
 #include "ppapi/c/pp_stdint.h"
@@ -40,7 +40,7 @@
 
   // Shared memory
   base::SharedMemoryHandle plugin_handle_;
-  scoped_ptr<base::SharedMemory> shmem_;
+  std::unique_ptr<base::SharedMemory> shmem_;
   uint32_t size_in_bytes_;
 
   DISALLOW_COPY_AND_ASSIGN(PluginArrayBufferVar);
diff --git a/ppapi/proxy/plugin_dispatcher.cc b/ppapi/proxy/plugin_dispatcher.cc
index a645d47..f4621b3 100644
--- a/ppapi/proxy/plugin_dispatcher.cc
+++ b/ppapi/proxy/plugin_dispatcher.cc
@@ -266,7 +266,8 @@
   if (!g_instance_to_dispatcher)
     g_instance_to_dispatcher = new InstanceToDispatcherMap;
   (*g_instance_to_dispatcher)[instance] = this;
-  instance_map_.set(instance, scoped_ptr<InstanceData>(new InstanceData()));
+  instance_map_.set(instance,
+                    std::unique_ptr<InstanceData>(new InstanceData()));
 }
 
 void PluginDispatcher::DidDestroyInstance(PP_Instance instance) {
diff --git a/ppapi/proxy/plugin_dispatcher.h b/ppapi/proxy/plugin_dispatcher.h
index 5dc2273..b37fa9e 100644
--- a/ppapi/proxy/plugin_dispatcher.h
+++ b/ppapi/proxy/plugin_dispatcher.h
@@ -68,7 +68,7 @@
 
   // The message handler which should handle JavaScript->Plugin messages, if
   // one has been registered, otherwise NULL.
-  scoped_ptr<MessageHandler> message_handler;
+  std::unique_ptr<MessageHandler> message_handler;
 
   // Flush info for PpapiCommandBufferProxy::OrderingBarrier().
   struct FlushInfo {
@@ -208,7 +208,7 @@
   typedef base::hash_map<std::string, const void*> InterfaceMap;
   InterfaceMap plugin_interfaces_;
 
-  typedef base::ScopedPtrHashMap<PP_Instance, scoped_ptr<InstanceData>>
+  typedef base::ScopedPtrHashMap<PP_Instance, std::unique_ptr<InstanceData>>
       InstanceDataMap;
   InstanceDataMap instance_map_;
 
diff --git a/ppapi/proxy/plugin_dispatcher_unittest.cc b/ppapi/proxy/plugin_dispatcher_unittest.cc
index 821ecad..2e3f058 100644
--- a/ppapi/proxy/plugin_dispatcher_unittest.cc
+++ b/ppapi/proxy/plugin_dispatcher_unittest.cc
@@ -2,7 +2,6 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "base/memory/scoped_ptr.h"
 #include "ipc/ipc_message_utils.h"
 #include "ppapi/c/ppb_audio.h"
 #include "ppapi/c/ppp_instance.h"
diff --git a/ppapi/proxy/plugin_globals.h b/ppapi/proxy/plugin_globals.h
index 5075f81f..2821ce7 100644
--- a/ppapi/proxy/plugin_globals.h
+++ b/ppapi/proxy/plugin_globals.h
@@ -5,12 +5,12 @@
 #ifndef PPAPI_PROXY_PLUGIN_GLOBALS_H_
 #define PPAPI_PROXY_PLUGIN_GLOBALS_H_
 
+#include <memory>
 #include <string>
 
 #include "base/compiler_specific.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/threading/thread_local_storage.h"
 #include "ppapi/proxy/connection.h"
 #include "ppapi/proxy/plugin_resource_tracker.h"
@@ -170,7 +170,7 @@
   PluginVarTracker plugin_var_tracker_;
   scoped_refptr<CallbackTracker> callback_tracker_;
 
-  scoped_ptr<base::ThreadLocalStorage::Slot> msg_loop_slot_;
+  std::unique_ptr<base::ThreadLocalStorage::Slot> msg_loop_slot_;
   // Note that loop_for_main_thread's constructor sets msg_loop_slot_, so it
   // must be initialized after msg_loop_slot_ (hence the order here).
   scoped_refptr<MessageLoopResource> loop_for_main_thread_;
@@ -183,13 +183,13 @@
   // called.
   std::string command_line_;
 
-  scoped_ptr<BrowserSender> browser_sender_;
+  std::unique_ptr<BrowserSender> browser_sender_;
 
   scoped_refptr<base::TaskRunner> ipc_task_runner_;
 
   // Thread for performing potentially blocking file operations. It's created
   // lazily, since it might not be needed.
-  scoped_ptr<base::Thread> file_thread_;
+  std::unique_ptr<base::Thread> file_thread_;
 
   scoped_refptr<ResourceReplyThreadRegistrar> resource_reply_thread_registrar_;
 
diff --git a/ppapi/proxy/plugin_resource_tracker_unittest.cc b/ppapi/proxy/plugin_resource_tracker_unittest.cc
index 8623f64..1969f4e 100644
--- a/ppapi/proxy/plugin_resource_tracker_unittest.cc
+++ b/ppapi/proxy/plugin_resource_tracker_unittest.cc
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "base/memory/scoped_ptr.h"
+#include "ppapi/proxy/plugin_resource_tracker.h"
+
 #include "base/process/process.h"
 #include "ppapi/proxy/mock_resource.h"
 #include "ppapi/proxy/plugin_dispatcher.h"
-#include "ppapi/proxy/plugin_resource_tracker.h"
 #include "ppapi/proxy/ppapi_messages.h"
 #include "ppapi/proxy/ppapi_proxy_test.h"
 #include "ppapi/shared_impl/proxy_lock.h"
diff --git a/ppapi/proxy/ppapi_command_buffer_proxy.cc b/ppapi/proxy/ppapi_command_buffer_proxy.cc
index 58ad59a3..c96b44af 100644
--- a/ppapi/proxy/ppapi_command_buffer_proxy.cc
+++ b/ppapi/proxy/ppapi_command_buffer_proxy.cc
@@ -150,7 +150,7 @@
     return NULL;
   }
 
-  scoped_ptr<base::SharedMemory> shared_memory(
+  std::unique_ptr<base::SharedMemory> shared_memory(
       new base::SharedMemory(handle.shmem(), false));
 
   // Map the shared memory on demand.
diff --git a/ppapi/proxy/ppapi_command_buffer_proxy.h b/ppapi/proxy/ppapi_command_buffer_proxy.h
index e0629bf..cbc73ff 100644
--- a/ppapi/proxy/ppapi_command_buffer_proxy.h
+++ b/ppapi/proxy/ppapi_command_buffer_proxy.h
@@ -8,10 +8,11 @@
 #include <stddef.h>
 #include <stdint.h>
 
+#include <memory>
+
 #include "base/callback.h"
 #include "base/containers/hash_tables.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "gpu/command_buffer/client/gpu_control.h"
 #include "gpu/command_buffer/common/command_buffer.h"
 #include "gpu/command_buffer/common/command_buffer_id.h"
@@ -94,7 +95,7 @@
 
   gpu::Capabilities capabilities_;
   State last_state_;
-  scoped_ptr<base::SharedMemory> shared_state_shm_;
+  std::unique_ptr<base::SharedMemory> shared_state_shm_;
 
   HostResource resource_;
   PluginDispatcher* dispatcher_;
diff --git a/ppapi/proxy/ppapi_proxy_test.cc b/ppapi/proxy/ppapi_proxy_test.cc
index 5ff1a4e..88bf5db 100644
--- a/ppapi/proxy/ppapi_proxy_test.cc
+++ b/ppapi/proxy/ppapi_proxy_test.cc
@@ -253,9 +253,8 @@
     base::PlatformFile handle,
     base::ProcessId /* remote_pid */,
     bool should_close_source) {
-  return IPC::GetFileHandleForProcess(handle,
-                                      base::GetCurrentProcessHandle(),
-                                      should_close_source);
+  return IPC::GetPlatformFileForTransit(handle,
+                                        should_close_source);
 }
 
 base::SharedMemoryHandle
@@ -491,9 +490,8 @@
     base::PlatformFile handle,
     base::ProcessId /* remote_pid */,
     bool should_close_source) {
-  return IPC::GetFileHandleForProcess(handle,
-                                      base::GetCurrentProcessHandle(),
-                                      should_close_source);
+  return IPC::GetPlatformFileForTransit(handle,
+                                        should_close_source);
 }
 
 base::SharedMemoryHandle
diff --git a/ppapi/proxy/ppapi_proxy_test.h b/ppapi/proxy/ppapi_proxy_test.h
index ec99071..670753e 100644
--- a/ppapi/proxy/ppapi_proxy_test.h
+++ b/ppapi/proxy/ppapi_proxy_test.h
@@ -5,12 +5,12 @@
 #include <stdint.h>
 
 #include <map>
+#include <memory>
 #include <string>
 
 #include "base/compiler_specific.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/synchronization/waitable_event.h"
 #include "base/task_runner.h"
 #include "base/threading/simple_thread.h"
@@ -177,9 +177,9 @@
       const scoped_refptr<base::TaskRunner>& ipc_task_runner);
 
   GlobalsConfiguration globals_config_;
-  scoped_ptr<PluginGlobals> plugin_globals_;
+  std::unique_ptr<PluginGlobals> plugin_globals_;
 
-  scoped_ptr<PluginDispatcher> plugin_dispatcher_;
+  std::unique_ptr<PluginDispatcher> plugin_dispatcher_;
   PluginDelegateMock plugin_delegate_mock_;
 };
 
@@ -240,8 +240,8 @@
   static void InternalSetUpTestOnSecondaryThread(void* user_data,
                                                  int32_t result);
 
-  scoped_ptr<base::DelegateSimpleThread> secondary_thread_;
-  scoped_ptr<base::RunLoop> nested_main_thread_message_loop_;
+  std::unique_ptr<base::DelegateSimpleThread> secondary_thread_;
+  std::unique_ptr<base::RunLoop> nested_main_thread_message_loop_;
 };
 
 class HostProxyTestHarness : public ProxyTestHarnessBase {
@@ -301,11 +301,11 @@
   void CreateHostGlobals();
 
   GlobalsConfiguration globals_config_;
-  scoped_ptr<ppapi::TestGlobals> host_globals_;
-  scoped_ptr<HostDispatcher> host_dispatcher_;
+  std::unique_ptr<ppapi::TestGlobals> host_globals_;
+  std::unique_ptr<HostDispatcher> host_dispatcher_;
   // The host side of the real proxy doesn't lock, so this disables locking for
   // the thread the host side of the test runs on.
-  scoped_ptr<ProxyLock::LockingDisablerForTest> disable_locking_;
+  std::unique_ptr<ProxyLock::LockingDisablerForTest> disable_locking_;
   DelegateMock delegate_mock_;
 };
 
diff --git a/ppapi/proxy/ppb_flash_message_loop_proxy.cc b/ppapi/proxy/ppb_flash_message_loop_proxy.cc
index 24d990e..8b76946d 100644
--- a/ppapi/proxy/ppb_flash_message_loop_proxy.cc
+++ b/ppapi/proxy/ppb_flash_message_loop_proxy.cc
@@ -135,7 +135,7 @@
 
   PPB_Flash_MessageLoop_API::RunFromHostProxyCallback callback =
       base::Bind(&PPB_Flash_MessageLoop_Proxy::WillQuitSoon, AsWeakPtr(),
-                 base::Passed(scoped_ptr<IPC::Message>(reply)));
+                 base::Passed(std::unique_ptr<IPC::Message>(reply)));
 
   EnterHostFromHostResource<PPB_Flash_MessageLoop_API>
       enter(flash_message_loop);
@@ -154,7 +154,7 @@
 }
 
 void PPB_Flash_MessageLoop_Proxy::WillQuitSoon(
-    scoped_ptr<IPC::Message> reply_message,
+    std::unique_ptr<IPC::Message> reply_message,
     int32_t result) {
   PpapiHostMsg_PPBFlashMessageLoop_Run::WriteReplyParams(reply_message.get(),
                                                          result);
diff --git a/ppapi/proxy/ppb_flash_message_loop_proxy.h b/ppapi/proxy/ppb_flash_message_loop_proxy.h
index 9f0a3f9..00847318 100644
--- a/ppapi/proxy/ppb_flash_message_loop_proxy.h
+++ b/ppapi/proxy/ppb_flash_message_loop_proxy.h
@@ -7,9 +7,10 @@
 
 #include <stdint.h>
 
+#include <memory>
+
 #include "base/compiler_specific.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "ppapi/c/pp_instance.h"
 #include "ppapi/c/pp_resource.h"
@@ -45,7 +46,8 @@
                 IPC::Message* reply);
   void OnMsgQuit(const ppapi::HostResource& flash_message_loop);
 
-  void WillQuitSoon(scoped_ptr<IPC::Message> reply_message, int32_t result);
+  void WillQuitSoon(std::unique_ptr<IPC::Message> reply_message,
+                    int32_t result);
 
   DISALLOW_COPY_AND_ASSIGN(PPB_Flash_MessageLoop_Proxy);
 };
diff --git a/ppapi/proxy/ppb_graphics_3d_proxy.h b/ppapi/proxy/ppb_graphics_3d_proxy.h
index e2b4dda..fab0122 100644
--- a/ppapi/proxy/ppb_graphics_3d_proxy.h
+++ b/ppapi/proxy/ppb_graphics_3d_proxy.h
@@ -62,7 +62,7 @@
   gpu::GpuControl* GetGpuControl() override;
   int32_t DoSwapBuffers(const gpu::SyncToken& sync_token) override;
 
-  scoped_ptr<PpapiCommandBufferProxy> command_buffer_;
+  std::unique_ptr<PpapiCommandBufferProxy> command_buffer_;
 
   DISALLOW_COPY_AND_ASSIGN(Graphics3D);
 };
diff --git a/ppapi/proxy/ppb_image_data_proxy.h b/ppapi/proxy/ppb_image_data_proxy.h
index 46fb9af..0e2edb4 100644
--- a/ppapi/proxy/ppb_image_data_proxy.h
+++ b/ppapi/proxy/ppb_image_data_proxy.h
@@ -7,8 +7,9 @@
 
 #include <stdint.h>
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/shared_memory.h"
 #include "build/build_config.h"
 #include "ipc/ipc_platform_file.h"
@@ -100,7 +101,7 @@
   static ImageHandle NullHandle();
 
  private:
-  scoped_ptr<TransportDIB> transport_dib_;
+  std::unique_ptr<TransportDIB> transport_dib_;
 
   // Null when the image isn't mapped.
   skia::RefPtr<SkCanvas> mapped_canvas_;
diff --git a/ppapi/proxy/ppb_instance_proxy.cc b/ppapi/proxy/ppb_instance_proxy.cc
index 63372cb..ec875ea21 100644
--- a/ppapi/proxy/ppb_instance_proxy.cc
+++ b/ppapi/proxy/ppb_instance_proxy.cc
@@ -787,7 +787,7 @@
     return PP_ERROR_BADARGUMENT;
 
   int32_t result = PP_ERROR_FAILED;
-  scoped_ptr<MessageHandler> message_handler = MessageHandler::Create(
+  std::unique_ptr<MessageHandler> message_handler = MessageHandler::Create(
       instance, handler, user_data, message_loop, &result);
   if (message_handler)
     data->message_handler = std::move(message_handler);
diff --git a/ppapi/proxy/ppb_message_loop_proxy.h b/ppapi/proxy/ppb_message_loop_proxy.h
index e8213a9..16139594 100644
--- a/ppapi/proxy/ppb_message_loop_proxy.h
+++ b/ppapi/proxy/ppb_message_loop_proxy.h
@@ -7,10 +7,11 @@
 
 #include <stdint.h>
 
+#include <memory>
+
 #include "base/bind.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/message_loop/message_loop.h"
 #include "base/single_thread_task_runner.h"
 #include "ppapi/proxy/interface_proxy.h"
@@ -84,7 +85,7 @@
   // that it's created on the thread it will run on. NULL for the main thread
   // loop, since that's owned by somebody else. This is needed for Run and Quit.
   // Any time we post tasks, we should post them using task_runner_.
-  scoped_ptr<base::MessageLoop> loop_;
+  std::unique_ptr<base::MessageLoop> loop_;
   scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
 
   // Number of invocations of Run currently on the stack.
diff --git a/ppapi/proxy/ppp_instance_proxy.h b/ppapi/proxy/ppp_instance_proxy.h
index 85ae55c..235617f 100644
--- a/ppapi/proxy/ppp_instance_proxy.h
+++ b/ppapi/proxy/ppp_instance_proxy.h
@@ -5,10 +5,10 @@
 #ifndef PPAPI_PROXY_PPP_INSTANCE_PROXY_H_
 #define PPAPI_PROXY_PPP_INSTANCE_PROXY_H_
 
+#include <memory>
 #include <string>
 #include <vector>
 
-#include "base/memory/scoped_ptr.h"
 #include "ppapi/c/pp_instance.h"
 #include "ppapi/c/pp_resource.h"
 #include "ppapi/c/pp_var.h"
@@ -54,7 +54,7 @@
                                      int pending_loader_host_id,
                                      const URLResponseInfoData& data);
 
-  scoped_ptr<PPP_Instance_Combined> combined_interface_;
+  std::unique_ptr<PPP_Instance_Combined> combined_interface_;
 };
 
 }  // namespace proxy
diff --git a/ppapi/proxy/ppp_messaging_proxy.cc b/ppapi/proxy/ppp_messaging_proxy.cc
index 75614ae..e1b1f4d 100644
--- a/ppapi/proxy/ppp_messaging_proxy.cc
+++ b/ppapi/proxy/ppp_messaging_proxy.cc
@@ -6,6 +6,7 @@
 
 #include <algorithm>
 
+#include "base/memory/ptr_util.h"
 #include "ppapi/c/ppp_messaging.h"
 #include "ppapi/proxy/host_dispatcher.h"
 #include "ppapi/proxy/message_handler.h"
@@ -119,8 +120,8 @@
   MessageHandler* message_handler = GetMessageHandler(dispatcher(), instance);
   if (message_handler) {
     if (message_handler->LoopIsValid()) {
-      message_handler->HandleBlockingMessage(
-          received_var, scoped_ptr<IPC::Message>(reply_msg));
+      message_handler->HandleBlockingMessage(received_var,
+                                             base::WrapUnique(reply_msg));
       return;
     } else {
       // If the MessageHandler's loop has been quit, then we should treat it as
diff --git a/ppapi/proxy/proxy_channel.h b/ppapi/proxy/proxy_channel.h
index 0e657f73..9d981da9 100644
--- a/ppapi/proxy/proxy_channel.h
+++ b/ppapi/proxy/proxy_channel.h
@@ -5,9 +5,10 @@
 #ifndef PPAPI_PROXY_PROXY_CHANNEL_H_
 #define PPAPI_PROXY_PROXY_CHANNEL_H_
 
+#include <memory>
+
 #include "base/files/scoped_file.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/shared_memory.h"
 #include "base/process/process.h"
 #include "build/build_config.h"
@@ -136,7 +137,7 @@
 
   // Will be null for some tests when there is a test_sink_, and if the
   // remote side has crashed.
-  scoped_ptr<IPC::SyncChannel> channel_;
+  std::unique_ptr<IPC::SyncChannel> channel_;
 
   DISALLOW_COPY_AND_ASSIGN(ProxyChannel);
 };
diff --git a/ppapi/proxy/raw_var_data.cc b/ppapi/proxy/raw_var_data.cc
index f4bcf96..9dbd75b 100644
--- a/ppapi/proxy/raw_var_data.cc
+++ b/ppapi/proxy/raw_var_data.cc
@@ -7,6 +7,7 @@
 #include <stack>
 
 #include "base/containers/hash_tables.h"
+#include "base/memory/ptr_util.h"
 #include "base/stl_util.h"
 #include "ipc/ipc_message.h"
 #include "ppapi/proxy/ppapi_param_traits.h"
@@ -44,18 +45,18 @@
 // |visited_map| keeps track of RawVarDatas that have already been created.
 size_t GetOrCreateRawVarData(const PP_Var& var,
                              base::hash_map<int64_t, size_t>* visited_map,
-                             std::vector<scoped_ptr<RawVarData>>* data) {
+                             std::vector<std::unique_ptr<RawVarData>>* data) {
   if (VarTracker::IsVarTypeRefcounted(var.type)) {
     base::hash_map<int64_t, size_t>::iterator it = visited_map->find(
         var.value.as_id);
     if (it != visited_map->end()) {
       return it->second;
     } else {
-      data->push_back(make_scoped_ptr(RawVarData::Create(var.type)));
+      data->push_back(base::WrapUnique(RawVarData::Create(var.type)));
       (*visited_map)[var.value.as_id] = data->size() - 1;
     }
   } else {
-    data->push_back(make_scoped_ptr(RawVarData::Create(var.type)));
+    data->push_back(base::WrapUnique(RawVarData::Create(var.type)));
   }
   return data->size() - 1;
 }
@@ -83,9 +84,9 @@
 // node at the top of the stack has already been visited, then we pop it off the
 // stack and erase it from |parent_ids|.
 // static
-scoped_ptr<RawVarDataGraph> RawVarDataGraph::Create(const PP_Var& var,
-                                                    PP_Instance instance) {
-  scoped_ptr<RawVarDataGraph> graph(new RawVarDataGraph);
+std::unique_ptr<RawVarDataGraph> RawVarDataGraph::Create(const PP_Var& var,
+                                                         PP_Instance instance) {
+  std::unique_ptr<RawVarDataGraph> graph(new RawVarDataGraph);
   // Map of |var.value.as_id| to a RawVarData index in RawVarDataGraph.
   base::hash_map<int64_t, size_t> visited_map;
   base::hash_set<int64_t> parent_ids;
@@ -109,7 +110,7 @@
       parent_ids.insert(current_var.value.as_id);
     if (!current_var_data->Init(current_var, instance)) {
       NOTREACHED();
-      return scoped_ptr<RawVarDataGraph>();
+      return nullptr;
     }
 
     // Add child nodes to the stack.
@@ -117,7 +118,7 @@
       ArrayVar* array_var = ArrayVar::FromPPVar(current_var);
       if (!array_var) {
         NOTREACHED();
-        return scoped_ptr<RawVarDataGraph>();
+        return nullptr;
       }
       for (ArrayVar::ElementVector::const_iterator iter =
                array_var->elements().begin();
@@ -127,7 +128,7 @@
         // If a child of this node is already in parent_ids, we have a cycle so
         // we just return null.
         if (CanHaveChildren(child) && parent_ids.count(child.value.as_id) != 0)
-          return scoped_ptr<RawVarDataGraph>();
+          return nullptr;
         size_t child_id = GetOrCreateRawVarData(child, &visited_map,
                                                 &graph->data_);
         static_cast<ArrayRawVarData*>(current_var_data)->AddChild(child_id);
@@ -138,7 +139,7 @@
       DictionaryVar* dict_var = DictionaryVar::FromPPVar(current_var);
       if (!dict_var) {
         NOTREACHED();
-        return scoped_ptr<RawVarDataGraph>();
+        return nullptr;
       }
       for (DictionaryVar::KeyValueMap::const_iterator iter =
                dict_var->key_value_map().begin();
@@ -146,7 +147,7 @@
            ++iter) {
         const PP_Var& child = iter->second.get();
         if (CanHaveChildren(child) && parent_ids.count(child.value.as_id) != 0)
-          return scoped_ptr<RawVarDataGraph>();
+          return nullptr;
         size_t child_id = GetOrCreateRawVarData(child, &visited_map,
                                                 &graph->data_);
         static_cast<DictionaryRawVarData*>(
@@ -184,20 +185,21 @@
 }
 
 // static
-scoped_ptr<RawVarDataGraph> RawVarDataGraph::Read(const base::Pickle* m,
-                                                  base::PickleIterator* iter) {
-  scoped_ptr<RawVarDataGraph> result(new RawVarDataGraph);
+std::unique_ptr<RawVarDataGraph> RawVarDataGraph::Read(
+    const base::Pickle* m,
+    base::PickleIterator* iter) {
+  std::unique_ptr<RawVarDataGraph> result(new RawVarDataGraph);
   uint32_t size = 0;
   if (!iter->ReadUInt32(&size))
-    return scoped_ptr<RawVarDataGraph>();
+    return nullptr;
   for (uint32_t i = 0; i < size; ++i) {
     int32_t type;
     if (!iter->ReadInt(&type))
-      return scoped_ptr<RawVarDataGraph>();
+      return nullptr;
     PP_VarType var_type = static_cast<PP_VarType>(type);
-    result->data_.push_back(make_scoped_ptr(RawVarData::Create(var_type)));
+    result->data_.push_back(base::WrapUnique(RawVarData::Create(var_type)));
     if (!result->data_.back()->Read(var_type, m, iter))
-      return scoped_ptr<RawVarDataGraph>();
+      return nullptr;
   }
   return result;
 }
diff --git a/ppapi/proxy/raw_var_data.h b/ppapi/proxy/raw_var_data.h
index fec92e7..530023f 100644
--- a/ppapi/proxy/raw_var_data.h
+++ b/ppapi/proxy/raw_var_data.h
@@ -8,11 +8,11 @@
 #include <stddef.h>
 #include <stdint.h>
 
+#include <memory>
 #include <vector>
 
 #include "base/callback.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "ppapi/c/pp_instance.h"
 #include "ppapi/c/pp_var.h"
 #include "ppapi/proxy/ppapi_param_traits.h"
@@ -56,8 +56,8 @@
  public:
   // Construct a RawVarDataGraph from a given root PP_Var. A null pointer
   // is returned upon failure.
-  static scoped_ptr<RawVarDataGraph> Create(const PP_Var& var,
-                                            PP_Instance instance);
+  static std::unique_ptr<RawVarDataGraph> Create(const PP_Var& var,
+                                                 PP_Instance instance);
 
   // Constructs an empty RawVarDataGraph.
   RawVarDataGraph();
@@ -73,8 +73,8 @@
   void Write(base::Pickle* m, const HandleWriter& handle_writer);
 
   // Create a RawVarDataGraph from the given message.
-  static scoped_ptr<RawVarDataGraph> Read(const base::Pickle* m,
-                                          base::PickleIterator* iter);
+  static std::unique_ptr<RawVarDataGraph> Read(const base::Pickle* m,
+                                               base::PickleIterator* iter);
 
   // Returns a vector of SerializedHandles associated with this RawVarDataGraph.
   // Ownership of the pointers remains with the elements of the RawVarDataGraph.
@@ -88,7 +88,7 @@
 
  private:
   // A list of the nodes in the graph.
-  std::vector<scoped_ptr<RawVarData>> data_;
+  std::vector<std::unique_ptr<RawVarData>> data_;
 
   DISALLOW_COPY_AND_ASSIGN(RawVarDataGraph);
 };
@@ -295,7 +295,7 @@
   // resource. The message type will vary based on the resource type, and will
   // usually contain a pending resource host ID, and other required information.
   // If the resource was created directly, this is NULL.
-  scoped_ptr<IPC::Message> creation_message_;
+  std::unique_ptr<IPC::Message> creation_message_;
 };
 
 }  // namespace proxy
diff --git a/ppapi/proxy/raw_var_data_unittest.cc b/ppapi/proxy/raw_var_data_unittest.cc
index 5985a5d..4cf419a 100644
--- a/ppapi/proxy/raw_var_data_unittest.cc
+++ b/ppapi/proxy/raw_var_data_unittest.cc
@@ -7,9 +7,10 @@
 #include <stddef.h>
 #include <stdint.h>
 
+#include <memory>
+
 #include "base/logging.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/message_loop/message_loop.h"
 #include "base/values.h"
 #include "ppapi/c/pp_bool.h"
@@ -56,14 +57,15 @@
 
 bool WriteAndRead(const PP_Var& var, PP_Var* result) {
   PP_Instance dummy_instance = 1234;
-  scoped_ptr<RawVarDataGraph> expected_data(RawVarDataGraph::Create(
-      var, dummy_instance));
+  std::unique_ptr<RawVarDataGraph> expected_data(
+      RawVarDataGraph::Create(var, dummy_instance));
   if (!expected_data)
     return false;
   IPC::Message m;
   expected_data->Write(&m, base::Bind(&DefaultHandleWriter));
   base::PickleIterator iter(m);
-  scoped_ptr<RawVarDataGraph> actual_data(RawVarDataGraph::Read(&m, &iter));
+  std::unique_ptr<RawVarDataGraph> actual_data(
+      RawVarDataGraph::Read(&m, &iter));
   *result = actual_data->CreatePPVar(dummy_instance);
   return true;
 }
diff --git a/ppapi/proxy/resource_message_test_sink.cc b/ppapi/proxy/resource_message_test_sink.cc
index 864f72c..71bff59 100644
--- a/ppapi/proxy/resource_message_test_sink.cc
+++ b/ppapi/proxy/resource_message_test_sink.cc
@@ -48,7 +48,7 @@
 
 bool ResourceMessageTestSink::Send(IPC::Message* msg) {
   int message_id = 0;
-  scoped_ptr<IPC::MessageReplyDeserializer> reply_deserializer;
+  std::unique_ptr<IPC::MessageReplyDeserializer> reply_deserializer;
   if (msg->is_sync()) {
     reply_deserializer.reset(
         static_cast<IPC::SyncMessage*>(msg)->GetReplyDeserializer());
diff --git a/ppapi/proxy/resource_message_test_sink.h b/ppapi/proxy/resource_message_test_sink.h
index b6ada44c..a243060 100644
--- a/ppapi/proxy/resource_message_test_sink.h
+++ b/ppapi/proxy/resource_message_test_sink.h
@@ -55,7 +55,7 @@
   ResourceReplyVector GetAllResourceRepliesMatching(uint32_t id);
 
  private:
-  scoped_ptr<IPC::Message> sync_reply_msg_;
+  std::unique_ptr<IPC::Message> sync_reply_msg_;
 };
 
 // This is a message handler which generates reply messages for synchronous
diff --git a/ppapi/proxy/serialized_var.cc b/ppapi/proxy/serialized_var.cc
index bbdba09..abf9fbf 100644
--- a/ppapi/proxy/serialized_var.cc
+++ b/ppapi/proxy/serialized_var.cc
@@ -114,7 +114,8 @@
   DCHECK(!has_been_serialized_);
   has_been_serialized_ = true;
 #endif
-  scoped_ptr<RawVarDataGraph> data = RawVarDataGraph::Create(var_, instance_);
+  std::unique_ptr<RawVarDataGraph> data =
+      RawVarDataGraph::Create(var_, instance_);
   if (data) {
     m->WriteBool(true);  // Success.
     data->Write(m, base::Bind(&DefaultHandleWriter));
diff --git a/ppapi/proxy/serialized_var.h b/ppapi/proxy/serialized_var.h
index 85c0018..b7c3714 100644
--- a/ppapi/proxy/serialized_var.h
+++ b/ppapi/proxy/serialized_var.h
@@ -8,12 +8,12 @@
 #include <stddef.h>
 #include <stdint.h>
 
+#include <memory>
 #include <string>
 #include <vector>
 
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "ppapi/c/pp_instance.h"
 #include "ppapi/c/pp_var.h"
 #include "ppapi/proxy/ppapi_proxy_export.h"
@@ -198,7 +198,7 @@
     // which means we cannot create some types of PP_Var
     // (e.g. PP_VARTYPE_STRING). The data is stored in |raw_var_data_| and the
     // PP_Var is constructed when |GetVar()| is called.
-    scoped_ptr<RawVarDataGraph> raw_var_data_;
+    std::unique_ptr<RawVarDataGraph> raw_var_data_;
 
     DISALLOW_COPY_AND_ASSIGN(Inner);
   };
diff --git a/ppapi/proxy/udp_socket_filter.cc b/ppapi/proxy/udp_socket_filter.cc
index e41d758..c40316e 100644
--- a/ppapi/proxy/udp_socket_filter.cc
+++ b/ppapi/proxy/udp_socket_filter.cc
@@ -27,7 +27,7 @@
 namespace {
 
 int32_t SetRecvFromOutput(PP_Instance pp_instance,
-                          const scoped_ptr<std::string>& data,
+                          const std::unique_ptr<std::string>& data,
                           const PP_NetAddress_Private& addr,
                           char* output_buffer,
                           int32_t num_bytes,
@@ -69,7 +69,7 @@
   ProxyLock::AssertAcquired();
   base::AutoLock acquire(lock_);
   DCHECK(!queues_.contains(resource));
-  queues_.add(resource, scoped_ptr<RecvQueue>(new RecvQueue(
+  queues_.add(resource, std::unique_ptr<RecvQueue>(new RecvQueue(
                             instance, private_api, slot_available_callback)));
 }
 
@@ -182,7 +182,7 @@
     //    (Since the callback will complete on another thread, it's possible
     //     that the resource will be deleted and abort the callback before it
     //     is actually run.)
-    scoped_ptr<std::string> data_to_pass(new std::string(data));
+    std::unique_ptr<std::string> data_to_pass(new std::string(data));
     recvfrom_callback_->set_completion_task(base::Bind(
         &SetRecvFromOutput, pp_instance_, base::Passed(std::move(data_to_pass)),
         addr, base::Unretained(read_buffer_), bytes_to_read_,
@@ -225,7 +225,7 @@
       return PP_ERROR_MESSAGE_TOO_BIG;
 
     int32_t result = static_cast<int32_t>(front.data.size());
-    scoped_ptr<std::string> data_to_pass(new std::string);
+    std::unique_ptr<std::string> data_to_pass(new std::string);
     data_to_pass->swap(front.data);
     SetRecvFromOutput(pp_instance_, std::move(data_to_pass), front.addr,
                       buffer_out, num_bytes, addr_out, PP_OK);
diff --git a/ppapi/proxy/udp_socket_filter.h b/ppapi/proxy/udp_socket_filter.h
index 4aa3e5c..e10ca3a 100644
--- a/ppapi/proxy/udp_socket_filter.h
+++ b/ppapi/proxy/udp_socket_filter.h
@@ -8,6 +8,7 @@
 #include <stddef.h>
 #include <stdint.h>
 
+#include <memory>
 #include <queue>
 #include <string>
 
@@ -130,7 +131,7 @@
   // 1 ppapi::ProxyLock
   // \-->2 Filter lock_
   mutable base::Lock lock_;
-  base::ScopedPtrHashMap<PP_Resource, scoped_ptr<RecvQueue>> queues_;
+  base::ScopedPtrHashMap<PP_Resource, std::unique_ptr<RecvQueue>> queues_;
 };
 
 }  // namespace proxy
diff --git a/ppapi/proxy/video_capture_resource.cc b/ppapi/proxy/video_capture_resource.cc
index 5189509..0091e160 100644
--- a/ppapi/proxy/video_capture_resource.cc
+++ b/ppapi/proxy/video_capture_resource.cc
@@ -154,7 +154,7 @@
 
   PluginResourceTracker* tracker =
       PluginGlobals::Get()->plugin_resource_tracker();
-  scoped_ptr<PP_Resource[]> resources(new PP_Resource[buffers.size()]);
+  std::unique_ptr<PP_Resource[]> resources(new PP_Resource[buffers.size()]);
   for (size_t i = 0; i < buffers.size(); ++i) {
     // We assume that the browser created a new set of resources.
     DCHECK(!tracker->PluginResourceForHostResource(buffers[i]));
diff --git a/ppapi/proxy/video_decoder_resource.cc b/ppapi/proxy/video_decoder_resource.cc
index 1519d1a..cb55764 100644
--- a/ppapi/proxy/video_decoder_resource.cc
+++ b/ppapi/proxy/video_decoder_resource.cc
@@ -32,7 +32,7 @@
 namespace proxy {
 
 VideoDecoderResource::ShmBuffer::ShmBuffer(
-    scoped_ptr<base::SharedMemory> shm_ptr,
+    std::unique_ptr<base::SharedMemory> shm_ptr,
     uint32_t size,
     uint32_t shm_id)
     : shm(std::move(shm_ptr)), addr(NULL), shm_id(shm_id) {
@@ -230,9 +230,9 @@
     base::SharedMemoryHandle shm_handle = base::SharedMemory::NULLHandle();
     if (!reply_params.TakeSharedMemoryHandleAtIndex(0, &shm_handle))
       return PP_ERROR_NOMEMORY;
-    scoped_ptr<base::SharedMemory> shm(
+    std::unique_ptr<base::SharedMemory> shm(
         new base::SharedMemory(shm_handle, false /* read_only */));
-    scoped_ptr<ShmBuffer> shm_buffer(
+    std::unique_ptr<ShmBuffer> shm_buffer(
         new ShmBuffer(std::move(shm), shm_size, shm_id));
     if (!shm_buffer->addr)
       return PP_ERROR_NOMEMORY;
diff --git a/ppapi/proxy/video_decoder_resource.h b/ppapi/proxy/video_decoder_resource.h
index 8f66e4a..f8ba1757 100644
--- a/ppapi/proxy/video_decoder_resource.h
+++ b/ppapi/proxy/video_decoder_resource.h
@@ -7,12 +7,12 @@
 
 #include <stdint.h>
 
+#include <memory>
 #include <queue>
 
 #include "base/containers/hash_tables.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/scoped_vector.h"
 #include "ppapi/proxy/connection.h"
 #include "ppapi/proxy/plugin_resource.h"
@@ -85,12 +85,12 @@
  private:
   // Struct to hold a shared memory buffer.
   struct ShmBuffer {
-    ShmBuffer(scoped_ptr<base::SharedMemory> shm,
+    ShmBuffer(std::unique_ptr<base::SharedMemory> shm,
               uint32_t size,
               uint32_t shm_id);
     ~ShmBuffer();
 
-    const scoped_ptr<base::SharedMemory> shm;
+    const std::unique_ptr<base::SharedMemory> shm;
     void* addr;
     // Index into shm_buffers_ vector, used as an id. This should map 1:1 to
     // the index on the host side of the proxy.
diff --git a/ppapi/proxy/video_encoder_resource.cc b/ppapi/proxy/video_encoder_resource.cc
index 4af703a2..89dd9f1 100644
--- a/ppapi/proxy/video_encoder_resource.cc
+++ b/ppapi/proxy/video_encoder_resource.cc
@@ -6,6 +6,7 @@
 
 #include <utility>
 
+#include "base/memory/ptr_util.h"
 #include "base/memory/shared_memory.h"
 #include "base/numerics/safe_conversions.h"
 #include "ppapi/c/pp_array_output.h"
@@ -58,8 +59,9 @@
 
 }  // namespace
 
-VideoEncoderResource::ShmBuffer::ShmBuffer(uint32_t id,
-                                           scoped_ptr<base::SharedMemory> shm)
+VideoEncoderResource::ShmBuffer::ShmBuffer(
+    uint32_t id,
+    std::unique_ptr<base::SharedMemory> shm)
     : id(id), shm(std::move(shm)) {}
 
 VideoEncoderResource::ShmBuffer::~ShmBuffer() {
@@ -349,7 +351,7 @@
 
   if (!buffer_manager_.SetBuffers(
           frame_count, frame_length,
-          make_scoped_ptr(new base::SharedMemory(buffer_handle, false)),
+          base::WrapUnique(new base::SharedMemory(buffer_handle, false)),
           true)) {
     NotifyError(PP_ERROR_FAILED);
     return;
@@ -396,7 +398,7 @@
   }
 
   for (uint32_t i = 0; i < shm_handles.size(); ++i) {
-    scoped_ptr<base::SharedMemory> shm(
+    std::unique_ptr<base::SharedMemory> shm(
         new base::SharedMemory(shm_handles[i], true));
     CHECK(shm->Map(buffer_length));
 
diff --git a/ppapi/proxy/video_encoder_resource.h b/ppapi/proxy/video_encoder_resource.h
index f040a38..b7106d88 100644
--- a/ppapi/proxy/video_encoder_resource.h
+++ b/ppapi/proxy/video_encoder_resource.h
@@ -8,10 +8,10 @@
 #include <stdint.h>
 
 #include <deque>
+#include <memory>
 
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/scoped_vector.h"
 #include "ppapi/proxy/connection.h"
 #include "ppapi/proxy/plugin_resource.h"
@@ -44,13 +44,13 @@
 
  private:
   struct ShmBuffer {
-    ShmBuffer(uint32_t id, scoped_ptr<base::SharedMemory> shm);
+    ShmBuffer(uint32_t id, std::unique_ptr<base::SharedMemory> shm);
     ~ShmBuffer();
 
     // Index of the buffer in the ScopedVector. Buffers have the same id in
     // the plugin and the host.
     uint32_t id;
-    scoped_ptr<base::SharedMemory> shm;
+    std::unique_ptr<base::SharedMemory> shm;
   };
 
   struct BitstreamBuffer {
diff --git a/ppapi/proxy/video_encoder_resource_unittest.cc b/ppapi/proxy/video_encoder_resource_unittest.cc
index 2b122e93..3d7fe118 100644
--- a/ppapi/proxy/video_encoder_resource_unittest.cc
+++ b/ppapi/proxy/video_encoder_resource_unittest.cc
@@ -123,7 +123,7 @@
   void CreateBitstreamSharedMemory(uint32_t buffer_size, uint32_t nb_buffers) {
     shared_memory_bitstreams_.clear();
     for (uint32_t i = 0; i < nb_buffers; ++i) {
-      scoped_ptr<base::SharedMemory> mem(new base::SharedMemory());
+      std::unique_ptr<base::SharedMemory> mem(new base::SharedMemory());
       ASSERT_TRUE(mem->CreateAnonymous(buffer_size));
       shared_memory_bitstreams_.push_back(std::move(mem));
     }
@@ -131,7 +131,7 @@
 
   void CreateVideoFramesSharedMemory(uint32_t frame_length,
                                      uint32_t frame_count) {
-    scoped_ptr<base::SharedMemory> shared_memory_frames(
+    std::unique_ptr<base::SharedMemory> shared_memory_frames(
         new base::SharedMemory());
     uint32_t buffer_length =
         frame_length + sizeof(ppapi::MediaStreamBuffer::Video);
diff --git a/ppapi/shared_impl/compositor_layer_data.cc b/ppapi/shared_impl/compositor_layer_data.cc
index a4b51d37..73ad43bc 100644
--- a/ppapi/shared_impl/compositor_layer_data.cc
+++ b/ppapi/shared_impl/compositor_layer_data.cc
@@ -8,8 +8,8 @@
 
 namespace {
 
-template<typename T>
-void Copy(scoped_ptr<T>* a, const scoped_ptr<T>& b) {
+template <typename T>
+void Copy(std::unique_ptr<T>* a, const std::unique_ptr<T>& b) {
   if (b) {
     if (!(*a))
       a->reset(new T());
diff --git a/ppapi/shared_impl/compositor_layer_data.h b/ppapi/shared_impl/compositor_layer_data.h
index 86a5b59..179b693 100644
--- a/ppapi/shared_impl/compositor_layer_data.h
+++ b/ppapi/shared_impl/compositor_layer_data.h
@@ -8,8 +8,9 @@
 #include <stdint.h>
 #include <string.h>
 
+#include <memory>
+
 #include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
 #include "gpu/command_buffer/common/mailbox.h"
 #include "gpu/command_buffer/common/sync_token.h"
 #include "ppapi/c/ppb_compositor_layer.h"
@@ -112,9 +113,9 @@
   const CompositorLayerData& operator=(const CompositorLayerData& other);
 
   LayerCommon common;
-  scoped_ptr<ColorLayer> color;
-  scoped_ptr<TextureLayer> texture;
-  scoped_ptr<ImageLayer> image;
+  std::unique_ptr<ColorLayer> color;
+  std::unique_ptr<TextureLayer> texture;
+  std::unique_ptr<ImageLayer> image;
 };
 
 }  // namespace ppapi
diff --git a/ppapi/shared_impl/media_stream_buffer_manager.cc b/ppapi/shared_impl/media_stream_buffer_manager.cc
index db97263..b828c70 100644
--- a/ppapi/shared_impl/media_stream_buffer_manager.cc
+++ b/ppapi/shared_impl/media_stream_buffer_manager.cc
@@ -25,10 +25,11 @@
 
 MediaStreamBufferManager::~MediaStreamBufferManager() {}
 
-bool MediaStreamBufferManager::SetBuffers(int32_t number_of_buffers,
-                                          int32_t buffer_size,
-                                          scoped_ptr<base::SharedMemory> shm,
-                                          bool enqueue_all_buffers) {
+bool MediaStreamBufferManager::SetBuffers(
+    int32_t number_of_buffers,
+    int32_t buffer_size,
+    std::unique_ptr<base::SharedMemory> shm,
+    bool enqueue_all_buffers) {
   DCHECK(shm);
   DCHECK_GT(number_of_buffers, 0);
   DCHECK_GT(buffer_size,
diff --git a/ppapi/shared_impl/media_stream_buffer_manager.h b/ppapi/shared_impl/media_stream_buffer_manager.h
index d965b11b..6a1cf0dd 100644
--- a/ppapi/shared_impl/media_stream_buffer_manager.h
+++ b/ppapi/shared_impl/media_stream_buffer_manager.h
@@ -8,11 +8,11 @@
 #include <stdint.h>
 
 #include <deque>
+#include <memory>
 #include <vector>
 
 #include "base/compiler_specific.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/shared_memory.h"
 #include "ppapi/shared_impl/ppapi_shared_export.h"
 
@@ -61,7 +61,7 @@
   // Initializes shared memory for buffers transmission.
   bool SetBuffers(int32_t number_of_buffers,
                   int32_t buffer_size,
-                  scoped_ptr<base::SharedMemory> shm,
+                  std::unique_ptr<base::SharedMemory> shm,
                   bool enqueue_all_buffers);
 
   // Dequeues a buffer from |buffer_queue_|.
@@ -95,7 +95,7 @@
   int32_t number_of_buffers_;
 
   // A memory block shared between renderer process and plugin process.
-  scoped_ptr<base::SharedMemory> shm_;
+  std::unique_ptr<base::SharedMemory> shm_;
 
   DISALLOW_COPY_AND_ASSIGN(MediaStreamBufferManager);
 };
diff --git a/ppapi/shared_impl/media_stream_buffer_manager_unittest.cc b/ppapi/shared_impl/media_stream_buffer_manager_unittest.cc
index 4bb250a..97cf90a 100644
--- a/ppapi/shared_impl/media_stream_buffer_manager_unittest.cc
+++ b/ppapi/shared_impl/media_stream_buffer_manager_unittest.cc
@@ -8,7 +8,6 @@
 
 #include <utility>
 
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/shared_memory.h"
 #include "ppapi/c/pp_errors.h"
 #include "testing/gtest/include/gtest/gtest.h"
@@ -18,9 +17,9 @@
 
 namespace {
 
-scoped_ptr<SharedMemory> CreateSharedMemory(int32_t buffer_size,
-                                            int32_t number_of_buffers) {
-  scoped_ptr<SharedMemory> shared_memory(new SharedMemory());
+std::unique_ptr<SharedMemory> CreateSharedMemory(int32_t buffer_size,
+                                                 int32_t number_of_buffers) {
+  std::unique_ptr<SharedMemory> shared_memory(new SharedMemory());
   SharedMemoryCreateOptions options;
   options.size = buffer_size * number_of_buffers;
   options.executable = false;
@@ -48,7 +47,7 @@
     const int32_t kBufferSize = 128;
     MockDelegate delegate;
     MediaStreamBufferManager manager(&delegate);
-    scoped_ptr<SharedMemory> shared_memory =
+    std::unique_ptr<SharedMemory> shared_memory =
         CreateSharedMemory(kBufferSize, kNumberOfBuffers);
     // SetBuffers with enqueue_all_buffers = true;
     EXPECT_TRUE(manager.SetBuffers(kNumberOfBuffers, kBufferSize,
@@ -105,7 +104,7 @@
     const int32_t kBufferSize = 128;
     MockDelegate delegate;
     MediaStreamBufferManager manager(&delegate);
-    scoped_ptr<SharedMemory> shared_memory =
+    std::unique_ptr<SharedMemory> shared_memory =
         CreateSharedMemory(kBufferSize, kNumberOfBuffers);
     // SetBuffers with enqueue_all_buffers = false;
     EXPECT_TRUE(manager.SetBuffers(kNumberOfBuffers, kBufferSize,
@@ -134,7 +133,7 @@
   MockDelegate delegate;
   MediaStreamBufferManager manager(&delegate);
   {
-    scoped_ptr<SharedMemory> shared_memory(new SharedMemory());
+    std::unique_ptr<SharedMemory> shared_memory(new SharedMemory());
     SharedMemoryCreateOptions options;
     options.size = kBufferSize1 * kNumberOfBuffers1;
     options.executable = false;
@@ -160,7 +159,7 @@
   }
 
   {
-    scoped_ptr<SharedMemory> shared_memory =
+    std::unique_ptr<SharedMemory> shared_memory =
         CreateSharedMemory(kBufferSize2, kNumberOfBuffers2);
     // SetBuffers with enqueue_all_buffers = true;
     EXPECT_TRUE(manager.SetBuffers(kNumberOfBuffers2, kBufferSize2,
diff --git a/ppapi/shared_impl/ppb_audio_shared.h b/ppapi/shared_impl/ppb_audio_shared.h
index 10b0500..7f7995b 100644
--- a/ppapi/shared_impl/ppb_audio_shared.h
+++ b/ppapi/shared_impl/ppb_audio_shared.h
@@ -8,8 +8,9 @@
 #include <stddef.h>
 #include <stdint.h>
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/shared_memory.h"
 #include "base/sync_socket.h"
 #include "base/threading/simple_thread.h"
@@ -111,18 +112,18 @@
 
   // Socket used to notify us when audio is ready to accept new samples. This
   // pointer is created in StreamCreated().
-  scoped_ptr<base::CancelableSyncSocket> socket_;
+  std::unique_ptr<base::CancelableSyncSocket> socket_;
 
   // Sample buffer in shared memory. This pointer is created in
   // StreamCreated(). The memory is only mapped when the audio thread is
   // created.
-  scoped_ptr<base::SharedMemory> shared_memory_;
+  std::unique_ptr<base::SharedMemory> shared_memory_;
 
   // The size of the sample buffer in bytes.
   size_t shared_memory_size_;
 
   // When the callback is set, this thread is spawned for calling it.
-  scoped_ptr<base::DelegateSimpleThread> audio_thread_;
+  std::unique_ptr<base::DelegateSimpleThread> audio_thread_;
   uintptr_t nacl_thread_id_;
   bool nacl_thread_active_;
 
@@ -135,11 +136,11 @@
   void* user_data_;
 
   // AudioBus for shuttling data across the shared memory.
-  scoped_ptr<media::AudioBus> audio_bus_;
+  std::unique_ptr<media::AudioBus> audio_bus_;
 
   // Internal buffer for client's integer audio data.
   int client_buffer_size_bytes_;
-  scoped_ptr<uint8_t[]> client_buffer_;
+  std::unique_ptr<uint8_t[]> client_buffer_;
 
   // The size (in bytes) of one second of audio data. Used to calculate latency.
   size_t bytes_per_second_;
diff --git a/ppapi/shared_impl/ppb_graphics_3d_shared.h b/ppapi/shared_impl/ppb_graphics_3d_shared.h
index 75f0931..7e11f6c 100644
--- a/ppapi/shared_impl/ppb_graphics_3d_shared.h
+++ b/ppapi/shared_impl/ppb_graphics_3d_shared.h
@@ -7,8 +7,9 @@
 
 #include <stdint.h>
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "ppapi/c/pp_completion_callback.h"
 #include "ppapi/shared_impl/ppapi_shared_export.h"
 #include "ppapi/shared_impl/resource.h"
@@ -78,9 +79,9 @@
   void DestroyGLES2Impl();
 
  private:
-  scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_;
-  scoped_ptr<gpu::TransferBuffer> transfer_buffer_;
-  scoped_ptr<gpu::gles2::GLES2Implementation> gles2_impl_;
+  std::unique_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_;
+  std::unique_ptr<gpu::TransferBuffer> transfer_buffer_;
+  std::unique_ptr<gpu::gles2::GLES2Implementation> gles2_impl_;
 
   // Callback that needs to be executed when swap-buffers is completed.
   scoped_refptr<TrackedCallback> swap_callback_;
diff --git a/ppapi/shared_impl/private/ppb_x509_certificate_private_shared.cc b/ppapi/shared_impl/private/ppb_x509_certificate_private_shared.cc
index 57ae502a..9f429bd 100644
--- a/ppapi/shared_impl/private/ppb_x509_certificate_private_shared.cc
+++ b/ppapi/shared_impl/private/ppb_x509_certificate_private_shared.cc
@@ -15,7 +15,7 @@
 
 PPB_X509Certificate_Fields::PPB_X509Certificate_Fields(
     const PPB_X509Certificate_Fields& fields) {
-  scoped_ptr<base::ListValue> new_values(fields.values_.DeepCopy());
+  std::unique_ptr<base::ListValue> new_values(fields.values_.DeepCopy());
   values_.Swap(new_values.get());
 }
 
@@ -115,7 +115,7 @@
     return PP_FALSE;
 
   std::vector<char> der(bytes, bytes + length);
-  scoped_ptr<PPB_X509Certificate_Fields> fields(
+  std::unique_ptr<PPB_X509Certificate_Fields> fields(
       new PPB_X509Certificate_Fields());
   bool success = ParseDER(der, fields.get());
   if (success) {
diff --git a/ppapi/shared_impl/private/ppb_x509_certificate_private_shared.h b/ppapi/shared_impl/private/ppb_x509_certificate_private_shared.h
index 61a49d1..b68e091 100644
--- a/ppapi/shared_impl/private/ppb_x509_certificate_private_shared.h
+++ b/ppapi/shared_impl/private/ppb_x509_certificate_private_shared.h
@@ -7,10 +7,10 @@
 
 #include <stdint.h>
 
+#include <memory>
 #include <vector>
 
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/values.h"
 #include "ppapi/c/private/ppb_x509_certificate_private.h"
 #include "ppapi/shared_impl/resource.h"
@@ -66,7 +66,7 @@
                         PPB_X509Certificate_Fields* result);
 
  private:
-  scoped_ptr<PPB_X509Certificate_Fields> fields_;
+  std::unique_ptr<PPB_X509Certificate_Fields> fields_;
 
   DISALLOW_COPY_AND_ASSIGN(PPB_X509Certificate_Private_Shared);
 };
diff --git a/ppapi/shared_impl/proxy_lock.h b/ppapi/shared_impl/proxy_lock.h
index 8c7bc83..366504e 100644
--- a/ppapi/shared_impl/proxy_lock.h
+++ b/ppapi/shared_impl/proxy_lock.h
@@ -5,12 +5,12 @@
 #ifndef PPAPI_SHARED_IMPL_PROXY_LOCK_H_
 #define PPAPI_SHARED_IMPL_PROXY_LOCK_H_
 
+#include <memory>
 #include <utility>
 
 #include "base/bind.h"
 #include "base/callback.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/threading/thread_checker.h"
 #include "ppapi/shared_impl/ppapi_shared_export.h"
 
@@ -185,7 +185,7 @@
     // creation.
     thread_checker_.DetachFromThread();
   }
-  static void CallWhileLocked(scoped_ptr<RunWhileLockedHelper> ptr) {
+  static void CallWhileLocked(std::unique_ptr<RunWhileLockedHelper> ptr) {
     // Bind thread_checker_ to this thread so we can check in the destructor.
     // *If* the callback gets invoked, it's important that RunWhileLockedHelper
     // is destroyed on the same thread (see the comments in the destructor).
@@ -195,7 +195,7 @@
       // Use a scope and local Callback to ensure that the callback is cleared
       // before the lock is released, even in the unlikely event that Run()
       // throws an exception.
-      scoped_ptr<CallbackType> temp_callback(std::move(ptr->callback_));
+      std::unique_ptr<CallbackType> temp_callback(std::move(ptr->callback_));
       temp_callback->Run();
     }
   }
@@ -228,7 +228,7 @@
 
  private:
   DISALLOW_COPY_AND_ASSIGN(RunWhileLockedHelper);
-  scoped_ptr<CallbackType> callback_;
+  std::unique_ptr<CallbackType> callback_;
 
   // Used to ensure that the Callback is run and deleted on the same thread.
   base::ThreadChecker thread_checker_;
@@ -242,11 +242,12 @@
       : callback_(new CallbackType(callback)) {
     thread_checker_.DetachFromThread();
   }
-  static void CallWhileLocked(scoped_ptr<RunWhileLockedHelper> ptr, P1 p1) {
+  static void CallWhileLocked(std::unique_ptr<RunWhileLockedHelper> ptr,
+                              P1 p1) {
     DCHECK(ptr->thread_checker_.CalledOnValidThread());
     ProxyAutoLock lock;
     {
-      scoped_ptr<CallbackType> temp_callback(std::move(ptr->callback_));
+      std::unique_ptr<CallbackType> temp_callback(std::move(ptr->callback_));
       temp_callback->Run(p1);
     }
   }
@@ -260,7 +261,7 @@
 
  private:
   DISALLOW_COPY_AND_ASSIGN(RunWhileLockedHelper);
-  scoped_ptr<CallbackType> callback_;
+  std::unique_ptr<CallbackType> callback_;
   base::ThreadChecker thread_checker_;
 };
 
@@ -272,12 +273,13 @@
       : callback_(new CallbackType(callback)) {
     thread_checker_.DetachFromThread();
   }
-  static void CallWhileLocked(
-      scoped_ptr<RunWhileLockedHelper> ptr, P1 p1, P2 p2) {
+  static void CallWhileLocked(std::unique_ptr<RunWhileLockedHelper> ptr,
+                              P1 p1,
+                              P2 p2) {
     DCHECK(ptr->thread_checker_.CalledOnValidThread());
     ProxyAutoLock lock;
     {
-      scoped_ptr<CallbackType> temp_callback(std::move(ptr->callback_));
+      std::unique_ptr<CallbackType> temp_callback(std::move(ptr->callback_));
       temp_callback->Run(p1, p2);
     }
   }
@@ -291,7 +293,7 @@
 
  private:
   DISALLOW_COPY_AND_ASSIGN(RunWhileLockedHelper);
-  scoped_ptr<CallbackType> callback_;
+  std::unique_ptr<CallbackType> callback_;
   base::ThreadChecker thread_checker_;
 };
 
@@ -303,12 +305,14 @@
       : callback_(new CallbackType(callback)) {
     thread_checker_.DetachFromThread();
   }
-  static void CallWhileLocked(
-      scoped_ptr<RunWhileLockedHelper> ptr, P1 p1, P2 p2, P3 p3) {
+  static void CallWhileLocked(std::unique_ptr<RunWhileLockedHelper> ptr,
+                              P1 p1,
+                              P2 p2,
+                              P3 p3) {
     DCHECK(ptr->thread_checker_.CalledOnValidThread());
     ProxyAutoLock lock;
     {
-      scoped_ptr<CallbackType> temp_callback(std::move(ptr->callback_));
+      std::unique_ptr<CallbackType> temp_callback(std::move(ptr->callback_));
       temp_callback->Run(p1, p2, p3);
     }
   }
@@ -322,7 +326,7 @@
 
  private:
   DISALLOW_COPY_AND_ASSIGN(RunWhileLockedHelper);
-  scoped_ptr<CallbackType> callback_;
+  std::unique_ptr<CallbackType> callback_;
   base::ThreadChecker thread_checker_;
 };
 
@@ -374,7 +378,7 @@
   // in that case, if we used base::Owned, we might delete RunWhileLockedHelper
   // on this thread, which will violate the RunWhileLockedHelper's assumption
   // that it is destroyed on the same thread where it is run.
-  scoped_ptr<internal::RunWhileLockedHelper<FunctionType>> helper(
+  std::unique_ptr<internal::RunWhileLockedHelper<FunctionType>> helper(
       new internal::RunWhileLockedHelper<FunctionType>(callback));
   return base::Bind(
       &internal::RunWhileLockedHelper<FunctionType>::CallWhileLocked,
diff --git a/ppapi/shared_impl/resource_tracker.cc b/ppapi/shared_impl/resource_tracker.cc
index 2f24049..8d4e31f2 100644
--- a/ppapi/shared_impl/resource_tracker.cc
+++ b/ppapi/shared_impl/resource_tracker.cc
@@ -6,6 +6,7 @@
 
 #include "base/bind.h"
 #include "base/compiler_specific.h"
+#include "base/memory/ptr_util.h"
 #include "base/message_loop/message_loop.h"
 #include "ppapi/shared_impl/callback_tracker.h"
 #include "ppapi/shared_impl/id_assignment.h"
@@ -96,7 +97,7 @@
   // instead.
   if (instance_map_.find(instance) != instance_map_.end())
     return;
-  instance_map_[instance] = make_scoped_ptr(new InstanceData);
+  instance_map_[instance] = base::WrapUnique(new InstanceData);
 }
 
 void ResourceTracker::DidDeleteInstance(PP_Instance instance) {
diff --git a/ppapi/shared_impl/resource_tracker.h b/ppapi/shared_impl/resource_tracker.h
index 8e4ac080..38a7a835 100644
--- a/ppapi/shared_impl/resource_tracker.h
+++ b/ppapi/shared_impl/resource_tracker.h
@@ -7,11 +7,11 @@
 
 #include <stdint.h>
 
+#include <memory>
 #include <set>
 
 #include "base/containers/hash_tables.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/threading/thread_checker.h"
 #include "base/threading/thread_checker_impl.h"
@@ -106,7 +106,8 @@
     // going away (otherwise, they may crash if they outlive the instance).
     ResourceSet resources;
   };
-  typedef base::hash_map<PP_Instance, scoped_ptr<InstanceData>> InstanceMap;
+  typedef base::hash_map<PP_Instance, std::unique_ptr<InstanceData>>
+      InstanceMap;
 
   InstanceMap instance_map_;
 
@@ -128,7 +129,7 @@
   // thread. This is to protect us from accidentally using the tracker from
   // other threads (especially the IO thread). On the plugin side, the tracker
   // is protected by the proxy lock and is thread-safe, so this will be NULL.
-  scoped_ptr<base::ThreadChecker> thread_checker_;
+  std::unique_ptr<base::ThreadChecker> thread_checker_;
 
   base::WeakPtrFactory<ResourceTracker> weak_ptr_factory_;
 
diff --git a/ppapi/shared_impl/thread_aware_callback_unittest.cc b/ppapi/shared_impl/thread_aware_callback_unittest.cc
index 92d91242..1d56586 100644
--- a/ppapi/shared_impl/thread_aware_callback_unittest.cc
+++ b/ppapi/shared_impl/thread_aware_callback_unittest.cc
@@ -4,11 +4,12 @@
 
 #include "ppapi/shared_impl/thread_aware_callback.h"
 
+#include <memory>
+
 #include "base/bind_helpers.h"
 #include "base/compiler_specific.h"
 #include "base/location.h"
 #include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/single_thread_task_runner.h"
 #include "ppapi/c/pp_errors.h"
 #include "ppapi/proxy/ppapi_proxy_test.h"
@@ -93,7 +94,7 @@
     }
   }
 
-  scoped_ptr<ThreadAwareCallback<CallbackFunc> > main_thread_callback_;
+  std::unique_ptr<ThreadAwareCallback<CallbackFunc>> main_thread_callback_;
   bool main_thread_callback_called_;
 };
 
@@ -142,7 +143,7 @@
     main_thread_callback_.reset(NULL);
   }
 
-  scoped_ptr<ThreadAwareCallback<CallbackFunc> > main_thread_callback_;
+  std::unique_ptr<ThreadAwareCallback<CallbackFunc>> main_thread_callback_;
 };
 
 }  // namespace
@@ -159,33 +160,33 @@
   // Exercise all the template code.
   called_num = 0;
   typedef void (*FuncType_0)();
-  scoped_ptr<ThreadAwareCallback<FuncType_0> > callback_0(
+  std::unique_ptr<ThreadAwareCallback<FuncType_0>> callback_0(
       ThreadAwareCallback<FuncType_0>::Create(TestCallback_0));
   callback_0->RunOnTargetThread();
 
   typedef void (*FuncType_1)(int);
-  scoped_ptr<ThreadAwareCallback<FuncType_1> > callback_1(
+  std::unique_ptr<ThreadAwareCallback<FuncType_1>> callback_1(
       ThreadAwareCallback<FuncType_1>::Create(TestCallback_1));
   callback_1->RunOnTargetThread(1);
 
   typedef void (*FuncType_2)(int, const double*);
-  scoped_ptr<ThreadAwareCallback<FuncType_2> > callback_2(
+  std::unique_ptr<ThreadAwareCallback<FuncType_2>> callback_2(
       ThreadAwareCallback<FuncType_2>::Create(TestCallback_2));
   callback_2->RunOnTargetThread(1, &double_arg);
 
   typedef void (*FuncType_3)(int, const double*, bool*);
-  scoped_ptr<ThreadAwareCallback<FuncType_3> > callback_3(
+  std::unique_ptr<ThreadAwareCallback<FuncType_3>> callback_3(
       ThreadAwareCallback<FuncType_3>::Create(TestCallback_3));
   callback_3->RunOnTargetThread(1, &double_arg, &bool_arg);
 
   typedef void (*FuncType_4)(int, const double*, bool*, TestParameter);
-  scoped_ptr<ThreadAwareCallback<FuncType_4> > callback_4(
+  std::unique_ptr<ThreadAwareCallback<FuncType_4>> callback_4(
       ThreadAwareCallback<FuncType_4>::Create(TestCallback_4));
   callback_4->RunOnTargetThread(1, &double_arg, &bool_arg, object_arg);
 
   typedef void (*FuncType_5)(
       int, const double*, bool*, TestParameter, const TestParameter&);
-  scoped_ptr<ThreadAwareCallback<FuncType_5> > callback_5(
+  std::unique_ptr<ThreadAwareCallback<FuncType_5>> callback_5(
       ThreadAwareCallback<FuncType_5>::Create(TestCallback_5));
   callback_5->RunOnTargetThread(
       1, &double_arg, &bool_arg, object_arg, object_arg);
diff --git a/ppapi/shared_impl/tracked_callback.h b/ppapi/shared_impl/tracked_callback.h
index b80e680a..89690c3 100644
--- a/ppapi/shared_impl/tracked_callback.h
+++ b/ppapi/shared_impl/tracked_callback.h
@@ -8,12 +8,12 @@
 #include <stdint.h>
 
 #include <map>
+#include <memory>
 #include <set>
 
 #include "base/callback.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/synchronization/condition_variable.h"
 #include "base/synchronization/lock.h"
 #include "ppapi/c/pp_completion_callback.h"
@@ -192,7 +192,7 @@
   // Used for pausing/waking the blocked thread if this is a blocking completion
   // callback. Note that in-process, there is no lock, blocking callbacks are
   // not allowed, and therefore this pointer will be NULL.
-  scoped_ptr<base::ConditionVariable> operation_completed_condvar_;
+  std::unique_ptr<base::ConditionVariable> operation_completed_condvar_;
 
   DISALLOW_IMPLICIT_CONSTRUCTORS(TrackedCallback);
 };
diff --git a/ppapi/shared_impl/var_tracker.h b/ppapi/shared_impl/var_tracker.h
index 6ef9fc8..9e5439f97 100644
--- a/ppapi/shared_impl/var_tracker.h
+++ b/ppapi/shared_impl/var_tracker.h
@@ -7,12 +7,12 @@
 
 #include <stdint.h>
 
+#include <memory>
 #include <vector>
 
 #include "base/containers/hash_tables.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/shared_memory.h"
 #include "base/threading/thread_checker.h"
 #include "ppapi/c/pp_instance.h"
@@ -235,7 +235,7 @@
   // thread. This is to protect us from accidentally using the tracker from
   // other threads (especially the IO thread). On the plugin side, the tracker
   // is protected by the proxy lock and is thread-safe, so this will be NULL.
-  scoped_ptr<base::ThreadChecker> thread_checker_;
+  std::unique_ptr<base::ThreadChecker> thread_checker_;
 
   DISALLOW_COPY_AND_ASSIGN(VarTracker);
 };
diff --git a/ppapi/thunk/ppb_flash_clipboard_thunk.cc b/ppapi/thunk/ppb_flash_clipboard_thunk.cc
index 8c925e7..240550a0 100644
--- a/ppapi/thunk/ppb_flash_clipboard_thunk.cc
+++ b/ppapi/thunk/ppb_flash_clipboard_thunk.cc
@@ -4,7 +4,8 @@
 
 #include <stdint.h>
 
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
 #include "ppapi/c/pp_errors.h"
 #include "ppapi/c/private/ppb_flash_clipboard.h"
 #include "ppapi/thunk/enter.h"
@@ -72,7 +73,7 @@
                       uint32_t data_item_count,
                       const PP_Flash_Clipboard_Format formats[],
                       const PP_Var data_items[]) {
-  scoped_ptr<uint32_t[]> new_formats(new uint32_t[data_item_count]);
+  std::unique_ptr<uint32_t[]> new_formats(new uint32_t[data_item_count]);
   for (uint32_t i = 0; i < data_item_count; ++i)
     new_formats[i] = static_cast<uint32_t>(formats[i]);
   return WriteData(instance, clipboard_type, data_item_count,
diff --git a/ppapi/thunk/ppb_instance_api.h b/ppapi/thunk/ppb_instance_api.h
index 3657c878e..8e77156 100644
--- a/ppapi/thunk/ppb_instance_api.h
+++ b/ppapi/thunk/ppb_instance_api.h
@@ -8,7 +8,6 @@
 #include <stdint.h>
 
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "build/build_config.h"
 #include "ppapi/c/dev/ppb_url_util_dev.h"
 #include "ppapi/c/pp_bool.h"
diff --git a/remoting/base/auto_thread.cc b/remoting/base/auto_thread.cc
index c55a761..963bd6b 100644
--- a/remoting/base/auto_thread.cc
+++ b/remoting/base/auto_thread.cc
@@ -22,9 +22,9 @@
 namespace {
 
 #if defined(OS_WIN)
-scoped_ptr<base::win::ScopedCOMInitializer> CreateComInitializer(
+std::unique_ptr<base::win::ScopedCOMInitializer> CreateComInitializer(
     AutoThread::ComInitType type) {
-  scoped_ptr<base::win::ScopedCOMInitializer> initializer;
+  std::unique_ptr<base::win::ScopedCOMInitializer> initializer;
   if (type == AutoThread::COM_INIT_MTA) {
     initializer.reset(new base::win::ScopedCOMInitializer(
         base::win::ScopedCOMInitializer::kMTA));
@@ -202,7 +202,7 @@
 
 #if defined(OS_WIN)
   // Initialize COM on the thread, if requested.
-  scoped_ptr<base::win::ScopedCOMInitializer> com_initializer(
+  std::unique_ptr<base::win::ScopedCOMInitializer> com_initializer(
       CreateComInitializer(com_init_type_));
 #endif
 
diff --git a/remoting/base/auto_thread_task_runner.h b/remoting/base/auto_thread_task_runner.h
index 4e64500..e8efe97 100644
--- a/remoting/base/auto_thread_task_runner.h
+++ b/remoting/base/auto_thread_task_runner.h
@@ -5,9 +5,10 @@
 #ifndef REMOTING_BASE_AUTO_THREAD_TASK_RUNNER_H_
 #define REMOTING_BASE_AUTO_THREAD_TASK_RUNNER_H_
 
+#include <memory>
+
 #include "base/callback.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/message_loop/message_loop.h"
 #include "base/single_thread_task_runner.h"
 
diff --git a/remoting/base/breakpad_win.cc b/remoting/base/breakpad_win.cc
index 6ba02c5..dc522230 100644
--- a/remoting/base/breakpad_win.cc
+++ b/remoting/base/breakpad_win.cc
@@ -10,6 +10,8 @@
 #include "remoting/base/breakpad.h"
 
 #include <windows.h>
+
+#include <memory>
 #include <string>
 
 #include "base/atomicops.h"
@@ -17,7 +19,6 @@
 #include "base/lazy_instance.h"
 #include "base/logging.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/win/current_module.h"
 #include "base/win/wrapped_window_proc.h"
@@ -77,7 +78,7 @@
   static int OnWindowProcedureException(EXCEPTION_POINTERS* exinfo);
 
   // Breakpad's exception handler.
-  scoped_ptr<google_breakpad::ExceptionHandler> breakpad_;
+  std::unique_ptr<google_breakpad::ExceptionHandler> breakpad_;
 
   // This flag is used to indicate that an exception is already being handled.
   volatile AtomicWord handling_exception_;
@@ -144,7 +145,7 @@
 
 // Returns the Custom information to be used for crash reporting.
 google_breakpad::CustomClientInfo* BreakpadWin::GetCustomInfo() {
-  scoped_ptr<FileVersionInfo> version_info(
+  std::unique_ptr<FileVersionInfo> version_info(
       FileVersionInfo::CreateFileVersionInfoForModule(CURRENT_MODULE()));
 
   static wchar_t version[64];
diff --git a/remoting/base/breakpad_win_unittest.cc b/remoting/base/breakpad_win_unittest.cc
index 877ea32..f0da52c 100644
--- a/remoting/base/breakpad_win_unittest.cc
+++ b/remoting/base/breakpad_win_unittest.cc
@@ -3,12 +3,13 @@
 // found in the LICENSE file.
 
 #include <stdio.h>
+
+#include <memory>
 #include <string>
 
 #include "base/compiler_specific.h"
 #include "base/environment.h"
 #include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/strings/stringprintf.h"
 #include "base/strings/utf_string_conversions.h"
 #include "breakpad/src/client/windows/crash_generation/client_info.h"
@@ -74,8 +75,8 @@
   void SetUp() override;
 
  protected:
-  scoped_ptr<google_breakpad::CrashGenerationServer> crash_server_;
-  scoped_ptr<MockCrashServerCallbacks> callbacks_;
+  std::unique_ptr<google_breakpad::CrashGenerationServer> crash_server_;
+  std::unique_ptr<MockCrashServerCallbacks> callbacks_;
   std::wstring pipe_name_;
 };
 
@@ -86,7 +87,7 @@
 }
 
 void BreakpadWinDeathTest::SetUp() {
-  scoped_ptr<base::Environment> environment(base::Environment::Create());
+  std::unique_ptr<base::Environment> environment(base::Environment::Create());
   std::string pipe_name;
   if (environment->GetVar(kPipeVariableName, &pipe_name)) {
     // This is a child process. Initialize crash dump reporting to the crash
diff --git a/remoting/base/buffered_socket_writer.cc b/remoting/base/buffered_socket_writer.cc
index 48d8196..4e0fd2a 100644
--- a/remoting/base/buffered_socket_writer.cc
+++ b/remoting/base/buffered_socket_writer.cc
@@ -36,10 +36,10 @@
 };
 
 // static
-scoped_ptr<BufferedSocketWriter> BufferedSocketWriter::CreateForSocket(
+std::unique_ptr<BufferedSocketWriter> BufferedSocketWriter::CreateForSocket(
     net::Socket* socket,
     const WriteFailedCallback& write_failed_callback) {
-  scoped_ptr<BufferedSocketWriter> result(new BufferedSocketWriter());
+  std::unique_ptr<BufferedSocketWriter> result(new BufferedSocketWriter());
   result->Start(base::Bind(&WriteNetSocket, socket), write_failed_callback);
   return result;
 }
diff --git a/remoting/base/buffered_socket_writer.h b/remoting/base/buffered_socket_writer.h
index c153ebec..343b143 100644
--- a/remoting/base/buffered_socket_writer.h
+++ b/remoting/base/buffered_socket_writer.h
@@ -29,7 +29,7 @@
       WriteCallback;
   typedef base::Callback<void(int)> WriteFailedCallback;
 
-  static scoped_ptr<BufferedSocketWriter> CreateForSocket(
+  static std::unique_ptr<BufferedSocketWriter> CreateForSocket(
       net::Socket* socket,
       const WriteFailedCallback& write_failed_callback);
 
diff --git a/remoting/base/buffered_socket_writer_unittest.cc b/remoting/base/buffered_socket_writer_unittest.cc
index d924ad0e..8825f631 100644
--- a/remoting/base/buffered_socket_writer_unittest.cc
+++ b/remoting/base/buffered_socket_writer_unittest.cc
@@ -153,8 +153,8 @@
   base::MessageLoop message_loop_;
   net::NetLog net_log_;
   SocketDataProvider socket_data_provider_;
-  scoped_ptr<net::StreamSocket> socket_;
-  scoped_ptr<BufferedSocketWriter> writer_;
+  std::unique_ptr<net::StreamSocket> socket_;
+  std::unique_ptr<BufferedSocketWriter> writer_;
   scoped_refptr<net::IOBufferWithSize> test_buffer_;
   scoped_refptr<net::IOBufferWithSize> test_buffer_2_;
   int write_error_;
diff --git a/remoting/base/chromium_url_request.cc b/remoting/base/chromium_url_request.cc
index 073f6ac6..e347f8a 100644
--- a/remoting/base/chromium_url_request.cc
+++ b/remoting/base/chromium_url_request.cc
@@ -5,6 +5,7 @@
 #include "remoting/base/chromium_url_request.h"
 
 #include "base/callback_helpers.h"
+#include "base/memory/ptr_util.h"
 #include "net/url_request/url_fetcher.h"
 #include "net/url_request/url_request_context_getter.h"
 
@@ -67,10 +68,10 @@
     : url_context_(url_context) {}
 ChromiumUrlRequestFactory::~ChromiumUrlRequestFactory() {}
 
-scoped_ptr<UrlRequest> ChromiumUrlRequestFactory::CreateUrlRequest(
+std::unique_ptr<UrlRequest> ChromiumUrlRequestFactory::CreateUrlRequest(
     UrlRequest::Type type,
     const std::string& url) {
-  return make_scoped_ptr(new ChromiumUrlRequest(url_context_, type, url));
+  return base::WrapUnique(new ChromiumUrlRequest(url_context_, type, url));
 }
 
 }  // namespace remoting
diff --git a/remoting/base/chromium_url_request.h b/remoting/base/chromium_url_request.h
index 9cca077..2593672 100644
--- a/remoting/base/chromium_url_request.h
+++ b/remoting/base/chromium_url_request.h
@@ -36,7 +36,7 @@
   // net::URLFetcherDelegate interface.
   void OnURLFetchComplete(const net::URLFetcher* url_fetcher) override;
 
-  scoped_ptr<net::URLFetcher> url_fetcher_;
+  std::unique_ptr<net::URLFetcher> url_fetcher_;
   OnResultCallback on_result_callback_;
 };
 
@@ -47,8 +47,8 @@
   ~ChromiumUrlRequestFactory() override;
 
   // UrlRequestFactory interface.
-  scoped_ptr<UrlRequest> CreateUrlRequest(UrlRequest::Type type,
-                                          const std::string& url) override;
+  std::unique_ptr<UrlRequest> CreateUrlRequest(UrlRequest::Type type,
+                                               const std::string& url) override;
 
  private:
   scoped_refptr<net::URLRequestContextGetter> url_context_;
diff --git a/remoting/base/compound_buffer_unittest.cc b/remoting/base/compound_buffer_unittest.cc
index 031365a8..c64b7ea 100644
--- a/remoting/base/compound_buffer_unittest.cc
+++ b/remoting/base/compound_buffer_unittest.cc
@@ -2,16 +2,17 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "remoting/base/compound_buffer.h"
+
 #include <stddef.h>
 #include <stdint.h>
 
+#include <memory>
 #include <string>
 
 #include "base/bind.h"
 #include "base/callback.h"
-#include "base/memory/scoped_ptr.h"
 #include "net/base/io_buffer.h"
-#include "remoting/base/compound_buffer.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 using net::IOBuffer;
@@ -140,14 +141,14 @@
   static void ReadString(CompoundBufferInputStream* input,
                          const std::string& str) {
     SCOPED_TRACE(str);
-    scoped_ptr<char[]> buffer(new char[str.size() + 1]);
+    std::unique_ptr<char[]> buffer(new char[str.size() + 1]);
     buffer[str.size()] = '\0';
     EXPECT_EQ(ReadFromInput(input, buffer.get(), str.size()), str.size());
     EXPECT_STREQ(str.data(), buffer.get());
   }
 
   // Construct and prepare data in the |buffer|.
-  static void PrepareData(scoped_ptr<CompoundBuffer>* buffer) {
+  static void PrepareData(std::unique_ptr<CompoundBuffer>* buffer) {
     static const std::string kTestData =
         "Hello world!"
         "This is testing"
@@ -261,7 +262,7 @@
 }
 
 TEST_F(CompoundBufferTest, InputStream) {
-  scoped_ptr<CompoundBuffer> buffer;
+  std::unique_ptr<CompoundBuffer> buffer;
   PrepareData(&buffer);
   CompoundBufferInputStream stream(buffer.get());
 
diff --git a/remoting/base/rsa_key_pair.cc b/remoting/base/rsa_key_pair.cc
index 98a153b4..5d39361 100644
--- a/remoting/base/rsa_key_pair.cc
+++ b/remoting/base/rsa_key_pair.cc
@@ -21,8 +21,8 @@
 
 namespace remoting {
 
-RsaKeyPair::RsaKeyPair(scoped_ptr<crypto::RSAPrivateKey> key)
-    : key_(std::move(key)){
+RsaKeyPair::RsaKeyPair(std::unique_ptr<crypto::RSAPrivateKey> key)
+    : key_(std::move(key)) {
   DCHECK(key_);
 }
 
@@ -30,7 +30,8 @@
 
 // static
 scoped_refptr<RsaKeyPair> RsaKeyPair::Generate() {
-  scoped_ptr<crypto::RSAPrivateKey> key(crypto::RSAPrivateKey::Create(2048));
+  std::unique_ptr<crypto::RSAPrivateKey> key(
+      crypto::RSAPrivateKey::Create(2048));
   if (!key) {
     LOG(ERROR) << "Cannot generate private key.";
     return NULL;
@@ -48,7 +49,7 @@
   }
 
   std::vector<uint8_t> key_buf(key_str.begin(), key_str.end());
-  scoped_ptr<crypto::RSAPrivateKey> key(
+  std::unique_ptr<crypto::RSAPrivateKey> key(
       crypto::RSAPrivateKey::CreateFromPrivateKeyInfo(key_buf));
   if (!key) {
     LOG(ERROR) << "Invalid private key.";
@@ -80,7 +81,7 @@
 }
 
 std::string RsaKeyPair::SignMessage(const std::string& message) const {
-  scoped_ptr<crypto::SignatureCreator> signature_creator(
+  std::unique_ptr<crypto::SignatureCreator> signature_creator(
       crypto::SignatureCreator::Create(key_.get(),
                                        crypto::SignatureCreator::SHA1));
   signature_creator->Update(reinterpret_cast<const uint8_t*>(message.c_str()),
diff --git a/remoting/base/rsa_key_pair.h b/remoting/base/rsa_key_pair.h
index 03e791f..a4190b3 100644
--- a/remoting/base/rsa_key_pair.h
+++ b/remoting/base/rsa_key_pair.h
@@ -5,11 +5,11 @@
 #ifndef REMOTING_BASE_RSA_KEY_PAIR_H_
 #define REMOTING_BASE_RSA_KEY_PAIR_H_
 
+#include <memory>
 #include <string>
 
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 
 namespace crypto {
 class RSAPrivateKey;
@@ -43,10 +43,10 @@
 
  private:
   friend class base::RefCountedThreadSafe<RsaKeyPair>;
-  RsaKeyPair(scoped_ptr<crypto::RSAPrivateKey> key);
+  RsaKeyPair(std::unique_ptr<crypto::RSAPrivateKey> key);
   virtual ~RsaKeyPair();
 
-  scoped_ptr<crypto::RSAPrivateKey> key_;
+  std::unique_ptr<crypto::RSAPrivateKey> key_;
 
   DISALLOW_COPY_AND_ASSIGN(RsaKeyPair);
 };
diff --git a/remoting/base/url_request.h b/remoting/base/url_request.h
index bcb1b642..704abece 100644
--- a/remoting/base/url_request.h
+++ b/remoting/base/url_request.h
@@ -5,10 +5,10 @@
 #ifndef REMOTING_BASE_URL_REQUEST_H_
 #define REMOTING_BASE_URL_REQUEST_H_
 
+#include <memory>
 #include <string>
 
 #include "base/callback_forward.h"
-#include "base/memory/scoped_ptr.h"
 
 namespace remoting {
 
@@ -59,8 +59,9 @@
 class UrlRequestFactory {
  public:
   virtual ~UrlRequestFactory() {}
-  virtual scoped_ptr<UrlRequest> CreateUrlRequest(UrlRequest::Type type,
-                                                  const std::string& url) = 0;
+  virtual std::unique_ptr<UrlRequest> CreateUrlRequest(
+      UrlRequest::Type type,
+      const std::string& url) = 0;
 };
 
 }  // namespace remoting
diff --git a/remoting/base/url_request_context_getter.h b/remoting/base/url_request_context_getter.h
index 13ef147..d6c9916 100644
--- a/remoting/base/url_request_context_getter.h
+++ b/remoting/base/url_request_context_getter.h
@@ -5,8 +5,9 @@
 #ifndef REMOTING_BASE_URL_REQUEST_CONTEXT_GETTER_H_
 #define REMOTING_BASE_URL_REQUEST_CONTEXT_GETTER_H_
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "net/url_request/url_request_context_getter.h"
 
 namespace base {
@@ -37,9 +38,9 @@
  private:
   scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_;
   scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_;
-  scoped_ptr<net::ProxyConfigService> proxy_config_service_;
-  scoped_ptr<net::NetLog> net_log_;
-  scoped_ptr<net::URLRequestContext> url_request_context_;
+  std::unique_ptr<net::ProxyConfigService> proxy_config_service_;
+  std::unique_ptr<net::NetLog> net_log_;
+  std::unique_ptr<net::URLRequestContext> url_request_context_;
 
   DISALLOW_COPY_AND_ASSIGN(URLRequestContextGetter);
 };
diff --git a/remoting/base/vlog_net_log.cc b/remoting/base/vlog_net_log.cc
index 98c964f9..4a3ad8e8 100644
--- a/remoting/base/vlog_net_log.cc
+++ b/remoting/base/vlog_net_log.cc
@@ -4,10 +4,11 @@
 
 #include "remoting/base/vlog_net_log.h"
 
+#include <memory>
+
 #include "base/json/json_writer.h"
 #include "base/logging.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/threading/thread_restrictions.h"
 #include "base/time/time.h"
 #include "base/values.h"
@@ -34,7 +35,7 @@
 
 void VlogNetLog::Observer::OnAddEntry(const net::NetLog::Entry& entry) {
   if (VLOG_IS_ON(4)) {
-    scoped_ptr<base::Value> value(entry.ToValue());
+    std::unique_ptr<base::Value> value(entry.ToValue());
     std::string json;
     base::JSONWriter::Write(*value, &json);
     VLOG(4) << json;
diff --git a/remoting/base/vlog_net_log.h b/remoting/base/vlog_net_log.h
index 4b923ee..c133e9b 100644
--- a/remoting/base/vlog_net_log.h
+++ b/remoting/base/vlog_net_log.h
@@ -5,8 +5,9 @@
 #ifndef REMOTING_BASE_VLOG_NET_LOG_H_
 #define REMOTING_BASE_VLOG_NET_LOG_H_
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "net/log/net_log.h"
 
 namespace remoting {
@@ -22,7 +23,7 @@
 
  private:
   class Observer;
-  scoped_ptr<Observer> observer_;
+  std::unique_ptr<Observer> observer_;
 
   DISALLOW_COPY_AND_ASSIGN(VlogNetLog);
 };
diff --git a/remoting/client/audio_decode_scheduler.cc b/remoting/client/audio_decode_scheduler.cc
index 976d7a4..3f0e466 100644
--- a/remoting/client/audio_decode_scheduler.cc
+++ b/remoting/client/audio_decode_scheduler.cc
@@ -20,10 +20,10 @@
  public:
   Core(scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
        scoped_refptr<base::SingleThreadTaskRunner> audio_decode_task_runner,
-       scoped_ptr<AudioPlayer> audio_player);
+       std::unique_ptr<AudioPlayer> audio_player);
 
   void Initialize(const protocol::SessionConfig& config);
-  void ProcessAudioPacket(scoped_ptr<AudioPacket> packet,
+  void ProcessAudioPacket(std::unique_ptr<AudioPacket> packet,
                           const base::Closure& done);
 
   // Called by AudioDecodeScheduler when it is destroyed.
@@ -35,16 +35,17 @@
   virtual ~Core();
 
   // Called on the audio decoder thread.
-  void DecodePacket(scoped_ptr<AudioPacket> packet, const base::Closure& done);
+  void DecodePacket(std::unique_ptr<AudioPacket> packet,
+                    const base::Closure& done);
 
   // Called on the main thread.
-  void ProcessDecodedPacket(scoped_ptr<AudioPacket> packet,
+  void ProcessDecodedPacket(std::unique_ptr<AudioPacket> packet,
                             const base::Closure& done);
 
   scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
   scoped_refptr<base::SingleThreadTaskRunner> audio_decode_task_runner_;
-  scoped_ptr<AudioDecoder> decoder_;
-  scoped_ptr<AudioPlayer> audio_player_;
+  std::unique_ptr<AudioDecoder> decoder_;
+  std::unique_ptr<AudioPlayer> audio_player_;
 
   DISALLOW_COPY_AND_ASSIGN(Core);
 };
@@ -52,7 +53,7 @@
 AudioDecodeScheduler::Core::Core(
     scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
     scoped_refptr<base::SingleThreadTaskRunner> audio_decode_task_runner,
-    scoped_ptr<AudioPlayer> audio_player)
+    std::unique_ptr<AudioPlayer> audio_player)
     : main_task_runner_(main_task_runner),
       audio_decode_task_runner_(audio_decode_task_runner),
       audio_player_(std::move(audio_player)) {}
@@ -66,7 +67,7 @@
 }
 
 void AudioDecodeScheduler::Core::ProcessAudioPacket(
-    scoped_ptr<AudioPacket> packet,
+    std::unique_ptr<AudioPacket> packet,
     const base::Closure& done) {
   DCHECK(main_task_runner_->BelongsToCurrentThread());
   audio_decode_task_runner_->PostTask(FROM_HERE, base::Bind(
@@ -80,10 +81,11 @@
 }
 
 void AudioDecodeScheduler::Core::DecodePacket(
-    scoped_ptr<AudioPacket> packet,
+    std::unique_ptr<AudioPacket> packet,
     const base::Closure& done) {
   DCHECK(audio_decode_task_runner_->BelongsToCurrentThread());
-  scoped_ptr<AudioPacket> decoded_packet = decoder_->Decode(std::move(packet));
+  std::unique_ptr<AudioPacket> decoded_packet =
+      decoder_->Decode(std::move(packet));
 
   main_task_runner_->PostTask(FROM_HERE, base::Bind(
       &AudioDecodeScheduler::Core::ProcessDecodedPacket, this,
@@ -91,7 +93,7 @@
 }
 
 void AudioDecodeScheduler::Core::ProcessDecodedPacket(
-    scoped_ptr<AudioPacket> packet,
+    std::unique_ptr<AudioPacket> packet,
     const base::Closure& done) {
   DCHECK(main_task_runner_->BelongsToCurrentThread());
   // Only process |packet| if it is non-null.
@@ -103,10 +105,10 @@
 AudioDecodeScheduler::AudioDecodeScheduler(
     scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
     scoped_refptr<base::SingleThreadTaskRunner> audio_decode_task_runner,
-    scoped_ptr<AudioPlayer> audio_player)
-    : core_(new Core(main_task_runner, audio_decode_task_runner,
-                     std::move(audio_player))) {
-}
+    std::unique_ptr<AudioPlayer> audio_player)
+    : core_(new Core(main_task_runner,
+                     audio_decode_task_runner,
+                     std::move(audio_player))) {}
 
 AudioDecodeScheduler::~AudioDecodeScheduler() {
   core_->Detach();
@@ -116,8 +118,9 @@
   core_->Initialize(config);
 }
 
-void AudioDecodeScheduler::ProcessAudioPacket(scoped_ptr<AudioPacket> packet,
-                                              const base::Closure& done) {
+void AudioDecodeScheduler::ProcessAudioPacket(
+    std::unique_ptr<AudioPacket> packet,
+    const base::Closure& done) {
   core_->ProcessAudioPacket(std::move(packet), done);
 }
 
diff --git a/remoting/client/audio_decode_scheduler.h b/remoting/client/audio_decode_scheduler.h
index a3c3c3b..767342f0 100644
--- a/remoting/client/audio_decode_scheduler.h
+++ b/remoting/client/audio_decode_scheduler.h
@@ -5,9 +5,10 @@
 #ifndef REMOTING_CLIENT_AUDIO_DECODE_SCHEDULER_H_
 #define REMOTING_CLIENT_AUDIO_DECODE_SCHEDULER_H_
 
+#include <memory>
+
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "remoting/protocol/audio_stub.h"
 
 namespace base {
@@ -29,14 +30,14 @@
   AudioDecodeScheduler(
       scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
       scoped_refptr<base::SingleThreadTaskRunner> audio_decode_task_runner,
-      scoped_ptr<AudioPlayer> audio_player);
+      std::unique_ptr<AudioPlayer> audio_player);
   ~AudioDecodeScheduler() override;
 
   // Initializes decoder with the information from the protocol config.
   void Initialize(const protocol::SessionConfig& config);
 
   // AudioStub implementation.
-  void ProcessAudioPacket(scoped_ptr<AudioPacket> packet,
+  void ProcessAudioPacket(std::unique_ptr<AudioPacket> packet,
                           const base::Closure& done) override;
 
  private:
diff --git a/remoting/client/audio_player.cc b/remoting/client/audio_player.cc
index 7ae340c..249c20d 100644
--- a/remoting/client/audio_player.cc
+++ b/remoting/client/audio_player.cc
@@ -31,7 +31,7 @@
   ResetQueue();
 }
 
-void AudioPlayer::ProcessAudioPacket(scoped_ptr<AudioPacket> packet) {
+void AudioPlayer::ProcessAudioPacket(std::unique_ptr<AudioPacket> packet) {
   CHECK_EQ(1, packet->data_size());
   DCHECK_EQ(AudioPacket::ENCODING_RAW, packet->encoding());
   DCHECK_NE(AudioPacket::SAMPLING_RATE_INVALID, packet->sampling_rate());
diff --git a/remoting/client/audio_player.h b/remoting/client/audio_player.h
index 94de1b4..f88e6633 100644
--- a/remoting/client/audio_player.h
+++ b/remoting/client/audio_player.h
@@ -9,9 +9,9 @@
 #include <stdint.h>
 
 #include <list>
+#include <memory>
 
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/synchronization/lock.h"
 #include "remoting/proto/audio.pb.h"
 
@@ -21,7 +21,7 @@
  public:
   virtual ~AudioPlayer();
 
-  void ProcessAudioPacket(scoped_ptr<AudioPacket> packet);
+  void ProcessAudioPacket(std::unique_ptr<AudioPacket> packet);
 
  protected:
   AudioPlayer();
diff --git a/remoting/client/audio_player_unittest.cc b/remoting/client/audio_player_unittest.cc
index 1bfb86f..8ab50d4 100644
--- a/remoting/client/audio_player_unittest.cc
+++ b/remoting/client/audio_player_unittest.cc
@@ -6,8 +6,9 @@
 
 #include <stdint.h>
 
+#include <memory>
+
 #include "base/compiler_specific.h"
-#include "base/memory/scoped_ptr.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace {
@@ -82,13 +83,14 @@
     return static_cast<int>(audio_->bytes_consumed_);
   }
 
-  scoped_ptr<AudioPlayer> audio_;
-  scoped_ptr<char[]> buffer_;
+  std::unique_ptr<AudioPlayer> audio_;
+  std::unique_ptr<char[]> buffer_;
 };
 
-scoped_ptr<AudioPacket> CreatePacketWithSamplingRate(
-      AudioPacket::SamplingRate rate, int samples) {
-  scoped_ptr<AudioPacket> packet(new AudioPacket());
+std::unique_ptr<AudioPacket> CreatePacketWithSamplingRate(
+    AudioPacket::SamplingRate rate,
+    int samples) {
+  std::unique_ptr<AudioPacket> packet(new AudioPacket());
   packet->set_encoding(AudioPacket::ENCODING_RAW);
   packet->set_sampling_rate(rate);
   packet->set_bytes_per_sample(AudioPacket::BYTES_PER_SAMPLE_2);
@@ -102,12 +104,12 @@
   return packet;
 }
 
-scoped_ptr<AudioPacket> CreatePacket44100Hz(int samples) {
+std::unique_ptr<AudioPacket> CreatePacket44100Hz(int samples) {
   return CreatePacketWithSamplingRate(AudioPacket::SAMPLING_RATE_44100,
                                       samples);
 }
 
-scoped_ptr<AudioPacket> CreatePacket48000Hz(int samples) {
+std::unique_ptr<AudioPacket> CreatePacket48000Hz(int samples) {
   return CreatePacketWithSamplingRate(AudioPacket::SAMPLING_RATE_48000,
                                       samples);
 }
diff --git a/remoting/client/chromoting_client.cc b/remoting/client/chromoting_client.cc
index e51bc7b8..35aa71e 100644
--- a/remoting/client/chromoting_client.cc
+++ b/remoting/client/chromoting_client.cc
@@ -6,6 +6,7 @@
 
 #include <utility>
 
+#include "base/memory/ptr_util.h"
 #include "remoting/base/capabilities.h"
 #include "remoting/base/constants.h"
 #include "remoting/client/audio_decode_scheduler.h"
@@ -30,7 +31,7 @@
 ChromotingClient::ChromotingClient(ClientContext* client_context,
                                    ClientUserInterface* user_interface,
                                    protocol::VideoRenderer* video_renderer,
-                                   scoped_ptr<AudioPlayer> audio_player)
+                                   std::unique_ptr<AudioPlayer> audio_player)
     : user_interface_(user_interface), video_renderer_(video_renderer) {
   DCHECK(client_context->main_task_runner()->BelongsToCurrentThread());
   if (audio_player) {
@@ -46,12 +47,12 @@
 }
 
 void ChromotingClient::set_protocol_config(
-    scoped_ptr<protocol::CandidateSessionConfig> config) {
+    std::unique_ptr<protocol::CandidateSessionConfig> config) {
   protocol_config_ = std::move(config);
 }
 
 void ChromotingClient::SetConnectionToHostForTests(
-    scoped_ptr<protocol::ConnectionToHost> connection_to_host) {
+    std::unique_ptr<protocol::ConnectionToHost> connection_to_host) {
   connection_ = std::move(connection_to_host);
 }
 
@@ -239,7 +240,7 @@
   connection_->Connect(
       session_manager_->Connect(
           host_jid_,
-          make_scoped_ptr(new protocol::NegotiatingClientAuthenticator(
+          base::WrapUnique(new protocol::NegotiatingClientAuthenticator(
               NormalizeJid(signal_strategy_->GetLocalJid()), host_jid_,
               client_auth_config_))),
       transport_context_, this);
diff --git a/remoting/client/chromoting_client.h b/remoting/client/chromoting_client.h
index cba780d..f3ed9d8 100644
--- a/remoting/client/chromoting_client.h
+++ b/remoting/client/chromoting_client.h
@@ -7,11 +7,11 @@
 #ifndef REMOTING_CLIENT_CHROMOTING_CLIENT_H_
 #define REMOTING_CLIENT_CHROMOTING_CLIENT_H_
 
+#include <memory>
 #include <string>
 
 #include "base/callback.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "remoting/protocol/client_authentication_config.h"
 #include "remoting/protocol/client_stub.h"
 #include "remoting/protocol/clipboard_stub.h"
@@ -51,15 +51,16 @@
   ChromotingClient(ClientContext* client_context,
                    ClientUserInterface* user_interface,
                    protocol::VideoRenderer* video_renderer,
-                   scoped_ptr<AudioPlayer> audio_player);
+                   std::unique_ptr<AudioPlayer> audio_player);
 
   ~ChromotingClient() override;
 
-  void set_protocol_config(scoped_ptr<protocol::CandidateSessionConfig> config);
+  void set_protocol_config(
+      std::unique_ptr<protocol::CandidateSessionConfig> config);
 
   // Used to set fake/mock objects for tests which use the ChromotingClient.
   void SetConnectionToHostForTests(
-      scoped_ptr<protocol::ConnectionToHost> connection_to_host);
+      std::unique_ptr<protocol::ConnectionToHost> connection_to_host);
 
   // Start the client. Must be called on the main thread. |signal_strategy|
   // must outlive the client.
@@ -115,7 +116,7 @@
 
   base::ThreadChecker thread_checker_;
 
-  scoped_ptr<protocol::CandidateSessionConfig> protocol_config_;
+  std::unique_ptr<protocol::CandidateSessionConfig> protocol_config_;
 
   // The following are not owned by this class.
   ClientUserInterface* user_interface_ = nullptr;
@@ -126,10 +127,10 @@
   protocol::ClientAuthenticationConfig client_auth_config_;
   scoped_refptr<protocol::TransportContext> transport_context_;
 
-  scoped_ptr<protocol::SessionManager> session_manager_;
-  scoped_ptr<protocol::ConnectionToHost> connection_;
+  std::unique_ptr<protocol::SessionManager> session_manager_;
+  std::unique_ptr<protocol::ConnectionToHost> connection_;
 
-  scoped_ptr<AudioDecodeScheduler> audio_decode_scheduler_;
+  std::unique_ptr<AudioDecodeScheduler> audio_decode_scheduler_;
 
   std::string local_capabilities_;
 
diff --git a/remoting/client/chromoting_client_runtime.cc b/remoting/client/chromoting_client_runtime.cc
index db486f61..a603eea0 100644
--- a/remoting/client/chromoting_client_runtime.cc
+++ b/remoting/client/chromoting_client_runtime.cc
@@ -6,12 +6,13 @@
 
 #include "base/bind.h"
 #include "base/logging.h"
+#include "base/memory/ptr_util.h"
 #include "base/message_loop/message_loop.h"
 #include "remoting/base/url_request_context_getter.h"
 
 namespace remoting {
 
-scoped_ptr<ChromotingClientRuntime> ChromotingClientRuntime::Create(
+std::unique_ptr<ChromotingClientRuntime> ChromotingClientRuntime::Create(
     base::MessageLoopForUI* ui_loop) {
   DCHECK(ui_loop);
 
@@ -33,7 +34,7 @@
   scoped_refptr<net::URLRequestContextGetter> url_requester =
       new URLRequestContextGetter(network_task_runner, file_task_runner);
 
-  return make_scoped_ptr(new ChromotingClientRuntime(
+  return base::WrapUnique(new ChromotingClientRuntime(
       ui_task_runner, display_task_runner, network_task_runner,
       file_task_runner, url_requester));
 }
diff --git a/remoting/client/chromoting_client_runtime.h b/remoting/client/chromoting_client_runtime.h
index b9c45b6..69efb0d 100644
--- a/remoting/client/chromoting_client_runtime.h
+++ b/remoting/client/chromoting_client_runtime.h
@@ -5,8 +5,9 @@
 #ifndef REMOTING_CLIENT_CHROMOTING_CLIENT_RUNTIME_H_
 #define REMOTING_CLIENT_CHROMOTING_CLIENT_RUNTIME_H_
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "net/url_request/url_request_context_getter.h"
 #include "remoting/base/auto_thread.h"
 
@@ -28,17 +29,17 @@
   //
   //  base::MessageLoopForUI *ui_loop = new base::MessageLoopForUI();
   //  ui_loop_->Start();
-  //  scoped_ptr<ChromotingClientRuntime> runtime =
+  //  std::unique_ptr<ChromotingClientRuntime> runtime =
   //    ChromotingClientRuntime::Create(ui_loop);
   //
   // On iOS we created a new message loop and now attach it.
   //
   //  base::MessageLoopForUI *ui_loop = new base::MessageLoopForUI();
   //  ui_loop_->Attach();
-  //  scoped_ptr<ChromotingClientRuntime> runtime =
+  //  std::unique_ptr<ChromotingClientRuntime> runtime =
   //    ChromotingClientRuntime::Create(ui_loop);
   //
-  static scoped_ptr<ChromotingClientRuntime> Create(
+  static std::unique_ptr<ChromotingClientRuntime> Create(
       base::MessageLoopForUI* ui_loop);
 
   ~ChromotingClientRuntime();
diff --git a/remoting/client/chromoting_client_runtime_unittest.cc b/remoting/client/chromoting_client_runtime_unittest.cc
index 39f240fe1..e56f748 100644
--- a/remoting/client/chromoting_client_runtime_unittest.cc
+++ b/remoting/client/chromoting_client_runtime_unittest.cc
@@ -15,13 +15,13 @@
 // A simple test that starts and stop the runtime. This tests the runtime
 // operates properly and all threads and message loops are valid.
 TEST(ChromotingClientRuntimeTest, StartAndStop) {
-  scoped_ptr<base::MessageLoopForUI> ui_loop;
+  std::unique_ptr<base::MessageLoopForUI> ui_loop;
   ui_loop.reset(new base::MessageLoopForUI());
 #if defined(OS_IOS)
   ui_loop->Attach();
 #endif
 
-  scoped_ptr<ChromotingClientRuntime> runtime =
+  std::unique_ptr<ChromotingClientRuntime> runtime =
       ChromotingClientRuntime::Create(ui_loop.get());
 
   ASSERT_TRUE(runtime);
diff --git a/remoting/client/client_status_logger.cc b/remoting/client/client_status_logger.cc
index c7cc0fe..74a4a69 100644
--- a/remoting/client/client_status_logger.cc
+++ b/remoting/client/client_status_logger.cc
@@ -57,7 +57,7 @@
     protocol::ErrorCode error) {
   DCHECK(CalledOnValidThread());
 
-  scoped_ptr<ServerLogEntry> entry(
+  std::unique_ptr<ServerLogEntry> entry(
       MakeLogEntryForSessionStateChange(state, error));
   AddClientFieldsToLogEntry(entry.get());
   entry->AddModeField(log_to_server_.mode());
@@ -97,7 +97,8 @@
 
   MaybeExpireSessionId();
 
-  scoped_ptr<ServerLogEntry> entry(MakeLogEntryForStatistics(perf_tracker));
+  std::unique_ptr<ServerLogEntry> entry(
+      MakeLogEntryForStatistics(perf_tracker));
   AddClientFieldsToLogEntry(entry.get());
   entry->AddModeField(log_to_server_.mode());
   AddSessionIdToLogEntry(entry.get(), session_id_);
@@ -125,7 +126,8 @@
   base::TimeDelta max_age = base::TimeDelta::FromDays(kMaxSessionIdAgeDays);
   if (base::TimeTicks::Now() - session_id_generation_time_ > max_age) {
     // Log the old session ID.
-    scoped_ptr<ServerLogEntry> entry(MakeLogEntryForSessionIdOld(session_id_));
+    std::unique_ptr<ServerLogEntry> entry(
+        MakeLogEntryForSessionIdOld(session_id_));
     entry->AddModeField(log_to_server_.mode());
     log_to_server_.Log(*entry.get());
 
diff --git a/remoting/client/client_status_logger_unittest.cc b/remoting/client/client_status_logger_unittest.cc
index b1030195..145a0175 100644
--- a/remoting/client/client_status_logger_unittest.cc
+++ b/remoting/client/client_status_logger_unittest.cc
@@ -76,7 +76,7 @@
  protected:
   base::MessageLoop message_loop_;
   MockSignalStrategy signal_strategy_;
-  scoped_ptr<ClientStatusLogger> client_status_logger_;
+  std::unique_ptr<ClientStatusLogger> client_status_logger_;
 };
 
 TEST_F(ClientStatusLoggerTest, LogStateChange) {
diff --git a/remoting/client/client_user_interface.h b/remoting/client/client_user_interface.h
index 7b8edbe1..daf22b1c9 100644
--- a/remoting/client/client_user_interface.h
+++ b/remoting/client/client_user_interface.h
@@ -5,9 +5,9 @@
 #ifndef REMOTING_CLIENT_CLIENT_USER_INTERFACE_H_
 #define REMOTING_CLIENT_CLIENT_USER_INTERFACE_H_
 
+#include <memory>
 #include <string>
 
-#include "base/memory/scoped_ptr.h"
 #include "remoting/protocol/connection_to_host.h"
 #include "remoting/protocol/third_party_client_authenticator.h"
 
diff --git a/remoting/client/jni/android_keymap.h b/remoting/client/jni/android_keymap.h
index 5cfe555a..0ce0276 100644
--- a/remoting/client/jni/android_keymap.h
+++ b/remoting/client/jni/android_keymap.h
@@ -8,7 +8,7 @@
 #include <stddef.h>
 #include <stdint.h>
 
-#include "base/memory/scoped_ptr.h"
+#include <memory>
 
 namespace remoting {
 
diff --git a/remoting/client/jni/chromoting_jni_instance.cc b/remoting/client/jni/chromoting_jni_instance.cc
index 3d74d31..bbdda97 100644
--- a/remoting/client/jni/chromoting_jni_instance.cc
+++ b/remoting/client/jni/chromoting_jni_instance.cc
@@ -13,6 +13,7 @@
 #include "base/callback_helpers.h"
 #include "base/format_macros.h"
 #include "base/logging.h"
+#include "base/memory/ptr_util.h"
 #include "jingle/glue/thread_wrapper.h"
 #include "net/socket/client_socket_factory.h"
 #include "remoting/base/chromium_url_request.h"
@@ -408,8 +409,8 @@
   scoped_refptr<protocol::TransportContext> transport_context =
       new protocol::TransportContext(
           signaling_.get(),
-          make_scoped_ptr(new protocol::ChromiumPortAllocatorFactory()),
-          make_scoped_ptr(
+          base::WrapUnique(new protocol::ChromiumPortAllocatorFactory()),
+          base::WrapUnique(
               new ChromiumUrlRequestFactory(jni_runtime_->url_requester())),
           protocol::NetworkSettings(
               protocol::NetworkSettings::NAT_TRAVERSAL_FULL),
@@ -418,7 +419,7 @@
 #if defined(ENABLE_WEBRTC_REMOTING_CLIENT)
   if (flags_.find("useWebrtc") != std::string::npos) {
     VLOG(0) << "Attempting to connect using WebRTC.";
-    scoped_ptr<protocol::CandidateSessionConfig> protocol_config =
+    std::unique_ptr<protocol::CandidateSessionConfig> protocol_config =
         protocol::CandidateSessionConfig::CreateEmpty();
     protocol_config->set_webrtc_supported(true);
     protocol_config->set_ice_supported(false);
diff --git a/remoting/client/jni/chromoting_jni_instance.h b/remoting/client/jni/chromoting_jni_instance.h
index de12db5..da02627 100644
--- a/remoting/client/jni/chromoting_jni_instance.h
+++ b/remoting/client/jni/chromoting_jni_instance.h
@@ -5,11 +5,11 @@
 #ifndef REMOTING_CLIENT_CHROMOTING_JNI_INSTANCE_H_
 #define REMOTING_CLIENT_CHROMOTING_JNI_INSTANCE_H_
 
+#include <memory>
 #include <string>
 
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/message_loop/message_loop.h"
 #include "remoting/client/chromoting_client.h"
@@ -156,14 +156,14 @@
   std::string flags_;
 
   // This group of variables is to be used on the network thread.
-  scoped_ptr<ClientContext> client_context_;
-  scoped_ptr<protocol::PerformanceTracker> perf_tracker_;
-  scoped_ptr<JniFrameConsumer> view_;
-  scoped_ptr<protocol::VideoRenderer> video_renderer_;
-  scoped_ptr<ChromotingClient> client_;
+  std::unique_ptr<ClientContext> client_context_;
+  std::unique_ptr<protocol::PerformanceTracker> perf_tracker_;
+  std::unique_ptr<JniFrameConsumer> view_;
+  std::unique_ptr<protocol::VideoRenderer> video_renderer_;
+  std::unique_ptr<ChromotingClient> client_;
   XmppSignalStrategy::XmppServerConfig xmpp_config_;
-  scoped_ptr<XmppSignalStrategy> signaling_;  // Must outlive client_
-  scoped_ptr<ClientStatusLogger> client_status_logger_;
+  std::unique_ptr<XmppSignalStrategy> signaling_;  // Must outlive client_
+  std::unique_ptr<ClientStatusLogger> client_status_logger_;
   protocol::ThirdPartyTokenFetchedCallback third_party_token_fetched_callback_;
 
   // Pass this the user's PIN once we have it. To be assigned and accessed on
diff --git a/remoting/client/jni/chromoting_jni_runtime.h b/remoting/client/jni/chromoting_jni_runtime.h
index 8dedfcb..bb5a216 100644
--- a/remoting/client/jni/chromoting_jni_runtime.h
+++ b/remoting/client/jni/chromoting_jni_runtime.h
@@ -129,11 +129,11 @@
 
   // Chromium code's connection to the app message loop. Once created the
   // MessageLoop will live for the life of the program.
-  scoped_ptr<base::MessageLoopForUI> ui_loop_;
+  std::unique_ptr<base::MessageLoopForUI> ui_loop_;
 
   // Contains threads.
   //
-  scoped_ptr<ChromotingClientRuntime> runtime_;
+  std::unique_ptr<ChromotingClientRuntime> runtime_;
 
   // Contains all connection-specific state.
   scoped_refptr<ChromotingJniInstance> session_;
diff --git a/remoting/client/jni/jni_frame_consumer.cc b/remoting/client/jni/jni_frame_consumer.cc
index 066110c..1e3fc09 100644
--- a/remoting/client/jni/jni_frame_consumer.cc
+++ b/remoting/client/jni/jni_frame_consumer.cc
@@ -9,6 +9,7 @@
 #include "base/android/jni_android.h"
 #include "base/android/scoped_java_ref.h"
 #include "base/logging.h"
+#include "base/memory/ptr_util.h"
 #include "remoting/base/util.h"
 #include "remoting/client/jni/chromoting_jni_instance.h"
 #include "remoting/client/jni/chromoting_jni_runtime.h"
@@ -25,7 +26,7 @@
     DCHECK(jni_runtime_->display_task_runner()->BelongsToCurrentThread());
   }
 
-  void RenderFrame(scoped_ptr<webrtc::DesktopFrame> frame);
+  void RenderFrame(std::unique_ptr<webrtc::DesktopFrame> frame);
 
  private:
   // Used to obtain task runner references and make calls to Java methods.
@@ -39,12 +40,12 @@
 
   // Reference to the frame bitmap that is passed to Java when the frame is
   // allocated. This provides easy access to the underlying pixels.
-  scoped_ptr<gfx::JavaBitmap> bitmap_;
+  std::unique_ptr<gfx::JavaBitmap> bitmap_;
 };
 
 // Function called on the display thread to render the frame.
 void JniFrameConsumer::Renderer::RenderFrame(
-    scoped_ptr<webrtc::DesktopFrame> frame) {
+    std::unique_ptr<webrtc::DesktopFrame> frame) {
   DCHECK(jni_runtime_->display_task_runner()->BelongsToCurrentThread());
 
   if (!bitmap_ || bitmap_->size().width() != frame->size().width() ||
@@ -91,12 +92,12 @@
                                                   renderer_.release());
 }
 
-scoped_ptr<webrtc::DesktopFrame> JniFrameConsumer::AllocateFrame(
+std::unique_ptr<webrtc::DesktopFrame> JniFrameConsumer::AllocateFrame(
     const webrtc::DesktopSize& size) {
-  return make_scoped_ptr(new webrtc::BasicDesktopFrame(size));
+  return base::WrapUnique(new webrtc::BasicDesktopFrame(size));
 }
 
-void JniFrameConsumer::DrawFrame(scoped_ptr<webrtc::DesktopFrame> frame,
+void JniFrameConsumer::DrawFrame(std::unique_ptr<webrtc::DesktopFrame> frame,
                                  const base::Closure& done) {
   DCHECK(jni_runtime_->network_task_runner()->BelongsToCurrentThread());
 
diff --git a/remoting/client/jni/jni_frame_consumer.h b/remoting/client/jni/jni_frame_consumer.h
index e635032d..7a8ed63 100644
--- a/remoting/client/jni/jni_frame_consumer.h
+++ b/remoting/client/jni/jni_frame_consumer.h
@@ -6,10 +6,10 @@
 #define REMOTING_CLIENT_JNI_JNI_FRAME_CONSUMER_H_
 
 #include <list>
+#include <memory>
 
 #include "base/compiler_specific.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "remoting/protocol/frame_consumer.h"
 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
@@ -27,9 +27,9 @@
   ~JniFrameConsumer() override;
 
   // FrameConsumer implementation.
-  scoped_ptr<webrtc::DesktopFrame> AllocateFrame(
+  std::unique_ptr<webrtc::DesktopFrame> AllocateFrame(
       const webrtc::DesktopSize& size) override;
-  void DrawFrame(scoped_ptr<webrtc::DesktopFrame> frame,
+  void DrawFrame(std::unique_ptr<webrtc::DesktopFrame> frame,
                  const base::Closure& done) override;
   PixelFormat GetPixelFormat() override;
 
@@ -42,7 +42,7 @@
   ChromotingJniRuntime* jni_runtime_;
 
   // Renderer object used to render the frames on the display thread.
-  scoped_ptr<Renderer> renderer_;
+  std::unique_ptr<Renderer> renderer_;
 
   base::WeakPtrFactory<JniFrameConsumer> weak_factory_;
 
diff --git a/remoting/client/normalizing_input_filter_cros_unittest.cc b/remoting/client/normalizing_input_filter_cros_unittest.cc
index e0e4f7f1..fc839a4558 100644
--- a/remoting/client/normalizing_input_filter_cros_unittest.cc
+++ b/remoting/client/normalizing_input_filter_cros_unittest.cc
@@ -60,7 +60,7 @@
 // Test OSKey press/release.
 TEST(NormalizingInputFilterCrosTest, PressReleaseOsKey) {
   MockInputStub stub;
-  scoped_ptr<protocol::InputFilter> processor(
+  std::unique_ptr<protocol::InputFilter> processor(
       new NormalizingInputFilterCros(&stub));
 
   {
@@ -85,7 +85,7 @@
 // Test OSKey key repeat switches it to "modifying" mode.
 TEST(NormalizingInputFilterCrosTest, OSKeyRepeats) {
   MockInputStub stub;
-  scoped_ptr<protocol::InputFilter> processor(
+  std::unique_ptr<protocol::InputFilter> processor(
       new NormalizingInputFilterCros(&stub));
 
   {
@@ -110,7 +110,7 @@
 // just the function key events.
 TEST(NormalizingInputFilterCrosTest, FunctionKey) {
   MockInputStub stub;
-  scoped_ptr<protocol::InputFilter> processor(
+  std::unique_ptr<protocol::InputFilter> processor(
       new NormalizingInputFilterCros(&stub));
 
   {
@@ -132,7 +132,7 @@
 // just the function key events.
 TEST(NormalizingInputFilterCrosTest, ExtendedKey) {
   MockInputStub stub;
-  scoped_ptr<protocol::InputFilter> processor(
+  std::unique_ptr<protocol::InputFilter> processor(
       new NormalizingInputFilterCros(&stub));
 
   {
@@ -155,7 +155,7 @@
 // test.
 TEST(NormalizingInputFilterCrosTest, OtherKey) {
   MockInputStub stub;
-  scoped_ptr<protocol::InputFilter> processor(
+  std::unique_ptr<protocol::InputFilter> processor(
       new NormalizingInputFilterCros(&stub));
 
   {
@@ -181,7 +181,7 @@
 // results in OSKey switching to modifying mode for the normal key.
 TEST(NormalizingInputFilterCrosTest, ExtendedThenOtherKey) {
   MockInputStub stub;
-  scoped_ptr<protocol::InputFilter> processor(
+  std::unique_ptr<protocol::InputFilter> processor(
       new NormalizingInputFilterCros(&stub));
 
   {
@@ -211,7 +211,7 @@
 // Test OSKey press followed by mouse event puts the OSKey into modifying mode.
 TEST(NormalizingInputFilterCrosTest, MouseEvent) {
   MockInputStub stub;
-  scoped_ptr<protocol::InputFilter> processor(
+  std::unique_ptr<protocol::InputFilter> processor(
       new NormalizingInputFilterCros(&stub));
 
   {
@@ -233,7 +233,7 @@
 // Test left alt + right click is remapped to left alt + left click.
 TEST(NormalizingInputFilterCrosTest, LeftAltClick) {
   MockInputStub stub;
-  scoped_ptr<protocol::InputFilter> processor(
+  std::unique_ptr<protocol::InputFilter> processor(
       new NormalizingInputFilterCros(&stub));
 
   {
@@ -262,7 +262,7 @@
 // Test that right alt + right click is unchanged.
 TEST(NormalizingInputFilterCrosTest, RightAltClick) {
   MockInputStub stub;
-  scoped_ptr<protocol::InputFilter> processor(
+  std::unique_ptr<protocol::InputFilter> processor(
       new NormalizingInputFilterCros(&stub));
 
   {
@@ -291,7 +291,7 @@
 // Test that the Alt-key remapping for Up and Down is not applied.
 TEST(NormalizingInputFilterCrosTest, UndoAltPlusArrowRemapping) {
   MockInputStub stub;
-  scoped_ptr<protocol::InputFilter> processor(
+  std::unique_ptr<protocol::InputFilter> processor(
       new NormalizingInputFilterCros(&stub));
 
   {
diff --git a/remoting/client/normalizing_input_filter_mac_unittest.cc b/remoting/client/normalizing_input_filter_mac_unittest.cc
index ce5ff53..a1f86afc 100644
--- a/remoting/client/normalizing_input_filter_mac_unittest.cc
+++ b/remoting/client/normalizing_input_filter_mac_unittest.cc
@@ -37,7 +37,7 @@
 // Test CapsLock press/release.
 TEST(NormalizingInputFilterMacTest, CapsLock) {
   MockInputStub stub;
-  scoped_ptr<protocol::InputFilter> processor(
+  std::unique_ptr<protocol::InputFilter> processor(
       new NormalizingInputFilterMac(&stub));
 
   {
@@ -57,7 +57,7 @@
 // Test without pressing command key.
 TEST(NormalizingInputFilterMacTest, NoInjection) {
   MockInputStub stub;
-  scoped_ptr<protocol::InputFilter> processor(
+  std::unique_ptr<protocol::InputFilter> processor(
       new NormalizingInputFilterMac(&stub));
 
   {
@@ -77,7 +77,7 @@
 // Test pressing command key and other normal keys.
 TEST(NormalizingInputFilterMacTest, CmdKey) {
   MockInputStub stub;
-  scoped_ptr<protocol::InputFilter> processor(
+  std::unique_ptr<protocol::InputFilter> processor(
       new NormalizingInputFilterMac(&stub));
 
   {
@@ -138,7 +138,7 @@
 // Test pressing command and special keys.
 TEST(NormalizingInputFilterMacTest, SpecialKeys) {
   MockInputStub stub;
-  scoped_ptr<protocol::InputFilter> processor(
+  std::unique_ptr<protocol::InputFilter> processor(
       new NormalizingInputFilterMac(&stub));
 
   {
@@ -181,7 +181,7 @@
 // Test pressing multiple command keys.
 TEST(NormalizingInputFilterMacTest, MultipleCmdKeys) {
   MockInputStub stub;
-  scoped_ptr<protocol::InputFilter> processor(
+  std::unique_ptr<protocol::InputFilter> processor(
       new NormalizingInputFilterMac(&stub));
 
   {
@@ -210,7 +210,7 @@
 // Test press C key before command key.
 TEST(NormalizingInputFilterMacTest, BeforeCmdKey) {
   MockInputStub stub;
-  scoped_ptr<protocol::InputFilter> processor(
+  std::unique_ptr<protocol::InputFilter> processor(
       new NormalizingInputFilterMac(&stub));
 
   {
diff --git a/remoting/client/plugin/chromoting_instance.cc b/remoting/client/plugin/chromoting_instance.cc
index 20142d71..dea1613f 100644
--- a/remoting/client/plugin/chromoting_instance.cc
+++ b/remoting/client/plugin/chromoting_instance.cc
@@ -18,6 +18,7 @@
 #include "base/json/json_writer.h"
 #include "base/lazy_instance.h"
 #include "base/logging.h"
+#include "base/memory/ptr_util.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_split.h"
 #include "base/strings/stringprintf.h"
@@ -189,7 +190,7 @@
   rtc::InitRandom(random_seed, sizeof(random_seed));
 
   // Send hello message.
-  PostLegacyJsonMessage("hello", make_scoped_ptr(new base::DictionaryValue()));
+  PostLegacyJsonMessage("hello", base::WrapUnique(new base::DictionaryValue()));
 }
 
 ChromotingInstance::~ChromotingInstance() {
@@ -226,7 +227,7 @@
     return;
   }
 
-  scoped_ptr<base::Value> json = base::JSONReader::Read(
+  std::unique_ptr<base::Value> json = base::JSONReader::Read(
       message.AsString(), base::JSON_ALLOW_TRAILING_COMMAS);
   base::DictionaryValue* message_dict = nullptr;
   std::string method;
@@ -338,16 +339,16 @@
 
 void ChromotingInstance::OnVideoFirstFrameReceived() {
   PostLegacyJsonMessage("onFirstFrameReceived",
-                        make_scoped_ptr(new base::DictionaryValue()));
+                        base::WrapUnique(new base::DictionaryValue()));
 }
 
 void ChromotingInstance::OnVideoFrameDirtyRegion(
     const webrtc::DesktopRegion& dirty_region) {
-  scoped_ptr<base::ListValue> rects_value(new base::ListValue());
+  std::unique_ptr<base::ListValue> rects_value(new base::ListValue());
   for (webrtc::DesktopRegion::Iterator i(dirty_region); !i.IsAtEnd();
        i.Advance()) {
     const webrtc::DesktopRect& rect = i.rect();
-    scoped_ptr<base::ListValue> rect_value(new base::ListValue());
+    std::unique_ptr<base::ListValue> rect_value(new base::ListValue());
     rect_value->AppendInteger(rect.left());
     rect_value->AppendInteger(rect.top());
     rect_value->AppendInteger(rect.width());
@@ -355,7 +356,7 @@
     rects_value->Append(rect_value.release());
   }
 
-  scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
+  std::unique_ptr<base::DictionaryValue> data(new base::DictionaryValue());
   data->Set("rects", rects_value.release());
   PostLegacyJsonMessage("onDebugRegion", std::move(data));
 }
@@ -414,7 +415,7 @@
       break;
   }
 
-  scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
+  std::unique_ptr<base::DictionaryValue> data(new base::DictionaryValue());
   data->SetString("state", protocol::ConnectionToHost::StateToString(state));
   data->SetString("error", ConnectionErrorToString(error));
   PostLegacyJsonMessage("onConnectionStatus", std::move(data));
@@ -430,7 +431,7 @@
   // So, it's impossible to reach this with a callback already registered.
   DCHECK(third_party_token_fetched_callback_.is_null());
   third_party_token_fetched_callback_ = token_fetched_callback;
-  scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
+  std::unique_ptr<base::DictionaryValue> data(new base::DictionaryValue());
   data->SetString("tokenUrl", token_url);
   data->SetString("hostPublicKey", host_public_key);
   data->SetString("scope", scope);
@@ -438,14 +439,14 @@
 }
 
 void ChromotingInstance::OnConnectionReady(bool ready) {
-  scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
+  std::unique_ptr<base::DictionaryValue> data(new base::DictionaryValue());
   data->SetBoolean("ready", ready);
   PostLegacyJsonMessage("onConnectionReady", std::move(data));
 }
 
 void ChromotingInstance::OnRouteChanged(const std::string& channel_name,
                                         const protocol::TransportRoute& route) {
-  scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
+  std::unique_ptr<base::DictionaryValue> data(new base::DictionaryValue());
   data->SetString("channel", channel_name);
   data->SetString("connectionType",
                   protocol::TransportRoute::GetTypeString(route.type));
@@ -453,14 +454,14 @@
 }
 
 void ChromotingInstance::SetCapabilities(const std::string& capabilities) {
-  scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
+  std::unique_ptr<base::DictionaryValue> data(new base::DictionaryValue());
   data->SetString("capabilities", capabilities);
   PostLegacyJsonMessage("setCapabilities", std::move(data));
 }
 
 void ChromotingInstance::SetPairingResponse(
     const protocol::PairingResponse& pairing_response) {
-  scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
+  std::unique_ptr<base::DictionaryValue> data(new base::DictionaryValue());
   data->SetString("clientId", pairing_response.client_id());
   data->SetString("sharedSecret", pairing_response.shared_secret());
   PostLegacyJsonMessage("pairingResponse", std::move(data));
@@ -468,7 +469,7 @@
 
 void ChromotingInstance::DeliverHostMessage(
     const protocol::ExtensionMessage& message) {
-  scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
+  std::unique_ptr<base::DictionaryValue> data(new base::DictionaryValue());
   data->SetString("type", message.type());
   data->SetString("data", message.data());
   PostLegacyJsonMessage("extensionMessage", std::move(data));
@@ -481,7 +482,7 @@
   mouse_input_filter_.set_output_size(size);
   touch_input_scaler_.set_output_size(size);
 
-  scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
+  std::unique_ptr<base::DictionaryValue> data(new base::DictionaryValue());
   data->SetInteger("width", size.width());
   data->SetInteger("height", size.height());
   data->SetInteger("x_dpi", dpi.x());
@@ -497,7 +498,7 @@
   // So, it's impossible to reach this with a callback already registered.
   DCHECK(secret_fetched_callback_.is_null());
   secret_fetched_callback_ = secret_fetched_callback;
-  scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
+  std::unique_ptr<base::DictionaryValue> data(new base::DictionaryValue());
   data->SetBoolean("pairingSupported", pairing_supported);
   PostLegacyJsonMessage("fetchPin", std::move(data));
 }
@@ -521,7 +522,7 @@
 
 void ChromotingInstance::InjectClipboardEvent(
     const protocol::ClipboardEvent& event) {
-  scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
+  std::unique_ptr<base::DictionaryValue> data(new base::DictionaryValue());
   data->SetString("mimeType", event.mime_type());
   data->SetString("item", event.data());
   PostLegacyJsonMessage("injectClipboardItem", std::move(data));
@@ -656,7 +657,7 @@
 
   client_.reset(
       new ChromotingClient(&context_, this, video_renderer_.get(),
-                           make_scoped_ptr(new PepperAudioPlayer(this))));
+                           base::WrapUnique(new PepperAudioPlayer(this))));
 
   // Setup the signal strategy.
   signal_strategy_.reset(new DelegatingSignalStrategy(
@@ -667,13 +668,13 @@
   scoped_refptr<protocol::TransportContext> transport_context(
       new protocol::TransportContext(
           signal_strategy_.get(),
-          make_scoped_ptr(new PepperPortAllocatorFactory(this)),
-          make_scoped_ptr(new PepperUrlRequestFactory(this)),
+          base::WrapUnique(new PepperPortAllocatorFactory(this)),
+          base::WrapUnique(new PepperUrlRequestFactory(this)),
           protocol::NetworkSettings(
               protocol::NetworkSettings::NAT_TRAVERSAL_FULL),
           protocol::TransportRole::CLIENT));
 
-  scoped_ptr<protocol::CandidateSessionConfig> config =
+  std::unique_ptr<protocol::CandidateSessionConfig> config =
       protocol::CandidateSessionConfig::CreateDefault();
   if (std::find(experiments_list.begin(), experiments_list.end(), "vp9") !=
       experiments_list.end()) {
@@ -981,7 +982,7 @@
 
 void ChromotingInstance::PostLegacyJsonMessage(
     const std::string& method,
-    scoped_ptr<base::DictionaryValue> data) {
+    std::unique_ptr<base::DictionaryValue> data) {
   base::DictionaryValue message;
   message.SetString("method", method);
   message.Set("data", data.release());
@@ -992,14 +993,14 @@
 }
 
 void ChromotingInstance::SendTrappedKey(uint32_t usb_keycode, bool pressed) {
-  scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
+  std::unique_ptr<base::DictionaryValue> data(new base::DictionaryValue());
   data->SetInteger("usbKeycode", usb_keycode);
   data->SetBoolean("pressed", pressed);
   PostLegacyJsonMessage("trappedKeyEvent", std::move(data));
 }
 
 void ChromotingInstance::SendOutgoingIq(const std::string& iq) {
-  scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
+  std::unique_ptr<base::DictionaryValue> data(new base::DictionaryValue());
   data->SetString("iq", iq);
   PostLegacyJsonMessage("sendOutgoingIq", std::move(data));
 }
@@ -1007,7 +1008,7 @@
 void ChromotingInstance::UpdatePerfStatsInUI() {
   // Fetch performance stats from the VideoRenderer and send them to the client
   // for display to users.
-  scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
+  std::unique_ptr<base::DictionaryValue> data(new base::DictionaryValue());
   data->SetDouble("videoBandwidth", perf_tracker_.video_bandwidth());
   data->SetDouble("videoFrameRate", perf_tracker_.video_frame_rate());
   data->SetDouble("captureLatency", perf_tracker_.video_capture_ms().Average());
diff --git a/remoting/client/plugin/chromoting_instance.h b/remoting/client/plugin/chromoting_instance.h
index 84bc1eeb..147c833 100644
--- a/remoting/client/plugin/chromoting_instance.h
+++ b/remoting/client/plugin/chromoting_instance.h
@@ -8,10 +8,10 @@
 #include <stddef.h>
 #include <stdint.h>
 
+#include <memory>
 #include <string>
 
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/thread_task_runner_handle.h"
 #include "ppapi/c/pp_instance.h"
@@ -222,7 +222,7 @@
   // TODO(sergeyu): When all current versions of the webapp support raw messages
   // remove this method and use PostChromotingMessage() instead.
   void PostLegacyJsonMessage(const std::string& method,
-                             scoped_ptr<base::DictionaryValue> data);
+                             std::unique_ptr<base::DictionaryValue> data);
 
   // Posts trapped keys to the web-app to handle.
   void SendTrappedKey(uint32_t usb_keycode, bool pressed);
@@ -244,25 +244,25 @@
   bool initialized_;
 
   scoped_refptr<base::SingleThreadTaskRunner> plugin_task_runner_;
-  scoped_ptr<base::ThreadTaskRunnerHandle> thread_task_runner_handle_;
-  scoped_ptr<jingle_glue::JingleThreadWrapper> thread_wrapper_;
+  std::unique_ptr<base::ThreadTaskRunnerHandle> thread_task_runner_handle_;
+  std::unique_ptr<jingle_glue::JingleThreadWrapper> thread_wrapper_;
   ClientContext context_;
   protocol::PerformanceTracker perf_tracker_;
-  scoped_ptr<PepperVideoRenderer> video_renderer_;
+  std::unique_ptr<PepperVideoRenderer> video_renderer_;
   pp::View plugin_view_;
 
   // Contains the most-recently-reported desktop shape, if any.
-  scoped_ptr<webrtc::DesktopRegion> desktop_shape_;
+  std::unique_ptr<webrtc::DesktopRegion> desktop_shape_;
 
-  scoped_ptr<DelegatingSignalStrategy> signal_strategy_;
+  std::unique_ptr<DelegatingSignalStrategy> signal_strategy_;
 
-  scoped_ptr<ChromotingClient> client_;
+  std::unique_ptr<ChromotingClient> client_;
 
   // Input pipeline components, in reverse order of distance from input source.
   protocol::MouseInputFilter mouse_input_filter_;
   TouchInputScaler touch_input_scaler_;
   KeyEventMapper key_mapper_;
-  scoped_ptr<protocol::InputFilter> normalizing_input_filter_;
+  std::unique_ptr<protocol::InputFilter> normalizing_input_filter_;
   protocol::InputEventTracker input_tracker_;
   PepperInputHandler input_handler_;
 
@@ -270,7 +270,7 @@
   // process cursor shape events. Note that |mouse_locker_| appears in the
   // cursor pipeline since it is triggered by receipt of an empty cursor.
   PepperCursorSetter cursor_setter_;
-  scoped_ptr<PepperMouseLocker> mouse_locker_;
+  std::unique_ptr<PepperMouseLocker> mouse_locker_;
   EmptyCursorFilter empty_cursor_filter_;
 
   // Used to control text input settings, such as whether to show the IME.
diff --git a/remoting/client/plugin/delegating_signal_strategy.cc b/remoting/client/plugin/delegating_signal_strategy.cc
index bb4bd93..bc86f41 100644
--- a/remoting/client/plugin/delegating_signal_strategy.cc
+++ b/remoting/client/plugin/delegating_signal_strategy.cc
@@ -21,7 +21,7 @@
 }
 
 void DelegatingSignalStrategy::OnIncomingMessage(const std::string& message) {
- scoped_ptr<buzz::XmlElement> stanza(buzz::XmlElement::ForStr(message));
+  std::unique_ptr<buzz::XmlElement> stanza(buzz::XmlElement::ForStr(message));
   if (!stanza.get()) {
     LOG(WARNING) << "Malformed XMPP stanza received: " << message;
     return;
@@ -61,7 +61,8 @@
   listeners_.RemoveObserver(listener);
 }
 
-bool DelegatingSignalStrategy::SendStanza(scoped_ptr<buzz::XmlElement> stanza) {
+bool DelegatingSignalStrategy::SendStanza(
+    std::unique_ptr<buzz::XmlElement> stanza) {
   send_iq_callback_.Run(stanza->Str());
   return true;
 }
diff --git a/remoting/client/plugin/delegating_signal_strategy.h b/remoting/client/plugin/delegating_signal_strategy.h
index 6f87856..9a9096f 100644
--- a/remoting/client/plugin/delegating_signal_strategy.h
+++ b/remoting/client/plugin/delegating_signal_strategy.h
@@ -34,7 +34,7 @@
   std::string GetLocalJid() const override;
   void AddListener(Listener* listener) override;
   void RemoveListener(Listener* listener) override;
-  bool SendStanza(scoped_ptr<buzz::XmlElement> stanza) override;
+  bool SendStanza(std::unique_ptr<buzz::XmlElement> stanza) override;
   std::string GetNextId() override;
 
  private:
diff --git a/remoting/client/plugin/pepper_input_handler.h b/remoting/client/plugin/pepper_input_handler.h
index 1d07c9f..a42634a 100644
--- a/remoting/client/plugin/pepper_input_handler.h
+++ b/remoting/client/plugin/pepper_input_handler.h
@@ -5,8 +5,9 @@
 #ifndef REMOTING_CLIENT_PLUGIN_PEPPER_INPUT_HANDLER_H_
 #define REMOTING_CLIENT_PLUGIN_PEPPER_INPUT_HANDLER_H_
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 
 namespace pp {
 class InputEvent;
diff --git a/remoting/client/plugin/pepper_mouse_locker.h b/remoting/client/plugin/pepper_mouse_locker.h
index 5e54dd2..b1b3c04a 100644
--- a/remoting/client/plugin/pepper_mouse_locker.h
+++ b/remoting/client/plugin/pepper_mouse_locker.h
@@ -5,9 +5,10 @@
 #ifndef REMOTING_CLIENT_PLUGIN_PEPPER_MOUSE_LOCKER_H_
 #define REMOTING_CLIENT_PLUGIN_PEPPER_MOUSE_LOCKER_H_
 
+#include <memory>
+
 #include "base/callback.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "ppapi/cpp/mouse_lock.h"
 #include "ppapi/utility/completion_callback_factory.h"
 #include "remoting/protocol/cursor_shape_stub.h"
@@ -67,7 +68,7 @@
   protocol::CursorShapeStub* cursor_stub_;
 
   // Copy of the most-recently-set cursor, to set when mouse-lock is cancelled.
-  scoped_ptr<protocol::CursorShapeInfo> cursor_shape_;
+  std::unique_ptr<protocol::CursorShapeInfo> cursor_shape_;
 
   // Used to create PPAPI callbacks that will be abandoned when |this| is
   // deleted.
diff --git a/remoting/client/plugin/pepper_packet_socket_factory.cc b/remoting/client/plugin/pepper_packet_socket_factory.cc
index 9735d013..d8b8dd7 100644
--- a/remoting/client/plugin/pepper_packet_socket_factory.cc
+++ b/remoting/client/plugin/pepper_packet_socket_factory.cc
@@ -414,7 +414,7 @@
     const rtc::SocketAddress& local_address,
     uint16_t min_port,
     uint16_t max_port) {
-  scoped_ptr<UdpPacketSocket> result(new UdpPacketSocket(pp_instance_));
+  std::unique_ptr<UdpPacketSocket> result(new UdpPacketSocket(pp_instance_));
   if (!result->Init(local_address, min_port, max_port))
     return nullptr;
   return result.release();
diff --git a/remoting/client/plugin/pepper_port_allocator_factory.cc b/remoting/client/plugin/pepper_port_allocator_factory.cc
index 1209c80..062fc59 100644
--- a/remoting/client/plugin/pepper_port_allocator_factory.cc
+++ b/remoting/client/plugin/pepper_port_allocator_factory.cc
@@ -4,6 +4,7 @@
 
 #include "remoting/client/plugin/pepper_port_allocator_factory.h"
 
+#include "base/memory/ptr_util.h"
 #include "remoting/client/plugin/pepper_network_manager.h"
 #include "remoting/client/plugin/pepper_packet_socket_factory.h"
 #include "remoting/protocol/port_allocator.h"
@@ -17,12 +18,12 @@
 
 PepperPortAllocatorFactory::~PepperPortAllocatorFactory() {}
 
-scoped_ptr<cricket::PortAllocator>
+std::unique_ptr<cricket::PortAllocator>
 PepperPortAllocatorFactory::CreatePortAllocator(
     scoped_refptr<protocol::TransportContext> transport_context) {
-  return make_scoped_ptr(new protocol::PortAllocator(
-      make_scoped_ptr(new PepperNetworkManager(pp_instance_)),
-      make_scoped_ptr(new PepperPacketSocketFactory(pp_instance_)),
+  return base::WrapUnique(new protocol::PortAllocator(
+      base::WrapUnique(new PepperNetworkManager(pp_instance_)),
+      base::WrapUnique(new PepperPacketSocketFactory(pp_instance_)),
       transport_context));
 }
 
diff --git a/remoting/client/plugin/pepper_port_allocator_factory.h b/remoting/client/plugin/pepper_port_allocator_factory.h
index 566817d..eb27d8ea 100644
--- a/remoting/client/plugin/pepper_port_allocator_factory.h
+++ b/remoting/client/plugin/pepper_port_allocator_factory.h
@@ -5,9 +5,10 @@
 #ifndef REMOTING_CLIENT_PLUGIN_PEPPER_PORT_ALLOCATOR_FACTORY_H_
 #define REMOTING_CLIENT_PLUGIN_PEPPER_PORT_ALLOCATOR_FACTORY_H_
 
+#include <memory>
+
 #include "base/compiler_specific.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "ppapi/cpp/instance_handle.h"
 #include "remoting/protocol/port_allocator_factory.h"
 
@@ -19,7 +20,7 @@
   ~PepperPortAllocatorFactory() override;
 
    // PortAllocatorFactory interface.
-  scoped_ptr<cricket::PortAllocator> CreatePortAllocator(
+  std::unique_ptr<cricket::PortAllocator> CreatePortAllocator(
       scoped_refptr<protocol::TransportContext> transport_context) override;
 
  private:
diff --git a/remoting/client/plugin/pepper_url_request.cc b/remoting/client/plugin/pepper_url_request.cc
index 31f3ef8e..a2b2f92 100644
--- a/remoting/client/plugin/pepper_url_request.cc
+++ b/remoting/client/plugin/pepper_url_request.cc
@@ -6,6 +6,7 @@
 
 #include "base/callback_helpers.h"
 #include "base/logging.h"
+#include "base/memory/ptr_util.h"
 #include "ppapi/cpp/url_response_info.h"
 
 // Read buffer we allocate per read when reading response from
@@ -107,10 +108,10 @@
     : pp_instance_(pp_instance) {}
 PepperUrlRequestFactory::~PepperUrlRequestFactory() {}
 
-scoped_ptr<UrlRequest> PepperUrlRequestFactory::CreateUrlRequest(
+std::unique_ptr<UrlRequest> PepperUrlRequestFactory::CreateUrlRequest(
     UrlRequest::Type type,
     const std::string& url) {
-  return make_scoped_ptr(new PepperUrlRequest(pp_instance_, type, url));
+  return base::WrapUnique(new PepperUrlRequest(pp_instance_, type, url));
 }
 
 }  // namespace remoting
diff --git a/remoting/client/plugin/pepper_url_request.h b/remoting/client/plugin/pepper_url_request.h
index 67b299de..e666aca5 100644
--- a/remoting/client/plugin/pepper_url_request.h
+++ b/remoting/client/plugin/pepper_url_request.h
@@ -54,8 +54,8 @@
   ~PepperUrlRequestFactory() override;
 
    // UrlRequestFactory interface.
-  scoped_ptr<UrlRequest> CreateUrlRequest(UrlRequest::Type type,
-                                          const std::string& url) override;
+  std::unique_ptr<UrlRequest> CreateUrlRequest(UrlRequest::Type type,
+                                               const std::string& url) override;
 
  private:
   pp::InstanceHandle pp_instance_;
diff --git a/remoting/client/plugin/pepper_video_renderer_2d.cc b/remoting/client/plugin/pepper_video_renderer_2d.cc
index 8ff3252..120b330 100644
--- a/remoting/client/plugin/pepper_video_renderer_2d.cc
+++ b/remoting/client/plugin/pepper_video_renderer_2d.cc
@@ -10,6 +10,7 @@
 
 #include "base/bind.h"
 #include "base/callback_helpers.h"
+#include "base/memory/ptr_util.h"
 #include "base/strings/string_util.h"
 #include "base/task_runner_util.h"
 #include "ppapi/cpp/completion_callback.h"
@@ -120,17 +121,18 @@
   return software_video_renderer_->GetFrameConsumer();
 }
 
-scoped_ptr<webrtc::DesktopFrame> PepperVideoRenderer2D::AllocateFrame(
+std::unique_ptr<webrtc::DesktopFrame> PepperVideoRenderer2D::AllocateFrame(
     const webrtc::DesktopSize& size) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
   pp::ImageData buffer_data(instance_, PP_IMAGEDATAFORMAT_BGRA_PREMUL,
                             pp::Size(size.width(), size.height()), false);
-  return make_scoped_ptr(new PepperDesktopFrame(buffer_data));
+  return base::WrapUnique(new PepperDesktopFrame(buffer_data));
 }
 
-void PepperVideoRenderer2D::DrawFrame(scoped_ptr<webrtc::DesktopFrame> frame,
-                                      const base::Closure& done) {
+void PepperVideoRenderer2D::DrawFrame(
+    std::unique_ptr<webrtc::DesktopFrame> frame,
+    const base::Closure& done) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
   if (!frame_received_) {
diff --git a/remoting/client/plugin/pepper_video_renderer_2d.h b/remoting/client/plugin/pepper_video_renderer_2d.h
index f4580fa..e772998 100644
--- a/remoting/client/plugin/pepper_video_renderer_2d.h
+++ b/remoting/client/plugin/pepper_video_renderer_2d.h
@@ -58,9 +58,9 @@
 
  private:
   // protocol::FrameConsumer implementation.
-  scoped_ptr<webrtc::DesktopFrame> AllocateFrame(
+  std::unique_ptr<webrtc::DesktopFrame> AllocateFrame(
       const webrtc::DesktopSize& size) override;
-  void DrawFrame(scoped_ptr<webrtc::DesktopFrame> frame,
+  void DrawFrame(std::unique_ptr<webrtc::DesktopFrame> frame,
                  const base::Closure& done) override;
   PixelFormat GetPixelFormat() override;
 
@@ -74,7 +74,7 @@
 
   pp::Graphics2D graphics2d_;
 
-  scoped_ptr<SoftwareVideoRenderer> software_video_renderer_;
+  std::unique_ptr<SoftwareVideoRenderer> software_video_renderer_;
 
   // View size in output pixels.
   webrtc::DesktopSize view_size_;
diff --git a/remoting/client/plugin/pepper_video_renderer_3d.cc b/remoting/client/plugin/pepper_video_renderer_3d.cc
index 389c05c..80020882 100644
--- a/remoting/client/plugin/pepper_video_renderer_3d.cc
+++ b/remoting/client/plugin/pepper_video_renderer_3d.cc
@@ -35,7 +35,7 @@
 
 class PepperVideoRenderer3D::PendingPacket {
  public:
-  PendingPacket(scoped_ptr<VideoPacket> packet, const base::Closure& done)
+  PendingPacket(std::unique_ptr<VideoPacket> packet, const base::Closure& done)
       : packet_(std::move(packet)), done_runner_(done) {}
 
   ~PendingPacket() {}
@@ -43,7 +43,7 @@
   const VideoPacket* packet() const { return packet_.get(); }
 
  private:
-  scoped_ptr<VideoPacket> packet_;
+  std::unique_ptr<VideoPacket> packet_;
   base::ScopedClosureRunner done_runner_;
 };
 
@@ -186,8 +186,9 @@
   return nullptr;
 }
 
-void PepperVideoRenderer3D::ProcessVideoPacket(scoped_ptr<VideoPacket> packet,
-                                               const base::Closure& done) {
+void PepperVideoRenderer3D::ProcessVideoPacket(
+    std::unique_ptr<VideoPacket> packet,
+    const base::Closure& done) {
   base::ScopedClosureRunner done_runner(done);
 
   perf_tracker_->RecordVideoPacketStats(*packet);
diff --git a/remoting/client/plugin/pepper_video_renderer_3d.h b/remoting/client/plugin/pepper_video_renderer_3d.h
index 529f946a..d621ffac 100644
--- a/remoting/client/plugin/pepper_video_renderer_3d.h
+++ b/remoting/client/plugin/pepper_video_renderer_3d.h
@@ -8,11 +8,11 @@
 #include <stdint.h>
 
 #include <deque>
+#include <memory>
 #include <string>
 
 #include "base/callback.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "ppapi/cpp/graphics_3d.h"
 #include "ppapi/cpp/instance_handle.h"
 #include "ppapi/cpp/video_decoder.h"
@@ -47,7 +47,7 @@
   protocol::FrameConsumer* GetFrameConsumer() override;
 
   // protocol::VideoStub interface.
-  void ProcessVideoPacket(scoped_ptr<VideoPacket> packet,
+  void ProcessVideoPacket(std::unique_ptr<VideoPacket> packet,
                           const base::Closure& done) override;
 
  private:
@@ -111,12 +111,12 @@
 
   // The current picture shown on the screen or being rendered. Must be deleted
   // before |video_decoder_|.
-  scoped_ptr<Picture> current_picture_;
+  std::unique_ptr<Picture> current_picture_;
 
   // The next picture to be rendered. PaintIfNeeded() will copy it to
   // |current_picture_| and render it after that. Must be deleted
   // before |video_decoder_|.
-  scoped_ptr<Picture> next_picture_;
+  std::unique_ptr<Picture> next_picture_;
 
   // Set to true if the screen has been resized and needs to be repainted.
   bool force_repaint_ = false;
diff --git a/remoting/client/server_log_entry_client.cc b/remoting/client/server_log_entry_client.cc
index e99345d..fdf496c 100644
--- a/remoting/client/server_log_entry_client.cc
+++ b/remoting/client/server_log_entry_client.cc
@@ -95,10 +95,10 @@
 
 }  // namespace
 
-scoped_ptr<ServerLogEntry> MakeLogEntryForSessionStateChange(
+std::unique_ptr<ServerLogEntry> MakeLogEntryForSessionStateChange(
     ConnectionToHost::State state,
     ErrorCode error) {
-  scoped_ptr<ServerLogEntry> entry(new ServerLogEntry());
+  std::unique_ptr<ServerLogEntry> entry(new ServerLogEntry());
   entry->AddRoleField(kValueRoleClient);
   entry->AddEventNameField(kValueEventNameSessionState);
 
@@ -110,9 +110,9 @@
   return entry;
 }
 
-scoped_ptr<ServerLogEntry> MakeLogEntryForStatistics(
+std::unique_ptr<ServerLogEntry> MakeLogEntryForStatistics(
     protocol::PerformanceTracker* perf_tracker) {
-  scoped_ptr<ServerLogEntry> entry(new ServerLogEntry());
+  std::unique_ptr<ServerLogEntry> entry(new ServerLogEntry());
   entry->AddRoleField(kValueRoleClient);
   entry->AddEventNameField(kValueEventNameStatistics);
 
@@ -132,18 +132,18 @@
   return entry;
 }
 
-scoped_ptr<ServerLogEntry> MakeLogEntryForSessionIdOld(
+std::unique_ptr<ServerLogEntry> MakeLogEntryForSessionIdOld(
     const std::string& session_id) {
-  scoped_ptr<ServerLogEntry> entry(new ServerLogEntry());
+  std::unique_ptr<ServerLogEntry> entry(new ServerLogEntry());
   entry->AddRoleField(kValueRoleClient);
   entry->AddEventNameField(kValueEventNameSessionIdOld);
   AddSessionIdToLogEntry(entry.get(), session_id);
   return entry;
 }
 
-scoped_ptr<ServerLogEntry> MakeLogEntryForSessionIdNew(
+std::unique_ptr<ServerLogEntry> MakeLogEntryForSessionIdNew(
     const std::string& session_id) {
-  scoped_ptr<ServerLogEntry> entry(new ServerLogEntry());
+  std::unique_ptr<ServerLogEntry> entry(new ServerLogEntry());
   entry->AddRoleField(kValueRoleClient);
   entry->AddEventNameField(kValueEventNameSessionIdNew);
   AddSessionIdToLogEntry(entry.get(), session_id);
diff --git a/remoting/client/server_log_entry_client.h b/remoting/client/server_log_entry_client.h
index 84c22073..238c9e21 100644
--- a/remoting/client/server_log_entry_client.h
+++ b/remoting/client/server_log_entry_client.h
@@ -18,20 +18,20 @@
 }  // namespace protocol
 
 // Constructs a log entry for a session state change.
-scoped_ptr<ServerLogEntry> MakeLogEntryForSessionStateChange(
+std::unique_ptr<ServerLogEntry> MakeLogEntryForSessionStateChange(
     protocol::ConnectionToHost::State state,
     protocol::ErrorCode error);
 
 // Constructs a log entry for reporting statistics.
-scoped_ptr<ServerLogEntry> MakeLogEntryForStatistics(
+std::unique_ptr<ServerLogEntry> MakeLogEntryForStatistics(
     protocol::PerformanceTracker* statistics);
 
 // Constructs a log entry for reporting session ID is old.
-scoped_ptr<ServerLogEntry> MakeLogEntryForSessionIdOld(
+std::unique_ptr<ServerLogEntry> MakeLogEntryForSessionIdOld(
     const std::string& session_id);
 
 // Constructs a log entry for reporting session ID is old.
-scoped_ptr<ServerLogEntry> MakeLogEntryForSessionIdNew(
+std::unique_ptr<ServerLogEntry> MakeLogEntryForSessionIdNew(
     const std::string& session_id);
 
 void AddClientFieldsToLogEntry(ServerLogEntry* entry);
diff --git a/remoting/client/server_log_entry_client_unittest.cc b/remoting/client/server_log_entry_client_unittest.cc
index 494f655b..294a97f 100644
--- a/remoting/client/server_log_entry_client_unittest.cc
+++ b/remoting/client/server_log_entry_client_unittest.cc
@@ -2,10 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "base/memory/scoped_ptr.h"
+#include "remoting/client/server_log_entry_client.h"
+
+#include <memory>
+
 #include "base/strings/stringize_macros.h"
 #include "base/sys_info.h"
-#include "remoting/client/server_log_entry_client.h"
 #include "remoting/protocol/performance_tracker.h"
 #include "remoting/signaling/server_log_entry.h"
 #include "remoting/signaling/server_log_entry_unittest.h"
@@ -20,9 +22,9 @@
 namespace remoting {
 
 TEST(ServerLogEntryClientTest, SessionStateChange) {
-  scoped_ptr<ServerLogEntry> entry(MakeLogEntryForSessionStateChange(
+  std::unique_ptr<ServerLogEntry> entry(MakeLogEntryForSessionStateChange(
       ConnectionToHost::CONNECTED, remoting::protocol::OK));
-  scoped_ptr<XmlElement> stanza = entry->ToStanza();
+  std::unique_ptr<XmlElement> stanza = entry->ToStanza();
   std::string error;
   std::map<std::string, std::string> key_value_pairs;
   key_value_pairs["role"] = "client";
@@ -34,9 +36,9 @@
 }
 
 TEST(ServerLogEntryClientTest, SessionStateChangeWithError) {
-  scoped_ptr<ServerLogEntry> entry(MakeLogEntryForSessionStateChange(
+  std::unique_ptr<ServerLogEntry> entry(MakeLogEntryForSessionStateChange(
       ConnectionToHost::FAILED, remoting::protocol::PEER_IS_OFFLINE));
-  scoped_ptr<XmlElement> stanza = entry->ToStanza();
+  std::unique_ptr<XmlElement> stanza = entry->ToStanza();
   std::string error;
   std::map<std::string, std::string> key_value_pairs;
   key_value_pairs["role"] = "client";
@@ -50,8 +52,9 @@
 
 TEST(ServerLogEntryClientTest, Statistics) {
   protocol::PerformanceTracker perf_tracker;
-  scoped_ptr<ServerLogEntry> entry(MakeLogEntryForStatistics(&perf_tracker));
-  scoped_ptr<XmlElement> stanza = entry->ToStanza();
+  std::unique_ptr<ServerLogEntry> entry(
+      MakeLogEntryForStatistics(&perf_tracker));
+  std::unique_ptr<XmlElement> stanza = entry->ToStanza();
   std::string error;
   std::map<std::string, std::string> key_value_pairs;
   key_value_pairs["role"] = "client";
@@ -68,8 +71,8 @@
 }
 
 TEST(ServerLogEntryClientTest, SessionIdChanged) {
-  scoped_ptr<ServerLogEntry> entry(MakeLogEntryForSessionIdOld("abc"));
-  scoped_ptr<XmlElement> stanza = entry->ToStanza();
+  std::unique_ptr<ServerLogEntry> entry(MakeLogEntryForSessionIdOld("abc"));
+  std::unique_ptr<XmlElement> stanza = entry->ToStanza();
   std::string error;
   std::map<std::string, std::string> key_value_pairs;
   key_value_pairs["role"] = "client";
@@ -88,10 +91,10 @@
 }
 
 TEST(ServerLogEntryClientTest, AddClientFields) {
-  scoped_ptr<ServerLogEntry> entry(MakeLogEntryForSessionStateChange(
+  std::unique_ptr<ServerLogEntry> entry(MakeLogEntryForSessionStateChange(
       ConnectionToHost::CONNECTED, remoting::protocol::OK));
   AddClientFieldsToLogEntry(entry.get());
-  scoped_ptr<XmlElement> stanza = entry->ToStanza();
+  std::unique_ptr<XmlElement> stanza = entry->ToStanza();
   std::string error;
   std::map<std::string, std::string> key_value_pairs;
   key_value_pairs["role"] = "client";
@@ -107,10 +110,10 @@
 }
 
 TEST(ServerLogEntryClientTest, AddSessionDuration) {
-  scoped_ptr<ServerLogEntry> entry(MakeLogEntryForSessionStateChange(
+  std::unique_ptr<ServerLogEntry> entry(MakeLogEntryForSessionStateChange(
       ConnectionToHost::CONNECTED, remoting::protocol::OK));
   AddSessionDurationToLogEntry(entry.get(), base::TimeDelta::FromSeconds(123));
-  scoped_ptr<XmlElement> stanza = entry->ToStanza();
+  std::unique_ptr<XmlElement> stanza = entry->ToStanza();
   std::string error;
   std::map<std::string, std::string> key_value_pairs;
   key_value_pairs["role"] = "client";
diff --git a/remoting/client/software_video_renderer.cc b/remoting/client/software_video_renderer.cc
index 2fa0fb2..0bb2f03 100644
--- a/remoting/client/software_video_renderer.cc
+++ b/remoting/client/software_video_renderer.cc
@@ -11,6 +11,7 @@
 #include "base/callback_helpers.h"
 #include "base/location.h"
 #include "base/logging.h"
+#include "base/memory/ptr_util.h"
 #include "base/single_thread_task_runner.h"
 #include "base/task_runner_util.h"
 #include "remoting/base/util.h"
@@ -36,7 +37,7 @@
 // in the right byte-order, instead of swapping it here.
 class RgbToBgrVideoDecoderFilter : public VideoDecoder {
  public:
-  RgbToBgrVideoDecoderFilter(scoped_ptr<VideoDecoder> parent)
+  RgbToBgrVideoDecoderFilter(std::unique_ptr<VideoDecoder> parent)
       : parent_(std::move(parent)) {}
 
   bool DecodePacket(const VideoPacket& packet,
@@ -56,13 +57,13 @@
   }
 
  private:
-  scoped_ptr<VideoDecoder> parent_;
+  std::unique_ptr<VideoDecoder> parent_;
 };
 
-scoped_ptr<webrtc::DesktopFrame> DoDecodeFrame(
+std::unique_ptr<webrtc::DesktopFrame> DoDecodeFrame(
     VideoDecoder* decoder,
-    scoped_ptr<VideoPacket> packet,
-    scoped_ptr<webrtc::DesktopFrame> frame) {
+    std::unique_ptr<VideoPacket> packet,
+    std::unique_ptr<webrtc::DesktopFrame> frame) {
   if (!decoder->DecodePacket(*packet, frame.get()))
     frame.reset();
   return frame;
@@ -102,7 +103,7 @@
 
   if (consumer_->GetPixelFormat() == protocol::FrameConsumer::FORMAT_RGBA) {
     decoder_ =
-        make_scoped_ptr(new RgbToBgrVideoDecoderFilter(std::move(decoder_)));
+        base::WrapUnique(new RgbToBgrVideoDecoderFilter(std::move(decoder_)));
   }
 }
 
@@ -115,8 +116,9 @@
   return consumer_;
 }
 
-void SoftwareVideoRenderer::ProcessVideoPacket(scoped_ptr<VideoPacket> packet,
-                                               const base::Closure& done) {
+void SoftwareVideoRenderer::ProcessVideoPacket(
+    std::unique_ptr<VideoPacket> packet,
+    const base::Closure& done) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
   base::ScopedClosureRunner done_runner(done);
@@ -149,7 +151,7 @@
     return;
   }
 
-  scoped_ptr<webrtc::DesktopFrame> frame =
+  std::unique_ptr<webrtc::DesktopFrame> frame =
       consumer_->AllocateFrame(source_size_);
   frame->set_dpi(source_dpi_);
 
@@ -165,7 +167,7 @@
 void SoftwareVideoRenderer::RenderFrame(
     int32_t frame_id,
     const base::Closure& done,
-    scoped_ptr<webrtc::DesktopFrame> frame) {
+    std::unique_ptr<webrtc::DesktopFrame> frame) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
   if (perf_tracker_)
diff --git a/remoting/client/software_video_renderer.h b/remoting/client/software_video_renderer.h
index 5951cf3..ed9c837 100644
--- a/remoting/client/software_video_renderer.h
+++ b/remoting/client/software_video_renderer.h
@@ -7,9 +7,10 @@
 
 #include <stdint.h>
 
+#include <memory>
+
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/threading/thread_checker.h"
 #include "remoting/protocol/performance_tracker.h"
@@ -55,20 +56,20 @@
   protocol::FrameConsumer* GetFrameConsumer() override;
 
   // protocol::VideoStub interface.
-  void ProcessVideoPacket(scoped_ptr<VideoPacket> packet,
+  void ProcessVideoPacket(std::unique_ptr<VideoPacket> packet,
                           const base::Closure& done) override;
 
  private:
   void RenderFrame(int32_t frame_id,
                    const base::Closure& done,
-                   scoped_ptr<webrtc::DesktopFrame> frame);
+                   std::unique_ptr<webrtc::DesktopFrame> frame);
   void OnFrameRendered(int32_t frame_id, const base::Closure& done);
 
   scoped_refptr<base::SingleThreadTaskRunner> decode_task_runner_;
   protocol::FrameConsumer* consumer_;
   protocol::PerformanceTracker* perf_tracker_;
 
-  scoped_ptr<VideoDecoder> decoder_;
+  std::unique_ptr<VideoDecoder> decoder_;
 
   webrtc::DesktopSize source_size_;
   webrtc::DesktopVector source_dpi_;
diff --git a/remoting/client/software_video_renderer_unittest.cc b/remoting/client/software_video_renderer_unittest.cc
index 9b658fdb..6ad1986 100644
--- a/remoting/client/software_video_renderer_unittest.cc
+++ b/remoting/client/software_video_renderer_unittest.cc
@@ -10,6 +10,7 @@
 #include <vector>
 
 #include "base/bind.h"
+#include "base/memory/ptr_util.h"
 #include "base/memory/scoped_vector.h"
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
@@ -35,7 +36,8 @@
   TestFrameConsumer() {}
   ~TestFrameConsumer() override {}
 
-  scoped_ptr<DesktopFrame> WaitForNextFrame(base::Closure* out_done_callback) {
+  std::unique_ptr<DesktopFrame> WaitForNextFrame(
+      base::Closure* out_done_callback) {
     EXPECT_TRUE(thread_checker_.CalledOnValidThread());
     frame_run_loop_.reset(new base::RunLoop());
     frame_run_loop_->Run();
@@ -46,13 +48,13 @@
   }
 
   // FrameConsumer interface.
-  scoped_ptr<DesktopFrame> AllocateFrame(
+  std::unique_ptr<DesktopFrame> AllocateFrame(
       const webrtc::DesktopSize& size) override {
     EXPECT_TRUE(thread_checker_.CalledOnValidThread());
-    return make_scoped_ptr(new webrtc::BasicDesktopFrame(size));
+    return base::WrapUnique(new webrtc::BasicDesktopFrame(size));
   }
 
-  void DrawFrame(scoped_ptr<DesktopFrame> frame,
+  void DrawFrame(std::unique_ptr<DesktopFrame> frame,
                  const base::Closure& done) override {
     EXPECT_TRUE(thread_checker_.CalledOnValidThread());
     last_frame_ = std::move(frame);
@@ -68,14 +70,14 @@
  private:
   base::ThreadChecker thread_checker_;
 
-  scoped_ptr<base::RunLoop> frame_run_loop_;
+  std::unique_ptr<base::RunLoop> frame_run_loop_;
 
-  scoped_ptr<DesktopFrame> last_frame_;
+  std::unique_ptr<DesktopFrame> last_frame_;
   base::Closure last_frame_done_callback_;
 };
 
-scoped_ptr<DesktopFrame> CreateTestFrame(int index) {
-  scoped_ptr<DesktopFrame> frame(new webrtc::BasicDesktopFrame(
+std::unique_ptr<DesktopFrame> CreateTestFrame(int index) {
+  std::unique_ptr<DesktopFrame> frame(new webrtc::BasicDesktopFrame(
       webrtc::DesktopSize(kFrameWidth, kFrameHeight)));
 
   for (int y = 0; y < kFrameHeight; y++) {
@@ -145,7 +147,7 @@
   base::Thread decode_thread_;
 
   TestFrameConsumer frame_consumer_;
-  scoped_ptr<SoftwareVideoRenderer> renderer_;
+  std::unique_ptr<SoftwareVideoRenderer> renderer_;
 
   VideoEncoderVerbatim encoder_;
 };
@@ -170,7 +172,7 @@
 
   for (int frame_index = 0; frame_index < kFrameCount; frame_index++) {
     base::Closure done_callback;
-    scoped_ptr<DesktopFrame> decoded_frame =
+    std::unique_ptr<DesktopFrame> decoded_frame =
         frame_consumer_.WaitForNextFrame(&done_callback);
 
     EXPECT_FALSE(callback_called[frame_index]);
diff --git a/remoting/codec/audio_decoder.cc b/remoting/codec/audio_decoder.cc
index 326b458..3e5dfac 100644
--- a/remoting/codec/audio_decoder.cc
+++ b/remoting/codec/audio_decoder.cc
@@ -5,20 +5,21 @@
 #include "remoting/codec/audio_decoder.h"
 
 #include "base/logging.h"
+#include "base/memory/ptr_util.h"
 #include "remoting/codec/audio_decoder_opus.h"
 #include "remoting/codec/audio_decoder_verbatim.h"
 #include "remoting/protocol/session_config.h"
 
 namespace remoting {
 
-scoped_ptr<AudioDecoder> AudioDecoder::CreateAudioDecoder(
+std::unique_ptr<AudioDecoder> AudioDecoder::CreateAudioDecoder(
     const protocol::SessionConfig& config) {
   const protocol::ChannelConfig& audio_config = config.audio_config();
 
   if (audio_config.codec == protocol::ChannelConfig::CODEC_VERBATIM) {
-    return make_scoped_ptr(new AudioDecoderVerbatim());
+    return base::WrapUnique(new AudioDecoderVerbatim());
   } else if (audio_config.codec == protocol::ChannelConfig::CODEC_OPUS) {
-    return make_scoped_ptr(new AudioDecoderOpus());
+    return base::WrapUnique(new AudioDecoderOpus());
   }
 
   NOTIMPLEMENTED();
diff --git a/remoting/codec/audio_decoder.h b/remoting/codec/audio_decoder.h
index f5088bc..46a464cf 100644
--- a/remoting/codec/audio_decoder.h
+++ b/remoting/codec/audio_decoder.h
@@ -5,7 +5,7 @@
 #ifndef REMOTING_CODEC_AUDIO_DECODER_H_
 #define REMOTING_CODEC_AUDIO_DECODER_H_
 
-#include "base/memory/scoped_ptr.h"
+#include <memory>
 
 namespace remoting {
 
@@ -17,14 +17,15 @@
 
 class AudioDecoder {
  public:
-  static scoped_ptr<AudioDecoder> CreateAudioDecoder(
+  static std::unique_ptr<AudioDecoder> CreateAudioDecoder(
       const protocol::SessionConfig& config);
 
   virtual ~AudioDecoder() {}
 
   // Returns the decoded packet. If the packet is invalid, then a NULL
   // scoped_ptr is returned.
-  virtual scoped_ptr<AudioPacket> Decode(scoped_ptr<AudioPacket> packet) = 0;
+  virtual std::unique_ptr<AudioPacket> Decode(
+      std::unique_ptr<AudioPacket> packet) = 0;
 };
 
 }  // namespace remoting
diff --git a/remoting/codec/audio_decoder_opus.cc b/remoting/codec/audio_decoder_opus.cc
index 8a57871..5d05d3c 100644
--- a/remoting/codec/audio_decoder_opus.cc
+++ b/remoting/codec/audio_decoder_opus.cc
@@ -74,8 +74,8 @@
   return decoder_ != nullptr;
 }
 
-scoped_ptr<AudioPacket> AudioDecoderOpus::Decode(
-    scoped_ptr<AudioPacket> packet) {
+std::unique_ptr<AudioPacket> AudioDecoderOpus::Decode(
+    std::unique_ptr<AudioPacket> packet) {
   if (packet->encoding() != AudioPacket::ENCODING_OPUS) {
     LOG(WARNING) << "Received an audio packet with encoding "
                  << packet->encoding() << " when an OPUS packet was expected.";
@@ -91,7 +91,7 @@
   }
 
   // Create a new packet of decoded data.
-  scoped_ptr<AudioPacket> decoded_packet(new AudioPacket());
+  std::unique_ptr<AudioPacket> decoded_packet(new AudioPacket());
   decoded_packet->set_encoding(AudioPacket::ENCODING_RAW);
   decoded_packet->set_sampling_rate(kSamplingRate);
   decoded_packet->set_bytes_per_sample(AudioPacket::BYTES_PER_SAMPLE_2);
diff --git a/remoting/codec/audio_decoder_opus.h b/remoting/codec/audio_decoder_opus.h
index 553f77f..5fb7d5d 100644
--- a/remoting/codec/audio_decoder_opus.h
+++ b/remoting/codec/audio_decoder_opus.h
@@ -5,8 +5,9 @@
 #ifndef REMOTING_CODEC_AUDIO_DECODER_OPUS_H_
 #define REMOTING_CODEC_AUDIO_DECODER_OPUS_H_
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "remoting/codec/audio_decoder.h"
 
 struct OpusDecoder;
@@ -21,7 +22,8 @@
   ~AudioDecoderOpus() override;
 
   // AudioDecoder interface.
-  scoped_ptr<AudioPacket> Decode(scoped_ptr<AudioPacket> packet) override;
+  std::unique_ptr<AudioPacket> Decode(
+      std::unique_ptr<AudioPacket> packet) override;
 
  private:
   void InitDecoder();
diff --git a/remoting/codec/audio_decoder_verbatim.cc b/remoting/codec/audio_decoder_verbatim.cc
index 6bd115a9..4e8a3c6 100644
--- a/remoting/codec/audio_decoder_verbatim.cc
+++ b/remoting/codec/audio_decoder_verbatim.cc
@@ -12,8 +12,8 @@
 AudioDecoderVerbatim::AudioDecoderVerbatim() {}
 AudioDecoderVerbatim::~AudioDecoderVerbatim() {}
 
-scoped_ptr<AudioPacket> AudioDecoderVerbatim::Decode(
-    scoped_ptr<AudioPacket> packet) {
+std::unique_ptr<AudioPacket> AudioDecoderVerbatim::Decode(
+    std::unique_ptr<AudioPacket> packet) {
   // Return a null scoped_ptr if we get a corrupted packet.
   if ((packet->encoding() != AudioPacket::ENCODING_RAW) ||
       (packet->data_size() != 1) ||
diff --git a/remoting/codec/audio_decoder_verbatim.h b/remoting/codec/audio_decoder_verbatim.h
index 2aabe4a..9c085d8 100644
--- a/remoting/codec/audio_decoder_verbatim.h
+++ b/remoting/codec/audio_decoder_verbatim.h
@@ -5,10 +5,10 @@
 #ifndef REMOTING_CODEC_AUDIO_DECODER_VERBATIM_H_
 #define REMOTING_CODEC_AUDIO_DECODER_VERBATIM_H_
 
-#include "remoting/codec/audio_decoder.h"
+#include <memory>
 
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
+#include "remoting/codec/audio_decoder.h"
 
 namespace remoting {
 
@@ -20,7 +20,8 @@
   AudioDecoderVerbatim();
   ~AudioDecoderVerbatim() override;
 
-  scoped_ptr<AudioPacket> Decode(scoped_ptr<AudioPacket> packet) override;
+  std::unique_ptr<AudioPacket> Decode(
+      std::unique_ptr<AudioPacket> packet) override;
 
  private:
   DISALLOW_COPY_AND_ASSIGN(AudioDecoderVerbatim);
diff --git a/remoting/codec/audio_encoder.h b/remoting/codec/audio_encoder.h
index c33a4d2..e534892e 100644
--- a/remoting/codec/audio_encoder.h
+++ b/remoting/codec/audio_encoder.h
@@ -5,7 +5,7 @@
 #ifndef REMOTING_CODEC_AUDIO_ENCODER_H_
 #define REMOTING_CODEC_AUDIO_ENCODER_H_
 
-#include "base/memory/scoped_ptr.h"
+#include <memory>
 
 namespace remoting {
 
@@ -15,7 +15,8 @@
  public:
   virtual ~AudioEncoder() {}
 
-  virtual scoped_ptr<AudioPacket> Encode(scoped_ptr<AudioPacket> packet) = 0;
+  virtual std::unique_ptr<AudioPacket> Encode(
+      std::unique_ptr<AudioPacket> packet) = 0;
 
   // Returns average bitrate for the stream in bits per second.
   virtual int GetBitrate() = 0;
diff --git a/remoting/codec/audio_encoder_opus.cc b/remoting/codec/audio_encoder_opus.cc
index c0b57101..cc3e71c 100644
--- a/remoting/codec/audio_encoder_opus.cc
+++ b/remoting/codec/audio_encoder_opus.cc
@@ -137,8 +137,8 @@
   return kOutputBitrateBps;
 }
 
-scoped_ptr<AudioPacket> AudioEncoderOpus::Encode(
-    scoped_ptr<AudioPacket> packet) {
+std::unique_ptr<AudioPacket> AudioEncoderOpus::Encode(
+    std::unique_ptr<AudioPacket> packet) {
   DCHECK_EQ(AudioPacket::ENCODING_RAW, packet->encoding());
   DCHECK_EQ(1, packet->data_size());
   DCHECK_EQ(kBytesPerSample, packet->bytes_per_sample());
@@ -153,7 +153,7 @@
       reinterpret_cast<const int16_t*>(packet->data(0).data());
 
   // Create a new packet of encoded data.
-  scoped_ptr<AudioPacket> encoded_packet(new AudioPacket());
+  std::unique_ptr<AudioPacket> encoded_packet(new AudioPacket());
   encoded_packet->set_encoding(AudioPacket::ENCODING_OPUS);
   encoded_packet->set_sampling_rate(kOpusSamplingRate);
   encoded_packet->set_channels(channels_);
diff --git a/remoting/codec/audio_encoder_opus.h b/remoting/codec/audio_encoder_opus.h
index 5e227a6..d692f655 100644
--- a/remoting/codec/audio_encoder_opus.h
+++ b/remoting/codec/audio_encoder_opus.h
@@ -29,7 +29,8 @@
   ~AudioEncoderOpus() override;
 
   // AudioEncoder interface.
-  scoped_ptr<AudioPacket> Encode(scoped_ptr<AudioPacket> packet) override;
+  std::unique_ptr<AudioPacket> Encode(
+      std::unique_ptr<AudioPacket> packet) override;
   int GetBitrate() override;
 
  private:
@@ -45,9 +46,9 @@
   OpusEncoder* encoder_;
 
   int frame_size_;
-  scoped_ptr<media::MultiChannelResampler> resampler_;
-  scoped_ptr<char[]> resample_buffer_;
-  scoped_ptr<media::AudioBus> resampler_bus_;
+  std::unique_ptr<media::MultiChannelResampler> resampler_;
+  std::unique_ptr<char[]> resample_buffer_;
+  std::unique_ptr<media::AudioBus> resampler_bus_;
 
   // Used to pass packet to the FetchBytesToResampler() callback.
   const char* resampling_data_;
@@ -55,7 +56,7 @@
   int resampling_data_pos_;
 
   // Left-over unencoded samples from the previous AudioPacket.
-  scoped_ptr<int16_t[]> leftover_buffer_;
+  std::unique_ptr<int16_t[]> leftover_buffer_;
   int leftover_buffer_size_;
   int leftover_samples_;
 
diff --git a/remoting/codec/audio_encoder_opus_unittest.cc b/remoting/codec/audio_encoder_opus_unittest.cc
index b67e28ab..989b6744 100644
--- a/remoting/codec/audio_encoder_opus_unittest.cc
+++ b/remoting/codec/audio_encoder_opus_unittest.cc
@@ -67,18 +67,17 @@
 
   // Creates  audio packet filled with a test signal with the specified
   // |frequency_hz|.
-  scoped_ptr<AudioPacket> CreatePacket(
-      int samples,
-      AudioPacket::SamplingRate rate,
-      double frequency_hz,
-      int pos) {
+  std::unique_ptr<AudioPacket> CreatePacket(int samples,
+                                            AudioPacket::SamplingRate rate,
+                                            double frequency_hz,
+                                            int pos) {
     std::vector<int16_t> data(samples * kChannels);
     for (int i = 0; i < samples; ++i) {
       data[i * kChannels] = GetSampleValue(rate, frequency_hz, i + pos, 0);
       data[i * kChannels + 1] = GetSampleValue(rate, frequency_hz, i + pos, 1);
     }
 
-    scoped_ptr<AudioPacket> packet(new AudioPacket());
+    std::unique_ptr<AudioPacket> packet(new AudioPacket());
     packet->add_data(reinterpret_cast<char*>(&(data[0])),
                      samples * kChannels * sizeof(int16_t));
     packet->set_encoding(AudioPacket::ENCODING_RAW);
@@ -139,21 +138,21 @@
     std::vector<int16_t> received_data;
     int pos = 0;
     for (; pos < kTotalTestSamples; pos += packet_size) {
-        scoped_ptr<AudioPacket> source_packet =
-            CreatePacket(packet_size, rate, frequency_hz, pos);
-        scoped_ptr<AudioPacket> encoded =
-            encoder_->Encode(std::move(source_packet));
-        if (encoded.get()) {
-          scoped_ptr<AudioPacket> decoded =
-              decoder_->Decode(std::move(encoded));
-          EXPECT_EQ(kDefaultSamplingRate, decoded->sampling_rate());
-          for (int i = 0; i < decoded->data_size(); ++i) {
-            const int16_t* data =
-                reinterpret_cast<const int16_t*>(decoded->data(i).data());
-            received_data.insert(
-                received_data.end(), data,
-                data + decoded->data(i).size() / sizeof(int16_t));
-          }
+      std::unique_ptr<AudioPacket> source_packet =
+          CreatePacket(packet_size, rate, frequency_hz, pos);
+      std::unique_ptr<AudioPacket> encoded =
+          encoder_->Encode(std::move(source_packet));
+      if (encoded.get()) {
+        std::unique_ptr<AudioPacket> decoded =
+            decoder_->Decode(std::move(encoded));
+        EXPECT_EQ(kDefaultSamplingRate, decoded->sampling_rate());
+        for (int i = 0; i < decoded->data_size(); ++i) {
+          const int16_t* data =
+              reinterpret_cast<const int16_t*>(decoded->data(i).data());
+          received_data.insert(
+              received_data.end(), data,
+              data + decoded->data(i).size() / sizeof(int16_t));
+        }
         }
     }
 
@@ -167,8 +166,8 @@
   }
 
  protected:
-  scoped_ptr<AudioEncoderOpus> encoder_;
-  scoped_ptr<AudioDecoderOpus> decoder_;
+  std::unique_ptr<AudioEncoderOpus> encoder_;
+  std::unique_ptr<AudioDecoderOpus> decoder_;
 };
 
 TEST_F(OpusAudioEncoderTest, CreateAndDestroy) {
diff --git a/remoting/codec/audio_encoder_verbatim.cc b/remoting/codec/audio_encoder_verbatim.cc
index 9241ce0..1e87eee8 100644
--- a/remoting/codec/audio_encoder_verbatim.cc
+++ b/remoting/codec/audio_encoder_verbatim.cc
@@ -13,8 +13,8 @@
 
 AudioEncoderVerbatim::~AudioEncoderVerbatim() {}
 
-scoped_ptr<AudioPacket> AudioEncoderVerbatim::Encode(
-    scoped_ptr<AudioPacket> packet) {
+std::unique_ptr<AudioPacket> AudioEncoderVerbatim::Encode(
+    std::unique_ptr<AudioPacket> packet) {
   DCHECK_EQ(AudioPacket::ENCODING_RAW, packet->encoding());
   DCHECK_EQ(1, packet->data_size());
   DCHECK_NE(AudioPacket::SAMPLING_RATE_INVALID, packet->sampling_rate());
diff --git a/remoting/codec/audio_encoder_verbatim.h b/remoting/codec/audio_encoder_verbatim.h
index f546bef..e96242c2 100644
--- a/remoting/codec/audio_encoder_verbatim.h
+++ b/remoting/codec/audio_encoder_verbatim.h
@@ -18,7 +18,8 @@
   ~AudioEncoderVerbatim() override;
 
   // AudioEncoder implementation.
-  scoped_ptr<AudioPacket> Encode(scoped_ptr<AudioPacket> packet) override;
+  std::unique_ptr<AudioPacket> Encode(
+      std::unique_ptr<AudioPacket> packet) override;
   int GetBitrate() override;
 
  private:
diff --git a/remoting/codec/codec_test.cc b/remoting/codec/codec_test.cc
index 3da3793..4f8f24b 100644
--- a/remoting/codec/codec_test.cc
+++ b/remoting/codec/codec_test.cc
@@ -2,20 +2,21 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "remoting/codec/codec_test.h"
+
 #include <stddef.h>
 #include <stdint.h>
 #include <stdlib.h>
 
 #include <deque>
+#include <memory>
 #include <utility>
 
 #include "base/bind.h"
 #include "base/logging.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "media/base/video_frame.h"
 #include "remoting/base/util.h"
-#include "remoting/codec/codec_test.h"
 #include "remoting/codec/video_decoder.h"
 #include "remoting/codec/video_encoder.h"
 #include "remoting/proto/video.pb.h"
@@ -76,7 +77,7 @@
            frame_->size().width() * frame_->size().height() * kBytesPerPixel);
   }
 
-  void ReceivedPacket(scoped_ptr<VideoPacket> packet) {
+  void ReceivedPacket(std::unique_ptr<VideoPacket> packet) {
     ASSERT_TRUE(decoder_->DecodePacket(*packet, frame_.get()));
   }
 
@@ -166,7 +167,7 @@
   bool strict_;
   DesktopRegion expected_region_;
   VideoDecoder* decoder_;
-  scoped_ptr<DesktopFrame> frame_;
+  std::unique_ptr<DesktopFrame> frame_;
   DesktopFrame* expected_frame_;
 
   DISALLOW_COPY_AND_ASSIGN(VideoDecoderTester);
@@ -182,7 +183,7 @@
     EXPECT_GT(data_available_, 0);
   }
 
-  void DataAvailable(scoped_ptr<VideoPacket> packet) {
+  void DataAvailable(std::unique_ptr<VideoPacket> packet) {
     ++data_available_;
     // Send the message to the VideoDecoderTester.
     if (decoder_tester_) {
@@ -201,8 +202,8 @@
   DISALLOW_COPY_AND_ASSIGN(VideoEncoderTester);
 };
 
-scoped_ptr<DesktopFrame> PrepareFrame(const DesktopSize& size) {
-  scoped_ptr<DesktopFrame> frame(new BasicDesktopFrame(size));
+std::unique_ptr<DesktopFrame> PrepareFrame(const DesktopSize& size) {
+  std::unique_ptr<DesktopFrame> frame(new BasicDesktopFrame(size));
 
   srand(0);
   int memory_size = size.width() * size.height() * kBytesPerPixel;
@@ -229,7 +230,7 @@
   for (size_t xi = 0; xi < arraysize(kSizes); ++xi) {
     for (size_t yi = 0; yi < arraysize(kSizes); ++yi) {
       DesktopSize size(kSizes[xi], kSizes[yi]);
-      scoped_ptr<DesktopFrame> frame = PrepareFrame(size);
+      std::unique_ptr<DesktopFrame> frame = PrepareFrame(size);
       for (const DesktopRegion& region : MakeTestRegionLists(size)) {
         TestEncodingRects(encoder, &tester, frame.get(), region);
       }
@@ -245,7 +246,7 @@
 void TestVideoEncoderEmptyFrames(VideoEncoder* encoder,
                                  int max_topoff_frames) {
   const DesktopSize kSize(100, 100);
-  scoped_ptr<DesktopFrame> frame(PrepareFrame(kSize));
+  std::unique_ptr<DesktopFrame> frame(PrepareFrame(kSize));
 
   frame->mutable_updated_region()->SetRect(
       webrtc::DesktopRect::MakeSize(kSize));
@@ -299,7 +300,7 @@
 
   VideoEncoderTester encoder_tester;
 
-  scoped_ptr<DesktopFrame> frame = PrepareFrame(kSize);
+  std::unique_ptr<DesktopFrame> frame = PrepareFrame(kSize);
 
   VideoDecoderTester decoder_tester(decoder, kSize);
   decoder_tester.set_strict(strict);
@@ -330,8 +331,7 @@
                                      const DesktopSize& screen_size,
                                      double max_error_limit,
                                      double mean_error_limit) {
-  scoped_ptr<BasicDesktopFrame> frame(
-      new BasicDesktopFrame(screen_size));
+  std::unique_ptr<BasicDesktopFrame> frame(new BasicDesktopFrame(screen_size));
   FillWithGradient(frame.get());
   frame->mutable_updated_region()->SetRect(DesktopRect::MakeSize(screen_size));
 
diff --git a/remoting/codec/scoped_vpx_codec.h b/remoting/codec/scoped_vpx_codec.h
index bf03c64..89a6d12 100644
--- a/remoting/codec/scoped_vpx_codec.h
+++ b/remoting/codec/scoped_vpx_codec.h
@@ -5,7 +5,7 @@
 #ifndef REMOTING_CODEC_SCOPED_VPX_CODEC_H_
 #define REMOTING_CODEC_SCOPED_VPX_CODEC_H_
 
-#include "base/memory/scoped_ptr.h"
+#include <memory>
 
 extern "C" {
 typedef struct vpx_codec_ctx vpx_codec_ctx_t;
@@ -17,7 +17,7 @@
   void operator()(vpx_codec_ctx_t* codec);
 };
 
-typedef scoped_ptr<vpx_codec_ctx_t, VpxCodecDeleter> ScopedVpxCodec;
+typedef std::unique_ptr<vpx_codec_ctx_t, VpxCodecDeleter> ScopedVpxCodec;
 
 } // namespace remoting
 
diff --git a/remoting/codec/video_decoder_verbatim.h b/remoting/codec/video_decoder_verbatim.h
index f1d7784..2ccf7c5 100644
--- a/remoting/codec/video_decoder_verbatim.h
+++ b/remoting/codec/video_decoder_verbatim.h
@@ -5,9 +5,10 @@
 #ifndef REMOTING_CODEC_VIDEO_DECODER_VERBATIM_H_
 #define REMOTING_CODEC_VIDEO_DECODER_VERBATIM_H_
 
+#include <memory>
+
 #include "base/compiler_specific.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "remoting/codec/video_decoder.h"
 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
 #include "third_party/webrtc/modules/desktop_capture/desktop_region.h"
diff --git a/remoting/codec/video_decoder_vpx.cc b/remoting/codec/video_decoder_vpx.cc
index b076128..e3db190 100644
--- a/remoting/codec/video_decoder_vpx.cc
+++ b/remoting/codec/video_decoder_vpx.cc
@@ -8,6 +8,7 @@
 #include <stdint.h>
 
 #include "base/logging.h"
+#include "base/memory/ptr_util.h"
 #include "remoting/base/util.h"
 #include "remoting/proto/video.pb.h"
 #include "third_party/libyuv/include/libyuv/convert_argb.h"
@@ -68,13 +69,13 @@
 }  // namespace
 
 // static
-scoped_ptr<VideoDecoderVpx> VideoDecoderVpx::CreateForVP8() {
-  return make_scoped_ptr(new VideoDecoderVpx(vpx_codec_vp8_dx()));
+std::unique_ptr<VideoDecoderVpx> VideoDecoderVpx::CreateForVP8() {
+  return base::WrapUnique(new VideoDecoderVpx(vpx_codec_vp8_dx()));
 }
 
 // static
-scoped_ptr<VideoDecoderVpx> VideoDecoderVpx::CreateForVP9() {
-  return make_scoped_ptr(new VideoDecoderVpx(vpx_codec_vp9_dx()));
+std::unique_ptr<VideoDecoderVpx> VideoDecoderVpx::CreateForVP9() {
+  return base::WrapUnique(new VideoDecoderVpx(vpx_codec_vp9_dx()));
 }
 
 VideoDecoderVpx::~VideoDecoderVpx() {}
diff --git a/remoting/codec/video_decoder_vpx.h b/remoting/codec/video_decoder_vpx.h
index a386ca2..48bbb90 100644
--- a/remoting/codec/video_decoder_vpx.h
+++ b/remoting/codec/video_decoder_vpx.h
@@ -5,9 +5,10 @@
 #ifndef REMOTING_CODEC_VIDEO_DECODER_VPX_H_
 #define REMOTING_CODEC_VIDEO_DECODER_VPX_H_
 
+#include <memory>
+
 #include "base/compiler_specific.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "remoting/codec/scoped_vpx_codec.h"
 #include "remoting/codec/video_decoder.h"
 
@@ -19,8 +20,8 @@
 class VideoDecoderVpx : public VideoDecoder {
  public:
   // Create decoders for the specified protocol.
-  static scoped_ptr<VideoDecoderVpx> CreateForVP8();
-  static scoped_ptr<VideoDecoderVpx> CreateForVP9();
+  static std::unique_ptr<VideoDecoderVpx> CreateForVP8();
+  static std::unique_ptr<VideoDecoderVpx> CreateForVP9();
 
   ~VideoDecoderVpx() override;
 
diff --git a/remoting/codec/video_decoder_vpx_unittest.cc b/remoting/codec/video_decoder_vpx_unittest.cc
index a7f2530..2224d9a 100644
--- a/remoting/codec/video_decoder_vpx_unittest.cc
+++ b/remoting/codec/video_decoder_vpx_unittest.cc
@@ -16,8 +16,8 @@
 
 class VideoDecoderVpxTest : public testing::Test {
  protected:
-  scoped_ptr<VideoEncoderVpx> encoder_;
-  scoped_ptr<VideoDecoderVpx> decoder_;
+  std::unique_ptr<VideoEncoderVpx> encoder_;
+  std::unique_ptr<VideoDecoderVpx> decoder_;
 
   VideoDecoderVpxTest() : encoder_(VideoEncoderVpx::CreateForVP8()),
                           decoder_(VideoDecoderVpx::CreateForVP8()) {
diff --git a/remoting/codec/video_encoder.h b/remoting/codec/video_encoder.h
index 9da447c..6629518 100644
--- a/remoting/codec/video_encoder.h
+++ b/remoting/codec/video_encoder.h
@@ -5,7 +5,7 @@
 #ifndef REMOTING_CODEC_VIDEO_ENCODER_H_
 #define REMOTING_CODEC_VIDEO_ENCODER_H_
 
-#include "base/memory/scoped_ptr.h"
+#include <memory>
 
 namespace webrtc {
 class DesktopFrame;
@@ -29,7 +29,8 @@
   // then the encoder may return a packet (e.g. to top-off previously-encoded
   // portions of the frame to higher quality) or return nullptr to indicate that
   // there is no work to do.
-  virtual scoped_ptr<VideoPacket> Encode(const webrtc::DesktopFrame& frame) = 0;
+  virtual std::unique_ptr<VideoPacket> Encode(
+      const webrtc::DesktopFrame& frame) = 0;
 };
 
 }  // namespace remoting
diff --git a/remoting/codec/video_encoder_helper.cc b/remoting/codec/video_encoder_helper.cc
index d079162..d3bf3c8 100644
--- a/remoting/codec/video_encoder_helper.cc
+++ b/remoting/codec/video_encoder_helper.cc
@@ -13,16 +13,16 @@
 
 VideoEncoderHelper::VideoEncoderHelper() {}
 
-scoped_ptr<VideoPacket> VideoEncoderHelper::CreateVideoPacket(
+std::unique_ptr<VideoPacket> VideoEncoderHelper::CreateVideoPacket(
     const webrtc::DesktopFrame& frame) {
   return CreateVideoPacketWithUpdatedRegion(frame, frame.updated_region());
 }
 
-scoped_ptr<VideoPacket>
+std::unique_ptr<VideoPacket>
 VideoEncoderHelper::CreateVideoPacketWithUpdatedRegion(
     const webrtc::DesktopFrame& frame,
     const webrtc::DesktopRegion& updated_region) {
-  scoped_ptr<VideoPacket> packet(new VideoPacket());
+  std::unique_ptr<VideoPacket> packet(new VideoPacket());
 
   // Set |screen_width| and |screen_height| iff they have changed.
   if (!frame.size().equals(screen_size_)) {
diff --git a/remoting/codec/video_encoder_helper.h b/remoting/codec/video_encoder_helper.h
index 65e4acc0..5e7f5040 100644
--- a/remoting/codec/video_encoder_helper.h
+++ b/remoting/codec/video_encoder_helper.h
@@ -5,8 +5,9 @@
 #ifndef REMOTING_CODEC_VIDEO_ENCODER_HELPER_H_
 #define REMOTING_CODEC_VIDEO_ENCODER_HELPER_H_
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
 
 namespace webrtc {
@@ -26,15 +27,17 @@
   // list, frame shape if any) initialized based on the supplied |frame|.
   // Screen width and height will be set iff |frame|'s size differs from that
   // of the previously-supplied frame.
-  scoped_ptr<VideoPacket> CreateVideoPacket(const webrtc::DesktopFrame& frame);
+  std::unique_ptr<VideoPacket> CreateVideoPacket(
+      const webrtc::DesktopFrame& frame);
 
   // Returns a new VideoPacket with the common fields populated from |frame|,
   // but the updated rects overridden by |updated_region|. This is useful for
   // encoders which alter the updated region e.g. by expanding it to macroblock
   // boundaries.
-  scoped_ptr<VideoPacket> CreateVideoPacketWithUpdatedRegion(
+  std::unique_ptr<VideoPacket> CreateVideoPacketWithUpdatedRegion(
       const webrtc::DesktopFrame& frame,
       const webrtc::DesktopRegion& updated_region);
+
  private:
   // The most recent screen size. Used to detect screen size changes.
   webrtc::DesktopSize screen_size_;
diff --git a/remoting/codec/video_encoder_helper_unittest.cc b/remoting/codec/video_encoder_helper_unittest.cc
index 73035cc..7d1e65b 100644
--- a/remoting/codec/video_encoder_helper_unittest.cc
+++ b/remoting/codec/video_encoder_helper_unittest.cc
@@ -4,7 +4,8 @@
 
 #include "remoting/codec/video_encoder_helper.h"
 
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
 #include "remoting/proto/video.pb.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
@@ -24,7 +25,7 @@
   frame.mutable_updated_region()->SetRect(DesktopRect::MakeLTRB(0, 0, 16, 16));
 
   VideoEncoderHelper helper;
-  scoped_ptr<VideoPacket> packet(helper.CreateVideoPacket(frame));
+  std::unique_ptr<VideoPacket> packet(helper.CreateVideoPacket(frame));
 
   ASSERT_TRUE(packet->has_format());
   EXPECT_FALSE(packet->format().has_encoding());
@@ -41,7 +42,7 @@
   // DPI is zero unless explicitly set.
 
   VideoEncoderHelper helper;
-  scoped_ptr<VideoPacket> packet(helper.CreateVideoPacket(frame));
+  std::unique_ptr<VideoPacket> packet(helper.CreateVideoPacket(frame));
 
   // Packet should have a format containing the screen dimensions only.
   ASSERT_TRUE(packet->has_format());
@@ -57,7 +58,7 @@
   frame.set_dpi(DesktopVector(96, 97));
 
   VideoEncoderHelper helper;
-  scoped_ptr<VideoPacket> packet(helper.CreateVideoPacket(frame));
+  std::unique_ptr<VideoPacket> packet(helper.CreateVideoPacket(frame));
   packet = helper.CreateVideoPacket(frame);
 
   ASSERT_TRUE(packet->has_format());
@@ -73,7 +74,7 @@
   // Process the same frame twice, so the helper knows the current size, and
   // to trigger suppression of the size field due to the size not changing.
   BasicDesktopFrame frame1(DesktopSize(32, 32));
-  scoped_ptr<VideoPacket> packet(helper.CreateVideoPacket(frame1));
+  std::unique_ptr<VideoPacket> packet(helper.CreateVideoPacket(frame1));
   packet = helper.CreateVideoPacket(frame1);
 
   // Process a different-sized frame to trigger size to be emitted.
diff --git a/remoting/codec/video_encoder_verbatim.cc b/remoting/codec/video_encoder_verbatim.cc
index 9da4850..797d0aca 100644
--- a/remoting/codec/video_encoder_verbatim.cc
+++ b/remoting/codec/video_encoder_verbatim.cc
@@ -25,7 +25,7 @@
 VideoEncoderVerbatim::VideoEncoderVerbatim() {}
 VideoEncoderVerbatim::~VideoEncoderVerbatim() {}
 
-scoped_ptr<VideoPacket> VideoEncoderVerbatim::Encode(
+std::unique_ptr<VideoPacket> VideoEncoderVerbatim::Encode(
     const webrtc::DesktopFrame& frame) {
   DCHECK(frame.data());
 
@@ -35,7 +35,7 @@
     return nullptr;
 
   // Create a VideoPacket with common fields (e.g. DPI, rects, shape) set.
-  scoped_ptr<VideoPacket> packet(helper_.CreateVideoPacket(frame));
+  std::unique_ptr<VideoPacket> packet(helper_.CreateVideoPacket(frame));
   packet->mutable_format()->set_encoding(VideoPacketFormat::ENCODING_VERBATIM);
 
   // Calculate output size.
diff --git a/remoting/codec/video_encoder_verbatim.h b/remoting/codec/video_encoder_verbatim.h
index 0e76b43..e4e0701 100644
--- a/remoting/codec/video_encoder_verbatim.h
+++ b/remoting/codec/video_encoder_verbatim.h
@@ -19,7 +19,8 @@
   ~VideoEncoderVerbatim() override;
 
   // VideoEncoder interface.
-  scoped_ptr<VideoPacket> Encode(const webrtc::DesktopFrame& frame) override;
+  std::unique_ptr<VideoPacket> Encode(
+      const webrtc::DesktopFrame& frame) override;
 
  private:
   VideoEncoderHelper helper_;
diff --git a/remoting/codec/video_encoder_verbatim_unittest.cc b/remoting/codec/video_encoder_verbatim_unittest.cc
index a294d7bd..0acdff9 100644
--- a/remoting/codec/video_encoder_verbatim_unittest.cc
+++ b/remoting/codec/video_encoder_verbatim_unittest.cc
@@ -11,18 +11,18 @@
 namespace remoting {
 
 TEST(VideoEncoderVerbatimTest, TestVideoEncoder) {
-  scoped_ptr<VideoEncoderVerbatim> encoder(new VideoEncoderVerbatim());
+  std::unique_ptr<VideoEncoderVerbatim> encoder(new VideoEncoderVerbatim());
   TestVideoEncoder(encoder.get(), true);
 }
 
 TEST(VideoEncoderVerbatimTest, EncodeAndDecode) {
-  scoped_ptr<VideoEncoderVerbatim> encoder(new VideoEncoderVerbatim());
-  scoped_ptr<VideoDecoderVerbatim> decoder(new VideoDecoderVerbatim());
+  std::unique_ptr<VideoEncoderVerbatim> encoder(new VideoEncoderVerbatim());
+  std::unique_ptr<VideoDecoderVerbatim> decoder(new VideoDecoderVerbatim());
   TestVideoEncoderDecoder(encoder.get(), decoder.get(), true);
 }
 
 TEST(VideoEncoderVerbatimTest, EncodeUnchangedFrame) {
-  scoped_ptr<VideoEncoderVerbatim> encoder(new VideoEncoderVerbatim());
+  std::unique_ptr<VideoEncoderVerbatim> encoder(new VideoEncoderVerbatim());
   TestVideoEncoderEmptyFrames(encoder.get(), 0);
 }
 
diff --git a/remoting/codec/video_encoder_vpx.cc b/remoting/codec/video_encoder_vpx.cc
index ea848590..0021b8acf 100644
--- a/remoting/codec/video_encoder_vpx.cc
+++ b/remoting/codec/video_encoder_vpx.cc
@@ -8,6 +8,7 @@
 
 #include "base/bind.h"
 #include "base/logging.h"
+#include "base/memory/ptr_util.h"
 #include "base/sys_info.h"
 #include "remoting/base/util.h"
 #include "remoting/proto/video.pb.h"
@@ -150,8 +151,8 @@
 
 void FreeImageIfMismatched(bool use_i444,
                            const webrtc::DesktopSize& size,
-                           scoped_ptr<vpx_image_t>* out_image,
-                           scoped_ptr<uint8_t[]>* out_image_buffer) {
+                           std::unique_ptr<vpx_image_t>* out_image,
+                           std::unique_ptr<uint8_t[]>* out_image_buffer) {
   if (*out_image) {
     const vpx_img_fmt_t desired_fmt =
         use_i444 ? VPX_IMG_FMT_I444 : VPX_IMG_FMT_I420;
@@ -165,13 +166,13 @@
 
 void CreateImage(bool use_i444,
                  const webrtc::DesktopSize& size,
-                 scoped_ptr<vpx_image_t>* out_image,
-                 scoped_ptr<uint8_t[]>* out_image_buffer) {
+                 std::unique_ptr<vpx_image_t>* out_image,
+                 std::unique_ptr<uint8_t[]>* out_image_buffer) {
   DCHECK(!size.is_empty());
   DCHECK(!*out_image_buffer);
   DCHECK(!*out_image);
 
-  scoped_ptr<vpx_image_t> image(new vpx_image_t());
+  std::unique_ptr<vpx_image_t> image(new vpx_image_t());
   memset(image.get(), 0, sizeof(vpx_image_t));
 
   // libvpx seems to require both to be assigned.
@@ -209,7 +210,7 @@
 
   // Allocate a YUV buffer large enough for the aligned data & padding.
   const int buffer_size = y_stride * y_rows + 2*uv_stride * uv_rows;
-  scoped_ptr<uint8_t[]> image_buffer(new uint8_t[buffer_size]);
+  std::unique_ptr<uint8_t[]> image_buffer(new uint8_t[buffer_size]);
 
   // Reset image value to 128 so we just need to fill in the y plane.
   memset(image_buffer.get(), 128, buffer_size);
@@ -231,13 +232,13 @@
 } // namespace
 
 // static
-scoped_ptr<VideoEncoderVpx> VideoEncoderVpx::CreateForVP8() {
-  return make_scoped_ptr(new VideoEncoderVpx(false));
+std::unique_ptr<VideoEncoderVpx> VideoEncoderVpx::CreateForVP8() {
+  return base::WrapUnique(new VideoEncoderVpx(false));
 }
 
 // static
-scoped_ptr<VideoEncoderVpx> VideoEncoderVpx::CreateForVP9() {
-  return make_scoped_ptr(new VideoEncoderVpx(true));
+std::unique_ptr<VideoEncoderVpx> VideoEncoderVpx::CreateForVP9() {
+  return base::WrapUnique(new VideoEncoderVpx(true));
 }
 
 VideoEncoderVpx::~VideoEncoderVpx() {}
@@ -267,7 +268,7 @@
   }
 }
 
-scoped_ptr<VideoPacket> VideoEncoderVpx::Encode(
+std::unique_ptr<VideoPacket> VideoEncoderVpx::Encode(
     const webrtc::DesktopFrame& frame) {
   DCHECK_LE(32, frame.size().width());
   DCHECK_LE(32, frame.size().height());
@@ -325,7 +326,7 @@
 
   // TODO(hclam): Make sure we get exactly one frame from the packet.
   // TODO(hclam): We should provide the output buffer to avoid one copy.
-  scoped_ptr<VideoPacket> packet(
+  std::unique_ptr<VideoPacket> packet(
       helper_.CreateVideoPacketWithUpdatedRegion(frame, updated_region));
   packet->mutable_format()->set_encoding(VideoPacketFormat::ENCODING_VP8);
 
diff --git a/remoting/codec/video_encoder_vpx.h b/remoting/codec/video_encoder_vpx.h
index 35d5f670..95a9bd66 100644
--- a/remoting/codec/video_encoder_vpx.h
+++ b/remoting/codec/video_encoder_vpx.h
@@ -27,8 +27,8 @@
 class VideoEncoderVpx : public VideoEncoder {
  public:
   // Create encoder for the specified protocol.
-  static scoped_ptr<VideoEncoderVpx> CreateForVP8();
-  static scoped_ptr<VideoEncoderVpx> CreateForVP9();
+  static std::unique_ptr<VideoEncoderVpx> CreateForVP8();
+  static std::unique_ptr<VideoEncoderVpx> CreateForVP9();
 
   ~VideoEncoderVpx() override;
 
@@ -37,7 +37,8 @@
   // VideoEncoder interface.
   void SetLosslessEncode(bool want_lossless) override;
   void SetLosslessColor(bool want_lossless) override;
-  scoped_ptr<VideoPacket> Encode(const webrtc::DesktopFrame& frame) override;
+  std::unique_ptr<VideoPacket> Encode(
+      const webrtc::DesktopFrame& frame) override;
 
  private:
   explicit VideoEncoderVpx(bool use_vp9);
@@ -74,11 +75,11 @@
   base::TimeTicks timestamp_base_;
 
   // VPX image and buffer to hold the actual YUV planes.
-  scoped_ptr<vpx_image_t> image_;
-  scoped_ptr<uint8_t[]> image_buffer_;
+  std::unique_ptr<vpx_image_t> image_;
+  std::unique_ptr<uint8_t[]> image_buffer_;
 
   // Active map used to optimize out processing of un-changed macroblocks.
-  scoped_ptr<uint8_t[]> active_map_;
+  std::unique_ptr<uint8_t[]> active_map_;
   webrtc::DesktopSize active_map_size_;
 
   // True if the codec wants unchanged frames to finish topping-off with.
diff --git a/remoting/codec/video_encoder_vpx_unittest.cc b/remoting/codec/video_encoder_vpx_unittest.cc
index 61c74d1..3ef6054 100644
--- a/remoting/codec/video_encoder_vpx_unittest.cc
+++ b/remoting/codec/video_encoder_vpx_unittest.cc
@@ -7,9 +7,9 @@
 #include <stdint.h>
 
 #include <limits>
+#include <memory>
 #include <vector>
 
-#include "base/memory/scoped_ptr.h"
 #include "remoting/codec/codec_test.h"
 #include "remoting/proto/video.pb.h"
 #include "testing/gtest/include/gtest/gtest.h"
@@ -24,9 +24,9 @@
 // Creates a frame stippled between blue and red pixels, which is useful for
 // lossy/lossless encode and color tests. By default all pixels in the frame
 // are included in the updated_region().
-static scoped_ptr<webrtc::DesktopFrame> CreateTestFrame(
+static std::unique_ptr<webrtc::DesktopFrame> CreateTestFrame(
     const webrtc::DesktopSize& frame_size) {
-  scoped_ptr<webrtc::DesktopFrame> frame(
+  std::unique_ptr<webrtc::DesktopFrame> frame(
       new webrtc::BasicDesktopFrame(frame_size));
   for (int x = 0; x < frame_size.width(); ++x) {
     for (int y = 0; y < frame_size.height(); ++y) {
@@ -42,30 +42,30 @@
 }
 
 TEST(VideoEncoderVpxTest, Vp8) {
-  scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP8());
+  std::unique_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP8());
   TestVideoEncoder(encoder.get(), false);
 }
 
 TEST(VideoEncoderVpxTest, Vp9) {
-  scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP9());
+  std::unique_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP9());
   // VP9 encoder defaults to lossless encode and lossy (I420) color.
   TestVideoEncoder(encoder.get(), false);
 }
 
 // Test that the VP9 encoder can switch between lossy & lossless encode.
 TEST(VideoEncoderVpxTest, Vp9LossyEncodeSwitching) {
-  scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP9());
+  std::unique_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP9());
 
   webrtc::DesktopSize frame_size(100, 100);
-  scoped_ptr<webrtc::DesktopFrame> frame(CreateTestFrame(frame_size));
+  std::unique_ptr<webrtc::DesktopFrame> frame(CreateTestFrame(frame_size));
 
   // Lossy encode the first frame.
   encoder->SetLosslessEncode(false);
-  scoped_ptr<VideoPacket> lossy_packet = encoder->Encode(*frame);
+  std::unique_ptr<VideoPacket> lossy_packet = encoder->Encode(*frame);
 
   // Lossless encode the second frame.
   encoder->SetLosslessEncode(true);
-  scoped_ptr<VideoPacket> lossless_packet = encoder->Encode(*frame);
+  std::unique_ptr<VideoPacket> lossless_packet = encoder->Encode(*frame);
   // Lossless encode is so good that the frames are smaller than the lossy
   // encodes. This comparison needs to be revisited.
   // http://crbug.com/439166
@@ -80,18 +80,18 @@
 
 // Test that the VP9 encoder can switch between lossy & lossless color.
 TEST(VideoEncoderVpxTest, Vp9LossyColorSwitching) {
-  scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP9());
+  std::unique_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP9());
 
   webrtc::DesktopSize frame_size(100, 100);
-  scoped_ptr<webrtc::DesktopFrame> frame(CreateTestFrame(frame_size));
+  std::unique_ptr<webrtc::DesktopFrame> frame(CreateTestFrame(frame_size));
 
   // Lossy encode the first frame.
   encoder->SetLosslessColor(false);
-  scoped_ptr<VideoPacket> lossy_packet = encoder->Encode(*frame);
+  std::unique_ptr<VideoPacket> lossy_packet = encoder->Encode(*frame);
 
   // Lossless encode the second frame.
   encoder->SetLosslessColor(true);
-  scoped_ptr<VideoPacket> lossless_packet = encoder->Encode(*frame);
+  std::unique_ptr<VideoPacket> lossless_packet = encoder->Encode(*frame);
 
   // Lossy encode one more frame.
   encoder->SetLosslessColor(false);
@@ -100,15 +100,15 @@
 
 // Test that the VP8 encoder ignores lossless modes without crashing.
 TEST(VideoEncoderVpxTest, Vp8IgnoreLossy) {
-  scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP8());
+  std::unique_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP8());
 
   webrtc::DesktopSize frame_size(100, 100);
-  scoped_ptr<webrtc::DesktopFrame> frame(CreateTestFrame(frame_size));
+  std::unique_ptr<webrtc::DesktopFrame> frame(CreateTestFrame(frame_size));
 
   // Encode a frame, to give the encoder a chance to crash if misconfigured.
   encoder->SetLosslessEncode(true);
   encoder->SetLosslessColor(true);
-  scoped_ptr<VideoPacket> packet = encoder->Encode(*frame);
+  std::unique_ptr<VideoPacket> packet = encoder->Encode(*frame);
   EXPECT_TRUE(packet);
 }
 
@@ -117,11 +117,11 @@
 TEST(VideoEncoderVpxTest, Vp8SizeChangeNoCrash) {
   webrtc::DesktopSize frame_size(100, 100);
 
-  scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP8());
+  std::unique_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP8());
 
   // Create first frame & encode it.
-  scoped_ptr<webrtc::DesktopFrame> frame(CreateTestFrame(frame_size));
-  scoped_ptr<VideoPacket> packet = encoder->Encode(*frame);
+  std::unique_ptr<webrtc::DesktopFrame> frame(CreateTestFrame(frame_size));
+  std::unique_ptr<VideoPacket> packet = encoder->Encode(*frame);
   EXPECT_TRUE(packet);
 
   // Double the size of the frame, and updated region, and encode again.
@@ -136,11 +136,11 @@
 TEST(VideoEncoderVpxTest, Vp9SizeChangeNoCrash) {
   webrtc::DesktopSize frame_size(100, 100);
 
-  scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP9());
+  std::unique_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP9());
 
   // Create first frame & encode it.
-  scoped_ptr<webrtc::DesktopFrame> frame(CreateTestFrame(frame_size));
-  scoped_ptr<VideoPacket> packet = encoder->Encode(*frame);
+  std::unique_ptr<webrtc::DesktopFrame> frame(CreateTestFrame(frame_size));
+  std::unique_ptr<VideoPacket> packet = encoder->Encode(*frame);
   EXPECT_TRUE(packet);
 
   // Double the size of the frame, and updated region, and encode again.
@@ -155,28 +155,28 @@
 TEST(VideoEncoderVpxTest, DpiPropagation) {
   webrtc::DesktopSize frame_size(32, 32);
 
-  scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP8());
+  std::unique_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP8());
 
-  scoped_ptr<webrtc::DesktopFrame> frame(CreateTestFrame(frame_size));
+  std::unique_ptr<webrtc::DesktopFrame> frame(CreateTestFrame(frame_size));
   frame->set_dpi(webrtc::DesktopVector(96, 97));
-  scoped_ptr<VideoPacket> packet = encoder->Encode(*frame);
+  std::unique_ptr<VideoPacket> packet = encoder->Encode(*frame);
   EXPECT_EQ(packet->format().x_dpi(), 96);
   EXPECT_EQ(packet->format().y_dpi(), 97);
 }
 
 TEST(VideoEncoderVpxTest, Vp8EncodeUnchangedFrame) {
-  scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP8());
+  std::unique_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP8());
   TestVideoEncoderEmptyFrames(encoder.get(), 0);
 }
 
 TEST(VideoEncoderVpxTest, Vp9LosslessUnchangedFrame) {
-  scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP9());
+  std::unique_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP9());
   encoder->SetLosslessEncode(true);
   TestVideoEncoderEmptyFrames(encoder.get(), 0);
 }
 
 TEST(VideoEncoderVpxTest, Vp9LossyUnchangedFrame) {
-  scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP9());
+  std::unique_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP9());
   encoder->SetLosslessEncode(false);
   // Expect that VP9+CR should generate no more than 10 top-off frames
   // per cycle, and take no more than 2 cycles to top-off.
diff --git a/remoting/host/audio_capturer.h b/remoting/host/audio_capturer.h
index 97ea46b15..c799499 100644
--- a/remoting/host/audio_capturer.h
+++ b/remoting/host/audio_capturer.h
@@ -5,8 +5,9 @@
 #ifndef REMOTING_HOST_AUDIO_CAPTURER_H_
 #define REMOTING_HOST_AUDIO_CAPTURER_H_
 
+#include <memory>
+
 #include "base/callback.h"
-#include "base/memory/scoped_ptr.h"
 
 namespace remoting {
 
@@ -14,7 +15,7 @@
 
 class AudioCapturer {
  public:
-  typedef base::Callback<void(scoped_ptr<AudioPacket> packet)>
+  typedef base::Callback<void(std::unique_ptr<AudioPacket> packet)>
       PacketCapturedCallback;
 
   virtual ~AudioCapturer() {}
@@ -22,7 +23,7 @@
   // Returns true if audio capturing is supported on this platform. If this
   // returns true, then Create() must not return nullptr.
   static bool IsSupported();
-  static scoped_ptr<AudioCapturer> Create();
+  static std::unique_ptr<AudioCapturer> Create();
 
   // Capturers should sample at a 44.1 or 48 kHz sampling rate, in uncompressed
   // PCM stereo format. Capturers may choose the number of frames per packet.
diff --git a/remoting/host/audio_capturer_linux.cc b/remoting/host/audio_capturer_linux.cc
index dea720a..bce9b6a 100644
--- a/remoting/host/audio_capturer_linux.cc
+++ b/remoting/host/audio_capturer_linux.cc
@@ -5,11 +5,13 @@
 #include "remoting/host/audio_capturer_linux.h"
 
 #include <stdint.h>
+
 #include <utility>
 
 #include "base/files/file_path.h"
 #include "base/lazy_instance.h"
 #include "base/logging.h"
+#include "base/memory/ptr_util.h"
 #include "remoting/proto/audio.pb.h"
 
 namespace remoting {
@@ -61,7 +63,7 @@
     return;
   }
 
-  scoped_ptr<AudioPacket> packet(new AudioPacket());
+  std::unique_ptr<AudioPacket> packet(new AudioPacket());
   packet->add_data(data->data());
   packet->set_encoding(AudioPacket::ENCODING_RAW);
   packet->set_sampling_rate(AudioPipeReader::kSamplingRate);
@@ -74,12 +76,12 @@
   return g_pulseaudio_pipe_sink_reader.Get().get() != nullptr;
 }
 
-scoped_ptr<AudioCapturer> AudioCapturer::Create() {
+std::unique_ptr<AudioCapturer> AudioCapturer::Create() {
   scoped_refptr<AudioPipeReader> reader =
       g_pulseaudio_pipe_sink_reader.Get();
   if (!reader.get())
     return nullptr;
-  return make_scoped_ptr(new AudioCapturerLinux(reader));
+  return base::WrapUnique(new AudioCapturerLinux(reader));
 }
 
 }  // namespace remoting
diff --git a/remoting/host/audio_capturer_mac.cc b/remoting/host/audio_capturer_mac.cc
index 6ccf61f..1ddd3e9fb 100644
--- a/remoting/host/audio_capturer_mac.cc
+++ b/remoting/host/audio_capturer_mac.cc
@@ -11,7 +11,7 @@
   return false;
 }
 
-scoped_ptr<AudioCapturer> AudioCapturer::Create() {
+std::unique_ptr<AudioCapturer> AudioCapturer::Create() {
   NOTIMPLEMENTED();
   return nullptr;
 }
diff --git a/remoting/host/audio_capturer_win.cc b/remoting/host/audio_capturer_win.cc
index 86fd9595..24a4c61 100644
--- a/remoting/host/audio_capturer_win.cc
+++ b/remoting/host/audio_capturer_win.cc
@@ -15,6 +15,7 @@
 #include <utility>
 
 #include "base/logging.h"
+#include "base/memory/ptr_util.h"
 
 namespace {
 const int kChannels = 2;
@@ -267,7 +268,7 @@
     }
   }
 
-  scoped_ptr<AudioPacket> packet(new AudioPacket());
+  std::unique_ptr<AudioPacket> packet(new AudioPacket());
   packet->add_data(data, frames * wave_format_ex_->nBlockAlign);
   packet->set_encoding(AudioPacket::ENCODING_RAW);
   packet->set_sampling_rate(sampling_rate_);
@@ -325,8 +326,8 @@
   return true;
 }
 
-scoped_ptr<AudioCapturer> AudioCapturer::Create() {
-  return make_scoped_ptr(new AudioCapturerWin());
+std::unique_ptr<AudioCapturer> AudioCapturer::Create() {
+  return base::WrapUnique(new AudioCapturerWin());
 }
 
 }  // namespace remoting
diff --git a/remoting/host/audio_capturer_win.h b/remoting/host/audio_capturer_win.h
index 11070be..832cddce 100644
--- a/remoting/host/audio_capturer_win.h
+++ b/remoting/host/audio_capturer_win.h
@@ -8,8 +8,9 @@
 #include <audioclient.h>
 #include <mmdeviceapi.h>
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/threading/thread_checker.h"
 #include "base/timer/timer.h"
 #include "base/win/scoped_co_mem.h"
@@ -47,7 +48,7 @@
 
   AudioPacket::SamplingRate sampling_rate_;
 
-  scoped_ptr<base::RepeatingTimer> capture_timer_;
+  std::unique_ptr<base::RepeatingTimer> capture_timer_;
   base::TimeDelta audio_device_period_;
 
   AudioSilenceDetector silence_detector_;
diff --git a/remoting/host/audio_pump.cc b/remoting/host/audio_pump.cc
index d6b799d..89a590d 100644
--- a/remoting/host/audio_pump.cc
+++ b/remoting/host/audio_pump.cc
@@ -24,40 +24,40 @@
 
 class AudioPump::Core {
    public:
-  Core(base::WeakPtr<AudioPump> pump,
-       scoped_ptr<AudioCapturer> audio_capturer,
-       scoped_ptr<AudioEncoder> audio_encoder);
-  ~Core();
+    Core(base::WeakPtr<AudioPump> pump,
+         std::unique_ptr<AudioCapturer> audio_capturer,
+         std::unique_ptr<AudioEncoder> audio_encoder);
+    ~Core();
 
-  void Start();
-  void Pause(bool pause);
+    void Start();
+    void Pause(bool pause);
 
-  void OnPacketSent(int size);
+    void OnPacketSent(int size);
 
- private:
-  void EncodeAudioPacket(scoped_ptr<AudioPacket> packet);
+   private:
+    void EncodeAudioPacket(std::unique_ptr<AudioPacket> packet);
 
-  base::ThreadChecker thread_checker_;
+    base::ThreadChecker thread_checker_;
 
-  base::WeakPtr<AudioPump> pump_;
+    base::WeakPtr<AudioPump> pump_;
 
-  scoped_refptr<base::SingleThreadTaskRunner> pump_task_runner_;
+    scoped_refptr<base::SingleThreadTaskRunner> pump_task_runner_;
 
-  scoped_ptr<AudioCapturer> audio_capturer_;
-  scoped_ptr<AudioEncoder> audio_encoder_;
+    std::unique_ptr<AudioCapturer> audio_capturer_;
+    std::unique_ptr<AudioEncoder> audio_encoder_;
 
-  bool enabled_;
+    bool enabled_;
 
-  // Number of bytes in the queue that have been encoded but haven't been sent
-  // yet.
-  int bytes_pending_;
+    // Number of bytes in the queue that have been encoded but haven't been sent
+    // yet.
+    int bytes_pending_;
 
-  DISALLOW_COPY_AND_ASSIGN(Core);
+    DISALLOW_COPY_AND_ASSIGN(Core);
 };
 
 AudioPump::Core::Core(base::WeakPtr<AudioPump> pump,
-                      scoped_ptr<AudioCapturer> audio_capturer,
-                      scoped_ptr<AudioEncoder> audio_encoder)
+                      std::unique_ptr<AudioCapturer> audio_capturer,
+                      std::unique_ptr<AudioEncoder> audio_encoder)
     : pump_(pump),
       pump_task_runner_(base::ThreadTaskRunnerHandle::Get()),
       audio_capturer_(std::move(audio_capturer)),
@@ -91,7 +91,7 @@
   DCHECK_GE(bytes_pending_, 0);
 }
 
-void AudioPump::Core::EncodeAudioPacket(scoped_ptr<AudioPacket> packet) {
+void AudioPump::Core::EncodeAudioPacket(std::unique_ptr<AudioPacket> packet) {
   DCHECK(thread_checker_.CalledOnValidThread());
   DCHECK(packet);
 
@@ -100,7 +100,7 @@
   if (!enabled_ || bytes_pending_ > max_buffered_bytes)
     return;
 
-  scoped_ptr<AudioPacket> encoded_packet =
+  std::unique_ptr<AudioPacket> encoded_packet =
       audio_encoder_->Encode(std::move(packet));
 
   // The audio encoder returns a null audio packet if there's no audio to send.
@@ -117,8 +117,8 @@
 
 AudioPump::AudioPump(
     scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner,
-    scoped_ptr<AudioCapturer> audio_capturer,
-    scoped_ptr<AudioEncoder> audio_encoder,
+    std::unique_ptr<AudioCapturer> audio_capturer,
+    std::unique_ptr<AudioEncoder> audio_encoder,
     protocol::AudioStub* audio_stub)
     : audio_task_runner_(audio_task_runner),
       audio_stub_(audio_stub),
@@ -146,7 +146,7 @@
       base::Bind(&Core::Pause, base::Unretained(core_.get()), pause));
 }
 
-void AudioPump::SendAudioPacket(scoped_ptr<AudioPacket> packet, int size) {
+void AudioPump::SendAudioPacket(std::unique_ptr<AudioPacket> packet, int size) {
   DCHECK(thread_checker_.CalledOnValidThread());
   DCHECK(packet);
 
diff --git a/remoting/host/audio_pump.h b/remoting/host/audio_pump.h
index dc4e9bf..3f1fcff7 100644
--- a/remoting/host/audio_pump.h
+++ b/remoting/host/audio_pump.h
@@ -5,9 +5,10 @@
 #ifndef REMOTING_HOST_AUDIO_PUMP_H_
 #define REMOTING_HOST_AUDIO_PUMP_H_
 
+#include <memory>
+
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/threading/thread_checker.h"
 
@@ -34,8 +35,8 @@
   // The caller must ensure that the |audio_stub| is not destroyed until the
   // pump is destroyed.
   AudioPump(scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner,
-            scoped_ptr<AudioCapturer> audio_capturer,
-            scoped_ptr<AudioEncoder> audio_encoder,
+            std::unique_ptr<AudioCapturer> audio_capturer,
+            std::unique_ptr<AudioEncoder> audio_encoder,
             protocol::AudioStub* audio_stub);
   virtual ~AudioPump();
 
@@ -48,7 +49,7 @@
   class Core;
 
   // Called on the network thread to send a captured packet to the audio stub.
-  void SendAudioPacket(scoped_ptr<AudioPacket> packet, int size);
+  void SendAudioPacket(std::unique_ptr<AudioPacket> packet, int size);
 
   // Callback for BufferedSocketWriter.
   void OnPacketSent(int size);
@@ -58,7 +59,7 @@
   scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner_;
   protocol::AudioStub* audio_stub_;
 
-  scoped_ptr<Core> core_;
+  std::unique_ptr<Core> core_;
 
   base::WeakPtrFactory<AudioPump> weak_factory_;
 
diff --git a/remoting/host/audio_pump_unittest.cc b/remoting/host/audio_pump_unittest.cc
index b0b0dee7..b9f88e2d 100644
--- a/remoting/host/audio_pump_unittest.cc
+++ b/remoting/host/audio_pump_unittest.cc
@@ -9,6 +9,7 @@
 #include <utility>
 
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/memory/scoped_vector.h"
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
@@ -23,8 +24,8 @@
 namespace {
 
 // Creates a dummy packet with 1k data
-scoped_ptr<AudioPacket> MakeAudioPacket() {
-  scoped_ptr<AudioPacket> packet(new AudioPacket);
+std::unique_ptr<AudioPacket> MakeAudioPacket() {
+  std::unique_ptr<AudioPacket> packet(new AudioPacket);
   packet->add_data()->resize(1000);
   return packet;
 }
@@ -54,7 +55,8 @@
   FakeAudioEncoder() {}
   ~FakeAudioEncoder() override {}
 
-  scoped_ptr<AudioPacket> Encode(scoped_ptr<AudioPacket> packet) override {
+  std::unique_ptr<AudioPacket> Encode(
+      std::unique_ptr<AudioPacket> packet) override {
     return packet;
   }
   int GetBitrate() override {
@@ -73,7 +75,7 @@
   void TearDown() override;
 
   // protocol::AudioStub interface.
-  void ProcessAudioPacket(scoped_ptr<AudioPacket> audio_packet,
+  void ProcessAudioPacket(std::unique_ptr<AudioPacket> audio_packet,
                           const base::Closure& done) override;
 
  protected:
@@ -83,7 +85,7 @@
   FakeAudioCapturer* capturer_;
   FakeAudioEncoder* encoder_;
 
-  scoped_ptr<AudioPump> pump_;
+  std::unique_ptr<AudioPump> pump_;
 
   ScopedVector<AudioPacket> sent_packets_;
   std::vector<base::Closure> done_closures_;
@@ -96,8 +98,8 @@
   capturer_ = new FakeAudioCapturer();
   encoder_ = new FakeAudioEncoder();
   pump_.reset(new AudioPump(message_loop_.task_runner(),
-                            make_scoped_ptr(capturer_),
-                            make_scoped_ptr(encoder_), this));
+                            base::WrapUnique(capturer_),
+                            base::WrapUnique(encoder_), this));
 }
 
 void AudioPumpTest::TearDown() {
@@ -108,7 +110,7 @@
 }
 
 void AudioPumpTest::ProcessAudioPacket(
-    scoped_ptr<AudioPacket> audio_packet,
+    std::unique_ptr<AudioPacket> audio_packet,
     const base::Closure& done) {
   sent_packets_.push_back(std::move(audio_packet));
   done_closures_.push_back(done);
diff --git a/remoting/host/backoff_timer.cc b/remoting/host/backoff_timer.cc
index 5f2c07d..1df5559 100644
--- a/remoting/host/backoff_timer.cc
+++ b/remoting/host/backoff_timer.cc
@@ -33,7 +33,7 @@
   backoff_entry_.reset();
 };
 
-void BackoffTimer::SetTimerForTest(scoped_ptr<base::Timer> timer) {
+void BackoffTimer::SetTimerForTest(std::unique_ptr<base::Timer> timer) {
   timer_ = std::move(timer);
 }
 
diff --git a/remoting/host/backoff_timer.h b/remoting/host/backoff_timer.h
index a75a8d30..5f4ab36e 100644
--- a/remoting/host/backoff_timer.h
+++ b/remoting/host/backoff_timer.h
@@ -5,9 +5,10 @@
 #ifndef REMOTING_HOST_BACKOFF_TIMER_H_
 #define REMOTING_HOST_BACKOFF_TIMER_H_
 
+#include <memory>
+
 #include "base/callback.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/timer/timer.h"
 #include "net/base/backoff_entry.h"
 
@@ -33,17 +34,17 @@
   // Returns true if the user task may be invoked in the future.
   bool IsRunning() const { return !!backoff_entry_; }
 
-  void SetTimerForTest(scoped_ptr<base::Timer> timer);
+  void SetTimerForTest(std::unique_ptr<base::Timer> timer);
 
  private:
   void StartTimer();
   void OnTimerFired();
 
-  scoped_ptr<base::Timer> timer_;
+  std::unique_ptr<base::Timer> timer_;
   base::Closure user_task_;
   tracked_objects::Location posted_from_;
   net::BackoffEntry::Policy backoff_policy_ = {};
-  scoped_ptr<net::BackoffEntry> backoff_entry_;
+  std::unique_ptr<net::BackoffEntry> backoff_entry_;
 
   DISALLOW_COPY_AND_ASSIGN(BackoffTimer);
 };
diff --git a/remoting/host/backoff_timer_unittest.cc b/remoting/host/backoff_timer_unittest.cc
index 0dfb9d7..fe52bcd 100644
--- a/remoting/host/backoff_timer_unittest.cc
+++ b/remoting/host/backoff_timer_unittest.cc
@@ -4,6 +4,7 @@
 
 #include "remoting/host/backoff_timer.h"
 
+#include "base/memory/ptr_util.h"
 #include "base/timer/mock_timer.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
@@ -20,7 +21,7 @@
 TEST(BackoffTimer, Basic) {
   base::MockTimer* mock_timer = new base::MockTimer(false, false);
   BackoffTimer backoff_timer;
-  backoff_timer.SetTimerForTest(make_scoped_ptr(mock_timer));
+  backoff_timer.SetTimerForTest(base::WrapUnique(mock_timer));
   ASSERT_FALSE(backoff_timer.IsRunning());
 
   int counter = 0;
diff --git a/remoting/host/basic_desktop_environment.cc b/remoting/host/basic_desktop_environment.cc
index 0f18f98b..d73bfac 100644
--- a/remoting/host/basic_desktop_environment.cc
+++ b/remoting/host/basic_desktop_environment.cc
@@ -6,6 +6,7 @@
 
 #include "base/bind.h"
 #include "base/logging.h"
+#include "base/memory/ptr_util.h"
 #include "base/single_thread_task_runner.h"
 #include "build/build_config.h"
 #include "remoting/host/audio_capturer.h"
@@ -33,27 +34,28 @@
   DCHECK(caller_task_runner_->BelongsToCurrentThread());
 }
 
-scoped_ptr<AudioCapturer> BasicDesktopEnvironment::CreateAudioCapturer() {
+std::unique_ptr<AudioCapturer> BasicDesktopEnvironment::CreateAudioCapturer() {
   DCHECK(caller_task_runner_->BelongsToCurrentThread());
 
   return AudioCapturer::Create();
 }
 
-scoped_ptr<InputInjector> BasicDesktopEnvironment::CreateInputInjector() {
+std::unique_ptr<InputInjector> BasicDesktopEnvironment::CreateInputInjector() {
   DCHECK(caller_task_runner_->BelongsToCurrentThread());
 
   return InputInjector::Create(input_task_runner(), ui_task_runner());
 }
 
-scoped_ptr<ScreenControls> BasicDesktopEnvironment::CreateScreenControls() {
+std::unique_ptr<ScreenControls>
+BasicDesktopEnvironment::CreateScreenControls() {
   DCHECK(caller_task_runner_->BelongsToCurrentThread());
 
   return nullptr;
 }
 
-scoped_ptr<webrtc::MouseCursorMonitor>
+std::unique_ptr<webrtc::MouseCursorMonitor>
 BasicDesktopEnvironment::CreateMouseCursorMonitor() {
-  scoped_ptr<webrtc::MouseCursorMonitor> cursor_monitor;
+  std::unique_ptr<webrtc::MouseCursorMonitor> cursor_monitor;
 
 #if defined(OS_CHROMEOS)
   cursor_monitor.reset(new MouseCursorMonitorAura());
@@ -61,7 +63,7 @@
   cursor_monitor.reset(webrtc::MouseCursorMonitor::CreateForScreen(
       *desktop_capture_options_, webrtc::kFullDesktopScreenId));
 #endif
-  return make_scoped_ptr(new MouseCursorMonitorProxy(
+  return base::WrapUnique(new MouseCursorMonitorProxy(
       video_capture_task_runner_, std::move(cursor_monitor)));
 }
 
@@ -75,11 +77,11 @@
 void BasicDesktopEnvironment::SetCapabilities(const std::string& capabilities) {
 }
 
-scoped_ptr<webrtc::DesktopCapturer>
+std::unique_ptr<webrtc::DesktopCapturer>
 BasicDesktopEnvironment::CreateVideoCapturer() {
   DCHECK(caller_task_runner_->BelongsToCurrentThread());
 
-  scoped_ptr<webrtc::DesktopCapturer> capturer;
+  std::unique_ptr<webrtc::DesktopCapturer> capturer;
 
 #if defined(OS_CHROMEOS)
   capturer.reset(new AuraDesktopCapturer());
@@ -87,8 +89,8 @@
   capturer.reset(webrtc::ScreenCapturer::Create(*desktop_capture_options_));
 #endif  // !defined(OS_CHROMEOS)
 
-  return make_scoped_ptr(new DesktopCapturerProxy(video_capture_task_runner_,
-                                                  std::move(capturer)));
+  return base::WrapUnique(new DesktopCapturerProxy(video_capture_task_runner_,
+                                                   std::move(capturer)));
 }
 
 BasicDesktopEnvironment::BasicDesktopEnvironment(
diff --git a/remoting/host/basic_desktop_environment.h b/remoting/host/basic_desktop_environment.h
index 5ed174e..8eb9e710 100644
--- a/remoting/host/basic_desktop_environment.h
+++ b/remoting/host/basic_desktop_environment.h
@@ -5,12 +5,12 @@
 #ifndef REMOTING_HOST_BASIC_DESKTOP_ENVIRONMENT_H_
 #define REMOTING_HOST_BASIC_DESKTOP_ENVIRONMENT_H_
 
+#include <memory>
 #include <string>
 
 #include "base/compiler_specific.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "remoting/host/desktop_environment.h"
 
 namespace webrtc {
@@ -28,11 +28,12 @@
   ~BasicDesktopEnvironment() override;
 
   // DesktopEnvironment implementation.
-  scoped_ptr<AudioCapturer> CreateAudioCapturer() override;
-  scoped_ptr<InputInjector> CreateInputInjector() override;
-  scoped_ptr<ScreenControls> CreateScreenControls() override;
-  scoped_ptr<webrtc::DesktopCapturer> CreateVideoCapturer() override;
-  scoped_ptr<webrtc::MouseCursorMonitor> CreateMouseCursorMonitor() override;
+  std::unique_ptr<AudioCapturer> CreateAudioCapturer() override;
+  std::unique_ptr<InputInjector> CreateInputInjector() override;
+  std::unique_ptr<ScreenControls> CreateScreenControls() override;
+  std::unique_ptr<webrtc::DesktopCapturer> CreateVideoCapturer() override;
+  std::unique_ptr<webrtc::MouseCursorMonitor> CreateMouseCursorMonitor()
+      override;
   std::string GetCapabilities() const override;
   void SetCapabilities(const std::string& capabilities) override;
 
@@ -86,7 +87,7 @@
   // Also: it's dynamically allocated to avoid having to bring in
   // desktop_capture_options.h which brings in X11 headers which causes hard to
   // find build errors.
-  scoped_ptr<webrtc::DesktopCaptureOptions> desktop_capture_options_;
+  std::unique_ptr<webrtc::DesktopCaptureOptions> desktop_capture_options_;
 
   // True if the touch events capability should be offered.
   const bool supports_touch_events_;
diff --git a/remoting/host/chromeos/aura_desktop_capturer.cc b/remoting/host/chromeos/aura_desktop_capturer.cc
index dbaea58..ee80cd2 100644
--- a/remoting/host/chromeos/aura_desktop_capturer.cc
+++ b/remoting/host/chromeos/aura_desktop_capturer.cc
@@ -42,11 +42,9 @@
 }
 
 void AuraDesktopCapturer::Capture(const webrtc::DesktopRegion&) {
-  scoped_ptr<cc::CopyOutputRequest> request =
-      cc::CopyOutputRequest::CreateBitmapRequest(
-          base::Bind(
-              &AuraDesktopCapturer::OnFrameCaptured,
-              weak_factory_.GetWeakPtr()));
+  std::unique_ptr<cc::CopyOutputRequest> request =
+      cc::CopyOutputRequest::CreateBitmapRequest(base::Bind(
+          &AuraDesktopCapturer::OnFrameCaptured, weak_factory_.GetWeakPtr()));
 
   gfx::Rect window_rect(desktop_window_->bounds().size());
 
@@ -55,7 +53,7 @@
 }
 
 void AuraDesktopCapturer::OnFrameCaptured(
-    scoped_ptr<cc::CopyOutputResult> result) {
+    std::unique_ptr<cc::CopyOutputResult> result) {
   if (result->IsEmpty()) {
     callback_->OnCaptureCompleted(nullptr);
     return;
@@ -63,9 +61,9 @@
 
   DCHECK(result->HasBitmap());
 
-  scoped_ptr<SkBitmap> bitmap = result->TakeBitmap();
+  std::unique_ptr<SkBitmap> bitmap = result->TakeBitmap();
 
-  scoped_ptr<webrtc::DesktopFrame> frame(
+  std::unique_ptr<webrtc::DesktopFrame> frame(
       SkiaBitmapDesktopFrame::Create(std::move(bitmap)));
 
   // |VideoFramePump| will not encode the frame if |updated_region| is empty.
diff --git a/remoting/host/chromeos/aura_desktop_capturer.h b/remoting/host/chromeos/aura_desktop_capturer.h
index 624c70aa..d3618fc 100644
--- a/remoting/host/chromeos/aura_desktop_capturer.h
+++ b/remoting/host/chromeos/aura_desktop_capturer.h
@@ -5,8 +5,9 @@
 #ifndef REMOTING_HOST_CHROMEOS_AURA_DESKTOP_CAPTURER_H_
 #define REMOTING_HOST_CHROMEOS_AURA_DESKTOP_CAPTURER_H_
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h"
 
@@ -37,7 +38,7 @@
   friend class AuraDesktopCapturerTest;
 
   // Called when a copy of the layer is captured.
-  void OnFrameCaptured(scoped_ptr<cc::CopyOutputResult> result);
+  void OnFrameCaptured(std::unique_ptr<cc::CopyOutputResult> result);
 
   // Points to the callback passed to webrtc::DesktopCapturer::Start().
   webrtc::DesktopCapturer::Callback* callback_;
diff --git a/remoting/host/chromeos/aura_desktop_capturer_unittest.cc b/remoting/host/chromeos/aura_desktop_capturer_unittest.cc
index 9d35291..754bb45 100644
--- a/remoting/host/chromeos/aura_desktop_capturer_unittest.cc
+++ b/remoting/host/chromeos/aura_desktop_capturer_unittest.cc
@@ -50,7 +50,7 @@
 
  protected:
   void SimulateFrameCapture() {
-    scoped_ptr<SkBitmap> bitmap(new SkBitmap());
+    std::unique_ptr<SkBitmap> bitmap(new SkBitmap());
     const SkImageInfo& info =
         SkImageInfo::Make(3, 4, kBGRA_8888_SkColorType, kPremul_SkAlphaType);
     bitmap->installPixels(info, const_cast<unsigned char*>(frame_data), 12);
@@ -59,7 +59,7 @@
         cc::CopyOutputResult::CreateBitmapResult(std::move(bitmap)));
   }
 
-  scoped_ptr<AuraDesktopCapturer> capturer_;
+  std::unique_ptr<AuraDesktopCapturer> capturer_;
 };
 
 void AuraDesktopCapturerTest::SetUp() {
diff --git a/remoting/host/chromeos/clipboard_aura.cc b/remoting/host/chromeos/clipboard_aura.cc
index ef0438b9..02b593b05 100644
--- a/remoting/host/chromeos/clipboard_aura.cc
+++ b/remoting/host/chromeos/clipboard_aura.cc
@@ -6,6 +6,7 @@
 
 #include <utility>
 
+#include "base/memory/ptr_util.h"
 #include "base/strings/utf_string_conversions.h"
 #include "remoting/base/constants.h"
 #include "remoting/proto/event.pb.h"
@@ -32,7 +33,7 @@
 }
 
 void ClipboardAura::Start(
-    scoped_ptr<protocol::ClipboardStub> client_clipboard) {
+    std::unique_ptr<protocol::ClipboardStub> client_clipboard) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
   client_clipboard_ = std::move(client_clipboard);
@@ -90,8 +91,8 @@
   client_clipboard_->InjectClipboardEvent(event);
 }
 
-scoped_ptr<Clipboard> Clipboard::Create() {
-  return make_scoped_ptr(new ClipboardAura());
+std::unique_ptr<Clipboard> Clipboard::Create() {
+  return base::WrapUnique(new ClipboardAura());
 }
 
 }  // namespace remoting
diff --git a/remoting/host/chromeos/clipboard_aura.h b/remoting/host/chromeos/clipboard_aura.h
index 6642f655..3949b476 100644
--- a/remoting/host/chromeos/clipboard_aura.h
+++ b/remoting/host/chromeos/clipboard_aura.h
@@ -7,8 +7,9 @@
 
 #include <stdint.h>
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/threading/thread_checker.h"
 #include "base/timer/timer.h"
 #include "remoting/host/clipboard.h"
@@ -35,7 +36,8 @@
   ~ClipboardAura() override;
 
   // Clipboard interface.
-  void Start(scoped_ptr<protocol::ClipboardStub> client_clipboard) override;
+  void Start(
+      std::unique_ptr<protocol::ClipboardStub> client_clipboard) override;
   void InjectClipboardEvent(const protocol::ClipboardEvent& event) override;
 
   // Overrides the clipboard polling interval for unit test.
@@ -45,7 +47,7 @@
   void CheckClipboardForChanges();
 
   base::ThreadChecker thread_checker_;
-  scoped_ptr<protocol::ClipboardStub> client_clipboard_;
+  std::unique_ptr<protocol::ClipboardStub> client_clipboard_;
   base::RepeatingTimer clipboard_polling_timer_;
   uint64_t current_change_count_;
   base::TimeDelta polling_interval_;
diff --git a/remoting/host/chromeos/clipboard_aura_unittest.cc b/remoting/host/chromeos/clipboard_aura_unittest.cc
index 8894597..2b7d413 100644
--- a/remoting/host/chromeos/clipboard_aura_unittest.cc
+++ b/remoting/host/chromeos/clipboard_aura_unittest.cc
@@ -7,6 +7,7 @@
 #include "base/bind.h"
 #include "base/bind_helpers.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
 #include "base/strings/utf_string_conversions.h"
@@ -57,7 +58,7 @@
 
   base::MessageLoopForUI message_loop_;
   ClientClipboard* client_clipboard_;
-  scoped_ptr<ClipboardAura> clipboard_;
+  std::unique_ptr<ClipboardAura> clipboard_;
 };
 
 void ClipboardAuraTest::SetUp() {
@@ -77,7 +78,7 @@
       << "The test timeout should be greater than the polling interval";
   clipboard_->SetPollingIntervalForTesting(kTestOverridePollingInterval);
 
-  clipboard_->Start(make_scoped_ptr(client_clipboard_));
+  clipboard_->Start(base::WrapUnique(client_clipboard_));
 }
 
 void ClipboardAuraTest::TearDown() {
diff --git a/remoting/host/chromeos/mouse_cursor_monitor_aura.cc b/remoting/host/chromeos/mouse_cursor_monitor_aura.cc
index ed7a0e0..9749ac7b 100644
--- a/remoting/host/chromeos/mouse_cursor_monitor_aura.cc
+++ b/remoting/host/chromeos/mouse_cursor_monitor_aura.cc
@@ -66,7 +66,7 @@
 }
 
 void MouseCursorMonitorAura::NotifyCursorChanged(const ui::Cursor& cursor) {
-  scoped_ptr<SkBitmap> cursor_bitmap(new SkBitmap());
+  std::unique_ptr<SkBitmap> cursor_bitmap(new SkBitmap());
   gfx::Point cursor_hotspot;
 
   if (cursor.native_type() == ui::kCursorNone) {
@@ -96,9 +96,9 @@
     cursor_hotspot.SetPoint(0, 0);
   }
 
-  scoped_ptr<webrtc::DesktopFrame> image(
+  std::unique_ptr<webrtc::DesktopFrame> image(
       SkiaBitmapDesktopFrame::Create(std::move(cursor_bitmap)));
-  scoped_ptr<webrtc::MouseCursor> cursor_shape(new webrtc::MouseCursor(
+  std::unique_ptr<webrtc::MouseCursor> cursor_shape(new webrtc::MouseCursor(
       image.release(),
       webrtc::DesktopVector(cursor_hotspot.x(), cursor_hotspot.y())));
 
diff --git a/remoting/host/chromeos/skia_bitmap_desktop_frame.cc b/remoting/host/chromeos/skia_bitmap_desktop_frame.cc
index dfd9b10..a692a39a 100644
--- a/remoting/host/chromeos/skia_bitmap_desktop_frame.cc
+++ b/remoting/host/chromeos/skia_bitmap_desktop_frame.cc
@@ -14,8 +14,7 @@
 
 // static
 SkiaBitmapDesktopFrame* SkiaBitmapDesktopFrame::Create(
-    scoped_ptr<SkBitmap> bitmap) {
-
+    std::unique_ptr<SkBitmap> bitmap) {
   webrtc::DesktopSize size(bitmap->width(), bitmap->height());
   DCHECK_EQ(kBGRA_8888_SkColorType, bitmap->info().colorType())
       << "DesktopFrame objects always hold RGBA data.";
@@ -34,7 +33,7 @@
 SkiaBitmapDesktopFrame::SkiaBitmapDesktopFrame(webrtc::DesktopSize size,
                                                int stride,
                                                uint8_t* data,
-                                               scoped_ptr<SkBitmap> bitmap)
+                                               std::unique_ptr<SkBitmap> bitmap)
     : DesktopFrame(size, stride, data, nullptr), bitmap_(std::move(bitmap)) {}
 
 SkiaBitmapDesktopFrame::~SkiaBitmapDesktopFrame() {}
diff --git a/remoting/host/chromeos/skia_bitmap_desktop_frame.h b/remoting/host/chromeos/skia_bitmap_desktop_frame.h
index 10ed31aa..f0bc863 100644
--- a/remoting/host/chromeos/skia_bitmap_desktop_frame.h
+++ b/remoting/host/chromeos/skia_bitmap_desktop_frame.h
@@ -4,8 +4,9 @@
 
 #include <stdint.h>
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "third_party/skia/include/core/SkBitmap.h"
 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
 
@@ -15,16 +16,16 @@
 // Frame data is stored in a SkBitmap.
 class SkiaBitmapDesktopFrame : public webrtc::DesktopFrame {
  public:
-  static SkiaBitmapDesktopFrame* Create(scoped_ptr<SkBitmap> bitmap);
+  static SkiaBitmapDesktopFrame* Create(std::unique_ptr<SkBitmap> bitmap);
   ~SkiaBitmapDesktopFrame() override;
 
  private:
   SkiaBitmapDesktopFrame(webrtc::DesktopSize size,
                          int stride,
                          uint8_t* data,
-                         scoped_ptr<SkBitmap> bitmap);
+                         std::unique_ptr<SkBitmap> bitmap);
 
-  scoped_ptr<SkBitmap> bitmap_;
+  std::unique_ptr<SkBitmap> bitmap_;
 
   DISALLOW_COPY_AND_ASSIGN(SkiaBitmapDesktopFrame);
 };
diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc
index c483321..bee95f5 100644
--- a/remoting/host/chromoting_host.cc
+++ b/remoting/host/chromoting_host.cc
@@ -12,6 +12,7 @@
 #include "base/bind.h"
 #include "base/callback.h"
 #include "base/command_line.h"
+#include "base/memory/ptr_util.h"
 #include "build/build_config.h"
 #include "jingle/glue/thread_wrapper.h"
 #include "remoting/base/constants.h"
@@ -64,7 +65,7 @@
 
 ChromotingHost::ChromotingHost(
     DesktopEnvironmentFactory* desktop_environment_factory,
-    scoped_ptr<protocol::SessionManager> session_manager,
+    std::unique_ptr<protocol::SessionManager> session_manager,
     scoped_refptr<protocol::TransportContext> transport_context,
     scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner,
     scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner)
@@ -120,12 +121,12 @@
   status_observers_.RemoveObserver(observer);
 }
 
-void ChromotingHost::AddExtension(scoped_ptr<HostExtension> extension) {
+void ChromotingHost::AddExtension(std::unique_ptr<HostExtension> extension) {
   extensions_.push_back(extension.release());
 }
 
 void ChromotingHost::SetAuthenticatorFactory(
-    scoped_ptr<protocol::AuthenticatorFactory> authenticator_factory) {
+    std::unique_ptr<protocol::AuthenticatorFactory> authenticator_factory) {
   DCHECK(CalledOnValidThread());
   session_manager_->set_authenticator_factory(std::move(authenticator_factory));
 }
@@ -262,14 +263,14 @@
 
   // Create either IceConnectionToClient or WebrtcConnectionToClient.
   // TODO(sergeyu): Move this logic to the protocol layer.
-  scoped_ptr<protocol::ConnectionToClient> connection;
+  std::unique_ptr<protocol::ConnectionToClient> connection;
   if (session->config().protocol() ==
       protocol::SessionConfig::Protocol::WEBRTC) {
     connection.reset(new protocol::WebrtcConnectionToClient(
-        make_scoped_ptr(session), transport_context_));
+        base::WrapUnique(session), transport_context_));
   } else {
     connection.reset(new protocol::IceConnectionToClient(
-        make_scoped_ptr(session), transport_context_,
+        base::WrapUnique(session), transport_context_,
         video_encode_task_runner_));
   }
 
diff --git a/remoting/host/chromoting_host.h b/remoting/host/chromoting_host.h
index 78ae1e4..5186988 100644
--- a/remoting/host/chromoting_host.h
+++ b/remoting/host/chromoting_host.h
@@ -6,11 +6,11 @@
 #define REMOTING_HOST_CHROMOTING_HOST_H_
 
 #include <list>
+#include <memory>
 #include <string>
 
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/scoped_vector.h"
 #include "base/memory/weak_ptr.h"
 #include "base/observer_list.h"
@@ -69,7 +69,7 @@
   // |desktop_environment_factory| must outlive this object.
   ChromotingHost(
       DesktopEnvironmentFactory* desktop_environment_factory,
-      scoped_ptr<protocol::SessionManager> session_manager,
+      std::unique_ptr<protocol::SessionManager> session_manager,
       scoped_refptr<protocol::TransportContext> transport_context,
       scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner,
       scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner);
@@ -88,7 +88,7 @@
   void RemoveStatusObserver(HostStatusObserver* observer) override;
 
   // Registers a host extension.
-  void AddExtension(scoped_ptr<HostExtension> extension);
+  void AddExtension(std::unique_ptr<HostExtension> extension);
 
   // Sets the authenticator factory to use for incoming
   // connections. Incoming connections are rejected until
@@ -97,7 +97,7 @@
   // once per host instance because it may not be safe to delete
   // factory before all authenticators it created are deleted.
   void SetAuthenticatorFactory(
-      scoped_ptr<protocol::AuthenticatorFactory> authenticator_factory);
+      std::unique_ptr<protocol::AuthenticatorFactory> authenticator_factory);
 
   // Enables/disables curtaining when one or more clients are connected.
   // Takes immediate effect if clients are already connected.
@@ -153,7 +153,7 @@
 
   // Parameters specified when the host was created.
   DesktopEnvironmentFactory* desktop_environment_factory_;
-  scoped_ptr<protocol::SessionManager> session_manager_;
+  std::unique_ptr<protocol::SessionManager> session_manager_;
   scoped_refptr<protocol::TransportContext> transport_context_;
   scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner_;
   scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner_;
diff --git a/remoting/host/chromoting_host_context.cc b/remoting/host/chromoting_host_context.cc
index 00f1cf7..8807af4f 100644
--- a/remoting/host/chromoting_host_context.cc
+++ b/remoting/host/chromoting_host_context.cc
@@ -5,6 +5,7 @@
 #include "remoting/host/chromoting_host_context.h"
 
 #include "base/bind.h"
+#include "base/memory/ptr_util.h"
 #include "base/threading/thread_restrictions.h"
 #include "build/build_config.h"
 #include "remoting/base/auto_thread.h"
@@ -43,8 +44,8 @@
 ChromotingHostContext::~ChromotingHostContext() {
 }
 
-scoped_ptr<ChromotingHostContext> ChromotingHostContext::Copy() {
-  return make_scoped_ptr(new ChromotingHostContext(
+std::unique_ptr<ChromotingHostContext> ChromotingHostContext::Copy() {
+  return base::WrapUnique(new ChromotingHostContext(
       ui_task_runner_, audio_task_runner_, file_task_runner_,
       input_task_runner_, network_task_runner_, video_capture_task_runner_,
       video_encode_task_runner_, url_request_context_getter_));
@@ -90,7 +91,7 @@
   return url_request_context_getter_;
 }
 
-scoped_ptr<ChromotingHostContext> ChromotingHostContext::Create(
+std::unique_ptr<ChromotingHostContext> ChromotingHostContext::Create(
     scoped_refptr<AutoThreadTaskRunner> ui_task_runner) {
 #if defined(OS_WIN)
   // On Windows the AudioCapturer requires COM, so we run a single-threaded
@@ -114,10 +115,8 @@
   network_task_runner->PostTask(FROM_HERE,
                                 base::Bind(&DisallowBlockingOperations));
 
-  return make_scoped_ptr(new ChromotingHostContext(
-      ui_task_runner,
-      audio_task_runner,
-      file_task_runner,
+  return base::WrapUnique(new ChromotingHostContext(
+      ui_task_runner, audio_task_runner, file_task_runner,
       AutoThread::CreateWithType("ChromotingInputThread", ui_task_runner,
                                  base::MessageLoop::TYPE_IO),
       network_task_runner,
@@ -130,7 +129,7 @@
 #if defined(OS_CHROMEOS)
 
 // static
-scoped_ptr<ChromotingHostContext> ChromotingHostContext::CreateForChromeOS(
+std::unique_ptr<ChromotingHostContext> ChromotingHostContext::CreateForChromeOS(
     scoped_refptr<net::URLRequestContextGetter> url_request_context_getter,
     scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
     scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
@@ -153,7 +152,7 @@
 
   // Use browser's file thread as the joiner as it is the only browser-thread
   // that allows blocking I/O, which is required by thread joining.
-  return make_scoped_ptr(new ChromotingHostContext(
+  return base::WrapUnique(new ChromotingHostContext(
       ui_auto_task_runner,
       AutoThread::Create("ChromotingAudioThread", file_auto_task_runner),
       file_auto_task_runner,
diff --git a/remoting/host/chromoting_host_context.h b/remoting/host/chromoting_host_context.h
index 74ce93a4..351c1307 100644
--- a/remoting/host/chromoting_host_context.h
+++ b/remoting/host/chromoting_host_context.h
@@ -5,9 +5,10 @@
 #ifndef REMOTING_HOST_CHROMOTING_HOST_CONTEXT_H_
 #define REMOTING_HOST_CHROMOTING_HOST_CONTEXT_H_
 
+#include <memory>
+
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "build/build_config.h"
 
 namespace base {
@@ -30,7 +31,7 @@
   // During shutdown the caller should tear-down the ChromotingHostContext and
   // then continue to run until |ui_task_runner| is no longer referenced.
   // nullptr is returned if any threads fail to start.
-  static scoped_ptr<ChromotingHostContext> Create(
+  static std::unique_ptr<ChromotingHostContext> Create(
       scoped_refptr<AutoThreadTaskRunner> ui_task_runner);
 
 #if defined(OS_CHROMEOS)
@@ -43,7 +44,7 @@
   // violates the "Disallow IO" thread restrictions on some task runners (e.g.
   // the IO Thread of the browser process).
   // Instead, we re-use the |url_request_context_getter| in the browser process.
-  static scoped_ptr<ChromotingHostContext> CreateForChromeOS(
+  static std::unique_ptr<ChromotingHostContext> CreateForChromeOS(
       scoped_refptr<net::URLRequestContextGetter> url_request_context_getter,
       scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
       scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
@@ -52,7 +53,7 @@
 
   ~ChromotingHostContext();
 
-  scoped_ptr<ChromotingHostContext> Copy();
+  std::unique_ptr<ChromotingHostContext> Copy();
 
   // Task runner for the thread that is used for the UI.
   scoped_refptr<AutoThreadTaskRunner> ui_task_runner() const;
diff --git a/remoting/host/chromoting_host_context_unittest.cc b/remoting/host/chromoting_host_context_unittest.cc
index 955135de..b0aefa0 100644
--- a/remoting/host/chromoting_host_context_unittest.cc
+++ b/remoting/host/chromoting_host_context_unittest.cc
@@ -16,7 +16,7 @@
   base::MessageLoopForUI message_loop;
   base::RunLoop run_loop;
 
-  scoped_ptr<ChromotingHostContext> context =
+  std::unique_ptr<ChromotingHostContext> context =
       ChromotingHostContext::Create(new AutoThreadTaskRunner(
           message_loop.task_runner(), run_loop.QuitClosure()));
 
diff --git a/remoting/host/chromoting_host_unittest.cc b/remoting/host/chromoting_host_unittest.cc
index 1b94ed5..6b65884a5 100644
--- a/remoting/host/chromoting_host_unittest.cc
+++ b/remoting/host/chromoting_host_unittest.cc
@@ -4,11 +4,12 @@
 
 #include "remoting/host/chromoting_host.h"
 
+#include <memory>
 #include <utility>
 
 #include "base/bind.h"
 #include "base/bind_helpers.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
 #include "remoting/base/auto_thread_task_runner.h"
 #include "remoting/host/audio_capturer.h"
 #include "remoting/host/chromoting_host_context.h"
@@ -64,7 +65,7 @@
     session_manager_ = new protocol::MockSessionManager();
 
     host_.reset(new ChromotingHost(
-        desktop_environment_factory_.get(), make_scoped_ptr(session_manager_),
+        desktop_environment_factory_.get(), base::WrapUnique(session_manager_),
         protocol::TransportContext::ForTests(protocol::TransportRole::SERVER),
         task_runner_,    // Audio
         task_runner_));  // Video encode
@@ -106,13 +107,13 @@
         .WillRepeatedly(ReturnRef(*session_config2_));
 
     owned_connection1_.reset(
-        new protocol::FakeConnectionToClient(make_scoped_ptr(session1_)));
+        new protocol::FakeConnectionToClient(base::WrapUnique(session1_)));
     owned_connection1_->set_host_stub(&host_stub1_);
     connection1_ = owned_connection1_.get();
     connection1_->set_client_stub(&client_stub1_);
 
     owned_connection2_.reset(
-        new protocol::FakeConnectionToClient(make_scoped_ptr(session2_)));
+        new protocol::FakeConnectionToClient(base::WrapUnique(session2_)));
     owned_connection2_->set_host_stub(&host_stub2_);
     connection2_ = owned_connection2_.get();
     connection2_->set_client_stub(&client_stub2_);
@@ -121,10 +122,10 @@
   // Helper method to pretend a client is connected to ChromotingHost.
   void SimulateClientConnection(int connection_index, bool authenticate,
                                 bool reject) {
-    scoped_ptr<protocol::ConnectionToClient> connection = std::move(
+    std::unique_ptr<protocol::ConnectionToClient> connection = std::move(
         (connection_index == 0) ? owned_connection1_ : owned_connection2_);
     protocol::ConnectionToClient* connection_ptr = connection.get();
-    scoped_ptr<ClientSession> client(new ClientSession(
+    std::unique_ptr<ClientSession> client(new ClientSession(
         host_.get(), task_runner_ /* audio_task_runner */,
         std::move(connection), desktop_environment_factory_.get(),
         base::TimeDelta(), nullptr, std::vector<HostExtension*>()));
@@ -206,30 +207,30 @@
   base::MessageLoop message_loop_;
   scoped_refptr<AutoThreadTaskRunner> task_runner_;
   MockConnectionToClientEventHandler handler_;
-  scoped_ptr<FakeDesktopEnvironmentFactory> desktop_environment_factory_;
+  std::unique_ptr<FakeDesktopEnvironmentFactory> desktop_environment_factory_;
   MockHostStatusObserver host_status_observer_;
-  scoped_ptr<ChromotingHost> host_;
+  std::unique_ptr<ChromotingHost> host_;
   protocol::MockSessionManager* session_manager_;
   std::string xmpp_login_;
   protocol::FakeConnectionToClient* connection1_;
-  scoped_ptr<protocol::FakeConnectionToClient> owned_connection1_;
+  std::unique_ptr<protocol::FakeConnectionToClient> owned_connection1_;
   ClientSession* client1_;
   std::string session_jid1_;
   MockSession* session1_;  // Owned by |connection_|.
-  scoped_ptr<SessionConfig> session_config1_;
+  std::unique_ptr<SessionConfig> session_config1_;
   MockClientStub client_stub1_;
   MockHostStub host_stub1_;
   protocol::FakeConnectionToClient* connection2_;
-  scoped_ptr<protocol::FakeConnectionToClient> owned_connection2_;
+  std::unique_ptr<protocol::FakeConnectionToClient> owned_connection2_;
   ClientSession* client2_;
   std::string session_jid2_;
   MockSession* session2_;  // Owned by |connection2_|.
-  scoped_ptr<SessionConfig> session_config2_;
+  std::unique_ptr<SessionConfig> session_config2_;
   MockClientStub client_stub2_;
   MockHostStub host_stub2_;
-  scoped_ptr<MockSession> session_unowned1_;  // Not owned by a connection.
+  std::unique_ptr<MockSession> session_unowned1_;  // Not owned by a connection.
   std::string session_unowned_jid1_;
-  scoped_ptr<MockSession> session_unowned2_;  // Not owned by a connection.
+  std::unique_ptr<MockSession> session_unowned2_;  // Not owned by a connection.
   std::string session_unowned_jid2_;
   protocol::Session::EventHandler* session_unowned1_event_handler_;
   protocol::Session::EventHandler* session_unowned2_event_handler_;
diff --git a/remoting/host/chromoting_messages.h b/remoting/host/chromoting_messages.h
index c9c5e189..1d2a574 100644
--- a/remoting/host/chromoting_messages.h
+++ b/remoting/host/chromoting_messages.h
@@ -87,13 +87,14 @@
 
 // Serialized remoting::protocol::TransportRoute structure.
 IPC_STRUCT_BEGIN(SerializedTransportRoute)
-  IPC_STRUCT_MEMBER(int, type)
-  IPC_STRUCT_MEMBER(net::IPAddressNumber, remote_address)
-  IPC_STRUCT_MEMBER(uint16_t, remote_port)
-  IPC_STRUCT_MEMBER(net::IPAddressNumber, local_address)
-  IPC_STRUCT_MEMBER(uint16_t, local_port)
+  IPC_STRUCT_MEMBER(remoting::protocol::TransportRoute::RouteType, type)
+  IPC_STRUCT_MEMBER(net::IPEndPoint, remote_address)
+  IPC_STRUCT_MEMBER(net::IPEndPoint, local_address)
 IPC_STRUCT_END()
 
+IPC_ENUM_TRAITS_MAX_VALUE(remoting::protocol::TransportRoute::RouteType,
+                          remoting::protocol::TransportRoute::ROUTE_TYPE_MAX)
+
 // Hosts status notifications (see HostStatusObserver interface) sent by
 // IpcHostEventLogger.
 IPC_MESSAGE_CONTROL1(ChromotingNetworkDaemonMsg_AccessDenied,
@@ -268,4 +269,4 @@
 // The array of bytes representing a security key response from the remote
 // client.  This message is sent over the per-client IPC channel.
 IPC_MESSAGE_CONTROL1(ChromotingNetworkToRemoteSecurityKeyMsg_Response,
-                     std::string /* response bytes */)
\ No newline at end of file
+                     std::string /* response bytes */)
diff --git a/remoting/host/chromoting_param_traits.cc b/remoting/host/chromoting_param_traits.cc
index 89918aa..a440c34 100644
--- a/remoting/host/chromoting_param_traits.cc
+++ b/remoting/host/chromoting_param_traits.cc
@@ -7,6 +7,7 @@
 #include <stdint.h>
 
 #include "base/strings/stringprintf.h"
+#include "ipc/ipc_message_utils.h"
 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
 
 namespace IPC {
@@ -188,5 +189,55 @@
                                p.dpi().x(), p.dpi().y()));
 }
 
+// static
+void ParamTraits<net::IPAddress>::Write(base::Pickle* m, const param_type& p) {
+  WriteParam(m, p.bytes());
+}
+
+// static
+bool ParamTraits<net::IPAddress>::Read(const base::Pickle* m,
+                                       base::PickleIterator* iter,
+                                       param_type* p) {
+  std::vector<uint8_t> bytes;
+  if (!ReadParam(m, iter, &bytes))
+    return false;
+
+  net::IPAddress address(bytes);
+  if (address.empty() || address.IsValid()) {
+    *p = address;
+    return true;
+  }
+  return false;
+}
+
+// static
+void ParamTraits<net::IPAddress>::Log(const param_type& p, std::string* l) {
+  l->append("IPAddress:" + (p.empty() ? "(empty)" : p.ToString()));
+}
+
+// static
+void ParamTraits<net::IPEndPoint>::Write(base::Pickle* m, const param_type& p) {
+  WriteParam(m, p.address());
+  WriteParam(m, p.port());
+}
+
+// static
+bool ParamTraits<net::IPEndPoint>::Read(const base::Pickle* m,
+                                        base::PickleIterator* iter,
+                                        param_type* p) {
+  net::IPAddress address;
+  uint16_t port;
+  if (!ReadParam(m, iter, &address) || !ReadParam(m, iter, &port))
+    return false;
+
+  *p = net::IPEndPoint(address, port);
+  return true;
+}
+
+// static
+void ParamTraits<net::IPEndPoint>::Log(const param_type& p, std::string* l) {
+  l->append("IPEndPoint: " + p.ToString());
+}
+
 }  // namespace IPC
 
diff --git a/remoting/host/chromoting_param_traits.h b/remoting/host/chromoting_param_traits.h
index b13bc82..2ca0baf 100644
--- a/remoting/host/chromoting_param_traits.h
+++ b/remoting/host/chromoting_param_traits.h
@@ -7,6 +7,8 @@
 
 #include "ipc/ipc_message.h"
 #include "ipc/ipc_param_traits.h"
+#include "net/base/ip_address.h"
+#include "net/base/ip_endpoint.h"
 #include "remoting/host/screen_resolution.h"
 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
@@ -64,6 +66,26 @@
   static void Log(const param_type& p, std::string* l);
 };
 
+template <>
+struct ParamTraits<net::IPAddress> {
+  typedef net::IPAddress param_type;
+  static void Write(base::Pickle* m, const param_type& p);
+  static bool Read(const base::Pickle* m,
+                   base::PickleIterator* iter,
+                   param_type* p);
+  static void Log(const param_type& p, std::string* l);
+};
+
+template <>
+struct ParamTraits<net::IPEndPoint> {
+  typedef net::IPEndPoint param_type;
+  static void Write(base::Pickle* m, const param_type& p);
+  static bool Read(const base::Pickle* m,
+                   base::PickleIterator* iter,
+                   param_type* p);
+  static void Log(const param_type& p, std::string* l);
+};
+
 }  // namespace IPC
 
 #endif  // REMOTING_HOST_CHROMOTING_PARAM_TRAITS_H_
diff --git a/remoting/host/client_session.cc b/remoting/host/client_session.cc
index e3a6766..acb9603 100644
--- a/remoting/host/client_session.cc
+++ b/remoting/host/client_session.cc
@@ -8,6 +8,7 @@
 #include <utility>
 
 #include "base/command_line.h"
+#include "base/memory/ptr_util.h"
 #include "base/single_thread_task_runner.h"
 #include "base/thread_task_runner_handle.h"
 #include "build/build_config.h"
@@ -42,14 +43,14 @@
 // Name of command-line flag to disable use of I444 by default.
 const char kDisableI444SwitchName[] = "disable-i444";
 
-scoped_ptr<AudioEncoder> CreateAudioEncoder(
+std::unique_ptr<AudioEncoder> CreateAudioEncoder(
     const protocol::SessionConfig& config) {
   const protocol::ChannelConfig& audio_config = config.audio_config();
 
   if (audio_config.codec == protocol::ChannelConfig::CODEC_VERBATIM) {
-    return make_scoped_ptr(new AudioEncoderVerbatim());
+    return base::WrapUnique(new AudioEncoderVerbatim());
   } else if (audio_config.codec == protocol::ChannelConfig::CODEC_OPUS) {
-    return make_scoped_ptr(new AudioEncoderOpus());
+    return base::WrapUnique(new AudioEncoderOpus());
   }
 
   NOTREACHED();
@@ -61,7 +62,7 @@
 ClientSession::ClientSession(
     EventHandler* event_handler,
     scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner,
-    scoped_ptr<protocol::ConnectionToClient> connection,
+    std::unique_ptr<protocol::ConnectionToClient> connection,
     DesktopEnvironmentFactory* desktop_environment_factory,
     const base::TimeDelta& max_duration,
     scoped_refptr<protocol::PairingRegistry> pairing_registry,
@@ -187,7 +188,7 @@
   }
 
   // Compute the set of capabilities supported by both client and host.
-  client_capabilities_ = make_scoped_ptr(new std::string());
+  client_capabilities_ = base::WrapUnique(new std::string());
   if (capabilities.has_capabilities())
     *client_capabilities_ = capabilities.capabilities();
   capabilities_ = IntersectCapabilities(*client_capabilities_,
@@ -331,7 +332,7 @@
 
   // Create an AudioPump if audio is enabled, to pump audio samples.
   if (connection_->session()->config().is_audio_enabled()) {
-    scoped_ptr<AudioEncoder> audio_encoder =
+    std::unique_ptr<AudioEncoder> audio_encoder =
         CreateAudioEncoder(connection_->session()->config());
     audio_pump_.reset(new AudioPump(
         audio_task_runner_, desktop_environment_->CreateAudioCapturer(),
@@ -423,10 +424,10 @@
   disable_clipboard_filter_.set_enabled(!disable_inputs);
 }
 
-scoped_ptr<protocol::ClipboardStub> ClientSession::CreateClipboardProxy() {
+std::unique_ptr<protocol::ClipboardStub> ClientSession::CreateClipboardProxy() {
   DCHECK(CalledOnValidThread());
 
-  return make_scoped_ptr(
+  return base::WrapUnique(
       new protocol::ClipboardThreadProxy(client_clipboard_factory_.GetWeakPtr(),
                                          base::ThreadTaskRunnerHandle::Get()));
 }
diff --git a/remoting/host/client_session.h b/remoting/host/client_session.h
index 0caf5e1..a42e91e 100644
--- a/remoting/host/client_session.h
+++ b/remoting/host/client_session.h
@@ -87,7 +87,7 @@
   // All |HostExtension|s in |extensions| must outlive |this|.
   ClientSession(EventHandler* event_handler,
                 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner,
-                scoped_ptr<protocol::ConnectionToClient> connection,
+                std::unique_ptr<protocol::ConnectionToClient> connection,
                 DesktopEnvironmentFactory* desktop_environment_factory,
                 const base::TimeDelta& max_duration,
                 scoped_refptr<protocol::PairingRegistry> pairing_registry,
@@ -138,7 +138,7 @@
 
  private:
   // Creates a proxy for sending clipboard events to the client.
-  scoped_ptr<protocol::ClipboardStub> CreateClipboardProxy();
+  std::unique_ptr<protocol::ClipboardStub> CreateClipboardProxy();
 
   void OnScreenSizeChanged(const webrtc::DesktopSize& size,
                            const webrtc::DesktopVector& dpi);
@@ -146,7 +146,7 @@
   EventHandler* event_handler_;
 
   // The connection to the client.
-  scoped_ptr<protocol::ConnectionToClient> connection_;
+  std::unique_ptr<protocol::ConnectionToClient> connection_;
 
   std::string client_jid_;
 
@@ -154,7 +154,7 @@
   DesktopEnvironmentFactory* desktop_environment_factory_;
 
   // The DesktopEnvironment instance for this session.
-  scoped_ptr<DesktopEnvironment> desktop_environment_;
+  std::unique_ptr<DesktopEnvironment> desktop_environment_;
 
   // Filter used as the final element in the input pipeline.
   protocol::InputFilter host_input_filter_;
@@ -193,12 +193,12 @@
   scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner_;
 
   // Objects responsible for sending video, audio and mouse shape.
-  scoped_ptr<AudioPump> audio_pump_;
-  scoped_ptr<protocol::VideoStream> video_stream_;
-  scoped_ptr<MouseShapePump> mouse_shape_pump_;
+  std::unique_ptr<AudioPump> audio_pump_;
+  std::unique_ptr<protocol::VideoStream> video_stream_;
+  std::unique_ptr<MouseShapePump> mouse_shape_pump_;
 
   // The set of all capabilities supported by the client.
-  scoped_ptr<std::string> client_capabilities_;
+  std::unique_ptr<std::string> client_capabilities_;
 
   // The set of all capabilities supported by the host.
   std::string host_capabilities_;
@@ -207,16 +207,16 @@
   std::string capabilities_;
 
   // Used to inject mouse and keyboard input and handle clipboard events.
-  scoped_ptr<InputInjector> input_injector_;
+  std::unique_ptr<InputInjector> input_injector_;
 
   // Used to apply client-requested changes in screen resolution.
-  scoped_ptr<ScreenControls> screen_controls_;
+  std::unique_ptr<ScreenControls> screen_controls_;
 
   // The pairing registry for PIN-less authentication.
   scoped_refptr<protocol::PairingRegistry> pairing_registry_;
 
   // Used to manage extension functionality.
-  scoped_ptr<HostExtensionSessionManager> extension_manager_;
+  std::unique_ptr<HostExtensionSessionManager> extension_manager_;
 
   // Set to true if the client was authenticated successfully.
   bool is_authenticated_;
diff --git a/remoting/host/client_session_unittest.cc b/remoting/host/client_session_unittest.cc
index 32da050c..3ef301a 100644
--- a/remoting/host/client_session_unittest.cc
+++ b/remoting/host/client_session_unittest.cc
@@ -132,13 +132,13 @@
   std::vector<HostExtension*> extensions_;
 
   // ClientSession instance under test.
-  scoped_ptr<ClientSession> client_session_;
+  std::unique_ptr<ClientSession> client_session_;
 
   // ClientSession::EventHandler mock for use in tests.
   MockClientSessionEventHandler session_event_handler_;
 
   // Storage for values to be returned by the protocol::Session mock.
-  scoped_ptr<SessionConfig> session_config_;
+  std::unique_ptr<SessionConfig> session_config_;
   const std::string client_jid_;
 
   // Stubs returned to |client_session_| components by |connection_|.
@@ -147,7 +147,7 @@
   // ClientSession owns |connection_| but tests need it to inject fake events.
   protocol::FakeConnectionToClient* connection_;
 
-  scoped_ptr<FakeDesktopEnvironmentFactory> desktop_environment_factory_;
+  std::unique_ptr<FakeDesktopEnvironmentFactory> desktop_environment_factory_;
 };
 
 void ClientSessionTest::SetUp() {
@@ -174,13 +174,13 @@
 
 void ClientSessionTest::CreateClientSession() {
   // Mock protocol::Session APIs called directly by ClientSession.
-  scoped_ptr<protocol::MockSession> session(new MockSession());
+  std::unique_ptr<protocol::MockSession> session(new MockSession());
   EXPECT_CALL(*session, config()).WillRepeatedly(ReturnRef(*session_config_));
   EXPECT_CALL(*session, jid()).WillRepeatedly(ReturnRef(client_jid_));
 
   // Mock protocol::ConnectionToClient APIs called directly by ClientSession.
   // HostStub is not touched by ClientSession, so we can safely pass nullptr.
-  scoped_ptr<protocol::FakeConnectionToClient> connection(
+  std::unique_ptr<protocol::FakeConnectionToClient> connection(
       new protocol::FakeConnectionToClient(std::move(session)));
   connection->set_client_stub(&client_stub_);
   connection_ = connection.get();
diff --git a/remoting/host/clipboard.h b/remoting/host/clipboard.h
index c977b7a..f952a7265 100644
--- a/remoting/host/clipboard.h
+++ b/remoting/host/clipboard.h
@@ -5,10 +5,10 @@
 #ifndef REMOTING_HOST_CLIPBOARD_H_
 #define REMOTING_HOST_CLIPBOARD_H_
 
+#include <memory>
 #include <string>
 
 #include "base/callback.h"
-#include "base/memory/scoped_ptr.h"
 
 namespace remoting {
 
@@ -24,12 +24,13 @@
   virtual ~Clipboard() {}
 
   // Initialises any objects needed to read from or write to the clipboard.
-  virtual void Start(scoped_ptr<protocol::ClipboardStub> client_clipboard) = 0;
+  virtual void Start(
+      std::unique_ptr<protocol::ClipboardStub> client_clipboard) = 0;
 
   // Writes an item to the clipboard. It must be called after Start().
   virtual void InjectClipboardEvent(const protocol::ClipboardEvent& event) = 0;
 
-  static scoped_ptr<Clipboard> Create();
+  static std::unique_ptr<Clipboard> Create();
 };
 
 }  // namespace remoting
diff --git a/remoting/host/clipboard_mac.mm b/remoting/host/clipboard_mac.mm
index 758f39b8..d361a64 100644
--- a/remoting/host/clipboard_mac.mm
+++ b/remoting/host/clipboard_mac.mm
@@ -7,9 +7,11 @@
 #import <Cocoa/Cocoa.h>
 #include <stdint.h>
 
+#include <memory>
+
 #include "base/logging.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
 #include "base/strings/sys_string_conversions.h"
 #include "base/timer/timer.h"
 #include "remoting/base/constants.h"
@@ -31,14 +33,15 @@
   ClipboardMac();
   ~ClipboardMac() override;
 
-  void Start(scoped_ptr<protocol::ClipboardStub> client_clipboard) override;
+  void Start(
+      std::unique_ptr<protocol::ClipboardStub> client_clipboard) override;
   void InjectClipboardEvent(const protocol::ClipboardEvent& event) override;
 
  private:
   void CheckClipboardForChanges();
 
-  scoped_ptr<protocol::ClipboardStub> client_clipboard_;
-  scoped_ptr<base::RepeatingTimer> clipboard_polling_timer_;
+  std::unique_ptr<protocol::ClipboardStub> client_clipboard_;
+  std::unique_ptr<base::RepeatingTimer> clipboard_polling_timer_;
   NSInteger current_change_count_;
 
   DISALLOW_COPY_AND_ASSIGN(ClipboardMac);
@@ -48,7 +51,8 @@
 
 ClipboardMac::~ClipboardMac() {}
 
-void ClipboardMac::Start(scoped_ptr<protocol::ClipboardStub> client_clipboard) {
+void ClipboardMac::Start(
+    std::unique_ptr<protocol::ClipboardStub> client_clipboard) {
   client_clipboard_.reset(client_clipboard.release());
 
   // Synchronize local change-count with the pasteboard's. The change-count is
@@ -103,8 +107,8 @@
   client_clipboard_->InjectClipboardEvent(event);
 }
 
-scoped_ptr<Clipboard> Clipboard::Create() {
-  return make_scoped_ptr(new ClipboardMac());
+std::unique_ptr<Clipboard> Clipboard::Create() {
+  return base::WrapUnique(new ClipboardMac());
 }
 
 }  // namespace remoting
diff --git a/remoting/host/clipboard_win.cc b/remoting/host/clipboard_win.cc
index 007d6e4..ff8d46d 100644
--- a/remoting/host/clipboard_win.cc
+++ b/remoting/host/clipboard_win.cc
@@ -9,6 +9,7 @@
 #include "base/bind.h"
 #include "base/logging.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/strings/string16.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/threading/platform_thread.h"
@@ -110,7 +111,7 @@
   ~ClipboardWin() override;
 
   void Start(
-      scoped_ptr<protocol::ClipboardStub> client_clipboard) override;
+      std::unique_ptr<protocol::ClipboardStub> client_clipboard) override;
   void InjectClipboardEvent(
       const protocol::ClipboardEvent& event) override;
 
@@ -123,12 +124,12 @@
                      LPARAM lparam,
                      LRESULT* result);
 
-  scoped_ptr<protocol::ClipboardStub> client_clipboard_;
+  std::unique_ptr<protocol::ClipboardStub> client_clipboard_;
   AddClipboardFormatListenerFn* add_clipboard_format_listener_;
   RemoveClipboardFormatListenerFn* remove_clipboard_format_listener_;
 
   // Used to subscribe to WM_CLIPBOARDUPDATE messages.
-  scoped_ptr<base::win::MessageWindow> window_;
+  std::unique_ptr<base::win::MessageWindow> window_;
 
   DISALLOW_COPY_AND_ASSIGN(ClipboardWin);
 };
@@ -144,7 +145,7 @@
 }
 
 void ClipboardWin::Start(
-    scoped_ptr<protocol::ClipboardStub> client_clipboard) {
+    std::unique_ptr<protocol::ClipboardStub> client_clipboard) {
   DCHECK(!add_clipboard_format_listener_);
   DCHECK(!remove_clipboard_format_listener_);
   DCHECK(!window_);
@@ -273,8 +274,8 @@
   return false;
 }
 
-scoped_ptr<Clipboard> Clipboard::Create() {
-  return make_scoped_ptr(new ClipboardWin());
+std::unique_ptr<Clipboard> Clipboard::Create() {
+  return base::WrapUnique(new ClipboardWin());
 }
 
 }  // namespace remoting
diff --git a/remoting/host/clipboard_x11.cc b/remoting/host/clipboard_x11.cc
index 94ec094a..ec9b93e 100644
--- a/remoting/host/clipboard_x11.cc
+++ b/remoting/host/clipboard_x11.cc
@@ -5,6 +5,8 @@
 #include "remoting/host/clipboard.h"
 
 #include <X11/Xlib.h>
+
+#include "base/memory/ptr_util.h"
 #undef Status  // Xlib.h #defines this, which breaks protobuf headers.
 
 #include "base/bind.h"
@@ -25,7 +27,8 @@
   ~ClipboardX11() override;
 
   // Clipboard interface.
-  void Start(scoped_ptr<protocol::ClipboardStub> client_clipboard) override;
+  void Start(
+      std::unique_ptr<protocol::ClipboardStub> client_clipboard) override;
   void InjectClipboardEvent(const protocol::ClipboardEvent& event) override;
 
   // MessageLoopForIO::Watcher interface.
@@ -37,7 +40,7 @@
                           const std::string& data);
   void PumpXEvents();
 
-  scoped_ptr<protocol::ClipboardStub> client_clipboard_;
+  std::unique_ptr<protocol::ClipboardStub> client_clipboard_;
 
   // Underlying X11 clipboard implementation.
   XServerClipboard x_server_clipboard_;
@@ -62,7 +65,7 @@
 }
 
 void ClipboardX11::Start(
-    scoped_ptr<protocol::ClipboardStub> client_clipboard) {
+    std::unique_ptr<protocol::ClipboardStub> client_clipboard) {
   // TODO(lambroslambrou): Share the X connection with InputInjector.
   display_ = XOpenDisplay(nullptr);
   if (!display_) {
@@ -117,8 +120,8 @@
   }
 }
 
-scoped_ptr<Clipboard> Clipboard::Create() {
-  return make_scoped_ptr(new ClipboardX11());
+std::unique_ptr<Clipboard> Clipboard::Create() {
+  return base::WrapUnique(new ClipboardX11());
 }
 
 }  // namespace remoting
diff --git a/remoting/host/config_file_watcher.cc b/remoting/host/config_file_watcher.cc
index bd02b7c..02ee223 100644
--- a/remoting/host/config_file_watcher.cc
+++ b/remoting/host/config_file_watcher.cc
@@ -4,6 +4,7 @@
 
 #include "remoting/host/config_file_watcher.h"
 
+#include <memory>
 #include <string>
 
 #include "base/bind.h"
@@ -11,7 +12,6 @@
 #include "base/files/file_path_watcher.h"
 #include "base/files/file_util.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/single_thread_task_runner.h"
 #include "base/timer/timer.h"
@@ -70,13 +70,13 @@
   std::string config_;
   base::FilePath config_path_;
 
-  scoped_ptr<base::DelayTimer> config_updated_timer_;
+  std::unique_ptr<base::DelayTimer> config_updated_timer_;
 
   // Number of times an attempt to read the configuration file failed.
   int retries_;
 
   // Monitors the host configuration file.
-  scoped_ptr<base::FilePathWatcher> config_watcher_;
+  std::unique_ptr<base::FilePathWatcher> config_watcher_;
 
   ConfigWatcher::Delegate* delegate_;
 
diff --git a/remoting/host/config_file_watcher_unittest.cc b/remoting/host/config_file_watcher_unittest.cc
index ec52b22..bdb9156b6 100644
--- a/remoting/host/config_file_watcher_unittest.cc
+++ b/remoting/host/config_file_watcher_unittest.cc
@@ -59,7 +59,7 @@
   base::FilePath config_file_;
 
   // The configuration file watcher that is being tested.
-  scoped_ptr<ConfigFileWatcher> watcher_;
+  std::unique_ptr<ConfigFileWatcher> watcher_;
 };
 
 ConfigFileWatcherTest::ConfigFileWatcherTest() {
diff --git a/remoting/host/continue_window_chromeos.cc b/remoting/host/continue_window_chromeos.cc
index 17c88956..5143046 100644
--- a/remoting/host/continue_window_chromeos.cc
+++ b/remoting/host/continue_window_chromeos.cc
@@ -5,6 +5,7 @@
 #include "remoting/host/continue_window.h"
 
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "remoting/base/string_resources.h"
 #include "remoting/host/chromeos/message_box.h"
 #include "ui/base/l10n/l10n_util.h"
@@ -26,7 +27,7 @@
   void HideUi() override;
 
  private:
-  scoped_ptr<MessageBox> message_box_;
+  std::unique_ptr<MessageBox> message_box_;
   DISALLOW_COPY_AND_ASSIGN(ContinueWindowAura);
 };
 
@@ -63,8 +64,8 @@
 }  // namespace
 
 // static
-scoped_ptr<HostWindow> HostWindow::CreateContinueWindow() {
-  return make_scoped_ptr(new ContinueWindowAura());
+std::unique_ptr<HostWindow> HostWindow::CreateContinueWindow() {
+  return base::WrapUnique(new ContinueWindowAura());
 }
 
 }  // namespace remoting
diff --git a/remoting/host/continue_window_linux.cc b/remoting/host/continue_window_linux.cc
index e3d35c7..edceac3 100644
--- a/remoting/host/continue_window_linux.cc
+++ b/remoting/host/continue_window_linux.cc
@@ -2,14 +2,16 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "remoting/host/continue_window.h"
+
 #include <gtk/gtk.h>
 
 #include "base/compiler_specific.h"
 #include "base/logging.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/strings/utf_string_conversions.h"
 #include "remoting/base/string_resources.h"
-#include "remoting/host/continue_window.h"
 #include "ui/base/glib/glib_signal.h"
 #include "ui/base/l10n/l10n_util.h"
 
@@ -115,8 +117,8 @@
 }
 
 // static
-scoped_ptr<HostWindow> HostWindow::CreateContinueWindow() {
-  return make_scoped_ptr(new ContinueWindowGtk());
+std::unique_ptr<HostWindow> HostWindow::CreateContinueWindow() {
+  return base::WrapUnique(new ContinueWindowGtk());
 }
 
 }  // namespace remoting
diff --git a/remoting/host/continue_window_mac.mm b/remoting/host/continue_window_mac.mm
index cefb494..40fd2bb 100644
--- a/remoting/host/continue_window_mac.mm
+++ b/remoting/host/continue_window_mac.mm
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "remoting/host/continue_window.h"
+
 #import <Cocoa/Cocoa.h>
 
 #include "base/compiler_specific.h"
@@ -9,9 +11,9 @@
 #include "base/mac/scoped_nsautorelease_pool.h"
 #include "base/mac/scoped_nsobject.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/strings/sys_string_conversions.h"
 #include "remoting/base/string_resources.h"
-#include "remoting/host/continue_window.h"
 #include "ui/base/l10n/l10n_util_mac.h"
 
 // Handles the ContinueWindow.
@@ -73,8 +75,8 @@
 }
 
 // static
-scoped_ptr<HostWindow> HostWindow::CreateContinueWindow() {
-  return make_scoped_ptr(new ContinueWindowMac());
+std::unique_ptr<HostWindow> HostWindow::CreateContinueWindow() {
+  return base::WrapUnique(new ContinueWindowMac());
 }
 
 }  // namespace remoting
diff --git a/remoting/host/continue_window_win.cc b/remoting/host/continue_window_win.cc
index d0ac2560..37578f22 100644
--- a/remoting/host/continue_window_win.cc
+++ b/remoting/host/continue_window_win.cc
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "remoting/host/continue_window.h"
+
 #include <windows.h>
 
 #include "base/bind.h"
@@ -10,10 +12,10 @@
 #include "base/location.h"
 #include "base/logging.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/single_thread_task_runner.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/win/current_module.h"
-#include "remoting/host/continue_window.h"
 #include "remoting/host/win/core_resource.h"
 
 namespace remoting {
@@ -128,8 +130,8 @@
 }  // namespace
 
 // static
-scoped_ptr<HostWindow> HostWindow::CreateContinueWindow() {
-  return make_scoped_ptr(new ContinueWindowWin());
+std::unique_ptr<HostWindow> HostWindow::CreateContinueWindow() {
+  return base::WrapUnique(new ContinueWindowWin());
 }
 
 }  // namespace remoting
diff --git a/remoting/host/curtain_mode.h b/remoting/host/curtain_mode.h
index 6d8522f..58e147e7 100644
--- a/remoting/host/curtain_mode.h
+++ b/remoting/host/curtain_mode.h
@@ -5,10 +5,11 @@
 #ifndef REMOTING_HOST_CURTAIN_MODE_H_
 #define REMOTING_HOST_CURTAIN_MODE_H_
 
+#include <memory>
+
 #include "base/compiler_specific.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 
 namespace base {
@@ -28,7 +29,7 @@
   // the local console. |client_session_control| can be used to drop
   // the connection in the case if the session re-connects to the local console
   // in mid-flight.
-  static scoped_ptr<CurtainMode> Create(
+  static std::unique_ptr<CurtainMode> Create(
       scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
       scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
       base::WeakPtr<ClientSessionControl> client_session_control);
diff --git a/remoting/host/curtain_mode_linux.cc b/remoting/host/curtain_mode_linux.cc
index ceec4dc7..05031bf 100644
--- a/remoting/host/curtain_mode_linux.cc
+++ b/remoting/host/curtain_mode_linux.cc
@@ -8,6 +8,7 @@
 
 #include "base/callback.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/single_thread_task_runner.h"
 #include "remoting/base/logging.h"
 #include "remoting/host/client_session_control.h"
@@ -100,11 +101,11 @@
 }
 
 // static
-scoped_ptr<CurtainMode> CurtainMode::Create(
+std::unique_ptr<CurtainMode> CurtainMode::Create(
     scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
     scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
     base::WeakPtr<ClientSessionControl> client_session_control) {
-  return make_scoped_ptr(new CurtainModeLinux());
+  return base::WrapUnique(new CurtainModeLinux());
 }
 
 }  // namespace remoting
diff --git a/remoting/host/curtain_mode_mac.cc b/remoting/host/curtain_mode_mac.cc
index 8199860..9bdb884 100644
--- a/remoting/host/curtain_mode_mac.cc
+++ b/remoting/host/curtain_mode_mac.cc
@@ -15,6 +15,7 @@
 #include "base/mac/mac_util.h"
 #include "base/mac/scoped_cftyperef.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/single_thread_task_runner.h"
 #include "remoting/host/client_session_control.h"
 #include "remoting/protocol/errors.h"
@@ -260,12 +261,12 @@
 }
 
 // static
-scoped_ptr<CurtainMode> CurtainMode::Create(
+std::unique_ptr<CurtainMode> CurtainMode::Create(
     scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
     scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
     base::WeakPtr<ClientSessionControl> client_session_control) {
-  return make_scoped_ptr(new CurtainModeMac(
-      caller_task_runner, ui_task_runner, client_session_control));
+  return base::WrapUnique(new CurtainModeMac(caller_task_runner, ui_task_runner,
+                                             client_session_control));
 }
 
 }  // namespace remoting
diff --git a/remoting/host/curtain_mode_win.cc b/remoting/host/curtain_mode_win.cc
index 237cb7b1..2e5355f 100644
--- a/remoting/host/curtain_mode_win.cc
+++ b/remoting/host/curtain_mode_win.cc
@@ -6,6 +6,7 @@
 
 #include "base/logging.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/single_thread_task_runner.h"
 #include "base/win/windows_version.h"
 #include "remoting/host/client_session_control.h"
@@ -44,14 +45,14 @@
 }
 
 // static
-scoped_ptr<CurtainMode> CurtainMode::Create(
+std::unique_ptr<CurtainMode> CurtainMode::Create(
     scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
     scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
     base::WeakPtr<ClientSessionControl> client_session_control) {
   // |client_session_control| is not used because the client session is
   // disconnected as soon as the session is re-attached to the local console.
   // See RdpDesktopSession for more details.
-  return make_scoped_ptr(new CurtainModeWin());
+  return base::WrapUnique(new CurtainModeWin());
 }
 
 }  // namespace remoting
diff --git a/remoting/host/daemon_process.cc b/remoting/host/daemon_process.cc
index b874426e..3482f978 100644
--- a/remoting/host/daemon_process.cc
+++ b/remoting/host/daemon_process.cc
@@ -209,8 +209,8 @@
   next_terminal_id_ = std::max(next_terminal_id_, terminal_id + 1);
 
   // Create the desktop session.
-  scoped_ptr<DesktopSession> session = DoCreateDesktopSession(
-      terminal_id, resolution, virtual_terminal);
+  std::unique_ptr<DesktopSession> session =
+      DoCreateDesktopSession(terminal_id, resolution, virtual_terminal);
   if (!session) {
     LOG(ERROR) << "Failed to create a desktop session.";
     SendToNetwork(
@@ -332,36 +332,10 @@
                                         const SerializedTransportRoute& route) {
   DCHECK(caller_task_runner()->BelongsToCurrentThread());
 
-  // Validate |route|.
-  if (route.type != protocol::TransportRoute::DIRECT &&
-      route.type != protocol::TransportRoute::STUN &&
-      route.type != protocol::TransportRoute::RELAY) {
-    LOG(ERROR) << "An invalid RouteType " << route.type << " passed.";
-    CrashNetworkProcess(FROM_HERE);
-    return;
-  }
-  if (route.remote_address.size() != net::kIPv4AddressSize &&
-      route.remote_address.size() != net::kIPv6AddressSize) {
-    LOG(ERROR) << "An invalid net::IPAddressNumber size "
-               << route.remote_address.size() << " passed.";
-    CrashNetworkProcess(FROM_HERE);
-    return;
-  }
-  if (route.local_address.size() != net::kIPv4AddressSize &&
-      route.local_address.size() != net::kIPv6AddressSize) {
-    LOG(ERROR) << "An invalid net::IPAddressNumber size "
-               << route.local_address.size() << " passed.";
-    CrashNetworkProcess(FROM_HERE);
-    return;
-  }
-
   protocol::TransportRoute parsed_route;
-  parsed_route.type =
-      static_cast<protocol::TransportRoute::RouteType>(route.type);
-  parsed_route.remote_address =
-      net::IPEndPoint(route.remote_address, route.remote_port);
-  parsed_route.local_address =
-      net::IPEndPoint(route.local_address, route.local_port);
+  parsed_route.type = route.type;
+  parsed_route.remote_address = route.remote_address;
+  parsed_route.local_address = route.local_address;
   FOR_EACH_OBSERVER(HostStatusObserver, status_observers_,
                     OnClientRouteChange(jid, channel_name, parsed_route));
 }
diff --git a/remoting/host/daemon_process.h b/remoting/host/daemon_process.h
index 01fe0fd2..38b84a4 100644
--- a/remoting/host/daemon_process.h
+++ b/remoting/host/daemon_process.h
@@ -8,12 +8,12 @@
 #include <stdint.h>
 
 #include <list>
+#include <memory>
 #include <string>
 
 #include "base/compiler_specific.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/observer_list.h"
 #include "base/process/process.h"
@@ -54,7 +54,7 @@
   // passing relevant task runners. Public methods of this class must be called
   // on the |caller_task_runner| thread. |io_task_runner| is used to handle IPC
   // and background I/O tasks.
-  static scoped_ptr<DaemonProcess> Create(
+  static std::unique_ptr<DaemonProcess> Create(
       scoped_refptr<AutoThreadTaskRunner> caller_task_runner,
       scoped_refptr<AutoThreadTaskRunner> io_task_runner,
       const base::Closure& stopped_callback);
@@ -129,7 +129,7 @@
 
   // Creates a platform-specific desktop session and assigns a unique ID to it.
   // An implementation should validate |params| as they are received via IPC.
-  virtual scoped_ptr<DesktopSession> DoCreateDesktopSession(
+  virtual std::unique_ptr<DesktopSession> DoCreateDesktopSession(
       int terminal_id,
       const ScreenResolution& resolution,
       bool virtual_terminal) = 0;
@@ -165,7 +165,7 @@
   // Handles IPC and background I/O tasks.
   scoped_refptr<AutoThreadTaskRunner> io_task_runner_;
 
-  scoped_ptr<ConfigWatcher> config_watcher_;
+  std::unique_ptr<ConfigWatcher> config_watcher_;
 
   // The configuration file contents.
   std::string serialized_config_;
@@ -183,7 +183,7 @@
   base::Closure stopped_callback_;
 
   // Writes host status updates to the system event log.
-  scoped_ptr<HostEventLogger> host_event_logger_;
+  std::unique_ptr<HostEventLogger> host_event_logger_;
 
   base::WeakPtrFactory<DaemonProcess> weak_factory_;
 
diff --git a/remoting/host/daemon_process_unittest.cc b/remoting/host/daemon_process_unittest.cc
index b3ba10c6..5d042ad 100644
--- a/remoting/host/daemon_process_unittest.cc
+++ b/remoting/host/daemon_process_unittest.cc
@@ -2,12 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "remoting/host/daemon_process.h"
+
 #include <stdint.h>
 
 #include "base/bind.h"
 #include "base/bind_helpers.h"
 #include "base/location.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/memory/ref_counted.h"
 #include "base/process/process.h"
 #include "ipc/ipc_message.h"
@@ -15,7 +18,6 @@
 #include "ipc/ipc_platform_file.h"
 #include "remoting/base/auto_thread_task_runner.h"
 #include "remoting/host/chromoting_messages.h"
-#include "remoting/host/daemon_process.h"
 #include "remoting/host/desktop_session.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gmock_mutant.h"
@@ -59,7 +61,7 @@
       const base::Closure& stopped_callback);
   ~MockDaemonProcess() override;
 
-  scoped_ptr<DesktopSession> DoCreateDesktopSession(
+  std::unique_ptr<DesktopSession> DoCreateDesktopSession(
       int terminal_id,
       const ScreenResolution& resolution,
       bool virtual_terminal) override;
@@ -98,11 +100,11 @@
 MockDaemonProcess::~MockDaemonProcess() {
 }
 
-scoped_ptr<DesktopSession> MockDaemonProcess::DoCreateDesktopSession(
+std::unique_ptr<DesktopSession> MockDaemonProcess::DoCreateDesktopSession(
     int terminal_id,
     const ScreenResolution& resolution,
     bool virtual_terminal) {
-  return make_scoped_ptr(DoCreateDesktopSessionPtr(terminal_id));
+  return base::WrapUnique(DoCreateDesktopSessionPtr(terminal_id));
 }
 
 bool MockDaemonProcess::OnMessageReceived(const IPC::Message& message) {
@@ -149,7 +151,7 @@
  protected:
   base::MessageLoopForIO message_loop_;
 
-  scoped_ptr<MockDaemonProcess> daemon_process_;
+  std::unique_ptr<MockDaemonProcess> daemon_process_;
   int terminal_id_;
 };
 
diff --git a/remoting/host/daemon_process_win.cc b/remoting/host/daemon_process_win.cc
index 1ac3e7f..17961d5a 100644
--- a/remoting/host/daemon_process_win.cc
+++ b/remoting/host/daemon_process_win.cc
@@ -6,6 +6,7 @@
 
 #include <stdint.h>
 
+#include <memory>
 #include <utility>
 
 #include "base/base_switches.h"
@@ -15,7 +16,6 @@
 #include "base/logging.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/process/process.h"
 #include "base/single_thread_task_runner.h"
 #include "base/strings/utf_string_conversions.h"
@@ -45,14 +45,12 @@
 
 namespace {
 
-// Duplicates |key| into |target_process| and returns the value that can be sent
-// over IPC.
+// Duplicates |key| and returns the value that can be sent over IPC.
 IPC::PlatformFileForTransit GetRegistryKeyForTransit(
-    base::ProcessHandle target_process,
     const base::win::RegKey& key) {
   base::PlatformFile handle =
       reinterpret_cast<base::PlatformFile>(key.Handle());
-  return IPC::GetFileHandleForProcess(handle, target_process, false);
+  return IPC::GetPlatformFileForTransit(handle, false);
 }
 
 }  // namespace
@@ -88,7 +86,7 @@
 
  protected:
   // DaemonProcess implementation.
-  scoped_ptr<DesktopSession> DoCreateDesktopSession(
+  std::unique_ptr<DesktopSession> DoCreateDesktopSession(
       int terminal_id,
       const ScreenResolution& resolution,
       bool virtual_terminal) override;
@@ -107,7 +105,7 @@
   bool OpenPairingRegistry();
 
  private:
-  scoped_ptr<WorkerProcessLauncher> network_launcher_;
+  std::unique_ptr<WorkerProcessLauncher> network_launcher_;
 
   // Handle of the network process.
   ScopedHandle network_process_;
@@ -192,7 +190,7 @@
   return true;
 }
 
-scoped_ptr<DesktopSession> DaemonProcessWin::DoCreateDesktopSession(
+std::unique_ptr<DesktopSession> DaemonProcessWin::DoCreateDesktopSession(
     int terminal_id,
     const ScreenResolution& resolution,
     bool virtual_terminal) {
@@ -225,23 +223,22 @@
     return;
   }
 
-  scoped_ptr<base::CommandLine> target(new base::CommandLine(host_binary));
+  std::unique_ptr<base::CommandLine> target(new base::CommandLine(host_binary));
   target->AppendSwitchASCII(kProcessTypeSwitchName, kProcessTypeHost);
   target->CopySwitchesFrom(*base::CommandLine::ForCurrentProcess(),
                            kCopiedSwitchNames, arraysize(kCopiedSwitchNames));
 
-  scoped_ptr<UnprivilegedProcessDelegate> delegate(
+  std::unique_ptr<UnprivilegedProcessDelegate> delegate(
       new UnprivilegedProcessDelegate(io_task_runner(), std::move(target)));
   network_launcher_.reset(new WorkerProcessLauncher(std::move(delegate), this));
 }
 
-scoped_ptr<DaemonProcess> DaemonProcess::Create(
+std::unique_ptr<DaemonProcess> DaemonProcess::Create(
     scoped_refptr<AutoThreadTaskRunner> caller_task_runner,
     scoped_refptr<AutoThreadTaskRunner> io_task_runner,
     const base::Closure& stopped_callback) {
-  scoped_ptr<DaemonProcessWin> daemon_process(
-      new DaemonProcessWin(caller_task_runner, io_task_runner,
-                           stopped_callback));
+  std::unique_ptr<DaemonProcessWin> daemon_process(new DaemonProcessWin(
+      caller_task_runner, io_task_runner, stopped_callback));
   daemon_process->Initialize();
   return std::move(daemon_process);
 }
@@ -290,9 +287,9 @@
 
   // Duplicate handles to the network process.
   IPC::PlatformFileForTransit privileged_key = GetRegistryKeyForTransit(
-      network_process_.Get(), pairing_registry_privileged_key_);
+      pairing_registry_privileged_key_);
   IPC::PlatformFileForTransit unprivileged_key = GetRegistryKeyForTransit(
-      network_process_.Get(), pairing_registry_unprivileged_key_);
+      pairing_registry_unprivileged_key_);
   if (!(privileged_key.IsValid() && unprivileged_key.IsValid()))
     return false;
 
diff --git a/remoting/host/desktop_capturer_proxy.cc b/remoting/host/desktop_capturer_proxy.cc
index 0f0a7378..897ed50 100644
--- a/remoting/host/desktop_capturer_proxy.cc
+++ b/remoting/host/desktop_capturer_proxy.cc
@@ -11,6 +11,7 @@
 #include "base/bind.h"
 #include "base/location.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/single_thread_task_runner.h"
 #include "base/thread_task_runner_handle.h"
 #include "remoting/proto/control.pb.h"
@@ -23,12 +24,12 @@
  public:
   Core(base::WeakPtr<DesktopCapturerProxy> proxy,
        scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner,
-       scoped_ptr<webrtc::DesktopCapturer> capturer);
+       std::unique_ptr<webrtc::DesktopCapturer> capturer);
   ~Core() override;
 
   void Start();
   void SetSharedMemoryFactory(
-      scoped_ptr<webrtc::SharedMemoryFactory> shared_memory_factory);
+      std::unique_ptr<webrtc::SharedMemoryFactory> shared_memory_factory);
   void Capture(const webrtc::DesktopRegion& rect);
 
  private:
@@ -39,7 +40,7 @@
 
   base::WeakPtr<DesktopCapturerProxy> proxy_;
   scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_;
-  scoped_ptr<webrtc::DesktopCapturer> capturer_;
+  std::unique_ptr<webrtc::DesktopCapturer> capturer_;
 
   DISALLOW_COPY_AND_ASSIGN(Core);
 };
@@ -47,7 +48,7 @@
 DesktopCapturerProxy::Core::Core(
     base::WeakPtr<DesktopCapturerProxy> proxy,
     scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner,
-    scoped_ptr<webrtc::DesktopCapturer> capturer)
+    std::unique_ptr<webrtc::DesktopCapturer> capturer)
     : proxy_(proxy),
       caller_task_runner_(base::ThreadTaskRunnerHandle::Get()),
       capturer_(std::move(capturer)) {
@@ -64,7 +65,7 @@
 }
 
 void DesktopCapturerProxy::Core::SetSharedMemoryFactory(
-    scoped_ptr<webrtc::SharedMemoryFactory> shared_memory_factory) {
+    std::unique_ptr<webrtc::SharedMemoryFactory> shared_memory_factory) {
   DCHECK(thread_checker_.CalledOnValidThread());
   capturer_->SetSharedMemoryFactory(
       rtc_make_scoped_ptr(shared_memory_factory.release()));
@@ -81,12 +82,12 @@
 
   caller_task_runner_->PostTask(
       FROM_HERE, base::Bind(&DesktopCapturerProxy::OnFrameCaptured, proxy_,
-                            base::Passed(make_scoped_ptr(frame))));
+                            base::Passed(base::WrapUnique(frame))));
 }
 
 DesktopCapturerProxy::DesktopCapturerProxy(
     scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner,
-    scoped_ptr<webrtc::DesktopCapturer> capturer)
+    std::unique_ptr<webrtc::DesktopCapturer> capturer)
     : capture_task_runner_(capture_task_runner), weak_factory_(this) {
   core_.reset(new Core(weak_factory_.GetWeakPtr(), capture_task_runner,
                        std::move(capturer)));
@@ -113,7 +114,7 @@
       FROM_HERE,
       base::Bind(
           &Core::SetSharedMemoryFactory, base::Unretained(core_.get()),
-          base::Passed(make_scoped_ptr(shared_memory_factory.release()))));
+          base::Passed(base::WrapUnique(shared_memory_factory.release()))));
 }
 
 void DesktopCapturerProxy::Capture(const webrtc::DesktopRegion& rect) {
@@ -128,7 +129,7 @@
 }
 
 void DesktopCapturerProxy::OnFrameCaptured(
-    scoped_ptr<webrtc::DesktopFrame> frame) {
+    std::unique_ptr<webrtc::DesktopFrame> frame) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
   callback_->OnCaptureCompleted(frame.release());
diff --git a/remoting/host/desktop_capturer_proxy.h b/remoting/host/desktop_capturer_proxy.h
index 51dd2fa..959fc39 100644
--- a/remoting/host/desktop_capturer_proxy.h
+++ b/remoting/host/desktop_capturer_proxy.h
@@ -5,9 +5,10 @@
 #ifndef REMOTING_HOST_DESKTOP_CAPTURER_PROXY_H_
 #define REMOTING_HOST_DESKTOP_CAPTURER_PROXY_H_
 
+#include <memory>
+
 #include "base/callback.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/threading/thread_checker.h"
 #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h"
@@ -28,7 +29,7 @@
  public:
   DesktopCapturerProxy(
       scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner,
-      scoped_ptr<webrtc::DesktopCapturer> capturer);
+      std::unique_ptr<webrtc::DesktopCapturer> capturer);
   ~DesktopCapturerProxy() override;
 
   // webrtc::DesktopCapturer interface.
@@ -40,11 +41,11 @@
  private:
   class Core;
 
-  void OnFrameCaptured(scoped_ptr<webrtc::DesktopFrame> frame);
+  void OnFrameCaptured(std::unique_ptr<webrtc::DesktopFrame> frame);
 
   base::ThreadChecker thread_checker_;
 
-  scoped_ptr<Core> core_;
+  std::unique_ptr<Core> core_;
   scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner_;
   webrtc::DesktopCapturer::Callback* callback_;
 
diff --git a/remoting/host/desktop_environment.h b/remoting/host/desktop_environment.h
index 1ed5cd3..ec984c5 100644
--- a/remoting/host/desktop_environment.h
+++ b/remoting/host/desktop_environment.h
@@ -5,11 +5,11 @@
 #ifndef REMOTING_HOST_DESKTOP_ENVIRONMENT_H_
 #define REMOTING_HOST_DESKTOP_ENVIRONMENT_H_
 
+#include <memory>
 #include <string>
 
 #include "base/callback_forward.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 
 namespace base {
@@ -40,11 +40,12 @@
 
   // Factory methods used to create audio/video capturers, event executor, and
   // screen controls object for a particular desktop environment.
-  virtual scoped_ptr<AudioCapturer> CreateAudioCapturer() = 0;
-  virtual scoped_ptr<InputInjector> CreateInputInjector() = 0;
-  virtual scoped_ptr<ScreenControls> CreateScreenControls() = 0;
-  virtual scoped_ptr<webrtc::DesktopCapturer> CreateVideoCapturer() = 0;
-  virtual scoped_ptr<webrtc::MouseCursorMonitor> CreateMouseCursorMonitor() = 0;
+  virtual std::unique_ptr<AudioCapturer> CreateAudioCapturer() = 0;
+  virtual std::unique_ptr<InputInjector> CreateInputInjector() = 0;
+  virtual std::unique_ptr<ScreenControls> CreateScreenControls() = 0;
+  virtual std::unique_ptr<webrtc::DesktopCapturer> CreateVideoCapturer() = 0;
+  virtual std::unique_ptr<webrtc::MouseCursorMonitor>
+  CreateMouseCursorMonitor() = 0;
 
   // Returns the set of all capabilities supported by |this|.
   virtual std::string GetCapabilities() const = 0;
@@ -63,7 +64,7 @@
   // the desktop environment could not be created for any reason (if the curtain
   // failed to active for instance). |client_session_control| must outlive
   // the created desktop environment.
-  virtual scoped_ptr<DesktopEnvironment> Create(
+  virtual std::unique_ptr<DesktopEnvironment> Create(
       base::WeakPtr<ClientSessionControl> client_session_control) = 0;
 
   // Enables or disables the curtain mode.
diff --git a/remoting/host/desktop_process.cc b/remoting/host/desktop_process.cc
index e59b8a5..ca03a10 100644
--- a/remoting/host/desktop_process.cc
+++ b/remoting/host/desktop_process.cc
@@ -97,7 +97,7 @@
 }
 
 bool DesktopProcess::Start(
-    scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory) {
+    std::unique_ptr<DesktopEnvironmentFactory> desktop_environment_factory) {
   DCHECK(caller_task_runner_->BelongsToCurrentThread());
   DCHECK(!desktop_environment_factory_);
   DCHECK(desktop_environment_factory);
diff --git a/remoting/host/desktop_process.h b/remoting/host/desktop_process.h
index 42467245..c74133ead 100644
--- a/remoting/host/desktop_process.h
+++ b/remoting/host/desktop_process.h
@@ -7,13 +7,13 @@
 
 #include <stdint.h>
 
+#include <memory>
 #include <string>
 
 #include "base/callback_forward.h"
 #include "base/compiler_specific.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "ipc/ipc_listener.h"
 #include "remoting/host/desktop_session_agent.h"
@@ -53,7 +53,8 @@
 
   // Creates the desktop agent and required threads and IPC channels. Returns
   // true on success.
-  bool Start(scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory);
+  bool Start(
+      std::unique_ptr<DesktopEnvironmentFactory> desktop_environment_factory);
 
  private:
   // Crashes the process in response to a daemon's request. The daemon passes
@@ -70,14 +71,14 @@
   scoped_refptr<AutoThreadTaskRunner> input_task_runner_;
 
   // Factory used to create integration components for use by |desktop_agent_|.
-  scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory_;
+  std::unique_ptr<DesktopEnvironmentFactory> desktop_environment_factory_;
 
   // Name of the IPC channel connecting the desktop process with the daemon
   // process.
   std::string daemon_channel_name_;
 
   // IPC channel connecting the desktop process with the daemon process.
-  scoped_ptr<IPC::ChannelProxy> daemon_channel_;
+  std::unique_ptr<IPC::ChannelProxy> daemon_channel_;
 
   // Provides screen/audio capturing and input injection services for
   // the network process.
diff --git a/remoting/host/desktop_process_main.cc b/remoting/host/desktop_process_main.cc
index 7116580..825a5f5 100644
--- a/remoting/host/desktop_process_main.cc
+++ b/remoting/host/desktop_process_main.cc
@@ -5,12 +5,12 @@
 // This file implements the Windows service controlling Me2Me host processes
 // running within user sessions.
 
+#include <memory>
 #include <utility>
 
 #include "base/bind.h"
 #include "base/bind_helpers.h"
 #include "base/command_line.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
 #include "build/build_config.h"
@@ -54,7 +54,7 @@
                                  channel_name);
 
   // Create a platform-dependent environment factory.
-  scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory;
+  std::unique_ptr<DesktopEnvironmentFactory> desktop_environment_factory;
 #if defined(OS_WIN)
   desktop_environment_factory.reset(new SessionDesktopEnvironmentFactory(
       ui_task_runner, video_capture_task_runner, input_task_runner,
diff --git a/remoting/host/desktop_process_unittest.cc b/remoting/host/desktop_process_unittest.cc
index 1cde44e6..15da5e04 100644
--- a/remoting/host/desktop_process_unittest.cc
+++ b/remoting/host/desktop_process_unittest.cc
@@ -150,7 +150,7 @@
 
  protected:
   // The daemon's end of the daemon-to-desktop channel.
-  scoped_ptr<IPC::ChannelProxy> daemon_channel_;
+  std::unique_ptr<IPC::ChannelProxy> daemon_channel_;
 
   // Delegate that is passed to |daemon_channel_|.
   MockDaemonListener daemon_listener_;
@@ -161,7 +161,7 @@
   scoped_refptr<AutoThreadTaskRunner> io_task_runner_;
 
   // The network's end of the network-to-desktop channel.
-  scoped_ptr<IPC::ChannelProxy> network_channel_;
+  std::unique_ptr<IPC::ChannelProxy> network_channel_;
 
   // Delegate that is passed to |network_channel_|.
   MockNetworkListener network_listener_;
@@ -269,7 +269,7 @@
       IPC::ChannelHandle(channel_name), IPC::Channel::MODE_SERVER,
       &daemon_listener_, io_task_runner_.get());
 
-  scoped_ptr<MockDesktopEnvironmentFactory> desktop_environment_factory(
+  std::unique_ptr<MockDesktopEnvironmentFactory> desktop_environment_factory(
       new MockDesktopEnvironmentFactory());
   EXPECT_CALL(*desktop_environment_factory, CreatePtr())
       .Times(AnyNumber())
diff --git a/remoting/host/desktop_resizer.h b/remoting/host/desktop_resizer.h
index 0b103fc..e08dcd0 100644
--- a/remoting/host/desktop_resizer.h
+++ b/remoting/host/desktop_resizer.h
@@ -6,8 +6,8 @@
 #define REMOTING_HOST_DESKTOP_RESIZER_H_
 
 #include <list>
+#include <memory>
 
-#include "base/memory/scoped_ptr.h"
 #include "remoting/host/screen_resolution.h"
 
 namespace remoting {
@@ -17,7 +17,7 @@
   virtual ~DesktopResizer() {}
 
   // Create a platform-specific DesktopResizer instance.
-  static scoped_ptr<DesktopResizer> Create();
+  static std::unique_ptr<DesktopResizer> Create();
 
   // Return the current resolution of the desktop.
   virtual ScreenResolution GetCurrentResolution() = 0;
diff --git a/remoting/host/desktop_resizer_mac.cc b/remoting/host/desktop_resizer_mac.cc
index d3490a7..82432ce 100644
--- a/remoting/host/desktop_resizer_mac.cc
+++ b/remoting/host/desktop_resizer_mac.cc
@@ -11,6 +11,7 @@
 #include "base/mac/mac_util.h"
 #include "base/mac/scoped_cftyperef.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "remoting/base/logging.h"
 
 namespace {
@@ -167,8 +168,8 @@
   return true;
 }
 
-scoped_ptr<DesktopResizer> DesktopResizer::Create() {
-  return make_scoped_ptr(new DesktopResizerMac);
+std::unique_ptr<DesktopResizer> DesktopResizer::Create() {
+  return base::WrapUnique(new DesktopResizerMac);
 }
 
 }  // namespace remoting
diff --git a/remoting/host/desktop_resizer_ozone.cc b/remoting/host/desktop_resizer_ozone.cc
index 7898f8ec..e70cd0e2 100644
--- a/remoting/host/desktop_resizer_ozone.cc
+++ b/remoting/host/desktop_resizer_ozone.cc
@@ -6,6 +6,7 @@
 
 #include "base/logging.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 
 namespace remoting {
 
@@ -49,8 +50,8 @@
 void DesktopResizerOzone::RestoreResolution(const ScreenResolution& original) {
 }
 
-scoped_ptr<DesktopResizer> DesktopResizer::Create() {
-  return make_scoped_ptr(new DesktopResizerOzone);
+std::unique_ptr<DesktopResizer> DesktopResizer::Create() {
+  return base::WrapUnique(new DesktopResizerOzone);
 }
 
 }  // namespace remoting
diff --git a/remoting/host/desktop_resizer_win.cc b/remoting/host/desktop_resizer_win.cc
index 32fec81..626d727 100644
--- a/remoting/host/desktop_resizer_win.cc
+++ b/remoting/host/desktop_resizer_win.cc
@@ -5,10 +5,12 @@
 #include "remoting/host/desktop_resizer.h"
 
 #include <windows.h>
+
 #include <map>
 
 #include "base/logging.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 
 namespace {
 // TODO(jamiewalch): Use the correct DPI for the mode: http://crbug.com/172405.
@@ -185,8 +187,8 @@
       webrtc::DesktopVector(kDefaultDPI, kDefaultDPI));
 }
 
-scoped_ptr<DesktopResizer> DesktopResizer::Create() {
-  return make_scoped_ptr(new DesktopResizerWin);
+std::unique_ptr<DesktopResizer> DesktopResizer::Create() {
+  return base::WrapUnique(new DesktopResizerWin);
 }
 
 }  // namespace remoting
diff --git a/remoting/host/desktop_resizer_x11.cc b/remoting/host/desktop_resizer_x11.cc
index 63fe542..e59fa2c1 100644
--- a/remoting/host/desktop_resizer_x11.cc
+++ b/remoting/host/desktop_resizer_x11.cc
@@ -4,12 +4,13 @@
 
 #include "remoting/host/desktop_resizer.h"
 
-#include <string.h>
-#include <X11/extensions/Xrandr.h>
 #include <X11/Xlib.h>
+#include <X11/extensions/Xrandr.h>
+#include <string.h>
 
 #include "base/command_line.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "remoting/base/logging.h"
 #include "remoting/host/linux/x11_util.h"
 
@@ -324,8 +325,8 @@
                    CurrentTime, 0, 0, mode_id, 1, outputs, number_of_outputs);
 }
 
-scoped_ptr<DesktopResizer> DesktopResizer::Create() {
-  return make_scoped_ptr(new DesktopResizerX11);
+std::unique_ptr<DesktopResizer> DesktopResizer::Create() {
+  return base::WrapUnique(new DesktopResizerX11);
 }
 
 }  // namespace remoting
diff --git a/remoting/host/desktop_session_agent.cc b/remoting/host/desktop_session_agent.cc
index 274bd2a..26ee9e1 100644
--- a/remoting/host/desktop_session_agent.cc
+++ b/remoting/host/desktop_session_agent.cc
@@ -9,6 +9,7 @@
 #include "base/files/file_util.h"
 #include "base/logging.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/memory/shared_memory.h"
 #include "base/process/process_handle.h"
 #include "build/build_config.h"
@@ -70,12 +71,12 @@
 // webrtc::SharedMemory implementation that creates base::SharedMemory.
 class SharedMemoryImpl : public webrtc::SharedMemory {
  public:
-  static scoped_ptr<SharedMemoryImpl>
+  static std::unique_ptr<SharedMemoryImpl>
   Create(size_t size, int id, const base::Closure& on_deleted_callback) {
-    scoped_ptr<base::SharedMemory> memory(new base::SharedMemory());
+    std::unique_ptr<base::SharedMemory> memory(new base::SharedMemory());
     if (!memory->CreateAndMapAnonymous(size))
       return nullptr;
-    return make_scoped_ptr(
+    return base::WrapUnique(
         new SharedMemoryImpl(std::move(memory), size, id, on_deleted_callback));
   }
 
@@ -84,7 +85,7 @@
   base::SharedMemory* shared_memory() { return shared_memory_.get(); }
 
  private:
-  SharedMemoryImpl(scoped_ptr<base::SharedMemory> memory,
+  SharedMemoryImpl(std::unique_ptr<base::SharedMemory> memory,
                    size_t size,
                    int id,
                    const base::Closure& on_deleted_callback)
@@ -102,14 +103,14 @@
   }
 
   base::Closure on_deleted_callback_;
-  scoped_ptr<base::SharedMemory> shared_memory_;
+  std::unique_ptr<base::SharedMemory> shared_memory_;
 
   DISALLOW_COPY_AND_ASSIGN(SharedMemoryImpl);
 };
 
 class SharedMemoryFactoryImpl : public webrtc::SharedMemoryFactory {
  public:
-  typedef base::Callback<void(scoped_ptr<IPC::Message> message)>
+  typedef base::Callback<void(std::unique_ptr<IPC::Message> message)>
       SendMessageCallback;
 
   SharedMemoryFactoryImpl(const SendMessageCallback& send_message_callback)
@@ -117,12 +118,12 @@
 
   rtc::scoped_ptr<webrtc::SharedMemory> CreateSharedMemory(
       size_t size) override {
-    base::Closure release_buffer_callback = base::Bind(
-        send_message_callback_,
-        base::Passed(
-            make_scoped_ptr(new ChromotingDesktopNetworkMsg_ReleaseSharedBuffer(
-                next_shared_buffer_id_))));
-    scoped_ptr<SharedMemoryImpl> buffer = SharedMemoryImpl::Create(
+    base::Closure release_buffer_callback =
+        base::Bind(send_message_callback_,
+                   base::Passed(base::WrapUnique(
+                       new ChromotingDesktopNetworkMsg_ReleaseSharedBuffer(
+                           next_shared_buffer_id_))));
+    std::unique_ptr<SharedMemoryImpl> buffer = SharedMemoryImpl::Create(
         size, next_shared_buffer_id_, release_buffer_callback);
     if (buffer) {
       // |next_shared_buffer_id_| starts from 1 and incrementing it by 2 makes
@@ -136,7 +137,7 @@
       next_shared_buffer_id_ += 2;
 
       send_message_callback_.Run(
-          make_scoped_ptr(new ChromotingDesktopNetworkMsg_CreateSharedBuffer(
+          base::WrapUnique(new ChromotingDesktopNetworkMsg_CreateSharedBuffer(
               buffer->id(), buffer->shared_memory()->handle(),
               buffer->size())));
     }
@@ -235,7 +236,7 @@
 }
 
 void DesktopSessionAgent::DisconnectSession(protocol::ErrorCode error) {
-  SendToNetwork(make_scoped_ptr(
+  SendToNetwork(base::WrapUnique(
       new ChromotingDesktopNetworkMsg_DisconnectSession(error)));
 }
 
@@ -294,7 +295,7 @@
 #endif  // defined(OS_WIN)
 
   // Start the input injector.
-  scoped_ptr<protocol::ClipboardStub> clipboard_stub(
+  std::unique_ptr<protocol::ClipboardStub> clipboard_stub(
       new DesktopSessionClipboardStub(this));
   input_injector_->Start(std::move(clipboard_stub));
 
@@ -334,16 +335,16 @@
     serialized_frame.dirty_region.push_back(i.rect());
   }
 
-  SendToNetwork(make_scoped_ptr(
+  SendToNetwork(base::WrapUnique(
       new ChromotingDesktopNetworkMsg_CaptureCompleted(serialized_frame)));
 }
 
 void DesktopSessionAgent::OnMouseCursor(webrtc::MouseCursor* cursor) {
   DCHECK(caller_task_runner_->BelongsToCurrentThread());
 
-  scoped_ptr<webrtc::MouseCursor> owned_cursor(cursor);
+  std::unique_ptr<webrtc::MouseCursor> owned_cursor(cursor);
 
-  SendToNetwork(make_scoped_ptr(
+  SendToNetwork(base::WrapUnique(
       new ChromotingDesktopNetworkMsg_MouseCursor(*owned_cursor)));
 }
 
@@ -364,11 +365,12 @@
     return;
   }
 
-  SendToNetwork(make_scoped_ptr(
+  SendToNetwork(base::WrapUnique(
       new ChromotingDesktopNetworkMsg_InjectClipboardEvent(serialized_event)));
 }
 
-void DesktopSessionAgent::ProcessAudioPacket(scoped_ptr<AudioPacket> packet) {
+void DesktopSessionAgent::ProcessAudioPacket(
+    std::unique_ptr<AudioPacket> packet) {
   DCHECK(audio_capture_task_runner_->BelongsToCurrentThread());
 
   std::string serialized_packet;
@@ -377,7 +379,7 @@
     return;
   }
 
-  SendToNetwork(make_scoped_ptr(
+  SendToNetwork(base::WrapUnique(
       new ChromotingDesktopNetworkMsg_AudioPacket(serialized_packet)));
 }
 
@@ -545,7 +547,7 @@
     screen_controls_->SetScreenResolution(resolution);
 }
 
-void DesktopSessionAgent::SendToNetwork(scoped_ptr<IPC::Message> message) {
+void DesktopSessionAgent::SendToNetwork(std::unique_ptr<IPC::Message> message) {
   if (!caller_task_runner_->BelongsToCurrentThread()) {
     caller_task_runner_->PostTask(
         FROM_HERE, base::Bind(&DesktopSessionAgent::SendToNetwork, this,
diff --git a/remoting/host/desktop_session_agent.h b/remoting/host/desktop_session_agent.h
index 2c49ee9c..c965d37 100644
--- a/remoting/host/desktop_session_agent.h
+++ b/remoting/host/desktop_session_agent.h
@@ -9,12 +9,12 @@
 #include <stdint.h>
 
 #include <map>
+#include <memory>
 
 #include "base/callback.h"
 #include "base/compiler_specific.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "ipc/ipc_listener.h"
 #include "ipc/ipc_platform_file.h"
@@ -90,7 +90,7 @@
   void InjectClipboardEvent(const protocol::ClipboardEvent& event);
 
   // Forwards an audio packet though the IPC channel to the network process.
-  void ProcessAudioPacket(scoped_ptr<AudioPacket> packet);
+  void ProcessAudioPacket(std::unique_ptr<AudioPacket> packet);
 
   // Creates desktop integration components and a connected IPC channel to be
   // used to access them. The client end of the channel is returned in
@@ -132,7 +132,7 @@
   void SetScreenResolution(const ScreenResolution& resolution);
 
   // Sends a message to the network process.
-  void SendToNetwork(scoped_ptr<IPC::Message> message);
+  void SendToNetwork(std::unique_ptr<IPC::Message> message);
 
   // Posted to |audio_capture_task_runner_| to start the audio capturer.
   void StartAudioCapturer();
@@ -154,29 +154,29 @@
   scoped_refptr<AutoThreadTaskRunner> io_task_runner_;
 
   // Captures audio output.
-  scoped_ptr<AudioCapturer> audio_capturer_;
+  std::unique_ptr<AudioCapturer> audio_capturer_;
 
   std::string client_jid_;
 
   base::WeakPtr<Delegate> delegate_;
 
   // The DesktopEnvironment instance used by this agent.
-  scoped_ptr<DesktopEnvironment> desktop_environment_;
+  std::unique_ptr<DesktopEnvironment> desktop_environment_;
 
   // Executes keyboard, mouse and clipboard events.
-  scoped_ptr<InputInjector> input_injector_;
+  std::unique_ptr<InputInjector> input_injector_;
 
   // Tracker used to release pressed keys and buttons when disconnecting.
-  scoped_ptr<protocol::InputEventTracker> input_tracker_;
+  std::unique_ptr<protocol::InputEventTracker> input_tracker_;
 
   // Filter used to disable remote inputs during local input activity.
-  scoped_ptr<RemoteInputFilter> remote_input_filter_;
+  std::unique_ptr<RemoteInputFilter> remote_input_filter_;
 
   // Used to apply client-requested changes in screen resolution.
-  scoped_ptr<ScreenControls> screen_controls_;
+  std::unique_ptr<ScreenControls> screen_controls_;
 
   // IPC channel connecting the desktop process with the network process.
-  scoped_ptr<IPC::ChannelProxy> network_channel_;
+  std::unique_ptr<IPC::ChannelProxy> network_channel_;
 
   // The client end of the network-to-desktop pipe. It is kept alive until
   // the network process connects to the pipe.
@@ -189,14 +189,14 @@
   bool started_ = false;
 
   // Captures the screen.
-  scoped_ptr<webrtc::DesktopCapturer> video_capturer_;
+  std::unique_ptr<webrtc::DesktopCapturer> video_capturer_;
 
   // Captures mouse shapes.
-  scoped_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor_;
+  std::unique_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor_;
 
   // Keep reference to the last frame sent to make sure shared buffer is alive
   // before it's received.
-  scoped_ptr<webrtc::DesktopFrame> last_frame_;
+  std::unique_ptr<webrtc::DesktopFrame> last_frame_;
 
   // Used to disable callbacks to |this|.
   base::WeakPtrFactory<DesktopSessionAgent> weak_factory_;
diff --git a/remoting/host/desktop_session_proxy.cc b/remoting/host/desktop_session_proxy.cc
index a13c4171..4d1f540 100644
--- a/remoting/host/desktop_session_proxy.cc
+++ b/remoting/host/desktop_session_proxy.cc
@@ -11,6 +11,7 @@
 #include "base/compiler_specific.h"
 #include "base/logging.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/memory/shared_memory.h"
 #include "base/process/process_handle.h"
 #include "base/single_thread_task_runner.h"
@@ -106,33 +107,34 @@
   DCHECK(caller_task_runner_->BelongsToCurrentThread());
 }
 
-scoped_ptr<AudioCapturer> DesktopSessionProxy::CreateAudioCapturer() {
+std::unique_ptr<AudioCapturer> DesktopSessionProxy::CreateAudioCapturer() {
   DCHECK(caller_task_runner_->BelongsToCurrentThread());
 
-  return make_scoped_ptr(new IpcAudioCapturer(this));
+  return base::WrapUnique(new IpcAudioCapturer(this));
 }
 
-scoped_ptr<InputInjector> DesktopSessionProxy::CreateInputInjector() {
+std::unique_ptr<InputInjector> DesktopSessionProxy::CreateInputInjector() {
   DCHECK(caller_task_runner_->BelongsToCurrentThread());
 
-  return make_scoped_ptr(new IpcInputInjector(this));
+  return base::WrapUnique(new IpcInputInjector(this));
 }
 
-scoped_ptr<ScreenControls> DesktopSessionProxy::CreateScreenControls() {
+std::unique_ptr<ScreenControls> DesktopSessionProxy::CreateScreenControls() {
   DCHECK(caller_task_runner_->BelongsToCurrentThread());
 
-  return make_scoped_ptr(new IpcScreenControls(this));
+  return base::WrapUnique(new IpcScreenControls(this));
 }
 
-scoped_ptr<webrtc::DesktopCapturer> DesktopSessionProxy::CreateVideoCapturer() {
+std::unique_ptr<webrtc::DesktopCapturer>
+DesktopSessionProxy::CreateVideoCapturer() {
   DCHECK(caller_task_runner_->BelongsToCurrentThread());
 
-  return make_scoped_ptr(new IpcVideoFrameCapturer(this));
+  return base::WrapUnique(new IpcVideoFrameCapturer(this));
 }
 
-scoped_ptr<webrtc::MouseCursorMonitor>
-    DesktopSessionProxy::CreateMouseCursorMonitor() {
-  return make_scoped_ptr(new IpcMouseCursorMonitor(this));
+std::unique_ptr<webrtc::MouseCursorMonitor>
+DesktopSessionProxy::CreateMouseCursorMonitor() {
+  return base::WrapUnique(new IpcMouseCursorMonitor(this));
 }
 
 std::string DesktopSessionProxy::GetCapabilities() const {
@@ -371,7 +373,7 @@
 }
 
 void DesktopSessionProxy::StartInputInjector(
-    scoped_ptr<protocol::ClipboardStub> client_clipboard) {
+    std::unique_ptr<protocol::ClipboardStub> client_clipboard) {
   DCHECK(caller_task_runner_->BelongsToCurrentThread());
 
   client_clipboard_ = std::move(client_clipboard);
@@ -431,7 +433,7 @@
 
   // Parse a serialized audio packet. No further validation is done since
   // the message was sent by more privileged process.
-  scoped_ptr<AudioPacket> packet(new AudioPacket());
+  std::unique_ptr<AudioPacket> packet(new AudioPacket());
   if (!packet->ParseFromString(serialized_packet)) {
     LOG(ERROR) << "Failed to parse AudioPacket.";
     return;
@@ -475,7 +477,7 @@
       GetSharedBufferCore(serialized_frame.shared_buffer_id);
   CHECK(shared_buffer_core.get());
 
-  scoped_ptr<webrtc::DesktopFrame> frame(
+  std::unique_ptr<webrtc::DesktopFrame> frame(
       new webrtc::SharedMemoryDesktopFrame(
           serialized_frame.dimensions, serialized_frame.bytes_per_row,
           new IpcSharedBuffer(shared_buffer_core)));
@@ -496,7 +498,7 @@
 
   if (mouse_cursor_monitor_) {
     mouse_cursor_monitor_->OnMouseCursor(
-        make_scoped_ptr(webrtc::MouseCursor::CopyOf(mouse_cursor)));
+        base::WrapUnique(webrtc::MouseCursor::CopyOf(mouse_cursor)));
   }
 }
 
diff --git a/remoting/host/desktop_session_proxy.h b/remoting/host/desktop_session_proxy.h
index f54713f..133df7c 100644
--- a/remoting/host/desktop_session_proxy.h
+++ b/remoting/host/desktop_session_proxy.h
@@ -8,10 +8,10 @@
 #include <stdint.h>
 
 #include <map>
+#include <memory>
 
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/shared_memory_handle.h"
 #include "base/memory/weak_ptr.h"
 #include "base/process/process.h"
@@ -82,11 +82,11 @@
       bool supports_touch_events);
 
   // Mirrors DesktopEnvironment.
-  scoped_ptr<AudioCapturer> CreateAudioCapturer();
-  scoped_ptr<InputInjector> CreateInputInjector();
-  scoped_ptr<ScreenControls> CreateScreenControls();
-  scoped_ptr<webrtc::DesktopCapturer> CreateVideoCapturer();
-  scoped_ptr<webrtc::MouseCursorMonitor> CreateMouseCursorMonitor();
+  std::unique_ptr<AudioCapturer> CreateAudioCapturer();
+  std::unique_ptr<InputInjector> CreateInputInjector();
+  std::unique_ptr<ScreenControls> CreateScreenControls();
+  std::unique_ptr<webrtc::DesktopCapturer> CreateVideoCapturer();
+  std::unique_ptr<webrtc::MouseCursorMonitor> CreateMouseCursorMonitor();
   std::string GetCapabilities() const;
   void SetCapabilities(const std::string& capabilities);
 
@@ -130,7 +130,8 @@
   void InjectTextEvent(const protocol::TextEvent& event);
   void InjectMouseEvent(const protocol::MouseEvent& event);
   void InjectTouchEvent(const protocol::TouchEvent& event);
-  void StartInputInjector(scoped_ptr<protocol::ClipboardStub> client_clipboard);
+  void StartInputInjector(
+      std::unique_ptr<protocol::ClipboardStub> client_clipboard);
 
   // API used to implement the SessionController interface.
   void SetScreenResolution(const ScreenResolution& resolution);
@@ -185,7 +186,7 @@
   base::WeakPtr<IpcAudioCapturer> audio_capturer_;
 
   // Points to the client stub passed to StartInputInjector().
-  scoped_ptr<protocol::ClipboardStub> client_clipboard_;
+  std::unique_ptr<protocol::ClipboardStub> client_clipboard_;
 
   // Used to disconnect the client session.
   base::WeakPtr<ClientSessionControl> client_session_control_;
@@ -201,7 +202,7 @@
   base::WeakPtr<IpcMouseCursorMonitor> mouse_cursor_monitor_;
 
   // IPC channel to the desktop session agent.
-  scoped_ptr<IPC::ChannelProxy> desktop_channel_;
+  std::unique_ptr<IPC::ChannelProxy> desktop_channel_;
 
   // Handle of the desktop process.
   base::Process desktop_process_;
diff --git a/remoting/host/desktop_session_win.cc b/remoting/host/desktop_session_win.cc
index 3001a13..413b179 100644
--- a/remoting/host/desktop_session_win.cc
+++ b/remoting/host/desktop_session_win.cc
@@ -7,6 +7,7 @@
 #include <sddl.h>
 
 #include <limits>
+#include <memory>
 #include <utility>
 
 #include "base/base_switches.h"
@@ -14,8 +15,8 @@
 #include "base/files/file_path.h"
 #include "base/guid.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/strings/stringprintf.h"
 #include "base/strings/utf_string_conversions.h"
@@ -104,7 +105,7 @@
   void InjectSas() override;
 
  private:
-  scoped_ptr<SasInjector> sas_injector_;
+  std::unique_ptr<SasInjector> sas_injector_;
 
   DISALLOW_COPY_AND_ASSIGN(ConsoleSession);
 };
@@ -365,27 +366,27 @@
 } // namespace
 
 // static
-scoped_ptr<DesktopSession> DesktopSessionWin::CreateForConsole(
+std::unique_ptr<DesktopSession> DesktopSessionWin::CreateForConsole(
     scoped_refptr<AutoThreadTaskRunner> caller_task_runner,
     scoped_refptr<AutoThreadTaskRunner> io_task_runner,
     DaemonProcess* daemon_process,
     int id,
     const ScreenResolution& resolution) {
-  return make_scoped_ptr(new ConsoleSession(
-      caller_task_runner, io_task_runner, daemon_process, id,
-      HostService::GetInstance()));
+  return base::WrapUnique(new ConsoleSession(caller_task_runner, io_task_runner,
+                                             daemon_process, id,
+                                             HostService::GetInstance()));
 }
 
 // static
-scoped_ptr<DesktopSession> DesktopSessionWin::CreateForVirtualTerminal(
+std::unique_ptr<DesktopSession> DesktopSessionWin::CreateForVirtualTerminal(
     scoped_refptr<AutoThreadTaskRunner> caller_task_runner,
     scoped_refptr<AutoThreadTaskRunner> io_task_runner,
     DaemonProcess* daemon_process,
     int id,
     const ScreenResolution& resolution) {
-  scoped_ptr<RdpSession> session(new RdpSession(
-      caller_task_runner, io_task_runner, daemon_process, id,
-      HostService::GetInstance()));
+  std::unique_ptr<RdpSession> session(
+      new RdpSession(caller_task_runner, io_task_runner, daemon_process, id,
+                     HostService::GetInstance()));
   if (!session->Initialize(resolution))
     return nullptr;
 
@@ -530,16 +531,18 @@
 
   session_attach_timer_.Stop();
 
-  scoped_ptr<base::CommandLine> target(new base::CommandLine(desktop_binary));
+  std::unique_ptr<base::CommandLine> target(
+      new base::CommandLine(desktop_binary));
   target->AppendSwitchASCII(kProcessTypeSwitchName, kProcessTypeDesktop);
   // Copy the command line switches enabling verbose logging.
   target->CopySwitchesFrom(*base::CommandLine::ForCurrentProcess(),
                            kCopiedSwitchNames, arraysize(kCopiedSwitchNames));
 
   // Create a delegate capable of launching a process in a different session.
-  scoped_ptr<WtsSessionProcessDelegate> delegate(new WtsSessionProcessDelegate(
-      io_task_runner_, std::move(target), launch_elevated,
-      base::WideToUTF8(kDaemonIpcSecurityDescriptor)));
+  std::unique_ptr<WtsSessionProcessDelegate> delegate(
+      new WtsSessionProcessDelegate(
+          io_task_runner_, std::move(target), launch_elevated,
+          base::WideToUTF8(kDaemonIpcSecurityDescriptor)));
   if (!delegate->Initialize(session_id)) {
     TerminateSession();
     return;
diff --git a/remoting/host/desktop_session_win.h b/remoting/host/desktop_session_win.h
index 0875243..1ff42c7 100644
--- a/remoting/host/desktop_session_win.h
+++ b/remoting/host/desktop_session_win.h
@@ -7,9 +7,10 @@
 
 #include <stdint.h>
 
+#include <memory>
+
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/time/time.h"
 #include "base/timer/timer.h"
 #include "base/win/scoped_handle.h"
@@ -41,7 +42,7 @@
       public WtsTerminalObserver {
  public:
   // Creates a desktop session instance that attaches to the physical console.
-  static scoped_ptr<DesktopSession> CreateForConsole(
+  static std::unique_ptr<DesktopSession> CreateForConsole(
       scoped_refptr<AutoThreadTaskRunner> caller_task_runner,
       scoped_refptr<AutoThreadTaskRunner> io_task_runner,
       DaemonProcess* daemon_process,
@@ -49,7 +50,7 @@
       const ScreenResolution& resolution);
 
   // Creates a desktop session instance that attaches to a virtual console.
-  static scoped_ptr<DesktopSession> CreateForVirtualTerminal(
+  static std::unique_ptr<DesktopSession> CreateForVirtualTerminal(
       scoped_refptr<AutoThreadTaskRunner> caller_task_runner,
       scoped_refptr<AutoThreadTaskRunner> io_task_runner,
       DaemonProcess* daemon_process,
@@ -116,7 +117,7 @@
   base::win::ScopedHandle desktop_process_;
 
   // Launches and monitors the desktop process.
-  scoped_ptr<WorkerProcessLauncher> launcher_;
+  std::unique_ptr<WorkerProcessLauncher> launcher_;
 
   // Used to unsubscribe from session attach and detach events.
   WtsTerminalMonitor* monitor_;
diff --git a/remoting/host/disconnect_window_chromeos.cc b/remoting/host/disconnect_window_chromeos.cc
index be1a4fa..1bb7153 100644
--- a/remoting/host/disconnect_window_chromeos.cc
+++ b/remoting/host/disconnect_window_chromeos.cc
@@ -7,6 +7,7 @@
 #include "ash/shell.h"
 #include "ash/system/tray/system_tray_notifier.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "remoting/host/client_session_control.h"
 #include "remoting/host/host_window.h"
 
@@ -48,8 +49,8 @@
 }  // namespace
 
 // static
-scoped_ptr<HostWindow> HostWindow::CreateDisconnectWindow() {
-  return make_scoped_ptr(new DisconnectWindowAura());
+std::unique_ptr<HostWindow> HostWindow::CreateDisconnectWindow() {
+  return base::WrapUnique(new DisconnectWindowAura());
 }
 
 }  // namespace remoting
diff --git a/remoting/host/disconnect_window_linux.cc b/remoting/host/disconnect_window_linux.cc
index a113fa8..524bbe0c 100644
--- a/remoting/host/disconnect_window_linux.cc
+++ b/remoting/host/disconnect_window_linux.cc
@@ -8,6 +8,7 @@
 #include "base/compiler_specific.h"
 #include "base/logging.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/strings/string_util.h"
 #include "base/strings/utf_string_conversions.h"
 #include "remoting/base/string_resources.h"
@@ -288,8 +289,8 @@
 }  // namespace
 
 // static
-scoped_ptr<HostWindow> HostWindow::CreateDisconnectWindow() {
-  return make_scoped_ptr(new DisconnectWindowGtk());
+std::unique_ptr<HostWindow> HostWindow::CreateDisconnectWindow() {
+  return base::WrapUnique(new DisconnectWindowGtk());
 }
 
 }  // namespace remoting
diff --git a/remoting/host/disconnect_window_mac.mm b/remoting/host/disconnect_window_mac.mm
index a2210ed..8271f3d 100644
--- a/remoting/host/disconnect_window_mac.mm
+++ b/remoting/host/disconnect_window_mac.mm
@@ -2,14 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#import <Cocoa/Cocoa.h>
-
 #import "remoting/host/disconnect_window_mac.h"
 
+#import <Cocoa/Cocoa.h>
+
 #include "base/bind.h"
 #include "base/compiler_specific.h"
 #include "base/i18n/rtl.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/memory/weak_ptr.h"
 #include "base/strings/string_util.h"
 #include "base/strings/sys_string_conversions.h"
@@ -74,8 +75,8 @@
 }
 
 // static
-scoped_ptr<HostWindow> HostWindow::CreateDisconnectWindow() {
-  return make_scoped_ptr(new DisconnectWindowMac());
+std::unique_ptr<HostWindow> HostWindow::CreateDisconnectWindow() {
+  return base::WrapUnique(new DisconnectWindowMac());
 }
 
 }  // namespace remoting
diff --git a/remoting/host/disconnect_window_win.cc b/remoting/host/disconnect_window_win.cc
index 6a4e48c5..daf71f35 100644
--- a/remoting/host/disconnect_window_win.cc
+++ b/remoting/host/disconnect_window_win.cc
@@ -2,12 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include <windows.h>
 #include <stddef.h>
+#include <windows.h>
 
 #include "base/compiler_specific.h"
 #include "base/logging.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/strings/string_util.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/win/current_module.h"
@@ -395,8 +396,8 @@
 } // namespace
 
 // static
-scoped_ptr<HostWindow> HostWindow::CreateDisconnectWindow() {
-  return make_scoped_ptr(new DisconnectWindowWin());
+std::unique_ptr<HostWindow> HostWindow::CreateDisconnectWindow() {
+  return base::WrapUnique(new DisconnectWindowWin());
 }
 
 }  // namespace remoting
diff --git a/remoting/host/dns_blackhole_checker.h b/remoting/host/dns_blackhole_checker.h
index 0ebc892f..053905ea 100644
--- a/remoting/host/dns_blackhole_checker.h
+++ b/remoting/host/dns_blackhole_checker.h
@@ -41,7 +41,7 @@
   scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;
 
   // URL fetcher used to verify access to the host talkgadget.
-  scoped_ptr<net::URLFetcher> url_fetcher_;
+  std::unique_ptr<net::URLFetcher> url_fetcher_;
 
   // The string pre-pended to '.talkgadget.google.com' to create the full
   // talkgadget domain name for the host.
diff --git a/remoting/host/fake_desktop_environment.cc b/remoting/host/fake_desktop_environment.cc
index a7ddca7..0c3528cc 100644
--- a/remoting/host/fake_desktop_environment.cc
+++ b/remoting/host/fake_desktop_environment.cc
@@ -6,6 +6,7 @@
 
 #include <utility>
 
+#include "base/memory/ptr_util.h"
 #include "remoting/host/audio_capturer.h"
 #include "remoting/host/input_injector.h"
 #include "remoting/proto/event.pb.h"
@@ -17,8 +18,7 @@
 FakeInputInjector::~FakeInputInjector() {}
 
 void FakeInputInjector::Start(
-    scoped_ptr<protocol::ClipboardStub> client_clipboard) {
-}
+    std::unique_ptr<protocol::ClipboardStub> client_clipboard) {}
 
 void FakeInputInjector::InjectKeyEvent(const protocol::KeyEvent& event) {
   if (key_events_)
@@ -58,32 +58,32 @@
 FakeDesktopEnvironment::~FakeDesktopEnvironment() {}
 
 // DesktopEnvironment implementation.
-scoped_ptr<AudioCapturer> FakeDesktopEnvironment::CreateAudioCapturer() {
+std::unique_ptr<AudioCapturer> FakeDesktopEnvironment::CreateAudioCapturer() {
   return nullptr;
 }
 
-scoped_ptr<InputInjector> FakeDesktopEnvironment::CreateInputInjector() {
-  scoped_ptr<FakeInputInjector> result(new FakeInputInjector());
+std::unique_ptr<InputInjector> FakeDesktopEnvironment::CreateInputInjector() {
+  std::unique_ptr<FakeInputInjector> result(new FakeInputInjector());
   last_input_injector_ = result->AsWeakPtr();
   return std::move(result);
 }
 
-scoped_ptr<ScreenControls> FakeDesktopEnvironment::CreateScreenControls() {
-  return make_scoped_ptr(new FakeScreenControls());
+std::unique_ptr<ScreenControls> FakeDesktopEnvironment::CreateScreenControls() {
+  return base::WrapUnique(new FakeScreenControls());
 }
 
-scoped_ptr<webrtc::DesktopCapturer>
+std::unique_ptr<webrtc::DesktopCapturer>
 FakeDesktopEnvironment::CreateVideoCapturer() {
-  scoped_ptr<protocol::FakeDesktopCapturer> result(
+  std::unique_ptr<protocol::FakeDesktopCapturer> result(
       new protocol::FakeDesktopCapturer());
   if (!frame_generator_.is_null())
     result->set_frame_generator(frame_generator_);
   return std::move(result);
 }
 
-scoped_ptr<webrtc::MouseCursorMonitor>
+std::unique_ptr<webrtc::MouseCursorMonitor>
 FakeDesktopEnvironment::CreateMouseCursorMonitor() {
-  return make_scoped_ptr(new FakeMouseCursorMonitor());
+  return base::WrapUnique(new FakeMouseCursorMonitor());
 }
 
 std::string FakeDesktopEnvironment::GetCapabilities() const {
@@ -96,9 +96,9 @@
 FakeDesktopEnvironmentFactory::~FakeDesktopEnvironmentFactory() {}
 
 // DesktopEnvironmentFactory implementation.
-scoped_ptr<DesktopEnvironment> FakeDesktopEnvironmentFactory::Create(
+std::unique_ptr<DesktopEnvironment> FakeDesktopEnvironmentFactory::Create(
     base::WeakPtr<ClientSessionControl> client_session_control) {
-  scoped_ptr<FakeDesktopEnvironment> result(new FakeDesktopEnvironment());
+  std::unique_ptr<FakeDesktopEnvironment> result(new FakeDesktopEnvironment());
   result->set_frame_generator(frame_generator_);
   last_desktop_environment_ = result->AsWeakPtr();
   return std::move(result);
diff --git a/remoting/host/fake_desktop_environment.h b/remoting/host/fake_desktop_environment.h
index b1bc6b4..2991001 100644
--- a/remoting/host/fake_desktop_environment.h
+++ b/remoting/host/fake_desktop_environment.h
@@ -20,7 +20,8 @@
   FakeInputInjector();
   ~FakeInputInjector() override;
 
-  void Start(scoped_ptr<protocol::ClipboardStub> client_clipboard) override;
+  void Start(
+      std::unique_ptr<protocol::ClipboardStub> client_clipboard) override;
   void InjectKeyEvent(const protocol::KeyEvent& event) override;
   void InjectTextEvent(const protocol::TextEvent& event) override;
   void InjectMouseEvent(const protocol::MouseEvent& event) override;
@@ -76,11 +77,12 @@
   }
 
   // DesktopEnvironment implementation.
-  scoped_ptr<AudioCapturer> CreateAudioCapturer() override;
-  scoped_ptr<InputInjector> CreateInputInjector() override;
-  scoped_ptr<ScreenControls> CreateScreenControls() override;
-  scoped_ptr<webrtc::DesktopCapturer> CreateVideoCapturer() override;
-  scoped_ptr<webrtc::MouseCursorMonitor> CreateMouseCursorMonitor() override;
+  std::unique_ptr<AudioCapturer> CreateAudioCapturer() override;
+  std::unique_ptr<InputInjector> CreateInputInjector() override;
+  std::unique_ptr<ScreenControls> CreateScreenControls() override;
+  std::unique_ptr<webrtc::DesktopCapturer> CreateVideoCapturer() override;
+  std::unique_ptr<webrtc::MouseCursorMonitor> CreateMouseCursorMonitor()
+      override;
   std::string GetCapabilities() const override;
   void SetCapabilities(const std::string& capabilities) override;
 
@@ -109,7 +111,7 @@
   }
 
   // DesktopEnvironmentFactory implementation.
-  scoped_ptr<DesktopEnvironment> Create(
+  std::unique_ptr<DesktopEnvironment> Create(
       base::WeakPtr<ClientSessionControl> client_session_control) override;
   void SetEnableCurtaining(bool enable) override;
   bool SupportsAudioCapture() const override;
diff --git a/remoting/host/fake_host_extension.cc b/remoting/host/fake_host_extension.cc
index 1e980ef..3fc26c11 100644
--- a/remoting/host/fake_host_extension.cc
+++ b/remoting/host/fake_host_extension.cc
@@ -8,6 +8,7 @@
 
 #include "base/logging.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "remoting/codec/video_encoder.h"
 #include "remoting/host/host_extension_session.h"
 #include "remoting/proto/control.pb.h"
@@ -57,12 +58,12 @@
   return capability_;
 }
 
-scoped_ptr<HostExtensionSession> FakeExtension::CreateExtensionSession(
+std::unique_ptr<HostExtensionSession> FakeExtension::CreateExtensionSession(
     ClientSessionControl* client_session_control,
     protocol::ClientStub* client_stub) {
   DCHECK(!was_instantiated());
   was_instantiated_ = true;
-  return make_scoped_ptr(new Session(this, message_type_));
+  return base::WrapUnique(new Session(this, message_type_));
 }
 
 } // namespace remoting
diff --git a/remoting/host/fake_host_extension.h b/remoting/host/fake_host_extension.h
index 7152de4..6dc7a3f 100644
--- a/remoting/host/fake_host_extension.h
+++ b/remoting/host/fake_host_extension.h
@@ -29,7 +29,7 @@
 
   // HostExtension interface.
   std::string capability() const override;
-  scoped_ptr<HostExtensionSession> CreateExtensionSession(
+  std::unique_ptr<HostExtensionSession> CreateExtensionSession(
       ClientSessionControl* client_session_control,
       protocol::ClientStub* client_stub) override;
 
diff --git a/remoting/host/fake_mouse_cursor_monitor.cc b/remoting/host/fake_mouse_cursor_monitor.cc
index 10facb5..5dbda7e1 100644
--- a/remoting/host/fake_mouse_cursor_monitor.cc
+++ b/remoting/host/fake_mouse_cursor_monitor.cc
@@ -4,8 +4,9 @@
 
 #include "remoting/host/fake_mouse_cursor_monitor.h"
 
+#include <memory>
+
 #include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor.h"
@@ -34,14 +35,13 @@
   const int kWidth = 32;
   const int kHeight = 32;
 
-  scoped_ptr<webrtc::DesktopFrame> desktop_frame(
+  std::unique_ptr<webrtc::DesktopFrame> desktop_frame(
       new webrtc::BasicDesktopFrame(webrtc::DesktopSize(kWidth, kHeight)));
   memset(desktop_frame->data(), 0xFF,
          webrtc::DesktopFrame::kBytesPerPixel * kWidth * kHeight);
 
-  scoped_ptr<webrtc::MouseCursor> mouse_cursor(
-      new webrtc::MouseCursor(desktop_frame.release(),
-                              webrtc::DesktopVector()));
+  std::unique_ptr<webrtc::MouseCursor> mouse_cursor(new webrtc::MouseCursor(
+      desktop_frame.release(), webrtc::DesktopVector()));
 
   callback_->OnMouseCursor(mouse_cursor.release());
 }
diff --git a/remoting/host/gcd_rest_client.cc b/remoting/host/gcd_rest_client.cc
index d985538..eba4d39 100644
--- a/remoting/host/gcd_rest_client.cc
+++ b/remoting/host/gcd_rest_client.cc
@@ -34,7 +34,7 @@
 GcdRestClient::~GcdRestClient() {}
 
 void GcdRestClient::PatchState(
-    scoped_ptr<base::DictionaryValue> patch_details,
+    std::unique_ptr<base::DictionaryValue> patch_details,
     const GcdRestClient::ResultCallback& callback) {
   DCHECK(!HasPendingRequest());
 
@@ -54,9 +54,9 @@
   // value because |DictionaryValue| doesn't support int64_t values, and
   // GCD doesn't accept fractional values.
   double now = clock_->Now().ToJavaTime();
-  scoped_ptr<base::DictionaryValue> patch_dict(new base::DictionaryValue);
+  std::unique_ptr<base::DictionaryValue> patch_dict(new base::DictionaryValue);
   patch_dict->SetDouble("requestTimeMs", now);
-  scoped_ptr<base::ListValue> patch_list(new base::ListValue);
+  std::unique_ptr<base::ListValue> patch_list(new base::ListValue);
   base::DictionaryValue* patch_item = new base::DictionaryValue;
   patch_list->Append(patch_item);
   patch_item->Set("patch", std::move(patch_details));
@@ -88,7 +88,7 @@
       base::Bind(&GcdRestClient::OnTokenReceived, base::Unretained(this)));
 }
 
-void GcdRestClient::SetClockForTest(scoped_ptr<base::Clock> clock) {
+void GcdRestClient::SetClockForTest(std::unique_ptr<base::Clock> clock) {
   clock_ = std::move(clock);
 }
 
diff --git a/remoting/host/gcd_rest_client.h b/remoting/host/gcd_rest_client.h
index 40c6d0b..5a9f41e 100644
--- a/remoting/host/gcd_rest_client.h
+++ b/remoting/host/gcd_rest_client.h
@@ -5,11 +5,11 @@
 #ifndef REMOTING_HOST_GCD_REST_CLIENT_H_
 #define REMOTING_HOST_GCD_REST_CLIENT_H_
 
+#include <memory>
 #include <queue>
 
 #include "base/callback.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/time/clock.h"
 #include "net/url_request/url_fetcher_delegate.h"
 #include "remoting/base/url_request_context_getter.h"
@@ -50,10 +50,10 @@
   // Sends a 'patchState' request to the GCD API.  Constructs and
   // sends an appropriate JSON message M where |patch_details| becomes
   // the value of M.patches[0].patch.
-  void PatchState(scoped_ptr<base::DictionaryValue> patch_details,
+  void PatchState(std::unique_ptr<base::DictionaryValue> patch_details,
                   const GcdRestClient::ResultCallback& callback);
 
-  void SetClockForTest(scoped_ptr<base::Clock> clock);
+  void SetClockForTest(std::unique_ptr<base::Clock> clock);
 
  private:
   void OnTokenReceived(OAuthTokenGetter::Status status,
@@ -68,8 +68,8 @@
   std::string gcd_device_id_;
   scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;
   OAuthTokenGetter* token_getter_;
-  scoped_ptr<base::Clock> clock_;
-  scoped_ptr<net::URLFetcher> url_fetcher_;
+  std::unique_ptr<base::Clock> clock_;
+  std::unique_ptr<net::URLFetcher> url_fetcher_;
   ResultCallback callback_;
 
   DISALLOW_COPY_AND_ASSIGN(GcdRestClient);
diff --git a/remoting/host/gcd_rest_client_unittest.cc b/remoting/host/gcd_rest_client_unittest.cc
index cfdbd9e..5b9df79 100644
--- a/remoting/host/gcd_rest_client_unittest.cc
+++ b/remoting/host/gcd_rest_client_unittest.cc
@@ -4,6 +4,7 @@
 
 #include "remoting/host/gcd_rest_client.h"
 
+#include "base/memory/ptr_util.h"
 #include "base/run_loop.h"
 #include "base/test/simple_test_clock.h"
 #include "base/values.h"
@@ -25,8 +26,9 @@
     last_result_ = result;
   }
 
-  scoped_ptr<base::DictionaryValue> MakePatchDetails(int id) {
-    scoped_ptr<base::DictionaryValue> patch_details(new base::DictionaryValue);
+  std::unique_ptr<base::DictionaryValue> MakePatchDetails(int id) {
+    std::unique_ptr<base::DictionaryValue> patch_details(
+        new base::DictionaryValue);
     patch_details->SetInteger("id", id);
     return patch_details;
   }
@@ -37,13 +39,13 @@
     }
     client_.reset(new GcdRestClient("http://gcd_base_url", "<gcd_device_id>",
                                     nullptr, token_getter));
-    client_->SetClockForTest(make_scoped_ptr(new base::SimpleTestClock));
+    client_->SetClockForTest(base::WrapUnique(new base::SimpleTestClock));
   }
 
  protected:
   net::TestURLFetcherFactory url_fetcher_factory_;
   FakeOAuthTokenGetter default_token_getter_;
-  scoped_ptr<GcdRestClient> client_;
+  std::unique_ptr<GcdRestClient> client_;
   int counter_ = 0;
   GcdRestClient::Result last_result_ = GcdRestClient::OTHER_ERROR;
 
diff --git a/remoting/host/gcd_state_updater.cc b/remoting/host/gcd_state_updater.cc
index c6cc22a4..d7d57c9 100644
--- a/remoting/host/gcd_state_updater.cc
+++ b/remoting/host/gcd_state_updater.cc
@@ -28,7 +28,7 @@
     const base::Closure& on_update_successful_callback,
     const base::Closure& on_unknown_host_id_error,
     SignalStrategy* signal_strategy,
-    scoped_ptr<GcdRestClient> gcd_rest_client)
+    std::unique_ptr<GcdRestClient> gcd_rest_client)
     : on_update_successful_callback_(on_update_successful_callback),
       on_unknown_host_id_error_(on_unknown_host_id_error),
       signal_strategy_(signal_strategy),
@@ -113,8 +113,8 @@
   }
 
   // Construct an update to the remote state.
-  scoped_ptr<base::DictionaryValue> patch(new base::DictionaryValue);
-  scoped_ptr<base::DictionaryValue> base_state(new base::DictionaryValue);
+  std::unique_ptr<base::DictionaryValue> patch(new base::DictionaryValue);
+  std::unique_ptr<base::DictionaryValue> base_state(new base::DictionaryValue);
   pending_request_jid_ = signal_strategy_->GetLocalJid();
   base_state->SetString("_jabberId", pending_request_jid_);
   base_state->SetString("_hostVersion", STRINGIZE(VERSION));
diff --git a/remoting/host/gcd_state_updater.h b/remoting/host/gcd_state_updater.h
index 9801103..fda54c2 100644
--- a/remoting/host/gcd_state_updater.h
+++ b/remoting/host/gcd_state_updater.h
@@ -5,11 +5,11 @@
 #ifndef REMOTING_HOST_GCD_STATE_UPDATER_H_
 #define REMOTING_HOST_GCD_STATE_UPDATER_H_
 
+#include <memory>
 #include <string>
 
 #include "base/callback.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/threading/thread_checker.h"
 #include "remoting/host/backoff_timer.h"
 #include "remoting/host/gcd_rest_client.h"
@@ -37,7 +37,7 @@
   GcdStateUpdater(const base::Closure& on_update_successful_callback,
                   const base::Closure& on_unknown_host_id_error,
                   SignalStrategy* signal_strategy,
-                  scoped_ptr<GcdRestClient> gcd_client);
+                  std::unique_ptr<GcdRestClient> gcd_client);
   ~GcdStateUpdater() override;
 
   // See HeartbeatSender::SetHostOfflineReason.
@@ -57,7 +57,7 @@
   base::Closure on_update_successful_callback_;
   base::Closure on_unknown_host_id_error_;
   SignalStrategy* signal_strategy_;
-  scoped_ptr<GcdRestClient> gcd_rest_client_;
+  std::unique_ptr<GcdRestClient> gcd_rest_client_;
   BackoffTimer timer_;
   base::ThreadChecker thread_checker_;
   std::string pending_request_jid_;
diff --git a/remoting/host/gcd_state_updater_unittest.cc b/remoting/host/gcd_state_updater_unittest.cc
index 2496341..fc50f39 100644
--- a/remoting/host/gcd_state_updater_unittest.cc
+++ b/remoting/host/gcd_state_updater_unittest.cc
@@ -8,6 +8,7 @@
 #include <utility>
 #include <vector>
 
+#include "base/memory/ptr_util.h"
 #include "base/strings/stringize_macros.h"
 #include "base/test/simple_test_clock.h"
 #include "base/test/test_mock_time_task_runner.h"
@@ -40,7 +41,7 @@
             nullptr,
             &token_getter_)),
         signal_strategy_("local_jid") {
-    rest_client_->SetClockForTest(make_scoped_ptr(new base::SimpleTestClock));
+    rest_client_->SetClockForTest(base::WrapUnique(new base::SimpleTestClock));
   }
 
   void OnSuccess() { on_success_count_++; }
@@ -50,17 +51,17 @@
  protected:
   scoped_refptr<base::TestMockTimeTaskRunner> task_runner_;
   base::ThreadTaskRunnerHandle runner_handler_;
-  scoped_ptr<base::Clock> clock_;
+  std::unique_ptr<base::Clock> clock_;
   net::TestURLFetcherFactory url_fetcher_factory_;
   FakeOAuthTokenGetter token_getter_;
-  scoped_ptr<GcdRestClient> rest_client_;
+  std::unique_ptr<GcdRestClient> rest_client_;
   FakeSignalStrategy signal_strategy_;
   int on_success_count_ = 0;
   int on_host_id_error_count_ = 0;
 };
 
 TEST_F(GcdStateUpdaterTest, Success) {
-  scoped_ptr<GcdStateUpdater> updater(new GcdStateUpdater(
+  std::unique_ptr<GcdStateUpdater> updater(new GcdStateUpdater(
       base::Bind(&GcdStateUpdaterTest::OnSuccess, base::Unretained(this)),
       base::Bind(&GcdStateUpdaterTest::OnHostIdError, base::Unretained(this)),
       &signal_strategy_, std::move(rest_client_)));
@@ -84,7 +85,7 @@
 }
 
 TEST_F(GcdStateUpdaterTest, QueuedRequests) {
-  scoped_ptr<GcdStateUpdater> updater(new GcdStateUpdater(
+  std::unique_ptr<GcdStateUpdater> updater(new GcdStateUpdater(
       base::Bind(&GcdStateUpdaterTest::OnSuccess, base::Unretained(this)),
       base::Bind(&GcdStateUpdaterTest::OnHostIdError, base::Unretained(this)),
       &signal_strategy_, std::move(rest_client_)));
@@ -128,7 +129,7 @@
 }
 
 TEST_F(GcdStateUpdaterTest, Retry) {
-  scoped_ptr<GcdStateUpdater> updater(new GcdStateUpdater(
+  std::unique_ptr<GcdStateUpdater> updater(new GcdStateUpdater(
       base::Bind(&GcdStateUpdaterTest::OnSuccess, base::Unretained(this)),
       base::Bind(&GcdStateUpdaterTest::OnHostIdError, base::Unretained(this)),
       &signal_strategy_, std::move(rest_client_)));
@@ -153,7 +154,7 @@
 }
 
 TEST_F(GcdStateUpdaterTest, UnknownHost) {
-  scoped_ptr<GcdStateUpdater> updater(new GcdStateUpdater(
+  std::unique_ptr<GcdStateUpdater> updater(new GcdStateUpdater(
       base::Bind(&GcdStateUpdaterTest::OnSuccess, base::Unretained(this)),
       base::Bind(&GcdStateUpdaterTest::OnHostIdError, base::Unretained(this)),
       &signal_strategy_, std::move(rest_client_)));
diff --git a/remoting/host/heartbeat_sender.cc b/remoting/host/heartbeat_sender.cc
index 079a393..d18c881 100644
--- a/remoting/host/heartbeat_sender.cc
+++ b/remoting/host/heartbeat_sender.cc
@@ -305,10 +305,10 @@
   sequence_id_was_set_ = true;
 }
 
-scoped_ptr<XmlElement> HeartbeatSender::CreateHeartbeatMessage() {
+std::unique_ptr<XmlElement> HeartbeatSender::CreateHeartbeatMessage() {
   // Create heartbeat stanza.
-  scoped_ptr<XmlElement> heartbeat(new XmlElement(
-      QName(kChromotingXmlNamespace, kHeartbeatQueryTag)));
+  std::unique_ptr<XmlElement> heartbeat(
+      new XmlElement(QName(kChromotingXmlNamespace, kHeartbeatQueryTag)));
   heartbeat->AddAttr(QName(kChromotingXmlNamespace, kHostIdAttr), host_id_);
   heartbeat->AddAttr(QName(kChromotingXmlNamespace, kSequenceIdAttr),
                  base::IntToString(sequence_id_));
@@ -319,35 +319,35 @@
   }
   heartbeat->AddElement(CreateSignature().release());
   // Append host version.
-  scoped_ptr<XmlElement> version_tag(new XmlElement(
-      QName(kChromotingXmlNamespace, kHostVersionTag)));
+  std::unique_ptr<XmlElement> version_tag(
+      new XmlElement(QName(kChromotingXmlNamespace, kHostVersionTag)));
   version_tag->AddText(STRINGIZE(VERSION));
   heartbeat->AddElement(version_tag.release());
   // If we have not recorded a heartbeat success, continue sending host OS info.
   if (!heartbeat_succeeded_) {
     // Append host OS name.
-    scoped_ptr<XmlElement> os_name_tag(new XmlElement(
+    std::unique_ptr<XmlElement> os_name_tag(new XmlElement(
         QName(kChromotingXmlNamespace, kHostOperatingSystemNameTag)));
     os_name_tag->AddText(GetHostOperatingSystemName());
     heartbeat->AddElement(os_name_tag.release());
     // Append host OS version.
-    scoped_ptr<XmlElement> os_version_tag(new XmlElement(
+    std::unique_ptr<XmlElement> os_version_tag(new XmlElement(
         QName(kChromotingXmlNamespace, kHostOperatingSystemVersionTag)));
     os_version_tag->AddText(GetHostOperatingSystemVersion());
     heartbeat->AddElement(os_version_tag.release());
   }
   // Append log message (which isn't signed).
-  scoped_ptr<XmlElement> log(ServerLogEntry::MakeStanza());
-  scoped_ptr<ServerLogEntry> log_entry(MakeLogEntryForHeartbeat());
+  std::unique_ptr<XmlElement> log(ServerLogEntry::MakeStanza());
+  std::unique_ptr<ServerLogEntry> log_entry(MakeLogEntryForHeartbeat());
   AddHostFieldsToLogEntry(log_entry.get());
   log->AddElement(log_entry->ToStanza().release());
   heartbeat->AddElement(log.release());
   return heartbeat;
 }
 
-scoped_ptr<XmlElement> HeartbeatSender::CreateSignature() {
-  scoped_ptr<XmlElement> signature_tag(new XmlElement(
-      QName(kChromotingXmlNamespace, kHeartbeatSignatureTag)));
+std::unique_ptr<XmlElement> HeartbeatSender::CreateSignature() {
+  std::unique_ptr<XmlElement> signature_tag(
+      new XmlElement(QName(kChromotingXmlNamespace, kHeartbeatSignatureTag)));
 
   std::string message = NormalizeJid(signal_strategy_->GetLocalJid()) + ' ' +
                         base::IntToString(sequence_id_);
diff --git a/remoting/host/heartbeat_sender.h b/remoting/host/heartbeat_sender.h
index d2293b2..da5ef091 100644
--- a/remoting/host/heartbeat_sender.h
+++ b/remoting/host/heartbeat_sender.h
@@ -5,6 +5,7 @@
 #ifndef REMOTING_HOST_HEARTBEAT_SENDER_H_
 #define REMOTING_HOST_HEARTBEAT_SENDER_H_
 
+#include <memory>
 #include <string>
 
 #include "base/callback.h"
@@ -12,7 +13,6 @@
 #include "base/gtest_prod_util.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/threading/thread_checker.h"
 #include "base/timer/timer.h"
 #include "remoting/base/rsa_key_pair.h"
@@ -147,8 +147,8 @@
   void OnHostOfflineReasonAck();
 
   // Helper methods used by DoSendStanza() to generate heartbeat stanzas.
-  scoped_ptr<buzz::XmlElement> CreateHeartbeatMessage();
-  scoped_ptr<buzz::XmlElement> CreateSignature();
+  std::unique_ptr<buzz::XmlElement> CreateHeartbeatMessage();
+  std::unique_ptr<buzz::XmlElement> CreateSignature();
 
   base::Closure on_heartbeat_successful_callback_;
   base::Closure on_unknown_host_id_error_;
@@ -156,8 +156,8 @@
   SignalStrategy* signal_strategy_;
   scoped_refptr<const RsaKeyPair> host_key_pair_;
   std::string directory_bot_jid_;
-  scoped_ptr<IqSender> iq_sender_;
-  scoped_ptr<IqRequest> request_;
+  std::unique_ptr<IqSender> iq_sender_;
+  std::unique_ptr<IqRequest> request_;
   int interval_ms_;
   base::RepeatingTimer timer_;
   base::OneShotTimer timer_resend_;
diff --git a/remoting/host/heartbeat_sender_unittest.cc b/remoting/host/heartbeat_sender_unittest.cc
index d2f27a5..9253ac6e 100644
--- a/remoting/host/heartbeat_sender_unittest.cc
+++ b/remoting/host/heartbeat_sender_unittest.cc
@@ -107,7 +107,7 @@
   MockClosure mock_unknown_host_id_error_callback_;
   std::set<SignalStrategy::Listener*> signal_strategy_listeners_;
   scoped_refptr<RsaKeyPair> key_pair_;
-  scoped_ptr<HeartbeatSender> heartbeat_sender_;
+  std::unique_ptr<HeartbeatSender> heartbeat_sender_;
 };
 
 // Call Start() followed by Stop(), and make sure a valid heartbeat is sent.
@@ -125,7 +125,7 @@
   heartbeat_sender_->OnSignalStrategyStateChange(SignalStrategy::CONNECTED);
   base::RunLoop().RunUntilIdle();
 
-  scoped_ptr<XmlElement> stanza(sent_iq);
+  std::unique_ptr<XmlElement> stanza(sent_iq);
   ASSERT_TRUE(stanza != nullptr);
   ValidateHeartbeatStanza(stanza.get(), "0", nullptr);
 
@@ -149,7 +149,7 @@
   heartbeat_sender_->OnSignalStrategyStateChange(SignalStrategy::CONNECTED);
   base::RunLoop().RunUntilIdle();
 
-  scoped_ptr<XmlElement> stanza(sent_iq);
+  std::unique_ptr<XmlElement> stanza(sent_iq);
   ASSERT_TRUE(stanza != nullptr);
   ValidateHeartbeatStanza(stanza.get(), "0", nullptr);
 
@@ -166,7 +166,7 @@
   heartbeat_sender_->OnSignalStrategyStateChange(SignalStrategy::CONNECTED);
   base::RunLoop().RunUntilIdle();
 
-  scoped_ptr<XmlElement> stanza2(sent_iq);
+  std::unique_ptr<XmlElement> stanza2(sent_iq);
   ValidateHeartbeatStanza(stanza2.get(), "1", nullptr);
 
   heartbeat_sender_->OnSignalStrategyStateChange(SignalStrategy::DISCONNECTED);
@@ -190,7 +190,7 @@
   heartbeat_sender_->OnSignalStrategyStateChange(SignalStrategy::CONNECTED);
   base::RunLoop().RunUntilIdle();
 
-  scoped_ptr<XmlElement> stanza(sent_iq);
+  std::unique_ptr<XmlElement> stanza(sent_iq);
   ASSERT_TRUE(stanza != nullptr);
   ValidateHeartbeatStanza(stanza.get(), "0", nullptr);
 
@@ -202,7 +202,7 @@
   EXPECT_CALL(signal_strategy_, SendStanzaPtr(NotNull()))
       .WillOnce(DoAll(SaveArg<0>(&sent_iq2), Return(true)));
 
-  scoped_ptr<XmlElement> response(new XmlElement(buzz::QN_IQ));
+  std::unique_ptr<XmlElement> response(new XmlElement(buzz::QN_IQ));
   response->AddAttr(QName(std::string(), "type"), "result");
   XmlElement* result =
       new XmlElement(QName(kChromotingXmlNamespace, "heartbeat-result"));
@@ -215,7 +215,7 @@
   heartbeat_sender_->ProcessResponse(false, nullptr, response.get());
   base::RunLoop().RunUntilIdle();
 
-  scoped_ptr<XmlElement> stanza2(sent_iq2);
+  std::unique_ptr<XmlElement> stanza2(sent_iq2);
   ASSERT_TRUE(stanza2 != nullptr);
   ValidateHeartbeatStanza(stanza2.get(),
                           base::IntToString(kExpectedSequenceId).c_str(),
@@ -228,7 +228,7 @@
 void HeartbeatSenderTest::ProcessResponseWithInterval(
     bool is_offline_heartbeat_response,
     int interval) {
-  scoped_ptr<XmlElement> response(new XmlElement(buzz::QN_IQ));
+  std::unique_ptr<XmlElement> response(new XmlElement(buzz::QN_IQ));
   response->AddAttr(QName(std::string(), "type"), "result");
 
   XmlElement* result = new XmlElement(
@@ -276,7 +276,7 @@
   heartbeat_sender_->OnSignalStrategyStateChange(SignalStrategy::CONNECTED);
   base::RunLoop().RunUntilIdle();
 
-  scoped_ptr<XmlElement> stanza(sent_iq);
+  std::unique_ptr<XmlElement> stanza(sent_iq);
   ASSERT_TRUE(stanza != nullptr);
   ValidateHeartbeatStanza(stanza.get(), "0", "test_error");
 
@@ -346,7 +346,7 @@
   heartbeat_sender_->OnSignalStrategyStateChange(SignalStrategy::CONNECTED);
   base::RunLoop().RunUntilIdle();
 
-  scoped_ptr<XmlElement> stanza(sent_iq);
+  std::unique_ptr<XmlElement> stanza(sent_iq);
   ASSERT_TRUE(stanza != nullptr);
 
   XmlElement* heartbeat_stanza =
diff --git a/remoting/host/host_change_notification_listener.h b/remoting/host/host_change_notification_listener.h
index 26f1939..8452550 100644
--- a/remoting/host/host_change_notification_listener.h
+++ b/remoting/host/host_change_notification_listener.h
@@ -5,11 +5,11 @@
 #ifndef REMOTING_HOST_HOST_CHANGE_NOTIFICATION_LISTENER_H
 #define REMOTING_HOST_HOST_CHANGE_NOTIFICATION_LISTENER_H
 
+#include <memory>
 #include <string>
 
 #include "base/compiler_specific.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "remoting/signaling/signal_strategy.h"
 
diff --git a/remoting/host/host_change_notification_listener_unittest.cc b/remoting/host/host_change_notification_listener_unittest.cc
index bdaff5b5..cbacbf9 100644
--- a/remoting/host/host_change_notification_listener_unittest.cc
+++ b/remoting/host/host_change_notification_listener_unittest.cc
@@ -65,10 +65,10 @@
     EXPECT_TRUE(signal_strategy_listeners_.empty());
   }
 
-  scoped_ptr<XmlElement> GetNotificationStanza(std::string operation,
-                                               std::string hostId,
-                                               std::string botJid) {
-    scoped_ptr<XmlElement> stanza(new XmlElement(buzz::QN_IQ));
+  std::unique_ptr<XmlElement> GetNotificationStanza(std::string operation,
+                                                    std::string hostId,
+                                                    std::string botJid) {
+    std::unique_ptr<XmlElement> stanza(new XmlElement(buzz::QN_IQ));
     stanza->AddAttr(QName(std::string(), "type"), "set");
     XmlElement* host_changed =
         new XmlElement(QName(kChromotingXmlNamespace, "host-changed"));
@@ -84,15 +84,16 @@
   MockListener mock_listener_;
   MockSignalStrategy signal_strategy_;
   std::set<SignalStrategy::Listener*> signal_strategy_listeners_;
-  scoped_ptr<HostChangeNotificationListener> host_change_notification_listener_;
+  std::unique_ptr<HostChangeNotificationListener>
+      host_change_notification_listener_;
   base::MessageLoop message_loop_;
 };
 
 TEST_F(HostChangeNotificationListenerTest, ReceiveValidNotification) {
   EXPECT_CALL(mock_listener_, OnHostDeleted())
       .WillOnce(Return());
-  scoped_ptr<XmlElement> stanza = GetNotificationStanza(
-      "delete", kHostId, kTestBotJid);
+  std::unique_ptr<XmlElement> stanza =
+      GetNotificationStanza("delete", kHostId, kTestBotJid);
   host_change_notification_listener_->OnSignalStrategyIncomingStanza(
       stanza.get());
   message_loop_.PostTask(FROM_HERE,
@@ -103,8 +104,8 @@
 TEST_F(HostChangeNotificationListenerTest, ReceiveNotificationBeforeDelete) {
   EXPECT_CALL(mock_listener_, OnHostDeleted())
       .Times(0);
-  scoped_ptr<XmlElement> stanza = GetNotificationStanza(
-      "delete", kHostId, kTestBotJid);
+  std::unique_ptr<XmlElement> stanza =
+      GetNotificationStanza("delete", kHostId, kTestBotJid);
   host_change_notification_listener_->OnSignalStrategyIncomingStanza(
       stanza.get());
   host_change_notification_listener_.reset();
@@ -117,8 +118,8 @@
 TEST_F(HostChangeNotificationListenerTest, ReceiveInvalidHostIdNotification) {
   EXPECT_CALL(mock_listener_, OnHostDeleted())
       .Times(0);
-  scoped_ptr<XmlElement> stanza = GetNotificationStanza(
-      "delete", "1", kTestBotJid);
+  std::unique_ptr<XmlElement> stanza =
+      GetNotificationStanza("delete", "1", kTestBotJid);
   host_change_notification_listener_->OnSignalStrategyIncomingStanza(
       stanza.get());
   message_loop_.PostTask(FROM_HERE,
@@ -129,7 +130,7 @@
 TEST_F(HostChangeNotificationListenerTest, ReceiveInvalidBotJidNotification) {
   EXPECT_CALL(mock_listener_, OnHostDeleted())
       .Times(0);
-  scoped_ptr<XmlElement> stanza = GetNotificationStanza(
+  std::unique_ptr<XmlElement> stanza = GetNotificationStanza(
       "delete", kHostId, "notremotingbot@bot.talk.google.com");
   host_change_notification_listener_->OnSignalStrategyIncomingStanza(
       stanza.get());
@@ -141,8 +142,8 @@
 TEST_F(HostChangeNotificationListenerTest, ReceiveNonDeleteNotification) {
   EXPECT_CALL(mock_listener_, OnHostDeleted())
       .Times(0);
-  scoped_ptr<XmlElement> stanza = GetNotificationStanza(
-      "update", kHostId, kTestBotJid);
+  std::unique_ptr<XmlElement> stanza =
+      GetNotificationStanza("update", kHostId, kTestBotJid);
   host_change_notification_listener_->OnSignalStrategyIncomingStanza(
       stanza.get());
   message_loop_.PostTask(FROM_HERE,
diff --git a/remoting/host/host_config.cc b/remoting/host/host_config.cc
index f464962..95b66e2 100644
--- a/remoting/host/host_config.cc
+++ b/remoting/host/host_config.cc
@@ -8,20 +8,21 @@
 #include "base/files/important_file_writer.h"
 #include "base/json/json_reader.h"
 #include "base/json/json_writer.h"
+#include "base/memory/ptr_util.h"
 #include "base/values.h"
 
 namespace remoting {
 
-scoped_ptr<base::DictionaryValue> HostConfigFromJson(
+std::unique_ptr<base::DictionaryValue> HostConfigFromJson(
     const std::string& json) {
-  scoped_ptr<base::Value> value =
+  std::unique_ptr<base::Value> value =
       base::JSONReader::Read(json, base::JSON_ALLOW_TRAILING_COMMAS);
   if (!value || !value->IsType(base::Value::TYPE_DICTIONARY)) {
     LOG(WARNING) << "Failed to parse host config from JSON";
     return nullptr;
   }
 
-  return make_scoped_ptr(static_cast<base::DictionaryValue*>(value.release()));
+  return base::WrapUnique(static_cast<base::DictionaryValue*>(value.release()));
 }
 
 std::string HostConfigToJson(const base::DictionaryValue& host_config) {
@@ -30,7 +31,7 @@
   return data;
 }
 
-scoped_ptr<base::DictionaryValue> HostConfigFromJsonFile(
+std::unique_ptr<base::DictionaryValue> HostConfigFromJsonFile(
     const base::FilePath& config_file) {
   // TODO(sergeyu): Implement better error handling here.
   std::string serialized;
diff --git a/remoting/host/host_config.h b/remoting/host/host_config.h
index 0ce69f2d..73f0408 100644
--- a/remoting/host/host_config.h
+++ b/remoting/host/host_config.h
@@ -5,9 +5,9 @@
 #ifndef REMOTING_HOST_HOST_CONFIG_H_
 #define REMOTING_HOST_HOST_CONFIG_H_
 
+#include <memory>
 #include <string>
 
-#include "base/memory/scoped_ptr.h"
 
 namespace base {
 class DictionaryValue;
@@ -47,12 +47,12 @@
 extern const char kGcdDeviceIdConfigPath[];
 
 // Helpers for serializing/deserializing Host configuration dictonaries.
-scoped_ptr<base::DictionaryValue> HostConfigFromJson(
+std::unique_ptr<base::DictionaryValue> HostConfigFromJson(
     const std::string& serialized);
 std::string HostConfigToJson(const base::DictionaryValue& host_config);
 
 // Helpers for loading/saving host configurations from/to files.
-scoped_ptr<base::DictionaryValue> HostConfigFromJsonFile(
+std::unique_ptr<base::DictionaryValue> HostConfigFromJsonFile(
     const base::FilePath& config_file);
 bool HostConfigToJsonFile(const base::DictionaryValue& host_config,
                           const base::FilePath& config_file);
diff --git a/remoting/host/host_config_unittest.cc b/remoting/host/host_config_unittest.cc
index 6203c7f..c082491 100644
--- a/remoting/host/host_config_unittest.cc
+++ b/remoting/host/host_config_unittest.cc
@@ -52,7 +52,8 @@
   ASSERT_TRUE(test_dir_.CreateUniqueTempDir());
   base::FilePath test_file = test_dir_.path().AppendASCII("read.json");
   WriteTestFile(test_file);
-  scoped_ptr<base::DictionaryValue> target(HostConfigFromJsonFile(test_file));
+  std::unique_ptr<base::DictionaryValue> target(
+      HostConfigFromJsonFile(test_file));
   ASSERT_TRUE(target);
 
   std::string value;
@@ -75,7 +76,8 @@
 
   base::FilePath test_file = test_dir_.path().AppendASCII("write.json");
   WriteTestFile(test_file);
-  scoped_ptr<base::DictionaryValue> target(HostConfigFromJsonFile(test_file));
+  std::unique_ptr<base::DictionaryValue> target(
+      HostConfigFromJsonFile(test_file));
   ASSERT_TRUE(target);
 
   std::string new_refresh_token_value = "NEW_REFRESH_TOKEN";
@@ -83,7 +85,8 @@
   ASSERT_TRUE(HostConfigToJsonFile(*target, test_file));
 
   // Now read the file again and check that the value has been written.
-  scoped_ptr<base::DictionaryValue> reader(HostConfigFromJsonFile(test_file));
+  std::unique_ptr<base::DictionaryValue> reader(
+      HostConfigFromJsonFile(test_file));
   ASSERT_TRUE(reader);
 
   std::string value;
diff --git a/remoting/host/host_event_logger.h b/remoting/host/host_event_logger.h
index 80b61a5..e7ab5a9 100644
--- a/remoting/host/host_event_logger.h
+++ b/remoting/host/host_event_logger.h
@@ -5,11 +5,11 @@
 #ifndef REMOTING_HOST_HOST_EVENT_LOGGER_H_
 #define REMOTING_HOST_HOST_EVENT_LOGGER_H_
 
+#include <memory>
 #include <string>
 
 #include "base/compiler_specific.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 
 namespace remoting {
@@ -22,7 +22,7 @@
 
   // Creates an event-logger that monitors host status changes and logs
   // corresponding events to the OS-specific log (syslog/EventLog).
-  static scoped_ptr<HostEventLogger> Create(
+  static std::unique_ptr<HostEventLogger> Create(
       base::WeakPtr<HostStatusMonitor> monitor,
       const std::string& application_name);
 
diff --git a/remoting/host/host_event_logger_posix.cc b/remoting/host/host_event_logger_posix.cc
index ce06140..7b7112ee 100644
--- a/remoting/host/host_event_logger_posix.cc
+++ b/remoting/host/host_event_logger_posix.cc
@@ -4,8 +4,15 @@
 
 #include "remoting/host/host_event_logger.h"
 
+// Included here, since the #define for LOG_USER in syslog.h conflicts with the
+// constants in base/logging.h, and this source file should use the version in
+// syslog.h.
+#include <syslog.h>
+
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
 #include "base/memory/weak_ptr.h"
 #include "base/strings/stringprintf.h"
 #include "net/base/ip_endpoint.h"
@@ -13,11 +20,6 @@
 #include "remoting/host/host_status_observer.h"
 #include "remoting/protocol/transport.h"
 
-// Included here, since the #define for LOG_USER in syslog.h conflicts with the
-// constants in base/logging.h, and this source file should use the version in
-// syslog.h.
-#include <syslog.h>
-
 namespace remoting {
 
 namespace {
@@ -103,10 +105,10 @@
 }
 
 // static
-scoped_ptr<HostEventLogger> HostEventLogger::Create(
+std::unique_ptr<HostEventLogger> HostEventLogger::Create(
     base::WeakPtr<HostStatusMonitor> monitor,
     const std::string& application_name) {
-  return make_scoped_ptr(new HostEventLoggerPosix(monitor, application_name));
+  return base::WrapUnique(new HostEventLoggerPosix(monitor, application_name));
 }
 
 }  // namespace remoting
diff --git a/remoting/host/host_event_logger_win.cc b/remoting/host/host_event_logger_win.cc
index f3ae2c57..d99a01f 100644
--- a/remoting/host/host_event_logger_win.cc
+++ b/remoting/host/host_event_logger_win.cc
@@ -4,13 +4,15 @@
 
 #include "remoting/host/host_event_logger.h"
 
-#include <windows.h>
 #include <stddef.h>
+#include <windows.h>
+
+#include <memory>
 #include <string>
 #include <vector>
 
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
 #include "base/memory/weak_ptr.h"
 #include "base/strings/string16.h"
 #include "base/strings/utf_string_conversions.h"
@@ -148,10 +150,10 @@
 }
 
 // static
-scoped_ptr<HostEventLogger> HostEventLogger::Create(
+std::unique_ptr<HostEventLogger> HostEventLogger::Create(
     base::WeakPtr<HostStatusMonitor> monitor,
     const std::string& application_name) {
-  return make_scoped_ptr(new HostEventLoggerWin(monitor, application_name));
+  return base::WrapUnique(new HostEventLoggerWin(monitor, application_name));
 }
 
 }  // namespace remoting
diff --git a/remoting/host/host_extension.h b/remoting/host/host_extension.h
index 41158e6..07c5b775a 100644
--- a/remoting/host/host_extension.h
+++ b/remoting/host/host_extension.h
@@ -5,9 +5,9 @@
 #ifndef REMOTING_HOST_HOST_EXTENSION_H_
 #define REMOTING_HOST_HOST_EXTENSION_H_
 
+#include <memory>
 #include <string>
 
-#include "base/memory/scoped_ptr.h"
 
 namespace remoting {
 
@@ -36,7 +36,7 @@
   // |client_session_control| may be used to e.g. disconnect the session.
   // |client_stub| may be used to send messages to the session.
   // Both interfaces are valid for the lifetime of the |HostExtensionSession|.
-  virtual scoped_ptr<HostExtensionSession> CreateExtensionSession(
+  virtual std::unique_ptr<HostExtensionSession> CreateExtensionSession(
       ClientSessionControl* client_session_control,
       protocol::ClientStub* client_stub) = 0;
 };
diff --git a/remoting/host/host_extension_session.h b/remoting/host/host_extension_session.h
index d30360f..56d70e6 100644
--- a/remoting/host/host_extension_session.h
+++ b/remoting/host/host_extension_session.h
@@ -5,8 +5,6 @@
 #ifndef REMOTING_HOST_HOST_EXTENSION_SESSION_H_
 #define REMOTING_HOST_HOST_EXTENSION_SESSION_H_
 
-#include "base/memory/scoped_ptr.h"
-
 namespace webrtc {
 class DesktopCapturer;
 }
diff --git a/remoting/host/host_extension_session_manager.cc b/remoting/host/host_extension_session_manager.cc
index 0d56793d..df61058f 100644
--- a/remoting/host/host_extension_session_manager.cc
+++ b/remoting/host/host_extension_session_manager.cc
@@ -55,7 +55,7 @@
       continue;
     }
 
-    scoped_ptr<HostExtensionSession> extension_session =
+    std::unique_ptr<HostExtensionSession> extension_session =
         (*extension)
             ->CreateExtensionSession(client_session_control_, client_stub_);
     DCHECK(extension_session);
diff --git a/remoting/host/host_extension_session_manager.h b/remoting/host/host_extension_session_manager.h
index ad9c2c7..cea26117 100644
--- a/remoting/host/host_extension_session_manager.h
+++ b/remoting/host/host_extension_session_manager.h
@@ -5,11 +5,11 @@
 #ifndef REMOTING_HOST_HOST_EXTENSION_SESSION_MANAGER_H_
 #define REMOTING_HOST_HOST_EXTENSION_SESSION_MANAGER_H_
 
+#include <memory>
 #include <string>
 #include <vector>
 
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/scoped_vector.h"
 
 namespace webrtc {
diff --git a/remoting/host/host_mock_objects.cc b/remoting/host/host_mock_objects.cc
index 16d12d64..dbb2ac8 100644
--- a/remoting/host/host_mock_objects.cc
+++ b/remoting/host/host_mock_objects.cc
@@ -4,6 +4,7 @@
 
 #include "remoting/host/host_mock_objects.h"
 
+#include "base/memory/ptr_util.h"
 #include "base/single_thread_task_runner.h"
 #include "net/base/ip_endpoint.h"
 #include "remoting/base/auto_thread_task_runner.h"
@@ -23,35 +24,35 @@
 
 MockDesktopEnvironment::~MockDesktopEnvironment() {}
 
-scoped_ptr<AudioCapturer> MockDesktopEnvironment::CreateAudioCapturer() {
-  return make_scoped_ptr(CreateAudioCapturerPtr());
+std::unique_ptr<AudioCapturer> MockDesktopEnvironment::CreateAudioCapturer() {
+  return base::WrapUnique(CreateAudioCapturerPtr());
 }
 
-scoped_ptr<InputInjector> MockDesktopEnvironment::CreateInputInjector() {
-  return make_scoped_ptr(CreateInputInjectorPtr());
+std::unique_ptr<InputInjector> MockDesktopEnvironment::CreateInputInjector() {
+  return base::WrapUnique(CreateInputInjectorPtr());
 }
 
-scoped_ptr<ScreenControls> MockDesktopEnvironment::CreateScreenControls() {
-  return make_scoped_ptr(CreateScreenControlsPtr());
+std::unique_ptr<ScreenControls> MockDesktopEnvironment::CreateScreenControls() {
+  return base::WrapUnique(CreateScreenControlsPtr());
 }
 
-scoped_ptr<webrtc::DesktopCapturer>
+std::unique_ptr<webrtc::DesktopCapturer>
 MockDesktopEnvironment::CreateVideoCapturer() {
-  return make_scoped_ptr(CreateVideoCapturerPtr());
+  return base::WrapUnique(CreateVideoCapturerPtr());
 }
 
-scoped_ptr<webrtc::MouseCursorMonitor>
+std::unique_ptr<webrtc::MouseCursorMonitor>
 MockDesktopEnvironment::CreateMouseCursorMonitor() {
-  return make_scoped_ptr(CreateMouseCursorMonitorPtr());
+  return base::WrapUnique(CreateMouseCursorMonitorPtr());
 }
 
 MockDesktopEnvironmentFactory::MockDesktopEnvironmentFactory() {}
 
 MockDesktopEnvironmentFactory::~MockDesktopEnvironmentFactory() {}
 
-scoped_ptr<DesktopEnvironment> MockDesktopEnvironmentFactory::Create(
+std::unique_ptr<DesktopEnvironment> MockDesktopEnvironmentFactory::Create(
     base::WeakPtr<ClientSessionControl> client_session_control) {
-  return make_scoped_ptr(CreatePtr());
+  return base::WrapUnique(CreatePtr());
 }
 
 MockInputInjector::MockInputInjector() {}
@@ -59,7 +60,7 @@
 MockInputInjector::~MockInputInjector() {}
 
 void MockInputInjector::Start(
-    scoped_ptr<protocol::ClipboardStub> client_clipboard) {
+    std::unique_ptr<protocol::ClipboardStub> client_clipboard) {
   StartPtr(client_clipboard.get());
 }
 
diff --git a/remoting/host/host_mock_objects.h b/remoting/host/host_mock_objects.h
index 1eb8ca1..770045e 100644
--- a/remoting/host/host_mock_objects.h
+++ b/remoting/host/host_mock_objects.h
@@ -45,11 +45,11 @@
   MOCK_METHOD1(SetCapabilities, void(const std::string&));
 
   // DesktopEnvironment implementation.
-  scoped_ptr<AudioCapturer> CreateAudioCapturer() override;
-  scoped_ptr<InputInjector> CreateInputInjector() override;
-  scoped_ptr<ScreenControls> CreateScreenControls() override;
-  scoped_ptr<webrtc::DesktopCapturer> CreateVideoCapturer() override;
-  scoped_ptr<webrtc::MouseCursorMonitor> CreateMouseCursorMonitor()
+  std::unique_ptr<AudioCapturer> CreateAudioCapturer() override;
+  std::unique_ptr<InputInjector> CreateInputInjector() override;
+  std::unique_ptr<ScreenControls> CreateScreenControls() override;
+  std::unique_ptr<webrtc::DesktopCapturer> CreateVideoCapturer() override;
+  std::unique_ptr<webrtc::MouseCursorMonitor> CreateMouseCursorMonitor()
       override;
 };
 
@@ -95,7 +95,7 @@
   MOCK_METHOD0(CreatePtr, DesktopEnvironment*());
   MOCK_CONST_METHOD0(SupportsAudioCapture, bool());
 
-  scoped_ptr<DesktopEnvironment> Create(
+  std::unique_ptr<DesktopEnvironment> Create(
       base::WeakPtr<ClientSessionControl> client_session_control) override;
 
  private:
@@ -116,7 +116,7 @@
   MOCK_METHOD1(StartPtr,
                void(protocol::ClipboardStub* client_clipboard));
 
-  void Start(scoped_ptr<protocol::ClipboardStub> client_clipboard);
+  void Start(std::unique_ptr<protocol::ClipboardStub> client_clipboard);
 
  private:
   DISALLOW_COPY_AND_ASSIGN(MockInputInjector);
diff --git a/remoting/host/host_status_logger.cc b/remoting/host/host_status_logger.cc
index eeae93b..992a155 100644
--- a/remoting/host/host_status_logger.cc
+++ b/remoting/host/host_status_logger.cc
@@ -31,7 +31,7 @@
                                              bool connected) {
   DCHECK(CalledOnValidThread());
 
-  scoped_ptr<ServerLogEntry> entry(
+  std::unique_ptr<ServerLogEntry> entry(
       MakeLogEntryForSessionStateChange(connected));
   AddHostFieldsToLogEntry(entry.get());
   entry->AddModeField(log_to_server_.mode());
diff --git a/remoting/host/host_status_logger_unittest.cc b/remoting/host/host_status_logger_unittest.cc
index a3c41cca..f562167 100644
--- a/remoting/host/host_status_logger_unittest.cc
+++ b/remoting/host/host_status_logger_unittest.cc
@@ -137,7 +137,7 @@
  protected:
   base::MessageLoop message_loop_;
   MockSignalStrategy signal_strategy_;
-  scoped_ptr<HostStatusLogger> host_status_logger_;
+  std::unique_ptr<HostStatusLogger> host_status_logger_;
   FakeHostStatusMonitor host_status_monitor_;
 };
 
diff --git a/remoting/host/host_window.h b/remoting/host/host_window.h
index 03d5b00..0a2e309 100644
--- a/remoting/host/host_window.h
+++ b/remoting/host/host_window.h
@@ -5,9 +5,10 @@
 #ifndef REMOTING_HOST_HOST_WINDOW_H_
 #define REMOTING_HOST_HOST_WINDOW_H_
 
+#include <memory>
+
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/threading/non_thread_safe.h"
 
@@ -20,10 +21,10 @@
   virtual ~HostWindow() {}
 
   // Creates a platform-specific instance of the continue window.
-  static scoped_ptr<HostWindow> CreateContinueWindow();
+  static std::unique_ptr<HostWindow> CreateContinueWindow();
 
   // Creates a platform-specific instance of the disconnect window.
-  static scoped_ptr<HostWindow> CreateDisconnectWindow();
+  static std::unique_ptr<HostWindow> CreateDisconnectWindow();
 
   // Starts the UI state machine. |client_session_control| will be used to
   // notify the caller about the local user's actions.
diff --git a/remoting/host/host_window_proxy.cc b/remoting/host/host_window_proxy.cc
index 60dd0a1..862398b 100644
--- a/remoting/host/host_window_proxy.cc
+++ b/remoting/host/host_window_proxy.cc
@@ -23,7 +23,7 @@
  public:
   Core(scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
        scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
-       scoped_ptr<HostWindow> host_window);
+       std::unique_ptr<HostWindow> host_window);
 
   // Starts |host_window_| on the |ui_task_runner_| thread.
   void Start(const base::WeakPtr<ClientSessionControl>& client_session_control);
@@ -59,7 +59,7 @@
   base::WeakPtr<ClientSessionControl> client_session_control_;
 
   // The wrapped |HostWindow| instance running on the |ui_task_runner_| thread.
-  scoped_ptr<HostWindow> host_window_;
+  std::unique_ptr<HostWindow> host_window_;
 
   // Used to create the control pointer passed to |host_window_|.
   base::WeakPtrFactory<ClientSessionControl> weak_factory_;
@@ -70,7 +70,7 @@
 HostWindowProxy::HostWindowProxy(
     scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
     scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
-    scoped_ptr<HostWindow> host_window) {
+    std::unique_ptr<HostWindow> host_window) {
   DCHECK(caller_task_runner->BelongsToCurrentThread());
 
   // Detach |host_window| from the calling thread so that |Core| could run it on
@@ -95,7 +95,7 @@
 HostWindowProxy::Core::Core(
     scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
     scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
-    scoped_ptr<HostWindow> host_window)
+    std::unique_ptr<HostWindow> host_window)
     : caller_task_runner_(caller_task_runner),
       ui_task_runner_(ui_task_runner),
       host_window_(std::move(host_window)),
diff --git a/remoting/host/host_window_proxy.h b/remoting/host/host_window_proxy.h
index de7de3e..2419c40 100644
--- a/remoting/host/host_window_proxy.h
+++ b/remoting/host/host_window_proxy.h
@@ -5,9 +5,10 @@
 #ifndef REMOTING_HOST_HOST_WINDOW_PROXY_H_
 #define REMOTING_HOST_HOST_WINDOW_PROXY_H_
 
+#include <memory>
+
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "remoting/host/host_window.h"
 
@@ -23,7 +24,7 @@
   HostWindowProxy(
       scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
       scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
-      scoped_ptr<HostWindow> host_window);
+      std::unique_ptr<HostWindow> host_window);
   ~HostWindowProxy() override;
 
   // HostWindow overrides.
diff --git a/remoting/host/input_injector.h b/remoting/host/input_injector.h
index 99a7ddee..20169c4 100644
--- a/remoting/host/input_injector.h
+++ b/remoting/host/input_injector.h
@@ -5,8 +5,9 @@
 #ifndef REMOTING_HOST_INPUT_INJECTOR_H_
 #define REMOTING_HOST_INPUT_INJECTOR_H_
 
+#include <memory>
+
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "remoting/protocol/clipboard_stub.h"
 #include "remoting/protocol/input_stub.h"
 
@@ -24,7 +25,7 @@
   // object should do as much work as possible on |main_task_runner|,
   // using |ui_task_runner| only for tasks actually requiring a UI
   // thread.
-  static scoped_ptr<InputInjector> Create(
+  static std::unique_ptr<InputInjector> Create(
       scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
       scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner);
 
@@ -34,7 +35,7 @@
 
   // Initialises any objects needed to execute events.
   virtual void Start(
-      scoped_ptr<protocol::ClipboardStub> client_clipboard) = 0;
+      std::unique_ptr<protocol::ClipboardStub> client_clipboard) = 0;
 };
 
 }  // namespace remoting
diff --git a/remoting/host/input_injector_chromeos.cc b/remoting/host/input_injector_chromeos.cc
index 49b08e75..65c58de 100644
--- a/remoting/host/input_injector_chromeos.cc
+++ b/remoting/host/input_injector_chromeos.cc
@@ -11,6 +11,7 @@
 #include "base/bind_helpers.h"
 #include "base/location.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "remoting/host/chromeos/point_transformer.h"
 #include "remoting/host/clipboard.h"
 #include "remoting/proto/internal.pb.h"
@@ -56,15 +57,15 @@
   void InjectKeyEvent(const KeyEvent& event);
   void InjectTextEvent(const TextEvent& event);
   void InjectMouseEvent(const MouseEvent& event);
-  void Start(scoped_ptr<protocol::ClipboardStub> client_clipboard);
+  void Start(std::unique_ptr<protocol::ClipboardStub> client_clipboard);
 
  private:
-  scoped_ptr<ui::SystemInputInjector> delegate_;
-  scoped_ptr<Clipboard> clipboard_;
+  std::unique_ptr<ui::SystemInputInjector> delegate_;
+  std::unique_ptr<Clipboard> clipboard_;
 
   // Used to rotate the input coordinates appropriately based on the current
   // display rotation settings.
-  scoped_ptr<PointTransformer> point_transformer_;
+  std::unique_ptr<PointTransformer> point_transformer_;
 
   DISALLOW_COPY_AND_ASSIGN(Core);
 };
@@ -111,7 +112,7 @@
 }
 
 void InputInjectorChromeos::Core::Start(
-    scoped_ptr<protocol::ClipboardStub> client_clipboard) {
+    std::unique_ptr<protocol::ClipboardStub> client_clipboard) {
   ui::OzonePlatform* ozone_platform = ui::OzonePlatform::GetInstance();
   delegate_ = ozone_platform->CreateSystemInputInjector();
   DCHECK(delegate_);
@@ -161,19 +162,19 @@
 }
 
 void InputInjectorChromeos::Start(
-    scoped_ptr<protocol::ClipboardStub> client_clipboard) {
+    std::unique_ptr<protocol::ClipboardStub> client_clipboard) {
   input_task_runner_->PostTask(
       FROM_HERE, base::Bind(&Core::Start, base::Unretained(core_.get()),
                             base::Passed(&client_clipboard)));
 }
 
 // static
-scoped_ptr<InputInjector> InputInjector::Create(
+std::unique_ptr<InputInjector> InputInjector::Create(
     scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
     scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) {
   // The Ozone input injector must be called on the UI task runner of the
   // browser process.
-  return make_scoped_ptr(new InputInjectorChromeos(ui_task_runner));
+  return base::WrapUnique(new InputInjectorChromeos(ui_task_runner));
 }
 
 // static
diff --git a/remoting/host/input_injector_chromeos.h b/remoting/host/input_injector_chromeos.h
index e72d916..1707c42 100644
--- a/remoting/host/input_injector_chromeos.h
+++ b/remoting/host/input_injector_chromeos.h
@@ -30,14 +30,15 @@
   void InjectTouchEvent(const protocol::TouchEvent& event) override;
 
   // InputInjector interface.
-  void Start(scoped_ptr<protocol::ClipboardStub> client_clipboard) override;
+  void Start(
+      std::unique_ptr<protocol::ClipboardStub> client_clipboard) override;
 
  private:
   class Core;
 
   // Task runner for input injection.
   scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_;
-  scoped_ptr<Core> core_;
+  std::unique_ptr<Core> core_;
 
   DISALLOW_COPY_AND_ASSIGN(InputInjectorChromeos);
 };
diff --git a/remoting/host/input_injector_mac.cc b/remoting/host/input_injector_mac.cc
index fc2ba1b..2b00c19 100644
--- a/remoting/host/input_injector_mac.cc
+++ b/remoting/host/input_injector_mac.cc
@@ -17,6 +17,7 @@
 #include "base/location.h"
 #include "base/mac/scoped_cftyperef.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/memory/ref_counted.h"
 #include "base/single_thread_task_runner.h"
 #include "base/strings/utf_string_conversions.h"
@@ -82,7 +83,8 @@
   void InjectTouchEvent(const TouchEvent& event) override;
 
   // InputInjector interface.
-  void Start(scoped_ptr<protocol::ClipboardStub> client_clipboard) override;
+  void Start(
+      std::unique_ptr<protocol::ClipboardStub> client_clipboard) override;
 
  private:
   // The actual implementation resides in InputInjectorMac::Core class.
@@ -99,7 +101,7 @@
     void InjectMouseEvent(const MouseEvent& event);
 
     // Mirrors the InputInjector interface.
-    void Start(scoped_ptr<protocol::ClipboardStub> client_clipboard);
+    void Start(std::unique_ptr<protocol::ClipboardStub> client_clipboard);
 
     void Stop();
 
@@ -112,7 +114,7 @@
     scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
     webrtc::DesktopVector mouse_pos_;
     uint32_t mouse_button_state_;
-    scoped_ptr<Clipboard> clipboard_;
+    std::unique_ptr<Clipboard> clipboard_;
     uint64_t left_modifiers_;
     uint64_t right_modifiers_;
     base::TimeTicks last_time_display_woken_;
@@ -155,7 +157,7 @@
 }
 
 void InputInjectorMac::Start(
-    scoped_ptr<protocol::ClipboardStub> client_clipboard) {
+    std::unique_ptr<protocol::ClipboardStub> client_clipboard) {
   core_->Start(std::move(client_clipboard));
 }
 
@@ -335,7 +337,7 @@
 }
 
 void InputInjectorMac::Core::Start(
-    scoped_ptr<protocol::ClipboardStub> client_clipboard) {
+    std::unique_ptr<protocol::ClipboardStub> client_clipboard) {
   if (!task_runner_->BelongsToCurrentThread()) {
     task_runner_->PostTask(
         FROM_HERE,
@@ -388,10 +390,10 @@
 }  // namespace
 
 // static
-scoped_ptr<InputInjector> InputInjector::Create(
+std::unique_ptr<InputInjector> InputInjector::Create(
     scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
     scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) {
-  return make_scoped_ptr(new InputInjectorMac(main_task_runner));
+  return base::WrapUnique(new InputInjectorMac(main_task_runner));
 }
 
 // static
diff --git a/remoting/host/input_injector_win.cc b/remoting/host/input_injector_win.cc
index d1fefa9..5278dbe 100644
--- a/remoting/host/input_injector_win.cc
+++ b/remoting/host/input_injector_win.cc
@@ -8,11 +8,13 @@
 #include <windows.h>
 
 #include <utility>
+#include <vector>
 
 #include "base/bind.h"
 #include "base/compiler_specific.h"
 #include "base/location.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/memory/ref_counted.h"
 #include "base/single_thread_task_runner.h"
 #include "base/strings/string16.h"
@@ -27,6 +29,12 @@
 
 namespace {
 
+using protocol::ClipboardEvent;
+using protocol::KeyEvent;
+using protocol::TextEvent;
+using protocol::MouseEvent;
+using protocol::TouchEvent;
+
 // Helper used to call SendInput() API.
 void SendKeyboardInput(uint32_t flags, uint16_t scancode) {
   // Populate a Windows INPUT structure for the event.
@@ -52,11 +60,93 @@
     PLOG(ERROR) << "Failed to inject a key event";
 }
 
-using protocol::ClipboardEvent;
-using protocol::KeyEvent;
-using protocol::TextEvent;
-using protocol::MouseEvent;
-using protocol::TouchEvent;
+// Parse move related operations from the input MouseEvent, and insert the
+// result into output.
+void ParseMouseMoveEvent(const MouseEvent& event, std::vector<INPUT>* output) {
+  INPUT input = {0};
+  input.type = INPUT_MOUSE;
+
+  if (event.has_delta_x() && event.has_delta_y()) {
+    input.mi.dx = event.delta_x();
+    input.mi.dy = event.delta_y();
+    input.mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_VIRTUALDESK;
+  } else if (event.has_x() && event.has_y()) {
+    int width = GetSystemMetrics(SM_CXVIRTUALSCREEN);
+    int height = GetSystemMetrics(SM_CYVIRTUALSCREEN);
+    if (width > 1 && height > 1) {
+      int x = std::max(0, std::min(width, event.x()));
+      int y = std::max(0, std::min(height, event.y()));
+      input.mi.dx = static_cast<int>((x * 65535) / (width - 1));
+      input.mi.dy = static_cast<int>((y * 65535) / (height - 1));
+      input.mi.dwFlags =
+          MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_VIRTUALDESK;
+    }
+  } else {
+    return;
+  }
+
+  output->push_back(std::move(input));
+}
+
+// Parse click related operations from the input MouseEvent, and insert the
+// result into output.
+void ParseMouseClickEvent(const MouseEvent& event, std::vector<INPUT>* output) {
+  if (event.has_button() && event.has_button_down()) {
+    INPUT input = {0};
+    input.type = INPUT_MOUSE;
+
+    MouseEvent::MouseButton button = event.button();
+    bool down = event.button_down();
+
+    // If the host is configured to swap left & right buttons, inject swapped
+    // events to un-do that re-mapping.
+    if (GetSystemMetrics(SM_SWAPBUTTON)) {
+      if (button == MouseEvent::BUTTON_LEFT) {
+        button = MouseEvent::BUTTON_RIGHT;
+      } else if (button == MouseEvent::BUTTON_RIGHT) {
+        button = MouseEvent::BUTTON_LEFT;
+      }
+    }
+
+    if (button == MouseEvent::BUTTON_MIDDLE) {
+      input.mi.dwFlags = down ? MOUSEEVENTF_MIDDLEDOWN : MOUSEEVENTF_MIDDLEUP;
+    } else if (button == MouseEvent::BUTTON_RIGHT) {
+      input.mi.dwFlags = down ? MOUSEEVENTF_RIGHTDOWN : MOUSEEVENTF_RIGHTUP;
+    } else {
+      input.mi.dwFlags = down ? MOUSEEVENTF_LEFTDOWN : MOUSEEVENTF_LEFTUP;
+    }
+
+    output->push_back(std::move(input));
+  }
+}
+
+// Parse wheel related operations from the input MouseEvent, and insert the
+// result into output.
+void ParseMouseWheelEvent(const MouseEvent& event, std::vector<INPUT>* output) {
+  if (event.has_wheel_delta_x()) {
+    int delta = static_cast<int>(event.wheel_delta_x());
+    if (delta != 0) {
+      INPUT input = {0};
+      input.type = INPUT_MOUSE;
+      input.mi.mouseData = delta;
+      // According to MSDN, MOUSEEVENTF_HWHELL and MOUSEEVENTF_WHEEL are both
+      // required for a horizontal wheel event.
+      input.mi.dwFlags = MOUSEEVENTF_HWHEEL | MOUSEEVENTF_WHEEL;
+      output->push_back(std::move(input));
+    }
+  }
+
+  if (event.has_wheel_delta_y()) {
+    int delta = static_cast<int>(event.wheel_delta_y());
+    if (delta != 0) {
+      INPUT input = {0};
+      input.type = INPUT_MOUSE;
+      input.mi.mouseData = delta;
+      input.mi.dwFlags = MOUSEEVENTF_WHEEL;
+      output->push_back(std::move(input));
+    }
+  }
+}
 
 // A class to generate events on Windows.
 class InputInjectorWin : public InputInjector {
@@ -76,7 +166,7 @@
 
   // InputInjector interface.
   void Start(
-      scoped_ptr<protocol::ClipboardStub> client_clipboard) override;
+      std::unique_ptr<protocol::ClipboardStub> client_clipboard) override;
 
  private:
   // The actual implementation resides in InputInjectorWin::Core class.
@@ -95,7 +185,7 @@
     void InjectTouchEvent(const TouchEvent& event);
 
     // Mirrors the InputInjector interface.
-    void Start(scoped_ptr<protocol::ClipboardStub> client_clipboard);
+    void Start(std::unique_ptr<protocol::ClipboardStub> client_clipboard);
 
     void Stop();
 
@@ -110,7 +200,7 @@
 
     scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
     scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
-    scoped_ptr<Clipboard> clipboard_;
+    std::unique_ptr<Clipboard> clipboard_;
     TouchInjectorWin touch_injector_;
 
     DISALLOW_COPY_AND_ASSIGN(Core);
@@ -152,7 +242,7 @@
 }
 
 void InputInjectorWin::Start(
-    scoped_ptr<protocol::ClipboardStub> client_clipboard) {
+    std::unique_ptr<protocol::ClipboardStub> client_clipboard) {
   core_->Start(std::move(client_clipboard));
 }
 
@@ -216,7 +306,7 @@
 }
 
 void InputInjectorWin::Core::Start(
-    scoped_ptr<protocol::ClipboardStub> client_clipboard) {
+    std::unique_ptr<protocol::ClipboardStub> client_clipboard) {
   if (!ui_task_runner_->BelongsToCurrentThread()) {
     ui_task_runner_->PostTask(
         FROM_HERE,
@@ -276,72 +366,13 @@
   // Reset the system idle suspend timeout.
   SetThreadExecutionState(ES_SYSTEM_REQUIRED);
 
-  INPUT input;
-  memset(&input, 0, sizeof(input));
-  input.type = INPUT_MOUSE;
+  std::vector<INPUT> inputs;
+  ParseMouseMoveEvent(event, &inputs);
+  ParseMouseClickEvent(event, &inputs);
+  ParseMouseWheelEvent(event, &inputs);
 
-  if (event.has_delta_x() && event.has_delta_y()) {
-    input.mi.dx = event.delta_x();
-    input.mi.dy = event.delta_y();
-    input.mi.dwFlags |= MOUSEEVENTF_MOVE | MOUSEEVENTF_VIRTUALDESK;
-  } else if (event.has_x() && event.has_y()) {
-    int width = GetSystemMetrics(SM_CXVIRTUALSCREEN);
-    int height = GetSystemMetrics(SM_CYVIRTUALSCREEN);
-    if (width > 1 && height > 1) {
-      int x = std::max(0, std::min(width, event.x()));
-      int y = std::max(0, std::min(height, event.y()));
-      input.mi.dx = static_cast<int>((x * 65535) / (width - 1));
-      input.mi.dy = static_cast<int>((y * 65535) / (height - 1));
-      input.mi.dwFlags |=
-          MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_VIRTUALDESK;
-    }
-  }
-
-  int wheel_delta_x = 0;
-  int wheel_delta_y = 0;
-  if (event.has_wheel_delta_x() && event.has_wheel_delta_y()) {
-    wheel_delta_x = static_cast<int>(event.wheel_delta_x());
-    wheel_delta_y = static_cast<int>(event.wheel_delta_y());
-  }
-
-  if (wheel_delta_x != 0 || wheel_delta_y != 0) {
-    if (wheel_delta_x != 0) {
-      input.mi.mouseData = wheel_delta_x;
-      input.mi.dwFlags |= MOUSEEVENTF_HWHEEL;
-    }
-    if (wheel_delta_y != 0) {
-      input.mi.mouseData = wheel_delta_y;
-      input.mi.dwFlags |= MOUSEEVENTF_WHEEL;
-    }
-  }
-
-  if (event.has_button() && event.has_button_down()) {
-    MouseEvent::MouseButton button = event.button();
-    bool down = event.button_down();
-
-    // If the host is configured to swap left & right buttons, inject swapped
-    // events to un-do that re-mapping.
-    if (GetSystemMetrics(SM_SWAPBUTTON)) {
-      if (button == MouseEvent::BUTTON_LEFT) {
-        button = MouseEvent::BUTTON_RIGHT;
-      } else if (button == MouseEvent::BUTTON_RIGHT) {
-        button = MouseEvent::BUTTON_LEFT;
-      }
-    }
-
-    if (button == MouseEvent::BUTTON_LEFT) {
-      input.mi.dwFlags |= down ? MOUSEEVENTF_LEFTDOWN : MOUSEEVENTF_LEFTUP;
-    } else if (button == MouseEvent::BUTTON_MIDDLE) {
-      input.mi.dwFlags |= down ? MOUSEEVENTF_MIDDLEDOWN : MOUSEEVENTF_MIDDLEUP;
-    } else if (button == MouseEvent::BUTTON_RIGHT) {
-      input.mi.dwFlags |= down ? MOUSEEVENTF_RIGHTDOWN : MOUSEEVENTF_RIGHTUP;
-    } else {
-      input.mi.dwFlags |= down ? MOUSEEVENTF_LEFTDOWN : MOUSEEVENTF_LEFTUP;
-    }
-  }
-
-  if (input.mi.dwFlags) {
-    if (SendInput(1, &input, sizeof(INPUT)) == 0)
+  if (!inputs.empty()) {
+    if (SendInput(inputs.size(), inputs.data(), sizeof(INPUT)) != inputs.size())
       PLOG(ERROR) << "Failed to inject a mouse event";
   }
 }
@@ -353,10 +384,10 @@
 }  // namespace
 
 // static
-scoped_ptr<InputInjector> InputInjector::Create(
+std::unique_ptr<InputInjector> InputInjector::Create(
     scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
     scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) {
-  return make_scoped_ptr(
+  return base::WrapUnique(
       new InputInjectorWin(main_task_runner, ui_task_runner));
 }
 
diff --git a/remoting/host/input_injector_x11.cc b/remoting/host/input_injector_x11.cc
index 030df3f1..d28d07b 100644
--- a/remoting/host/input_injector_x11.cc
+++ b/remoting/host/input_injector_x11.cc
@@ -129,7 +129,8 @@
   void InjectTouchEvent(const TouchEvent& event) override;
 
   // InputInjector interface.
-  void Start(scoped_ptr<protocol::ClipboardStub> client_clipboard) override;
+  void Start(
+      std::unique_ptr<protocol::ClipboardStub> client_clipboard) override;
 
  private:
   // The actual implementation resides in InputInjectorX11::Core class.
@@ -148,7 +149,7 @@
     void InjectMouseEvent(const MouseEvent& event);
 
     // Mirrors the InputInjector interface.
-    void Start(scoped_ptr<protocol::ClipboardStub> client_clipboard);
+    void Start(std::unique_ptr<protocol::ClipboardStub> client_clipboard);
 
     void Stop();
 
@@ -196,7 +197,7 @@
     PointTransformer point_transformer_;
 #endif
 
-    scoped_ptr<Clipboard> clipboard_;
+    std::unique_ptr<Clipboard> clipboard_;
 
     bool saved_auto_repeat_enabled_;
 
@@ -242,7 +243,7 @@
 }
 
 void InputInjectorX11::Start(
-    scoped_ptr<protocol::ClipboardStub> client_clipboard) {
+    std::unique_ptr<protocol::ClipboardStub> client_clipboard) {
   core_->Start(std::move(client_clipboard));
 }
 
@@ -522,7 +523,8 @@
   // Note that if a user has a global mapping that completely disables a button
   // (by assigning 0 to it), we won't be able to inject it.
   int num_buttons = XGetPointerMapping(display_, nullptr, 0);
-  scoped_ptr<unsigned char[]> pointer_mapping(new unsigned char[num_buttons]);
+  std::unique_ptr<unsigned char[]> pointer_mapping(
+      new unsigned char[num_buttons]);
   num_buttons = XGetPointerMapping(display_, pointer_mapping.get(),
                                    num_buttons);
   for (int i = 0; i < kNumPointerButtons; i++) {
@@ -579,7 +581,8 @@
 
   int num_device_buttons =
       XGetDeviceButtonMapping(display_, device, nullptr, 0);
-  scoped_ptr<unsigned char[]> button_mapping(new unsigned char[num_buttons]);
+  std::unique_ptr<unsigned char[]> button_mapping(
+      new unsigned char[num_buttons]);
   for (int i = 0; i < num_device_buttons; i++) {
     button_mapping[i] = i + 1;
   }
@@ -620,7 +623,7 @@
 }
 
 void InputInjectorX11::Core::Start(
-    scoped_ptr<protocol::ClipboardStub> client_clipboard) {
+    std::unique_ptr<protocol::ClipboardStub> client_clipboard) {
   if (!task_runner_->BelongsToCurrentThread()) {
     task_runner_->PostTask(
         FROM_HERE,
@@ -645,10 +648,10 @@
 }  // namespace
 
 // static
-scoped_ptr<InputInjector> InputInjector::Create(
+std::unique_ptr<InputInjector> InputInjector::Create(
     scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
     scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) {
-  scoped_ptr<InputInjectorX11> injector(
+  std::unique_ptr<InputInjectorX11> injector(
       new InputInjectorX11(main_task_runner));
   if (!injector->Init())
     return nullptr;
diff --git a/remoting/host/installer/win/chromoting.wxs b/remoting/host/installer/win/chromoting.wxs
index 44cbc1f..15f1dcf 100644
--- a/remoting/host/installer/win/chromoting.wxs
+++ b/remoting/host/installer/win/chromoting.wxs
@@ -37,6 +37,7 @@
 
   <?define CoreBinary = "remoting_core.dll" ?>
   <?define HostBinary = "remoting_host.exe" ?>
+  <?define RemoteSecurityKeyBinary = "remote_security_key.exe" ?>
 
   <?define ChromotingTypelib = "{b6396c45-b0cc-456b-9f49-f12964ee6df4}" ?>
 
@@ -279,6 +280,25 @@
                                 Scope="any" />
       </Component>
 
+      <Component Id="remote_security_key" Guid="*">
+        <File Id="$(var.RemoteSecurityKeyBinary)"
+              DiskId="1"
+              KeyPath="yes"
+              Name="$(var.RemoteSecurityKeyBinary)"
+              Vital="yes"/>
+      </Component>
+
+      <Component Id="remote_security_key_registration" Guid="*">
+        <RegistryKey Id="remote_security_key_reg_key"
+                     Root="HKLM"
+                     Key="SOFTWARE\Google\SecurityKey"
+                     Action="create">
+          <RegistryValue Type="string"
+                         Name="RemoteSecurityKeyPath"
+                         Value="[binaries]$(var.RemoteSecurityKeyBinary)"/>
+        </RegistryKey>
+      </Component>
+
       <?if $(var.OfficialBuild) != 0 ?>
         <Component Id="omaha_registration" Guid="*">
           <RegistryKey Id="omaha_client_key"
@@ -618,6 +638,8 @@
       <ComponentRef Id="remoting_host"/>
       <ComponentRef Id="remoting_lib"/>
       <ComponentRef Id="remoting_pairing_registry"/>
+      <ComponentRef Id="remote_security_key"/>
+      <ComponentRef Id="remote_security_key_registration"/>
       <ComponentRef Id="sas"/>
       <ComponentRef Id="sawbuck_provider"/>
     </Feature>
diff --git a/remoting/host/installer/win/parameters.json b/remoting/host/installer/win/parameters.json
index 47b4f041..dc13a8e9 100644
--- a/remoting/host/installer/win/parameters.json
+++ b/remoting/host/installer/win/parameters.json
@@ -16,7 +16,8 @@
     "remoting_desktop.exe",
     "remoting_host.exe",
     "remoting_native_messaging_host.exe",
-    "remote_assistance_host.exe"
+    "remote_assistance_host.exe",
+    "remote_security_key.exe"
   ],
   "source": "chromoting.wxs",
   "bind_path": "files",
diff --git a/remoting/host/ipc_audio_capturer.cc b/remoting/host/ipc_audio_capturer.cc
index 3b6b95d4..70c475d 100644
--- a/remoting/host/ipc_audio_capturer.cc
+++ b/remoting/host/ipc_audio_capturer.cc
@@ -29,7 +29,7 @@
   return true;
 }
 
-void IpcAudioCapturer::OnAudioPacket(scoped_ptr<AudioPacket> packet) {
+void IpcAudioCapturer::OnAudioPacket(std::unique_ptr<AudioPacket> packet) {
   callback_.Run(std::move(packet));
 }
 
diff --git a/remoting/host/ipc_audio_capturer.h b/remoting/host/ipc_audio_capturer.h
index 56a578a..aac678d 100644
--- a/remoting/host/ipc_audio_capturer.h
+++ b/remoting/host/ipc_audio_capturer.h
@@ -5,9 +5,10 @@
 #ifndef REMOTING_HOST_IPC_AUDIO_CAPTURER_H_
 #define REMOTING_HOST_IPC_AUDIO_CAPTURER_H_
 
+#include <memory>
+
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "remoting/host/audio_capturer.h"
 
@@ -26,7 +27,7 @@
   bool Start(const PacketCapturedCallback& callback) override;
 
   // Called by DesktopSessionProxy when an audio packet is received.
-  void OnAudioPacket(scoped_ptr<AudioPacket> packet);
+  void OnAudioPacket(std::unique_ptr<AudioPacket> packet);
 
  private:
   // Invoked when an audio packet was received.
diff --git a/remoting/host/ipc_desktop_environment.cc b/remoting/host/ipc_desktop_environment.cc
index a98a9f4..a5bb70f 100644
--- a/remoting/host/ipc_desktop_environment.cc
+++ b/remoting/host/ipc_desktop_environment.cc
@@ -8,6 +8,7 @@
 
 #include "base/compiler_specific.h"
 #include "base/logging.h"
+#include "base/memory/ptr_util.h"
 #include "base/process/process_handle.h"
 #include "base/single_thread_task_runner.h"
 #include "build/build_config.h"
@@ -42,24 +43,24 @@
 
 IpcDesktopEnvironment::~IpcDesktopEnvironment() {}
 
-scoped_ptr<AudioCapturer> IpcDesktopEnvironment::CreateAudioCapturer() {
+std::unique_ptr<AudioCapturer> IpcDesktopEnvironment::CreateAudioCapturer() {
   return desktop_session_proxy_->CreateAudioCapturer();
 }
 
-scoped_ptr<InputInjector> IpcDesktopEnvironment::CreateInputInjector() {
+std::unique_ptr<InputInjector> IpcDesktopEnvironment::CreateInputInjector() {
   return desktop_session_proxy_->CreateInputInjector();
 }
 
-scoped_ptr<ScreenControls> IpcDesktopEnvironment::CreateScreenControls() {
+std::unique_ptr<ScreenControls> IpcDesktopEnvironment::CreateScreenControls() {
   return desktop_session_proxy_->CreateScreenControls();
 }
 
-scoped_ptr<webrtc::MouseCursorMonitor>
+std::unique_ptr<webrtc::MouseCursorMonitor>
 IpcDesktopEnvironment::CreateMouseCursorMonitor() {
   return desktop_session_proxy_->CreateMouseCursorMonitor();
 }
 
-scoped_ptr<webrtc::DesktopCapturer>
+std::unique_ptr<webrtc::DesktopCapturer>
 IpcDesktopEnvironment::CreateVideoCapturer() {
   return desktop_session_proxy_->CreateVideoCapturer();
 }
@@ -85,11 +86,11 @@
 
 IpcDesktopEnvironmentFactory::~IpcDesktopEnvironmentFactory() {}
 
-scoped_ptr<DesktopEnvironment> IpcDesktopEnvironmentFactory::Create(
+std::unique_ptr<DesktopEnvironment> IpcDesktopEnvironmentFactory::Create(
     base::WeakPtr<ClientSessionControl> client_session_control) {
   DCHECK(caller_task_runner_->BelongsToCurrentThread());
 
-  return make_scoped_ptr(new IpcDesktopEnvironment(
+  return base::WrapUnique(new IpcDesktopEnvironment(
       audio_task_runner_, caller_task_runner_, io_task_runner_,
       client_session_control, connector_factory_.GetWeakPtr(), curtain_enabled_,
       supports_touch_events_));
diff --git a/remoting/host/ipc_desktop_environment.h b/remoting/host/ipc_desktop_environment.h
index 81b6a18..337734a 100644
--- a/remoting/host/ipc_desktop_environment.h
+++ b/remoting/host/ipc_desktop_environment.h
@@ -6,12 +6,12 @@
 #define REMOTING_HOST_IPC_DESKTOP_ENVIRONMENT_H_
 
 #include <map>
+#include <memory>
 #include <string>
 
 #include "base/callback_forward.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "remoting/host/desktop_environment.h"
 #include "remoting/host/desktop_session_connector.h"
@@ -48,11 +48,12 @@
   ~IpcDesktopEnvironment() override;
 
   // DesktopEnvironment implementation.
-  scoped_ptr<AudioCapturer> CreateAudioCapturer() override;
-  scoped_ptr<InputInjector> CreateInputInjector() override;
-  scoped_ptr<ScreenControls> CreateScreenControls() override;
-  scoped_ptr<webrtc::DesktopCapturer> CreateVideoCapturer() override;
-  scoped_ptr<webrtc::MouseCursorMonitor> CreateMouseCursorMonitor() override;
+  std::unique_ptr<AudioCapturer> CreateAudioCapturer() override;
+  std::unique_ptr<InputInjector> CreateInputInjector() override;
+  std::unique_ptr<ScreenControls> CreateScreenControls() override;
+  std::unique_ptr<webrtc::DesktopCapturer> CreateVideoCapturer() override;
+  std::unique_ptr<webrtc::MouseCursorMonitor> CreateMouseCursorMonitor()
+      override;
   std::string GetCapabilities() const override;
   void SetCapabilities(const std::string& capabilities) override;
 
@@ -78,7 +79,7 @@
   ~IpcDesktopEnvironmentFactory() override;
 
   // DesktopEnvironmentFactory implementation.
-  scoped_ptr<DesktopEnvironment> Create(
+  std::unique_ptr<DesktopEnvironment> Create(
       base::WeakPtr<ClientSessionControl> client_session_control) override;
   void SetEnableCurtaining(bool enable) override;
   bool SupportsAudioCapture() const override;
diff --git a/remoting/host/ipc_desktop_environment_unittest.cc b/remoting/host/ipc_desktop_environment_unittest.cc
index 86b9c80..10d5145 100644
--- a/remoting/host/ipc_desktop_environment_unittest.cc
+++ b/remoting/host/ipc_desktop_environment_unittest.cc
@@ -2,8 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "remoting/host/ipc_desktop_environment.h"
+
 #include <stdint.h>
 
+#include <memory>
 #include <utility>
 
 #include "base/bind.h"
@@ -11,7 +14,6 @@
 #include "base/callback.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/message_loop/message_loop.h"
 #include "base/process/process.h"
 #include "base/process/process_handle.h"
@@ -33,7 +35,6 @@
 #include "remoting/host/desktop_session_proxy.h"
 #include "remoting/host/fake_mouse_cursor_monitor.h"
 #include "remoting/host/host_mock_objects.h"
-#include "remoting/host/ipc_desktop_environment.h"
 #include "remoting/protocol/fake_desktop_capturer.h"
 #include "remoting/protocol/protocol_mock_objects.h"
 #include "remoting/protocol/test_event_matchers.h"
@@ -183,7 +184,7 @@
   base::MessageLoopForUI message_loop_;
 
   // Runs until |desktop_session_proxy_| is connected to the desktop.
-  scoped_ptr<base::RunLoop> setup_run_loop_;
+  std::unique_ptr<base::RunLoop> setup_run_loop_;
 
   scoped_refptr<AutoThreadTaskRunner> task_runner_;
   scoped_refptr<AutoThreadTaskRunner> io_task_runner_;
@@ -194,7 +195,7 @@
   protocol::ClipboardStub* clipboard_stub_;
 
   // The daemons's end of the daemon-to-desktop channel.
-  scoped_ptr<IPC::ChannelProxy> desktop_channel_;
+  std::unique_ptr<IPC::ChannelProxy> desktop_channel_;
 
   // Name of the daemon-to-desktop channel.
   std::string desktop_channel_name_;
@@ -204,20 +205,20 @@
 
   FakeDaemonSender daemon_channel_;
 
-  scoped_ptr<IpcDesktopEnvironmentFactory> desktop_environment_factory_;
-  scoped_ptr<DesktopEnvironment> desktop_environment_;
+  std::unique_ptr<IpcDesktopEnvironmentFactory> desktop_environment_factory_;
+  std::unique_ptr<DesktopEnvironment> desktop_environment_;
 
   // The IPC input injector.
-  scoped_ptr<InputInjector> input_injector_;
+  std::unique_ptr<InputInjector> input_injector_;
 
   // The IPC screen controls.
-  scoped_ptr<ScreenControls> screen_controls_;
+  std::unique_ptr<ScreenControls> screen_controls_;
 
   // The IPC screen capturer.
-  scoped_ptr<webrtc::DesktopCapturer> video_capturer_;
+  std::unique_ptr<webrtc::DesktopCapturer> video_capturer_;
 
   // Represents the desktop process running in a user session.
-  scoped_ptr<DesktopProcess> desktop_process_;
+  std::unique_ptr<DesktopProcess> desktop_process_;
 
   // Input injector owned by |desktop_process_|.
   MockInputInjector* remote_input_injector_;
@@ -407,7 +408,7 @@
                                             io_task_runner_,
                                             desktop_channel_name_));
 
-  scoped_ptr<MockDesktopEnvironmentFactory> desktop_environment_factory(
+  std::unique_ptr<MockDesktopEnvironmentFactory> desktop_environment_factory(
       new MockDesktopEnvironmentFactory());
   EXPECT_CALL(*desktop_environment_factory, CreatePtr())
       .Times(AnyNumber())
@@ -456,7 +457,7 @@
 
 // Runs until the desktop is attached and exits immediately after that.
 TEST_F(IpcDesktopEnvironmentTest, Basic) {
-  scoped_ptr<protocol::MockClipboardStub> clipboard_stub(
+  std::unique_ptr<protocol::MockClipboardStub> clipboard_stub(
       new protocol::MockClipboardStub());
   EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_))
       .Times(0);
@@ -473,7 +474,7 @@
 
 // Check Capabilities.
 TEST_F(IpcDesktopEnvironmentTest, CapabilitiesNoTouch) {
-  scoped_ptr<protocol::MockClipboardStub> clipboard_stub(
+  std::unique_ptr<protocol::MockClipboardStub> clipboard_stub(
       new protocol::MockClipboardStub());
   EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_))
       .Times(0);
@@ -498,7 +499,7 @@
   desktop_environment_ = desktop_environment_factory_->Create(
       client_session_control_factory_.GetWeakPtr());
 
-  scoped_ptr<protocol::MockClipboardStub> clipboard_stub(
+  std::unique_ptr<protocol::MockClipboardStub> clipboard_stub(
       new protocol::MockClipboardStub());
   EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_))
       .Times(0);
@@ -518,7 +519,7 @@
 
 // Tests that the video capturer receives a frame over IPC.
 TEST_F(IpcDesktopEnvironmentTest, CaptureFrame) {
-  scoped_ptr<protocol::MockClipboardStub> clipboard_stub(
+  std::unique_ptr<protocol::MockClipboardStub> clipboard_stub(
       new protocol::MockClipboardStub());
   EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_))
       .Times(0);
@@ -543,7 +544,7 @@
 
 // Tests that attaching to a new desktop works.
 TEST_F(IpcDesktopEnvironmentTest, Reattach) {
-  scoped_ptr<protocol::MockClipboardStub> clipboard_stub(
+  std::unique_ptr<protocol::MockClipboardStub> clipboard_stub(
       new protocol::MockClipboardStub());
   EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_))
       .Times(0);
@@ -567,7 +568,7 @@
 
 // Tests injection of clipboard events.
 TEST_F(IpcDesktopEnvironmentTest, InjectClipboardEvent) {
-  scoped_ptr<protocol::MockClipboardStub> clipboard_stub(
+  std::unique_ptr<protocol::MockClipboardStub> clipboard_stub(
       new protocol::MockClipboardStub());
   clipboard_stub_ = clipboard_stub.get();
 
@@ -599,7 +600,7 @@
 
 // Tests injection of key events.
 TEST_F(IpcDesktopEnvironmentTest, InjectKeyEvent) {
-  scoped_ptr<protocol::MockClipboardStub> clipboard_stub(
+  std::unique_ptr<protocol::MockClipboardStub> clipboard_stub(
       new protocol::MockClipboardStub());
   EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_))
       .Times(0);
@@ -626,7 +627,7 @@
 
 // Tests injection of text events.
 TEST_F(IpcDesktopEnvironmentTest, InjectTextEvent) {
-  scoped_ptr<protocol::MockClipboardStub> clipboard_stub(
+  std::unique_ptr<protocol::MockClipboardStub> clipboard_stub(
       new protocol::MockClipboardStub());
   EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_))
       .Times(0);
@@ -652,7 +653,7 @@
 
 // Tests injection of mouse events.
 TEST_F(IpcDesktopEnvironmentTest, InjectMouseEvent) {
-  scoped_ptr<protocol::MockClipboardStub> clipboard_stub(
+  std::unique_ptr<protocol::MockClipboardStub> clipboard_stub(
       new protocol::MockClipboardStub());
   EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_))
       .Times(0);
@@ -679,7 +680,7 @@
 
 // Tests injection of touch events.
 TEST_F(IpcDesktopEnvironmentTest, InjectTouchEvent) {
-  scoped_ptr<protocol::MockClipboardStub> clipboard_stub(
+  std::unique_ptr<protocol::MockClipboardStub> clipboard_stub(
       new protocol::MockClipboardStub());
   EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_))
       .Times(0);
@@ -721,7 +722,7 @@
 
 // Tests that setting the desktop resolution works.
 TEST_F(IpcDesktopEnvironmentTest, SetScreenResolution) {
-  scoped_ptr<protocol::MockClipboardStub> clipboard_stub(
+  std::unique_ptr<protocol::MockClipboardStub> clipboard_stub(
       new protocol::MockClipboardStub());
   EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_))
       .Times(0);
diff --git a/remoting/host/ipc_host_event_logger.cc b/remoting/host/ipc_host_event_logger.cc
index e5c3dad1..24b04edc 100644
--- a/remoting/host/ipc_host_event_logger.cc
+++ b/remoting/host/ipc_host_event_logger.cc
@@ -60,10 +60,8 @@
 
   SerializedTransportRoute serialized_route;
   serialized_route.type = route.type;
-  serialized_route.remote_address = route.remote_address.address().bytes();
-  serialized_route.remote_port = route.remote_address.port();
-  serialized_route.local_address = route.local_address.address().bytes();
-  serialized_route.local_port = route.local_address.port();
+  serialized_route.remote_address = route.remote_address;
+  serialized_route.local_address = route.local_address;
 
   daemon_channel_->Send(new ChromotingNetworkDaemonMsg_ClientRouteChange(
       jid, channel_name, serialized_route));
diff --git a/remoting/host/ipc_host_event_logger.h b/remoting/host/ipc_host_event_logger.h
index ccb9832..bf15d58 100644
--- a/remoting/host/ipc_host_event_logger.h
+++ b/remoting/host/ipc_host_event_logger.h
@@ -5,11 +5,11 @@
 #ifndef REMOTING_HOST_IPC_HOST_EVENT_LOGGER_H_
 #define REMOTING_HOST_IPC_HOST_EVENT_LOGGER_H_
 
+#include <memory>
 #include <string>
 
 #include "base/compiler_specific.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/threading/non_thread_safe.h"
 #include "remoting/host/host_event_logger.h"
diff --git a/remoting/host/ipc_input_injector.cc b/remoting/host/ipc_input_injector.cc
index fb5fd09..01d92fff 100644
--- a/remoting/host/ipc_input_injector.cc
+++ b/remoting/host/ipc_input_injector.cc
@@ -40,7 +40,7 @@
 }
 
 void IpcInputInjector::Start(
-    scoped_ptr<protocol::ClipboardStub> client_clipboard) {
+    std::unique_ptr<protocol::ClipboardStub> client_clipboard) {
   desktop_session_proxy_->StartInputInjector(std::move(client_clipboard));
 }
 
diff --git a/remoting/host/ipc_input_injector.h b/remoting/host/ipc_input_injector.h
index 3e7e628..e161d6d 100644
--- a/remoting/host/ipc_input_injector.h
+++ b/remoting/host/ipc_input_injector.h
@@ -32,7 +32,8 @@
   void InjectTouchEvent(const protocol::TouchEvent& event) override;
 
   // InputInjector interface.
-  void Start(scoped_ptr<protocol::ClipboardStub> client_clipboard) override;
+  void Start(
+      std::unique_ptr<protocol::ClipboardStub> client_clipboard) override;
 
  private:
   // Wraps the IPC channel to the desktop process.
diff --git a/remoting/host/ipc_mouse_cursor_monitor.cc b/remoting/host/ipc_mouse_cursor_monitor.cc
index 7df56db..d9f2fc6 100644
--- a/remoting/host/ipc_mouse_cursor_monitor.cc
+++ b/remoting/host/ipc_mouse_cursor_monitor.cc
@@ -33,7 +33,7 @@
 }
 
 void IpcMouseCursorMonitor::OnMouseCursor(
-    scoped_ptr<webrtc::MouseCursor> cursor) {
+    std::unique_ptr<webrtc::MouseCursor> cursor) {
   DCHECK(callback_);
   callback_->OnMouseCursor(cursor.release());
 }
diff --git a/remoting/host/ipc_mouse_cursor_monitor.h b/remoting/host/ipc_mouse_cursor_monitor.h
index 9879f9c..528e89d 100644
--- a/remoting/host/ipc_mouse_cursor_monitor.h
+++ b/remoting/host/ipc_mouse_cursor_monitor.h
@@ -5,9 +5,10 @@
 #ifndef REMOTING_HOST_IPC_MOUSE_CURSOR_MONITOR_H_
 #define REMOTING_HOST_IPC_MOUSE_CURSOR_MONITOR_H_
 
+#include <memory>
+
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor_monitor.h"
@@ -29,7 +30,7 @@
   void Capture() override;
 
   // Called when the cursor shape has changed.
-  void OnMouseCursor(scoped_ptr<webrtc::MouseCursor> cursor);
+  void OnMouseCursor(std::unique_ptr<webrtc::MouseCursor> cursor);
 
  private:
   // The callback passed to |webrtc::MouseCursorMonitor::Init()|.
diff --git a/remoting/host/ipc_util.h b/remoting/host/ipc_util.h
index a80c4818..5642be1 100644
--- a/remoting/host/ipc_util.h
+++ b/remoting/host/ipc_util.h
@@ -5,11 +5,11 @@
 #ifndef REMOTING_HOST_IPC_UTIL_H_
 #define REMOTING_HOST_IPC_UTIL_H_
 
+#include <memory>
 #include <string>
 
 #include "base/compiler_specific.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "build/build_config.h"
 #include "ipc/ipc_platform_file.h"
 
@@ -38,7 +38,7 @@
     scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
     IPC::Listener* listener,
     base::File* client_out,
-    scoped_ptr<IPC::ChannelProxy>* server_out);
+    std::unique_ptr<IPC::ChannelProxy>* server_out);
 
 #if defined(OS_WIN)
 
diff --git a/remoting/host/ipc_util_posix.cc b/remoting/host/ipc_util_posix.cc
index b7c5277..3747c1d 100644
--- a/remoting/host/ipc_util_posix.cc
+++ b/remoting/host/ipc_util_posix.cc
@@ -22,7 +22,7 @@
     scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
     IPC::Listener* listener,
     base::File* client_out,
-    scoped_ptr<IPC::ChannelProxy>* server_out) {
+    std::unique_ptr<IPC::ChannelProxy>* server_out) {
   // Create a socket pair.
   int pipe_fds[2];
   if (socketpair(AF_UNIX, SOCK_STREAM, 0, pipe_fds) != 0) {
diff --git a/remoting/host/ipc_util_win.cc b/remoting/host/ipc_util_win.cc
index d9952ef..a7187a81 100644
--- a/remoting/host/ipc_util_win.cc
+++ b/remoting/host/ipc_util_win.cc
@@ -29,7 +29,7 @@
     scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
     IPC::Listener* listener,
     base::File* client_out,
-    scoped_ptr<IPC::ChannelProxy>* server_out) {
+    std::unique_ptr<IPC::ChannelProxy>* server_out) {
   // presubmit: allow wstring
   std::wstring user_sid;
   if (!base::win::GetUserSidString(&user_sid)) {
@@ -56,11 +56,9 @@
   }
 
   // Wrap the pipe into an IPC channel.
-  scoped_ptr<IPC::ChannelProxy> server =
-      IPC::ChannelProxy::Create(IPC::ChannelHandle(pipe.Get()),
-                                IPC::Channel::MODE_SERVER,
-                                listener,
-                                io_task_runner);
+  std::unique_ptr<IPC::ChannelProxy> server = IPC::ChannelProxy::Create(
+      IPC::ChannelHandle(pipe.Get()), IPC::Channel::MODE_SERVER, listener,
+      io_task_runner);
 
   // Convert the channel name to the pipe name.
   std::string pipe_name(kChromePipeNamePrefix);
diff --git a/remoting/host/ipc_video_frame_capturer.cc b/remoting/host/ipc_video_frame_capturer.cc
index f022d86..23cc5e0 100644
--- a/remoting/host/ipc_video_frame_capturer.cc
+++ b/remoting/host/ipc_video_frame_capturer.cc
@@ -34,7 +34,7 @@
 }
 
 void IpcVideoFrameCapturer::OnCaptureCompleted(
-    scoped_ptr<webrtc::DesktopFrame> frame) {
+    std::unique_ptr<webrtc::DesktopFrame> frame) {
   DCHECK(capture_pending_);
   capture_pending_ = false;
   callback_->OnCaptureCompleted(frame.release());
diff --git a/remoting/host/ipc_video_frame_capturer.h b/remoting/host/ipc_video_frame_capturer.h
index 2ab0ce1..c93e2ba 100644
--- a/remoting/host/ipc_video_frame_capturer.h
+++ b/remoting/host/ipc_video_frame_capturer.h
@@ -5,9 +5,10 @@
 #ifndef REMOTING_HOST_IPC_VIDEO_FRAME_CAPTURER_H_
 #define REMOTING_HOST_IPC_VIDEO_FRAME_CAPTURER_H_
 
+#include <memory>
+
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h"
 
@@ -28,7 +29,7 @@
   void Capture(const webrtc::DesktopRegion& region) override;
 
   // Called when a video |frame| has been captured.
-  void OnCaptureCompleted(scoped_ptr<webrtc::DesktopFrame> frame);
+  void OnCaptureCompleted(std::unique_ptr<webrtc::DesktopFrame> frame);
 
  private:
   // Points to the callback passed to webrtc::DesktopCapturer::Start().
diff --git a/remoting/host/it2me/it2me_confirmation_dialog.cc b/remoting/host/it2me/it2me_confirmation_dialog.cc
index 503c4c8..766be5e41f 100644
--- a/remoting/host/it2me/it2me_confirmation_dialog.cc
+++ b/remoting/host/it2me/it2me_confirmation_dialog.cc
@@ -13,7 +13,8 @@
 
 // TODO(dcaiafa): Remove after implementations for all platforms exist.
 #if !defined(OS_CHROMEOS)
-scoped_ptr<It2MeConfirmationDialog> It2MeConfirmationDialogFactory::Create() {
+std::unique_ptr<It2MeConfirmationDialog>
+It2MeConfirmationDialogFactory::Create() {
   return nullptr;
 }
 #endif
diff --git a/remoting/host/it2me/it2me_confirmation_dialog.h b/remoting/host/it2me/it2me_confirmation_dialog.h
index c6b251c..2e51ae7f 100644
--- a/remoting/host/it2me/it2me_confirmation_dialog.h
+++ b/remoting/host/it2me/it2me_confirmation_dialog.h
@@ -5,10 +5,11 @@
 #ifndef REMOTING_HOST_IT2ME_IT2ME_CONFIRMATION_DIALOG_H_
 #define REMOTING_HOST_IT2ME_IT2ME_CONFIRMATION_DIALOG_H_
 
+#include <memory>
+
 #include "base/callback_forward.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/single_thread_task_runner.h"
 
 namespace remoting {
@@ -38,7 +39,7 @@
   It2MeConfirmationDialogFactory();
   virtual ~It2MeConfirmationDialogFactory();
 
-  virtual scoped_ptr<It2MeConfirmationDialog> Create();
+  virtual std::unique_ptr<It2MeConfirmationDialog> Create();
 
   DISALLOW_COPY_AND_ASSIGN(It2MeConfirmationDialogFactory);
 };
diff --git a/remoting/host/it2me/it2me_confirmation_dialog_chromeos.cc b/remoting/host/it2me/it2me_confirmation_dialog_chromeos.cc
index 4f3d570..2aee3bae4 100644
--- a/remoting/host/it2me/it2me_confirmation_dialog_chromeos.cc
+++ b/remoting/host/it2me/it2me_confirmation_dialog_chromeos.cc
@@ -28,7 +28,7 @@
   // Handles result from |message_box_|.
   void OnMessageBoxResult(MessageBox::Result result);
 
-  scoped_ptr<MessageBox> message_box_;
+  std::unique_ptr<MessageBox> message_box_;
   ResultCallback callback_;
 
   DISALLOW_COPY_AND_ASSIGN(It2MeConfirmationDialogChromeOS);
@@ -59,8 +59,9 @@
                                        Result::OK : Result::CANCEL);
 }
 
-scoped_ptr<It2MeConfirmationDialog> It2MeConfirmationDialogFactory::Create() {
-  return scoped_ptr<It2MeConfirmationDialog>(
+std::unique_ptr<It2MeConfirmationDialog>
+It2MeConfirmationDialogFactory::Create() {
+  return std::unique_ptr<It2MeConfirmationDialog>(
       new It2MeConfirmationDialogChromeOS());
 }
 
diff --git a/remoting/host/it2me/it2me_confirmation_dialog_proxy.cc b/remoting/host/it2me/it2me_confirmation_dialog_proxy.cc
index de00e677..979e2b7 100644
--- a/remoting/host/it2me/it2me_confirmation_dialog_proxy.cc
+++ b/remoting/host/it2me/it2me_confirmation_dialog_proxy.cc
@@ -19,7 +19,7 @@
   Core(scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
        scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
        base::WeakPtr<It2MeConfirmationDialogProxy> parent,
-       scoped_ptr<It2MeConfirmationDialog> dialog);
+       std::unique_ptr<It2MeConfirmationDialog> dialog);
   ~Core();
 
   // Shows the wrapped dialog. Must be called on the UI thread.
@@ -40,7 +40,7 @@
   scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
   scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_;
   base::WeakPtr<It2MeConfirmationDialogProxy> parent_;
-  scoped_ptr<It2MeConfirmationDialog> dialog_;
+  std::unique_ptr<It2MeConfirmationDialog> dialog_;
 
   DISALLOW_COPY_AND_ASSIGN(Core);
 };
@@ -49,12 +49,11 @@
     scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
     scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
     base::WeakPtr<It2MeConfirmationDialogProxy> parent,
-    scoped_ptr<It2MeConfirmationDialog> dialog)
+    std::unique_ptr<It2MeConfirmationDialog> dialog)
     : ui_task_runner_(ui_task_runner),
       caller_task_runner_(caller_task_runner),
       parent_(parent),
-      dialog_(std::move(dialog)) {
-}
+      dialog_(std::move(dialog)) {}
 
 It2MeConfirmationDialogProxy::Core::~Core() {
   DCHECK(ui_task_runner_->BelongsToCurrentThread());
@@ -77,7 +76,7 @@
 
 It2MeConfirmationDialogProxy::It2MeConfirmationDialogProxy(
     scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
-    scoped_ptr<It2MeConfirmationDialog> dialog)
+    std::unique_ptr<It2MeConfirmationDialog> dialog)
     : weak_factory_(this) {
   core_.reset(new Core(ui_task_runner, base::ThreadTaskRunnerHandle::Get(),
                        weak_factory_.GetWeakPtr(), std::move(dialog)));
diff --git a/remoting/host/it2me/it2me_confirmation_dialog_proxy.h b/remoting/host/it2me/it2me_confirmation_dialog_proxy.h
index 56a1817..77e0fbd 100644
--- a/remoting/host/it2me/it2me_confirmation_dialog_proxy.h
+++ b/remoting/host/it2me/it2me_confirmation_dialog_proxy.h
@@ -23,7 +23,7 @@
   // |dialog| is the dialog being wrapped.
   It2MeConfirmationDialogProxy(
       scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
-      scoped_ptr<It2MeConfirmationDialog> dialog);
+      std::unique_ptr<It2MeConfirmationDialog> dialog);
 
   ~It2MeConfirmationDialogProxy() override;
 
@@ -35,7 +35,7 @@
 
   void ReportResult(It2MeConfirmationDialog::Result result);
 
-  scoped_ptr<Core> core_;
+  std::unique_ptr<Core> core_;
   It2MeConfirmationDialog::ResultCallback callback_;
   base::WeakPtrFactory<It2MeConfirmationDialogProxy> weak_factory_;
 
diff --git a/remoting/host/it2me/it2me_confirmation_dialog_proxy_unittest.cc b/remoting/host/it2me/it2me_confirmation_dialog_proxy_unittest.cc
index bb7a29c..79f78d8 100644
--- a/remoting/host/it2me/it2me_confirmation_dialog_proxy_unittest.cc
+++ b/remoting/host/it2me/it2me_confirmation_dialog_proxy_unittest.cc
@@ -4,9 +4,10 @@
 
 #include "remoting/host/it2me/it2me_confirmation_dialog_proxy.h"
 
+#include <memory>
+
 #include "base/bind.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/run_loop.h"
 #include "base/single_thread_task_runner.h"
 #include "base/threading/thread.h"
@@ -110,7 +111,7 @@
   // |dialog_| is owned by |dialog_proxy_| but we keep an alias for test
   // purposes.
   StubIt2MeConfirmationDialog* dialog_;
-  scoped_ptr<It2MeConfirmationDialogProxy> dialog_proxy_;
+  std::unique_ptr<It2MeConfirmationDialogProxy> dialog_proxy_;
 };
 
 It2MeConfirmationDialogProxyTest::It2MeConfirmationDialogProxyTest()
@@ -119,8 +120,7 @@
 
   dialog_ = new StubIt2MeConfirmationDialog(dialog_task_runner());
   dialog_proxy_.reset(new It2MeConfirmationDialogProxy(
-      dialog_task_runner(),
-      scoped_ptr<It2MeConfirmationDialog>(dialog_)));
+      dialog_task_runner(), std::unique_ptr<It2MeConfirmationDialog>(dialog_)));
 }
 
 It2MeConfirmationDialogProxyTest::~It2MeConfirmationDialogProxyTest() {}
diff --git a/remoting/host/it2me/it2me_host.cc b/remoting/host/it2me/it2me_host.cc
index 0d51b3fb3..0afaee6f 100644
--- a/remoting/host/it2me/it2me_host.cc
+++ b/remoting/host/it2me/it2me_host.cc
@@ -10,6 +10,7 @@
 
 #include "base/bind.h"
 #include "base/callback_helpers.h"
+#include "base/memory/ptr_util.h"
 #include "base/strings/string_util.h"
 #include "base/threading/platform_thread.h"
 #include "net/socket/client_socket_factory.h"
@@ -49,9 +50,9 @@
 }  // namespace
 
 It2MeHost::It2MeHost(
-    scoped_ptr<ChromotingHostContext> host_context,
-    scoped_ptr<PolicyWatcher> policy_watcher,
-    scoped_ptr<It2MeConfirmationDialogFactory> confirmation_dialog_factory,
+    std::unique_ptr<ChromotingHostContext> host_context,
+    std::unique_ptr<PolicyWatcher> policy_watcher,
+    std::unique_ptr<It2MeConfirmationDialogFactory> confirmation_dialog_factory,
     base::WeakPtr<It2MeHost::Observer> observer,
     const XmppSignalStrategy::XmppServerConfig& xmpp_server_config,
     const std::string& directory_bot_jid)
@@ -139,7 +140,7 @@
 
   SetState(kStarting, "");
 
-  scoped_ptr<It2MeConfirmationDialog> confirmation_dialog =
+  std::unique_ptr<It2MeConfirmationDialog> confirmation_dialog =
       confirmation_dialog_factory_->Create();
 
   // TODO(dcaiafa): Remove after dialog implementations for all platforms exist.
@@ -209,17 +210,15 @@
   host_key_pair_ = RsaKeyPair::Generate();
 
   // Create XMPP connection.
-  scoped_ptr<SignalStrategy> signal_strategy(
-      new XmppSignalStrategy(net::ClientSocketFactory::GetDefaultFactory(),
-                             host_context_->url_request_context_getter(),
-                             xmpp_server_config_));
+  std::unique_ptr<SignalStrategy> signal_strategy(new XmppSignalStrategy(
+      net::ClientSocketFactory::GetDefaultFactory(),
+      host_context_->url_request_context_getter(), xmpp_server_config_));
 
   // Request registration of the host for support.
-  scoped_ptr<RegisterSupportHostRequest> register_request(
+  std::unique_ptr<RegisterSupportHostRequest> register_request(
       new RegisterSupportHostRequest(
           signal_strategy.get(), host_key_pair_, directory_bot_jid_,
-          base::Bind(&It2MeHost::OnReceivedSupportID,
-                     base::Unretained(this))));
+          base::Bind(&It2MeHost::OnReceivedSupportID, base::Unretained(this))));
 
   // Beyond this point nothing can fail, so save the config and request.
   signal_strategy_ = std::move(signal_strategy);
@@ -241,17 +240,17 @@
   scoped_refptr<protocol::TransportContext> transport_context =
       new protocol::TransportContext(
           signal_strategy_.get(),
-          make_scoped_ptr(new protocol::ChromiumPortAllocatorFactory()),
-          make_scoped_ptr(new ChromiumUrlRequestFactory(
+          base::WrapUnique(new protocol::ChromiumPortAllocatorFactory()),
+          base::WrapUnique(new ChromiumUrlRequestFactory(
               host_context_->url_request_context_getter())),
           network_settings, protocol::TransportRole::SERVER);
   transport_context->set_ice_config_url(
       ServiceUrls::GetInstance()->ice_config_url());
 
-  scoped_ptr<protocol::SessionManager> session_manager(
+  std::unique_ptr<protocol::SessionManager> session_manager(
       new protocol::JingleSessionManager(signal_strategy_.get()));
 
-  scoped_ptr<protocol::CandidateSessionConfig> protocol_config =
+  std::unique_ptr<protocol::CandidateSessionConfig> protocol_config =
       protocol::CandidateSessionConfig::CreateDefault();
   // Disable audio by default.
   // TODO(sergeyu): Add UI to enable it.
@@ -317,7 +316,8 @@
   Shutdown();
 }
 
-void It2MeHost::OnPolicyUpdate(scoped_ptr<base::DictionaryValue> policies) {
+void It2MeHost::OnPolicyUpdate(
+    std::unique_ptr<base::DictionaryValue> policies) {
   // The policy watcher runs on the |ui_task_runner|.
   if (!host_context_->network_task_runner()->BelongsToCurrentThread()) {
     host_context_->network_task_runner()->PostTask(
@@ -480,7 +480,7 @@
     return;
   }
 
-  scoped_ptr<protocol::AuthenticatorFactory> factory(
+  std::unique_ptr<protocol::AuthenticatorFactory> factory(
       new protocol::It2MeHostAuthenticatorFactory(
           local_certificate, host_key_pair_, access_code_hash,
           required_client_domain_));
@@ -507,15 +507,15 @@
 }
 
 scoped_refptr<It2MeHost> It2MeHostFactory::CreateIt2MeHost(
-    scoped_ptr<ChromotingHostContext> context,
+    std::unique_ptr<ChromotingHostContext> context,
     base::WeakPtr<It2MeHost::Observer> observer,
     const XmppSignalStrategy::XmppServerConfig& xmpp_server_config,
     const std::string& directory_bot_jid) {
   DCHECK(context->ui_task_runner()->BelongsToCurrentThread());
 
-  scoped_ptr<It2MeConfirmationDialogFactory> confirmation_dialog_factory(
+  std::unique_ptr<It2MeConfirmationDialogFactory> confirmation_dialog_factory(
       new It2MeConfirmationDialogFactory());
-  scoped_ptr<PolicyWatcher> policy_watcher =
+  std::unique_ptr<PolicyWatcher> policy_watcher =
       PolicyWatcher::Create(policy_service_, context->file_task_runner());
   return new It2MeHost(std::move(context), std::move(policy_watcher),
                        std::move(confirmation_dialog_factory), observer,
diff --git a/remoting/host/it2me/it2me_host.h b/remoting/host/it2me/it2me_host.h
index e1e6076..5532621 100644
--- a/remoting/host/it2me/it2me_host.h
+++ b/remoting/host/it2me/it2me_host.h
@@ -5,9 +5,10 @@
 #ifndef REMOTING_HOST_IT2ME_IT2ME_HOST_H_
 #define REMOTING_HOST_IT2ME_IT2ME_HOST_H_
 
+#include <memory>
+
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/single_thread_task_runner.h"
 #include "remoting/host/host_status_observer.h"
@@ -61,13 +62,13 @@
                                 const std::string& error_message) = 0;
   };
 
-  It2MeHost(
-      scoped_ptr<ChromotingHostContext> context,
-      scoped_ptr<PolicyWatcher> policy_watcher,
-      scoped_ptr<It2MeConfirmationDialogFactory> confirmation_dialog_factory,
-      base::WeakPtr<It2MeHost::Observer> observer,
-      const XmppSignalStrategy::XmppServerConfig& xmpp_server_config,
-      const std::string& directory_bot_jid);
+  It2MeHost(std::unique_ptr<ChromotingHostContext> context,
+            std::unique_ptr<PolicyWatcher> policy_watcher,
+            std::unique_ptr<It2MeConfirmationDialogFactory>
+                confirmation_dialog_factory,
+            base::WeakPtr<It2MeHost::Observer> observer,
+            const XmppSignalStrategy::XmppServerConfig& xmpp_server_config,
+            const std::string& directory_bot_jid);
 
   // Methods called by the script object, from the plugin thread.
 
@@ -128,7 +129,7 @@
                            const std::string& error_message);
 
   // Called when initial policies are read, and when they change.
-  void OnPolicyUpdate(scoped_ptr<base::DictionaryValue> policies);
+  void OnPolicyUpdate(std::unique_ptr<base::DictionaryValue> policies);
 
   // Called when malformed policies are detected.
   void OnPolicyError();
@@ -141,7 +142,7 @@
   void Shutdown();
 
   // Caller supplied fields.
-  scoped_ptr<ChromotingHostContext> host_context_;
+  std::unique_ptr<ChromotingHostContext> host_context_;
   scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
   base::WeakPtr<It2MeHost::Observer> observer_;
   XmppSignalStrategy::XmppServerConfig xmpp_server_config_;
@@ -150,18 +151,18 @@
   It2MeHostState state_;
 
   scoped_refptr<RsaKeyPair> host_key_pair_;
-  scoped_ptr<SignalStrategy> signal_strategy_;
-  scoped_ptr<RegisterSupportHostRequest> register_request_;
-  scoped_ptr<HostStatusLogger> host_status_logger_;
-  scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory_;
-  scoped_ptr<HostEventLogger> host_event_logger_;
+  std::unique_ptr<SignalStrategy> signal_strategy_;
+  std::unique_ptr<RegisterSupportHostRequest> register_request_;
+  std::unique_ptr<HostStatusLogger> host_status_logger_;
+  std::unique_ptr<DesktopEnvironmentFactory> desktop_environment_factory_;
+  std::unique_ptr<HostEventLogger> host_event_logger_;
 
-  scoped_ptr<ChromotingHost> host_;
+  std::unique_ptr<ChromotingHost> host_;
   int failed_login_attempts_;
 
-  scoped_ptr<PolicyWatcher> policy_watcher_;
-  scoped_ptr<It2MeConfirmationDialogFactory> confirmation_dialog_factory_;
-  scoped_ptr<It2MeConfirmationDialogProxy> confirmation_dialog_proxy_;
+  std::unique_ptr<PolicyWatcher> policy_watcher_;
+  std::unique_ptr<It2MeConfirmationDialogFactory> confirmation_dialog_factory_;
+  std::unique_ptr<It2MeConfirmationDialogProxy> confirmation_dialog_proxy_;
 
   // Host the current nat traversal policy setting.
   bool nat_traversal_enabled_;
@@ -199,7 +200,7 @@
   virtual void set_policy_service(policy::PolicyService* policy_service);
 
   virtual scoped_refptr<It2MeHost> CreateIt2MeHost(
-      scoped_ptr<ChromotingHostContext> context,
+      std::unique_ptr<ChromotingHostContext> context,
       base::WeakPtr<It2MeHost::Observer> observer,
       const XmppSignalStrategy::XmppServerConfig& xmpp_server_config,
       const std::string& directory_bot_jid);
diff --git a/remoting/host/it2me/it2me_native_messaging_host.cc b/remoting/host/it2me/it2me_native_messaging_host.cc
index 87ecea84b7..4d41d6a 100644
--- a/remoting/host/it2me/it2me_native_messaging_host.cc
+++ b/remoting/host/it2me/it2me_native_messaging_host.cc
@@ -41,8 +41,8 @@
 }  // namespace
 
 It2MeNativeMessagingHost::It2MeNativeMessagingHost(
-    scoped_ptr<ChromotingHostContext> context,
-    scoped_ptr<It2MeHostFactory> factory)
+    std::unique_ptr<ChromotingHostContext> context,
+    std::unique_ptr<It2MeHostFactory> factory)
     : client_(nullptr),
       host_context_(std::move(context)),
       factory_(std::move(factory)),
@@ -72,15 +72,15 @@
 void It2MeNativeMessagingHost::OnMessage(const std::string& message) {
   DCHECK(task_runner()->BelongsToCurrentThread());
 
-  scoped_ptr<base::DictionaryValue> response(new base::DictionaryValue());
-  scoped_ptr<base::Value> message_value = base::JSONReader::Read(message);
+  std::unique_ptr<base::DictionaryValue> response(new base::DictionaryValue());
+  std::unique_ptr<base::Value> message_value = base::JSONReader::Read(message);
   if (!message_value->IsType(base::Value::TYPE_DICTIONARY)) {
     LOG(ERROR) << "Received a message that's not a dictionary.";
     client_->CloseChannel(std::string());
     return;
   }
 
-  scoped_ptr<base::DictionaryValue> message_dict(
+  std::unique_ptr<base::DictionaryValue> message_dict(
       static_cast<base::DictionaryValue*>(message_value.release()));
 
   // If the client supplies an ID, it will expect it in the response. This
@@ -120,7 +120,7 @@
 }
 
 void It2MeNativeMessagingHost::SendMessageToClient(
-    scoped_ptr<base::Value> message) const {
+    std::unique_ptr<base::Value> message) const {
   DCHECK(task_runner()->BelongsToCurrentThread());
   std::string message_json;
   base::JSONWriter::Write(*message, &message_json);
@@ -129,13 +129,14 @@
 
 void It2MeNativeMessagingHost::ProcessHello(
     const base::DictionaryValue& message,
-    scoped_ptr<base::DictionaryValue> response) const {
+    std::unique_ptr<base::DictionaryValue> response) const {
   DCHECK(task_runner()->BelongsToCurrentThread());
 
   response->SetString("version", STRINGIZE(VERSION));
 
   // This list will be populated when new features are added.
-  scoped_ptr<base::ListValue> supported_features_list(new base::ListValue());
+  std::unique_ptr<base::ListValue> supported_features_list(
+      new base::ListValue());
   response->Set("supportedFeatures", supported_features_list.release());
 
   SendMessageToClient(std::move(response));
@@ -143,7 +144,7 @@
 
 void It2MeNativeMessagingHost::ProcessConnect(
     const base::DictionaryValue& message,
-    scoped_ptr<base::DictionaryValue> response) {
+    std::unique_ptr<base::DictionaryValue> response) {
   DCHECK(task_runner()->BelongsToCurrentThread());
 
   if (it2me_host_.get()) {
@@ -220,7 +221,7 @@
 
 void It2MeNativeMessagingHost::ProcessDisconnect(
     const base::DictionaryValue& message,
-    scoped_ptr<base::DictionaryValue> response) {
+    std::unique_ptr<base::DictionaryValue> response) {
   DCHECK(task_runner()->BelongsToCurrentThread());
 
   if (it2me_host_.get()) {
@@ -231,7 +232,7 @@
 }
 
 void It2MeNativeMessagingHost::SendErrorAndExit(
-    scoped_ptr<base::DictionaryValue> response,
+    std::unique_ptr<base::DictionaryValue> response,
     const std::string& description) const {
   DCHECK(task_runner()->BelongsToCurrentThread());
 
@@ -252,7 +253,7 @@
 
   state_ = state;
 
-  scoped_ptr<base::DictionaryValue> message(new base::DictionaryValue());
+  std::unique_ptr<base::DictionaryValue> message(new base::DictionaryValue());
 
   message->SetString("type", "hostStateChanged");
   message->SetString("state", HostStateToString(state));
@@ -290,7 +291,7 @@
 void It2MeNativeMessagingHost::OnNatPolicyChanged(bool nat_traversal_enabled) {
   DCHECK(task_runner()->BelongsToCurrentThread());
 
-  scoped_ptr<base::DictionaryValue> message(new base::DictionaryValue());
+  std::unique_ptr<base::DictionaryValue> message(new base::DictionaryValue());
 
   message->SetString("type", "natPolicyChanged");
   message->SetBoolean("natTraversalEnabled", nat_traversal_enabled);
diff --git a/remoting/host/it2me/it2me_native_messaging_host.h b/remoting/host/it2me/it2me_native_messaging_host.h
index ef849047..7e792f6 100644
--- a/remoting/host/it2me/it2me_native_messaging_host.h
+++ b/remoting/host/it2me/it2me_native_messaging_host.h
@@ -5,9 +5,10 @@
 #ifndef REMOTING_HOST_IT2ME_IT2ME_NATIVE_MESSAGING_HOST_H_
 #define REMOTING_HOST_IT2ME_IT2ME_NATIVE_MESSAGING_HOST_H_
 
+#include <memory>
+
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "build/build_config.h"
 #include "extensions/browser/api/messaging/native_message_host.h"
@@ -30,9 +31,8 @@
 class It2MeNativeMessagingHost : public It2MeHost::Observer,
                                  public extensions::NativeMessageHost {
  public:
-  It2MeNativeMessagingHost(
-      scoped_ptr<ChromotingHostContext> host_context,
-      scoped_ptr<It2MeHostFactory> host_factory);
+  It2MeNativeMessagingHost(std::unique_ptr<ChromotingHostContext> host_context,
+                           std::unique_ptr<It2MeHostFactory> host_factory);
   ~It2MeNativeMessagingHost() override;
 
   // extensions::NativeMessageHost implementation.
@@ -57,24 +57,24 @@
   // dictionary is pre-filled by ProcessMessage() with the parts of the
   // response already known ("id" and "type" fields).
   void ProcessHello(const base::DictionaryValue& message,
-                    scoped_ptr<base::DictionaryValue> response) const;
+                    std::unique_ptr<base::DictionaryValue> response) const;
   void ProcessConnect(const base::DictionaryValue& message,
-                      scoped_ptr<base::DictionaryValue> response);
+                      std::unique_ptr<base::DictionaryValue> response);
   void ProcessDisconnect(const base::DictionaryValue& message,
-                         scoped_ptr<base::DictionaryValue> response);
-  void SendErrorAndExit(scoped_ptr<base::DictionaryValue> response,
+                         std::unique_ptr<base::DictionaryValue> response);
+  void SendErrorAndExit(std::unique_ptr<base::DictionaryValue> response,
                         const std::string& description) const;
-  void SendMessageToClient(scoped_ptr<base::Value> message) const;
+  void SendMessageToClient(std::unique_ptr<base::Value> message) const;
 
   Client* client_;
-  scoped_ptr<ChromotingHostContext> host_context_;
-  scoped_ptr<It2MeHostFactory> factory_;
+  std::unique_ptr<ChromotingHostContext> host_context_;
+  std::unique_ptr<It2MeHostFactory> factory_;
   scoped_refptr<It2MeHost> it2me_host_;
 
 #if !defined(OS_CHROMEOS)
   // Don't install a log message handler on ChromeOS because we run in the
   // browser process and don't want to intercept all its log messages.
-  scoped_ptr<LogMessageHandler> log_message_handler_;
+  std::unique_ptr<LogMessageHandler> log_message_handler_;
 #endif
 
   // Cached, read-only copies of |it2me_host_| session state.
diff --git a/remoting/host/it2me/it2me_native_messaging_host_main.cc b/remoting/host/it2me/it2me_native_messaging_host_main.cc
index b853ce9..2165e60a 100644
--- a/remoting/host/it2me/it2me_native_messaging_host_main.cc
+++ b/remoting/host/it2me/it2me_native_messaging_host_main.cc
@@ -117,19 +117,19 @@
   base::MessageLoopForUI message_loop;
   base::RunLoop run_loop;
 
-  scoped_ptr<It2MeHostFactory> factory(new It2MeHostFactory());
+  std::unique_ptr<It2MeHostFactory> factory(new It2MeHostFactory());
 
-  scoped_ptr<NativeMessagingPipe> native_messaging_pipe(
+  std::unique_ptr<NativeMessagingPipe> native_messaging_pipe(
       new NativeMessagingPipe());
 
   // Set up the native messaging channel.
-  scoped_ptr<extensions::NativeMessagingChannel> channel(
+  std::unique_ptr<extensions::NativeMessagingChannel> channel(
       new PipeMessagingChannel(std::move(read_file), std::move(write_file)));
 
-  scoped_ptr<ChromotingHostContext> context =
+  std::unique_ptr<ChromotingHostContext> context =
       ChromotingHostContext::Create(new remoting::AutoThreadTaskRunner(
           message_loop.task_runner(), run_loop.QuitClosure()));
-  scoped_ptr<extensions::NativeMessageHost> host(
+  std::unique_ptr<extensions::NativeMessageHost> host(
       new It2MeNativeMessagingHost(std::move(context), std::move(factory)));
 
   host->Start(native_messaging_pipe.get());
diff --git a/remoting/host/it2me/it2me_native_messaging_host_unittest.cc b/remoting/host/it2me/it2me_native_messaging_host_unittest.cc
index 0a5ede12..edef673 100644
--- a/remoting/host/it2me/it2me_native_messaging_host_unittest.cc
+++ b/remoting/host/it2me/it2me_native_messaging_host_unittest.cc
@@ -12,6 +12,7 @@
 #include "base/json/json_reader.h"
 #include "base/json/json_writer.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
 #include "base/stl_util.h"
@@ -35,7 +36,8 @@
 const int kTestAccessCodeLifetimeInSeconds = 666;
 const char kTestClientUsername[] = "some_user@gmail.com";
 
-void VerifyId(scoped_ptr<base::DictionaryValue> response, int expected_value) {
+void VerifyId(std::unique_ptr<base::DictionaryValue> response,
+              int expected_value) {
   ASSERT_TRUE(response);
 
   int value;
@@ -43,7 +45,7 @@
   EXPECT_EQ(expected_value, value);
 }
 
-void VerifyStringProperty(scoped_ptr<base::DictionaryValue> response,
+void VerifyStringProperty(std::unique_ptr<base::DictionaryValue> response,
                           const std::string& name,
                           const std::string& expected_value) {
   ASSERT_TRUE(response);
@@ -54,7 +56,7 @@
 }
 
 // Verity the values of the "type" and "id" properties
-void VerifyCommonProperties(scoped_ptr<base::DictionaryValue> response,
+void VerifyCommonProperties(std::unique_ptr<base::DictionaryValue> response,
                             const std::string& type,
                             int id) {
   ASSERT_TRUE(response);
@@ -72,8 +74,8 @@
 
 class MockIt2MeHost : public It2MeHost {
  public:
-  MockIt2MeHost(scoped_ptr<ChromotingHostContext> context,
-                scoped_ptr<PolicyWatcher> policy_watcher,
+  MockIt2MeHost(std::unique_ptr<ChromotingHostContext> context,
+                std::unique_ptr<PolicyWatcher> policy_watcher,
                 base::WeakPtr<It2MeHost::Observer> observer,
                 const XmppSignalStrategy::XmppServerConfig& xmpp_server_config,
                 const std::string& directory_bot_jid)
@@ -155,7 +157,7 @@
  public:
   MockIt2MeHostFactory() : It2MeHostFactory() {}
   scoped_refptr<It2MeHost> CreateIt2MeHost(
-      scoped_ptr<ChromotingHostContext> context,
+      std::unique_ptr<ChromotingHostContext> context,
       base::WeakPtr<It2MeHost::Observer> observer,
       const XmppSignalStrategy::XmppServerConfig& xmpp_server_config,
       const std::string& directory_bot_jid) override {
@@ -176,7 +178,7 @@
   void TearDown() override;
 
  protected:
-  scoped_ptr<base::DictionaryValue> ReadMessageFromOutputPipe();
+  std::unique_ptr<base::DictionaryValue> ReadMessageFromOutputPipe();
   void WriteMessageToInputPipe(const base::Value& message);
 
   void VerifyHelloResponse(int request_id);
@@ -205,15 +207,15 @@
   base::File output_read_file_;
 
   // Message loop of the test thread.
-  scoped_ptr<base::MessageLoop> test_message_loop_;
-  scoped_ptr<base::RunLoop> test_run_loop_;
+  std::unique_ptr<base::MessageLoop> test_message_loop_;
+  std::unique_ptr<base::RunLoop> test_run_loop_;
 
-  scoped_ptr<base::Thread> host_thread_;
-  scoped_ptr<base::RunLoop> host_run_loop_;
+  std::unique_ptr<base::Thread> host_thread_;
+  std::unique_ptr<base::RunLoop> host_run_loop_;
 
   // Task runner of the host thread.
   scoped_refptr<AutoThreadTaskRunner> host_task_runner_;
-  scoped_ptr<remoting::NativeMessagingPipe> pipe_;
+  std::unique_ptr<remoting::NativeMessagingPipe> pipe_;
 
   DISALLOW_COPY_AND_ASSIGN(It2MeNativeMessagingHostTest);
 };
@@ -254,7 +256,7 @@
   test_run_loop_->Run();
 
   // Verify there are no more message in the output pipe.
-  scoped_ptr<base::DictionaryValue> response = ReadMessageFromOutputPipe();
+  std::unique_ptr<base::DictionaryValue> response = ReadMessageFromOutputPipe();
   EXPECT_FALSE(response);
 
   // The It2MeNativeMessagingHost dtor closes the handles that are passed to it.
@@ -262,7 +264,7 @@
   output_read_file_.Close();
 }
 
-scoped_ptr<base::DictionaryValue>
+std::unique_ptr<base::DictionaryValue>
 It2MeNativeMessagingHostTest::ReadMessageFromOutputPipe() {
   while (true) {
     uint32_t length;
@@ -282,13 +284,13 @@
       return nullptr;
     }
 
-    scoped_ptr<base::Value> message = base::JSONReader::Read(message_json);
+    std::unique_ptr<base::Value> message = base::JSONReader::Read(message_json);
     if (!message || !message->IsType(base::Value::TYPE_DICTIONARY)) {
       LOG(ERROR) << "Malformed message:" << message_json;
       return nullptr;
     }
 
-    scoped_ptr<base::DictionaryValue> result = make_scoped_ptr(
+    std::unique_ptr<base::DictionaryValue> result = base::WrapUnique(
         static_cast<base::DictionaryValue*>(message.release()));
     std::string type;
     // If this is a debug message log, ignore it, otherwise return it.
@@ -311,12 +313,12 @@
 }
 
 void It2MeNativeMessagingHostTest::VerifyHelloResponse(int request_id) {
-  scoped_ptr<base::DictionaryValue> response = ReadMessageFromOutputPipe();
+  std::unique_ptr<base::DictionaryValue> response = ReadMessageFromOutputPipe();
   VerifyCommonProperties(std::move(response), "helloResponse", request_id);
 }
 
 void It2MeNativeMessagingHostTest::VerifyErrorResponse() {
-  scoped_ptr<base::DictionaryValue> response = ReadMessageFromOutputPipe();
+  std::unique_ptr<base::DictionaryValue> response = ReadMessageFromOutputPipe();
   VerifyStringProperty(std::move(response), "type", "error");
 }
 
@@ -329,7 +331,8 @@
 
   // We expect a total of 5 messages: 1 connectResponse and 4 hostStateChanged.
   for (int i = 0; i < 5; ++i) {
-    scoped_ptr<base::DictionaryValue> response = ReadMessageFromOutputPipe();
+    std::unique_ptr<base::DictionaryValue> response =
+        ReadMessageFromOutputPipe();
     ASSERT_TRUE(response);
 
     std::string type;
@@ -385,7 +388,8 @@
 
   // We expect a total of 3 messages: 1 connectResponse and 1 hostStateChanged.
   for (int i = 0; i < 2; ++i) {
-    scoped_ptr<base::DictionaryValue> response = ReadMessageFromOutputPipe();
+    std::unique_ptr<base::DictionaryValue> response =
+        ReadMessageFromOutputPipe();
     ASSERT_TRUE(response);
 
     std::string type;
@@ -425,7 +429,7 @@
   if (expect_error_response)
     VerifyErrorResponse();
 
-  scoped_ptr<base::DictionaryValue> response = ReadMessageFromOutputPipe();
+  std::unique_ptr<base::DictionaryValue> response = ReadMessageFromOutputPipe();
   EXPECT_FALSE(response);
 }
 
@@ -440,15 +444,15 @@
 
   pipe_.reset(new NativeMessagingPipe());
 
-  scoped_ptr<extensions::NativeMessagingChannel> channel(
+  std::unique_ptr<extensions::NativeMessagingChannel> channel(
       new PipeMessagingChannel(std::move(input_read_file),
                                std::move(output_write_file)));
 
   // Creating a native messaging host with a mock It2MeHostFactory.
-  scoped_ptr<extensions::NativeMessageHost> it2me_host(
+  std::unique_ptr<extensions::NativeMessageHost> it2me_host(
       new It2MeNativeMessagingHost(
           ChromotingHostContext::Create(host_task_runner_),
-          make_scoped_ptr(new MockIt2MeHostFactory())));
+          base::WrapUnique(new MockIt2MeHostFactory())));
   it2me_host->Start(pipe_.get());
 
   pipe_->Start(std::move(it2me_host), std::move(channel));
@@ -512,7 +516,7 @@
   message.SetString("id", "42");
   WriteMessageToInputPipe(message);
 
-  scoped_ptr<base::DictionaryValue> response = ReadMessageFromOutputPipe();
+  std::unique_ptr<base::DictionaryValue> response = ReadMessageFromOutputPipe();
   EXPECT_TRUE(response);
   std::string value;
   EXPECT_FALSE(response->GetString("id", &value));
diff --git a/remoting/host/it2me_desktop_environment.cc b/remoting/host/it2me_desktop_environment.cc
index f2f7cf05..ffe768f 100644
--- a/remoting/host/it2me_desktop_environment.cc
+++ b/remoting/host/it2me_desktop_environment.cc
@@ -7,6 +7,7 @@
 #include <utility>
 
 #include "base/logging.h"
+#include "base/memory/ptr_util.h"
 #include "base/single_thread_task_runner.h"
 #include "build/build_config.h"
 #include "remoting/host/client_session_control.h"
@@ -84,11 +85,11 @@
 
 It2MeDesktopEnvironmentFactory::~It2MeDesktopEnvironmentFactory() {}
 
-scoped_ptr<DesktopEnvironment> It2MeDesktopEnvironmentFactory::Create(
+std::unique_ptr<DesktopEnvironment> It2MeDesktopEnvironmentFactory::Create(
     base::WeakPtr<ClientSessionControl> client_session_control) {
   DCHECK(caller_task_runner()->BelongsToCurrentThread());
 
-  return make_scoped_ptr(new It2MeDesktopEnvironment(
+  return base::WrapUnique(new It2MeDesktopEnvironment(
       caller_task_runner(), video_capture_task_runner(), input_task_runner(),
       ui_task_runner(), client_session_control, supports_touch_events()));
 }
diff --git a/remoting/host/it2me_desktop_environment.h b/remoting/host/it2me_desktop_environment.h
index 54118ba..94f210a 100644
--- a/remoting/host/it2me_desktop_environment.h
+++ b/remoting/host/it2me_desktop_environment.h
@@ -5,8 +5,9 @@
 #ifndef REMOTING_HOST_IT2ME_DESKTOP_ENVIRONMENT_H_
 #define REMOTING_HOST_IT2ME_DESKTOP_ENVIRONMENT_H_
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "remoting/host/basic_desktop_environment.h"
 
@@ -33,13 +34,13 @@
 
  private:
   // Presents the continue window to the local user.
-  scoped_ptr<HostWindow> continue_window_;
+  std::unique_ptr<HostWindow> continue_window_;
 
   // Presents the disconnect window to the local user.
-  scoped_ptr<HostWindow> disconnect_window_;
+  std::unique_ptr<HostWindow> disconnect_window_;
 
   // Notifies the client session about the local mouse movements.
-  scoped_ptr<LocalInputMonitor> local_input_monitor_;
+  std::unique_ptr<LocalInputMonitor> local_input_monitor_;
 
   DISALLOW_COPY_AND_ASSIGN(It2MeDesktopEnvironment);
 };
@@ -55,7 +56,7 @@
   ~It2MeDesktopEnvironmentFactory() override;
 
   // DesktopEnvironmentFactory interface.
-  scoped_ptr<DesktopEnvironment> Create(
+  std::unique_ptr<DesktopEnvironment> Create(
       base::WeakPtr<ClientSessionControl> client_session_control) override;
 
  private:
diff --git a/remoting/host/linux/audio_pipe_reader_unittest.cc b/remoting/host/linux/audio_pipe_reader_unittest.cc
index a624a20..dc396768 100644
--- a/remoting/host/linux/audio_pipe_reader_unittest.cc
+++ b/remoting/host/linux/audio_pipe_reader_unittest.cc
@@ -8,10 +8,11 @@
 #include <sys/types.h>
 #include <unistd.h>
 
+#include <memory>
+
 #include "base/files/file.h"
 #include "base/files/scoped_temp_dir.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
 #include "base/threading/thread.h"
@@ -74,11 +75,11 @@
 
  protected:
   base::MessageLoop message_loop_;
-  scoped_ptr<base::RunLoop> run_loop_;
-  scoped_ptr<base::Thread> audio_thread_;
+  std::unique_ptr<base::RunLoop> run_loop_;
+  std::unique_ptr<base::Thread> audio_thread_;
   base::ScopedTempDir test_dir_;
   base::FilePath pipe_path_;
-  scoped_ptr<base::File> output_;
+  std::unique_ptr<base::File> output_;
 
   scoped_refptr<AudioPipeReader> reader_;
 
diff --git a/remoting/host/local_input_monitor.h b/remoting/host/local_input_monitor.h
index 57ec051..bbbaa59 100644
--- a/remoting/host/local_input_monitor.h
+++ b/remoting/host/local_input_monitor.h
@@ -5,8 +5,9 @@
 #ifndef REMOTING_HOST_LOCAL_INPUT_MONITOR_H_
 #define REMOTING_HOST_LOCAL_INPUT_MONITOR_H_
 
+#include <memory>
+
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 
 namespace base {
@@ -29,7 +30,7 @@
 
   // Creates a platform-specific instance of LocalInputMonitor.
   // |client_session_control| is called on the |caller_task_runner| thread.
-  static scoped_ptr<LocalInputMonitor> Create(
+  static std::unique_ptr<LocalInputMonitor> Create(
       scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
       scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
       scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
diff --git a/remoting/host/local_input_monitor_chromeos.cc b/remoting/host/local_input_monitor_chromeos.cc
index 88e0d84..c2ce05c 100644
--- a/remoting/host/local_input_monitor_chromeos.cc
+++ b/remoting/host/local_input_monitor_chromeos.cc
@@ -8,6 +8,7 @@
 #include "base/callback.h"
 #include "base/location.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/single_thread_task_runner.h"
 #include "base/threading/non_thread_safe.h"
 #include "remoting/host/chromeos/point_transformer.h"
@@ -56,14 +57,14 @@
 
     // Used to rotate the local mouse positions appropriately based on the
     // current display rotation settings.
-    scoped_ptr<PointTransformer> point_transformer_;
+    std::unique_ptr<PointTransformer> point_transformer_;
 
     DISALLOW_COPY_AND_ASSIGN(Core);
   };
 
   // Task runner on which ui::events are received.
   scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_;
-  scoped_ptr<Core> core_;
+  std::unique_ptr<Core> core_;
 
   DISALLOW_COPY_AND_ASSIGN(LocalInputMonitorChromeos);
 };
@@ -140,12 +141,12 @@
 
 }  // namespace
 
-scoped_ptr<LocalInputMonitor> LocalInputMonitor::Create(
+std::unique_ptr<LocalInputMonitor> LocalInputMonitor::Create(
     scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
     scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
     scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
     base::WeakPtr<ClientSessionControl> client_session_control) {
-  return make_scoped_ptr(new LocalInputMonitorChromeos(
+  return base::WrapUnique(new LocalInputMonitorChromeos(
       caller_task_runner, input_task_runner, client_session_control));
 }
 
diff --git a/remoting/host/local_input_monitor_mac.mm b/remoting/host/local_input_monitor_mac.mm
index fa76f67..961d7ef 100644
--- a/remoting/host/local_input_monitor_mac.mm
+++ b/remoting/host/local_input_monitor_mac.mm
@@ -6,6 +6,7 @@
 
 #import <AppKit/AppKit.h>
 #include <stdint.h>
+
 #include <set>
 
 #include "base/bind.h"
@@ -14,6 +15,7 @@
 #include "base/logging.h"
 #include "base/mac/scoped_cftyperef.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/memory/ref_counted.h"
 #include "base/single_thread_task_runner.h"
 #include "base/synchronization/lock.h"
@@ -277,12 +279,12 @@
 
 }  // namespace
 
-scoped_ptr<LocalInputMonitor> LocalInputMonitor::Create(
+std::unique_ptr<LocalInputMonitor> LocalInputMonitor::Create(
     scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
     scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
     scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
     base::WeakPtr<ClientSessionControl> client_session_control) {
-  return make_scoped_ptr(new LocalInputMonitorMac(
+  return base::WrapUnique(new LocalInputMonitorMac(
       caller_task_runner, ui_task_runner, client_session_control));
 }
 
diff --git a/remoting/host/local_input_monitor_unittest.cc b/remoting/host/local_input_monitor_unittest.cc
index ddb6542..7d15d25 100644
--- a/remoting/host/local_input_monitor_unittest.cc
+++ b/remoting/host/local_input_monitor_unittest.cc
@@ -2,15 +2,17 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "remoting/host/local_input_monitor.h"
+
+#include <memory>
+
 #include "base/bind.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
 #include "build/build_config.h"
 #include "remoting/base/auto_thread_task_runner.h"
 #include "remoting/host/client_session_control.h"
 #include "remoting/host/host_mock_objects.h"
-#include "remoting/host/local_input_monitor.h"
 #include "remoting/protocol/protocol_mock_objects.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
@@ -76,10 +78,8 @@
       .Times(0);
 
   {
-    scoped_ptr<LocalInputMonitor> local_input_monitor =
-        LocalInputMonitor::Create(task_runner_,
-                                  task_runner_,
-                                  task_runner_,
+    std::unique_ptr<LocalInputMonitor> local_input_monitor =
+        LocalInputMonitor::Create(task_runner_, task_runner_, task_runner_,
                                   client_session_control_factory_.GetWeakPtr());
     task_runner_ = nullptr;
   }
diff --git a/remoting/host/local_input_monitor_win.cc b/remoting/host/local_input_monitor_win.cc
index 11073bee..ac6525e 100644
--- a/remoting/host/local_input_monitor_win.cc
+++ b/remoting/host/local_input_monitor_win.cc
@@ -11,6 +11,7 @@
 #include "base/location.h"
 #include "base/logging.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/single_thread_task_runner.h"
 #include "base/strings/stringprintf.h"
 #include "base/threading/non_thread_safe.h"
@@ -69,7 +70,7 @@
     scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
 
     // Used to receive raw input.
-    scoped_ptr<base::win::MessageWindow> window_;
+    std::unique_ptr<base::win::MessageWindow> window_;
 
     // Points to the object receiving mouse event notifications.
     base::WeakPtr<ClientSessionControl> client_session_control_;
@@ -174,7 +175,7 @@
   }
 
   // Retrieve the input record itself.
-  scoped_ptr<uint8_t[]> buffer(new uint8_t[size]);
+  std::unique_ptr<uint8_t[]> buffer(new uint8_t[size]);
   RAWINPUT* input = reinterpret_cast<RAWINPUT*>(buffer.get());
   result = GetRawInputData(input_handle,
                            RID_INPUT,
@@ -235,12 +236,12 @@
 
 }  // namespace
 
-scoped_ptr<LocalInputMonitor> LocalInputMonitor::Create(
+std::unique_ptr<LocalInputMonitor> LocalInputMonitor::Create(
     scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
     scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
     scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
     base::WeakPtr<ClientSessionControl> client_session_control) {
-  return make_scoped_ptr(new LocalInputMonitorWin(
+  return base::WrapUnique(new LocalInputMonitorWin(
       caller_task_runner, ui_task_runner, client_session_control));
 }
 
diff --git a/remoting/host/local_input_monitor_x11.cc b/remoting/host/local_input_monitor_x11.cc
index 060e382..32d5eb59 100644
--- a/remoting/host/local_input_monitor_x11.cc
+++ b/remoting/host/local_input_monitor_x11.cc
@@ -6,6 +6,8 @@
 
 #include <sys/select.h>
 #include <unistd.h>
+
+#include "base/memory/ptr_util.h"
 #define XK_MISCELLANY
 #include <X11/keysymdef.h>
 
@@ -317,12 +319,12 @@
 
 }  // namespace
 
-scoped_ptr<LocalInputMonitor> LocalInputMonitor::Create(
+std::unique_ptr<LocalInputMonitor> LocalInputMonitor::Create(
     scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
     scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
     scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
     base::WeakPtr<ClientSessionControl> client_session_control) {
-  return make_scoped_ptr(new LocalInputMonitorX11(
+  return base::WrapUnique(new LocalInputMonitorX11(
       caller_task_runner, input_task_runner, client_session_control));
 }
 
diff --git a/remoting/host/mac/me2me_preference_pane.h b/remoting/host/mac/me2me_preference_pane.h
index da65747..b6662403 100644
--- a/remoting/host/mac/me2me_preference_pane.h
+++ b/remoting/host/mac/me2me_preference_pane.h
@@ -6,10 +6,10 @@
 #import <PreferencePanes/PreferencePanes.h>
 #import <SecurityInterface/SFAuthorizationView.h>
 
+#include <memory>
 #include <string>
 
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "third_party/jsoncpp/source/include/json/value.h"
 
 namespace remoting {
@@ -51,7 +51,7 @@
 
   // Holds the new proposed configuration if a temporary config file is
   // present.
-  scoped_ptr<remoting::JsonHostConfig> config_;
+  std::unique_ptr<remoting::JsonHostConfig> config_;
 
   NSTimer* service_status_timer_;
 
diff --git a/remoting/host/mac/me2me_preference_pane.mm b/remoting/host/mac/me2me_preference_pane.mm
index c4d8317..98f0b9a 100644
--- a/remoting/host/mac/me2me_preference_pane.mm
+++ b/remoting/host/mac/me2me_preference_pane.mm
@@ -15,18 +15,18 @@
 #include <unistd.h>
 
 #include <fstream>
+#include <memory>
 
 #include "base/mac/authorization_util.h"
 #include "base/mac/launchd.h"
 #include "base/mac/mac_logging.h"
 #include "base/mac/scoped_launch_data.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/posix/eintr_wrapper.h"
 #include "remoting/host/constants_mac.h"
 #include "remoting/host/host_config.h"
-#include "remoting/host/pin_hash.h"
 #import "remoting/host/mac/me2me_preference_pane_confirm_pin.h"
 #import "remoting/host/mac/me2me_preference_pane_disable.h"
+#include "remoting/host/pin_hash.h"
 #include "third_party/jsoncpp/source/include/json/reader.h"
 #include "third_party/jsoncpp/source/include/json/writer.h"
 
@@ -245,7 +245,7 @@
   if (access(file.c_str(), F_OK) != 0)
     return;
 
-  scoped_ptr<remoting::JsonHostConfig> new_config_(
+  std::unique_ptr<remoting::JsonHostConfig> new_config_(
       new remoting::JsonHostConfig(file));
   if (!new_config_->Read()) {
     // Report the error, because the file exists but couldn't be read.  The
diff --git a/remoting/host/me2me_desktop_environment.cc b/remoting/host/me2me_desktop_environment.cc
index 0a6d37dc..35723db 100644
--- a/remoting/host/me2me_desktop_environment.cc
+++ b/remoting/host/me2me_desktop_environment.cc
@@ -7,6 +7,7 @@
 #include <utility>
 
 #include "base/logging.h"
+#include "base/memory/ptr_util.h"
 #include "base/single_thread_task_runner.h"
 #include "build/build_config.h"
 #include "remoting/base/logging.h"
@@ -34,10 +35,11 @@
   DCHECK(caller_task_runner()->BelongsToCurrentThread());
 }
 
-scoped_ptr<ScreenControls> Me2MeDesktopEnvironment::CreateScreenControls() {
+std::unique_ptr<ScreenControls>
+Me2MeDesktopEnvironment::CreateScreenControls() {
   DCHECK(caller_task_runner()->BelongsToCurrentThread());
 
-  return make_scoped_ptr(new ResizingHostObserver(DesktopResizer::Create()));
+  return base::WrapUnique(new ResizingHostObserver(DesktopResizer::Create()));
 }
 
 std::string Me2MeDesktopEnvironment::GetCapabilities() const {
@@ -132,11 +134,11 @@
 Me2MeDesktopEnvironmentFactory::~Me2MeDesktopEnvironmentFactory() {
 }
 
-scoped_ptr<DesktopEnvironment> Me2MeDesktopEnvironmentFactory::Create(
+std::unique_ptr<DesktopEnvironment> Me2MeDesktopEnvironmentFactory::Create(
     base::WeakPtr<ClientSessionControl> client_session_control) {
   DCHECK(caller_task_runner()->BelongsToCurrentThread());
 
-  scoped_ptr<Me2MeDesktopEnvironment> desktop_environment(
+  std::unique_ptr<Me2MeDesktopEnvironment> desktop_environment(
       new Me2MeDesktopEnvironment(
           caller_task_runner(), video_capture_task_runner(),
           input_task_runner(), ui_task_runner(), supports_touch_events()));
diff --git a/remoting/host/me2me_desktop_environment.h b/remoting/host/me2me_desktop_environment.h
index d6aee15..38e06b7 100644
--- a/remoting/host/me2me_desktop_environment.h
+++ b/remoting/host/me2me_desktop_environment.h
@@ -21,7 +21,7 @@
   ~Me2MeDesktopEnvironment() override;
 
   // DesktopEnvironment interface.
-  scoped_ptr<ScreenControls> CreateScreenControls() override;
+  std::unique_ptr<ScreenControls> CreateScreenControls() override;
   std::string GetCapabilities() const override;
 
  protected:
@@ -42,13 +42,13 @@
  private:
   // "Curtains" the session making sure it is disconnected from the local
   // console.
-  scoped_ptr<CurtainMode> curtain_;
+  std::unique_ptr<CurtainMode> curtain_;
 
   // Presents the disconnect window to the local user.
-  scoped_ptr<HostWindow> disconnect_window_;
+  std::unique_ptr<HostWindow> disconnect_window_;
 
   // Notifies the client session about the local mouse movements.
-  scoped_ptr<LocalInputMonitor> local_input_monitor_;
+  std::unique_ptr<LocalInputMonitor> local_input_monitor_;
 
   DISALLOW_COPY_AND_ASSIGN(Me2MeDesktopEnvironment);
 };
@@ -64,7 +64,7 @@
   ~Me2MeDesktopEnvironmentFactory() override;
 
   // DesktopEnvironmentFactory interface.
-  scoped_ptr<DesktopEnvironment> Create(
+  std::unique_ptr<DesktopEnvironment> Create(
       base::WeakPtr<ClientSessionControl> client_session_control) override;
   void SetEnableCurtaining(bool enable) override;
 
diff --git a/remoting/host/mouse_cursor_monitor_proxy.cc b/remoting/host/mouse_cursor_monitor_proxy.cc
index 252eb287..77d356e 100644
--- a/remoting/host/mouse_cursor_monitor_proxy.cc
+++ b/remoting/host/mouse_cursor_monitor_proxy.cc
@@ -20,7 +20,7 @@
  public:
   Core(base::WeakPtr<MouseCursorMonitorProxy> proxy,
        scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
-       scoped_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor);
+       std::unique_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor);
   ~Core() override;
 
   void Init(webrtc::MouseCursorMonitor::Mode mode);
@@ -36,7 +36,7 @@
 
   base::WeakPtr<MouseCursorMonitorProxy> proxy_;
   scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_;
-  scoped_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor_;
+  std::unique_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor_;
 
   DISALLOW_COPY_AND_ASSIGN(Core);
 };
@@ -44,7 +44,7 @@
 MouseCursorMonitorProxy::Core::Core(
     base::WeakPtr<MouseCursorMonitorProxy> proxy,
     scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
-    scoped_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor)
+    std::unique_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor)
     : proxy_(proxy),
       caller_task_runner_(caller_task_runner),
       mouse_cursor_monitor_(std::move(mouse_cursor_monitor)) {
@@ -71,7 +71,7 @@
 void MouseCursorMonitorProxy::Core::OnMouseCursor(webrtc::MouseCursor* cursor) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
-  scoped_ptr<webrtc::MouseCursor> owned_cursor(cursor);
+  std::unique_ptr<webrtc::MouseCursor> owned_cursor(cursor);
   caller_task_runner_->PostTask(
       FROM_HERE, base::Bind(&MouseCursorMonitorProxy::OnMouseCursor, proxy_,
                             base::Passed(&owned_cursor)));
@@ -89,7 +89,7 @@
 
 MouseCursorMonitorProxy::MouseCursorMonitorProxy(
     scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner,
-    scoped_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor)
+    std::unique_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor)
     : capture_task_runner_(capture_task_runner), weak_factory_(this) {
   core_.reset(new Core(weak_factory_.GetWeakPtr(),
                        base::ThreadTaskRunnerHandle::Get(),
@@ -114,7 +114,7 @@
 }
 
 void MouseCursorMonitorProxy::OnMouseCursor(
-    scoped_ptr<webrtc::MouseCursor> cursor) {
+    std::unique_ptr<webrtc::MouseCursor> cursor) {
   DCHECK(thread_checker_.CalledOnValidThread());
   callback_->OnMouseCursor(cursor.release());
 }
diff --git a/remoting/host/mouse_cursor_monitor_proxy.h b/remoting/host/mouse_cursor_monitor_proxy.h
index 3ad7f58..d583f70 100644
--- a/remoting/host/mouse_cursor_monitor_proxy.h
+++ b/remoting/host/mouse_cursor_monitor_proxy.h
@@ -5,8 +5,9 @@
 #ifndef REMOTING_HOST_MOUSE_CURSOR_MONITOR_PROXY_H_
 #define REMOTING_HOST_MOUSE_CURSOR_MONITOR_PROXY_H_
 
+#include <memory>
+
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/threading/thread_checker.h"
 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor_monitor.h"
@@ -21,7 +22,7 @@
  public:
   MouseCursorMonitorProxy(
       scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner,
-      scoped_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor);
+      std::unique_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor);
   ~MouseCursorMonitorProxy() override;
 
   // webrtc::MouseCursorMonitor interface.
@@ -31,13 +32,13 @@
  private:
   class Core;
 
-  void OnMouseCursor(scoped_ptr<webrtc::MouseCursor> cursor);
+  void OnMouseCursor(std::unique_ptr<webrtc::MouseCursor> cursor);
   void OnMouseCursorPosition(CursorState state,
                              const webrtc::DesktopVector& position);
 
   base::ThreadChecker thread_checker_;
 
-  scoped_ptr<Core> core_;
+  std::unique_ptr<Core> core_;
   scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner_;
   Callback* callback_ = nullptr;
 
diff --git a/remoting/host/mouse_cursor_monitor_proxy_unittest.cc b/remoting/host/mouse_cursor_monitor_proxy_unittest.cc
index 8a79bcd..d27a6c94 100644
--- a/remoting/host/mouse_cursor_monitor_proxy_unittest.cc
+++ b/remoting/host/mouse_cursor_monitor_proxy_unittest.cc
@@ -56,7 +56,7 @@
     EXPECT_TRUE(task_runner_->BelongsToCurrentThread());
     ASSERT_TRUE(callback_);
 
-    scoped_ptr<webrtc::MouseCursor> mouse_cursor(new webrtc::MouseCursor(
+    std::unique_ptr<webrtc::MouseCursor> mouse_cursor(new webrtc::MouseCursor(
         new webrtc::BasicDesktopFrame(
             webrtc::DesktopSize(kCursorWidth, kCursorHeight)),
         webrtc::DesktopVector(kHotspotX, kHotspotY)));
@@ -94,7 +94,7 @@
   base::MessageLoop message_loop_;
   base::RunLoop run_loop_;
   base::Thread capture_thread_;
-  scoped_ptr<MouseCursorMonitorProxy> proxy_;
+  std::unique_ptr<MouseCursorMonitorProxy> proxy_;
 
   MockClientStub client_stub_;
 };
@@ -119,7 +119,7 @@
 }
 
 TEST_F(MouseCursorMonitorProxyTest, CursorShape) {
-  scoped_ptr<ThreadCheckMouseCursorMonitor> cursor_monitor(
+  std::unique_ptr<ThreadCheckMouseCursorMonitor> cursor_monitor(
       new ThreadCheckMouseCursorMonitor(capture_thread_.task_runner()));
 
   // Initialize the proxy.
diff --git a/remoting/host/mouse_shape_pump.cc b/remoting/host/mouse_shape_pump.cc
index e086ef4..f86a30a 100644
--- a/remoting/host/mouse_shape_pump.cc
+++ b/remoting/host/mouse_shape_pump.cc
@@ -21,7 +21,7 @@
 static const int kCursorCaptureIntervalMs = 100;
 
 MouseShapePump::MouseShapePump(
-    scoped_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor,
+    std::unique_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor,
     protocol::CursorShapeStub* cursor_shape_stub)
     : mouse_cursor_monitor_(std::move(mouse_cursor_monitor)),
       cursor_shape_stub_(cursor_shape_stub),
@@ -43,9 +43,9 @@
 void MouseShapePump::OnMouseCursor(webrtc::MouseCursor* cursor) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
-  scoped_ptr<webrtc::MouseCursor> owned_cursor(cursor);
+  std::unique_ptr<webrtc::MouseCursor> owned_cursor(cursor);
 
-  scoped_ptr<protocol::CursorShapeInfo> cursor_proto(
+  std::unique_ptr<protocol::CursorShapeInfo> cursor_proto(
       new protocol::CursorShapeInfo());
   cursor_proto->set_width(cursor->image()->size().width());
   cursor_proto->set_height(cursor->image()->size().height());
diff --git a/remoting/host/mouse_shape_pump.h b/remoting/host/mouse_shape_pump.h
index cf6f370..f5a499a 100644
--- a/remoting/host/mouse_shape_pump.h
+++ b/remoting/host/mouse_shape_pump.h
@@ -5,8 +5,9 @@
 #ifndef REMOTING_HOST_MOUSE_SHAPE_PUMP_H_
 #define REMOTING_HOST_MOUSE_SHAPE_PUMP_H_
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/threading/thread_checker.h"
 #include "base/timer/timer.h"
 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor_monitor.h"
@@ -21,8 +22,9 @@
 // MouseCursorMonitor and sending it to a CursorShapeStub.
 class MouseShapePump : public webrtc::MouseCursorMonitor::Callback {
  public:
-  MouseShapePump(scoped_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor,
-                 protocol::CursorShapeStub* cursor_shape_stub);
+  MouseShapePump(
+      std::unique_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor,
+      protocol::CursorShapeStub* cursor_shape_stub);
   ~MouseShapePump() override;
 
  private:
@@ -34,7 +36,7 @@
                              const webrtc::DesktopVector& position) override;
 
   base::ThreadChecker thread_checker_;
-  scoped_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor_;
+  std::unique_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor_;
   protocol::CursorShapeStub* cursor_shape_stub_;
 
   base::Timer capture_timer_;
diff --git a/remoting/host/mouse_shape_pump_unittest.cc b/remoting/host/mouse_shape_pump_unittest.cc
index cbc6a4d..946635e 100644
--- a/remoting/host/mouse_shape_pump_unittest.cc
+++ b/remoting/host/mouse_shape_pump_unittest.cc
@@ -7,6 +7,7 @@
 #include <utility>
 
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
 #include "base/single_thread_task_runner.h"
@@ -46,7 +47,7 @@
   void Capture() override {
     ASSERT_TRUE(callback_);
 
-    scoped_ptr<webrtc::MouseCursor> mouse_cursor(new webrtc::MouseCursor(
+    std::unique_ptr<webrtc::MouseCursor> mouse_cursor(new webrtc::MouseCursor(
         new webrtc::BasicDesktopFrame(
             webrtc::DesktopSize(kCursorWidth, kCursorHeight)),
         webrtc::DesktopVector(kHotspotX, kHotspotY)));
@@ -67,7 +68,7 @@
  protected:
   base::MessageLoop message_loop_;
   base::RunLoop run_loop_;
-  scoped_ptr<MouseShapePump> pump_;
+  std::unique_ptr<MouseShapePump> pump_;
 
   MockClientStub client_stub_;
 };
@@ -98,7 +99,7 @@
       .RetiresOnSaturation();
 
   // Start the pump.
-  pump_.reset(new MouseShapePump(make_scoped_ptr(new TestMouseCursorMonitor()),
+  pump_.reset(new MouseShapePump(base::WrapUnique(new TestMouseCursorMonitor()),
                                  &client_stub_));
 
   run_loop_.Run();
diff --git a/remoting/host/native_messaging/log_message_handler.cc b/remoting/host/native_messaging/log_message_handler.cc
index d301cc3f..0625d44 100644
--- a/remoting/host/native_messaging/log_message_handler.cc
+++ b/remoting/host/native_messaging/log_message_handler.cc
@@ -117,7 +117,7 @@
   std::string message = str.substr(message_start);
   base::TrimWhitespaceASCII(message, base::TRIM_ALL, &message);
 
-  scoped_ptr<base::DictionaryValue> dictionary(new base::DictionaryValue);
+  std::unique_ptr<base::DictionaryValue> dictionary(new base::DictionaryValue);
   dictionary->SetString("type", kDebugMessageTypeName);
   dictionary->SetString("severity", severity_string);
   dictionary->SetString("message", message);
diff --git a/remoting/host/native_messaging/log_message_handler.h b/remoting/host/native_messaging/log_message_handler.h
index f8b2d1f..201c7ba7 100644
--- a/remoting/host/native_messaging/log_message_handler.h
+++ b/remoting/host/native_messaging/log_message_handler.h
@@ -7,8 +7,9 @@
 
 #include <stddef.h>
 
+#include <memory>
+
 #include "base/callback.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/values.h"
 
@@ -19,7 +20,7 @@
 // over a Native Messaging channel.
 class LogMessageHandler {
  public:
-  typedef base::Callback<void (scoped_ptr<base::Value> message)> Delegate;
+  typedef base::Callback<void(std::unique_ptr<base::Value> message)> Delegate;
 
   explicit LogMessageHandler(const Delegate& delegate);
   ~LogMessageHandler();
diff --git a/remoting/host/native_messaging/native_messaging_pipe.cc b/remoting/host/native_messaging/native_messaging_pipe.cc
index d19dde5d..27128a1b 100644
--- a/remoting/host/native_messaging/native_messaging_pipe.cc
+++ b/remoting/host/native_messaging/native_messaging_pipe.cc
@@ -17,14 +17,14 @@
 NativeMessagingPipe::~NativeMessagingPipe() {}
 
 void NativeMessagingPipe::Start(
-    scoped_ptr<extensions::NativeMessageHost> host,
-    scoped_ptr<extensions::NativeMessagingChannel> channel) {
+    std::unique_ptr<extensions::NativeMessageHost> host,
+    std::unique_ptr<extensions::NativeMessagingChannel> channel) {
   host_ = std::move(host);
   channel_ = std::move(channel);
   channel_->Start(this);
 }
 
-void NativeMessagingPipe::OnMessage(scoped_ptr<base::Value> message) {
+void NativeMessagingPipe::OnMessage(std::unique_ptr<base::Value> message) {
   std::string message_json;
   base::JSONWriter::Write(*message, &message_json);
   host_->OnMessage(message_json);
@@ -37,7 +37,7 @@
 
 void NativeMessagingPipe::PostMessageFromNativeHost(
     const std::string& message) {
-  scoped_ptr<base::Value> json = base::JSONReader::Read(message);
+  std::unique_ptr<base::Value> json = base::JSONReader::Read(message);
   channel_->SendMessage(std::move(json));
 }
 
diff --git a/remoting/host/native_messaging/native_messaging_pipe.h b/remoting/host/native_messaging/native_messaging_pipe.h
index 8524a1a6..b420931 100644
--- a/remoting/host/native_messaging/native_messaging_pipe.h
+++ b/remoting/host/native_messaging/native_messaging_pipe.h
@@ -5,8 +5,9 @@
 #ifndef REMOTING_HOST_NATIVE_MESSAGING_NATIVE_MESSAGING_PIPE_H_
 #define REMOTING_HOST_NATIVE_MESSAGING_NATIVE_MESSAGING_PIPE_H_
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "extensions/browser/api/messaging/native_message_host.h"
 #include "extensions/browser/api/messaging/native_messaging_channel.h"
@@ -26,20 +27,20 @@
   ~NativeMessagingPipe() override;
 
   // Starts processing messages from the pipe.
-  void Start(scoped_ptr<extensions::NativeMessageHost> host,
-             scoped_ptr<extensions::NativeMessagingChannel> channel);
+  void Start(std::unique_ptr<extensions::NativeMessageHost> host,
+             std::unique_ptr<extensions::NativeMessagingChannel> channel);
 
   // extensions::NativeMessageHost::Client implementation.
   void PostMessageFromNativeHost(const std::string& message) override;
   void CloseChannel(const std::string& error_message) override;
 
   // extensions::NativeMessagingChannel::EventHandler implementation.
-  void OnMessage(scoped_ptr<base::Value> message) override;
+  void OnMessage(std::unique_ptr<base::Value> message) override;
   void OnDisconnect() override;
 
  private:
-  scoped_ptr<extensions::NativeMessagingChannel> channel_;
-  scoped_ptr<extensions::NativeMessageHost> host_;
+  std::unique_ptr<extensions::NativeMessagingChannel> channel_;
+  std::unique_ptr<extensions::NativeMessageHost> host_;
 
   DISALLOW_COPY_AND_ASSIGN(NativeMessagingPipe);
 };
diff --git a/remoting/host/native_messaging/native_messaging_reader.cc b/remoting/host/native_messaging/native_messaging_reader.cc
index f5cbb87f..6d2beeb 100644
--- a/remoting/host/native_messaging/native_messaging_reader.cc
+++ b/remoting/host/native_messaging/native_messaging_reader.cc
@@ -113,7 +113,7 @@
       return;
     }
 
-    scoped_ptr<base::Value> message = base::JSONReader::Read(message_json);
+    std::unique_ptr<base::Value> message = base::JSONReader::Read(message_json);
     if (!message) {
       LOG(ERROR) << "Failed to parse JSON message: " << message.get();
       NotifyEof();
@@ -160,7 +160,7 @@
 }
 
 void NativeMessagingReader::InvokeMessageCallback(
-    scoped_ptr<base::Value> message) {
+    std::unique_ptr<base::Value> message) {
   message_callback_.Run(std::move(message));
 }
 
diff --git a/remoting/host/native_messaging/native_messaging_reader.h b/remoting/host/native_messaging/native_messaging_reader.h
index f5a090c2..482d48fb 100644
--- a/remoting/host/native_messaging/native_messaging_reader.h
+++ b/remoting/host/native_messaging/native_messaging_reader.h
@@ -5,10 +5,11 @@
 #ifndef REMOTING_HOST_NATIVE_MESSAGING_NATIVE_MESSAGING_READER_H_
 #define REMOTING_HOST_NATIVE_MESSAGING_NATIVE_MESSAGING_READER_H_
 
+#include <memory>
+
 #include "base/callback.h"
 #include "base/files/file.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/threading/thread.h"
 
@@ -23,7 +24,7 @@
 // webapp.
 class NativeMessagingReader {
  public:
-  typedef base::Callback<void(scoped_ptr<base::Value>)> MessageCallback;
+  typedef base::Callback<void(std::unique_ptr<base::Value>)> MessageCallback;
 
   explicit NativeMessagingReader(base::File file);
   ~NativeMessagingReader();
@@ -42,13 +43,13 @@
   // Wrappers posted to by the read thread to trigger the message and EOF
   // callbacks on the caller thread, and have them safely dropped if the reader
   // has been deleted before they are processed.
-  void InvokeMessageCallback(scoped_ptr<base::Value> message);
+  void InvokeMessageCallback(std::unique_ptr<base::Value> message);
   void InvokeEofCallback();
 
   // Holds the information that the read thread needs to access, such as the
   // File, and the TaskRunner used for posting notifications back to this
   // class.
-  scoped_ptr<Core> core_;
+  std::unique_ptr<Core> core_;
 
   // Caller-supplied message and end-of-file callbacks.
   MessageCallback message_callback_;
diff --git a/remoting/host/native_messaging/native_messaging_reader_unittest.cc b/remoting/host/native_messaging/native_messaging_reader_unittest.cc
index 73ff362..e5e033c 100644
--- a/remoting/host/native_messaging/native_messaging_reader_unittest.cc
+++ b/remoting/host/native_messaging/native_messaging_reader_unittest.cc
@@ -6,10 +6,10 @@
 
 #include <stdint.h>
 
+#include <memory>
 #include <utility>
 
 #include "base/bind.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
 #include "base/values.h"
@@ -30,7 +30,7 @@
 
   // MessageCallback passed to the Reader. Stores |message| so it can be
   // verified by tests.
-  void OnMessage(scoped_ptr<base::Value> message);
+  void OnMessage(std::unique_ptr<base::Value> message);
 
   // Writes a message (header+body) to the write-end of the pipe.
   void WriteMessage(const std::string& message);
@@ -39,10 +39,10 @@
   void WriteData(const char* data, int length);
 
  protected:
-  scoped_ptr<NativeMessagingReader> reader_;
+  std::unique_ptr<NativeMessagingReader> reader_;
   base::File read_file_;
   base::File write_file_;
-  scoped_ptr<base::Value> message_;
+  std::unique_ptr<base::Value> message_;
 
  private:
   // MessageLoop declared here, since the NativeMessageReader ctor requires a
@@ -71,7 +71,8 @@
   run_loop_.Run();
 }
 
-void NativeMessagingReaderTest::OnMessage(scoped_ptr<base::Value> message) {
+void NativeMessagingReaderTest::OnMessage(
+    std::unique_ptr<base::Value> message) {
   message_ = std::move(message);
 }
 
diff --git a/remoting/host/native_messaging/native_messaging_writer_unittest.cc b/remoting/host/native_messaging/native_messaging_writer_unittest.cc
index def0a7573..37963c0 100644
--- a/remoting/host/native_messaging/native_messaging_writer_unittest.cc
+++ b/remoting/host/native_messaging/native_messaging_writer_unittest.cc
@@ -6,10 +6,10 @@
 
 #include <stdint.h>
 
+#include <memory>
 #include <utility>
 
 #include "base/json/json_reader.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/stl_util.h"
 #include "base/values.h"
 #include "remoting/host/setup/test_util.h"
@@ -25,7 +25,7 @@
   void SetUp() override;
 
  protected:
-  scoped_ptr<NativeMessagingWriter> writer_;
+  std::unique_ptr<NativeMessagingWriter> writer_;
   base::File read_file_;
   base::File write_file_;
 };
@@ -52,7 +52,8 @@
   EXPECT_EQ(static_cast<int>(length), read);
 
   // |content| should now contain serialized |message|.
-  scoped_ptr<base::Value> written_message = base::JSONReader::Read(content);
+  std::unique_ptr<base::Value> written_message =
+      base::JSONReader::Read(content);
   EXPECT_TRUE(message.Equals(written_message.get()));
 
   // Nothing more should have been written. Close the write-end of the pipe,
@@ -84,7 +85,8 @@
   }
 
   // |content| should now contain serialized |message2|.
-  scoped_ptr<base::Value> written_message2 = base::JSONReader::Read(content);
+  std::unique_ptr<base::Value> written_message2 =
+      base::JSONReader::Read(content);
   EXPECT_TRUE(message2.Equals(written_message2.get()));
 }
 
diff --git a/remoting/host/native_messaging/pipe_messaging_channel.cc b/remoting/host/native_messaging/pipe_messaging_channel.cc
index a1e8831e..014e67de 100644
--- a/remoting/host/native_messaging/pipe_messaging_channel.cc
+++ b/remoting/host/native_messaging/pipe_messaging_channel.cc
@@ -68,14 +68,15 @@
       base::Bind(&PipeMessagingChannel::Shutdown, weak_ptr_));
 }
 
-void PipeMessagingChannel::ProcessMessage(scoped_ptr<base::Value> message) {
+void PipeMessagingChannel::ProcessMessage(
+    std::unique_ptr<base::Value> message) {
   DCHECK(CalledOnValidThread());
 
   if (event_handler_)
     event_handler_->OnMessage(std::move(message));
 }
 
-void PipeMessagingChannel::SendMessage(scoped_ptr<base::Value> message) {
+void PipeMessagingChannel::SendMessage(std::unique_ptr<base::Value> message) {
   DCHECK(CalledOnValidThread());
 
   bool success = message && native_messaging_writer_;
diff --git a/remoting/host/native_messaging/pipe_messaging_channel.h b/remoting/host/native_messaging/pipe_messaging_channel.h
index 75c4f94..93e04c1 100644
--- a/remoting/host/native_messaging/pipe_messaging_channel.h
+++ b/remoting/host/native_messaging/pipe_messaging_channel.h
@@ -5,11 +5,12 @@
 #ifndef REMOTING_HOST_NATIVE_MESSAGING_PIPE_MESSAGING_CHANNEL_H_
 #define REMOTING_HOST_NATIVE_MESSAGING_PIPE_MESSAGING_CHANNEL_H_
 
+#include <memory>
+
 #include "base/callback.h"
 #include "base/files/file.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/threading/non_thread_safe.h"
 #include "extensions/browser/api/messaging/native_messaging_channel.h"
@@ -40,17 +41,17 @@
 
   // extensions::NativeMessagingChannel implementation.
   void Start(EventHandler* event_handler) override;
-  void SendMessage(scoped_ptr<base::Value> message) override;
+  void SendMessage(std::unique_ptr<base::Value> message) override;
 
  private:
   // Processes a message received from the client app.
-  void ProcessMessage(scoped_ptr<base::Value> message);
+  void ProcessMessage(std::unique_ptr<base::Value> message);
 
   // Initiates shutdown.
   void Shutdown();
 
   NativeMessagingReader native_messaging_reader_;
-  scoped_ptr<NativeMessagingWriter> native_messaging_writer_;
+  std::unique_ptr<NativeMessagingWriter> native_messaging_writer_;
 
   EventHandler* event_handler_;
   base::WeakPtr<PipeMessagingChannel> weak_ptr_;
diff --git a/remoting/host/oauth_token_getter_impl.cc b/remoting/host/oauth_token_getter_impl.cc
index 1dd35aa..83404d8 100644
--- a/remoting/host/oauth_token_getter_impl.cc
+++ b/remoting/host/oauth_token_getter_impl.cc
@@ -26,7 +26,7 @@
 }  // namespace
 
 OAuthTokenGetterImpl::OAuthTokenGetterImpl(
-    scoped_ptr<OAuthCredentials> oauth_credentials,
+    std::unique_ptr<OAuthCredentials> oauth_credentials,
     const scoped_refptr<net::URLRequestContextGetter>&
         url_request_context_getter,
     bool auto_refresh)
diff --git a/remoting/host/oauth_token_getter_impl.h b/remoting/host/oauth_token_getter_impl.h
index 5d318f8..8e5ae33 100644
--- a/remoting/host/oauth_token_getter_impl.h
+++ b/remoting/host/oauth_token_getter_impl.h
@@ -25,7 +25,7 @@
                              public base::NonThreadSafe,
                              public gaia::GaiaOAuthClient::Delegate {
  public:
-  OAuthTokenGetterImpl(scoped_ptr<OAuthCredentials> oauth_credentials,
+  OAuthTokenGetterImpl(std::unique_ptr<OAuthCredentials> oauth_credentials,
                        const scoped_refptr<net::URLRequestContextGetter>&
                            url_request_context_getter,
                        bool auto_refresh);
@@ -52,8 +52,8 @@
                        const std::string& access_token);
   void RefreshOAuthToken();
 
-  scoped_ptr<OAuthCredentials> oauth_credentials_;
-  scoped_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_;
+  std::unique_ptr<OAuthCredentials> oauth_credentials_;
+  std::unique_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_;
   scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;
 
   bool refreshing_oauth_token_ = false;
@@ -61,7 +61,7 @@
   std::string oauth_access_token_;
   base::Time auth_token_expiry_time_;
   std::queue<OAuthTokenGetter::TokenCallback> pending_callbacks_;
-  scoped_ptr<base::OneShotTimer> refresh_timer_;
+  std::unique_ptr<base::OneShotTimer> refresh_timer_;
 };
 
 }  // namespace remoting
diff --git a/remoting/host/pairing_registry_delegate.cc b/remoting/host/pairing_registry_delegate.cc
index a9596b0b..cf5a102 100644
--- a/remoting/host/pairing_registry_delegate.cc
+++ b/remoting/host/pairing_registry_delegate.cc
@@ -15,7 +15,7 @@
 scoped_refptr<PairingRegistry> CreatePairingRegistry(
     scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
   scoped_refptr<PairingRegistry> pairing_registry;
-  scoped_ptr<PairingRegistry::Delegate> delegate(
+  std::unique_ptr<PairingRegistry::Delegate> delegate(
       CreatePairingRegistryDelegate());
   if (delegate) {
     pairing_registry = new PairingRegistry(task_runner, std::move(delegate));
diff --git a/remoting/host/pairing_registry_delegate.h b/remoting/host/pairing_registry_delegate.h
index a5e96b9..96f4849 100644
--- a/remoting/host/pairing_registry_delegate.h
+++ b/remoting/host/pairing_registry_delegate.h
@@ -5,8 +5,9 @@
 #ifndef REMOTING_HOST_PAIRING_REGISTRY_DELEGATE_H_
 #define REMOTING_HOST_PAIRING_REGISTRY_DELEGATE_H_
 
+#include <memory>
+
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "remoting/protocol/pairing_registry.h"
 
 namespace base {
@@ -16,7 +17,7 @@
 namespace remoting {
 // Returns a platform-specific pairing registry delegate that will save to
 // permanent storage. Returns nullptr on platforms that don't support pairing.
-scoped_ptr<protocol::PairingRegistry::Delegate>
+std::unique_ptr<protocol::PairingRegistry::Delegate>
 CreatePairingRegistryDelegate();
 
 // Convenience function which returns a new PairingRegistry, using the delegate
diff --git a/remoting/host/pairing_registry_delegate_linux.cc b/remoting/host/pairing_registry_delegate_linux.cc
index 8bd25de..f6ad1c5 100644
--- a/remoting/host/pairing_registry_delegate_linux.cc
+++ b/remoting/host/pairing_registry_delegate_linux.cc
@@ -11,6 +11,7 @@
 #include "base/json/json_file_value_serializer.h"
 #include "base/json/json_string_value_serializer.h"
 #include "base/location.h"
+#include "base/memory/ptr_util.h"
 #include "base/strings/stringprintf.h"
 #include "base/values.h"
 #include "remoting/host/branding.h"
@@ -35,8 +36,8 @@
 PairingRegistryDelegateLinux::~PairingRegistryDelegateLinux() {
 }
 
-scoped_ptr<base::ListValue> PairingRegistryDelegateLinux::LoadAll() {
-  scoped_ptr<base::ListValue> pairings(new base::ListValue());
+std::unique_ptr<base::ListValue> PairingRegistryDelegateLinux::LoadAll() {
+  std::unique_ptr<base::ListValue> pairings(new base::ListValue());
 
   // Enumerate all pairing files in the pairing registry.
   base::FilePath registry_path = GetRegistryPath();
@@ -49,7 +50,7 @@
     JSONFileValueDeserializer deserializer(pairing_file);
     int error_code;
     std::string error_message;
-    scoped_ptr<base::Value> pairing_json =
+    std::unique_ptr<base::Value> pairing_json =
         deserializer.Deserialize(&error_code, &error_message);
     if (!pairing_json) {
       LOG(WARNING) << "Failed to load '" << pairing_file.value() << "' ("
@@ -88,7 +89,7 @@
   JSONFileValueDeserializer deserializer(pairing_file);
   int error_code;
   std::string error_message;
-  scoped_ptr<base::Value> pairing =
+  std::unique_ptr<base::Value> pairing =
       deserializer.Deserialize(&error_code, &error_message);
   if (!pairing) {
     LOG(WARNING) << "Failed to load pairing information: " << error_message
@@ -155,9 +156,8 @@
   registry_path_for_testing_ = registry_path;
 }
 
-
-scoped_ptr<PairingRegistry::Delegate> CreatePairingRegistryDelegate() {
-  return make_scoped_ptr(new PairingRegistryDelegateLinux());
+std::unique_ptr<PairingRegistry::Delegate> CreatePairingRegistryDelegate() {
+  return base::WrapUnique(new PairingRegistryDelegateLinux());
 }
 
 }  // namespace remoting
diff --git a/remoting/host/pairing_registry_delegate_linux.h b/remoting/host/pairing_registry_delegate_linux.h
index 638a4bb..d147644 100644
--- a/remoting/host/pairing_registry_delegate_linux.h
+++ b/remoting/host/pairing_registry_delegate_linux.h
@@ -24,7 +24,7 @@
   ~PairingRegistryDelegateLinux() override;
 
   // PairingRegistry::Delegate interface
-  scoped_ptr<base::ListValue> LoadAll() override;
+  std::unique_ptr<base::ListValue> LoadAll() override;
   bool DeleteAll() override;
   protocol::PairingRegistry::Pairing Load(
       const std::string& client_id) override;
diff --git a/remoting/host/pairing_registry_delegate_linux_unittest.cc b/remoting/host/pairing_registry_delegate_linux_unittest.cc
index 7cc0403..9a5f947b 100644
--- a/remoting/host/pairing_registry_delegate_linux_unittest.cc
+++ b/remoting/host/pairing_registry_delegate_linux_unittest.cc
@@ -30,7 +30,7 @@
 };
 
 TEST_F(PairingRegistryDelegateLinuxTest, SaveAndLoad) {
-  scoped_ptr<PairingRegistryDelegateLinux> delegate(
+  std::unique_ptr<PairingRegistryDelegateLinux> delegate(
       new PairingRegistryDelegateLinux());
   delegate->SetRegistryPathForTesting(temp_registry_);
 
@@ -59,7 +59,7 @@
 
   // Verify that the only value that left is |pairing2|.
   EXPECT_EQ(delegate->LoadAll()->GetSize(), 1u);
-  scoped_ptr<base::ListValue> pairings = delegate->LoadAll();
+  std::unique_ptr<base::ListValue> pairings = delegate->LoadAll();
   base::DictionaryValue* json;
   EXPECT_TRUE(pairings->GetDictionary(0, &json));
   EXPECT_EQ(PairingRegistry::Pairing::CreateFromValue(*json), pairing2);
@@ -71,9 +71,9 @@
 
 // Verifies that the delegate is stateless by using two different instances.
 TEST_F(PairingRegistryDelegateLinuxTest, Stateless) {
-  scoped_ptr<PairingRegistryDelegateLinux> save_delegate(
+  std::unique_ptr<PairingRegistryDelegateLinux> save_delegate(
       new PairingRegistryDelegateLinux());
-  scoped_ptr<PairingRegistryDelegateLinux> load_delegate(
+  std::unique_ptr<PairingRegistryDelegateLinux> load_delegate(
       new PairingRegistryDelegateLinux());
   save_delegate->SetRegistryPathForTesting(temp_registry_);
   load_delegate->SetRegistryPathForTesting(temp_registry_);
diff --git a/remoting/host/pairing_registry_delegate_mac.cc b/remoting/host/pairing_registry_delegate_mac.cc
index ef3173a..9d3ae443 100644
--- a/remoting/host/pairing_registry_delegate_mac.cc
+++ b/remoting/host/pairing_registry_delegate_mac.cc
@@ -10,7 +10,7 @@
 
 using protocol::PairingRegistry;
 
-scoped_ptr<PairingRegistry::Delegate> CreatePairingRegistryDelegate() {
+std::unique_ptr<PairingRegistry::Delegate> CreatePairingRegistryDelegate() {
   return nullptr;
 }
 
diff --git a/remoting/host/pairing_registry_delegate_win.cc b/remoting/host/pairing_registry_delegate_win.cc
index d65014e5..d2423c8 100644
--- a/remoting/host/pairing_registry_delegate_win.cc
+++ b/remoting/host/pairing_registry_delegate_win.cc
@@ -8,6 +8,7 @@
 
 #include "base/json/json_string_value_serializer.h"
 #include "base/logging.h"
+#include "base/memory/ptr_util.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/values.h"
 #include "base/win/registry.h"
@@ -38,8 +39,8 @@
 
 // Reads value |value_name| from |key| as a JSON string and returns it as
 // |base::Value|.
-scoped_ptr<base::DictionaryValue> ReadValue(const base::win::RegKey& key,
-                                            const wchar_t* value_name) {
+std::unique_ptr<base::DictionaryValue> ReadValue(const base::win::RegKey& key,
+                                                 const wchar_t* value_name) {
   // presubmit: allow wstring
   std::wstring value_json;
   LONG result = key.ReadValue(value_name, &value_json);
@@ -54,7 +55,7 @@
   JSONStringValueDeserializer deserializer(value_json_utf8);
   int error_code;
   std::string error_message;
-  scoped_ptr<base::Value> value =
+  std::unique_ptr<base::Value> value =
       deserializer.Deserialize(&error_code, &error_message);
   if (!value) {
     LOG(ERROR) << "Failed to parse '" << value_name << "': " << error_message
@@ -67,14 +68,14 @@
     return nullptr;
   }
 
-  return make_scoped_ptr(static_cast<base::DictionaryValue*>(value.release()));
+  return base::WrapUnique(static_cast<base::DictionaryValue*>(value.release()));
 }
 
 // Serializes |value| into a JSON string and writes it as value |value_name|
 // under |key|.
 bool WriteValue(base::win::RegKey& key,
                 const wchar_t* value_name,
-                scoped_ptr<base::DictionaryValue> value) {
+                std::unique_ptr<base::DictionaryValue> value) {
   std::string value_json_utf8;
   JSONStringValueSerializer serializer(&value_json_utf8);
   if (!serializer.Serialize(*value)) {
@@ -121,8 +122,8 @@
   return true;
 }
 
-scoped_ptr<base::ListValue> PairingRegistryDelegateWin::LoadAll() {
-  scoped_ptr<base::ListValue> pairings(new base::ListValue());
+std::unique_ptr<base::ListValue> PairingRegistryDelegateWin::LoadAll() {
+  std::unique_ptr<base::ListValue> pairings(new base::ListValue());
 
   // Enumerate and parse all values under the unprivileged key.
   DWORD count = unprivileged_.GetValueCount();
@@ -186,15 +187,15 @@
   std::wstring value_name = base::UTF8ToWide(client_id);
 
   // Read unprivileged fields first.
-  scoped_ptr<base::DictionaryValue> pairing = ReadValue(unprivileged_,
-                                                        value_name.c_str());
+  std::unique_ptr<base::DictionaryValue> pairing =
+      ReadValue(unprivileged_, value_name.c_str());
   if (!pairing)
     return PairingRegistry::Pairing();
 
   // Read the shared secret.
   if (privileged_.Valid()) {
-    scoped_ptr<base::DictionaryValue> secret = ReadValue(privileged_,
-                                                         value_name.c_str());
+    std::unique_ptr<base::DictionaryValue> secret =
+        ReadValue(privileged_, value_name.c_str());
     if (!secret)
       return PairingRegistry::Pairing();
 
@@ -213,12 +214,13 @@
   }
 
   // Convert pairing to JSON.
-  scoped_ptr<base::DictionaryValue> pairing_json = pairing.ToValue();
+  std::unique_ptr<base::DictionaryValue> pairing_json = pairing.ToValue();
 
   // Extract the shared secret to a separate dictionary.
-  scoped_ptr<base::Value> secret_key;
+  std::unique_ptr<base::Value> secret_key;
   CHECK(pairing_json->Remove(PairingRegistry::kSharedSecretKey, &secret_key));
-  scoped_ptr<base::DictionaryValue> secret_json(new base::DictionaryValue());
+  std::unique_ptr<base::DictionaryValue> secret_json(
+      new base::DictionaryValue());
   secret_json->Set(PairingRegistry::kSharedSecretKey, secret_key.release());
 
   // presubmit: allow wstring
@@ -263,8 +265,8 @@
   return true;
 }
 
-scoped_ptr<PairingRegistry::Delegate> CreatePairingRegistryDelegate() {
-  return make_scoped_ptr(new PairingRegistryDelegateWin());
+std::unique_ptr<PairingRegistry::Delegate> CreatePairingRegistryDelegate() {
+  return base::WrapUnique(new PairingRegistryDelegateWin());
 }
 
 }  // namespace remoting
diff --git a/remoting/host/pairing_registry_delegate_win.h b/remoting/host/pairing_registry_delegate_win.h
index 7d92917..05df334 100644
--- a/remoting/host/pairing_registry_delegate_win.h
+++ b/remoting/host/pairing_registry_delegate_win.h
@@ -5,11 +5,11 @@
 #ifndef REMOTING_PROTOCOL_PAIRING_REGISTRY_DELEGATE_WIN_H_
 #define REMOTING_PROTOCOL_PAIRING_REGISTRY_DELEGATE_WIN_H_
 
+#include <memory>
 #include <string>
 
 #include "base/compiler_specific.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/win/registry.h"
 #include "remoting/protocol/pairing_registry.h"
 
@@ -52,7 +52,7 @@
   bool SetRootKeys(HKEY privileged, HKEY unprivileged);
 
   // PairingRegistry::Delegate interface
-  scoped_ptr<base::ListValue> LoadAll() override;
+  std::unique_ptr<base::ListValue> LoadAll() override;
   bool DeleteAll() override;
   protocol::PairingRegistry::Pairing Load(
       const std::string& client_id) override;
diff --git a/remoting/host/pairing_registry_delegate_win_unittest.cc b/remoting/host/pairing_registry_delegate_win_unittest.cc
index 646bd19..ab73ecc 100644
--- a/remoting/host/pairing_registry_delegate_win_unittest.cc
+++ b/remoting/host/pairing_registry_delegate_win_unittest.cc
@@ -47,7 +47,7 @@
 };
 
 TEST_F(PairingRegistryDelegateWinTest, SaveAndLoad) {
-  scoped_ptr<PairingRegistryDelegateWin> delegate(
+  std::unique_ptr<PairingRegistryDelegateWin> delegate(
       new PairingRegistryDelegateWin());
   delegate->SetRootKeys(privileged_.Handle(), unprivileged_.Handle());
 
@@ -76,7 +76,7 @@
 
   // Verify that the only remaining value is |pairing2|.
   EXPECT_EQ(delegate->LoadAll()->GetSize(), 1u);
-  scoped_ptr<base::ListValue> pairings = delegate->LoadAll();
+  std::unique_ptr<base::ListValue> pairings = delegate->LoadAll();
   base::DictionaryValue* json;
   EXPECT_TRUE(pairings->GetDictionary(0, &json));
   EXPECT_EQ(PairingRegistry::Pairing::CreateFromValue(*json), pairing2);
@@ -88,10 +88,10 @@
 
 // Verifies that the delegate is stateless by using two different instances.
 TEST_F(PairingRegistryDelegateWinTest, Stateless) {
-  scoped_ptr<PairingRegistryDelegateWin> load_delegate(
+  std::unique_ptr<PairingRegistryDelegateWin> load_delegate(
       new PairingRegistryDelegateWin());
   load_delegate->SetRootKeys(privileged_.Handle(), unprivileged_.Handle());
-  scoped_ptr<PairingRegistryDelegateWin> save_delegate(
+  std::unique_ptr<PairingRegistryDelegateWin> save_delegate(
       new PairingRegistryDelegateWin());
   save_delegate->SetRootKeys(privileged_.Handle(), unprivileged_.Handle());
 
@@ -101,7 +101,7 @@
 }
 
 TEST_F(PairingRegistryDelegateWinTest, Unprivileged) {
-  scoped_ptr<PairingRegistryDelegateWin> delegate(
+  std::unique_ptr<PairingRegistryDelegateWin> delegate(
       new PairingRegistryDelegateWin());
   delegate->SetRootKeys(privileged_.Handle(), unprivileged_.Handle());
 
diff --git a/remoting/host/pam_authorization_factory_posix.cc b/remoting/host/pam_authorization_factory_posix.cc
index 2ae1eb3..40c1c30 100644
--- a/remoting/host/pam_authorization_factory_posix.cc
+++ b/remoting/host/pam_authorization_factory_posix.cc
@@ -11,6 +11,7 @@
 #include "base/bind.h"
 #include "base/callback.h"
 #include "base/environment.h"
+#include "base/memory/ptr_util.h"
 #include "remoting/base/logging.h"
 #include "remoting/host/username.h"
 #include "remoting/protocol/channel_authenticator.h"
@@ -21,7 +22,7 @@
 namespace {
 class PamAuthorizer : public protocol::Authenticator {
  public:
-  PamAuthorizer(scoped_ptr<protocol::Authenticator> underlying);
+  PamAuthorizer(std::unique_ptr<protocol::Authenticator> underlying);
   ~PamAuthorizer() override;
 
   // protocol::Authenticator interface.
@@ -30,9 +31,9 @@
   RejectionReason rejection_reason() const override;
   void ProcessMessage(const buzz::XmlElement* message,
                       const base::Closure& resume_callback) override;
-  scoped_ptr<buzz::XmlElement> GetNextMessage() override;
+  std::unique_ptr<buzz::XmlElement> GetNextMessage() override;
   const std::string& GetAuthKey() const override;
-  scoped_ptr<protocol::ChannelAuthenticator> CreateChannelAuthenticator()
+  std::unique_ptr<protocol::ChannelAuthenticator> CreateChannelAuthenticator()
       const override;
 
  private:
@@ -45,13 +46,14 @@
                              struct pam_response** responses,
                              void* context);
 
-  scoped_ptr<protocol::Authenticator> underlying_;
+  std::unique_ptr<protocol::Authenticator> underlying_;
   enum { NOT_CHECKED, ALLOWED, DISALLOWED } local_login_status_;
 };
 
 }  // namespace
 
-PamAuthorizer::PamAuthorizer(scoped_ptr<protocol::Authenticator> underlying)
+PamAuthorizer::PamAuthorizer(
+    std::unique_ptr<protocol::Authenticator> underlying)
     : underlying_(std::move(underlying)), local_login_status_(NOT_CHECKED) {}
 
 PamAuthorizer::~PamAuthorizer() {}
@@ -90,8 +92,8 @@
   resume_callback.Run();
 }
 
-scoped_ptr<buzz::XmlElement> PamAuthorizer::GetNextMessage() {
-  scoped_ptr<buzz::XmlElement> result(underlying_->GetNextMessage());
+std::unique_ptr<buzz::XmlElement> PamAuthorizer::GetNextMessage() {
+  std::unique_ptr<buzz::XmlElement> result(underlying_->GetNextMessage());
   MaybeCheckLocalLogin();
   return result;
 }
@@ -100,7 +102,7 @@
   return underlying_->GetAuthKey();
 }
 
-scoped_ptr<protocol::ChannelAuthenticator>
+std::unique_ptr<protocol::ChannelAuthenticator>
 PamAuthorizer::CreateChannelAuthenticator() const {
   return underlying_->CreateChannelAuthenticator();
 }
@@ -161,17 +163,17 @@
 }
 
 PamAuthorizationFactory::PamAuthorizationFactory(
-    scoped_ptr<protocol::AuthenticatorFactory> underlying)
+    std::unique_ptr<protocol::AuthenticatorFactory> underlying)
     : underlying_(std::move(underlying)) {}
 
 PamAuthorizationFactory::~PamAuthorizationFactory() {}
 
-scoped_ptr<protocol::Authenticator>
+std::unique_ptr<protocol::Authenticator>
 PamAuthorizationFactory::CreateAuthenticator(const std::string& local_jid,
                                              const std::string& remote_jid) {
-  scoped_ptr<protocol::Authenticator> authenticator(
+  std::unique_ptr<protocol::Authenticator> authenticator(
       underlying_->CreateAuthenticator(local_jid, remote_jid));
-  return make_scoped_ptr(new PamAuthorizer(std::move(authenticator)));
+  return base::WrapUnique(new PamAuthorizer(std::move(authenticator)));
 }
 
 }  // namespace remoting
diff --git a/remoting/host/pam_authorization_factory_posix.h b/remoting/host/pam_authorization_factory_posix.h
index bc35a2b..f9dd0386 100644
--- a/remoting/host/pam_authorization_factory_posix.h
+++ b/remoting/host/pam_authorization_factory_posix.h
@@ -5,9 +5,10 @@
 #ifndef REMOTING_HOST_PAM_AUTHORIZATION_FACTORY_POSIX_H_
 #define REMOTING_HOST_PAM_AUTHORIZATION_FACTORY_POSIX_H_
 
+#include <memory>
+
 #include "remoting/protocol/authenticator.h"
 
-#include "base/memory/scoped_ptr.h"
 
 // PamAuthorizationFactory abuses the AuthenticatorFactory interface to apply
 // PAM-based authorization on top of some underlying authentication scheme.
@@ -17,15 +18,15 @@
 class PamAuthorizationFactory : public protocol::AuthenticatorFactory {
  public:
   PamAuthorizationFactory(
-      scoped_ptr<protocol::AuthenticatorFactory> underlying);
+      std::unique_ptr<protocol::AuthenticatorFactory> underlying);
   ~PamAuthorizationFactory() override;
 
-  scoped_ptr<protocol::Authenticator> CreateAuthenticator(
+  std::unique_ptr<protocol::Authenticator> CreateAuthenticator(
       const std::string& local_jid,
       const std::string& remote_jid) override;
 
  private:
-  scoped_ptr<protocol::AuthenticatorFactory> underlying_;
+  std::unique_ptr<protocol::AuthenticatorFactory> underlying_;
 };
 
 }  // namespace remoting
diff --git a/remoting/host/policy_watcher.cc b/remoting/host/policy_watcher.cc
index 3c3cfb5..a630ba2 100644
--- a/remoting/host/policy_watcher.cc
+++ b/remoting/host/policy_watcher.cc
@@ -13,6 +13,7 @@
 #include "base/compiler_specific.h"
 #include "base/files/file_path.h"
 #include "base/location.h"
+#include "base/memory/ptr_util.h"
 #include "base/single_thread_task_runner.h"
 #include "base/values.h"
 #include "build/build_config.h"
@@ -48,10 +49,10 @@
 
 // Copies all policy values from one dictionary to another, using values from
 // |default_values| if they are not set in |from|.
-scoped_ptr<base::DictionaryValue> CopyValuesAndAddDefaults(
+std::unique_ptr<base::DictionaryValue> CopyValuesAndAddDefaults(
     const base::DictionaryValue& from,
     const base::DictionaryValue& default_values) {
-  scoped_ptr<base::DictionaryValue> to(default_values.DeepCopy());
+  std::unique_ptr<base::DictionaryValue> to(default_values.DeepCopy());
   for (base::DictionaryValue::Iterator i(default_values); !i.IsAtEnd();
        i.Advance()) {
     const base::Value* value = nullptr;
@@ -72,22 +73,23 @@
   return policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, std::string());
 }
 
-scoped_ptr<policy::SchemaRegistry> CreateSchemaRegistry() {
+std::unique_ptr<policy::SchemaRegistry> CreateSchemaRegistry() {
   // TODO(lukasza): Schema below should ideally only cover Chromoting-specific
   // policies (expecting perf and maintanability improvement, but no functional
   // impact).
   policy::Schema schema = policy::Schema::Wrap(policy::GetChromeSchemaData());
 
-  scoped_ptr<policy::SchemaRegistry> schema_registry(
+  std::unique_ptr<policy::SchemaRegistry> schema_registry(
       new policy::SchemaRegistry());
   schema_registry->RegisterComponent(GetPolicyNamespace(), schema);
   return schema_registry;
 }
 
-scoped_ptr<base::DictionaryValue> CopyChromotingPoliciesIntoDictionary(
+std::unique_ptr<base::DictionaryValue> CopyChromotingPoliciesIntoDictionary(
     const policy::PolicyMap& current) {
   const char kPolicyNameSubstring[] = "RemoteAccessHost";
-  scoped_ptr<base::DictionaryValue> policy_dict(new base::DictionaryValue());
+  std::unique_ptr<base::DictionaryValue> policy_dict(
+      new base::DictionaryValue());
   for (auto it = current.begin(); it != current.end(); ++it) {
     const std::string& key = it->first;
     const base::Value* value = it->second.value;
@@ -163,9 +165,9 @@
 
 PolicyWatcher::PolicyWatcher(
     policy::PolicyService* policy_service,
-    scoped_ptr<policy::PolicyService> owned_policy_service,
-    scoped_ptr<policy::ConfigurationPolicyProvider> owned_policy_provider,
-    scoped_ptr<policy::SchemaRegistry> owned_schema_registry)
+    std::unique_ptr<policy::PolicyService> owned_policy_service,
+    std::unique_ptr<policy::ConfigurationPolicyProvider> owned_policy_provider,
+    std::unique_ptr<policy::SchemaRegistry> owned_schema_registry)
     : old_policies_(new base::DictionaryValue()),
       default_values_(new base::DictionaryValue()),
       policy_service_(policy_service),
@@ -246,11 +248,11 @@
 }
 }  // namespace
 
-scoped_ptr<base::DictionaryValue>
+std::unique_ptr<base::DictionaryValue>
 PolicyWatcher::StoreNewAndReturnChangedPolicies(
-    scoped_ptr<base::DictionaryValue> new_policies) {
+    std::unique_ptr<base::DictionaryValue> new_policies) {
   // Find the changed policies.
-  scoped_ptr<base::DictionaryValue> changed_policies(
+  std::unique_ptr<base::DictionaryValue> changed_policies(
       new base::DictionaryValue());
   base::DictionaryValue::Iterator iter(*new_policies);
   while (!iter.IsAtEnd()) {
@@ -284,7 +286,7 @@
 void PolicyWatcher::OnPolicyUpdated(const policy::PolicyNamespace& ns,
                                     const policy::PolicyMap& previous,
                                     const policy::PolicyMap& current) {
-  scoped_ptr<base::DictionaryValue> new_policies =
+  std::unique_ptr<base::DictionaryValue> new_policies =
       CopyChromotingPoliciesIntoDictionary(current);
 
   // Check for mistyped values and get rid of unknown policies.
@@ -294,11 +296,11 @@
   }
 
   // Use default values for any missing policies.
-  scoped_ptr<base::DictionaryValue> filled_policies =
+  std::unique_ptr<base::DictionaryValue> filled_policies =
       CopyValuesAndAddDefaults(*new_policies, *default_values_);
 
   // Limit reporting to only the policies that were changed.
-  scoped_ptr<base::DictionaryValue> changed_policies =
+  std::unique_ptr<base::DictionaryValue> changed_policies =
       StoreNewAndReturnChangedPolicies(std::move(filled_policies));
   if (changed_policies->empty()) {
     return;
@@ -320,40 +322,41 @@
   OnPolicyUpdated(ns, current, current);
 }
 
-scoped_ptr<PolicyWatcher> PolicyWatcher::CreateFromPolicyLoader(
-    scoped_ptr<policy::AsyncPolicyLoader> async_policy_loader) {
-  scoped_ptr<policy::SchemaRegistry> schema_registry = CreateSchemaRegistry();
-  scoped_ptr<policy::AsyncPolicyProvider> policy_provider(
+std::unique_ptr<PolicyWatcher> PolicyWatcher::CreateFromPolicyLoader(
+    std::unique_ptr<policy::AsyncPolicyLoader> async_policy_loader) {
+  std::unique_ptr<policy::SchemaRegistry> schema_registry =
+      CreateSchemaRegistry();
+  std::unique_ptr<policy::AsyncPolicyProvider> policy_provider(
       new policy::AsyncPolicyProvider(schema_registry.get(),
                                       std::move(async_policy_loader)));
   policy_provider->Init(schema_registry.get());
 
   policy::PolicyServiceImpl::Providers providers;
   providers.push_back(policy_provider.get());
-  scoped_ptr<policy::PolicyService> policy_service(
+  std::unique_ptr<policy::PolicyService> policy_service(
       new policy::PolicyServiceImpl(providers));
 
   policy::PolicyService* borrowed_policy_service = policy_service.get();
-  return make_scoped_ptr(new PolicyWatcher(
+  return base::WrapUnique(new PolicyWatcher(
       borrowed_policy_service, std::move(policy_service),
       std::move(policy_provider), std::move(schema_registry)));
 }
 
-scoped_ptr<PolicyWatcher> PolicyWatcher::Create(
+std::unique_ptr<PolicyWatcher> PolicyWatcher::Create(
     policy::PolicyService* policy_service,
     const scoped_refptr<base::SingleThreadTaskRunner>& file_task_runner) {
 #if defined(OS_CHROMEOS)
   // On Chrome OS the PolicyService is owned by the browser.
   DCHECK(policy_service);
-  return make_scoped_ptr(new PolicyWatcher(policy_service, nullptr, nullptr,
-                                           CreateSchemaRegistry()));
+  return base::WrapUnique(new PolicyWatcher(policy_service, nullptr, nullptr,
+                                            CreateSchemaRegistry()));
 #else  // !defined(OS_CHROMEOS)
   DCHECK(!policy_service);
 
   // Create platform-specific PolicyLoader. Always read the Chrome policies
   // (even on Chromium) so that policy enforcement can't be bypassed by running
   // Chromium.
-  scoped_ptr<policy::AsyncPolicyLoader> policy_loader;
+  std::unique_ptr<policy::AsyncPolicyLoader> policy_loader;
 #if defined(OS_WIN)
   policy_loader.reset(new policy::PolicyLoaderWin(
       file_task_runner, L"SOFTWARE\\Policies\\Google\\Chrome",
diff --git a/remoting/host/policy_watcher.h b/remoting/host/policy_watcher.h
index 1cd5833..e3f54f6 100644
--- a/remoting/host/policy_watcher.h
+++ b/remoting/host/policy_watcher.h
@@ -5,10 +5,11 @@
 #ifndef REMOTING_HOST_POLICY_WATCHER_H_
 #define REMOTING_HOST_POLICY_WATCHER_H_
 
+#include <memory>
+
 #include "base/callback.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/threading/non_thread_safe.h"
 #include "components/policy/core/common/policy_service.h"
 
@@ -31,7 +32,7 @@
                       public base::NonThreadSafe {
  public:
   // Called first with all policies, and subsequently with any changed policies.
-  typedef base::Callback<void(scoped_ptr<base::DictionaryValue>)>
+  typedef base::Callback<void(std::unique_ptr<base::DictionaryValue>)>
       PolicyUpdatedCallback;
 
   // Called after detecting malformed policies.
@@ -73,7 +74,7 @@
   // policy from files / registry / preferences (although (2) is just an
   // implementation detail and should likely be ignored outside of
   // PolicyWatcher).
-  static scoped_ptr<PolicyWatcher> Create(
+  static std::unique_ptr<PolicyWatcher> Create(
       policy::PolicyService* policy_service,
       const scoped_refptr<base::SingleThreadTaskRunner>& file_task_runner);
 
@@ -91,8 +92,8 @@
 
   // Stores |new_policies| into |old_policies_|.  Returns dictionary with items
   // from |new_policies| that are different from the old |old_policies_|.
-  scoped_ptr<base::DictionaryValue> StoreNewAndReturnChangedPolicies(
-      scoped_ptr<base::DictionaryValue> new_policies);
+  std::unique_ptr<base::DictionaryValue> StoreNewAndReturnChangedPolicies(
+      std::unique_ptr<base::DictionaryValue> new_policies);
 
   // Signals policy error to the registered |PolicyErrorCallback|.
   void SignalPolicyError();
@@ -100,19 +101,19 @@
   // |policy_service_task_runner| is the task runner where it is safe
   // to call |policy_service_| methods and where we expect to get callbacks
   // from |policy_service_|.
-  PolicyWatcher(
-      policy::PolicyService* policy_service,
-      scoped_ptr<policy::PolicyService> owned_policy_service,
-      scoped_ptr<policy::ConfigurationPolicyProvider> owned_policy_provider,
-      scoped_ptr<policy::SchemaRegistry> owned_schema_registry);
+  PolicyWatcher(policy::PolicyService* policy_service,
+                std::unique_ptr<policy::PolicyService> owned_policy_service,
+                std::unique_ptr<policy::ConfigurationPolicyProvider>
+                    owned_policy_provider,
+                std::unique_ptr<policy::SchemaRegistry> owned_schema_registry);
 
   // Creates PolicyWatcher that wraps the owned |async_policy_loader| with an
   // appropriate PolicySchema.
   //
   // |policy_service_task_runner| is passed through to the constructor of
   // PolicyWatcher.
-  static scoped_ptr<PolicyWatcher> CreateFromPolicyLoader(
-      scoped_ptr<policy::AsyncPolicyLoader> async_policy_loader);
+  static std::unique_ptr<PolicyWatcher> CreateFromPolicyLoader(
+      std::unique_ptr<policy::AsyncPolicyLoader> async_policy_loader);
 
   // PolicyService::Observer interface.
   void OnPolicyUpdated(const policy::PolicyNamespace& ns,
@@ -123,8 +124,8 @@
   PolicyUpdatedCallback policy_updated_callback_;
   PolicyErrorCallback policy_error_callback_;
 
-  scoped_ptr<base::DictionaryValue> old_policies_;
-  scoped_ptr<base::DictionaryValue> default_values_;
+  std::unique_ptr<base::DictionaryValue> old_policies_;
+  std::unique_ptr<base::DictionaryValue> default_values_;
 
   policy::PolicyService* policy_service_;
 
@@ -132,9 +133,9 @@
   // dependencies into account:
   // - |owned_policy_service_| uses |owned_policy_provider_|
   // - |owned_policy_provider_| uses |owned_schema_registry_|
-  scoped_ptr<policy::SchemaRegistry> owned_schema_registry_;
-  scoped_ptr<policy::ConfigurationPolicyProvider> owned_policy_provider_;
-  scoped_ptr<policy::PolicyService> owned_policy_service_;
+  std::unique_ptr<policy::SchemaRegistry> owned_schema_registry_;
+  std::unique_ptr<policy::ConfigurationPolicyProvider> owned_policy_provider_;
+  std::unique_ptr<policy::PolicyService> owned_policy_service_;
 
   DISALLOW_COPY_AND_ASSIGN(PolicyWatcher);
 };
diff --git a/remoting/host/policy_watcher_unittest.cc b/remoting/host/policy_watcher_unittest.cc
index 8802190..07e458b 100644
--- a/remoting/host/policy_watcher_unittest.cc
+++ b/remoting/host/policy_watcher_unittest.cc
@@ -2,9 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "remoting/host/policy_watcher.h"
+
 #include "base/bind.h"
 #include "base/json/json_writer.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
 #include "base/single_thread_task_runner.h"
@@ -15,7 +18,6 @@
 #include "components/policy/core/common/fake_async_policy_loader.h"
 #include "policy/policy_constants.h"
 #include "remoting/host/dns_blackhole_checker.h"
-#include "remoting/host/policy_watcher.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
@@ -45,9 +47,9 @@
  public:
   MockPolicyCallback(){};
 
-  // TODO(lukasza): gmock cannot mock a method taking scoped_ptr<T>...
+  // TODO(lukasza): gmock cannot mock a method taking std::unique_ptr<T>...
   MOCK_METHOD1(OnPolicyUpdatePtr, void(const base::DictionaryValue* policies));
-  void OnPolicyUpdate(scoped_ptr<base::DictionaryValue> policies) {
+  void OnPolicyUpdate(std::unique_ptr<base::DictionaryValue> policies) {
     OnPolicyUpdatePtr(policies.get());
   }
 
@@ -70,7 +72,7 @@
     policy_loader_ =
         new policy::FakeAsyncPolicyLoader(base::ThreadTaskRunnerHandle::Get());
     policy_watcher_ =
-        PolicyWatcher::CreateFromPolicyLoader(make_scoped_ptr(policy_loader_));
+        PolicyWatcher::CreateFromPolicyLoader(base::WrapUnique(policy_loader_));
 
     nat_true_.SetBoolean(key::kRemoteAccessHostFirewallTraversal, true);
     nat_false_.SetBoolean(key::kRemoteAccessHostFirewallTraversal, false);
@@ -199,7 +201,7 @@
   // a raw pointer to |policy_loader_| in order to control the simulated / faked
   // policy contents.
   policy::FakeAsyncPolicyLoader* policy_loader_;
-  scoped_ptr<PolicyWatcher> policy_watcher_;
+  std::unique_ptr<PolicyWatcher> policy_watcher_;
 
   base::DictionaryValue empty_;
   base::DictionaryValue nat_true_;
diff --git a/remoting/host/register_support_host_request.cc b/remoting/host/register_support_host_request.cc
index 01955a6..48d42279 100644
--- a/remoting/host/register_support_host_request.cc
+++ b/remoting/host/register_support_host_request.cc
@@ -81,10 +81,10 @@
   return false;
 }
 
-scoped_ptr<XmlElement> RegisterSupportHostRequest::CreateRegistrationRequest(
-    const std::string& jid) {
-  scoped_ptr<XmlElement> query(new XmlElement(
-      QName(kChromotingXmlNamespace, kRegisterQueryTag)));
+std::unique_ptr<XmlElement>
+RegisterSupportHostRequest::CreateRegistrationRequest(const std::string& jid) {
+  std::unique_ptr<XmlElement> query(
+      new XmlElement(QName(kChromotingXmlNamespace, kRegisterQueryTag)));
   XmlElement* public_key = new XmlElement(
       QName(kChromotingXmlNamespace, kPublicKeyTag));
   public_key->AddText(key_pair_->GetPublicKey());
@@ -93,10 +93,10 @@
   return query;
 }
 
-scoped_ptr<XmlElement> RegisterSupportHostRequest::CreateSignature(
+std::unique_ptr<XmlElement> RegisterSupportHostRequest::CreateSignature(
     const std::string& jid) {
-  scoped_ptr<XmlElement> signature_tag(new XmlElement(
-      QName(kChromotingXmlNamespace, kSignatureTag)));
+  std::unique_ptr<XmlElement> signature_tag(
+      new XmlElement(QName(kChromotingXmlNamespace, kSignatureTag)));
 
   int64_t time = static_cast<int64_t>(base::Time::Now().ToDoubleT());
   std::string time_str(base::Int64ToString(time));
diff --git a/remoting/host/register_support_host_request.h b/remoting/host/register_support_host_request.h
index b249883..63f155f 100644
--- a/remoting/host/register_support_host_request.h
+++ b/remoting/host/register_support_host_request.h
@@ -5,12 +5,12 @@
 #ifndef REMOTING_HOST_REGISTER_SUPPORT_HOST_REQUEST_H_
 #define REMOTING_HOST_REGISTER_SUPPORT_HOST_REQUEST_H_
 
+#include <memory>
 #include <string>
 
 #include "base/callback.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "remoting/base/rsa_key_pair.h"
 #include "remoting/signaling/signal_strategy.h"
 #include "testing/gtest/include/gtest/gtest_prod.h"
@@ -61,9 +61,9 @@
  private:
   void DoSend();
 
-  scoped_ptr<buzz::XmlElement> CreateRegistrationRequest(
+  std::unique_ptr<buzz::XmlElement> CreateRegistrationRequest(
       const std::string& jid);
-  scoped_ptr<buzz::XmlElement> CreateSignature(const std::string& jid);
+  std::unique_ptr<buzz::XmlElement> CreateSignature(const std::string& jid);
 
   void ProcessResponse(IqRequest* request, const buzz::XmlElement* response);
   void ParseResponse(const buzz::XmlElement* response,
@@ -79,8 +79,8 @@
   std::string directory_bot_jid_;
   RegisterCallback callback_;
 
-  scoped_ptr<IqSender> iq_sender_;
-  scoped_ptr<IqRequest> request_;
+  std::unique_ptr<IqSender> iq_sender_;
+  std::unique_ptr<IqRequest> request_;
 
   DISALLOW_COPY_AND_ASSIGN(RegisterSupportHostRequest);
 };
diff --git a/remoting/host/register_support_host_request_unittest.cc b/remoting/host/register_support_host_request_unittest.cc
index 30420b5f..9bcfb9d 100644
--- a/remoting/host/register_support_host_request_unittest.cc
+++ b/remoting/host/register_support_host_request_unittest.cc
@@ -83,11 +83,10 @@
   // |iq_request| is freed by RegisterSupportHostRequest.
   int64_t start_time = static_cast<int64_t>(base::Time::Now().ToDoubleT());
 
-  scoped_ptr<RegisterSupportHostRequest> request(
-      new RegisterSupportHostRequest(&signal_strategy_, key_pair_,
-                                     kTestBotJid,
-                                     base::Bind(&MockCallback::OnResponse,
-                                                base::Unretained(&callback_))));
+  std::unique_ptr<RegisterSupportHostRequest> request(
+      new RegisterSupportHostRequest(
+          &signal_strategy_, key_pair_, kTestBotJid,
+          base::Bind(&MockCallback::OnResponse, base::Unretained(&callback_))));
 
   XmlElement* sent_iq = nullptr;
   EXPECT_CALL(signal_strategy_, GetNextId())
@@ -99,7 +98,7 @@
   base::RunLoop().RunUntilIdle();
 
   // Verify format of the query.
-  scoped_ptr<XmlElement> stanza(sent_iq);
+  std::unique_ptr<XmlElement> stanza(sent_iq);
   ASSERT_TRUE(stanza != nullptr);
 
   EXPECT_EQ(stanza->Attr(buzz::QName(std::string(), "to")),
@@ -134,7 +133,7 @@
                                     base::TimeDelta::FromSeconds(300),
                                     ""));
 
-  scoped_ptr<XmlElement> response(new XmlElement(buzz::QN_IQ));
+  std::unique_ptr<XmlElement> response(new XmlElement(buzz::QN_IQ));
   response->AddAttr(QName(std::string(), "from"), kTestBotJid);
   response->AddAttr(QName(std::string(), "type"), "result");
   response->AddAttr(QName(std::string(), "id"), kStanzaId);
diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc
index e2a667fca..9e9393e0 100644
--- a/remoting/host/remoting_me2me_host.cc
+++ b/remoting/host/remoting_me2me_host.cc
@@ -7,6 +7,7 @@
 #include <stddef.h>
 #include <stdint.h>
 
+#include <memory>
 #include <string>
 #include <utility>
 
@@ -17,7 +18,7 @@
 #include "base/files/file_path.h"
 #include "base/files/file_util.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
 #include "base/message_loop/message_loop.h"
 #include "base/single_thread_task_runner.h"
 #include "base/strings/string_number_conversions.h"
@@ -202,12 +203,12 @@
     done_ = true;
     resume_callback.Run();
   }
-  scoped_ptr<buzz::XmlElement> GetNextMessage() override {
+  std::unique_ptr<buzz::XmlElement> GetNextMessage() override {
     NOTREACHED();
     return nullptr;
   }
   const std::string& GetAuthKey() const override { return auth_key_; }
-  scoped_ptr<protocol::ChannelAuthenticator> CreateChannelAuthenticator()
+  std::unique_ptr<protocol::ChannelAuthenticator> CreateChannelAuthenticator()
       const override {
     NOTREACHED();
     return nullptr;
@@ -224,10 +225,10 @@
   NoopAuthenticatorFactory() {}
   ~NoopAuthenticatorFactory() override {}
 
-  scoped_ptr<protocol::Authenticator> CreateAuthenticator(
+  std::unique_ptr<protocol::Authenticator> CreateAuthenticator(
       const std::string& local_jid,
       const std::string& remote_jid) override {
-    return make_scoped_ptr(new NoopAuthenticator());
+    return base::WrapUnique(new NoopAuthenticator());
   }
 };
 
@@ -241,7 +242,7 @@
   // |shutdown_watchdog| is armed when shutdown is started, and should be kept
   // alive as long as possible until the process exits (since destroying the
   // watchdog disarms it).
-  HostProcess(scoped_ptr<ChromotingHostContext> context,
+  HostProcess(std::unique_ptr<ChromotingHostContext> context,
               int* exit_code_out,
               ShutdownWatchdog* shutdown_watchdog);
 
@@ -330,7 +331,7 @@
   bool ApplyConfig(const base::DictionaryValue& config);
 
   // Handles policy updates, by calling On*PolicyUpdate methods.
-  void OnPolicyUpdate(scoped_ptr<base::DictionaryValue> policies);
+  void OnPolicyUpdate(std::unique_ptr<base::DictionaryValue> policies);
   void OnPolicyError();
   void ReportPolicyErrorAndRestartHost();
   void ApplyHostDomainPolicy();
@@ -381,7 +382,7 @@
                const std::string& file_name,
                const int& line_number);
 
-  scoped_ptr<ChromotingHostContext> context_;
+  std::unique_ptr<ChromotingHostContext> context_;
 
   // XMPP server/remoting bot configuration (initialized from the command line).
   XmppSignalStrategy::XmppServerConfig xmpp_server_config_;
@@ -390,12 +391,12 @@
   // Created on the UI thread but used from the network thread.
   base::FilePath host_config_path_;
   std::string host_config_;
-  scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory_;
+  std::unique_ptr<DesktopEnvironmentFactory> desktop_environment_factory_;
 
   // Accessed on the network thread.
   HostState state_ = HOST_STARTING;
 
-  scoped_ptr<ConfigWatcher> config_watcher_;
+  std::unique_ptr<ConfigWatcher> config_watcher_;
 
   std::string host_id_;
   std::string pin_hash_;
@@ -407,7 +408,7 @@
   bool use_service_account_ = false;
   bool enable_vp9_ = false;
 
-  scoped_ptr<PolicyWatcher> policy_watcher_;
+  std::unique_ptr<PolicyWatcher> policy_watcher_;
   PolicyState policy_state_ = POLICY_INITIALIZING;
   std::string client_domain_;
   std::string host_domain_;
@@ -431,31 +432,32 @@
   webrtc::WindowId window_id_ = 0;
 
   // Must outlive |gcd_state_updater_| and |signaling_connector_|.
-  scoped_ptr<OAuthTokenGetter> oauth_token_getter_;
+  std::unique_ptr<OAuthTokenGetter> oauth_token_getter_;
 
   // Must outlive |signaling_connector_|, |gcd_subscriber_|, and
   // |heartbeat_sender_|.
-  scoped_ptr<SignalStrategy> signal_strategy_;
+  std::unique_ptr<SignalStrategy> signal_strategy_;
 
-  scoped_ptr<SignalingConnector> signaling_connector_;
-  scoped_ptr<HeartbeatSender> heartbeat_sender_;
+  std::unique_ptr<SignalingConnector> signaling_connector_;
+  std::unique_ptr<HeartbeatSender> heartbeat_sender_;
 #if defined(USE_GCD)
-  scoped_ptr<GcdStateUpdater> gcd_state_updater_;
-  scoped_ptr<PushNotificationSubscriber> gcd_subscriber_;
+  std::unique_ptr<GcdStateUpdater> gcd_state_updater_;
+  std::unique_ptr<PushNotificationSubscriber> gcd_subscriber_;
 #endif  // defined(USE_GCD)
 
-  scoped_ptr<HostChangeNotificationListener> host_change_notification_listener_;
-  scoped_ptr<HostStatusLogger> host_status_logger_;
-  scoped_ptr<HostEventLogger> host_event_logger_;
+  std::unique_ptr<HostChangeNotificationListener>
+      host_change_notification_listener_;
+  std::unique_ptr<HostStatusLogger> host_status_logger_;
+  std::unique_ptr<HostEventLogger> host_event_logger_;
 
-  scoped_ptr<ChromotingHost> host_;
+  std::unique_ptr<ChromotingHost> host_;
 
   // Used to keep this HostProcess alive until it is shutdown.
   scoped_refptr<HostProcess> self_;
 
 #if defined(REMOTING_MULTI_PROCESS)
   // Accessed on the UI thread.
-  scoped_ptr<IPC::ChannelProxy> daemon_channel_;
+  std::unique_ptr<IPC::ChannelProxy> daemon_channel_;
 
   // Owned as |desktop_environment_factory_|.
   DesktopSessionConnector* desktop_session_connector_ = nullptr;
@@ -471,7 +473,7 @@
   DISALLOW_COPY_AND_ASSIGN(HostProcess);
 };
 
-HostProcess::HostProcess(scoped_ptr<ChromotingHostContext> context,
+HostProcess::HostProcess(std::unique_ptr<ChromotingHostContext> context,
                          int* exit_code_out,
                          ShutdownWatchdog* shutdown_watchdog)
     : context_(std::move(context)),
@@ -536,7 +538,7 @@
     // Read config from stdin if necessary.
     if (host_config_path_ == base::FilePath(kStdinConfigPath)) {
       const size_t kBufferSize = 4096;
-      scoped_ptr<char[]> buf(new char[kBufferSize]);
+      std::unique_ptr<char[]> buf(new char[kBufferSize]);
       size_t len;
       while ((len = fread(buf.get(), 1, kBufferSize, stdin)) > 0) {
         host_config_.append(buf.get(), len);
@@ -611,7 +613,7 @@
   HOST_LOG << "Processing new host configuration.";
 
   serialized_config_ = serialized_config;
-  scoped_ptr<base::DictionaryValue> config(
+  std::unique_ptr<base::DictionaryValue> config(
       HostConfigFromJson(serialized_config));
   if (!config) {
     LOG(ERROR) << "Invalid configuration.";
@@ -740,7 +742,7 @@
     ShutdownHost(kInitializationFailed);
 #else  // defined(NDEBUG)
     host_->SetAuthenticatorFactory(
-        make_scoped_ptr(new NoopAuthenticatorFactory()));
+        base::WrapUnique(new NoopAuthenticatorFactory()));
 #endif  // !defined(NDEBUG)
     return;
   }
@@ -752,7 +754,7 @@
     return;
   }
 
-  scoped_ptr<protocol::AuthenticatorFactory> factory;
+  std::unique_ptr<protocol::AuthenticatorFactory> factory;
 
   if (third_party_auth_config_.is_null()) {
     scoped_refptr<PairingRegistry> pairing_registry;
@@ -761,7 +763,7 @@
       // InitializePairingRegistry().
 #if !defined(OS_WIN)
       if (!pairing_registry_) {
-        scoped_ptr<PairingRegistry::Delegate> delegate =
+        std::unique_ptr<PairingRegistry::Delegate> delegate =
             CreatePairingRegistryDelegate();
 
         if (delegate)
@@ -976,7 +978,7 @@
   HKEY unprivileged_hkey = reinterpret_cast<HKEY>(
       IPC::PlatformFileForTransitToPlatformFile(unprivileged_key));
 
-  scoped_ptr<PairingRegistryDelegateWin> delegate(
+  std::unique_ptr<PairingRegistryDelegateWin> delegate(
       new PairingRegistryDelegateWin());
   delegate->SetRootKeys(privileged_hkey, unprivileged_hkey);
 
@@ -1050,7 +1052,8 @@
   return true;
 }
 
-void HostProcess::OnPolicyUpdate(scoped_ptr<base::DictionaryValue> policies) {
+void HostProcess::OnPolicyUpdate(
+    std::unique_ptr<base::DictionaryValue> policies) {
   if (!context_->network_task_runner()->BelongsToCurrentThread()) {
     context_->network_task_runner()->PostTask(
         FROM_HERE, base::Bind(&HostProcess::OnPolicyUpdate, this,
@@ -1391,9 +1394,10 @@
   signal_strategy_.reset(xmpp_signal_strategy);
 
   // Create SignalingConnector.
-  scoped_ptr<DnsBlackholeChecker> dns_blackhole_checker(new DnsBlackholeChecker(
-      context_->url_request_context_getter(), talkgadget_prefix_));
-  scoped_ptr<OAuthTokenGetter::OAuthCredentials> oauth_credentials(
+  std::unique_ptr<DnsBlackholeChecker> dns_blackhole_checker(
+      new DnsBlackholeChecker(context_->url_request_context_getter(),
+                              talkgadget_prefix_));
+  std::unique_ptr<OAuthTokenGetter::OAuthCredentials> oauth_credentials(
       new OAuthTokenGetter::OAuthCredentials(xmpp_server_config_.username,
                                              oauth_refresh_token_,
                                              use_service_account_));
@@ -1408,7 +1412,7 @@
 #if defined(USE_GCD)
   // Create objects to manage GCD state.
   ServiceUrls* service_urls = ServiceUrls::GetInstance();
-  scoped_ptr<GcdRestClient> gcd_rest_client(new GcdRestClient(
+  std::unique_ptr<GcdRestClient> gcd_rest_client(new GcdRestClient(
       service_urls->gcd_base_url(), host_id_,
       context_->url_request_context_getter(), oauth_token_getter_.get()));
   gcd_state_updater_.reset(new GcdStateUpdater(
@@ -1475,17 +1479,17 @@
   scoped_refptr<protocol::TransportContext> transport_context =
       new protocol::TransportContext(
           signal_strategy_.get(),
-          make_scoped_ptr(new protocol::ChromiumPortAllocatorFactory()),
-          make_scoped_ptr(new ChromiumUrlRequestFactory(
+          base::WrapUnique(new protocol::ChromiumPortAllocatorFactory()),
+          base::WrapUnique(new ChromiumUrlRequestFactory(
               context_->url_request_context_getter())),
           network_settings, protocol::TransportRole::SERVER);
   transport_context->set_ice_config_url(
       ServiceUrls::GetInstance()->ice_config_url());
 
-  scoped_ptr<protocol::SessionManager> session_manager(
+  std::unique_ptr<protocol::SessionManager> session_manager(
       new protocol::JingleSessionManager(signal_strategy_.get()));
 
-  scoped_ptr<protocol::CandidateSessionConfig> protocol_config =
+  std::unique_ptr<protocol::CandidateSessionConfig> protocol_config =
       protocol::CandidateSessionConfig::CreateDefault();
   if (!desktop_environment_factory_->SupportsAudioCapture())
     protocol_config->DisableAudioChannel();
@@ -1500,7 +1504,7 @@
                                  context_->video_encode_task_runner()));
 
   if (gnubby_auth_policy_enabled_ && gnubby_extension_supported_) {
-    host_->AddExtension(make_scoped_ptr(new GnubbyExtension()));
+    host_->AddExtension(base::WrapUnique(new GnubbyExtension()));
   }
 
   // TODO(simonmorris): Get the maximum session duration from a policy.
@@ -1679,14 +1683,15 @@
 
   // Create the main message loop and start helper threads.
   base::MessageLoopForUI message_loop;
-  scoped_ptr<ChromotingHostContext> context = ChromotingHostContext::Create(
-      new AutoThreadTaskRunner(message_loop.task_runner(),
-                               base::MessageLoop::QuitWhenIdleClosure()));
+  std::unique_ptr<ChromotingHostContext> context =
+      ChromotingHostContext::Create(
+          new AutoThreadTaskRunner(message_loop.task_runner(),
+                                   base::MessageLoop::QuitWhenIdleClosure()));
   if (!context)
     return kInitializationFailed;
 
   // NetworkChangeNotifier must be initialized after MessageLoop.
-  scoped_ptr<net::NetworkChangeNotifier> network_change_notifier(
+  std::unique_ptr<net::NetworkChangeNotifier> network_change_notifier(
       net::NetworkChangeNotifier::Create());
 
   // Create & start the HostProcess using these threads.
diff --git a/remoting/host/resizing_host_observer.cc b/remoting/host/resizing_host_observer.cc
index 04129be3..b47fa8c 100644
--- a/remoting/host/resizing_host_observer.cc
+++ b/remoting/host/resizing_host_observer.cc
@@ -118,7 +118,7 @@
 }  // namespace
 
 ResizingHostObserver::ResizingHostObserver(
-    scoped_ptr<DesktopResizer> desktop_resizer)
+    std::unique_ptr<DesktopResizer> desktop_resizer)
     : desktop_resizer_(std::move(desktop_resizer)),
       now_function_(base::Bind(base::Time::Now)),
       weak_factory_(this) {}
diff --git a/remoting/host/resizing_host_observer.h b/remoting/host/resizing_host_observer.h
index e2711817..137246b 100644
--- a/remoting/host/resizing_host_observer.h
+++ b/remoting/host/resizing_host_observer.h
@@ -7,10 +7,11 @@
 
 #include <stddef.h>
 
+#include <memory>
+
 #include "base/callback.h"
 #include "base/compiler_specific.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/time/time.h"
 #include "base/timer/timer.h"
@@ -29,7 +30,8 @@
 // the original desktop size.
 class ResizingHostObserver : public ScreenControls {
  public:
-  explicit ResizingHostObserver(scoped_ptr<DesktopResizer> desktop_resizer);
+  explicit ResizingHostObserver(
+      std::unique_ptr<DesktopResizer> desktop_resizer);
   ~ResizingHostObserver() override;
 
   // ScreenControls interface.
@@ -42,7 +44,7 @@
       const base::Callback<base::Time(void)>& now_function);
 
  private:
-  scoped_ptr<DesktopResizer> desktop_resizer_;
+  std::unique_ptr<DesktopResizer> desktop_resizer_;
   ScreenResolution original_resolution_;
 
   // State to manage rate-limiting of desktop resizes.
diff --git a/remoting/host/resizing_host_observer_unittest.cc b/remoting/host/resizing_host_observer_unittest.cc
index 488fd165..08713f1 100644
--- a/remoting/host/resizing_host_observer_unittest.cc
+++ b/remoting/host/resizing_host_observer_unittest.cc
@@ -10,6 +10,7 @@
 #include "base/compiler_specific.h"
 #include "base/logging.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/memory/ref_counted.h"
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
@@ -106,7 +107,7 @@
   }
 
  protected:
-  void SetDesktopResizer(scoped_ptr<FakeDesktopResizer> desktop_resizer) {
+  void SetDesktopResizer(std::unique_ptr<FakeDesktopResizer> desktop_resizer) {
     CHECK(!desktop_resizer_) << "Call SetDeskopResizer once per test";
     desktop_resizer_ = desktop_resizer.get();
 
@@ -138,7 +139,7 @@
     return result;
   }
 
-  scoped_ptr<ResizingHostObserver> resizing_host_observer_;
+  std::unique_ptr<ResizingHostObserver> resizing_host_observer_;
   FakeDesktopResizer* desktop_resizer_;
   base::Time now_;
 };
@@ -147,9 +148,8 @@
 TEST_F(ResizingHostObserverTest, NoRestoreResolution) {
   int restore_resolution_call_count = 0;
   ScreenResolution initial = MakeResolution(640, 480);
-  scoped_ptr<FakeDesktopResizer> desktop_resizer(
-      new FakeDesktopResizer(initial, false, nullptr, 0,
-                             &restore_resolution_call_count));
+  std::unique_ptr<FakeDesktopResizer> desktop_resizer(new FakeDesktopResizer(
+      initial, false, nullptr, 0, &restore_resolution_call_count));
   SetDesktopResizer(std::move(desktop_resizer));
   VerifySizes(nullptr, nullptr, 0);
   resizing_host_observer_.reset();
@@ -161,9 +161,8 @@
 TEST_F(ResizingHostObserverTest, EmptyGetSupportedSizes) {
   int restore_resolution_call_count = 0;
   ScreenResolution initial = MakeResolution(640, 480);
-  scoped_ptr<FakeDesktopResizer> desktop_resizer(
-      new FakeDesktopResizer(initial, false, nullptr, 0,
-                             &restore_resolution_call_count));
+  std::unique_ptr<FakeDesktopResizer> desktop_resizer(new FakeDesktopResizer(
+      initial, false, nullptr, 0, &restore_resolution_call_count));
   SetDesktopResizer(std::move(desktop_resizer));
 
   ScreenResolution client_sizes[] = { MakeResolution(200, 100),
@@ -178,9 +177,9 @@
 // Check that if the implementation supports exact size matching, it is used.
 TEST_F(ResizingHostObserverTest, SelectExactSize) {
   int restore_resolution_call_count = 0;
-  scoped_ptr<FakeDesktopResizer> desktop_resizer(
-        new FakeDesktopResizer(MakeResolution(640, 480), true, nullptr, 0,
-                               &restore_resolution_call_count));
+  std::unique_ptr<FakeDesktopResizer> desktop_resizer(
+      new FakeDesktopResizer(MakeResolution(640, 480), true, nullptr, 0,
+                             &restore_resolution_call_count));
   SetDesktopResizer(std::move(desktop_resizer));
 
   ScreenResolution client_sizes[] = { MakeResolution(200, 100),
@@ -198,10 +197,9 @@
 TEST_F(ResizingHostObserverTest, SelectBestSmallerSize) {
   ScreenResolution supported_sizes[] = { MakeResolution(639, 479),
                                          MakeResolution(640, 480) };
-  scoped_ptr<FakeDesktopResizer> desktop_resizer(
-      new FakeDesktopResizer(MakeResolution(640, 480), false,
-                             supported_sizes, arraysize(supported_sizes),
-                             nullptr));
+  std::unique_ptr<FakeDesktopResizer> desktop_resizer(
+      new FakeDesktopResizer(MakeResolution(640, 480), false, supported_sizes,
+                             arraysize(supported_sizes), nullptr));
   SetDesktopResizer(std::move(desktop_resizer));
 
   ScreenResolution client_sizes[] = { MakeResolution(639, 479),
@@ -218,10 +216,9 @@
 TEST_F(ResizingHostObserverTest, SelectBestScaleFactor) {
   ScreenResolution supported_sizes[] = { MakeResolution(100, 100),
                                          MakeResolution(200, 100) };
-  scoped_ptr<FakeDesktopResizer> desktop_resizer(
-      new FakeDesktopResizer(MakeResolution(200, 100), false,
-                             supported_sizes, arraysize(supported_sizes),
-                             nullptr));
+  std::unique_ptr<FakeDesktopResizer> desktop_resizer(
+      new FakeDesktopResizer(MakeResolution(200, 100), false, supported_sizes,
+                             arraysize(supported_sizes), nullptr));
   SetDesktopResizer(std::move(desktop_resizer));
 
   ScreenResolution client_sizes[] = { MakeResolution(1, 1),
@@ -237,10 +234,9 @@
 TEST_F(ResizingHostObserverTest, SelectWidest) {
   ScreenResolution supported_sizes[] = { MakeResolution(640, 480),
                                          MakeResolution(480, 640) };
-  scoped_ptr<FakeDesktopResizer> desktop_resizer(
-      new FakeDesktopResizer(MakeResolution(480, 640), false,
-                             supported_sizes, arraysize(supported_sizes),
-                             nullptr));
+  std::unique_ptr<FakeDesktopResizer> desktop_resizer(
+      new FakeDesktopResizer(MakeResolution(480, 640), false, supported_sizes,
+                             arraysize(supported_sizes), nullptr));
   SetDesktopResizer(std::move(desktop_resizer));
 
   ScreenResolution client_sizes[] = { MakeResolution(100, 100),
@@ -259,9 +255,9 @@
 TEST_F(ResizingHostObserverTest, NoSetSizeForSameSize) {
   ScreenResolution supported_sizes[] = { MakeResolution(640, 480),
                                          MakeResolution(480, 640) };
-  SetDesktopResizer(make_scoped_ptr(new FakeDesktopResizer(
-      MakeResolution(480, 640), false,
-      supported_sizes, arraysize(supported_sizes), nullptr)));
+  SetDesktopResizer(base::WrapUnique(
+      new FakeDesktopResizer(MakeResolution(480, 640), false, supported_sizes,
+                             arraysize(supported_sizes), nullptr)));
 
   ScreenResolution client_sizes[] = { MakeResolution(640, 640),
                                       MakeResolution(1024, 768),
@@ -276,7 +272,7 @@
 // Check that desktop resizes are rate-limited, and that if multiple resize
 // requests are received in the time-out period, the most recent is respected.
 TEST_F(ResizingHostObserverTest, RateLimited) {
-  SetDesktopResizer(make_scoped_ptr(new FakeDesktopResizer(
+  SetDesktopResizer(base::WrapUnique(new FakeDesktopResizer(
       MakeResolution(640, 480), true, nullptr, 0, nullptr)));
   resizing_host_observer_->SetNowFunctionForTesting(
       base::Bind(&ResizingHostObserverTest::GetTime, base::Unretained(this)));
diff --git a/remoting/host/sas_injector.h b/remoting/host/sas_injector.h
index a77485a..248eb296 100644
--- a/remoting/host/sas_injector.h
+++ b/remoting/host/sas_injector.h
@@ -5,7 +5,7 @@
 #ifndef REMOTING_HOST_SAS_INJECTOR_H_
 #define REMOTING_HOST_SAS_INJECTOR_H_
 
-#include "base/memory/scoped_ptr.h"
+#include <memory>
 
 namespace remoting {
 
@@ -20,7 +20,7 @@
 
   // Creates an instance of SasInjector if supported by the OS, otherwise
   // returns nullptr.
-  static scoped_ptr<SasInjector> Create();
+  static std::unique_ptr<SasInjector> Create();
 };
 
 }  // namespace remoting
diff --git a/remoting/host/sas_injector_win.cc b/remoting/host/sas_injector_win.cc
index fcf2de6..17315559 100644
--- a/remoting/host/sas_injector_win.cc
+++ b/remoting/host/sas_injector_win.cc
@@ -5,11 +5,13 @@
 #include "remoting/host/sas_injector.h"
 
 #include <windows.h>
+
 #include <string>
 
 #include "base/files/file_path.h"
 #include "base/logging.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/path_service.h"
 #include "base/scoped_native_library.h"
 #include "base/strings/utf_string_conversions.h"
@@ -188,7 +190,7 @@
   const wchar_t kSasWindowClassName[] = L"SAS window class";
   const wchar_t kSasWindowTitle[] = L"SAS window";
 
-  scoped_ptr<webrtc::Desktop> winlogon_desktop(
+  std::unique_ptr<webrtc::Desktop> winlogon_desktop(
       webrtc::Desktop::GetDesktop(kWinlogonDesktopName));
   if (!winlogon_desktop.get()) {
     PLOG(ERROR) << "Failed to open '" << kWinlogonDesktopName << "' desktop";
@@ -219,11 +221,11 @@
   return true;
 }
 
-scoped_ptr<SasInjector> SasInjector::Create() {
+std::unique_ptr<SasInjector> SasInjector::Create() {
   if (base::win::GetVersion() < base::win::VERSION_VISTA) {
-    return make_scoped_ptr(new SasInjectorXp());
+    return base::WrapUnique(new SasInjectorXp());
   } else {
-    return make_scoped_ptr(new SasInjectorWin());
+    return base::WrapUnique(new SasInjectorWin());
   }
 }
 
diff --git a/remoting/host/security_key/fake_ipc_gnubby_auth_handler.cc b/remoting/host/security_key/fake_ipc_gnubby_auth_handler.cc
index 233c9ff..2918f38 100644
--- a/remoting/host/security_key/fake_ipc_gnubby_auth_handler.cc
+++ b/remoting/host/security_key/fake_ipc_gnubby_auth_handler.cc
@@ -4,7 +4,8 @@
 
 #include "remoting/host/security_key/fake_ipc_gnubby_auth_handler.h"
 
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
 #include "base/time/time.h"
 #include "ipc/ipc_channel.h"
 #include "ipc/ipc_listener.h"
diff --git a/remoting/host/security_key/fake_ipc_gnubby_auth_handler.h b/remoting/host/security_key/fake_ipc_gnubby_auth_handler.h
index d4ef5b2c..73b5377 100644
--- a/remoting/host/security_key/fake_ipc_gnubby_auth_handler.h
+++ b/remoting/host/security_key/fake_ipc_gnubby_auth_handler.h
@@ -7,9 +7,9 @@
 
 #include "remoting/host/security_key/gnubby_auth_handler.h"
 
+#include <memory>
 #include <string>
 
-#include "base/memory/scoped_ptr.h"
 #include "base/time/time.h"
 #include "ipc/ipc_listener.h"
 
@@ -62,11 +62,11 @@
 
   // IPC Clients connect to this channel first to receive their own unique IPC
   // channel to start a security key forwarding session on.
-  scoped_ptr<IPC::Channel> ipc_server_channel_;
+  std::unique_ptr<IPC::Channel> ipc_server_channel_;
 
   DISALLOW_COPY_AND_ASSIGN(FakeIpcGnubbyAuthHandler);
 };
 
 }  // namespace remoting
 
-#endif  // REMOTING_HOST_SECURITY_KEY_FAKE_IPC_GNUBBY_AUTH_HANDLER_H_
\ No newline at end of file
+#endif  // REMOTING_HOST_SECURITY_KEY_FAKE_IPC_GNUBBY_AUTH_HANDLER_H_
diff --git a/remoting/host/security_key/fake_remote_security_key_ipc_client.cc b/remoting/host/security_key/fake_remote_security_key_ipc_client.cc
index 6c70737f..958b18cc 100644
--- a/remoting/host/security_key/fake_remote_security_key_ipc_client.cc
+++ b/remoting/host/security_key/fake_remote_security_key_ipc_client.cc
@@ -4,9 +4,10 @@
 
 #include "remoting/host/security_key/fake_remote_security_key_ipc_client.h"
 
+#include <memory>
+
 #include "base/callback.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/run_loop.h"
 #include "base/thread_task_runner_handle.h"
diff --git a/remoting/host/security_key/fake_remote_security_key_ipc_client.h b/remoting/host/security_key/fake_remote_security_key_ipc_client.h
index 9734470..adf10db 100644
--- a/remoting/host/security_key/fake_remote_security_key_ipc_client.h
+++ b/remoting/host/security_key/fake_remote_security_key_ipc_client.h
@@ -5,11 +5,11 @@
 #ifndef REMOTING_HOST_SECURITY_KEY_FAKE_SECURITY_KEY_IPC_CLIENT_H_
 #define REMOTING_HOST_SECURITY_KEY_FAKE_SECURITY_KEY_IPC_CLIENT_H_
 
+#include <memory>
 #include <string>
 
 #include "base/callback_forward.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "remoting/host/security_key/remote_security_key_ipc_client.h"
 
@@ -85,7 +85,7 @@
   base::Closure channel_event_callback_;
 
   // Used for sending/receiving security key messages between processes.
-  scoped_ptr<IPC::Channel> client_channel_;
+  std::unique_ptr<IPC::Channel> client_channel_;
 
   // Provides the contents of the last IPC message received.
   std::string last_message_received_;
@@ -109,4 +109,4 @@
 
 }  // namespace remoting
 
-#endif  // REMOTING_HOST_SECURITY_KEY_FAKE_SECURITY_KEY_IPC_CLIENT_H_
\ No newline at end of file
+#endif  // REMOTING_HOST_SECURITY_KEY_FAKE_SECURITY_KEY_IPC_CLIENT_H_
diff --git a/remoting/host/security_key/fake_remote_security_key_ipc_server.cc b/remoting/host/security_key/fake_remote_security_key_ipc_server.cc
index 3b59d77e..9243480f 100644
--- a/remoting/host/security_key/fake_remote_security_key_ipc_server.cc
+++ b/remoting/host/security_key/fake_remote_security_key_ipc_server.cc
@@ -4,9 +4,11 @@
 
 #include "remoting/host/security_key/fake_remote_security_key_ipc_server.h"
 
+#include <memory>
+
 #include "base/callback.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
 #include "ipc/ipc_channel.h"
 #include "ipc/ipc_message.h"
 #include "ipc/ipc_message_macros.h"
@@ -97,19 +99,19 @@
   RemoteSecurityKeyIpcServer::SetFactoryForTest(nullptr);
 }
 
-scoped_ptr<RemoteSecurityKeyIpcServer>
+std::unique_ptr<RemoteSecurityKeyIpcServer>
 FakeRemoteSecurityKeyIpcServerFactory::Create(
     int connection_id,
     base::TimeDelta initial_connect_timeout,
     const GnubbyAuthHandler::SendMessageCallback& send_message_callback,
     const base::Closure& done_callback) {
-  scoped_ptr<FakeRemoteSecurityKeyIpcServer> fake_ipc_server(
+  std::unique_ptr<FakeRemoteSecurityKeyIpcServer> fake_ipc_server(
       new FakeRemoteSecurityKeyIpcServer(connection_id, initial_connect_timeout,
                                          send_message_callback, done_callback));
 
   ipc_server_map_[connection_id] = fake_ipc_server->AsWeakPtr();
 
-  return make_scoped_ptr(fake_ipc_server.release());
+  return base::WrapUnique(fake_ipc_server.release());
 }
 
 base::WeakPtr<FakeRemoteSecurityKeyIpcServer>
diff --git a/remoting/host/security_key/fake_remote_security_key_ipc_server.h b/remoting/host/security_key/fake_remote_security_key_ipc_server.h
index bddd6303..6b4f0a0 100644
--- a/remoting/host/security_key/fake_remote_security_key_ipc_server.h
+++ b/remoting/host/security_key/fake_remote_security_key_ipc_server.h
@@ -8,11 +8,11 @@
 #include "remoting/host/security_key/remote_security_key_ipc_server.h"
 
 #include <map>
+#include <memory>
 #include <string>
 
 #include "base/callback_forward.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "ipc/ipc_listener.h"
 
@@ -90,7 +90,7 @@
   base::Closure send_response_callback_;
 
   // Used for sending/receiving security key messages between processes.
-  scoped_ptr<IPC::Channel> ipc_channel_;
+  std::unique_ptr<IPC::Channel> ipc_channel_;
 
   // NOTE: Weak pointers must be invalidated before all other member variables.
   base::WeakPtrFactory<FakeRemoteSecurityKeyIpcServer> weak_factory_;
@@ -109,7 +109,7 @@
   ~FakeRemoteSecurityKeyIpcServerFactory() override;
 
   // RemoteSecurityKeyIpcServerFactory implementation.
-  scoped_ptr<RemoteSecurityKeyIpcServer> Create(
+  std::unique_ptr<RemoteSecurityKeyIpcServer> Create(
       int connection_id,
       base::TimeDelta initial_connect_timeout,
       const GnubbyAuthHandler::SendMessageCallback& message_callback,
@@ -130,4 +130,4 @@
 
 }  // namespace remoting
 
-#endif  // REMOTING_HOST_SECURITY_KEY_FAKE_SECURITY_KEY_IPC_SERVER_H_
\ No newline at end of file
+#endif  // REMOTING_HOST_SECURITY_KEY_FAKE_SECURITY_KEY_IPC_SERVER_H_
diff --git a/remoting/host/security_key/gnubby_auth_handler.h b/remoting/host/security_key/gnubby_auth_handler.h
index fe6dff0..0a6a755 100644
--- a/remoting/host/security_key/gnubby_auth_handler.h
+++ b/remoting/host/security_key/gnubby_auth_handler.h
@@ -5,10 +5,10 @@
 #ifndef REMOTING_HOST_SECURITY_KEY_GNUBBY_AUTH_HANDLER_H_
 #define REMOTING_HOST_SECURITY_KEY_GNUBBY_AUTH_HANDLER_H_
 
+#include <memory>
 #include <string>
 
 #include "base/callback.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/time/time.h"
 
 namespace base {
@@ -31,7 +31,7 @@
   // All invocations of |callback| are guaranteed to occur before the underlying
   // GnubbyAuthHandler object is destroyed.  It is not safe to destroy the
   // GnubbyAuthHandler object within the callback.
-  static scoped_ptr<GnubbyAuthHandler> Create(
+  static std::unique_ptr<GnubbyAuthHandler> Create(
       const SendMessageCallback& callback);
 
 #if defined(OS_LINUX)
diff --git a/remoting/host/security_key/gnubby_auth_handler_linux.cc b/remoting/host/security_key/gnubby_auth_handler_linux.cc
index b53f823..5ba1ee2 100644
--- a/remoting/host/security_key/gnubby_auth_handler_linux.cc
+++ b/remoting/host/security_key/gnubby_auth_handler_linux.cc
@@ -7,11 +7,12 @@
 #include <stdint.h>
 #include <unistd.h>
 
+#include <memory>
+
 #include "base/bind.h"
 #include "base/files/file_util.h"
 #include "base/lazy_instance.h"
 #include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/stl_util.h"
 #include "base/threading/thread_checker.h"
 #include "base/threading/thread_restrictions.h"
@@ -91,10 +92,10 @@
   base::ThreadChecker thread_checker_;
 
   // Socket used to listen for authorization requests.
-  scoped_ptr<net::UnixDomainServerSocket> auth_socket_;
+  std::unique_ptr<net::UnixDomainServerSocket> auth_socket_;
 
   // A temporary holder for an accepted connection.
-  scoped_ptr<net::StreamSocket> accept_socket_;
+  std::unique_ptr<net::StreamSocket> accept_socket_;
 
   // Used to pass gnubby extension messages to the client.
   SendMessageCallback send_message_callback_;
@@ -111,9 +112,9 @@
   DISALLOW_COPY_AND_ASSIGN(GnubbyAuthHandlerLinux);
 };
 
-scoped_ptr<GnubbyAuthHandler> GnubbyAuthHandler::Create(
+std::unique_ptr<GnubbyAuthHandler> GnubbyAuthHandler::Create(
     const SendMessageCallback& callback) {
-  scoped_ptr<GnubbyAuthHandler> auth_handler(new GnubbyAuthHandlerLinux());
+  std::unique_ptr<GnubbyAuthHandler> auth_handler(new GnubbyAuthHandlerLinux());
   auth_handler->SetSendMessageCallback(callback);
   return auth_handler;
 }
diff --git a/remoting/host/security_key/gnubby_auth_handler_linux_unittest.cc b/remoting/host/security_key/gnubby_auth_handler_linux_unittest.cc
index 354ecc4..74ba1b7 100644
--- a/remoting/host/security_key/gnubby_auth_handler_linux_unittest.cc
+++ b/remoting/host/security_key/gnubby_auth_handler_linux_unittest.cc
@@ -114,10 +114,10 @@
 
  protected:
   base::MessageLoopForIO message_loop_;
-  scoped_ptr<base::RunLoop> run_loop_;
+  std::unique_ptr<base::RunLoop> run_loop_;
 
   // Object under test.
-  scoped_ptr<GnubbyAuthHandler> auth_handler_;
+  std::unique_ptr<GnubbyAuthHandler> auth_handler_;
 
   GnubbyAuthHandler::SendMessageCallback send_message_callback_;
 
diff --git a/remoting/host/security_key/gnubby_auth_handler_mac.cc b/remoting/host/security_key/gnubby_auth_handler_mac.cc
index d489644..de113a4 100644
--- a/remoting/host/security_key/gnubby_auth_handler_mac.cc
+++ b/remoting/host/security_key/gnubby_auth_handler_mac.cc
@@ -8,7 +8,7 @@
 
 namespace remoting {
 
-scoped_ptr<GnubbyAuthHandler> GnubbyAuthHandler::Create(
+std::unique_ptr<GnubbyAuthHandler> GnubbyAuthHandler::Create(
     const SendMessageCallback& callback) {
   return nullptr;
 }
diff --git a/remoting/host/security_key/gnubby_auth_handler_win.cc b/remoting/host/security_key/gnubby_auth_handler_win.cc
index 4a3c98b6..49ce705 100644
--- a/remoting/host/security_key/gnubby_auth_handler_win.cc
+++ b/remoting/host/security_key/gnubby_auth_handler_win.cc
@@ -5,11 +5,11 @@
 #include "remoting/host/security_key/gnubby_auth_handler.h"
 
 #include <map>
+#include <memory>
 #include <string>
 
 #include "base/bind.h"
 #include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/threading/thread_checker.h"
 #include "base/time/time.h"
 #include "base/timer/timer.h"
@@ -55,7 +55,8 @@
   ~GnubbyAuthHandlerWin() override;
 
  private:
-  typedef std::map<int, scoped_ptr<RemoteSecurityKeyIpcServer>> ActiveChannels;
+  typedef std::map<int, std::unique_ptr<RemoteSecurityKeyIpcServer>>
+      ActiveChannels;
 
   // GnubbyAuthHandler interface.
   void CreateGnubbyConnection() override;
@@ -107,7 +108,7 @@
 
   // IPC Clients connect to this channel first to receive their own IPC
   // channel to start a security key forwarding session on.
-  scoped_ptr<IPC::Channel> ipc_server_channel_;
+  std::unique_ptr<IPC::Channel> ipc_server_channel_;
 
   // Ensures GnubbyAuthHandlerWin methods are called on the same thread.
   base::ThreadChecker thread_checker_;
@@ -115,9 +116,9 @@
   DISALLOW_COPY_AND_ASSIGN(GnubbyAuthHandlerWin);
 };
 
-scoped_ptr<GnubbyAuthHandler> GnubbyAuthHandler::Create(
+std::unique_ptr<GnubbyAuthHandler> GnubbyAuthHandler::Create(
     const SendMessageCallback& callback) {
-  scoped_ptr<GnubbyAuthHandler> auth_handler(new GnubbyAuthHandlerWin());
+  std::unique_ptr<GnubbyAuthHandler> auth_handler(new GnubbyAuthHandlerWin());
   auth_handler->SetSendMessageCallback(callback);
   return auth_handler;
 }
@@ -226,7 +227,7 @@
   // Tracked via crbug.com/591746
 
   int new_connection_id = ++last_connection_id_;
-  scoped_ptr<RemoteSecurityKeyIpcServer> ipc_server(
+  std::unique_ptr<RemoteSecurityKeyIpcServer> ipc_server(
       RemoteSecurityKeyIpcServer::Create(
           new_connection_id, disconnect_timeout_, send_message_callback_,
           base::Bind(&GnubbyAuthHandlerWin::CloseSecurityKeyRequestIpcChannel,
diff --git a/remoting/host/security_key/gnubby_auth_handler_win_unittest.cc b/remoting/host/security_key/gnubby_auth_handler_win_unittest.cc
index 0682b0b..d844d3f 100644
--- a/remoting/host/security_key/gnubby_auth_handler_win_unittest.cc
+++ b/remoting/host/security_key/gnubby_auth_handler_win_unittest.cc
@@ -4,11 +4,11 @@
 
 #include "remoting/host/security_key/gnubby_auth_handler.h"
 
+#include <memory>
 #include <string>
 
 #include "base/bind.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
@@ -85,10 +85,10 @@
 
   // Used to allow |message_loop_| to run during tests.  The instance is reset
   // after each stage of the tests has been completed.
-  scoped_ptr<base::RunLoop> run_loop_;
+  std::unique_ptr<base::RunLoop> run_loop_;
 
   // The object under test.
-  scoped_ptr<GnubbyAuthHandler> auth_handler_;
+  std::unique_ptr<GnubbyAuthHandler> auth_handler_;
 
   // Set as the default factory to create RemoteSecurityKeyIpcServerFactory
   // instances, this class will track each objects creation and allow the tests
diff --git a/remoting/host/security_key/gnubby_extension.cc b/remoting/host/security_key/gnubby_extension.cc
index 156ffac..3177766 100644
--- a/remoting/host/security_key/gnubby_extension.cc
+++ b/remoting/host/security_key/gnubby_extension.cc
@@ -4,6 +4,7 @@
 
 #include "remoting/host/security_key/gnubby_extension.h"
 
+#include "base/memory/ptr_util.h"
 #include "remoting/host/security_key/gnubby_extension_session.h"
 
 namespace {
@@ -22,13 +23,13 @@
   return kCapability;
 }
 
-scoped_ptr<HostExtensionSession> GnubbyExtension::CreateExtensionSession(
+std::unique_ptr<HostExtensionSession> GnubbyExtension::CreateExtensionSession(
     ClientSessionControl* client_session_control,
     protocol::ClientStub* client_stub) {
   // TODO(joedow): Update this mechanism to allow for multiple sessions.  The
   //               extension will only send messages through the initial
   //               |client_stub| with the current design.
-  return make_scoped_ptr(new GnubbyExtensionSession(client_stub));
+  return base::WrapUnique(new GnubbyExtensionSession(client_stub));
 }
 
 }  // namespace remoting
diff --git a/remoting/host/security_key/gnubby_extension.h b/remoting/host/security_key/gnubby_extension.h
index 7cad0954..79c85f0 100644
--- a/remoting/host/security_key/gnubby_extension.h
+++ b/remoting/host/security_key/gnubby_extension.h
@@ -5,10 +5,10 @@
 #ifndef REMOTING_HOST_SECURITY_KEY_GNUBBY_EXTENSION_H_
 #define REMOTING_HOST_SECURITY_KEY_GNUBBY_EXTENSION_H_
 
+#include <memory>
 #include <string>
 
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "remoting/host/host_extension.h"
 
 namespace remoting {
@@ -21,7 +21,7 @@
 
   // HostExtension interface.
   std::string capability() const override;
-  scoped_ptr<HostExtensionSession> CreateExtensionSession(
+  std::unique_ptr<HostExtensionSession> CreateExtensionSession(
       ClientSessionControl* client_session_control,
       protocol::ClientStub* client_stub) override;
 
diff --git a/remoting/host/security_key/gnubby_extension_session.cc b/remoting/host/security_key/gnubby_extension_session.cc
index d53338c..ee3c92e 100644
--- a/remoting/host/security_key/gnubby_extension_session.cc
+++ b/remoting/host/security_key/gnubby_extension_session.cc
@@ -84,7 +84,7 @@
     return false;
   }
 
-  scoped_ptr<base::Value> value = base::JSONReader::Read(message.data());
+  std::unique_ptr<base::Value> value = base::JSONReader::Read(message.data());
   base::DictionaryValue* client_message;
   if (!value || !value->GetAsDictionary(&client_message)) {
     LOG(WARNING) << "Failed to retrieve data from gnubby-auth message.";
@@ -179,7 +179,7 @@
   request.SetString(kMessageType, kDataMessage);
   request.SetInteger(kConnectionId, connection_id);
 
-  scoped_ptr<base::ListValue> bytes(new base::ListValue());
+  std::unique_ptr<base::ListValue> bytes(new base::ListValue());
   for (std::string::const_iterator i = data.begin(); i != data.end(); ++i) {
     bytes->AppendInteger(static_cast<unsigned char>(*i));
   }
@@ -196,7 +196,7 @@
 }
 
 void GnubbyExtensionSession::SetGnubbyAuthHandlerForTesting(
-    scoped_ptr<GnubbyAuthHandler> gnubby_auth_handler) {
+    std::unique_ptr<GnubbyAuthHandler> gnubby_auth_handler) {
   DCHECK(gnubby_auth_handler);
 
   gnubby_auth_handler_ = std::move(gnubby_auth_handler);
diff --git a/remoting/host/security_key/gnubby_extension_session.h b/remoting/host/security_key/gnubby_extension_session.h
index 82b6703..74ad58f 100644
--- a/remoting/host/security_key/gnubby_extension_session.h
+++ b/remoting/host/security_key/gnubby_extension_session.h
@@ -5,11 +5,11 @@
 #ifndef REMOTING_HOST_SECURITY_KEY_GNUBBY_EXTENSION_SESSION_H_
 #define REMOTING_HOST_SECURITY_KEY_GNUBBY_EXTENSION_SESSION_H_
 
+#include <memory>
 #include <string>
 
 #include "base/callback.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/threading/thread_checker.h"
 #include "remoting/host/host_extension_session.h"
 
@@ -38,7 +38,7 @@
 
   // Allows the underlying GnubbyAuthHandler to be overridden for unit testing.
   void SetGnubbyAuthHandlerForTesting(
-      scoped_ptr<GnubbyAuthHandler> gnubby_auth_handler);
+      std::unique_ptr<GnubbyAuthHandler> gnubby_auth_handler);
 
  private:
   // These methods process specific gnubby extension message types.
@@ -55,7 +55,7 @@
   protocol::ClientStub* client_stub_ = nullptr;
 
   // Handles platform specific gnubby operations.
-  scoped_ptr<GnubbyAuthHandler> gnubby_auth_handler_;
+  std::unique_ptr<GnubbyAuthHandler> gnubby_auth_handler_;
 
   DISALLOW_COPY_AND_ASSIGN(GnubbyExtensionSession);
 };
diff --git a/remoting/host/security_key/gnubby_extension_session_unittest.cc b/remoting/host/security_key/gnubby_extension_session_unittest.cc
index 2c64a53b..c8dafdd 100644
--- a/remoting/host/security_key/gnubby_extension_session_unittest.cc
+++ b/remoting/host/security_key/gnubby_extension_session_unittest.cc
@@ -2,12 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "remoting/host/security_key/gnubby_extension_session.h"
+
 #include <stddef.h>
 
 #include "base/files/file_path.h"
 #include "base/files/scoped_temp_dir.h"
 #include "base/json/json_writer.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
 #include "base/strings/stringprintf.h"
@@ -20,7 +23,6 @@
 #include "net/socket/unix_domain_client_socket_posix.h"
 #include "remoting/host/host_mock_objects.h"
 #include "remoting/host/security_key/gnubby_auth_handler.h"
-#include "remoting/host/security_key/gnubby_extension_session.h"
 #include "remoting/proto/internal.pb.h"
 #include "remoting/protocol/client_stub.h"
 #include "testing/gmock/include/gmock/gmock.h"
@@ -93,7 +95,7 @@
 
  private:
   protocol::ExtensionMessage message_;
-  scoped_ptr<base::RunLoop> run_loop_;
+  std::unique_ptr<base::RunLoop> run_loop_;
 
   DISALLOW_COPY_AND_ASSIGN(TestClientStub);
 };
@@ -107,7 +109,7 @@
     // once |gnubby_extension_session_| is destroyed.
     mock_gnubby_auth_handler_ = new MockGnubbyAuthHandler();
     gnubby_extension_session_->SetGnubbyAuthHandlerForTesting(
-        make_scoped_ptr(mock_gnubby_auth_handler_));
+        base::WrapUnique(mock_gnubby_auth_handler_));
   }
 
   void WaitForAndVerifyHostMessage() {
@@ -140,7 +142,7 @@
   base::MessageLoopForIO message_loop_;
 
   // Object under test.
-  scoped_ptr<GnubbyExtensionSession> gnubby_extension_session_;
+  std::unique_ptr<GnubbyExtensionSession> gnubby_extension_session_;
 
   MockGnubbyAuthHandler* mock_gnubby_auth_handler_ = nullptr;
 
diff --git a/remoting/host/security_key/gnubby_socket.cc b/remoting/host/security_key/gnubby_socket.cc
index 371a3529..28a21064 100644
--- a/remoting/host/security_key/gnubby_socket.cc
+++ b/remoting/host/security_key/gnubby_socket.cc
@@ -26,7 +26,7 @@
 
 }  // namespace
 
-GnubbySocket::GnubbySocket(scoped_ptr<net::StreamSocket> socket,
+GnubbySocket::GnubbySocket(std::unique_ptr<net::StreamSocket> socket,
                            base::TimeDelta timeout,
                            const base::Closure& timeout_callback)
     : socket_(std::move(socket)),
@@ -59,7 +59,7 @@
 
   std::string response_length_string = GetResponseLengthAsBytes(response_data);
   int response_len = response_length_string.size() + response_data.size();
-  scoped_ptr<std::string> response(
+  std::unique_ptr<std::string> response(
       new std::string(response_length_string + response_data));
   write_buffer_ = new net::DrainableIOBuffer(
       new net::StringIOBuffer(std::move(response)), response_len);
diff --git a/remoting/host/security_key/gnubby_socket.h b/remoting/host/security_key/gnubby_socket.h
index f56bf336..c0e1b4d 100644
--- a/remoting/host/security_key/gnubby_socket.h
+++ b/remoting/host/security_key/gnubby_socket.h
@@ -7,13 +7,13 @@
 
 #include <stddef.h>
 
+#include <memory>
 #include <string>
 #include <vector>
 
 #include "base/callback.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/threading/thread_checker.h"
 
 namespace base {
@@ -33,7 +33,7 @@
 // bytes over the wire, which is checked by IsRequestTooLarge method.
 class GnubbySocket {
  public:
-  GnubbySocket(scoped_ptr<net::StreamSocket> socket,
+  GnubbySocket(std::unique_ptr<net::StreamSocket> socket,
                base::TimeDelta timeout,
                const base::Closure& timeout_callback);
   ~GnubbySocket();
@@ -86,7 +86,7 @@
   base::ThreadChecker thread_checker_;
 
   // The socket.
-  scoped_ptr<net::StreamSocket> socket_;
+  std::unique_ptr<net::StreamSocket> socket_;
 
   // Invoked when request data has been read.
   base::Closure request_received_callback_;
@@ -103,7 +103,7 @@
   scoped_refptr<net::IOBufferWithSize> read_buffer_;
 
   // The activity timer.
-  scoped_ptr<base::Timer> timer_;
+  std::unique_ptr<base::Timer> timer_;
 
   DISALLOW_COPY_AND_ASSIGN(GnubbySocket);
 };
diff --git a/remoting/host/security_key/remote_security_key_ipc_client.h b/remoting/host/security_key/remote_security_key_ipc_client.h
index 46cabe1..fcde9a8 100644
--- a/remoting/host/security_key/remote_security_key_ipc_client.h
+++ b/remoting/host/security_key/remote_security_key_ipc_client.h
@@ -5,10 +5,10 @@
 #ifndef REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_IPC_CLIENT_H_
 #define REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_IPC_CLIENT_H_
 
+#include <memory>
 #include <string>
 
 #include "base/callback.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/threading/thread_checker.h"
 #include "ipc/ipc_listener.h"
@@ -98,7 +98,7 @@
   ResponseCallback response_callback_;
 
   // Used for sending/receiving security key messages between processes.
-  scoped_ptr<IPC::Channel> ipc_channel_;
+  std::unique_ptr<IPC::Channel> ipc_channel_;
 
   base::ThreadChecker thread_checker_;
 
diff --git a/remoting/host/security_key/remote_security_key_ipc_client_unittest.cc b/remoting/host/security_key/remote_security_key_ipc_client_unittest.cc
index 2191d71..b37d4f4 100644
--- a/remoting/host/security_key/remote_security_key_ipc_client_unittest.cc
+++ b/remoting/host/security_key/remote_security_key_ipc_client_unittest.cc
@@ -4,11 +4,11 @@
 
 #include "remoting/host/security_key/remote_security_key_ipc_client.h"
 
+#include <memory>
 #include <string>
 
 #include "base/bind.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
 #include "ipc/ipc_channel.h"
@@ -68,7 +68,7 @@
 
   // Used to allow |message_loop_| to run during tests.  The instance is reset
   // after each stage of the tests has been completed.
-  scoped_ptr<base::RunLoop> run_loop_;
+  std::unique_ptr<base::RunLoop> run_loop_;
 
   // The object under test.
   RemoteSecurityKeyIpcClient remote_security_key_ipc_client_;
diff --git a/remoting/host/security_key/remote_security_key_ipc_server.cc b/remoting/host/security_key/remote_security_key_ipc_server.cc
index 62d54c83..e3a7877 100644
--- a/remoting/host/security_key/remote_security_key_ipc_server.cc
+++ b/remoting/host/security_key/remote_security_key_ipc_server.cc
@@ -4,10 +4,11 @@
 
 #include "remoting/host/security_key/remote_security_key_ipc_server.h"
 
+#include <memory>
 #include <string>
 
 #include "base/callback.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
 #include "base/threading/thread_checker.h"
 #include "base/timer/timer.h"
 #include "ipc/ipc_channel.h"
@@ -31,16 +32,16 @@
   g_factory = factory;
 }
 
-scoped_ptr<RemoteSecurityKeyIpcServer> RemoteSecurityKeyIpcServer::Create(
+std::unique_ptr<RemoteSecurityKeyIpcServer> RemoteSecurityKeyIpcServer::Create(
     int connection_id,
     base::TimeDelta initial_connect_timeout,
     const GnubbyAuthHandler::SendMessageCallback& message_callback,
     const base::Closure& done_callback) {
-  scoped_ptr<RemoteSecurityKeyIpcServer> ipc_server =
+  std::unique_ptr<RemoteSecurityKeyIpcServer> ipc_server =
       g_factory
           ? g_factory->Create(connection_id, initial_connect_timeout,
                               message_callback, done_callback)
-          : make_scoped_ptr(new RemoteSecurityKeyIpcServerImpl(
+          : base::WrapUnique(new RemoteSecurityKeyIpcServerImpl(
                 connection_id, initial_connect_timeout, message_callback,
                 done_callback));
 
diff --git a/remoting/host/security_key/remote_security_key_ipc_server.h b/remoting/host/security_key/remote_security_key_ipc_server.h
index cd85541a..9c754f65 100644
--- a/remoting/host/security_key/remote_security_key_ipc_server.h
+++ b/remoting/host/security_key/remote_security_key_ipc_server.h
@@ -5,10 +5,10 @@
 #ifndef REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_IPC_SERVER_H_
 #define REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_IPC_SERVER_H_
 
+#include <memory>
 #include <string>
 
 #include "base/callback_forward.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/time/time.h"
 #include "remoting/host/security_key/gnubby_auth_handler.h"
 
@@ -23,7 +23,7 @@
   virtual ~RemoteSecurityKeyIpcServer() {}
 
   // Creates a new RemoteSecurityKeyIpcServer instance.
-  static scoped_ptr<RemoteSecurityKeyIpcServer> Create(
+  static std::unique_ptr<RemoteSecurityKeyIpcServer> Create(
       int connection_id,
       base::TimeDelta initial_connect_timeout,
       const GnubbyAuthHandler::SendMessageCallback& message_callback,
@@ -46,7 +46,7 @@
  public:
   virtual ~RemoteSecurityKeyIpcServerFactory() {}
 
-  virtual scoped_ptr<RemoteSecurityKeyIpcServer> Create(
+  virtual std::unique_ptr<RemoteSecurityKeyIpcServer> Create(
       int connection_id,
       base::TimeDelta connect_timeout,
       const GnubbyAuthHandler::SendMessageCallback& message_callback,
diff --git a/remoting/host/security_key/remote_security_key_ipc_server_impl.cc b/remoting/host/security_key/remote_security_key_ipc_server_impl.cc
index 4ef56ed..ffbbdc6 100644
--- a/remoting/host/security_key/remote_security_key_ipc_server_impl.cc
+++ b/remoting/host/security_key/remote_security_key_ipc_server_impl.cc
@@ -4,11 +4,11 @@
 
 #include "remoting/host/security_key/remote_security_key_ipc_server_impl.h"
 
+#include <memory>
 #include <string>
 
 #include "base/callback.h"
 #include "base/callback_helpers.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/threading/thread_checker.h"
 #include "base/timer/timer.h"
 #include "ipc/ipc_channel.h"
diff --git a/remoting/host/security_key/remote_security_key_ipc_server_impl.h b/remoting/host/security_key/remote_security_key_ipc_server_impl.h
index 68101140..c45ff364 100644
--- a/remoting/host/security_key/remote_security_key_ipc_server_impl.h
+++ b/remoting/host/security_key/remote_security_key_ipc_server_impl.h
@@ -7,10 +7,10 @@
 
 #include "remoting/host/security_key/remote_security_key_ipc_server.h"
 
+#include <memory>
 #include <string>
 
 #include "base/callback.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/threading/thread_checker.h"
 #include "base/time/time.h"
 #include "base/timer/timer.h"
@@ -73,7 +73,7 @@
   GnubbyAuthHandler::SendMessageCallback message_callback_;
 
   // Used for sending/receiving security key messages between processes.
-  scoped_ptr<IPC::Channel> ipc_channel_;
+  std::unique_ptr<IPC::Channel> ipc_channel_;
 
   // Ensures RemoteSecurityKeyIpcServerImpl methods are called on the same
   // thread.
@@ -84,4 +84,4 @@
 
 }  // namespace remoting
 
-#endif  // REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_IPC_SERVER_IMPL_H_
\ No newline at end of file
+#endif  // REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_IPC_SERVER_IMPL_H_
diff --git a/remoting/host/security_key/remote_security_key_ipc_server_unittest.cc b/remoting/host/security_key/remote_security_key_ipc_server_unittest.cc
index 0b7b2bf..222335f 100644
--- a/remoting/host/security_key/remote_security_key_ipc_server_unittest.cc
+++ b/remoting/host/security_key/remote_security_key_ipc_server_unittest.cc
@@ -4,12 +4,12 @@
 
 #include "remoting/host/security_key/remote_security_key_ipc_server.h"
 
+#include <memory>
 #include <string>
 
 #include "base/bind.h"
 #include "base/callback.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
 #include "ipc/ipc_channel.h"
@@ -50,10 +50,10 @@
 
   // Used to allow |message_loop_| to run during tests.  The instance is reset
   // after each stage of the tests has been completed.
-  scoped_ptr<base::RunLoop> run_loop_;
+  std::unique_ptr<base::RunLoop> run_loop_;
 
   // The object under test.
-  scoped_ptr<RemoteSecurityKeyIpcServer> remote_security_key_ipc_server_;
+  std::unique_ptr<RemoteSecurityKeyIpcServer> remote_security_key_ipc_server_;
 
   // Used to validate the object under test uses the correct ID when
   // communicating over the IPC channel.
diff --git a/remoting/host/security_key/remote_security_key_main.cc b/remoting/host/security_key/remote_security_key_main.cc
index 206925a..a13efb1 100644
--- a/remoting/host/security_key/remote_security_key_main.cc
+++ b/remoting/host/security_key/remote_security_key_main.cc
@@ -4,20 +4,66 @@
 
 #include "remoting/host/security_key/remote_security_key_main.h"
 
+#include <string>
+#include <utility>
+
 #include "base/at_exit.h"
 #include "base/command_line.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/message_loop/message_loop.h"
+#include "base/run_loop.h"
 #include "remoting/host/host_exit_codes.h"
 #include "remoting/host/logging.h"
+#include "remoting/host/security_key/remote_security_key_ipc_client.h"
+#include "remoting/host/security_key/remote_security_key_message_handler.h"
 
 namespace remoting {
 
 int StartRemoteSecurityKey() {
+#if defined(OS_WIN)
+  // GetStdHandle() returns pseudo-handles for stdin and stdout even if
+  // the hosting executable specifies "Windows" subsystem. However the returned
+  // handles are invalid in that case unless standard input and output are
+  // redirected to a pipe or file.
+  base::File read_file(GetStdHandle(STD_INPUT_HANDLE));
+  base::File write_file(GetStdHandle(STD_OUTPUT_HANDLE));
+
+  // After the message handler starts, the remote security key message reader
+  // will keep doing blocking read operations on the input named pipe.
+  // If any other thread tries to perform any operation on STDIN, it will also
+  // block because the input named pipe is synchronous (non-overlapped).
+  // It is pretty common for a DLL to query the device info (GetFileType) of
+  // the STD* handles at startup. So any LoadLibrary request can potentially
+  // be blocked. To prevent that from happening we close STDIN and STDOUT
+  // handles as soon as we retrieve the corresponding file handles.
+  SetStdHandle(STD_INPUT_HANDLE, nullptr);
+  SetStdHandle(STD_OUTPUT_HANDLE, nullptr);
+#elif defined(OS_POSIX)
+  // The files are automatically closed.
+  base::File read_file(STDIN_FILENO);
+  base::File write_file(STDOUT_FILENO);
+#else
+#error Not implemented.
+#endif
+
+  base::RunLoop run_loop;
+
+  scoped_ptr<RemoteSecurityKeyIpcClient> ipc_client(
+      new RemoteSecurityKeyIpcClient());
+
+  RemoteSecurityKeyMessageHandler message_handler;
+  message_handler.Start(std::move(read_file), std::move(write_file),
+                        std::move(ipc_client), run_loop.QuitClosure());
+
+  run_loop.Run();
+
   return kSuccessExitCode;
 }
 
 int RemoteSecurityKeyMain(int argc, char** argv) {
   // This object instance is required by Chrome classes (such as MessageLoop).
   base::AtExitManager exit_manager;
+  base::MessageLoopForUI message_loop;
 
   base::CommandLine::Init(argc, argv);
   remoting::InitHostLogging();
diff --git a/remoting/host/security_key/remote_security_key_message_handler.cc b/remoting/host/security_key/remote_security_key_message_handler.cc
index cd981ba..e27e9cdc 100644
--- a/remoting/host/security_key/remote_security_key_message_handler.cc
+++ b/remoting/host/security_key/remote_security_key_message_handler.cc
@@ -25,7 +25,7 @@
 void RemoteSecurityKeyMessageHandler::Start(
     base::File message_read_stream,
     base::File message_write_stream,
-    scoped_ptr<RemoteSecurityKeyIpcClient> ipc_client,
+    std::unique_ptr<RemoteSecurityKeyIpcClient> ipc_client,
     const base::Closure& error_callback) {
   DCHECK(thread_checker_.CalledOnValidThread());
   DCHECK(message_read_stream.IsValid());
@@ -56,19 +56,19 @@
 }
 
 void RemoteSecurityKeyMessageHandler::SetRemoteSecurityKeyMessageReaderForTest(
-    scoped_ptr<RemoteSecurityKeyMessageReader> reader) {
+    std::unique_ptr<RemoteSecurityKeyMessageReader> reader) {
   DCHECK(!reader_);
   reader_ = std::move(reader);
 }
 
 void RemoteSecurityKeyMessageHandler::SetRemoteSecurityKeyMessageWriterForTest(
-    scoped_ptr<RemoteSecurityKeyMessageWriter> writer) {
+    std::unique_ptr<RemoteSecurityKeyMessageWriter> writer) {
   DCHECK(!writer_);
   writer_ = std::move(writer);
 }
 
 void RemoteSecurityKeyMessageHandler::ProcessRemoteSecurityKeyMessage(
-    scoped_ptr<SecurityKeyMessage> message) {
+    std::unique_ptr<SecurityKeyMessage> message) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
   RemoteSecurityKeyMessageType message_type = message->type();
diff --git a/remoting/host/security_key/remote_security_key_message_handler.h b/remoting/host/security_key/remote_security_key_message_handler.h
index e61d100..f36e3ed 100644
--- a/remoting/host/security_key/remote_security_key_message_handler.h
+++ b/remoting/host/security_key/remote_security_key_message_handler.h
@@ -5,12 +5,12 @@
 #ifndef REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_MESSAGE_HANDLER_H_
 #define REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_MESSAGE_HANDLER_H_
 
+#include <memory>
 #include <string>
 
 #include "base/callback.h"
 #include "base/files/file.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/threading/thread_checker.h"
 #include "remoting/host/security_key/security_key_message.h"
 
@@ -30,22 +30,23 @@
   // Sets up the handler to begin receiving and processing messages.
   void Start(base::File message_read_stream,
              base::File message_write_stream,
-             scoped_ptr<RemoteSecurityKeyIpcClient> ipc_client,
+             std::unique_ptr<RemoteSecurityKeyIpcClient> ipc_client,
              const base::Closure& error_callback);
 
   // Sets |reader_| to the instance passed in via |reader|.  This method should
   // be called before Start().
   void SetRemoteSecurityKeyMessageReaderForTest(
-      scoped_ptr<RemoteSecurityKeyMessageReader> reader);
+      std::unique_ptr<RemoteSecurityKeyMessageReader> reader);
 
   // Sets |writer_| to the instance passed in via |writer|.  This method should
   // be called before Start().
   void SetRemoteSecurityKeyMessageWriterForTest(
-      scoped_ptr<RemoteSecurityKeyMessageWriter> writer);
+      std::unique_ptr<RemoteSecurityKeyMessageWriter> writer);
 
  private:
   // RemoteSecurityKeyMessage handler.
-  void ProcessRemoteSecurityKeyMessage(scoped_ptr<SecurityKeyMessage> message);
+  void ProcessRemoteSecurityKeyMessage(
+      std::unique_ptr<SecurityKeyMessage> message);
 
   // Cleans up resources when an error occurs.
   void OnError();
@@ -68,13 +69,13 @@
   void HandleSecurityKeyRequest(const std::string& message_payload);
 
   // Used to communicate with the remote security key.
-  scoped_ptr<RemoteSecurityKeyIpcClient> ipc_client_;
+  std::unique_ptr<RemoteSecurityKeyIpcClient> ipc_client_;
 
   // Used to listen for security key messages.
-  scoped_ptr<RemoteSecurityKeyMessageReader> reader_;
+  std::unique_ptr<RemoteSecurityKeyMessageReader> reader_;
 
   // Used to write security key messages to local security key tools.
-  scoped_ptr<RemoteSecurityKeyMessageWriter> writer_;
+  std::unique_ptr<RemoteSecurityKeyMessageWriter> writer_;
 
   // Signaled when an error occurs.
   base::Closure error_callback_;
diff --git a/remoting/host/security_key/remote_security_key_message_handler_unittest.cc b/remoting/host/security_key/remote_security_key_message_handler_unittest.cc
index aa1f804..65afea2 100644
--- a/remoting/host/security_key/remote_security_key_message_handler_unittest.cc
+++ b/remoting/host/security_key/remote_security_key_message_handler_unittest.cc
@@ -4,11 +4,11 @@
 
 #include "remoting/host/security_key/remote_security_key_message_handler.h"
 
+#include <memory>
 #include <string>
 #include <utility>
 
 #include "base/bind.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
@@ -50,11 +50,11 @@
   base::WeakPtr<FakeRemoteSecurityKeyIpcClient> ipc_client_weak_ptr_;
   base::WeakPtr<FakeRemoteSecurityKeyMessageReader> reader_weak_ptr_;
   base::WeakPtr<FakeRemoteSecurityKeyMessageWriter> writer_weak_ptr_;
-  scoped_ptr<RemoteSecurityKeyMessageHandler> message_handler_;
+  std::unique_ptr<RemoteSecurityKeyMessageHandler> message_handler_;
 
  private:
   base::MessageLoopForIO message_loop_;
-  scoped_ptr<base::RunLoop> run_loop_;
+  std::unique_ptr<base::RunLoop> run_loop_;
 
   DISALLOW_COPY_AND_ASSIGN(RemoteSecurityKeyMessageHandlerTest);
 };
@@ -71,17 +71,17 @@
   run_loop_.reset(new base::RunLoop());
   message_handler_.reset(new RemoteSecurityKeyMessageHandler());
 
-  scoped_ptr<FakeRemoteSecurityKeyIpcClient> ipc_client(
+  std::unique_ptr<FakeRemoteSecurityKeyIpcClient> ipc_client(
       new FakeRemoteSecurityKeyIpcClient(
           base::Bind(&RemoteSecurityKeyMessageHandlerTest::OperationComplete,
                      base::Unretained(this))));
   ipc_client_weak_ptr_ = ipc_client->AsWeakPtr();
 
-  scoped_ptr<FakeRemoteSecurityKeyMessageReader> reader(
+  std::unique_ptr<FakeRemoteSecurityKeyMessageReader> reader(
       new FakeRemoteSecurityKeyMessageReader());
   reader_weak_ptr_ = reader->AsWeakPtr();
 
-  scoped_ptr<FakeRemoteSecurityKeyMessageWriter> writer(
+  std::unique_ptr<FakeRemoteSecurityKeyMessageWriter> writer(
       new FakeRemoteSecurityKeyMessageWriter(
           base::Bind(&RemoteSecurityKeyMessageHandlerTest::OperationComplete,
                      base::Unretained(this))));
diff --git a/remoting/host/security_key/remote_security_key_message_reader.cc b/remoting/host/security_key/remote_security_key_message_reader.cc
index 1497887..2c2c341 100644
--- a/remoting/host/security_key/remote_security_key_message_reader.cc
+++ b/remoting/host/security_key/remote_security_key_message_reader.cc
@@ -96,7 +96,7 @@
       return;
     }
 
-    scoped_ptr<SecurityKeyMessage> message(new SecurityKeyMessage());
+    std::unique_ptr<SecurityKeyMessage> message(new SecurityKeyMessage());
     if (!message->ParseMessage(message_data)) {
       LOG(ERROR) << "Invalid message data received.";
       NotifyError();
@@ -121,7 +121,7 @@
 }
 
 void RemoteSecurityKeyMessageReader::InvokeMessageCallback(
-    scoped_ptr<SecurityKeyMessage> message) {
+    std::unique_ptr<SecurityKeyMessage> message) {
   DCHECK(main_task_runner_->RunsTasksOnCurrentThread());
   message_callback_.Run(std::move(message));
 }
diff --git a/remoting/host/security_key/remote_security_key_message_reader_impl.cc b/remoting/host/security_key/remote_security_key_message_reader_impl.cc
index 0431742..55c4061 100644
--- a/remoting/host/security_key/remote_security_key_message_reader_impl.cc
+++ b/remoting/host/security_key/remote_security_key_message_reader_impl.cc
@@ -95,7 +95,7 @@
       return;
     }
 
-    scoped_ptr<SecurityKeyMessage> message(new SecurityKeyMessage());
+    std::unique_ptr<SecurityKeyMessage> message(new SecurityKeyMessage());
     if (!message->ParseMessage(message_data)) {
       LOG(ERROR) << "Invalid message data received.";
       NotifyError();
@@ -120,7 +120,7 @@
 }
 
 void RemoteSecurityKeyMessageReaderImpl::InvokeMessageCallback(
-    scoped_ptr<SecurityKeyMessage> message) {
+    std::unique_ptr<SecurityKeyMessage> message) {
   DCHECK(main_task_runner_->RunsTasksOnCurrentThread());
   message_callback_.Run(std::move(message));
 }
diff --git a/remoting/host/security_key/remote_security_key_message_reader_impl.h b/remoting/host/security_key/remote_security_key_message_reader_impl.h
index e1e0747..873d478 100644
--- a/remoting/host/security_key/remote_security_key_message_reader_impl.h
+++ b/remoting/host/security_key/remote_security_key_message_reader_impl.h
@@ -5,10 +5,11 @@
 #ifndef REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_MESSAGE_READER_IMPL_H_
 #define REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_MESSAGE_READER_IMPL_H_
 
+#include <memory>
+
 #include "base/callback.h"
 #include "base/files/file.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/threading/thread.h"
 #include "remoting/host/security_key/remote_security_key_message_reader.h"
@@ -42,7 +43,7 @@
 
   // Used for callbacks on the appropriate task runner to signal status changes.
   // These callbacks are invoked on |main_task_runner_|.
-  void InvokeMessageCallback(scoped_ptr<SecurityKeyMessage> message);
+  void InvokeMessageCallback(std::unique_ptr<SecurityKeyMessage> message);
   void InvokeErrorCallback();
 
   base::File read_stream_;
diff --git a/remoting/host/security_key/remote_security_key_message_reader_impl_unittest.cc b/remoting/host/security_key/remote_security_key_message_reader_impl_unittest.cc
index 3664a6ca..88d5d71 100644
--- a/remoting/host/security_key/remote_security_key_message_reader_impl_unittest.cc
+++ b/remoting/host/security_key/remote_security_key_message_reader_impl_unittest.cc
@@ -2,17 +2,16 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "remoting/host/security_key/remote_security_key_message_reader.h"
+#include "remoting/host/security_key/remote_security_key_message_reader_impl.h"
 
 #include <cstdint>
+#include <memory>
 #include <string>
 #include <utility>
 
 #include "base/bind.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
-#include "remoting/host/security_key/remote_security_key_message_reader_impl.h"
 #include "remoting/host/security_key/security_key_message.h"
 #include "remoting/host/setup/test_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
@@ -32,7 +31,7 @@
 
   // SecurityKeyMessageCallback passed to the Reader. Stores |message| so it can
   // be verified by tests.
-  void OnMessage(scoped_ptr<SecurityKeyMessage> message);
+  void OnMessage(std::unique_ptr<SecurityKeyMessage> message);
 
   // Used as a callback to signal completion.
   void OperationComplete();
@@ -55,15 +54,15 @@
   // Writes some data to the write-end of the pipe.
   void WriteData(const char* data, int length);
 
-  scoped_ptr<RemoteSecurityKeyMessageReader> reader_;
+  std::unique_ptr<RemoteSecurityKeyMessageReader> reader_;
   base::File read_file_;
   base::File write_file_;
 
-  std::vector<scoped_ptr<SecurityKeyMessage>> messages_received_;
+  std::vector<std::unique_ptr<SecurityKeyMessage>> messages_received_;
 
  private:
   base::MessageLoopForIO message_loop_;
-  scoped_ptr<base::RunLoop> run_loop_;
+  std::unique_ptr<base::RunLoop> run_loop_;
 
   DISALLOW_COPY_AND_ASSIGN(RemoteSecurityKeyMessageReaderImplTest);
 };
@@ -99,7 +98,7 @@
 }
 
 void RemoteSecurityKeyMessageReaderImplTest::OnMessage(
-    scoped_ptr<SecurityKeyMessage> message) {
+    std::unique_ptr<SecurityKeyMessage> message) {
   messages_received_.push_back(std::move(message));
   OperationComplete();
 }
diff --git a/remoting/host/security_key/remote_security_key_message_writer_impl_unittest.cc b/remoting/host/security_key/remote_security_key_message_writer_impl_unittest.cc
index 4aeb0b8..5884772 100644
--- a/remoting/host/security_key/remote_security_key_message_writer_impl_unittest.cc
+++ b/remoting/host/security_key/remote_security_key_message_writer_impl_unittest.cc
@@ -2,20 +2,19 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "remoting/host/security_key/remote_security_key_message_writer.h"
+#include "remoting/host/security_key/remote_security_key_message_writer_impl.h"
 
 #include <cstdint>
+#include <memory>
 #include <utility>
 
 #include "base/bind.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
 #include "base/stl_util.h"
 #include "base/task_runner_util.h"
 #include "base/threading/thread.h"
 #include "base/time/time.h"
-#include "remoting/host/security_key/remote_security_key_message_writer_impl.h"
 #include "remoting/host/security_key/security_key_message.h"
 #include "remoting/host/setup/test_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
@@ -49,7 +48,7 @@
   // they were written correctly.
   void WriteMessageToOutput(const std::string& payload);
 
-  scoped_ptr<RemoteSecurityKeyMessageWriter> writer_;
+  std::unique_ptr<RemoteSecurityKeyMessageWriter> writer_;
   base::File read_file_;
   base::File write_file_;
 
diff --git a/remoting/host/security_key/security_key_message.cc b/remoting/host/security_key/security_key_message.cc
index 0b8b343b..77614bb 100644
--- a/remoting/host/security_key/security_key_message.cc
+++ b/remoting/host/security_key/security_key_message.cc
@@ -5,12 +5,12 @@
 #include "remoting/host/security_key/security_key_message.h"
 
 #include <cstdint>
+#include <memory>
 #include <string>
 #include <utility>
 
 #include "base/callback.h"
 #include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
 
 namespace {
 
@@ -55,10 +55,10 @@
   }
 }
 
-scoped_ptr<SecurityKeyMessage> SecurityKeyMessage::CreateMessageForTest(
+std::unique_ptr<SecurityKeyMessage> SecurityKeyMessage::CreateMessageForTest(
     RemoteSecurityKeyMessageType type,
     const std::string& payload) {
-  scoped_ptr<SecurityKeyMessage> message(new SecurityKeyMessage());
+  std::unique_ptr<SecurityKeyMessage> message(new SecurityKeyMessage());
   message->type_ = type;
   message->payload_ = payload;
 
@@ -84,4 +84,4 @@
   return true;
 }
 
-}  // namespace remoting
\ No newline at end of file
+}  // namespace remoting
diff --git a/remoting/host/security_key/security_key_message.h b/remoting/host/security_key/security_key_message.h
index 1074a4a..cdf67c5 100644
--- a/remoting/host/security_key/security_key_message.h
+++ b/remoting/host/security_key/security_key_message.h
@@ -6,11 +6,11 @@
 #define REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_MESSAGE_H_
 
 #include <cstdint>
+#include <memory>
 #include <string>
 
 #include "base/callback_forward.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 
 namespace remoting {
 
@@ -118,7 +118,7 @@
 
   // Creates a message from the passed in values, no validation is done as this
   // method is only expected to be called from test code.
-  static scoped_ptr<SecurityKeyMessage> CreateMessageForTest(
+  static std::unique_ptr<SecurityKeyMessage> CreateMessageForTest(
       RemoteSecurityKeyMessageType type,
       const std::string& payload);
 
@@ -138,7 +138,7 @@
 };
 
 // Used to pass remote security key message data between classes.
-typedef base::Callback<void(scoped_ptr<SecurityKeyMessage> message)>
+typedef base::Callback<void(std::unique_ptr<SecurityKeyMessage> message)>
     SecurityKeyMessageCallback;
 
 }  // namespace remoting
diff --git a/remoting/host/server_log_entry_host.cc b/remoting/host/server_log_entry_host.cc
index 2ede7e8..62d1e79 100644
--- a/remoting/host/server_log_entry_host.cc
+++ b/remoting/host/server_log_entry_host.cc
@@ -33,17 +33,17 @@
 
 }  // namespace
 
-scoped_ptr<ServerLogEntry> MakeLogEntryForSessionStateChange(
+std::unique_ptr<ServerLogEntry> MakeLogEntryForSessionStateChange(
     bool connected) {
-  scoped_ptr<ServerLogEntry> entry(new ServerLogEntry());
+  std::unique_ptr<ServerLogEntry> entry(new ServerLogEntry());
   entry->AddRoleField(kValueRoleHost);
   entry->AddEventNameField(kValueEventNameSessionState);
   entry->Set(kKeySessionState, GetValueSessionState(connected));
   return entry;
 }
 
-scoped_ptr<ServerLogEntry> MakeLogEntryForHeartbeat() {
-  scoped_ptr<ServerLogEntry> entry(new ServerLogEntry());
+std::unique_ptr<ServerLogEntry> MakeLogEntryForHeartbeat() {
+  std::unique_ptr<ServerLogEntry> entry(new ServerLogEntry());
   entry->AddRoleField(kValueRoleHost);
   entry->AddEventNameField(kValueEventNameHeartbeat);
   return entry;
diff --git a/remoting/host/server_log_entry_host.h b/remoting/host/server_log_entry_host.h
index 1fef4c1..e93154a 100644
--- a/remoting/host/server_log_entry_host.h
+++ b/remoting/host/server_log_entry_host.h
@@ -13,11 +13,11 @@
 
 // Constructs a log entry for a session state change.
 // Currently this is either connection or disconnection.
-scoped_ptr<ServerLogEntry> MakeLogEntryForSessionStateChange(
+std::unique_ptr<ServerLogEntry> MakeLogEntryForSessionStateChange(
     bool connected);
 
 // Constructs a log entry for a heartbeat.
-scoped_ptr<ServerLogEntry> MakeLogEntryForHeartbeat();
+std::unique_ptr<ServerLogEntry> MakeLogEntryForHeartbeat();
 
 // Adds fields describing the host to this log entry.
 void AddHostFieldsToLogEntry(ServerLogEntry* entry);
diff --git a/remoting/host/server_log_entry_host_unittest.cc b/remoting/host/server_log_entry_host_unittest.cc
index 59f6709b..f70d4311 100644
--- a/remoting/host/server_log_entry_host_unittest.cc
+++ b/remoting/host/server_log_entry_host_unittest.cc
@@ -2,10 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "base/memory/scoped_ptr.h"
+#include "remoting/host/server_log_entry_host.h"
+
+#include <memory>
+
 #include "base/strings/stringize_macros.h"
 #include "build/build_config.h"
-#include "remoting/host/server_log_entry_host.h"
 #include "remoting/signaling/server_log_entry.h"
 #include "remoting/signaling/server_log_entry_unittest.h"
 #include "testing/gtest/include/gtest/gtest.h"
@@ -17,8 +19,9 @@
 namespace remoting {
 
 TEST(ServerLogEntryHostTest, MakeForSessionStateChange) {
-  scoped_ptr<ServerLogEntry> entry(MakeLogEntryForSessionStateChange(true));
-  scoped_ptr<XmlElement> stanza = entry->ToStanza();
+  std::unique_ptr<ServerLogEntry> entry(
+      MakeLogEntryForSessionStateChange(true));
+  std::unique_ptr<XmlElement> stanza = entry->ToStanza();
   std::string error;
   std::map<std::string, std::string> key_value_pairs;
   key_value_pairs["role"] = "host";
@@ -30,8 +33,8 @@
 }
 
 TEST(ServerLogEntryHostTest, MakeForHeartbeat) {
-  scoped_ptr<ServerLogEntry> entry(MakeLogEntryForHeartbeat());
-  scoped_ptr<XmlElement> stanza = entry->ToStanza();
+  std::unique_ptr<ServerLogEntry> entry(MakeLogEntryForHeartbeat());
+  std::unique_ptr<XmlElement> stanza = entry->ToStanza();
   std::string error;
   std::map<std::string, std::string> key_value_pairs;
   key_value_pairs["role"] = "host";
@@ -42,9 +45,10 @@
 }
 
 TEST(ServerLogEntryHostTest, AddHostFields) {
-  scoped_ptr<ServerLogEntry> entry(MakeLogEntryForSessionStateChange(true));
+  std::unique_ptr<ServerLogEntry> entry(
+      MakeLogEntryForSessionStateChange(true));
   AddHostFieldsToLogEntry(entry.get());
-  scoped_ptr<XmlElement> stanza = entry->ToStanza();
+  std::unique_ptr<XmlElement> stanza = entry->ToStanza();
   std::string error;
   std::map<std::string, std::string> key_value_pairs;
   key_value_pairs["role"] = "host";
@@ -77,9 +81,10 @@
 }
 
 TEST(ServerLogEntryHostTest, AddModeField1) {
-  scoped_ptr<ServerLogEntry> entry(MakeLogEntryForSessionStateChange(true));
+  std::unique_ptr<ServerLogEntry> entry(
+      MakeLogEntryForSessionStateChange(true));
   entry->AddModeField(ServerLogEntry::IT2ME);
-  scoped_ptr<XmlElement> stanza = entry->ToStanza();
+  std::unique_ptr<XmlElement> stanza = entry->ToStanza();
   std::string error;
   std::map<std::string, std::string> key_value_pairs;
   key_value_pairs["role"] = "host";
@@ -92,9 +97,10 @@
 }
 
 TEST(ServerLogEntryHostTest, AddModeField2) {
-  scoped_ptr<ServerLogEntry> entry(MakeLogEntryForSessionStateChange(true));
+  std::unique_ptr<ServerLogEntry> entry(
+      MakeLogEntryForSessionStateChange(true));
   entry->AddModeField(ServerLogEntry::ME2ME);
-  scoped_ptr<XmlElement> stanza = entry->ToStanza();
+  std::unique_ptr<XmlElement> stanza = entry->ToStanza();
   std::string error;
   std::map<std::string, std::string> key_value_pairs;
   key_value_pairs["role"] = "host";
diff --git a/remoting/host/setup/daemon_controller.cc b/remoting/host/setup/daemon_controller.cc
index f871d43d..d8677b7 100644
--- a/remoting/host/setup/daemon_controller.cc
+++ b/remoting/host/setup/daemon_controller.cc
@@ -20,7 +20,7 @@
 // Name of the Daemon Controller's worker thread.
 const char kDaemonControllerThreadName[] = "Daemon Controller thread";
 
-DaemonController::DaemonController(scoped_ptr<Delegate> delegate)
+DaemonController::DaemonController(std::unique_ptr<Delegate> delegate)
     : caller_task_runner_(base::ThreadTaskRunnerHandle::Get()),
       delegate_(std::move(delegate)) {
   // Launch the delegate thread.
@@ -51,7 +51,7 @@
 }
 
 void DaemonController::SetConfigAndStart(
-    scoped_ptr<base::DictionaryValue> config,
+    std::unique_ptr<base::DictionaryValue> config,
     bool consent,
     const CompletionCallback& done) {
   DCHECK(caller_task_runner_->BelongsToCurrentThread());
@@ -64,8 +64,9 @@
   ServiceOrQueueRequest(request);
 }
 
-void DaemonController::UpdateConfig(scoped_ptr<base::DictionaryValue> config,
-                                    const CompletionCallback& done) {
+void DaemonController::UpdateConfig(
+    std::unique_ptr<base::DictionaryValue> config,
+    const CompletionCallback& done) {
   DCHECK(caller_task_runner_->BelongsToCurrentThread());
 
   DaemonController::CompletionCallback wrapped_done = base::Bind(
@@ -109,13 +110,13 @@
 void DaemonController::DoGetConfig(const GetConfigCallback& done) {
   DCHECK(delegate_task_runner_->BelongsToCurrentThread());
 
-  scoped_ptr<base::DictionaryValue> config = delegate_->GetConfig();
+  std::unique_ptr<base::DictionaryValue> config = delegate_->GetConfig();
   caller_task_runner_->PostTask(FROM_HERE,
                                 base::Bind(done, base::Passed(&config)));
 }
 
 void DaemonController::DoSetConfigAndStart(
-    scoped_ptr<base::DictionaryValue> config,
+    std::unique_ptr<base::DictionaryValue> config,
     bool consent,
     const CompletionCallback& done) {
   DCHECK(delegate_task_runner_->BelongsToCurrentThread());
@@ -124,7 +125,7 @@
 }
 
 void DaemonController::DoUpdateConfig(
-    scoped_ptr<base::DictionaryValue> config,
+    std::unique_ptr<base::DictionaryValue> config,
     const CompletionCallback& done) {
   DCHECK(delegate_task_runner_->BelongsToCurrentThread());
 
@@ -163,7 +164,7 @@
 
 void DaemonController::InvokeConfigCallbackAndScheduleNext(
     const GetConfigCallback& done,
-    scoped_ptr<base::DictionaryValue> config) {
+    std::unique_ptr<base::DictionaryValue> config) {
   DCHECK(caller_task_runner_->BelongsToCurrentThread());
 
   done.Run(std::move(config));
diff --git a/remoting/host/setup/daemon_controller.h b/remoting/host/setup/daemon_controller.h
index 52ab0d1..8d135906 100644
--- a/remoting/host/setup/daemon_controller.h
+++ b/remoting/host/setup/daemon_controller.h
@@ -5,13 +5,13 @@
 #ifndef REMOTING_HOST_SETUP_DAEMON_CONTROLLER_H_
 #define REMOTING_HOST_SETUP_DAEMON_CONTROLLER_H_
 
+#include <memory>
 #include <queue>
 #include <string>
 
 #include "base/callback.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 
 namespace base {
 class DictionaryValue;
@@ -66,7 +66,7 @@
   // is returned containing host_id and xmpp_login, with security-sensitive
   // fields filtered out. An empty dictionary is returned if the host is not
   // configured, and nullptr if the configuration is corrupt or cannot be read.
-  typedef base::Callback<void (scoped_ptr<base::DictionaryValue> config)>
+  typedef base::Callback<void(std::unique_ptr<base::DictionaryValue> config)>
       GetConfigCallback;
 
   // Callback used for asynchronous operations, e.g. when
@@ -107,13 +107,13 @@
 
     // Queries current host configuration. Any values that might be security
     // sensitive have been filtered out.
-    virtual scoped_ptr<base::DictionaryValue> GetConfig() = 0;
+    virtual std::unique_ptr<base::DictionaryValue> GetConfig() = 0;
 
     // Starts the daemon process. This may require that the daemon be
     // downloaded and installed. |done| is invoked on the calling thread when
     // the operation is completed.
     virtual void SetConfigAndStart(
-        scoped_ptr<base::DictionaryValue> config,
+        std::unique_ptr<base::DictionaryValue> config,
         bool consent,
         const CompletionCallback& done) = 0;
 
@@ -122,9 +122,8 @@
     // |config| is preserved. |config| must not contain host_id or xmpp_login
     // values, because implementations of this method cannot change them. |done|
     // is invoked on the calling thread when the operation is completed.
-    virtual void UpdateConfig(
-        scoped_ptr<base::DictionaryValue> config,
-        const CompletionCallback& done) = 0;
+    virtual void UpdateConfig(std::unique_ptr<base::DictionaryValue> config,
+                              const CompletionCallback& done) = 0;
 
     // Stops the daemon process. |done| is invoked on the calling thread when
     // the operation is completed.
@@ -136,7 +135,7 @@
 
   static scoped_refptr<DaemonController> Create();
 
-  explicit DaemonController(scoped_ptr<Delegate> delegate);
+  explicit DaemonController(std::unique_ptr<Delegate> delegate);
 
   // Return the "installed/running" state of the daemon process.
   //
@@ -159,7 +158,7 @@
   // these two steps are merged for simplicity. Consider splitting it
   // into SetConfig() and Start() once we have basic host setup flow
   // working.
-  void SetConfigAndStart(scoped_ptr<base::DictionaryValue> config,
+  void SetConfigAndStart(std::unique_ptr<base::DictionaryValue> config,
                          bool consent,
                          const CompletionCallback& done);
 
@@ -168,7 +167,7 @@
   // Any value in the existing configuration that isn't specified in |config|
   // is preserved. |config| must not contain host_id or xmpp_login values,
   // because implementations of this method cannot change them.
-  void UpdateConfig(scoped_ptr<base::DictionaryValue> config,
+  void UpdateConfig(std::unique_ptr<base::DictionaryValue> config,
                     const CompletionCallback& done);
 
   // Stop the daemon process. It is permitted to call Stop while the daemon
@@ -188,10 +187,10 @@
 
   // Blocking helper methods used to call the delegate.
   void DoGetConfig(const GetConfigCallback& done);
-  void DoSetConfigAndStart(scoped_ptr<base::DictionaryValue> config,
+  void DoSetConfigAndStart(std::unique_ptr<base::DictionaryValue> config,
                            bool consent,
                            const CompletionCallback& done);
-  void DoUpdateConfig(scoped_ptr<base::DictionaryValue> config,
+  void DoUpdateConfig(std::unique_ptr<base::DictionaryValue> config,
                       const CompletionCallback& done);
   void DoStop(const CompletionCallback& done);
   void DoGetUsageStatsConsent(const GetUsageStatsConsentCallback& done);
@@ -203,7 +202,7 @@
       AsyncResult result);
   void InvokeConfigCallbackAndScheduleNext(
       const GetConfigCallback& done,
-      scoped_ptr<base::DictionaryValue> config);
+      std::unique_ptr<base::DictionaryValue> config);
   void InvokeConsentCallbackAndScheduleNext(
       const GetUsageStatsConsentCallback& done,
       const UsageStatsConsent& consent);
@@ -221,9 +220,9 @@
   // called at a time.
   scoped_refptr<AutoThreadTaskRunner> delegate_task_runner_;
 
-  scoped_ptr<AutoThread> delegate_thread_;
+  std::unique_ptr<AutoThread> delegate_thread_;
 
-  scoped_ptr<Delegate> delegate_;
+  std::unique_ptr<Delegate> delegate_;
 
   std::queue<base::Closure> pending_requests_;
 
diff --git a/remoting/host/setup/daemon_controller_delegate_linux.cc b/remoting/host/setup/daemon_controller_delegate_linux.cc
index f8096ca..c37bd5b 100644
--- a/remoting/host/setup/daemon_controller_delegate_linux.cc
+++ b/remoting/host/setup/daemon_controller_delegate_linux.cc
@@ -16,6 +16,7 @@
 #include "base/json/json_writer.h"
 #include "base/logging.h"
 #include "base/md5.h"
+#include "base/memory/ptr_util.h"
 #include "base/path_service.h"
 #include "base/process/launch.h"
 #include "base/process/process.h"
@@ -125,13 +126,14 @@
   }
 }
 
-scoped_ptr<base::DictionaryValue> DaemonControllerDelegateLinux::GetConfig() {
-  scoped_ptr<base::DictionaryValue> config(
+std::unique_ptr<base::DictionaryValue>
+DaemonControllerDelegateLinux::GetConfig() {
+  std::unique_ptr<base::DictionaryValue> config(
       HostConfigFromJsonFile(GetConfigPath()));
   if (!config)
     return nullptr;
 
-  scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue());
+  std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue());
   std::string value;
   if (config->GetString(kHostIdConfigPath, &value)) {
     result->SetString(kHostIdConfigPath, value);
@@ -143,7 +145,7 @@
 }
 
 void DaemonControllerDelegateLinux::SetConfigAndStart(
-    scoped_ptr<base::DictionaryValue> config,
+    std::unique_ptr<base::DictionaryValue> config,
     bool consent,
     const DaemonController::CompletionCallback& done) {
   // Add the user to chrome-remote-desktop group first.
@@ -185,9 +187,9 @@
 }
 
 void DaemonControllerDelegateLinux::UpdateConfig(
-    scoped_ptr<base::DictionaryValue> config,
+    std::unique_ptr<base::DictionaryValue> config,
     const DaemonController::CompletionCallback& done) {
-  scoped_ptr<base::DictionaryValue> new_config(
+  std::unique_ptr<base::DictionaryValue> new_config(
       HostConfigFromJsonFile(GetConfigPath()));
   if (new_config)
     new_config->MergeDictionary(config.get());
@@ -230,7 +232,7 @@
 
 scoped_refptr<DaemonController> DaemonController::Create() {
   return new DaemonController(
-      make_scoped_ptr(new DaemonControllerDelegateLinux()));
+      base::WrapUnique(new DaemonControllerDelegateLinux()));
 }
 
 }  // namespace remoting
diff --git a/remoting/host/setup/daemon_controller_delegate_linux.h b/remoting/host/setup/daemon_controller_delegate_linux.h
index 9bcc81c..eee9839 100644
--- a/remoting/host/setup/daemon_controller_delegate_linux.h
+++ b/remoting/host/setup/daemon_controller_delegate_linux.h
@@ -5,8 +5,9 @@
 #ifndef REMOTING_HOST_SETUP_DAEMON_CONTROLLER_DELEGATE_LINUX_H_
 #define REMOTING_HOST_SETUP_DAEMON_CONTROLLER_DELEGATE_LINUX_H_
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "remoting/host/setup/daemon_controller.h"
 
 namespace remoting {
@@ -18,12 +19,12 @@
 
   // DaemonController::Delegate interface.
   DaemonController::State GetState() override;
-  scoped_ptr<base::DictionaryValue> GetConfig() override;
+  std::unique_ptr<base::DictionaryValue> GetConfig() override;
   void SetConfigAndStart(
-      scoped_ptr<base::DictionaryValue> config,
+      std::unique_ptr<base::DictionaryValue> config,
       bool consent,
       const DaemonController::CompletionCallback& done) override;
-  void UpdateConfig(scoped_ptr<base::DictionaryValue> config,
+  void UpdateConfig(std::unique_ptr<base::DictionaryValue> config,
                     const DaemonController::CompletionCallback& done) override;
   void Stop(const DaemonController::CompletionCallback& done) override;
   DaemonController::UsageStatsConsent GetUsageStatsConsent() override;
diff --git a/remoting/host/setup/daemon_controller_delegate_mac.h b/remoting/host/setup/daemon_controller_delegate_mac.h
index 7ae6c57..d85f186c 100644
--- a/remoting/host/setup/daemon_controller_delegate_mac.h
+++ b/remoting/host/setup/daemon_controller_delegate_mac.h
@@ -5,9 +5,12 @@
 #ifndef REMOTING_HOST_SETUP_DAEMON_CONTROLLER_DELEGATE_MAC_H_
 #define REMOTING_HOST_SETUP_DAEMON_CONTROLLER_DELEGATE_MAC_H_
 
+#include <CoreFoundation/CoreFoundation.h>
+
+#include <memory>
+
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "remoting/host/setup/daemon_controller.h"
 
 namespace remoting {
@@ -19,12 +22,12 @@
 
   // DaemonController::Delegate interface.
   DaemonController::State GetState() override;
-  scoped_ptr<base::DictionaryValue> GetConfig() override;
+  std::unique_ptr<base::DictionaryValue> GetConfig() override;
   void SetConfigAndStart(
-      scoped_ptr<base::DictionaryValue> config,
+      std::unique_ptr<base::DictionaryValue> config,
       bool consent,
       const DaemonController::CompletionCallback& done) override;
-  void UpdateConfig(scoped_ptr<base::DictionaryValue> config,
+  void UpdateConfig(std::unique_ptr<base::DictionaryValue> config,
                     const DaemonController::CompletionCallback& done) override;
   void Stop(const DaemonController::CompletionCallback& done) override;
   DaemonController::UsageStatsConsent GetUsageStatsConsent() override;
diff --git a/remoting/host/setup/daemon_controller_delegate_mac.mm b/remoting/host/setup/daemon_controller_delegate_mac.mm
index 4363a40..c8386ea 100644
--- a/remoting/host/setup/daemon_controller_delegate_mac.mm
+++ b/remoting/host/setup/daemon_controller_delegate_mac.mm
@@ -2,10 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include <CoreFoundation/CoreFoundation.h>
-
 #include "remoting/host/setup/daemon_controller_delegate_mac.h"
 
+#include <CoreFoundation/CoreFoundation.h>
 #include <launch.h>
 #include <stdio.h>
 #include <sys/types.h>
@@ -21,6 +20,7 @@
 #include "base/mac/mac_logging.h"
 #include "base/mac/mac_util.h"
 #include "base/mac/scoped_launch_data.h"
+#include "base/memory/ptr_util.h"
 #include "base/time/time.h"
 #include "base/values.h"
 #include "remoting/host/constants_mac.h"
@@ -48,14 +48,15 @@
   }
 }
 
-scoped_ptr<base::DictionaryValue> DaemonControllerDelegateMac::GetConfig() {
+std::unique_ptr<base::DictionaryValue>
+DaemonControllerDelegateMac::GetConfig() {
   base::FilePath config_path(kHostConfigFilePath);
-  scoped_ptr<base::DictionaryValue> host_config(
+  std::unique_ptr<base::DictionaryValue> host_config(
       HostConfigFromJsonFile(config_path));
   if (!host_config)
     return nullptr;
 
-  scoped_ptr<base::DictionaryValue> config(new base::DictionaryValue);
+  std::unique_ptr<base::DictionaryValue> config(new base::DictionaryValue);
   std::string value;
   if (host_config->GetString(kHostIdConfigPath, &value))
     config->SetString(kHostIdConfigPath, value);
@@ -65,7 +66,7 @@
 }
 
 void DaemonControllerDelegateMac::SetConfigAndStart(
-    scoped_ptr<base::DictionaryValue> config,
+    std::unique_ptr<base::DictionaryValue> config,
     bool consent,
     const DaemonController::CompletionCallback& done) {
   config->SetBoolean(kUsageStatsConsentConfigPath, consent);
@@ -73,10 +74,10 @@
 }
 
 void DaemonControllerDelegateMac::UpdateConfig(
-    scoped_ptr<base::DictionaryValue> config,
+    std::unique_ptr<base::DictionaryValue> config,
     const DaemonController::CompletionCallback& done) {
   base::FilePath config_file_path(kHostConfigFilePath);
-  scoped_ptr<base::DictionaryValue> host_config(
+  std::unique_ptr<base::DictionaryValue> host_config(
       HostConfigFromJsonFile(config_file_path));
   if (!host_config) {
     done.Run(DaemonController::RESULT_FAILED);
@@ -101,7 +102,7 @@
   consent.set_by_policy = false;
 
   base::FilePath config_file_path(kHostConfigFilePath);
-  scoped_ptr<base::DictionaryValue> host_config(
+  std::unique_ptr<base::DictionaryValue> host_config(
       HostConfigFromJsonFile(config_file_path));
   if (host_config) {
     host_config->GetBoolean(kUsageStatsConsentConfigPath, &consent.allowed);
@@ -250,7 +251,7 @@
 
 scoped_refptr<DaemonController> DaemonController::Create() {
   return new DaemonController(
-      make_scoped_ptr(new DaemonControllerDelegateMac()));
+      base::WrapUnique(new DaemonControllerDelegateMac()));
 }
 
 }  // namespace remoting
diff --git a/remoting/host/setup/daemon_controller_delegate_win.cc b/remoting/host/setup/daemon_controller_delegate_win.cc
index 91e72679..f1cf44eb 100644
--- a/remoting/host/setup/daemon_controller_delegate_win.cc
+++ b/remoting/host/setup/daemon_controller_delegate_win.cc
@@ -12,6 +12,7 @@
 #include "base/json/json_writer.h"
 #include "base/logging.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/thread_task_runner_handle.h"
 #include "base/values.h"
 #include "base/win/scoped_bstr.h"
@@ -66,7 +67,7 @@
 // Reads and parses the configuration file up to |kMaxConfigFileSize| in
 // size.
 bool ReadConfig(const base::FilePath& filename,
-                scoped_ptr<base::DictionaryValue>* config_out) {
+                std::unique_ptr<base::DictionaryValue>* config_out) {
   std::string file_content;
   if (!base::ReadFileToStringWithMaxSize(filename, &file_content,
                                          kMaxConfigFileSize)) {
@@ -75,7 +76,7 @@
   }
 
   // Parse the JSON configuration, expecting it to contain a dictionary.
-  scoped_ptr<base::Value> value =
+  std::unique_ptr<base::Value> value =
       base::JSONReader::Read(file_content, base::JSON_ALLOW_TRAILING_COMMAS);
 
   base::DictionaryValue* dictionary;
@@ -159,7 +160,7 @@
   }
 
   // Extract the configuration data that the user will verify.
-  scoped_ptr<base::Value> config_value = base::JSONReader::Read(content);
+  std::unique_ptr<base::Value> config_value = base::JSONReader::Read(content);
   if (!config_value.get()) {
     return false;
   }
@@ -368,11 +369,12 @@
   return ConvertToDaemonState(status.dwCurrentState);
 }
 
-scoped_ptr<base::DictionaryValue> DaemonControllerDelegateWin::GetConfig() {
+std::unique_ptr<base::DictionaryValue>
+DaemonControllerDelegateWin::GetConfig() {
   base::FilePath config_dir = remoting::GetConfigDir();
 
   // Read the unprivileged part of host configuration.
-  scoped_ptr<base::DictionaryValue> config;
+  std::unique_ptr<base::DictionaryValue> config;
   if (!ReadConfig(config_dir.Append(kUnprivilegedConfigFileName), &config))
     return nullptr;
 
@@ -380,7 +382,7 @@
 }
 
 void DaemonControllerDelegateWin::UpdateConfig(
-    scoped_ptr<base::DictionaryValue> config,
+    std::unique_ptr<base::DictionaryValue> config,
     const DaemonController::CompletionCallback& done) {
   // Check for bad keys.
   for (size_t i = 0; i < arraysize(kReadonlyKeys); ++i) {
@@ -393,7 +395,7 @@
   }
   // Get the old config.
   base::FilePath config_dir = remoting::GetConfigDir();
-  scoped_ptr<base::DictionaryValue> config_old;
+  std::unique_ptr<base::DictionaryValue> config_old;
   if (!ReadConfig(config_dir.Append(kConfigFileName), &config_old)) {
     InvokeCompletionCallback(done, false);
     return;
@@ -438,7 +440,7 @@
 }
 
 void DaemonControllerDelegateWin::SetConfigAndStart(
-    scoped_ptr<base::DictionaryValue> config,
+    std::unique_ptr<base::DictionaryValue> config,
     bool consent,
     const DaemonController::CompletionCallback& done) {
   // Record the user's consent.
@@ -470,7 +472,7 @@
 
 scoped_refptr<DaemonController> DaemonController::Create() {
   return new DaemonController(
-      make_scoped_ptr(new DaemonControllerDelegateWin()));
+      base::WrapUnique(new DaemonControllerDelegateWin()));
 }
 
 }  // namespace remoting
diff --git a/remoting/host/setup/daemon_controller_delegate_win.h b/remoting/host/setup/daemon_controller_delegate_win.h
index f2aafc4..d10fc34 100644
--- a/remoting/host/setup/daemon_controller_delegate_win.h
+++ b/remoting/host/setup/daemon_controller_delegate_win.h
@@ -19,14 +19,13 @@
 
   // DaemonController::Delegate interface.
   DaemonController::State GetState() override;
-  scoped_ptr<base::DictionaryValue> GetConfig() override;
+  std::unique_ptr<base::DictionaryValue> GetConfig() override;
   void SetConfigAndStart(
-      scoped_ptr<base::DictionaryValue> config,
+      std::unique_ptr<base::DictionaryValue> config,
       bool consent,
       const DaemonController::CompletionCallback& done) override;
-  void UpdateConfig(
-      scoped_ptr<base::DictionaryValue> config,
-      const DaemonController::CompletionCallback& done) override;
+  void UpdateConfig(std::unique_ptr<base::DictionaryValue> config,
+                    const DaemonController::CompletionCallback& done) override;
   void Stop(const DaemonController::CompletionCallback& done) override;
   DaemonController::UsageStatsConsent GetUsageStatsConsent() override;
 
diff --git a/remoting/host/setup/host_starter.cc b/remoting/host/setup/host_starter.cc
index 078a98c..fe8473f3 100644
--- a/remoting/host/setup/host_starter.cc
+++ b/remoting/host/setup/host_starter.cc
@@ -10,6 +10,7 @@
 #include "base/callback_helpers.h"
 #include "base/guid.h"
 #include "base/location.h"
+#include "base/memory/ptr_util.h"
 #include "base/thread_task_runner_handle.h"
 #include "base/values.h"
 #include "google_apis/google_api_keys.h"
@@ -23,8 +24,8 @@
 namespace remoting {
 
 HostStarter::HostStarter(
-    scoped_ptr<gaia::GaiaOAuthClient> oauth_client,
-    scoped_ptr<remoting::ServiceClient> service_client,
+    std::unique_ptr<gaia::GaiaOAuthClient> oauth_client,
+    std::unique_ptr<remoting::ServiceClient> service_client,
     scoped_refptr<remoting::DaemonController> daemon_controller)
     : oauth_client_(std::move(oauth_client)),
       service_client_(std::move(service_client)),
@@ -38,13 +39,13 @@
 
 HostStarter::~HostStarter() {}
 
-scoped_ptr<HostStarter> HostStarter::Create(
+std::unique_ptr<HostStarter> HostStarter::Create(
     const std::string& chromoting_hosts_url,
     net::URLRequestContextGetter* url_request_context_getter) {
-  return make_scoped_ptr(new HostStarter(
-      make_scoped_ptr(new gaia::GaiaOAuthClient(url_request_context_getter)),
-      make_scoped_ptr(new remoting::ServiceClient(chromoting_hosts_url,
-                                                  url_request_context_getter)),
+  return base::WrapUnique(new HostStarter(
+      base::WrapUnique(new gaia::GaiaOAuthClient(url_request_context_getter)),
+      base::WrapUnique(new remoting::ServiceClient(chromoting_hosts_url,
+                                                   url_request_context_getter)),
       remoting::DaemonController::Create()));
 }
 
@@ -156,7 +157,7 @@
 void HostStarter::StartHostProcess() {
   // Start the host.
   std::string host_secret_hash = remoting::MakeHostPinHash(host_id_, host_pin_);
-  scoped_ptr<base::DictionaryValue> config(new base::DictionaryValue());
+  std::unique_ptr<base::DictionaryValue> config(new base::DictionaryValue());
   if (host_owner_ != xmpp_login_) {
     config->SetString("host_owner", host_owner_);
   }
diff --git a/remoting/host/setup/host_starter.h b/remoting/host/setup/host_starter.h
index 881721b..52eacfd 100644
--- a/remoting/host/setup/host_starter.h
+++ b/remoting/host/setup/host_starter.h
@@ -38,7 +38,7 @@
   ~HostStarter() override;
 
   // Creates a HostStarter.
-  static scoped_ptr<HostStarter> Create(
+  static std::unique_ptr<HostStarter> Create(
       const std::string& chromoting_hosts_url,
       net::URLRequestContextGetter* url_request_context_getter);
 
@@ -72,16 +72,16 @@
   void OnNetworkError(int response_code) override;
 
  private:
-  HostStarter(scoped_ptr<gaia::GaiaOAuthClient> oauth_client,
-              scoped_ptr<remoting::ServiceClient> service_client,
+  HostStarter(std::unique_ptr<gaia::GaiaOAuthClient> oauth_client,
+              std::unique_ptr<remoting::ServiceClient> service_client,
               scoped_refptr<remoting::DaemonController> daemon_controller);
 
   void StartHostProcess();
 
   void OnHostStarted(DaemonController::AsyncResult result);
 
-  scoped_ptr<gaia::GaiaOAuthClient> oauth_client_;
-  scoped_ptr<remoting::ServiceClient> service_client_;
+  std::unique_ptr<gaia::GaiaOAuthClient> oauth_client_;
+  std::unique_ptr<remoting::ServiceClient> service_client_;
   scoped_refptr<remoting::DaemonController> daemon_controller_;
   gaia::OAuthClientInfo oauth_client_info_;
   std::string host_name_;
diff --git a/remoting/host/setup/me2me_native_messaging_host.cc b/remoting/host/setup/me2me_native_messaging_host.cc
index 39b31e5..7af0d13 100644
--- a/remoting/host/setup/me2me_native_messaging_host.cc
+++ b/remoting/host/setup/me2me_native_messaging_host.cc
@@ -58,9 +58,9 @@
 
 // Helper to extract the "config" part of a message as a DictionaryValue.
 // Returns nullptr on failure, and logs an error message.
-scoped_ptr<base::DictionaryValue> ConfigDictionaryFromMessage(
-    scoped_ptr<base::DictionaryValue> message) {
-  scoped_ptr<base::DictionaryValue> result;
+std::unique_ptr<base::DictionaryValue> ConfigDictionaryFromMessage(
+    std::unique_ptr<base::DictionaryValue> message) {
+  std::unique_ptr<base::DictionaryValue> result;
   const base::DictionaryValue* config_dict;
   if (message->GetDictionary("config", &config_dict)) {
     result.reset(config_dict->DeepCopy());
@@ -77,10 +77,10 @@
 Me2MeNativeMessagingHost::Me2MeNativeMessagingHost(
     bool needs_elevation,
     intptr_t parent_window_handle,
-    scoped_ptr<extensions::NativeMessagingChannel> channel,
+    std::unique_ptr<extensions::NativeMessagingChannel> channel,
     scoped_refptr<DaemonController> daemon_controller,
     scoped_refptr<protocol::PairingRegistry> pairing_registry,
-    scoped_ptr<OAuthClient> oauth_client)
+    std::unique_ptr<OAuthClient> oauth_client)
     : needs_elevation_(needs_elevation),
 #if defined(OS_WIN)
       parent_window_handle_(parent_window_handle),
@@ -110,7 +110,7 @@
   channel_->Start(this);
 }
 
-void Me2MeNativeMessagingHost::OnMessage(scoped_ptr<base::Value> message) {
+void Me2MeNativeMessagingHost::OnMessage(std::unique_ptr<base::Value> message) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
   if (!message->IsType(base::Value::TYPE_DICTIONARY)) {
@@ -119,9 +119,9 @@
     return;
   }
 
-  scoped_ptr<base::DictionaryValue> message_dict(
+  std::unique_ptr<base::DictionaryValue> message_dict(
       static_cast<base::DictionaryValue*>(message.release()));
-  scoped_ptr<base::DictionaryValue> response(new base::DictionaryValue());
+  std::unique_ptr<base::DictionaryValue> response(new base::DictionaryValue());
 
   // If the client supplies an ID, it will expect it in the response. This
   // might be a string or a number, so cope with both.
@@ -184,12 +184,13 @@
 }
 
 void Me2MeNativeMessagingHost::ProcessHello(
-    scoped_ptr<base::DictionaryValue> message,
-    scoped_ptr<base::DictionaryValue> response) {
+    std::unique_ptr<base::DictionaryValue> message,
+    std::unique_ptr<base::DictionaryValue> response) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
   response->SetString("version", STRINGIZE(VERSION));
-  scoped_ptr<base::ListValue> supported_features_list(new base::ListValue());
+  std::unique_ptr<base::ListValue> supported_features_list(
+      new base::ListValue());
   supported_features_list->AppendStrings(std::vector<std::string>(
       kSupportedFeatures, kSupportedFeatures + arraysize(kSupportedFeatures)));
   response->Set("supportedFeatures", supported_features_list.release());
@@ -197,8 +198,8 @@
 }
 
 void Me2MeNativeMessagingHost::ProcessClearPairedClients(
-    scoped_ptr<base::DictionaryValue> message,
-    scoped_ptr<base::DictionaryValue> response) {
+    std::unique_ptr<base::DictionaryValue> message,
+    std::unique_ptr<base::DictionaryValue> response) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
   if (needs_elevation_) {
@@ -217,8 +218,8 @@
 }
 
 void Me2MeNativeMessagingHost::ProcessDeletePairedClient(
-    scoped_ptr<base::DictionaryValue> message,
-    scoped_ptr<base::DictionaryValue> response) {
+    std::unique_ptr<base::DictionaryValue> message,
+    std::unique_ptr<base::DictionaryValue> response) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
   if (needs_elevation_) {
@@ -246,8 +247,8 @@
 }
 
 void Me2MeNativeMessagingHost::ProcessGetHostName(
-    scoped_ptr<base::DictionaryValue> message,
-    scoped_ptr<base::DictionaryValue> response) {
+    std::unique_ptr<base::DictionaryValue> message,
+    std::unique_ptr<base::DictionaryValue> response) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
   response->SetString("hostname", net::GetHostName());
@@ -255,8 +256,8 @@
 }
 
 void Me2MeNativeMessagingHost::ProcessGetPinHash(
-    scoped_ptr<base::DictionaryValue> message,
-    scoped_ptr<base::DictionaryValue> response) {
+    std::unique_ptr<base::DictionaryValue> message,
+    std::unique_ptr<base::DictionaryValue> response) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
   std::string host_id;
@@ -276,8 +277,8 @@
 }
 
 void Me2MeNativeMessagingHost::ProcessGenerateKeyPair(
-    scoped_ptr<base::DictionaryValue> message,
-    scoped_ptr<base::DictionaryValue> response) {
+    std::unique_ptr<base::DictionaryValue> message,
+    std::unique_ptr<base::DictionaryValue> response) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
   scoped_refptr<RsaKeyPair> key_pair = RsaKeyPair::Generate();
@@ -287,8 +288,8 @@
 }
 
 void Me2MeNativeMessagingHost::ProcessUpdateDaemonConfig(
-    scoped_ptr<base::DictionaryValue> message,
-    scoped_ptr<base::DictionaryValue> response) {
+    std::unique_ptr<base::DictionaryValue> message,
+    std::unique_ptr<base::DictionaryValue> response) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
   if (needs_elevation_) {
@@ -297,7 +298,7 @@
     return;
   }
 
-  scoped_ptr<base::DictionaryValue> config_dict =
+  std::unique_ptr<base::DictionaryValue> config_dict =
       ConfigDictionaryFromMessage(std::move(message));
   if (!config_dict) {
     OnError();
@@ -311,8 +312,8 @@
 }
 
 void Me2MeNativeMessagingHost::ProcessGetDaemonConfig(
-    scoped_ptr<base::DictionaryValue> message,
-    scoped_ptr<base::DictionaryValue> response) {
+    std::unique_ptr<base::DictionaryValue> message,
+    std::unique_ptr<base::DictionaryValue> response) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
   daemon_controller_->GetConfig(
@@ -321,8 +322,8 @@
 }
 
 void Me2MeNativeMessagingHost::ProcessGetPairedClients(
-    scoped_ptr<base::DictionaryValue> message,
-    scoped_ptr<base::DictionaryValue> response) {
+    std::unique_ptr<base::DictionaryValue> message,
+    std::unique_ptr<base::DictionaryValue> response) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
   if (pairing_registry_.get()) {
@@ -330,15 +331,15 @@
         base::Bind(&Me2MeNativeMessagingHost::SendPairedClientsResponse,
                    weak_ptr_, base::Passed(&response)));
   } else {
-    scoped_ptr<base::ListValue> no_paired_clients(new base::ListValue);
+    std::unique_ptr<base::ListValue> no_paired_clients(new base::ListValue);
     SendPairedClientsResponse(std::move(response),
                               std::move(no_paired_clients));
   }
 }
 
 void Me2MeNativeMessagingHost::ProcessGetUsageStatsConsent(
-    scoped_ptr<base::DictionaryValue> message,
-    scoped_ptr<base::DictionaryValue> response) {
+    std::unique_ptr<base::DictionaryValue> message,
+    std::unique_ptr<base::DictionaryValue> response) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
   daemon_controller_->GetUsageStatsConsent(
@@ -347,8 +348,8 @@
 }
 
 void Me2MeNativeMessagingHost::ProcessStartDaemon(
-    scoped_ptr<base::DictionaryValue> message,
-    scoped_ptr<base::DictionaryValue> response) {
+    std::unique_ptr<base::DictionaryValue> message,
+    std::unique_ptr<base::DictionaryValue> response) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
   if (needs_elevation_) {
@@ -364,7 +365,7 @@
     return;
   }
 
-  scoped_ptr<base::DictionaryValue> config_dict =
+  std::unique_ptr<base::DictionaryValue> config_dict =
       ConfigDictionaryFromMessage(std::move(message));
   if (!config_dict) {
     OnError();
@@ -378,8 +379,8 @@
 }
 
 void Me2MeNativeMessagingHost::ProcessStopDaemon(
-    scoped_ptr<base::DictionaryValue> message,
-    scoped_ptr<base::DictionaryValue> response) {
+    std::unique_ptr<base::DictionaryValue> message,
+    std::unique_ptr<base::DictionaryValue> response) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
   if (needs_elevation_) {
@@ -394,8 +395,8 @@
 }
 
 void Me2MeNativeMessagingHost::ProcessGetDaemonState(
-    scoped_ptr<base::DictionaryValue> message,
-    scoped_ptr<base::DictionaryValue> response) {
+    std::unique_ptr<base::DictionaryValue> message,
+    std::unique_ptr<base::DictionaryValue> response) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
   DaemonController::State state = daemon_controller_->GetState();
@@ -423,8 +424,8 @@
 }
 
 void Me2MeNativeMessagingHost::ProcessGetHostClientId(
-    scoped_ptr<base::DictionaryValue> message,
-    scoped_ptr<base::DictionaryValue> response) {
+    std::unique_ptr<base::DictionaryValue> message,
+    std::unique_ptr<base::DictionaryValue> response) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
   response->SetString("clientId", google_apis::GetOAuth2ClientID(
@@ -433,8 +434,8 @@
 }
 
 void Me2MeNativeMessagingHost::ProcessGetCredentialsFromAuthCode(
-    scoped_ptr<base::DictionaryValue> message,
-    scoped_ptr<base::DictionaryValue> response,
+    std::unique_ptr<base::DictionaryValue> message,
+    std::unique_ptr<base::DictionaryValue> response,
     bool need_user_email) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
@@ -458,8 +459,8 @@
 }
 
 void Me2MeNativeMessagingHost::SendConfigResponse(
-    scoped_ptr<base::DictionaryValue> response,
-    scoped_ptr<base::DictionaryValue> config) {
+    std::unique_ptr<base::DictionaryValue> response,
+    std::unique_ptr<base::DictionaryValue> config) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
   if (config) {
@@ -471,8 +472,8 @@
 }
 
 void Me2MeNativeMessagingHost::SendPairedClientsResponse(
-    scoped_ptr<base::DictionaryValue> response,
-    scoped_ptr<base::ListValue> pairings) {
+    std::unique_ptr<base::DictionaryValue> response,
+    std::unique_ptr<base::ListValue> pairings) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
   response->Set("pairedClients", pairings.release());
@@ -480,7 +481,7 @@
 }
 
 void Me2MeNativeMessagingHost::SendUsageStatsConsentResponse(
-    scoped_ptr<base::DictionaryValue> response,
+    std::unique_ptr<base::DictionaryValue> response,
     const DaemonController::UsageStatsConsent& consent) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
@@ -491,7 +492,7 @@
 }
 
 void Me2MeNativeMessagingHost::SendAsyncResult(
-    scoped_ptr<base::DictionaryValue> response,
+    std::unique_ptr<base::DictionaryValue> response,
     DaemonController::AsyncResult result) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
@@ -510,7 +511,8 @@
 }
 
 void Me2MeNativeMessagingHost::SendBooleanResult(
-    scoped_ptr<base::DictionaryValue> response, bool result) {
+    std::unique_ptr<base::DictionaryValue> response,
+    bool result) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
   response->SetBoolean("result", result);
@@ -518,7 +520,7 @@
 }
 
 void Me2MeNativeMessagingHost::SendCredentialsResponse(
-    scoped_ptr<base::DictionaryValue> response,
+    std::unique_ptr<base::DictionaryValue> response,
     const std::string& user_email,
     const std::string& refresh_token) {
   DCHECK(thread_checker_.CalledOnValidThread());
@@ -549,7 +551,7 @@
 }
 
 void Me2MeNativeMessagingHost::ElevatedChannelEventHandler::OnMessage(
-    scoped_ptr<base::Value> message) {
+    std::unique_ptr<base::Value> message) {
   DCHECK(parent_->thread_checker_.CalledOnValidThread());
 
   // Simply pass along the response from the elevated host to the client.
@@ -561,7 +563,7 @@
 }
 
 bool Me2MeNativeMessagingHost::DelegateToElevatedHost(
-    scoped_ptr<base::DictionaryValue> message) {
+    std::unique_ptr<base::DictionaryValue> message) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
   EnsureElevatedHostCreated();
@@ -741,7 +743,7 @@
 #else  // defined(OS_WIN)
 
 bool Me2MeNativeMessagingHost::DelegateToElevatedHost(
-    scoped_ptr<base::DictionaryValue> message) {
+    std::unique_ptr<base::DictionaryValue> message) {
   NOTREACHED();
   return false;
 }
diff --git a/remoting/host/setup/me2me_native_messaging_host.h b/remoting/host/setup/me2me_native_messaging_host.h
index aa50500..3722eff 100644
--- a/remoting/host/setup/me2me_native_messaging_host.h
+++ b/remoting/host/setup/me2me_native_messaging_host.h
@@ -5,9 +5,10 @@
 #ifndef REMOTING_HOST_SETUP_ME2ME_NATIVE_MESSAGING_HOST_H_
 #define REMOTING_HOST_SETUP_ME2ME_NATIVE_MESSAGING_HOST_H_
 
+#include <memory>
+
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/threading/thread_checker.h"
 #include "base/timer/timer.h"
@@ -43,85 +44,76 @@
   Me2MeNativeMessagingHost(
       bool needs_elevation,
       intptr_t parent_window_handle,
-      scoped_ptr<extensions::NativeMessagingChannel> channel,
+      std::unique_ptr<extensions::NativeMessagingChannel> channel,
       scoped_refptr<DaemonController> daemon_controller,
       scoped_refptr<protocol::PairingRegistry> pairing_registry,
-      scoped_ptr<OAuthClient> oauth_client);
+      std::unique_ptr<OAuthClient> oauth_client);
   ~Me2MeNativeMessagingHost() override;
 
   void Start(const base::Closure& quit_closure);
 
   // extensions::NativeMessagingChannel::EventHandler implementation
-  void OnMessage(scoped_ptr<base::Value> message) override;
+  void OnMessage(std::unique_ptr<base::Value> message) override;
   void OnDisconnect() override;
 
  private:
   // These "Process.." methods handle specific request types. The |response|
   // dictionary is pre-filled by ProcessMessage() with the parts of the
   // response already known ("id" and "type" fields).
-  void ProcessHello(
-      scoped_ptr<base::DictionaryValue> message,
-      scoped_ptr<base::DictionaryValue> response);
+  void ProcessHello(std::unique_ptr<base::DictionaryValue> message,
+                    std::unique_ptr<base::DictionaryValue> response);
   void ProcessClearPairedClients(
-      scoped_ptr<base::DictionaryValue> message,
-      scoped_ptr<base::DictionaryValue> response);
+      std::unique_ptr<base::DictionaryValue> message,
+      std::unique_ptr<base::DictionaryValue> response);
   void ProcessDeletePairedClient(
-      scoped_ptr<base::DictionaryValue> message,
-      scoped_ptr<base::DictionaryValue> response);
-  void ProcessGetHostName(
-      scoped_ptr<base::DictionaryValue> message,
-      scoped_ptr<base::DictionaryValue> response);
-  void ProcessGetPinHash(
-      scoped_ptr<base::DictionaryValue> message,
-      scoped_ptr<base::DictionaryValue> response);
-  void ProcessGenerateKeyPair(
-      scoped_ptr<base::DictionaryValue> message,
-      scoped_ptr<base::DictionaryValue> response);
+      std::unique_ptr<base::DictionaryValue> message,
+      std::unique_ptr<base::DictionaryValue> response);
+  void ProcessGetHostName(std::unique_ptr<base::DictionaryValue> message,
+                          std::unique_ptr<base::DictionaryValue> response);
+  void ProcessGetPinHash(std::unique_ptr<base::DictionaryValue> message,
+                         std::unique_ptr<base::DictionaryValue> response);
+  void ProcessGenerateKeyPair(std::unique_ptr<base::DictionaryValue> message,
+                              std::unique_ptr<base::DictionaryValue> response);
   void ProcessUpdateDaemonConfig(
-      scoped_ptr<base::DictionaryValue> message,
-      scoped_ptr<base::DictionaryValue> response);
-  void ProcessGetDaemonConfig(
-      scoped_ptr<base::DictionaryValue> message,
-      scoped_ptr<base::DictionaryValue> response);
-  void ProcessGetPairedClients(
-      scoped_ptr<base::DictionaryValue> message,
-      scoped_ptr<base::DictionaryValue> response);
+      std::unique_ptr<base::DictionaryValue> message,
+      std::unique_ptr<base::DictionaryValue> response);
+  void ProcessGetDaemonConfig(std::unique_ptr<base::DictionaryValue> message,
+                              std::unique_ptr<base::DictionaryValue> response);
+  void ProcessGetPairedClients(std::unique_ptr<base::DictionaryValue> message,
+                               std::unique_ptr<base::DictionaryValue> response);
   void ProcessGetUsageStatsConsent(
-      scoped_ptr<base::DictionaryValue> message,
-      scoped_ptr<base::DictionaryValue> response);
-  void ProcessStartDaemon(
-      scoped_ptr<base::DictionaryValue> message,
-      scoped_ptr<base::DictionaryValue> response);
-  void ProcessStopDaemon(
-      scoped_ptr<base::DictionaryValue> message,
-      scoped_ptr<base::DictionaryValue> response);
-  void ProcessGetDaemonState(
-      scoped_ptr<base::DictionaryValue> message,
-      scoped_ptr<base::DictionaryValue> response);
-  void ProcessGetHostClientId(
-      scoped_ptr<base::DictionaryValue> message,
-      scoped_ptr<base::DictionaryValue> response);
+      std::unique_ptr<base::DictionaryValue> message,
+      std::unique_ptr<base::DictionaryValue> response);
+  void ProcessStartDaemon(std::unique_ptr<base::DictionaryValue> message,
+                          std::unique_ptr<base::DictionaryValue> response);
+  void ProcessStopDaemon(std::unique_ptr<base::DictionaryValue> message,
+                         std::unique_ptr<base::DictionaryValue> response);
+  void ProcessGetDaemonState(std::unique_ptr<base::DictionaryValue> message,
+                             std::unique_ptr<base::DictionaryValue> response);
+  void ProcessGetHostClientId(std::unique_ptr<base::DictionaryValue> message,
+                              std::unique_ptr<base::DictionaryValue> response);
   void ProcessGetCredentialsFromAuthCode(
-      scoped_ptr<base::DictionaryValue> message,
-      scoped_ptr<base::DictionaryValue> response,
+      std::unique_ptr<base::DictionaryValue> message,
+      std::unique_ptr<base::DictionaryValue> response,
       bool need_user_email);
 
   // These Send... methods get called on the DaemonController's internal thread,
   // or on the calling thread if called by the PairingRegistry.
   // These methods fill in the |response| dictionary from the other parameters,
   // and pass it to SendResponse().
-  void SendConfigResponse(scoped_ptr<base::DictionaryValue> response,
-                          scoped_ptr<base::DictionaryValue> config);
-  void SendPairedClientsResponse(scoped_ptr<base::DictionaryValue> response,
-                                 scoped_ptr<base::ListValue> pairings);
+  void SendConfigResponse(std::unique_ptr<base::DictionaryValue> response,
+                          std::unique_ptr<base::DictionaryValue> config);
+  void SendPairedClientsResponse(
+      std::unique_ptr<base::DictionaryValue> response,
+      std::unique_ptr<base::ListValue> pairings);
   void SendUsageStatsConsentResponse(
-      scoped_ptr<base::DictionaryValue> response,
+      std::unique_ptr<base::DictionaryValue> response,
       const DaemonController::UsageStatsConsent& consent);
-  void SendAsyncResult(scoped_ptr<base::DictionaryValue> response,
+  void SendAsyncResult(std::unique_ptr<base::DictionaryValue> response,
                        DaemonController::AsyncResult result);
-  void SendBooleanResult(scoped_ptr<base::DictionaryValue> response,
+  void SendBooleanResult(std::unique_ptr<base::DictionaryValue> response,
                          bool result);
-  void SendCredentialsResponse(scoped_ptr<base::DictionaryValue> response,
+  void SendCredentialsResponse(std::unique_ptr<base::DictionaryValue> response,
                                const std::string& user_email,
                                const std::string& refresh_token);
 
@@ -131,7 +123,7 @@
 
   // Returns true if the request was successfully delegated to the elevated
   // host and false otherwise.
-  bool DelegateToElevatedHost(scoped_ptr<base::DictionaryValue> message);
+  bool DelegateToElevatedHost(std::unique_ptr<base::DictionaryValue> message);
 
 #if defined(OS_WIN)
   class ElevatedChannelEventHandler
@@ -139,7 +131,7 @@
    public:
     ElevatedChannelEventHandler(Me2MeNativeMessagingHost* host);
 
-    void OnMessage(scoped_ptr<base::Value> message) override;
+    void OnMessage(std::unique_ptr<base::Value> message) override;
     void OnDisconnect() override;
    private:
     Me2MeNativeMessagingHost* parent_;
@@ -154,11 +146,11 @@
   void DisconnectElevatedHost();
 
   // Native messaging channel used to communicate with the elevated host.
-  scoped_ptr<extensions::NativeMessagingChannel> elevated_channel_;
+  std::unique_ptr<extensions::NativeMessagingChannel> elevated_channel_;
 
   // Native messaging event handler used to process responses from the elevated
   // host.
-  scoped_ptr<ElevatedChannelEventHandler> elevated_channel_event_handler_;
+  std::unique_ptr<ElevatedChannelEventHandler> elevated_channel_event_handler_;
 
   // Timer to control the lifetime of the elevated host.
   base::OneShotTimer elevated_host_timer_;
@@ -175,7 +167,7 @@
 
   // Native messaging channel used to communicate with the native message
   // client.
-  scoped_ptr<extensions::NativeMessagingChannel> channel_;
+  std::unique_ptr<extensions::NativeMessagingChannel> channel_;
 
   LogMessageHandler log_message_handler_;
 
@@ -185,7 +177,7 @@
   scoped_refptr<protocol::PairingRegistry> pairing_registry_;
 
   // Used to exchange the service account authorization code for credentials.
-  scoped_ptr<OAuthClient> oauth_client_;
+  std::unique_ptr<OAuthClient> oauth_client_;
 
   base::ThreadChecker thread_checker_;
 
diff --git a/remoting/host/setup/me2me_native_messaging_host_main.cc b/remoting/host/setup/me2me_native_messaging_host_main.cc
index 75fd590..e191175 100644
--- a/remoting/host/setup/me2me_native_messaging_host_main.cc
+++ b/remoting/host/setup/me2me_native_messaging_host_main.cc
@@ -202,7 +202,7 @@
   scoped_refptr<net::URLRequestContextGetter> url_request_context_getter(
       new URLRequestContextGetter(io_thread.task_runner(),
                                   file_thread.task_runner()));
-  scoped_ptr<OAuthClient> oauth_client(
+  std::unique_ptr<OAuthClient> oauth_client(
       new GaiaOAuthClient(url_request_context_getter));
 
   net::URLFetcher::SetIgnoreCertificateRequests(true);
@@ -244,7 +244,7 @@
   }
 
   // Initialize the pairing registry delegate and set the root keys.
-  scoped_ptr<PairingRegistryDelegateWin> delegate(
+  std::unique_ptr<PairingRegistryDelegateWin> delegate(
       new PairingRegistryDelegateWin());
   if (!delegate->SetRootKeys(privileged.Take(), unprivileged.Take()))
     return kInitializationFailed;
@@ -257,11 +257,11 @@
 #endif  // !defined(OS_WIN)
 
   // Set up the native messaging channel.
-  scoped_ptr<extensions::NativeMessagingChannel> channel(
+  std::unique_ptr<extensions::NativeMessagingChannel> channel(
       new PipeMessagingChannel(std::move(read_file), std::move(write_file)));
 
   // Create the native messaging host.
-  scoped_ptr<Me2MeNativeMessagingHost> host(new Me2MeNativeMessagingHost(
+  std::unique_ptr<Me2MeNativeMessagingHost> host(new Me2MeNativeMessagingHost(
       needs_elevation, static_cast<intptr_t>(native_view_handle),
       std::move(channel), daemon_controller, pairing_registry,
       std::move(oauth_client)));
diff --git a/remoting/host/setup/me2me_native_messaging_host_unittest.cc b/remoting/host/setup/me2me_native_messaging_host_unittest.cc
index e30a56a..09020da 100644
--- a/remoting/host/setup/me2me_native_messaging_host_unittest.cc
+++ b/remoting/host/setup/me2me_native_messaging_host_unittest.cc
@@ -13,6 +13,7 @@
 #include "base/json/json_reader.h"
 #include "base/json/json_writer.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
 #include "base/stl_util.h"
@@ -37,7 +38,7 @@
 
 namespace {
 
-void VerifyHelloResponse(scoped_ptr<base::DictionaryValue> response) {
+void VerifyHelloResponse(std::unique_ptr<base::DictionaryValue> response) {
   ASSERT_TRUE(response);
   std::string value;
   EXPECT_TRUE(response->GetString("type", &value));
@@ -52,7 +53,8 @@
   EXPECT_EQ(STRINGIZE(VERSION), value);
 }
 
-void VerifyGetHostNameResponse(scoped_ptr<base::DictionaryValue> response) {
+void VerifyGetHostNameResponse(
+    std::unique_ptr<base::DictionaryValue> response) {
   ASSERT_TRUE(response);
   std::string value;
   EXPECT_TRUE(response->GetString("type", &value));
@@ -61,7 +63,7 @@
   EXPECT_EQ(net::GetHostName(), value);
 }
 
-void VerifyGetPinHashResponse(scoped_ptr<base::DictionaryValue> response) {
+void VerifyGetPinHashResponse(std::unique_ptr<base::DictionaryValue> response) {
   ASSERT_TRUE(response);
   std::string value;
   EXPECT_TRUE(response->GetString("type", &value));
@@ -70,7 +72,8 @@
   EXPECT_EQ(remoting::MakeHostPinHash("my_host", "1234"), value);
 }
 
-void VerifyGenerateKeyPairResponse(scoped_ptr<base::DictionaryValue> response) {
+void VerifyGenerateKeyPairResponse(
+    std::unique_ptr<base::DictionaryValue> response) {
   ASSERT_TRUE(response);
   std::string value;
   EXPECT_TRUE(response->GetString("type", &value));
@@ -79,7 +82,8 @@
   EXPECT_TRUE(response->GetString("publicKey", &value));
 }
 
-void VerifyGetDaemonConfigResponse(scoped_ptr<base::DictionaryValue> response) {
+void VerifyGetDaemonConfigResponse(
+    std::unique_ptr<base::DictionaryValue> response) {
   ASSERT_TRUE(response);
   std::string value;
   EXPECT_TRUE(response->GetString("type", &value));
@@ -90,7 +94,7 @@
 }
 
 void VerifyGetUsageStatsConsentResponse(
-    scoped_ptr<base::DictionaryValue> response) {
+    std::unique_ptr<base::DictionaryValue> response) {
   ASSERT_TRUE(response);
   std::string value;
   EXPECT_TRUE(response->GetString("type", &value));
@@ -104,7 +108,7 @@
   EXPECT_TRUE(set_by_policy);
 }
 
-void VerifyStopDaemonResponse(scoped_ptr<base::DictionaryValue> response) {
+void VerifyStopDaemonResponse(std::unique_ptr<base::DictionaryValue> response) {
   ASSERT_TRUE(response);
   std::string value;
   EXPECT_TRUE(response->GetString("type", &value));
@@ -113,7 +117,8 @@
   EXPECT_EQ("OK", value);
 }
 
-void VerifyGetDaemonStateResponse(scoped_ptr<base::DictionaryValue> response) {
+void VerifyGetDaemonStateResponse(
+    std::unique_ptr<base::DictionaryValue> response) {
   ASSERT_TRUE(response);
   std::string value;
   EXPECT_TRUE(response->GetString("type", &value));
@@ -123,7 +128,7 @@
 }
 
 void VerifyUpdateDaemonConfigResponse(
-    scoped_ptr<base::DictionaryValue> response) {
+    std::unique_ptr<base::DictionaryValue> response) {
   ASSERT_TRUE(response);
   std::string value;
   EXPECT_TRUE(response->GetString("type", &value));
@@ -132,7 +137,8 @@
   EXPECT_EQ("OK", value);
 }
 
-void VerifyStartDaemonResponse(scoped_ptr<base::DictionaryValue> response) {
+void VerifyStartDaemonResponse(
+    std::unique_ptr<base::DictionaryValue> response) {
   ASSERT_TRUE(response);
   std::string value;
   EXPECT_TRUE(response->GetString("type", &value));
@@ -142,7 +148,7 @@
 }
 
 void VerifyGetCredentialsFromAuthCodeResponse(
-    scoped_ptr<base::DictionaryValue> response) {
+    std::unique_ptr<base::DictionaryValue> response) {
   ASSERT_TRUE(response);
   std::string value;
   EXPECT_TRUE(response->GetString("type", &value));
@@ -164,12 +170,12 @@
 
   // DaemonController::Delegate interface.
   DaemonController::State GetState() override;
-  scoped_ptr<base::DictionaryValue> GetConfig() override;
+  std::unique_ptr<base::DictionaryValue> GetConfig() override;
   void SetConfigAndStart(
-      scoped_ptr<base::DictionaryValue> config,
+      std::unique_ptr<base::DictionaryValue> config,
       bool consent,
       const DaemonController::CompletionCallback& done) override;
-  void UpdateConfig(scoped_ptr<base::DictionaryValue> config,
+  void UpdateConfig(std::unique_ptr<base::DictionaryValue> config,
                     const DaemonController::CompletionCallback& done) override;
   void Stop(const DaemonController::CompletionCallback& done) override;
   DaemonController::UsageStatsConsent GetUsageStatsConsent() override;
@@ -186,15 +192,15 @@
   return DaemonController::STATE_STARTED;
 }
 
-scoped_ptr<base::DictionaryValue> MockDaemonControllerDelegate::GetConfig() {
-  return make_scoped_ptr(new base::DictionaryValue());
+std::unique_ptr<base::DictionaryValue>
+MockDaemonControllerDelegate::GetConfig() {
+  return base::WrapUnique(new base::DictionaryValue());
 }
 
 void MockDaemonControllerDelegate::SetConfigAndStart(
-    scoped_ptr<base::DictionaryValue> config,
+    std::unique_ptr<base::DictionaryValue> config,
     bool consent,
     const DaemonController::CompletionCallback& done) {
-
   // Verify parameters passed in.
   if (consent && config && config->HasKey("start")) {
     done.Run(DaemonController::RESULT_OK);
@@ -204,7 +210,7 @@
 }
 
 void MockDaemonControllerDelegate::UpdateConfig(
-    scoped_ptr<base::DictionaryValue> config,
+    std::unique_ptr<base::DictionaryValue> config,
     const DaemonController::CompletionCallback& done) {
   if (config && config->HasKey("update")) {
     done.Run(DaemonController::RESULT_OK);
@@ -235,7 +241,7 @@
   void SetUp() override;
   void TearDown() override;
 
-  scoped_ptr<base::DictionaryValue> ReadMessageFromOutputPipe();
+  std::unique_ptr<base::DictionaryValue> ReadMessageFromOutputPipe();
 
   void WriteMessageToInputPipe(const base::Value& message);
 
@@ -265,15 +271,15 @@
   base::File output_read_file_;
 
   // Message loop of the test thread.
-  scoped_ptr<base::MessageLoop> test_message_loop_;
-  scoped_ptr<base::RunLoop> test_run_loop_;
+  std::unique_ptr<base::MessageLoop> test_message_loop_;
+  std::unique_ptr<base::RunLoop> test_run_loop_;
 
-  scoped_ptr<base::Thread> host_thread_;
-  scoped_ptr<base::RunLoop> host_run_loop_;
+  std::unique_ptr<base::Thread> host_thread_;
+  std::unique_ptr<base::RunLoop> host_run_loop_;
 
   // Task runner of the host thread.
   scoped_refptr<AutoThreadTaskRunner> host_task_runner_;
-  scoped_ptr<remoting::Me2MeNativeMessagingHost> host_;
+  std::unique_ptr<remoting::Me2MeNativeMessagingHost> host_;
 
   DISALLOW_COPY_AND_ASSIGN(Me2MeNativeMessagingHostTest);
 };
@@ -322,17 +328,17 @@
 
   daemon_controller_delegate_ = new MockDaemonControllerDelegate();
   scoped_refptr<DaemonController> daemon_controller(
-      new DaemonController(make_scoped_ptr(daemon_controller_delegate_)));
+      new DaemonController(base::WrapUnique(daemon_controller_delegate_)));
 
   scoped_refptr<PairingRegistry> pairing_registry =
       new SynchronousPairingRegistry(
-          make_scoped_ptr(new MockPairingRegistryDelegate()));
+          base::WrapUnique(new MockPairingRegistryDelegate()));
 
-  scoped_ptr<extensions::NativeMessagingChannel> channel(
+  std::unique_ptr<extensions::NativeMessagingChannel> channel(
       new PipeMessagingChannel(std::move(input_read_file),
                                std::move(output_write_file)));
 
-  scoped_ptr<OAuthClient> oauth_client(
+  std::unique_ptr<OAuthClient> oauth_client(
       new MockOAuthClient("fake_user_email", "fake_refresh_token"));
 
   host_.reset(new Me2MeNativeMessagingHost(false, 0, std::move(channel),
@@ -379,7 +385,7 @@
   test_run_loop_->Run();
 
   // Verify there are no more message in the output pipe.
-  scoped_ptr<base::DictionaryValue> response = ReadMessageFromOutputPipe();
+  std::unique_ptr<base::DictionaryValue> response = ReadMessageFromOutputPipe();
   EXPECT_FALSE(response);
 
   // The It2MeMe2MeNativeMessagingHost dtor closes the handles that are passed
@@ -387,7 +393,7 @@
   output_read_file_.Close();
 }
 
-scoped_ptr<base::DictionaryValue>
+std::unique_ptr<base::DictionaryValue>
 Me2MeNativeMessagingHostTest::ReadMessageFromOutputPipe() {
   while (true) {
     uint32_t length;
@@ -404,12 +410,12 @@
       return nullptr;
     }
 
-    scoped_ptr<base::Value> message = base::JSONReader::Read(message_json);
+    std::unique_ptr<base::Value> message = base::JSONReader::Read(message_json);
     if (!message || !message->IsType(base::Value::TYPE_DICTIONARY)) {
       return nullptr;
     }
 
-    scoped_ptr<base::DictionaryValue> result = make_scoped_ptr(
+    std::unique_ptr<base::DictionaryValue> result = base::WrapUnique(
         static_cast<base::DictionaryValue*>(message.release()));
     std::string type;
     // If this is a debug message log, ignore it, otherwise return it.
@@ -442,7 +448,7 @@
   WriteMessageToInputPipe(good_message);
 
   // Read from output pipe, and verify responses.
-  scoped_ptr<base::DictionaryValue> response = ReadMessageFromOutputPipe();
+  std::unique_ptr<base::DictionaryValue> response = ReadMessageFromOutputPipe();
   VerifyHelloResponse(std::move(response));
 
   response = ReadMessageFromOutputPipe();
@@ -510,7 +516,7 @@
   message.SetString("authorizationCode", "fake_auth_code");
   WriteMessageToInputPipe(message);
 
-  void (*verify_routines[])(scoped_ptr<base::DictionaryValue>) = {
+  void (*verify_routines[])(std::unique_ptr<base::DictionaryValue>) = {
       &VerifyHelloResponse,
       &VerifyGetHostNameResponse,
       &VerifyGetPinHashResponse,
@@ -527,7 +533,8 @@
 
   // Read all responses from output pipe, and verify them.
   for (int i = 0; i < next_id; ++i) {
-    scoped_ptr<base::DictionaryValue> response = ReadMessageFromOutputPipe();
+    std::unique_ptr<base::DictionaryValue> response =
+        ReadMessageFromOutputPipe();
 
     // Make sure that id is available and is in the range.
     int id;
@@ -551,7 +558,7 @@
   message.SetString("id", "42");
   WriteMessageToInputPipe(message);
 
-  scoped_ptr<base::DictionaryValue> response = ReadMessageFromOutputPipe();
+  std::unique_ptr<base::DictionaryValue> response = ReadMessageFromOutputPipe();
   EXPECT_TRUE(response);
   std::string value;
   EXPECT_FALSE(response->GetString("id", &value));
diff --git a/remoting/host/setup/service_client.cc b/remoting/host/setup/service_client.cc
index ba42825..7c107af 100644
--- a/remoting/host/setup/service_client.cc
+++ b/remoting/host/setup/service_client.cc
@@ -4,9 +4,10 @@
 
 #include "remoting/host/setup/service_client.h"
 
+#include <memory>
+
 #include "base/json/json_reader.h"
 #include "base/json/json_writer.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/values.h"
 #include "net/http/http_status_code.h"
 #include "net/url_request/url_fetcher.h"
@@ -61,7 +62,7 @@
 
   scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
   ServiceClient::Delegate* delegate_;
-  scoped_ptr<net::URLFetcher> request_;
+  std::unique_ptr<net::URLFetcher> request_;
   PendingRequestType pending_request_type_;
   std::string chromoting_hosts_url_;
 };
@@ -145,7 +146,8 @@
         {
           std::string data;
           source->GetResponseAsString(&data);
-          scoped_ptr<base::Value> message_value = base::JSONReader::Read(data);
+          std::unique_ptr<base::Value> message_value =
+              base::JSONReader::Read(data);
           base::DictionaryValue *dict;
           std::string code;
           if (message_value.get() &&
diff --git a/remoting/host/setup/start_host.cc b/remoting/host/setup/start_host.cc
index 3c80d81..2849403f 100644
--- a/remoting/host/setup/start_host.cc
+++ b/remoting/host/setup/start_host.cc
@@ -190,7 +190,7 @@
   net::URLFetcher::SetIgnoreCertificateRequests(true);
 
   // Start the host.
-  scoped_ptr<HostStarter> host_starter(HostStarter::Create(
+  std::unique_ptr<HostStarter> host_starter(HostStarter::Create(
       remoting::ServiceUrls::GetInstance()->directory_hosts_url(),
       url_request_context_getter.get()));
   if (redirect_url.empty()) {
diff --git a/remoting/host/signaling_connector.cc b/remoting/host/signaling_connector.cc
index ac5bbaf6..1309403 100644
--- a/remoting/host/signaling_connector.cc
+++ b/remoting/host/signaling_connector.cc
@@ -42,7 +42,7 @@
 
 SignalingConnector::SignalingConnector(
     XmppSignalStrategy* signal_strategy,
-    scoped_ptr<DnsBlackholeChecker> dns_blackhole_checker,
+    std::unique_ptr<DnsBlackholeChecker> dns_blackhole_checker,
     OAuthTokenGetter* oauth_token_getter,
     const base::Closure& auth_failed_callback)
     : signal_strategy_(signal_strategy),
diff --git a/remoting/host/signaling_connector.h b/remoting/host/signaling_connector.h
index 81a1197..a65fcc2 100644
--- a/remoting/host/signaling_connector.h
+++ b/remoting/host/signaling_connector.h
@@ -32,7 +32,7 @@
  public:
   // The |auth_failed_callback| is called when authentication fails.
   SignalingConnector(XmppSignalStrategy* signal_strategy,
-                     scoped_ptr<DnsBlackholeChecker> dns_blackhole_checker,
+                     std::unique_ptr<DnsBlackholeChecker> dns_blackhole_checker,
                      OAuthTokenGetter* oauth_token_getter,
                      const base::Closure& auth_failed_callback);
   ~SignalingConnector() override;
@@ -62,7 +62,7 @@
 
   XmppSignalStrategy* signal_strategy_;
   base::Closure auth_failed_callback_;
-  scoped_ptr<DnsBlackholeChecker> dns_blackhole_checker_;
+  std::unique_ptr<DnsBlackholeChecker> dns_blackhole_checker_;
 
   OAuthTokenGetter* oauth_token_getter_;
 
diff --git a/remoting/host/single_window_desktop_environment.cc b/remoting/host/single_window_desktop_environment.cc
index 0f2b1480..382a428 100644
--- a/remoting/host/single_window_desktop_environment.cc
+++ b/remoting/host/single_window_desktop_environment.cc
@@ -8,6 +8,7 @@
 
 #include "base/logging.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/single_thread_task_runner.h"
 #include "remoting/host/single_window_input_injector.h"
 #include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h"
@@ -22,8 +23,8 @@
   ~SingleWindowDesktopEnvironment() override;
 
   // DesktopEnvironment interface.
-  scoped_ptr<webrtc::DesktopCapturer> CreateVideoCapturer() override;
-  scoped_ptr<InputInjector> CreateInputInjector() override;
+  std::unique_ptr<webrtc::DesktopCapturer> CreateVideoCapturer() override;
+  std::unique_ptr<InputInjector> CreateInputInjector() override;
 
  protected:
   friend class SingleWindowDesktopEnvironmentFactory;
@@ -43,7 +44,7 @@
 
 SingleWindowDesktopEnvironment::~SingleWindowDesktopEnvironment() {}
 
-scoped_ptr<webrtc::DesktopCapturer>
+std::unique_ptr<webrtc::DesktopCapturer>
 SingleWindowDesktopEnvironment::CreateVideoCapturer() {
   DCHECK(caller_task_runner()->BelongsToCurrentThread());
 
@@ -51,20 +52,19 @@
       webrtc::DesktopCaptureOptions::CreateDefault();
   options.set_use_update_notifications(true);
 
-  scoped_ptr<webrtc::WindowCapturer> window_capturer(
-        webrtc::WindowCapturer::Create(options));
+  std::unique_ptr<webrtc::WindowCapturer> window_capturer(
+      webrtc::WindowCapturer::Create(options));
   window_capturer->SelectWindow(window_id_);
 
   return std::move(window_capturer);
 }
 
-scoped_ptr<InputInjector>
+std::unique_ptr<InputInjector>
 SingleWindowDesktopEnvironment::CreateInputInjector() {
   DCHECK(caller_task_runner()->BelongsToCurrentThread());
 
-  scoped_ptr<InputInjector> input_injector(
-      InputInjector::Create(input_task_runner(),
-                            ui_task_runner()));
+  std::unique_ptr<InputInjector> input_injector(
+      InputInjector::Create(input_task_runner(), ui_task_runner()));
   return SingleWindowInputInjector::CreateForWindow(
              window_id_, std::move(input_injector));
 }
@@ -99,11 +99,12 @@
     ~SingleWindowDesktopEnvironmentFactory() {
 }
 
-scoped_ptr<DesktopEnvironment> SingleWindowDesktopEnvironmentFactory::Create(
+std::unique_ptr<DesktopEnvironment>
+SingleWindowDesktopEnvironmentFactory::Create(
     base::WeakPtr<ClientSessionControl> client_session_control) {
   DCHECK(caller_task_runner()->BelongsToCurrentThread());
 
-  return make_scoped_ptr(new SingleWindowDesktopEnvironment(
+  return base::WrapUnique(new SingleWindowDesktopEnvironment(
       caller_task_runner(), video_capture_task_runner(), input_task_runner(),
       ui_task_runner(), window_id_, supports_touch_events()));
 }
diff --git a/remoting/host/single_window_desktop_environment.h b/remoting/host/single_window_desktop_environment.h
index c4e84ea..5c8d17c 100644
--- a/remoting/host/single_window_desktop_environment.h
+++ b/remoting/host/single_window_desktop_environment.h
@@ -25,7 +25,7 @@
   ~SingleWindowDesktopEnvironmentFactory() override;
 
   // DesktopEnvironmentFactory interface.
-  scoped_ptr<DesktopEnvironment> Create(
+  std::unique_ptr<DesktopEnvironment> Create(
       base::WeakPtr<ClientSessionControl> client_session_control) override;
 
  private:
diff --git a/remoting/host/single_window_input_injector.h b/remoting/host/single_window_input_injector.h
index 6ee92c7..02ed9e6 100644
--- a/remoting/host/single_window_input_injector.h
+++ b/remoting/host/single_window_input_injector.h
@@ -5,7 +5,8 @@
 #ifndef REMOTING_HOST_SINGLE_WINDOW_INPUT_INJECTOR_H_
 #define REMOTING_HOST_SINGLE_WINDOW_INPUT_INJECTOR_H_
 
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
 #include "remoting/host/input_injector.h"
 #include "third_party/webrtc/modules/desktop_capture/desktop_capture_types.h"
 
@@ -20,9 +21,9 @@
  public:
   // This Create method needs to be passed a full desktop
   // InputInjector.
-  static scoped_ptr<InputInjector> CreateForWindow(
+  static std::unique_ptr<InputInjector> CreateForWindow(
       webrtc::WindowId window_id,
-      scoped_ptr<InputInjector> input_injector);
+      std::unique_ptr<InputInjector> input_injector);
 };
 
 }  // namespace remoting
diff --git a/remoting/host/single_window_input_injector_linux.cc b/remoting/host/single_window_input_injector_linux.cc
index 7baa8bd..f8b2aea 100644
--- a/remoting/host/single_window_input_injector_linux.cc
+++ b/remoting/host/single_window_input_injector_linux.cc
@@ -6,9 +6,9 @@
 
 namespace remoting {
 
-scoped_ptr<InputInjector> SingleWindowInputInjector::CreateForWindow(
+std::unique_ptr<InputInjector> SingleWindowInputInjector::CreateForWindow(
     webrtc::WindowId window_id,
-    scoped_ptr<InputInjector> input_injector) {
+    std::unique_ptr<InputInjector> input_injector) {
   return nullptr;
 }
 
diff --git a/remoting/host/single_window_input_injector_mac.cc b/remoting/host/single_window_input_injector_mac.cc
index 3954fe7..cbe86208 100644
--- a/remoting/host/single_window_input_injector_mac.cc
+++ b/remoting/host/single_window_input_injector_mac.cc
@@ -12,6 +12,7 @@
 #include "base/mac/foundation_util.h"
 #include "base/mac/scoped_cftyperef.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "remoting/proto/event.pb.h"
 #include "third_party/webrtc/modules/desktop_capture/mac/desktop_configuration.h"
 
@@ -25,13 +26,13 @@
 
 class SingleWindowInputInjectorMac : public SingleWindowInputInjector {
  public:
-  SingleWindowInputInjectorMac(
-      webrtc::WindowId window_id,
-      scoped_ptr<InputInjector> input_injector);
+  SingleWindowInputInjectorMac(webrtc::WindowId window_id,
+                               std::unique_ptr<InputInjector> input_injector);
   ~SingleWindowInputInjectorMac() override;
 
   // InputInjector interface.
-  void Start(scoped_ptr<protocol::ClipboardStub> client_clipboard) override;
+  void Start(
+      std::unique_ptr<protocol::ClipboardStub> client_clipboard) override;
   void InjectKeyEvent(const KeyEvent& event) override;
   void InjectTextEvent(const TextEvent& event) override;
   void InjectMouseEvent(const MouseEvent& event) override;
@@ -42,21 +43,21 @@
   CGRect FindCGRectOfWindow();
 
   CGWindowID window_id_;
-  scoped_ptr<InputInjector> input_injector_;
+  std::unique_ptr<InputInjector> input_injector_;
 
   DISALLOW_COPY_AND_ASSIGN(SingleWindowInputInjectorMac);
 };
 
 SingleWindowInputInjectorMac::SingleWindowInputInjectorMac(
     webrtc::WindowId window_id,
-    scoped_ptr<InputInjector> input_injector)
+    std::unique_ptr<InputInjector> input_injector)
     : window_id_(static_cast<CGWindowID>(window_id)),
       input_injector_(std::move(input_injector)) {}
 
 SingleWindowInputInjectorMac::~SingleWindowInputInjectorMac() {}
 
 void SingleWindowInputInjectorMac::Start(
-    scoped_ptr<protocol::ClipboardStub> client_clipboard) {
+    std::unique_ptr<protocol::ClipboardStub> client_clipboard) {
   input_injector_->Start(std::move(client_clipboard));
 }
 
@@ -161,10 +162,10 @@
   return CGRectNull;
 }
 
-scoped_ptr<InputInjector> SingleWindowInputInjector::CreateForWindow(
+std::unique_ptr<InputInjector> SingleWindowInputInjector::CreateForWindow(
     webrtc::WindowId window_id,
-    scoped_ptr<InputInjector> input_injector) {
-  return make_scoped_ptr(
+    std::unique_ptr<InputInjector> input_injector) {
+  return base::WrapUnique(
       new SingleWindowInputInjectorMac(window_id, std::move(input_injector)));
 }
 
diff --git a/remoting/host/single_window_input_injector_win.cc b/remoting/host/single_window_input_injector_win.cc
index 7baa8bd..f8b2aea 100644
--- a/remoting/host/single_window_input_injector_win.cc
+++ b/remoting/host/single_window_input_injector_win.cc
@@ -6,9 +6,9 @@
 
 namespace remoting {
 
-scoped_ptr<InputInjector> SingleWindowInputInjector::CreateForWindow(
+std::unique_ptr<InputInjector> SingleWindowInputInjector::CreateForWindow(
     webrtc::WindowId window_id,
-    scoped_ptr<InputInjector> input_injector) {
+    std::unique_ptr<InputInjector> input_injector) {
   return nullptr;
 }
 
diff --git a/remoting/host/token_validator_base.cc b/remoting/host/token_validator_base.cc
index bbf7396..08c077e 100644
--- a/remoting/host/token_validator_base.cc
+++ b/remoting/host/token_validator_base.cc
@@ -209,7 +209,7 @@
   }
 
   // Decode the JSON data from the response.
-  scoped_ptr<base::Value> value = base::JSONReader::Read(data_);
+  std::unique_ptr<base::Value> value = base::JSONReader::Read(data_);
   base::DictionaryValue* dict;
   if (!value || !value->GetAsDictionary(&dict)) {
     LOG(ERROR) << "Invalid token validation response: '" << data_ << "'";
diff --git a/remoting/host/token_validator_base.h b/remoting/host/token_validator_base.h
index 660a898..eab3064a 100644
--- a/remoting/host/token_validator_base.h
+++ b/remoting/host/token_validator_base.h
@@ -5,9 +5,10 @@
 #ifndef REMOTING_HOST_TOKEN_VALIDATOR_BASE_H_
 #define REMOTING_HOST_TOKEN_VALIDATOR_BASE_H_
 
+#include <memory>
+
 #include "base/callback.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "net/url_request/url_request.h"
 #include "net/url_request/url_request_context_getter.h"
@@ -65,7 +66,7 @@
   scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
 
   // URLRequest related fields.
-  scoped_ptr<net::URLRequest> request_;
+  std::unique_ptr<net::URLRequest> request_;
   scoped_refptr<net::IOBuffer> buffer_;
   std::string data_;
 
diff --git a/remoting/host/token_validator_factory_impl.cc b/remoting/host/token_validator_factory_impl.cc
index 321722de4..972a410 100644
--- a/remoting/host/token_validator_factory_impl.cc
+++ b/remoting/host/token_validator_factory_impl.cc
@@ -14,6 +14,7 @@
 #include "base/json/json_reader.h"
 #include "base/logging.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/single_thread_task_runner.h"
 #include "base/strings/string_util.h"
 #include "base/values.h"
@@ -92,9 +93,8 @@
       net::HttpRequestHeaders::kContentType,
       "application/x-www-form-urlencoded", true);
   request_->set_method("POST");
-  scoped_ptr<net::UploadElementReader> reader(
-      new net::UploadBytesElementReader(
-          post_body_.data(), post_body_.size()));
+  std::unique_ptr<net::UploadElementReader> reader(
+      new net::UploadBytesElementReader(post_body_.data(), post_body_.size()));
   request_->set_upload(
       net::ElementsUploadDataStream::CreateWithReader(std::move(reader), 0));
   request_->Start();
@@ -123,14 +123,12 @@
 TokenValidatorFactoryImpl::~TokenValidatorFactoryImpl() {
 }
 
-scoped_ptr<protocol::TokenValidator>
-TokenValidatorFactoryImpl::CreateTokenValidator(
-    const std::string& local_jid,
-    const std::string& remote_jid) {
-  return make_scoped_ptr(
-      new TokenValidatorImpl(third_party_auth_config_,
-                             key_pair_, local_jid, remote_jid,
-                             request_context_getter_));
+std::unique_ptr<protocol::TokenValidator>
+TokenValidatorFactoryImpl::CreateTokenValidator(const std::string& local_jid,
+                                                const std::string& remote_jid) {
+  return base::WrapUnique(
+      new TokenValidatorImpl(third_party_auth_config_, key_pair_, local_jid,
+                             remote_jid, request_context_getter_));
 }
 
 }  // namespace remoting
diff --git a/remoting/host/token_validator_factory_impl.h b/remoting/host/token_validator_factory_impl.h
index 7ba77f14..e1c17411 100644
--- a/remoting/host/token_validator_factory_impl.h
+++ b/remoting/host/token_validator_factory_impl.h
@@ -29,7 +29,7 @@
       scoped_refptr<net::URLRequestContextGetter> request_context_getter);
 
   // TokenValidatorFactory interface.
-  scoped_ptr<protocol::TokenValidator> CreateTokenValidator(
+  std::unique_ptr<protocol::TokenValidator> CreateTokenValidator(
       const std::string& local_jid,
       const std::string& remote_jid) override;
 
diff --git a/remoting/host/token_validator_factory_impl_unittest.cc b/remoting/host/token_validator_factory_impl_unittest.cc
index b86f9fb..c9aabd3 100644
--- a/remoting/host/token_validator_factory_impl_unittest.cc
+++ b/remoting/host/token_validator_factory_impl_unittest.cc
@@ -4,10 +4,13 @@
 //
 // A set of unit tests for TokenValidatorFactoryImpl
 
+#include "remoting/host/token_validator_factory_impl.h"
+
+#include <memory>
 #include <string>
 
 #include "base/json/json_writer.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
 #include "base/values.h"
 #include "net/http/http_status_code.h"
 #include "net/url_request/url_request_job_factory.h"
@@ -17,7 +20,6 @@
 #include "net/url_request/url_request_test_util.h"
 #include "remoting/base/rsa_key_pair.h"
 #include "remoting/base/test_rsa_key_pair.h"
-#include "remoting/host/token_validator_factory_impl.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "url/gurl.h"
 
@@ -56,10 +58,10 @@
 class SetResponseURLRequestContext: public net::TestURLRequestContext {
  public:
   void SetResponse(const std::string& headers, const std::string& response) {
-    scoped_ptr<net::URLRequestJobFactoryImpl> factory =
-        make_scoped_ptr(new net::URLRequestJobFactoryImpl());
+    std::unique_ptr<net::URLRequestJobFactoryImpl> factory =
+        base::WrapUnique(new net::URLRequestJobFactoryImpl());
     factory->SetProtocolHandler(
-        "https", make_scoped_ptr(new FakeProtocolHandler(headers, response)));
+        "https", base::WrapUnique(new FakeProtocolHandler(headers, response)));
     context_storage_.set_job_factory(std::move(factory));
   }
 };
@@ -93,7 +95,7 @@
     key_pair_ = RsaKeyPair::FromString(kTestRsaKeyPair);
     request_context_getter_ = new net::TestURLRequestContextGetter(
         message_loop_.task_runner(),
-        make_scoped_ptr(new SetResponseURLRequestContext()));
+        base::WrapUnique(new SetResponseURLRequestContext()));
     ThirdPartyAuthConfig config;
     config.token_url = GURL(kTokenUrl);
     config.token_validation_url = GURL(kTokenValidationUrl);
@@ -132,7 +134,7 @@
   scoped_refptr<RsaKeyPair> key_pair_;
   scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
   scoped_refptr<TokenValidatorFactoryImpl> token_validator_factory_;
-  scoped_ptr<protocol::TokenValidator> token_validator_;
+  std::unique_ptr<protocol::TokenValidator> token_validator_;
 };
 
 TEST_F(TokenValidatorFactoryImplTest, Success) {
diff --git a/remoting/host/touch_injector_win.cc b/remoting/host/touch_injector_win.cc
index 6c7c262..4d90747 100644
--- a/remoting/host/touch_injector_win.cc
+++ b/remoting/host/touch_injector_win.cc
@@ -86,11 +86,11 @@
 TouchInjectorWinDelegate::~TouchInjectorWinDelegate() {}
 
 // static.
-scoped_ptr<TouchInjectorWinDelegate> TouchInjectorWinDelegate::Create() {
+std::unique_ptr<TouchInjectorWinDelegate> TouchInjectorWinDelegate::Create() {
   base::ScopedNativeLibrary library(base::FilePath(L"User32.dll"));
   if (!library.is_valid()) {
     PLOG(INFO) << "Failed to get library module for touch injection functions.";
-    return scoped_ptr<TouchInjectorWinDelegate>();
+    return std::unique_ptr<TouchInjectorWinDelegate>();
   }
 
   InitializeTouchInjectionFunction init_func =
@@ -98,7 +98,7 @@
           library.GetFunctionPointer("InitializeTouchInjection"));
   if (!init_func) {
     PLOG(INFO) << "Failed to get InitializeTouchInjection function handle.";
-    return scoped_ptr<TouchInjectorWinDelegate>();
+    return std::unique_ptr<TouchInjectorWinDelegate>();
   }
 
   InjectTouchInputFunction inject_touch_func =
@@ -106,12 +106,11 @@
           library.GetFunctionPointer("InjectTouchInput"));
   if (!inject_touch_func) {
     PLOG(INFO) << "Failed to get InjectTouchInput.";
-    return scoped_ptr<TouchInjectorWinDelegate>();
+    return std::unique_ptr<TouchInjectorWinDelegate>();
   }
 
-  return scoped_ptr<TouchInjectorWinDelegate>(
-      new TouchInjectorWinDelegate(
-          library.Release(), init_func, inject_touch_func));
+  return std::unique_ptr<TouchInjectorWinDelegate>(new TouchInjectorWinDelegate(
+      library.Release(), init_func, inject_touch_func));
 }
 
 TouchInjectorWinDelegate::TouchInjectorWinDelegate(
@@ -190,7 +189,7 @@
 }
 
 void TouchInjectorWin::SetInjectorDelegateForTest(
-    scoped_ptr<TouchInjectorWinDelegate> functions) {
+    std::unique_ptr<TouchInjectorWinDelegate> functions) {
   delegate_ = std::move(functions);
 }
 
diff --git a/remoting/host/touch_injector_win.h b/remoting/host/touch_injector_win.h
index 6256018..c0723737 100644
--- a/remoting/host/touch_injector_win.h
+++ b/remoting/host/touch_injector_win.h
@@ -8,10 +8,10 @@
 #include <windows.h>
 #include <stdint.h>
 #include <map>
+#include <memory>
 #include <vector>
 
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/scoped_native_library.h"
 
 namespace remoting {
@@ -30,7 +30,7 @@
 
   // Determines whether Windows touch injection functions can be used.
   // Returns a non-null TouchInjectorWinDelegate on success.
-  static scoped_ptr<TouchInjectorWinDelegate> Create();
+  static std::unique_ptr<TouchInjectorWinDelegate> Create();
 
   // These match the functions in MSDN.
   virtual BOOL InitializeTouchInjection(UINT32 max_count, DWORD dw_mode);
@@ -75,7 +75,7 @@
   void InjectTouchEvent(const protocol::TouchEvent& event);
 
   void SetInjectorDelegateForTest(
-      scoped_ptr<TouchInjectorWinDelegate> functions);
+      std::unique_ptr<TouchInjectorWinDelegate> functions);
 
  private:
   // Helper methods called from InjectTouchEvent().
@@ -88,7 +88,7 @@
   void CancelTouchPoints(const protocol::TouchEvent& event);
 
   // Set to null if touch injection is not available from the OS.
-  scoped_ptr<TouchInjectorWinDelegate> delegate_;
+  std::unique_ptr<TouchInjectorWinDelegate> delegate_;
 
   // TODO(rkuroiwa): crbug.com/470203
   // This is a naive implementation. Check if we can achieve
diff --git a/remoting/host/touch_injector_win_unittest.cc b/remoting/host/touch_injector_win_unittest.cc
index 785ae65..f3d24d9 100644
--- a/remoting/host/touch_injector_win_unittest.cc
+++ b/remoting/host/touch_injector_win_unittest.cc
@@ -88,7 +88,7 @@
 // A test to make sure that the touch event is converted correctly to
 // POINTER_TOUCH_INFO.
 TEST(TouchInjectorWinTest, CheckConversionWithPressure) {
-  scoped_ptr<TouchInjectorWinDelegateMock> delegate_mock(
+  std::unique_ptr<TouchInjectorWinDelegateMock> delegate_mock(
       new ::testing::StrictMock<TouchInjectorWinDelegateMock>());
 
   TouchEvent event;
@@ -156,7 +156,7 @@
 // Some devices don't detect pressure. This test is a conversion check for
 // such devices.
 TEST(TouchInjectorWinTest, CheckConversionNoPressure) {
-  scoped_ptr<TouchInjectorWinDelegateMock> delegate_mock(
+  std::unique_ptr<TouchInjectorWinDelegateMock> delegate_mock(
       new ::testing::StrictMock<TouchInjectorWinDelegateMock>());
 
   TouchEvent event;
@@ -201,7 +201,7 @@
 
 // If initialization fails, it should not call any touch injection functions.
 TEST(TouchInjectorWinTest, InitFailed) {
-  scoped_ptr<TouchInjectorWinDelegateMock> delegate_mock(
+  std::unique_ptr<TouchInjectorWinDelegateMock> delegate_mock(
       new ::testing::StrictMock<TouchInjectorWinDelegateMock>());
 
   TouchEvent event;
@@ -220,10 +220,12 @@
 
 // Deinitialize and initialize should clean the state.
 TEST(TouchInjectorWinTest, Reinitialize) {
-  scoped_ptr<TouchInjectorWinDelegateMock> delegate_mock_before_deinitialize(
-      new ::testing::StrictMock<TouchInjectorWinDelegateMock>());
-  scoped_ptr<TouchInjectorWinDelegateMock> delegate_mock_after_deinitialize(
-      new ::testing::StrictMock<TouchInjectorWinDelegateMock>());
+  std::unique_ptr<TouchInjectorWinDelegateMock>
+      delegate_mock_before_deinitialize(
+          new ::testing::StrictMock<TouchInjectorWinDelegateMock>());
+  std::unique_ptr<TouchInjectorWinDelegateMock>
+      delegate_mock_after_deinitialize(
+          new ::testing::StrictMock<TouchInjectorWinDelegateMock>());
 
   TouchEvent first_event;
   first_event.set_event_type(TouchEvent::TOUCH_POINT_START);
@@ -274,7 +276,7 @@
 
 // Make sure that the flag is set to kStartFlag.
 TEST(TouchInjectorWinTest, StartTouchPoint) {
-  scoped_ptr<TouchInjectorWinDelegateMock> delegate_mock(
+  std::unique_ptr<TouchInjectorWinDelegateMock> delegate_mock(
       new ::testing::StrictMock<TouchInjectorWinDelegateMock>());
 
   TouchEvent event;
@@ -301,7 +303,7 @@
 
 // Start a point and then move, make sure the flag is set to kMoveFlag.
 TEST(TouchInjectorWinTest, MoveTouchPoint) {
-  scoped_ptr<TouchInjectorWinDelegateMock> delegate_mock(
+  std::unique_ptr<TouchInjectorWinDelegateMock> delegate_mock(
       new ::testing::StrictMock<TouchInjectorWinDelegateMock>());
 
   TouchEvent event;
@@ -337,7 +339,7 @@
 
 // Start a point and then move, make sure the flag is set to kEndFlag.
 TEST(TouchInjectorWinTest, EndTouchPoint) {
-  scoped_ptr<TouchInjectorWinDelegateMock> delegate_mock(
+  std::unique_ptr<TouchInjectorWinDelegateMock> delegate_mock(
       new ::testing::StrictMock<TouchInjectorWinDelegateMock>());
 
   TouchEvent event;
@@ -372,7 +374,7 @@
 
 // Start a point and then move, make sure the flag is set to kCancelFlag.
 TEST(TouchInjectorWinTest, CancelTouchPoint) {
-  scoped_ptr<TouchInjectorWinDelegateMock> delegate_mock(
+  std::unique_ptr<TouchInjectorWinDelegateMock> delegate_mock(
       new ::testing::StrictMock<TouchInjectorWinDelegateMock>());
 
   TouchEvent event;
@@ -414,7 +416,7 @@
 // 5. End second touch point.
 // 6. Cancel remaining (first and third) touch points.
 TEST(TouchInjectorWinTest, MultiTouch) {
-  scoped_ptr<TouchInjectorWinDelegateMock> delegate_mock(
+  std::unique_ptr<TouchInjectorWinDelegateMock> delegate_mock(
       new ::testing::StrictMock<TouchInjectorWinDelegateMock>());
 
   InSequence s;
diff --git a/remoting/host/usage_stats_consent_mac.cc b/remoting/host/usage_stats_consent_mac.cc
index 2a7f86a..50f3ce4d 100644
--- a/remoting/host/usage_stats_consent_mac.cc
+++ b/remoting/host/usage_stats_consent_mac.cc
@@ -4,12 +4,12 @@
 
 #include "remoting/host/usage_stats_consent.h"
 
+#include <memory>
 #include <string>
 
 #include "base/command_line.h"
 #include "base/files/file_path.h"
 #include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/values.h"
 #include "remoting/host/config_file_watcher.h"
 #include "remoting/host/host_config.h"
@@ -27,7 +27,7 @@
   if (command_line->HasSwitch(kHostConfigSwitchName)) {
     base::FilePath config_file_path =
         command_line->GetSwitchValuePath(kHostConfigSwitchName);
-    scoped_ptr<base::DictionaryValue> host_config(
+    std::unique_ptr<base::DictionaryValue> host_config(
         HostConfigFromJsonFile(config_file_path));
     if (host_config) {
       return host_config->GetBoolean(kUsageStatsConsentConfigPath, allowed);
diff --git a/remoting/host/win/host_service.h b/remoting/host/win/host_service.h
index 34629ed..de3f3a0 100644
--- a/remoting/host/win/host_service.h
+++ b/remoting/host/win/host_service.h
@@ -9,10 +9,10 @@
 #include <stdint.h>
 
 #include <list>
+#include <memory>
 
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/singleton.h"
 #include "base/memory/weak_ptr.h"
 #include "base/synchronization/waitable_event.h"
@@ -104,7 +104,7 @@
   // The list of observers receiving session notifications.
   std::list<RegisteredObserver> observers_;
 
-  scoped_ptr<DaemonProcess> daemon_process_;
+  std::unique_ptr<DaemonProcess> daemon_process_;
 
   // Service message loop. |main_task_runner_| must be valid as long as the
   // Control+C or service notification handler is registered.
diff --git a/remoting/host/win/launch_process_with_token.cc b/remoting/host/win/launch_process_with_token.cc
index a274b334..04a6660 100644
--- a/remoting/host/win/launch_process_with_token.cc
+++ b/remoting/host/win/launch_process_with_token.cc
@@ -9,10 +9,10 @@
 #include <winternl.h>
 
 #include <limits>
+#include <memory>
 #include <utility>
 
 #include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/rand_util.h"
 #include "base/scoped_native_library.h"
 #include "base/strings/string16.h"
@@ -323,7 +323,7 @@
   // and three nullptr-terminated string parameters.
   size_t size = sizeof(CreateProcessRequest) + sizeof(wchar_t) *
       (application_name.size() + command_line.size() + desktop.size() + 3);
-  scoped_ptr<char[]> buffer(new char[size]);
+  std::unique_ptr<char[]> buffer(new char[size]);
   memset(buffer.get(), 0, size);
 
   // Marshal the input parameters.
diff --git a/remoting/host/win/launch_process_with_token.h b/remoting/host/win/launch_process_with_token.h
index 0525d73..090c4bf 100644
--- a/remoting/host/win/launch_process_with_token.h
+++ b/remoting/host/win/launch_process_with_token.h
@@ -7,12 +7,13 @@
 
 #include <windows.h>
 #include <stdint.h>
+
+#include <memory>
 #include <string>
 
 #include "base/command_line.h"
 #include "base/files/file_path.h"
 #include "base/lazy_instance.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/synchronization/lock.h"
 #include "base/win/scoped_handle.h"
 
diff --git a/remoting/host/win/rdp_client.cc b/remoting/host/win/rdp_client.cc
index 9c67fb4..f190798 100644
--- a/remoting/host/win/rdp_client.cc
+++ b/remoting/host/win/rdp_client.cc
@@ -81,7 +81,7 @@
   RdpClient::EventHandler* event_handler_;
 
   // Hosts the RDP ActiveX control.
-  scoped_ptr<RdpClientWindow> rdp_client_window_;
+  std::unique_ptr<RdpClientWindow> rdp_client_window_;
 
   // A self-reference to keep the object alive during connection shutdown.
   scoped_refptr<Core> self_;
diff --git a/remoting/host/win/rdp_client.h b/remoting/host/win/rdp_client.h
index 7c24efad..049cfdd 100644
--- a/remoting/host/win/rdp_client.h
+++ b/remoting/host/win/rdp_client.h
@@ -5,11 +5,11 @@
 #ifndef REMOTING_HOST_WIN_RDP_CLIENT_H_
 #define REMOTING_HOST_WIN_RDP_CLIENT_H_
 
+#include <memory>
 #include <string>
 
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/threading/non_thread_safe.h"
 
 namespace base {
diff --git a/remoting/host/win/rdp_client_unittest.cc b/remoting/host/win/rdp_client_unittest.cc
index d9f44d1e..01524be 100644
--- a/remoting/host/win/rdp_client_unittest.cc
+++ b/remoting/host/win/rdp_client_unittest.cc
@@ -93,7 +93,7 @@
 
  protected:
   // The ATL module instance required by the ATL code.
-  scoped_ptr<RdpClientModule> module_;
+  std::unique_ptr<RdpClientModule> module_;
 
   // The UI message loop used by RdpClient. The loop is stopped once there is no
   // more references to |task_runner_|.
@@ -105,7 +105,7 @@
   MockRdpClientEventHandler event_handler_;
 
   // Points to the object being tested.
-  scoped_ptr<RdpClient> rdp_client_;
+  std::unique_ptr<RdpClient> rdp_client_;
 
   // Unique terminal identifier passed to RdpClient.
   std::string terminal_id_;
diff --git a/remoting/host/win/rdp_desktop_session.h b/remoting/host/win/rdp_desktop_session.h
index 94237a6b2..3b3f5dd 100644
--- a/remoting/host/win/rdp_desktop_session.h
+++ b/remoting/host/win/rdp_desktop_session.h
@@ -9,7 +9,8 @@
 #include <atlcom.h>
 #include <atlctl.h>
 
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
 #include "base/win/scoped_comptr.h"
 // chromoting_lib.h contains MIDL-generated declarations.
 #include "remoting/host/chromoting_lib.h"
@@ -61,7 +62,7 @@
   END_COM_MAP()
 
   // Implements loading and instantiation of the RDP ActiveX client.
-  scoped_ptr<RdpClient> client_;
+  std::unique_ptr<RdpClient> client_;
 
   // Holds a reference to the caller's EventHandler, through which notifications
   // are dispatched. Released in Disconnect(), to prevent further notifications.
diff --git a/remoting/host/win/session_desktop_environment.cc b/remoting/host/win/session_desktop_environment.cc
index 9d9f8b2..dc19f1d 100644
--- a/remoting/host/win/session_desktop_environment.cc
+++ b/remoting/host/win/session_desktop_environment.cc
@@ -7,6 +7,7 @@
 #include <utility>
 
 #include "base/logging.h"
+#include "base/memory/ptr_util.h"
 #include "base/single_thread_task_runner.h"
 #include "remoting/host/audio_capturer.h"
 #include "remoting/host/input_injector.h"
@@ -18,10 +19,11 @@
 
 SessionDesktopEnvironment::~SessionDesktopEnvironment() {}
 
-scoped_ptr<InputInjector> SessionDesktopEnvironment::CreateInputInjector() {
+std::unique_ptr<InputInjector>
+SessionDesktopEnvironment::CreateInputInjector() {
   DCHECK(caller_task_runner()->BelongsToCurrentThread());
 
-  return make_scoped_ptr(new SessionInputInjectorWin(
+  return base::WrapUnique(new SessionInputInjectorWin(
       input_task_runner(),
       InputInjector::Create(input_task_runner(), ui_task_runner()),
       ui_task_runner(), inject_sas_));
@@ -57,11 +59,11 @@
 
 SessionDesktopEnvironmentFactory::~SessionDesktopEnvironmentFactory() {}
 
-scoped_ptr<DesktopEnvironment> SessionDesktopEnvironmentFactory::Create(
+std::unique_ptr<DesktopEnvironment> SessionDesktopEnvironmentFactory::Create(
     base::WeakPtr<ClientSessionControl> client_session_control) {
   DCHECK(caller_task_runner()->BelongsToCurrentThread());
 
-  scoped_ptr<SessionDesktopEnvironment> desktop_environment(
+  std::unique_ptr<SessionDesktopEnvironment> desktop_environment(
       new SessionDesktopEnvironment(caller_task_runner(),
                                     video_capture_task_runner(),
                                     input_task_runner(), ui_task_runner(),
diff --git a/remoting/host/win/session_desktop_environment.h b/remoting/host/win/session_desktop_environment.h
index 96fd493..a74f6fc 100644
--- a/remoting/host/win/session_desktop_environment.h
+++ b/remoting/host/win/session_desktop_environment.h
@@ -20,7 +20,7 @@
   ~SessionDesktopEnvironment() override;
 
   // DesktopEnvironment implementation.
-  scoped_ptr<InputInjector> CreateInputInjector() override;
+  std::unique_ptr<InputInjector> CreateInputInjector() override;
 
  private:
   friend class SessionDesktopEnvironmentFactory;
@@ -50,7 +50,7 @@
   ~SessionDesktopEnvironmentFactory() override;
 
   // DesktopEnvironmentFactory implementation.
-  scoped_ptr<DesktopEnvironment> Create(
+  std::unique_ptr<DesktopEnvironment> Create(
       base::WeakPtr<ClientSessionControl> client_session_control) override;
 
  private:
diff --git a/remoting/host/win/session_input_injector.cc b/remoting/host/win/session_input_injector.cc
index ce0ec31..9b685186 100644
--- a/remoting/host/win/session_input_injector.cc
+++ b/remoting/host/win/session_input_injector.cc
@@ -48,14 +48,13 @@
     : public base::RefCountedThreadSafe<SessionInputInjectorWin::Core>,
       public InputInjector {
  public:
-  Core(
-      scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
-      scoped_ptr<InputInjector> nested_executor,
-      scoped_refptr<base::SingleThreadTaskRunner> inject_sas_task_runner,
-      const base::Closure& inject_sas);
+  Core(scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
+       std::unique_ptr<InputInjector> nested_executor,
+       scoped_refptr<base::SingleThreadTaskRunner> inject_sas_task_runner,
+       const base::Closure& inject_sas);
 
   // InputInjector implementation.
-  void Start(scoped_ptr<ClipboardStub> client_clipboard) override;
+  void Start(std::unique_ptr<ClipboardStub> client_clipboard) override;
 
   // protocol::ClipboardStub implementation.
   void InjectClipboardEvent(const ClipboardEvent& event) override;
@@ -77,7 +76,7 @@
   scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_;
 
   // Pointer to the next event executor.
-  scoped_ptr<InputInjector> nested_executor_;
+  std::unique_ptr<InputInjector> nested_executor_;
 
   scoped_refptr<base::SingleThreadTaskRunner> inject_sas_task_runner_;
 
@@ -87,7 +86,7 @@
   base::Closure inject_sas_;
 
   // Used to inject Secure Attention Sequence on XP.
-  scoped_ptr<SasInjector> sas_injector_;
+  std::unique_ptr<SasInjector> sas_injector_;
 
   // Keys currently pressed by the client, used to detect Ctrl-Alt-Del.
   std::set<ui::DomCode> pressed_keys_;
@@ -97,7 +96,7 @@
 
 SessionInputInjectorWin::Core::Core(
     scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
-    scoped_ptr<InputInjector> nested_executor,
+    std::unique_ptr<InputInjector> nested_executor,
     scoped_refptr<base::SingleThreadTaskRunner> inject_sas_task_runner,
     const base::Closure& inject_sas)
     : input_task_runner_(input_task_runner),
@@ -106,7 +105,7 @@
       inject_sas_(inject_sas) {}
 
 void SessionInputInjectorWin::Core::Start(
-    scoped_ptr<protocol::ClipboardStub> client_clipboard) {
+    std::unique_ptr<protocol::ClipboardStub> client_clipboard) {
   if (!input_task_runner_->BelongsToCurrentThread()) {
     input_task_runner_->PostTask(
         FROM_HERE,
@@ -205,7 +204,7 @@
 void SessionInputInjectorWin::Core::SwitchToInputDesktop() {
   // Switch to the desktop receiving user input if different from the current
   // one.
-  scoped_ptr<webrtc::Desktop> input_desktop(
+  std::unique_ptr<webrtc::Desktop> input_desktop(
       webrtc::Desktop::GetInputDesktop());
   if (input_desktop.get() != nullptr && !desktop_.IsSame(*input_desktop)) {
     // If SetThreadDesktop() fails, the thread is still assigned a desktop.
@@ -216,7 +215,7 @@
 
 SessionInputInjectorWin::SessionInputInjectorWin(
     scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
-    scoped_ptr<InputInjector> nested_executor,
+    std::unique_ptr<InputInjector> nested_executor,
     scoped_refptr<base::SingleThreadTaskRunner> inject_sas_task_runner,
     const base::Closure& inject_sas) {
   core_ = new Core(input_task_runner, std::move(nested_executor),
@@ -227,7 +226,7 @@
 }
 
 void SessionInputInjectorWin::Start(
-    scoped_ptr<protocol::ClipboardStub> client_clipboard) {
+    std::unique_ptr<protocol::ClipboardStub> client_clipboard) {
   core_->Start(std::move(client_clipboard));
 }
 
diff --git a/remoting/host/win/session_input_injector.h b/remoting/host/win/session_input_injector.h
index f91251f2..ed818c98 100644
--- a/remoting/host/win/session_input_injector.h
+++ b/remoting/host/win/session_input_injector.h
@@ -5,10 +5,11 @@
 #ifndef REMOTING_HOST_WIN_SESSION_INPUT_INJECTOR_H_
 #define REMOTING_HOST_WIN_SESSION_INPUT_INJECTOR_H_
 
+#include <memory>
+
 #include "base/callback_forward.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "remoting/host/input_injector.h"
 
 namespace base {
@@ -26,14 +27,14 @@
   // Vista+.
   SessionInputInjectorWin(
       scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
-      scoped_ptr<InputInjector> nested_executor,
+      std::unique_ptr<InputInjector> nested_executor,
       scoped_refptr<base::SingleThreadTaskRunner> inject_sas_task_runner,
       const base::Closure& inject_sas);
   ~SessionInputInjectorWin() override;
 
   // InputInjector implementation.
   void Start(
-      scoped_ptr<protocol::ClipboardStub> client_clipboard) override;
+      std::unique_ptr<protocol::ClipboardStub> client_clipboard) override;
 
   // protocol::ClipboardStub implementation.
   void InjectClipboardEvent(
diff --git a/remoting/host/win/unprivileged_process_delegate.cc b/remoting/host/win/unprivileged_process_delegate.cc
index c4b9276..66d6c1e 100644
--- a/remoting/host/win/unprivileged_process_delegate.cc
+++ b/remoting/host/win/unprivileged_process_delegate.cc
@@ -238,7 +238,7 @@
 
 UnprivilegedProcessDelegate::UnprivilegedProcessDelegate(
     scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
-    scoped_ptr<base::CommandLine> target_command)
+    std::unique_ptr<base::CommandLine> target_command)
     : io_task_runner_(io_task_runner),
       target_command_(std::move(target_command)),
       event_handler_(nullptr) {}
@@ -256,7 +256,7 @@
 
   event_handler_ = event_handler;
 
-  scoped_ptr<IPC::ChannelProxy> server;
+  std::unique_ptr<IPC::ChannelProxy> server;
 
   // Create a restricted token that will be used to run the worker process.
   ScopedHandle token;
diff --git a/remoting/host/win/unprivileged_process_delegate.h b/remoting/host/win/unprivileged_process_delegate.h
index 086f9118..5059234ff 100644
--- a/remoting/host/win/unprivileged_process_delegate.h
+++ b/remoting/host/win/unprivileged_process_delegate.h
@@ -7,11 +7,12 @@
 
 #include <stdint.h>
 
+#include <memory>
+
 #include "base/compiler_specific.h"
 #include "base/files/file_path.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/threading/non_thread_safe.h"
 #include "base/win/scoped_handle.h"
 #include "ipc/ipc_listener.h"
@@ -38,7 +39,7 @@
  public:
   UnprivilegedProcessDelegate(
       scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
-      scoped_ptr<base::CommandLine> target_command);
+      std::unique_ptr<base::CommandLine> target_command);
   ~UnprivilegedProcessDelegate() override;
 
   // WorkerProcessLauncher::Delegate implementation.
@@ -60,11 +61,11 @@
   scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
 
   // Command line of the launched process.
-  scoped_ptr<base::CommandLine> target_command_;
+  std::unique_ptr<base::CommandLine> target_command_;
 
   // The server end of the IPC channel used to communicate to the worker
   // process.
-  scoped_ptr<IPC::ChannelProxy> channel_;
+  std::unique_ptr<IPC::ChannelProxy> channel_;
 
   WorkerProcessLauncher* event_handler_;
 
diff --git a/remoting/host/win/worker_process_launcher.cc b/remoting/host/win/worker_process_launcher.cc
index 941fefba..f3198a0 100644
--- a/remoting/host/win/worker_process_launcher.cc
+++ b/remoting/host/win/worker_process_launcher.cc
@@ -53,7 +53,7 @@
 WorkerProcessLauncher::Delegate::~Delegate() {}
 
 WorkerProcessLauncher::WorkerProcessLauncher(
-    scoped_ptr<WorkerProcessLauncher::Delegate> launcher_delegate,
+    std::unique_ptr<WorkerProcessLauncher::Delegate> launcher_delegate,
     WorkerProcessIpcDelegate* ipc_handler)
     : ipc_handler_(ipc_handler),
       launcher_delegate_(std::move(launcher_delegate)),
diff --git a/remoting/host/win/worker_process_launcher.h b/remoting/host/win/worker_process_launcher.h
index e263509e..9e3ff2f 100644
--- a/remoting/host/win/worker_process_launcher.h
+++ b/remoting/host/win/worker_process_launcher.h
@@ -7,11 +7,12 @@
 
 #include <stdint.h>
 
+#include <memory>
+
 #include "base/callback.h"
 #include "base/compiler_specific.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/threading/non_thread_safe.h"
 #include "base/timer/timer.h"
 #include "base/win/object_watcher.h"
@@ -66,7 +67,7 @@
   // Creates the launcher that will use |launcher_delegate| to manage the worker
   // process and |ipc_handler| to handle IPCs. The caller must ensure that
   // |ipc_handler| must outlive this object.
-  WorkerProcessLauncher(scoped_ptr<Delegate> launcher_delegate,
+  WorkerProcessLauncher(std::unique_ptr<Delegate> launcher_delegate,
                         WorkerProcessIpcDelegate* ipc_handler);
   ~WorkerProcessLauncher() override;
 
@@ -130,7 +131,7 @@
   WorkerProcessIpcDelegate* ipc_handler_;
 
   // Implements specifics of launching a worker process.
-  scoped_ptr<WorkerProcessLauncher::Delegate> launcher_delegate_;
+  std::unique_ptr<WorkerProcessLauncher::Delegate> launcher_delegate_;
 
   // Keeps the exit code of the worker process after it was closed. The exit
   // code is used to determine whether the process has to be restarted.
diff --git a/remoting/host/win/worker_process_launcher_unittest.cc b/remoting/host/win/worker_process_launcher_unittest.cc
index ba27372..a71318f 100644
--- a/remoting/host/win/worker_process_launcher_unittest.cc
+++ b/remoting/host/win/worker_process_launcher_unittest.cc
@@ -167,19 +167,19 @@
   MockIpcDelegate server_listener_;
 
   // Implements WorkerProcessLauncher::Delegate.
-  scoped_ptr<MockProcessLauncherDelegate> launcher_delegate_;
+  std::unique_ptr<MockProcessLauncherDelegate> launcher_delegate_;
 
   // The name of the IPC channel.
   std::string channel_name_;
 
   // Client and server ends of the IPC channel.
-  scoped_ptr<IPC::ChannelProxy> channel_client_;
-  scoped_ptr<IPC::ChannelProxy> channel_server_;
+  std::unique_ptr<IPC::ChannelProxy> channel_client_;
+  std::unique_ptr<IPC::ChannelProxy> channel_server_;
 
   WorkerProcessLauncher* event_handler_;
 
   // The worker process launcher.
-  scoped_ptr<WorkerProcessLauncher> launcher_;
+  std::unique_ptr<WorkerProcessLauncher> launcher_;
 
   // An event that is used to emulate the worker process's handle.
   ScopedHandle worker_process_;
diff --git a/remoting/host/win/wts_session_process_delegate.cc b/remoting/host/win/wts_session_process_delegate.cc
index 9bd58bfe..be23baf3 100644
--- a/remoting/host/win/wts_session_process_delegate.cc
+++ b/remoting/host/win/wts_session_process_delegate.cc
@@ -50,7 +50,7 @@
       public IPC::Listener {
  public:
   Core(scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
-       scoped_ptr<base::CommandLine> target,
+       std::unique_ptr<base::CommandLine> target,
        bool launch_elevated,
        const std::string& channel_security);
 
@@ -111,7 +111,7 @@
 
   // The server end of the IPC channel used to communicate to the worker
   // process.
-  scoped_ptr<IPC::ChannelProxy> channel_;
+  std::unique_ptr<IPC::ChannelProxy> channel_;
 
   // Security descriptor (as SDDL) to be applied to |channel_|.
   std::string channel_security_;
@@ -138,7 +138,7 @@
   base::win::ScopedHandle session_token_;
 
   // Command line of the launched process.
-  scoped_ptr<base::CommandLine> target_command_;
+  std::unique_ptr<base::CommandLine> target_command_;
 
   // The handle of the worker process, if launched.
   base::win::ScopedHandle worker_process_;
@@ -148,7 +148,7 @@
 
 WtsSessionProcessDelegate::Core::Core(
     scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
-    scoped_ptr<base::CommandLine> target_command,
+    std::unique_ptr<base::CommandLine> target_command,
     bool launch_elevated,
     const std::string& channel_security)
     : caller_task_runner_(base::ThreadTaskRunnerHandle::Get()),
@@ -382,11 +382,9 @@
   }
 
   // Wrap the pipe into an IPC channel.
-  scoped_ptr<IPC::ChannelProxy> channel(
-      IPC::ChannelProxy::Create(IPC::ChannelHandle(pipe.Get()),
-                                IPC::Channel::MODE_SERVER,
-                                this,
-                                io_task_runner_));
+  std::unique_ptr<IPC::ChannelProxy> channel(IPC::ChannelProxy::Create(
+      IPC::ChannelHandle(pipe.Get()), IPC::Channel::MODE_SERVER, this,
+      io_task_runner_));
 
   // Pass the name of the IPC channel to use.
   command_line.AppendSwitchNative(kDaemonPipeSwitchName,
@@ -529,7 +527,7 @@
 
 WtsSessionProcessDelegate::WtsSessionProcessDelegate(
     scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
-    scoped_ptr<base::CommandLine> target_command,
+    std::unique_ptr<base::CommandLine> target_command,
     bool launch_elevated,
     const std::string& channel_security) {
   core_ = new Core(io_task_runner, std::move(target_command), launch_elevated,
diff --git a/remoting/host/win/wts_session_process_delegate.h b/remoting/host/win/wts_session_process_delegate.h
index f3f3e09f..407e0af6 100644
--- a/remoting/host/win/wts_session_process_delegate.h
+++ b/remoting/host/win/wts_session_process_delegate.h
@@ -7,10 +7,11 @@
 
 #include <stdint.h>
 
+#include <memory>
+
 #include "base/compiler_specific.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/threading/non_thread_safe.h"
 #include "remoting/host/win/worker_process_launcher.h"
 
@@ -33,7 +34,7 @@
  public:
   WtsSessionProcessDelegate(
       scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
-      scoped_ptr<base::CommandLine> target,
+      std::unique_ptr<base::CommandLine> target,
       bool launch_elevated,
       const std::string& channel_security);
   ~WtsSessionProcessDelegate() override;
diff --git a/remoting/protocol/audio_reader.cc b/remoting/protocol/audio_reader.cc
index 272a1f1..5fdf077 100644
--- a/remoting/protocol/audio_reader.cc
+++ b/remoting/protocol/audio_reader.cc
@@ -22,8 +22,8 @@
 
 AudioReader::~AudioReader() {}
 
-void AudioReader::OnIncomingMessage(scoped_ptr<CompoundBuffer> message) {
-  scoped_ptr<AudioPacket> audio_packet =
+void AudioReader::OnIncomingMessage(std::unique_ptr<CompoundBuffer> message) {
+  std::unique_ptr<AudioPacket> audio_packet =
       ParseMessage<AudioPacket>(message.get());
   if (audio_packet) {
     audio_stub_->ProcessAudioPacket(std::move(audio_packet),
diff --git a/remoting/protocol/audio_reader.h b/remoting/protocol/audio_reader.h
index 4ad5ef9..79ce53b 100644
--- a/remoting/protocol/audio_reader.h
+++ b/remoting/protocol/audio_reader.h
@@ -20,7 +20,7 @@
   ~AudioReader() override;
 
  private:
-  void OnIncomingMessage(scoped_ptr<CompoundBuffer> message) override;
+  void OnIncomingMessage(std::unique_ptr<CompoundBuffer> message) override;
 
   AudioStub* audio_stub_;
 
diff --git a/remoting/protocol/audio_stub.h b/remoting/protocol/audio_stub.h
index d8db746..715110c 100644
--- a/remoting/protocol/audio_stub.h
+++ b/remoting/protocol/audio_stub.h
@@ -5,9 +5,10 @@
 #ifndef REMOTING_PROTOCOL_AUDIO_STUB_H_
 #define REMOTING_PROTOCOL_AUDIO_STUB_H_
 
+#include <memory>
+
 #include "base/callback_forward.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 
 namespace remoting {
 
@@ -19,7 +20,7 @@
  public:
   virtual ~AudioStub() { }
 
-  virtual void ProcessAudioPacket(scoped_ptr<AudioPacket> audio_packet,
+  virtual void ProcessAudioPacket(std::unique_ptr<AudioPacket> audio_packet,
                                   const base::Closure& done) = 0;
 
  protected:
diff --git a/remoting/protocol/audio_writer.cc b/remoting/protocol/audio_writer.cc
index be40f91..bee8485 100644
--- a/remoting/protocol/audio_writer.cc
+++ b/remoting/protocol/audio_writer.cc
@@ -5,6 +5,7 @@
 #include "remoting/protocol/audio_writer.h"
 
 #include "base/bind.h"
+#include "base/memory/ptr_util.h"
 #include "net/socket/stream_socket.h"
 #include "remoting/base/compound_buffer.h"
 #include "remoting/base/constants.h"
@@ -19,19 +20,19 @@
 AudioWriter::AudioWriter() : ChannelDispatcherBase(kAudioChannelName) {}
 AudioWriter::~AudioWriter() {}
 
-void AudioWriter::ProcessAudioPacket(scoped_ptr<AudioPacket> packet,
+void AudioWriter::ProcessAudioPacket(std::unique_ptr<AudioPacket> packet,
                                      const base::Closure& done) {
   message_pipe()->Send(packet.get(), done);
 }
 
 // static
-scoped_ptr<AudioWriter> AudioWriter::Create(const SessionConfig& config) {
+std::unique_ptr<AudioWriter> AudioWriter::Create(const SessionConfig& config) {
   if (!config.is_audio_enabled())
     return nullptr;
-  return make_scoped_ptr(new AudioWriter());
+  return base::WrapUnique(new AudioWriter());
 }
 
-void AudioWriter::OnIncomingMessage(scoped_ptr<CompoundBuffer> message) {
+void AudioWriter::OnIncomingMessage(std::unique_ptr<CompoundBuffer> message) {
   LOG(ERROR) << "Received unexpected message on the audio channel.";
 }
 
diff --git a/remoting/protocol/audio_writer.h b/remoting/protocol/audio_writer.h
index 89de056..7766dd3 100644
--- a/remoting/protocol/audio_writer.h
+++ b/remoting/protocol/audio_writer.h
@@ -5,12 +5,12 @@
 #ifndef REMOTING_PROTOCOL_AUDIO_WRITER_H_
 #define REMOTING_PROTOCOL_AUDIO_WRITER_H_
 
+#include <memory>
 #include <string>
 
 #include "base/callback.h"
 #include "base/compiler_specific.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "remoting/protocol/audio_stub.h"
 #include "remoting/protocol/channel_dispatcher_base.h"
 
@@ -29,18 +29,18 @@
  public:
   // Once AudioWriter is created, the Init() method of ChannelDispatcherBase
   // should be used to initialize it for the session.
-  static scoped_ptr<AudioWriter> Create(const SessionConfig& config);
+  static std::unique_ptr<AudioWriter> Create(const SessionConfig& config);
 
   ~AudioWriter() override;
 
   // AudioStub interface.
-  void ProcessAudioPacket(scoped_ptr<AudioPacket> packet,
+  void ProcessAudioPacket(std::unique_ptr<AudioPacket> packet,
                           const base::Closure& done) override;
 
  private:
   AudioWriter();
 
-  void OnIncomingMessage(scoped_ptr<CompoundBuffer> message) override;
+  void OnIncomingMessage(std::unique_ptr<CompoundBuffer> message) override;
 
   DISALLOW_COPY_AND_ASSIGN(AudioWriter);
 };
diff --git a/remoting/protocol/authenticator.cc b/remoting/protocol/authenticator.cc
index 03e176a..372bb1ae 100644
--- a/remoting/protocol/authenticator.cc
+++ b/remoting/protocol/authenticator.cc
@@ -4,6 +4,7 @@
 
 #include "remoting/protocol/authenticator.h"
 
+#include "base/memory/ptr_util.h"
 #include "remoting/base/constants.h"
 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h"
 
@@ -21,8 +22,9 @@
 }
 
 // static
-scoped_ptr<buzz::XmlElement> Authenticator::CreateEmptyAuthenticatorMessage() {
-  return make_scoped_ptr(new buzz::XmlElement(kAuthenticationQName));
+std::unique_ptr<buzz::XmlElement>
+Authenticator::CreateEmptyAuthenticatorMessage() {
+  return base::WrapUnique(new buzz::XmlElement(kAuthenticationQName));
 }
 
 // static
diff --git a/remoting/protocol/authenticator.h b/remoting/protocol/authenticator.h
index cc05dba..8678ddd 100644
--- a/remoting/protocol/authenticator.h
+++ b/remoting/protocol/authenticator.h
@@ -5,10 +5,10 @@
 #ifndef REMOTING_PROTOCOL_AUTHENTICATOR_H_
 #define REMOTING_PROTOCOL_AUTHENTICATOR_H_
 
+#include <memory>
 #include <string>
 
 #include "base/callback_forward.h"
-#include "base/memory/scoped_ptr.h"
 
 namespace buzz {
 class XmlElement;
@@ -71,7 +71,7 @@
   // Callback used for layered Authenticator implementations, particularly
   // third-party and pairing authenticators. They use this callback to create
   // base SPAKE2 authenticators.
-  typedef base::Callback<scoped_ptr<Authenticator>(
+  typedef base::Callback<std::unique_ptr<Authenticator>(
       const std::string& shared_secret,
       Authenticator::State initial_state)>
       CreateBaseAuthenticatorCallback;
@@ -80,7 +80,7 @@
   static bool IsAuthenticatorMessage(const buzz::XmlElement* message);
 
   // Creates an empty Authenticator message, owned by the caller.
-  static scoped_ptr<buzz::XmlElement> CreateEmptyAuthenticatorMessage();
+  static std::unique_ptr<buzz::XmlElement> CreateEmptyAuthenticatorMessage();
 
   // Finds Authenticator message among child elements of |message|, or
   // returns nullptr otherwise.
@@ -111,15 +111,15 @@
 
   // Must be called when in MESSAGE_READY state. Returns next
   // authentication message that needs to be sent to the peer.
-  virtual scoped_ptr<buzz::XmlElement> GetNextMessage() = 0;
+  virtual std::unique_ptr<buzz::XmlElement> GetNextMessage() = 0;
 
   // Returns the auth key received as result of the authentication handshake.
   virtual const std::string& GetAuthKey() const = 0;
 
   // Creates new authenticator for a channel. Can be called only in
   // the ACCEPTED state.
-  virtual scoped_ptr<ChannelAuthenticator>
-      CreateChannelAuthenticator() const = 0;
+  virtual std::unique_ptr<ChannelAuthenticator> CreateChannelAuthenticator()
+      const = 0;
 };
 
 // Factory for Authenticator instances.
@@ -136,7 +136,7 @@
   // if the |first_message| is invalid and the session should be
   // rejected. ProcessMessage() should be called with |first_message|
   // for the result of this method.
-  virtual scoped_ptr<Authenticator> CreateAuthenticator(
+  virtual std::unique_ptr<Authenticator> CreateAuthenticator(
       const std::string& local_jid,
       const std::string& remote_jid) = 0;
 };
diff --git a/remoting/protocol/authenticator_test_base.cc b/remoting/protocol/authenticator_test_base.cc
index 072b6211..d1ad881 100644
--- a/remoting/protocol/authenticator_test_base.cc
+++ b/remoting/protocol/authenticator_test_base.cc
@@ -84,7 +84,7 @@
                                                      Authenticator* receiver,
                                                      bool sender_started,
                                                      bool receiver_started) {
-  scoped_ptr<buzz::XmlElement> message;
+  std::unique_ptr<buzz::XmlElement> message;
   ASSERT_NE(Authenticator::WAITING_MESSAGE, sender->state());
   if (sender->state() == Authenticator::ACCEPTED ||
       sender->state() == Authenticator::REJECTED) {
@@ -161,14 +161,14 @@
 
 void AuthenticatorTestBase::OnHostConnected(
     int error,
-    scoped_ptr<P2PStreamSocket> socket) {
+    std::unique_ptr<P2PStreamSocket> socket) {
   host_callback_.OnDone(error);
   host_socket_ = std::move(socket);
 }
 
 void AuthenticatorTestBase::OnClientConnected(
     int error,
-    scoped_ptr<P2PStreamSocket> socket) {
+    std::unique_ptr<P2PStreamSocket> socket) {
   client_callback_.OnDone(error);
   client_socket_ = std::move(socket);
 }
diff --git a/remoting/protocol/authenticator_test_base.h b/remoting/protocol/authenticator_test_base.h
index e9154234..16b4a14b 100644
--- a/remoting/protocol/authenticator_test_base.h
+++ b/remoting/protocol/authenticator_test_base.h
@@ -5,11 +5,11 @@
 #ifndef REMOTING_PROTOCOL_AUTHENTICATOR_TEST_BASE_H_
 #define REMOTING_PROTOCOL_AUTHENTICATOR_TEST_BASE_H_
 
+#include <memory>
 #include <string>
 
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/message_loop/message_loop.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
@@ -47,26 +47,24 @@
   void RunHostInitiatedAuthExchange();
   void RunChannelAuth(bool expected_fail);
 
-  void OnHostConnected(int error,
-                       scoped_ptr<P2PStreamSocket> socket);
-  void OnClientConnected(int error,
-                         scoped_ptr<P2PStreamSocket> socket);
+  void OnHostConnected(int error, std::unique_ptr<P2PStreamSocket> socket);
+  void OnClientConnected(int error, std::unique_ptr<P2PStreamSocket> socket);
 
   base::MessageLoop message_loop_;
 
   scoped_refptr<RsaKeyPair> key_pair_;
   std::string host_public_key_;
   std::string host_cert_;
-  scoped_ptr<Authenticator> host_;
-  scoped_ptr<Authenticator> client_;
-  scoped_ptr<FakeStreamSocket> client_fake_socket_;
-  scoped_ptr<FakeStreamSocket> host_fake_socket_;
-  scoped_ptr<ChannelAuthenticator> client_auth_;
-  scoped_ptr<ChannelAuthenticator> host_auth_;
+  std::unique_ptr<Authenticator> host_;
+  std::unique_ptr<Authenticator> client_;
+  std::unique_ptr<FakeStreamSocket> client_fake_socket_;
+  std::unique_ptr<FakeStreamSocket> host_fake_socket_;
+  std::unique_ptr<ChannelAuthenticator> client_auth_;
+  std::unique_ptr<ChannelAuthenticator> host_auth_;
   MockChannelDoneCallback client_callback_;
   MockChannelDoneCallback host_callback_;
-  scoped_ptr<P2PStreamSocket> client_socket_;
-  scoped_ptr<P2PStreamSocket> host_socket_;
+  std::unique_ptr<P2PStreamSocket> client_socket_;
+  std::unique_ptr<P2PStreamSocket> host_socket_;
 
   DISALLOW_COPY_AND_ASSIGN(AuthenticatorTestBase);
 };
diff --git a/remoting/protocol/capture_scheduler.cc b/remoting/protocol/capture_scheduler.cc
index ab913d60..963d9ee 100644
--- a/remoting/protocol/capture_scheduler.cc
+++ b/remoting/protocol/capture_scheduler.cc
@@ -117,7 +117,7 @@
   ScheduleNextCapture();
 }
 
-void CaptureScheduler::ProcessVideoAck(scoped_ptr<VideoAck> video_ack) {
+void CaptureScheduler::ProcessVideoAck(std::unique_ptr<VideoAck> video_ack) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
   --num_unacknowledged_frames_;
@@ -127,11 +127,11 @@
 }
 
 void CaptureScheduler::SetTickClockForTest(
-    scoped_ptr<base::TickClock> tick_clock) {
+    std::unique_ptr<base::TickClock> tick_clock) {
   tick_clock_ = std::move(tick_clock);
 }
 
-void CaptureScheduler::SetTimerForTest(scoped_ptr<base::Timer> timer) {
+void CaptureScheduler::SetTimerForTest(std::unique_ptr<base::Timer> timer) {
   capture_timer_ = std::move(timer);
 }
 
diff --git a/remoting/protocol/capture_scheduler.h b/remoting/protocol/capture_scheduler.h
index 3f4369ae..a2228f6 100644
--- a/remoting/protocol/capture_scheduler.h
+++ b/remoting/protocol/capture_scheduler.h
@@ -54,7 +54,7 @@
   void OnFrameSent();
 
   // VideoFeedbackStub interface.
-  void ProcessVideoAck(scoped_ptr<VideoAck> video_ack) override;
+  void ProcessVideoAck(std::unique_ptr<VideoAck> video_ack) override;
 
   // Sets minimum interval between frames.
   void set_minimum_interval(base::TimeDelta minimum_interval) {
@@ -62,8 +62,8 @@
   }
 
   // Helper functions for tests.
-  void SetTickClockForTest(scoped_ptr<base::TickClock> tick_clock);
-  void SetTimerForTest(scoped_ptr<base::Timer> timer);
+  void SetTickClockForTest(std::unique_ptr<base::TickClock> tick_clock);
+  void SetTimerForTest(std::unique_ptr<base::Timer> timer);
   void SetNumOfProcessorsForTest(int num_of_processors);
 
  private:
@@ -78,10 +78,10 @@
 
   base::Closure capture_closure_;
 
-  scoped_ptr<base::TickClock> tick_clock_;
+  std::unique_ptr<base::TickClock> tick_clock_;
 
   // Timer used to schedule CaptureNextFrame().
-  scoped_ptr<base::Timer> capture_timer_;
+  std::unique_ptr<base::Timer> capture_timer_;
 
   // Minimum interval between frames that determines maximum possible framerate.
   base::TimeDelta minimum_interval_;
diff --git a/remoting/protocol/capture_scheduler_unittest.cc b/remoting/protocol/capture_scheduler_unittest.cc
index fe752d2..4a6aef4 100644
--- a/remoting/protocol/capture_scheduler_unittest.cc
+++ b/remoting/protocol/capture_scheduler_unittest.cc
@@ -9,6 +9,7 @@
 #include <utility>
 
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/message_loop/message_loop.h"
 #include "base/test/simple_test_tick_clock.h"
 #include "base/timer/mock_timer.h"
@@ -31,9 +32,9 @@
     scheduler_->set_minimum_interval(
         base::TimeDelta::FromMilliseconds(kMinumumFrameIntervalMs));
     tick_clock_ = new base::SimpleTestTickClock();
-    scheduler_->SetTickClockForTest(make_scoped_ptr(tick_clock_));
+    scheduler_->SetTickClockForTest(base::WrapUnique(tick_clock_));
     capture_timer_ = new base::MockTimer(false, false);
-    scheduler_->SetTimerForTest(make_scoped_ptr(capture_timer_));
+    scheduler_->SetTimerForTest(base::WrapUnique(capture_timer_));
     scheduler_->Start();
   }
 
@@ -61,7 +62,7 @@
 
     scheduler_->OnFrameSent();
 
-    scoped_ptr<VideoAck> ack(new VideoAck());
+    std::unique_ptr<VideoAck> ack(new VideoAck());
     ack->set_frame_id(packet.frame_id());
     scheduler_->ProcessVideoAck(std::move(ack));
 
@@ -74,7 +75,7 @@
  protected:
   base::MessageLoop message_loop_;
 
-  scoped_ptr<CaptureScheduler> scheduler_;
+  std::unique_ptr<CaptureScheduler> scheduler_;
 
   // Owned by |scheduler_|.
   base::SimpleTestTickClock* tick_clock_;
@@ -194,7 +195,7 @@
   // Next frame should be scheduled, once one of the queued frames is
   // acknowledged.
   EXPECT_FALSE(capture_timer_->IsRunning());
-  scheduler_->ProcessVideoAck(make_scoped_ptr(new VideoAck()));
+  scheduler_->ProcessVideoAck(base::WrapUnique(new VideoAck()));
   EXPECT_TRUE(capture_timer_->IsRunning());
 }
 
diff --git a/remoting/protocol/channel_authenticator.h b/remoting/protocol/channel_authenticator.h
index e29e7d8c..a6b1904e 100644
--- a/remoting/protocol/channel_authenticator.h
+++ b/remoting/protocol/channel_authenticator.h
@@ -20,7 +20,7 @@
 // should be used only once for one channel.
 class ChannelAuthenticator {
  public:
-  typedef base::Callback<void(int error, scoped_ptr<P2PStreamSocket>)>
+  typedef base::Callback<void(int error, std::unique_ptr<P2PStreamSocket>)>
       DoneCallback;
 
   virtual ~ChannelAuthenticator() {}
@@ -28,9 +28,8 @@
   // Start authentication of the given |socket|. |done_callback| is called when
   // authentication is finished. Callback may be invoked before this method
   // returns, and may delete the calling authenticator.
-  virtual void SecureAndAuthenticate(
-      scoped_ptr<P2PStreamSocket> socket,
-      const DoneCallback& done_callback) = 0;
+  virtual void SecureAndAuthenticate(std::unique_ptr<P2PStreamSocket> socket,
+                                     const DoneCallback& done_callback) = 0;
 };
 
 }  // namespace protocol
diff --git a/remoting/protocol/channel_dispatcher_base.cc b/remoting/protocol/channel_dispatcher_base.cc
index acb1fac..274c0d5 100644
--- a/remoting/protocol/channel_dispatcher_base.cc
+++ b/remoting/protocol/channel_dispatcher_base.cc
@@ -32,7 +32,7 @@
 }
 
 void ChannelDispatcherBase::OnChannelReady(
-    scoped_ptr<MessagePipe> message_pipe) {
+    std::unique_ptr<MessagePipe> message_pipe) {
   channel_factory_ = nullptr;
   message_pipe_ = std::move(message_pipe);
   message_pipe_->StartReceiving(base::Bind(
diff --git a/remoting/protocol/channel_dispatcher_base.h b/remoting/protocol/channel_dispatcher_base.h
index 0a1e29cf..1d97a61 100644
--- a/remoting/protocol/channel_dispatcher_base.h
+++ b/remoting/protocol/channel_dispatcher_base.h
@@ -5,11 +5,11 @@
 #ifndef REMOTING_PROTOCOL_CHANNEL_DISPATCHER_BASE_H_
 #define REMOTING_PROTOCOL_CHANNEL_DISPATCHER_BASE_H_
 
+#include <memory>
 #include <string>
 
 #include "base/callback.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "remoting/protocol/errors.h"
 
 namespace remoting {
@@ -58,17 +58,17 @@
   MessagePipe* message_pipe() { return message_pipe_.get(); }
 
   // Child classes must override this method to handle incoming messages.
-  virtual void OnIncomingMessage(scoped_ptr<CompoundBuffer> message) = 0;
+  virtual void OnIncomingMessage(std::unique_ptr<CompoundBuffer> message) = 0;
 
  private:
-  void OnChannelReady(scoped_ptr<MessagePipe> message_pipe);
+  void OnChannelReady(std::unique_ptr<MessagePipe> message_pipe);
   void OnPipeError(int error);
 
   std::string channel_name_;
   MessageChannelFactory* channel_factory_ = nullptr;
   EventHandler* event_handler_ = nullptr;
 
-  scoped_ptr<MessagePipe> message_pipe_;
+  std::unique_ptr<MessagePipe> message_pipe_;
 
   DISALLOW_COPY_AND_ASSIGN(ChannelDispatcherBase);
 };
diff --git a/remoting/protocol/channel_multiplexer.cc b/remoting/protocol/channel_multiplexer.cc
index 1ac07ffd..4ea4015 100644
--- a/remoting/protocol/channel_multiplexer.cc
+++ b/remoting/protocol/channel_multiplexer.cc
@@ -30,7 +30,7 @@
 
 class PendingPacket {
  public:
-  PendingPacket(scoped_ptr<MultiplexPacket> packet)
+  PendingPacket(std::unique_ptr<MultiplexPacket> packet)
       : packet(std::move(packet)) {}
   ~PendingPacket() {}
 
@@ -44,7 +44,7 @@
   }
 
  private:
-  scoped_ptr<MultiplexPacket> packet;
+  std::unique_ptr<MultiplexPacket> packet;
   size_t pos = 0U;
 
   DISALLOW_COPY_AND_ASSIGN(PendingPacket);
@@ -74,13 +74,13 @@
   void set_receive_id(int id) { receive_id_ = id; }
 
   // Called by ChannelMultiplexer.
-  scoped_ptr<P2PStreamSocket> CreateSocket();
-  void OnIncomingPacket(scoped_ptr<MultiplexPacket> packet);
+  std::unique_ptr<P2PStreamSocket> CreateSocket();
+  void OnIncomingPacket(std::unique_ptr<MultiplexPacket> packet);
   void OnBaseChannelError(int error);
 
   // Called by MuxSocket.
   void OnSocketDestroyed();
-  void DoWrite(scoped_ptr<MultiplexPacket> packet,
+  void DoWrite(std::unique_ptr<MultiplexPacket> packet,
                const base::Closure& done_task);
   int DoRead(const scoped_refptr<net::IOBuffer>& buffer, int buffer_len);
 
@@ -148,15 +148,16 @@
   STLDeleteElements(&pending_packets_);
 }
 
-scoped_ptr<P2PStreamSocket> ChannelMultiplexer::MuxChannel::CreateSocket() {
+std::unique_ptr<P2PStreamSocket>
+ChannelMultiplexer::MuxChannel::CreateSocket() {
   DCHECK(!socket_);  // Can't create more than one socket per channel.
-  scoped_ptr<MuxSocket> result(new MuxSocket(this));
+  std::unique_ptr<MuxSocket> result(new MuxSocket(this));
   socket_ = result.get();
   return std::move(result);
 }
 
 void ChannelMultiplexer::MuxChannel::OnIncomingPacket(
-    scoped_ptr<MultiplexPacket> packet) {
+    std::unique_ptr<MultiplexPacket> packet) {
   DCHECK_EQ(packet->channel_id(), receive_id_);
   if (packet->data().size() > 0) {
     pending_packets_.push_back(new PendingPacket(std::move(packet)));
@@ -178,7 +179,7 @@
 }
 
 void ChannelMultiplexer::MuxChannel::DoWrite(
-    scoped_ptr<MultiplexPacket> packet,
+    std::unique_ptr<MultiplexPacket> packet,
     const base::Closure& done_task) {
   packet->set_channel_id(send_id_);
   if (!id_sent_) {
@@ -246,7 +247,7 @@
   if (base_channel_error_ != net::OK)
     return base_channel_error_;
 
-  scoped_ptr<MultiplexPacket> packet(new MultiplexPacket());
+  std::unique_ptr<MultiplexPacket> packet(new MultiplexPacket());
   size_t size = std::min(kMaxPacketSize, buffer_len);
   packet->mutable_data()->assign(buffer->data(), size);
 
@@ -350,7 +351,7 @@
 }
 
 void ChannelMultiplexer::OnBaseChannelReady(
-    scoped_ptr<P2PStreamSocket> socket) {
+    std::unique_ptr<P2PStreamSocket> socket) {
   base_channel_factory_ = nullptr;
   base_channel_ = std::move(socket);
 
@@ -384,7 +385,7 @@
 
   PendingChannel c = pending_channels_.front();
   pending_channels_.erase(pending_channels_.begin());
-  scoped_ptr<P2PStreamSocket> socket;
+  std::unique_ptr<P2PStreamSocket> socket;
   if (base_channel_.get())
     socket = GetOrCreateChannel(c.name)->CreateSocket();
   c.callback.Run(std::move(socket));
@@ -422,8 +423,9 @@
     it->second->OnBaseChannelError(error);
 }
 
-void ChannelMultiplexer::OnIncomingPacket(scoped_ptr<CompoundBuffer> buffer) {
-  scoped_ptr<MultiplexPacket> packet =
+void ChannelMultiplexer::OnIncomingPacket(
+    std::unique_ptr<CompoundBuffer> buffer) {
+  std::unique_ptr<MultiplexPacket> packet =
       ParseMessage<MultiplexPacket>(buffer.get());
   if (!packet)
     return;
@@ -455,7 +457,7 @@
   channel->OnIncomingPacket(std::move(packet));
 }
 
-void ChannelMultiplexer::DoWrite(scoped_ptr<MultiplexPacket> packet,
+void ChannelMultiplexer::DoWrite(std::unique_ptr<MultiplexPacket> packet,
                                  const base::Closure& done_task) {
   writer_.Write(SerializeAndFrameMessage(*packet), done_task);
 }
diff --git a/remoting/protocol/channel_multiplexer.h b/remoting/protocol/channel_multiplexer.h
index 976561c0..b14767b6 100644
--- a/remoting/protocol/channel_multiplexer.h
+++ b/remoting/protocol/channel_multiplexer.h
@@ -36,7 +36,7 @@
   friend class MuxChannel;
 
   // Callback for |base_channel_| creation.
-  void OnBaseChannelReady(scoped_ptr<P2PStreamSocket> socket);
+  void OnBaseChannelReady(std::unique_ptr<P2PStreamSocket> socket);
 
   // Helper to create channels asynchronously.
   void DoCreatePendingChannels();
@@ -52,10 +52,10 @@
   void NotifyBaseChannelError(const std::string& name, int error);
 
   // Callback for |reader_;
-  void OnIncomingPacket(scoped_ptr<CompoundBuffer> buffer);
+  void OnIncomingPacket(std::unique_ptr<CompoundBuffer> buffer);
 
   // Called by MuxChannel.
-  void DoWrite(scoped_ptr<MultiplexPacket> packet,
+  void DoWrite(std::unique_ptr<MultiplexPacket> packet,
                const base::Closure& done_task);
 
   // Factory used to create |base_channel_|. Set to nullptr once creation is
@@ -66,7 +66,7 @@
   std::string base_channel_name_;
 
   // The channel over which to multiplex.
-  scoped_ptr<P2PStreamSocket> base_channel_;
+  std::unique_ptr<P2PStreamSocket> base_channel_;
 
   // List of requested channels while we are waiting for |base_channel_|.
   std::list<PendingChannel> pending_channels_;
diff --git a/remoting/protocol/channel_multiplexer_unittest.cc b/remoting/protocol/channel_multiplexer_unittest.cc
index 3f8729ea..5e2efac 100644
--- a/remoting/protocol/channel_multiplexer_unittest.cc
+++ b/remoting/protocol/channel_multiplexer_unittest.cc
@@ -48,7 +48,7 @@
 class MockConnectCallback {
  public:
   MOCK_METHOD1(OnConnectedPtr, void(P2PStreamSocket* socket));
-  void OnConnected(scoped_ptr<P2PStreamSocket> socket) {
+  void OnConnected(std::unique_ptr<P2PStreamSocket> socket) {
     OnConnectedPtr(socket.release());
   }
 };
@@ -86,8 +86,8 @@
   }
 
   void CreateChannel(const std::string& name,
-                     scoped_ptr<P2PStreamSocket>* host_socket,
-                     scoped_ptr<P2PStreamSocket>* client_socket) {
+                     std::unique_ptr<P2PStreamSocket>* host_socket,
+                     std::unique_ptr<P2PStreamSocket>* client_socket) {
     int counter = 2;
     host_mux_->CreateChannel(name, base::Bind(
         &ChannelMultiplexerTest::OnChannelConnected, base::Unretained(this),
@@ -102,10 +102,9 @@
     EXPECT_TRUE(client_socket->get());
   }
 
-  void OnChannelConnected(
-      scoped_ptr<P2PStreamSocket>* storage,
-      int* counter,
-      scoped_ptr<P2PStreamSocket> socket) {
+  void OnChannelConnected(std::unique_ptr<P2PStreamSocket>* storage,
+                          int* counter,
+                          std::unique_ptr<P2PStreamSocket> socket) {
     *storage = std::move(socket);
     --(*counter);
     EXPECT_GE(*counter, 0);
@@ -127,19 +126,19 @@
   FakeStreamChannelFactory host_channel_factory_;
   FakeStreamChannelFactory client_channel_factory_;
 
-  scoped_ptr<ChannelMultiplexer> host_mux_;
-  scoped_ptr<ChannelMultiplexer> client_mux_;
+  std::unique_ptr<ChannelMultiplexer> host_mux_;
+  std::unique_ptr<ChannelMultiplexer> client_mux_;
 
-  scoped_ptr<P2PStreamSocket> host_socket1_;
-  scoped_ptr<P2PStreamSocket> client_socket1_;
-  scoped_ptr<P2PStreamSocket> host_socket2_;
-  scoped_ptr<P2PStreamSocket> client_socket2_;
+  std::unique_ptr<P2PStreamSocket> host_socket1_;
+  std::unique_ptr<P2PStreamSocket> client_socket1_;
+  std::unique_ptr<P2PStreamSocket> host_socket2_;
+  std::unique_ptr<P2PStreamSocket> client_socket2_;
 };
 
 
 TEST_F(ChannelMultiplexerTest, OneChannel) {
-  scoped_ptr<P2PStreamSocket> host_socket;
-  scoped_ptr<P2PStreamSocket> client_socket;
+  std::unique_ptr<P2PStreamSocket> host_socket;
+  std::unique_ptr<P2PStreamSocket> client_socket;
   ASSERT_NO_FATAL_FAILURE(
       CreateChannel(kTestChannelName, &host_socket, &client_socket));
 
@@ -151,13 +150,13 @@
 }
 
 TEST_F(ChannelMultiplexerTest, TwoChannels) {
-  scoped_ptr<P2PStreamSocket> host_socket1_;
-  scoped_ptr<P2PStreamSocket> client_socket1_;
+  std::unique_ptr<P2PStreamSocket> host_socket1_;
+  std::unique_ptr<P2PStreamSocket> client_socket1_;
   ASSERT_NO_FATAL_FAILURE(
       CreateChannel(kTestChannelName, &host_socket1_, &client_socket1_));
 
-  scoped_ptr<P2PStreamSocket> host_socket2_;
-  scoped_ptr<P2PStreamSocket> client_socket2_;
+  std::unique_ptr<P2PStreamSocket> host_socket2_;
+  std::unique_ptr<P2PStreamSocket> client_socket2_;
   ASSERT_NO_FATAL_FAILURE(
       CreateChannel(kTestChannelName2, &host_socket2_, &client_socket2_));
 
@@ -176,23 +175,23 @@
 
 // Four channels, two in each direction
 TEST_F(ChannelMultiplexerTest, FourChannels) {
-  scoped_ptr<P2PStreamSocket> host_socket1_;
-  scoped_ptr<P2PStreamSocket> client_socket1_;
+  std::unique_ptr<P2PStreamSocket> host_socket1_;
+  std::unique_ptr<P2PStreamSocket> client_socket1_;
   ASSERT_NO_FATAL_FAILURE(
       CreateChannel(kTestChannelName, &host_socket1_, &client_socket1_));
 
-  scoped_ptr<P2PStreamSocket> host_socket2_;
-  scoped_ptr<P2PStreamSocket> client_socket2_;
+  std::unique_ptr<P2PStreamSocket> host_socket2_;
+  std::unique_ptr<P2PStreamSocket> client_socket2_;
   ASSERT_NO_FATAL_FAILURE(
       CreateChannel(kTestChannelName2, &host_socket2_, &client_socket2_));
 
-  scoped_ptr<P2PStreamSocket> host_socket3;
-  scoped_ptr<P2PStreamSocket> client_socket3;
+  std::unique_ptr<P2PStreamSocket> host_socket3;
+  std::unique_ptr<P2PStreamSocket> client_socket3;
   ASSERT_NO_FATAL_FAILURE(
       CreateChannel("test3", &host_socket3, &client_socket3));
 
-  scoped_ptr<P2PStreamSocket> host_socket4;
-  scoped_ptr<P2PStreamSocket> client_socket4;
+  std::unique_ptr<P2PStreamSocket> host_socket4;
+  std::unique_ptr<P2PStreamSocket> client_socket4;
   ASSERT_NO_FATAL_FAILURE(
       CreateChannel("ch4", &host_socket4, &client_socket4));
 
@@ -219,13 +218,13 @@
 }
 
 TEST_F(ChannelMultiplexerTest, WriteFailSync) {
-  scoped_ptr<P2PStreamSocket> host_socket1_;
-  scoped_ptr<P2PStreamSocket> client_socket1_;
+  std::unique_ptr<P2PStreamSocket> host_socket1_;
+  std::unique_ptr<P2PStreamSocket> client_socket1_;
   ASSERT_NO_FATAL_FAILURE(
       CreateChannel(kTestChannelName, &host_socket1_, &client_socket1_));
 
-  scoped_ptr<P2PStreamSocket> host_socket2_;
-  scoped_ptr<P2PStreamSocket> client_socket2_;
+  std::unique_ptr<P2PStreamSocket> host_socket2_;
+  std::unique_ptr<P2PStreamSocket> client_socket2_;
   ASSERT_NO_FATAL_FAILURE(
       CreateChannel(kTestChannelName2, &host_socket2_, &client_socket2_));
 
diff --git a/remoting/protocol/channel_socket_adapter_unittest.cc b/remoting/protocol/channel_socket_adapter_unittest.cc
index bb67eafa..5ddd559 100644
--- a/remoting/protocol/channel_socket_adapter_unittest.cc
+++ b/remoting/protocol/channel_socket_adapter_unittest.cc
@@ -7,8 +7,9 @@
 #include <stddef.h>
 #include <stdint.h>
 
+#include <memory>
+
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/message_loop/message_loop.h"
 #include "net/base/io_buffer.h"
 #include "net/base/net_errors.h"
@@ -58,7 +59,8 @@
 
   // This can't be a real mock method because gmock doesn't support move-only
   // return values.
-  virtual rtc::scoped_ptr<rtc::SSLCertificate> GetRemoteSSLCertificate() const {
+  virtual rtc::scoped_ptr<rtc::SSLCertificate> GetRemoteSSLCertificate()
+      const {
     EXPECT_TRUE(false);  // Never called.
     return nullptr;
   }
@@ -90,7 +92,7 @@
   }
 
   MockTransportChannel channel_;
-  scoped_ptr<TransportChannelSocketAdapter> target_;
+  std::unique_ptr<TransportChannelSocketAdapter> target_;
   net::CompletionCallback callback_;
   int callback_result_;
   base::MessageLoopForIO message_loop_;
diff --git a/remoting/protocol/chromium_port_allocator_factory.cc b/remoting/protocol/chromium_port_allocator_factory.cc
index 26e65bb..77361fb 100644
--- a/remoting/protocol/chromium_port_allocator_factory.cc
+++ b/remoting/protocol/chromium_port_allocator_factory.cc
@@ -4,6 +4,7 @@
 
 #include "remoting/protocol/chromium_port_allocator_factory.h"
 
+#include "base/memory/ptr_util.h"
 #include "remoting/protocol/chromium_socket_factory.h"
 #include "remoting/protocol/port_allocator.h"
 #include "remoting/protocol/transport_context.h"
@@ -14,12 +15,12 @@
 ChromiumPortAllocatorFactory::ChromiumPortAllocatorFactory() {}
 ChromiumPortAllocatorFactory::~ChromiumPortAllocatorFactory() {}
 
-scoped_ptr<cricket::PortAllocator>
+std::unique_ptr<cricket::PortAllocator>
 ChromiumPortAllocatorFactory::CreatePortAllocator(
     scoped_refptr<TransportContext> transport_context) {
-  return make_scoped_ptr(new PortAllocator(
-      make_scoped_ptr(new rtc::BasicNetworkManager()),
-      make_scoped_ptr(new ChromiumPacketSocketFactory()), transport_context));
+  return base::WrapUnique(new PortAllocator(
+      base::WrapUnique(new rtc::BasicNetworkManager()),
+      base::WrapUnique(new ChromiumPacketSocketFactory()), transport_context));
 }
 
 }  // namespace protocol
diff --git a/remoting/protocol/chromium_port_allocator_factory.h b/remoting/protocol/chromium_port_allocator_factory.h
index 3da8cca..8a1dd0b 100644
--- a/remoting/protocol/chromium_port_allocator_factory.h
+++ b/remoting/protocol/chromium_port_allocator_factory.h
@@ -5,11 +5,11 @@
 #ifndef REMOTING_PROTOCOL_CHROMIUM_PORT_ALLOCATOR_FACTORY_H_
 #define REMOTING_PROTOCOL_CHROMIUM_PORT_ALLOCATOR_FACTORY_H_
 
+#include <memory>
 #include <set>
 
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "remoting/protocol/port_allocator_factory.h"
 
 namespace remoting {
@@ -21,7 +21,7 @@
   ~ChromiumPortAllocatorFactory() override;
 
    // PortAllocatorFactory interface.
-  scoped_ptr<cricket::PortAllocator> CreatePortAllocator(
+  std::unique_ptr<cricket::PortAllocator> CreatePortAllocator(
       scoped_refptr<TransportContext> transport_context) override;
 
  private:
diff --git a/remoting/protocol/chromium_socket_factory.cc b/remoting/protocol/chromium_socket_factory.cc
index 22b59b4..e9bbd44 100644
--- a/remoting/protocol/chromium_socket_factory.cc
+++ b/remoting/protocol/chromium_socket_factory.cc
@@ -6,10 +6,11 @@
 
 #include <stddef.h>
 
+#include <memory>
+
 #include "base/bind.h"
 #include "base/logging.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/time/time.h"
 #include "jingle/glue/utils.h"
 #include "net/base/io_buffer.h"
@@ -81,7 +82,7 @@
   void OnReadCompleted(int result);
   void HandleReadResult(int result);
 
-  scoped_ptr<net::UDPServerSocket> socket_;
+  std::unique_ptr<net::UDPServerSocket> socket_;
 
   State state_;
   int error_;
@@ -375,7 +376,7 @@
     const rtc::SocketAddress& local_address,
     uint16_t min_port,
     uint16_t max_port) {
-  scoped_ptr<UdpPacketSocket> result(new UdpPacketSocket());
+  std::unique_ptr<UdpPacketSocket> result(new UdpPacketSocket());
   if (!result->Init(local_address, min_port, max_port))
     return nullptr;
   return result.release();
diff --git a/remoting/protocol/chromium_socket_factory_unittest.cc b/remoting/protocol/chromium_socket_factory_unittest.cc
index 8c59f826a..7f16eb7 100644
--- a/remoting/protocol/chromium_socket_factory_unittest.cc
+++ b/remoting/protocol/chromium_socket_factory_unittest.cc
@@ -7,7 +7,8 @@
 #include <stddef.h>
 #include <stdint.h>
 
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
 #include "testing/gmock/include/gmock/gmock.h"
@@ -64,17 +65,17 @@
   base::MessageLoopForIO message_loop_;
   base::RunLoop run_loop_;
 
-  scoped_ptr<rtc::PacketSocketFactory> socket_factory_;
-  scoped_ptr<rtc::AsyncPacketSocket> socket_;
+  std::unique_ptr<rtc::PacketSocketFactory> socket_factory_;
+  std::unique_ptr<rtc::AsyncPacketSocket> socket_;
 
   std::string last_packet_;
   rtc::SocketAddress last_address_;
 };
 
 TEST_F(ChromiumSocketFactoryTest, SendAndReceive) {
-  scoped_ptr<rtc::AsyncPacketSocket> sending_socket(
-      socket_factory_->CreateUdpSocket(
-          rtc::SocketAddress("127.0.0.1", 0), 0, 0));
+  std::unique_ptr<rtc::AsyncPacketSocket> sending_socket(
+      socket_factory_->CreateUdpSocket(rtc::SocketAddress("127.0.0.1", 0), 0,
+                                       0));
   ASSERT_TRUE(sending_socket.get() != nullptr);
   EXPECT_EQ(sending_socket->GetState(),
             rtc::AsyncPacketSocket::STATE_BOUND);
@@ -99,9 +100,9 @@
 }
 
 TEST_F(ChromiumSocketFactoryTest, TransientError) {
-  scoped_ptr<rtc::AsyncPacketSocket> sending_socket(
-      socket_factory_->CreateUdpSocket(
-          rtc::SocketAddress("127.0.0.1", 0), 0, 0));
+  std::unique_ptr<rtc::AsyncPacketSocket> sending_socket(
+      socket_factory_->CreateUdpSocket(rtc::SocketAddress("127.0.0.1", 0), 0,
+                                       0));
   std::string test_packet("TEST");
 
   // Try sending a packet to an IPv6 address from a socket that's bound to an
diff --git a/remoting/protocol/client_control_dispatcher.cc b/remoting/protocol/client_control_dispatcher.cc
index 78f836d9..a9d481c 100644
--- a/remoting/protocol/client_control_dispatcher.cc
+++ b/remoting/protocol/client_control_dispatcher.cc
@@ -112,11 +112,11 @@
 }
 
 void ClientControlDispatcher::OnIncomingMessage(
-    scoped_ptr<CompoundBuffer> buffer) {
+    std::unique_ptr<CompoundBuffer> buffer) {
   DCHECK(client_stub_);
   DCHECK(clipboard_stub_);
 
-  scoped_ptr<ControlMessage> message =
+  std::unique_ptr<ControlMessage> message =
       ParseMessage<ControlMessage>(buffer.get());
   if (!message)
     return;
diff --git a/remoting/protocol/client_control_dispatcher.h b/remoting/protocol/client_control_dispatcher.h
index c646fe5..93b889c 100644
--- a/remoting/protocol/client_control_dispatcher.h
+++ b/remoting/protocol/client_control_dispatcher.h
@@ -51,7 +51,7 @@
   }
 
  private:
-  void OnIncomingMessage(scoped_ptr<CompoundBuffer> message) override;
+  void OnIncomingMessage(std::unique_ptr<CompoundBuffer> message) override;
 
   ClientStub* client_stub_ = nullptr;
   ClipboardStub* clipboard_stub_ = nullptr;
diff --git a/remoting/protocol/client_event_dispatcher.cc b/remoting/protocol/client_event_dispatcher.cc
index 90d23048..11a7d94 100644
--- a/remoting/protocol/client_event_dispatcher.cc
+++ b/remoting/protocol/client_event_dispatcher.cc
@@ -51,7 +51,7 @@
 }
 
 void ClientEventDispatcher::OnIncomingMessage(
-    scoped_ptr<CompoundBuffer> message) {
+    std::unique_ptr<CompoundBuffer> message) {
   LOG(ERROR) << "Received unexpected message on the event channel.";
 }
 
diff --git a/remoting/protocol/client_event_dispatcher.h b/remoting/protocol/client_event_dispatcher.h
index 98d4473..577e12d 100644
--- a/remoting/protocol/client_event_dispatcher.h
+++ b/remoting/protocol/client_event_dispatcher.h
@@ -27,7 +27,7 @@
   void InjectTouchEvent(const TouchEvent& event) override;
 
  private:
-  void OnIncomingMessage(scoped_ptr<CompoundBuffer> message) override;
+  void OnIncomingMessage(std::unique_ptr<CompoundBuffer> message) override;
 
   DISALLOW_COPY_AND_ASSIGN(ClientEventDispatcher);
 };
diff --git a/remoting/protocol/client_video_dispatcher.cc b/remoting/protocol/client_video_dispatcher.cc
index 70fd857..95e8788 100644
--- a/remoting/protocol/client_video_dispatcher.cc
+++ b/remoting/protocol/client_video_dispatcher.cc
@@ -39,8 +39,8 @@
 ClientVideoDispatcher::~ClientVideoDispatcher() {}
 
 void ClientVideoDispatcher::OnIncomingMessage(
-    scoped_ptr<CompoundBuffer> message) {
-  scoped_ptr<VideoPacket> video_packet =
+    std::unique_ptr<CompoundBuffer> message) {
+  std::unique_ptr<VideoPacket> video_packet =
       ParseMessage<VideoPacket>(message.get());
   if (!video_packet)
     return;
diff --git a/remoting/protocol/client_video_dispatcher.h b/remoting/protocol/client_video_dispatcher.h
index 717500d..b9d70c1 100644
--- a/remoting/protocol/client_video_dispatcher.h
+++ b/remoting/protocol/client_video_dispatcher.h
@@ -29,7 +29,7 @@
   struct PendingFrame;
   typedef std::list<PendingFrame> PendingFramesList;
 
-  void OnIncomingMessage(scoped_ptr<CompoundBuffer> message) override;
+  void OnIncomingMessage(std::unique_ptr<CompoundBuffer> message) override;
 
   // Callback for VideoStub::ProcessVideoPacket().
   void OnPacketDone(PendingFramesList::iterator pending_frame);
diff --git a/remoting/protocol/client_video_dispatcher_unittest.cc b/remoting/protocol/client_video_dispatcher_unittest.cc
index 067049da..f847ef9 100644
--- a/remoting/protocol/client_video_dispatcher_unittest.cc
+++ b/remoting/protocol/client_video_dispatcher_unittest.cc
@@ -29,7 +29,7 @@
   ClientVideoDispatcherTest();
 
   // VideoStub interface.
-  void ProcessVideoPacket(scoped_ptr<VideoPacket> video_packet,
+  void ProcessVideoPacket(std::unique_ptr<VideoPacket> video_packet,
                           const base::Closure& done) override;
 
   // ChannelDispatcherBase::EventHandler interface.
@@ -38,7 +38,7 @@
  protected:
   void OnChannelError(int error);
 
-  void OnMessageReceived(scoped_ptr<CompoundBuffer> buffer);
+  void OnMessageReceived(std::unique_ptr<CompoundBuffer> buffer);
   void OnReadError(int error);
 
   base::MessageLoop message_loop_;
@@ -85,7 +85,7 @@
 }
 
 void ClientVideoDispatcherTest::ProcessVideoPacket(
-    scoped_ptr<VideoPacket> video_packet,
+    std::unique_ptr<VideoPacket> video_packet,
     const base::Closure& done) {
   video_packets_.push_back(video_packet.release());
   packet_done_callbacks_.push_back(done);
@@ -102,8 +102,8 @@
 }
 
 void ClientVideoDispatcherTest::OnMessageReceived(
-    scoped_ptr<CompoundBuffer> buffer) {
-  scoped_ptr<VideoAck> ack = ParseMessage<VideoAck>(buffer.get());
+    std::unique_ptr<CompoundBuffer> buffer) {
+  std::unique_ptr<VideoAck> ack = ParseMessage<VideoAck>(buffer.get());
   EXPECT_TRUE(ack);
   ack_messages_.push_back(ack.release());
 }
diff --git a/remoting/protocol/connection_tester.cc b/remoting/protocol/connection_tester.cc
index 2ef40288..89389b0 100644
--- a/remoting/protocol/connection_tester.cc
+++ b/remoting/protocol/connection_tester.cc
@@ -276,7 +276,7 @@
       &MessagePipeConnectionTester::OnMessageReceived, base::Unretained(this)));
 
   for (int i = 0; i < message_count_; ++i) {
-    scoped_ptr<VideoPacket> message(new VideoPacket());
+    std::unique_ptr<VideoPacket> message(new VideoPacket());
     message->mutable_data()->resize(message_size_);
     for (int p = 0; p < message_size_; ++p) {
       message->mutable_data()[0] = static_cast<char>(i + p);
@@ -294,7 +294,7 @@
 }
 
 void MessagePipeConnectionTester::OnMessageReceived(
-    scoped_ptr<CompoundBuffer> message) {
+    std::unique_ptr<CompoundBuffer> message) {
   received_messages_.push_back(ParseMessage<VideoPacket>(message.get()));
   if (received_messages_.size() >= sent_messages_.size()) {
     run_loop_.Quit();
diff --git a/remoting/protocol/connection_tester.h b/remoting/protocol/connection_tester.h
index 59ce49e..4fbf3389 100644
--- a/remoting/protocol/connection_tester.h
+++ b/remoting/protocol/connection_tester.h
@@ -6,10 +6,10 @@
 #define REMOTING_PROTOCOL_CONNECTION_TESTER_H_
 
 #include <list>
+#include <memory>
 #include <vector>
 
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/run_loop.h"
 
 namespace base {
@@ -123,7 +123,7 @@
   void RunAndCheckResults();
 
  protected:
-  void OnMessageReceived(scoped_ptr<CompoundBuffer> message);
+  void OnMessageReceived(std::unique_ptr<CompoundBuffer> message);
 
  private:
   base::RunLoop run_loop_;
@@ -132,8 +132,8 @@
   int message_size_;
   int message_count_;
 
-  std::vector<scoped_ptr<VideoPacket>> sent_messages_;
-  std::vector<scoped_ptr<VideoPacket>> received_messages_;
+  std::vector<std::unique_ptr<VideoPacket>> sent_messages_;
+  std::vector<std::unique_ptr<VideoPacket>> received_messages_;
 };
 
 }  // namespace protocol
diff --git a/remoting/protocol/connection_to_client.h b/remoting/protocol/connection_to_client.h
index 09ac21b..acb48b5 100644
--- a/remoting/protocol/connection_to_client.h
+++ b/remoting/protocol/connection_to_client.h
@@ -84,8 +84,8 @@
 
   // Start video stream that sends screen content from |desktop_capturer| to the
   // client.
-  virtual scoped_ptr<VideoStream> StartVideoStream(
-      scoped_ptr<webrtc::DesktopCapturer> desktop_capturer) = 0;
+  virtual std::unique_ptr<VideoStream> StartVideoStream(
+      std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer) = 0;
 
   // Get the stubs used by the host to transmit messages to the client.
   // The stubs must not be accessed before OnConnectionAuthenticated(), or
diff --git a/remoting/protocol/connection_to_host.h b/remoting/protocol/connection_to_host.h
index 575f1da..4a8d537b 100644
--- a/remoting/protocol/connection_to_host.h
+++ b/remoting/protocol/connection_to_host.h
@@ -5,10 +5,10 @@
 #ifndef REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_
 #define REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_
 
+#include <memory>
 #include <string>
 
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "remoting/protocol/errors.h"
 
 namespace remoting {
@@ -77,7 +77,7 @@
   // Initiates a connection using |session|. |event_callback| will be notified
   // of changes in the state of the connection and must outlive the
   // ConnectionToHost. Caller must set stubs (see below) before calling Connect.
-  virtual void Connect(scoped_ptr<Session> session,
+  virtual void Connect(std::unique_ptr<Session> session,
                        scoped_refptr<TransportContext> transport_context,
                        HostEventCallback* event_callback) = 0;
 
diff --git a/remoting/protocol/connection_unittest.cc b/remoting/protocol/connection_unittest.cc
index 9f35abd..f2a5d8c 100644
--- a/remoting/protocol/connection_unittest.cc
+++ b/remoting/protocol/connection_unittest.cc
@@ -6,6 +6,7 @@
 
 #include "base/bind.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
 #include "remoting/base/constants.h"
@@ -71,7 +72,7 @@
   }
   void Capture(const webrtc::DesktopRegion& region) override {
     // Return black 10x10 frame.
-    scoped_ptr<webrtc::DesktopFrame> frame(
+    std::unique_ptr<webrtc::DesktopFrame> frame(
         new webrtc::BasicDesktopFrame(webrtc::DesktopSize(100, 100)));
     memset(frame->data(), 0, frame->stride() * frame->size().height());
     frame->mutable_updated_region()->SetRect(
@@ -102,13 +103,13 @@
     // Create Connection objects.
     if (is_using_webrtc()) {
       host_connection_.reset(new WebrtcConnectionToClient(
-          make_scoped_ptr(host_session_),
+          base::WrapUnique(host_session_),
           TransportContext::ForTests(protocol::TransportRole::SERVER)));
       client_connection_.reset(new WebrtcConnectionToHost());
 
     } else {
       host_connection_.reset(new IceConnectionToClient(
-          make_scoped_ptr(host_session_),
+          base::WrapUnique(host_session_),
           TransportContext::ForTests(protocol::TransportRole::SERVER),
           message_loop_.task_runner()));
       client_connection_.reset(new IceConnectionToHost());
@@ -187,13 +188,13 @@
   }
 
   base::MessageLoopForIO message_loop_;
-  scoped_ptr<base::RunLoop> run_loop_;
+  std::unique_ptr<base::RunLoop> run_loop_;
 
   MockConnectionToClientEventHandler host_event_handler_;
   MockClipboardStub host_clipboard_stub_;
   MockHostStub host_stub_;
   MockInputStub host_input_stub_;
-  scoped_ptr<ConnectionToClient> host_connection_;
+  std::unique_ptr<ConnectionToClient> host_connection_;
   FakeSession* host_session_;  // Owned by |host_connection_|.
   bool host_connected_ = false;
 
@@ -201,9 +202,9 @@
   MockClientStub client_stub_;
   MockClipboardStub client_clipboard_stub_;
   FakeVideoRenderer client_video_renderer_;
-  scoped_ptr<ConnectionToHost> client_connection_;
+  std::unique_ptr<ConnectionToHost> client_connection_;
   FakeSession* client_session_;  // Owned by |client_connection_|.
-  scoped_ptr<FakeSession> owned_client_session_;
+  std::unique_ptr<FakeSession> owned_client_session_;
   bool client_connected_ = false;
 
  private:
@@ -279,8 +280,9 @@
 TEST_P(ConnectionTest, Video) {
   Connect();
 
-  scoped_ptr<VideoStream> video_stream = host_connection_->StartVideoStream(
-      make_scoped_ptr(new TestScreenCapturer()));
+  std::unique_ptr<VideoStream> video_stream =
+      host_connection_->StartVideoStream(
+          base::WrapUnique(new TestScreenCapturer()));
 
   base::RunLoop run_loop;
 
diff --git a/remoting/protocol/content_description.cc b/remoting/protocol/content_description.cc
index e1c43c6..6ac678d 100644
--- a/remoting/protocol/content_description.cc
+++ b/remoting/protocol/content_description.cc
@@ -8,6 +8,7 @@
 
 #include "base/base64.h"
 #include "base/logging.h"
+#include "base/memory/ptr_util.h"
 #include "base/strings/string_number_conversions.h"
 #include "remoting/base/constants.h"
 #include "remoting/protocol/authenticator.h"
@@ -115,11 +116,10 @@
 }  // namespace
 
 ContentDescription::ContentDescription(
-    scoped_ptr<CandidateSessionConfig> config,
-    scoped_ptr<buzz::XmlElement> authenticator_message)
+    std::unique_ptr<CandidateSessionConfig> config,
+    std::unique_ptr<buzz::XmlElement> authenticator_message)
     : candidate_config_(std::move(config)),
-      authenticator_message_(std::move(authenticator_message)) {
-}
+      authenticator_message_(std::move(authenticator_message)) {}
 
 ContentDescription::~ContentDescription() { }
 
@@ -200,14 +200,14 @@
 }
 
 // static
-scoped_ptr<ContentDescription> ContentDescription::ParseXml(
+std::unique_ptr<ContentDescription> ContentDescription::ParseXml(
     const XmlElement* element,
     bool webrtc_transport) {
   if (element->Name() != QName(kChromotingXmlNamespace, kDescriptionTag)) {
     LOG(ERROR) << "Invalid description: " << element->Str();
     return nullptr;
   }
-  scoped_ptr<CandidateSessionConfig> config(
+  std::unique_ptr<CandidateSessionConfig> config(
       CandidateSessionConfig::CreateEmpty());
 
   config->set_webrtc_supported(webrtc_transport);
@@ -232,12 +232,12 @@
     config->set_vp9_experiment_enabled(true);
   }
 
-  scoped_ptr<XmlElement> authenticator_message;
+  std::unique_ptr<XmlElement> authenticator_message;
   const XmlElement* child = Authenticator::FindAuthenticatorMessage(element);
   if (child)
     authenticator_message.reset(new XmlElement(*child));
 
-  return make_scoped_ptr(new ContentDescription(
+  return base::WrapUnique(new ContentDescription(
       std::move(config), std::move(authenticator_message)));
 }
 
diff --git a/remoting/protocol/content_description.h b/remoting/protocol/content_description.h
index 048fe88..84949c72 100644
--- a/remoting/protocol/content_description.h
+++ b/remoting/protocol/content_description.h
@@ -5,10 +5,10 @@
 #ifndef REMOTING_PROTOCOL_CONTENT_DESCRIPTION_H_
 #define REMOTING_PROTOCOL_CONTENT_DESCRIPTION_H_
 
+#include <memory>
 #include <string>
 
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "remoting/protocol/session_config.h"
 
 namespace buzz {
@@ -27,8 +27,8 @@
  public:
   static const char kChromotingContentName[];
 
-  ContentDescription(scoped_ptr<CandidateSessionConfig> config,
-                     scoped_ptr<buzz::XmlElement> authenticator_message);
+  ContentDescription(std::unique_ptr<CandidateSessionConfig> config,
+                     std::unique_ptr<buzz::XmlElement> authenticator_message);
   ~ContentDescription();
 
   const CandidateSessionConfig* config() const {
@@ -41,13 +41,13 @@
 
   buzz::XmlElement* ToXml() const;
 
-  static scoped_ptr<ContentDescription> ParseXml(
+  static std::unique_ptr<ContentDescription> ParseXml(
       const buzz::XmlElement* element,
       bool webrtc_transport);
 
  private:
-  scoped_ptr<const CandidateSessionConfig> candidate_config_;
-  scoped_ptr<const buzz::XmlElement> authenticator_message_;
+  std::unique_ptr<const CandidateSessionConfig> candidate_config_;
+  std::unique_ptr<const buzz::XmlElement> authenticator_message_;
 
   static bool ParseChannelConfigs(const buzz::XmlElement* const element,
                                   const char tag_name[],
diff --git a/remoting/protocol/content_description_unittest.cc b/remoting/protocol/content_description_unittest.cc
index 3fa8a906..ca0eb56 100644
--- a/remoting/protocol/content_description_unittest.cc
+++ b/remoting/protocol/content_description_unittest.cc
@@ -17,13 +17,13 @@
 namespace protocol {
 
 TEST(ContentDescriptionTest, FormatAndParse) {
-  scoped_ptr<CandidateSessionConfig> config =
+  std::unique_ptr<CandidateSessionConfig> config =
       CandidateSessionConfig::CreateDefault();
   ContentDescription description(
       std::move(config), Authenticator::CreateEmptyAuthenticatorMessage());
-  scoped_ptr<buzz::XmlElement> xml(description.ToXml());
+  std::unique_ptr<buzz::XmlElement> xml(description.ToXml());
   LOG(ERROR) << xml->Str();
-  scoped_ptr<ContentDescription> parsed(
+  std::unique_ptr<ContentDescription> parsed(
       ContentDescription::ParseXml(xml.get(), false));
   ASSERT_TRUE(parsed.get());
   EXPECT_TRUE(description.config()->control_configs() ==
@@ -48,8 +48,9 @@
       "  <video transport=\"stream\" version=\"2\" codec=\"vp8\"/>"
       "  <authentication/>"
       "</description>";
-  scoped_ptr<buzz::XmlElement> xml(buzz::XmlElement::ForStr(kTestDescription));
-  scoped_ptr<ContentDescription> parsed(
+  std::unique_ptr<buzz::XmlElement> xml(
+      buzz::XmlElement::ForStr(kTestDescription));
+  std::unique_ptr<ContentDescription> parsed(
       ContentDescription::ParseXml(xml.get(), false));
   ASSERT_TRUE(parsed.get());
   EXPECT_EQ(1U, parsed->config()->event_configs().size());
@@ -72,8 +73,9 @@
       "  <audio transport=\"none\"/>"
       "  <authentication/>"
       "</description>";
-  scoped_ptr<buzz::XmlElement> xml(buzz::XmlElement::ForStr(kTestDescription));
-  scoped_ptr<ContentDescription> parsed(
+  std::unique_ptr<buzz::XmlElement> xml(
+      buzz::XmlElement::ForStr(kTestDescription));
+  std::unique_ptr<ContentDescription> parsed(
       ContentDescription::ParseXml(xml.get(), false));
   ASSERT_TRUE(parsed.get());
   EXPECT_EQ(1U, parsed->config()->audio_configs().size());
@@ -93,8 +95,9 @@
       "  <audio transport=\"none\" version=\"2\" codec=\"verbatim\"/>"
       "  <authentication/>"
       "</description>";
-  scoped_ptr<buzz::XmlElement> xml(buzz::XmlElement::ForStr(kTestDescription));
-  scoped_ptr<ContentDescription> parsed(
+  std::unique_ptr<buzz::XmlElement> xml(
+      buzz::XmlElement::ForStr(kTestDescription));
+  std::unique_ptr<ContentDescription> parsed(
       ContentDescription::ParseXml(xml.get(), false));
   ASSERT_TRUE(parsed.get());
   EXPECT_EQ(1U, parsed->config()->audio_configs().size());
diff --git a/remoting/protocol/datagram_channel_factory.h b/remoting/protocol/datagram_channel_factory.h
index 2e19fc2..d82960a 100644
--- a/remoting/protocol/datagram_channel_factory.h
+++ b/remoting/protocol/datagram_channel_factory.h
@@ -5,11 +5,11 @@
 #ifndef REMOTING_PROTOCOL_DATAGRAM_CHANNEL_FACTORY_H_
 #define REMOTING_PROTOCOL_DATAGRAM_CHANNEL_FACTORY_H_
 
+#include <memory>
 #include <string>
 
 #include "base/callback_forward.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 
 namespace remoting {
 namespace protocol {
@@ -18,7 +18,7 @@
 
 class DatagramChannelFactory {
  public:
-  typedef base::Callback<void(scoped_ptr<P2PDatagramSocket>)>
+  typedef base::Callback<void(std::unique_ptr<P2PDatagramSocket>)>
       ChannelCreatedCallback;
 
   DatagramChannelFactory() {}
diff --git a/remoting/protocol/fake_authenticator.cc b/remoting/protocol/fake_authenticator.cc
index 93f443c0..e05e05b 100644
--- a/remoting/protocol/fake_authenticator.cc
+++ b/remoting/protocol/fake_authenticator.cc
@@ -8,6 +8,7 @@
 
 #include "base/base64.h"
 #include "base/callback_helpers.h"
+#include "base/memory/ptr_util.h"
 #include "base/message_loop/message_loop.h"
 #include "base/rand_util.h"
 #include "base/strings/string_number_conversions.h"
@@ -29,7 +30,7 @@
 FakeChannelAuthenticator::~FakeChannelAuthenticator() {}
 
 void FakeChannelAuthenticator::SecureAndAuthenticate(
-    scoped_ptr<P2PStreamSocket> socket,
+    std::unique_ptr<P2PStreamSocket> socket,
     const DoneCallback& done_callback) {
   socket_ = std::move(socket);
 
@@ -154,10 +155,10 @@
   resume_callback.Run();
 }
 
-scoped_ptr<buzz::XmlElement> FakeAuthenticator::GetNextMessage() {
+std::unique_ptr<buzz::XmlElement> FakeAuthenticator::GetNextMessage() {
   EXPECT_EQ(MESSAGE_READY, state());
 
-  scoped_ptr<buzz::XmlElement> result(new buzz::XmlElement(
+  std::unique_ptr<buzz::XmlElement> result(new buzz::XmlElement(
       buzz::QName(kChromotingXmlNamespace, "authentication")));
   buzz::XmlElement* id = new buzz::XmlElement(
       buzz::QName(kChromotingXmlNamespace, "id"));
@@ -185,10 +186,10 @@
   return auth_key_;
 }
 
-scoped_ptr<ChannelAuthenticator>
+std::unique_ptr<ChannelAuthenticator>
 FakeAuthenticator::CreateChannelAuthenticator() const {
   EXPECT_EQ(ACCEPTED, state());
-  return make_scoped_ptr(
+  return base::WrapUnique(
       new FakeChannelAuthenticator(action_ != REJECT_CHANNEL, async_));
 }
 
@@ -203,10 +204,11 @@
       async_(async) {}
 FakeHostAuthenticatorFactory::~FakeHostAuthenticatorFactory() {}
 
-scoped_ptr<Authenticator> FakeHostAuthenticatorFactory::CreateAuthenticator(
+std::unique_ptr<Authenticator>
+FakeHostAuthenticatorFactory::CreateAuthenticator(
     const std::string& local_jid,
     const std::string& remote_jid) {
-  scoped_ptr<FakeAuthenticator> authenticator(new FakeAuthenticator(
+  std::unique_ptr<FakeAuthenticator> authenticator(new FakeAuthenticator(
       FakeAuthenticator::HOST, round_trips_, action_, async_));
   authenticator->set_messages_till_started(messages_till_started_);
   return std::move(authenticator);
diff --git a/remoting/protocol/fake_authenticator.h b/remoting/protocol/fake_authenticator.h
index 4928d91..b17630c3 100644
--- a/remoting/protocol/fake_authenticator.h
+++ b/remoting/protocol/fake_authenticator.h
@@ -20,7 +20,7 @@
   ~FakeChannelAuthenticator() override;
 
   // ChannelAuthenticator interface.
-  void SecureAndAuthenticate(scoped_ptr<P2PStreamSocket> socket,
+  void SecureAndAuthenticate(std::unique_ptr<P2PStreamSocket> socket,
                              const DoneCallback& done_callback) override;
 
  private:
@@ -32,7 +32,7 @@
   const int result_;
   const bool async_;
 
-  scoped_ptr<P2PStreamSocket> socket_;
+  std::unique_ptr<P2PStreamSocket> socket_;
   DoneCallback done_callback_;
 
   bool did_read_bytes_ = false;
@@ -74,9 +74,10 @@
   RejectionReason rejection_reason() const override;
   void ProcessMessage(const buzz::XmlElement* message,
                       const base::Closure& resume_callback) override;
-  scoped_ptr<buzz::XmlElement> GetNextMessage() override;
+  std::unique_ptr<buzz::XmlElement> GetNextMessage() override;
   const std::string& GetAuthKey() const override;
-  scoped_ptr<ChannelAuthenticator> CreateChannelAuthenticator() const override;
+  std::unique_ptr<ChannelAuthenticator> CreateChannelAuthenticator()
+      const override;
 
  protected:
   const Type type_;
@@ -103,7 +104,7 @@
   ~FakeHostAuthenticatorFactory() override;
 
   // AuthenticatorFactory interface.
-  scoped_ptr<Authenticator> CreateAuthenticator(
+  std::unique_ptr<Authenticator> CreateAuthenticator(
       const std::string& local_jid,
       const std::string& remote_jid) override;
 
diff --git a/remoting/protocol/fake_connection_to_client.cc b/remoting/protocol/fake_connection_to_client.cc
index 113ecb26..8d115f5 100644
--- a/remoting/protocol/fake_connection_to_client.cc
+++ b/remoting/protocol/fake_connection_to_client.cc
@@ -31,7 +31,7 @@
   return weak_factory_.GetWeakPtr();
 }
 
-FakeConnectionToClient::FakeConnectionToClient(scoped_ptr<Session> session)
+FakeConnectionToClient::FakeConnectionToClient(std::unique_ptr<Session> session)
     : session_(std::move(session)) {}
 
 FakeConnectionToClient::~FakeConnectionToClient() {}
@@ -40,9 +40,9 @@
   event_handler_ = event_handler;
 }
 
-scoped_ptr<VideoStream> FakeConnectionToClient::StartVideoStream(
-    scoped_ptr<webrtc::DesktopCapturer> desktop_capturer) {
-  scoped_ptr<FakeVideoStream> result(new FakeVideoStream());
+std::unique_ptr<VideoStream> FakeConnectionToClient::StartVideoStream(
+    std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer) {
+  std::unique_ptr<FakeVideoStream> result(new FakeVideoStream());
   last_video_stream_ = result->GetWeakPtr();
   return std::move(result);
 }
diff --git a/remoting/protocol/fake_connection_to_client.h b/remoting/protocol/fake_connection_to_client.h
index bce93aa..3b79147 100644
--- a/remoting/protocol/fake_connection_to_client.h
+++ b/remoting/protocol/fake_connection_to_client.h
@@ -42,13 +42,13 @@
 
 class FakeConnectionToClient : public ConnectionToClient {
  public:
-  FakeConnectionToClient(scoped_ptr<Session> session);
+  FakeConnectionToClient(std::unique_ptr<Session> session);
   ~FakeConnectionToClient() override;
 
   void SetEventHandler(EventHandler* event_handler) override;
 
-  scoped_ptr<VideoStream> StartVideoStream(
-      scoped_ptr<webrtc::DesktopCapturer> desktop_capturer) override;
+  std::unique_ptr<VideoStream> StartVideoStream(
+      std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer) override;
 
   AudioStub* audio_stub() override;
   ClientStub* client_stub() override;
@@ -77,7 +77,7 @@
   ErrorCode disconnect_error() { return disconnect_error_; }
 
  private:
-  scoped_ptr<Session> session_;
+  std::unique_ptr<Session> session_;
   EventHandler* event_handler_ = nullptr;
 
   base::WeakPtr<FakeVideoStream> last_video_stream_;
diff --git a/remoting/protocol/fake_connection_to_host.cc b/remoting/protocol/fake_connection_to_host.cc
index 36703ee..e7964b7c 100644
--- a/remoting/protocol/fake_connection_to_host.cc
+++ b/remoting/protocol/fake_connection_to_host.cc
@@ -25,7 +25,7 @@
 void FakeConnectionToHost::set_audio_stub(protocol::AudioStub* audio_stub) {}
 
 void FakeConnectionToHost::Connect(
-    scoped_ptr<protocol::Session> session,
+    std::unique_ptr<protocol::Session> session,
     scoped_refptr<protocol::TransportContext> transport_context,
     HostEventCallback* event_callback) {
   DCHECK(event_callback);
diff --git a/remoting/protocol/fake_connection_to_host.h b/remoting/protocol/fake_connection_to_host.h
index 082a95ff..e3d275b 100644
--- a/remoting/protocol/fake_connection_to_host.h
+++ b/remoting/protocol/fake_connection_to_host.h
@@ -24,7 +24,7 @@
   void set_clipboard_stub(protocol::ClipboardStub* clipboard_stub) override;
   void set_video_renderer(protocol::VideoRenderer* video_renderer) override;
   void set_audio_stub(protocol::AudioStub* audio_stub) override;
-  void Connect(scoped_ptr<protocol::Session> session,
+  void Connect(std::unique_ptr<protocol::Session> session,
                scoped_refptr<protocol::TransportContext> transport_context,
                HostEventCallback* event_callback) override;
   const protocol::SessionConfig& config() override;
@@ -51,7 +51,7 @@
   testing::NiceMock<protocol::MockClipboardStub> mock_clipboard_stub_;
   testing::NiceMock<protocol::MockHostStub> mock_host_stub_;
   testing::NiceMock<protocol::MockInputStub> mock_input_stub_;
-  scoped_ptr<protocol::SessionConfig> session_config_;
+  std::unique_ptr<protocol::SessionConfig> session_config_;
 
   DISALLOW_COPY_AND_ASSIGN(FakeConnectionToHost);
 };
diff --git a/remoting/protocol/fake_datagram_socket.cc b/remoting/protocol/fake_datagram_socket.cc
index cb837466..34a50e0 100644
--- a/remoting/protocol/fake_datagram_socket.cc
+++ b/remoting/protocol/fake_datagram_socket.cc
@@ -157,7 +157,7 @@
     const ChannelCreatedCallback& callback) {
   EXPECT_TRUE(channels_[name] == nullptr);
 
-  scoped_ptr<FakeDatagramSocket> channel(new FakeDatagramSocket());
+  std::unique_ptr<FakeDatagramSocket> channel(new FakeDatagramSocket());
   channels_[name] = channel->GetWeakPtr();
 
   if (peer_factory_) {
@@ -181,7 +181,7 @@
 }
 
 void FakeDatagramChannelFactory::NotifyChannelCreated(
-    scoped_ptr<FakeDatagramSocket> owned_socket,
+    std::unique_ptr<FakeDatagramSocket> owned_socket,
     const std::string& name,
     const ChannelCreatedCallback& callback) {
   if (channels_.find(name) != channels_.end())
diff --git a/remoting/protocol/fake_datagram_socket.h b/remoting/protocol/fake_datagram_socket.h
index 49735b6..0df2d0e 100644
--- a/remoting/protocol/fake_datagram_socket.h
+++ b/remoting/protocol/fake_datagram_socket.h
@@ -6,11 +6,11 @@
 #define REMOTING_PROTOCOL_FAKE_DATAGRAM_SOCKET_H_
 
 #include <map>
+#include <memory>
 #include <string>
 #include <vector>
 
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "net/base/completion_callback.h"
 #include "remoting/protocol/datagram_channel_factory.h"
@@ -123,7 +123,7 @@
  private:
   typedef std::map<std::string, base::WeakPtr<FakeDatagramSocket> > ChannelsMap;
 
-  void NotifyChannelCreated(scoped_ptr<FakeDatagramSocket> owned_socket,
+  void NotifyChannelCreated(std::unique_ptr<FakeDatagramSocket> owned_socket,
                             const std::string& name,
                             const ChannelCreatedCallback& callback);
 
diff --git a/remoting/protocol/fake_desktop_capturer.cc b/remoting/protocol/fake_desktop_capturer.cc
index 290ef49..5817715 100644
--- a/remoting/protocol/fake_desktop_capturer.cc
+++ b/remoting/protocol/fake_desktop_capturer.cc
@@ -41,7 +41,7 @@
         box_speed_y_(kSpeed),
         first_frame_(true) {}
 
-  scoped_ptr<webrtc::DesktopFrame> GenerateFrame(
+  std::unique_ptr<webrtc::DesktopFrame> GenerateFrame(
       webrtc::SharedMemoryFactory* shared_memory_factory);
 
  private:
@@ -58,10 +58,10 @@
   DISALLOW_COPY_AND_ASSIGN(DefaultFrameGenerator);
 };
 
-scoped_ptr<webrtc::DesktopFrame> DefaultFrameGenerator::GenerateFrame(
+std::unique_ptr<webrtc::DesktopFrame> DefaultFrameGenerator::GenerateFrame(
     webrtc::SharedMemoryFactory* shared_memory_factory) {
   const int kBytesPerPixel = webrtc::DesktopFrame::kBytesPerPixel;
-  scoped_ptr<webrtc::DesktopFrame> frame;
+  std::unique_ptr<webrtc::DesktopFrame> frame;
   if (shared_memory_factory) {
     int buffer_size = kWidth * kHeight * kBytesPerPixel;
     frame.reset(new webrtc::SharedMemoryDesktopFrame(
@@ -147,7 +147,7 @@
 
 void FakeDesktopCapturer::Capture(const webrtc::DesktopRegion& region) {
   base::Time capture_start_time = base::Time::Now();
-  scoped_ptr<webrtc::DesktopFrame> frame =
+  std::unique_ptr<webrtc::DesktopFrame> frame =
       frame_generator_.Run(shared_memory_factory_.get());
   if (frame) {
     frame->set_capture_time_ms(
diff --git a/remoting/protocol/fake_desktop_capturer.h b/remoting/protocol/fake_desktop_capturer.h
index 8cf294e..9b54fd6 100644
--- a/remoting/protocol/fake_desktop_capturer.h
+++ b/remoting/protocol/fake_desktop_capturer.h
@@ -5,9 +5,10 @@
 #ifndef REMOTING_PROTOCOL_FAKE_DESKTOP_CAPTURER_H_
 #define REMOTING_PROTOCOL_FAKE_DESKTOP_CAPTURER_H_
 
+#include <memory>
+
 #include "base/callback.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h"
 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
 #include "third_party/webrtc/modules/desktop_capture/screen_capture_frame_queue.h"
@@ -26,7 +27,7 @@
   static const int kWidth = 800;
   static const int kHeight = 600;
 
-  typedef base::Callback<scoped_ptr<webrtc::DesktopFrame>(
+  typedef base::Callback<std::unique_ptr<webrtc::DesktopFrame>(
       webrtc::SharedMemoryFactory* shared_memory_factory)>
       FrameGenerator;
 
@@ -46,7 +47,7 @@
 
   Callback* callback_;
 
-  scoped_ptr<webrtc::SharedMemoryFactory> shared_memory_factory_;
+  std::unique_ptr<webrtc::SharedMemoryFactory> shared_memory_factory_;
 
   DISALLOW_COPY_AND_ASSIGN(FakeDesktopCapturer);
 };
diff --git a/remoting/protocol/fake_session.cc b/remoting/protocol/fake_session.cc
index f1e974e..90502e49 100644
--- a/remoting/protocol/fake_session.cc
+++ b/remoting/protocol/fake_session.cc
@@ -83,7 +83,7 @@
 }
 
 void FakeSession::SendTransportInfo(
-    scoped_ptr<buzz::XmlElement> transport_info) {
+    std::unique_ptr<buzz::XmlElement> transport_info) {
   if (!peer_)
     return;
   peer_->transport_->ProcessTransportInfo(transport_info.get());
diff --git a/remoting/protocol/fake_session.h b/remoting/protocol/fake_session.h
index 5717a97..b7b02c8 100644
--- a/remoting/protocol/fake_session.h
+++ b/remoting/protocol/fake_session.h
@@ -6,11 +6,11 @@
 #define REMOTING_PROTOCOL_FAKE_SESSION_H_
 
 #include <map>
+#include <memory>
 #include <string>
 #include <vector>
 
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "remoting/protocol/fake_stream_socket.h"
 #include "remoting/protocol/session.h"
@@ -44,14 +44,14 @@
 
  private:
   // Callback provided to the |transport_|.
-  void SendTransportInfo(scoped_ptr<buzz::XmlElement> transport_info);
+  void SendTransportInfo(std::unique_ptr<buzz::XmlElement> transport_info);
 
   EventHandler* event_handler_ = nullptr;
-  scoped_ptr<SessionConfig> config_;
+  std::unique_ptr<SessionConfig> config_;
 
   std::string jid_;
 
-  scoped_ptr<FakeAuthenticator> authenticator_;
+  std::unique_ptr<FakeAuthenticator> authenticator_;
   Transport* transport_;
 
   ErrorCode error_ = OK;
diff --git a/remoting/protocol/fake_stream_socket.cc b/remoting/protocol/fake_stream_socket.cc
index 547e2bd6..8ad9075 100644
--- a/remoting/protocol/fake_stream_socket.cc
+++ b/remoting/protocol/fake_stream_socket.cc
@@ -169,7 +169,7 @@
 void FakeStreamChannelFactory::CreateChannel(
     const std::string& name,
     const ChannelCreatedCallback& callback) {
-  scoped_ptr<FakeStreamSocket> channel(new FakeStreamSocket());
+  std::unique_ptr<FakeStreamSocket> channel(new FakeStreamSocket());
   channels_[name] = channel->GetWeakPtr();
   channel->set_async_write(async_write_);
 
@@ -192,7 +192,7 @@
 }
 
 void FakeStreamChannelFactory::NotifyChannelCreated(
-    scoped_ptr<FakeStreamSocket> owned_channel,
+    std::unique_ptr<FakeStreamSocket> owned_channel,
     const std::string& name,
     const ChannelCreatedCallback& callback) {
   if (channels_.find(name) != channels_.end())
diff --git a/remoting/protocol/fake_stream_socket.h b/remoting/protocol/fake_stream_socket.h
index 8b80785..83237dc 100644
--- a/remoting/protocol/fake_stream_socket.h
+++ b/remoting/protocol/fake_stream_socket.h
@@ -6,10 +6,10 @@
 #define REMOTING_PROTOCOL_FAKE_STREAM_SOCKET_H_
 
 #include <map>
+#include <memory>
 #include <string>
 
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "net/base/completion_callback.h"
 #include "remoting/protocol/p2p_stream_socket.h"
@@ -128,7 +128,7 @@
   void CancelChannelCreation(const std::string& name) override;
 
  private:
-  void NotifyChannelCreated(scoped_ptr<FakeStreamSocket> owned_channel,
+  void NotifyChannelCreated(std::unique_ptr<FakeStreamSocket> owned_channel,
                             const std::string& name,
                             const ChannelCreatedCallback& callback);
 
diff --git a/remoting/protocol/fake_video_renderer.cc b/remoting/protocol/fake_video_renderer.cc
index d30c4ad..b0d9b97d 100644
--- a/remoting/protocol/fake_video_renderer.cc
+++ b/remoting/protocol/fake_video_renderer.cc
@@ -8,6 +8,7 @@
 
 #include "base/callback.h"
 #include "base/logging.h"
+#include "base/memory/ptr_util.h"
 #include "remoting/proto/video.pb.h"
 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
 
@@ -22,8 +23,9 @@
   on_frame_callback_ = on_frame_callback;
 }
 
-void FakeVideoStub::ProcessVideoPacket(scoped_ptr<VideoPacket> video_packet,
-                                       const base::Closure& done) {
+void FakeVideoStub::ProcessVideoPacket(
+    std::unique_ptr<VideoPacket> video_packet,
+    const base::Closure& done) {
   CHECK(thread_checker_.CalledOnValidThread());
   received_packets_.push_back(std::move(video_packet));
   if (!done.is_null())
@@ -40,13 +42,13 @@
   on_frame_callback_ = on_frame_callback;
 }
 
-scoped_ptr<webrtc::DesktopFrame> FakeFrameConsumer::AllocateFrame(
+std::unique_ptr<webrtc::DesktopFrame> FakeFrameConsumer::AllocateFrame(
     const webrtc::DesktopSize& size) {
   CHECK(thread_checker_.CalledOnValidThread());
-  return make_scoped_ptr(new webrtc::BasicDesktopFrame(size));
+  return base::WrapUnique(new webrtc::BasicDesktopFrame(size));
 }
 
-void FakeFrameConsumer::DrawFrame(scoped_ptr<webrtc::DesktopFrame> frame,
+void FakeFrameConsumer::DrawFrame(std::unique_ptr<webrtc::DesktopFrame> frame,
                                   const base::Closure& done) {
   CHECK(thread_checker_.CalledOnValidThread());
   received_frames_.push_back(std::move(frame));
diff --git a/remoting/protocol/fake_video_renderer.h b/remoting/protocol/fake_video_renderer.h
index 60a70888..b8fde3c 100644
--- a/remoting/protocol/fake_video_renderer.h
+++ b/remoting/protocol/fake_video_renderer.h
@@ -6,9 +6,9 @@
 #define REMOTING_PROTOCOL_FAKE_VIDEO_RENDERER_H_
 
 #include <list>
+#include <memory>
 
 #include "base/callback.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/threading/thread_checker.h"
 #include "remoting/protocol/frame_consumer.h"
 #include "remoting/protocol/video_renderer.h"
@@ -22,19 +22,20 @@
   FakeVideoStub();
   ~FakeVideoStub() override;
 
-  const std::list<scoped_ptr<VideoPacket>>& received_packets() {
+  const std::list<std::unique_ptr<VideoPacket>>& received_packets() {
     return received_packets_;
   }
 
   void set_on_frame_callback(base::Closure on_frame_callback);
 
   // VideoStub interface.
-  void ProcessVideoPacket(scoped_ptr<VideoPacket> video_packet,
+  void ProcessVideoPacket(std::unique_ptr<VideoPacket> video_packet,
                           const base::Closure& done) override;
+
  private:
   base::ThreadChecker thread_checker_;
 
-  std::list<scoped_ptr<VideoPacket>> received_packets_;
+  std::list<std::unique_ptr<VideoPacket>> received_packets_;
   base::Closure on_frame_callback_;
 };
 
@@ -43,23 +44,23 @@
   FakeFrameConsumer();
   ~FakeFrameConsumer() override;
 
-  const std::list<scoped_ptr<webrtc::DesktopFrame>>& received_frames() {
+  const std::list<std::unique_ptr<webrtc::DesktopFrame>>& received_frames() {
     return received_frames_;
   }
 
   void set_on_frame_callback(base::Closure on_frame_callback);
 
   // FrameConsumer interface.
-  scoped_ptr<webrtc::DesktopFrame> AllocateFrame(
+  std::unique_ptr<webrtc::DesktopFrame> AllocateFrame(
       const webrtc::DesktopSize& size) override;
-  void DrawFrame(scoped_ptr<webrtc::DesktopFrame> frame,
+  void DrawFrame(std::unique_ptr<webrtc::DesktopFrame> frame,
                  const base::Closure& done) override;
   PixelFormat GetPixelFormat() override;
 
  private:
   base::ThreadChecker thread_checker_;
 
-  std::list<scoped_ptr<webrtc::DesktopFrame>> received_frames_;
+  std::list<std::unique_ptr<webrtc::DesktopFrame>> received_frames_;
   base::Closure on_frame_callback_;
 };
 
diff --git a/remoting/protocol/frame_consumer.h b/remoting/protocol/frame_consumer.h
index 7dde4fc8..be9c881 100644
--- a/remoting/protocol/frame_consumer.h
+++ b/remoting/protocol/frame_consumer.h
@@ -5,9 +5,10 @@
 #ifndef REMOTING_PROTOCOL_FRAME_CONSUMER_H_
 #define REMOTING_PROTOCOL_FRAME_CONSUMER_H_
 
+#include <memory>
+
 #include "base/callback_forward.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 
 namespace webrtc {
 class DesktopFrame;
@@ -25,10 +26,10 @@
     FORMAT_RGBA,  // Used for Android's Bitmap class.
   };
 
-  virtual scoped_ptr<webrtc::DesktopFrame> AllocateFrame(
+  virtual std::unique_ptr<webrtc::DesktopFrame> AllocateFrame(
       const webrtc::DesktopSize& size) = 0;
 
-  virtual void DrawFrame(scoped_ptr<webrtc::DesktopFrame> frame,
+  virtual void DrawFrame(std::unique_ptr<webrtc::DesktopFrame> frame,
                          const base::Closure& done) = 0;
 
   // Returns the preferred pixel encoding for the platform.
diff --git a/remoting/protocol/host_control_dispatcher.cc b/remoting/protocol/host_control_dispatcher.cc
index c817219..7f3ea27 100644
--- a/remoting/protocol/host_control_dispatcher.cc
+++ b/remoting/protocol/host_control_dispatcher.cc
@@ -63,11 +63,11 @@
 }
 
 void HostControlDispatcher::OnIncomingMessage(
-    scoped_ptr<CompoundBuffer> buffer) {
+    std::unique_ptr<CompoundBuffer> buffer) {
   DCHECK(clipboard_stub_);
   DCHECK(host_stub_);
 
-  scoped_ptr<ControlMessage> message =
+  std::unique_ptr<ControlMessage> message =
       ParseMessage<ControlMessage>(buffer.get());
   if (!message)
     return;
diff --git a/remoting/protocol/host_control_dispatcher.h b/remoting/protocol/host_control_dispatcher.h
index 597eb182..68c46b8 100644
--- a/remoting/protocol/host_control_dispatcher.h
+++ b/remoting/protocol/host_control_dispatcher.h
@@ -54,7 +54,7 @@
   void set_host_stub(HostStub* host_stub) { host_stub_ = host_stub; }
 
  private:
-  void OnIncomingMessage(scoped_ptr<CompoundBuffer> buffer) override;
+  void OnIncomingMessage(std::unique_ptr<CompoundBuffer> buffer) override;
 
   ClipboardStub* clipboard_stub_ = nullptr;
   HostStub* host_stub_ = nullptr;
diff --git a/remoting/protocol/host_event_dispatcher.cc b/remoting/protocol/host_event_dispatcher.cc
index 4032c0a..0ee78d0 100644
--- a/remoting/protocol/host_event_dispatcher.cc
+++ b/remoting/protocol/host_event_dispatcher.cc
@@ -19,10 +19,12 @@
     : ChannelDispatcherBase(kEventChannelName) {}
 HostEventDispatcher::~HostEventDispatcher() {}
 
-void HostEventDispatcher::OnIncomingMessage(scoped_ptr<CompoundBuffer> buffer) {
+void HostEventDispatcher::OnIncomingMessage(
+    std::unique_ptr<CompoundBuffer> buffer) {
   DCHECK(input_stub_);
 
-  scoped_ptr<EventMessage> message = ParseMessage<EventMessage>(buffer.get());
+  std::unique_ptr<EventMessage> message =
+      ParseMessage<EventMessage>(buffer.get());
   if (!message)
     return;
 
diff --git a/remoting/protocol/host_event_dispatcher.h b/remoting/protocol/host_event_dispatcher.h
index e299c2c..4c9df5e 100644
--- a/remoting/protocol/host_event_dispatcher.h
+++ b/remoting/protocol/host_event_dispatcher.h
@@ -37,7 +37,7 @@
   }
 
  private:
-  void OnIncomingMessage(scoped_ptr<CompoundBuffer> buffer) override;
+  void OnIncomingMessage(std::unique_ptr<CompoundBuffer> buffer) override;
 
   InputStub* input_stub_ = nullptr;
   OnInputEventCallback on_input_event_callback_;
diff --git a/remoting/protocol/host_video_dispatcher.cc b/remoting/protocol/host_video_dispatcher.cc
index 759f9d6..f2b604e 100644
--- a/remoting/protocol/host_video_dispatcher.cc
+++ b/remoting/protocol/host_video_dispatcher.cc
@@ -22,14 +22,15 @@
     : ChannelDispatcherBase(kVideoChannelName) {}
 HostVideoDispatcher::~HostVideoDispatcher() {}
 
-void HostVideoDispatcher::ProcessVideoPacket(scoped_ptr<VideoPacket> packet,
-                                             const base::Closure& done) {
+void HostVideoDispatcher::ProcessVideoPacket(
+    std::unique_ptr<VideoPacket> packet,
+    const base::Closure& done) {
   message_pipe()->Send(packet.get(), done);
 }
 
 void HostVideoDispatcher::OnIncomingMessage(
-    scoped_ptr<CompoundBuffer> message) {
-  scoped_ptr<VideoAck> ack = ParseMessage<VideoAck>(message.get());
+    std::unique_ptr<CompoundBuffer> message) {
+  std::unique_ptr<VideoAck> ack = ParseMessage<VideoAck>(message.get());
   if (!ack)
     return;
   if (video_feedback_stub_)
diff --git a/remoting/protocol/host_video_dispatcher.h b/remoting/protocol/host_video_dispatcher.h
index 1e61540..19c7d1d 100644
--- a/remoting/protocol/host_video_dispatcher.h
+++ b/remoting/protocol/host_video_dispatcher.h
@@ -25,11 +25,11 @@
   }
 
   // VideoStub interface.
-  void ProcessVideoPacket(scoped_ptr<VideoPacket> packet,
+  void ProcessVideoPacket(std::unique_ptr<VideoPacket> packet,
                           const base::Closure& done) override;
 
  private:
-  void OnIncomingMessage(scoped_ptr<CompoundBuffer> message) override;
+  void OnIncomingMessage(std::unique_ptr<CompoundBuffer> message) override;
 
   VideoFeedbackStub* video_feedback_stub_ = nullptr;
 
diff --git a/remoting/protocol/http_ice_config_request.cc b/remoting/protocol/http_ice_config_request.cc
index 1ae6414..7e8e5aa 100644
--- a/remoting/protocol/http_ice_config_request.cc
+++ b/remoting/protocol/http_ice_config_request.cc
@@ -129,7 +129,8 @@
     return;
   }
 
-  scoped_ptr<base::Value> json = base::JSONReader::Read(result.response_body);
+  std::unique_ptr<base::Value> json =
+      base::JSONReader::Read(result.response_body);
   base::DictionaryValue* dictionary = nullptr;
   base::ListValue* ice_servers_list = nullptr;
   if (!json || !json->GetAsDictionary(&dictionary) ||
diff --git a/remoting/protocol/http_ice_config_request.h b/remoting/protocol/http_ice_config_request.h
index 3610e9288..51047fa 100644
--- a/remoting/protocol/http_ice_config_request.h
+++ b/remoting/protocol/http_ice_config_request.h
@@ -5,9 +5,10 @@
 #ifndef REMOTING_PROTOCOL_HTTP_ICE_CONFIG_REQUEST_H_
 #define REMOTING_PROTOCOL_HTTP_ICE_CONFIG_REQUEST_H_
 
+#include <memory>
+
 #include "base/callback.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "remoting/base/url_request.h"
 #include "remoting/protocol/ice_config_request.h"
 
@@ -31,7 +32,7 @@
   void OnResponse(const UrlRequest::Result& result);
 
   std::string url_;
-  scoped_ptr<UrlRequest> url_request_;
+  std::unique_ptr<UrlRequest> url_request_;
   OnIceConfigCallback on_ice_config_callback_;
 
   DISALLOW_COPY_AND_ASSIGN(HttpIceConfigRequest);
diff --git a/remoting/protocol/http_ice_config_request_unittest.cc b/remoting/protocol/http_ice_config_request_unittest.cc
index 65cb9a4..fc105a5c 100644
--- a/remoting/protocol/http_ice_config_request_unittest.cc
+++ b/remoting/protocol/http_ice_config_request_unittest.cc
@@ -6,6 +6,7 @@
 
 #include "base/bind.h"
 #include "base/logging.h"
+#include "base/memory/ptr_util.h"
 #include "remoting/base/url_request.h"
 #include "remoting/protocol/ice_config.h"
 #include "testing/gtest/include/gtest/gtest.h"
@@ -47,11 +48,12 @@
   }
 
   // UrlRequestFactory interface.
-  scoped_ptr<UrlRequest> CreateUrlRequest(UrlRequest::Type type,
-                                          const std::string& url) override {
+  std::unique_ptr<UrlRequest> CreateUrlRequest(
+      UrlRequest::Type type,
+      const std::string& url) override {
     EXPECT_EQ(UrlRequest::Type::POST, type);
     CHECK(results_.count(url));
-    return make_scoped_ptr(new FakeUrlRequest(results_[url]));
+    return base::WrapUnique(new FakeUrlRequest(results_[url]));
   }
 
   std::map<std::string, UrlRequest::Result> results_;
@@ -81,13 +83,13 @@
 class HttpIceConfigRequestTest : public testing::Test {
  public:
   void OnResult(const IceConfig& config) {
-    received_config_ = make_scoped_ptr(new IceConfig(config));
+    received_config_ = base::WrapUnique(new IceConfig(config));
   }
 
  protected:
   FakeUrlRequestFactory url_request_factory_;
-  scoped_ptr<HttpIceConfigRequest> request_;
-  scoped_ptr<IceConfig> received_config_;
+  std::unique_ptr<HttpIceConfigRequest> request_;
+  std::unique_ptr<IceConfig> received_config_;
 };
 
 TEST_F(HttpIceConfigRequestTest, Parse) {
diff --git a/remoting/protocol/ice_connection_to_client.cc b/remoting/protocol/ice_connection_to_client.cc
index 6e5755136..2172ff4 100644
--- a/remoting/protocol/ice_connection_to_client.cc
+++ b/remoting/protocol/ice_connection_to_client.cc
@@ -8,6 +8,7 @@
 
 #include "base/bind.h"
 #include "base/location.h"
+#include "base/memory/ptr_util.h"
 #include "net/base/io_buffer.h"
 #include "remoting/codec/video_encoder.h"
 #include "remoting/codec/video_encoder_verbatim.h"
@@ -27,7 +28,7 @@
 
 namespace {
 
-scoped_ptr<VideoEncoder> CreateVideoEncoder(
+std::unique_ptr<VideoEncoder> CreateVideoEncoder(
     const protocol::SessionConfig& config) {
   const protocol::ChannelConfig& video_config = config.video_config();
 
@@ -36,7 +37,7 @@
   } else if (video_config.codec == protocol::ChannelConfig::CODEC_VP9) {
     return VideoEncoderVpx::CreateForVP9();
   } else if (video_config.codec == protocol::ChannelConfig::CODEC_VERBATIM) {
-    return make_scoped_ptr(new VideoEncoderVerbatim());
+    return base::WrapUnique(new VideoEncoderVerbatim());
   }
 
   NOTREACHED();
@@ -46,7 +47,7 @@
 }  // namespace
 
 IceConnectionToClient::IceConnectionToClient(
-    scoped_ptr<protocol::Session> session,
+    std::unique_ptr<protocol::Session> session,
     scoped_refptr<TransportContext> transport_context,
     scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner)
     : event_handler_(nullptr),
@@ -86,14 +87,14 @@
   event_handler_->OnInputEventReceived(this, timestamp);
 }
 
-scoped_ptr<VideoStream> IceConnectionToClient::StartVideoStream(
-    scoped_ptr<webrtc::DesktopCapturer> desktop_capturer) {
+std::unique_ptr<VideoStream> IceConnectionToClient::StartVideoStream(
+    std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
-  scoped_ptr<VideoEncoder> video_encoder =
+  std::unique_ptr<VideoEncoder> video_encoder =
       CreateVideoEncoder(session_->config());
 
-  scoped_ptr<VideoFramePump> pump(
+  std::unique_ptr<VideoFramePump> pump(
       new VideoFramePump(video_encode_task_runner_, std::move(desktop_capturer),
                          std::move(video_encoder), video_dispatcher_.get()));
   video_dispatcher_->set_video_feedback_stub(pump->video_feedback_stub());
diff --git a/remoting/protocol/ice_connection_to_client.h b/remoting/protocol/ice_connection_to_client.h
index a543ead..e0d034b 100644
--- a/remoting/protocol/ice_connection_to_client.h
+++ b/remoting/protocol/ice_connection_to_client.h
@@ -7,10 +7,10 @@
 
 #include <stdint.h>
 
+#include <memory>
 #include <string>
 
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/threading/thread_checker.h"
 #include "remoting/protocol/channel_dispatcher_base.h"
 #include "remoting/protocol/connection_to_client.h"
@@ -36,7 +36,7 @@
                               public ChannelDispatcherBase::EventHandler {
  public:
   IceConnectionToClient(
-      scoped_ptr<Session> session,
+      std::unique_ptr<Session> session,
       scoped_refptr<TransportContext> transport_context,
       scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner);
   ~IceConnectionToClient() override;
@@ -47,8 +47,8 @@
   Session* session() override;
   void Disconnect(ErrorCode error) override;
   void OnInputEventReceived(int64_t timestamp) override;
-  scoped_ptr<VideoStream> StartVideoStream(
-      scoped_ptr<webrtc::DesktopCapturer> desktop_capturer) override;
+  std::unique_ptr<VideoStream> StartVideoStream(
+      std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer) override;
   AudioStub* audio_stub() override;
   ClientStub* client_stub() override;
   void set_clipboard_stub(ClipboardStub* clipboard_stub) override;
@@ -76,16 +76,16 @@
   // Event handler for handling events sent from this object.
   ConnectionToClient::EventHandler* event_handler_;
 
-  scoped_ptr<Session> session_;
+  std::unique_ptr<Session> session_;
 
   scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner_;
 
   IceTransport transport_;
 
-  scoped_ptr<HostControlDispatcher> control_dispatcher_;
-  scoped_ptr<HostEventDispatcher> event_dispatcher_;
-  scoped_ptr<HostVideoDispatcher> video_dispatcher_;
-  scoped_ptr<AudioWriter> audio_writer_;
+  std::unique_ptr<HostControlDispatcher> control_dispatcher_;
+  std::unique_ptr<HostEventDispatcher> event_dispatcher_;
+  std::unique_ptr<HostVideoDispatcher> video_dispatcher_;
+  std::unique_ptr<AudioWriter> audio_writer_;
 
   DISALLOW_COPY_AND_ASSIGN(IceConnectionToClient);
 };
diff --git a/remoting/protocol/ice_connection_to_host.cc b/remoting/protocol/ice_connection_to_host.cc
index b8c211a9..940ad85 100644
--- a/remoting/protocol/ice_connection_to_host.cc
+++ b/remoting/protocol/ice_connection_to_host.cc
@@ -30,7 +30,7 @@
 IceConnectionToHost::~IceConnectionToHost() {}
 
 void IceConnectionToHost::Connect(
-    scoped_ptr<Session> session,
+    std::unique_ptr<Session> session,
     scoped_refptr<TransportContext> transport_context,
     HostEventCallback* event_callback) {
   DCHECK(client_stub_);
diff --git a/remoting/protocol/ice_connection_to_host.h b/remoting/protocol/ice_connection_to_host.h
index 8cab97e2..d347e1e3 100644
--- a/remoting/protocol/ice_connection_to_host.h
+++ b/remoting/protocol/ice_connection_to_host.h
@@ -5,13 +5,13 @@
 #ifndef REMOTING_PROTOCOL_ICE_CONNECTION_TO_HOST_H_
 #define REMOTING_PROTOCOL_ICE_CONNECTION_TO_HOST_H_
 
+#include <memory>
 #include <set>
 #include <string>
 
 #include "base/callback_forward.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/threading/non_thread_safe.h"
 #include "remoting/proto/internal.pb.h"
 #include "remoting/protocol/channel_dispatcher_base.h"
@@ -46,7 +46,7 @@
   void set_clipboard_stub(ClipboardStub* clipboard_stub) override;
   void set_video_renderer(VideoRenderer* video_renderer) override;
   void set_audio_stub(AudioStub* audio_stub) override;
-  void Connect(scoped_ptr<Session> session,
+  void Connect(std::unique_ptr<Session> session,
                scoped_refptr<TransportContext> transport_context,
                HostEventCallback* event_callback) override;
   const SessionConfig& config() override;
@@ -85,14 +85,14 @@
   VideoRenderer* video_renderer_ = nullptr;
   AudioStub* audio_stub_ = nullptr;
 
-  scoped_ptr<Session> session_;
-  scoped_ptr<IceTransport> transport_;
+  std::unique_ptr<Session> session_;
+  std::unique_ptr<IceTransport> transport_;
 
-  scoped_ptr<MonitoredVideoStub> monitored_video_stub_;
-  scoped_ptr<ClientVideoDispatcher> video_dispatcher_;
-  scoped_ptr<AudioReader> audio_reader_;
-  scoped_ptr<ClientControlDispatcher> control_dispatcher_;
-  scoped_ptr<ClientEventDispatcher> event_dispatcher_;
+  std::unique_ptr<MonitoredVideoStub> monitored_video_stub_;
+  std::unique_ptr<ClientVideoDispatcher> video_dispatcher_;
+  std::unique_ptr<AudioReader> audio_reader_;
+  std::unique_ptr<ClientControlDispatcher> control_dispatcher_;
+  std::unique_ptr<ClientEventDispatcher> event_dispatcher_;
   ClipboardFilter clipboard_forwarder_;
   InputFilter event_forwarder_;
 
diff --git a/remoting/protocol/ice_transport.cc b/remoting/protocol/ice_transport.cc
index 94ceee77..0eabd15 100644
--- a/remoting/protocol/ice_transport.cc
+++ b/remoting/protocol/ice_transport.cc
@@ -103,7 +103,7 @@
                                  const ChannelCreatedCallback& callback) {
   DCHECK(!channels_[name]);
 
-  scoped_ptr<IceTransportChannel> channel(
+  std::unique_ptr<IceTransportChannel> channel(
       new IceTransportChannel(transport_context_));
   channel->Connect(name, this, callback);
   AddPendingRemoteTransportInfo(channel.get());
@@ -193,7 +193,7 @@
 void IceTransport::SendTransportInfo() {
   DCHECK(pending_transport_info_message_);
 
-  scoped_ptr<buzz::XmlElement> transport_info_xml =
+  std::unique_ptr<buzz::XmlElement> transport_info_xml =
       pending_transport_info_message_->ToXml();
   pending_transport_info_message_.reset();
   send_transport_info_callback_.Run(std::move(transport_info_xml));
diff --git a/remoting/protocol/ice_transport.h b/remoting/protocol/ice_transport.h
index e47fc3b5..f25fe98 100644
--- a/remoting/protocol/ice_transport.h
+++ b/remoting/protocol/ice_transport.h
@@ -91,19 +91,19 @@
   SendTransportInfoCallback send_transport_info_callback_;
 
   ChannelsMap channels_;
-  scoped_ptr<PseudoTcpChannelFactory> pseudotcp_channel_factory_;
-  scoped_ptr<SecureChannelFactory> secure_channel_factory_;
-  scoped_ptr<MessageChannelFactory> message_channel_factory_;
+  std::unique_ptr<PseudoTcpChannelFactory> pseudotcp_channel_factory_;
+  std::unique_ptr<SecureChannelFactory> secure_channel_factory_;
+  std::unique_ptr<MessageChannelFactory> message_channel_factory_;
 
-  scoped_ptr<ChannelMultiplexer> channel_multiplexer_;
-  scoped_ptr<MessageChannelFactory> mux_channel_factory_;
+  std::unique_ptr<ChannelMultiplexer> channel_multiplexer_;
+  std::unique_ptr<MessageChannelFactory> mux_channel_factory_;
 
   // Pending remote transport info received before the local channels were
   // created.
   std::list<IceTransportInfo::IceCredentials> pending_remote_ice_credentials_;
   std::list<IceTransportInfo::NamedCandidate> pending_remote_candidates_;
 
-  scoped_ptr<IceTransportInfo> pending_transport_info_message_;
+  std::unique_ptr<IceTransportInfo> pending_transport_info_message_;
   base::OneShotTimer transport_info_timer_;
 
   base::WeakPtrFactory<IceTransport> weak_factory_;
diff --git a/remoting/protocol/ice_transport_channel.cc b/remoting/protocol/ice_transport_channel.cc
index da7a5cf..45e467a 100644
--- a/remoting/protocol/ice_transport_channel.cc
+++ b/remoting/protocol/ice_transport_channel.cc
@@ -134,7 +134,7 @@
 
 void IceTransportChannel::NotifyConnected() {
   // Create P2PDatagramSocket adapter for the P2PTransportChannel.
-  scoped_ptr<TransportChannelSocketAdapter> socket(
+  std::unique_ptr<TransportChannelSocketAdapter> socket(
       new TransportChannelSocketAdapter(channel_.get()));
   socket->SetOnDestroyedCallback(base::Bind(
       &IceTransportChannel::OnChannelDestroyed, base::Unretained(this)));
diff --git a/remoting/protocol/ice_transport_channel.h b/remoting/protocol/ice_transport_channel.h
index ca69d1f..f97f3ed 100644
--- a/remoting/protocol/ice_transport_channel.h
+++ b/remoting/protocol/ice_transport_channel.h
@@ -59,7 +59,8 @@
     virtual void OnChannelDeleted(IceTransportChannel* transport) = 0;
   };
 
-  typedef base::Callback<void(scoped_ptr<P2PDatagramSocket>)> ConnectedCallback;
+  typedef base::Callback<void(std::unique_ptr<P2PDatagramSocket>)>
+      ConnectedCallback;
 
   explicit IceTransportChannel(
       scoped_refptr<TransportContext> transport_context);
@@ -86,7 +87,7 @@
 
  private:
   void OnPortAllocatorCreated(
-      scoped_ptr<cricket::PortAllocator> port_allocator);
+      std::unique_ptr<cricket::PortAllocator> port_allocator);
 
   void NotifyConnected();
 
@@ -113,12 +114,12 @@
   ConnectedCallback callback_;
   std::string ice_username_fragment_;
 
-  scoped_ptr<cricket::PortAllocator> port_allocator_;
+  std::unique_ptr<cricket::PortAllocator> port_allocator_;
 
   std::string remote_ice_username_fragment_;
   std::string remote_ice_password_;
   std::list<cricket::Candidate> pending_candidates_;
-  scoped_ptr<cricket::P2PTransportChannel> channel_;
+  std::unique_ptr<cricket::P2PTransportChannel> channel_;
   int connect_attempts_left_;
   base::RepeatingTimer reconnect_timer_;
 
diff --git a/remoting/protocol/ice_transport_unittest.cc b/remoting/protocol/ice_transport_unittest.cc
index 467fb1a..66aa75c1 100644
--- a/remoting/protocol/ice_transport_unittest.cc
+++ b/remoting/protocol/ice_transport_unittest.cc
@@ -9,6 +9,7 @@
 #include "base/bind.h"
 #include "base/location.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
 #include "base/single_thread_task_runner.h"
@@ -97,8 +98,8 @@
     message_loop_.RunUntilIdle();
   }
 
-  void ProcessTransportInfo(scoped_ptr<IceTransport>* target_transport,
-                            scoped_ptr<buzz::XmlElement> transport_info) {
+  void ProcessTransportInfo(std::unique_ptr<IceTransport>* target_transport,
+                            std::unique_ptr<buzz::XmlElement> transport_info) {
     base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
         FROM_HERE, base::Bind(&IceTransportTest::DeliverTransportInfo,
                               base::Unretained(this), target_transport,
@@ -106,8 +107,8 @@
         transport_info_delay_);
   }
 
-  void DeliverTransportInfo(scoped_ptr<IceTransport>* target_transport,
-                            scoped_ptr<buzz::XmlElement> transport_info) {
+  void DeliverTransportInfo(std::unique_ptr<IceTransport>* target_transport,
+                            std::unique_ptr<buzz::XmlElement> transport_info) {
     ASSERT_TRUE(target_transport);
     EXPECT_TRUE(
         (*target_transport)->ProcessTransportInfo(transport_info.get()));
@@ -118,7 +119,7 @@
 
     host_transport_.reset(new IceTransport(
         new TransportContext(
-            nullptr, make_scoped_ptr(new ChromiumPortAllocatorFactory()),
+            nullptr, base::WrapUnique(new ChromiumPortAllocatorFactory()),
             nullptr, network_settings_, TransportRole::SERVER),
         &host_event_handler_));
     if (!host_authenticator_) {
@@ -128,7 +129,7 @@
 
     client_transport_.reset(new IceTransport(
         new TransportContext(
-            nullptr, make_scoped_ptr(new ChromiumPortAllocatorFactory()),
+            nullptr, base::WrapUnique(new ChromiumPortAllocatorFactory()),
             nullptr, network_settings_, TransportRole::CLIENT),
         &client_event_handler_));
     if (!client_authenticator_) {
@@ -167,12 +168,12 @@
     EXPECT_TRUE(host_message_pipe_.get());
   }
 
-  void OnClientChannelCreated(scoped_ptr<MessagePipe> message_pipe) {
+  void OnClientChannelCreated(std::unique_ptr<MessagePipe> message_pipe) {
     client_message_pipe_ = std::move(message_pipe);
     client_channel_callback_.OnDone(client_message_pipe_.get());
   }
 
-  void OnHostChannelCreated(scoped_ptr<MessagePipe> message_pipe) {
+  void OnHostChannelCreated(std::unique_ptr<MessagePipe> message_pipe) {
     host_message_pipe_ = std::move(message_pipe);
     host_channel_callback_.OnDone(host_message_pipe_.get());
   }
@@ -185,25 +186,25 @@
 
  protected:
   base::MessageLoopForIO message_loop_;
-  scoped_ptr<base::RunLoop> run_loop_;
+  std::unique_ptr<base::RunLoop> run_loop_;
 
   NetworkSettings network_settings_;
 
   base::TimeDelta transport_info_delay_;
 
-  scoped_ptr<IceTransport> host_transport_;
+  std::unique_ptr<IceTransport> host_transport_;
   TestTransportEventHandler host_event_handler_;
-  scoped_ptr<FakeAuthenticator> host_authenticator_;
+  std::unique_ptr<FakeAuthenticator> host_authenticator_;
 
-  scoped_ptr<IceTransport> client_transport_;
+  std::unique_ptr<IceTransport> client_transport_;
   TestTransportEventHandler client_event_handler_;
-  scoped_ptr<FakeAuthenticator> client_authenticator_;
+  std::unique_ptr<FakeAuthenticator> client_authenticator_;
 
   MockChannelCreatedCallback client_channel_callback_;
   MockChannelCreatedCallback host_channel_callback_;
 
-  scoped_ptr<MessagePipe> client_message_pipe_;
-  scoped_ptr<MessagePipe> host_message_pipe_;
+  std::unique_ptr<MessagePipe> client_message_pipe_;
+  std::unique_ptr<MessagePipe> host_message_pipe_;
 
   ErrorCode error_ = OK;
 };
diff --git a/remoting/protocol/it2me_host_authenticator_factory.cc b/remoting/protocol/it2me_host_authenticator_factory.cc
index fb89426..7d6e691 100644
--- a/remoting/protocol/it2me_host_authenticator_factory.cc
+++ b/remoting/protocol/it2me_host_authenticator_factory.cc
@@ -5,6 +5,7 @@
 #include "remoting/protocol/it2me_host_authenticator_factory.h"
 
 #include "base/logging.h"
+#include "base/memory/ptr_util.h"
 #include "base/strings/string_util.h"
 #include "remoting/base/rsa_key_pair.h"
 #include "remoting/protocol/negotiating_host_authenticator.h"
@@ -25,7 +26,8 @@
 
 It2MeHostAuthenticatorFactory::~It2MeHostAuthenticatorFactory() {}
 
-scoped_ptr<Authenticator> It2MeHostAuthenticatorFactory::CreateAuthenticator(
+std::unique_ptr<Authenticator>
+It2MeHostAuthenticatorFactory::CreateAuthenticator(
     const std::string& local_jid,
     const std::string& remote_jid) {
   // Check the client domain policy.
@@ -40,7 +42,7 @@
                         base::CompareCase::INSENSITIVE_ASCII)) {
       LOG(ERROR) << "Rejecting incoming connection from " << remote_jid
                  << ": Domain mismatch.";
-      return make_scoped_ptr(
+      return base::WrapUnique(
           new RejectingAuthenticator(Authenticator::INVALID_CREDENTIALS));
     }
   }
diff --git a/remoting/protocol/it2me_host_authenticator_factory.h b/remoting/protocol/it2me_host_authenticator_factory.h
index 02dfff3..fe244c2f 100644
--- a/remoting/protocol/it2me_host_authenticator_factory.h
+++ b/remoting/protocol/it2me_host_authenticator_factory.h
@@ -5,12 +5,12 @@
 #ifndef REMOTING_PROTOCOL_IT2ME_HOST_AUTHENTICATOR_FACTORY_H_
 #define REMOTING_PROTOCOL_IT2ME_HOST_AUTHENTICATOR_FACTORY_H_
 
+#include <memory>
 #include <string>
 
 #include "base/compiler_specific.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "remoting/protocol/authenticator.h"
 
 namespace remoting {
@@ -30,7 +30,7 @@
   ~It2MeHostAuthenticatorFactory() override;
 
   // AuthenticatorFactory interface.
-  scoped_ptr<Authenticator> CreateAuthenticator(
+  std::unique_ptr<Authenticator> CreateAuthenticator(
       const std::string& local_jid,
       const std::string& remote_jid) override;
 
diff --git a/remoting/protocol/jingle_info_request.cc b/remoting/protocol/jingle_info_request.cc
index b8044995..7569dcc 100644
--- a/remoting/protocol/jingle_info_request.cc
+++ b/remoting/protocol/jingle_info_request.cc
@@ -32,7 +32,7 @@
 
 void JingleInfoRequest::Send(const OnIceConfigCallback& callback) {
   on_ice_config_callback_ = callback;
-  scoped_ptr<buzz::XmlElement> iq_body(
+  std::unique_ptr<buzz::XmlElement> iq_body(
       new buzz::XmlElement(buzz::QN_JINGLE_INFO_QUERY, true));
   request_ = iq_sender_.SendIq(
       buzz::STR_GET, buzz::STR_EMPTY, std::move(iq_body),
diff --git a/remoting/protocol/jingle_info_request.h b/remoting/protocol/jingle_info_request.h
index f905539c..a7b3d775 100644
--- a/remoting/protocol/jingle_info_request.h
+++ b/remoting/protocol/jingle_info_request.h
@@ -5,13 +5,13 @@
 #ifndef REMOTING_PROTOCOL_JINGLE_INFO_REQUEST_H_
 #define REMOTING_PROTOCOL_JINGLE_INFO_REQUEST_H_
 
+#include <memory>
 #include <set>
 #include <string>
 #include <vector>
 
 #include "base/callback.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "remoting/protocol/ice_config_request.h"
 #include "remoting/signaling/iq_sender.h"
 
@@ -38,7 +38,7 @@
   void OnResponse(IqRequest* request, const buzz::XmlElement* stanza);
 
   IqSender iq_sender_;
-  scoped_ptr<IqRequest> request_;
+  std::unique_ptr<IqRequest> request_;
   OnIceConfigCallback on_ice_config_callback_;
 
   DISALLOW_COPY_AND_ASSIGN(JingleInfoRequest);
diff --git a/remoting/protocol/jingle_messages.cc b/remoting/protocol/jingle_messages.cc
index 45bc3b5..bc8846a 100644
--- a/remoting/protocol/jingle_messages.cc
+++ b/remoting/protocol/jingle_messages.cc
@@ -285,8 +285,8 @@
   return true;
 }
 
-scoped_ptr<buzz::XmlElement> JingleMessage::ToXml() const {
-  scoped_ptr<XmlElement> root(
+std::unique_ptr<buzz::XmlElement> JingleMessage::ToXml() const {
+  std::unique_ptr<XmlElement> root(
       new XmlElement(QName("jabber:client", "iq"), true));
 
   DCHECK(!to.empty());
@@ -367,9 +367,9 @@
 
 JingleMessageReply::~JingleMessageReply() { }
 
-scoped_ptr<buzz::XmlElement> JingleMessageReply::ToXml(
+std::unique_ptr<buzz::XmlElement> JingleMessageReply::ToXml(
     const buzz::XmlElement* request_stanza) const {
-  scoped_ptr<XmlElement> iq(
+  std::unique_ptr<XmlElement> iq(
       new XmlElement(QName(kJabberNamespace, "iq"), true));
   iq->SetAttr(QName(kEmptyNamespace, "to"),
               request_stanza->Attr(QName(kEmptyNamespace, "from")));
@@ -482,8 +482,8 @@
   return true;
 }
 
-scoped_ptr<buzz::XmlElement> IceTransportInfo::ToXml() const {
-  scoped_ptr<buzz::XmlElement> result(
+std::unique_ptr<buzz::XmlElement> IceTransportInfo::ToXml() const {
+  std::unique_ptr<buzz::XmlElement> result(
       new XmlElement(QName(kIceTransportNamespace, "transport"), true));
   for (const IceCredentials& credentials : ice_credentials) {
     result->AddElement(FormatIceCredentials(credentials));
diff --git a/remoting/protocol/jingle_messages.h b/remoting/protocol/jingle_messages.h
index 96a0f488..e81d862 100644
--- a/remoting/protocol/jingle_messages.h
+++ b/remoting/protocol/jingle_messages.h
@@ -6,9 +6,9 @@
 #define REMOTING_PROTOCOL_JINGLE_MESSAGES_H_
 
 #include <list>
+#include <memory>
 #include <string>
 
-#include "base/memory/scoped_ptr.h"
 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h"
 #include "third_party/webrtc/p2p/base/candidate.h"
 
@@ -53,7 +53,7 @@
   // message when parsing fails.
   bool ParseXml(const buzz::XmlElement* stanza, std::string* error);
 
-  scoped_ptr<buzz::XmlElement> ToXml() const;
+  std::unique_ptr<buzz::XmlElement> ToXml() const;
 
   std::string from;
   std::string to;
@@ -62,12 +62,12 @@
 
   std::string initiator;
 
-  scoped_ptr<ContentDescription> description;
+  std::unique_ptr<ContentDescription> description;
 
-  scoped_ptr<buzz::XmlElement> transport_info;
+  std::unique_ptr<buzz::XmlElement> transport_info;
 
   // Content of session-info messages.
-  scoped_ptr<buzz::XmlElement> info;
+  std::unique_ptr<buzz::XmlElement> info;
 
   // Value from the <reason> tag if it is present in the
   // message. Useful mainly for session-terminate messages, but Jingle
@@ -97,7 +97,7 @@
   // Formats reply stanza for the specified |request_stanza|. Id and
   // recepient as well as other information needed to generate a valid
   // reply are taken from |request_stanza|.
-  scoped_ptr<buzz::XmlElement> ToXml(
+  std::unique_ptr<buzz::XmlElement> ToXml(
       const buzz::XmlElement* request_stanza) const;
 
   ReplyType type;
@@ -131,7 +131,7 @@
   // Caller keeps ownership of |stanza|. |error| is set to debug error
   // message when parsing fails.
   bool ParseXml(const buzz::XmlElement* stanza);
-  scoped_ptr<buzz::XmlElement> ToXml() const;
+  std::unique_ptr<buzz::XmlElement> ToXml() const;
 
   std::list<IceCredentials> ice_credentials;
   std::list<NamedCandidate> candidates;
diff --git a/remoting/protocol/jingle_messages_unittest.cc b/remoting/protocol/jingle_messages_unittest.cc
index c45f7b23..5fb388a 100644
--- a/remoting/protocol/jingle_messages_unittest.cc
+++ b/remoting/protocol/jingle_messages_unittest.cc
@@ -96,8 +96,7 @@
 // Parses |message_text| to JingleMessage.
 void ParseJingleMessageFromXml(const char* message_text,
                                JingleMessage* parsed) {
-  scoped_ptr<XmlElement> source_message(
-      XmlElement::ForStr(message_text));
+  std::unique_ptr<XmlElement> source_message(XmlElement::ForStr(message_text));
   ASSERT_TRUE(source_message.get());
 
   EXPECT_TRUE(JingleMessage::IsJingleMessage(source_message.get()));
@@ -110,8 +109,7 @@
 // Parses |message_text| to JingleMessage then attempts to format it to XML and
 // verifies that the same XML content is generated.
 void ParseFormatAndCompare(const char* message_text, JingleMessage* parsed) {
-  scoped_ptr<XmlElement> source_message(
-      XmlElement::ForStr(message_text));
+  std::unique_ptr<XmlElement> source_message(XmlElement::ForStr(message_text));
   ASSERT_TRUE(source_message.get());
 
   EXPECT_TRUE(JingleMessage::IsJingleMessage(source_message.get()));
@@ -119,7 +117,7 @@
   std::string error;
   EXPECT_TRUE(parsed->ParseXml(source_message.get(), &error)) << error;
 
-  scoped_ptr<XmlElement> formatted_message(parsed->ToXml());
+  std::unique_ptr<XmlElement> formatted_message(parsed->ToXml());
   ASSERT_TRUE(formatted_message.get());
   EXPECT_TRUE(VerifyXml(source_message.get(), formatted_message.get(), &error))
       << error;
@@ -412,7 +410,7 @@
       "xmlns:cli='jabber:client'><jingle action='session-terminate' "
       "sid='2227053353' xmlns='urn:xmpp:jingle:1'><reason><success/>"
       "</reason></jingle></cli:iq>";
-  scoped_ptr<XmlElement> incoming_message(
+  std::unique_ptr<XmlElement> incoming_message(
       XmlElement::ForStr(kTestIncomingMessage));
   ASSERT_TRUE(incoming_message.get());
 
@@ -460,9 +458,10 @@
     } else {
       reply_msg = JingleMessageReply(tests[i].error, tests[i].error_text);
     }
-    scoped_ptr<XmlElement> reply(reply_msg.ToXml(incoming_message.get()));
+    std::unique_ptr<XmlElement> reply(reply_msg.ToXml(incoming_message.get()));
 
-    scoped_ptr<XmlElement> expected(XmlElement::ForStr(tests[i].expected_text));
+    std::unique_ptr<XmlElement> expected(
+        XmlElement::ForStr(tests[i].expected_text));
     ASSERT_TRUE(expected.get());
 
     std::string error;
@@ -495,7 +494,7 @@
             "xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>"
         "</error>"
       "</iq>";
-  scoped_ptr<XmlElement> source_message(
+  std::unique_ptr<XmlElement> source_message(
       XmlElement::ForStr(kTestSessionInitiateErrorMessage));
   ASSERT_TRUE(source_message.get());
 
diff --git a/remoting/protocol/jingle_session.cc b/remoting/protocol/jingle_session.cc
index 0576489b..2ecf152 100644
--- a/remoting/protocol/jingle_session.cc
+++ b/remoting/protocol/jingle_session.cc
@@ -89,8 +89,9 @@
   return error_;
 }
 
-void JingleSession::StartConnection(const std::string& peer_jid,
-                                    scoped_ptr<Authenticator> authenticator) {
+void JingleSession::StartConnection(
+    const std::string& peer_jid,
+    std::unique_ptr<Authenticator> authenticator) {
   DCHECK(thread_checker_.CalledOnValidThread());
   DCHECK(authenticator.get());
   DCHECK_EQ(authenticator->state(), Authenticator::MESSAGE_READY);
@@ -119,7 +120,7 @@
 
 void JingleSession::InitializeIncomingConnection(
     const JingleMessage& initiate_message,
-    scoped_ptr<Authenticator> authenticator) {
+    std::unique_ptr<Authenticator> authenticator) {
   DCHECK(thread_checker_.CalledOnValidThread());
   DCHECK(initiate_message.description.get());
   DCHECK(authenticator.get());
@@ -173,7 +174,7 @@
   JingleMessage message(peer_jid_, JingleMessage::SESSION_ACCEPT,
                         session_id_);
 
-  scoped_ptr<buzz::XmlElement> auth_message;
+  std::unique_ptr<buzz::XmlElement> auth_message;
   if (authenticator_->state() == Authenticator::MESSAGE_READY)
     auth_message = authenticator_->GetNextMessage();
 
@@ -212,14 +213,14 @@
 }
 
 void JingleSession::SendTransportInfo(
-    scoped_ptr<buzz::XmlElement> transport_info) {
+    std::unique_ptr<buzz::XmlElement> transport_info) {
   DCHECK(thread_checker_.CalledOnValidThread());
   DCHECK_EQ(state_, AUTHENTICATED);
 
   JingleMessage message(peer_jid_, JingleMessage::TRANSPORT_INFO, session_id_);
   message.transport_info = std::move(transport_info);
 
-  scoped_ptr<IqRequest> request = session_manager_->iq_sender()->SendIq(
+  std::unique_ptr<IqRequest> request = session_manager_->iq_sender()->SendIq(
       message.ToXml(), base::Bind(&JingleSession::OnTransportInfoResponse,
                                   base::Unretained(this)));
   if (request) {
@@ -280,11 +281,9 @@
 void JingleSession::SendMessage(const JingleMessage& message) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
-  scoped_ptr<IqRequest> request = session_manager_->iq_sender()->SendIq(
-      message.ToXml(),
-      base::Bind(&JingleSession::OnMessageResponse,
-                 base::Unretained(this),
-                 message.action));
+  std::unique_ptr<IqRequest> request = session_manager_->iq_sender()->SendIq(
+      message.ToXml(), base::Bind(&JingleSession::OnMessageResponse,
+                                  base::Unretained(this), message.action));
 
   int timeout = kDefaultMessageTimeout;
   if (message.action == JingleMessage::SESSION_INITIATE ||
diff --git a/remoting/protocol/jingle_session.h b/remoting/protocol/jingle_session.h
index 87a98c7..ae94939 100644
--- a/remoting/protocol/jingle_session.h
+++ b/remoting/protocol/jingle_session.h
@@ -52,15 +52,16 @@
 
   // Start connection by sending session-initiate message.
   void StartConnection(const std::string& peer_jid,
-                       scoped_ptr<Authenticator> authenticator);
+                       std::unique_ptr<Authenticator> authenticator);
 
   // Called by JingleSessionManager for incoming connections.
-  void InitializeIncomingConnection(const JingleMessage& initiate_message,
-                                    scoped_ptr<Authenticator> authenticator);
+  void InitializeIncomingConnection(
+      const JingleMessage& initiate_message,
+      std::unique_ptr<Authenticator> authenticator);
   void AcceptIncomingConnection(const JingleMessage& initiate_message);
 
   // Callback for Transport interface to send transport-info messages.
-  void SendTransportInfo(scoped_ptr<buzz::XmlElement> transport_info);
+  void SendTransportInfo(std::unique_ptr<buzz::XmlElement> transport_info);
 
   // Sends |message| to the peer. The session is closed if the send fails or no
   // response is received within a reasonable time. All other responses are
@@ -122,9 +123,9 @@
   State state_;
   ErrorCode error_;
 
-  scoped_ptr<SessionConfig> config_;
+  std::unique_ptr<SessionConfig> config_;
 
-  scoped_ptr<Authenticator> authenticator_;
+  std::unique_ptr<Authenticator> authenticator_;
 
   Transport* transport_ = nullptr;
 
diff --git a/remoting/protocol/jingle_session_manager.cc b/remoting/protocol/jingle_session_manager.cc
index f7872cf..9eed54a7 100644
--- a/remoting/protocol/jingle_session_manager.cc
+++ b/remoting/protocol/jingle_session_manager.cc
@@ -40,21 +40,21 @@
 }
 
 void JingleSessionManager::set_protocol_config(
-    scoped_ptr<CandidateSessionConfig> config) {
+    std::unique_ptr<CandidateSessionConfig> config) {
   protocol_config_ = std::move(config);
 }
 
-scoped_ptr<Session> JingleSessionManager::Connect(
+std::unique_ptr<Session> JingleSessionManager::Connect(
     const std::string& host_jid,
-    scoped_ptr<Authenticator> authenticator) {
-  scoped_ptr<JingleSession> session(new JingleSession(this));
+    std::unique_ptr<Authenticator> authenticator) {
+  std::unique_ptr<JingleSession> session(new JingleSession(this));
   session->StartConnection(host_jid, std::move(authenticator));
   sessions_[session->session_id_] = session.get();
   return std::move(session);
 }
 
 void JingleSessionManager::set_authenticator_factory(
-    scoped_ptr<AuthenticatorFactory> authenticator_factory) {
+    std::unique_ptr<AuthenticatorFactory> authenticator_factory) {
   DCHECK(CalledOnValidThread());
   authenticator_factory_ = std::move(authenticator_factory);
 }
@@ -80,7 +80,7 @@
 
     SendReply(stanza, JingleMessageReply::NONE);
 
-    scoped_ptr<Authenticator> authenticator =
+    std::unique_ptr<Authenticator> authenticator =
         authenticator_factory_->CreateAuthenticator(
             signal_strategy_->GetLocalJid(), message.from);
 
diff --git a/remoting/protocol/jingle_session_manager.h b/remoting/protocol/jingle_session_manager.h
index 3ac1906..6a1fe4fb 100644
--- a/remoting/protocol/jingle_session_manager.h
+++ b/remoting/protocol/jingle_session_manager.h
@@ -39,12 +39,13 @@
   // SessionManager interface.
   void AcceptIncoming(
       const IncomingSessionCallback& incoming_session_callback) override;
-  void set_protocol_config(scoped_ptr<CandidateSessionConfig> config) override;
-  scoped_ptr<Session> Connect(
+  void set_protocol_config(
+      std::unique_ptr<CandidateSessionConfig> config) override;
+  std::unique_ptr<Session> Connect(
       const std::string& host_jid,
-      scoped_ptr<Authenticator> authenticator) override;
+      std::unique_ptr<Authenticator> authenticator) override;
   void set_authenticator_factory(
-      scoped_ptr<AuthenticatorFactory> authenticator_factory) override;
+      std::unique_ptr<AuthenticatorFactory> authenticator_factory) override;
 
  private:
   friend class JingleSession;
@@ -64,10 +65,10 @@
 
   SignalStrategy* signal_strategy_ = nullptr;
   IncomingSessionCallback incoming_session_callback_;
-  scoped_ptr<CandidateSessionConfig> protocol_config_;
+  std::unique_ptr<CandidateSessionConfig> protocol_config_;
 
-  scoped_ptr<AuthenticatorFactory> authenticator_factory_;
-  scoped_ptr<IqSender> iq_sender_;
+  std::unique_ptr<AuthenticatorFactory> authenticator_factory_;
+  std::unique_ptr<IqSender> iq_sender_;
 
   SessionsMap sessions_;
 
diff --git a/remoting/protocol/jingle_session_unittest.cc b/remoting/protocol/jingle_session_unittest.cc
index 6701338b..d8e5fa0 100644
--- a/remoting/protocol/jingle_session_unittest.cc
+++ b/remoting/protocol/jingle_session_unittest.cc
@@ -117,9 +117,9 @@
         base::Bind(&MockSessionManagerListener::OnIncomingSession,
                    base::Unretained(&host_server_listener_)));
 
-    scoped_ptr<AuthenticatorFactory> factory(
-        new FakeHostAuthenticatorFactory(auth_round_trips,
-          messages_till_start, auth_action, true));
+    std::unique_ptr<AuthenticatorFactory> factory(
+        new FakeHostAuthenticatorFactory(auth_round_trips, messages_till_start,
+                                         auth_action, true));
     host_server_->set_authenticator_factory(std::move(factory));
 
     client_server_.reset(
@@ -198,7 +198,7 @@
       }
     }
 
-    scoped_ptr<Authenticator> authenticator(new FakeAuthenticator(
+    std::unique_ptr<Authenticator> authenticator(new FakeAuthenticator(
         FakeAuthenticator::CLIENT, auth_round_trips, auth_action, true));
 
     client_session_ =
@@ -218,21 +218,21 @@
         .Times(AtLeast(1));
   }
 
-  scoped_ptr<base::MessageLoopForIO> message_loop_;
+  std::unique_ptr<base::MessageLoopForIO> message_loop_;
 
   NetworkSettings network_settings_;
 
-  scoped_ptr<FakeSignalStrategy> host_signal_strategy_;
-  scoped_ptr<FakeSignalStrategy> client_signal_strategy_;
+  std::unique_ptr<FakeSignalStrategy> host_signal_strategy_;
+  std::unique_ptr<FakeSignalStrategy> client_signal_strategy_;
 
-  scoped_ptr<JingleSessionManager> host_server_;
+  std::unique_ptr<JingleSessionManager> host_server_;
   MockSessionManagerListener host_server_listener_;
-  scoped_ptr<JingleSessionManager> client_server_;
+  std::unique_ptr<JingleSessionManager> client_server_;
 
-  scoped_ptr<Session> host_session_;
+  std::unique_ptr<Session> host_session_;
   MockSessionEventHandler host_session_event_handler_;
   MockTransport host_transport_;
-  scoped_ptr<Session> client_session_;
+  std::unique_ptr<Session> client_session_;
   MockSessionEventHandler client_session_event_handler_;
   MockTransport client_transport_;
 };
@@ -260,7 +260,7 @@
         .Times(1);
   }
 
-  scoped_ptr<Authenticator> authenticator(new FakeAuthenticator(
+  std::unique_ptr<Authenticator> authenticator(new FakeAuthenticator(
       FakeAuthenticator::CLIENT, 1, FakeAuthenticator::ACCEPT, true));
   client_session_ = client_server_->Connect(kHostJid, std::move(authenticator));
   client_session_->SetEventHandler(&client_session_event_handler_);
@@ -312,10 +312,10 @@
               OnSessionStateChange(Session::FAILED))
       .Times(1);
 
-  scoped_ptr<Authenticator> authenticator(new FakeAuthenticator(
+  std::unique_ptr<Authenticator> authenticator(new FakeAuthenticator(
       FakeAuthenticator::CLIENT, 1, FakeAuthenticator::ACCEPT, true));
 
-  scoped_ptr<CandidateSessionConfig> config =
+  std::unique_ptr<CandidateSessionConfig> config =
       CandidateSessionConfig::CreateDefault();
   // Disable all video codecs so the host will reject connection.
   config->mutable_video_configs()->clear();
@@ -339,10 +339,10 @@
               OnSessionStateChange(Session::FAILED))
       .Times(1);
 
-  scoped_ptr<Authenticator> authenticator(new FakeAuthenticator(
+  std::unique_ptr<Authenticator> authenticator(new FakeAuthenticator(
       FakeAuthenticator::CLIENT, 1, FakeAuthenticator::ACCEPT, true));
 
-  scoped_ptr<CandidateSessionConfig> config =
+  std::unique_ptr<CandidateSessionConfig> config =
       CandidateSessionConfig::CreateDefault();
   config->set_ice_supported(false);
   client_server_->set_protocol_config(std::move(config));
@@ -371,7 +371,7 @@
       OnSessionStateChange(Session::AUTHENTICATING))
       .WillOnce(InvokeWithoutArgs(this, &JingleSessionTest::DeleteSession));
 
-  scoped_ptr<Authenticator> authenticator(new FakeAuthenticator(
+  std::unique_ptr<Authenticator> authenticator(new FakeAuthenticator(
       FakeAuthenticator::CLIENT, 3, FakeAuthenticator::ACCEPT, true));
 
   client_session_ = client_server_->Connect(kHostJid, std::move(authenticator));
@@ -398,7 +398,7 @@
       OnSessionStateChange(Session::AUTHENTICATING))
       .WillOnce(InvokeWithoutArgs(this, &JingleSessionTest::DeleteSession));
 
-  scoped_ptr<Authenticator> authenticator(new FakeAuthenticator(
+  std::unique_ptr<Authenticator> authenticator(new FakeAuthenticator(
       FakeAuthenticator::CLIENT, 3, FakeAuthenticator::ACCEPT, true));
 
   client_session_ = client_server_->Connect(kHostJid, std::move(authenticator));
diff --git a/remoting/protocol/me2me_host_authenticator_factory.cc b/remoting/protocol/me2me_host_authenticator_factory.cc
index 32281af..18f9994 100644
--- a/remoting/protocol/me2me_host_authenticator_factory.cc
+++ b/remoting/protocol/me2me_host_authenticator_factory.cc
@@ -7,6 +7,7 @@
 #include <utility>
 
 #include "base/base64.h"
+#include "base/memory/ptr_util.h"
 #include "base/strings/string_util.h"
 #include "remoting/base/rsa_key_pair.h"
 #include "remoting/protocol/channel_authenticator.h"
@@ -20,7 +21,8 @@
 namespace protocol {
 
 // static
-scoped_ptr<AuthenticatorFactory> Me2MeHostAuthenticatorFactory::CreateWithPin(
+std::unique_ptr<AuthenticatorFactory>
+Me2MeHostAuthenticatorFactory::CreateWithPin(
     bool use_service_account,
     const std::string& host_owner,
     const std::string& local_cert,
@@ -28,7 +30,7 @@
     const std::string& required_client_domain,
     const std::string& pin_hash,
     scoped_refptr<PairingRegistry> pairing_registry) {
-  scoped_ptr<Me2MeHostAuthenticatorFactory> result(
+  std::unique_ptr<Me2MeHostAuthenticatorFactory> result(
       new Me2MeHostAuthenticatorFactory());
   result->use_service_account_ = use_service_account;
   result->host_owner_ = host_owner;
@@ -42,7 +44,7 @@
 
 
 // static
-scoped_ptr<AuthenticatorFactory>
+std::unique_ptr<AuthenticatorFactory>
 Me2MeHostAuthenticatorFactory::CreateWithThirdPartyAuth(
     bool use_service_account,
     const std::string& host_owner,
@@ -50,7 +52,7 @@
     scoped_refptr<RsaKeyPair> key_pair,
     const std::string& required_client_domain,
     scoped_refptr<TokenValidatorFactory> token_validator_factory) {
-  scoped_ptr<Me2MeHostAuthenticatorFactory> result(
+  std::unique_ptr<Me2MeHostAuthenticatorFactory> result(
       new Me2MeHostAuthenticatorFactory());
   result->use_service_account_ = use_service_account;
   result->host_owner_ = host_owner;
@@ -65,10 +67,10 @@
 
 Me2MeHostAuthenticatorFactory::~Me2MeHostAuthenticatorFactory() {}
 
-scoped_ptr<Authenticator> Me2MeHostAuthenticatorFactory::CreateAuthenticator(
+std::unique_ptr<Authenticator>
+Me2MeHostAuthenticatorFactory::CreateAuthenticator(
     const std::string& local_jid,
     const std::string& remote_jid) {
-
   std::string remote_jid_prefix;
 
   if (!use_service_account_) {
@@ -78,7 +80,7 @@
     // account will have the same prefix.
     if (!SplitJidResource(local_jid, &remote_jid_prefix, nullptr)) {
       LOG(DFATAL) << "Invalid local JID:" << local_jid;
-      return make_scoped_ptr(
+      return base::WrapUnique(
           new RejectingAuthenticator(Authenticator::INVALID_CREDENTIALS));
     }
   } else {
@@ -94,7 +96,7 @@
                         base::CompareCase::INSENSITIVE_ASCII)) {
     LOG(ERROR) << "Rejecting incoming connection from " << remote_jid
                << ": Prefix mismatch.";
-    return make_scoped_ptr(
+    return base::WrapUnique(
         new RejectingAuthenticator(Authenticator::INVALID_CREDENTIALS));
   }
 
@@ -110,7 +112,7 @@
                         base::CompareCase::INSENSITIVE_ASCII)) {
       LOG(ERROR) << "Rejecting incoming connection from " << remote_jid
                  << ": Domain mismatch.";
-      return make_scoped_ptr(
+      return base::WrapUnique(
           new RejectingAuthenticator(Authenticator::INVALID_CREDENTIALS));
     }
   }
@@ -130,7 +132,7 @@
         pin_hash_, pairing_registry_);
   }
 
-  return make_scoped_ptr(
+  return base::WrapUnique(
       new RejectingAuthenticator(Authenticator::INVALID_CREDENTIALS));
 }
 
diff --git a/remoting/protocol/me2me_host_authenticator_factory.h b/remoting/protocol/me2me_host_authenticator_factory.h
index 6515ba8e..e081ba8 100644
--- a/remoting/protocol/me2me_host_authenticator_factory.h
+++ b/remoting/protocol/me2me_host_authenticator_factory.h
@@ -5,12 +5,12 @@
 #ifndef REMOTING_PROTOCOL_ME2ME_HOST_AUTHENTICATOR_FACTORY_H_
 #define REMOTING_PROTOCOL_ME2ME_HOST_AUTHENTICATOR_FACTORY_H_
 
+#include <memory>
 #include <string>
 
 #include "base/compiler_specific.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "remoting/protocol/authenticator.h"
 #include "remoting/protocol/third_party_host_authenticator.h"
 #include "remoting/protocol/token_validator.h"
@@ -26,7 +26,7 @@
 class Me2MeHostAuthenticatorFactory : public AuthenticatorFactory {
  public:
   // Create a factory that dispenses shared secret authenticators.
-  static scoped_ptr<AuthenticatorFactory> CreateWithPin(
+  static std::unique_ptr<AuthenticatorFactory> CreateWithPin(
       bool use_service_account,
       const std::string& host_owner,
       const std::string& local_cert,
@@ -36,7 +36,7 @@
       scoped_refptr<PairingRegistry> pairing_registry);
 
   // Create a factory that dispenses third party authenticators.
-  static scoped_ptr<AuthenticatorFactory> CreateWithThirdPartyAuth(
+  static std::unique_ptr<AuthenticatorFactory> CreateWithThirdPartyAuth(
       bool use_service_account,
       const std::string& host_owner,
       const std::string& local_cert,
@@ -48,7 +48,7 @@
   ~Me2MeHostAuthenticatorFactory() override;
 
   // AuthenticatorFactory interface.
-  scoped_ptr<Authenticator> CreateAuthenticator(
+  std::unique_ptr<Authenticator> CreateAuthenticator(
       const std::string& local_jid,
       const std::string& remote_jid) override;
 
diff --git a/remoting/protocol/message_channel_factory.h b/remoting/protocol/message_channel_factory.h
index 43079149..a9ecc44b 100644
--- a/remoting/protocol/message_channel_factory.h
+++ b/remoting/protocol/message_channel_factory.h
@@ -5,10 +5,10 @@
 #ifndef REMOTING_PROTOCOL_MESSAGE_CHANNEL_FACTORY_H_
 #define REMOTING_PROTOCOL_MESSAGE_CHANNEL_FACTORY_H_
 
+#include <memory>
 #include <string>
 
 #include "base/callback_forward.h"
-#include "base/memory/scoped_ptr.h"
 
 namespace remoting {
 namespace protocol {
@@ -17,7 +17,8 @@
 
 class MessageChannelFactory {
  public:
-  typedef base::Callback<void(scoped_ptr<MessagePipe>)> ChannelCreatedCallback;
+  typedef base::Callback<void(std::unique_ptr<MessagePipe>)>
+      ChannelCreatedCallback;
 
   virtual ~MessageChannelFactory() {}
 
diff --git a/remoting/protocol/message_decoder_unittest.cc b/remoting/protocol/message_decoder_unittest.cc
index 44c7764..25f05b8 100644
--- a/remoting/protocol/message_decoder_unittest.cc
+++ b/remoting/protocol/message_decoder_unittest.cc
@@ -2,17 +2,18 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "remoting/protocol/message_decoder.h"
+
 #include <stdint.h>
 
+#include <memory>
 #include <string>
 
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/stl_util.h"
 #include "base/strings/string_number_conversions.h"
 #include "remoting/proto/event.pb.h"
 #include "remoting/proto/internal.pb.h"
-#include "remoting/protocol/message_decoder.h"
 #include "remoting/protocol/message_serialization.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
@@ -53,7 +54,7 @@
   int size;
   uint8_t* test_data;
   PrepareData(&test_data, &size);
-  scoped_ptr<uint8_t[]> memory_deleter(test_data);
+  std::unique_ptr<uint8_t[]> memory_deleter(test_data);
 
   // Then simulate using MessageDecoder to decode variable
   // size of encoded data.
@@ -75,7 +76,7 @@
     memcpy(buffer->data(), test_data + pos, read);
     decoder.AddData(buffer, read);
     while (true) {
-      scoped_ptr<CompoundBuffer> message(decoder.GetNextMessage());
+      std::unique_ptr<CompoundBuffer> message(decoder.GetNextMessage());
       if (!message.get())
         break;
 
diff --git a/remoting/protocol/message_pipe.h b/remoting/protocol/message_pipe.h
index 107a510..6d8eeeb 100644
--- a/remoting/protocol/message_pipe.h
+++ b/remoting/protocol/message_pipe.h
@@ -5,8 +5,9 @@
 #ifndef REMOTING_PROTOCOL_MESSAGE_PIPE_H_
 #define REMOTING_PROTOCOL_MESSAGE_PIPE_H_
 
+#include <memory>
+
 #include "base/callback_forward.h"
-#include "base/memory/scoped_ptr.h"
 
 namespace google {
 namespace protobuf {
@@ -23,7 +24,7 @@
 // Represents a bi-directional pipe that allows to send and receive messages.
 class MessagePipe {
  public:
-  typedef base::Callback<void(scoped_ptr<CompoundBuffer> message)>
+  typedef base::Callback<void(std::unique_ptr<CompoundBuffer> message)>
       MessageReceivedCallback;
 
   virtual ~MessagePipe() {}
diff --git a/remoting/protocol/message_reader.cc b/remoting/protocol/message_reader.cc
index 3516595e..fb34001 100644
--- a/remoting/protocol/message_reader.cc
+++ b/remoting/protocol/message_reader.cc
@@ -10,8 +10,9 @@
 #include "base/callback.h"
 #include "base/compiler_specific.h"
 #include "base/location.h"
-#include "base/thread_task_runner_handle.h"
+#include "base/memory/ptr_util.h"
 #include "base/single_thread_task_runner.h"
+#include "base/thread_task_runner_handle.h"
 #include "net/base/io_buffer.h"
 #include "net/base/net_errors.h"
 #include "remoting/base/compound_buffer.h"
@@ -108,11 +109,11 @@
     base::ThreadTaskRunnerHandle::Get()->PostTask(
         FROM_HERE,
         base::Bind(&MessageReader::RunCallback, weak_factory_.GetWeakPtr(),
-                   base::Passed(make_scoped_ptr(buffer))));
+                   base::Passed(base::WrapUnique(buffer))));
   }
 }
 
-void MessageReader::RunCallback(scoped_ptr<CompoundBuffer> message) {
+void MessageReader::RunCallback(std::unique_ptr<CompoundBuffer> message) {
   if (!message_received_callback_.is_null())
     message_received_callback_.Run(std::move(message));
 }
diff --git a/remoting/protocol/message_reader.h b/remoting/protocol/message_reader.h
index 4467e68..9114258 100644
--- a/remoting/protocol/message_reader.h
+++ b/remoting/protocol/message_reader.h
@@ -5,9 +5,10 @@
 #ifndef REMOTING_PROTOCOL_MESSAGE_READER_H_
 #define REMOTING_PROTOCOL_MESSAGE_READER_H_
 
+#include <memory>
+
 #include "base/callback.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/threading/non_thread_safe.h"
 #include "remoting/base/compound_buffer.h"
@@ -35,7 +36,7 @@
 // e.g. when we the sender sends multiple messages in one TCP packet.
 class MessageReader : public base::NonThreadSafe {
  public:
-  typedef base::Callback<void(scoped_ptr<CompoundBuffer> message)>
+  typedef base::Callback<void(std::unique_ptr<CompoundBuffer> message)>
       MessageReceivedCallback;
   typedef base::Callback<void(int)> ReadFailedCallback;
 
@@ -52,7 +53,7 @@
   void OnRead(int result);
   void HandleReadResult(int result, bool* read_succeeded);
   void OnDataReceived(net::IOBuffer* data, int data_size);
-  void RunCallback(scoped_ptr<CompoundBuffer> message);
+  void RunCallback(std::unique_ptr<CompoundBuffer> message);
 
   ReadFailedCallback read_failed_callback_;
 
diff --git a/remoting/protocol/message_reader_unittest.cc b/remoting/protocol/message_reader_unittest.cc
index 874fd71..5ac8a70d 100644
--- a/remoting/protocol/message_reader_unittest.cc
+++ b/remoting/protocol/message_reader_unittest.cc
@@ -77,13 +77,13 @@
     reader_.reset();
   }
 
-  void OnMessage(scoped_ptr<CompoundBuffer> buffer) {
+  void OnMessage(std::unique_ptr<CompoundBuffer> buffer) {
     messages_.push_back(buffer.release());
     callback_.OnMessage();
   }
 
   base::MessageLoop message_loop_;
-  scoped_ptr<MessageReader> reader_;
+  std::unique_ptr<MessageReader> reader_;
   FakeStreamSocket socket_;
   MockMessageReceivedCallback callback_;
   int read_error_ = 0;
diff --git a/remoting/protocol/message_serialization.h b/remoting/protocol/message_serialization.h
index 2a035ff5..cebc5aa 100644
--- a/remoting/protocol/message_serialization.h
+++ b/remoting/protocol/message_serialization.h
@@ -21,8 +21,8 @@
 namespace protocol {
 
 template <class T>
-scoped_ptr<T> ParseMessage(CompoundBuffer* buffer) {
-  scoped_ptr<T> message(new T());
+std::unique_ptr<T> ParseMessage(CompoundBuffer* buffer) {
+  std::unique_ptr<T> message(new T());
   CompoundBufferInputStream stream(buffer);
   if (!message->ParseFromZeroCopyStream(&stream)) {
     LOG(WARNING) << "Received message that is not a valid protocol buffer.";
diff --git a/remoting/protocol/monitored_video_stub.cc b/remoting/protocol/monitored_video_stub.cc
index 3975fc31..073d1c5 100644
--- a/remoting/protocol/monitored_video_stub.cc
+++ b/remoting/protocol/monitored_video_stub.cc
@@ -29,7 +29,7 @@
 MonitoredVideoStub::~MonitoredVideoStub() {
 }
 
-void MonitoredVideoStub::ProcessVideoPacket(scoped_ptr<VideoPacket> packet,
+void MonitoredVideoStub::ProcessVideoPacket(std::unique_ptr<VideoPacket> packet,
                                             const base::Closure& done) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
diff --git a/remoting/protocol/monitored_video_stub.h b/remoting/protocol/monitored_video_stub.h
index a451d987..39350c3 100644
--- a/remoting/protocol/monitored_video_stub.h
+++ b/remoting/protocol/monitored_video_stub.h
@@ -41,7 +41,7 @@
   ~MonitoredVideoStub() override;
 
   // VideoStub implementation.
-  void ProcessVideoPacket(scoped_ptr<VideoPacket> packet,
+  void ProcessVideoPacket(std::unique_ptr<VideoPacket> packet,
                           const base::Closure& done) override;
 
  private:
diff --git a/remoting/protocol/monitored_video_stub_unittest.cc b/remoting/protocol/monitored_video_stub_unittest.cc
index e695818..2b0499a 100644
--- a/remoting/protocol/monitored_video_stub_unittest.cc
+++ b/remoting/protocol/monitored_video_stub_unittest.cc
@@ -43,8 +43,8 @@
   base::MessageLoop message_loop_;
   MockVideoStub video_stub_;
 
-  scoped_ptr<MonitoredVideoStub> monitor_;
-  scoped_ptr<VideoPacket> packet_;
+  std::unique_ptr<MonitoredVideoStub> monitor_;
+  std::unique_ptr<VideoPacket> packet_;
   base::OneShotTimer timer_end_test_;
 };
 
diff --git a/remoting/protocol/negotiating_authenticator_base.cc b/remoting/protocol/negotiating_authenticator_base.cc
index 87970b42..d31ad57 100644
--- a/remoting/protocol/negotiating_authenticator_base.cc
+++ b/remoting/protocol/negotiating_authenticator_base.cc
@@ -127,12 +127,12 @@
   resume_callback.Run();
 }
 
-scoped_ptr<buzz::XmlElement>
+std::unique_ptr<buzz::XmlElement>
 NegotiatingAuthenticatorBase::GetNextMessageInternal() {
   DCHECK_EQ(state(), MESSAGE_READY);
   DCHECK(current_method_ != Method::INVALID);
 
-  scoped_ptr<buzz::XmlElement> result;
+  std::unique_ptr<buzz::XmlElement> result;
   if (current_authenticator_->state() == MESSAGE_READY) {
     result = current_authenticator_->GetNextMessage();
   } else {
@@ -154,7 +154,7 @@
   return current_authenticator_->GetAuthKey();
 }
 
-scoped_ptr<ChannelAuthenticator>
+std::unique_ptr<ChannelAuthenticator>
 NegotiatingAuthenticatorBase::CreateChannelAuthenticator() const {
   DCHECK_EQ(state(), ACCEPTED);
   return current_authenticator_->CreateChannelAuthenticator();
diff --git a/remoting/protocol/negotiating_authenticator_base.h b/remoting/protocol/negotiating_authenticator_base.h
index c76697e..b5ff31cd 100644
--- a/remoting/protocol/negotiating_authenticator_base.h
+++ b/remoting/protocol/negotiating_authenticator_base.h
@@ -5,13 +5,13 @@
 #ifndef REMOTING_PROTOCOL_NEGOTIATING_AUTHENTICATOR_BASE_H_
 #define REMOTING_PROTOCOL_NEGOTIATING_AUTHENTICATOR_BASE_H_
 
+#include <memory>
 #include <string>
 #include <vector>
 
 #include "base/gtest_prod_util.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "remoting/protocol/authenticator.h"
 
 namespace buzz {
@@ -90,7 +90,8 @@
   bool started() const override;
   RejectionReason rejection_reason() const override;
   const std::string& GetAuthKey() const override;
-  scoped_ptr<ChannelAuthenticator> CreateChannelAuthenticator() const override;
+  std::unique_ptr<ChannelAuthenticator> CreateChannelAuthenticator()
+      const override;
 
   // Calls |current_authenticator_| to process |message|, passing the supplied
   // |resume_callback|.
@@ -124,11 +125,11 @@
 
   // Gets the next message from |current_authenticator_|, if any, and fills in
   // the 'method' tag with |current_method_|.
-  virtual scoped_ptr<buzz::XmlElement> GetNextMessageInternal();
+  virtual std::unique_ptr<buzz::XmlElement> GetNextMessageInternal();
 
   std::vector<Method> methods_;
   Method current_method_ = Method::INVALID;
-  scoped_ptr<Authenticator> current_authenticator_;
+  std::unique_ptr<Authenticator> current_authenticator_;
   State state_;
   RejectionReason rejection_reason_ = INVALID_CREDENTIALS;
 
diff --git a/remoting/protocol/negotiating_authenticator_unittest.cc b/remoting/protocol/negotiating_authenticator_unittest.cc
index cfa0a86..a83e80b8 100644
--- a/remoting/protocol/negotiating_authenticator_unittest.cc
+++ b/remoting/protocol/negotiating_authenticator_unittest.cc
@@ -4,6 +4,7 @@
 
 #include "base/bind.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "net/base/net_errors.h"
 #include "remoting/base/rsa_key_pair.h"
 #include "remoting/protocol/auth_util.h"
@@ -59,7 +60,7 @@
                                   const std::string& host_secret) {
     std::string host_secret_hash =
         GetSharedSecretHash(kTestHostId, host_secret);
-    scoped_ptr<NegotiatingHostAuthenticator> host =
+    std::unique_ptr<NegotiatingHostAuthenticator> host =
         NegotiatingHostAuthenticator::CreateWithSharedSecret(
             kHostJid, kClientJid, host_cert_, key_pair_, host_secret_hash,
             pairing_registry_);
@@ -95,7 +96,7 @@
 
   void CreatePairingRegistry(bool with_paired_client) {
     pairing_registry_ = new SynchronousPairingRegistry(
-        make_scoped_ptr(new MockPairingRegistryDelegate()));
+        base::WrapUnique(new MockPairingRegistryDelegate()));
     if (with_paired_client) {
       PairingRegistry::Pairing pairing(
           base::Time(), kTestClientName, kTestClientId, kTestPairedSecret);
diff --git a/remoting/protocol/negotiating_client_authenticator.cc b/remoting/protocol/negotiating_client_authenticator.cc
index ab4bd777..fc19c39 100644
--- a/remoting/protocol/negotiating_client_authenticator.cc
+++ b/remoting/protocol/negotiating_client_authenticator.cc
@@ -11,6 +11,7 @@
 #include "base/bind.h"
 #include "base/callback.h"
 #include "base/logging.h"
+#include "base/memory/ptr_util.h"
 #include "base/strings/string_split.h"
 #include "remoting/protocol/auth_util.h"
 #include "remoting/protocol/channel_authenticator.h"
@@ -80,14 +81,15 @@
   ProcessMessageInternal(message, resume_callback);
 }
 
-scoped_ptr<buzz::XmlElement> NegotiatingClientAuthenticator::GetNextMessage() {
+std::unique_ptr<buzz::XmlElement>
+NegotiatingClientAuthenticator::GetNextMessage() {
   DCHECK_EQ(state(), MESSAGE_READY);
 
   // This is the first message to the host, send a list of supported methods.
   if (current_method_ == Method::INVALID) {
     // If no authentication method has been chosen, see if we can optimistically
     // choose one.
-    scoped_ptr<buzz::XmlElement> result;
+    std::unique_ptr<buzz::XmlElement> result;
     CreatePreferredAuthenticator();
     if (current_authenticator_) {
       DCHECK(current_authenticator_->state() == MESSAGE_READY);
@@ -147,7 +149,7 @@
       PairingClientAuthenticator* pairing_authenticator =
           new PairingClientAuthenticator(
               config_, base::Bind(&V2Authenticator::CreateForClient));
-      current_authenticator_ = make_scoped_ptr(pairing_authenticator);
+      current_authenticator_ = base::WrapUnique(pairing_authenticator);
       pairing_authenticator->Start(preferred_initial_state, resume_callback);
       break;
     }
@@ -157,7 +159,7 @@
           new PairingClientAuthenticator(
               config_, base::Bind(&Spake2Authenticator::CreateForClient,
                                   local_id_, remote_id_));
-      current_authenticator_ = make_scoped_ptr(pairing_authenticator);
+      current_authenticator_ = base::WrapUnique(pairing_authenticator);
       pairing_authenticator->Start(preferred_initial_state, resume_callback);
       break;
     }
@@ -181,7 +183,7 @@
     PairingClientAuthenticator* pairing_authenticator =
         new PairingClientAuthenticator(
             config_, base::Bind(&V2Authenticator::CreateForClient));
-    current_authenticator_ = make_scoped_ptr(pairing_authenticator);
+    current_authenticator_ = base::WrapUnique(pairing_authenticator);
     pairing_authenticator->StartPaired(MESSAGE_READY);
     current_method_ = Method::PAIRED_SPAKE2_P224;
   }
diff --git a/remoting/protocol/negotiating_client_authenticator.h b/remoting/protocol/negotiating_client_authenticator.h
index 9688dcde..d0013e2b 100644
--- a/remoting/protocol/negotiating_client_authenticator.h
+++ b/remoting/protocol/negotiating_client_authenticator.h
@@ -5,11 +5,11 @@
 #ifndef REMOTING_PROTOCOL_NEGOTIATING_CLIENT_AUTHENTICATOR_H_
 #define REMOTING_PROTOCOL_NEGOTIATING_CLIENT_AUTHENTICATOR_H_
 
+#include <memory>
 #include <string>
 #include <vector>
 
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "remoting/protocol/authenticator.h"
 #include "remoting/protocol/client_authentication_config.h"
@@ -32,7 +32,7 @@
   // Overriden from Authenticator.
   void ProcessMessage(const buzz::XmlElement* message,
                       const base::Closure& resume_callback) override;
-  scoped_ptr<buzz::XmlElement> GetNextMessage() override;
+  std::unique_ptr<buzz::XmlElement> GetNextMessage() override;
 
  private:
   // (Asynchronously) creates an authenticator, and stores it in
diff --git a/remoting/protocol/negotiating_host_authenticator.cc b/remoting/protocol/negotiating_host_authenticator.cc
index 2d4269b..fe81133 100644
--- a/remoting/protocol/negotiating_host_authenticator.cc
+++ b/remoting/protocol/negotiating_host_authenticator.cc
@@ -36,7 +36,7 @@
       local_key_pair_(key_pair) {}
 
 // static
-scoped_ptr<NegotiatingHostAuthenticator>
+std::unique_ptr<NegotiatingHostAuthenticator>
 NegotiatingHostAuthenticator::CreateWithSharedSecret(
     const std::string& local_id,
     const std::string& remote_id,
@@ -44,7 +44,7 @@
     scoped_refptr<RsaKeyPair> key_pair,
     const std::string& shared_secret_hash,
     scoped_refptr<PairingRegistry> pairing_registry) {
-  scoped_ptr<NegotiatingHostAuthenticator> result(
+  std::unique_ptr<NegotiatingHostAuthenticator> result(
       new NegotiatingHostAuthenticator(local_id, remote_id, local_cert,
                                        key_pair));
   result->shared_secret_hash_ = shared_secret_hash;
@@ -59,14 +59,14 @@
 }
 
 // static
-scoped_ptr<NegotiatingHostAuthenticator>
+std::unique_ptr<NegotiatingHostAuthenticator>
 NegotiatingHostAuthenticator::CreateWithThirdPartyAuth(
     const std::string& local_id,
     const std::string& remote_id,
     const std::string& local_cert,
     scoped_refptr<RsaKeyPair> key_pair,
     scoped_refptr<TokenValidatorFactory> token_validator_factory) {
-  scoped_ptr<NegotiatingHostAuthenticator> result(
+  std::unique_ptr<NegotiatingHostAuthenticator> result(
       new NegotiatingHostAuthenticator(local_id, remote_id, local_cert,
                                        key_pair));
   result->token_validator_factory_ = token_validator_factory;
@@ -166,7 +166,8 @@
   ProcessMessageInternal(message, resume_callback);
 }
 
-scoped_ptr<buzz::XmlElement> NegotiatingHostAuthenticator::GetNextMessage() {
+std::unique_ptr<buzz::XmlElement>
+NegotiatingHostAuthenticator::GetNextMessage() {
   return GetNextMessageInternal();
 }
 
diff --git a/remoting/protocol/negotiating_host_authenticator.h b/remoting/protocol/negotiating_host_authenticator.h
index 8471d2d..42b0d5cf4 100644
--- a/remoting/protocol/negotiating_host_authenticator.h
+++ b/remoting/protocol/negotiating_host_authenticator.h
@@ -5,12 +5,12 @@
 #ifndef REMOTING_PROTOCOL_NEGOTIATING_HOST_AUTHENTICATOR_H_
 #define REMOTING_PROTOCOL_NEGOTIATING_HOST_AUTHENTICATOR_H_
 
+#include <memory>
 #include <string>
 #include <vector>
 
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "remoting/protocol/authenticator.h"
 #include "remoting/protocol/negotiating_authenticator_base.h"
 #include "remoting/protocol/pairing_registry.h"
@@ -33,7 +33,7 @@
   // Creates a host authenticator, using a PIN or access code. If
   // |pairing_registry| is non-nullptr then the paired methods will be offered,
   // supporting PIN-less authentication.
-  static scoped_ptr<NegotiatingHostAuthenticator> CreateWithSharedSecret(
+  static std::unique_ptr<NegotiatingHostAuthenticator> CreateWithSharedSecret(
       const std::string& local_id,
       const std::string& remote_id,
       const std::string& local_cert,
@@ -42,7 +42,7 @@
       scoped_refptr<PairingRegistry> pairing_registry);
 
   // Creates a host authenticator, using third party authentication.
-  static scoped_ptr<NegotiatingHostAuthenticator> CreateWithThirdPartyAuth(
+  static std::unique_ptr<NegotiatingHostAuthenticator> CreateWithThirdPartyAuth(
       const std::string& local_id,
       const std::string& remote_id,
       const std::string& local_cert,
@@ -52,7 +52,7 @@
   // Overriden from Authenticator.
   void ProcessMessage(const buzz::XmlElement* message,
                       const base::Closure& resume_callback) override;
-  scoped_ptr<buzz::XmlElement> GetNextMessage() override;
+  std::unique_ptr<buzz::XmlElement> GetNextMessage() override;
 
  private:
   NegotiatingHostAuthenticator(const std::string& local_id,
diff --git a/remoting/protocol/pairing_authenticator_base.cc b/remoting/protocol/pairing_authenticator_base.cc
index 4adc6ee..e622689 100644
--- a/remoting/protocol/pairing_authenticator_base.cc
+++ b/remoting/protocol/pairing_authenticator_base.cc
@@ -74,9 +74,10 @@
                  weak_factory_.GetWeakPtr(), resume_callback));
 }
 
-scoped_ptr<buzz::XmlElement> PairingAuthenticatorBase::GetNextMessage() {
+std::unique_ptr<buzz::XmlElement> PairingAuthenticatorBase::GetNextMessage() {
   DCHECK_EQ(state(), MESSAGE_READY);
-  scoped_ptr<buzz::XmlElement> result = spake2_authenticator_->GetNextMessage();
+  std::unique_ptr<buzz::XmlElement> result =
+      spake2_authenticator_->GetNextMessage();
   MaybeAddErrorMessage(result.get());
   return result;
 }
@@ -85,7 +86,7 @@
   return spake2_authenticator_->GetAuthKey();
 }
 
-scoped_ptr<ChannelAuthenticator>
+std::unique_ptr<ChannelAuthenticator>
 PairingAuthenticatorBase::CreateChannelAuthenticator() const {
   return spake2_authenticator_->CreateChannelAuthenticator();
 }
diff --git a/remoting/protocol/pairing_authenticator_base.h b/remoting/protocol/pairing_authenticator_base.h
index 1b3104e..f1ccb3b2 100644
--- a/remoting/protocol/pairing_authenticator_base.h
+++ b/remoting/protocol/pairing_authenticator_base.h
@@ -48,9 +48,10 @@
   RejectionReason rejection_reason() const override;
   void ProcessMessage(const buzz::XmlElement* message,
                       const base::Closure& resume_callback) override;
-  scoped_ptr<buzz::XmlElement> GetNextMessage() override;
+  std::unique_ptr<buzz::XmlElement> GetNextMessage() override;
   const std::string& GetAuthKey() const override;
-  scoped_ptr<ChannelAuthenticator> CreateChannelAuthenticator() const override;
+  std::unique_ptr<ChannelAuthenticator> CreateChannelAuthenticator()
+      const override;
 
  protected:
   // Create a Spake2 authenticator in the specified state, prompting the user
@@ -67,7 +68,7 @@
 
   // The underlying SPAKE2 authenticator, created with either the PIN or the
   // Paired Secret by the derived class.
-  scoped_ptr<Authenticator> spake2_authenticator_;
+  std::unique_ptr<Authenticator> spake2_authenticator_;
 
   // Derived classes must set this to True if the underlying authenticator is
   // using the Paired Secret.
diff --git a/remoting/protocol/pairing_registry.cc b/remoting/protocol/pairing_registry.cc
index f6ba2d5..54cf78ac 100644
--- a/remoting/protocol/pairing_registry.cc
+++ b/remoting/protocol/pairing_registry.cc
@@ -79,8 +79,9 @@
   return Pairing();
 }
 
-scoped_ptr<base::DictionaryValue> PairingRegistry::Pairing::ToValue() const {
-  scoped_ptr<base::DictionaryValue> pairing(new base::DictionaryValue());
+std::unique_ptr<base::DictionaryValue> PairingRegistry::Pairing::ToValue()
+    const {
+  std::unique_ptr<base::DictionaryValue> pairing(new base::DictionaryValue());
   pairing->SetDouble(kCreatedTimeKey, created_time().ToJsTime());
   pairing->SetString(kClientNameKey, client_name());
   pairing->SetString(kClientIdKey, client_id());
@@ -104,7 +105,7 @@
 
 PairingRegistry::PairingRegistry(
     scoped_refptr<base::SingleThreadTaskRunner> delegate_task_runner,
-    scoped_ptr<Delegate> delegate)
+    std::unique_ptr<Delegate> delegate)
     : caller_task_runner_(base::ThreadTaskRunnerHandle::Get()),
       delegate_task_runner_(delegate_task_runner),
       delegate_(std::move(delegate)) {
@@ -194,7 +195,7 @@
     const protocol::PairingRegistry::GetAllPairingsCallback& callback) {
   DCHECK(delegate_task_runner_->BelongsToCurrentThread());
 
-  scoped_ptr<base::ListValue> pairings = delegate_->LoadAll();
+  std::unique_ptr<base::ListValue> pairings = delegate_->LoadAll();
   PostTask(caller_task_runner_, FROM_HERE, base::Bind(callback,
                                                       base::Passed(&pairings)));
 }
@@ -253,17 +254,18 @@
 
 void PairingRegistry::InvokeGetAllPairingsCallbackAndScheduleNext(
     const GetAllPairingsCallback& callback,
-    scoped_ptr<base::ListValue> pairings) {
+    std::unique_ptr<base::ListValue> pairings) {
   callback.Run(std::move(pairings));
   pending_requests_.pop();
   ServiceNextRequest();
 }
 
-void PairingRegistry::SanitizePairings(const GetAllPairingsCallback& callback,
-                                       scoped_ptr<base::ListValue> pairings) {
+void PairingRegistry::SanitizePairings(
+    const GetAllPairingsCallback& callback,
+    std::unique_ptr<base::ListValue> pairings) {
   DCHECK(caller_task_runner_->BelongsToCurrentThread());
 
-  scoped_ptr<base::ListValue> sanitized_pairings(new base::ListValue());
+  std::unique_ptr<base::ListValue> sanitized_pairings(new base::ListValue());
   for (size_t i = 0; i < pairings->GetSize(); ++i) {
     base::DictionaryValue* pairing_json;
     if (!pairings->GetDictionary(i, &pairing_json)) {
diff --git a/remoting/protocol/pairing_registry.h b/remoting/protocol/pairing_registry.h
index b34404e1..b9b2e5e26 100644
--- a/remoting/protocol/pairing_registry.h
+++ b/remoting/protocol/pairing_registry.h
@@ -6,6 +6,7 @@
 #define REMOTING_PROTOCOL_PAIRING_REGISTRY_H_
 
 #include <map>
+#include <memory>
 #include <queue>
 #include <string>
 #include <vector>
@@ -14,7 +15,6 @@
 #include "base/gtest_prod_util.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/time/time.h"
 
 namespace base {
@@ -53,7 +53,7 @@
     static Pairing Create(const std::string& client_name);
     static Pairing CreateFromValue(const base::DictionaryValue& pairing);
 
-    scoped_ptr<base::DictionaryValue> ToValue() const;
+    std::unique_ptr<base::DictionaryValue> ToValue() const;
 
     bool operator==(const Pairing& other) const;
 
@@ -76,7 +76,7 @@
 
   // Delegate callbacks.
   typedef base::Callback<void(bool success)> DoneCallback;
-  typedef base::Callback<void(scoped_ptr<base::ListValue> pairings)>
+  typedef base::Callback<void(std::unique_ptr<base::ListValue> pairings)>
       GetAllPairingsCallback;
   typedef base::Callback<void(Pairing pairing)> GetPairingCallback;
 
@@ -91,7 +91,7 @@
     virtual ~Delegate() {}
 
     // Retrieves all JSON-encoded pairings from persistent storage.
-    virtual scoped_ptr<base::ListValue> LoadAll() = 0;
+    virtual std::unique_ptr<base::ListValue> LoadAll() = 0;
 
     // Deletes all pairings in persistent storage.
     virtual bool DeleteAll() = 0;
@@ -108,7 +108,7 @@
 
   PairingRegistry(
       scoped_refptr<base::SingleThreadTaskRunner> delegate_task_runner,
-      scoped_ptr<Delegate> delegate);
+      std::unique_ptr<Delegate> delegate);
 
   // Creates a pairing for a new client and saves it to disk.
   //
@@ -175,11 +175,11 @@
       const GetPairingCallback& callback, Pairing pairing);
   void InvokeGetAllPairingsCallbackAndScheduleNext(
       const GetAllPairingsCallback& callback,
-      scoped_ptr<base::ListValue> pairings);
+      std::unique_ptr<base::ListValue> pairings);
 
   // Sanitize |pairings| by parsing each entry and removing the secret from it.
   void SanitizePairings(const GetAllPairingsCallback& callback,
-                        scoped_ptr<base::ListValue> pairings);
+                        std::unique_ptr<base::ListValue> pairings);
 
   // Queue management methods.
   void ServiceOrQueueRequest(const base::Closure& request);
@@ -193,7 +193,7 @@
   // called at a time.
   scoped_refptr<base::SingleThreadTaskRunner> delegate_task_runner_;
 
-  scoped_ptr<Delegate> delegate_;
+  std::unique_ptr<Delegate> delegate_;
 
   std::queue<base::Closure> pending_requests_;
 
diff --git a/remoting/protocol/pairing_registry_unittest.cc b/remoting/protocol/pairing_registry_unittest.cc
index 4a9c501..94d4aa3 100644
--- a/remoting/protocol/pairing_registry_unittest.cc
+++ b/remoting/protocol/pairing_registry_unittest.cc
@@ -7,12 +7,13 @@
 #include <stdlib.h>
 
 #include <algorithm>
+#include <memory>
 #include <utility>
 
 #include "base/bind.h"
 #include "base/compiler_specific.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
 #include "base/thread_task_runner_handle.h"
@@ -36,7 +37,7 @@
   MOCK_METHOD1(GetAllPairingsCallbackPtr, void(base::ListValue*));
   MOCK_METHOD1(GetPairingCallback, void(PairingRegistry::Pairing));
 
-  void GetAllPairingsCallback(scoped_ptr<base::ListValue> pairings) {
+  void GetAllPairingsCallback(std::unique_ptr<base::ListValue> pairings) {
     GetAllPairingsCallbackPtr(pairings.get());
   }
 
@@ -66,7 +67,7 @@
  public:
   void SetUp() override { callback_count_ = 0; }
 
-  void set_pairings(scoped_ptr<base::ListValue> pairings) {
+  void set_pairings(std::unique_ptr<base::ListValue> pairings) {
     pairings_ = std::move(pairings);
   }
 
@@ -86,12 +87,12 @@
   base::RunLoop run_loop_;
 
   int callback_count_;
-  scoped_ptr<base::ListValue> pairings_;
+  std::unique_ptr<base::ListValue> pairings_;
 };
 
 TEST_F(PairingRegistryTest, CreateAndGetPairings) {
   scoped_refptr<PairingRegistry> registry = new SynchronousPairingRegistry(
-      make_scoped_ptr(new MockPairingRegistryDelegate()));
+      base::WrapUnique(new MockPairingRegistryDelegate()));
   PairingRegistry::Pairing pairing_1 = registry->CreatePairing("my_client");
   PairingRegistry::Pairing pairing_2 = registry->CreatePairing("my_client");
 
@@ -113,7 +114,7 @@
 
 TEST_F(PairingRegistryTest, GetAllPairings) {
   scoped_refptr<PairingRegistry> registry = new SynchronousPairingRegistry(
-      make_scoped_ptr(new MockPairingRegistryDelegate()));
+      base::WrapUnique(new MockPairingRegistryDelegate()));
   PairingRegistry::Pairing pairing_1 = registry->CreatePairing("client1");
   PairingRegistry::Pairing pairing_2 = registry->CreatePairing("client2");
 
@@ -141,7 +142,7 @@
 
 TEST_F(PairingRegistryTest, DeletePairing) {
   scoped_refptr<PairingRegistry> registry = new SynchronousPairingRegistry(
-      make_scoped_ptr(new MockPairingRegistryDelegate()));
+      base::WrapUnique(new MockPairingRegistryDelegate()));
   PairingRegistry::Pairing pairing_1 = registry->CreatePairing("client1");
   PairingRegistry::Pairing pairing_2 = registry->CreatePairing("client2");
 
@@ -166,7 +167,7 @@
 
 TEST_F(PairingRegistryTest, ClearAllPairings) {
   scoped_refptr<PairingRegistry> registry = new SynchronousPairingRegistry(
-      make_scoped_ptr(new MockPairingRegistryDelegate()));
+      base::WrapUnique(new MockPairingRegistryDelegate()));
   PairingRegistry::Pairing pairing_1 = registry->CreatePairing("client1");
   PairingRegistry::Pairing pairing_2 = registry->CreatePairing("client2");
 
@@ -215,9 +216,9 @@
       .InSequence(s)
       .WillOnce(QuitMessageLoop(run_loop_.QuitClosure()));
 
-  scoped_refptr<PairingRegistry> registry = new PairingRegistry(
-      base::ThreadTaskRunnerHandle::Get(),
-      make_scoped_ptr(new MockPairingRegistryDelegate()));
+  scoped_refptr<PairingRegistry> registry =
+      new PairingRegistry(base::ThreadTaskRunnerHandle::Get(),
+                          base::WrapUnique(new MockPairingRegistryDelegate()));
   PairingRegistry::Pairing pairing_1 = registry->CreatePairing("client1");
   PairingRegistry::Pairing pairing_2 = registry->CreatePairing("client2");
   registry->GetPairing(
diff --git a/remoting/protocol/port_allocator.cc b/remoting/protocol/port_allocator.cc
index 3f6684a..5a06668 100644
--- a/remoting/protocol/port_allocator.cc
+++ b/remoting/protocol/port_allocator.cc
@@ -41,8 +41,8 @@
 namespace protocol {
 
 PortAllocator::PortAllocator(
-    scoped_ptr<rtc::NetworkManager> network_manager,
-    scoped_ptr<rtc::PacketSocketFactory> socket_factory,
+    std::unique_ptr<rtc::NetworkManager> network_manager,
+    std::unique_ptr<rtc::PacketSocketFactory> socket_factory,
     scoped_refptr<TransportContext> transport_context)
     : BasicPortAllocator(network_manager.get(), socket_factory.get()),
       network_manager_(std::move(network_manager)),
@@ -110,14 +110,14 @@
   }
 }
 
-scoped_ptr<cricket::PortConfiguration>
+std::unique_ptr<cricket::PortConfiguration>
 PortAllocatorSession::GetPortConfiguration() {
   cricket::ServerAddresses stun_servers;
   for (const auto& host : ice_config_.stun_servers) {
     stun_servers.insert(host);
   }
 
-  scoped_ptr<cricket::PortConfiguration> config(
+  std::unique_ptr<cricket::PortConfiguration> config(
       new cricket::PortConfiguration(stun_servers, username(), password()));
 
   if (relay_enabled()) {
@@ -150,7 +150,7 @@
                     net::EscapeUrlEncodedData(username(), false) +
                     "&password=" +
                     net::EscapeUrlEncodedData(password(), false) + "&sn=1";
-  scoped_ptr<UrlRequest> url_request =
+  std::unique_ptr<UrlRequest> url_request =
       transport_context_->url_request_factory()->CreateUrlRequest(
           UrlRequest::Type::GET, url);
   url_request->AddHeader("X-Talk-Google-Relay-Auth: " +
@@ -180,7 +180,7 @@
     LOG(WARNING) << "Received unexpected password value from relay server.";
   }
 
-  scoped_ptr<cricket::PortConfiguration> config = GetPortConfiguration();
+  std::unique_ptr<cricket::PortConfiguration> config = GetPortConfiguration();
 
   std::string relay_ip = map["relay.ip"];
   std::string relay_port = map["relay.udp_port"];
diff --git a/remoting/protocol/port_allocator.h b/remoting/protocol/port_allocator.h
index bf0ebff..27606ee 100644
--- a/remoting/protocol/port_allocator.h
+++ b/remoting/protocol/port_allocator.h
@@ -19,8 +19,8 @@
 
 class PortAllocator : public cricket::BasicPortAllocator {
  public:
-  PortAllocator(scoped_ptr<rtc::NetworkManager> network_manager,
-                scoped_ptr<rtc::PacketSocketFactory> socket_factory,
+  PortAllocator(std::unique_ptr<rtc::NetworkManager> network_manager,
+                std::unique_ptr<rtc::PacketSocketFactory> socket_factory,
                 scoped_refptr<TransportContext> transport_context);
   ~PortAllocator() override;
 
@@ -35,8 +35,8 @@
       const std::string& ice_pwd) override;
 
  private:
-  scoped_ptr<rtc::NetworkManager> network_manager_;
-  scoped_ptr<rtc::PacketSocketFactory> socket_factory_;
+  std::unique_ptr<rtc::NetworkManager> network_manager_;
+  std::unique_ptr<rtc::PacketSocketFactory> socket_factory_;
   scoped_refptr<TransportContext> transport_context_;
 };
 
@@ -62,7 +62,7 @@
 
   // Creates PortConfiguration that inclues STUN and TURN servers from
   // |ice_config_|.
-  scoped_ptr<cricket::PortConfiguration> GetPortConfiguration();
+  std::unique_ptr<cricket::PortConfiguration> GetPortConfiguration();
 
   // Attempts to allocate relay session.
   void TryCreateRelaySession();
@@ -76,7 +76,7 @@
 
   int attempts_ = 0;
 
-  std::set<scoped_ptr<UrlRequest>> url_requests_;
+  std::set<std::unique_ptr<UrlRequest>> url_requests_;
 
   base::WeakPtrFactory<PortAllocatorSession> weak_factory_;
 };
diff --git a/remoting/protocol/port_allocator_factory.h b/remoting/protocol/port_allocator_factory.h
index 830cd923..d15b34c 100644
--- a/remoting/protocol/port_allocator_factory.h
+++ b/remoting/protocol/port_allocator_factory.h
@@ -5,8 +5,9 @@
 #ifndef REMOTING_PROTOCOL_PORT_ALLOCATOR_FACTORY_H_
 #define REMOTING_PROTOCOL_PORT_ALLOCATOR_FACTORY_H_
 
+#include <memory>
+
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 
 namespace cricket {
 class PortAllocator;
@@ -23,7 +24,7 @@
  public:
   virtual ~PortAllocatorFactory() {}
 
-  virtual scoped_ptr<cricket::PortAllocator> CreatePortAllocator(
+  virtual std::unique_ptr<cricket::PortAllocator> CreatePortAllocator(
       scoped_refptr<TransportContext> transport_context) = 0;
 };
 
diff --git a/remoting/protocol/protocol_mock_objects.cc b/remoting/protocol/protocol_mock_objects.cc
index 26d6e49..24c3abe 100644
--- a/remoting/protocol/protocol_mock_objects.cc
+++ b/remoting/protocol/protocol_mock_objects.cc
@@ -55,8 +55,8 @@
 MockPairingRegistryDelegate::~MockPairingRegistryDelegate() {
 }
 
-scoped_ptr<base::ListValue> MockPairingRegistryDelegate::LoadAll() {
-  scoped_ptr<base::ListValue> result(new base::ListValue());
+std::unique_ptr<base::ListValue> MockPairingRegistryDelegate::LoadAll() {
+  std::unique_ptr<base::ListValue> result(new base::ListValue());
   for (Pairings::const_iterator i = pairings_.begin(); i != pairings_.end();
        ++i) {
     result->Append(i->second.ToValue().release());
@@ -91,7 +91,7 @@
 }
 
 SynchronousPairingRegistry::SynchronousPairingRegistry(
-    scoped_ptr<Delegate> delegate)
+    std::unique_ptr<Delegate> delegate)
     : PairingRegistry(base::ThreadTaskRunnerHandle::Get(),
                       std::move(delegate)) {}
 SynchronousPairingRegistry::~SynchronousPairingRegistry() {}
diff --git a/remoting/protocol/protocol_mock_objects.h b/remoting/protocol/protocol_mock_objects.h
index 54e79a5..8d6a988 100644
--- a/remoting/protocol/protocol_mock_objects.h
+++ b/remoting/protocol/protocol_mock_objects.h
@@ -12,6 +12,7 @@
 
 #include "base/location.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/single_thread_task_runner.h"
 #include "base/values.h"
 #include "net/base/ip_endpoint.h"
@@ -46,7 +47,8 @@
                void(ConnectionToClient* connection));
   MOCK_METHOD2(OnConnectionClosed,
                void(ConnectionToClient* connection, ErrorCode error));
-  MOCK_METHOD1(OnCreateVideoEncoder, void(scoped_ptr<VideoEncoder>* encoder));
+  MOCK_METHOD1(OnCreateVideoEncoder,
+               void(std::unique_ptr<VideoEncoder>* encoder));
   MOCK_METHOD2(OnInputEventReceived,
                void(ConnectionToClient* connection, int64_t timestamp));
   MOCK_METHOD3(OnRouteChange,
@@ -75,7 +77,7 @@
   virtual ~MockCursorShapeChangeCallback();
 
   MOCK_METHOD1(CursorShapeChangedPtr, void(CursorShapeInfo* info));
-  void CursorShapeChanged(scoped_ptr<CursorShapeInfo> info);
+  void CursorShapeChanged(std::unique_ptr<CursorShapeInfo> info);
 
  private:
   DISALLOW_COPY_AND_ASSIGN(MockCursorShapeChangeCallback);
@@ -153,7 +155,7 @@
   MOCK_METHOD2(ProcessVideoPacketPtr,
                void(const VideoPacket* video_packet,
                     const base::Closure& done));
-  void ProcessVideoPacket(scoped_ptr<VideoPacket> video_packet,
+  void ProcessVideoPacket(std::unique_ptr<VideoPacket> video_packet,
                           const base::Closure& done) override {
     ProcessVideoPacketPtr(video_packet.get(), done);
   }
@@ -184,21 +186,21 @@
   ~MockSessionManager() override;
 
   MOCK_METHOD1(AcceptIncoming, void(const IncomingSessionCallback&));
-  void set_protocol_config(scoped_ptr<CandidateSessionConfig> config) override {
-  }
+  void set_protocol_config(
+      std::unique_ptr<CandidateSessionConfig> config) override {}
   MOCK_METHOD2(ConnectPtr,
                Session*(const std::string& host_jid,
                         Authenticator* authenticator));
   MOCK_METHOD0(Close, void());
   MOCK_METHOD1(set_authenticator_factory_ptr,
                void(AuthenticatorFactory* factory));
-  scoped_ptr<Session> Connect(
+  std::unique_ptr<Session> Connect(
       const std::string& host_jid,
-      scoped_ptr<Authenticator> authenticator) override {
-    return make_scoped_ptr(ConnectPtr(host_jid, authenticator.get()));
+      std::unique_ptr<Authenticator> authenticator) override {
+    return base::WrapUnique(ConnectPtr(host_jid, authenticator.get()));
   }
   void set_authenticator_factory(
-      scoped_ptr<AuthenticatorFactory> authenticator_factory) override {
+      std::unique_ptr<AuthenticatorFactory> authenticator_factory) override {
     set_authenticator_factory_ptr(authenticator_factory.release());
   }
 
@@ -213,7 +215,7 @@
   ~MockPairingRegistryDelegate() override;
 
   // PairingRegistry::Delegate implementation.
-  scoped_ptr<base::ListValue> LoadAll() override;
+  std::unique_ptr<base::ListValue> LoadAll() override;
   bool DeleteAll() override;
   protocol::PairingRegistry::Pairing Load(
       const std::string& client_id) override;
@@ -227,7 +229,7 @@
 
 class SynchronousPairingRegistry : public PairingRegistry {
  public:
-  explicit SynchronousPairingRegistry(scoped_ptr<Delegate> delegate);
+  explicit SynchronousPairingRegistry(std::unique_ptr<Delegate> delegate);
 
  protected:
   ~SynchronousPairingRegistry() override;
diff --git a/remoting/protocol/pseudotcp_adapter.cc b/remoting/protocol/pseudotcp_adapter.cc
index 9992ef2..2ba797e 100644
--- a/remoting/protocol/pseudotcp_adapter.cc
+++ b/remoting/protocol/pseudotcp_adapter.cc
@@ -32,7 +32,7 @@
 class PseudoTcpAdapter::Core : public cricket::IPseudoTcpNotify,
                                public base::RefCounted<Core> {
  public:
-  explicit Core(scoped_ptr<P2PDatagramSocket> socket);
+  explicit Core(std::unique_ptr<P2PDatagramSocket> socket);
 
   // Functions used to implement net::StreamSocket.
   int Read(const scoped_refptr<net::IOBuffer>& buffer, int buffer_size,
@@ -88,7 +88,7 @@
   net::CompletionCallback write_callback_;
 
   cricket::PseudoTcp pseudo_tcp_;
-  scoped_ptr<P2PDatagramSocket> socket_;
+  std::unique_ptr<P2PDatagramSocket> socket_;
 
   scoped_refptr<net::IOBuffer> read_buffer_;
   int read_buffer_size_;
@@ -115,8 +115,7 @@
   DISALLOW_COPY_AND_ASSIGN(Core);
 };
 
-
-PseudoTcpAdapter::Core::Core(scoped_ptr<P2PDatagramSocket> socket)
+PseudoTcpAdapter::Core::Core(std::unique_ptr<P2PDatagramSocket> socket)
     : pseudo_tcp_(this, 0),
       socket_(std::move(socket)),
       write_waits_for_send_(false),
@@ -452,9 +451,8 @@
 
 // Public interface implementation.
 
-PseudoTcpAdapter::PseudoTcpAdapter(scoped_ptr<P2PDatagramSocket> socket)
-    : core_(new Core(std::move(socket))) {
-}
+PseudoTcpAdapter::PseudoTcpAdapter(std::unique_ptr<P2PDatagramSocket> socket)
+    : core_(new Core(std::move(socket))) {}
 
 PseudoTcpAdapter::~PseudoTcpAdapter() {
   // Make sure that the underlying socket is destroyed before PseudoTcp.
diff --git a/remoting/protocol/pseudotcp_adapter.h b/remoting/protocol/pseudotcp_adapter.h
index 0d630e1..7a033a0 100644
--- a/remoting/protocol/pseudotcp_adapter.h
+++ b/remoting/protocol/pseudotcp_adapter.h
@@ -7,10 +7,11 @@
 
 #include <stdint.h>
 
+#include <memory>
+
 #include "base/compiler_specific.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/threading/non_thread_safe.h"
 #include "net/log/net_log.h"
 #include "remoting/protocol/p2p_stream_socket.h"
@@ -28,7 +29,7 @@
 // held on the stack during callbacks.
 class PseudoTcpAdapter : public P2PStreamSocket, base::NonThreadSafe {
  public:
-  explicit PseudoTcpAdapter(scoped_ptr<P2PDatagramSocket> socket);
+  explicit PseudoTcpAdapter(std::unique_ptr<P2PDatagramSocket> socket);
   ~PseudoTcpAdapter() override;
 
   // P2PStreamSocket implementation.
diff --git a/remoting/protocol/pseudotcp_adapter_unittest.cc b/remoting/protocol/pseudotcp_adapter_unittest.cc
index 16b3a1fd..45ea7c3 100644
--- a/remoting/protocol/pseudotcp_adapter_unittest.cc
+++ b/remoting/protocol/pseudotcp_adapter_unittest.cc
@@ -9,6 +9,7 @@
 #include "base/bind.h"
 #include "base/bind_helpers.h"
 #include "base/compiler_specific.h"
+#include "base/memory/ptr_util.h"
 #include "jingle/glue/thread_wrapper.h"
 #include "net/base/io_buffer.h"
 #include "net/base/net_errors.h"
@@ -294,16 +295,16 @@
     host_socket_->Connect(client_socket_);
     client_socket_->Connect(host_socket_);
 
-    host_pseudotcp_.reset(new PseudoTcpAdapter(make_scoped_ptr(host_socket_)));
+    host_pseudotcp_.reset(new PseudoTcpAdapter(base::WrapUnique(host_socket_)));
     client_pseudotcp_.reset(
-        new PseudoTcpAdapter(make_scoped_ptr(client_socket_)));
+        new PseudoTcpAdapter(base::WrapUnique(client_socket_)));
   }
 
   FakeSocket* host_socket_;
   FakeSocket* client_socket_;
 
-  scoped_ptr<PseudoTcpAdapter> host_pseudotcp_;
-  scoped_ptr<PseudoTcpAdapter> client_pseudotcp_;
+  std::unique_ptr<PseudoTcpAdapter> host_pseudotcp_;
+  std::unique_ptr<PseudoTcpAdapter> client_pseudotcp_;
   base::MessageLoop message_loop_;
 };
 
@@ -368,7 +369,7 @@
 class DeleteOnConnected {
  public:
   DeleteOnConnected(base::MessageLoop* message_loop,
-                    scoped_ptr<PseudoTcpAdapter>* adapter)
+                    std::unique_ptr<PseudoTcpAdapter>* adapter)
       : message_loop_(message_loop), adapter_(adapter) {}
   void OnConnected(int error) {
     adapter_->reset();
@@ -376,7 +377,7 @@
                             base::MessageLoop::QuitWhenIdleClosure());
   }
   base::MessageLoop* message_loop_;
-  scoped_ptr<PseudoTcpAdapter>* adapter_;
+  std::unique_ptr<PseudoTcpAdapter>* adapter_;
 };
 
 TEST_F(PseudoTcpAdapterTest, DeleteOnConnected) {
diff --git a/remoting/protocol/pseudotcp_channel_factory.cc b/remoting/protocol/pseudotcp_channel_factory.cc
index e9fd301..9adf225 100644
--- a/remoting/protocol/pseudotcp_channel_factory.cc
+++ b/remoting/protocol/pseudotcp_channel_factory.cc
@@ -61,7 +61,7 @@
 void PseudoTcpChannelFactory::OnDatagramChannelCreated(
     const std::string& name,
     const ChannelCreatedCallback& callback,
-    scoped_ptr<P2PDatagramSocket> datagram_socket) {
+    std::unique_ptr<P2PDatagramSocket> datagram_socket) {
   PseudoTcpAdapter* adapter = new PseudoTcpAdapter(std::move(datagram_socket));
   pending_sockets_[name] = adapter;
 
@@ -88,7 +88,7 @@
     int result) {
   PendingSocketsMap::iterator it = pending_sockets_.find(name);
   DCHECK(it != pending_sockets_.end());
-  scoped_ptr<P2PStreamSocket> socket(it->second);
+  std::unique_ptr<P2PStreamSocket> socket(it->second);
   pending_sockets_.erase(it);
 
   if (result != net::OK)
diff --git a/remoting/protocol/pseudotcp_channel_factory.h b/remoting/protocol/pseudotcp_channel_factory.h
index 37a1c60..a8a509d 100644
--- a/remoting/protocol/pseudotcp_channel_factory.h
+++ b/remoting/protocol/pseudotcp_channel_factory.h
@@ -35,7 +35,7 @@
 
   void OnDatagramChannelCreated(const std::string& name,
                                 const ChannelCreatedCallback& callback,
-                                scoped_ptr<P2PDatagramSocket> socket);
+                                std::unique_ptr<P2PDatagramSocket> socket);
   void OnPseudoTcpConnected(const std::string& name,
                             const ChannelCreatedCallback& callback,
                             int result);
diff --git a/remoting/protocol/rejecting_authenticator.cc b/remoting/protocol/rejecting_authenticator.cc
index 80a07a0..b23f298 100644
--- a/remoting/protocol/rejecting_authenticator.cc
+++ b/remoting/protocol/rejecting_authenticator.cc
@@ -39,7 +39,7 @@
   resume_callback.Run();
 }
 
-scoped_ptr<buzz::XmlElement> RejectingAuthenticator::GetNextMessage() {
+std::unique_ptr<buzz::XmlElement> RejectingAuthenticator::GetNextMessage() {
   NOTREACHED();
   return nullptr;
 }
@@ -49,7 +49,7 @@
   return auth_key_;
 };
 
-scoped_ptr<ChannelAuthenticator>
+std::unique_ptr<ChannelAuthenticator>
 RejectingAuthenticator::CreateChannelAuthenticator() const {
   NOTREACHED();
   return nullptr;
diff --git a/remoting/protocol/rejecting_authenticator.h b/remoting/protocol/rejecting_authenticator.h
index 6386c84..8f6c9467 100644
--- a/remoting/protocol/rejecting_authenticator.h
+++ b/remoting/protocol/rejecting_authenticator.h
@@ -25,9 +25,10 @@
   RejectionReason rejection_reason() const override;
   void ProcessMessage(const buzz::XmlElement* message,
                       const base::Closure& resume_callback) override;
-  scoped_ptr<buzz::XmlElement> GetNextMessage() override;
+  std::unique_ptr<buzz::XmlElement> GetNextMessage() override;
   const std::string& GetAuthKey() const override;
-  scoped_ptr<ChannelAuthenticator> CreateChannelAuthenticator() const override;
+  std::unique_ptr<ChannelAuthenticator> CreateChannelAuthenticator()
+      const override;
 
  private:
   RejectionReason rejection_reason_;
diff --git a/remoting/protocol/secure_channel_factory.cc b/remoting/protocol/secure_channel_factory.cc
index 9739bbd..40b02a0 100644
--- a/remoting/protocol/secure_channel_factory.cc
+++ b/remoting/protocol/secure_channel_factory.cc
@@ -51,7 +51,7 @@
 void SecureChannelFactory::OnBaseChannelCreated(
     const std::string& name,
     const ChannelCreatedCallback& callback,
-    scoped_ptr<P2PStreamSocket> socket) {
+    std::unique_ptr<P2PStreamSocket> socket) {
   if (!socket) {
     callback.Run(nullptr);
     return;
@@ -70,7 +70,7 @@
     const std::string& name,
     const ChannelCreatedCallback& callback,
     int error,
-    scoped_ptr<P2PStreamSocket> socket) {
+    std::unique_ptr<P2PStreamSocket> socket) {
   DCHECK((socket && error == net::OK) || (!socket && error != net::OK));
 
   AuthenticatorMap::iterator it = channel_authenticators_.find(name);
diff --git a/remoting/protocol/secure_channel_factory.h b/remoting/protocol/secure_channel_factory.h
index f78aba0..b348ffe77 100644
--- a/remoting/protocol/secure_channel_factory.h
+++ b/remoting/protocol/secure_channel_factory.h
@@ -39,12 +39,12 @@
 
   void OnBaseChannelCreated(const std::string& name,
                             const ChannelCreatedCallback& callback,
-                            scoped_ptr<P2PStreamSocket> socket);
+                            std::unique_ptr<P2PStreamSocket> socket);
 
   void OnSecureChannelCreated(const std::string& name,
                               const ChannelCreatedCallback& callback,
                               int error,
-                              scoped_ptr<P2PStreamSocket> socket);
+                              std::unique_ptr<P2PStreamSocket> socket);
 
   StreamChannelFactory* channel_factory_;
   Authenticator* authenticator_;
diff --git a/remoting/protocol/session_config.cc b/remoting/protocol/session_config.cc
index 86779a3..4a2c8271 100644
--- a/remoting/protocol/session_config.cc
+++ b/remoting/protocol/session_config.cc
@@ -8,6 +8,7 @@
 #include <vector>
 
 #include "base/logging.h"
+#include "base/memory/ptr_util.h"
 
 namespace remoting {
 namespace protocol {
@@ -70,19 +71,18 @@
 }
 
 // static
-scoped_ptr<SessionConfig> SessionConfig::SelectCommon(
+std::unique_ptr<SessionConfig> SessionConfig::SelectCommon(
     const CandidateSessionConfig* client_config,
     const CandidateSessionConfig* host_config) {
-
   // Use WebRTC if both host and client support it.
   if (client_config->webrtc_supported() && host_config->webrtc_supported())
-    return make_scoped_ptr(new SessionConfig(Protocol::WEBRTC));
+    return base::WrapUnique(new SessionConfig(Protocol::WEBRTC));
 
   // Reject connection if ICE is not supported by either of the peers.
   if (!host_config->ice_supported() || !client_config->ice_supported())
     return nullptr;
 
-  scoped_ptr<SessionConfig> result(new SessionConfig(Protocol::ICE));
+  std::unique_ptr<SessionConfig> result(new SessionConfig(Protocol::ICE));
   ChannelConfig control_config;
   ChannelConfig event_config;
   ChannelConfig video_config;
@@ -117,14 +117,14 @@
 }
 
 // static
-scoped_ptr<SessionConfig> SessionConfig::GetFinalConfig(
+std::unique_ptr<SessionConfig> SessionConfig::GetFinalConfig(
     const CandidateSessionConfig* candidate_config) {
   if (candidate_config->webrtc_supported()) {
     if (candidate_config->ice_supported()) {
       LOG(ERROR) << "Received candidate config is ambiguous.";
       return nullptr;
     }
-    return make_scoped_ptr(new SessionConfig(Protocol::WEBRTC));
+    return base::WrapUnique(new SessionConfig(Protocol::WEBRTC));
   }
 
   if (!candidate_config->ice_supported())
@@ -137,7 +137,7 @@
     return nullptr;
   }
 
-  scoped_ptr<SessionConfig> result(new SessionConfig(Protocol::ICE));
+  std::unique_ptr<SessionConfig> result(new SessionConfig(Protocol::ICE));
   result->control_config_ = candidate_config->control_configs().front();
   result->event_config_ = candidate_config->event_configs().front();
   result->video_config_ = candidate_config->video_configs().front();
@@ -147,8 +147,8 @@
 }
 
 // static
-scoped_ptr<SessionConfig> SessionConfig::ForTest() {
-  scoped_ptr<SessionConfig> result(new SessionConfig(Protocol::ICE));
+std::unique_ptr<SessionConfig> SessionConfig::ForTest() {
+  std::unique_ptr<SessionConfig> result(new SessionConfig(Protocol::ICE));
   result->control_config_ = ChannelConfig(ChannelConfig::TRANSPORT_MUX_STREAM,
                                           kControlStreamVersion,
                                           ChannelConfig::CODEC_UNDEFINED);
@@ -164,16 +164,16 @@
   return result;
 }
 
-scoped_ptr<SessionConfig> SessionConfig::ForTestWithVerbatimVideo() {
-  scoped_ptr<SessionConfig> result = ForTest();
+std::unique_ptr<SessionConfig> SessionConfig::ForTestWithVerbatimVideo() {
+  std::unique_ptr<SessionConfig> result = ForTest();
   result->video_config_ = ChannelConfig(ChannelConfig::TRANSPORT_STREAM,
                                         kDefaultStreamVersion,
                                         ChannelConfig::CODEC_VERBATIM);
   return result;
 }
 
-scoped_ptr<SessionConfig> SessionConfig::ForTestWithWebrtc() {
-  return make_scoped_ptr(new SessionConfig(Protocol::WEBRTC));
+std::unique_ptr<SessionConfig> SessionConfig::ForTestWithWebrtc() {
+  return base::WrapUnique(new SessionConfig(Protocol::WEBRTC));
 }
 
 const ChannelConfig& SessionConfig::control_config() const {
@@ -218,19 +218,19 @@
   return false;
 }
 
-scoped_ptr<CandidateSessionConfig> CandidateSessionConfig::Clone() const {
-  return make_scoped_ptr(new CandidateSessionConfig(*this));
+std::unique_ptr<CandidateSessionConfig> CandidateSessionConfig::Clone() const {
+  return base::WrapUnique(new CandidateSessionConfig(*this));
 }
 
 // static
-scoped_ptr<CandidateSessionConfig> CandidateSessionConfig::CreateEmpty() {
-  return make_scoped_ptr(new CandidateSessionConfig());
+std::unique_ptr<CandidateSessionConfig> CandidateSessionConfig::CreateEmpty() {
+  return base::WrapUnique(new CandidateSessionConfig());
 }
 
 // static
-scoped_ptr<CandidateSessionConfig> CandidateSessionConfig::CreateFrom(
+std::unique_ptr<CandidateSessionConfig> CandidateSessionConfig::CreateFrom(
     const SessionConfig& config) {
-  scoped_ptr<CandidateSessionConfig> result = CreateEmpty();
+  std::unique_ptr<CandidateSessionConfig> result = CreateEmpty();
 
   switch (config.protocol()) {
     case SessionConfig::Protocol::WEBRTC:
@@ -252,8 +252,9 @@
 }
 
 // static
-scoped_ptr<CandidateSessionConfig> CandidateSessionConfig::CreateDefault() {
-  scoped_ptr<CandidateSessionConfig> result = CreateEmpty();
+std::unique_ptr<CandidateSessionConfig>
+CandidateSessionConfig::CreateDefault() {
+  std::unique_ptr<CandidateSessionConfig> result = CreateEmpty();
 
   result->set_ice_supported(true);
 
diff --git a/remoting/protocol/session_config.h b/remoting/protocol/session_config.h
index 67f0336..312ce88e 100644
--- a/remoting/protocol/session_config.h
+++ b/remoting/protocol/session_config.h
@@ -6,9 +6,9 @@
 #define REMOTING_PROTOCOL_SESSION_CONFIG_H_
 
 #include <list>
+#include <memory>
 #include <string>
 
-#include "base/memory/scoped_ptr.h"
 
 namespace remoting {
 namespace protocol {
@@ -75,7 +75,7 @@
   // nullptr is returned if such configuration doesn't exist. When selecting
   // channel configuration priority is given to the configs listed first
   // in |client_config|.
-  static scoped_ptr<SessionConfig> SelectCommon(
+  static std::unique_ptr<SessionConfig> SelectCommon(
       const CandidateSessionConfig* client_config,
       const CandidateSessionConfig* host_config);
 
@@ -84,13 +84,13 @@
   // (e.g. there is more than one configuration for one of the channel)
   // or undefined (e.g. no configurations for a channel) then nullptr is
   // returned.
-  static scoped_ptr<SessionConfig> GetFinalConfig(
+  static std::unique_ptr<SessionConfig> GetFinalConfig(
       const CandidateSessionConfig* candidate_config);
 
   // Returns a suitable session configuration for use in tests.
-  static scoped_ptr<SessionConfig> ForTest();
-  static scoped_ptr<SessionConfig> ForTestWithVerbatimVideo();
-  static scoped_ptr<SessionConfig> ForTestWithWebrtc();
+  static std::unique_ptr<SessionConfig> ForTest();
+  static std::unique_ptr<SessionConfig> ForTestWithVerbatimVideo();
+  static std::unique_ptr<SessionConfig> ForTestWithWebrtc();
 
   Protocol protocol() const { return protocol_; }
 
@@ -120,10 +120,10 @@
 // because it allows one to specify multiple configurations for each channel.
 class CandidateSessionConfig {
  public:
-  static scoped_ptr<CandidateSessionConfig> CreateEmpty();
-  static scoped_ptr<CandidateSessionConfig> CreateFrom(
+  static std::unique_ptr<CandidateSessionConfig> CreateEmpty();
+  static std::unique_ptr<CandidateSessionConfig> CreateFrom(
       const SessionConfig& config);
-  static scoped_ptr<CandidateSessionConfig> CreateDefault();
+  static std::unique_ptr<CandidateSessionConfig> CreateDefault();
 
   ~CandidateSessionConfig();
 
@@ -182,7 +182,7 @@
   // Returns true if |config| is supported.
   bool IsSupported(const SessionConfig& config) const;
 
-  scoped_ptr<CandidateSessionConfig> Clone() const;
+  std::unique_ptr<CandidateSessionConfig> Clone() const;
 
   // Helpers for enabling/disabling specific features.
   void DisableAudioChannel();
diff --git a/remoting/protocol/session_config_unittest.cc b/remoting/protocol/session_config_unittest.cc
index 466815f8..0835482 100644
--- a/remoting/protocol/session_config_unittest.cc
+++ b/remoting/protocol/session_config_unittest.cc
@@ -9,11 +9,11 @@
 namespace remoting {
 namespace protocol {
 
-void TestGetFinalConfig(scoped_ptr<SessionConfig> config) {
-  scoped_ptr<CandidateSessionConfig> candidate_config =
+void TestGetFinalConfig(std::unique_ptr<SessionConfig> config) {
+  std::unique_ptr<CandidateSessionConfig> candidate_config =
       CandidateSessionConfig::CreateFrom(*config);
   ASSERT_TRUE(candidate_config);
-  scoped_ptr<SessionConfig> config2 =
+  std::unique_ptr<SessionConfig> config2 =
       SessionConfig::GetFinalConfig(candidate_config.get());
   ASSERT_TRUE(config2);
   EXPECT_EQ(config->protocol(), config2->protocol());
@@ -27,18 +27,18 @@
 }
 
 TEST(SessionConfig, SelectCommon) {
-  scoped_ptr<CandidateSessionConfig> default_candidate_config =
+  std::unique_ptr<CandidateSessionConfig> default_candidate_config =
       CandidateSessionConfig::CreateDefault();
 
-  scoped_ptr<CandidateSessionConfig> candidate_config_with_webrtc =
+  std::unique_ptr<CandidateSessionConfig> candidate_config_with_webrtc =
       CandidateSessionConfig::CreateEmpty();
   candidate_config_with_webrtc->set_webrtc_supported(true);
 
-  scoped_ptr<CandidateSessionConfig> hybrid_candidate_config =
+  std::unique_ptr<CandidateSessionConfig> hybrid_candidate_config =
       CandidateSessionConfig::CreateDefault();
   hybrid_candidate_config->set_webrtc_supported(true);
 
-  scoped_ptr<SessionConfig> selected;
+  std::unique_ptr<SessionConfig> selected;
 
   // ICE is selected by default.
   selected = SessionConfig::SelectCommon(default_candidate_config.get(),
@@ -82,19 +82,20 @@
 }
 
 TEST(SessionConfig, IsSupported) {
-  scoped_ptr<CandidateSessionConfig> default_candidate_config =
+  std::unique_ptr<CandidateSessionConfig> default_candidate_config =
       CandidateSessionConfig::CreateDefault();
 
-  scoped_ptr<CandidateSessionConfig> candidate_config_with_webrtc =
+  std::unique_ptr<CandidateSessionConfig> candidate_config_with_webrtc =
       CandidateSessionConfig::CreateEmpty();
   candidate_config_with_webrtc->set_webrtc_supported(true);
 
-  scoped_ptr<CandidateSessionConfig> hybrid_candidate_config =
+  std::unique_ptr<CandidateSessionConfig> hybrid_candidate_config =
       CandidateSessionConfig::CreateDefault();
   hybrid_candidate_config->set_webrtc_supported(true);
 
-  scoped_ptr<SessionConfig> ice_config = SessionConfig::ForTest();
-  scoped_ptr<SessionConfig> webrtc_config = SessionConfig::ForTestWithWebrtc();
+  std::unique_ptr<SessionConfig> ice_config = SessionConfig::ForTest();
+  std::unique_ptr<SessionConfig> webrtc_config =
+      SessionConfig::ForTestWithWebrtc();
 
   EXPECT_TRUE(default_candidate_config->IsSupported(*ice_config));
   EXPECT_FALSE(default_candidate_config->IsSupported(*webrtc_config));
diff --git a/remoting/protocol/session_manager.h b/remoting/protocol/session_manager.h
index 6d706ad..71c5007 100644
--- a/remoting/protocol/session_manager.h
+++ b/remoting/protocol/session_manager.h
@@ -106,15 +106,15 @@
   // Sets local protocol configuration to be used when negotiating outgoing and
   // incoming connections.
   virtual void set_protocol_config(
-      scoped_ptr<CandidateSessionConfig> config) = 0;
+      std::unique_ptr<CandidateSessionConfig> config) = 0;
 
   // Tries to create a session to the host |jid|.
   //
   // |host_jid| is the full jid of the host to connect to.
   // |authenticator| is a client authenticator for the session.
-  virtual scoped_ptr<Session> Connect(
+  virtual std::unique_ptr<Session> Connect(
       const std::string& host_jid,
-      scoped_ptr<Authenticator> authenticator) = 0;
+      std::unique_ptr<Authenticator> authenticator) = 0;
 
   // Set authenticator factory that should be used to authenticate
   // incoming connection. No connections will be accepted if
@@ -122,7 +122,7 @@
   // once per SessionManager because it may not be safe to delete
   // factory before all authenticators it created are deleted.
   virtual void set_authenticator_factory(
-      scoped_ptr<AuthenticatorFactory> authenticator_factory) = 0;
+      std::unique_ptr<AuthenticatorFactory> authenticator_factory) = 0;
 
  private:
   DISALLOW_COPY_AND_ASSIGN(SessionManager);
diff --git a/remoting/protocol/spake2_authenticator.cc b/remoting/protocol/spake2_authenticator.cc
index ab03e5d..55bbea32 100644
--- a/remoting/protocol/spake2_authenticator.cc
+++ b/remoting/protocol/spake2_authenticator.cc
@@ -8,6 +8,7 @@
 
 #include "base/base64.h"
 #include "base/logging.h"
+#include "base/memory/ptr_util.h"
 #include "base/sys_byteorder.h"
 #include "crypto/hmac.h"
 #include "crypto/secure_util.h"
@@ -40,13 +41,13 @@
 const buzz::StaticQName kCertificateTag = {kChromotingXmlNamespace,
                                            "certificate"};
 
-scoped_ptr<buzz::XmlElement> EncodeBinaryValueToXml(
+std::unique_ptr<buzz::XmlElement> EncodeBinaryValueToXml(
     const buzz::StaticQName& qname,
     const std::string& content) {
   std::string content_base64;
   base::Base64Encode(content, &content_base64);
 
-  scoped_ptr<buzz::XmlElement> result(new buzz::XmlElement(qname));
+  std::unique_ptr<buzz::XmlElement> result(new buzz::XmlElement(qname));
   result->SetBodyText(content_base64);
   return result;
 }
@@ -80,24 +81,24 @@
 }  // namespace
 
 // static
-scoped_ptr<Authenticator> Spake2Authenticator::CreateForClient(
+std::unique_ptr<Authenticator> Spake2Authenticator::CreateForClient(
     const std::string& local_id,
     const std::string& remote_id,
     const std::string& shared_secret,
     Authenticator::State initial_state) {
-  return make_scoped_ptr(new Spake2Authenticator(
+  return base::WrapUnique(new Spake2Authenticator(
       local_id, remote_id, shared_secret, false, initial_state));
 }
 
 // static
-scoped_ptr<Authenticator> Spake2Authenticator::CreateForHost(
+std::unique_ptr<Authenticator> Spake2Authenticator::CreateForHost(
     const std::string& local_id,
     const std::string& remote_id,
     const std::string& local_cert,
     scoped_refptr<RsaKeyPair> key_pair,
     const std::string& shared_secret,
     Authenticator::State initial_state) {
-  scoped_ptr<Spake2Authenticator> result(new Spake2Authenticator(
+  std::unique_ptr<Spake2Authenticator> result(new Spake2Authenticator(
       local_id, remote_id, shared_secret, true, initial_state));
   result->local_cert_ = local_cert;
   result->local_key_pair_ = key_pair;
@@ -247,10 +248,10 @@
   state_ = MESSAGE_READY;
 }
 
-scoped_ptr<buzz::XmlElement> Spake2Authenticator::GetNextMessage() {
+std::unique_ptr<buzz::XmlElement> Spake2Authenticator::GetNextMessage() {
   DCHECK_EQ(state(), MESSAGE_READY);
 
-  scoped_ptr<buzz::XmlElement> message = CreateEmptyAuthenticatorMessage();
+  std::unique_ptr<buzz::XmlElement> message = CreateEmptyAuthenticatorMessage();
 
   if (!spake_message_sent_) {
     if (!local_cert_.empty()) {
@@ -282,7 +283,7 @@
   return auth_key_;
 }
 
-scoped_ptr<ChannelAuthenticator>
+std::unique_ptr<ChannelAuthenticator>
 Spake2Authenticator::CreateChannelAuthenticator() const {
   DCHECK_EQ(state(), ACCEPTED);
   CHECK(!auth_key_.empty());
diff --git a/remoting/protocol/spake2_authenticator.h b/remoting/protocol/spake2_authenticator.h
index 50cdef06..10497f09 100644
--- a/remoting/protocol/spake2_authenticator.h
+++ b/remoting/protocol/spake2_authenticator.h
@@ -5,6 +5,7 @@
 #ifndef REMOTING_PROTOCOL_SPAKE2_AUTHENTICATOR_H_
 #define REMOTING_PROTOCOL_SPAKE2_AUTHENTICATOR_H_
 
+#include <memory>
 #include <queue>
 #include <string>
 
@@ -12,7 +13,6 @@
 #include "base/gtest_prod_util.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "remoting/protocol/authenticator.h"
 
 typedef struct spake2_ctx_st SPAKE2_CTX;
@@ -27,13 +27,13 @@
 // implements SPAKE2 over Curve25519.
 class Spake2Authenticator : public Authenticator {
  public:
-  static scoped_ptr<Authenticator> CreateForClient(
+  static std::unique_ptr<Authenticator> CreateForClient(
       const std::string& local_id,
       const std::string& remote_id,
       const std::string& shared_secret,
       State initial_state);
 
-  static scoped_ptr<Authenticator> CreateForHost(
+  static std::unique_ptr<Authenticator> CreateForHost(
       const std::string& local_id,
       const std::string& remote_id,
       const std::string& local_cert,
@@ -49,9 +49,10 @@
   RejectionReason rejection_reason() const override;
   void ProcessMessage(const buzz::XmlElement* message,
                       const base::Closure& resume_callback) override;
-  scoped_ptr<buzz::XmlElement> GetNextMessage() override;
+  std::unique_ptr<buzz::XmlElement> GetNextMessage() override;
   const std::string& GetAuthKey() const override;
-  scoped_ptr<ChannelAuthenticator> CreateChannelAuthenticator() const override;
+  std::unique_ptr<ChannelAuthenticator> CreateChannelAuthenticator()
+      const override;
 
  private:
   FRIEND_TEST_ALL_PREFIXES(Spake2AuthenticatorTest, InvalidSecret);
diff --git a/remoting/protocol/spake2_authenticator_unittest.cc b/remoting/protocol/spake2_authenticator_unittest.cc
index 1b1d315..dcb58b9 100644
--- a/remoting/protocol/spake2_authenticator_unittest.cc
+++ b/remoting/protocol/spake2_authenticator_unittest.cc
@@ -85,7 +85,7 @@
   reinterpret_cast<Spake2Authenticator*>(client_.get())->state_ =
       Authenticator::MESSAGE_READY;
 
-  scoped_ptr<buzz::XmlElement> message(client_->GetNextMessage());
+  std::unique_ptr<buzz::XmlElement> message(client_->GetNextMessage());
   ASSERT_TRUE(message.get());
 
   ASSERT_EQ(Authenticator::WAITING_MESSAGE, client_->state());
diff --git a/remoting/protocol/ssl_hmac_channel_authenticator.cc b/remoting/protocol/ssl_hmac_channel_authenticator.cc
index 32fd6c3..544e640d 100644
--- a/remoting/protocol/ssl_hmac_channel_authenticator.cc
+++ b/remoting/protocol/ssl_hmac_channel_authenticator.cc
@@ -12,10 +12,12 @@
 #include "base/bind_helpers.h"
 #include "base/callback_helpers.h"
 #include "base/logging.h"
+#include "base/memory/ptr_util.h"
 #include "build/build_config.h"
 #include "crypto/secure_util.h"
 #include "net/base/host_port_pair.h"
 #include "net/base/io_buffer.h"
+#include "net/base/ip_address.h"
 #include "net/base/net_errors.h"
 #include "net/cert/cert_status_flags.h"
 #include "net/cert/cert_verifier.h"
@@ -55,7 +57,7 @@
              net::CRLSet* crl_set,
              net::CertVerifyResult* verify_result,
              const net::CompletionCallback& callback,
-             scoped_ptr<Request>* out_req,
+             std::unique_ptr<Request>* out_req,
              const net::BoundNetLog& net_log) override {
     verify_result->verified_cert = cert;
     verify_result->cert_status = net::CERT_STATUS_INVALID;
@@ -67,7 +69,7 @@
 // to net::SSLClientSocket and net::SSLServerSocket.
 class NetStreamSocketAdapter : public net::StreamSocket {
  public:
-  NetStreamSocketAdapter(scoped_ptr<P2PStreamSocket> socket)
+  NetStreamSocketAdapter(std::unique_ptr<P2PStreamSocket> socket)
       : socket_(std::move(socket)) {}
   ~NetStreamSocketAdapter() override {}
 
@@ -99,8 +101,7 @@
   bool IsConnectedAndIdle() const override { return true; }
   int GetPeerAddress(net::IPEndPoint* address) const override {
     // SSL sockets call this function so it must return some result.
-    net::IPAddressNumber ip_address(net::kIPv4AddressSize);
-    *address = net::IPEndPoint(ip_address, 0);
+    *address = net::IPEndPoint(net::IPAddress::IPv4AllZeros(), 0);
     return net::OK;
   }
   int GetLocalAddress(net::IPEndPoint* address) const override {
@@ -140,15 +141,15 @@
   }
 
  private:
-  scoped_ptr<P2PStreamSocket> socket_;
+  std::unique_ptr<P2PStreamSocket> socket_;
   net::BoundNetLog net_log_;
 };
 
 // Implements P2PStreamSocket interface on top of net::StreamSocket.
 class P2PStreamSocketAdapter : public P2PStreamSocket {
  public:
-  P2PStreamSocketAdapter(scoped_ptr<net::StreamSocket> socket,
-                         scoped_ptr<net::SSLServerContext> server_context)
+  P2PStreamSocketAdapter(std::unique_ptr<net::StreamSocket> socket,
+                         std::unique_ptr<net::SSLServerContext> server_context)
       : server_context_(std::move(server_context)),
         socket_(std::move(socket)) {}
   ~P2PStreamSocketAdapter() override {}
@@ -165,29 +166,27 @@
  private:
   // The server_context_ will be a nullptr for client sockets.
   // The server_context_ must outlive any sockets it spawns.
-  scoped_ptr<net::SSLServerContext> server_context_;
-  scoped_ptr<net::StreamSocket> socket_;
+  std::unique_ptr<net::SSLServerContext> server_context_;
+  std::unique_ptr<net::StreamSocket> socket_;
 };
 
 }  // namespace
 
 // static
-scoped_ptr<SslHmacChannelAuthenticator>
-SslHmacChannelAuthenticator::CreateForClient(
-      const std::string& remote_cert,
-      const std::string& auth_key) {
-  scoped_ptr<SslHmacChannelAuthenticator> result(
+std::unique_ptr<SslHmacChannelAuthenticator>
+SslHmacChannelAuthenticator::CreateForClient(const std::string& remote_cert,
+                                             const std::string& auth_key) {
+  std::unique_ptr<SslHmacChannelAuthenticator> result(
       new SslHmacChannelAuthenticator(auth_key));
   result->remote_cert_ = remote_cert;
   return result;
 }
 
-scoped_ptr<SslHmacChannelAuthenticator>
-SslHmacChannelAuthenticator::CreateForHost(
-    const std::string& local_cert,
-    scoped_refptr<RsaKeyPair> key_pair,
-    const std::string& auth_key) {
-  scoped_ptr<SslHmacChannelAuthenticator> result(
+std::unique_ptr<SslHmacChannelAuthenticator>
+SslHmacChannelAuthenticator::CreateForHost(const std::string& local_cert,
+                                           scoped_refptr<RsaKeyPair> key_pair,
+                                           const std::string& auth_key) {
+  std::unique_ptr<SslHmacChannelAuthenticator> result(
       new SslHmacChannelAuthenticator(auth_key));
   result->local_cert_ = local_cert;
   result->local_key_pair_ = key_pair;
@@ -203,7 +202,7 @@
 }
 
 void SslHmacChannelAuthenticator::SecureAndAuthenticate(
-    scoped_ptr<P2PStreamSocket> socket,
+    std::unique_ptr<P2PStreamSocket> socket,
     const DoneCallback& done_callback) {
   DCHECK(CalledOnValidThread());
 
@@ -232,9 +231,9 @@
     server_context_ = net::CreateSSLServerContext(
         cert.get(), *local_key_pair_->private_key(), ssl_config);
 
-    scoped_ptr<net::SSLServerSocket> server_socket =
+    std::unique_ptr<net::SSLServerSocket> server_socket =
         server_context_->CreateSSLServerSocket(
-            make_scoped_ptr(new NetStreamSocketAdapter(std::move(socket))));
+            base::WrapUnique(new NetStreamSocketAdapter(std::move(socket))));
     net::SSLServerSocket* raw_server_socket = server_socket.get();
     socket_ = std::move(server_socket);
     result = raw_server_socket->Handshake(
@@ -263,10 +262,10 @@
     net::SSLClientSocketContext context;
     context.transport_security_state = transport_security_state_.get();
     context.cert_verifier = cert_verifier_.get();
-    scoped_ptr<net::ClientSocketHandle> socket_handle(
+    std::unique_ptr<net::ClientSocketHandle> socket_handle(
         new net::ClientSocketHandle);
     socket_handle->SetSocket(
-        make_scoped_ptr(new NetStreamSocketAdapter(std::move(socket))));
+        base::WrapUnique(new NetStreamSocketAdapter(std::move(socket))));
 
 #if defined(OS_NACL)
     // net_nacl doesn't include ClientSocketFactory.
@@ -434,7 +433,7 @@
       *callback_called = true;
 
     base::ResetAndReturn(&done_callback_)
-        .Run(net::OK, make_scoped_ptr(new P2PStreamSocketAdapter(
+        .Run(net::OK, base::WrapUnique(new P2PStreamSocketAdapter(
                           std::move(socket_), std::move(server_context_))));
   }
 }
diff --git a/remoting/protocol/ssl_hmac_channel_authenticator.h b/remoting/protocol/ssl_hmac_channel_authenticator.h
index 313f4bb..818882e 100644
--- a/remoting/protocol/ssl_hmac_channel_authenticator.h
+++ b/remoting/protocol/ssl_hmac_channel_authenticator.h
@@ -5,12 +5,12 @@
 #ifndef REMOTING_PROTOCOL_SSL_HMAC_CHANNEL_AUTHENTICATOR_H_
 #define REMOTING_PROTOCOL_SSL_HMAC_CHANNEL_AUTHENTICATOR_H_
 
+#include <memory>
 #include <string>
 
 #include "base/callback.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/threading/non_thread_safe.h"
 #include "remoting/protocol/channel_authenticator.h"
 
@@ -47,11 +47,11 @@
   // |auth_key| is set to access code. For EKE-based authentication
   // |auth_key| is the key established using EKE over the signaling
   // channel.
-  static scoped_ptr<SslHmacChannelAuthenticator> CreateForClient(
+  static std::unique_ptr<SslHmacChannelAuthenticator> CreateForClient(
       const std::string& remote_cert,
       const std::string& auth_key);
 
-  static scoped_ptr<SslHmacChannelAuthenticator> CreateForHost(
+  static std::unique_ptr<SslHmacChannelAuthenticator> CreateForHost(
       const std::string& local_cert,
       scoped_refptr<RsaKeyPair> key_pair,
       const std::string& auth_key);
@@ -59,7 +59,7 @@
   ~SslHmacChannelAuthenticator() override;
 
   // ChannelAuthenticator interface.
-  void SecureAndAuthenticate(scoped_ptr<P2PStreamSocket> socket,
+  void SecureAndAuthenticate(std::unique_ptr<P2PStreamSocket> socket,
                              const DoneCallback& done_callback) override;
 
  private:
@@ -87,14 +87,14 @@
   // Used in the SERVER mode only.
   std::string local_cert_;
   scoped_refptr<RsaKeyPair> local_key_pair_;
-  scoped_ptr<net::SSLServerContext> server_context_;
+  std::unique_ptr<net::SSLServerContext> server_context_;
 
   // Used in the CLIENT mode only.
   std::string remote_cert_;
-  scoped_ptr<net::TransportSecurityState> transport_security_state_;
-  scoped_ptr<net::CertVerifier> cert_verifier_;
+  std::unique_ptr<net::TransportSecurityState> transport_security_state_;
+  std::unique_ptr<net::CertVerifier> cert_verifier_;
 
-  scoped_ptr<net::SSLSocket> socket_;
+  std::unique_ptr<net::SSLSocket> socket_;
   DoneCallback done_callback_;
 
   scoped_refptr<net::DrainableIOBuffer> auth_write_buf_;
diff --git a/remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc b/remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc
index 7688c166..c50a85c 100644
--- a/remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc
+++ b/remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc
@@ -118,7 +118,7 @@
 
   void OnHostConnected(const std::string& ref_argument,
                        int error,
-                       scoped_ptr<P2PStreamSocket> socket) {
+                       std::unique_ptr<P2PStreamSocket> socket) {
     // Try deleting the authenticator and verify that this doesn't destroy
     // reference parameters.
     host_auth_.reset();
@@ -128,7 +128,7 @@
     host_socket_ = std::move(socket);
   }
 
-  void OnClientConnected(int error, scoped_ptr<P2PStreamSocket> socket) {
+  void OnClientConnected(int error, std::unique_ptr<P2PStreamSocket> socket) {
     client_auth_.reset();
     client_callback_.OnDone(error, socket.get());
     client_socket_ = std::move(socket);
@@ -138,14 +138,14 @@
 
   scoped_refptr<RsaKeyPair> key_pair_;
   std::string host_cert_;
-  scoped_ptr<FakeStreamSocket> client_fake_socket_;
-  scoped_ptr<FakeStreamSocket> host_fake_socket_;
-  scoped_ptr<ChannelAuthenticator> client_auth_;
-  scoped_ptr<ChannelAuthenticator> host_auth_;
+  std::unique_ptr<FakeStreamSocket> client_fake_socket_;
+  std::unique_ptr<FakeStreamSocket> host_fake_socket_;
+  std::unique_ptr<ChannelAuthenticator> client_auth_;
+  std::unique_ptr<ChannelAuthenticator> host_auth_;
   MockChannelDoneCallback client_callback_;
   MockChannelDoneCallback host_callback_;
-  scoped_ptr<P2PStreamSocket> client_socket_;
-  scoped_ptr<P2PStreamSocket> host_socket_;
+  std::unique_ptr<P2PStreamSocket> client_socket_;
+  std::unique_ptr<P2PStreamSocket> host_socket_;
 
   DISALLOW_COPY_AND_ASSIGN(SslHmacChannelAuthenticatorTest);
 };
diff --git a/remoting/protocol/stream_channel_factory.h b/remoting/protocol/stream_channel_factory.h
index fe4a1e5..a28b0272 100644
--- a/remoting/protocol/stream_channel_factory.h
+++ b/remoting/protocol/stream_channel_factory.h
@@ -5,11 +5,11 @@
 #ifndef REMOTING_PROTOCOL_STREAM_CHANNEL_FACTORY_H_
 #define REMOTING_PROTOCOL_STREAM_CHANNEL_FACTORY_H_
 
+#include <memory>
 #include <string>
 
 #include "base/callback.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/threading/non_thread_safe.h"
 
 namespace remoting {
@@ -21,7 +21,7 @@
  public:
   // TODO(sergeyu): Specify connection error code when channel
   // connection fails.
-  typedef base::Callback<void(scoped_ptr<P2PStreamSocket>)>
+  typedef base::Callback<void(std::unique_ptr<P2PStreamSocket>)>
       ChannelCreatedCallback;
 
   StreamChannelFactory() {}
diff --git a/remoting/protocol/stream_message_pipe_adapter.cc b/remoting/protocol/stream_message_pipe_adapter.cc
index ff8597aa..96bd32b 100644
--- a/remoting/protocol/stream_message_pipe_adapter.cc
+++ b/remoting/protocol/stream_message_pipe_adapter.cc
@@ -8,6 +8,7 @@
 
 #include "base/bind.h"
 #include "base/callback_helpers.h"
+#include "base/memory/ptr_util.h"
 #include "net/base/net_errors.h"
 #include "remoting/base/buffered_socket_writer.h"
 #include "remoting/base/compound_buffer.h"
@@ -19,7 +20,7 @@
 namespace protocol {
 
 StreamMessagePipeAdapter::StreamMessagePipeAdapter(
-    scoped_ptr<P2PStreamSocket> socket,
+    std::unique_ptr<P2PStreamSocket> socket,
     const ErrorCallback& error_callback)
     : socket_(std::move(socket)),
       error_callback_(error_callback),
@@ -79,12 +80,12 @@
 
 void StreamMessageChannelFactoryAdapter::OnChannelCreated(
     const ChannelCreatedCallback& callback,
-    scoped_ptr<P2PStreamSocket> socket) {
+    std::unique_ptr<P2PStreamSocket> socket) {
   if (!socket) {
     error_callback_.Run(net::ERR_FAILED);
     return;
   }
-  callback.Run(make_scoped_ptr(
+  callback.Run(base::WrapUnique(
       new StreamMessagePipeAdapter(std::move(socket), error_callback_)));
 }
 
diff --git a/remoting/protocol/stream_message_pipe_adapter.h b/remoting/protocol/stream_message_pipe_adapter.h
index 37d694e..b75bbdd 100644
--- a/remoting/protocol/stream_message_pipe_adapter.h
+++ b/remoting/protocol/stream_message_pipe_adapter.h
@@ -24,7 +24,7 @@
  public:
   typedef base::Callback<void(int)> ErrorCallback;
 
-  StreamMessagePipeAdapter(scoped_ptr<P2PStreamSocket> socket,
+  StreamMessagePipeAdapter(std::unique_ptr<P2PStreamSocket> socket,
                            const ErrorCallback& error_callback);
   ~StreamMessagePipeAdapter() override;
 
@@ -36,11 +36,11 @@
  private:
   void CloseOnError(int error);
 
-  scoped_ptr<P2PStreamSocket> socket_;
+  std::unique_ptr<P2PStreamSocket> socket_;
   ErrorCallback error_callback_;
 
   MessageReader reader_;
-  scoped_ptr<BufferedSocketWriter> writer_;
+  std::unique_ptr<BufferedSocketWriter> writer_;
 
   DISALLOW_COPY_AND_ASSIGN(StreamMessagePipeAdapter);
 };
@@ -61,7 +61,7 @@
 
  private:
   void OnChannelCreated(const ChannelCreatedCallback& callback,
-                        scoped_ptr<P2PStreamSocket> socket);
+                        std::unique_ptr<P2PStreamSocket> socket);
 
   StreamChannelFactory* stream_channel_factory_;
   ErrorCallback error_callback_;
diff --git a/remoting/protocol/third_party_authenticator_base.cc b/remoting/protocol/third_party_authenticator_base.cc
index a0bdce4..ba03712 100644
--- a/remoting/protocol/third_party_authenticator_base.cc
+++ b/remoting/protocol/third_party_authenticator_base.cc
@@ -68,10 +68,11 @@
   }
 }
 
-scoped_ptr<buzz::XmlElement> ThirdPartyAuthenticatorBase::GetNextMessage() {
+std::unique_ptr<buzz::XmlElement>
+ThirdPartyAuthenticatorBase::GetNextMessage() {
   DCHECK_EQ(state(), MESSAGE_READY);
 
-  scoped_ptr<buzz::XmlElement> message;
+  std::unique_ptr<buzz::XmlElement> message;
   if (underlying_ && underlying_->state() == MESSAGE_READY) {
     message = underlying_->GetNextMessage();
   } else {
@@ -91,7 +92,7 @@
   return underlying_->GetAuthKey();
 }
 
-scoped_ptr<ChannelAuthenticator>
+std::unique_ptr<ChannelAuthenticator>
 ThirdPartyAuthenticatorBase::CreateChannelAuthenticator() const {
   DCHECK_EQ(state(), ACCEPTED);
 
diff --git a/remoting/protocol/third_party_authenticator_base.h b/remoting/protocol/third_party_authenticator_base.h
index e990907d..6e2fe574 100644
--- a/remoting/protocol/third_party_authenticator_base.h
+++ b/remoting/protocol/third_party_authenticator_base.h
@@ -5,11 +5,11 @@
 #ifndef REMOTING_PROTOCOL_THIRD_PARTY_AUTHENTICATOR_BASE_H_
 #define REMOTING_PROTOCOL_THIRD_PARTY_AUTHENTICATOR_BASE_H_
 
+#include <memory>
 #include <string>
 
 #include "base/callback.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "remoting/protocol/authenticator.h"
 #include "third_party/webrtc/libjingle/xmllite/qname.h"
 
@@ -41,9 +41,10 @@
   RejectionReason rejection_reason() const override;
   void ProcessMessage(const buzz::XmlElement* message,
                       const base::Closure& resume_callback) override;
-  scoped_ptr<buzz::XmlElement> GetNextMessage() override;
+  std::unique_ptr<buzz::XmlElement> GetNextMessage() override;
   const std::string& GetAuthKey() const override;
-  scoped_ptr<ChannelAuthenticator> CreateChannelAuthenticator() const override;
+  std::unique_ptr<ChannelAuthenticator> CreateChannelAuthenticator()
+      const override;
 
  protected:
   // XML tag names for third party authentication fields.
@@ -66,7 +67,7 @@
   // Adds the token related XML elements to the message.
   virtual void AddTokenElements(buzz::XmlElement* message) = 0;
 
-  scoped_ptr<Authenticator> underlying_;
+  std::unique_ptr<Authenticator> underlying_;
   State token_state_;
   bool started_;
   RejectionReason rejection_reason_;
diff --git a/remoting/protocol/third_party_authenticator_unittest.cc b/remoting/protocol/third_party_authenticator_unittest.cc
index f4d8046d..d37758bc 100644
--- a/remoting/protocol/third_party_authenticator_unittest.cc
+++ b/remoting/protocol/third_party_authenticator_unittest.cc
@@ -7,6 +7,7 @@
 #include "base/bind.h"
 #include "base/callback_helpers.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "net/base/net_errors.h"
 #include "remoting/base/rsa_key_pair.h"
 #include "remoting/protocol/authenticator_test_base.h"
@@ -104,7 +105,7 @@
     token_validator_ = new FakeTokenValidator();
     host_.reset(new ThirdPartyHostAuthenticator(
         base::Bind(&V2Authenticator::CreateForHost, host_cert_, key_pair_),
-        make_scoped_ptr(token_validator_)));
+        base::WrapUnique(token_validator_)));
     client_.reset(new ThirdPartyClientAuthenticator(
         base::Bind(&V2Authenticator::CreateForClient),
         base::Bind(&FakeTokenFetcher::FetchThirdPartyToken,
diff --git a/remoting/protocol/third_party_client_authenticator.h b/remoting/protocol/third_party_client_authenticator.h
index fa8b883..9483068b 100644
--- a/remoting/protocol/third_party_client_authenticator.h
+++ b/remoting/protocol/third_party_client_authenticator.h
@@ -5,11 +5,11 @@
 #ifndef REMOTING_PROTOCOL_THIRD_PARTY_CLIENT_AUTHENTICATOR_H_
 #define REMOTING_PROTOCOL_THIRD_PARTY_CLIENT_AUTHENTICATOR_H_
 
+#include <memory>
 #include <string>
 
 #include "base/callback.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "remoting/protocol/client_authentication_config.h"
 #include "remoting/protocol/third_party_authenticator_base.h"
diff --git a/remoting/protocol/third_party_host_authenticator.cc b/remoting/protocol/third_party_host_authenticator.cc
index 1ee4a02..0024480 100644
--- a/remoting/protocol/third_party_host_authenticator.cc
+++ b/remoting/protocol/third_party_host_authenticator.cc
@@ -19,7 +19,7 @@
 
 ThirdPartyHostAuthenticator::ThirdPartyHostAuthenticator(
     const CreateBaseAuthenticatorCallback& create_base_authenticator_callback,
-    scoped_ptr<TokenValidator> token_validator)
+    std::unique_ptr<TokenValidator> token_validator)
     : ThirdPartyAuthenticatorBase(MESSAGE_READY),
       create_base_authenticator_callback_(create_base_authenticator_callback),
       token_validator_(std::move(token_validator)) {}
diff --git a/remoting/protocol/third_party_host_authenticator.h b/remoting/protocol/third_party_host_authenticator.h
index f9755a9..67feed28 100644
--- a/remoting/protocol/third_party_host_authenticator.h
+++ b/remoting/protocol/third_party_host_authenticator.h
@@ -5,11 +5,11 @@
 #ifndef REMOTING_PROTOCOL_THIRD_PARTY_HOST_AUTHENTICATOR_H_
 #define REMOTING_PROTOCOL_THIRD_PARTY_HOST_AUTHENTICATOR_H_
 
+#include <memory>
 #include <string>
 
 #include "base/callback.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "remoting/protocol/third_party_authenticator_base.h"
 
 namespace remoting {
@@ -32,7 +32,7 @@
   // to the client and is used to obtain the shared secret.
   ThirdPartyHostAuthenticator(
       const CreateBaseAuthenticatorCallback& create_base_authenticator_callback,
-      scoped_ptr<TokenValidator> token_validator);
+      std::unique_ptr<TokenValidator> token_validator);
   ~ThirdPartyHostAuthenticator() override;
 
  protected:
@@ -47,7 +47,7 @@
                                   const std::string& shared_secret);
 
   CreateBaseAuthenticatorCallback create_base_authenticator_callback_;
-  scoped_ptr<TokenValidator> token_validator_;
+  std::unique_ptr<TokenValidator> token_validator_;
 
   DISALLOW_COPY_AND_ASSIGN(ThirdPartyHostAuthenticator);
 };
diff --git a/remoting/protocol/token_validator.h b/remoting/protocol/token_validator.h
index 12af22d5..c8534fb 100644
--- a/remoting/protocol/token_validator.h
+++ b/remoting/protocol/token_validator.h
@@ -5,11 +5,11 @@
 #ifndef REMOTING_PROTOCOL_TOKEN_VALIDATOR_H_
 #define REMOTING_PROTOCOL_TOKEN_VALIDATOR_H_
 
+#include <memory>
 #include <string>
 
 #include "base/callback.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "url/gurl.h"
 
 namespace remoting {
@@ -54,7 +54,7 @@
  public:
   // Creates a TokenValidator. |local_jid| and |remote_jid| are used to create
   // a token scope that is restricted to the current connection's JIDs.
-  virtual scoped_ptr<TokenValidator> CreateTokenValidator(
+  virtual std::unique_ptr<TokenValidator> CreateTokenValidator(
       const std::string& local_jid,
       const std::string& remote_jid) = 0;
 
diff --git a/remoting/protocol/transport.h b/remoting/protocol/transport.h
index c9f24d3..a612ea5 100644
--- a/remoting/protocol/transport.h
+++ b/remoting/protocol/transport.h
@@ -5,11 +5,11 @@
 #ifndef REMOTING_PROTOCOL_TRANSPORT_H_
 #define REMOTING_PROTOCOL_TRANSPORT_H_
 
+#include <memory>
 #include <string>
 
 #include "base/callback_forward.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/threading/non_thread_safe.h"
 #include "net/base/ip_endpoint.h"
 #include "remoting/protocol/errors.h"
@@ -40,6 +40,7 @@
     DIRECT,
     STUN,
     RELAY,
+    ROUTE_TYPE_MAX = RELAY,
   };
 
   // Helper method to get string representation of the type.
@@ -58,7 +59,7 @@
 // Implementations should provide other methods to send and receive data.
 class Transport {
  public:
-  typedef base::Callback<void(scoped_ptr<buzz::XmlElement> transport_info)>
+  typedef base::Callback<void(std::unique_ptr<buzz::XmlElement> transport_info)>
       SendTransportInfoCallback;
 
   virtual ~Transport() {}
diff --git a/remoting/protocol/transport_context.cc b/remoting/protocol/transport_context.cc
index c10953f..14a2d569 100644
--- a/remoting/protocol/transport_context.cc
+++ b/remoting/protocol/transport_context.cc
@@ -8,6 +8,7 @@
 
 #include "base/bind.h"
 #include "base/location.h"
+#include "base/memory/ptr_util.h"
 #include "base/single_thread_task_runner.h"
 #include "base/thread_task_runner_handle.h"
 #include "remoting/base/url_request.h"
@@ -30,7 +31,7 @@
 scoped_refptr<TransportContext> TransportContext::ForTests(TransportRole role) {
   jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop();
   return new protocol::TransportContext(
-      nullptr, make_scoped_ptr(new protocol::ChromiumPortAllocatorFactory()),
+      nullptr, base::WrapUnique(new protocol::ChromiumPortAllocatorFactory()),
       nullptr, protocol::NetworkSettings(
                    protocol::NetworkSettings::NAT_TRAVERSAL_OUTGOING),
       role);
@@ -39,8 +40,8 @@
 
 TransportContext::TransportContext(
     SignalStrategy* signal_strategy,
-    scoped_ptr<PortAllocatorFactory> port_allocator_factory,
-    scoped_ptr<UrlRequestFactory> url_request_factory,
+    std::unique_ptr<PortAllocatorFactory> port_allocator_factory,
+    std::unique_ptr<UrlRequestFactory> url_request_factory,
     const NetworkSettings& network_settings,
     TransportRole role)
     : signal_strategy_(signal_strategy),
@@ -80,7 +81,7 @@
 
   if (ice_config_[relay_mode_].is_null() ||
       base::Time::Now() > ice_config_[relay_mode_].expiration_time) {
-    scoped_ptr<IceConfigRequest> request;
+    std::unique_ptr<IceConfigRequest> request;
     switch (relay_mode_) {
       case RelayMode::TURN:
         if (ice_config_url_.empty()) {
diff --git a/remoting/protocol/transport_context.h b/remoting/protocol/transport_context.h
index 1c434f68..2a1ddb6 100644
--- a/remoting/protocol/transport_context.h
+++ b/remoting/protocol/transport_context.h
@@ -7,12 +7,12 @@
 
 #include <array>
 #include <list>
+#include <memory>
 #include <string>
 #include <vector>
 
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "remoting/protocol/ice_config.h"
 #include "remoting/protocol/network_settings.h"
 #include "remoting/protocol/transport.h"
@@ -46,8 +46,8 @@
   static scoped_refptr<TransportContext> ForTests(TransportRole role);
 
   TransportContext(SignalStrategy* signal_strategy,
-                   scoped_ptr<PortAllocatorFactory> port_allocator_factory,
-                   scoped_ptr<UrlRequestFactory> url_request_factory,
+                   std::unique_ptr<PortAllocatorFactory> port_allocator_factory,
+                   std::unique_ptr<UrlRequestFactory> url_request_factory,
                    const NetworkSettings& network_settings,
                    TransportRole role);
 
@@ -85,15 +85,16 @@
   void OnIceConfig(RelayMode relay_mode, const IceConfig& ice_config);
 
   SignalStrategy* signal_strategy_;
-  scoped_ptr<PortAllocatorFactory> port_allocator_factory_;
-  scoped_ptr<UrlRequestFactory> url_request_factory_;
+  std::unique_ptr<PortAllocatorFactory> port_allocator_factory_;
+  std::unique_ptr<UrlRequestFactory> url_request_factory_;
   NetworkSettings network_settings_;
   TransportRole role_;
 
   std::string ice_config_url_;
   RelayMode relay_mode_ = RelayMode::GTURN;
 
-  std::array<scoped_ptr<IceConfigRequest>, kNumRelayModes> ice_config_request_;
+  std::array<std::unique_ptr<IceConfigRequest>, kNumRelayModes>
+      ice_config_request_;
   std::array<IceConfig, kNumRelayModes> ice_config_;
 
   // When there is an active |ice_config_request_| stores list of callbacks to
diff --git a/remoting/protocol/v2_authenticator.cc b/remoting/protocol/v2_authenticator.cc
index a17fb46..9db2fef 100644
--- a/remoting/protocol/v2_authenticator.cc
+++ b/remoting/protocol/v2_authenticator.cc
@@ -8,6 +8,7 @@
 
 #include "base/base64.h"
 #include "base/logging.h"
+#include "base/memory/ptr_util.h"
 #include "remoting/base/constants.h"
 #include "remoting/base/rsa_key_pair.h"
 #include "remoting/protocol/ssl_hmac_channel_authenticator.h"
@@ -33,20 +34,20 @@
 }
 
 // static
-scoped_ptr<Authenticator> V2Authenticator::CreateForClient(
+std::unique_ptr<Authenticator> V2Authenticator::CreateForClient(
     const std::string& shared_secret,
     Authenticator::State initial_state) {
-  return make_scoped_ptr(new V2Authenticator(
+  return base::WrapUnique(new V2Authenticator(
       P224EncryptedKeyExchange::kPeerTypeClient, shared_secret, initial_state));
 }
 
 // static
-scoped_ptr<Authenticator> V2Authenticator::CreateForHost(
+std::unique_ptr<Authenticator> V2Authenticator::CreateForHost(
     const std::string& local_cert,
     scoped_refptr<RsaKeyPair> key_pair,
     const std::string& shared_secret,
     Authenticator::State initial_state) {
-  scoped_ptr<V2Authenticator> result(new V2Authenticator(
+  std::unique_ptr<V2Authenticator> result(new V2Authenticator(
       P224EncryptedKeyExchange::kPeerTypeServer, shared_secret, initial_state));
   result->local_cert_ = local_cert;
   result->local_key_pair_ = key_pair;
@@ -150,10 +151,10 @@
   state_ = MESSAGE_READY;
 }
 
-scoped_ptr<buzz::XmlElement> V2Authenticator::GetNextMessage() {
+std::unique_ptr<buzz::XmlElement> V2Authenticator::GetNextMessage() {
   DCHECK_EQ(state(), MESSAGE_READY);
 
-  scoped_ptr<buzz::XmlElement> message = CreateEmptyAuthenticatorMessage();
+  std::unique_ptr<buzz::XmlElement> message = CreateEmptyAuthenticatorMessage();
 
   DCHECK(!pending_messages_.empty());
   while (!pending_messages_.empty()) {
@@ -187,7 +188,7 @@
   return auth_key_;
 }
 
-scoped_ptr<ChannelAuthenticator>
+std::unique_ptr<ChannelAuthenticator>
 V2Authenticator::CreateChannelAuthenticator() const {
   DCHECK_EQ(state(), ACCEPTED);
   CHECK(!auth_key_.empty());
diff --git a/remoting/protocol/v2_authenticator.h b/remoting/protocol/v2_authenticator.h
index 770d86f..336678d 100644
--- a/remoting/protocol/v2_authenticator.h
+++ b/remoting/protocol/v2_authenticator.h
@@ -5,6 +5,7 @@
 #ifndef REMOTING_PROTOCOL_V2_AUTHENTICATOR_H_
 #define REMOTING_PROTOCOL_V2_AUTHENTICATOR_H_
 
+#include <memory>
 #include <queue>
 #include <string>
 
@@ -12,7 +13,6 @@
 #include "base/gtest_prod_util.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "crypto/p224_spake.h"
 #include "remoting/protocol/authenticator.h"
 
@@ -26,11 +26,11 @@
  public:
   static bool IsEkeMessage(const buzz::XmlElement* message);
 
-  static scoped_ptr<Authenticator> CreateForClient(
+  static std::unique_ptr<Authenticator> CreateForClient(
       const std::string& shared_secret,
       State initial_state);
 
-  static scoped_ptr<Authenticator> CreateForHost(
+  static std::unique_ptr<Authenticator> CreateForHost(
       const std::string& local_cert,
       scoped_refptr<RsaKeyPair> key_pair,
       const std::string& shared_secret,
@@ -44,9 +44,10 @@
   RejectionReason rejection_reason() const override;
   void ProcessMessage(const buzz::XmlElement* message,
                       const base::Closure& resume_callback) override;
-  scoped_ptr<buzz::XmlElement> GetNextMessage() override;
+  std::unique_ptr<buzz::XmlElement> GetNextMessage() override;
   const std::string& GetAuthKey() const override;
-  scoped_ptr<ChannelAuthenticator> CreateChannelAuthenticator() const override;
+  std::unique_ptr<ChannelAuthenticator> CreateChannelAuthenticator()
+      const override;
 
  private:
   FRIEND_TEST_ALL_PREFIXES(V2AuthenticatorTest, InvalidSecret);
diff --git a/remoting/protocol/v2_authenticator_unittest.cc b/remoting/protocol/v2_authenticator_unittest.cc
index 73f86d3..9b91446 100644
--- a/remoting/protocol/v2_authenticator_unittest.cc
+++ b/remoting/protocol/v2_authenticator_unittest.cc
@@ -83,7 +83,7 @@
   reinterpret_cast<V2Authenticator*>(client_.get())->state_ =
       Authenticator::MESSAGE_READY;
 
-  scoped_ptr<buzz::XmlElement> message(client_->GetNextMessage());
+  std::unique_ptr<buzz::XmlElement> message(client_->GetNextMessage());
   ASSERT_TRUE(message.get());
 
   ASSERT_EQ(Authenticator::WAITING_MESSAGE, client_->state());
diff --git a/remoting/protocol/video_feedback_stub.h b/remoting/protocol/video_feedback_stub.h
index edad73ea..2daa61d36 100644
--- a/remoting/protocol/video_feedback_stub.h
+++ b/remoting/protocol/video_feedback_stub.h
@@ -5,9 +5,10 @@
 #ifndef REMOTING_PROTOCOL_VIDEO_FEEDBACK_STUB_H_
 #define REMOTING_PROTOCOL_VIDEO_FEEDBACK_STUB_H_
 
+#include <memory>
+
 #include "base/callback_forward.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 
 namespace remoting {
 
@@ -17,7 +18,7 @@
 
 class VideoFeedbackStub {
  public:
-  virtual void ProcessVideoAck(scoped_ptr<VideoAck> video_ack) = 0;
+  virtual void ProcessVideoAck(std::unique_ptr<VideoAck> video_ack) = 0;
 
  protected:
   VideoFeedbackStub() {}
diff --git a/remoting/protocol/video_frame_pump.cc b/remoting/protocol/video_frame_pump.cc
index ba0d322b..2065c8b 100644
--- a/remoting/protocol/video_frame_pump.cc
+++ b/remoting/protocol/video_frame_pump.cc
@@ -5,12 +5,13 @@
 #include "remoting/protocol/video_frame_pump.h"
 
 #include <algorithm>
+#include <memory>
 #include <utility>
 
 #include "base/bind.h"
 #include "base/callback.h"
 #include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
 #include "base/single_thread_task_runner.h"
 #include "base/task_runner_util.h"
 #include "base/time/time.h"
@@ -35,8 +36,8 @@
 VideoFramePump::FrameTimestamps::~FrameTimestamps() {}
 
 VideoFramePump::PacketWithTimestamps::PacketWithTimestamps(
-    scoped_ptr<VideoPacket> packet,
-    scoped_ptr<FrameTimestamps> timestamps)
+    std::unique_ptr<VideoPacket> packet,
+    std::unique_ptr<FrameTimestamps> timestamps)
     : packet(std::move(packet)), timestamps(std::move(timestamps)) {}
 
 VideoFramePump::PacketWithTimestamps::~PacketWithTimestamps() {}
@@ -48,8 +49,8 @@
 
 VideoFramePump::VideoFramePump(
     scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner,
-    scoped_ptr<webrtc::DesktopCapturer> capturer,
-    scoped_ptr<VideoEncoder> encoder,
+    std::unique_ptr<webrtc::DesktopCapturer> capturer,
+    std::unique_ptr<VideoEncoder> encoder,
     protocol::VideoStub* video_stub)
     : encode_task_runner_(encode_task_runner),
       capturer_(std::move(capturer)),
@@ -141,7 +142,7 @@
   base::PostTaskAndReplyWithResult(
       encode_task_runner_.get(), FROM_HERE,
       base::Bind(&VideoFramePump::EncodeFrame, encoder_.get(),
-                 base::Passed(make_scoped_ptr(frame)),
+                 base::Passed(base::WrapUnique(frame)),
                  base::Passed(&captured_frame_timestamps_)),
       base::Bind(&VideoFramePump::OnFrameEncoded, weak_factory_.GetWeakPtr()));
 }
@@ -162,13 +163,13 @@
 }
 
 // static
-scoped_ptr<VideoFramePump::PacketWithTimestamps> VideoFramePump::EncodeFrame(
-    VideoEncoder* encoder,
-    scoped_ptr<webrtc::DesktopFrame> frame,
-    scoped_ptr<FrameTimestamps> timestamps) {
+std::unique_ptr<VideoFramePump::PacketWithTimestamps>
+VideoFramePump::EncodeFrame(VideoEncoder* encoder,
+                            std::unique_ptr<webrtc::DesktopFrame> frame,
+                            std::unique_ptr<FrameTimestamps> timestamps) {
   timestamps->encode_started_time = base::TimeTicks::Now();
 
-  scoped_ptr<VideoPacket> packet;
+  std::unique_ptr<VideoPacket> packet;
   // If |frame| is non-NULL then let the encoder process it.
   if (frame)
     packet = encoder->Encode(*frame);
@@ -186,11 +187,12 @@
       (timestamps->encode_ended_time - timestamps->encode_started_time)
           .InMilliseconds());
 
-  return make_scoped_ptr(
+  return base::WrapUnique(
       new PacketWithTimestamps(std::move(packet), std::move(timestamps)));
 }
 
-void VideoFramePump::OnFrameEncoded(scoped_ptr<PacketWithTimestamps> packet) {
+void VideoFramePump::OnFrameEncoded(
+    std::unique_ptr<PacketWithTimestamps> packet) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
   capture_scheduler_.OnFrameEncoded(packet->packet.get());
@@ -202,7 +204,7 @@
   }
 }
 
-void VideoFramePump::SendPacket(scoped_ptr<PacketWithTimestamps> packet) {
+void VideoFramePump::SendPacket(std::unique_ptr<PacketWithTimestamps> packet) {
   DCHECK(thread_checker_.CalledOnValidThread());
   DCHECK(!send_pending_);
 
@@ -252,7 +254,7 @@
 
   // Send next packet if any.
   if (!pending_packets_.empty()) {
-    scoped_ptr<PacketWithTimestamps> next(pending_packets_.front());
+    std::unique_ptr<PacketWithTimestamps> next(pending_packets_.front());
     pending_packets_.weak_erase(pending_packets_.begin());
     SendPacket(std::move(next));
   }
@@ -262,7 +264,7 @@
   DCHECK(thread_checker_.CalledOnValidThread());
 
   video_stub_->ProcessVideoPacket(
-      make_scoped_ptr(new VideoPacket()),
+      base::WrapUnique(new VideoPacket()),
       base::Bind(&VideoFramePump::OnKeepAlivePacketSent,
                  weak_factory_.GetWeakPtr()));
 }
diff --git a/remoting/protocol/video_frame_pump.h b/remoting/protocol/video_frame_pump.h
index d703b2a..710bf0a 100644
--- a/remoting/protocol/video_frame_pump.h
+++ b/remoting/protocol/video_frame_pump.h
@@ -8,8 +8,9 @@
 #include <stddef.h>
 #include <stdint.h>
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/scoped_vector.h"
 #include "base/threading/thread_checker.h"
 #include "base/time/time.h"
@@ -75,11 +76,10 @@
   // Creates a VideoFramePump running capture, encode and network tasks on the
   // supplied TaskRunners. Video will be pumped to |video_stub|, which must
   // outlive the pump..
-  VideoFramePump(
-      scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner,
-      scoped_ptr<webrtc::DesktopCapturer> capturer,
-      scoped_ptr<VideoEncoder> encoder,
-      protocol::VideoStub* video_stub);
+  VideoFramePump(scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner,
+                 std::unique_ptr<webrtc::DesktopCapturer> capturer,
+                 std::unique_ptr<VideoEncoder> encoder,
+                 protocol::VideoStub* video_stub);
   ~VideoFramePump() override;
 
   // VideoStream interface.
@@ -113,12 +113,12 @@
   };
 
   struct PacketWithTimestamps {
-    PacketWithTimestamps(scoped_ptr<VideoPacket> packet,
-                         scoped_ptr<FrameTimestamps> timestamps);
+    PacketWithTimestamps(std::unique_ptr<VideoPacket> packet,
+                         std::unique_ptr<FrameTimestamps> timestamps);
     ~PacketWithTimestamps();
 
-    scoped_ptr<VideoPacket> packet;
-    scoped_ptr<FrameTimestamps> timestamps;
+    std::unique_ptr<VideoPacket> packet;
+    std::unique_ptr<FrameTimestamps> timestamps;
   };
 
   // webrtc::DesktopCapturer::Callback interface.
@@ -129,16 +129,16 @@
   void CaptureNextFrame();
 
   // Task running on the encoder thread to encode the |frame|.
-  static scoped_ptr<PacketWithTimestamps> EncodeFrame(
+  static std::unique_ptr<PacketWithTimestamps> EncodeFrame(
       VideoEncoder* encoder,
-      scoped_ptr<webrtc::DesktopFrame> frame,
-      scoped_ptr<FrameTimestamps> timestamps);
+      std::unique_ptr<webrtc::DesktopFrame> frame,
+      std::unique_ptr<FrameTimestamps> timestamps);
 
   // Task called when a frame has finished encoding.
-  void OnFrameEncoded(scoped_ptr<PacketWithTimestamps> packet);
+  void OnFrameEncoded(std::unique_ptr<PacketWithTimestamps> packet);
 
   // Sends |packet| to the client.
-  void SendPacket(scoped_ptr<PacketWithTimestamps> packet);
+  void SendPacket(std::unique_ptr<PacketWithTimestamps> packet);
 
   // Helper called from SendPacket() to calculate timing fields in the |packet|
   // before sending it.
@@ -157,10 +157,10 @@
   scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner_;
 
   // Capturer used to capture the screen.
-  scoped_ptr<webrtc::DesktopCapturer> capturer_;
+  std::unique_ptr<webrtc::DesktopCapturer> capturer_;
 
   // Used to encode captured frames. Always accessed on the encode thread.
-  scoped_ptr<VideoEncoder> encoder_;
+  std::unique_ptr<VideoEncoder> encoder_;
 
   // Interface through which video frames are passed to the client.
   protocol::VideoStub* video_stub_;
@@ -178,10 +178,10 @@
   CaptureScheduler capture_scheduler_;
 
   // Timestamps for the frame to be captured next.
-  scoped_ptr<FrameTimestamps> next_frame_timestamps_;
+  std::unique_ptr<FrameTimestamps> next_frame_timestamps_;
 
   // Timestamps for the frame that's being captured.
-  scoped_ptr<FrameTimestamps> captured_frame_timestamps_;
+  std::unique_ptr<FrameTimestamps> captured_frame_timestamps_;
 
   bool send_pending_ = false;
 
diff --git a/remoting/protocol/video_frame_pump_unittest.cc b/remoting/protocol/video_frame_pump_unittest.cc
index 023d8315..e01df012 100644
--- a/remoting/protocol/video_frame_pump_unittest.cc
+++ b/remoting/protocol/video_frame_pump_unittest.cc
@@ -8,6 +8,7 @@
 
 #include "base/bind.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
 #include "base/single_thread_task_runner.h"
@@ -40,16 +41,16 @@
   arg1.Run();
 }
 
-scoped_ptr<webrtc::DesktopFrame> CreateNullFrame(
+std::unique_ptr<webrtc::DesktopFrame> CreateNullFrame(
     webrtc::SharedMemoryFactory* shared_memory_factory) {
   return nullptr;
 }
 
-scoped_ptr<webrtc::DesktopFrame> CreateUnchangedFrame(
+std::unique_ptr<webrtc::DesktopFrame> CreateUnchangedFrame(
     webrtc::SharedMemoryFactory* shared_memory_factory) {
   const webrtc::DesktopSize kSize(800, 640);
   // updated_region() is already empty by default in new BasicDesktopFrames.
-  return make_scoped_ptr(new webrtc::BasicDesktopFrame(kSize));
+  return base::WrapUnique(new webrtc::BasicDesktopFrame(kSize));
 }
 
 class MockVideoEncoder : public VideoEncoder {
@@ -61,8 +62,8 @@
   MOCK_METHOD1(SetLosslessColor, void(bool));
   MOCK_METHOD1(EncodePtr, VideoPacket*(const webrtc::DesktopFrame&));
 
-  scoped_ptr<VideoPacket> Encode(const webrtc::DesktopFrame& frame) {
-    return make_scoped_ptr(EncodePtr(frame));
+  std::unique_ptr<VideoPacket> Encode(const webrtc::DesktopFrame& frame) {
+    return base::WrapUnique(EncodePtr(frame));
   }
 };
 
@@ -81,8 +82,9 @@
     EXPECT_TRUE(task_runner_->BelongsToCurrentThread());
   }
 
-  scoped_ptr<VideoPacket> Encode(const webrtc::DesktopFrame& frame) override {
-    return make_scoped_ptr(new VideoPacket());
+  std::unique_ptr<VideoPacket> Encode(
+      const webrtc::DesktopFrame& frame) override {
+    return base::WrapUnique(new VideoPacket());
   }
 
  private:
@@ -111,7 +113,7 @@
   void Capture(const webrtc::DesktopRegion& rect) override {
     EXPECT_TRUE(task_runner_->BelongsToCurrentThread());
 
-    scoped_ptr<webrtc::DesktopFrame> frame(
+    std::unique_ptr<webrtc::DesktopFrame> frame(
         new webrtc::BasicDesktopFrame(webrtc::DesktopSize(kWidth, kHeight)));
     frame->mutable_updated_region()->SetRect(
         webrtc::DesktopRect::MakeXYWH(0, 0, 10, 10));
@@ -130,16 +132,15 @@
   void SetUp() override;
   void TearDown() override;
 
-  void StartVideoFramePump(
-      scoped_ptr<webrtc::DesktopCapturer> capturer,
-      scoped_ptr<VideoEncoder> encoder);
+  void StartVideoFramePump(std::unique_ptr<webrtc::DesktopCapturer> capturer,
+                           std::unique_ptr<VideoEncoder> encoder);
 
  protected:
   base::MessageLoop message_loop_;
   base::RunLoop run_loop_;
   scoped_refptr<AutoThreadTaskRunner> encode_task_runner_;
   scoped_refptr<AutoThreadTaskRunner> main_task_runner_;
-  scoped_ptr<VideoFramePump> pump_;
+  std::unique_ptr<VideoFramePump> pump_;
 
   MockVideoStub video_stub_;
 };
@@ -164,9 +165,9 @@
 // This test mocks capturer, encoder and network layer to simulate one capture
 // cycle.
 TEST_F(VideoFramePumpTest, StartAndStop) {
-  scoped_ptr<ThreadCheckDesktopCapturer> capturer(
+  std::unique_ptr<ThreadCheckDesktopCapturer> capturer(
       new ThreadCheckDesktopCapturer(main_task_runner_));
-  scoped_ptr<ThreadCheckVideoEncoder> encoder(
+  std::unique_ptr<ThreadCheckVideoEncoder> encoder(
       new ThreadCheckVideoEncoder(encode_task_runner_));
 
   base::RunLoop run_loop;
@@ -187,8 +188,8 @@
 
 // Tests that the pump handles null frames returned by the capturer.
 TEST_F(VideoFramePumpTest, NullFrame) {
-  scoped_ptr<FakeDesktopCapturer> capturer(new FakeDesktopCapturer);
-  scoped_ptr<MockVideoEncoder> encoder(new MockVideoEncoder);
+  std::unique_ptr<FakeDesktopCapturer> capturer(new FakeDesktopCapturer);
+  std::unique_ptr<MockVideoEncoder> encoder(new MockVideoEncoder);
 
   base::RunLoop run_loop;
 
@@ -214,8 +215,8 @@
 
 // Tests how the pump handles unchanged frames returned by the capturer.
 TEST_F(VideoFramePumpTest, UnchangedFrame) {
-  scoped_ptr<FakeDesktopCapturer> capturer(new FakeDesktopCapturer);
-  scoped_ptr<MockVideoEncoder> encoder(new MockVideoEncoder);
+  std::unique_ptr<FakeDesktopCapturer> capturer(new FakeDesktopCapturer);
+  std::unique_ptr<MockVideoEncoder> encoder(new MockVideoEncoder);
 
   base::RunLoop run_loop;
 
diff --git a/remoting/protocol/video_stub.h b/remoting/protocol/video_stub.h
index 3c47a912..104e36d 100644
--- a/remoting/protocol/video_stub.h
+++ b/remoting/protocol/video_stub.h
@@ -5,9 +5,10 @@
 #ifndef REMOTING_PROTOCOL_VIDEO_STUB_H_
 #define REMOTING_PROTOCOL_VIDEO_STUB_H_
 
+#include <memory>
+
 #include "base/callback_forward.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 
 namespace remoting {
 
@@ -17,7 +18,7 @@
 
 class VideoStub {
  public:
-  virtual void ProcessVideoPacket(scoped_ptr<VideoPacket> video_packet,
+  virtual void ProcessVideoPacket(std::unique_ptr<VideoPacket> video_packet,
                                   const base::Closure& done) = 0;
 
  protected:
diff --git a/remoting/protocol/webrtc_connection_to_client.cc b/remoting/protocol/webrtc_connection_to_client.cc
index 5fde9e5..0d0ed47 100644
--- a/remoting/protocol/webrtc_connection_to_client.cc
+++ b/remoting/protocol/webrtc_connection_to_client.cc
@@ -35,7 +35,7 @@
 // TODO(sergeyu): Figure out if we would benefit from using a separate
 // thread as a worker thread.
 WebrtcConnectionToClient::WebrtcConnectionToClient(
-    scoped_ptr<protocol::Session> session,
+    std::unique_ptr<protocol::Session> session,
     scoped_refptr<protocol::TransportContext> transport_context)
     : transport_(jingle_glue::JingleThreadWrapper::current(),
                  transport_context,
@@ -73,9 +73,9 @@
   event_handler_->OnInputEventReceived(this, timestamp);
 }
 
-scoped_ptr<VideoStream> WebrtcConnectionToClient::StartVideoStream(
-    scoped_ptr<webrtc::DesktopCapturer> desktop_capturer) {
-  scoped_ptr<WebrtcVideoStream> stream(new WebrtcVideoStream());
+std::unique_ptr<VideoStream> WebrtcConnectionToClient::StartVideoStream(
+    std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer) {
+  std::unique_ptr<WebrtcVideoStream> stream(new WebrtcVideoStream());
   if (!stream->Start(std::move(desktop_capturer), transport_.peer_connection(),
                      transport_.peer_connection_factory())) {
     return nullptr;
diff --git a/remoting/protocol/webrtc_connection_to_client.h b/remoting/protocol/webrtc_connection_to_client.h
index 13d0ee36..34f51ba 100644
--- a/remoting/protocol/webrtc_connection_to_client.h
+++ b/remoting/protocol/webrtc_connection_to_client.h
@@ -7,10 +7,10 @@
 
 #include <stdint.h>
 
+#include <memory>
 #include <string>
 
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/threading/thread_checker.h"
 #include "remoting/protocol/channel_dispatcher_base.h"
 #include "remoting/protocol/connection_to_client.h"
@@ -29,7 +29,7 @@
                                  public ChannelDispatcherBase::EventHandler {
  public:
   WebrtcConnectionToClient(
-      scoped_ptr<Session> session,
+      std::unique_ptr<Session> session,
       scoped_refptr<protocol::TransportContext> transport_context);
   ~WebrtcConnectionToClient() override;
 
@@ -39,8 +39,8 @@
   Session* session() override;
   void Disconnect(ErrorCode error) override;
   void OnInputEventReceived(int64_t timestamp) override;
-  scoped_ptr<VideoStream> StartVideoStream(
-      scoped_ptr<webrtc::DesktopCapturer> desktop_capturer) override;
+  std::unique_ptr<VideoStream> StartVideoStream(
+      std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer) override;
   AudioStub* audio_stub() override;
   ClientStub* client_stub() override;
   void set_clipboard_stub(ClipboardStub* clipboard_stub) override;
@@ -70,10 +70,10 @@
 
   WebrtcTransport transport_;
 
-  scoped_ptr<Session> session_;
+  std::unique_ptr<Session> session_;
 
-  scoped_ptr<HostControlDispatcher> control_dispatcher_;
-  scoped_ptr<HostEventDispatcher> event_dispatcher_;
+  std::unique_ptr<HostControlDispatcher> control_dispatcher_;
+  std::unique_ptr<HostEventDispatcher> event_dispatcher_;
 
   DISALLOW_COPY_AND_ASSIGN(WebrtcConnectionToClient);
 };
diff --git a/remoting/protocol/webrtc_connection_to_host.cc b/remoting/protocol/webrtc_connection_to_host.cc
index bfa103e..8ba5cb1c 100644
--- a/remoting/protocol/webrtc_connection_to_host.cc
+++ b/remoting/protocol/webrtc_connection_to_host.cc
@@ -23,7 +23,7 @@
 WebrtcConnectionToHost::~WebrtcConnectionToHost() {}
 
 void WebrtcConnectionToHost::Connect(
-    scoped_ptr<Session> session,
+    std::unique_ptr<Session> session,
     scoped_refptr<TransportContext> transport_context,
     HostEventCallback* event_callback) {
   DCHECK(client_stub_);
diff --git a/remoting/protocol/webrtc_connection_to_host.h b/remoting/protocol/webrtc_connection_to_host.h
index b557cf1..8410fa5 100644
--- a/remoting/protocol/webrtc_connection_to_host.h
+++ b/remoting/protocol/webrtc_connection_to_host.h
@@ -5,10 +5,10 @@
 #ifndef REMOTING_PROTOCOL_WEBRTC_CONNECTION_TO_HOST_H_
 #define REMOTING_PROTOCOL_WEBRTC_CONNECTION_TO_HOST_H_
 
+#include <memory>
 #include <string>
 
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "remoting/protocol/channel_dispatcher_base.h"
 #include "remoting/protocol/clipboard_filter.h"
 #include "remoting/protocol/connection_to_host.h"
@@ -38,7 +38,7 @@
   void set_clipboard_stub(ClipboardStub* clipboard_stub) override;
   void set_video_renderer(VideoRenderer* video_renderer) override;
   void set_audio_stub(AudioStub* audio_stub) override;
-  void Connect(scoped_ptr<Session> session,
+  void Connect(std::unique_ptr<Session> session,
                scoped_refptr<TransportContext> transport_context,
                HostEventCallback* event_callback) override;
   const SessionConfig& config() override;
@@ -76,15 +76,15 @@
   VideoRenderer* video_renderer_ = nullptr;
   ClipboardStub* clipboard_stub_ = nullptr;
 
-  scoped_ptr<Session> session_;
-  scoped_ptr<WebrtcTransport> transport_;
+  std::unique_ptr<Session> session_;
+  std::unique_ptr<WebrtcTransport> transport_;
 
-  scoped_ptr<ClientControlDispatcher> control_dispatcher_;
-  scoped_ptr<ClientEventDispatcher> event_dispatcher_;
+  std::unique_ptr<ClientControlDispatcher> control_dispatcher_;
+  std::unique_ptr<ClientEventDispatcher> event_dispatcher_;
   ClipboardFilter clipboard_forwarder_;
   InputFilter event_forwarder_;
 
-  scoped_ptr<WebrtcVideoRendererAdapter> video_adapter_;
+  std::unique_ptr<WebrtcVideoRendererAdapter> video_adapter_;
 
   // Internal state of the connection.
   State state_ = INITIALIZING;
diff --git a/remoting/protocol/webrtc_data_stream_adapter.cc b/remoting/protocol/webrtc_data_stream_adapter.cc
index 0a0ef01..92007c6 100644
--- a/remoting/protocol/webrtc_data_stream_adapter.cc
+++ b/remoting/protocol/webrtc_data_stream_adapter.cc
@@ -11,6 +11,7 @@
 #include "base/callback_helpers.h"
 #include "base/location.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/thread_task_runner_handle.h"
 #include "net/base/net_errors.h"
 #include "remoting/base/compound_buffer.h"
@@ -144,7 +145,7 @@
 
 void WebrtcDataStreamAdapter::Channel::OnMessage(
     const webrtc::DataBuffer& rtc_buffer) {
-  scoped_ptr<CompoundBuffer> buffer(new CompoundBuffer());
+  std::unique_ptr<CompoundBuffer> buffer(new CompoundBuffer());
   buffer->AppendCopyOf(reinterpret_cast<const char*>(rtc_buffer.data.data()),
                        rtc_buffer.data.size());
   buffer->Lock();
@@ -153,7 +154,7 @@
 
 struct WebrtcDataStreamAdapter::PendingChannel {
   PendingChannel() {}
-  PendingChannel(scoped_ptr<Channel> channel,
+  PendingChannel(std::unique_ptr<Channel> channel,
                  const ChannelCreatedCallback& connected_callback)
       : channel(std::move(channel)), connected_callback(connected_callback) {}
   PendingChannel(PendingChannel&& other)
@@ -165,7 +166,7 @@
     return *this;
   }
 
-  scoped_ptr<Channel> channel;
+  std::unique_ptr<Channel> channel;
   ChannelCreatedCallback connected_callback;
 };
 
@@ -204,7 +205,7 @@
   DCHECK(pending_channels_.find(name) == pending_channels_.end());
 
   Channel* channel = new Channel(weak_factory_.GetWeakPtr());
-  pending_channels_[name] = PendingChannel(make_scoped_ptr(channel), callback);
+  pending_channels_[name] = PendingChannel(base::WrapUnique(channel), callback);
 
   if (outgoing_) {
     webrtc::DataChannelInit config;
diff --git a/remoting/protocol/webrtc_transport.cc b/remoting/protocol/webrtc_transport.cc
index fbec3d2..8b630a82 100644
--- a/remoting/protocol/webrtc_transport.cc
+++ b/remoting/protocol/webrtc_transport.cc
@@ -10,6 +10,7 @@
 #include "base/callback_helpers.h"
 #include "base/command_line.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/single_thread_task_runner.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_split.h"
@@ -69,8 +70,9 @@
     : public webrtc::CreateSessionDescriptionObserver {
  public:
   typedef base::Callback<void(
-      scoped_ptr<webrtc::SessionDescriptionInterface> description,
-      const std::string& error)> ResultCallback;
+      std::unique_ptr<webrtc::SessionDescriptionInterface> description,
+      const std::string& error)>
+      ResultCallback;
 
   static CreateSessionDescriptionObserver* Create(
       const ResultCallback& result_callback) {
@@ -79,7 +81,7 @@
   }
   void OnSuccess(webrtc::SessionDescriptionInterface* desc) override {
     base::ResetAndReturn(&result_callback_)
-        .Run(make_scoped_ptr(desc), std::string());
+        .Run(base::WrapUnique(desc), std::string());
   }
   void OnFailure(const std::string& error) override {
     base::ResetAndReturn(&result_callback_).Run(nullptr, error);
@@ -185,7 +187,7 @@
   constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
                            webrtc::MediaConstraintsInterface::kValueTrue);
 
-  scoped_ptr<cricket::PortAllocator> port_allocator =
+  std::unique_ptr<cricket::PortAllocator> port_allocator =
       transport_context_->port_allocator_factory()->CreatePortAllocator(
           transport_context_);
   peer_connection_ = peer_connection_factory_->CreatePeerConnection(
@@ -249,7 +251,7 @@
     }
 
     webrtc::SdpParseError error;
-    scoped_ptr<webrtc::SessionDescriptionInterface> session_description(
+    std::unique_ptr<webrtc::SessionDescriptionInterface> session_description(
         webrtc::CreateSessionDescription(type, sdp, &error));
     if (!session_description) {
       LOG(ERROR) << "Failed to parse the session description: "
@@ -283,7 +285,7 @@
     }
 
     webrtc::SdpParseError error;
-    scoped_ptr<webrtc::IceCandidateInterface> candidate(
+    std::unique_ptr<webrtc::IceCandidateInterface> candidate(
         webrtc::CreateIceCandidate(sdp_mid, sdp_mlineindex, candidate_str,
                                    &error));
     if (!candidate) {
@@ -307,7 +309,7 @@
 }
 
 void WebrtcTransport::OnLocalSessionDescriptionCreated(
-    scoped_ptr<webrtc::SessionDescriptionInterface> description,
+    std::unique_ptr<webrtc::SessionDescriptionInterface> description,
     const std::string& error) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
@@ -329,7 +331,7 @@
   description_sdp = NormalizeSessionDescription(description_sdp);
 
   // Format and send the session description to the peer.
-  scoped_ptr<XmlElement> transport_info(
+  std::unique_ptr<XmlElement> transport_info(
       new XmlElement(QName(kTransportNamespace, "transport"), true));
   XmlElement* offer_tag =
       new XmlElement(QName(kTransportNamespace, "session-description"));
@@ -460,7 +462,7 @@
     const webrtc::IceCandidateInterface* candidate) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
-  scoped_ptr<XmlElement> candidate_element(
+  std::unique_ptr<XmlElement> candidate_element(
       new XmlElement(QName(kTransportNamespace, "candidate")));
   std::string candidate_str;
   if (!candidate->ToString(&candidate_str)) {
diff --git a/remoting/protocol/webrtc_transport.h b/remoting/protocol/webrtc_transport.h
index f3d2cefa..c78aad7 100644
--- a/remoting/protocol/webrtc_transport.h
+++ b/remoting/protocol/webrtc_transport.h
@@ -5,9 +5,10 @@
 #ifndef REMOTING_PROTOCOL_WEBRTC_TRANSPORT_H_
 #define REMOTING_PROTOCOL_WEBRTC_TRANSPORT_H_
 
+#include <memory>
+
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/scoped_vector.h"
 #include "base/memory/weak_ptr.h"
 #include "base/threading/thread_checker.h"
@@ -82,7 +83,7 @@
 
  private:
   void OnLocalSessionDescriptionCreated(
-      scoped_ptr<webrtc::SessionDescriptionInterface> description,
+      std::unique_ptr<webrtc::SessionDescriptionInterface> description,
       const std::string& error);
   void OnLocalDescriptionSet(bool success, const std::string& error);
   void OnRemoteDescriptionSet(bool send_answer,
@@ -119,7 +120,7 @@
 
   crypto::HMAC handshake_hmac_;
 
-  scoped_ptr<webrtc::FakeAudioDeviceModule> fake_audio_device_module_;
+  std::unique_ptr<webrtc::FakeAudioDeviceModule> fake_audio_device_module_;
 
   rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface>
       peer_connection_factory_;
@@ -129,7 +130,7 @@
 
   bool connected_ = false;
 
-  scoped_ptr<buzz::XmlElement> pending_transport_info_message_;
+  std::unique_ptr<buzz::XmlElement> pending_transport_info_message_;
   base::OneShotTimer transport_info_timer_;
 
   ScopedVector<webrtc::IceCandidateInterface> pending_incoming_candidates_;
diff --git a/remoting/protocol/webrtc_transport_unittest.cc b/remoting/protocol/webrtc_transport_unittest.cc
index ca0725af..eb56c8b3 100644
--- a/remoting/protocol/webrtc_transport_unittest.cc
+++ b/remoting/protocol/webrtc_transport_unittest.cc
@@ -94,9 +94,9 @@
     base::RunLoop().RunUntilIdle();
   }
 
-  void ProcessTransportInfo(scoped_ptr<WebrtcTransport>* target_transport,
+  void ProcessTransportInfo(std::unique_ptr<WebrtcTransport>* target_transport,
                             bool normalize_line_endings,
-                            scoped_ptr<buzz::XmlElement> transport_info) {
+                            std::unique_ptr<buzz::XmlElement> transport_info) {
     ASSERT_TRUE(target_transport);
 
     // Reformat the message to normalize line endings by removing CR symbol.
@@ -181,13 +181,13 @@
                                  base::Unretained(this)));
   }
 
-  void OnClientChannelCreated(scoped_ptr<MessagePipe> pipe) {
+  void OnClientChannelCreated(std::unique_ptr<MessagePipe> pipe) {
     client_message_pipe_ = std::move(pipe);
     if (run_loop_ && host_message_pipe_)
       run_loop_->Quit();
   }
 
-  void OnHostChannelCreated(scoped_ptr<MessagePipe> pipe) {
+  void OnHostChannelCreated(std::unique_ptr<MessagePipe> pipe) {
     host_message_pipe_ = std::move(pipe);
     if (run_loop_ && client_message_pipe_)
       run_loop_->Quit();
@@ -219,20 +219,20 @@
 
  protected:
   base::MessageLoopForIO message_loop_;
-  scoped_ptr<base::RunLoop> run_loop_;
+  std::unique_ptr<base::RunLoop> run_loop_;
 
   NetworkSettings network_settings_;
 
-  scoped_ptr<WebrtcTransport> host_transport_;
+  std::unique_ptr<WebrtcTransport> host_transport_;
   TestTransportEventHandler host_event_handler_;
-  scoped_ptr<FakeAuthenticator> host_authenticator_;
+  std::unique_ptr<FakeAuthenticator> host_authenticator_;
 
-  scoped_ptr<WebrtcTransport> client_transport_;
+  std::unique_ptr<WebrtcTransport> client_transport_;
   TestTransportEventHandler client_event_handler_;
-  scoped_ptr<FakeAuthenticator> client_authenticator_;
+  std::unique_ptr<FakeAuthenticator> client_authenticator_;
 
-  scoped_ptr<MessagePipe> client_message_pipe_;
-  scoped_ptr<MessagePipe> host_message_pipe_;
+  std::unique_ptr<MessagePipe> client_message_pipe_;
+  std::unique_ptr<MessagePipe> host_message_pipe_;
 
   ErrorCode client_error_ = OK;
   ErrorCode host_error_ = OK;
diff --git a/remoting/protocol/webrtc_video_capturer_adapter.cc b/remoting/protocol/webrtc_video_capturer_adapter.cc
index 3013bc9..0d5dec0 100644
--- a/remoting/protocol/webrtc_video_capturer_adapter.cc
+++ b/remoting/protocol/webrtc_video_capturer_adapter.cc
@@ -18,7 +18,7 @@
 const int kFramesPerSec = 30;
 
 WebrtcVideoCapturerAdapter::WebrtcVideoCapturerAdapter(
-    scoped_ptr<webrtc::DesktopCapturer> capturer)
+    std::unique_ptr<webrtc::DesktopCapturer> capturer)
     : desktop_capturer_(std::move(capturer)), weak_factory_(this) {
   DCHECK(desktop_capturer_);
 
@@ -157,7 +157,7 @@
   if (!frame)
     return;
 
-  scoped_ptr<webrtc::DesktopFrame> owned_frame(frame);
+  std::unique_ptr<webrtc::DesktopFrame> owned_frame(frame);
 
   // TODO(sergeyu): Currently the adapter keeps generating frames even when
   // nothing is changing on the screen. This is necessary because the video
diff --git a/remoting/protocol/webrtc_video_capturer_adapter.h b/remoting/protocol/webrtc_video_capturer_adapter.h
index 01dd6d4..cf780445 100644
--- a/remoting/protocol/webrtc_video_capturer_adapter.h
+++ b/remoting/protocol/webrtc_video_capturer_adapter.h
@@ -8,10 +8,10 @@
 #include <stddef.h>
 #include <stdint.h>
 
+#include <memory>
 #include <vector>
 
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/threading/thread_checker.h"
 #include "base/timer/timer.h"
@@ -46,7 +46,7 @@
                                    public webrtc::DesktopCapturer::Callback {
  public:
   explicit WebrtcVideoCapturerAdapter(
-      scoped_ptr<webrtc::DesktopCapturer> capturer);
+      std::unique_ptr<webrtc::DesktopCapturer> capturer);
   ~WebrtcVideoCapturerAdapter() override;
 
   void SetSizeCallback(const VideoStream::SizeCallback& size_callback);
@@ -74,12 +74,12 @@
 
   base::ThreadChecker thread_checker_;
 
-  scoped_ptr<webrtc::DesktopCapturer> desktop_capturer_;
+  std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer_;
 
   VideoStream::SizeCallback size_callback_;
 
   // Timer to call CaptureNextFrame().
-  scoped_ptr<base::RepeatingTimer> capture_timer_;
+  std::unique_ptr<base::RepeatingTimer> capture_timer_;
 
   webrtc::DesktopSize frame_size_;
   webrtc::DesktopVector frame_dpi_;
diff --git a/remoting/protocol/webrtc_video_renderer_adapter.cc b/remoting/protocol/webrtc_video_renderer_adapter.cc
index 1dcd4ac0..c3de15f 100644
--- a/remoting/protocol/webrtc_video_renderer_adapter.cc
+++ b/remoting/protocol/webrtc_video_renderer_adapter.cc
@@ -4,12 +4,12 @@
 
 #include "remoting/protocol/webrtc_video_renderer_adapter.h"
 
+#include <memory>
 #include <utility>
 
 #include "base/bind.h"
 #include "base/callback.h"
 #include "base/location.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/single_thread_task_runner.h"
 #include "base/thread_task_runner_handle.h"
 #include "remoting/protocol/frame_consumer.h"
@@ -54,7 +54,7 @@
   // cannot call FrameConsumer::AllocateFrame() here and instead
   // BasicDesktopFrame is created directly. This will not work correctly with
   // all FrameConsumer implementations. Fix this somehow.
-  scoped_ptr<webrtc::DesktopFrame> rgb_frame(new webrtc::BasicDesktopFrame(
+  std::unique_ptr<webrtc::DesktopFrame> rgb_frame(new webrtc::BasicDesktopFrame(
       webrtc::DesktopSize(frame.GetWidth(), frame.GetHeight())));
 
   frame.ConvertToRgbBuffer(
@@ -70,7 +70,7 @@
 }
 
 void WebrtcVideoRendererAdapter::DrawFrame(
-    scoped_ptr<webrtc::DesktopFrame> frame) {
+    std::unique_ptr<webrtc::DesktopFrame> frame) {
   DCHECK(task_runner_->BelongsToCurrentThread());
   frame_consumer_->DrawFrame(std::move(frame), base::Closure());
 }
diff --git a/remoting/protocol/webrtc_video_renderer_adapter.h b/remoting/protocol/webrtc_video_renderer_adapter.h
index 07e6393..a21e3855 100644
--- a/remoting/protocol/webrtc_video_renderer_adapter.h
+++ b/remoting/protocol/webrtc_video_renderer_adapter.h
@@ -5,8 +5,9 @@
 #ifndef REMOTING_PROTOCOL_WEBRTC_VIDEO_RENDERER_ADAPTER_H_
 #define REMOTING_PROTOCOL_WEBRTC_VIDEO_RENDERER_ADAPTER_H_
 
+#include <memory>
+
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "third_party/webrtc/api/mediastreaminterface.h"
 #include "third_party/webrtc/media/base/videosinkinterface.h"
@@ -42,7 +43,7 @@
   void OnFrame(const cricket::VideoFrame& frame) override;
 
  private:
-  void DrawFrame(scoped_ptr<webrtc::DesktopFrame> frame);
+  void DrawFrame(std::unique_ptr<webrtc::DesktopFrame> frame);
 
   scoped_refptr<webrtc::MediaStreamInterface> media_stream_;
   FrameConsumer* frame_consumer_;
diff --git a/remoting/protocol/webrtc_video_stream.cc b/remoting/protocol/webrtc_video_stream.cc
index b43f189..b4dbae4a 100644
--- a/remoting/protocol/webrtc_video_stream.cc
+++ b/remoting/protocol/webrtc_video_stream.cc
@@ -34,11 +34,11 @@
 }
 
 bool WebrtcVideoStream::Start(
-    scoped_ptr<webrtc::DesktopCapturer> desktop_capturer,
+    std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer,
     scoped_refptr<webrtc::PeerConnectionInterface> connection,
     scoped_refptr<webrtc::PeerConnectionFactoryInterface>
         peer_connection_factory) {
-  scoped_ptr<WebrtcVideoCapturerAdapter> capturer_adapter(
+  std::unique_ptr<WebrtcVideoCapturerAdapter> capturer_adapter(
       new WebrtcVideoCapturerAdapter(std::move(desktop_capturer)));
   capturer_adapter_ = capturer_adapter->GetWeakPtr();
 
diff --git a/remoting/protocol/webrtc_video_stream.h b/remoting/protocol/webrtc_video_stream.h
index 83d71cd..8fba34b 100644
--- a/remoting/protocol/webrtc_video_stream.h
+++ b/remoting/protocol/webrtc_video_stream.h
@@ -7,9 +7,10 @@
 
 #include <stdint.h>
 
+#include <memory>
+
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "remoting/protocol/video_stream.h"
 
@@ -32,7 +33,7 @@
   WebrtcVideoStream();
   ~WebrtcVideoStream() override;
 
-  bool Start(scoped_ptr<webrtc::DesktopCapturer> desktop_capturer,
+  bool Start(std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer,
              scoped_refptr<webrtc::PeerConnectionInterface> connection,
              scoped_refptr<webrtc::PeerConnectionFactoryInterface>
                  peer_connection_factory);
diff --git a/remoting/remoting_host_win.gypi b/remoting/remoting_host_win.gypi
index d8a3c5c..a75f8d1f 100644
--- a/remoting/remoting_host_win.gypi
+++ b/remoting/remoting_host_win.gypi
@@ -577,6 +577,7 @@
           'type': 'none',
           'dependencies': [
             '<(icu_gyp_path):icudata',
+            'remote_security_key',
             'remoting_core',
             'remoting_desktop',
             'remoting_it2me_native_messaging_host',
@@ -586,6 +587,7 @@
           ],
           'compiled_inputs': [
             '<(PRODUCT_DIR)/remote_assistance_host.exe',
+            '<(PRODUCT_DIR)/remote_security_key.exe',
             '<(PRODUCT_DIR)/remoting_core.dll',
             '<(PRODUCT_DIR)/remoting_desktop.exe',
             '<(PRODUCT_DIR)/remoting_host.exe',
@@ -593,6 +595,7 @@
           ],
           'compiled_inputs_dst': [
             'files/remote_assistance_host.exe',
+            'files/remote_security_key.exe',
             'files/remoting_core.dll',
             'files/remoting_desktop.exe',
             'files/remoting_host.exe',
diff --git a/remoting/signaling/fake_signal_strategy.cc b/remoting/signaling/fake_signal_strategy.cc
index 4acb424..9ea6ebd 100644
--- a/remoting/signaling/fake_signal_strategy.cc
+++ b/remoting/signaling/fake_signal_strategy.cc
@@ -98,7 +98,7 @@
   listeners_.RemoveObserver(listener);
 }
 
-bool FakeSignalStrategy::SendStanza(scoped_ptr<buzz::XmlElement> stanza) {
+bool FakeSignalStrategy::SendStanza(std::unique_ptr<buzz::XmlElement> stanza) {
   DCHECK(CalledOnValidThread());
 
   stanza->SetAttr(buzz::QN_FROM, jid_);
@@ -126,14 +126,14 @@
 void FakeSignalStrategy::DeliverMessageOnThread(
     scoped_refptr<base::SingleThreadTaskRunner> thread,
     base::WeakPtr<FakeSignalStrategy> target,
-    scoped_ptr<buzz::XmlElement> stanza) {
+    std::unique_ptr<buzz::XmlElement> stanza) {
   thread->PostTask(FROM_HERE,
                    base::Bind(&FakeSignalStrategy::OnIncomingMessage,
                               target, base::Passed(&stanza)));
 }
 
 void FakeSignalStrategy::OnIncomingMessage(
-    scoped_ptr<buzz::XmlElement> stanza) {
+    std::unique_ptr<buzz::XmlElement> stanza) {
   DCHECK(CalledOnValidThread());
 
   buzz::XmlElement* stanza_ptr = stanza.get();
diff --git a/remoting/signaling/fake_signal_strategy.h b/remoting/signaling/fake_signal_strategy.h
index 659f1c0..b828a2e 100644
--- a/remoting/signaling/fake_signal_strategy.h
+++ b/remoting/signaling/fake_signal_strategy.h
@@ -53,20 +53,20 @@
   std::string GetLocalJid() const override;
   void AddListener(Listener* listener) override;
   void RemoveListener(Listener* listener) override;
-  bool SendStanza(scoped_ptr<buzz::XmlElement> stanza) override;
+  bool SendStanza(std::unique_ptr<buzz::XmlElement> stanza) override;
   std::string GetNextId() override;
 
  private:
-  typedef base::Callback<void(scoped_ptr<buzz::XmlElement> message)>
+  typedef base::Callback<void(std::unique_ptr<buzz::XmlElement> message)>
       PeerCallback;
 
   static void DeliverMessageOnThread(
       scoped_refptr<base::SingleThreadTaskRunner> thread,
       base::WeakPtr<FakeSignalStrategy> target,
-      scoped_ptr<buzz::XmlElement> stanza);
+      std::unique_ptr<buzz::XmlElement> stanza);
 
   // Called by the |peer_|. Takes ownership of |stanza|.
-  void OnIncomingMessage(scoped_ptr<buzz::XmlElement> stanza);
+  void OnIncomingMessage(std::unique_ptr<buzz::XmlElement> stanza);
   void SetPeerCallback(const PeerCallback& peer_callback);
 
   scoped_refptr<base::SingleThreadTaskRunner> main_thread_;
diff --git a/remoting/signaling/iq_sender.cc b/remoting/signaling/iq_sender.cc
index 498fdb5..18530256 100644
--- a/remoting/signaling/iq_sender.cc
+++ b/remoting/signaling/iq_sender.cc
@@ -4,13 +4,13 @@
 
 #include "remoting/signaling/iq_sender.h"
 
+#include <memory>
 #include <utility>
 
 #include "base/bind.h"
 #include "base/callback_helpers.h"
 #include "base/location.h"
 #include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/single_thread_task_runner.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/thread_task_runner_handle.h"
@@ -23,11 +23,11 @@
 namespace remoting {
 
 // static
-scoped_ptr<buzz::XmlElement> IqSender::MakeIqStanza(
+std::unique_ptr<buzz::XmlElement> IqSender::MakeIqStanza(
     const std::string& type,
     const std::string& addressee,
-    scoped_ptr<buzz::XmlElement> iq_body) {
-  scoped_ptr<buzz::XmlElement> stanza(new buzz::XmlElement(buzz::QN_IQ));
+    std::unique_ptr<buzz::XmlElement> iq_body) {
+  std::unique_ptr<buzz::XmlElement> stanza(new buzz::XmlElement(buzz::QN_IQ));
   stanza->AddAttr(buzz::QN_TYPE, type);
   if (!addressee.empty())
     stanza->AddAttr(buzz::QN_TO, addressee);
@@ -44,8 +44,9 @@
   signal_strategy_->RemoveListener(this);
 }
 
-scoped_ptr<IqRequest> IqSender::SendIq(scoped_ptr<buzz::XmlElement> stanza,
-                                       const ReplyCallback& callback) {
+std::unique_ptr<IqRequest> IqSender::SendIq(
+    std::unique_ptr<buzz::XmlElement> stanza,
+    const ReplyCallback& callback) {
   std::string addressee = stanza->Attr(buzz::QN_TO);
   std::string id = signal_strategy_->GetNextId();
   stanza->AddAttr(buzz::QN_ID, id);
@@ -53,16 +54,17 @@
     return nullptr;
   }
   DCHECK(requests_.find(id) == requests_.end());
-  scoped_ptr<IqRequest> request(new IqRequest(this, callback, addressee));
+  std::unique_ptr<IqRequest> request(new IqRequest(this, callback, addressee));
   if (!callback.is_null())
     requests_[id] = request.get();
   return request;
 }
 
-scoped_ptr<IqRequest> IqSender::SendIq(const std::string& type,
-                                       const std::string& addressee,
-                                       scoped_ptr<buzz::XmlElement> iq_body,
-                                       const ReplyCallback& callback) {
+std::unique_ptr<IqRequest> IqSender::SendIq(
+    const std::string& type,
+    const std::string& addressee,
+    std::unique_ptr<buzz::XmlElement> iq_body,
+    const ReplyCallback& callback) {
   return SendIq(MakeIqStanza(type, addressee, std::move(iq_body)), callback);
 }
 
@@ -153,13 +155,13 @@
 void IqRequest::OnResponse(const buzz::XmlElement* stanza) {
   // It's unsafe to delete signal strategy here, and the callback may
   // want to do that, so we post task to invoke the callback later.
-  scoped_ptr<buzz::XmlElement> stanza_copy(new buzz::XmlElement(*stanza));
+  std::unique_ptr<buzz::XmlElement> stanza_copy(new buzz::XmlElement(*stanza));
   base::ThreadTaskRunnerHandle::Get()->PostTask(
       FROM_HERE, base::Bind(&IqRequest::DeliverResponse, AsWeakPtr(),
                             base::Passed(&stanza_copy)));
 }
 
-void IqRequest::DeliverResponse(scoped_ptr<buzz::XmlElement> stanza) {
+void IqRequest::DeliverResponse(std::unique_ptr<buzz::XmlElement> stanza) {
   CallCallback(stanza.get());
 }
 
diff --git a/remoting/signaling/iq_sender.h b/remoting/signaling/iq_sender.h
index e98ed970..be7c986 100644
--- a/remoting/signaling/iq_sender.h
+++ b/remoting/signaling/iq_sender.h
@@ -6,12 +6,12 @@
 #define REMOTING_SIGNALING_IQ_SENDER_H_
 
 #include <map>
+#include <memory>
 #include <string>
 
 #include "base/callback.h"
 #include "base/compiler_specific.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "remoting/signaling/signal_strategy.h"
 
@@ -45,14 +45,14 @@
   // received. Destroy the returned IqRequest to cancel the callback.
   // Caller must take ownership of the result. Result must be
   // destroyed before sender is destroyed.
-  scoped_ptr<IqRequest> SendIq(scoped_ptr<buzz::XmlElement> stanza,
-                               const ReplyCallback& callback);
+  std::unique_ptr<IqRequest> SendIq(std::unique_ptr<buzz::XmlElement> stanza,
+                                    const ReplyCallback& callback);
 
   // Same as above, but also formats the message.
-  scoped_ptr<IqRequest> SendIq(const std::string& type,
-                               const std::string& addressee,
-                               scoped_ptr<buzz::XmlElement> iq_body,
-                               const ReplyCallback& callback);
+  std::unique_ptr<IqRequest> SendIq(const std::string& type,
+                                    const std::string& addressee,
+                                    std::unique_ptr<buzz::XmlElement> iq_body,
+                                    const ReplyCallback& callback);
 
   // SignalStrategy::Listener implementation.
   void OnSignalStrategyStateChange(SignalStrategy::State state) override;
@@ -63,10 +63,10 @@
   friend class IqRequest;
 
   // Helper function used to create iq stanzas.
-  static scoped_ptr<buzz::XmlElement> MakeIqStanza(
+  static std::unique_ptr<buzz::XmlElement> MakeIqStanza(
       const std::string& type,
       const std::string& addressee,
-      scoped_ptr<buzz::XmlElement> iq_body);
+      std::unique_ptr<buzz::XmlElement> iq_body);
 
   // Removes |request| from the list of pending requests. Called by IqRequest.
   void RemoveRequest(IqRequest* request);
@@ -97,7 +97,7 @@
   // Called by IqSender when a response is received.
   void OnResponse(const buzz::XmlElement* stanza);
 
-  void DeliverResponse(scoped_ptr<buzz::XmlElement> stanza);
+  void DeliverResponse(std::unique_ptr<buzz::XmlElement> stanza);
 
   IqSender* sender_;
   IqSender::ReplyCallback callback_;
diff --git a/remoting/signaling/iq_sender_unittest.cc b/remoting/signaling/iq_sender_unittest.cc
index aa025dc..bcf573d 100644
--- a/remoting/signaling/iq_sender_unittest.cc
+++ b/remoting/signaling/iq_sender_unittest.cc
@@ -60,7 +60,7 @@
 
  protected:
   void SendTestMessage() {
-    scoped_ptr<XmlElement> iq_body(
+    std::unique_ptr<XmlElement> iq_body(
         new XmlElement(QName(kNamespace, kBodyTag)));
     XmlElement* sent_stanza;
     EXPECT_CALL(signal_strategy_, GetNextId())
@@ -83,8 +83,8 @@
   }
 
   bool FormatAndDeliverResponse(const std::string& from,
-                                scoped_ptr<XmlElement>* response_out) {
-    scoped_ptr<XmlElement> response(new XmlElement(buzz::QN_IQ));
+                                std::unique_ptr<XmlElement>* response_out) {
+    std::unique_ptr<XmlElement> response(new XmlElement(buzz::QN_IQ));
     response->AddAttr(QName(std::string(), "type"), "result");
     response->AddAttr(QName(std::string(), "id"), kStanzaId);
     response->AddAttr(QName(std::string(), "from"), from);
@@ -103,9 +103,9 @@
 
   base::MessageLoop message_loop_;
   MockSignalStrategy signal_strategy_;
-  scoped_ptr<IqSender> sender_;
+  std::unique_ptr<IqSender> sender_;
   MockCallback callback_;
-  scoped_ptr<IqRequest> request_;
+  std::unique_ptr<IqRequest> request_;
 };
 
 TEST_F(IqSenderTest, SendIq) {
@@ -113,7 +113,7 @@
     SendTestMessage();
   });
 
-  scoped_ptr<XmlElement> response;
+  std::unique_ptr<XmlElement> response;
   EXPECT_TRUE(FormatAndDeliverResponse(kTo, &response));
 
   EXPECT_CALL(callback_, OnReply(request_.get(), XmlEq(response.get())));
@@ -140,7 +140,7 @@
 
   // Set upper-case from value, which is equivalent to kTo in the original
   // message.
-  scoped_ptr<XmlElement> response;
+  std::unique_ptr<XmlElement> response;
   EXPECT_TRUE(FormatAndDeliverResponse("USER@domain.com", &response));
 
   EXPECT_CALL(callback_, OnReply(request_.get(), XmlEq(response.get())));
diff --git a/remoting/signaling/log_to_server.cc b/remoting/signaling/log_to_server.cc
index 2da454f..0116cce6 100644
--- a/remoting/signaling/log_to_server.cc
+++ b/remoting/signaling/log_to_server.cc
@@ -59,7 +59,7 @@
     return;
   }
   // Make one stanza containing all the pending entries.
-  scoped_ptr<XmlElement> stanza(ServerLogEntry::MakeStanza());
+  std::unique_ptr<XmlElement> stanza(ServerLogEntry::MakeStanza());
   while (!pending_entries_.empty()) {
     ServerLogEntry& entry = pending_entries_.front();
     stanza->AddElement(entry.ToStanza().release());
diff --git a/remoting/signaling/log_to_server.h b/remoting/signaling/log_to_server.h
index ca46a8ef..6986c816 100644
--- a/remoting/signaling/log_to_server.h
+++ b/remoting/signaling/log_to_server.h
@@ -46,7 +46,7 @@
 
   ServerLogEntry::Mode mode_;
   SignalStrategy* signal_strategy_;
-  scoped_ptr<IqSender> iq_sender_;
+  std::unique_ptr<IqSender> iq_sender_;
   std::string directory_bot_jid_;
 
   std::deque<ServerLogEntry> pending_entries_;
diff --git a/remoting/signaling/log_to_server_unittest.cc b/remoting/signaling/log_to_server_unittest.cc
index 494d3077..772a33e 100644
--- a/remoting/signaling/log_to_server_unittest.cc
+++ b/remoting/signaling/log_to_server_unittest.cc
@@ -50,7 +50,7 @@
   base::MessageLoop message_loop_;
   base::RunLoop run_loop_;
   MockSignalStrategy signal_strategy_;
-  scoped_ptr<LogToServer> log_to_server_;
+  std::unique_ptr<LogToServer> log_to_server_;
 };
 
 TEST_F(LogToServerTest, LogWhenConnected) {
diff --git a/remoting/signaling/mock_signal_strategy.h b/remoting/signaling/mock_signal_strategy.h
index 3245931..79c3ea5 100644
--- a/remoting/signaling/mock_signal_strategy.h
+++ b/remoting/signaling/mock_signal_strategy.h
@@ -2,7 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
 #include "remoting/signaling/iq_sender.h"
 #include "remoting/signaling/signal_strategy.h"
 #include "testing/gmock/include/gmock/gmock.h"
@@ -27,7 +28,7 @@
   // GMock currently doesn't support move-only arguments, so we have
   // to use this hack here.
   MOCK_METHOD1(SendStanzaPtr, bool(buzz::XmlElement* stanza));
-  bool SendStanza(scoped_ptr<buzz::XmlElement> stanza) override {
+  bool SendStanza(std::unique_ptr<buzz::XmlElement> stanza) override {
     return SendStanzaPtr(stanza.release());
   }
 };
diff --git a/remoting/signaling/push_notification_subscriber.cc b/remoting/signaling/push_notification_subscriber.cc
index f0b6662..0984df66 100644
--- a/remoting/signaling/push_notification_subscriber.cc
+++ b/remoting/signaling/push_notification_subscriber.cc
@@ -6,6 +6,7 @@
 
 #include "base/bind.h"
 #include "base/callback.h"
+#include "base/memory/ptr_util.h"
 #include "remoting/base/logging.h"
 #include "remoting/signaling/iq_sender.h"
 #include "remoting/signaling/jid_util.h"
@@ -72,7 +73,7 @@
   // Send the request.
   iq_sender_.reset(new IqSender(signal_strategy_));
   iq_request_ = iq_sender_->SendIq(
-      "set", bare_jid, make_scoped_ptr(subscribe_element),
+      "set", bare_jid, base::WrapUnique(subscribe_element),
       base::Bind(&PushNotificationSubscriber::OnSubscriptionResult,
                  base::Unretained(this)));
 }
diff --git a/remoting/signaling/push_notification_subscriber.h b/remoting/signaling/push_notification_subscriber.h
index 9731e6a4..d379b95 100644
--- a/remoting/signaling/push_notification_subscriber.h
+++ b/remoting/signaling/push_notification_subscriber.h
@@ -5,11 +5,11 @@
 #ifndef REMOTING_HOST_GCD_NOTIFICATION_SUBSCRIBER_H_
 #define REMOTING_HOST_GCD_NOTIFICATION_SUBSCRIBER_H_
 
+#include <memory>
 #include <string>
 #include <vector>
 
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "remoting/signaling/signal_strategy.h"
 
 namespace remoting {
@@ -47,8 +47,8 @@
 
   SignalStrategy* signal_strategy_;
   SubscriptionList subscriptions_;
-  scoped_ptr<IqSender> iq_sender_;
-  scoped_ptr<IqRequest> iq_request_;
+  std::unique_ptr<IqSender> iq_sender_;
+  std::unique_ptr<IqRequest> iq_request_;
 
   DISALLOW_COPY_AND_ASSIGN(PushNotificationSubscriber);
 };
diff --git a/remoting/signaling/server_log_entry.cc b/remoting/signaling/server_log_entry.cc
index 080f8ea..421edc38 100644
--- a/remoting/signaling/server_log_entry.cc
+++ b/remoting/signaling/server_log_entry.cc
@@ -5,6 +5,7 @@
 #include "remoting/signaling/server_log_entry.h"
 
 #include "base/logging.h"
+#include "base/memory/ptr_util.h"
 #include "base/sys_info.h"
 #include "remoting/base/constants.h"
 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h"
@@ -72,14 +73,14 @@
 }
 
 // static
-scoped_ptr<XmlElement> ServerLogEntry::MakeStanza() {
-  return make_scoped_ptr(
+std::unique_ptr<XmlElement> ServerLogEntry::MakeStanza() {
+  return base::WrapUnique(
       new XmlElement(QName(kChromotingXmlNamespace, kLogCommand)));
 }
 
-scoped_ptr<XmlElement> ServerLogEntry::ToStanza() const {
-  scoped_ptr<XmlElement> stanza(new XmlElement(QName(
-      kChromotingXmlNamespace, kLogEntry)));
+std::unique_ptr<XmlElement> ServerLogEntry::ToStanza() const {
+  std::unique_ptr<XmlElement> stanza(
+      new XmlElement(QName(kChromotingXmlNamespace, kLogEntry)));
   ValuesMap::const_iterator iter;
   for (iter = values_map_.begin(); iter != values_map_.end(); ++iter) {
     stanza->AddAttr(QName(std::string(), iter->first), iter->second);
diff --git a/remoting/signaling/server_log_entry.h b/remoting/signaling/server_log_entry.h
index fbcba0f..395432f 100644
--- a/remoting/signaling/server_log_entry.h
+++ b/remoting/signaling/server_log_entry.h
@@ -6,9 +6,9 @@
 #define REMOTING_SIGNALING_SERVER_LOG_ENTRY_H_
 
 #include <map>
+#include <memory>
 #include <string>
 
-#include "base/memory/scoped_ptr.h"
 
 namespace buzz {
 class XmlElement;
@@ -49,10 +49,10 @@
   // Constructs a log stanza. The caller should add one or more log entry
   // stanzas as children of this stanza, before sending the log stanza to
   // the remoting bot.
-  static scoped_ptr<buzz::XmlElement> MakeStanza();
+  static std::unique_ptr<buzz::XmlElement> MakeStanza();
 
   // Converts this object to an XML stanza.
-  scoped_ptr<buzz::XmlElement> ToStanza() const;
+  std::unique_ptr<buzz::XmlElement> ToStanza() const;
 
  private:
   typedef std::map<std::string, std::string> ValuesMap;
diff --git a/remoting/signaling/signal_strategy.h b/remoting/signaling/signal_strategy.h
index 499159c..479f8b7 100644
--- a/remoting/signaling/signal_strategy.h
+++ b/remoting/signaling/signal_strategy.h
@@ -5,10 +5,10 @@
 #ifndef REMOTING_SIGNALING_SIGNAL_STRATEGY_H_
 #define REMOTING_SIGNALING_SIGNAL_STRATEGY_H_
 
+#include <memory>
 #include <string>
 
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 
 namespace buzz {
 class XmlElement;
@@ -87,7 +87,7 @@
   virtual void RemoveListener(Listener* listener) = 0;
 
   // Sends a raw XMPP stanza. Returns false if the stanza couldn't be send.
-  virtual bool SendStanza(scoped_ptr<buzz::XmlElement> stanza) = 0;
+  virtual bool SendStanza(std::unique_ptr<buzz::XmlElement> stanza) = 0;
 
   // Returns new ID that should be used for the next outgoing IQ
   // request.
diff --git a/remoting/signaling/xmpp_login_handler.cc b/remoting/signaling/xmpp_login_handler.cc
index dc123823..1e83af8 100644
--- a/remoting/signaling/xmpp_login_handler.cc
+++ b/remoting/signaling/xmpp_login_handler.cc
@@ -83,7 +83,7 @@
   stream_parser_->AppendData(data);
 }
 
-void XmppLoginHandler::OnStanza(scoped_ptr<buzz::XmlElement> stanza) {
+void XmppLoginHandler::OnStanza(std::unique_ptr<buzz::XmlElement> stanza) {
   switch (state_) {
     case State::WAIT_STREAM_HEADER: {
       if (stanza->Name() == kJabberFeaturesName &&
diff --git a/remoting/signaling/xmpp_login_handler.h b/remoting/signaling/xmpp_login_handler.h
index 33d87e6..451498f9 100644
--- a/remoting/signaling/xmpp_login_handler.h
+++ b/remoting/signaling/xmpp_login_handler.h
@@ -5,10 +5,10 @@
 #ifndef REMOTING_SIGNALING_XMPP_LOGIN_HANDLER_H_
 #define REMOTING_SIGNALING_XMPP_LOGIN_HANDLER_H_
 
+#include <memory>
 #include <string>
 
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "remoting/signaling/signal_strategy.h"
 
 // Undefine SendMessage and ERROR defined in Windows headers.
@@ -40,7 +40,7 @@
     virtual void SendMessage(const std::string& message) = 0;
     virtual void StartTls() = 0;
     virtual void OnHandshakeDone(const std::string& jid,
-                                 scoped_ptr<XmppStreamParser> parser) = 0;
+                                 std::unique_ptr<XmppStreamParser> parser) = 0;
     virtual void OnLoginHandlerError(SignalStrategy::Error error) = 0;
 
    protected:
@@ -112,7 +112,7 @@
   };
 
   // Callbacks for XmppStreamParser.
-  void OnStanza(scoped_ptr<buzz::XmlElement> stanza);
+  void OnStanza(std::unique_ptr<buzz::XmlElement> stanza);
   void OnParserError();
 
   // Starts authentication handshake in WAIT_STREAM_HEADER_AFTER_TLS state.
@@ -134,7 +134,7 @@
 
   std::string jid_;
 
-  scoped_ptr<XmppStreamParser> stream_parser_;
+  std::unique_ptr<XmppStreamParser> stream_parser_;
 
   DISALLOW_COPY_AND_ASSIGN(XmppLoginHandler);
 };
diff --git a/remoting/signaling/xmpp_login_handler_unittest.cc b/remoting/signaling/xmpp_login_handler_unittest.cc
index 125a8ac..885c4ce7 100644
--- a/remoting/signaling/xmpp_login_handler_unittest.cc
+++ b/remoting/signaling/xmpp_login_handler_unittest.cc
@@ -51,7 +51,7 @@
   }
 
   void OnHandshakeDone(const std::string& jid,
-                       scoped_ptr<XmppStreamParser> parser) override {
+                       std::unique_ptr<XmppStreamParser> parser) override {
     jid_ = jid;
     parser_ = std::move(parser);
     if (delete_login_handler_from_delegate_)
@@ -70,11 +70,11 @@
 
   base::MessageLoop message_loop_;
 
-  scoped_ptr<XmppLoginHandler> login_handler_;
+  std::unique_ptr<XmppLoginHandler> login_handler_;
   std::string sent_data_;
   bool start_tls_called_;
   std::string jid_;
-  scoped_ptr<XmppStreamParser> parser_;
+  std::unique_ptr<XmppStreamParser> parser_;
   SignalStrategy::Error error_;
   bool delete_login_handler_from_delegate_ = false;
 };
diff --git a/remoting/signaling/xmpp_signal_strategy.cc b/remoting/signaling/xmpp_signal_strategy.cc
index 10aea02..4e0ff69 100644
--- a/remoting/signaling/xmpp_signal_strategy.cc
+++ b/remoting/signaling/xmpp_signal_strategy.cc
@@ -67,7 +67,7 @@
   std::string GetLocalJid() const;
   void AddListener(Listener* listener);
   void RemoveListener(Listener* listener);
-  bool SendStanza(scoped_ptr<buzz::XmlElement> stanza);
+  bool SendStanza(std::unique_ptr<buzz::XmlElement> stanza);
 
   void SetAuthInfo(const std::string& username,
                    const std::string& auth_token);
@@ -99,14 +99,14 @@
   void SendMessage(const std::string& message) override;
   void StartTls() override;
   void OnHandshakeDone(const std::string& jid,
-                       scoped_ptr<XmppStreamParser> parser) override;
+                       std::unique_ptr<XmppStreamParser> parser) override;
   void OnLoginHandlerError(SignalStrategy::Error error) override;
 
   // Callback for BufferedSocketWriter.
   void OnMessageSent();
 
   // Event handlers for XmppStreamParser.
-  void OnStanza(const scoped_ptr<buzz::XmlElement> stanza);
+  void OnStanza(const std::unique_ptr<buzz::XmlElement> stanza);
   void OnParserError();
 
   void OnNetworkError(int error);
@@ -118,19 +118,19 @@
   XmppServerConfig xmpp_server_config_;
 
   // Used by the |socket_|.
-  scoped_ptr<net::CertVerifier> cert_verifier_;
-  scoped_ptr<net::TransportSecurityState> transport_security_state_;
+  std::unique_ptr<net::CertVerifier> cert_verifier_;
+  std::unique_ptr<net::TransportSecurityState> transport_security_state_;
 
-  scoped_ptr<net::StreamSocket> socket_;
-  scoped_ptr<BufferedSocketWriter> writer_;
+  std::unique_ptr<net::StreamSocket> socket_;
+  std::unique_ptr<BufferedSocketWriter> writer_;
   int pending_writes_ = 0;
   scoped_refptr<net::IOBuffer> read_buffer_;
   bool read_pending_ = false;
 
   TlsState tls_state_ = TlsState::NOT_REQUESTED;
 
-  scoped_ptr<XmppLoginHandler> login_handler_;
-  scoped_ptr<XmppStreamParser> stream_parser_;
+  std::unique_ptr<XmppLoginHandler> login_handler_;
+  std::unique_ptr<XmppStreamParser> stream_parser_;
   std::string jid_;
 
   Error error_ = OK;
@@ -236,7 +236,8 @@
   listeners_.RemoveObserver(listener);
 }
 
-bool XmppSignalStrategy::Core::SendStanza(scoped_ptr<buzz::XmlElement> stanza) {
+bool XmppSignalStrategy::Core::SendStanza(
+    std::unique_ptr<buzz::XmlElement> stanza) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
   if (!stream_parser_) {
@@ -288,7 +289,7 @@
 
   DCHECK(!read_pending_);
 
-  scoped_ptr<net::ClientSocketHandle> socket_handle(
+  std::unique_ptr<net::ClientSocketHandle> socket_handle(
       new net::ClientSocketHandle());
   socket_handle->SetSocket(std::move(socket_));
 
@@ -311,7 +312,7 @@
 
 void XmppSignalStrategy::Core::OnHandshakeDone(
     const std::string& jid,
-    scoped_ptr<XmppStreamParser> parser) {
+    std::unique_ptr<XmppStreamParser> parser) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
   jid_ = jid;
@@ -345,7 +346,7 @@
 }
 
 void XmppSignalStrategy::Core::OnStanza(
-    const scoped_ptr<buzz::XmlElement> stanza) {
+    const std::unique_ptr<buzz::XmlElement> stanza) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
   base::ObserverListBase<Listener>::Iterator it(&listeners_);
@@ -526,7 +527,7 @@
 void XmppSignalStrategy::RemoveListener(Listener* listener) {
   core_->RemoveListener(listener);
 }
-bool XmppSignalStrategy::SendStanza(scoped_ptr<buzz::XmlElement> stanza) {
+bool XmppSignalStrategy::SendStanza(std::unique_ptr<buzz::XmlElement> stanza) {
   return core_->SendStanza(std::move(stanza));
 }
 
diff --git a/remoting/signaling/xmpp_signal_strategy.h b/remoting/signaling/xmpp_signal_strategy.h
index 4743d9f..bd06015 100644
--- a/remoting/signaling/xmpp_signal_strategy.h
+++ b/remoting/signaling/xmpp_signal_strategy.h
@@ -7,10 +7,11 @@
 
 #include "remoting/signaling/signal_strategy.h"
 
+#include <memory>
+
 #include "base/compiler_specific.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 
 namespace net {
 class ClientSocketFactory;
@@ -50,7 +51,7 @@
   std::string GetLocalJid() const override;
   void AddListener(Listener* listener) override;
   void RemoveListener(Listener* listener) override;
-  bool SendStanza(scoped_ptr<buzz::XmlElement> stanza) override;
+  bool SendStanza(std::unique_ptr<buzz::XmlElement> stanza) override;
   std::string GetNextId() override;
 
   // This method is used to update the auth info (for example when the OAuth
@@ -62,7 +63,7 @@
  private:
   class Core;
 
-  scoped_ptr<Core> core_;
+  std::unique_ptr<Core> core_;
 
   DISALLOW_COPY_AND_ASSIGN(XmppSignalStrategy);
 };
diff --git a/remoting/signaling/xmpp_signal_strategy_unittest.cc b/remoting/signaling/xmpp_signal_strategy_unittest.cc
index fcfdce70..ad4fe35ee 100644
--- a/remoting/signaling/xmpp_signal_strategy_unittest.cc
+++ b/remoting/signaling/xmpp_signal_strategy_unittest.cc
@@ -7,6 +7,7 @@
 #include <utility>
 
 #include "base/base64.h"
+#include "base/memory/ptr_util.h"
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
 #include "net/socket/socket_test_util.h"
@@ -89,8 +90,8 @@
 
 class MockClientSocketFactory : public net::MockClientSocketFactory {
  public:
-  scoped_ptr<net::SSLClientSocket> CreateSSLClientSocket(
-      scoped_ptr<net::ClientSocketHandle> transport_socket,
+  std::unique_ptr<net::SSLClientSocket> CreateSSLClientSocket(
+      std::unique_ptr<net::ClientSocketHandle> transport_socket,
       const net::HostPortPair& host_and_port,
       const net::SSLConfig& ssl_config,
       const net::SSLClientSocketContext& context) override {
@@ -119,7 +120,7 @@
   void SetUp() override {
     request_context_getter_ = new net::TestURLRequestContextGetter(
         message_loop_.task_runner(),
-        make_scoped_ptr(new net::TestURLRequestContext()));
+        base::WrapUnique(new net::TestURLRequestContext()));
   }
 
   void CreateSignalStrategy(int port) {
@@ -145,7 +146,7 @@
 
   bool OnSignalStrategyIncomingStanza(const buzz::XmlElement* stanza) override {
     received_messages_.push_back(
-        make_scoped_ptr(new buzz::XmlElement(*stanza)));
+        base::WrapUnique(new buzz::XmlElement(*stanza)));
     return true;
   }
 
@@ -155,9 +156,9 @@
   base::MessageLoop message_loop_;
   scoped_refptr<net::TestURLRequestContextGetter> request_context_getter_;
   MockClientSocketFactory client_socket_factory_;
-  scoped_ptr<XmppSocketDataProvider> socket_data_provider_;
-  scoped_ptr<net::SSLSocketDataProvider> ssl_socket_data_provider_;
-  scoped_ptr<XmppSignalStrategy> signal_strategy_;
+  std::unique_ptr<XmppSocketDataProvider> socket_data_provider_;
+  std::unique_ptr<net::SSLSocketDataProvider> ssl_socket_data_provider_;
+  std::unique_ptr<XmppSignalStrategy> signal_strategy_;
 
   std::vector<SignalStrategy::State> state_history_;
   ScopedVector<buzz::XmlElement> received_messages_;
@@ -272,7 +273,7 @@
   CreateSignalStrategy(kDefaultPort);
   Connect(true);
 
-  EXPECT_TRUE(signal_strategy_->SendStanza(make_scoped_ptr(
+  EXPECT_TRUE(signal_strategy_->SendStanza(base::WrapUnique(
       new buzz::XmlElement(buzz::QName(std::string(), "hello")))));
   EXPECT_EQ("<hello/>", socket_data_provider_->GetAndClearWrittenData());
 
@@ -298,7 +299,7 @@
   EXPECT_EQ(SignalStrategy::OK, signal_strategy_->GetError());
 
   // Can't send messages anymore.
-  EXPECT_FALSE(signal_strategy_->SendStanza(make_scoped_ptr(
+  EXPECT_FALSE(signal_strategy_->SendStanza(base::WrapUnique(
       new buzz::XmlElement(buzz::QName(std::string(), "hello")))));
 
   // Try connecting again.
@@ -316,7 +317,7 @@
   EXPECT_EQ(SignalStrategy::NETWORK_ERROR, signal_strategy_->GetError());
 
   // Can't send messages anymore.
-  EXPECT_FALSE(signal_strategy_->SendStanza(make_scoped_ptr(
+  EXPECT_FALSE(signal_strategy_->SendStanza(base::WrapUnique(
       new buzz::XmlElement(buzz::QName(std::string(), "hello")))));
 
   // Try connecting again.
@@ -330,7 +331,7 @@
   socket_data_provider_->set_write_error(net::ERR_FAILED);
 
   // Next SendMessage() will call Write() which will fail.
-  EXPECT_FALSE(signal_strategy_->SendStanza(make_scoped_ptr(
+  EXPECT_FALSE(signal_strategy_->SendStanza(base::WrapUnique(
       new buzz::XmlElement(buzz::QName(std::string(), "hello")))));
 
   EXPECT_EQ(3U, state_history_.size());
diff --git a/remoting/signaling/xmpp_stream_parser.cc b/remoting/signaling/xmpp_stream_parser.cc
index 22cbbee..f205d1862 100644
--- a/remoting/signaling/xmpp_stream_parser.cc
+++ b/remoting/signaling/xmpp_stream_parser.cc
@@ -7,6 +7,7 @@
 #include "base/location.h"
 #include "base/logging.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/single_thread_task_runner.h"
 #include "base/thread_task_runner_handle.h"
 #include "third_party/webrtc/libjingle/xmllite/xmlbuilder.h"
@@ -17,7 +18,7 @@
 
 class XmppStreamParser::Core : public buzz::XmlParseHandler {
  public:
-  typedef base::Callback<void(scoped_ptr<buzz::XmlElement> stanza)>
+  typedef base::Callback<void(std::unique_ptr<buzz::XmlElement> stanza)>
       OnStanzaCallback;
 
   Core();
@@ -82,7 +83,7 @@
 
   ++depth_;
   if (depth_ == 1) {
-    scoped_ptr<buzz::XmlElement> header(
+    std::unique_ptr<buzz::XmlElement> header(
         buzz::XmlBuilder::BuildElement(context, name, atts));
     if (!header) {
       LOG(ERROR) << "Failed to parse XMPP stream header.";
@@ -109,7 +110,7 @@
 
   if (depth_ == 1) {
     if (!on_stanza_callback_.is_null())
-      on_stanza_callback_.Run(make_scoped_ptr(builder_.CreateElement()));
+      on_stanza_callback_.Run(base::WrapUnique(builder_.CreateElement()));
   }
 }
 
diff --git a/remoting/signaling/xmpp_stream_parser.h b/remoting/signaling/xmpp_stream_parser.h
index b05d127..de8959e 100644
--- a/remoting/signaling/xmpp_stream_parser.h
+++ b/remoting/signaling/xmpp_stream_parser.h
@@ -5,11 +5,11 @@
 #ifndef REMOTING_SIGNALING_XMPP_STREAM_PARSER_H_
 #define REMOTING_SIGNALING_XMPP_STREAM_PARSER_H_
 
+#include <memory>
 #include <string>
 
 #include "base/callback.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 
 namespace buzz {
 class XmlElement;
@@ -22,7 +22,7 @@
 // |on_error_callback| specified using SetCallbacks().
 class XmppStreamParser {
  public:
-  typedef base::Callback<void(scoped_ptr<buzz::XmlElement> stanza)>
+  typedef base::Callback<void(std::unique_ptr<buzz::XmlElement> stanza)>
       OnStanzaCallback;
 
   XmppStreamParser();
@@ -36,7 +36,7 @@
  private:
   class Core;
 
-  scoped_ptr<Core> core_;
+  std::unique_ptr<Core> core_;
 
   DISALLOW_COPY_AND_ASSIGN(XmppStreamParser);
 };
diff --git a/remoting/signaling/xmpp_stream_parser_unittest.cc b/remoting/signaling/xmpp_stream_parser_unittest.cc
index 0bd2d31..0b6dc1b4 100644
--- a/remoting/signaling/xmpp_stream_parser_unittest.cc
+++ b/remoting/signaling/xmpp_stream_parser_unittest.cc
@@ -31,7 +31,7 @@
     base::RunLoop().RunUntilIdle();
   }
 
-  void OnStanza(scoped_ptr<buzz::XmlElement> stanza) {
+  void OnStanza(std::unique_ptr<buzz::XmlElement> stanza) {
     received_stanzas_.push_back(std::move(stanza));
   }
 
@@ -42,7 +42,7 @@
  protected:
   base::MessageLoop message_loop_;
 
-  scoped_ptr<XmppStreamParser> parser_;
+  std::unique_ptr<XmppStreamParser> parser_;
   ScopedVector<buzz::XmlElement> received_stanzas_;
   bool error_;
 };
diff --git a/remoting/test/access_token_fetcher.cc b/remoting/test/access_token_fetcher.cc
index 5d23a10..45068296 100644
--- a/remoting/test/access_token_fetcher.cc
+++ b/remoting/test/access_token_fetcher.cc
@@ -123,13 +123,13 @@
 }
 
 void AccessTokenFetcher::OnGetUserInfoResponse(
-    scoped_ptr<base::DictionaryValue> user_info) {
+    std::unique_ptr<base::DictionaryValue> user_info) {
   // This callback should not be called as we do not request user info.
   NOTREACHED();
 }
 
 void AccessTokenFetcher::OnGetTokenInfoResponse(
-    scoped_ptr<base::DictionaryValue> token_info) {
+    std::unique_ptr<base::DictionaryValue> token_info) {
   VLOG(1) << "AccessTokenFetcher::OnGetTokenInfoResponse() Called";
 
   std::string error_string;
diff --git a/remoting/test/access_token_fetcher.h b/remoting/test/access_token_fetcher.h
index 65301a9..46d499c 100644
--- a/remoting/test/access_token_fetcher.h
+++ b/remoting/test/access_token_fetcher.h
@@ -5,12 +5,12 @@
 #ifndef REMOTING_TEST_ACCESS_TOKEN_FETCHER_H_
 #define REMOTING_TEST_ACCESS_TOKEN_FETCHER_H_
 
+#include <memory>
 #include <string>
 
 #include "base/callback.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "google_apis/gaia/gaia_oauth_client.h"
 
 namespace remoting {
@@ -51,9 +51,9 @@
   void OnGetUserEmailResponse(const std::string& user_email) override;
   void OnGetUserIdResponse(const std::string& user_id) override;
   void OnGetUserInfoResponse(
-      scoped_ptr<base::DictionaryValue> user_info) override;
+      std::unique_ptr<base::DictionaryValue> user_info) override;
   void OnGetTokenInfoResponse(
-      scoped_ptr<base::DictionaryValue> token_info) override;
+      std::unique_ptr<base::DictionaryValue> token_info) override;
   void OnOAuthError() override;
   void OnNetworkError(int response_code) override;
 
@@ -78,7 +78,7 @@
   gaia::OAuthClientInfo oauth_client_info_;
 
   // Used to make token requests to GAIA.
-  scoped_ptr<gaia::GaiaOAuthClient> auth_client_;
+  std::unique_ptr<gaia::GaiaOAuthClient> auth_client_;
 
   DISALLOW_COPY_AND_ASSIGN(AccessTokenFetcher);
 };
diff --git a/remoting/test/access_token_fetcher_unittest.cc b/remoting/test/access_token_fetcher_unittest.cc
index 4ada637..ebdd36a 100644
--- a/remoting/test/access_token_fetcher_unittest.cc
+++ b/remoting/test/access_token_fetcher_unittest.cc
@@ -79,7 +79,7 @@
 
  private:
   net::FakeURLFetcherFactory url_fetcher_factory_;
-  scoped_ptr<base::MessageLoopForIO> message_loop_;
+  std::unique_ptr<base::MessageLoopForIO> message_loop_;
 
   DISALLOW_COPY_AND_ASSIGN(AccessTokenFetcherTest);
 };
@@ -174,7 +174,7 @@
                   kValidTokenInfoResponse, net::HTTP_OK,
                   net::URLRequestStatus::SUCCESS);
 
-  scoped_ptr<base::RunLoop> run_loop;
+  std::unique_ptr<base::RunLoop> run_loop;
   run_loop.reset(new base::RunLoop());
   AccessTokenCallback access_token_callback =
       base::Bind(&AccessTokenFetcherTest::OnAccessTokenRetrieved,
diff --git a/remoting/test/app_remoting_connected_client_fixture.cc b/remoting/test/app_remoting_connected_client_fixture.cc
index 71ceae6d..6c88bf0 100644
--- a/remoting/test/app_remoting_connected_client_fixture.cc
+++ b/remoting/test/app_remoting_connected_client_fixture.cc
@@ -48,7 +48,7 @@
 void AppRemotingConnectedClientFixture::SetUp() {
   connection_helper_.reset(
       new AppRemotingConnectionHelper(application_details_));
-  scoped_ptr<TestChromotingClient> test_chromoting_client(
+  std::unique_ptr<TestChromotingClient> test_chromoting_client(
       new TestChromotingClient());
 
   test_chromoting_client->AddRemoteConnectionObserver(this);
diff --git a/remoting/test/app_remoting_connected_client_fixture.h b/remoting/test/app_remoting_connected_client_fixture.h
index 2b9e2099..88b623e 100644
--- a/remoting/test/app_remoting_connected_client_fixture.h
+++ b/remoting/test/app_remoting_connected_client_fixture.h
@@ -5,11 +5,11 @@
 #ifndef REMOTING_TEST_APP_REMOTING_CONNECTED_CLIENT_FIXTURE_H_
 #define REMOTING_TEST_APP_REMOTING_CONNECTED_CLIENT_FIXTURE_H_
 
+#include <memory>
 #include <string>
 
 #include "base/callback.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/threading/thread_checker.h"
 #include "remoting/test/remote_connection_observer.h"
@@ -63,17 +63,17 @@
   const RemoteApplicationDetails& application_details_;
 
   // Used to run the thread's message loop.
-  scoped_ptr<base::RunLoop> run_loop_;
+  std::unique_ptr<base::RunLoop> run_loop_;
 
   // Used for setting timeouts and delays.
-  scoped_ptr<base::Timer> timer_;
+  std::unique_ptr<base::Timer> timer_;
 
   // Used to ensure RemoteConnectionObserver methods are called on the same
   // thread.
   base::ThreadChecker thread_checker_;
 
   // Creates and manages the connection to the remote host.
-  scoped_ptr<AppRemotingConnectionHelper> connection_helper_;
+  std::unique_ptr<AppRemotingConnectionHelper> connection_helper_;
 
   // Called when an ExtensionMessage is received from the host.
   HostMessageReceivedCallback host_message_received_callback_;
diff --git a/remoting/test/app_remoting_connection_helper.cc b/remoting/test/app_remoting_connection_helper.cc
index 215a1a2..77ea5b6 100644
--- a/remoting/test/app_remoting_connection_helper.cc
+++ b/remoting/test/app_remoting_connection_helper.cc
@@ -47,7 +47,7 @@
 }
 
 void AppRemotingConnectionHelper::Initialize(
-    scoped_ptr<TestChromotingClient> test_chromoting_client) {
+    std::unique_ptr<TestChromotingClient> test_chromoting_client) {
   client_ = std::move(test_chromoting_client);
   client_->AddRemoteConnectionObserver(this);
 }
@@ -184,7 +184,8 @@
   DCHECK_EQ(message.type(), "onWindowAdded");
 
   const base::DictionaryValue* message_data = nullptr;
-  scoped_ptr<base::Value> host_message = base::JSONReader::Read(message.data());
+  std::unique_ptr<base::Value> host_message =
+      base::JSONReader::Read(message.data());
   if (!host_message.get() || !host_message->GetAsDictionary(&message_data)) {
     LOG(ERROR) << "onWindowAdded message received was not valid JSON.";
     if (run_loop_) {
diff --git a/remoting/test/app_remoting_connection_helper.h b/remoting/test/app_remoting_connection_helper.h
index 985995d..c782fa4 100644
--- a/remoting/test/app_remoting_connection_helper.h
+++ b/remoting/test/app_remoting_connection_helper.h
@@ -5,11 +5,11 @@
 #ifndef REMOTING_TEST_APP_REMOTING_CONNECTION_HELPER_H_
 #define REMOTING_TEST_APP_REMOTING_CONNECTION_HELPER_H_
 
+#include <memory>
 #include <string>
 
 #include "base/callback.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/threading/thread_checker.h"
 #include "remoting/test/remote_connection_observer.h"
 #include "testing/gtest/include/gtest/gtest.h"
@@ -36,7 +36,7 @@
   ~AppRemotingConnectionHelper() override;
 
   // Initialize internal structures.
-  void Initialize(scoped_ptr<TestChromotingClient> test_chromoting_client);
+  void Initialize(std::unique_ptr<TestChromotingClient> test_chromoting_client);
 
   // Starts a connection with the remote host.
   // NOTE: Initialize() must be called before calling this method.
@@ -75,17 +75,17 @@
   bool connection_is_ready_for_tests_;
 
   // Used to run the thread's message loop.
-  scoped_ptr<base::RunLoop> run_loop_;
+  std::unique_ptr<base::RunLoop> run_loop_;
 
   // Used for setting timeouts and delays.
-  scoped_ptr<base::Timer> timer_;
+  std::unique_ptr<base::Timer> timer_;
 
   // Used to ensure RemoteConnectionObserver methods are called on the same
   // thread.
   base::ThreadChecker thread_checker_;
 
   // Creates and manages the connection to the remote host.
-  scoped_ptr<TestChromotingClient> client_;
+  std::unique_ptr<TestChromotingClient> client_;
 
   DISALLOW_COPY_AND_ASSIGN(AppRemotingConnectionHelper);
 };
diff --git a/remoting/test/app_remoting_latency_test_fixture.cc b/remoting/test/app_remoting_latency_test_fixture.cc
index 2827c2c..d5f1a5f 100644
--- a/remoting/test/app_remoting_latency_test_fixture.cc
+++ b/remoting/test/app_remoting_latency_test_fixture.cc
@@ -29,10 +29,11 @@
 AppRemotingLatencyTestFixture::~AppRemotingLatencyTestFixture() {}
 
 void AppRemotingLatencyTestFixture::SetUp() {
-  scoped_ptr<TestVideoRenderer> test_video_renderer(new TestVideoRenderer());
+  std::unique_ptr<TestVideoRenderer> test_video_renderer(
+      new TestVideoRenderer());
   test_video_renderer_ = test_video_renderer->GetWeakPtr();
 
-  scoped_ptr<TestChromotingClient> test_chromoting_client(
+  std::unique_ptr<TestChromotingClient> test_chromoting_client(
       new TestChromotingClient(std::move(test_video_renderer)));
 
   test_chromoting_client->AddRemoteConnectionObserver(this);
@@ -67,7 +68,7 @@
 AppRemotingLatencyTestFixture::SetExpectedImagePattern(
     const webrtc::DesktopRect& expected_rect,
     const RGBValue& expected_color) {
-  scoped_ptr<base::RunLoop> run_loop(new base::RunLoop());
+  std::unique_ptr<base::RunLoop> run_loop(new base::RunLoop());
 
   test_video_renderer_->ExpectAverageColorInRect(expected_rect, expected_color,
                                                  run_loop->QuitClosure());
@@ -82,7 +83,7 @@
 }
 
 bool AppRemotingLatencyTestFixture::WaitForImagePatternMatch(
-    scoped_ptr<base::RunLoop> run_loop,
+    std::unique_ptr<base::RunLoop> run_loop,
     const base::TimeDelta& max_wait_time) {
   DCHECK(run_loop);
   DCHECK(!timer_->IsRunning());
diff --git a/remoting/test/app_remoting_latency_test_fixture.h b/remoting/test/app_remoting_latency_test_fixture.h
index f13c2937..cc42a8e 100644
--- a/remoting/test/app_remoting_latency_test_fixture.h
+++ b/remoting/test/app_remoting_latency_test_fixture.h
@@ -5,11 +5,11 @@
 #ifndef REMOTING_TEST_APP_REMOTING_LATENCY_TEST_FIXTURE_H_
 #define REMOTING_TEST_APP_REMOTING_LATENCY_TEST_FIXTURE_H_
 
+#include <memory>
 #include <vector>
 
 #include "base/callback.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "remoting/test/remote_connection_observer.h"
 #include "testing/gtest/include/gtest/gtest.h"
@@ -89,7 +89,7 @@
   virtual void ResetApplicationState();
 
   // Creates and manages the connection to the remote host.
-  scoped_ptr<AppRemotingConnectionHelper> connection_helper_;
+  std::unique_ptr<AppRemotingConnectionHelper> connection_helper_;
 
  private:
   // testing::Test interface.
@@ -106,14 +106,14 @@
   // true if we received a response within the maximum time limit.
   // NOTE: This method should only be run when as a returned callback by
   // SetExpectedImagePattern.
-  bool WaitForImagePatternMatch(scoped_ptr<base::RunLoop> run_loop,
+  bool WaitForImagePatternMatch(std::unique_ptr<base::RunLoop> run_loop,
                                 const base::TimeDelta& max_wait_time);
 
   // Used to run the thread's message loop.
-  scoped_ptr<base::RunLoop> run_loop_;
+  std::unique_ptr<base::RunLoop> run_loop_;
 
   // Used for setting timeouts and delays.
-  scoped_ptr<base::Timer> timer_;
+  std::unique_ptr<base::Timer> timer_;
 
   // Used to maintain a reference to the TestVideoRenderer instance while it
   // exists.
diff --git a/remoting/test/app_remoting_report_issue_request.h b/remoting/test/app_remoting_report_issue_request.h
index bcb02c59..f118893 100644
--- a/remoting/test/app_remoting_report_issue_request.h
+++ b/remoting/test/app_remoting_report_issue_request.h
@@ -5,12 +5,12 @@
 #ifndef REMOTING_TEST_APP_REMOTING_REPORT_ISSUE_REQUEST_H_
 #define REMOTING_TEST_APP_REMOTING_REPORT_ISSUE_REQUEST_H_
 
+#include <memory>
 #include <string>
 
 #include "base/callback.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "net/url_request/url_fetcher_delegate.h"
 #include "remoting/test/app_remoting_service_urls.h"
 
@@ -46,7 +46,7 @@
   void OnURLFetchComplete(const net::URLFetcher* source) override;
 
   // Holds the URLFetcher for the ReportIssue request.
-  scoped_ptr<net::URLFetcher> request_;
+  std::unique_ptr<net::URLFetcher> request_;
 
   // Provides application-specific context for the network request.
   scoped_refptr<remoting::URLRequestContextGetter> request_context_getter_;
diff --git a/remoting/test/app_remoting_report_issue_request_unittest.cc b/remoting/test/app_remoting_report_issue_request_unittest.cc
index 3924746a..3ad6d851c 100644
--- a/remoting/test/app_remoting_report_issue_request_unittest.cc
+++ b/remoting/test/app_remoting_report_issue_request_unittest.cc
@@ -45,14 +45,14 @@
   // Used for result verification.
   std::string dev_service_environment_url_;
 
-  scoped_ptr<base::RunLoop> run_loop_;
-  scoped_ptr<base::Timer> timer_;
+  std::unique_ptr<base::RunLoop> run_loop_;
+  std::unique_ptr<base::Timer> timer_;
 
   AppRemotingReportIssueRequest app_remoting_report_issue_request_;
 
  private:
   net::FakeURLFetcherFactory url_fetcher_factory_;
-  scoped_ptr<base::MessageLoopForIO> message_loop_;
+  std::unique_ptr<base::MessageLoopForIO> message_loop_;
 
   DISALLOW_COPY_AND_ASSIGN(AppRemotingReportIssueRequestTest);
 };
diff --git a/remoting/test/app_remoting_sample_test_driver_environment.cc b/remoting/test/app_remoting_sample_test_driver_environment.cc
index afc007a3..d362eca 100644
--- a/remoting/test/app_remoting_sample_test_driver_environment.cc
+++ b/remoting/test/app_remoting_sample_test_driver_environment.cc
@@ -2,15 +2,16 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "base/memory/ptr_util.h"
 #include "remoting/test/app_remoting_test_driver_environment.h"
 
 namespace remoting {
 namespace test {
 
-scoped_ptr<AppRemotingTestDriverEnvironment>
+std::unique_ptr<AppRemotingTestDriverEnvironment>
 CreateAppRemotingTestDriverEnvironment(
     const AppRemotingTestDriverEnvironment::EnvironmentOptions& options) {
-  return make_scoped_ptr<AppRemotingTestDriverEnvironment>(
+  return base::WrapUnique<AppRemotingTestDriverEnvironment>(
       new AppRemotingTestDriverEnvironment(options));
 }
 
diff --git a/remoting/test/app_remoting_test_driver.cc b/remoting/test/app_remoting_test_driver.cc
index e036363..34d5659 100644
--- a/remoting/test/app_remoting_test_driver.cc
+++ b/remoting/test/app_remoting_test_driver.cc
@@ -227,7 +227,7 @@
   // retrieving an access token for the user and spinning up VMs.
   // The GTest framework will own the lifetime of this object once
   // it is registered below.
-  scoped_ptr<remoting::test::AppRemotingTestDriverEnvironment> shared_data(
+  std::unique_ptr<remoting::test::AppRemotingTestDriverEnvironment> shared_data(
       remoting::test::CreateAppRemotingTestDriverEnvironment(options));
 
   if (!shared_data->Initialize(auth_code)) {
diff --git a/remoting/test/app_remoting_test_driver_environment.cc b/remoting/test/app_remoting_test_driver_environment.cc
index 9e8b2f5..1ef1b9c 100644
--- a/remoting/test/app_remoting_test_driver_environment.cc
+++ b/remoting/test/app_remoting_test_driver_environment.cc
@@ -59,7 +59,7 @@
 
   // If a unit test has set |test_refresh_token_store_| then we should use it
   // below.  Note that we do not want to destroy the test object.
-  scoped_ptr<RefreshTokenStore> temporary_refresh_token_store;
+  std::unique_ptr<RefreshTokenStore> temporary_refresh_token_store;
   RefreshTokenStore* refresh_token_store = test_refresh_token_store_;
   if (!refresh_token_store) {
     temporary_refresh_token_store =
@@ -118,7 +118,7 @@
   // If a unit test has set |test_remote_host_info_fetcher_| then we should use
   // it below.  Note that we do not want to destroy the test object at the end
   // of the function which is why we have the dance below.
-  scoped_ptr<RemoteHostInfoFetcher> temporary_remote_host_info_fetcher;
+  std::unique_ptr<RemoteHostInfoFetcher> temporary_remote_host_info_fetcher;
   RemoteHostInfoFetcher* remote_host_info_fetcher =
       test_remote_host_info_fetcher_;
   if (!remote_host_info_fetcher) {
@@ -228,7 +228,7 @@
   // If a unit test has set |test_app_remoting_report_issue_request_| then we
   // should use it below.  Note that we do not want to destroy the test object
   // at the end of the function which is why we have the dance below.
-  scoped_ptr<AppRemotingReportIssueRequest> temporary_report_issue_request;
+  std::unique_ptr<AppRemotingReportIssueRequest> temporary_report_issue_request;
   AppRemotingReportIssueRequest* report_issue_request =
       test_app_remoting_report_issue_request_;
   if (!report_issue_request) {
@@ -279,7 +279,7 @@
   // If a unit test has set |test_access_token_fetcher_| then we should use it
   // below.  Note that we do not want to destroy the test object at the end of
   // the function which is why we have the dance below.
-  scoped_ptr<AccessTokenFetcher> temporary_access_token_fetcher;
+  std::unique_ptr<AccessTokenFetcher> temporary_access_token_fetcher;
   AccessTokenFetcher* access_token_fetcher = test_access_token_fetcher_;
   if (!access_token_fetcher) {
     temporary_access_token_fetcher.reset(new AccessTokenFetcher());
@@ -307,7 +307,7 @@
     if (!refresh_token_.empty()) {
       // If a unit test has set |test_refresh_token_store_| then we should use
       // it below.  Note that we do not want to destroy the test object.
-      scoped_ptr<RefreshTokenStore> temporary_refresh_token_store;
+      std::unique_ptr<RefreshTokenStore> temporary_refresh_token_store;
       RefreshTokenStore* refresh_token_store = test_refresh_token_store_;
       if (!refresh_token_store) {
         temporary_refresh_token_store =
diff --git a/remoting/test/app_remoting_test_driver_environment.h b/remoting/test/app_remoting_test_driver_environment.h
index 4a989c0..6bbb43f 100644
--- a/remoting/test/app_remoting_test_driver_environment.h
+++ b/remoting/test/app_remoting_test_driver_environment.h
@@ -6,12 +6,12 @@
 #define REMOTING_TEST_APP_REMOTING_TEST_DRIVER_ENVIRONMENT_H_
 
 #include <map>
+#include <memory>
 #include <string>
 #include <vector>
 
 #include "base/files/file_path.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "remoting/test/remote_application_details.h"
 #include "remoting/test/remote_host_info_fetcher.h"
 #include "testing/gtest/include/gtest/gtest.h"
@@ -150,7 +150,7 @@
   remoting::test::RemoteHostInfoFetcher* test_remote_host_info_fetcher_;
 
   // Used for running network request tasks.
-  scoped_ptr<base::MessageLoopForIO> message_loop_;
+  std::unique_ptr<base::MessageLoopForIO> message_loop_;
 
   // Contains the host ids to release when the environment is torn down.
   // The key is the application id and the value is a list of hosts.
@@ -161,7 +161,7 @@
 
 // Used to provide application specific instances of the
 // AppRemotingTestDriverEnvironment class.
-extern scoped_ptr<AppRemotingTestDriverEnvironment>
+extern std::unique_ptr<AppRemotingTestDriverEnvironment>
 CreateAppRemotingTestDriverEnvironment(
     const AppRemotingTestDriverEnvironment::EnvironmentOptions& options);
 
diff --git a/remoting/test/app_remoting_test_driver_environment_unittest.cc b/remoting/test/app_remoting_test_driver_environment_unittest.cc
index 26546b3..6d2afc678 100644
--- a/remoting/test/app_remoting_test_driver_environment_unittest.cc
+++ b/remoting/test/app_remoting_test_driver_environment_unittest.cc
@@ -55,7 +55,7 @@
   FakeRemoteHostInfoFetcher fake_remote_host_info_fetcher_;
   MockAccessTokenFetcher mock_access_token_fetcher_;
 
-  scoped_ptr<AppRemotingTestDriverEnvironment> environment_object_;
+  std::unique_ptr<AppRemotingTestDriverEnvironment> environment_object_;
 
  private:
   DISALLOW_COPY_AND_ASSIGN(AppRemotingTestDriverEnvironmentTest);
@@ -80,7 +80,7 @@
     const AppRemotingTestDriverEnvironment::EnvironmentOptions& options) {
   environment_object_.reset(new AppRemotingTestDriverEnvironment(options));
 
-  scoped_ptr<FakeAccessTokenFetcher> fake_access_token_fetcher(
+  std::unique_ptr<FakeAccessTokenFetcher> fake_access_token_fetcher(
       new FakeAccessTokenFetcher());
   fake_access_token_fetcher_ = fake_access_token_fetcher.get();
   mock_access_token_fetcher_.SetAccessTokenFetcher(
diff --git a/remoting/test/chromoting_test_driver.cc b/remoting/test/chromoting_test_driver.cc
index 055a6346..4cd7ab6 100644
--- a/remoting/test/chromoting_test_driver.cc
+++ b/remoting/test/chromoting_test_driver.cc
@@ -218,7 +218,7 @@
   // Create and register our global test data object. It will handle
   // retrieving an access token or host list for the user. The GTest framework
   // will own the lifetime of this object once it is registered below.
-  scoped_ptr<remoting::test::ChromotingTestDriverEnvironment> shared_data(
+  std::unique_ptr<remoting::test::ChromotingTestDriverEnvironment> shared_data(
       new remoting::test::ChromotingTestDriverEnvironment(options));
 
   if (!shared_data->Initialize(auth_code)) {
diff --git a/remoting/test/chromoting_test_driver_environment.cc b/remoting/test/chromoting_test_driver_environment.cc
index 8a9c3ad..0744b23 100644
--- a/remoting/test/chromoting_test_driver_environment.cc
+++ b/remoting/test/chromoting_test_driver_environment.cc
@@ -56,7 +56,7 @@
 
   // If a unit test has set |test_refresh_token_store_| then we should use it
   // below.  Note that we do not want to destroy the test object.
-  scoped_ptr<RefreshTokenStore> temporary_refresh_token_store;
+  std::unique_ptr<RefreshTokenStore> temporary_refresh_token_store;
   RefreshTokenStore* refresh_token_store = test_refresh_token_store_;
   if (!refresh_token_store) {
     temporary_refresh_token_store =
@@ -199,7 +199,7 @@
   // If a unit test has set |test_access_token_fetcher_| then we should use it
   // below.  Note that we do not want to destroy the test object at the end of
   // the function which is why we have the dance below.
-  scoped_ptr<AccessTokenFetcher> temporary_access_token_fetcher;
+  std::unique_ptr<AccessTokenFetcher> temporary_access_token_fetcher;
   AccessTokenFetcher* access_token_fetcher = test_access_token_fetcher_;
   if (!access_token_fetcher) {
     temporary_access_token_fetcher.reset(new AccessTokenFetcher());
@@ -227,7 +227,7 @@
     if (!refresh_token_.empty()) {
       // If a unit test has set |test_refresh_token_store_| then we should use
       // it below.  Note that we do not want to destroy the test object.
-      scoped_ptr<RefreshTokenStore> temporary_refresh_token_store;
+      std::unique_ptr<RefreshTokenStore> temporary_refresh_token_store;
       RefreshTokenStore* refresh_token_store = test_refresh_token_store_;
       if (!refresh_token_store) {
         temporary_refresh_token_store =
@@ -283,7 +283,7 @@
   // If a unit test has set |test_host_list_fetcher_| then we should use it
   // below.  Note that we do not want to destroy the test object at the end of
   // the function which is why we have the dance below.
-  scoped_ptr<HostListFetcher> temporary_host_list_fetcher;
+  std::unique_ptr<HostListFetcher> temporary_host_list_fetcher;
   HostListFetcher* host_list_fetcher = test_host_list_fetcher_;
   if (!host_list_fetcher) {
     temporary_host_list_fetcher.reset(new HostListFetcher());
diff --git a/remoting/test/chromoting_test_driver_environment.h b/remoting/test/chromoting_test_driver_environment.h
index 291a5fe8..e6e1bc6 100644
--- a/remoting/test/chromoting_test_driver_environment.h
+++ b/remoting/test/chromoting_test_driver_environment.h
@@ -5,13 +5,13 @@
 #ifndef REMOTING_TEST_CHROMOTING_TEST_DRIVER_ENVIRONMENT_H_
 #define REMOTING_TEST_CHROMOTING_TEST_DRIVER_ENVIRONMENT_H_
 
+#include <memory>
 #include <string>
 #include <vector>
 
 #include "base/callback.h"
 #include "base/files/file_path.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "remoting/test/host_info.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
@@ -141,7 +141,7 @@
   remoting::test::HostListFetcher* test_host_list_fetcher_;
 
   // Used for running network request tasks.
-  scoped_ptr<base::MessageLoopForIO> message_loop_;
+  std::unique_ptr<base::MessageLoopForIO> message_loop_;
 
   DISALLOW_COPY_AND_ASSIGN(ChromotingTestDriverEnvironment);
 };
diff --git a/remoting/test/chromoting_test_driver_environment_unittest.cc b/remoting/test/chromoting_test_driver_environment_unittest.cc
index f05b7b7..843be6d 100644
--- a/remoting/test/chromoting_test_driver_environment_unittest.cc
+++ b/remoting/test/chromoting_test_driver_environment_unittest.cc
@@ -50,7 +50,7 @@
   FakeRefreshTokenStore fake_token_store_;
   FakeHostListFetcher fake_host_list_fetcher_;
 
-  scoped_ptr<ChromotingTestDriverEnvironment> environment_object_;
+  std::unique_ptr<ChromotingTestDriverEnvironment> environment_object_;
 
  private:
   DISALLOW_COPY_AND_ASSIGN(ChromotingTestDriverEnvironmentTest);
diff --git a/remoting/test/chromoting_test_fixture.h b/remoting/test/chromoting_test_fixture.h
index c6a9fc5..5293815 100644
--- a/remoting/test/chromoting_test_fixture.h
+++ b/remoting/test/chromoting_test_fixture.h
@@ -5,8 +5,9 @@
 #ifndef REMOTING_TEST_CHROMOTING_TEST_FIXTURE_H_
 #define REMOTING_TEST_CHROMOTING_TEST_FIXTURE_H_
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/threading/thread_checker.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
@@ -40,7 +41,7 @@
 
  protected:
   // Observes and saves the times when a chromoting client changes its state.
-  scoped_ptr<ConnectionTimeObserver> connection_time_observer_;
+  std::unique_ptr<ConnectionTimeObserver> connection_time_observer_;
 
  private:
   // testing::Test overrides.
@@ -53,7 +54,7 @@
   void DestroyObserver();
 
   // Creates and manages the connection to the remote host.
-  scoped_ptr<TestChromotingClient> test_chromoting_client_;
+  std::unique_ptr<TestChromotingClient> test_chromoting_client_;
 
   base::ThreadChecker thread_checker_;
 
diff --git a/remoting/test/codec_perftest.cc b/remoting/test/codec_perftest.cc
index e157b88..c10b0e0 100644
--- a/remoting/test/codec_perftest.cc
+++ b/remoting/test/codec_perftest.cc
@@ -43,7 +43,7 @@
  protected:
   base::SimpleTestTickClock clock_;
   scoped_refptr<CyclicFrameGenerator> frame_generator_;
-  scoped_ptr<VideoEncoderVpx> encoder_;
+  std::unique_ptr<VideoEncoderVpx> encoder_;
 };
 
 INSTANTIATE_TEST_CASE_P(VP8,
@@ -73,11 +73,11 @@
   int total_bytes = 0;
 
   for (int i = 0; i < kTotalFrames; ++i) {
-    scoped_ptr<webrtc::DesktopFrame> frame =
+    std::unique_ptr<webrtc::DesktopFrame> frame =
         frame_generator_->GenerateFrame(nullptr);
     base::TimeTicks started = base::TimeTicks::Now();
 
-    scoped_ptr<VideoPacket> packet = encoder_->Encode(*frame);
+    std::unique_ptr<VideoPacket> packet = encoder_->Encode(*frame);
 
     base::TimeTicks ended = base::TimeTicks::Now();
     base::TimeDelta latency = ended - started;
@@ -136,11 +136,11 @@
       base::TimeDelta::FromMilliseconds(kIntervalBetweenFramesMs));
 
   for (int i = 0; i < kTotalFrames; ++i) {
-    scoped_ptr<webrtc::DesktopFrame> frame =
+    std::unique_ptr<webrtc::DesktopFrame> frame =
         frame_generator_->GenerateFrame(nullptr);
     base::TimeTicks started = base::TimeTicks::Now();
 
-    scoped_ptr<VideoPacket> packet = encoder_->Encode(*frame);
+    std::unique_ptr<VideoPacket> packet = encoder_->Encode(*frame);
 
     base::TimeTicks ended = base::TimeTicks::Now();
     base::TimeDelta latency = ended - started;
diff --git a/remoting/test/connection_time_observer_unittest.cc b/remoting/test/connection_time_observer_unittest.cc
index 8e52e59..d77fc1a7 100644
--- a/remoting/test/connection_time_observer_unittest.cc
+++ b/remoting/test/connection_time_observer_unittest.cc
@@ -29,7 +29,7 @@
   std::map<protocol::ConnectionToHost::State, base::TimeTicks> test_map_;
 
   // Observes and saves the times when the chromoting connection state changes.
-  scoped_ptr<ConnectionTimeObserver> connection_time_observer_;
+  std::unique_ptr<ConnectionTimeObserver> connection_time_observer_;
 
  private:
   DISALLOW_COPY_AND_ASSIGN(ConnectionTimeObserverTest);
diff --git a/remoting/test/cyclic_frame_generator.cc b/remoting/test/cyclic_frame_generator.cc
index 3ba3836..91d61c7 100644
--- a/remoting/test/cyclic_frame_generator.cc
+++ b/remoting/test/cyclic_frame_generator.cc
@@ -24,7 +24,7 @@
 const int kBarcodeBlackThreshold = 85;
 const int kBarcodeWhiteThreshold = 170;
 
-scoped_ptr<webrtc::DesktopFrame> LoadDesktopFrameFromPng(
+std::unique_ptr<webrtc::DesktopFrame> LoadDesktopFrameFromPng(
     const base::FilePath& file_path) {
   std::string file_content;
   if (!base::ReadFileToString(file_path, &file_content))
@@ -33,7 +33,7 @@
   SkBitmap bitmap;
   gfx::PNGCodec::Decode(reinterpret_cast<const uint8_t*>(file_content.data()),
                         file_content.size(), &bitmap);
-  scoped_ptr<webrtc::DesktopFrame> frame(new webrtc::BasicDesktopFrame(
+  std::unique_ptr<webrtc::DesktopFrame> frame(new webrtc::BasicDesktopFrame(
       webrtc::DesktopSize(bitmap.width(), bitmap.height())));
   bitmap.copyPixelsTo(frame->data(),
                       frame->stride() * frame->size().height(),
@@ -70,7 +70,7 @@
   test_data_path = test_data_path.Append(FILE_PATH_LITERAL("test"));
   test_data_path = test_data_path.Append(FILE_PATH_LITERAL("data"));
 
-  std::vector<scoped_ptr<webrtc::DesktopFrame>> frames;
+  std::vector<std::unique_ptr<webrtc::DesktopFrame>> frames;
   frames.push_back(
       LoadDesktopFrameFromPng(test_data_path.AppendASCII("test_frame1.png")));
   frames.push_back(
@@ -79,7 +79,7 @@
 }
 
 CyclicFrameGenerator::CyclicFrameGenerator(
-    std::vector<scoped_ptr<webrtc::DesktopFrame>> reference_frames)
+    std::vector<std::unique_ptr<webrtc::DesktopFrame>> reference_frames)
     : reference_frames_(std::move(reference_frames)),
       clock_(&default_tick_clock_),
       started_time_(clock_->NowTicks()) {
@@ -98,14 +98,14 @@
   started_time_ = clock_->NowTicks();
 }
 
-scoped_ptr<webrtc::DesktopFrame> CyclicFrameGenerator::GenerateFrame(
+std::unique_ptr<webrtc::DesktopFrame> CyclicFrameGenerator::GenerateFrame(
     webrtc::SharedMemoryFactory* shared_memory_factory) {
   base::TimeTicks now = clock_->NowTicks();
   int reference_frame =
       ((now - started_time_) / frame_cycle_period_) % reference_frames_.size();
   bool cursor_state = ((now - started_time_) / cursor_blink_period_) % 2;
 
-  scoped_ptr<webrtc::DesktopFrame> frame(
+  std::unique_ptr<webrtc::DesktopFrame> frame(
       new webrtc::BasicDesktopFrame(screen_size_));
   frame->CopyPixelsFrom(*reference_frames_[reference_frame],
                         webrtc::DesktopVector(),
diff --git a/remoting/test/cyclic_frame_generator.h b/remoting/test/cyclic_frame_generator.h
index a77706a..9dd26bae 100644
--- a/remoting/test/cyclic_frame_generator.h
+++ b/remoting/test/cyclic_frame_generator.h
@@ -6,10 +6,10 @@
 #define REMOTING_TEST_CYCLIC_FRAME_GENERATOR_H_
 
 #include <map>
+#include <memory>
 #include <vector>
 
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/time/default_tick_clock.h"
 #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h"
 
@@ -47,7 +47,7 @@
   static scoped_refptr<CyclicFrameGenerator> Create();
 
   CyclicFrameGenerator(
-      std::vector<scoped_ptr<webrtc::DesktopFrame>> reference_frames);
+      std::vector<std::unique_ptr<webrtc::DesktopFrame>> reference_frames);
 
   void set_frame_cycle_period(base::TimeDelta frame_cycle_period) {
     frame_cycle_period_ = frame_cycle_period;
@@ -64,7 +64,7 @@
   // by its content.
   void set_draw_barcode(bool draw_barcode) { draw_barcode_ = draw_barcode; }
 
-  scoped_ptr<webrtc::DesktopFrame> GenerateFrame(
+  std::unique_ptr<webrtc::DesktopFrame> GenerateFrame(
       webrtc::SharedMemoryFactory* shared_memory_factory);
 
   FrameType last_frame_type() { return last_frame_type_; }
@@ -77,7 +77,7 @@
   ~CyclicFrameGenerator();
   friend class base::RefCountedThreadSafe<CyclicFrameGenerator>;
 
-  std::vector<scoped_ptr<webrtc::DesktopFrame>> reference_frames_;
+  std::vector<std::unique_ptr<webrtc::DesktopFrame>> reference_frames_;
   base::DefaultTickClock default_tick_clock_;
   base::TickClock* clock_;
   webrtc::DesktopSize screen_size_;
diff --git a/remoting/test/fake_network_manager.h b/remoting/test/fake_network_manager.h
index 01da153e..cce6f9f 100644
--- a/remoting/test/fake_network_manager.h
+++ b/remoting/test/fake_network_manager.h
@@ -5,7 +5,8 @@
 #ifndef REMOTING_TEST_FAKE_NETWORK_MANAGER_H_
 #define REMOTING_TEST_FAKE_NETWORK_MANAGER_H_
 
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
 #include "base/memory/weak_ptr.h"
 #include "third_party/webrtc/base/network.h"
 
@@ -27,7 +28,7 @@
   void SendNetworksChangedSignal();
 
   bool started_;
-  scoped_ptr<rtc::Network> network_;
+  std::unique_ptr<rtc::Network> network_;
 
   base::WeakPtrFactory<FakeNetworkManager> weak_factory_;
 };
diff --git a/remoting/test/fake_port_allocator.cc b/remoting/test/fake_port_allocator.cc
index 49db553..b0a26de 100644
--- a/remoting/test/fake_port_allocator.cc
+++ b/remoting/test/fake_port_allocator.cc
@@ -5,6 +5,7 @@
 #include "remoting/test/fake_port_allocator.h"
 
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "remoting/protocol/transport_context.h"
 #include "remoting/test/fake_network_dispatcher.h"
 #include "remoting/test/fake_network_manager.h"
@@ -77,10 +78,10 @@
 
 FakePortAllocatorFactory::~FakePortAllocatorFactory() {}
 
-scoped_ptr<cricket::PortAllocator>
+std::unique_ptr<cricket::PortAllocator>
 FakePortAllocatorFactory::CreatePortAllocator(
     scoped_refptr<protocol::TransportContext> transport_context) {
-  return make_scoped_ptr(new FakePortAllocator(
+  return base::WrapUnique(new FakePortAllocator(
       network_manager_.get(), socket_factory_.get(), transport_context));
 }
 
diff --git a/remoting/test/fake_port_allocator.h b/remoting/test/fake_port_allocator.h
index cc5e6ebb..e593915 100644
--- a/remoting/test/fake_port_allocator.h
+++ b/remoting/test/fake_port_allocator.h
@@ -5,11 +5,11 @@
 #ifndef REMOTING_TEST_FAKE_PORT_ALLOCATOR_H_
 #define REMOTING_TEST_FAKE_PORT_ALLOCATOR_H_
 
+#include <memory>
 #include <set>
 
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "remoting/protocol/port_allocator_factory.h"
 #include "third_party/webrtc/p2p/client/basicportallocator.h"
 
@@ -48,12 +48,12 @@
   FakePacketSocketFactory* socket_factory() { return socket_factory_.get(); }
 
    // PortAllocatorFactory interface.
-  scoped_ptr<cricket::PortAllocator> CreatePortAllocator(
+  std::unique_ptr<cricket::PortAllocator> CreatePortAllocator(
       scoped_refptr<protocol::TransportContext> transport_context) override;
 
  private:
-  scoped_ptr<rtc::NetworkManager> network_manager_;
-  scoped_ptr<FakePacketSocketFactory> socket_factory_;
+  std::unique_ptr<rtc::NetworkManager> network_manager_;
+  std::unique_ptr<FakePacketSocketFactory> socket_factory_;
 
   DISALLOW_COPY_AND_ASSIGN(FakePortAllocatorFactory);
 };
diff --git a/remoting/test/fake_socket_factory.h b/remoting/test/fake_socket_factory.h
index 7bb537e..e755818 100644
--- a/remoting/test/fake_socket_factory.h
+++ b/remoting/test/fake_socket_factory.h
@@ -8,11 +8,11 @@
 #include <stdint.h>
 
 #include <list>
+#include <memory>
 
 #include "base/callback_forward.h"
 #include "base/compiler_specific.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "remoting/test/fake_network_dispatcher.h"
 #include "third_party/webrtc/p2p/base/packetsocketfactory.h"
@@ -109,7 +109,7 @@
 
   rtc::IPAddress address_;
 
-  scoped_ptr<LeakyBucket> leaky_bucket_;
+  std::unique_ptr<LeakyBucket> leaky_bucket_;
   base::TimeDelta latency_average_;
   base::TimeDelta latency_stddev_;
   double out_of_order_rate_;
diff --git a/remoting/test/host_list_fetcher.cc b/remoting/test/host_list_fetcher.cc
index bac2db27..73d4106 100644
--- a/remoting/test/host_list_fetcher.cc
+++ b/remoting/test/host_list_fetcher.cc
@@ -60,7 +60,7 @@
     return false;
   }
 
-  scoped_ptr<base::Value> response_value(
+  std::unique_ptr<base::Value> response_value(
       base::JSONReader::Read(response_string));
   if (!response_value ||
       !response_value->IsType(base::Value::TYPE_DICTIONARY)) {
diff --git a/remoting/test/host_list_fetcher.h b/remoting/test/host_list_fetcher.h
index 7b7cc3a..54094bd 100644
--- a/remoting/test/host_list_fetcher.h
+++ b/remoting/test/host_list_fetcher.h
@@ -5,13 +5,13 @@
 #ifndef REMOTING_TEST_HOST_LIST_FETCHER_H_
 #define REMOTING_TEST_HOST_LIST_FETCHER_H_
 
+#include <memory>
 #include <string>
 #include <vector>
 
 #include "base/callback.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "net/url_request/url_fetcher_delegate.h"
 #include "remoting/test/host_info.h"
 
@@ -58,7 +58,7 @@
   void OnURLFetchComplete(const net::URLFetcher* source) override;
 
   // Holds the URLFetcher for the Host List request.
-  scoped_ptr<net::URLFetcher> request_;
+  std::unique_ptr<net::URLFetcher> request_;
 
   // Provides application-specific context for the network request.
   scoped_refptr<remoting::URLRequestContextGetter> request_context_getter_;
diff --git a/remoting/test/host_list_fetcher_unittest.cc b/remoting/test/host_list_fetcher_unittest.cc
index 47dcf89..825c817 100644
--- a/remoting/test/host_list_fetcher_unittest.cc
+++ b/remoting/test/host_list_fetcher_unittest.cc
@@ -194,7 +194,7 @@
 
  private:
   net::FakeURLFetcherFactory url_fetcher_factory_;
-  scoped_ptr<base::MessageLoopForIO> message_loop_;
+  std::unique_ptr<base::MessageLoopForIO> message_loop_;
 
   DISALLOW_COPY_AND_ASSIGN(HostListFetcherTest);
 };
diff --git a/remoting/test/mock_access_token_fetcher.cc b/remoting/test/mock_access_token_fetcher.cc
index 398f09f0..29d8214 100644
--- a/remoting/test/mock_access_token_fetcher.cc
+++ b/remoting/test/mock_access_token_fetcher.cc
@@ -16,7 +16,7 @@
 MockAccessTokenFetcher::~MockAccessTokenFetcher() {}
 
 void MockAccessTokenFetcher::SetAccessTokenFetcher(
-    scoped_ptr<AccessTokenFetcher> fetcher) {
+    std::unique_ptr<AccessTokenFetcher> fetcher) {
   internal_access_token_fetcher_ = std::move(fetcher);
 
   ON_CALL(*this, GetAccessTokenFromAuthCode(_, _))
diff --git a/remoting/test/mock_access_token_fetcher.h b/remoting/test/mock_access_token_fetcher.h
index 85b430e1403..dda08e9 100644
--- a/remoting/test/mock_access_token_fetcher.h
+++ b/remoting/test/mock_access_token_fetcher.h
@@ -35,10 +35,10 @@
   // Stores an access token fetcher object and wires up the mock methods to call
   // through to the appropriate method on it.  This method is typically used to
   // pass a FakeAccessTokenFetcher.
-  void SetAccessTokenFetcher(scoped_ptr<AccessTokenFetcher> fetcher);
+  void SetAccessTokenFetcher(std::unique_ptr<AccessTokenFetcher> fetcher);
 
  private:
-  scoped_ptr<AccessTokenFetcher> internal_access_token_fetcher_;
+  std::unique_ptr<AccessTokenFetcher> internal_access_token_fetcher_;
 
   DISALLOW_COPY_AND_ASSIGN(MockAccessTokenFetcher);
 };
diff --git a/remoting/test/protocol_perftest.cc b/remoting/test/protocol_perftest.cc
index 77c06d87..a19f994 100644
--- a/remoting/test/protocol_perftest.cc
+++ b/remoting/test/protocol_perftest.cc
@@ -7,6 +7,7 @@
 #include "base/base64.h"
 #include "base/files/file_util.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/message_loop/message_loop.h"
 #include "base/rand_util.h"
 #include "base/run_loop.h"
@@ -84,10 +85,10 @@
   void SetCursorShape(const protocol::CursorShapeInfo& cursor_shape) override{};
 };
 
-scoped_ptr<webrtc::DesktopFrame> DoDecodeFrame(
+std::unique_ptr<webrtc::DesktopFrame> DoDecodeFrame(
     VideoDecoder* decoder,
     VideoPacket* packet,
-    scoped_ptr<webrtc::DesktopFrame> frame) {
+    std::unique_ptr<webrtc::DesktopFrame> frame) {
   if (!decoder->DecodePacket(*packet, frame.get()))
     frame.reset();
   return frame;
@@ -153,7 +154,7 @@
   protocol::FrameConsumer* GetFrameConsumer() override { return this; }
 
   // protocol::VideoStub interface.
-  void ProcessVideoPacket(scoped_ptr<VideoPacket> packet,
+  void ProcessVideoPacket(std::unique_ptr<VideoPacket> packet,
                           const base::Closure& done) override {
     if (packet->data().empty()) {
       // Ignore keep-alive packets
@@ -167,7 +168,7 @@
                       packet->format().screen_height());
     }
 
-    scoped_ptr<webrtc::DesktopFrame> frame(
+    std::unique_ptr<webrtc::DesktopFrame> frame(
         new webrtc::BasicDesktopFrame(frame_size_));
     base::PostTaskAndReplyWithResult(
         decode_thread_.task_runner().get(), FROM_HERE,
@@ -177,20 +178,20 @@
                    base::Passed(&packet), done));
   }
 
-  void OnFrameDecoded(scoped_ptr<VideoPacket> packet,
+  void OnFrameDecoded(std::unique_ptr<VideoPacket> packet,
                       const base::Closure& done,
-                      scoped_ptr<webrtc::DesktopFrame> frame) {
+                      std::unique_ptr<webrtc::DesktopFrame> frame) {
     last_video_packet_ = std::move(packet);
     DrawFrame(std::move(frame), done);
   }
 
   // protocol::FrameConsumer interface.
-  scoped_ptr<webrtc::DesktopFrame> AllocateFrame(
+  std::unique_ptr<webrtc::DesktopFrame> AllocateFrame(
       const webrtc::DesktopSize& size) override {
-    return make_scoped_ptr(new webrtc::BasicDesktopFrame(size));
+    return base::WrapUnique(new webrtc::BasicDesktopFrame(size));
   }
 
-  void DrawFrame(scoped_ptr<webrtc::DesktopFrame> frame,
+  void DrawFrame(std::unique_ptr<webrtc::DesktopFrame> frame,
                  const base::Closure& done) override {
     last_video_frame_ = std::move(frame);
     if (!on_frame_task_.is_null())
@@ -228,7 +229,7 @@
       connecting_loop_->Quit();
   }
 
-  scoped_ptr<webrtc::DesktopFrame> ReceiveFrame() {
+  std::unique_ptr<webrtc::DesktopFrame> ReceiveFrame() {
     last_video_frame_.reset();
 
     waiting_frames_loop_.reset(new base::RunLoop());
@@ -315,7 +316,7 @@
     protocol::NetworkSettings network_settings(
         protocol::NetworkSettings::NAT_TRAVERSAL_OUTGOING);
 
-    scoped_ptr<FakePortAllocatorFactory> port_allocator_factory(
+    std::unique_ptr<FakePortAllocatorFactory> port_allocator_factory(
         new FakePortAllocatorFactory(fake_network_dispatcher_));
     port_allocator_factory->socket_factory()->SetBandwidth(
         GetParam().bandwidth, GetParam().max_buffers);
@@ -327,7 +328,7 @@
         new protocol::TransportContext(
             host_signaling_.get(), std::move(port_allocator_factory), nullptr,
             network_settings, protocol::TransportRole::SERVER));
-    scoped_ptr<protocol::SessionManager> session_manager(
+    std::unique_ptr<protocol::SessionManager> session_manager(
         new protocol::JingleSessionManager(host_signaling_.get()));
     session_manager->set_protocol_config(protocol_config_->Clone());
 
@@ -354,7 +355,7 @@
 
     std::string host_pin_hash =
         protocol::GetSharedSecretHash(kHostId, kHostPin);
-    scoped_ptr<protocol::AuthenticatorFactory> auth_factory =
+    std::unique_ptr<protocol::AuthenticatorFactory> auth_factory =
         protocol::Me2MeHostAuthenticatorFactory::CreateWithPin(
             true, kHostOwner, host_cert, key_pair, "", host_pin_hash, nullptr);
     host_->SetAuthenticatorFactory(std::move(auth_factory));
@@ -377,7 +378,7 @@
     client_context_.reset(
         new ClientContext(base::ThreadTaskRunnerHandle::Get()));
 
-    scoped_ptr<FakePortAllocatorFactory> port_allocator_factory(
+    std::unique_ptr<FakePortAllocatorFactory> port_allocator_factory(
         new FakePortAllocatorFactory(fake_network_dispatcher_));
     port_allocator_factory->socket_factory()->SetBandwidth(
         GetParam().bandwidth, GetParam().max_buffers);
@@ -426,7 +427,7 @@
 
     int last_frame_id = -1;
     for (int i = 0; i < 30; ++i) {
-      scoped_ptr<webrtc::DesktopFrame> frame = ReceiveFrame();
+      std::unique_ptr<webrtc::DesktopFrame> frame = ReceiveFrame();
       test::CyclicFrameGenerator::FrameInfo frame_info =
           frame_generator->IdentifyFrame(frame.get());
       base::TimeDelta latency = base::TimeTicks::Now() - frame_info.timestamp;
@@ -475,27 +476,27 @@
 
   FakeCursorShapeStub cursor_shape_stub_;
 
-  scoped_ptr<protocol::CandidateSessionConfig> protocol_config_;
+  std::unique_ptr<protocol::CandidateSessionConfig> protocol_config_;
 
-  scoped_ptr<FakeSignalStrategy> host_signaling_;
-  scoped_ptr<FakeSignalStrategy> client_signaling_;
+  std::unique_ptr<FakeSignalStrategy> host_signaling_;
+  std::unique_ptr<FakeSignalStrategy> client_signaling_;
 
-  scoped_ptr<ChromotingHost> host_;
-  scoped_ptr<ClientContext> client_context_;
-  scoped_ptr<ChromotingClient> client_;
+  std::unique_ptr<ChromotingHost> host_;
+  std::unique_ptr<ClientContext> client_context_;
+  std::unique_ptr<ChromotingClient> client_;
   webrtc::DesktopSize frame_size_;
-  scoped_ptr<VideoDecoder> video_decoder_;
+  std::unique_ptr<VideoDecoder> video_decoder_;
 
-  scoped_ptr<base::RunLoop> connecting_loop_;
-  scoped_ptr<base::RunLoop> waiting_frames_loop_;
+  std::unique_ptr<base::RunLoop> connecting_loop_;
+  std::unique_ptr<base::RunLoop> waiting_frames_loop_;
 
   bool client_connected_;
   bool host_connected_;
 
   base::Closure on_frame_task_;
 
-  scoped_ptr<VideoPacket> last_video_packet_;
-  scoped_ptr<webrtc::DesktopFrame> last_video_frame_;
+  std::unique_ptr<VideoPacket> last_video_packet_;
+  std::unique_ptr<webrtc::DesktopFrame> last_video_frame_;
 
  private:
   DISALLOW_COPY_AND_ASSIGN(ProtocolPerfTest);
@@ -562,7 +563,7 @@
   IntermittentChangeFrameGenerator()
       : frame_index_(0) {}
 
-  scoped_ptr<webrtc::DesktopFrame> GenerateFrame(
+  std::unique_ptr<webrtc::DesktopFrame> GenerateFrame(
       webrtc::SharedMemoryFactory* shared_memory_factory) {
     const int kWidth = 1000;
     const int kHeight = kIntermittentFrameSize / kWidth / 4;
@@ -575,7 +576,7 @@
     }
     ++frame_index_;
 
-    scoped_ptr<webrtc::DesktopFrame> result(current_frame_->Share());
+    std::unique_ptr<webrtc::DesktopFrame> result(current_frame_->Share());
     result->mutable_updated_region()->Clear();
     if (fresh_frame) {
       result->mutable_updated_region()->AddRect(
@@ -589,7 +590,7 @@
   friend class base::RefCountedThreadSafe<IntermittentChangeFrameGenerator>;
 
   int frame_index_;
-  scoped_ptr<webrtc::SharedDesktopFrame> current_frame_;
+  std::unique_ptr<webrtc::SharedDesktopFrame> current_frame_;
 
   DISALLOW_COPY_AND_ASSIGN(IntermittentChangeFrameGenerator);
 };
diff --git a/remoting/test/refresh_token_store.cc b/remoting/test/refresh_token_store.cc
index dfe3964..d67e6a1 100644
--- a/remoting/test/refresh_token_store.cc
+++ b/remoting/test/refresh_token_store.cc
@@ -10,6 +10,7 @@
 #include "base/json/json_writer.h"
 #include "base/logging.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/values.h"
 
 namespace {
@@ -71,7 +72,8 @@
     return std::string();
   }
 
-  scoped_ptr<base::Value> token_data(base::JSONReader::Read(file_contents));
+  std::unique_ptr<base::Value> token_data(
+      base::JSONReader::Read(file_contents));
   base::DictionaryValue* tokens = nullptr;
   if (!token_data || !token_data->GetAsDictionary(&tokens)) {
     LOG(ERROR) << "Refresh token file contents were not valid JSON, "
@@ -113,7 +115,8 @@
     }
   }
 
-  scoped_ptr<base::Value> token_data(base::JSONReader::Read(file_contents));
+  std::unique_ptr<base::Value> token_data(
+      base::JSONReader::Read(file_contents));
   base::DictionaryValue* tokens = nullptr;
   if (!token_data || !token_data->GetAsDictionary(&tokens)) {
     LOG(ERROR) << "Invalid refresh token file format, could not store token.";
@@ -158,10 +161,10 @@
   return refresh_token_file_path;
 }
 
-scoped_ptr<RefreshTokenStore> RefreshTokenStore::OnDisk(
+std::unique_ptr<RefreshTokenStore> RefreshTokenStore::OnDisk(
     const std::string& user_name,
     const base::FilePath& refresh_token_file_path) {
-  return make_scoped_ptr<RefreshTokenStore>(
+  return base::WrapUnique<RefreshTokenStore>(
       new RefreshTokenStoreOnDisk(user_name, refresh_token_file_path));
 }
 
diff --git a/remoting/test/refresh_token_store.h b/remoting/test/refresh_token_store.h
index 1ee2f50..01d972c 100644
--- a/remoting/test/refresh_token_store.h
+++ b/remoting/test/refresh_token_store.h
@@ -5,9 +5,9 @@
 #ifndef REMOTING_TEST_REFRESH_TOKEN_STORE_H_
 #define REMOTING_TEST_REFRESH_TOKEN_STORE_H_
 
+#include <memory>
 #include <string>
 
-#include "base/memory/scoped_ptr.h"
 
 namespace base {
 class FilePath;
@@ -28,7 +28,7 @@
 
   // Returns a RefreshTokenStore which reads/writes to a user specific token
   // file on the local disk.
-  static scoped_ptr<RefreshTokenStore> OnDisk(
+  static std::unique_ptr<RefreshTokenStore> OnDisk(
       const std::string& user_name,
       const base::FilePath& refresh_token_file_path);
 };
diff --git a/remoting/test/remote_host_info_fetcher.cc b/remoting/test/remote_host_info_fetcher.cc
index 4d9bfb8..b5d009a 100644
--- a/remoting/test/remote_host_info_fetcher.cc
+++ b/remoting/test/remote_host_info_fetcher.cc
@@ -87,7 +87,7 @@
     return;
   }
 
-  scoped_ptr<base::Value> response_value(
+  std::unique_ptr<base::Value> response_value(
       base::JSONReader::Read(response_string));
   if (!response_value ||
       !response_value->IsType(base::Value::TYPE_DICTIONARY)) {
diff --git a/remoting/test/remote_host_info_fetcher.h b/remoting/test/remote_host_info_fetcher.h
index 4fc9d4c..34b599d 100644
--- a/remoting/test/remote_host_info_fetcher.h
+++ b/remoting/test/remote_host_info_fetcher.h
@@ -5,12 +5,12 @@
 #ifndef REMOTING_TEST_REMOTE_HOST_INFO_FETCHER_H_
 #define REMOTING_TEST_REMOTE_HOST_INFO_FETCHER_H_
 
+#include <memory>
 #include <string>
 
 #include "base/callback.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "net/url_request/url_fetcher_delegate.h"
 #include "remoting/test/app_remoting_service_urls.h"
 #include "remoting/test/remote_host_info.h"
@@ -52,7 +52,7 @@
   void OnURLFetchComplete(const net::URLFetcher* source) override;
 
   // Holds the URLFetcher for the RemoteHostInfo request.
-  scoped_ptr<net::URLFetcher> request_;
+  std::unique_ptr<net::URLFetcher> request_;
 
   // Provides application-specific context for the network request.
   scoped_refptr<remoting::URLRequestContextGetter> request_context_getter_;
diff --git a/remoting/test/remote_host_info_fetcher_unittest.cc b/remoting/test/remote_host_info_fetcher_unittest.cc
index e088a6b..3227b99e 100644
--- a/remoting/test/remote_host_info_fetcher_unittest.cc
+++ b/remoting/test/remote_host_info_fetcher_unittest.cc
@@ -82,7 +82,7 @@
 
  private:
   net::FakeURLFetcherFactory url_fetcher_factory_;
-  scoped_ptr<base::MessageLoopForIO> message_loop_;
+  std::unique_ptr<base::MessageLoopForIO> message_loop_;
 
   DISALLOW_COPY_AND_ASSIGN(RemoteHostInfoFetcherTest);
 };
diff --git a/remoting/test/test_chromoting_client.cc b/remoting/test/test_chromoting_client.cc
index 64625ce..cd9309d 100644
--- a/remoting/test/test_chromoting_client.cc
+++ b/remoting/test/test_chromoting_client.cc
@@ -9,6 +9,7 @@
 #include <vector>
 
 #include "base/logging.h"
+#include "base/memory/ptr_util.h"
 #include "base/thread_task_runner_handle.h"
 #include "jingle/glue/thread_wrapper.h"
 #include "net/base/request_priority.h"
@@ -63,7 +64,7 @@
     : TestChromotingClient(nullptr) {}
 
 TestChromotingClient::TestChromotingClient(
-    scoped_ptr<protocol::VideoRenderer> video_renderer)
+    std::unique_ptr<protocol::VideoRenderer> video_renderer)
     : connection_to_host_state_(protocol::ConnectionToHost::INITIALIZING),
       connection_error_code_(protocol::OK),
       video_renderer_(std::move(video_renderer)) {}
@@ -121,8 +122,8 @@
   scoped_refptr<protocol::TransportContext> transport_context(
       new protocol::TransportContext(
           signal_strategy_.get(),
-          make_scoped_ptr(new protocol::ChromiumPortAllocatorFactory()),
-          make_scoped_ptr(
+          base::WrapUnique(new protocol::ChromiumPortAllocatorFactory()),
+          base::WrapUnique(
               new ChromiumUrlRequestFactory(request_context_getter)),
           network_settings, protocol::TransportRole::CLIENT));
 
@@ -177,12 +178,12 @@
 }
 
 void TestChromotingClient::SetSignalStrategyForTests(
-    scoped_ptr<SignalStrategy> signal_strategy) {
+    std::unique_ptr<SignalStrategy> signal_strategy) {
   signal_strategy_ = std::move(signal_strategy);
 }
 
 void TestChromotingClient::SetConnectionToHostForTests(
-    scoped_ptr<protocol::ConnectionToHost> connection_to_host) {
+    std::unique_ptr<protocol::ConnectionToHost> connection_to_host) {
   test_connection_to_host_ = std::move(connection_to_host);
 }
 
diff --git a/remoting/test/test_chromoting_client.h b/remoting/test/test_chromoting_client.h
index f8a4551..e4c0a80 100644
--- a/remoting/test/test_chromoting_client.h
+++ b/remoting/test/test_chromoting_client.h
@@ -5,11 +5,11 @@
 #ifndef REMOTING_TEST_TEST_CHROMOTING_CLIENT_H_
 #define REMOTING_TEST_TEST_CHROMOTING_CLIENT_H_
 
+#include <memory>
 #include <string>
 
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/observer_list.h"
 #include "remoting/client/chromoting_client.h"
 #include "remoting/client/client_user_interface.h"
@@ -45,7 +45,7 @@
  public:
   TestChromotingClient();
   explicit TestChromotingClient(
-      scoped_ptr<protocol::VideoRenderer> video_renderer);
+      std::unique_ptr<protocol::VideoRenderer> video_renderer);
   ~TestChromotingClient() override;
 
   // Starts a Chromoting connection using the specified connection setup info.
@@ -70,9 +70,10 @@
   void RemoveRemoteConnectionObserver(RemoteConnectionObserver* observer);
 
   // Used to set a fake/mock dependencies for tests.
-  void SetSignalStrategyForTests(scoped_ptr<SignalStrategy> signal_strategy);
+  void SetSignalStrategyForTests(
+      std::unique_ptr<SignalStrategy> signal_strategy);
   void SetConnectionToHostForTests(
-      scoped_ptr<protocol::ConnectionToHost> connection_to_host);
+      std::unique_ptr<protocol::ConnectionToHost> connection_to_host);
 
  private:
   // ClientUserInterface interface.
@@ -108,19 +109,19 @@
   base::ObserverList<RemoteConnectionObserver, true> connection_observers_;
 
   // ConnectionToHost used by TestChromotingClient tests.
-  scoped_ptr<protocol::ConnectionToHost> test_connection_to_host_;
+  std::unique_ptr<protocol::ConnectionToHost> test_connection_to_host_;
 
   // Creates and manages the connection to the remote host.
-  scoped_ptr<ChromotingClient> chromoting_client_;
+  std::unique_ptr<ChromotingClient> chromoting_client_;
 
   // Manages the threads and task runners for |chromoting_client_|.
-  scoped_ptr<ClientContext> client_context_;
+  std::unique_ptr<ClientContext> client_context_;
 
   // Processes video packets from the host.
-  scoped_ptr<protocol::VideoRenderer> video_renderer_;
+  std::unique_ptr<protocol::VideoRenderer> video_renderer_;
 
   // SignalStrategy used for connection signaling.
-  scoped_ptr<SignalStrategy> signal_strategy_;
+  std::unique_ptr<SignalStrategy> signal_strategy_;
 
   DISALLOW_COPY_AND_ASSIGN(TestChromotingClient);
 };
diff --git a/remoting/test/test_chromoting_client_unittest.cc b/remoting/test/test_chromoting_client_unittest.cc
index e4bdcf3..3cfc961 100644
--- a/remoting/test/test_chromoting_client_unittest.cc
+++ b/remoting/test/test_chromoting_client_unittest.cc
@@ -2,14 +2,16 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "remoting/test/test_chromoting_client.h"
+
 #include <string>
 
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/message_loop/message_loop.h"
 #include "remoting/protocol/fake_connection_to_host.h"
 #include "remoting/signaling/fake_signal_strategy.h"
 #include "remoting/test/connection_setup_info.h"
-#include "remoting/test/test_chromoting_client.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace remoting {
@@ -42,7 +44,7 @@
   ConnectionSetupInfo connection_setup_info_;
   FakeConnectionToHost* fake_connection_to_host_ = nullptr;
 
-  scoped_ptr<TestChromotingClient> test_chromoting_client_;
+  std::unique_ptr<TestChromotingClient> test_chromoting_client_;
 
  private:
   // RemoteConnectionObserver interface.
@@ -66,10 +68,10 @@
   // keep the ptr around so we can use it to simulate state changes.  It will
   // remain valid until |test_chromoting_client_| is destroyed.
   fake_connection_to_host_ = new FakeConnectionToHost();
-  test_chromoting_client_->SetSignalStrategyForTests(make_scoped_ptr(
+  test_chromoting_client_->SetSignalStrategyForTests(base::WrapUnique(
       new FakeSignalStrategy("test_user@faux_address.com/123")));
   test_chromoting_client_->SetConnectionToHostForTests(
-      make_scoped_ptr(fake_connection_to_host_));
+      base::WrapUnique(fake_connection_to_host_));
 
   connection_setup_info_.host_jid = "test_host@faux_address.com/321";
 }
diff --git a/remoting/test/test_video_renderer.cc b/remoting/test/test_video_renderer.cc
index 00a4bf7f..44690a7 100644
--- a/remoting/test/test_video_renderer.cc
+++ b/remoting/test/test_video_renderer.cc
@@ -10,6 +10,7 @@
 #include "base/callback_helpers.h"
 #include "base/logging.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/synchronization/lock.h"
 #include "base/thread_task_runner_handle.h"
 #include "base/threading/thread.h"
@@ -44,14 +45,14 @@
   void Initialize();
 
   // Used to decode video packets.
-  void ProcessVideoPacket(scoped_ptr<VideoPacket> packet,
+  void ProcessVideoPacket(std::unique_ptr<VideoPacket> packet,
                           const base::Closure& done);
 
   // Initialize a decoder to decode video packets.
   void SetCodecForDecoding(const protocol::ChannelConfig::Codec codec);
 
   // Returns a copy of the current frame.
-  scoped_ptr<webrtc::DesktopFrame> GetCurrentFrameForTest() const;
+  std::unique_ptr<webrtc::DesktopFrame> GetCurrentFrameForTest() const;
 
   // Set expected image pattern for comparison and the callback will be called
   // when the pattern is matched.
@@ -78,7 +79,7 @@
   base::ThreadChecker thread_checker_;
 
   // Used to decode video packets.
-  scoped_ptr<VideoDecoder> decoder_;
+  std::unique_ptr<VideoDecoder> decoder_;
 
   // Used to post tasks back to main thread.
   scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
@@ -87,7 +88,7 @@
   mutable base::Lock lock_;
 
   // Used to store decoded video frame.
-  scoped_ptr<webrtc::SharedDesktopFrame> frame_;
+  std::unique_ptr<webrtc::SharedDesktopFrame> frame_;
 
   // Used to store the expected image pattern.
   webrtc::DesktopRect expected_rect_;
@@ -149,15 +150,16 @@
   }
 }
 
-scoped_ptr<webrtc::DesktopFrame>
+std::unique_ptr<webrtc::DesktopFrame>
 TestVideoRenderer::Core::GetCurrentFrameForTest() const {
   base::AutoLock auto_lock(lock_);
   DCHECK(frame_);
-  return make_scoped_ptr(webrtc::BasicDesktopFrame::CopyOf(*frame_));
+  return base::WrapUnique(webrtc::BasicDesktopFrame::CopyOf(*frame_));
 }
 
-void TestVideoRenderer::Core::ProcessVideoPacket(scoped_ptr<VideoPacket> packet,
-                                                 const base::Closure& done) {
+void TestVideoRenderer::Core::ProcessVideoPacket(
+    std::unique_ptr<VideoPacket> packet,
+    const base::Closure& done) {
   DCHECK(thread_checker_.CalledOnValidThread());
   DCHECK(decoder_);
   DCHECK(packet);
@@ -180,7 +182,7 @@
   // Render the result into a new DesktopFrame instance that shares buffer with
   // |frame_|. updated_region() will be updated for |new_frame|, but not for
   // |frame_|.
-  scoped_ptr<webrtc::DesktopFrame> new_frame(frame_->Share());
+  std::unique_ptr<webrtc::DesktopFrame> new_frame(frame_->Share());
 
   {
     base::AutoLock auto_lock(lock_);
@@ -193,7 +195,7 @@
   main_task_runner_->PostTask(FROM_HERE, done);
 
   if (save_frame_data_to_disk_) {
-    scoped_ptr<webrtc::DesktopFrame> frame(
+    std::unique_ptr<webrtc::DesktopFrame> frame(
         webrtc::BasicDesktopFrame::CopyOf(*frame_));
     video_frame_writer.HighlightRectInFrame(frame.get(), expected_rect_);
     video_frame_writer.WriteFrameToDefaultPath(*frame);
@@ -313,8 +315,9 @@
   return nullptr;
 }
 
-void TestVideoRenderer::ProcessVideoPacket(scoped_ptr<VideoPacket> video_packet,
-                                           const base::Closure& done) {
+void TestVideoRenderer::ProcessVideoPacket(
+    std::unique_ptr<VideoPacket> video_packet,
+    const base::Closure& done) {
   DCHECK(thread_checker_.CalledOnValidThread());
   DCHECK(video_decode_task_runner_) << "Failed to start video decode thread";
 
@@ -345,8 +348,8 @@
                             codec));
 }
 
-scoped_ptr<webrtc::DesktopFrame> TestVideoRenderer::GetCurrentFrameForTest()
-    const {
+std::unique_ptr<webrtc::DesktopFrame>
+TestVideoRenderer::GetCurrentFrameForTest() const {
   DCHECK(thread_checker_.CalledOnValidThread());
 
   return core_->GetCurrentFrameForTest();
diff --git a/remoting/test/test_video_renderer.h b/remoting/test/test_video_renderer.h
index 1ea4905..b872162 100644
--- a/remoting/test/test_video_renderer.h
+++ b/remoting/test/test_video_renderer.h
@@ -5,8 +5,9 @@
 #ifndef REMOTING_TEST_TEST_VIDEO_RENDERER_H_
 #define REMOTING_TEST_TEST_VIDEO_RENDERER_H_
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/threading/thread_checker.h"
 #include "remoting/protocol/session_config.h"
@@ -44,14 +45,14 @@
   protocol::FrameConsumer* GetFrameConsumer() override;
 
   // protocol::VideoStub interface.
-  void ProcessVideoPacket(scoped_ptr<VideoPacket> video_packet,
+  void ProcessVideoPacket(std::unique_ptr<VideoPacket> video_packet,
                           const base::Closure& done) override;
 
   // Initialize a decoder to decode video packets.
   void SetCodecForDecoding(const protocol::ChannelConfig::Codec codec);
 
   // Returns a copy of the current frame.
-  scoped_ptr<webrtc::DesktopFrame> GetCurrentFrameForTest() const;
+  std::unique_ptr<webrtc::DesktopFrame> GetCurrentFrameForTest() const;
 
   // Gets a weak pointer for this object.
   base::WeakPtr<TestVideoRenderer> GetWeakPtr() {
@@ -71,13 +72,13 @@
  private:
   // The actual implementation resides in Core class.
   class Core;
-  scoped_ptr<Core> core_;
+  std::unique_ptr<Core> core_;
 
   // Used to ensure TestVideoRenderer methods are called on the same thread.
   base::ThreadChecker thread_checker_;
 
   // Used to decode and process video packets.
-  scoped_ptr<base::Thread>  video_decode_thread_;
+  std::unique_ptr<base::Thread> video_decode_thread_;
 
   // Used to post tasks to video decode thread.
   scoped_refptr<base::SingleThreadTaskRunner> video_decode_task_runner_;
diff --git a/remoting/test/test_video_renderer_unittest.cc b/remoting/test/test_video_renderer_unittest.cc
index 99220897..fae0f0e 100644
--- a/remoting/test/test_video_renderer_unittest.cc
+++ b/remoting/test/test_video_renderer_unittest.cc
@@ -10,6 +10,7 @@
 #include <utility>
 
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/memory/scoped_vector.h"
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
@@ -66,21 +67,22 @@
                              bool expect_to_match);
 
   // Generate a basic desktop frame containing a gradient.
-  scoped_ptr<webrtc::DesktopFrame> CreateDesktopFrameWithGradient(
-      int screen_width, int screen_height) const;
+  std::unique_ptr<webrtc::DesktopFrame> CreateDesktopFrameWithGradient(
+      int screen_width,
+      int screen_height) const;
 
  protected:
   // Used to post tasks to the message loop.
-  scoped_ptr<base::RunLoop> run_loop_;
+  std::unique_ptr<base::RunLoop> run_loop_;
 
   // Used to set timeouts and delays.
-  scoped_ptr<base::Timer> timer_;
+  std::unique_ptr<base::Timer> timer_;
 
   // Manages the decoder and process generated video packets.
-  scoped_ptr<TestVideoRenderer> test_video_renderer_;
+  std::unique_ptr<TestVideoRenderer> test_video_renderer_;
 
   // Used to encode desktop frames to generate video packets.
-  scoped_ptr<VideoEncoder> encoder_;
+  std::unique_ptr<VideoEncoder> encoder_;
 
  private:
   // testing::Test interface.
@@ -88,7 +90,7 @@
 
   // Set image pattern, send video packet and returns if the expected pattern is
   // matched.
-  bool SendPacketAndWaitForMatch(scoped_ptr<VideoPacket> packet,
+  bool SendPacketAndWaitForMatch(std::unique_ptr<VideoPacket> packet,
                                  const webrtc::DesktopRect& expected_rect,
                                  const RGBValue& expected_average_color);
 
@@ -108,7 +110,7 @@
   void FillFrameWithGradient(webrtc::DesktopFrame* frame) const;
 
   // The thread's message loop. Valid only when the thread is alive.
-  scoped_ptr<base::MessageLoop> message_loop_;
+  std::unique_ptr<base::MessageLoop> message_loop_;
 
   DISALLOW_COPY_AND_ASSIGN(TestVideoRendererTest);
 };
@@ -134,11 +136,11 @@
   DCHECK(test_video_renderer_);
 
   // Generate a frame containing a gradient.
-  scoped_ptr<webrtc::DesktopFrame> original_frame =
+  std::unique_ptr<webrtc::DesktopFrame> original_frame =
       CreateDesktopFrameWithGradient(screen_width, screen_height);
   EXPECT_TRUE(original_frame);
 
-  scoped_ptr<VideoPacket> packet = encoder_->Encode(*original_frame.get());
+  std::unique_ptr<VideoPacket> packet = encoder_->Encode(*original_frame.get());
 
   DCHECK(!run_loop_ || !run_loop_->running());
   DCHECK(!timer_->IsRunning());
@@ -159,7 +161,7 @@
   timer_->Stop();
   run_loop_.reset();
 
-  scoped_ptr<webrtc::DesktopFrame> buffer_copy =
+  std::unique_ptr<webrtc::DesktopFrame> buffer_copy =
       test_video_renderer_->GetCurrentFrameForTest();
   EXPECT_NE(buffer_copy, nullptr);
 
@@ -170,7 +172,7 @@
 }
 
 bool TestVideoRendererTest::SendPacketAndWaitForMatch(
-    scoped_ptr<VideoPacket> packet,
+    std::unique_ptr<VideoPacket> packet,
     const webrtc::DesktopRect& expected_rect,
     const RGBValue& expected_average_color) {
   DCHECK(!run_loop_ || !run_loop_->running());
@@ -188,7 +190,7 @@
       expected_rect, expected_average_color, run_loop_->QuitClosure());
 
   // Used to verify if the expected image pattern will be matched by |packet|.
-  scoped_ptr<VideoPacket> packet_copy(new VideoPacket(*packet.get()));
+  std::unique_ptr<VideoPacket> packet_copy(new VideoPacket(*packet.get()));
 
   // Post first test packet: |packet|.
   test_video_renderer_->ProcessVideoPacket(std::move(packet),
@@ -226,11 +228,11 @@
   DCHECK(encoder_);
   DCHECK(test_video_renderer_);
 
-  scoped_ptr<webrtc::DesktopFrame> frame =
+  std::unique_ptr<webrtc::DesktopFrame> frame =
       CreateDesktopFrameWithGradient(screen_width, screen_height);
   RGBValue expected_average_color =
       CalculateAverageColorValueForFrame(frame.get(), expected_rect);
-  scoped_ptr<VideoPacket> packet = encoder_->Encode(*frame.get());
+  std::unique_ptr<VideoPacket> packet = encoder_->Encode(*frame.get());
 
   if (expect_to_match) {
     EXPECT_TRUE(SendPacketAndWaitForMatch(std::move(packet), expected_rect,
@@ -332,11 +334,11 @@
   return sqrt(error_sum_squares / (3 * screen_width * screen_height));
 }
 
-scoped_ptr<webrtc::DesktopFrame>
-    TestVideoRendererTest::CreateDesktopFrameWithGradient(
-        int screen_width, int screen_height) const {
+std::unique_ptr<webrtc::DesktopFrame>
+TestVideoRendererTest::CreateDesktopFrameWithGradient(int screen_width,
+                                                      int screen_height) const {
   webrtc::DesktopSize screen_size(screen_width, screen_height);
-  scoped_ptr<webrtc::DesktopFrame> frame(
+  std::unique_ptr<webrtc::DesktopFrame> frame(
       new webrtc::BasicDesktopFrame(screen_size));
   frame->mutable_updated_region()->SetRect(
       webrtc::DesktopRect::MakeSize(screen_size));
@@ -399,7 +401,7 @@
   const int task_num = 20;
   ScopedVector<VideoPacket> video_packets;
   for (int i = 0; i < task_num; ++i) {
-    scoped_ptr<webrtc::DesktopFrame> original_frame =
+    std::unique_ptr<webrtc::DesktopFrame> original_frame =
         CreateDesktopFrameWithGradient(kDefaultScreenWidthPx,
                                        kDefaultScreenHeightPx);
     video_packets.push_back(encoder_->Encode(*original_frame.get()));
@@ -409,7 +411,7 @@
     // Transfer ownership of video packet.
     VideoPacket* packet = video_packets[i];
     video_packets[i] = nullptr;
-    test_video_renderer_->ProcessVideoPacket(make_scoped_ptr(packet),
+    test_video_renderer_->ProcessVideoPacket(base::WrapUnique(packet),
                                              base::Bind(&base::DoNothing));
   }
 }
@@ -439,7 +441,7 @@
   DCHECK(encoder_);
   DCHECK(test_video_renderer_);
 
-  scoped_ptr<webrtc::DesktopFrame> frame = CreateDesktopFrameWithGradient(
+  std::unique_ptr<webrtc::DesktopFrame> frame = CreateDesktopFrameWithGradient(
       kDefaultScreenWidthPx, kDefaultScreenHeightPx);
 
   // Since we don't care whether expected image pattern is matched or not in
diff --git a/sql/sql_unittests_apk.isolate b/sql/sql_unittests_apk.isolate
index 7788b5c..412e3b8 100644
--- a/sql/sql_unittests_apk.isolate
+++ b/sql/sql_unittests_apk.isolate
@@ -9,6 +9,7 @@
   'variables': {
     'command': [
       '<(PRODUCT_DIR)/bin/run_sql_unittests',
+      '--logcat-output-dir', '${ISOLATED_OUTDIR}/logcats',
     ],
     'files': [
       '../base/base.isolate',
diff --git a/testing/buildbot/chromium.chromiumos.json b/testing/buildbot/chromium.chromiumos.json
index b79122a..43b689ce 100644
--- a/testing/buildbot/chromium.chromiumos.json
+++ b/testing/buildbot/chromium.chromiumos.json
@@ -37,6 +37,12 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         },
+        "test": "app_list_shower_unittests"
+      },
+      {
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        },
         "test": "app_list_unittests"
       },
       {
@@ -322,6 +328,12 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         },
+        "test": "app_list_shower_unittests"
+      },
+      {
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        },
         "test": "app_list_unittests"
       },
       {
@@ -621,6 +633,12 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         },
+        "test": "app_list_shower_unittests"
+      },
+      {
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        },
         "test": "app_list_unittests"
       },
       {
diff --git a/testing/buildbot/chromium.fyi.json b/testing/buildbot/chromium.fyi.json
index 82f8da7..9ee3d6d 100644
--- a/testing/buildbot/chromium.fyi.json
+++ b/testing/buildbot/chromium.fyi.json
@@ -401,6 +401,12 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         },
+        "test": "app_list_shower_unittests"
+      },
+      {
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        },
         "test": "app_list_unittests"
       },
       {
@@ -1294,6 +1300,12 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         },
+        "test": "app_list_shower_unittests"
+      },
+      {
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        },
         "test": "app_list_unittests"
       },
       {
@@ -6534,6 +6546,12 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         },
+        "test": "app_list_shower_unittests"
+      },
+      {
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        },
         "test": "app_list_unittests"
       },
       {
@@ -6861,6 +6879,9 @@
         "test": "app_list_unittests"
       },
       {
+        "test": "app_list_shower_unittests"
+      },
+      {
         "test": "app_shell_unittests"
       },
       {
@@ -7062,6 +7083,12 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         },
+        "test": "app_list_shower_unittests"
+      },
+      {
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        },
         "test": "app_list_unittests"
       },
       {
@@ -7386,6 +7413,9 @@
         "test": "app_list_unittests"
       },
       {
+        "test": "app_list_shower_unittests"
+      },
+      {
         "test": "app_shell_unittests"
       },
       {
diff --git a/testing/buildbot/chromium.linux.json b/testing/buildbot/chromium.linux.json
index 820345b..89e5b99 100644
--- a/testing/buildbot/chromium.linux.json
+++ b/testing/buildbot/chromium.linux.json
@@ -562,6 +562,12 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         },
+        "test": "app_list_shower_unittests"
+      },
+      {
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        },
         "test": "app_list_unittests"
       },
       {
@@ -1020,6 +1026,12 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         },
+        "test": "app_list_shower_unittests"
+      },
+      {
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        },
         "test": "app_list_unittests"
       },
       {
@@ -1413,6 +1425,12 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         },
+        "test": "app_list_shower_unittests"
+      },
+      {
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        },
         "test": "app_list_unittests"
       },
       {
diff --git a/testing/buildbot/chromium.memory.fyi.json b/testing/buildbot/chromium.memory.fyi.json
index 74efcba..465518f4 100644
--- a/testing/buildbot/chromium.memory.fyi.json
+++ b/testing/buildbot/chromium.memory.fyi.json
@@ -88,6 +88,9 @@
         "test": "app_list_unittests"
       },
       {
+        "test": "app_list_shower_unittests"
+      },
+      {
         "test": "display_unittests"
       },
       {
@@ -205,6 +208,7 @@
   "Chromium OS Builder (valgrind)": {
     "additional_compile_targets": [
       "app_list_unittests",
+      "app_list_shower_unittests",
       "ash_unittests",
       "aura_unittests",
       "base_unittests",
@@ -243,6 +247,7 @@
       "accessibility_unittests",
       "angle_unittests",
       "app_list_unittests",
+      "app_list_shower_unittests",
       "aura_unittests",
       "base_unittests",
       "blink_heap_unittests",
@@ -292,6 +297,7 @@
       "accessibility_unittests",
       "angle_unittests",
       "app_list_unittests",
+      "app_list_shower_unittests",
       "aura_unittests",
       "base_unittests",
       "blink_heap_unittests",
@@ -350,6 +356,12 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         },
+        "test": "app_list_shower_unittests"
+      },
+      {
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        },
         "test": "app_list_unittests"
       },
       {
@@ -635,6 +647,12 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         },
+        "test": "app_list_shower_unittests"
+      },
+      {
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        },
         "test": "app_list_unittests"
       },
       {
@@ -937,6 +955,12 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         },
+        "test": "app_list_shower_unittests"
+      },
+      {
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        },
         "test": "app_list_unittests"
       },
       {
@@ -2209,6 +2233,9 @@
         "test": "app_list_unittests"
       },
       {
+        "test": "app_list_shower_unittests"
+      },
+      {
         "test": "aura_unittests"
       },
       {
@@ -2276,6 +2303,9 @@
         "test": "app_list_unittests"
       },
       {
+        "test": "app_list_shower_unittests"
+      },
+      {
         "test": "aura_unittests"
       },
       {
@@ -2415,6 +2445,9 @@
         "test": "app_list_unittests"
       },
       {
+        "test": "app_list_shower_unittests"
+      },
+      {
         "test": "aura_unittests"
       },
       {
diff --git a/testing/buildbot/chromium.memory.json b/testing/buildbot/chromium.memory.json
index 7460b60..ddc1c70 100644
--- a/testing/buildbot/chromium.memory.json
+++ b/testing/buildbot/chromium.memory.json
@@ -276,6 +276,12 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         },
+        "test": "app_list_shower_unittests"
+      },
+      {
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        },
         "test": "app_list_unittests"
       },
       {
diff --git a/testing/buildbot/chromium.webkit.json b/testing/buildbot/chromium.webkit.json
index 3108038..5d3225d 100644
--- a/testing/buildbot/chromium.webkit.json
+++ b/testing/buildbot/chromium.webkit.json
@@ -125,6 +125,12 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         },
+        "test": "app_list_shower_unittests"
+      },
+      {
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        },
         "test": "app_list_unittests"
       },
       {
diff --git a/testing/buildbot/chromium.win.json b/testing/buildbot/chromium.win.json
index 118d80d..f35f59a 100644
--- a/testing/buildbot/chromium.win.json
+++ b/testing/buildbot/chromium.win.json
@@ -11,6 +11,12 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         },
+        "test": "app_list_shower_unittests"
+      },
+      {
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        },
         "test": "app_list_unittests"
       },
       {
@@ -430,6 +436,12 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         },
+        "test": "app_list_shower_unittests"
+      },
+      {
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        },
         "test": "app_list_unittests"
       },
       {
@@ -865,6 +877,12 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         },
+        "test": "app_list_shower_unittests"
+      },
+      {
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        },
         "test": "app_list_unittests"
       },
       {
@@ -1283,6 +1301,12 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         },
+        "test": "app_list_shower_unittests"
+      },
+      {
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        },
         "test": "app_list_unittests"
       },
       {
@@ -2064,6 +2088,7 @@
     "additional_compile_targets": [
       "accessibility_unittests",
       "app_list_unittests",
+      "app_list_shower_unittests",
       "app_shell_unittests",
       "ash_shell_with_content",
       "ash_unittests",
diff --git a/testing/buildbot/chromium_trybot.json b/testing/buildbot/chromium_trybot.json
index 9083bde..b909f9e 100644
--- a/testing/buildbot/chromium_trybot.json
+++ b/testing/buildbot/chromium_trybot.json
@@ -22,6 +22,12 @@
       "test": "app_list_unittests"
     },
     {
+      "swarming": {
+        "can_use_on_swarming_builders": true
+      },
+      "test": "app_list_shower_unittests"
+    },
+    {
       "chromium_configs": [
         "chromium_chromeos",
         "chromium_chromeos_clang",
diff --git a/testing/buildbot/client.v8.fyi.json b/testing/buildbot/client.v8.fyi.json
index bc7c405..9fee35f 100644
--- a/testing/buildbot/client.v8.fyi.json
+++ b/testing/buildbot/client.v8.fyi.json
@@ -9,6 +9,7 @@
     "additional_compile_targets": [
       "accessibility_unittests",
       "app_list_unittests",
+      "app_list_shower_unittests",
       "aura_unittests",
       "browser_tests",
       "cacheinvalidation_unittests",
diff --git a/testing/buildbot/gn_isolate_map.pyl b/testing/buildbot/gn_isolate_map.pyl
index 0d6fe1c9..641d182d 100644
--- a/testing/buildbot/gn_isolate_map.pyl
+++ b/testing/buildbot/gn_isolate_map.pyl
@@ -99,6 +99,10 @@
     "label": "//ui/app_list:app_list_unittests",
     "type": "windowed_test_launcher",
   },
+  "app_list_shower_unittests": {
+    "label": "//ui/app_list/shower:app_list_shower_unittests",
+    "type": "windowed_test_launcher",
+  },
   "app_shell_unittests": {
     "label": "//extensions/shell:app_shell_unittests",
     "type": "windowed_test_launcher",
diff --git a/testing/buildbot/tryserver.v8.json b/testing/buildbot/tryserver.v8.json
index 2852105c..81e9c88 100644
--- a/testing/buildbot/tryserver.v8.json
+++ b/testing/buildbot/tryserver.v8.json
@@ -9,6 +9,7 @@
     "additional_compile_targets": [
       "accessibility_unittests",
       "app_list_unittests",
+      "app_list_shower_unittests",
       "aura_unittests",
       "browser_tests",
       "cacheinvalidation_unittests",
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/site-per-process b/third_party/WebKit/LayoutTests/FlagExpectations/site-per-process
index 653bfb2..42b4d5cd 100644
--- a/third_party/WebKit/LayoutTests/FlagExpectations/site-per-process
+++ b/third_party/WebKit/LayoutTests/FlagExpectations/site-per-process
@@ -12,31 +12,13 @@
 http/tests/inspector-enabled/console-log-before-frame-navigation.html [ Crash ]
 http/tests/inspector/change-iframe-src.html [ Crash ]
 http/tests/navigation/cross-origin-fragment-navigation-is-async.html [ Crash Failure ]
-http/tests/security/aboutBlank/xss-DENIED-navigate-opener-document-write.html [ Crash Failure ]
-http/tests/security/aboutBlank/xss-DENIED-navigate-opener-javascript-url.html [ Crash Failure ]
-http/tests/security/contentSecurityPolicy/1.1/referrer-always-http-https.html [ Crash ]
-http/tests/security/contentSecurityPolicy/1.1/referrer-default-http-https.html [ Crash ]
-http/tests/security/contentSecurityPolicy/1.1/referrer-empty-http-https.html [ Crash ]
-http/tests/security/contentSecurityPolicy/1.1/referrer-invalid-http-https.html [ Crash ]
-http/tests/security/contentSecurityPolicy/1.1/referrer-never-http-https.html [ Crash ]
-http/tests/security/contentSecurityPolicy/1.1/referrer-origin-http-https.html [ Crash ]
 http/tests/security/cross-frame-access-document-direct.html [ Crash Timeout ]
 http/tests/security/frameNavigation/xss-ALLOWED-targeted-subframe-navigation-change.html [ Crash Timeout ]
-http/tests/security/listener/xss-inactive-closure.html [ Crash ]
-http/tests/security/listener/xss-JSTargetNode-onclick-addEventListener.html [ Crash ]
-http/tests/security/listener/xss-JSTargetNode-onclick-shortcut.html [ Crash ]
-http/tests/security/listener/xss-window-onclick-addEventListener.html [ Crash ]
-http/tests/security/listener/xss-window-onclick-shortcut.html [ Crash ]
-http/tests/security/listener/xss-XMLHttpRequest-addEventListener.html [ Crash ]
-http/tests/security/listener/xss-XMLHttpRequest-shortcut.html [ Crash ]
-http/tests/security/object-literals.html [ Crash ]
 http/tests/security/referrer-policy-origin-when-crossorigin-is-crossorigin.html [ Crash Timeout ]
-http/tests/security/xss-eval.html [ Crash ]
 http/tests/security/xssAuditor/anchor-url-dom-write-location-inline-event.html [ Crash ]
 http/tests/security/xssAuditor/anchor-url-dom-write-location-inline-event-null-char.html [ Crash Timeout ]
 http/tests/security/xssAuditor/dom-write-location-inline-event.html [ Crash ]
 http/tests/serviceworker/windowclient-navigate.html [ Crash ]
-http/tests/xmlhttprequest/detaching-frame-2.html [ Crash ]
 
 # https://crbug.com/582289 - dumpResourceLoadCallbacks test flag is not replicated into OOPIFs.
 http/tests/security/XFrameOptions/x-frame-options-deny-meta-tag-parent-same-origin-deny.html [ Failure ]
@@ -71,10 +53,6 @@
 # https://crbug.com/582522 - extra mixedContent checks reported with --site-per-process
 http/tests/security/mixedContent/insecure-iframe-in-iframe.html [ Failure ]
 
-# https://crbug.com/582551 - testRunner.overridePreference doesn't impact all renderers.
-http/tests/security/powerfulFeatureRestrictions/geolocation-on-sandboxed-insecure-origin.html [ Failure ]
-http/tests/security/powerfulFeatureRestrictions/geolocation-on-secure-origin-in-insecure-origin.html [ Failure ]
-
 # https://crbug.com/582176 - InspectorTest.changeExecutionContext doesn't like OOPIFs.
 http/tests/inspector/console-cd-completions.html [ Failure ]
 http/tests/inspector/console-cd.html [ Failure ]
@@ -147,7 +125,6 @@
 http/tests/appcache/remove-cache.html [ Failure ]
 http/tests/inspector-protocol/access-inspected-object.html [ Timeout Failure ]
 http/tests/inspector/injected-script-for-origin.html [ Failure ]
-http/tests/inspector/resource-parameters.html [ Failure ]
 http/tests/local/serviceworker/fetch-request-body-file.html [ Failure Crash ]
 http/tests/inspector-protocol/request-mixed-content-status-blockable.html [ Timeout ]
 http/tests/inspector-protocol/request-mixed-content-status-none.html [ Timeout ]
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations
index 8fa5517..01041f8 100644
--- a/third_party/WebKit/LayoutTests/TestExpectations
+++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -1313,7 +1313,7 @@
 crbug.com/587593 [ Android ] fast/js/pic/cached-single-entry-transition.html [ Pass Failure ]
 
 crbug.com/587779 [ Linux Mac10.10 Mac10.11 Retina ] fast/dynamic/window-resize-scrollbars-test.html [ Timeout Failure Pass ]
-
+crbug.com/590043 media/media-document-audio-repaint.html [ NeedsRebaseline ]
 crbug.com/588103 fast/xmlhttprequest/xmlhttprequest-responsetype-arraybuffer.html [ Pass Failure ]
 
 crbug.com/594672 fast/events/iframe-object-onload.html [ Failure Pass ]
diff --git a/third_party/WebKit/LayoutTests/VirtualTestSuites b/third_party/WebKit/LayoutTests/VirtualTestSuites
index e243fe1..f9f5f74 100644
--- a/third_party/WebKit/LayoutTests/VirtualTestSuites
+++ b/third_party/WebKit/LayoutTests/VirtualTestSuites
@@ -98,6 +98,11 @@
              "--disable-composited-antialiasing"]
   },
   {
+    "prefix": "android",
+    "base": "media/mediadocument",
+    "args": ["--enable-features=MediaDocumentDownloadButton"]
+  },
+  {
     "prefix": "stable",
     "base": "fast/css3-text/css3-text-decoration/stable",
     "args": ["--stable-release-mode"]
diff --git a/third_party/WebKit/LayoutTests/bluetooth/advertising-data.html b/third_party/WebKit/LayoutTests/bluetooth/advertising-data.html
index aba343a4..b70cfcc 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/advertising-data.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/advertising-data.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../resources/testharness.js"></script>
 <script src="../resources/testharnessreport.js"></script>
-<script src="resources/bluetooth-helpers.js"></script>
+<script src="../resources/bluetooth/bluetooth-helpers.js"></script>
 <script>
 'use strict';
 
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristicProperties.html b/third_party/WebKit/LayoutTests/bluetooth/characteristicProperties.html
index b119a40..1619fd1 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/characteristicProperties.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/characteristicProperties.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../resources/testharness.js"></script>
 <script src="../resources/testharnessreport.js"></script>
-<script src="resources/bluetooth-helpers.js"></script>
+<script src="../resources/bluetooth/bluetooth-helpers.js"></script>
 <script>
 'use strict';
 test(t => { assert_true(window.testRunner instanceof Object); t.done(); },
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristicvaluechanged.html b/third_party/WebKit/LayoutTests/bluetooth/characteristicvaluechanged.html
index f50fc6f51..0cf19da 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/characteristicvaluechanged.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/characteristicvaluechanged.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../resources/testharness.js"></script>
 <script src="../resources/testharnessreport.js"></script>
-<script src="resources/bluetooth-helpers.js"></script>
+<script src="../resources/bluetooth/bluetooth-helpers.js"></script>
 <script>
 'use strict';
 test(t => { assert_true(window.testRunner instanceof Object); t.done(); },
diff --git a/third_party/WebKit/LayoutTests/bluetooth/connect.html b/third_party/WebKit/LayoutTests/bluetooth/connect.html
index cf39934..da801f24 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/connect.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/connect.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../resources/testharness.js"></script>
 <script src="../resources/testharnessreport.js"></script>
-<script src="resources/bluetooth-helpers.js"></script>
+<script src="../resources/bluetooth/bluetooth-helpers.js"></script>
 <script>
 'use strict';
 
diff --git a/third_party/WebKit/LayoutTests/bluetooth/disconnect-frame-detached/detach-gc.html b/third_party/WebKit/LayoutTests/bluetooth/disconnect-frame-detached/detach-gc.html
index 403218b1..77144c6 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/disconnect-frame-detached/detach-gc.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/disconnect-frame-detached/detach-gc.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../../resources/testharness.js"></script>
 <script src="../../resources/testharnessreport.js"></script>
-<script src="../resources/bluetooth-helpers.js"></script>
+<script src="../../resources/bluetooth/bluetooth-helpers.js"></script>
 <body>
   <script>
   "use strict";
@@ -25,7 +25,7 @@
     setBluetoothFakeAdapter('HeartRateAdapter')
       .then(() => {
         let iframe = document.createElement('iframe');
-        iframe.src = '../resources/connect-iframe.html';
+        iframe.src = '../../resources/bluetooth/connect-iframe.html';
         document.body.appendChild(iframe);
       });
   }, 'Detach frame then garbage collect. We shouldn\'t crash.');
diff --git a/third_party/WebKit/LayoutTests/bluetooth/disconnect-frame-detached/gc-detach.html b/third_party/WebKit/LayoutTests/bluetooth/disconnect-frame-detached/gc-detach.html
index 28e1069..b6852a4 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/disconnect-frame-detached/gc-detach.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/disconnect-frame-detached/gc-detach.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../../resources/testharness.js"></script>
 <script src="../../resources/testharnessreport.js"></script>
-<script src="../resources/bluetooth-helpers.js"></script>
+<script src="../../resources/bluetooth/bluetooth-helpers.js"></script>
 <body>
   <script>
   "use strict";
@@ -27,7 +27,7 @@
     setBluetoothFakeAdapter('HeartRateAdapter')
       .then(() => {
         let iframe = document.createElement('iframe');
-        iframe.src = '../resources/connect-iframe.html';
+        iframe.src = '../../resources/bluetooth/connect-iframe.html';
         document.body.appendChild(iframe);
       });
   }, 'Garbage collect then detach frame. We shouldn\'t crash.');
diff --git a/third_party/WebKit/LayoutTests/bluetooth/disconnect-frame-detached/hide-detach.html b/third_party/WebKit/LayoutTests/bluetooth/disconnect-frame-detached/hide-detach.html
index 9395ceb..eeea6e7 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/disconnect-frame-detached/hide-detach.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/disconnect-frame-detached/hide-detach.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../../resources/testharness.js"></script>
 <script src="../../resources/testharnessreport.js"></script>
-<script src="../resources/bluetooth-helpers.js"></script>
+<script src="../../resources/bluetooth/bluetooth-helpers.js"></script>
 <body>
   <script>
   "use strict";
@@ -26,7 +26,7 @@
     setBluetoothFakeAdapter('HeartRateAdapter')
       .then(() => {
         let iframe = document.createElement('iframe');
-        iframe.src = '../resources/connect-iframe.html';
+        iframe.src = '../../resources/bluetooth/connect-iframe.html';
         document.body.appendChild(iframe);
       });
   }, 'Hide then detach frame. We shouldn\'t crash.');
diff --git a/third_party/WebKit/LayoutTests/bluetooth/disconnect.html b/third_party/WebKit/LayoutTests/bluetooth/disconnect.html
index 037122e4..5f7c57f9 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/disconnect.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/disconnect.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../resources/testharness.js"></script>
 <script src="../resources/testharnessreport.js"></script>
-<script src="resources/bluetooth-helpers.js"></script>
+<script src="../resources/bluetooth/bluetooth-helpers.js"></script>
 <script>
 'use strict';
 
diff --git a/third_party/WebKit/LayoutTests/bluetooth/getCharacteristic-blacklist.html b/third_party/WebKit/LayoutTests/bluetooth/getCharacteristic-blacklist.html
index ecf4539..8d19c31 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/getCharacteristic-blacklist.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/getCharacteristic-blacklist.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../resources/testharness.js"></script>
 <script src="../resources/testharnessreport.js"></script>
-<script src="resources/bluetooth-helpers.js"></script>
+<script src="../resources/bluetooth/bluetooth-helpers.js"></script>
 <script>
 'use strict';
 
diff --git a/third_party/WebKit/LayoutTests/bluetooth/getCharacteristic.html b/third_party/WebKit/LayoutTests/bluetooth/getCharacteristic.html
index e03c7260..435e3afa3 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/getCharacteristic.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/getCharacteristic.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../resources/testharness.js"></script>
 <script src="../resources/testharnessreport.js"></script>
-<script src="resources/bluetooth-helpers.js"></script>
+<script src="../resources/bluetooth/bluetooth-helpers.js"></script>
 <script>
 'use strict';
 
diff --git a/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/blacklisted-characteristics-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/blacklisted-characteristics-with-uuid.html
index f0d90e821..a6b92881 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/blacklisted-characteristics-with-uuid.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/blacklisted-characteristics-with-uuid.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../../resources/testharness.js"></script>
 <script src="../../resources/testharnessreport.js"></script>
-<script src="../resources/bluetooth-helpers.js"></script>
+<script src="../../resources/bluetooth/bluetooth-helpers.js"></script>
 <script>
 'use strict';
 promise_test(() => {
diff --git a/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/blacklisted-characteristics.html b/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/blacklisted-characteristics.html
index 1e2f3b9f..b2a20383 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/blacklisted-characteristics.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/blacklisted-characteristics.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../../resources/testharness.js"></script>
 <script src="../../resources/testharnessreport.js"></script>
-<script src="../resources/bluetooth-helpers.js"></script>
+<script src="../../resources/bluetooth/bluetooth-helpers.js"></script>
 <script>
 'use strict';
 promise_test(() => {
diff --git a/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/characteristics-found-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/characteristics-found-with-uuid.html
index 82a868e3..5abe37e8 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/characteristics-found-with-uuid.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/characteristics-found-with-uuid.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../../resources/testharness.js"></script>
 <script src="../../resources/testharnessreport.js"></script>
-<script src="../resources/bluetooth-helpers.js"></script>
+<script src="../../resources/bluetooth/bluetooth-helpers.js"></script>
 <script>
 'use strict';
 promise_test(() => {
diff --git a/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/characteristics-found.html b/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/characteristics-found.html
index e07d3d2..6290c53 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/characteristics-found.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/characteristics-found.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../../resources/testharness.js"></script>
 <script src="../../resources/testharnessreport.js"></script>
-<script src="../resources/bluetooth-helpers.js"></script>
+<script src="../../resources/bluetooth/bluetooth-helpers.js"></script>
 <script>
 'use strict';
 promise_test(() => {
diff --git a/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/characteristics-not-found-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/characteristics-not-found-with-uuid.html
index 90b74457..1f791a5 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/characteristics-not-found-with-uuid.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/characteristics-not-found-with-uuid.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../../resources/testharness.js"></script>
 <script src="../../resources/testharnessreport.js"></script>
-<script src="../resources/bluetooth-helpers.js"></script>
+<script src="../../resources/bluetooth/bluetooth-helpers.js"></script>
 <script>
 'use strict';
 promise_test(() => {
diff --git a/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/characteristics-not-found.html b/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/characteristics-not-found.html
index 5bb08a6..d133cde 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/characteristics-not-found.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/characteristics-not-found.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../../resources/testharness.js"></script>
 <script src="../../resources/testharnessreport.js"></script>
-<script src="../resources/bluetooth-helpers.js"></script>
+<script src="../../resources/bluetooth/bluetooth-helpers.js"></script>
 <script>
 'use strict';
 promise_test(() => {
diff --git a/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/correct-characteristics.html b/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/correct-characteristics.html
index 02f2f6ea..ca027874 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/correct-characteristics.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/correct-characteristics.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../../resources/testharness.js"></script>
 <script src="../../resources/testharnessreport.js"></script>
-<script src="../resources/bluetooth-helpers.js"></script>
+<script src="../../resources/bluetooth/bluetooth-helpers.js"></script>
 <script>
 'use strict';
 promise_test(() => {
diff --git a/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/device-goes-out-of-range-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/device-goes-out-of-range-with-uuid.html
index ef0f018..c77fde4 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/device-goes-out-of-range-with-uuid.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/device-goes-out-of-range-with-uuid.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../../resources/testharness.js"></script>
 <script src="../../resources/testharnessreport.js"></script>
-<script src="../resources/bluetooth-helpers.js"></script>
+<script src="../../resources/bluetooth/bluetooth-helpers.js"></script>
 <script>
 'use strict';
 promise_test(() => {
diff --git a/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/device-goes-out-of-range.html b/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/device-goes-out-of-range.html
index d4ff4977..ed798c26 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/device-goes-out-of-range.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/device-goes-out-of-range.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../../resources/testharness.js"></script>
 <script src="../../resources/testharnessreport.js"></script>
-<script src="../resources/bluetooth-helpers.js"></script>
+<script src="../../resources/bluetooth/bluetooth-helpers.js"></script>
 <script>
 'use strict';
 promise_test(() => {
diff --git a/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/get-same-characteristics.html b/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/get-same-characteristics.html
index 25c9998..b4f16492 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/get-same-characteristics.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/get-same-characteristics.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../../resources/testharness.js"></script>
 <script src="../../resources/testharnessreport.js"></script>
-<script src="../resources/bluetooth-helpers.js"></script>
+<script src="../../resources/bluetooth/bluetooth-helpers.js"></script>
 <script>
 'use strict';
 promise_test(() => {
diff --git a/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/invalid-characteristic-name.html b/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/invalid-characteristic-name.html
index f011c55b..98f0469 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/invalid-characteristic-name.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/invalid-characteristic-name.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../../resources/testharness.js"></script>
 <script src="../../resources/testharnessreport.js"></script>
-<script src="../resources/bluetooth-helpers.js"></script>
+<script src="../../resources/bluetooth/bluetooth-helpers.js"></script>
 <script>
 'use strict';
 promise_test(() => {
diff --git a/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/service-is-removed-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/service-is-removed-with-uuid.html
index d9542974..99472ef 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/service-is-removed-with-uuid.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/service-is-removed-with-uuid.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../../resources/testharness.js"></script>
 <script src="../../resources/testharnessreport.js"></script>
-<script src="../resources/bluetooth-helpers.js"></script>
+<script src="../../resources/bluetooth/bluetooth-helpers.js"></script>
 <script>
 'use strict';
 promise_test(() => {
diff --git a/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/service-is-removed.html b/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/service-is-removed.html
index 16fa9b8..c79a712 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/service-is-removed.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/getCharacteristics/service-is-removed.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../../resources/testharness.js"></script>
 <script src="../../resources/testharnessreport.js"></script>
-<script src="../resources/bluetooth-helpers.js"></script>
+<script src="../../resources/bluetooth/bluetooth-helpers.js"></script>
 <script>
 'use strict';
 promise_test(() => {
diff --git a/third_party/WebKit/LayoutTests/bluetooth/getPrimaryService.html b/third_party/WebKit/LayoutTests/bluetooth/getPrimaryService.html
index 6b65765b..71a91d5 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/getPrimaryService.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/getPrimaryService.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../resources/testharness.js"></script>
 <script src="../resources/testharnessreport.js"></script>
-<script src="resources/bluetooth-helpers.js"></script>
+<script src="../resources/bluetooth/bluetooth-helpers.js"></script>
 <script>
 'use strict'
 
diff --git a/third_party/WebKit/LayoutTests/bluetooth/idl-BluetoothDevice.html b/third_party/WebKit/LayoutTests/bluetooth/idl-BluetoothDevice.html
index 57cc924..a5af53c 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/idl-BluetoothDevice.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/idl-BluetoothDevice.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../resources/testharness.js"></script>
 <script src="../resources/testharnessreport.js"></script>
-<script src="resources/bluetooth-helpers.js"></script>
+<script src="../resources/bluetooth/bluetooth-helpers.js"></script>
 <script>
 test(() => {
   assert_throws(null, () => new BluetoothDevice(),
diff --git a/third_party/WebKit/LayoutTests/bluetooth/iframeRequestDevice.html b/third_party/WebKit/LayoutTests/bluetooth/iframeRequestDevice.html
index 37be32e9..5beeee39 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/iframeRequestDevice.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/iframeRequestDevice.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../resources/testharness.js"></script>
 <script src="../resources/testharnessreport.js"></script>
-<script src="resources/bluetooth-helpers.js"></script>
+<script src="../resources/bluetooth/bluetooth-helpers.js"></script>
 <body>
   <script>
   "use strict";
@@ -40,7 +40,7 @@
       .then(() => {
         for (let i = 0; i < numIframes; i++) {
           let iframe = document.createElement('iframe');
-          iframe.src = 'resources/requestDevice-in-iframe.html';
+          iframe.src = '../resources/bluetooth/requestDevice-in-iframe.html';
           document.body.appendChild(iframe);
         }
       });
diff --git a/third_party/WebKit/LayoutTests/bluetooth/notifications.html b/third_party/WebKit/LayoutTests/bluetooth/notifications.html
index ff43f1fb..4345c1a 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/notifications.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/notifications.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../resources/testharness.js"></script>
 <script src="../resources/testharnessreport.js"></script>
-<script src="resources/bluetooth-helpers.js"></script>
+<script src="../resources/bluetooth/bluetooth-helpers.js"></script>
 <script>
 'use strict';
 test(t => { assert_true(window.testRunner instanceof Object); t.done(); },
diff --git a/third_party/WebKit/LayoutTests/bluetooth/readValue-blacklist.html b/third_party/WebKit/LayoutTests/bluetooth/readValue-blacklist.html
index b96a34c..8f4c14c 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/readValue-blacklist.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/readValue-blacklist.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../resources/testharness.js"></script>
 <script src="../resources/testharnessreport.js"></script>
-<script src="resources/bluetooth-helpers.js"></script>
+<script src="../resources/bluetooth/bluetooth-helpers.js"></script>
 <script>
 'use strict';
 
diff --git a/third_party/WebKit/LayoutTests/bluetooth/readValue.html b/third_party/WebKit/LayoutTests/bluetooth/readValue.html
index 73b7b141..9bb4418 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/readValue.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/readValue.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../resources/testharness.js"></script>
 <script src="../resources/testharnessreport.js"></script>
-<script src="resources/bluetooth-helpers.js"></script>
+<script src="../resources/bluetooth/bluetooth-helpers.js"></script>
 <script>
 'use strict';
 
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice-blacklist.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice-blacklist.html
index c8b4c609..e4256a1 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice-blacklist.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice-blacklist.html
@@ -2,7 +2,7 @@
 <script src="../resources/testharness.js"></script>
 <script src="../resources/testharness-helpers.js"></script>
 <script src="../resources/testharnessreport.js"></script>
-<script src="resources/bluetooth-helpers.js"></script>
+<script src="../resources/bluetooth/bluetooth-helpers.js"></script>
 <script>
 'use strict';
 
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice-canonicalize-filter.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice-canonicalize-filter.html
index 4e3a19e..c98265a 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice-canonicalize-filter.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice-canonicalize-filter.html
@@ -2,7 +2,7 @@
 <script src="../resources/testharness.js"></script>
 <script src="../resources/testharness-helpers.js"></script>
 <script src="../resources/testharnessreport.js"></script>
-<script src="resources/bluetooth-helpers.js"></script>
+<script src="../resources/bluetooth/bluetooth-helpers.js"></script>
 <script>
 'use strict';
 
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice-matches-a-filter.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice-matches-a-filter.html
index 4257dd2..f250aa84 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice-matches-a-filter.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice-matches-a-filter.html
@@ -2,7 +2,7 @@
 <script src="../resources/testharness.js"></script>
 <script src="../resources/testharness-helpers.js"></script>
 <script src="../resources/testharnessreport.js"></script>
-<script src="resources/bluetooth-helpers.js"></script>
+<script src="../resources/bluetooth/bluetooth-helpers.js"></script>
 <script>
 'use strict';
 
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice-sandboxed-iframe.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice-sandboxed-iframe.html
index 9820a59..e75b131 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice-sandboxed-iframe.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice-sandboxed-iframe.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../resources/testharness.js"></script>
 <script src="../resources/testharnessreport.js"></script>
-<script src="resources/bluetooth-helpers.js"></script>
+<script src="../resources/bluetooth/bluetooth-helpers.js"></script>
 <body>
   <script>
   "use strict";
@@ -23,7 +23,7 @@
       .then(() => {
         let iframe = document.createElement('iframe');
         iframe.sandbox.add('allow-scripts');
-        iframe.src = 'resources/requestDevice-in-sandboxed-iframe.html';
+        iframe.src = '../resources/bluetooth/requestDevice-in-sandboxed-iframe.html';
         document.body.appendChild(iframe);
       });
   }, 'Request device from a unique origin. Should reject with SecurityError.');
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice.html
index 0f0456b..82b13b0e 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice.html
@@ -2,7 +2,7 @@
 <script src="../resources/testharness.js"></script>
 <script src="../resources/testharness-helpers.js"></script>
 <script src="../resources/testharnessreport.js"></script>
-<script src="resources/bluetooth-helpers.js"></script>
+<script src="../resources/bluetooth/bluetooth-helpers.js"></script>
 <script>
 'use strict';
 
diff --git a/third_party/WebKit/LayoutTests/bluetooth/writeValue/blacklisted-characteristic.html b/third_party/WebKit/LayoutTests/bluetooth/writeValue/blacklisted-characteristic.html
index a891152c..256bcf8 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/writeValue/blacklisted-characteristic.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/writeValue/blacklisted-characteristic.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../../resources/testharness.js"></script>
 <script src="../../resources/testharnessreport.js"></script>
-<script src="../resources/bluetooth-helpers.js"></script>
+<script src="../../resources/bluetooth/bluetooth-helpers.js"></script>
 <script>
 'use strict';
 promise_test(() => {
diff --git a/third_party/WebKit/LayoutTests/bluetooth/writeValue/characteristic-is-removed.html b/third_party/WebKit/LayoutTests/bluetooth/writeValue/characteristic-is-removed.html
index 9888f8d..882aa3f 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/writeValue/characteristic-is-removed.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/writeValue/characteristic-is-removed.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../../resources/testharness.js"></script>
 <script src="../../resources/testharnessreport.js"></script>
-<script src="../resources/bluetooth-helpers.js"></script>
+<script src="../../resources/bluetooth/bluetooth-helpers.js"></script>
 <script>
 'use strict';
 promise_test(() => {
diff --git a/third_party/WebKit/LayoutTests/bluetooth/writeValue/device-goes-out-of-range.html b/third_party/WebKit/LayoutTests/bluetooth/writeValue/device-goes-out-of-range.html
index 0d55bfb..f48bf0fa 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/writeValue/device-goes-out-of-range.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/writeValue/device-goes-out-of-range.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../../resources/testharness.js"></script>
 <script src="../../resources/testharnessreport.js"></script>
-<script src="../resources/bluetooth-helpers.js"></script>
+<script src="../../resources/bluetooth/bluetooth-helpers.js"></script>
 <script>
 'use strict';
 promise_test(() => {
diff --git a/third_party/WebKit/LayoutTests/bluetooth/writeValue/service-is-removed.html b/third_party/WebKit/LayoutTests/bluetooth/writeValue/service-is-removed.html
index 283df19..0125a72 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/writeValue/service-is-removed.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/writeValue/service-is-removed.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../../resources/testharness.js"></script>
 <script src="../../resources/testharnessreport.js"></script>
-<script src="../resources/bluetooth-helpers.js"></script>
+<script src="../../resources/bluetooth/bluetooth-helpers.js"></script>
 <script>
 'use strict';
 promise_test(() => {
diff --git a/third_party/WebKit/LayoutTests/bluetooth/writeValue/value-too-long.html b/third_party/WebKit/LayoutTests/bluetooth/writeValue/value-too-long.html
index c58d537..c7790cd 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/writeValue/value-too-long.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/writeValue/value-too-long.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../../resources/testharness.js"></script>
 <script src="../../resources/testharnessreport.js"></script>
-<script src="../resources/bluetooth-helpers.js"></script>
+<script src="../../resources/bluetooth/bluetooth-helpers.js"></script>
 <script>
 'use strict';
 promise_test(() => {
diff --git a/third_party/WebKit/LayoutTests/bluetooth/writeValue/write-fails.html b/third_party/WebKit/LayoutTests/bluetooth/writeValue/write-fails.html
index 068cf03..5f5e121b 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/writeValue/write-fails.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/writeValue/write-fails.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../../resources/testharness.js"></script>
 <script src="../../resources/testharnessreport.js"></script>
-<script src="../resources/bluetooth-helpers.js"></script>
+<script src="../../resources/bluetooth/bluetooth-helpers.js"></script>
 <script>
 'use strict';
 gatt_errors_tests.forEach(testSpec => {
diff --git a/third_party/WebKit/LayoutTests/bluetooth/writeValue/write-succeeds.html b/third_party/WebKit/LayoutTests/bluetooth/writeValue/write-succeeds.html
index 39ddcb76..5b37b3c1 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/writeValue/write-succeeds.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/writeValue/write-succeeds.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../../resources/testharness.js"></script>
 <script src="../../resources/testharnessreport.js"></script>
-<script src="../resources/bluetooth-helpers.js"></script>
+<script src="../../resources/bluetooth/bluetooth-helpers.js"></script>
 <script>
 'use strict';
 promise_test(() => {
diff --git a/third_party/WebKit/LayoutTests/bluetooth/writeValue/write-updates-value.html b/third_party/WebKit/LayoutTests/bluetooth/writeValue/write-updates-value.html
index b5d3f6b4..8746df7 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/writeValue/write-updates-value.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/writeValue/write-updates-value.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src="../../resources/testharness.js"></script>
 <script src="../../resources/testharnessreport.js"></script>
-<script src="../resources/bluetooth-helpers.js"></script>
+<script src="../../resources/bluetooth/bluetooth-helpers.js"></script>
 <script>
 'use strict';
 promise_test(() => {
diff --git a/third_party/WebKit/LayoutTests/css3/flexbox/imported/flexbox-flex-direction-column-expected.htm b/third_party/WebKit/LayoutTests/css3/flexbox/imported/flexbox-flex-direction-column-expected.htm
deleted file mode 100644
index 27f63fa..0000000
--- a/third_party/WebKit/LayoutTests/css3/flexbox/imported/flexbox-flex-direction-column-expected.htm
+++ /dev/null
@@ -1,51 +0,0 @@
-<!DOCTYPE html>
-<html>
-	<head>
-		<title>CSS Reftest Reference: Flexbox direction and wrapping</title>
-	    <link rel="author" title="Gavin Elster" href="mailto:gavin.elster@me.com">
-	    <link rel="reviewer" title="Elika J. Etemad" href="http://fantasai.inkedblade.net/contact">
-	    <meta name="flags" content="">
-		<style>
-
-		/* Ref test styles */
-
-			.flex-wrapper div{
-				display: inline-block;
-			}
-
-
-		/* Test-series styles */
-
-			.flex-wrapper {
-				width:  120px;
-				height: 120px;
-
-				/* should only display on error */
-				background: red;
-
-				/* Enforce writing mode */
-				direction: ltr;
-				writing-mode: horizontal-tb;
-			}
-
-			.flex-wrapper div {
-				width:  38px;
-				height: 38px;
-
-				background: green;
-				border: 1px solid limegreen;
-
-				color: white;
-				line-height: 40px;
-				text-align: center;
-				vertical-align: middle;
-			}
-		</style>
-	</head>
-	<body>
-		<p>The test passes if there is a 3x3 grid of green squares, numbered 1-9 left-to-right and top-to-bottom, and there is no red.</p>
-		<div class="flex-wrapper">
-			<div>1</div><div>2</div><div>3</div><div>4</div><div>5</div><div>6</div><div>7</div><div>8</div><div>9</div>
-		</div>
-	</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/css3/flexbox/imported/flexbox-flex-direction-column.htm b/third_party/WebKit/LayoutTests/css3/flexbox/imported/flexbox-flex-direction-column.htm
deleted file mode 100644
index 384fcb7..0000000
--- a/third_party/WebKit/LayoutTests/css3/flexbox/imported/flexbox-flex-direction-column.htm
+++ /dev/null
@@ -1,57 +0,0 @@
-<!DOCTYPE html>
-<html>
-	<head>
-		<title>CSS Flexbox Test: Flex-direction = column</title>
-		<link rel="author" title="Gavin Elster" href="mailto:gavin.elster@me.com">
-		<link rel="reviewer" title="Elika J. Etemad" href="http://fantasai.inkedblade.net/contact">
-		<link rel="help" href="http://www.w3.org/TR/css-flexbox-1/#flex-direction-property">
-		<link rel="match" href="reference/flexbox-flex-direction-ref.htm" />
-		<meta name="flags" content="">
-		<meta name="assert" content="Test checks that flex container's main axis has the same orientation as the block axis of the current writing mode, when flex-direction = column. This assumes writing-direction = horizontal-tb', and direction = 'ltr'.">
-		<style>
-
-		/* Test specific Styles */
-
-			.flex-wrapper {
-				display: flex;
-				flex-direction: column;
-				flex-wrap: wrap;
-			}
-
-		/* Test-series styles */
-
-			.flex-wrapper {
-				width:  120px;
-				height: 120px;
-
-				/* should only display on error */
-				background: red;
-
-				/* Enforce writing mode */
-				direction: ltr;
-				writing-mode: horizontal-tb;
-			}
-
-			.flex-wrapper div {
-				width:  38px;
-				height: 38px;
-
-				background: green;
-				border: 1px solid limegreen;
-
-				color: white;
-				line-height: 40px;
-				text-align: center;
-				vertical-align: middle;
-			}
-		</style>
-	</head>
-	<body>
-		<p>The test passes if there is a 3x3 grid of green squares, numbered 1-9 left-to-right and top-to-bottom, and there is no red.</p>
-		<div class="flex-wrapper">
-			<div>1</div><div>4</div><div>7</div>
-			<div>2</div><div>5</div><div>8</div>
-			<div>3</div><div>6</div><div>9</div>
-		</div>
-	</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/css3/flexbox/imported/flexbox_direction-row-reverse-expected.html b/third_party/WebKit/LayoutTests/css3/flexbox/imported/flexbox_direction-row-reverse-expected.html
deleted file mode 100644
index d4fbbfc..0000000
--- a/third_party/WebKit/LayoutTests/css3/flexbox/imported/flexbox_direction-row-reverse-expected.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<!DOCTYPE html>
-<title>flexbox | flex-direction: row-reverse</title>
-<link rel="author" href="http://opera.com" title="Opera Software">
-<style>
-* {font-family: monospace;}
-body {
-	width: 10em;
-}
-ul {
-	background: blue;
-	padding: 0;
-	margin: 0;
-	list-style: none;
-}
-li {
-	color: white;
-	margin: 0;
-	width: 3.3333em;
-	display: inline-block;
-}
-</style>
-
-<ul>
-	<li>EFGH</li><li>ABCD</li><li>IJKL</li>
-</ul>
diff --git a/third_party/WebKit/LayoutTests/css3/flexbox/imported/flexbox_direction-row-reverse.html b/third_party/WebKit/LayoutTests/css3/flexbox/imported/flexbox_direction-row-reverse.html
deleted file mode 100644
index 8cc1ab1..0000000
--- a/third_party/WebKit/LayoutTests/css3/flexbox/imported/flexbox_direction-row-reverse.html
+++ /dev/null
@@ -1,32 +0,0 @@
-<!DOCTYPE html>
-<title>flexbox | flex-direction: row-reverse</title>
-<link rel="author" href="http://opera.com" title="Opera Software">
-<link rel="help"
-	href="http://www.w3.org/TR/css-flexbox-1/#flex-direction-property">
-<link rel="match" href="flexbox_direction-row-reverse-ref.html">
-<style>
-* {font-family: monospace;}
-body {
-	width: 10em;
-}
-ul {
-	background: blue;
-	padding: 0;
-	margin: 0;
-	list-style: none;
-
-	display: flex;
-	flex-direction: row-reverse;
-}
-li {
-	color: white;
-	margin: 0;
-	width: 10em;
-}
-</style>
-
-<ul>
-	<li>IJKL</li>
-	<li>ABCD</li>
-	<li>EFGH</li>
-</ul>
diff --git a/third_party/WebKit/LayoutTests/fast/scrolling/scroll-into-view-collapsed-div-expected.txt b/third_party/WebKit/LayoutTests/fast/scrolling/scroll-into-view-collapsed-div-expected.txt
new file mode 100644
index 0000000..9c560547
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/scrolling/scroll-into-view-collapsed-div-expected.txt
@@ -0,0 +1,15 @@
+Focus Textbox  Collapse Div With Textbox
+Focus Textbox  Collapse Div With Textbox
+Tests that scrollIntoViewIfNeeded works correctly if the enclosing div has no height.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+PASS window.scrollY is 190
+PASS window.scrollY is 190
+PASS window.scrollX is 0
+PASS window.scrollX is 0
+
diff --git a/third_party/WebKit/LayoutTests/fast/scrolling/scroll-into-view-collapsed-div.html b/third_party/WebKit/LayoutTests/fast/scrolling/scroll-into-view-collapsed-div.html
new file mode 100644
index 0000000..a1608fc
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/scrolling/scroll-into-view-collapsed-div.html
@@ -0,0 +1,114 @@
+<!DOCTYPE html>
+<head>
+  <style>
+    #bluebox {
+        width: 100px;
+        height: 100px;
+        background: blue;
+        padding: 0px;
+        margin: 0px;
+    }
+    #redbox {
+        width: 100px;
+        height: 100px;
+        background: red;
+        padding: 0px;
+        margin: 0px;
+    }
+    #spacer {
+        width: 2000px;
+        height: 2000px;
+        padding: 0px;
+        margin: 0px;
+    }
+    #container-vertical {
+      width: 200px;
+      height: 100px;
+    }
+    #container-horizontal {
+      width: 200px;
+      height: 100px;
+    }
+  </style>
+  <script src="../../resources/js-test.js"></script>
+  <script>
+
+    function focusTextboxHorizontal() {
+        document.getElementById('textBox-horizontal').focus();
+      }
+
+    function collapseToggleHorizontal() {
+      var element = document.getElementById('container-horizontal');
+
+      if (element.clientWidth > 0)
+        element.style.width = "0px";
+      else
+        element.style.width = "200px";
+    }
+
+    function focusTextboxVertical() {
+        document.getElementById('textBox-vertical').focus();
+      }
+
+    function collapseToggleVertical() {
+      var element = document.getElementById('container-vertical');
+
+      if (element.clientHeight > 0)
+        element.style.height = "0px";
+      else
+        element.style.height = "100px";
+    }
+
+    addEventListener('load', function() {
+      description('Tests that scrollIntoViewIfNeeded works correctly if the '
+        + 'enclosing div has no height.');
+
+      if (window.testRunner)
+        testRunner.dumpAsText();
+
+      window.scrollTo(0, 190);
+      document.getElementById('scroller-vertical').scrollTop = 1000;
+      document.getElementById('container-vertical').style.height = "0px";
+      document.getElementById('scroller-horizontal').scrollTop = 0;
+      document.getElementById('container-horizontal').style.width = "0px";
+
+      shouldBe("window.scrollY", "190");
+
+      document.getElementById('textBox-vertical').scrollIntoViewIfNeeded();
+
+      shouldBe("window.scrollY", "190");
+
+      shouldBe("window.scrollX", "0");
+
+      document.getElementById('textBox-horizontal').scrollIntoViewIfNeeded();
+
+      shouldBe("window.scrollX", "0");
+    });
+  </script>
+</head>
+<body>
+      <div style="height:200px"></div>
+      <div id="container-vertical" >
+        <div id="scroller-vertical" style="height: 100%; overflow: auto">
+          <input type="text" id="textBox-vertical">
+          <div id="bluebox"></div><div id="redbox"></div>
+          <div id="bluebox"></div><div id="redbox"></div>
+          <div id="bluebox"></div><div id="redbox"></div>
+          <div id="bluebox"></div><div id="redbox"></div>
+          <div id="bluebox"></div><div id="redbox"></div>
+        </div>
+      </div>
+      <button onclick="focusTextboxVertical();">Focus Textbox</button>
+      <button onclick="collapseToggleVertical();">Collapse Div With Textbox</button>
+      <div style="padding-left: 300px">
+        <div id="container-horizontal" >
+          <div id="scroller-horizontal" style="height: 100%; overflow: auto">
+            <div style="padding-left: 1000px"><input type="text" id="textBox-horizontal"></div>
+          </div>
+        </div>
+        <button onclick="focusTextboxHorizontal();">Focus Textbox</button>
+        <button onclick="collapseToggleHorizontal();">Collapse Div With Textbox</button>
+      </div>
+      <div id="console"></div>
+      <div id="spacer"></div>
+</body>
diff --git a/third_party/WebKit/LayoutTests/http/tests/css/ignore-pending-link-import-expected.txt b/third_party/WebKit/LayoutTests/http/tests/css/ignore-pending-link-import-expected.txt
new file mode 100644
index 0000000..47f713a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/css/ignore-pending-link-import-expected.txt
@@ -0,0 +1,5 @@
+backgroundColor: PASS
+color: PASS
+backgroundColor: PASS
+color: PASS
+
diff --git a/third_party/WebKit/LayoutTests/http/tests/css/ignore-pending-link-import.html b/third_party/WebKit/LayoutTests/http/tests/css/ignore-pending-link-import.html
new file mode 100644
index 0000000..80e39bd
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/css/ignore-pending-link-import.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<h1 id="h1"></h1>
+<pre id="res"></pre>
+<script>
+    if (window.testRunner) {
+        testRunner.dumpAsText();
+        testRunner.waitUntilDone();
+    }
+
+    var result = "";
+
+    function expectComputedOnH1(name, expected) {
+        var value = getComputedStyle(h1)[name];
+        result += name + ": ";
+        if (value == expected)
+            result += "PASS\n";
+        else
+            result += "FAIL - " + value + ", expected " + expected + "\n";
+    }
+
+    function sheetLoaded() {
+        // Need to remove the stylesheet used to trigger the ignore-pending-stylesheet
+        // behavior in order to not have pending stylesheets here.
+        document.head.removeChild(document.head.querySelector("style"));
+
+        expectComputedOnH1("backgroundColor", "rgb(0, 128, 0)");
+        expectComputedOnH1("color", "rgb(0, 128, 0)");
+
+        res.innerHTML = result;
+        if (window.testRunner)
+            testRunner.notifyDone();
+    }
+
+    // This style element is required to trigger updateLayoutTreeIgnorePendingStylesheets
+    // while the main link css file has loaded while its import has not.
+    var style = document.createElement("style");
+    style.appendChild(document.createTextNode("@import url(resources/slow-loading-sheet.php?sleep=10000&color=pink);"));
+    document.head.appendChild(style);
+
+    var link = document.createElement("link");
+    link.setAttribute("onload", "sheetLoaded()");
+    link.setAttribute("rel", "stylesheet");
+    link.setAttribute("href", "data:text/css,@import url(http://localhost:8080/css/resources/slow-loading-sheet.php?color=green); h1{color:green}");
+    document.head.appendChild(link);
+
+    document.body.offsetTop;
+    expectComputedOnH1("backgroundColor", "rgba(0, 0, 0, 0)");
+    expectComputedOnH1("color", "rgb(0, 0, 0)");
+
+</script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/css/ignore-pending-pi-import-expected.txt b/third_party/WebKit/LayoutTests/http/tests/css/ignore-pending-pi-import-expected.txt
new file mode 100644
index 0000000..984e3b2
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/css/ignore-pending-pi-import-expected.txt
@@ -0,0 +1,3 @@
+color: PASS
+backgroundColor: PASS
+
diff --git a/third_party/WebKit/LayoutTests/http/tests/css/ignore-pending-pi-import.xhtml b/third_party/WebKit/LayoutTests/http/tests/css/ignore-pending-pi-import.xhtml
new file mode 100644
index 0000000..b0c9e12
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/css/ignore-pending-pi-import.xhtml
@@ -0,0 +1,32 @@
+<?xml-stylesheet href="data:text/css,@import url(http://localhost:8080/css/resources/slow-loading-sheet.php?color=pink); h1 {color:red}" type="text/css"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <style title="myset"></style>
+</head>
+<body>
+    <h1></h1>
+    <pre id="res"></pre>
+    <script>
+        if (window.testRunner)
+            testRunner.dumpAsText();
+
+        var result = "";
+
+        function expectComputedOnH1(name, expected) {
+            var value = getComputedStyle(document.querySelector("h1"))[name];
+            result += name + ": ";
+            if (value == expected)
+                result += "PASS\n";
+            else
+                result += "FAIL - " + value + ", expected " + expected + "\n";
+        }
+
+        document.body.offsetTop;
+        expectComputedOnH1("color", "rgb(0, 0, 0)");
+        expectComputedOnH1("backgroundColor", "rgba(0, 0, 0, 0)");
+
+        document.querySelector("#res").innerHTML = result;
+    </script>
+</body>
+</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/css/ignore-pending-style-import-expected.txt b/third_party/WebKit/LayoutTests/http/tests/css/ignore-pending-style-import-expected.txt
new file mode 100644
index 0000000..47f713a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/css/ignore-pending-style-import-expected.txt
@@ -0,0 +1,5 @@
+backgroundColor: PASS
+color: PASS
+backgroundColor: PASS
+color: PASS
+
diff --git a/third_party/WebKit/LayoutTests/http/tests/css/ignore-pending-style-import.html b/third_party/WebKit/LayoutTests/http/tests/css/ignore-pending-style-import.html
new file mode 100644
index 0000000..73aa659
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/css/ignore-pending-style-import.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<h1 id="h1"></h1>
+<pre id="res"></pre>
+<script>
+    if (window.testRunner) {
+        testRunner.dumpAsText();
+        testRunner.waitUntilDone();
+    }
+
+    var result = "";
+
+    function expectComputedOnH1(name, expected) {
+        var value = getComputedStyle(h1)[name];
+        result += name + ": ";
+        if (value == expected)
+            result += "PASS\n";
+        else
+            result += "FAIL - " + value + ", expected " + expected + "\n";
+    }
+
+    function sheetLoaded() {
+        expectComputedOnH1("backgroundColor", "rgb(0, 128, 0)");
+        expectComputedOnH1("color", "rgb(0, 128, 0)");
+        res.innerHTML = result;
+        if (window.testRunner)
+            testRunner.notifyDone();
+    }
+
+    var style = document.createElement("style");
+    style.appendChild(document.createTextNode("@import url(http://localhost:8080/css/resources/slow-loading-sheet.php?color=green); h1{color:green}"));
+    style.setAttribute("onload", "sheetLoaded()");
+    document.head.appendChild(style);
+
+    document.body.offsetTop;
+    expectComputedOnH1("backgroundColor", "rgba(0, 0, 0, 0)");
+    expectComputedOnH1("color", "rgb(0, 0, 0)");
+
+</script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/console-test.js b/third_party/WebKit/LayoutTests/http/tests/inspector/console-test.js
index 113e9a9b..a91d0bd6 100644
--- a/third_party/WebKit/LayoutTests/http/tests/inspector/console-test.js
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/console-test.js
@@ -119,6 +119,7 @@
                 result.push(classNames.join(" > "));
         } else {
             var messageText = formatter(element, message);
+            messageText = messageText.replace(/VM\d+/g, "VM");
             result.push(messageText + (dumpClassNames ? " " + classNames.join(" > ") : ""));
         }
 
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/filesystem/async-callstack-filesystem-expected.txt b/third_party/WebKit/LayoutTests/http/tests/inspector/filesystem/async-callstack-filesystem-expected.txt
deleted file mode 100644
index edbb401..0000000
--- a/third_party/WebKit/LayoutTests/http/tests/inspector/filesystem/async-callstack-filesystem-expected.txt
+++ /dev/null
@@ -1,94 +0,0 @@
-Tests asynchronous call stacks for FileSystem API.
-
-Set timer for test function.
-Captured call stacks in no particular order:
-Call stack:
-    0) expectError (async-callstack-filesystem.html:36)
-    [FileSystem]
-    0) timeout (async-callstack-filesystem.html:31)
-    [setTimeout]
-    0) testFunction (async-callstack-filesystem.html:25)
-    [setTimeout]
-    0) scheduleTestFunction (debugger-test.js:3)
-    <... skipped remaining frames ...>
-
-Call stack:
-    0) onFileCreated (async-callstack-filesystem.html:51)
-    [FileSystem]
-    0) onInitFileSystem (async-callstack-filesystem.html:45)
-    [FileSystem]
-    0) expectError (async-callstack-filesystem.html:37)
-    [FileSystem]
-    0) timeout (async-callstack-filesystem.html:31)
-    [setTimeout]
-    0) testFunction (async-callstack-filesystem.html:25)
-
-Call stack:
-    0) onFileDeleted (async-callstack-filesystem.html:93)
-    [FileSystem]
-    0) deleteTmpFile (async-callstack-filesystem.html:88)
-    1) onFileReadEnd (async-callstack-filesystem.html:83)
-    [FileReader]
-    0) onFileEntryFile (async-callstack-filesystem.html:76)
-    [FileSystem]
-    0) onFileWriteEnd (async-callstack-filesystem.html:67)
-    [FileWriter]
-    0) onFileWriterCreated (async-callstack-filesystem.html:61)
-
-Call stack:
-    0) onFileEntryFile (async-callstack-filesystem.html:72)
-    [FileSystem]
-    0) onFileWriteEnd (async-callstack-filesystem.html:67)
-    [FileWriter]
-    0) onFileWriterCreated (async-callstack-filesystem.html:61)
-    [FileSystem]
-    0) onFileCreated (async-callstack-filesystem.html:52)
-    [FileSystem]
-    0) onInitFileSystem (async-callstack-filesystem.html:45)
-
-Call stack:
-    0) onFileReadEnd (async-callstack-filesystem.html:82)
-    [FileReader]
-    0) onFileEntryFile (async-callstack-filesystem.html:76)
-    [FileSystem]
-    0) onFileWriteEnd (async-callstack-filesystem.html:67)
-    [FileWriter]
-    0) onFileWriterCreated (async-callstack-filesystem.html:61)
-    [FileSystem]
-    0) onFileCreated (async-callstack-filesystem.html:52)
-
-Call stack:
-    0) onFileWriteEnd (async-callstack-filesystem.html:66)
-    [FileWriter]
-    0) onFileWriterCreated (async-callstack-filesystem.html:61)
-    [FileSystem]
-    0) onFileCreated (async-callstack-filesystem.html:52)
-    [FileSystem]
-    0) onInitFileSystem (async-callstack-filesystem.html:45)
-    [FileSystem]
-    0) expectError (async-callstack-filesystem.html:37)
-
-Call stack:
-    0) onFileWriterCreated (async-callstack-filesystem.html:57)
-    [FileSystem]
-    0) onFileCreated (async-callstack-filesystem.html:52)
-    [FileSystem]
-    0) onInitFileSystem (async-callstack-filesystem.html:45)
-    [FileSystem]
-    0) expectError (async-callstack-filesystem.html:37)
-    [FileSystem]
-    0) timeout (async-callstack-filesystem.html:31)
-
-Call stack:
-    0) onInitFileSystem (async-callstack-filesystem.html:43)
-    [FileSystem]
-    0) expectError (async-callstack-filesystem.html:37)
-    [FileSystem]
-    0) timeout (async-callstack-filesystem.html:31)
-    [setTimeout]
-    0) testFunction (async-callstack-filesystem.html:25)
-    [setTimeout]
-    0) scheduleTestFunction (debugger-test.js:3)
-    <... skipped remaining frames ...>
-
-
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/filesystem/async-callstack-filesystem.html b/third_party/WebKit/LayoutTests/http/tests/inspector/filesystem/async-callstack-filesystem.html
deleted file mode 100644
index 8ce9974f..0000000
--- a/third_party/WebKit/LayoutTests/http/tests/inspector/filesystem/async-callstack-filesystem.html
+++ /dev/null
@@ -1,111 +0,0 @@
-<html>
-<head>
-<script src="../inspector-test.js"></script>
-<script src="../debugger-test.js"></script>
-<script>
-
-window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem;
-
-var fileSystem;
-var tmpFileName;
-var fileEntry;
-
-var errorHandler = function(e)
-{
-    var msg = "FAIL: Error: " + e;
-    console.error(msg);
-    if (testRunner)
-        testRunner.logToStderr(msg);
-    errorHandler = function() { debugger; };
-    deleteTmpFile();
-}
-
-function testFunction()
-{
-    setTimeout(timeout, 0);
-}
-
-function timeout()
-{
-    var wrongType = window.TEMPORARY + window.PERSISTENT + 1234567;
-    window.requestFileSystem(wrongType, 1024 /* bytes */, errorHandler, expectError);
-}
-
-function expectError()
-{
-    debugger;
-    window.requestFileSystem(window.TEMPORARY, 1024 /* bytes */, onInitFileSystem, errorHandler);
-}
-
-function onInitFileSystem(fs)
-{
-    fileSystem = fs;
-    debugger;
-    tmpFileName = "async-callstack-filesystem-tmp-" + Date.now() + ".txt"
-    fileSystem.root.getFile(tmpFileName, { create: true, exclusive: true }, onFileCreated, errorHandler);
-}
-
-function onFileCreated(fe)
-{
-    fileEntry = fe;
-    debugger;
-    fileEntry.createWriter(onFileWriterCreated, errorHandler);    
-}
-
-function onFileWriterCreated(fileWriter)
-{
-    debugger;
-    fileWriter.onwriteend = onFileWriteEnd;
-    fileWriter.onerror = errorHandler;
-    var blob = new Blob(["Lorem Ipsum"], { type: "text/plain" });
-    fileWriter.write(blob);
-}
-
-function onFileWriteEnd()
-{
-    debugger;
-    fileEntry.file(onFileEntryFile, errorHandler);
-}
-
-function onFileEntryFile(file)
-{
-    debugger;
-    var fileReader = new FileReader();
-    fileReader.onloadend = onFileReadEnd;
-    fileReader.onerror = errorHandler;
-    fileReader.readAsText(file);
-}
-
-function onFileReadEnd()
-{
-    var content = this.result;
-    debugger;
-    deleteTmpFile();
-}
-
-function deleteTmpFile()
-{
-    fileEntry.remove(onFileDeleted, errorHandler);
-}
-
-function onFileDeleted()
-{
-    debugger;
-}
-
-var test = function()
-{
-    var totalDebuggerStatements = 8;
-    var maxAsyncCallStackDepth = 4;
-    InspectorTest.runAsyncCallStacksTest(totalDebuggerStatements, maxAsyncCallStackDepth);
-}
-
-</script>
-</head>
-
-<body onload="runTest()">
-<p>
-Tests asynchronous call stacks for FileSystem API.
-</p>
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/sources/debugger/async-callstack-fetch-expected.txt b/third_party/WebKit/LayoutTests/http/tests/inspector/sources/debugger/async-callstack-fetch-expected.txt
index 2f0919f..267d5b7 100644
--- a/third_party/WebKit/LayoutTests/http/tests/inspector/sources/debugger/async-callstack-fetch-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/sources/debugger/async-callstack-fetch-expected.txt
@@ -3,6 +3,23 @@
 Set timer for test function.
 Captured call stacks in no particular order:
 Call stack:
-    0) catchCallback (async-callstack-fetch.html:22)
+    0) chained1 (async-callstack-fetch.html:15)
+    [Promise]
+    0) doFetch (async-callstack-fetch.html:14)
+    [setTimeout]
+    0) testFunction (async-callstack-fetch.html:9)
+    [setTimeout]
+    0) scheduleTestFunction (debugger-test.js:3)
+    <... skipped remaining frames ...>
+
+Call stack:
+    0) chained4 (async-callstack-fetch.html:19)
+    [Promise]
+    0) doFetch (async-callstack-fetch.html:14)
+    [setTimeout]
+    0) testFunction (async-callstack-fetch.html:9)
+    [setTimeout]
+    0) scheduleTestFunction (debugger-test.js:3)
+    <... skipped remaining frames ...>
 
 
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/sources/debugger/async-callstack-fetch.html b/third_party/WebKit/LayoutTests/http/tests/inspector/sources/debugger/async-callstack-fetch.html
index bb4ea84c..5482979 100644
--- a/third_party/WebKit/LayoutTests/http/tests/inspector/sources/debugger/async-callstack-fetch.html
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/sources/debugger/async-callstack-fetch.html
@@ -12,20 +12,17 @@
 function doFetch()
 {
     fetch("../debugger/resources/script1.js").then(function chained1() {
+        debugger;
     }).then(function chained2() {
     }).then(function chained3() {
-        throw Error("thrown from chained3");
     }).then(function chained4() {
-    }).then(function chained5() {
-    }).then(function chained6() {
-    }).catch(function catchCallback() {
         debugger;
     });
 }
 
 var test = function()
 {
-    var totalDebuggerStatements = 1;
+    var totalDebuggerStatements = 2;
     var maxAsyncCallStackDepth = 4;
     InspectorTest.runAsyncCallStacksTest(totalDebuggerStatements, maxAsyncCallStackDepth);
 }
diff --git a/third_party/WebKit/LayoutTests/inspector/sources/debugger-async/async-callstack-middle-run.html b/third_party/WebKit/LayoutTests/inspector/sources/debugger-async/async-callstack-middle-run.html
index d4425a2..257b114f 100644
--- a/third_party/WebKit/LayoutTests/inspector/sources/debugger-async/async-callstack-middle-run.html
+++ b/third_party/WebKit/LayoutTests/inspector/sources/debugger-async/async-callstack-middle-run.html
@@ -12,7 +12,7 @@
 function timeoutOffCapturing()
 {
     setTimeout(timeoutOffCapturing2, 0);
-    debugger; // Will start capturing async stacks from this point.
+    debugger;
     setTimeout(timeoutOnCapturing, 0);
 }
 
diff --git a/third_party/WebKit/LayoutTests/inspector/sources/debugger-async/async-callstack-mutation-observer-expected.txt b/third_party/WebKit/LayoutTests/inspector/sources/debugger-async/async-callstack-mutation-observer-expected.txt
index 645b7eb..bc2f27c 100644
--- a/third_party/WebKit/LayoutTests/inspector/sources/debugger-async/async-callstack-mutation-observer-expected.txt
+++ b/third_party/WebKit/LayoutTests/inspector/sources/debugger-async/async-callstack-mutation-observer-expected.txt
@@ -4,7 +4,7 @@
 Captured call stacks in no particular order:
 Call stack:
     0) mutationCallback (async-callstack-mutation-observer.html:21)
-    [Mutation]
+    [attributes]
     0) doMutations1 (async-callstack-mutation-observer.html:50)
     1) timeout1 (async-callstack-mutation-observer.html:44)
     [setTimeout]
@@ -15,7 +15,7 @@
 
 Call stack:
     0) mutationCallback (async-callstack-mutation-observer.html:21)
-    [Mutation]
+    [childList]
     0) doMutations2 (async-callstack-mutation-observer.html:64)
     1) timeout2 (async-callstack-mutation-observer.html:57)
     [setTimeout]
@@ -28,10 +28,10 @@
 
 Call stack:
     0) nestedMutationCallback (async-callstack-mutation-observer.html:28)
-    [Mutation]
+    [attributes]
     0) doMutations1 (async-callstack-mutation-observer.html:50)
     1) mutationCallback (async-callstack-mutation-observer.html:20)
-    [Mutation]
+    [attributes]
     0) doMutations1 (async-callstack-mutation-observer.html:50)
     1) timeout1 (async-callstack-mutation-observer.html:44)
     [setTimeout]
@@ -42,15 +42,15 @@
 
 Call stack:
     0) nestedMutationCallback (async-callstack-mutation-observer.html:28)
-    [Mutation]
+    [childList]
     0) doMutations2 (async-callstack-mutation-observer.html:64)
     1) timeoutFromNestedMutation (async-callstack-mutation-observer.html:76)
     [setTimeout]
     0) nestedMutationCallback (async-callstack-mutation-observer.html:30)
-    [Mutation]
+    [attributes]
     0) doMutations1 (async-callstack-mutation-observer.html:50)
     1) mutationCallback (async-callstack-mutation-observer.html:20)
-    [Mutation]
+    [attributes]
     0) doMutations1 (async-callstack-mutation-observer.html:50)
     1) timeout1 (async-callstack-mutation-observer.html:44)
 
@@ -58,7 +58,7 @@
     0) timeoutFromMutation (async-callstack-mutation-observer.html:70)
     [setTimeout]
     0) mutationCallback (async-callstack-mutation-observer.html:23)
-    [Mutation]
+    [attributes]
     0) doMutations1 (async-callstack-mutation-observer.html:50)
     1) timeout1 (async-callstack-mutation-observer.html:44)
     [setTimeout]
@@ -71,10 +71,10 @@
     0) timeoutFromNestedMutation (async-callstack-mutation-observer.html:75)
     [setTimeout]
     0) nestedMutationCallback (async-callstack-mutation-observer.html:30)
-    [Mutation]
+    [attributes]
     0) doMutations1 (async-callstack-mutation-observer.html:50)
     1) mutationCallback (async-callstack-mutation-observer.html:20)
-    [Mutation]
+    [attributes]
     0) doMutations1 (async-callstack-mutation-observer.html:50)
     1) timeout1 (async-callstack-mutation-observer.html:44)
     [setTimeout]
diff --git a/third_party/WebKit/LayoutTests/platform/linux/printing/absolute-position-headers-and-footers-expected.png b/third_party/WebKit/LayoutTests/platform/linux/printing/absolute-position-headers-and-footers-expected.png
new file mode 100644
index 0000000..289ef38
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/printing/absolute-position-headers-and-footers-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/printing/absolute-position-headers-and-footers-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/printing/absolute-position-headers-and-footers-expected.txt
new file mode 100644
index 0000000..39d1f589
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/printing/absolute-position-headers-and-footers-expected.txt
@@ -0,0 +1,241 @@
+layer at (0,0) size 1046x799 scrollHeight 2685
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x2685 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x2685
+    LayoutBlockFlow {BODY} at (8,16) size 1030x2653
+      LayoutBlockFlow {P} at (0,0) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,36) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,72) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,108) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,144) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,180) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,216) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,252) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,288) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,324) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,360) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,396) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,432) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,468) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,504) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,540) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,576) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,612) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,648) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,684) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,720) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,756) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,783) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,819) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,855) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,891) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,927) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,963) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,999) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1035) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1071) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1107) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1143) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1179) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1215) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1251) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1287) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1323) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1359) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1395) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1431) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1467) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1503) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1539) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1582) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1618) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1654) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1690) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1726) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1762) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1798) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1834) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1870) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1906) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1942) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1978) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2014) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2050) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2086) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2122) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2158) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2194) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2230) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2266) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2302) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2338) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2381) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2417) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2453) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2489) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2525) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2561) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2597) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2633) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+layer at (8,0) size 584x38
+  LayoutBlockFlow (positioned) {DIV} at (8,0) size 584x38
+    LayoutBlockFlow {DIV} at (0,0) size 584x30
+      LayoutBlockFlow (anonymous) at (0,0) size 584x20
+        LayoutText {#text} at (0,0) size 584x19
+          text run at (0,0) width 584: "crbug.com/303728: Header Line is absolute positioned so should not be repeated on every page."
+      LayoutBlockFlow {HR} at (0,28) size 584x2 [border: (1px inset #EEEEEE)]
+layer at (8,761) size 580x38
+  LayoutBlockFlow (positioned) {DIV} at (8,761) size 580x38
+    LayoutBlockFlow {DIV} at (0,8) size 580x30
+      LayoutBlockFlow {HR} at (0,0) size 580x2 [border: (1px inset #EEEEEE)]
+      LayoutBlockFlow (anonymous) at (0,10) size 580x20
+        LayoutText {#text} at (0,0) size 580x19
+          text run at (0,0) width 580: "crbug.com/303728: Footer Line is absolute positioned so should not be repeated on every page."
diff --git a/third_party/WebKit/LayoutTests/platform/linux/printing/fixed-positioned-but-static-headers-and-footers-expected.png b/third_party/WebKit/LayoutTests/platform/linux/printing/fixed-positioned-but-static-headers-and-footers-expected.png
new file mode 100644
index 0000000..c35e8be8
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/printing/fixed-positioned-but-static-headers-and-footers-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/printing/fixed-positioned-but-static-headers-and-footers-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/printing/fixed-positioned-but-static-headers-and-footers-expected.txt
new file mode 100644
index 0000000..952bf3b
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/printing/fixed-positioned-but-static-headers-and-footers-expected.txt
@@ -0,0 +1,241 @@
+layer at (0,0) size 1046x799 scrollHeight 2685
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x2685 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x2685
+    LayoutBlockFlow {BODY} at (8,16) size 1030x2653
+      LayoutBlockFlow {P} at (0,0) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,36) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,72) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,108) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,144) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,180) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,216) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,252) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,288) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,324) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,360) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,396) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,432) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,468) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,504) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,540) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,576) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,612) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,648) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,684) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,720) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,756) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,783) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,819) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,855) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,891) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,927) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,963) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,999) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1035) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1071) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1107) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1143) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1179) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1215) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1251) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1287) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1323) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1359) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1395) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1431) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1467) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1503) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1539) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1582) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1618) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1654) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1690) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1726) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1762) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1798) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1834) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1870) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1906) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1942) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1978) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2014) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2050) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2086) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2122) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2158) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2194) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2230) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2266) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2302) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2338) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2381) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2417) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2453) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2489) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2525) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2561) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2597) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2633) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+layer at (8,16) size 638x38
+  LayoutBlockFlow (positioned) {DIV} at (8,16) size 638x38
+    LayoutBlockFlow {DIV} at (0,0) size 638x30
+      LayoutBlockFlow (anonymous) at (0,0) size 638x20
+        LayoutText {#text} at (0,0) size 638x19
+          text run at (0,0) width 638: "crbug.com/303728: Fixed-position header Line is statically positioned and will be repeated on every page."
+      LayoutBlockFlow {HR} at (0,28) size 638x2 [border: (1px inset #EEEEEE)]
+layer at (8,2685) size 589x38 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow (positioned) {DIV} at (8,2685) size 589x38
+    LayoutBlockFlow {DIV} at (0,8) size 589x30
+      LayoutBlockFlow {HR} at (0,0) size 589x2 [border: (1px inset #EEEEEE)]
+      LayoutBlockFlow (anonymous) at (0,10) size 589x20
+        LayoutText {#text} at (0,0) size 589x19
+          text run at (0,0) width 589: "crbug.com/303728: Footer Line is statically positioned and should not be repeated on every page."
diff --git a/third_party/WebKit/LayoutTests/platform/linux/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages-expected.txt
new file mode 100644
index 0000000..c86a393
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages-expected.txt
@@ -0,0 +1,18 @@
+layer at (0,0) size 1046x799 scrollHeight 5016
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x5016 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x5016
+    LayoutBlockFlow {BODY} at (8,8) size 1030x5000
+      LayoutBlockFlow {DIV} at (0,0) size 1030x5000
+layer at (0,0) size 510x68
+  LayoutBlockFlow (positioned) {DIV} at (0,0) size 510x68 [border: (5px solid #000000)]
+    LayoutBlockFlow {DIV} at (5,5) size 500x50
+      LayoutBlockFlow (anonymous) at (0,0) size 500x40
+        LayoutText {#text} at (0,0) size 491x39
+          text run at (0,0) width 491: "crbug.com/303728: Header Line should be repeated on every page except where"
+          text run at (0,20) width 321: "it's clipped by the absolute element on pages 3 and 4."
+      LayoutBlockFlow {HR} at (0,48) size 500x2 [border: (1px inset #EEEEEE)]
+layer at (0,1000) size 600x2000 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow (positioned) zI: 2 {DIV} at (0,1000) size 600x2000 [bgcolor=#000000]
+    LayoutText zI: 2 {#text} at (0,0) size 54x19
+      text run at (0,0) width 54: "Absolute"
diff --git a/third_party/WebKit/LayoutTests/platform/linux/printing/fixed-positioned-headers-and-footers-clipped-expected.png b/third_party/WebKit/LayoutTests/platform/linux/printing/fixed-positioned-headers-and-footers-clipped-expected.png
new file mode 100644
index 0000000..b69fc1d
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/printing/fixed-positioned-headers-and-footers-clipped-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/printing/fixed-positioned-headers-and-footers-clipped-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/printing/fixed-positioned-headers-and-footers-clipped-expected.txt
new file mode 100644
index 0000000..4a37db4f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/printing/fixed-positioned-headers-and-footers-clipped-expected.txt
@@ -0,0 +1,234 @@
+layer at (0,0) size 1046x799 scrollHeight 2685
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x2685 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x2685
+    LayoutBlockFlow {BODY} at (8,16) size 1030x2653
+      LayoutBlockFlow {P} at (0,0) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,36) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,72) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,108) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,144) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,180) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,216) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,252) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,288) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,324) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,360) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,396) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,432) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,468) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,504) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,540) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,576) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,612) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,648) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,684) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,720) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,756) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,783) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,819) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,855) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,891) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,927) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,963) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,999) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1035) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1071) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1107) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1143) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1179) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1215) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1251) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1287) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1323) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1359) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1395) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1431) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1467) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1503) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1539) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1582) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1618) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1654) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1690) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1726) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1762) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1798) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1834) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1870) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1906) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1942) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1978) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2014) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2050) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2086) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2122) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2158) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2194) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2230) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2266) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2302) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2338) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2381) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2417) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2453) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2489) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2525) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2561) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2597) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2633) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+layer at (8,0) size 0x0
+  LayoutBlockFlow (positioned) {DIV} at (8,0) size 0x0
+layer at (8,0) size 945x22 backgroundClip at (8,0) size 400x50 clip at (8,0) size 400x50
+  LayoutBlockFlow (positioned) {DIV} at (8,0) size 945x22 [border: (1px solid #000000)]
+    LayoutBlockFlow {DIV} at (1,1) size 943x20
+      LayoutText {#text} at (0,0) size 943x19
+        text run at (0,0) width 943: "crbug.com/303728: Clipped header Line is inside absolute element positioned at top of page so should only appear on first page and should be clipped there."
diff --git a/third_party/WebKit/LayoutTests/platform/linux/printing/fixed-positioned-headers-and-footers-expected.png b/third_party/WebKit/LayoutTests/platform/linux/printing/fixed-positioned-headers-and-footers-expected.png
new file mode 100644
index 0000000..4d81b98d
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/printing/fixed-positioned-headers-and-footers-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/printing/fixed-positioned-headers-and-footers-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/printing/fixed-positioned-headers-and-footers-expected.txt
new file mode 100644
index 0000000..a8404c5a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/printing/fixed-positioned-headers-and-footers-expected.txt
@@ -0,0 +1,241 @@
+layer at (0,0) size 1046x799 scrollHeight 2685
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x2685 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x2685
+    LayoutBlockFlow {BODY} at (8,16) size 1030x2653
+      LayoutBlockFlow {P} at (0,0) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,36) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,72) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,108) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,144) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,180) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,216) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,252) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,288) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,324) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,360) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,396) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,432) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,468) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,504) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,540) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,576) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,612) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,648) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,684) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,720) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,756) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,783) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,819) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,855) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,891) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,927) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,963) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,999) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1035) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1071) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1107) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1143) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1179) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1215) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1251) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1287) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1323) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1359) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1395) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1431) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1467) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1503) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1539) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1582) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1618) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1654) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1690) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1726) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1762) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1798) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1834) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1870) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1906) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1942) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1978) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2014) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2050) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2086) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2122) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2158) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2194) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2230) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2266) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2302) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2338) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2381) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2417) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2453) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2489) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2525) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2561) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2597) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2633) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+layer at (8,0) size 497x38
+  LayoutBlockFlow (positioned) {DIV} at (8,0) size 497x38
+    LayoutBlockFlow {DIV} at (0,0) size 497x30
+      LayoutBlockFlow (anonymous) at (0,0) size 497x20
+        LayoutText {#text} at (0,0) size 497x19
+          text run at (0,0) width 497: "crbug.com/303728: Fixed-position header Line should be repeated on every page."
+      LayoutBlockFlow {HR} at (0,28) size 497x2 [border: (1px inset #EEEEEE)]
+layer at (8,761) size 406x38
+  LayoutBlockFlow (positioned) {DIV} at (8,761) size 406x38
+    LayoutBlockFlow {DIV} at (0,8) size 406x30
+      LayoutBlockFlow {HR} at (0,0) size 406x2 [border: (1px inset #EEEEEE)]
+      LayoutBlockFlow (anonymous) at (0,10) size 406x20
+        LayoutText {#text} at (0,0) size 406x19
+          text run at (0,0) width 406: "crbug.com/303728: Footer Line should be repeated on every page."
diff --git a/third_party/WebKit/LayoutTests/platform/linux/printing/fixed-positioned-headers-and-footers-inside-transform-expected.png b/third_party/WebKit/LayoutTests/platform/linux/printing/fixed-positioned-headers-and-footers-inside-transform-expected.png
new file mode 100644
index 0000000..cabd496
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/printing/fixed-positioned-headers-and-footers-inside-transform-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/printing/fixed-positioned-headers-and-footers-inside-transform-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/printing/fixed-positioned-headers-and-footers-inside-transform-expected.txt
new file mode 100644
index 0000000..7b8805af
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/printing/fixed-positioned-headers-and-footers-inside-transform-expected.txt
@@ -0,0 +1,245 @@
+layer at (0,0) size 1046x799 scrollHeight 2685
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x2685 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x2685
+    LayoutBlockFlow {BODY} at (8,16) size 1030x2653
+      LayoutBlockFlow {P} at (0,0) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,36) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,72) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,108) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,144) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,180) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,216) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,252) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,288) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,324) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,360) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,396) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,432) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,468) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,504) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,540) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,576) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,612) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,648) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,684) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,720) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,756) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,783) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,819) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,855) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,891) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,927) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,963) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,999) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1035) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1071) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1107) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1143) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1179) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1215) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1251) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1287) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1323) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1359) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1395) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1431) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1467) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1503) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1539) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1582) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1618) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1654) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1690) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1726) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1762) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1798) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1834) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1870) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1906) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1942) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1978) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2014) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2050) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2086) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2122) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2158) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2194) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2230) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2266) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2302) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2338) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2381) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2417) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2453) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2489) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2525) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2561) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2597) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2633) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+layer at (8,16) size 1030x0
+  LayoutBlockFlow {DIV} at (0,0) size 1030x0
+layer at (8,16) size 433x38
+  LayoutBlockFlow (positioned) {DIV} at (0,0) size 433x38
+    LayoutBlockFlow {DIV} at (0,0) size 433x30
+      LayoutBlockFlow (anonymous) at (0,0) size 433x20
+        LayoutText {#text} at (0,0) size 433x19
+          text run at (0,0) width 433: "crbug.com/303728: Header Line should not be repeated on every page."
+      LayoutBlockFlow {HR} at (0,28) size 433x2 [border: (1px inset #EEEEEE)]
+layer at (8,2685) size 1030x0
+  LayoutBlockFlow {DIV} at (0,2669) size 1030x0
+layer at (8,2647) size 429x38 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow (positioned) {DIV} at (0,-38) size 429x38
+    LayoutBlockFlow {DIV} at (0,8) size 429x30
+      LayoutBlockFlow {HR} at (0,0) size 429x2 [border: (1px inset #EEEEEE)]
+      LayoutBlockFlow (anonymous) at (0,10) size 429x20
+        LayoutText {#text} at (0,0) size 429x19
+          text run at (0,0) width 429: "crbug.com/303728: Footer Line should not be repeated on every page."
diff --git a/third_party/WebKit/LayoutTests/platform/linux/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.png b/third_party/WebKit/LayoutTests/platform/linux/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.png
new file mode 100644
index 0000000..c3fe2c3
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.txt
new file mode 100644
index 0000000..dfba2f27
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.txt
@@ -0,0 +1,241 @@
+layer at (0,0) size 1046x799 scrollHeight 2685
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x2685 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x2685
+    LayoutBlockFlow {BODY} at (8,16) size 1030x2653
+      LayoutBlockFlow {P} at (0,0) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,36) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,72) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,108) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,144) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,180) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,216) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,252) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,288) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,324) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,360) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,396) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,432) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,468) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,504) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,540) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,576) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,612) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,648) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,684) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,720) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,756) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,783) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,819) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,855) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,891) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,927) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,963) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,999) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1035) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1071) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1107) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1143) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1179) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1215) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1251) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1287) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1323) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1359) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1395) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1431) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1467) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1503) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1539) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1582) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1618) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1654) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1690) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1726) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1762) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1798) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1834) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1870) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1906) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1942) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1978) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2014) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2050) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2086) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2122) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2158) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2194) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2230) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2266) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2302) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2338) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2381) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2417) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2453) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2489) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2525) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2561) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2597) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2633) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+layer at (8,0) size 2010x48 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow (positioned) {DIV} at (8,0) size 2010x48 [border: (5px solid #000000)]
+    LayoutBlockFlow {DIV} at (5,5) size 2000x30
+      LayoutBlockFlow (anonymous) at (0,0) size 2000x20
+        LayoutText {#text} at (0,0) size 672x19
+          text run at (0,0) width 672: "crbug.com/303728: Footer Line should be repeated on every page and should be clipped because it's too wide."
+      LayoutBlockFlow {HR} at (0,28) size 2000x2 [border: (1px inset #EEEEEE)]
+layer at (8,751) size 2010x48 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow (positioned) {DIV} at (8,751) size 2010x48 [border: (5px solid #000000)]
+    LayoutBlockFlow {DIV} at (5,13) size 2000x30
+      LayoutBlockFlow {HR} at (0,0) size 2000x2 [border: (1px inset #EEEEEE)]
+      LayoutBlockFlow (anonymous) at (0,10) size 2000x20
+        LayoutText {#text} at (0,0) size 672x19
+          text run at (0,0) width 672: "crbug.com/303728: Footer Line should be repeated on every page and should be clipped because it's too wide."
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/absolute-position-headers-and-footers-expected.png b/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/absolute-position-headers-and-footers-expected.png
new file mode 100644
index 0000000..289ef38
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/absolute-position-headers-and-footers-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/absolute-position-headers-and-footers-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/absolute-position-headers-and-footers-expected.txt
new file mode 100644
index 0000000..39d1f589
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/absolute-position-headers-and-footers-expected.txt
@@ -0,0 +1,241 @@
+layer at (0,0) size 1046x799 scrollHeight 2685
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x2685 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x2685
+    LayoutBlockFlow {BODY} at (8,16) size 1030x2653
+      LayoutBlockFlow {P} at (0,0) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,36) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,72) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,108) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,144) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,180) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,216) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,252) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,288) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,324) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,360) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,396) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,432) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,468) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,504) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,540) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,576) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,612) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,648) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,684) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,720) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,756) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,783) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,819) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,855) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,891) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,927) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,963) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,999) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1035) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1071) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1107) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1143) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1179) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1215) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1251) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1287) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1323) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1359) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1395) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1431) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1467) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1503) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1539) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1582) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1618) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1654) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1690) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1726) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1762) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1798) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1834) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1870) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1906) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1942) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1978) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2014) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2050) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2086) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2122) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2158) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2194) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2230) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2266) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2302) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2338) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2381) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2417) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2453) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2489) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2525) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2561) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2597) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2633) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+layer at (8,0) size 584x38
+  LayoutBlockFlow (positioned) {DIV} at (8,0) size 584x38
+    LayoutBlockFlow {DIV} at (0,0) size 584x30
+      LayoutBlockFlow (anonymous) at (0,0) size 584x20
+        LayoutText {#text} at (0,0) size 584x19
+          text run at (0,0) width 584: "crbug.com/303728: Header Line is absolute positioned so should not be repeated on every page."
+      LayoutBlockFlow {HR} at (0,28) size 584x2 [border: (1px inset #EEEEEE)]
+layer at (8,761) size 580x38
+  LayoutBlockFlow (positioned) {DIV} at (8,761) size 580x38
+    LayoutBlockFlow {DIV} at (0,8) size 580x30
+      LayoutBlockFlow {HR} at (0,0) size 580x2 [border: (1px inset #EEEEEE)]
+      LayoutBlockFlow (anonymous) at (0,10) size 580x20
+        LayoutText {#text} at (0,0) size 580x19
+          text run at (0,0) width 580: "crbug.com/303728: Footer Line is absolute positioned so should not be repeated on every page."
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/fixed-positioned-but-static-headers-and-footers-expected.png b/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/fixed-positioned-but-static-headers-and-footers-expected.png
new file mode 100644
index 0000000..c35e8be8
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/fixed-positioned-but-static-headers-and-footers-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/fixed-positioned-but-static-headers-and-footers-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/fixed-positioned-but-static-headers-and-footers-expected.txt
new file mode 100644
index 0000000..952bf3b
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/fixed-positioned-but-static-headers-and-footers-expected.txt
@@ -0,0 +1,241 @@
+layer at (0,0) size 1046x799 scrollHeight 2685
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x2685 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x2685
+    LayoutBlockFlow {BODY} at (8,16) size 1030x2653
+      LayoutBlockFlow {P} at (0,0) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,36) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,72) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,108) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,144) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,180) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,216) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,252) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,288) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,324) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,360) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,396) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,432) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,468) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,504) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,540) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,576) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,612) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,648) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,684) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,720) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,756) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,783) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,819) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,855) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,891) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,927) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,963) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,999) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1035) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1071) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1107) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1143) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1179) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1215) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1251) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1287) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1323) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1359) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1395) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1431) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1467) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1503) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1539) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1582) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1618) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1654) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1690) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1726) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1762) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1798) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1834) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1870) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1906) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1942) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1978) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2014) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2050) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2086) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2122) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2158) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2194) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2230) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2266) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2302) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2338) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2381) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2417) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2453) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2489) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2525) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2561) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2597) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2633) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+layer at (8,16) size 638x38
+  LayoutBlockFlow (positioned) {DIV} at (8,16) size 638x38
+    LayoutBlockFlow {DIV} at (0,0) size 638x30
+      LayoutBlockFlow (anonymous) at (0,0) size 638x20
+        LayoutText {#text} at (0,0) size 638x19
+          text run at (0,0) width 638: "crbug.com/303728: Fixed-position header Line is statically positioned and will be repeated on every page."
+      LayoutBlockFlow {HR} at (0,28) size 638x2 [border: (1px inset #EEEEEE)]
+layer at (8,2685) size 589x38 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow (positioned) {DIV} at (8,2685) size 589x38
+    LayoutBlockFlow {DIV} at (0,8) size 589x30
+      LayoutBlockFlow {HR} at (0,0) size 589x2 [border: (1px inset #EEEEEE)]
+      LayoutBlockFlow (anonymous) at (0,10) size 589x20
+        LayoutText {#text} at (0,0) size 589x19
+          text run at (0,0) width 589: "crbug.com/303728: Footer Line is statically positioned and should not be repeated on every page."
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages-expected.png b/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages-expected.png
new file mode 100644
index 0000000..9387b3a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages-expected.txt
new file mode 100644
index 0000000..c86a393
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages-expected.txt
@@ -0,0 +1,18 @@
+layer at (0,0) size 1046x799 scrollHeight 5016
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x5016 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x5016
+    LayoutBlockFlow {BODY} at (8,8) size 1030x5000
+      LayoutBlockFlow {DIV} at (0,0) size 1030x5000
+layer at (0,0) size 510x68
+  LayoutBlockFlow (positioned) {DIV} at (0,0) size 510x68 [border: (5px solid #000000)]
+    LayoutBlockFlow {DIV} at (5,5) size 500x50
+      LayoutBlockFlow (anonymous) at (0,0) size 500x40
+        LayoutText {#text} at (0,0) size 491x39
+          text run at (0,0) width 491: "crbug.com/303728: Header Line should be repeated on every page except where"
+          text run at (0,20) width 321: "it's clipped by the absolute element on pages 3 and 4."
+      LayoutBlockFlow {HR} at (0,48) size 500x2 [border: (1px inset #EEEEEE)]
+layer at (0,1000) size 600x2000 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow (positioned) zI: 2 {DIV} at (0,1000) size 600x2000 [bgcolor=#000000]
+    LayoutText zI: 2 {#text} at (0,0) size 54x19
+      text run at (0,0) width 54: "Absolute"
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/fixed-positioned-headers-and-footers-clipped-expected.png b/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/fixed-positioned-headers-and-footers-clipped-expected.png
new file mode 100644
index 0000000..b69fc1d
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/fixed-positioned-headers-and-footers-clipped-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/fixed-positioned-headers-and-footers-clipped-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/fixed-positioned-headers-and-footers-clipped-expected.txt
new file mode 100644
index 0000000..4a37db4f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/fixed-positioned-headers-and-footers-clipped-expected.txt
@@ -0,0 +1,234 @@
+layer at (0,0) size 1046x799 scrollHeight 2685
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x2685 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x2685
+    LayoutBlockFlow {BODY} at (8,16) size 1030x2653
+      LayoutBlockFlow {P} at (0,0) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,36) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,72) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,108) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,144) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,180) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,216) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,252) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,288) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,324) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,360) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,396) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,432) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,468) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,504) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,540) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,576) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,612) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,648) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,684) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,720) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,756) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,783) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,819) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,855) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,891) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,927) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,963) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,999) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1035) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1071) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1107) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1143) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1179) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1215) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1251) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1287) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1323) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1359) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1395) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1431) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1467) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1503) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1539) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1582) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1618) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1654) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1690) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1726) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1762) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1798) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1834) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1870) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1906) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1942) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1978) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2014) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2050) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2086) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2122) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2158) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2194) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2230) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2266) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2302) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2338) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2381) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2417) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2453) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2489) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2525) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2561) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2597) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2633) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+layer at (8,0) size 0x0
+  LayoutBlockFlow (positioned) {DIV} at (8,0) size 0x0
+layer at (8,0) size 945x22 backgroundClip at (8,0) size 400x50 clip at (8,0) size 400x50
+  LayoutBlockFlow (positioned) {DIV} at (8,0) size 945x22 [border: (1px solid #000000)]
+    LayoutBlockFlow {DIV} at (1,1) size 943x20
+      LayoutText {#text} at (0,0) size 943x19
+        text run at (0,0) width 943: "crbug.com/303728: Clipped header Line is inside absolute element positioned at top of page so should only appear on first page and should be clipped there."
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/fixed-positioned-headers-and-footers-expected.png b/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/fixed-positioned-headers-and-footers-expected.png
new file mode 100644
index 0000000..4d81b98d
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/fixed-positioned-headers-and-footers-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/fixed-positioned-headers-and-footers-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/fixed-positioned-headers-and-footers-expected.txt
new file mode 100644
index 0000000..a8404c5a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/fixed-positioned-headers-and-footers-expected.txt
@@ -0,0 +1,241 @@
+layer at (0,0) size 1046x799 scrollHeight 2685
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x2685 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x2685
+    LayoutBlockFlow {BODY} at (8,16) size 1030x2653
+      LayoutBlockFlow {P} at (0,0) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,36) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,72) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,108) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,144) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,180) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,216) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,252) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,288) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,324) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,360) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,396) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,432) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,468) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,504) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,540) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,576) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,612) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,648) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,684) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,720) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,756) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,783) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,819) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,855) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,891) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,927) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,963) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,999) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1035) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1071) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1107) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1143) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1179) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1215) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1251) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1287) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1323) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1359) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1395) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1431) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1467) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1503) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1539) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1582) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1618) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1654) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1690) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1726) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1762) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1798) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1834) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1870) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1906) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1942) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1978) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2014) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2050) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2086) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2122) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2158) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2194) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2230) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2266) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2302) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2338) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2381) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2417) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2453) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2489) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2525) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2561) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2597) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2633) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+layer at (8,0) size 497x38
+  LayoutBlockFlow (positioned) {DIV} at (8,0) size 497x38
+    LayoutBlockFlow {DIV} at (0,0) size 497x30
+      LayoutBlockFlow (anonymous) at (0,0) size 497x20
+        LayoutText {#text} at (0,0) size 497x19
+          text run at (0,0) width 497: "crbug.com/303728: Fixed-position header Line should be repeated on every page."
+      LayoutBlockFlow {HR} at (0,28) size 497x2 [border: (1px inset #EEEEEE)]
+layer at (8,761) size 406x38
+  LayoutBlockFlow (positioned) {DIV} at (8,761) size 406x38
+    LayoutBlockFlow {DIV} at (0,8) size 406x30
+      LayoutBlockFlow {HR} at (0,0) size 406x2 [border: (1px inset #EEEEEE)]
+      LayoutBlockFlow (anonymous) at (0,10) size 406x20
+        LayoutText {#text} at (0,0) size 406x19
+          text run at (0,0) width 406: "crbug.com/303728: Footer Line should be repeated on every page."
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/fixed-positioned-headers-and-footers-inside-transform-expected.png b/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/fixed-positioned-headers-and-footers-inside-transform-expected.png
new file mode 100644
index 0000000..cabd496
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/fixed-positioned-headers-and-footers-inside-transform-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/fixed-positioned-headers-and-footers-inside-transform-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/fixed-positioned-headers-and-footers-inside-transform-expected.txt
new file mode 100644
index 0000000..7b8805af
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/fixed-positioned-headers-and-footers-inside-transform-expected.txt
@@ -0,0 +1,245 @@
+layer at (0,0) size 1046x799 scrollHeight 2685
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x2685 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x2685
+    LayoutBlockFlow {BODY} at (8,16) size 1030x2653
+      LayoutBlockFlow {P} at (0,0) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,36) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,72) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,108) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,144) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,180) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,216) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,252) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,288) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,324) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,360) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,396) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,432) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,468) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,504) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,540) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,576) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,612) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,648) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,684) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,720) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,756) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,783) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,819) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,855) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,891) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,927) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,963) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,999) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1035) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1071) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1107) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1143) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1179) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1215) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1251) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1287) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1323) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1359) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1395) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1431) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1467) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1503) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1539) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1582) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1618) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1654) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1690) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1726) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1762) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1798) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1834) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1870) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1906) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1942) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1978) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2014) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2050) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2086) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2122) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2158) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2194) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2230) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2266) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2302) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2338) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2381) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2417) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2453) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2489) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2525) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2561) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2597) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2633) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+layer at (8,16) size 1030x0
+  LayoutBlockFlow {DIV} at (0,0) size 1030x0
+layer at (8,16) size 433x38
+  LayoutBlockFlow (positioned) {DIV} at (0,0) size 433x38
+    LayoutBlockFlow {DIV} at (0,0) size 433x30
+      LayoutBlockFlow (anonymous) at (0,0) size 433x20
+        LayoutText {#text} at (0,0) size 433x19
+          text run at (0,0) width 433: "crbug.com/303728: Header Line should not be repeated on every page."
+      LayoutBlockFlow {HR} at (0,28) size 433x2 [border: (1px inset #EEEEEE)]
+layer at (8,2685) size 1030x0
+  LayoutBlockFlow {DIV} at (0,2669) size 1030x0
+layer at (8,2647) size 429x38 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow (positioned) {DIV} at (0,-38) size 429x38
+    LayoutBlockFlow {DIV} at (0,8) size 429x30
+      LayoutBlockFlow {HR} at (0,0) size 429x2 [border: (1px inset #EEEEEE)]
+      LayoutBlockFlow (anonymous) at (0,10) size 429x20
+        LayoutText {#text} at (0,0) size 429x19
+          text run at (0,0) width 429: "crbug.com/303728: Footer Line should not be repeated on every page."
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.png b/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.png
new file mode 100644
index 0000000..c3fe2c3
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.txt
new file mode 100644
index 0000000..dfba2f27
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/threaded/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.txt
@@ -0,0 +1,241 @@
+layer at (0,0) size 1046x799 scrollHeight 2685
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x2685 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x2685
+    LayoutBlockFlow {BODY} at (8,16) size 1030x2653
+      LayoutBlockFlow {P} at (0,0) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,36) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,72) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,108) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,144) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,180) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,216) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,252) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,288) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,324) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,360) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,396) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,432) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,468) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,504) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,540) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,576) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,612) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,648) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,684) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,720) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,756) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,783) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,819) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,855) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,891) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,927) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,963) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,999) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1035) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1071) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1107) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1143) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1179) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1215) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1251) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1287) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1323) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1359) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1395) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1431) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1467) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1503) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1539) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1582) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1618) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1654) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1690) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1726) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1762) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1798) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1834) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1870) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1906) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1942) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,1978) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2014) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2050) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2086) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2122) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2158) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2194) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2230) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2266) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2302) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2338) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2381) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2417) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2453) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2489) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2525) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2561) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2597) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+      LayoutBlockFlow {P} at (0,2633) size 1030x20
+        LayoutText {#text} at (0,0) size 60x19
+          text run at (0,0) width 60: "Filler lines"
+layer at (8,0) size 2010x48 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow (positioned) {DIV} at (8,0) size 2010x48 [border: (5px solid #000000)]
+    LayoutBlockFlow {DIV} at (5,5) size 2000x30
+      LayoutBlockFlow (anonymous) at (0,0) size 2000x20
+        LayoutText {#text} at (0,0) size 672x19
+          text run at (0,0) width 672: "crbug.com/303728: Footer Line should be repeated on every page and should be clipped because it's too wide."
+      LayoutBlockFlow {HR} at (0,28) size 2000x2 [border: (1px inset #EEEEEE)]
+layer at (8,751) size 2010x48 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow (positioned) {DIV} at (8,751) size 2010x48 [border: (5px solid #000000)]
+    LayoutBlockFlow {DIV} at (5,13) size 2000x30
+      LayoutBlockFlow {HR} at (0,0) size 2000x2 [border: (1px inset #EEEEEE)]
+      LayoutBlockFlow (anonymous) at (0,10) size 2000x20
+        LayoutText {#text} at (0,0) size 672x19
+          text run at (0,0) width 672: "crbug.com/303728: Footer Line should be repeated on every page and should be clipped because it's too wide."
diff --git a/third_party/WebKit/LayoutTests/platform/mac/printing/absolute-position-headers-and-footers-expected.png b/third_party/WebKit/LayoutTests/platform/mac/printing/absolute-position-headers-and-footers-expected.png
new file mode 100644
index 0000000..5a66a7b
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/printing/absolute-position-headers-and-footers-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/printing/absolute-position-headers-and-footers-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/printing/absolute-position-headers-and-footers-expected.txt
new file mode 100644
index 0000000..4fb9ec5
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/printing/absolute-position-headers-and-footers-expected.txt
@@ -0,0 +1,241 @@
+layer at (0,0) size 1046x799 scrollHeight 2567
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x2567 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x2567
+    LayoutBlockFlow {BODY} at (8,16) size 1030x2535
+      LayoutBlockFlow {P} at (0,0) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,34) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,68) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,102) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,136) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,170) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,204) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,238) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,272) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,306) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,340) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,374) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,408) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,442) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,476) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,510) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,544) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,578) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,612) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,646) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,680) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,714) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,748) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,783) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,817) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,851) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,885) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,919) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,953) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,987) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1021) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1055) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1089) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1123) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1157) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1191) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1225) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1259) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1293) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1327) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1361) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1395) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1429) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1463) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1497) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1531) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1582) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1616) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1650) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1684) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1718) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1752) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1786) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1820) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1854) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1888) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1922) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1956) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1990) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2024) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2058) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2092) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2126) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2160) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2194) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2228) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2262) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2296) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2330) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2381) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2415) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2449) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2483) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2517) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+layer at (8,0) size 615x36
+  LayoutBlockFlow (positioned) {DIV} at (8,0) size 615.39x36
+    LayoutBlockFlow {DIV} at (0,0) size 615.39x28
+      LayoutBlockFlow (anonymous) at (0,0) size 615.39x18
+        LayoutText {#text} at (0,0) size 616x18
+          text run at (0,0) width 616: "crbug.com/303728: Header Line is absolute positioned so should not be repeated on every page."
+      LayoutBlockFlow {HR} at (0,26) size 615.39x2 [border: (1px inset #EEEEEE)]
+layer at (8,763) size 611x36
+  LayoutBlockFlow (positioned) {DIV} at (8,763) size 610.98x36
+    LayoutBlockFlow {DIV} at (0,8) size 610.98x28
+      LayoutBlockFlow {HR} at (0,0) size 610.98x2 [border: (1px inset #EEEEEE)]
+      LayoutBlockFlow (anonymous) at (0,10) size 610.98x18
+        LayoutText {#text} at (0,0) size 611x18
+          text run at (0,0) width 611: "crbug.com/303728: Footer Line is absolute positioned so should not be repeated on every page."
diff --git a/third_party/WebKit/LayoutTests/platform/mac/printing/fixed-positioned-but-static-headers-and-footers-expected.png b/third_party/WebKit/LayoutTests/platform/mac/printing/fixed-positioned-but-static-headers-and-footers-expected.png
new file mode 100644
index 0000000..85673fe91
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/printing/fixed-positioned-but-static-headers-and-footers-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/printing/fixed-positioned-but-static-headers-and-footers-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/printing/fixed-positioned-but-static-headers-and-footers-expected.txt
new file mode 100644
index 0000000..304d01d
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/printing/fixed-positioned-but-static-headers-and-footers-expected.txt
@@ -0,0 +1,241 @@
+layer at (0,0) size 1046x799 scrollHeight 2567
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x2567 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x2567
+    LayoutBlockFlow {BODY} at (8,16) size 1030x2535
+      LayoutBlockFlow {P} at (0,0) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,34) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,68) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,102) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,136) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,170) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,204) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,238) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,272) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,306) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,340) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,374) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,408) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,442) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,476) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,510) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,544) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,578) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,612) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,646) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,680) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,714) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,748) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,783) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,817) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,851) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,885) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,919) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,953) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,987) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1021) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1055) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1089) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1123) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1157) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1191) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1225) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1259) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1293) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1327) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1361) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1395) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1429) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1463) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1497) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1531) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1582) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1616) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1650) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1684) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1718) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1752) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1786) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1820) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1854) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1888) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1922) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1956) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1990) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2024) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2058) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2092) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2126) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2160) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2194) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2228) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2262) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2296) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2330) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2381) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2415) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2449) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2483) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2517) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+layer at (8,16) size 680x36
+  LayoutBlockFlow (positioned) {DIV} at (8,16) size 680.27x36
+    LayoutBlockFlow {DIV} at (0,0) size 680.27x28
+      LayoutBlockFlow (anonymous) at (0,0) size 680.27x18
+        LayoutText {#text} at (0,0) size 681x18
+          text run at (0,0) width 681: "crbug.com/303728: Fixed-position header Line is statically positioned and will be repeated on every page."
+      LayoutBlockFlow {HR} at (0,26) size 680.27x2 [border: (1px inset #EEEEEE)]
+layer at (8,2567) size 624x36 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow (positioned) {DIV} at (8,2567) size 624.30x36
+    LayoutBlockFlow {DIV} at (0,8) size 624.30x28
+      LayoutBlockFlow {HR} at (0,0) size 624.30x2 [border: (1px inset #EEEEEE)]
+      LayoutBlockFlow (anonymous) at (0,10) size 624.30x18
+        LayoutText {#text} at (0,0) size 625x18
+          text run at (0,0) width 625: "crbug.com/303728: Footer Line is statically positioned and should not be repeated on every page."
diff --git a/third_party/WebKit/LayoutTests/platform/mac/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages-expected.png b/third_party/WebKit/LayoutTests/platform/mac/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages-expected.png
new file mode 100644
index 0000000..41e6db4
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages-expected.txt
new file mode 100644
index 0000000..bc63ccbc
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages-expected.txt
@@ -0,0 +1,18 @@
+layer at (0,0) size 1046x799 scrollHeight 5016
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x5016 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x5016
+    LayoutBlockFlow {BODY} at (8,8) size 1030x5000
+      LayoutBlockFlow {DIV} at (0,0) size 1030x5000
+layer at (0,0) size 510x64
+  LayoutBlockFlow (positioned) {DIV} at (0,0) size 510x64 [border: (5px solid #000000)]
+    LayoutBlockFlow {DIV} at (5,5) size 500x46
+      LayoutBlockFlow (anonymous) at (0,0) size 500x36
+        LayoutText {#text} at (0,0) size 472x36
+          text run at (0,0) width 472: "crbug.com/303728: Header Line should be repeated on every page except"
+          text run at (0,18) width 384: "where it's clipped by the absolute element on pages 3 and 4."
+      LayoutBlockFlow {HR} at (0,44) size 500x2 [border: (1px inset #EEEEEE)]
+layer at (0,1000) size 600x2000 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow (positioned) zI: 2 {DIV} at (0,1000) size 600x2000 [bgcolor=#000000]
+    LayoutText zI: 2 {#text} at (0,0) size 58x18
+      text run at (0,0) width 58: "Absolute"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/printing/fixed-positioned-headers-and-footers-clipped-expected.png b/third_party/WebKit/LayoutTests/platform/mac/printing/fixed-positioned-headers-and-footers-clipped-expected.png
new file mode 100644
index 0000000..9c7a963
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/printing/fixed-positioned-headers-and-footers-clipped-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/printing/fixed-positioned-headers-and-footers-clipped-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/printing/fixed-positioned-headers-and-footers-clipped-expected.txt
new file mode 100644
index 0000000..9ca2a6f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/printing/fixed-positioned-headers-and-footers-clipped-expected.txt
@@ -0,0 +1,234 @@
+layer at (0,0) size 1046x799 scrollHeight 2567
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x2567 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x2567
+    LayoutBlockFlow {BODY} at (8,16) size 1030x2535
+      LayoutBlockFlow {P} at (0,0) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,34) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,68) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,102) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,136) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,170) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,204) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,238) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,272) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,306) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,340) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,374) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,408) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,442) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,476) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,510) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,544) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,578) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,612) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,646) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,680) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,714) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,748) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,783) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,817) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,851) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,885) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,919) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,953) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,987) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1021) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1055) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1089) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1123) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1157) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1191) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1225) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1259) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1293) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1327) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1361) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1395) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1429) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1463) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1497) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1531) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1582) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1616) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1650) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1684) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1718) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1752) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1786) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1820) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1854) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1888) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1922) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1956) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1990) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2024) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2058) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2092) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2126) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2160) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2194) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2228) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2262) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2296) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2330) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2381) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2415) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2449) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2483) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2517) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+layer at (8,0) size 0x0
+  LayoutBlockFlow (positioned) {DIV} at (8,0) size 0x0
+layer at (8,0) size 1004x20 backgroundClip at (8,0) size 400x50 clip at (8,0) size 400x50
+  LayoutBlockFlow (positioned) {DIV} at (8,0) size 1003.55x20 [border: (1px solid #000000)]
+    LayoutBlockFlow {DIV} at (1,1) size 1001.55x18
+      LayoutText {#text} at (0,0) size 1002x18
+        text run at (0,0) width 1002: "crbug.com/303728: Clipped header Line is inside absolute element positioned at top of page so should only appear on first page and should be clipped there."
diff --git a/third_party/WebKit/LayoutTests/platform/mac/printing/fixed-positioned-headers-and-footers-expected.png b/third_party/WebKit/LayoutTests/platform/mac/printing/fixed-positioned-headers-and-footers-expected.png
new file mode 100644
index 0000000..aa3fef7
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/printing/fixed-positioned-headers-and-footers-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/printing/fixed-positioned-headers-and-footers-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/printing/fixed-positioned-headers-and-footers-expected.txt
new file mode 100644
index 0000000..b413d1a0
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/printing/fixed-positioned-headers-and-footers-expected.txt
@@ -0,0 +1,241 @@
+layer at (0,0) size 1046x799 scrollHeight 2567
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x2567 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x2567
+    LayoutBlockFlow {BODY} at (8,16) size 1030x2535
+      LayoutBlockFlow {P} at (0,0) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,34) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,68) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,102) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,136) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,170) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,204) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,238) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,272) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,306) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,340) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,374) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,408) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,442) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,476) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,510) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,544) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,578) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,612) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,646) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,680) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,714) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,748) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,783) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,817) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,851) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,885) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,919) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,953) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,987) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1021) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1055) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1089) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1123) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1157) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1191) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1225) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1259) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1293) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1327) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1361) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1395) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1429) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1463) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1497) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1531) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1582) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1616) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1650) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1684) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1718) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1752) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1786) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1820) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1854) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1888) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1922) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1956) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1990) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2024) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2058) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2092) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2126) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2160) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2194) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2228) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2262) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2296) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2330) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2381) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2415) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2449) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2483) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2517) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+layer at (8,0) size 524x36
+  LayoutBlockFlow (positioned) {DIV} at (8,0) size 523.84x36
+    LayoutBlockFlow {DIV} at (0,0) size 523.84x28
+      LayoutBlockFlow (anonymous) at (0,0) size 523.84x18
+        LayoutText {#text} at (0,0) size 524x18
+          text run at (0,0) width 524: "crbug.com/303728: Fixed-position header Line should be repeated on every page."
+      LayoutBlockFlow {HR} at (0,26) size 523.84x2 [border: (1px inset #EEEEEE)]
+layer at (8,763) size 426x36
+  LayoutBlockFlow (positioned) {DIV} at (8,763) size 425.66x36
+    LayoutBlockFlow {DIV} at (0,8) size 425.66x28
+      LayoutBlockFlow {HR} at (0,0) size 425.66x2 [border: (1px inset #EEEEEE)]
+      LayoutBlockFlow (anonymous) at (0,10) size 425.66x18
+        LayoutText {#text} at (0,0) size 426x18
+          text run at (0,0) width 426: "crbug.com/303728: Footer Line should be repeated on every page."
diff --git a/third_party/WebKit/LayoutTests/platform/mac/printing/fixed-positioned-headers-and-footers-inside-transform-expected.png b/third_party/WebKit/LayoutTests/platform/mac/printing/fixed-positioned-headers-and-footers-inside-transform-expected.png
new file mode 100644
index 0000000..64437eb
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/printing/fixed-positioned-headers-and-footers-inside-transform-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/printing/fixed-positioned-headers-and-footers-inside-transform-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/printing/fixed-positioned-headers-and-footers-inside-transform-expected.txt
new file mode 100644
index 0000000..e3b4936f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/printing/fixed-positioned-headers-and-footers-inside-transform-expected.txt
@@ -0,0 +1,245 @@
+layer at (0,0) size 1046x799 scrollHeight 2567
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x2567 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x2567
+    LayoutBlockFlow {BODY} at (8,16) size 1030x2535
+      LayoutBlockFlow {P} at (0,0) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,34) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,68) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,102) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,136) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,170) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,204) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,238) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,272) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,306) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,340) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,374) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,408) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,442) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,476) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,510) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,544) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,578) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,612) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,646) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,680) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,714) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,748) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,783) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,817) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,851) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,885) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,919) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,953) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,987) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1021) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1055) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1089) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1123) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1157) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1191) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1225) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1259) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1293) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1327) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1361) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1395) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1429) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1463) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1497) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1531) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1582) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1616) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1650) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1684) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1718) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1752) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1786) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1820) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1854) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1888) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1922) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1956) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1990) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2024) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2058) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2092) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2126) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2160) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2194) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2228) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2262) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2296) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2330) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2381) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2415) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2449) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2483) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2517) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+layer at (8,16) size 1030x0
+  LayoutBlockFlow {DIV} at (0,0) size 1030x0
+layer at (8,16) size 455x36
+  LayoutBlockFlow (positioned) {DIV} at (0,0) size 454.52x36
+    LayoutBlockFlow {DIV} at (0,0) size 454.52x28
+      LayoutBlockFlow (anonymous) at (0,0) size 454.52x18
+        LayoutText {#text} at (0,0) size 455x18
+          text run at (0,0) width 455: "crbug.com/303728: Header Line should not be repeated on every page."
+      LayoutBlockFlow {HR} at (0,26) size 454.52x2 [border: (1px inset #EEEEEE)]
+layer at (8,2567) size 1030x0
+  LayoutBlockFlow {DIV} at (0,2551) size 1030x0
+layer at (8,2531) size 450x36 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow (positioned) {DIV} at (0,-36) size 450.09x36
+    LayoutBlockFlow {DIV} at (0,8) size 450.09x28
+      LayoutBlockFlow {HR} at (0,0) size 450.09x2 [border: (1px inset #EEEEEE)]
+      LayoutBlockFlow (anonymous) at (0,10) size 450.09x18
+        LayoutText {#text} at (0,0) size 451x18
+          text run at (0,0) width 451: "crbug.com/303728: Footer Line should not be repeated on every page."
diff --git a/third_party/WebKit/LayoutTests/platform/mac/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.png b/third_party/WebKit/LayoutTests/platform/mac/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.png
new file mode 100644
index 0000000..6bb1ecee
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.txt
new file mode 100644
index 0000000..b9d011f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.txt
@@ -0,0 +1,241 @@
+layer at (0,0) size 1046x799 scrollHeight 2567
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x2567 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x2567
+    LayoutBlockFlow {BODY} at (8,16) size 1030x2535
+      LayoutBlockFlow {P} at (0,0) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,34) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,68) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,102) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,136) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,170) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,204) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,238) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,272) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,306) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,340) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,374) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,408) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,442) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,476) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,510) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,544) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,578) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,612) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,646) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,680) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,714) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,748) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,783) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,817) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,851) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,885) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,919) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,953) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,987) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1021) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1055) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1089) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1123) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1157) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1191) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1225) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1259) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1293) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1327) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1361) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1395) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1429) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1463) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1497) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1531) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1582) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1616) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1650) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1684) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1718) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1752) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1786) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1820) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1854) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1888) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1922) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1956) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1990) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2024) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2058) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2092) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2126) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2160) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2194) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2228) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2262) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2296) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2330) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2381) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2415) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2449) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2483) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2517) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+layer at (8,0) size 2010x46 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow (positioned) {DIV} at (8,0) size 2010x46 [border: (5px solid #000000)]
+    LayoutBlockFlow {DIV} at (5,5) size 2000x28
+      LayoutBlockFlow (anonymous) at (0,0) size 2000x18
+        LayoutText {#text} at (0,0) size 706x18
+          text run at (0,0) width 706: "crbug.com/303728: Footer Line should be repeated on every page and should be clipped because it's too wide."
+      LayoutBlockFlow {HR} at (0,26) size 2000x2 [border: (1px inset #EEEEEE)]
+layer at (8,753) size 2010x46 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow (positioned) {DIV} at (8,753) size 2010x46 [border: (5px solid #000000)]
+    LayoutBlockFlow {DIV} at (5,13) size 2000x28
+      LayoutBlockFlow {HR} at (0,0) size 2000x2 [border: (1px inset #EEEEEE)]
+      LayoutBlockFlow (anonymous) at (0,10) size 2000x18
+        LayoutText {#text} at (0,0) size 706x18
+          text run at (0,0) width 706: "crbug.com/303728: Footer Line should be repeated on every page and should be clipped because it's too wide."
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/absolute-position-headers-and-footers-expected.png b/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/absolute-position-headers-and-footers-expected.png
new file mode 100644
index 0000000..5a66a7b
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/absolute-position-headers-and-footers-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/absolute-position-headers-and-footers-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/absolute-position-headers-and-footers-expected.txt
new file mode 100644
index 0000000..4fb9ec5
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/absolute-position-headers-and-footers-expected.txt
@@ -0,0 +1,241 @@
+layer at (0,0) size 1046x799 scrollHeight 2567
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x2567 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x2567
+    LayoutBlockFlow {BODY} at (8,16) size 1030x2535
+      LayoutBlockFlow {P} at (0,0) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,34) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,68) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,102) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,136) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,170) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,204) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,238) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,272) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,306) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,340) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,374) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,408) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,442) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,476) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,510) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,544) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,578) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,612) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,646) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,680) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,714) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,748) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,783) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,817) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,851) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,885) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,919) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,953) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,987) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1021) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1055) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1089) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1123) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1157) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1191) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1225) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1259) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1293) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1327) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1361) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1395) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1429) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1463) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1497) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1531) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1582) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1616) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1650) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1684) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1718) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1752) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1786) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1820) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1854) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1888) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1922) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1956) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1990) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2024) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2058) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2092) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2126) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2160) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2194) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2228) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2262) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2296) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2330) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2381) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2415) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2449) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2483) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2517) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+layer at (8,0) size 615x36
+  LayoutBlockFlow (positioned) {DIV} at (8,0) size 615.39x36
+    LayoutBlockFlow {DIV} at (0,0) size 615.39x28
+      LayoutBlockFlow (anonymous) at (0,0) size 615.39x18
+        LayoutText {#text} at (0,0) size 616x18
+          text run at (0,0) width 616: "crbug.com/303728: Header Line is absolute positioned so should not be repeated on every page."
+      LayoutBlockFlow {HR} at (0,26) size 615.39x2 [border: (1px inset #EEEEEE)]
+layer at (8,763) size 611x36
+  LayoutBlockFlow (positioned) {DIV} at (8,763) size 610.98x36
+    LayoutBlockFlow {DIV} at (0,8) size 610.98x28
+      LayoutBlockFlow {HR} at (0,0) size 610.98x2 [border: (1px inset #EEEEEE)]
+      LayoutBlockFlow (anonymous) at (0,10) size 610.98x18
+        LayoutText {#text} at (0,0) size 611x18
+          text run at (0,0) width 611: "crbug.com/303728: Footer Line is absolute positioned so should not be repeated on every page."
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/fixed-positioned-but-static-headers-and-footers-expected.png b/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/fixed-positioned-but-static-headers-and-footers-expected.png
new file mode 100644
index 0000000..85673fe91
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/fixed-positioned-but-static-headers-and-footers-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/fixed-positioned-but-static-headers-and-footers-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/fixed-positioned-but-static-headers-and-footers-expected.txt
new file mode 100644
index 0000000..304d01d
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/fixed-positioned-but-static-headers-and-footers-expected.txt
@@ -0,0 +1,241 @@
+layer at (0,0) size 1046x799 scrollHeight 2567
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x2567 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x2567
+    LayoutBlockFlow {BODY} at (8,16) size 1030x2535
+      LayoutBlockFlow {P} at (0,0) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,34) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,68) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,102) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,136) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,170) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,204) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,238) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,272) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,306) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,340) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,374) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,408) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,442) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,476) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,510) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,544) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,578) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,612) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,646) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,680) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,714) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,748) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,783) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,817) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,851) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,885) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,919) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,953) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,987) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1021) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1055) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1089) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1123) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1157) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1191) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1225) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1259) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1293) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1327) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1361) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1395) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1429) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1463) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1497) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1531) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1582) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1616) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1650) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1684) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1718) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1752) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1786) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1820) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1854) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1888) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1922) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1956) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1990) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2024) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2058) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2092) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2126) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2160) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2194) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2228) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2262) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2296) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2330) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2381) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2415) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2449) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2483) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2517) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+layer at (8,16) size 680x36
+  LayoutBlockFlow (positioned) {DIV} at (8,16) size 680.27x36
+    LayoutBlockFlow {DIV} at (0,0) size 680.27x28
+      LayoutBlockFlow (anonymous) at (0,0) size 680.27x18
+        LayoutText {#text} at (0,0) size 681x18
+          text run at (0,0) width 681: "crbug.com/303728: Fixed-position header Line is statically positioned and will be repeated on every page."
+      LayoutBlockFlow {HR} at (0,26) size 680.27x2 [border: (1px inset #EEEEEE)]
+layer at (8,2567) size 624x36 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow (positioned) {DIV} at (8,2567) size 624.30x36
+    LayoutBlockFlow {DIV} at (0,8) size 624.30x28
+      LayoutBlockFlow {HR} at (0,0) size 624.30x2 [border: (1px inset #EEEEEE)]
+      LayoutBlockFlow (anonymous) at (0,10) size 624.30x18
+        LayoutText {#text} at (0,0) size 625x18
+          text run at (0,0) width 625: "crbug.com/303728: Footer Line is statically positioned and should not be repeated on every page."
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages-expected.png b/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages-expected.png
new file mode 100644
index 0000000..41e6db4
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages-expected.txt
new file mode 100644
index 0000000..bc63ccbc
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages-expected.txt
@@ -0,0 +1,18 @@
+layer at (0,0) size 1046x799 scrollHeight 5016
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x5016 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x5016
+    LayoutBlockFlow {BODY} at (8,8) size 1030x5000
+      LayoutBlockFlow {DIV} at (0,0) size 1030x5000
+layer at (0,0) size 510x64
+  LayoutBlockFlow (positioned) {DIV} at (0,0) size 510x64 [border: (5px solid #000000)]
+    LayoutBlockFlow {DIV} at (5,5) size 500x46
+      LayoutBlockFlow (anonymous) at (0,0) size 500x36
+        LayoutText {#text} at (0,0) size 472x36
+          text run at (0,0) width 472: "crbug.com/303728: Header Line should be repeated on every page except"
+          text run at (0,18) width 384: "where it's clipped by the absolute element on pages 3 and 4."
+      LayoutBlockFlow {HR} at (0,44) size 500x2 [border: (1px inset #EEEEEE)]
+layer at (0,1000) size 600x2000 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow (positioned) zI: 2 {DIV} at (0,1000) size 600x2000 [bgcolor=#000000]
+    LayoutText zI: 2 {#text} at (0,0) size 58x18
+      text run at (0,0) width 58: "Absolute"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/fixed-positioned-headers-and-footers-clipped-expected.png b/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/fixed-positioned-headers-and-footers-clipped-expected.png
new file mode 100644
index 0000000..9c7a963
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/fixed-positioned-headers-and-footers-clipped-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/fixed-positioned-headers-and-footers-clipped-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/fixed-positioned-headers-and-footers-clipped-expected.txt
new file mode 100644
index 0000000..9ca2a6f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/fixed-positioned-headers-and-footers-clipped-expected.txt
@@ -0,0 +1,234 @@
+layer at (0,0) size 1046x799 scrollHeight 2567
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x2567 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x2567
+    LayoutBlockFlow {BODY} at (8,16) size 1030x2535
+      LayoutBlockFlow {P} at (0,0) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,34) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,68) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,102) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,136) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,170) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,204) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,238) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,272) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,306) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,340) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,374) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,408) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,442) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,476) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,510) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,544) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,578) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,612) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,646) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,680) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,714) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,748) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,783) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,817) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,851) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,885) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,919) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,953) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,987) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1021) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1055) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1089) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1123) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1157) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1191) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1225) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1259) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1293) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1327) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1361) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1395) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1429) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1463) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1497) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1531) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1582) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1616) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1650) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1684) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1718) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1752) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1786) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1820) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1854) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1888) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1922) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1956) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1990) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2024) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2058) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2092) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2126) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2160) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2194) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2228) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2262) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2296) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2330) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2381) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2415) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2449) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2483) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2517) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+layer at (8,0) size 0x0
+  LayoutBlockFlow (positioned) {DIV} at (8,0) size 0x0
+layer at (8,0) size 1004x20 backgroundClip at (8,0) size 400x50 clip at (8,0) size 400x50
+  LayoutBlockFlow (positioned) {DIV} at (8,0) size 1003.55x20 [border: (1px solid #000000)]
+    LayoutBlockFlow {DIV} at (1,1) size 1001.55x18
+      LayoutText {#text} at (0,0) size 1002x18
+        text run at (0,0) width 1002: "crbug.com/303728: Clipped header Line is inside absolute element positioned at top of page so should only appear on first page and should be clipped there."
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/fixed-positioned-headers-and-footers-expected.png b/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/fixed-positioned-headers-and-footers-expected.png
new file mode 100644
index 0000000..aa3fef7
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/fixed-positioned-headers-and-footers-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/fixed-positioned-headers-and-footers-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/fixed-positioned-headers-and-footers-expected.txt
new file mode 100644
index 0000000..b413d1a0
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/fixed-positioned-headers-and-footers-expected.txt
@@ -0,0 +1,241 @@
+layer at (0,0) size 1046x799 scrollHeight 2567
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x2567 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x2567
+    LayoutBlockFlow {BODY} at (8,16) size 1030x2535
+      LayoutBlockFlow {P} at (0,0) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,34) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,68) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,102) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,136) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,170) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,204) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,238) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,272) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,306) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,340) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,374) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,408) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,442) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,476) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,510) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,544) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,578) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,612) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,646) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,680) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,714) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,748) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,783) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,817) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,851) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,885) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,919) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,953) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,987) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1021) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1055) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1089) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1123) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1157) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1191) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1225) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1259) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1293) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1327) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1361) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1395) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1429) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1463) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1497) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1531) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1582) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1616) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1650) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1684) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1718) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1752) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1786) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1820) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1854) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1888) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1922) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1956) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1990) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2024) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2058) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2092) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2126) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2160) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2194) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2228) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2262) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2296) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2330) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2381) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2415) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2449) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2483) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2517) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+layer at (8,0) size 524x36
+  LayoutBlockFlow (positioned) {DIV} at (8,0) size 523.84x36
+    LayoutBlockFlow {DIV} at (0,0) size 523.84x28
+      LayoutBlockFlow (anonymous) at (0,0) size 523.84x18
+        LayoutText {#text} at (0,0) size 524x18
+          text run at (0,0) width 524: "crbug.com/303728: Fixed-position header Line should be repeated on every page."
+      LayoutBlockFlow {HR} at (0,26) size 523.84x2 [border: (1px inset #EEEEEE)]
+layer at (8,763) size 426x36
+  LayoutBlockFlow (positioned) {DIV} at (8,763) size 425.66x36
+    LayoutBlockFlow {DIV} at (0,8) size 425.66x28
+      LayoutBlockFlow {HR} at (0,0) size 425.66x2 [border: (1px inset #EEEEEE)]
+      LayoutBlockFlow (anonymous) at (0,10) size 425.66x18
+        LayoutText {#text} at (0,0) size 426x18
+          text run at (0,0) width 426: "crbug.com/303728: Footer Line should be repeated on every page."
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/fixed-positioned-headers-and-footers-inside-transform-expected.png b/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/fixed-positioned-headers-and-footers-inside-transform-expected.png
new file mode 100644
index 0000000..64437eb
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/fixed-positioned-headers-and-footers-inside-transform-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/fixed-positioned-headers-and-footers-inside-transform-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/fixed-positioned-headers-and-footers-inside-transform-expected.txt
new file mode 100644
index 0000000..e3b4936f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/fixed-positioned-headers-and-footers-inside-transform-expected.txt
@@ -0,0 +1,245 @@
+layer at (0,0) size 1046x799 scrollHeight 2567
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x2567 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x2567
+    LayoutBlockFlow {BODY} at (8,16) size 1030x2535
+      LayoutBlockFlow {P} at (0,0) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,34) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,68) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,102) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,136) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,170) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,204) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,238) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,272) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,306) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,340) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,374) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,408) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,442) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,476) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,510) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,544) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,578) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,612) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,646) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,680) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,714) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,748) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,783) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,817) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,851) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,885) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,919) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,953) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,987) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1021) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1055) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1089) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1123) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1157) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1191) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1225) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1259) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1293) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1327) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1361) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1395) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1429) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1463) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1497) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1531) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1582) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1616) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1650) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1684) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1718) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1752) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1786) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1820) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1854) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1888) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1922) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1956) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1990) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2024) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2058) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2092) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2126) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2160) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2194) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2228) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2262) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2296) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2330) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2381) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2415) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2449) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2483) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2517) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+layer at (8,16) size 1030x0
+  LayoutBlockFlow {DIV} at (0,0) size 1030x0
+layer at (8,16) size 455x36
+  LayoutBlockFlow (positioned) {DIV} at (0,0) size 454.52x36
+    LayoutBlockFlow {DIV} at (0,0) size 454.52x28
+      LayoutBlockFlow (anonymous) at (0,0) size 454.52x18
+        LayoutText {#text} at (0,0) size 455x18
+          text run at (0,0) width 455: "crbug.com/303728: Header Line should not be repeated on every page."
+      LayoutBlockFlow {HR} at (0,26) size 454.52x2 [border: (1px inset #EEEEEE)]
+layer at (8,2567) size 1030x0
+  LayoutBlockFlow {DIV} at (0,2551) size 1030x0
+layer at (8,2531) size 450x36 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow (positioned) {DIV} at (0,-36) size 450.09x36
+    LayoutBlockFlow {DIV} at (0,8) size 450.09x28
+      LayoutBlockFlow {HR} at (0,0) size 450.09x2 [border: (1px inset #EEEEEE)]
+      LayoutBlockFlow (anonymous) at (0,10) size 450.09x18
+        LayoutText {#text} at (0,0) size 451x18
+          text run at (0,0) width 451: "crbug.com/303728: Footer Line should not be repeated on every page."
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.png b/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.png
new file mode 100644
index 0000000..6bb1ecee
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.txt
new file mode 100644
index 0000000..b9d011f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/threaded/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.txt
@@ -0,0 +1,241 @@
+layer at (0,0) size 1046x799 scrollHeight 2567
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x2567 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x2567
+    LayoutBlockFlow {BODY} at (8,16) size 1030x2535
+      LayoutBlockFlow {P} at (0,0) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,34) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,68) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,102) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,136) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,170) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,204) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,238) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,272) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,306) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,340) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,374) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,408) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,442) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,476) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,510) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,544) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,578) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,612) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,646) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,680) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,714) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,748) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,783) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,817) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,851) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,885) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,919) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,953) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,987) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1021) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1055) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1089) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1123) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1157) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1191) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1225) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1259) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1293) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1327) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1361) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1395) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1429) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1463) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1497) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1531) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1582) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1616) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1650) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1684) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1718) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1752) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1786) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1820) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1854) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1888) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1922) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1956) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1990) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2024) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2058) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2092) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2126) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2160) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2194) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2228) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2262) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2296) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2330) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2381) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2415) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2449) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2483) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2517) size 1030x18
+        LayoutText {#text} at (0,0) size 69x18
+          text run at (0,0) width 69: "Filler lines"
+layer at (8,0) size 2010x46 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow (positioned) {DIV} at (8,0) size 2010x46 [border: (5px solid #000000)]
+    LayoutBlockFlow {DIV} at (5,5) size 2000x28
+      LayoutBlockFlow (anonymous) at (0,0) size 2000x18
+        LayoutText {#text} at (0,0) size 706x18
+          text run at (0,0) width 706: "crbug.com/303728: Footer Line should be repeated on every page and should be clipped because it's too wide."
+      LayoutBlockFlow {HR} at (0,26) size 2000x2 [border: (1px inset #EEEEEE)]
+layer at (8,753) size 2010x46 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow (positioned) {DIV} at (8,753) size 2010x46 [border: (5px solid #000000)]
+    LayoutBlockFlow {DIV} at (5,13) size 2000x28
+      LayoutBlockFlow {HR} at (0,0) size 2000x2 [border: (1px inset #EEEEEE)]
+      LayoutBlockFlow (anonymous) at (0,10) size 2000x18
+        LayoutText {#text} at (0,0) size 706x18
+          text run at (0,0) width 706: "crbug.com/303728: Footer Line should be repeated on every page and should be clipped because it's too wide."
diff --git a/third_party/WebKit/LayoutTests/platform/win/printing/absolute-position-headers-and-footers-expected.txt b/third_party/WebKit/LayoutTests/platform/win/printing/absolute-position-headers-and-footers-expected.txt
new file mode 100644
index 0000000..df3d852
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win/printing/absolute-position-headers-and-footers-expected.txt
@@ -0,0 +1,241 @@
+layer at (0,0) size 1046x799 scrollHeight 2567
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x2567 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x2567
+    LayoutBlockFlow {BODY} at (8,16) size 1030x2535
+      LayoutBlockFlow {P} at (0,0) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,34) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,68) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,102) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,136) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,170) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,204) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,238) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,272) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,306) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,340) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,374) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,408) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,442) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,476) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,510) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,544) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,578) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,612) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,646) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,680) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,714) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,748) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,783) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,817) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,851) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,885) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,919) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,953) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,987) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1021) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1055) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1089) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1123) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1157) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1191) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1225) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1259) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1293) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1327) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1361) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1395) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1429) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1463) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1497) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1531) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1582) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1616) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1650) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1684) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1718) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1752) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1786) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1820) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1854) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1888) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1922) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1956) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1990) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2024) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2058) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2092) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2126) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2160) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2194) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2228) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2262) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2296) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2330) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2381) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2415) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2449) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2483) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2517) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+layer at (8,0) size 615x36
+  LayoutBlockFlow (positioned) {DIV} at (8,0) size 615.39x36
+    LayoutBlockFlow {DIV} at (0,0) size 615.39x28
+      LayoutBlockFlow (anonymous) at (0,0) size 615.39x18
+        LayoutText {#text} at (0,0) size 616x17
+          text run at (0,0) width 616: "crbug.com/303728: Header Line is absolute positioned so should not be repeated on every page."
+      LayoutBlockFlow {HR} at (0,26) size 615.39x2 [border: (1px inset #EEEEEE)]
+layer at (8,763) size 611x36
+  LayoutBlockFlow (positioned) {DIV} at (8,763) size 610.98x36
+    LayoutBlockFlow {DIV} at (0,8) size 610.98x28
+      LayoutBlockFlow {HR} at (0,0) size 610.98x2 [border: (1px inset #EEEEEE)]
+      LayoutBlockFlow (anonymous) at (0,10) size 610.98x18
+        LayoutText {#text} at (0,0) size 611x17
+          text run at (0,0) width 611: "crbug.com/303728: Footer Line is absolute positioned so should not be repeated on every page."
diff --git a/third_party/WebKit/LayoutTests/platform/win/printing/fixed-positioned-but-static-headers-and-footers-expected.txt b/third_party/WebKit/LayoutTests/platform/win/printing/fixed-positioned-but-static-headers-and-footers-expected.txt
new file mode 100644
index 0000000..bcd0a47
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win/printing/fixed-positioned-but-static-headers-and-footers-expected.txt
@@ -0,0 +1,241 @@
+layer at (0,0) size 1046x799 scrollHeight 2567
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x2567 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x2567
+    LayoutBlockFlow {BODY} at (8,16) size 1030x2535
+      LayoutBlockFlow {P} at (0,0) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,34) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,68) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,102) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,136) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,170) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,204) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,238) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,272) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,306) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,340) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,374) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,408) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,442) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,476) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,510) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,544) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,578) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,612) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,646) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,680) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,714) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,748) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,783) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,817) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,851) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,885) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,919) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,953) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,987) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1021) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1055) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1089) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1123) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1157) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1191) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1225) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1259) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1293) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1327) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1361) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1395) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1429) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1463) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1497) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1531) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1582) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1616) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1650) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1684) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1718) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1752) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1786) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1820) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1854) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1888) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1922) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1956) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1990) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2024) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2058) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2092) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2126) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2160) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2194) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2228) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2262) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2296) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2330) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2381) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2415) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2449) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2483) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2517) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+layer at (8,16) size 680x36
+  LayoutBlockFlow (positioned) {DIV} at (8,16) size 680.27x36
+    LayoutBlockFlow {DIV} at (0,0) size 680.27x28
+      LayoutBlockFlow (anonymous) at (0,0) size 680.27x18
+        LayoutText {#text} at (0,0) size 681x17
+          text run at (0,0) width 681: "crbug.com/303728: Fixed-position header Line is statically positioned and will be repeated on every page."
+      LayoutBlockFlow {HR} at (0,26) size 680.27x2 [border: (1px inset #EEEEEE)]
+layer at (8,2567) size 624x36 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow (positioned) {DIV} at (8,2567) size 624.30x36
+    LayoutBlockFlow {DIV} at (0,8) size 624.30x28
+      LayoutBlockFlow {HR} at (0,0) size 624.30x2 [border: (1px inset #EEEEEE)]
+      LayoutBlockFlow (anonymous) at (0,10) size 624.30x18
+        LayoutText {#text} at (0,0) size 625x17
+          text run at (0,0) width 625: "crbug.com/303728: Footer Line is statically positioned and should not be repeated on every page."
diff --git a/third_party/WebKit/LayoutTests/platform/win/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages-expected.txt b/third_party/WebKit/LayoutTests/platform/win/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages-expected.txt
new file mode 100644
index 0000000..b37fe4c7
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages-expected.txt
@@ -0,0 +1,18 @@
+layer at (0,0) size 1046x799 scrollHeight 5016
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x5016 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x5016
+    LayoutBlockFlow {BODY} at (8,8) size 1030x5000
+      LayoutBlockFlow {DIV} at (0,0) size 1030x5000
+layer at (0,0) size 510x64
+  LayoutBlockFlow (positioned) {DIV} at (0,0) size 510x64 [border: (5px solid #000000)]
+    LayoutBlockFlow {DIV} at (5,5) size 500x46
+      LayoutBlockFlow (anonymous) at (0,0) size 500x36
+        LayoutText {#text} at (0,0) size 472x35
+          text run at (0,0) width 472: "crbug.com/303728: Header Line should be repeated on every page except"
+          text run at (0,18) width 384: "where it's clipped by the absolute element on pages 3 and 4."
+      LayoutBlockFlow {HR} at (0,44) size 500x2 [border: (1px inset #EEEEEE)]
+layer at (0,1000) size 600x2000 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow (positioned) zI: 2 {DIV} at (0,1000) size 600x2000 [bgcolor=#000000]
+    LayoutText zI: 2 {#text} at (0,0) size 58x17
+      text run at (0,0) width 58: "Absolute"
diff --git a/third_party/WebKit/LayoutTests/platform/win/printing/fixed-positioned-headers-and-footers-clipped-expected.txt b/third_party/WebKit/LayoutTests/platform/win/printing/fixed-positioned-headers-and-footers-clipped-expected.txt
new file mode 100644
index 0000000..8a2946e5
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win/printing/fixed-positioned-headers-and-footers-clipped-expected.txt
@@ -0,0 +1,234 @@
+layer at (0,0) size 1046x799 scrollHeight 2567
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x2567 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x2567
+    LayoutBlockFlow {BODY} at (8,16) size 1030x2535
+      LayoutBlockFlow {P} at (0,0) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,34) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,68) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,102) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,136) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,170) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,204) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,238) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,272) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,306) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,340) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,374) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,408) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,442) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,476) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,510) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,544) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,578) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,612) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,646) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,680) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,714) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,748) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,783) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,817) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,851) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,885) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,919) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,953) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,987) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1021) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1055) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1089) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1123) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1157) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1191) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1225) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1259) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1293) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1327) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1361) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1395) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1429) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1463) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1497) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1531) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1582) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1616) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1650) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1684) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1718) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1752) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1786) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1820) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1854) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1888) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1922) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1956) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1990) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2024) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2058) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2092) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2126) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2160) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2194) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2228) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2262) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2296) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2330) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2381) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2415) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2449) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2483) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2517) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+layer at (8,0) size 0x0
+  LayoutBlockFlow (positioned) {DIV} at (8,0) size 0x0
+layer at (8,0) size 1004x20 backgroundClip at (8,0) size 400x50 clip at (8,0) size 400x50
+  LayoutBlockFlow (positioned) {DIV} at (8,0) size 1004.42x20 [border: (1px solid #000000)]
+    LayoutBlockFlow {DIV} at (1,1) size 1002.42x18
+      LayoutText {#text} at (0,0) size 1003x17
+        text run at (0,0) width 1003: "crbug.com/303728: Clipped header Line is inside absolute element positioned at top of page so should only appear on first page and should be clipped there."
diff --git a/third_party/WebKit/LayoutTests/platform/win/printing/fixed-positioned-headers-and-footers-expected.txt b/third_party/WebKit/LayoutTests/platform/win/printing/fixed-positioned-headers-and-footers-expected.txt
new file mode 100644
index 0000000..4829fd4
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win/printing/fixed-positioned-headers-and-footers-expected.txt
@@ -0,0 +1,241 @@
+layer at (0,0) size 1046x799 scrollHeight 2567
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x2567 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x2567
+    LayoutBlockFlow {BODY} at (8,16) size 1030x2535
+      LayoutBlockFlow {P} at (0,0) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,34) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,68) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,102) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,136) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,170) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,204) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,238) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,272) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,306) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,340) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,374) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,408) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,442) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,476) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,510) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,544) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,578) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,612) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,646) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,680) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,714) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,748) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,783) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,817) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,851) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,885) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,919) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,953) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,987) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1021) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1055) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1089) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1123) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1157) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1191) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1225) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1259) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1293) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1327) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1361) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1395) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1429) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1463) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1497) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1531) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1582) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1616) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1650) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1684) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1718) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1752) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1786) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1820) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1854) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1888) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1922) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1956) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1990) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2024) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2058) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2092) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2126) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2160) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2194) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2228) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2262) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2296) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2330) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2381) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2415) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2449) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2483) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2517) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+layer at (8,0) size 524x36
+  LayoutBlockFlow (positioned) {DIV} at (8,0) size 523.84x36
+    LayoutBlockFlow {DIV} at (0,0) size 523.84x28
+      LayoutBlockFlow (anonymous) at (0,0) size 523.84x18
+        LayoutText {#text} at (0,0) size 524x17
+          text run at (0,0) width 524: "crbug.com/303728: Fixed-position header Line should be repeated on every page."
+      LayoutBlockFlow {HR} at (0,26) size 523.84x2 [border: (1px inset #EEEEEE)]
+layer at (8,763) size 426x36
+  LayoutBlockFlow (positioned) {DIV} at (8,763) size 425.66x36
+    LayoutBlockFlow {DIV} at (0,8) size 425.66x28
+      LayoutBlockFlow {HR} at (0,0) size 425.66x2 [border: (1px inset #EEEEEE)]
+      LayoutBlockFlow (anonymous) at (0,10) size 425.66x18
+        LayoutText {#text} at (0,0) size 426x17
+          text run at (0,0) width 426: "crbug.com/303728: Footer Line should be repeated on every page."
diff --git a/third_party/WebKit/LayoutTests/platform/win/printing/fixed-positioned-headers-and-footers-inside-transform-expected.txt b/third_party/WebKit/LayoutTests/platform/win/printing/fixed-positioned-headers-and-footers-inside-transform-expected.txt
new file mode 100644
index 0000000..87eac940
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win/printing/fixed-positioned-headers-and-footers-inside-transform-expected.txt
@@ -0,0 +1,245 @@
+layer at (0,0) size 1046x799 scrollHeight 2567
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x2567 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x2567
+    LayoutBlockFlow {BODY} at (8,16) size 1030x2535
+      LayoutBlockFlow {P} at (0,0) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,34) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,68) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,102) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,136) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,170) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,204) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,238) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,272) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,306) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,340) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,374) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,408) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,442) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,476) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,510) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,544) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,578) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,612) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,646) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,680) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,714) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,748) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,783) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,817) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,851) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,885) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,919) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,953) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,987) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1021) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1055) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1089) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1123) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1157) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1191) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1225) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1259) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1293) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1327) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1361) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1395) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1429) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1463) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1497) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1531) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1582) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1616) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1650) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1684) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1718) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1752) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1786) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1820) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1854) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1888) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1922) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1956) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1990) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2024) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2058) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2092) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2126) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2160) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2194) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2228) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2262) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2296) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2330) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2381) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2415) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2449) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2483) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2517) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+layer at (8,16) size 1030x0
+  LayoutBlockFlow {DIV} at (0,0) size 1030x0
+layer at (8,16) size 455x36
+  LayoutBlockFlow (positioned) {DIV} at (0,0) size 454.52x36
+    LayoutBlockFlow {DIV} at (0,0) size 454.52x28
+      LayoutBlockFlow (anonymous) at (0,0) size 454.52x18
+        LayoutText {#text} at (0,0) size 455x17
+          text run at (0,0) width 455: "crbug.com/303728: Header Line should not be repeated on every page."
+      LayoutBlockFlow {HR} at (0,26) size 454.52x2 [border: (1px inset #EEEEEE)]
+layer at (8,2567) size 1030x0
+  LayoutBlockFlow {DIV} at (0,2551) size 1030x0
+layer at (8,2531) size 450x36 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow (positioned) {DIV} at (0,-36) size 450.09x36
+    LayoutBlockFlow {DIV} at (0,8) size 450.09x28
+      LayoutBlockFlow {HR} at (0,0) size 450.09x2 [border: (1px inset #EEEEEE)]
+      LayoutBlockFlow (anonymous) at (0,10) size 450.09x18
+        LayoutText {#text} at (0,0) size 451x17
+          text run at (0,0) width 451: "crbug.com/303728: Footer Line should not be repeated on every page."
diff --git a/third_party/WebKit/LayoutTests/platform/win/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.txt b/third_party/WebKit/LayoutTests/platform/win/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.txt
new file mode 100644
index 0000000..442a95a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.txt
@@ -0,0 +1,241 @@
+layer at (0,0) size 1046x799 scrollHeight 2567
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x2567 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x2567
+    LayoutBlockFlow {BODY} at (8,16) size 1030x2535
+      LayoutBlockFlow {P} at (0,0) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,34) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,68) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,102) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,136) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,170) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,204) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,238) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,272) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,306) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,340) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,374) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,408) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,442) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,476) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,510) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,544) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,578) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,612) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,646) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,680) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,714) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,748) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,783) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,817) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,851) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,885) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,919) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,953) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,987) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1021) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1055) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1089) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1123) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1157) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1191) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1225) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1259) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1293) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1327) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1361) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1395) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1429) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1463) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1497) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1531) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1582) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1616) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1650) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1684) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1718) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1752) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1786) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1820) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1854) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1888) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1922) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1956) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1990) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2024) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2058) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2092) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2126) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2160) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2194) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2228) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2262) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2296) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2330) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2381) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2415) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2449) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2483) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2517) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+layer at (8,0) size 2010x46 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow (positioned) {DIV} at (8,0) size 2010x46 [border: (5px solid #000000)]
+    LayoutBlockFlow {DIV} at (5,5) size 2000x28
+      LayoutBlockFlow (anonymous) at (0,0) size 2000x18
+        LayoutText {#text} at (0,0) size 706x17
+          text run at (0,0) width 706: "crbug.com/303728: Footer Line should be repeated on every page and should be clipped because it's too wide."
+      LayoutBlockFlow {HR} at (0,26) size 2000x2 [border: (1px inset #EEEEEE)]
+layer at (8,753) size 2010x46 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow (positioned) {DIV} at (8,753) size 2010x46 [border: (5px solid #000000)]
+    LayoutBlockFlow {DIV} at (5,13) size 2000x28
+      LayoutBlockFlow {HR} at (0,0) size 2000x2 [border: (1px inset #EEEEEE)]
+      LayoutBlockFlow (anonymous) at (0,10) size 2000x18
+        LayoutText {#text} at (0,0) size 706x17
+          text run at (0,0) width 706: "crbug.com/303728: Footer Line should be repeated on every page and should be clipped because it's too wide."
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/threaded/printing/absolute-position-headers-and-footers-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/threaded/printing/absolute-position-headers-and-footers-expected.txt
new file mode 100644
index 0000000..df3d852
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win/virtual/threaded/printing/absolute-position-headers-and-footers-expected.txt
@@ -0,0 +1,241 @@
+layer at (0,0) size 1046x799 scrollHeight 2567
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x2567 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x2567
+    LayoutBlockFlow {BODY} at (8,16) size 1030x2535
+      LayoutBlockFlow {P} at (0,0) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,34) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,68) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,102) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,136) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,170) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,204) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,238) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,272) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,306) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,340) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,374) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,408) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,442) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,476) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,510) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,544) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,578) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,612) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,646) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,680) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,714) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,748) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,783) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,817) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,851) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,885) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,919) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,953) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,987) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1021) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1055) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1089) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1123) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1157) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1191) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1225) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1259) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1293) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1327) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1361) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1395) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1429) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1463) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1497) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1531) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1582) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1616) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1650) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1684) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1718) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1752) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1786) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1820) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1854) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1888) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1922) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1956) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1990) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2024) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2058) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2092) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2126) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2160) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2194) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2228) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2262) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2296) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2330) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2381) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2415) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2449) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2483) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2517) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+layer at (8,0) size 615x36
+  LayoutBlockFlow (positioned) {DIV} at (8,0) size 615.39x36
+    LayoutBlockFlow {DIV} at (0,0) size 615.39x28
+      LayoutBlockFlow (anonymous) at (0,0) size 615.39x18
+        LayoutText {#text} at (0,0) size 616x17
+          text run at (0,0) width 616: "crbug.com/303728: Header Line is absolute positioned so should not be repeated on every page."
+      LayoutBlockFlow {HR} at (0,26) size 615.39x2 [border: (1px inset #EEEEEE)]
+layer at (8,763) size 611x36
+  LayoutBlockFlow (positioned) {DIV} at (8,763) size 610.98x36
+    LayoutBlockFlow {DIV} at (0,8) size 610.98x28
+      LayoutBlockFlow {HR} at (0,0) size 610.98x2 [border: (1px inset #EEEEEE)]
+      LayoutBlockFlow (anonymous) at (0,10) size 610.98x18
+        LayoutText {#text} at (0,0) size 611x17
+          text run at (0,0) width 611: "crbug.com/303728: Footer Line is absolute positioned so should not be repeated on every page."
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/threaded/printing/fixed-positioned-but-static-headers-and-footers-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/threaded/printing/fixed-positioned-but-static-headers-and-footers-expected.txt
new file mode 100644
index 0000000..bcd0a47
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win/virtual/threaded/printing/fixed-positioned-but-static-headers-and-footers-expected.txt
@@ -0,0 +1,241 @@
+layer at (0,0) size 1046x799 scrollHeight 2567
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x2567 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x2567
+    LayoutBlockFlow {BODY} at (8,16) size 1030x2535
+      LayoutBlockFlow {P} at (0,0) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,34) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,68) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,102) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,136) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,170) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,204) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,238) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,272) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,306) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,340) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,374) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,408) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,442) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,476) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,510) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,544) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,578) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,612) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,646) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,680) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,714) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,748) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,783) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,817) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,851) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,885) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,919) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,953) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,987) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1021) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1055) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1089) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1123) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1157) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1191) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1225) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1259) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1293) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1327) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1361) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1395) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1429) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1463) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1497) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1531) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1582) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1616) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1650) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1684) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1718) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1752) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1786) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1820) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1854) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1888) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1922) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1956) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1990) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2024) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2058) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2092) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2126) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2160) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2194) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2228) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2262) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2296) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2330) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2381) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2415) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2449) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2483) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2517) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+layer at (8,16) size 680x36
+  LayoutBlockFlow (positioned) {DIV} at (8,16) size 680.27x36
+    LayoutBlockFlow {DIV} at (0,0) size 680.27x28
+      LayoutBlockFlow (anonymous) at (0,0) size 680.27x18
+        LayoutText {#text} at (0,0) size 681x17
+          text run at (0,0) width 681: "crbug.com/303728: Fixed-position header Line is statically positioned and will be repeated on every page."
+      LayoutBlockFlow {HR} at (0,26) size 680.27x2 [border: (1px inset #EEEEEE)]
+layer at (8,2567) size 624x36 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow (positioned) {DIV} at (8,2567) size 624.30x36
+    LayoutBlockFlow {DIV} at (0,8) size 624.30x28
+      LayoutBlockFlow {HR} at (0,0) size 624.30x2 [border: (1px inset #EEEEEE)]
+      LayoutBlockFlow (anonymous) at (0,10) size 624.30x18
+        LayoutText {#text} at (0,0) size 625x17
+          text run at (0,0) width 625: "crbug.com/303728: Footer Line is statically positioned and should not be repeated on every page."
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/threaded/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/threaded/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages-expected.txt
new file mode 100644
index 0000000..b37fe4c7
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win/virtual/threaded/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages-expected.txt
@@ -0,0 +1,18 @@
+layer at (0,0) size 1046x799 scrollHeight 5016
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x5016 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x5016
+    LayoutBlockFlow {BODY} at (8,8) size 1030x5000
+      LayoutBlockFlow {DIV} at (0,0) size 1030x5000
+layer at (0,0) size 510x64
+  LayoutBlockFlow (positioned) {DIV} at (0,0) size 510x64 [border: (5px solid #000000)]
+    LayoutBlockFlow {DIV} at (5,5) size 500x46
+      LayoutBlockFlow (anonymous) at (0,0) size 500x36
+        LayoutText {#text} at (0,0) size 472x35
+          text run at (0,0) width 472: "crbug.com/303728: Header Line should be repeated on every page except"
+          text run at (0,18) width 384: "where it's clipped by the absolute element on pages 3 and 4."
+      LayoutBlockFlow {HR} at (0,44) size 500x2 [border: (1px inset #EEEEEE)]
+layer at (0,1000) size 600x2000 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow (positioned) zI: 2 {DIV} at (0,1000) size 600x2000 [bgcolor=#000000]
+    LayoutText zI: 2 {#text} at (0,0) size 58x17
+      text run at (0,0) width 58: "Absolute"
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/threaded/printing/fixed-positioned-headers-and-footers-clipped-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/threaded/printing/fixed-positioned-headers-and-footers-clipped-expected.txt
new file mode 100644
index 0000000..8a2946e5
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win/virtual/threaded/printing/fixed-positioned-headers-and-footers-clipped-expected.txt
@@ -0,0 +1,234 @@
+layer at (0,0) size 1046x799 scrollHeight 2567
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x2567 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x2567
+    LayoutBlockFlow {BODY} at (8,16) size 1030x2535
+      LayoutBlockFlow {P} at (0,0) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,34) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,68) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,102) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,136) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,170) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,204) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,238) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,272) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,306) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,340) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,374) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,408) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,442) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,476) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,510) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,544) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,578) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,612) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,646) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,680) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,714) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,748) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,783) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,817) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,851) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,885) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,919) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,953) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,987) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1021) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1055) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1089) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1123) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1157) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1191) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1225) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1259) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1293) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1327) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1361) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1395) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1429) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1463) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1497) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1531) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1582) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1616) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1650) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1684) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1718) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1752) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1786) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1820) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1854) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1888) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1922) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1956) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1990) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2024) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2058) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2092) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2126) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2160) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2194) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2228) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2262) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2296) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2330) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2381) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2415) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2449) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2483) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2517) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+layer at (8,0) size 0x0
+  LayoutBlockFlow (positioned) {DIV} at (8,0) size 0x0
+layer at (8,0) size 1004x20 backgroundClip at (8,0) size 400x50 clip at (8,0) size 400x50
+  LayoutBlockFlow (positioned) {DIV} at (8,0) size 1004.42x20 [border: (1px solid #000000)]
+    LayoutBlockFlow {DIV} at (1,1) size 1002.42x18
+      LayoutText {#text} at (0,0) size 1003x17
+        text run at (0,0) width 1003: "crbug.com/303728: Clipped header Line is inside absolute element positioned at top of page so should only appear on first page and should be clipped there."
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/threaded/printing/fixed-positioned-headers-and-footers-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/threaded/printing/fixed-positioned-headers-and-footers-expected.txt
new file mode 100644
index 0000000..4829fd4
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win/virtual/threaded/printing/fixed-positioned-headers-and-footers-expected.txt
@@ -0,0 +1,241 @@
+layer at (0,0) size 1046x799 scrollHeight 2567
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x2567 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x2567
+    LayoutBlockFlow {BODY} at (8,16) size 1030x2535
+      LayoutBlockFlow {P} at (0,0) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,34) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,68) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,102) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,136) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,170) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,204) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,238) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,272) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,306) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,340) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,374) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,408) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,442) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,476) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,510) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,544) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,578) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,612) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,646) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,680) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,714) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,748) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,783) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,817) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,851) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,885) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,919) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,953) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,987) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1021) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1055) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1089) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1123) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1157) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1191) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1225) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1259) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1293) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1327) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1361) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1395) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1429) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1463) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1497) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1531) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1582) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1616) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1650) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1684) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1718) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1752) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1786) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1820) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1854) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1888) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1922) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1956) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1990) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2024) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2058) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2092) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2126) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2160) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2194) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2228) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2262) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2296) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2330) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2381) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2415) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2449) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2483) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2517) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+layer at (8,0) size 524x36
+  LayoutBlockFlow (positioned) {DIV} at (8,0) size 523.84x36
+    LayoutBlockFlow {DIV} at (0,0) size 523.84x28
+      LayoutBlockFlow (anonymous) at (0,0) size 523.84x18
+        LayoutText {#text} at (0,0) size 524x17
+          text run at (0,0) width 524: "crbug.com/303728: Fixed-position header Line should be repeated on every page."
+      LayoutBlockFlow {HR} at (0,26) size 523.84x2 [border: (1px inset #EEEEEE)]
+layer at (8,763) size 426x36
+  LayoutBlockFlow (positioned) {DIV} at (8,763) size 425.66x36
+    LayoutBlockFlow {DIV} at (0,8) size 425.66x28
+      LayoutBlockFlow {HR} at (0,0) size 425.66x2 [border: (1px inset #EEEEEE)]
+      LayoutBlockFlow (anonymous) at (0,10) size 425.66x18
+        LayoutText {#text} at (0,0) size 426x17
+          text run at (0,0) width 426: "crbug.com/303728: Footer Line should be repeated on every page."
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/threaded/printing/fixed-positioned-headers-and-footers-inside-transform-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/threaded/printing/fixed-positioned-headers-and-footers-inside-transform-expected.txt
new file mode 100644
index 0000000..87eac940
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win/virtual/threaded/printing/fixed-positioned-headers-and-footers-inside-transform-expected.txt
@@ -0,0 +1,245 @@
+layer at (0,0) size 1046x799 scrollHeight 2567
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x2567 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x2567
+    LayoutBlockFlow {BODY} at (8,16) size 1030x2535
+      LayoutBlockFlow {P} at (0,0) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,34) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,68) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,102) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,136) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,170) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,204) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,238) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,272) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,306) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,340) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,374) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,408) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,442) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,476) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,510) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,544) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,578) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,612) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,646) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,680) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,714) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,748) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,783) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,817) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,851) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,885) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,919) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,953) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,987) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1021) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1055) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1089) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1123) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1157) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1191) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1225) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1259) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1293) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1327) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1361) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1395) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1429) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1463) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1497) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1531) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1582) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1616) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1650) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1684) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1718) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1752) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1786) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1820) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1854) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1888) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1922) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1956) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1990) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2024) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2058) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2092) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2126) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2160) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2194) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2228) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2262) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2296) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2330) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2381) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2415) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2449) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2483) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2517) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+layer at (8,16) size 1030x0
+  LayoutBlockFlow {DIV} at (0,0) size 1030x0
+layer at (8,16) size 455x36
+  LayoutBlockFlow (positioned) {DIV} at (0,0) size 454.52x36
+    LayoutBlockFlow {DIV} at (0,0) size 454.52x28
+      LayoutBlockFlow (anonymous) at (0,0) size 454.52x18
+        LayoutText {#text} at (0,0) size 455x17
+          text run at (0,0) width 455: "crbug.com/303728: Header Line should not be repeated on every page."
+      LayoutBlockFlow {HR} at (0,26) size 454.52x2 [border: (1px inset #EEEEEE)]
+layer at (8,2567) size 1030x0
+  LayoutBlockFlow {DIV} at (0,2551) size 1030x0
+layer at (8,2531) size 450x36 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow (positioned) {DIV} at (0,-36) size 450.09x36
+    LayoutBlockFlow {DIV} at (0,8) size 450.09x28
+      LayoutBlockFlow {HR} at (0,0) size 450.09x2 [border: (1px inset #EEEEEE)]
+      LayoutBlockFlow (anonymous) at (0,10) size 450.09x18
+        LayoutText {#text} at (0,0) size 451x17
+          text run at (0,0) width 451: "crbug.com/303728: Footer Line should not be repeated on every page."
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/threaded/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/threaded/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.txt
new file mode 100644
index 0000000..442a95a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win/virtual/threaded/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.txt
@@ -0,0 +1,241 @@
+layer at (0,0) size 1046x799 scrollHeight 2567
+  LayoutView at (0,0) size 1046x799
+layer at (0,0) size 1046x2567 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow {HTML} at (0,0) size 1046x2567
+    LayoutBlockFlow {BODY} at (8,16) size 1030x2535
+      LayoutBlockFlow {P} at (0,0) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,34) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,68) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,102) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,136) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,170) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,204) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,238) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,272) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,306) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,340) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,374) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,408) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,442) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,476) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,510) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,544) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,578) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,612) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,646) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,680) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,714) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,748) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,783) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,817) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,851) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,885) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,919) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,953) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,987) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1021) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1055) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1089) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1123) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1157) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1191) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1225) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1259) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1293) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1327) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1361) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1395) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1429) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1463) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1497) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1531) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1582) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1616) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1650) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1684) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1718) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1752) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1786) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1820) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1854) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1888) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1922) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1956) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,1990) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2024) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2058) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2092) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2126) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2160) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2194) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2228) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2262) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2296) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2330) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2381) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2415) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2449) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2483) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+      LayoutBlockFlow {P} at (0,2517) size 1030x18
+        LayoutText {#text} at (0,0) size 69x17
+          text run at (0,0) width 69: "Filler lines"
+layer at (8,0) size 2010x46 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow (positioned) {DIV} at (8,0) size 2010x46 [border: (5px solid #000000)]
+    LayoutBlockFlow {DIV} at (5,5) size 2000x28
+      LayoutBlockFlow (anonymous) at (0,0) size 2000x18
+        LayoutText {#text} at (0,0) size 706x17
+          text run at (0,0) width 706: "crbug.com/303728: Footer Line should be repeated on every page and should be clipped because it's too wide."
+      LayoutBlockFlow {HR} at (0,26) size 2000x2 [border: (1px inset #EEEEEE)]
+layer at (8,753) size 2010x46 backgroundClip at (0,0) size 1046x799 clip at (0,0) size 1046x799
+  LayoutBlockFlow (positioned) {DIV} at (8,753) size 2010x46 [border: (5px solid #000000)]
+    LayoutBlockFlow {DIV} at (5,13) size 2000x28
+      LayoutBlockFlow {HR} at (0,0) size 2000x2 [border: (1px inset #EEEEEE)]
+      LayoutBlockFlow (anonymous) at (0,10) size 2000x18
+        LayoutText {#text} at (0,0) size 706x17
+          text run at (0,0) width 706: "crbug.com/303728: Footer Line should be repeated on every page and should be clipped because it's too wide."
diff --git a/third_party/WebKit/LayoutTests/platform/win7/printing/absolute-position-headers-and-footers-expected.png b/third_party/WebKit/LayoutTests/platform/win7/printing/absolute-position-headers-and-footers-expected.png
new file mode 100644
index 0000000..aeb296a3
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/printing/absolute-position-headers-and-footers-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/printing/fixed-positioned-but-static-headers-and-footers-expected.png b/third_party/WebKit/LayoutTests/platform/win7/printing/fixed-positioned-but-static-headers-and-footers-expected.png
new file mode 100644
index 0000000..79c5863
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/printing/fixed-positioned-but-static-headers-and-footers-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages-expected.png b/third_party/WebKit/LayoutTests/platform/win7/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages-expected.png
new file mode 100644
index 0000000..625e4e6
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/printing/fixed-positioned-headers-and-footers-clipped-expected.png b/third_party/WebKit/LayoutTests/platform/win7/printing/fixed-positioned-headers-and-footers-clipped-expected.png
new file mode 100644
index 0000000..498e198
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/printing/fixed-positioned-headers-and-footers-clipped-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/printing/fixed-positioned-headers-and-footers-expected.png b/third_party/WebKit/LayoutTests/platform/win7/printing/fixed-positioned-headers-and-footers-expected.png
new file mode 100644
index 0000000..b28c13e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/printing/fixed-positioned-headers-and-footers-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/printing/fixed-positioned-headers-and-footers-inside-transform-expected.png b/third_party/WebKit/LayoutTests/platform/win7/printing/fixed-positioned-headers-and-footers-inside-transform-expected.png
new file mode 100644
index 0000000..23366bc78
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/printing/fixed-positioned-headers-and-footers-inside-transform-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.png b/third_party/WebKit/LayoutTests/platform/win7/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.png
new file mode 100644
index 0000000..8a608fe
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/virtual/threaded/printing/absolute-position-headers-and-footers-expected.png b/third_party/WebKit/LayoutTests/platform/win7/virtual/threaded/printing/absolute-position-headers-and-footers-expected.png
new file mode 100644
index 0000000..aeb296a3
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/virtual/threaded/printing/absolute-position-headers-and-footers-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/virtual/threaded/printing/fixed-positioned-but-static-headers-and-footers-expected.png b/third_party/WebKit/LayoutTests/platform/win7/virtual/threaded/printing/fixed-positioned-but-static-headers-and-footers-expected.png
new file mode 100644
index 0000000..79c5863
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/virtual/threaded/printing/fixed-positioned-but-static-headers-and-footers-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/virtual/threaded/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages-expected.png b/third_party/WebKit/LayoutTests/platform/win7/virtual/threaded/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages-expected.png
new file mode 100644
index 0000000..625e4e6
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/virtual/threaded/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/virtual/threaded/printing/fixed-positioned-headers-and-footers-clipped-expected.png b/third_party/WebKit/LayoutTests/platform/win7/virtual/threaded/printing/fixed-positioned-headers-and-footers-clipped-expected.png
new file mode 100644
index 0000000..498e198
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/virtual/threaded/printing/fixed-positioned-headers-and-footers-clipped-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/virtual/threaded/printing/fixed-positioned-headers-and-footers-expected.png b/third_party/WebKit/LayoutTests/platform/win7/virtual/threaded/printing/fixed-positioned-headers-and-footers-expected.png
new file mode 100644
index 0000000..b28c13e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/virtual/threaded/printing/fixed-positioned-headers-and-footers-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/virtual/threaded/printing/fixed-positioned-headers-and-footers-inside-transform-expected.png b/third_party/WebKit/LayoutTests/platform/win7/virtual/threaded/printing/fixed-positioned-headers-and-footers-inside-transform-expected.png
new file mode 100644
index 0000000..23366bc78
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/virtual/threaded/printing/fixed-positioned-headers-and-footers-inside-transform-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/virtual/threaded/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.png b/third_party/WebKit/LayoutTests/platform/win7/virtual/threaded/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.png
new file mode 100644
index 0000000..8a608fe
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/virtual/threaded/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/plugins/change-widget-and-click-crash-expected.txt b/third_party/WebKit/LayoutTests/plugins/change-widget-and-click-crash-expected.txt
index f7a66c6..ae4ba565 100644
--- a/third_party/WebKit/LayoutTests/plugins/change-widget-and-click-crash-expected.txt
+++ b/third_party/WebKit/LayoutTests/plugins/change-widget-and-click-crash-expected.txt
@@ -1,2 +1,6 @@
 CONSOLE MESSAGE: Blink Test Plugin: initializing
+CONSOLE MESSAGE: Blink Test Plugin: initializing
+CONSOLE MESSAGE: Blink Test Plugin: DidChangeFocus(true)
+CONSOLE MESSAGE: Blink Test Plugin: MouseDown at (151,76)
+CONSOLE MESSAGE: Blink Test Plugin: DidChangeFocus(false)
 PASS
diff --git a/third_party/WebKit/LayoutTests/plugins/plugin-reload-data-expected.txt b/third_party/WebKit/LayoutTests/plugins/plugin-reload-data-expected.txt
new file mode 100644
index 0000000..df8bda4f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/plugins/plugin-reload-data-expected.txt
@@ -0,0 +1,13 @@
+CONSOLE MESSAGE: Blink Test Plugin: initializing
+CONSOLE MESSAGE: Blink Test Plugin: plugin args:
+CONSOLE MESSAGE: Blink Test Plugin:   name = data, value = data:text/plain,first
+CONSOLE MESSAGE: Blink Test Plugin:   name = type, value = application/x-blink-test-plugin
+CONSOLE MESSAGE: Blink Test Plugin:   name = logargs, value = true
+CONSOLE MESSAGE: Blink Test Plugin:   name = src, value = data:text/plain,first
+CONSOLE MESSAGE: Blink Test Plugin: initializing
+CONSOLE MESSAGE: Blink Test Plugin: plugin args:
+CONSOLE MESSAGE: Blink Test Plugin:   name = data, value = data:text/plain,second
+CONSOLE MESSAGE: Blink Test Plugin:   name = type, value = application/x-blink-test-plugin
+CONSOLE MESSAGE: Blink Test Plugin:   name = logargs, value = true
+CONSOLE MESSAGE: Blink Test Plugin:   name = src, value = data:text/plain,second
+
diff --git a/third_party/WebKit/LayoutTests/plugins/plugin-reload-data.html b/third_party/WebKit/LayoutTests/plugins/plugin-reload-data.html
new file mode 100644
index 0000000..d74c57d3
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/plugins/plugin-reload-data.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<script>
+    if (window.testRunner) {
+        testRunner.dumpAsText();
+        testRunner.waitUntilDone();
+
+        onload = () => {
+            var object = document.querySelector("object");
+            object.setAttribute("data", "data:text/plain,second");
+            requestAnimationFrame(() => { testRunner.notifyDone(); });
+        };
+    } else {
+        document.write("Needs to be run as a layout test.");
+    }
+</script>
+<object data="data:text/plain,first" type="application/x-blink-test-plugin" logargs="true"></object>
diff --git a/third_party/WebKit/LayoutTests/printing/absolute-position-headers-and-footers.html b/third_party/WebKit/LayoutTests/printing/absolute-position-headers-and-footers.html
new file mode 100644
index 0000000..8c5c3e61
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/printing/absolute-position-headers-and-footers.html
@@ -0,0 +1,103 @@
+<!DOCTYPE html>
+<style media="print">
+#myfooter
+{
+    position: absolute;
+    bottom: 0;
+}
+#myheader
+{
+    position: absolute;
+    top: 0;
+}
+</style>
+<script>
+if (window.testRunner)
+    testRunner.setPrinting();
+</script>
+<div id="myheader">
+    <div align="center">
+        crbug.com/303728: Header Line is absolute positioned so should not be repeated on every page.
+        <hr/>
+    </div>
+</div>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<div id="myfooter">
+    <div align="center">
+        <hr/>
+        crbug.com/303728: Footer Line is absolute positioned so should not be repeated on every page.
+    </div>
+</div>
diff --git a/third_party/WebKit/LayoutTests/printing/fixed-positioned-but-static-headers-and-footers.html b/third_party/WebKit/LayoutTests/printing/fixed-positioned-but-static-headers-and-footers.html
new file mode 100644
index 0000000..61ca35e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/printing/fixed-positioned-but-static-headers-and-footers.html
@@ -0,0 +1,101 @@
+<!DOCTYPE html>
+<style media="print">
+#myfooter
+{
+    position: fixed;
+}
+#myheader
+{
+    position: fixed;
+}
+</style>
+<script>
+if (window.testRunner)
+    testRunner.setPrinting();
+</script>
+<div id="myheader">
+    <div align="center">
+        crbug.com/303728: Fixed-position header Line is statically positioned and will be repeated on every page.
+        <hr/>
+    </div>
+</div>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<div id="myfooter">
+    <div align="center">
+        <hr/>
+        crbug.com/303728: Footer Line is statically positioned and should not be repeated on every page.
+    </div>
+</div>
diff --git a/third_party/WebKit/LayoutTests/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages-expected.png b/third_party/WebKit/LayoutTests/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages-expected.png
new file mode 100644
index 0000000..9387b3a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages.html b/third_party/WebKit/LayoutTests/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages.html
new file mode 100644
index 0000000..aa510aea
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<style media="print">
+#myheader
+{
+    position: fixed;
+    top: 0;
+    left: 0;
+    width: 500px;
+    border: 5px solid black;
+}
+</style>
+<script>
+if (window.testRunner)
+    testRunner.setPrinting();
+</script>
+<div id="myheader">
+    <div>
+        crbug.com/303728: Header Line should be repeated on every page except where it's clipped by the absolute element on pages 3 and 4.
+        <hr/>
+    </div>
+</div>
+<div style="position: absolute; left: 0px; top: 1000px; width: 600px; height: 2000px; background-color: black; z-index: 2">Absolute</div>
+<div style="height: 5000px"></div>
diff --git a/third_party/WebKit/LayoutTests/printing/fixed-positioned-headers-and-footers-clipped.html b/third_party/WebKit/LayoutTests/printing/fixed-positioned-headers-and-footers-clipped.html
new file mode 100644
index 0000000..63c016f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/printing/fixed-positioned-headers-and-footers-clipped.html
@@ -0,0 +1,99 @@
+<!DOCTYPE html>
+<style>
+#myheader
+{
+    position: fixed;
+    top: 0;
+    border: 1px solid black;
+}
+#clipper {
+    position: absolute;
+    top: 0;
+    clip: rect(0, 400px, 50px, 0px);
+}
+</style>
+<script>
+if (window.testRunner)
+    testRunner.setPrinting();
+</script>
+<div id="clipper">
+    <div id="myheader">
+        <div align="center">
+            crbug.com/303728: Clipped header Line is inside absolute element positioned at top of page so should only appear on first page and should be clipped there.
+        </div>
+    </div>
+</div>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
diff --git a/third_party/WebKit/LayoutTests/printing/fixed-positioned-headers-and-footers-inside-transform.html b/third_party/WebKit/LayoutTests/printing/fixed-positioned-headers-and-footers-inside-transform.html
new file mode 100644
index 0000000..b015104
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/printing/fixed-positioned-headers-and-footers-inside-transform.html
@@ -0,0 +1,107 @@
+<!DOCTYPE html>
+<style media="print">
+#myfooter
+{
+    position: fixed;
+    bottom: 0;
+}
+#myheader
+{
+    position: fixed;
+    top: 0;
+}
+</style>
+<script>
+if (window.testRunner)
+    testRunner.setPrinting();
+</script>
+<div style="will-change:transform;">
+    <div id="myheader">
+        <div align="center">
+            crbug.com/303728: Header Line should not be repeated on every page.
+            <hr/>
+        </div>
+    </div>
+</div>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<div style="will-change:transform;">
+    <div id="myfooter">
+        <div align="center">
+            <hr/>
+            crbug.com/303728: Footer Line should not be repeated on every page.
+        </div>
+    </div>
+</div>
diff --git a/third_party/WebKit/LayoutTests/printing/fixed-positioned-headers-and-footers-larger-than-page.html b/third_party/WebKit/LayoutTests/printing/fixed-positioned-headers-and-footers-larger-than-page.html
new file mode 100644
index 0000000..49d7a34
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/printing/fixed-positioned-headers-and-footers-larger-than-page.html
@@ -0,0 +1,107 @@
+<!DOCTYPE html>
+<style media="print">
+#myfooter
+{
+    position: fixed;
+    bottom: 0;
+    width: 2000px;
+    border: 5px solid black;
+}
+#myheader
+{
+    position: fixed;
+    top: 0;
+    width: 2000px;
+    border: 5px solid black;
+}
+</style>
+<script>
+if (window.testRunner)
+    testRunner.setPrinting();
+</script>
+<div id="myheader">
+    <div>
+        crbug.com/303728: Footer Line should be repeated on every page and should be clipped because it's too wide.
+        <hr/>
+    </div>
+</div>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<div id="myfooter">
+    <div>
+        <hr/>
+        crbug.com/303728: Footer Line should be repeated on every page and should be clipped because it's too wide.
+    </div>
+</div>
diff --git a/third_party/WebKit/LayoutTests/printing/fixed-positioned-headers-and-footers.html b/third_party/WebKit/LayoutTests/printing/fixed-positioned-headers-and-footers.html
new file mode 100644
index 0000000..28e01103
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/printing/fixed-positioned-headers-and-footers.html
@@ -0,0 +1,103 @@
+<!DOCTYPE html>
+<style media="print">
+#myfooter
+{
+    position: fixed;
+    bottom: 0;
+}
+#myheader
+{
+    position: fixed;
+    top: 0;
+}
+</style>
+<script>
+if (window.testRunner)
+    testRunner.setPrinting();
+</script>
+<div id="myheader">
+    <div align="center">
+        crbug.com/303728: Fixed-position header Line should be repeated on every page.
+        <hr/>
+    </div>
+</div>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<p>Filler lines</p>
+<div id="myfooter">
+    <div align="center">
+        <hr/>
+        crbug.com/303728: Footer Line should be repeated on every page.
+    </div>
+</div>
diff --git a/third_party/WebKit/LayoutTests/bluetooth/resources/bluetooth-helpers.js b/third_party/WebKit/LayoutTests/resources/bluetooth/bluetooth-helpers.js
similarity index 100%
rename from third_party/WebKit/LayoutTests/bluetooth/resources/bluetooth-helpers.js
rename to third_party/WebKit/LayoutTests/resources/bluetooth/bluetooth-helpers.js
diff --git a/third_party/WebKit/LayoutTests/bluetooth/resources/connect-iframe.html b/third_party/WebKit/LayoutTests/resources/bluetooth/connect-iframe.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/bluetooth/resources/connect-iframe.html
rename to third_party/WebKit/LayoutTests/resources/bluetooth/connect-iframe.html
diff --git a/third_party/WebKit/LayoutTests/bluetooth/resources/requestDevice-in-iframe.html b/third_party/WebKit/LayoutTests/resources/bluetooth/requestDevice-in-iframe.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/bluetooth/resources/requestDevice-in-iframe.html
rename to third_party/WebKit/LayoutTests/resources/bluetooth/requestDevice-in-iframe.html
diff --git a/third_party/WebKit/LayoutTests/bluetooth/resources/requestDevice-in-sandboxed-iframe.html b/third_party/WebKit/LayoutTests/resources/bluetooth/requestDevice-in-sandboxed-iframe.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/bluetooth/resources/requestDevice-in-sandboxed-iframe.html
rename to third_party/WebKit/LayoutTests/resources/bluetooth/requestDevice-in-sandboxed-iframe.html
diff --git a/third_party/WebKit/LayoutTests/virtual/android/media/mediadocument/README.txt b/third_party/WebKit/LayoutTests/virtual/android/media/mediadocument/README.txt
new file mode 100644
index 0000000..aafb7098
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/virtual/android/media/mediadocument/README.txt
@@ -0,0 +1 @@
+# This suite runs the tests on media document with additional flags.
diff --git a/third_party/WebKit/LayoutTests/virtual/android/media/mediadocument/media-document-with-download-button-expected.html b/third_party/WebKit/LayoutTests/virtual/android/media/mediadocument/media-document-with-download-button-expected.html
new file mode 100644
index 0000000..8fddc8e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/virtual/android/media/mediadocument/media-document-with-download-button-expected.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<script src="../../../../resources/run-after-layout-and-paint.js"></script>
+<script>
+    if (window.testRunner)
+        testRunner.waitUntilDone();
+
+    function frameLoaded()
+    {
+        if (window.testRunner)
+            testRunner.notifyDone();
+    }
+</script>
+<p>
+    This tests that in a standalone media document with audio content, a download button is positioned below the
+    media element.
+</p>
+<iframe src="resources/standalone-audio.html" id="fr" width=380 height=330 onload="frameLoaded()"></iframe>
\ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/virtual/android/media/mediadocument/media-document-with-download-button.html b/third_party/WebKit/LayoutTests/virtual/android/media/mediadocument/media-document-with-download-button.html
new file mode 100644
index 0000000..bd1aabe
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/virtual/android/media/mediadocument/media-document-with-download-button.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<script src="../../../../resources/run-after-layout-and-paint.js"></script>
+<script>
+    if (window.testRunner)
+        testRunner.waitUntilDone();
+
+    function frameLoaded()
+    {
+        if (window.testRunner)
+            testRunner.notifyDone();
+    }
+</script>
+<p>
+    This tests that in a standalone media document with audio content, a download button is positioned below the
+    media element.
+</p>
+<iframe src="../../../../media/content/silence.wav" id="fr" width=380 height=330 onload="frameLoaded()"></iframe>
\ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/virtual/android/media/mediadocument/resources/standalone-audio.html b/third_party/WebKit/LayoutTests/virtual/android/media/mediadocument/resources/standalone-audio.html
new file mode 100644
index 0000000..970526fb
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/virtual/android/media/mediadocument/resources/standalone-audio.html
@@ -0,0 +1,52 @@
+<head>
+<meta name="viewport" content="width=device-width">
+<style>
+body {
+  background-color: black;
+  margin: 0;
+}
+.button1 {
+  display: inline-block;
+  margin-top: 32px;
+  padding: 0 16px 0 16px;
+  height: 36px;
+  background: #4285F4;
+  font-family: Roboto;
+  font-size: 14px;
+  border-radius: 5px;
+  color: white;
+  font-weight: bold;
+  text-decoration:none;
+  min-width: 300px;
+  line-height: 36px;
+}
+
+.div1 {
+  display: flex;
+  flex-direction: column;
+  justify-content: center;
+  align-items: center;
+  min-height: min-content;
+  height: 100%;
+}
+
+.div2 {
+  text-align: center;
+  position: absolute;
+  left: 0;
+  right: 0;
+}
+
+.video {
+  height: 1px;
+  width: 300px;
+  object-fit: contain;
+}
+</style>
+</head>
+<body>
+<div class="div1">
+<video controls autoplay class="video"><source src="../../../../../media/content/silence.wav"></video>
+<div class="div2"><a href="../../../../../media/content/silence.wav" download class="button1">SAVE</a></div>
+</div>
+</body>
\ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/web-animations-api/animation-state-changes-negative-playback-rate.html b/third_party/WebKit/LayoutTests/web-animations-api/animation-state-changes-negative-playback-rate.html
index b854e16..e6903c7 100644
--- a/third_party/WebKit/LayoutTests/web-animations-api/animation-state-changes-negative-playback-rate.html
+++ b/third_party/WebKit/LayoutTests/web-animations-api/animation-state-changes-negative-playback-rate.html
@@ -60,7 +60,7 @@
 test(function() {
   var animation = runningAnimation();
   assert_equals(animation.startTime, document.timeline.currentTime - (animation.playbackRate * animation.currentTime));
-  assert_equals(animation.currentTime, duration / 2);
+  assert_approx_equals(animation.currentTime, duration / 2, 0.000001);
   assert_equals(animation.playState, 'running');
 }, "running");
 
@@ -204,7 +204,7 @@
   var animation = runningAnimation();
   animation.pause();
   assert_unresolved(animation.startTime);
-  assert_equals(animation.currentTime, duration / 2);
+  assert_approx_equals(animation.currentTime, duration / 2, 0.000001);
   assert_equals(animation.playState, 'pending');
 }, "running -> pause()");
 
@@ -228,7 +228,7 @@
   var animation = runningAnimation();
   animation.reverse();
   assert_unresolved(animation.startTime);
-  assert_equals(animation.currentTime, duration / 2);
+  assert_approx_equals(animation.currentTime, duration / 2, 0.000001);
   assert_equals(animation.playState, 'pending');
 }, "running -> reverse()");
 
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseResolver.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseResolver.cpp
index c673c46b..04dc617a 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseResolver.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseResolver.cpp
@@ -4,6 +4,8 @@
 
 #include "bindings/core/v8/ScriptPromiseResolver.h"
 
+#include "core/inspector/InspectorInstrumentation.h"
+
 namespace blink {
 
 ScriptPromiseResolver::ScriptPromiseResolver(ScriptState* scriptState)
@@ -20,6 +22,7 @@
         m_state = Detached;
         m_resolver.clear();
     }
+    InspectorInstrumentation::asyncTaskScheduled(getExecutionContext(), "Promise", this);
 }
 
 void ScriptPromiseResolver::suspend()
@@ -42,6 +45,7 @@
     m_resolver.clear();
     m_value.clear();
     m_keepAlive.clear();
+    InspectorInstrumentation::asyncTaskCanceled(getExecutionContext(), this);
 }
 
 void ScriptPromiseResolver::keepAliveWhilePending()
@@ -74,6 +78,7 @@
     ASSERT(!getExecutionContext()->activeDOMObjectsAreStopped());
     ASSERT(!getExecutionContext()->activeDOMObjectsAreSuspended());
     {
+        InspectorInstrumentation::AsyncTask asyncTask(getExecutionContext(), this);
         if (m_state == Resolving) {
             m_resolver.resolve(m_value.newLocal(m_scriptState->isolate()));
         } else {
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp b/third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp
index f1363a1d..901a7383 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp
@@ -676,6 +676,10 @@
         // We don't always have an entered DOM window, for example during microtask callbacks from V8
         // (where the entered context may be the DOM-in-JS context). In that case, we fall back
         // to the current context.
+        //
+        // TODO(haraken): It's nasty to return a current window from enteredDOMWindow.
+        // All call sites should be updated so that it works even if it doesn't have
+        // an entered window.
         window = currentDOMWindow(isolate);
         ASSERT(window);
     }
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp b/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp
index d3328f9..e1daa8b6 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp
@@ -137,7 +137,8 @@
     ASSERT(isMainThread());
     v8::Isolate* isolate = v8::Isolate::GetCurrent();
     // If called during context initialization, there will be no entered window.
-    LocalDOMWindow* enteredWindow = enteredDOMWindow(isolate);
+    // TODO(haraken): Add a helper method to get an entered window that may be null.
+    LocalDOMWindow* enteredWindow = toLocalDOMWindow(toDOMWindow(isolate->GetEnteredContext()));
     if (!enteredWindow || !enteredWindow->isCurrentlyDisplayedInFrame())
         return;
 
diff --git a/third_party/WebKit/Source/core/core.gypi b/third_party/WebKit/Source/core/core.gypi
index 9bfe9d6..27aa462 100644
--- a/third_party/WebKit/Source/core/core.gypi
+++ b/third_party/WebKit/Source/core/core.gypi
@@ -1784,8 +1784,6 @@
             'imagebitmap/ImageBitmapFactories.h',
             'imagebitmap/ImageBitmapSource.cpp',
             'imagebitmap/ImageBitmapSource.h',
-            'inspector/AsyncCallTracker.cpp',
-            'inspector/AsyncCallTracker.h',
             'inspector/AsyncOperationMap.h',
             'inspector/ConsoleAPITypes.h',
             'inspector/ConsoleMessage.cpp',
diff --git a/third_party/WebKit/Source/core/css/CSSProperties.in b/third_party/WebKit/Source/core/css/CSSProperties.in
index 686b0be7..4dcb2ea 100644
--- a/third_party/WebKit/Source/core/css/CSSProperties.in
+++ b/third_party/WebKit/Source/core/css/CSSProperties.in
@@ -216,7 +216,7 @@
 height interpolable, initial=initialSize, converter=convertLengthSizing
 image-rendering inherited
 image-orientation runtime_flag=ImageOrientation, inherited, name_for_methods=RespectImageOrientation, converter=convertImageOrientation
-isolation runtime_flag=CSSCompositing
+isolation
 justify-content initial=initialContentAlignment, converter=convertContentAlignmentData
 justify-items runtime_flag=CSSGridLayout, initial=initialSelfAlignment, converter=convertSelfOrDefaultAlignmentData
 justify-self runtime_flag=CSSGridLayout, initial=initialSelfAlignment, converter=convertSelfOrDefaultAlignmentData
@@ -241,7 +241,7 @@
 max-width interpolable, initial=initialMaxSize, converter=convertLengthMaxSizing
 min-height interpolable, initial=initialMinSize, converter=convertLengthSizing
 min-width interpolable, initial=initialMinSize, converter=convertLengthSizing
-mix-blend-mode runtime_flag=CSSCompositing, type_name=blink::WebBlendMode, name_for_methods=BlendMode
+mix-blend-mode type_name=blink::WebBlendMode, name_for_methods=BlendMode
 motion-offset interpolable, converter=convertLength
 motion-path converter=convertPathOrNone
 motion-rotation interpolable, converter=convertMotionRotation
diff --git a/third_party/WebKit/Source/core/css/mediaControls.css b/third_party/WebKit/Source/core/css/mediaControls.css
index 595baf18..f958d37 100644
--- a/third_party/WebKit/Source/core/css/mediaControls.css
+++ b/third_party/WebKit/Source/core/css/mediaControls.css
@@ -87,15 +87,6 @@
     transition: opacity 0.3s;
 }
 
-video:-webkit-full-page-media {
-    margin: auto;
-    position: absolute;
-    top: 0;
-    right: 0;
-    bottom: 0;
-    left: 0;
-}
-
 audio:-webkit-full-page-media, video:-webkit-full-page-media {
     max-height: 100%;
     max-width: 100%;
diff --git a/third_party/WebKit/Source/core/css/mediaControlsNew.css b/third_party/WebKit/Source/core/css/mediaControlsNew.css
index 8b82dbf3..ca78a3f3 100644
--- a/third_party/WebKit/Source/core/css/mediaControlsNew.css
+++ b/third_party/WebKit/Source/core/css/mediaControlsNew.css
@@ -86,15 +86,6 @@
     font-style: normal;
 }
 
-video:-webkit-full-page-media {
-    margin: auto;
-    position: absolute;
-    top: 0;
-    right: 0;
-    bottom: 0;
-    left: 0;
-}
-
 audio:-webkit-full-page-media, video:-webkit-full-page-media {
     max-height: 100%;
     max-width: 100%;
diff --git a/third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp b/third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp
index 708f4e2..4eb704a 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp
@@ -537,7 +537,6 @@
     case CSSPropertyImageRendering: // auto | optimizeContrast | pixelated
         return valueID == CSSValueAuto || valueID == CSSValueWebkitOptimizeContrast || (RuntimeEnabledFeatures::imageRenderingPixelatedEnabled() && valueID == CSSValuePixelated);
     case CSSPropertyIsolation: // auto | isolate
-        ASSERT(RuntimeEnabledFeatures::cssCompositingEnabled());
         return valueID == CSSValueAuto || valueID == CSSValueIsolate;
     case CSSPropertyListStylePosition: // inside | outside
         return valueID == CSSValueInside || valueID == CSSValueOutside;
@@ -627,7 +626,6 @@
     case CSSPropertyBackfaceVisibility:
         return valueID == CSSValueVisible || valueID == CSSValueHidden;
     case CSSPropertyMixBlendMode:
-        ASSERT(RuntimeEnabledFeatures::cssCompositingEnabled());
         return valueID == CSSValueNormal || valueID == CSSValueMultiply || valueID == CSSValueScreen || valueID == CSSValueOverlay
             || valueID == CSSValueDarken || valueID == CSSValueLighten || valueID == CSSValueColorDodge || valueID == CSSValueColorBurn
             || valueID == CSSValueHardLight || valueID == CSSValueSoftLight || valueID == CSSValueDifference || valueID == CSSValueExclusion
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp b/third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp
index 3a4e97e..5c569fcb 100644
--- a/third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp
+++ b/third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp
@@ -139,11 +139,9 @@
         case CSSPropertyBackdropFilter:
         case CSSPropertyZIndex:
         case CSSPropertyPosition:
-            return true;
         case CSSPropertyMixBlendMode:
         case CSSPropertyIsolation:
-            if (RuntimeEnabledFeatures::cssCompositingEnabled())
-                return true;
+            return true;
             break;
         default:
             break;
diff --git a/third_party/WebKit/Source/core/dom/FrameRequestCallbackCollection.cpp b/third_party/WebKit/Source/core/dom/FrameRequestCallbackCollection.cpp
index e6f451f..94afac1 100644
--- a/third_party/WebKit/Source/core/dom/FrameRequestCallbackCollection.cpp
+++ b/third_party/WebKit/Source/core/dom/FrameRequestCallbackCollection.cpp
@@ -24,6 +24,7 @@
 
     TRACE_EVENT_INSTANT1("devtools.timeline", "RequestAnimationFrame", TRACE_EVENT_SCOPE_THREAD, "data", InspectorAnimationFrameEvent::data(m_context, id));
     InspectorInstrumentation::didRequestAnimationFrame(m_context, id);
+    InspectorInstrumentation::asyncTaskScheduled(m_context, "requestAnimationFrame", callback);
 
     return id;
 }
@@ -32,6 +33,7 @@
 {
     for (size_t i = 0; i < m_callbacks.size(); ++i) {
         if (m_callbacks[i]->m_id == id) {
+            InspectorInstrumentation::asyncTaskCanceled(m_context, m_callbacks[i]);
             m_callbacks.remove(i);
             TRACE_EVENT_INSTANT1("devtools.timeline", "CancelAnimationFrame", TRACE_EVENT_SCOPE_THREAD, "data", InspectorAnimationFrameEvent::data(m_context, id));
             InspectorInstrumentation::didCancelAnimationFrame(m_context, id);
@@ -40,6 +42,7 @@
     }
     for (size_t i = 0; i < m_callbacksToInvoke.size(); ++i) {
         if (m_callbacksToInvoke[i]->m_id == id) {
+            InspectorInstrumentation::asyncTaskCanceled(m_context, m_callbacksToInvoke[i]);
             TRACE_EVENT_INSTANT1("devtools.timeline", "CancelAnimationFrame", TRACE_EVENT_SCOPE_THREAD, "data", InspectorAnimationFrameEvent::data(m_context, id));
             InspectorInstrumentation::didCancelAnimationFrame(m_context, id);
             m_callbacksToInvoke[i]->m_cancelled = true;
@@ -60,12 +63,11 @@
         FrameRequestCallback* callback = m_callbacksToInvoke[i].get();
         if (!callback->m_cancelled) {
             TRACE_EVENT1("devtools.timeline", "FireAnimationFrame", "data", InspectorAnimationFrameEvent::data(m_context, callback->m_id));
-            InspectorInstrumentationCookie cookie = InspectorInstrumentation::willFireAnimationFrame(m_context, callback->m_id);
+            InspectorInstrumentation::AsyncTask asyncTask(m_context, callback);
             if (callback->m_useLegacyTimeBase)
                 callback->handleEvent(highResNowMsLegacy);
             else
                 callback->handleEvent(highResNowMs);
-            InspectorInstrumentation::didFireAnimationFrame(cookie);
             TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "UpdateCounters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data());
         }
     }
diff --git a/third_party/WebKit/Source/core/dom/MainThreadTaskRunner.cpp b/third_party/WebKit/Source/core/dom/MainThreadTaskRunner.cpp
index eeb2e78..9866e72a 100644
--- a/third_party/WebKit/Source/core/dom/MainThreadTaskRunner.cpp
+++ b/third_party/WebKit/Source/core/dom/MainThreadTaskRunner.cpp
@@ -70,7 +70,7 @@
 void MainThreadTaskRunner::postTask(const WebTraceLocation& location, PassOwnPtr<ExecutionContextTask> task)
 {
     if (!task->taskNameForInstrumentation().isEmpty())
-        InspectorInstrumentation::didPostExecutionContextTask(m_context, task.get());
+        InspectorInstrumentation::asyncTaskScheduled(m_context, task->taskNameForInstrumentation(), task.get());
     postTaskInternal(location, task, false);
 }
 
@@ -86,12 +86,8 @@
         return;
     }
 
-    const bool instrumenting = !isInspectorTask && !task->taskNameForInstrumentation().isEmpty();
-    if (instrumenting)
-        InspectorInstrumentation::willPerformExecutionContextTask(m_context, task.get());
+    InspectorInstrumentation::AsyncTask asyncTask(m_context, task.get(), !isInspectorTask);
     task->performTask(m_context);
-    if (instrumenting)
-        InspectorInstrumentation::didPerformExecutionContextTask(m_context);
 }
 
 void MainThreadTaskRunner::suspend()
@@ -116,11 +112,8 @@
         OwnPtr<ExecutionContextTask> task = m_pendingTasks[0].release();
         m_pendingTasks.remove(0);
         const bool instrumenting = !task->taskNameForInstrumentation().isEmpty();
-        if (instrumenting)
-            InspectorInstrumentation::willPerformExecutionContextTask(m_context, task.get());
+        InspectorInstrumentation::AsyncTask asyncTask(m_context, task.get(), instrumenting);
         task->performTask(m_context);
-        if (instrumenting)
-            InspectorInstrumentation::didPerformExecutionContextTask(m_context);
     }
 }
 
diff --git a/third_party/WebKit/Source/core/dom/MutationObserver.cpp b/third_party/WebKit/Source/core/dom/MutationObserver.cpp
index 7b233e00..66d217c 100644
--- a/third_party/WebKit/Source/core/dom/MutationObserver.cpp
+++ b/third_party/WebKit/Source/core/dom/MutationObserver.cpp
@@ -69,8 +69,7 @@
 #if !ENABLE(OILPAN)
     ASSERT(m_registrations.isEmpty());
 #endif
-    if (!m_records.isEmpty())
-        InspectorInstrumentation::didClearAllMutationRecords(m_callback->getExecutionContext(), this);
+    cancelInspectorAsyncTasks();
 }
 
 void MutationObserver::observe(Node* node, const MutationObserverInit& observerInit, ExceptionState& exceptionState)
@@ -133,15 +132,15 @@
 MutationRecordVector MutationObserver::takeRecords()
 {
     MutationRecordVector records;
+    cancelInspectorAsyncTasks();
     records.swap(m_records);
-    InspectorInstrumentation::didClearAllMutationRecords(m_callback->getExecutionContext(), this);
     return records;
 }
 
 void MutationObserver::disconnect()
 {
+    cancelInspectorAsyncTasks();
     m_records.clear();
-    InspectorInstrumentation::didClearAllMutationRecords(m_callback->getExecutionContext(), this);
     MutationObserverRegistrationSet registrations(m_registrations);
     for (auto& registration : registrations) {
         // The registration may be already unregistered while iteration.
@@ -189,7 +188,7 @@
     ASSERT(isMainThread());
     m_records.append(mutation);
     activateObserver(this);
-    InspectorInstrumentation::didEnqueueMutationRecord(m_callback->getExecutionContext(), this);
+    InspectorInstrumentation::asyncTaskScheduled(m_callback->getExecutionContext(), mutation->type(), mutation);
 }
 
 void MutationObserver::setHasTransientRegistration()
@@ -211,6 +210,12 @@
     return m_callback->getExecutionContext() && m_callback->getExecutionContext()->activeDOMObjectsAreSuspended();
 }
 
+void MutationObserver::cancelInspectorAsyncTasks()
+{
+    for (auto& record : m_records)
+        InspectorInstrumentation::asyncTaskCanceled(m_callback->getExecutionContext(), record);
+}
+
 void MutationObserver::deliver()
 {
     ASSERT(!shouldBeSuspended());
@@ -231,9 +236,9 @@
     MutationRecordVector records;
     records.swap(m_records);
 
-    InspectorInstrumentation::willDeliverMutationRecords(m_callback->getExecutionContext(), this);
+    // Report the first (earliest) stack as the async cause.
+    InspectorInstrumentation::AsyncTask asyncTask(m_callback->getExecutionContext(), records.first());
     m_callback->call(records, this);
-    InspectorInstrumentation::didDeliverMutationRecords(m_callback->getExecutionContext());
 }
 
 void MutationObserver::resumeSuspendedObservers()
diff --git a/third_party/WebKit/Source/core/dom/MutationObserver.h b/third_party/WebKit/Source/core/dom/MutationObserver.h
index 347692c..86585e1 100644
--- a/third_party/WebKit/Source/core/dom/MutationObserver.h
+++ b/third_party/WebKit/Source/core/dom/MutationObserver.h
@@ -101,6 +101,7 @@
     explicit MutationObserver(RawPtr<MutationCallback>);
     void deliver();
     bool shouldBeSuspended() const;
+    void cancelInspectorAsyncTasks();
 
     Member<MutationCallback> m_callback;
     MutationRecordVector m_records;
diff --git a/third_party/WebKit/Source/core/dom/Range.cpp b/third_party/WebKit/Source/core/dom/Range.cpp
index 60ddc57..8fa8dca5 100644
--- a/third_party/WebKit/Source/core/dom/Range.cpp
+++ b/third_party/WebKit/Source/core/dom/Range.cpp
@@ -46,7 +46,6 @@
 #include "core/layout/LayoutText.h"
 #include "core/svg/SVGSVGElement.h"
 #include "platform/geometry/FloatQuad.h"
-#include "wtf/RefCountedLeakCounter.h"
 #include "wtf/text/CString.h"
 #include "wtf/text/StringBuilder.h"
 #ifndef NDEBUG
@@ -54,25 +53,12 @@
 #endif
 
 namespace blink {
-namespace {
-#ifndef NDEBUG
-WTF::RefCountedLeakCounter& rangeCounter()
-{
-    DEFINE_STATIC_LOCAL(WTF::RefCountedLeakCounter, staticRangeCounter, ("Range"));
-    return staticRangeCounter;
-}
-#endif
-} // namespace
 
 inline Range::Range(Document& ownerDocument)
     : m_ownerDocument(&ownerDocument)
     , m_start(m_ownerDocument)
     , m_end(m_ownerDocument)
 {
-#ifndef NDEBUG
-    rangeCounter().increment();
-#endif
-
     m_ownerDocument->attachRange(this);
 }
 
@@ -86,10 +72,6 @@
     , m_start(m_ownerDocument)
     , m_end(m_ownerDocument)
 {
-#ifndef NDEBUG
-    rangeCounter().increment();
-#endif
-
     m_ownerDocument->attachRange(this);
 
     // Simply setting the containers and offsets directly would not do any of the checking
@@ -127,20 +109,6 @@
     return Range::create(treeScope.document(), container, offset, container, offset);
 }
 
-#if !ENABLE(OILPAN) || !defined(NDEBUG)
-Range::~Range()
-{
-#if !ENABLE(OILPAN)
-    // Always detach (even if we've already detached) to fix https://bugs.webkit.org/show_bug.cgi?id=26044
-    m_ownerDocument->detachRange(this);
-#endif
-
-#ifndef NDEBUG
-    rangeCounter().decrement();
-#endif
-}
-#endif
-
 void Range::dispose()
 {
 #if ENABLE(OILPAN)
diff --git a/third_party/WebKit/Source/core/dom/Range.h b/third_party/WebKit/Source/core/dom/Range.h
index 9dafd6d..9619fff 100644
--- a/third_party/WebKit/Source/core/dom/Range.h
+++ b/third_party/WebKit/Source/core/dom/Range.h
@@ -48,22 +48,14 @@
 class NodeWithIndex;
 class Text;
 
-class CORE_EXPORT Range final
-#ifndef NDEBUG
-    : public GarbageCollectedFinalized<Range>
-#else
-    : public GarbageCollected<Range>
-#endif
-    , public ScriptWrappable {
+class CORE_EXPORT Range final : public GarbageCollected<Range>, public ScriptWrappable {
     DEFINE_WRAPPERTYPEINFO();
 public:
     static RawPtr<Range> create(Document&);
     static RawPtr<Range> create(Document&, Node* startContainer, int startOffset, Node* endContainer, int endOffset);
     static RawPtr<Range> create(Document&, const Position&, const Position&);
     static RawPtr<Range> createAdjustedToTreeScope(const TreeScope&, const Position&);
-#if !ENABLE(OILPAN) || !defined(NDEBUG)
-    ~Range();
-#endif
+
     void dispose();
 
     Document& ownerDocument() const { ASSERT(m_ownerDocument); return *m_ownerDocument.get(); }
diff --git a/third_party/WebKit/Source/core/dom/ScriptedAnimationController.cpp b/third_party/WebKit/Source/core/dom/ScriptedAnimationController.cpp
index 989f2ff6..94d0ad9 100644
--- a/third_party/WebKit/Source/core/dom/ScriptedAnimationController.cpp
+++ b/third_party/WebKit/Source/core/dom/ScriptedAnimationController.cpp
@@ -116,12 +116,11 @@
         // FIXME: we should figure out how to make dispatchEvent properly virtual to avoid
         // special casting window.
         // FIXME: We should not fire events for nodes that are no longer in the tree.
+        InspectorInstrumentation::AsyncTask asyncTask(eventTarget->getExecutionContext(), events[i]);
         if (LocalDOMWindow* window = eventTarget->toDOMWindow())
             window->dispatchEvent(events[i], nullptr);
         else
             eventTarget->dispatchEvent(events[i]);
-
-        InspectorInstrumentation::didRemoveEvent(eventTarget, events[i].get());
     }
 }
 
@@ -170,7 +169,7 @@
 
 void ScriptedAnimationController::enqueueEvent(Event* event)
 {
-    InspectorInstrumentation::didEnqueueEvent(event->target(), event);
+    InspectorInstrumentation::asyncTaskScheduled(event->target()->getExecutionContext(), event->type(), event);
     m_eventQueue.append(event);
     scheduleAnimationIfNeeded();
 }
diff --git a/third_party/WebKit/Source/core/dom/StyleSheetCandidate.cpp b/third_party/WebKit/Source/core/dom/StyleSheetCandidate.cpp
index f4e5551a..d49bb546 100644
--- a/third_party/WebKit/Source/core/dom/StyleSheetCandidate.cpp
+++ b/third_party/WebKit/Source/core/dom/StyleSheetCandidate.cpp
@@ -79,7 +79,11 @@
 
 bool StyleSheetCandidate::isEnabledAndLoading() const
 {
-    return isHTMLLink() && !toHTMLLinkElement(node()).isDisabled() && toHTMLLinkElement(node()).styleSheetIsLoading();
+    if (isHTMLLink())
+        return !toHTMLLinkElement(node()).isDisabled() && toHTMLLinkElement(node()).styleSheetIsLoading();
+
+    StyleSheet* sheet = this->sheet();
+    return sheet && !sheet->disabled() && sheet->isLoading();
 }
 
 bool StyleSheetCandidate::hasPreferrableName() const
diff --git a/third_party/WebKit/Source/core/dom/ViewportDescription.cpp b/third_party/WebKit/Source/core/dom/ViewportDescription.cpp
index d453242b..8fd6d241 100644
--- a/third_party/WebKit/Source/core/dom/ViewportDescription.cpp
+++ b/third_party/WebKit/Source/core/dom/ViewportDescription.cpp
@@ -256,7 +256,9 @@
 
 bool ViewportDescription::matchesHeuristicsForGpuRasterization() const
 {
-    return isSpecifiedByAuthor();
+    return maxWidth == Length(DeviceWidth)
+        && minZoom == 1.0
+        && minZoomIsExplicit;
 }
 
 } // namespace blink
diff --git a/third_party/WebKit/Source/core/editing/FrameSelection.cpp b/third_party/WebKit/Source/core/editing/FrameSelection.cpp
index c9b36bd..a47d7c5 100644
--- a/third_party/WebKit/Source/core/editing/FrameSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/FrameSelection.cpp
@@ -66,7 +66,7 @@
 #include "core/layout/HitTestResult.h"
 #include "core/layout/LayoutPart.h"
 #include "core/layout/LayoutTheme.h"
-#include "core/layout/LayoutView.h"
+#include "core/layout/api/LayoutViewItem.h"
 #include "core/loader/DocumentLoader.h"
 #include "core/page/EditorClient.h"
 #include "core/page/FocusController.h"
@@ -1024,8 +1024,7 @@
         setCaretRectNeedsUpdate();
     }
 
-    LayoutView* view = m_frame->contentLayoutObject();
-    if (!view)
+    if (m_frame->contentLayoutItem().isNull())
         return;
     m_pendingSelection->setHasPendingSelection();
 }
@@ -1168,13 +1167,13 @@
 LayoutRect FrameSelection::unclippedBounds() const
 {
     FrameView* view = m_frame->view();
-    LayoutView* layoutView = m_frame->contentLayoutObject();
+    LayoutViewItem layoutView = m_frame->contentLayoutItem();
 
-    if (!view || !layoutView)
+    if (!view || layoutView.isNull())
         return LayoutRect();
 
     view->updateLifecycleToLayoutClean();
-    return LayoutRect(layoutView->selectionBounds());
+    return LayoutRect(layoutView.selectionBounds());
 }
 
 static inline HTMLFormElement* associatedFormElement(HTMLElement& element)
diff --git a/third_party/WebKit/Source/core/events/DOMWindowEventQueue.cpp b/third_party/WebKit/Source/core/events/DOMWindowEventQueue.cpp
index ecda176e..2a39790 100644
--- a/third_party/WebKit/Source/core/events/DOMWindowEventQueue.cpp
+++ b/third_party/WebKit/Source/core/events/DOMWindowEventQueue.cpp
@@ -87,7 +87,7 @@
         return false;
 
     ASSERT(event->target());
-    InspectorInstrumentation::didEnqueueEvent(event->target(), event);
+    InspectorInstrumentation::asyncTaskScheduled(event->target()->getExecutionContext(), event->type(), event);
 
     bool wasAdded = m_queuedEvents.add(event).isNewEntry;
     ASSERT_UNUSED(wasAdded, wasAdded); // It should not have already been in the list.
@@ -103,7 +103,7 @@
     HeapListHashSet<Member<Event>, 16>::iterator it = m_queuedEvents.find(event);
     bool found = it != m_queuedEvents.end();
     if (found) {
-        InspectorInstrumentation::didRemoveEvent(event->target(), event);
+        InspectorInstrumentation::asyncTaskCanceled(event->target()->getExecutionContext(), event);
         m_queuedEvents.remove(it);
     }
     if (m_queuedEvents.isEmpty())
@@ -117,9 +117,8 @@
     m_pendingEventTimer->stop();
     if (InspectorInstrumentation::hasFrontends()) {
         for (const auto& queuedEvent : m_queuedEvents) {
-            Event* event = queuedEvent;
-            if (event)
-                InspectorInstrumentation::didRemoveEvent(event->target(), event);
+            if (queuedEvent)
+                InspectorInstrumentation::asyncTaskCanceled(queuedEvent->target()->getExecutionContext(), queuedEvent);
         }
     }
     m_queuedEvents.clear();
@@ -142,13 +141,13 @@
         if (!event)
             break;
         dispatchEvent(event);
-        InspectorInstrumentation::didRemoveEvent(event->target(), event);
     }
 }
 
 void DOMWindowEventQueue::dispatchEvent(Event* event)
 {
     EventTarget* eventTarget = event->target();
+    InspectorInstrumentation::AsyncTask asyncTask(eventTarget->getExecutionContext(), event);
     if (eventTarget->toDOMWindow())
         eventTarget->toDOMWindow()->dispatchEvent(event, nullptr);
     else
diff --git a/third_party/WebKit/Source/core/events/GenericEventQueue.cpp b/third_party/WebKit/Source/core/events/GenericEventQueue.cpp
index f6298b4..f32e9e6 100644
--- a/third_party/WebKit/Source/core/events/GenericEventQueue.cpp
+++ b/third_party/WebKit/Source/core/events/GenericEventQueue.cpp
@@ -63,7 +63,8 @@
         event->setTarget(nullptr);
 
     TRACE_EVENT_ASYNC_BEGIN1("event", "GenericEventQueue:enqueueEvent", event, "type", event->type().ascii());
-    InspectorInstrumentation::didEnqueueEvent(event->target() ? event->target() : m_owner.get(), event);
+    EventTarget* target = event->target() ? event->target() : m_owner.get();
+    InspectorInstrumentation::asyncTaskScheduled(target->getExecutionContext(), event->type(), event);
     m_pendingEvents.append(event);
 
     if (!m_timer.isActive())
@@ -77,7 +78,8 @@
     bool found = m_pendingEvents.contains(event);
 
     if (found) {
-        InspectorInstrumentation::didRemoveEvent(event->target() ? event->target() : m_owner.get(), event);
+        EventTarget* target = event->target() ? event->target() : m_owner.get();
+        InspectorInstrumentation::asyncTaskCanceled(target->getExecutionContext(), event);
         m_pendingEvents.remove(m_pendingEvents.find(event));
         TRACE_EVENT_ASYNC_END2("event", "GenericEventQueue:enqueueEvent", event, "type", event->type().ascii(), "status", "cancelled");
     }
@@ -100,10 +102,10 @@
         Event* event = pendingEvent.get();
         EventTarget* target = event->target() ? event->target() : m_owner.get();
         CString type(event->type().ascii());
+        InspectorInstrumentation::AsyncTask asyncTask(target->getExecutionContext(), event);
         TRACE_EVENT_ASYNC_STEP_INTO1("event", "GenericEventQueue:enqueueEvent", event, "dispatch", "type", type);
         target->dispatchEvent(pendingEvent);
         TRACE_EVENT_ASYNC_END1("event", "GenericEventQueue:enqueueEvent", event, "type", type);
-        InspectorInstrumentation::didRemoveEvent(target, event);
     }
 }
 
@@ -120,7 +122,8 @@
     for (const auto& pendingEvent : m_pendingEvents) {
         Event* event = pendingEvent.get();
         TRACE_EVENT_ASYNC_END2("event", "GenericEventQueue:enqueueEvent", event, "type", event->type().ascii(), "status", "cancelled");
-        InspectorInstrumentation::didRemoveEvent(event->target() ? event->target() : m_owner.get(), event);
+        EventTarget* target = event->target() ? event->target() : m_owner.get();
+        InspectorInstrumentation::asyncTaskCanceled(target->getExecutionContext(), event);
     }
     m_pendingEvents.clear();
 }
diff --git a/third_party/WebKit/Source/core/fetch/MemoryCache.cpp b/third_party/WebKit/Source/core/fetch/MemoryCache.cpp
index 97e29fb..0cd1ee5 100644
--- a/third_party/WebKit/Source/core/fetch/MemoryCache.cpp
+++ b/third_party/WebKit/Source/core/fetch/MemoryCache.cpp
@@ -158,8 +158,9 @@
     ASSERT(WTF::isMainThread());
     ASSERT(resource->url().isValid());
     ResourceMap* resources = ensureResourceMap(resource->cacheIdentifier());
-    RELEASE_ASSERT(!resources->contains(resource->url()));
-    resources->set(resource->url(), MemoryCacheEntry::create(resource));
+    KURL url = removeFragmentIdentifierIfNeeded(resource->url());
+    RELEASE_ASSERT(!resources->contains(url));
+    resources->set(url, MemoryCacheEntry::create(resource));
     update(resource, 0, resource->size(), true);
 
     WTF_LOG(ResourceLoading, "MemoryCache::add Added '%s', resource %p\n", resource->url().getString().latin1().data(), resource);
@@ -373,7 +374,8 @@
 
     ResourceMap* resources = m_resourceMaps.get(resource->cacheIdentifier());
     ASSERT(resources);
-    ResourceMap::iterator it = resources->find(resource->url());
+    KURL url = removeFragmentIdentifierIfNeeded(resource->url());
+    ResourceMap::iterator it = resources->find(url);
     ASSERT(it != resources->end());
 
     MemoryCacheEntry* entryPtr = it->value;
@@ -389,7 +391,8 @@
     ResourceMap* resources = m_resourceMaps.get(resource->cacheIdentifier());
     if (!resources)
         return nullptr;
-    MemoryCacheEntry* entry = resources->get(resource->url());
+    KURL url = removeFragmentIdentifierIfNeeded(resource->url());
+    MemoryCacheEntry* entry = resources->get(url);
     if (!entry || entry->m_resource != resource)
         return nullptr;
     return entry;
diff --git a/third_party/WebKit/Source/core/fetch/MemoryCache.h b/third_party/WebKit/Source/core/fetch/MemoryCache.h
index a1558b0..529a081 100644
--- a/third_party/WebKit/Source/core/fetch/MemoryCache.h
+++ b/third_party/WebKit/Source/core/fetch/MemoryCache.h
@@ -291,6 +291,7 @@
 
     // A URL-based map of all resources that are in the cache (including the freshest version of objects that are currently being
     // referenced by a Web page).
+    // removeFragmentIdentifierIfNeeded() should be called for the url before using it as a key for the map.
     using ResourceMap = HeapHashMap<String, Member<MemoryCacheEntry>>;
     using ResourceMapIndex = HeapHashMap<String, Member<ResourceMap>>;
     ResourceMap* ensureResourceMap(const String& cacheIdentifier);
diff --git a/third_party/WebKit/Source/core/fetch/Resource.cpp b/third_party/WebKit/Source/core/fetch/Resource.cpp
index 01ff5b9..aa6e1f8 100644
--- a/third_party/WebKit/Source/core/fetch/Resource.cpp
+++ b/third_party/WebKit/Source/core/fetch/Resource.cpp
@@ -236,14 +236,6 @@
     // Currently we support the metadata caching only for HTTP family.
     if (m_resourceRequest.url().protocolIsInHTTPFamily())
         m_cacheHandler = CacheHandler::create(this);
-
-    if (!m_resourceRequest.url().hasFragmentIdentifier())
-        return;
-    KURL urlForCache = MemoryCache::removeFragmentIdentifierIfNeeded(m_resourceRequest.url());
-    if (urlForCache.hasFragmentIdentifier())
-        return;
-    m_fragmentIdentifierForRequest = m_resourceRequest.url().fragmentIdentifier();
-    m_resourceRequest.setURL(urlForCache);
 }
 
 Resource::~Resource()
@@ -268,26 +260,17 @@
     m_status = Pending;
 
     ResourceRequest& request(m_revalidatingRequest.isNull() ? m_resourceRequest : m_revalidatingRequest);
+    KURL url = request.url();
     if (!accept().isEmpty())
         request.setHTTPAccept(accept());
     request.setAllowStoredCredentials(m_options.allowCredentials == AllowStoredCredentials);
 
-    // FIXME: It's unfortunate that the cache layer and below get to know anything about fragment identifiers.
-    // We should look into removing the expectation of that knowledge from the platform network stacks.
-    KURL urlWithoutFragment = request.url();
-    if (!m_fragmentIdentifierForRequest.isNull()) {
-        KURL url = request.url();
-        url.setFragmentIdentifier(m_fragmentIdentifierForRequest);
-        request.setURL(url);
-        m_fragmentIdentifierForRequest = String();
-    }
-
     m_loader = ResourceLoader::create(fetcher, this);
     m_loader->start(request);
     // If the request reference is null (i.e., a synchronous revalidation will
     // null the request), don't make the request non-null by setting the url.
     if (!request.isNull())
-        request.setURL(urlWithoutFragment);
+        request.setURL(url);
 }
 
 void Resource::checkNotify()
diff --git a/third_party/WebKit/Source/core/fetch/Resource.h b/third_party/WebKit/Source/core/fetch/Resource.h
index dd830561..c216902 100644
--- a/third_party/WebKit/Source/core/fetch/Resource.h
+++ b/third_party/WebKit/Source/core/fetch/Resource.h
@@ -120,6 +120,7 @@
 
     void setRevalidatingRequest(const ResourceRequest& request) { m_revalidatingRequest = request; }
 
+    // This url can have a fragment, but it can match resources that differ by the fragment only.
     const KURL& url() const { return m_resourceRequest.url();}
     Type getType() const { return static_cast<Type>(m_type); }
     const ResourceLoaderOptions& options() const { return m_options; }
@@ -325,8 +326,6 @@
     void clearCachedMetadata(CachedMetadataHandler::CacheType);
     CachedMetadata* cachedMetadata(unsigned dataTypeID) const;
 
-    String m_fragmentIdentifierForRequest;
-
 #if !ENABLE(OILPAN)
     WeakPtrFactory<Resource> m_weakPtrFactory;
 #endif
diff --git a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
index fe275e2..27db48b 100644
--- a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
+++ b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
@@ -405,17 +405,15 @@
     context().addCSPHeaderIfNecessary(factory.type(), request);
 
     KURL url = request.resourceRequest().url();
+    KURL urlWithoutFragment = MemoryCache::removeFragmentIdentifierIfNeeded(url);
     TRACE_EVENT1("blink", "ResourceFetcher::requestResource", "url", urlForTraceEvent(url));
 
     WTF_LOG(ResourceLoading, "ResourceFetcher::requestResource '%s', charset '%s', priority=%d, forPreload=%u, type=%s", url.elidedString().latin1().data(), request.charset().latin1().data(), request.priority(), request.forPreload(), Resource::resourceTypeName(factory.type()));
 
-    // If only the fragment identifiers differ, it is the same resource.
-    url = MemoryCache::removeFragmentIdentifierIfNeeded(url);
-
     if (!url.isValid())
         return nullptr;
 
-    if (!context().canRequest(factory.type(), request.resourceRequest(), url, request.options(), request.forPreload(), request.getOriginRestriction()))
+    if (!context().canRequest(factory.type(), request.resourceRequest(), urlWithoutFragment, request.options(), request.forPreload(), request.getOriginRestriction()))
         return nullptr;
 
     if (!request.forPreload()) {
@@ -487,9 +485,10 @@
             resource->didChangePriority(priority, 0);
     }
 
-    ASSERT(resource->url() == url.getString());
+    // If only the fragment identifiers differ, it is the same resource.
+    ASSERT(equalIgnoringFragmentIdentifier(resource->url(), url));
     requestLoadStarted(resource, request, policy == Use ? ResourceLoadingFromCache : ResourceLoadingFromNetwork, isStaticData);
-    m_documentResources.set(resource->url(), resource->asWeakPtr());
+    m_documentResources.set(urlWithoutFragment, resource->asWeakPtr());
 
     if (!resourceNeedsLoad(resource, request, policy))
         return resource;
diff --git a/third_party/WebKit/Source/core/fileapi/FileReader.cpp b/third_party/WebKit/Source/core/fileapi/FileReader.cpp
index 3b455487..1caaa44 100644
--- a/third_party/WebKit/Source/core/fileapi/FileReader.cpp
+++ b/third_party/WebKit/Source/core/fileapi/FileReader.cpp
@@ -97,7 +97,7 @@
         if (!controller)
             return;
 
-        reader->m_asyncOperationId = InspectorInstrumentation::traceAsyncOperationStarting(context, "FileReader");
+        InspectorInstrumentation::asyncTaskScheduled(context, "FileReader", reader, true);
         controller->pushReader(reader);
     }
 
@@ -112,13 +112,12 @@
 
     static void finishReader(ExecutionContext* context, FileReader* reader, FinishReaderType nextStep)
     {
-        InspectorInstrumentation::traceAsyncOperationCompleted(context, reader->m_asyncOperationId);
-
         ThrottlingController* controller = from(context);
         if (!controller)
             return;
 
         controller->finishReader(reader, nextStep);
+        InspectorInstrumentation::asyncTaskCanceled(context, reader);
     }
 
     DEFINE_INLINE_TRACE()
@@ -206,7 +205,6 @@
     , m_loadingState(LoadingStateNone)
     , m_readType(FileReaderLoader::ReadAsBinaryString)
     , m_lastProgressNotificationTimeMS(0)
-    , m_asyncOperationId(0)
 {
 }
 
@@ -451,10 +449,9 @@
 
 void FileReader::fireEvent(const AtomicString& type)
 {
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsyncCallbackStarting(getExecutionContext(), m_asyncOperationId);
+    InspectorInstrumentation::AsyncTask asyncTask(getExecutionContext(), this);
     if (!m_loader) {
         dispatchEvent(ProgressEvent::create(type, false, 0, 0));
-        InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
         return;
     }
 
@@ -462,8 +459,6 @@
         dispatchEvent(ProgressEvent::create(type, true, m_loader->bytesLoaded(), m_loader->totalBytes()));
     else
         dispatchEvent(ProgressEvent::create(type, false, m_loader->bytesLoaded(), 0));
-
-    InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
 }
 
 DEFINE_TRACE(FileReader)
diff --git a/third_party/WebKit/Source/core/fileapi/FileReader.h b/third_party/WebKit/Source/core/fileapi/FileReader.h
index b006f5f..a3bd1ff 100644
--- a/third_party/WebKit/Source/core/fileapi/FileReader.h
+++ b/third_party/WebKit/Source/core/fileapi/FileReader.h
@@ -134,7 +134,6 @@
     OwnPtr<FileReaderLoader> m_loader;
     Member<FileError> m_error;
     double m_lastProgressNotificationTimeMS;
-    int m_asyncOperationId;
 };
 
 } // namespace blink
diff --git a/third_party/WebKit/Source/core/frame/DOMTimer.cpp b/third_party/WebKit/Source/core/frame/DOMTimer.cpp
index 6eccc775..c1906114 100644
--- a/third_party/WebKit/Source/core/frame/DOMTimer.cpp
+++ b/third_party/WebKit/Source/core/frame/DOMTimer.cpp
@@ -76,6 +76,8 @@
     if (shouldForwardUserGesture(interval, m_nestingLevel))
         m_userGestureToken = UserGestureIndicator::currentToken();
 
+    InspectorInstrumentation::asyncTaskScheduled(context, singleShot ? "setTimeout" : "setInterval", this, !singleShot);
+
     double intervalMilliseconds = std::max(oneMillisecond, interval * oneMillisecond);
     if (intervalMilliseconds < minimumInterval && m_nestingLevel >= maxTimerNestingLevel)
         intervalMilliseconds = minimumInterval;
@@ -107,6 +109,7 @@
 
     TRACE_EVENT1("devtools.timeline", "TimerFire", "data", InspectorTimerFireEvent::data(context, m_timeoutID));
     InspectorInstrumentationCookie cookie = InspectorInstrumentation::willFireTimer(context, m_timeoutID);
+    InspectorInstrumentation::AsyncTask asyncTask(context, this);
 
     // Simple case for non-one-shot timers.
     if (isActive()) {
@@ -141,6 +144,7 @@
 
 void DOMTimer::stop()
 {
+    InspectorInstrumentation::asyncTaskCanceled(getExecutionContext(), this);
     SuspendableTimer::stop();
     // Need to release JS objects potentially protected by ScheduledAction
     // because they can form circular references back to the ExecutionContext
diff --git a/third_party/WebKit/Source/core/frame/Frame.cpp b/third_party/WebKit/Source/core/frame/Frame.cpp
index ebb92b8e..4cb5f44 100644
--- a/third_party/WebKit/Source/core/frame/Frame.cpp
+++ b/third_party/WebKit/Source/core/frame/Frame.cpp
@@ -44,7 +44,6 @@
 #include "core/page/FocusController.h"
 #include "core/page/Page.h"
 #include "wtf/PassOwnPtr.h"
-#include "wtf/RefCountedLeakCounter.h"
 
 namespace blink {
 
@@ -60,23 +59,12 @@
     return ++next;
 }
 
-#ifndef NDEBUG
-WTF::RefCountedLeakCounter& frameCounter()
-{
-    DEFINE_STATIC_LOCAL(WTF::RefCountedLeakCounter, staticFrameCounter, ("Frame"));
-    return staticFrameCounter;
-}
-#endif
-
 } // namespace
 
 Frame::~Frame()
 {
     InstanceCounters::decrementCounter(InstanceCounters::FrameCounter);
     ASSERT(!m_owner);
-#ifndef NDEBUG
-    frameCounter().decrement();
-#endif
 }
 
 DEFINE_TRACE(Frame)
@@ -304,10 +292,6 @@
 
     ASSERT(page());
 
-#ifndef NDEBUG
-    frameCounter().increment();
-#endif
-
     if (m_owner)
         m_owner->setContentFrame(*this);
     else
diff --git a/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp b/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp
index ff6ada9..a943a82 100644
--- a/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp
+++ b/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp
@@ -126,7 +126,7 @@
         , m_userGestureToken(userGestureToken)
         , m_disposalAllowed(true)
     {
-        m_asyncOperationId = InspectorInstrumentation::traceAsyncOperationStarting(getExecutionContext(), "postMessage");
+        InspectorInstrumentation::asyncTaskScheduled(window.document(), "postMessage", this);
     }
 
     MessageEvent* event() const { return m_event.get(); }
@@ -156,11 +156,10 @@
 private:
     void fired() override
     {
-        InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsyncOperationCompletedCallbackStarting(getExecutionContext(), m_asyncOperationId);
+        InspectorInstrumentation::AsyncTask asyncTask(m_window->document(), this);
         m_disposalAllowed = false;
         m_window->postMessageTimerFired(this);
         dispose();
-        InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
     }
 
     void dispose()
@@ -177,7 +176,6 @@
     RefPtr<SecurityOrigin> m_targetOrigin;
     RefPtr<ScriptCallStack> m_stackTrace;
     RefPtr<UserGestureToken> m_userGestureToken;
-    int m_asyncOperationId;
     bool m_disposalAllowed;
 };
 
diff --git a/third_party/WebKit/Source/core/html/HTMLPlugInElement.cpp b/third_party/WebKit/Source/core/html/HTMLPlugInElement.cpp
index 9e0614f..ada27e9 100644
--- a/third_party/WebKit/Source/core/html/HTMLPlugInElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLPlugInElement.cpp
@@ -606,8 +606,10 @@
 
 void HTMLPlugInElement::lazyReattachIfNeeded()
 {
-    if (!useFallbackContent() && needsWidgetUpdate() && layoutObject() && !isImageType())
+    if (!useFallbackContent() && needsWidgetUpdate() && layoutObject() && !isImageType()) {
         lazyReattachIfAttached();
+        setPersistedPluginWidget(nullptr);
+    }
 }
 
 } // namespace blink
diff --git a/third_party/WebKit/Source/core/html/HTMLTrackElement.h b/third_party/WebKit/Source/core/html/HTMLTrackElement.h
index 5485a97..e380d58e 100644
--- a/third_party/WebKit/Source/core/html/HTMLTrackElement.h
+++ b/third_party/WebKit/Source/core/html/HTMLTrackElement.h
@@ -38,6 +38,7 @@
 
 class HTMLTrackElement final : public HTMLElement, private TextTrackLoaderClient {
     DEFINE_WRAPPERTYPEINFO();
+    USING_GARBAGE_COLLECTED_MIXIN(HTMLTrackElement);
 public:
     DECLARE_NODE_FACTORY(HTMLTrackElement);
 
diff --git a/third_party/WebKit/Source/core/html/MediaDocument.cpp b/third_party/WebKit/Source/core/html/MediaDocument.cpp
index f5e4963..8a3652a 100644
--- a/third_party/WebKit/Source/core/html/MediaDocument.cpp
+++ b/third_party/WebKit/Source/core/html/MediaDocument.cpp
@@ -29,23 +29,46 @@
 #include "core/HTMLNames.h"
 #include "core/dom/ElementTraversal.h"
 #include "core/dom/RawDataDocumentParser.h"
+#include "core/dom/shadow/ShadowRoot.h"
+#include "core/events/Event.h"
+#include "core/events/EventListener.h"
 #include "core/events/KeyboardEvent.h"
 #include "core/frame/LocalFrame.h"
+#include "core/html/HTMLAnchorElement.h"
 #include "core/html/HTMLBodyElement.h"
+#include "core/html/HTMLContentElement.h"
+#include "core/html/HTMLDivElement.h"
 #include "core/html/HTMLHeadElement.h"
 #include "core/html/HTMLHtmlElement.h"
 #include "core/html/HTMLMetaElement.h"
 #include "core/html/HTMLSourceElement.h"
+#include "core/html/HTMLStyleElement.h"
 #include "core/html/HTMLVideoElement.h"
 #include "core/loader/DocumentLoader.h"
 #include "core/loader/FrameLoader.h"
 #include "core/loader/FrameLoaderClient.h"
+#include "platform/Histogram.h"
 #include "platform/KeyboardCodes.h"
+#include "platform/text/PlatformLocale.h"
 
 namespace blink {
 
 using namespace HTMLNames;
 
+// Enums used for UMA histogram.
+enum MediaDocumentDownloadButtonValue {
+    MediaDocumentDownloadButtonShown,
+    MediaDocumentDownloadButtonClicked,
+    // Only append new enums here.
+    MediaDocumentDownloadButtonMax
+};
+
+void recordDownloadMetric(MediaDocumentDownloadButtonValue value)
+{
+    DEFINE_STATIC_LOCAL(EnumerationHistogram, mediaDocumentDownloadButtonHistogram, ("Blink.MediaDocument.DownloadButton", MediaDocumentDownloadButtonMax));
+    mediaDocumentDownloadButtonHistogram.count(value);
+}
+
 // FIXME: Share more code with PluginDocumentParser.
 class MediaDocumentParser : public RawDataDocumentParser {
 public:
@@ -68,6 +91,36 @@
     bool m_didBuildDocumentStructure;
 };
 
+class MediaDownloadEventListener final : public EventListener {
+public:
+    static RawPtr<MediaDownloadEventListener> create()
+    {
+        return new MediaDownloadEventListener();
+    }
+
+    bool operator==(const EventListener& other) const override
+    {
+        return this == &other;
+    }
+
+private:
+    MediaDownloadEventListener()
+        : EventListener(CPPEventListenerType)
+        , m_clicked(false)
+    {
+    }
+
+    void handleEvent(ExecutionContext* context, Event* event) override
+    {
+        if (!m_clicked) {
+            recordDownloadMetric(MediaDocumentDownloadButtonClicked);
+            m_clicked = true;
+        }
+    }
+
+    bool m_clicked;
+};
+
 void MediaDocumentParser::createDocumentStructure()
 {
     ASSERT(document());
@@ -100,8 +153,63 @@
     media->appendChild(source.release());
 
     RawPtr<HTMLBodyElement> body = HTMLBodyElement::create(*document());
-    body->appendChild(media.release());
+    body->setAttribute(styleAttr, "margin: 0px;");
 
+    RawPtr<HTMLDivElement> div = HTMLDivElement::create(*document());
+    // Style sheets for media controls are lazily loaded until a media element is encountered.
+    // As a result, elements encountered before the media element will not get the right
+    // style at first if we put the styles in mediacontrols.css. To solve this issue, set the
+    // styles inline so that they will be applied when the page loads.
+    // See w3c example on how to centering an element: https://www.w3.org/Style/Examples/007/center.en.html
+    div->setAttribute(styleAttr,
+        "display: flex;"
+        "flex-direction: column;"
+        "justify-content: center;"
+        "align-items: center;"
+        "min-height: min-content;"
+        "height: 100%;");
+    RawPtr<HTMLContentElement> content = HTMLContentElement::create(*document());
+    div->appendChild(content.release());
+
+    if (RuntimeEnabledFeatures::mediaDocumentDownloadButtonEnabled()) {
+        RawPtr<HTMLAnchorElement> anchor = HTMLAnchorElement::create(*document());
+        anchor->setAttribute(downloadAttr, "");
+        anchor->setURL(document()->url());
+        anchor->setTextContent(document()->getCachedLocale(document()->contentLanguage()).queryString(WebLocalizedString::DownloadButtonLabel).upper());
+        // Using CSS style according to Android material design.
+        anchor->setAttribute(styleAttr,
+            "display: inline-block;"
+            "margin-top: 32px;"
+            "padding: 0 16px 0 16px;"
+            "height: 36px;"
+            "background: #4285F4;"
+            "font-family: Roboto;"
+            "font-size: 14px;"
+            "border-radius: 5px;"
+            "color: white;"
+            "font-weight: bold;"
+            "text-decoration: none;"
+            "min-width: 300px;"
+            "line-height: 36px;");
+        RawPtr<EventListener> listener = MediaDownloadEventListener::create();
+        anchor->addEventListener(EventTypeNames::click, listener, false);
+        RawPtr<HTMLDivElement> buttonContainer = HTMLDivElement::create(*document());
+        buttonContainer->setAttribute(styleAttr,
+            "position: absolute;"
+            "text-align: center;"
+            "left: 0;"
+            "right: 0;");
+        buttonContainer->appendChild(anchor.release());
+        div->appendChild(buttonContainer.release());
+        recordDownloadMetric(MediaDocumentDownloadButtonShown);
+    }
+
+    // According to https://html.spec.whatwg.org/multipage/browsers.html#read-media,
+    // MediaDocument should have a single child which is the video element. Use
+    // shadow root to hide all the elements we added here.
+    ShadowRoot& shadowRoot = body->ensureUserAgentShadowRoot();
+    shadowRoot.appendChild(div.release());
+    body->appendChild(media.release());
     rootElement->appendChild(head.release());
     rootElement->appendChild(body.release());
 
diff --git a/third_party/WebKit/Source/core/inspector/AsyncCallTracker.cpp b/third_party/WebKit/Source/core/inspector/AsyncCallTracker.cpp
deleted file mode 100644
index 1d7ee74b..0000000
--- a/third_party/WebKit/Source/core/inspector/AsyncCallTracker.cpp
+++ /dev/null
@@ -1,428 +0,0 @@
-/*
- * Copyright (C) 2013 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "core/inspector/AsyncCallTracker.h"
-
-#include "core/dom/ContextLifecycleObserver.h"
-#include "core/dom/ExecutionContext.h"
-#include "core/dom/ExecutionContextTask.h"
-#include "core/events/Event.h"
-#include "core/events/EventTarget.h"
-#include "core/inspector/AsyncOperationMap.h"
-#include "core/xmlhttprequest/XMLHttpRequest.h"
-#include "core/xmlhttprequest/XMLHttpRequestUpload.h"
-#include "platform/ScriptForbiddenScope.h"
-#include "wtf/text/StringBuilder.h"
-#include "wtf/text/StringHash.h"
-
-namespace {
-
-static const char setTimeoutName[] = "setTimeout";
-static const char setIntervalName[] = "setInterval";
-static const char requestAnimationFrameName[] = "requestAnimationFrame";
-static const char xhrSendName[] = "XMLHttpRequest.send";
-static const char enqueueMutationRecordName[] = "Mutation";
-
-}
-
-namespace blink {
-
-class AsyncCallTracker::ExecutionContextData final : public GarbageCollectedFinalized<ExecutionContextData>, public ContextLifecycleObserver {
-    USING_GARBAGE_COLLECTED_MIXIN(AsyncCallTracker::ExecutionContextData);
-public:
-    ExecutionContextData(AsyncCallTracker* tracker, ExecutionContext* executionContext)
-        : ContextLifecycleObserver(executionContext)
-        , m_tracker(tracker)
-        , m_timerCallChains(tracker->m_debuggerAgent)
-        , m_animationFrameCallChains(tracker->m_debuggerAgent)
-        , m_eventCallChains(tracker->m_debuggerAgent)
-        , m_xhrCallChains(tracker->m_debuggerAgent)
-        , m_mutationObserverCallChains(tracker->m_debuggerAgent)
-        , m_executionContextTaskCallChains(tracker->m_debuggerAgent)
-        , m_asyncOperations(tracker->m_debuggerAgent)
-    {
-    }
-
-    void contextDestroyed() override
-    {
-        ASSERT(getExecutionContext());
-        RawPtr<ExecutionContextData> self = m_tracker->m_executionContextDataMap.take(getExecutionContext());
-        ASSERT_UNUSED(self, self == this);
-        ContextLifecycleObserver::contextDestroyed();
-        disposeCallChains();
-    }
-
-    void unobserve()
-    {
-        disposeCallChains();
-        ContextLifecycleObserver::clearContext();
-    }
-
-    DEFINE_INLINE_VIRTUAL_TRACE()
-    {
-        visitor->trace(m_tracker);
-        visitor->trace(m_timerCallChains);
-        visitor->trace(m_animationFrameCallChains);
-        visitor->trace(m_eventCallChains);
-        visitor->trace(m_xhrCallChains);
-        visitor->trace(m_mutationObserverCallChains);
-        visitor->trace(m_executionContextTaskCallChains);
-        visitor->trace(m_asyncOperations);
-        ContextLifecycleObserver::trace(visitor);
-    }
-
-    Member<AsyncCallTracker> m_tracker;
-    HashSet<int> m_intervalTimerIds;
-    AsyncOperationMap<int> m_timerCallChains;
-    AsyncOperationMap<int> m_animationFrameCallChains;
-    AsyncOperationMap<Member<Event>> m_eventCallChains;
-    AsyncOperationMap<Member<EventTarget>> m_xhrCallChains;
-    AsyncOperationMap<Member<MutationObserver>> m_mutationObserverCallChains;
-    AsyncOperationMap<ExecutionContextTask*> m_executionContextTaskCallChains;
-    AsyncOperationMap<int> m_asyncOperations;
-
-private:
-    void disposeCallChains()
-    {
-        m_timerCallChains.dispose();
-        m_animationFrameCallChains.dispose();
-        m_eventCallChains.dispose();
-        m_xhrCallChains.dispose();
-        m_mutationObserverCallChains.dispose();
-        m_executionContextTaskCallChains.dispose();
-        m_asyncOperations.dispose();
-    }
-};
-
-static XMLHttpRequest* toXmlHttpRequest(EventTarget* eventTarget)
-{
-    const AtomicString& interfaceName = eventTarget->interfaceName();
-    if (interfaceName == EventTargetNames::XMLHttpRequest)
-        return static_cast<XMLHttpRequest*>(eventTarget);
-    if (interfaceName == EventTargetNames::XMLHttpRequestUpload)
-        return static_cast<XMLHttpRequestUpload*>(eventTarget)->xmlHttpRequest();
-    return nullptr;
-}
-
-AsyncCallTracker::AsyncCallTracker(V8DebuggerAgent* debuggerAgent, InstrumentingAgents* instrumentingAgents)
-    : m_debuggerAgent(debuggerAgent)
-    , m_instrumentingAgents(instrumentingAgents)
-{
-}
-
-AsyncCallTracker::~AsyncCallTracker()
-{
-}
-
-void AsyncCallTracker::asyncCallTrackingStateChanged(bool tracking)
-{
-    m_instrumentingAgents->setAsyncCallTracker(tracking ? this : nullptr);
-}
-
-void AsyncCallTracker::resetAsyncOperations()
-{
-    for (auto& it : m_executionContextDataMap)
-        it.value->unobserve();
-    m_executionContextDataMap.clear();
-}
-
-void AsyncCallTracker::didInstallTimer(ExecutionContext* context, int timerId, int timeout, bool singleShot)
-{
-    ASSERT(context);
-    ASSERT(m_debuggerAgent->trackingAsyncCalls());
-    int operationId = m_debuggerAgent->traceAsyncOperationStarting(singleShot ? setTimeoutName : setIntervalName);
-    ASSERT(timerId > 0);
-    ExecutionContextData* data = createContextDataIfNeeded(context);
-    data->m_timerCallChains.set(timerId, operationId);
-    if (!singleShot)
-        data->m_intervalTimerIds.add(timerId);
-}
-
-void AsyncCallTracker::didRemoveTimer(ExecutionContext* context, int timerId)
-{
-    ASSERT(context);
-    ASSERT(m_debuggerAgent->trackingAsyncCalls());
-    if (timerId <= 0)
-        return;
-    ExecutionContextData* data = m_executionContextDataMap.get(context);
-    if (!data)
-        return;
-    data->m_intervalTimerIds.remove(timerId);
-    data->m_timerCallChains.remove(timerId);
-}
-
-bool AsyncCallTracker::willFireTimer(ExecutionContext* context, int timerId)
-{
-    ASSERT(context);
-    ASSERT(m_debuggerAgent->trackingAsyncCalls());
-    ASSERT(timerId > 0);
-    if (ExecutionContextData* data = m_executionContextDataMap.get(context)) {
-        willFireAsyncCall(data->m_timerCallChains.get(timerId));
-        if (!data->m_intervalTimerIds.contains(timerId))
-            data->m_timerCallChains.remove(timerId);
-    } else {
-        willFireAsyncCall(V8DebuggerAgent::unknownAsyncOperationId);
-    }
-    return true;
-}
-
-void AsyncCallTracker::didRequestAnimationFrame(ExecutionContext* context, int callbackId)
-{
-    ASSERT(context);
-    ASSERT(m_debuggerAgent->trackingAsyncCalls());
-    int operationId = m_debuggerAgent->traceAsyncOperationStarting(requestAnimationFrameName);
-    ASSERT(callbackId > 0);
-    ExecutionContextData* data = createContextDataIfNeeded(context);
-    data->m_animationFrameCallChains.set(callbackId, operationId);
-}
-
-void AsyncCallTracker::didCancelAnimationFrame(ExecutionContext* context, int callbackId)
-{
-    ASSERT(context);
-    ASSERT(m_debuggerAgent->trackingAsyncCalls());
-    if (callbackId <= 0)
-        return;
-    if (ExecutionContextData* data = m_executionContextDataMap.get(context))
-        data->m_animationFrameCallChains.remove(callbackId);
-}
-
-bool AsyncCallTracker::willFireAnimationFrame(ExecutionContext* context, int callbackId)
-{
-    ASSERT(context);
-    ASSERT(m_debuggerAgent->trackingAsyncCalls());
-    ASSERT(callbackId > 0);
-    if (ExecutionContextData* data = m_executionContextDataMap.get(context)) {
-        willFireAsyncCall(data->m_animationFrameCallChains.get(callbackId));
-        data->m_animationFrameCallChains.remove(callbackId);
-    } else {
-        willFireAsyncCall(V8DebuggerAgent::unknownAsyncOperationId);
-    }
-    return true;
-}
-
-void AsyncCallTracker::didEnqueueEvent(EventTarget* eventTarget, Event* event)
-{
-    ASSERT(eventTarget->getExecutionContext());
-    ASSERT(m_debuggerAgent->trackingAsyncCalls());
-    ScriptForbiddenScope::AllowUserAgentScript allowScripting;
-    int operationId = m_debuggerAgent->traceAsyncOperationStarting(event->type());
-    ExecutionContextData* data = createContextDataIfNeeded(eventTarget->getExecutionContext());
-    data->m_eventCallChains.set(event, operationId);
-}
-
-void AsyncCallTracker::didRemoveEvent(EventTarget* eventTarget, Event* event)
-{
-    ASSERT(eventTarget->getExecutionContext());
-    ASSERT(m_debuggerAgent->trackingAsyncCalls());
-    if (ExecutionContextData* data = m_executionContextDataMap.get(eventTarget->getExecutionContext()))
-        data->m_eventCallChains.remove(event);
-}
-
-void AsyncCallTracker::willHandleEvent(EventTarget* eventTarget, Event* event, EventListener* listener, bool useCapture)
-{
-    ASSERT(eventTarget->getExecutionContext());
-    ASSERT(m_debuggerAgent->trackingAsyncCalls());
-    if (XMLHttpRequest* xhr = toXmlHttpRequest(eventTarget)) {
-        willHandleXHREvent(xhr, event);
-    } else {
-        ExecutionContext* context = eventTarget->getExecutionContext();
-        if (ExecutionContextData* data = m_executionContextDataMap.get(context))
-            willFireAsyncCall(data->m_eventCallChains.get(event));
-        else
-            willFireAsyncCall(V8DebuggerAgent::unknownAsyncOperationId);
-    }
-}
-
-void AsyncCallTracker::willLoadXHR(XMLHttpRequest* xhr, ThreadableLoaderClient*, const AtomicString&, const KURL&, bool async, PassRefPtr<EncodedFormData>, const HTTPHeaderMap&, bool)
-{
-    ASSERT(xhr->getExecutionContext());
-    ASSERT(m_debuggerAgent->trackingAsyncCalls());
-    if (!async)
-        return;
-    int operationId = m_debuggerAgent->traceAsyncOperationStarting(xhrSendName);
-    ExecutionContextData* data = createContextDataIfNeeded(xhr->getExecutionContext());
-    data->m_xhrCallChains.set(xhr, operationId);
-}
-
-void AsyncCallTracker::didDispatchXHRLoadendEvent(XMLHttpRequest* xhr)
-{
-    ASSERT(xhr->getExecutionContext());
-    ASSERT(m_debuggerAgent->trackingAsyncCalls());
-    if (ExecutionContextData* data = m_executionContextDataMap.get(xhr->getExecutionContext()))
-        data->m_xhrCallChains.remove(xhr);
-}
-
-void AsyncCallTracker::willHandleXHREvent(XMLHttpRequest* xhr, Event* event)
-{
-    ExecutionContext* context = xhr->getExecutionContext();
-    ASSERT(context);
-    ASSERT(m_debuggerAgent->trackingAsyncCalls());
-    if (ExecutionContextData* data = m_executionContextDataMap.get(context))
-        willFireAsyncCall(data->m_xhrCallChains.get(xhr));
-    else
-        willFireAsyncCall(V8DebuggerAgent::unknownAsyncOperationId);
-}
-
-void AsyncCallTracker::didEnqueueMutationRecord(ExecutionContext* context, MutationObserver* observer)
-{
-    ASSERT(context);
-    ASSERT(m_debuggerAgent->trackingAsyncCalls());
-    ExecutionContextData* data = createContextDataIfNeeded(context);
-    if (data->m_mutationObserverCallChains.contains(observer))
-        return;
-    ScriptForbiddenScope::AllowUserAgentScript allowScripting;
-    int operationId = m_debuggerAgent->traceAsyncOperationStarting(enqueueMutationRecordName);
-    data->m_mutationObserverCallChains.set(observer, operationId);
-}
-
-void AsyncCallTracker::didClearAllMutationRecords(ExecutionContext* context, MutationObserver* observer)
-{
-    ASSERT(context);
-    ASSERT(m_debuggerAgent->trackingAsyncCalls());
-    if (ExecutionContextData* data = m_executionContextDataMap.get(context))
-        data->m_mutationObserverCallChains.remove(observer);
-}
-
-void AsyncCallTracker::willDeliverMutationRecords(ExecutionContext* context, MutationObserver* observer)
-{
-    ASSERT(context);
-    ASSERT(m_debuggerAgent->trackingAsyncCalls());
-    if (ExecutionContextData* data = m_executionContextDataMap.get(context)) {
-        willFireAsyncCall(data->m_mutationObserverCallChains.get(observer));
-        data->m_mutationObserverCallChains.remove(observer);
-    } else {
-        willFireAsyncCall(V8DebuggerAgent::unknownAsyncOperationId);
-    }
-}
-
-void AsyncCallTracker::didPostExecutionContextTask(ExecutionContext* context, ExecutionContextTask* task)
-{
-    ASSERT(context);
-    ASSERT(m_debuggerAgent->trackingAsyncCalls());
-    if (task->taskNameForInstrumentation().isEmpty())
-        return;
-    int operationId = m_debuggerAgent->traceAsyncOperationStarting(task->taskNameForInstrumentation());
-    ExecutionContextData* data = createContextDataIfNeeded(context);
-    data->m_executionContextTaskCallChains.set(task, operationId);
-}
-
-void AsyncCallTracker::didKillAllExecutionContextTasks(ExecutionContext* context)
-{
-    ASSERT(context);
-    ASSERT(m_debuggerAgent->trackingAsyncCalls());
-    if (ExecutionContextData* data = m_executionContextDataMap.get(context))
-        data->m_executionContextTaskCallChains.clear();
-}
-
-void AsyncCallTracker::willPerformExecutionContextTask(ExecutionContext* context, ExecutionContextTask* task)
-{
-    ASSERT(context);
-    ASSERT(m_debuggerAgent->trackingAsyncCalls());
-    if (ExecutionContextData* data = m_executionContextDataMap.get(context)) {
-        willFireAsyncCall(data->m_executionContextTaskCallChains.get(task));
-        data->m_executionContextTaskCallChains.remove(task);
-    } else {
-        willFireAsyncCall(V8DebuggerAgent::unknownAsyncOperationId);
-    }
-}
-
-int AsyncCallTracker::traceAsyncOperationStarting(ExecutionContext* context, const String& operationName, int prevOperationId)
-{
-    ScriptForbiddenScope::AllowUserAgentScript allowScripting;
-    ASSERT(context);
-    ASSERT(m_debuggerAgent->trackingAsyncCalls());
-    if (prevOperationId)
-        traceAsyncOperationCompleted(context, prevOperationId);
-    int operationId = m_debuggerAgent->traceAsyncOperationStarting(operationName);
-    ExecutionContextData* data = createContextDataIfNeeded(context);
-    data->m_asyncOperations.set(operationId, operationId);
-    return operationId;
-}
-
-void AsyncCallTracker::traceAsyncOperationCompleted(ExecutionContext* context, int operationId)
-{
-    ASSERT(context);
-    ASSERT(m_debuggerAgent->trackingAsyncCalls());
-    if (operationId <= 0)
-        return;
-    if (ExecutionContextData* data = m_executionContextDataMap.get(context))
-        data->m_asyncOperations.remove(operationId);
-}
-
-void AsyncCallTracker::traceAsyncOperationCompletedCallbackStarting(ExecutionContext* context, int operationId)
-{
-    traceAsyncCallbackStarting(context, operationId);
-    traceAsyncOperationCompleted(context, operationId);
-}
-
-bool AsyncCallTracker::isKnownAsyncOperationId(ExecutionContext* context, int operationId) const
-{
-    if (operationId <= 0)
-        return false;
-    if (ExecutionContextData* data = m_executionContextDataMap.get(context))
-        return data->m_asyncOperations.contains(operationId);
-    return false;
-}
-
-void AsyncCallTracker::traceAsyncCallbackStarting(ExecutionContext* context, int operationId)
-{
-    ASSERT(context);
-    ASSERT(m_debuggerAgent->trackingAsyncCalls());
-    ASSERT(operationId <= 0 || isKnownAsyncOperationId(context, operationId));
-    willFireAsyncCall(operationId > 0 ? operationId : V8DebuggerAgent::unknownAsyncOperationId);
-}
-
-void AsyncCallTracker::didFireAsyncCall()
-{
-    m_debuggerAgent->traceAsyncCallbackCompleted();
-}
-
-void AsyncCallTracker::willFireAsyncCall(int operationId)
-{
-    m_debuggerAgent->traceAsyncCallbackStarting(operationId);
-}
-
-AsyncCallTracker::ExecutionContextData* AsyncCallTracker::createContextDataIfNeeded(ExecutionContext* context)
-{
-    ExecutionContextData* data = m_executionContextDataMap.get(context);
-    if (!data) {
-        data = m_executionContextDataMap.set(context, new AsyncCallTracker::ExecutionContextData(this, context))
-            .storedValue->value.get();
-    }
-    return data;
-}
-
-DEFINE_TRACE(AsyncCallTracker)
-{
-    visitor->trace(m_executionContextDataMap);
-    visitor->trace(m_instrumentingAgents);
-}
-
-} // namespace blink
diff --git a/third_party/WebKit/Source/core/inspector/AsyncCallTracker.h b/third_party/WebKit/Source/core/inspector/AsyncCallTracker.h
deleted file mode 100644
index 58d6867..0000000
--- a/third_party/WebKit/Source/core/inspector/AsyncCallTracker.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (C) 2013 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef AsyncCallTracker_h
-#define AsyncCallTracker_h
-
-#include "core/CoreExport.h"
-#include "core/inspector/InstrumentingAgents.h"
-#include "platform/heap/Handle.h"
-#include "platform/v8_inspector/public/V8DebuggerAgent.h"
-#include "wtf/Forward.h"
-#include "wtf/HashMap.h"
-#include "wtf/Noncopyable.h"
-
-namespace blink {
-
-class EncodedFormData;
-class Event;
-class EventListener;
-class EventTarget;
-class ExecutionContext;
-class ExecutionContextTask;
-class HTTPHeaderMap;
-class KURL;
-class MutationObserver;
-class ThreadableLoaderClient;
-class XMLHttpRequest;
-
-class CORE_EXPORT AsyncCallTracker final : public GarbageCollectedFinalized<AsyncCallTracker> {
-    WTF_MAKE_NONCOPYABLE(AsyncCallTracker);
-public:
-    AsyncCallTracker(V8DebuggerAgent*, InstrumentingAgents*);
-    ~AsyncCallTracker();
-
-    void asyncCallTrackingStateChanged(bool tracking);
-    void resetAsyncOperations();
-
-    void didInstallTimer(ExecutionContext*, int timerId, int timeout, bool singleShot);
-    void didRemoveTimer(ExecutionContext*, int timerId);
-    bool willFireTimer(ExecutionContext*, int timerId);
-    void didFireTimer() { didFireAsyncCall(); }
-
-    void didRequestAnimationFrame(ExecutionContext*, int callbackId);
-    void didCancelAnimationFrame(ExecutionContext*, int callbackId);
-    bool willFireAnimationFrame(ExecutionContext*, int callbackId);
-    void didFireAnimationFrame() { didFireAsyncCall(); }
-
-    void didEnqueueEvent(EventTarget*, Event*);
-    void didRemoveEvent(EventTarget*, Event*);
-    void willHandleEvent(EventTarget*, Event*, EventListener*, bool useCapture);
-    void didHandleEvent() { didFireAsyncCall(); }
-
-    void willLoadXHR(XMLHttpRequest*, ThreadableLoaderClient*, const AtomicString& method, const KURL&, bool async, PassRefPtr<EncodedFormData> body, const HTTPHeaderMap& headers, bool includeCrendentials);
-    void didDispatchXHRLoadendEvent(XMLHttpRequest*);
-
-    void didEnqueueMutationRecord(ExecutionContext*, MutationObserver*);
-    void didClearAllMutationRecords(ExecutionContext*, MutationObserver*);
-    void willDeliverMutationRecords(ExecutionContext*, MutationObserver*);
-    void didDeliverMutationRecords() { didFireAsyncCall(); }
-
-    void didPostExecutionContextTask(ExecutionContext*, ExecutionContextTask*);
-    void didKillAllExecutionContextTasks(ExecutionContext*);
-    void willPerformExecutionContextTask(ExecutionContext*, ExecutionContextTask*);
-    void didPerformExecutionContextTask() { didFireAsyncCall(); }
-
-    int traceAsyncOperationStarting(ExecutionContext*, const String& operationName, int prevOperationId = 0);
-    void traceAsyncOperationCompleted(ExecutionContext*, int operationId);
-    void traceAsyncOperationCompletedCallbackStarting(ExecutionContext*, int operationId);
-    void traceAsyncCallbackStarting(ExecutionContext*, int operationId);
-    void traceAsyncCallbackCompleted() { didFireAsyncCall(); }
-
-    DECLARE_VIRTUAL_TRACE();
-
-    class ExecutionContextData;
-
-private:
-    void willHandleXHREvent(XMLHttpRequest*, Event*);
-
-    bool isKnownAsyncOperationId(ExecutionContext*, int operationId) const;
-    void willFireAsyncCall(int operationId);
-    void didFireAsyncCall();
-
-    ExecutionContextData* createContextDataIfNeeded(ExecutionContext*);
-
-    using ExecutionContextDataMap = HeapHashMap<Member<ExecutionContext>, Member<ExecutionContextData>>;
-    ExecutionContextDataMap m_executionContextDataMap;
-    V8DebuggerAgent* m_debuggerAgent;
-    Member<InstrumentingAgents> m_instrumentingAgents;
-};
-
-} // namespace blink
-
-#endif // AsyncCallTracker_h
diff --git a/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp
index 7b401ba..9b19ea9 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp
@@ -69,7 +69,7 @@
 #include "core/layout/LayoutObjectInlines.h"
 #include "core/layout/LayoutText.h"
 #include "core/layout/LayoutTextFragment.h"
-#include "core/layout/LayoutView.h"
+#include "core/layout/api/LayoutViewItem.h"
 #include "core/layout/line/InlineTextBox.h"
 #include "core/loader/DocumentLoader.h"
 #include "core/page/Page.h"
@@ -138,7 +138,7 @@
     leftPadding = rightPadding = rect.width() / 2;
     topPadding = bottomPadding = rect.height() / 2;
     HitTestResult result(request, center, topPadding, rightPadding, bottomPadding, leftPadding);
-    document.frame()->contentLayoutObject()->hitTest(result);
+    document.frame()->contentLayoutItem().hitTest(result);
     return document.elementsFromHitTestResult(result);
 }
 
diff --git a/third_party/WebKit/Source/core/inspector/InspectorDebuggerAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorDebuggerAgent.cpp
index 71c1095..5eca1abd 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorDebuggerAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorDebuggerAgent.cpp
@@ -30,7 +30,6 @@
 #include "core/inspector/InspectorDebuggerAgent.h"
 
 #include "bindings/core/v8/V8Binding.h"
-#include "core/inspector/AsyncCallTracker.h"
 #include "platform/ScriptForbiddenScope.h"
 #include "platform/v8_inspector/public/V8Debugger.h"
 
@@ -57,7 +56,6 @@
 
 DEFINE_TRACE(InspectorDebuggerAgent)
 {
-    visitor->trace(m_asyncCallTracker);
     InspectorBaseAgent<InspectorDebuggerAgent, protocol::Frontend::Debugger>::trace(visitor);
 }
 
@@ -71,7 +69,6 @@
 
 void InspectorDebuggerAgent::disable(ErrorString* errorString)
 {
-    setTrackingAsyncCalls(false);
     m_state->setBoolean(DebuggerAgentState::debuggerEnabled, false);
     m_instrumentingAgents->setInspectorDebuggerAgent(nullptr);
     m_v8DebuggerAgent->disable(errorString);
@@ -247,7 +244,6 @@
 void InspectorDebuggerAgent::setAsyncCallStackDepth(ErrorString* errorString, int inMaxDepth)
 {
     m_v8DebuggerAgent->setAsyncCallStackDepth(errorString, inMaxDepth);
-    setTrackingAsyncCalls(m_v8DebuggerAgent->trackingAsyncCalls());
 }
 
 void InspectorDebuggerAgent::setBlackboxedRanges(
@@ -280,6 +276,36 @@
     m_v8DebuggerAgent->didExecuteScript();
 }
 
+void InspectorDebuggerAgent::asyncTaskScheduled(const String& taskName, void* task)
+{
+    m_v8DebuggerAgent->asyncTaskScheduled(taskName, task, false);
+}
+
+void InspectorDebuggerAgent::asyncTaskScheduled(const String& operationName, void* task, bool recurring)
+{
+    m_v8DebuggerAgent->asyncTaskScheduled(operationName, task, recurring);
+}
+
+void InspectorDebuggerAgent::asyncTaskCanceled(void* task)
+{
+    m_v8DebuggerAgent->asyncTaskCanceled(task);
+}
+
+void InspectorDebuggerAgent::allAsyncTasksCanceled()
+{
+    m_v8DebuggerAgent->allAsyncTasksCanceled();
+}
+
+void InspectorDebuggerAgent::asyncTaskStarted(void* task)
+{
+    m_v8DebuggerAgent->asyncTaskStarted(task);
+}
+
+void InspectorDebuggerAgent::asyncTaskFinished(void* task)
+{
+    m_v8DebuggerAgent->asyncTaskFinished(task);
+}
+
 // InspectorBaseAgent overrides.
 void InspectorDebuggerAgent::setState(protocol::DictionaryValue* state)
 {
@@ -287,11 +313,6 @@
     m_v8DebuggerAgent->setInspectorState(m_state);
 }
 
-void InspectorDebuggerAgent::init()
-{
-    m_asyncCallTracker = new AsyncCallTracker(m_v8DebuggerAgent.get(), m_instrumentingAgents.get());
-}
-
 void InspectorDebuggerAgent::setFrontend(protocol::Frontend* frontend)
 {
     InspectorBaseAgent::setFrontend(frontend);
@@ -311,7 +332,6 @@
     m_v8DebuggerAgent->restore();
     ErrorString errorString;
     enable(&errorString);
-    setTrackingAsyncCalls(m_v8DebuggerAgent->trackingAsyncCalls());
 }
 
 void InspectorDebuggerAgent::discardAgent()
@@ -319,11 +339,4 @@
     m_v8DebuggerAgent.clear();
 }
 
-void InspectorDebuggerAgent::setTrackingAsyncCalls(bool tracking)
-{
-    m_asyncCallTracker->asyncCallTrackingStateChanged(tracking);
-    if (!tracking)
-        m_asyncCallTracker->resetAsyncOperations();
-}
-
 } // namespace blink
diff --git a/third_party/WebKit/Source/core/inspector/InspectorDebuggerAgent.h b/third_party/WebKit/Source/core/inspector/InspectorDebuggerAgent.h
index 3309f22..11befd1 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorDebuggerAgent.h
+++ b/third_party/WebKit/Source/core/inspector/InspectorDebuggerAgent.h
@@ -80,9 +80,16 @@
     void willExecuteScript(int scriptId);
     void didExecuteScript();
 
+    // Async stack implementation.
+    void asyncTaskScheduled(const String& taskName, void* task);
+    void asyncTaskScheduled(const String& taskName, void* task, bool recurring);
+    void asyncTaskCanceled(void* task);
+    void allAsyncTasksCanceled();
+    void asyncTaskStarted(void* task);
+    void asyncTaskFinished(void* task);
+
     // InspectorBaseAgent overrides.
     void setState(protocol::DictionaryValue*) override;
-    void init() override;
     void setFrontend(protocol::Frontend*) override;
     void clearFrontend() override;
     void restore() override;
@@ -94,10 +101,6 @@
     explicit InspectorDebuggerAgent(V8RuntimeAgent*);
 
     OwnPtr<V8DebuggerAgent> m_v8DebuggerAgent;
-    Member<AsyncCallTracker> m_asyncCallTracker;
-
-private:
-    void setTrackingAsyncCalls(bool);
 };
 
 } // namespace blink
diff --git a/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.cpp b/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.cpp
index 015444f..2c65b2c3 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.cpp
@@ -58,6 +58,25 @@
 }
 
 namespace InspectorInstrumentation {
+
+AsyncTask::AsyncTask(ExecutionContext* context, void* task) : AsyncTask(context, task, true)
+{
+}
+
+AsyncTask::AsyncTask(ExecutionContext* context, void* task, bool enabled)
+    : m_instrumentingAgents(enabled ? instrumentingAgentsFor(context) : nullptr)
+    , m_task(task)
+{
+    if (m_instrumentingAgents && m_instrumentingAgents->inspectorDebuggerAgent())
+        m_instrumentingAgents->inspectorDebuggerAgent()->asyncTaskStarted(m_task);
+}
+
+AsyncTask::~AsyncTask()
+{
+    if (m_instrumentingAgents && m_instrumentingAgents->inspectorDebuggerAgent())
+        m_instrumentingAgents->inspectorDebuggerAgent()->asyncTaskFinished(m_task);
+}
+
 int FrontendCounter::s_frontendCounter = 0;
 
 // Keep in sync with kDevToolsRequestInitiator defined in devtools_network_controller.cc
diff --git a/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.h b/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.h
index 3afad9a4..2a548f1 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.h
+++ b/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.h
@@ -82,6 +82,18 @@
 
 namespace InspectorInstrumentation {
 
+class CORE_EXPORT AsyncTask {
+    STACK_ALLOCATED();
+public:
+    AsyncTask(ExecutionContext*, void* task);
+    AsyncTask(ExecutionContext*, void* task, bool enabled);
+    ~AsyncTask();
+
+private:
+    Member<InstrumentingAgents> m_instrumentingAgents;
+    void* m_task;
+};
+
 class CORE_EXPORT FrontendCounter {
     STATIC_ONLY(FrontendCounter);
 private:
diff --git a/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.idl b/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.idl
index c193887..364ff39 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.idl
+++ b/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.idl
@@ -68,7 +68,7 @@
 #include "core/dom/PseudoElement.h"
 
     // We should call PageDebuggerAgent method first otherwise this method resets script cache and removes scripts executed by other agents.
-    [PageDebugger, Page, Animation]
+    [Page, Animation]
     void didClearDocumentOfWindowObject([Keep] LocalFrame*);
 
     [DOMDebugger, Inline=FastReturn]
@@ -131,10 +131,10 @@
     [DOMDebugger, Inline=FastReturn]
     void didFireWebGLErrorOrWarning(Element*, const String& message);
 
-    [AsyncCallTracker, DOMDebugger, Inline=FastReturn]
+    [DOMDebugger, Inline=FastReturn]
     void didInstallTimer([Keep] ExecutionContext*, int timerId, int timeout, bool singleShot);
 
-    [AsyncCallTracker, DOMDebugger, Inline=FastReturn]
+    [DOMDebugger, Inline=FastReturn]
     void didRemoveTimer([Keep] ExecutionContext*, int timerId);
 
     [Debugger, Inline=FastReturn]
@@ -143,49 +143,19 @@
     [Debugger, Inline=FastReturn]
     void didExecuteScript(const InspectorInstrumentationCookie&);
 
-    [AsyncCallTracker, Inline=FastReturn]
-    void didEnqueueEvent([Keep] EventTarget*, Event*);
-
-    [AsyncCallTracker, Inline=FastReturn]
-    void didRemoveEvent([Keep] EventTarget*, Event*);
-
-    [AsyncCallTracker, DOMDebugger, Inline=FastReturn]
+    [DOMDebugger, Inline=FastReturn]
     InspectorInstrumentationCookie willHandleEvent([Keep] EventTarget*, Event*, EventListener* listener, bool useCapture);
 
-    [AsyncCallTracker, DOMDebugger, Inline=FastReturn]
+    [DOMDebugger, Inline=FastReturn]
     void didHandleEvent(const InspectorInstrumentationCookie&);
 
-    [AsyncCallTracker, Inline=FastReturn]
-    void didEnqueueMutationRecord([Keep] ExecutionContext*, MutationObserver*);
-
-    [AsyncCallTracker, Inline=FastReturn]
-    void didClearAllMutationRecords([Keep] ExecutionContext*, MutationObserver*);
-
-    [AsyncCallTracker, Inline=FastReturn]
-    void willDeliverMutationRecords([Keep] ExecutionContext*, MutationObserver*);
-
-    [AsyncCallTracker, Inline=FastReturn]
-    void didDeliverMutationRecords(ExecutionContext*);
-
-    [AsyncCallTracker, Inline=FastReturn]
-    void didPostExecutionContextTask([Keep] ExecutionContext*, ExecutionContextTask*);
-
-    [AsyncCallTracker, Inline=FastReturn]
-    void didKillAllExecutionContextTasks([Keep] ExecutionContext*);
-
-    [AsyncCallTracker, Inline=FastReturn]
-    void willPerformExecutionContextTask([Keep] ExecutionContext*, ExecutionContextTask*);
-
-    [AsyncCallTracker, Inline=FastReturn]
-    void didPerformExecutionContextTask(ExecutionContext*);
-
     [DOMDebugger, Inline=FastReturn]
     void willEvaluateScript(ExecutionContext*);
 
-    [AsyncCallTracker, DOMDebugger, Inline=FastReturn]
+    [DOMDebugger, Inline=FastReturn]
     InspectorInstrumentationCookie willFireTimer([Keep] ExecutionContext*, int timerId);
 
-    [AsyncCallTracker, DOMDebugger, Inline=FastReturn]
+    [DOMDebugger, Inline=FastReturn]
     void didFireTimer(const InspectorInstrumentationCookie&);
 
     [Page, Inline=FastReturn]
@@ -194,9 +164,6 @@
     [Page, Inline=FastReturn]
     void didResizeMainFrame(LocalFrame*);
 
-    [AsyncCallTracker, Inline=FastReturn]
-    void didDispatchXHRLoadendEvent(ExecutionContext*, XMLHttpRequest*);
-
     [LayerTree, Inline=FastReturn]
     void didPaint([Keep] LayoutObject*, const GraphicsLayer*, GraphicsContext&, const LayoutRect&);
 
@@ -254,7 +221,7 @@
     [Resource]
     void didFinishEventSourceRequest(ExecutionContext*, ThreadableLoaderClient* eventSource);
 
-    [AsyncCallTracker, Resource]
+    [Resource]
     void willLoadXHR(ExecutionContext*, XMLHttpRequest* xhr, ThreadableLoaderClient* client, const AtomicString& method, const KURL& url, bool async, PassRefPtr<EncodedFormData>, const HTTPHeaderMap& headers, bool includeCredentials);
 
     [Resource]
@@ -323,18 +290,15 @@
     [Inline=Forward]
     void removedResourceFromMemoryCache(Resource* cachedResource);
 
-    [AsyncCallTracker, DOMDebugger]
-    void didRequestAnimationFrame([Keep] ExecutionContext*, int callbackId);
-
-    [AsyncCallTracker, DOMDebugger]
-    void didCancelAnimationFrame([Keep] ExecutionContext*, int callbackId);
-
-    [AsyncCallTracker, DOMDebugger]
-    InspectorInstrumentationCookie willFireAnimationFrame([Keep] ExecutionContext*, int callbackId);
-
-    [AsyncCallTracker, Inline=FastReturn]
-    void didFireAnimationFrame(const InspectorInstrumentationCookie&);
-
+    [DOMDebugger] 
+    void didRequestAnimationFrame([Keep] ExecutionContext*, int callbackId);   
+   
+    [DOMDebugger]    
+    void didCancelAnimationFrame([Keep] ExecutionContext*, int callbackId);    
+   
+    [DOMDebugger]    
+    void willFireAnimationFrame([Keep] ExecutionContext*, int callbackId);   
+    
     [Worker]
     void didStartWorker(ExecutionContext*, WorkerInspectorProxy* proxy, bool waitingForDebugger);
 
@@ -389,23 +353,17 @@
     [DOM, Inline=FastReturn]
     void pseudoElementDestroyed([Keep] PseudoElement*);
 
-    [AsyncCallTracker, Inline=FastReturn]
-    int traceAsyncOperationStarting([Keep] ExecutionContext*, const String& operationName);
+    [Debugger, Inline=FastReturn]
+    void asyncTaskScheduled(ExecutionContext*, const String& name, void*);
 
-    [AsyncCallTracker, Inline=FastReturn]
-    int traceAsyncOperationStarting([Keep] ExecutionContext*, const String& operationName, int prevOperationId);
+    [Debugger, Inline=FastReturn]
+    void asyncTaskScheduled(ExecutionContext*, const String& name, void*, bool recurring);
 
-    [AsyncCallTracker, Inline=FastReturn]
-    void traceAsyncOperationCompleted([Keep] ExecutionContext*, int operationId);
+    [Debugger, Inline=FastReturn]
+    void asyncTaskCanceled(ExecutionContext*, void*);
 
-    [AsyncCallTracker, Inline=FastReturn]
-    InspectorInstrumentationCookie traceAsyncOperationCompletedCallbackStarting([Keep] ExecutionContext*, int operationId);
-
-    [AsyncCallTracker, Inline=FastReturn]
-    InspectorInstrumentationCookie traceAsyncCallbackStarting([Keep] ExecutionContext*, int operationId);
-
-    [AsyncCallTracker, Inline=FastReturn]
-    void traceAsyncCallbackCompleted(const InspectorInstrumentationCookie&);
+    [Debugger, Inline=FastReturn]
+    void allAsyncTasksCanceled(ExecutionContext*);
 
     [Animation, Inline=FastReturn]
     void didCreateAnimation(Document*, unsigned);
diff --git a/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.cpp
index b5efd8f4..c3d62c6 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.cpp
@@ -41,7 +41,7 @@
 #include "core/inspector/InspectedFrames.h"
 #include "core/inspector/InstrumentingAgents.h"
 #include "core/layout/LayoutPart.h"
-#include "core/layout/LayoutView.h"
+#include "core/layout/api/LayoutViewItem.h"
 #include "core/layout/compositing/CompositedLayerMapping.h"
 #include "core/layout/compositing/PaintLayerCompositor.h"
 #include "core/loader/DocumentLoader.h"
@@ -258,8 +258,8 @@
 
 PaintLayerCompositor* InspectorLayerTreeAgent::paintLayerCompositor()
 {
-    LayoutView* layoutView = m_inspectedFrames->root()->contentLayoutObject();
-    PaintLayerCompositor* compositor = layoutView ? layoutView->compositor() : nullptr;
+    LayoutViewItem layoutView = m_inspectedFrames->root()->contentLayoutItem();
+    PaintLayerCompositor* compositor = layoutView.isNull() ? nullptr : layoutView.compositor();
     return compositor;
 }
 
diff --git a/third_party/WebKit/Source/core/inspector/PageDebuggerAgent.cpp b/third_party/WebKit/Source/core/inspector/PageDebuggerAgent.cpp
index 21f1629c..b30bdf1 100644
--- a/third_party/WebKit/Source/core/inspector/PageDebuggerAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/PageDebuggerAgent.cpp
@@ -35,7 +35,6 @@
 #include "core/dom/Document.h"
 #include "core/frame/FrameConsole.h"
 #include "core/frame/LocalFrame.h"
-#include "core/inspector/AsyncCallTracker.h"
 #include "core/inspector/InspectedFrames.h"
 #include "core/inspector/InspectorInstrumentation.h"
 #include "core/inspector/InspectorTraceEvents.h"
@@ -106,12 +105,4 @@
     }
 }
 
-void PageDebuggerAgent::didClearDocumentOfWindowObject(LocalFrame* frame)
-{
-    // FIXME: what about nested objects?
-    if (frame != m_inspectedFrames->root())
-        return;
-    m_asyncCallTracker->resetAsyncOperations();
-}
-
 } // namespace blink
diff --git a/third_party/WebKit/Source/core/inspector/PageDebuggerAgent.h b/third_party/WebKit/Source/core/inspector/PageDebuggerAgent.h
index 07eb9bc9..5212d40a 100644
--- a/third_party/WebKit/Source/core/inspector/PageDebuggerAgent.h
+++ b/third_party/WebKit/Source/core/inspector/PageDebuggerAgent.h
@@ -56,7 +56,6 @@
     void restore() final;
 
     void didStartProvisionalLoad(LocalFrame*);
-    void didClearDocumentOfWindowObject(LocalFrame*);
 
 private:
     PageDebuggerAgent(InspectedFrames*, V8RuntimeAgent*);
diff --git a/third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp b/third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp
index b885df21..e2681ce 100644
--- a/third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp
+++ b/third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp
@@ -52,11 +52,6 @@
     return V8DOMWrapper::isWrapper(m_isolate, value);
 }
 
-bool ThreadDebugger::hasRecursionLevel()
-{
-    return !!v8::MicrotasksScope::GetCurrentDepth(m_isolate);
-}
-
 bool ThreadDebugger::isExecutionAllowed()
 {
     return !ScriptForbiddenScope::isScriptForbidden();
diff --git a/third_party/WebKit/Source/core/inspector/ThreadDebugger.h b/third_party/WebKit/Source/core/inspector/ThreadDebugger.h
index 1f94f05..9fb7632 100644
--- a/third_party/WebKit/Source/core/inspector/ThreadDebugger.h
+++ b/third_party/WebKit/Source/core/inspector/ThreadDebugger.h
@@ -26,7 +26,6 @@
     void eventListeners(v8::Local<v8::Value>, V8EventListenerInfoList&) override;
     String16 valueSubtype(v8::Local<v8::Value>) override;
     bool formatAccessorsAsProperties(v8::Local<v8::Value>) override;
-    bool hasRecursionLevel() override;
     bool isExecutionAllowed() override;
     double currentTimeMS() override;
 
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlockFlowLine.cpp b/third_party/WebKit/Source/core/layout/LayoutBlockFlowLine.cpp
index ce51645..0138337 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlockFlowLine.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlowLine.cpp
@@ -41,7 +41,6 @@
 #include "core/layout/svg/line/SVGRootInlineBox.h"
 #include "platform/fonts/Character.h"
 #include "platform/text/BidiResolver.h"
-#include "wtf/RefCountedLeakCounter.h"
 #include "wtf/StdLibExtras.h"
 #include "wtf/Vector.h"
 #include "wtf/text/CharacterNames.h"
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.cpp b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
index 8a378d6..07d286d 100644
--- a/third_party/WebKit/Source/core/layout/LayoutObject.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
@@ -90,7 +90,6 @@
 #include "platform/graphics/GraphicsContext.h"
 #include "platform/graphics/paint/PaintController.h"
 #include "wtf/Partitions.h"
-#include "wtf/RefCountedLeakCounter.h"
 #include "wtf/text/StringBuilder.h"
 #include "wtf/text/WTFString.h"
 #include <algorithm>
@@ -236,14 +235,6 @@
     return nullptr;
 }
 
-#ifndef NDEBUG
-static WTF::RefCountedLeakCounter& layoutObjectCounter()
-{
-    DEFINE_STATIC_LOCAL(WTF::RefCountedLeakCounter, staticLayoutObjectCounter, ("LayoutObject"));
-    return staticLayoutObjectCounter;
-}
-#endif
-
 LayoutObject::LayoutObject(Node* node)
     : m_style(nullptr)
     , m_node(node)
@@ -259,19 +250,12 @@
     // TODO(wangxianzhu): Move this into initialization list when we enable the feature by default.
     if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
         m_previousPositionFromPaintInvalidationBacking = uninitializedPaintOffset();
-
-#ifndef NDEBUG
-    layoutObjectCounter().increment();
-#endif
     InstanceCounters::incrementCounter(InstanceCounters::LayoutObjectCounter);
 }
 
 LayoutObject::~LayoutObject()
 {
     ASSERT(!m_hasAXObject);
-#ifndef NDEBUG
-    layoutObjectCounter().decrement();
-#endif
     InstanceCounters::decrementCounter(InstanceCounters::LayoutObjectCounter);
 }
 
diff --git a/third_party/WebKit/Source/core/layout/ScrollAlignment.cpp b/third_party/WebKit/Source/core/layout/ScrollAlignment.cpp
index cb8eddf..f35287f 100644
--- a/third_party/WebKit/Source/core/layout/ScrollAlignment.cpp
+++ b/third_party/WebKit/Source/core/layout/ScrollAlignment.cpp
@@ -57,16 +57,25 @@
 
 LayoutRect ScrollAlignment::getRectToExpose(const LayoutRect& visibleRect, const LayoutRect& exposeRect, const ScrollAlignment& alignX, const ScrollAlignment& alignY)
 {
+    // Prevent degenerate cases by giving the visible rect a minimum non-0 size.
+    LayoutRect nonZeroVisibleRect(visibleRect);
+    LayoutUnit minimumLayoutUnit;
+    minimumLayoutUnit.setRawValue(1);
+    if (nonZeroVisibleRect.width() == LayoutUnit())
+        nonZeroVisibleRect.setWidth(minimumLayoutUnit);
+    if (nonZeroVisibleRect.height() == LayoutUnit())
+        nonZeroVisibleRect.setHeight(minimumLayoutUnit);
+
     // Determine the appropriate X behavior.
     ScrollAlignmentBehavior scrollX;
-    LayoutRect exposeRectX(exposeRect.x(), visibleRect.y(), exposeRect.width(), visibleRect.height());
-    LayoutUnit intersectWidth = intersection(visibleRect, exposeRectX).width();
+    LayoutRect exposeRectX(exposeRect.x(), nonZeroVisibleRect.y(), exposeRect.width(), nonZeroVisibleRect.height());
+    LayoutUnit intersectWidth = intersection(nonZeroVisibleRect, exposeRectX).width();
     if (intersectWidth == exposeRect.width() || intersectWidth >= MIN_INTERSECT_FOR_REVEAL) {
         // If the rectangle is fully visible, use the specified visible behavior.
         // If the rectangle is partially visible, but over a certain threshold,
         // then treat it as fully visible to avoid unnecessary horizontal scrolling
         scrollX = getVisibleBehavior(alignX);
-    } else if (intersectWidth == visibleRect.width()) {
+    } else if (intersectWidth == nonZeroVisibleRect.width()) {
         // If the rect is bigger than the visible area, don't bother trying to center. Other alignments will work.
         scrollX = getVisibleBehavior(alignX);
         if (scrollX == ScrollAlignmentCenter)
@@ -80,10 +89,10 @@
 
     if (scrollX == ScrollAlignmentClosestEdge) {
         // Closest edge is the right in two cases:
-        // (1) exposeRect to the right of and smaller than visibleRect
-        // (2) exposeRect to the left of and larger than visibleRect
-        if ((exposeRect.maxX() > visibleRect.maxX() && exposeRect.width() < visibleRect.width())
-            || (exposeRect.maxX() < visibleRect.maxX() && exposeRect.width() > visibleRect.width())) {
+        // (1) exposeRect to the right of and smaller than nonZeroVisibleRect
+        // (2) exposeRect to the left of and larger than nonZeroVisibleRect
+        if ((exposeRect.maxX() > nonZeroVisibleRect.maxX() && exposeRect.width() < nonZeroVisibleRect.width())
+            || (exposeRect.maxX() < nonZeroVisibleRect.maxX() && exposeRect.width() > nonZeroVisibleRect.width())) {
             scrollX = ScrollAlignmentRight;
         }
     }
@@ -91,22 +100,22 @@
     // Given the X behavior, compute the X coordinate.
     LayoutUnit x;
     if (scrollX == ScrollAlignmentNoScroll)
-        x = visibleRect.x();
+        x = nonZeroVisibleRect.x();
     else if (scrollX == ScrollAlignmentRight)
-        x = exposeRect.maxX() - visibleRect.width();
+        x = exposeRect.maxX() - nonZeroVisibleRect.width();
     else if (scrollX == ScrollAlignmentCenter)
-        x = exposeRect.x() + (exposeRect.width() - visibleRect.width()) / 2;
+        x = exposeRect.x() + (exposeRect.width() - nonZeroVisibleRect.width()) / 2;
     else
         x = exposeRect.x();
 
     // Determine the appropriate Y behavior.
     ScrollAlignmentBehavior scrollY;
-    LayoutRect exposeRectY(visibleRect.x(), exposeRect.y(), visibleRect.width(), exposeRect.height());
-    LayoutUnit intersectHeight = intersection(visibleRect, exposeRectY).height();
+    LayoutRect exposeRectY(nonZeroVisibleRect.x(), exposeRect.y(), nonZeroVisibleRect.width(), exposeRect.height());
+    LayoutUnit intersectHeight = intersection(nonZeroVisibleRect, exposeRectY).height();
     if (intersectHeight == exposeRect.height()) {
         // If the rectangle is fully visible, use the specified visible behavior.
         scrollY = getVisibleBehavior(alignY);
-    } else if (intersectHeight == visibleRect.height()) {
+    } else if (intersectHeight == nonZeroVisibleRect.height()) {
         // If the rect is bigger than the visible area, don't bother trying to center. Other alignments will work.
         scrollY = getVisibleBehavior(alignY);
         if (scrollY == ScrollAlignmentCenter)
@@ -120,10 +129,10 @@
 
     if (scrollY == ScrollAlignmentClosestEdge) {
         // Closest edge is the bottom in two cases:
-        // (1) exposeRect below and smaller than visibleRect
-        // (2) exposeRect above and larger than visibleRect
-        if ((exposeRect.maxY() > visibleRect.maxY() && exposeRect.height() < visibleRect.height())
-            || (exposeRect.maxY() < visibleRect.maxY() && exposeRect.height() > visibleRect.height())) {
+        // (1) exposeRect below and smaller than nonZeroVisibleRect
+        // (2) exposeRect above and larger than nonZeroVisibleRect
+        if ((exposeRect.maxY() > nonZeroVisibleRect.maxY() && exposeRect.height() < nonZeroVisibleRect.height())
+            || (exposeRect.maxY() < nonZeroVisibleRect.maxY() && exposeRect.height() > nonZeroVisibleRect.height())) {
             scrollY = ScrollAlignmentBottom;
         }
     }
@@ -131,15 +140,15 @@
     // Given the Y behavior, compute the Y coordinate.
     LayoutUnit y;
     if (scrollY == ScrollAlignmentNoScroll)
-        y = visibleRect.y();
+        y = nonZeroVisibleRect.y();
     else if (scrollY == ScrollAlignmentBottom)
-        y = exposeRect.maxY() - visibleRect.height();
+        y = exposeRect.maxY() - nonZeroVisibleRect.height();
     else if (scrollY == ScrollAlignmentCenter)
-        y = exposeRect.y() + (exposeRect.height() - visibleRect.height()) / 2;
+        y = exposeRect.y() + (exposeRect.height() - nonZeroVisibleRect.height()) / 2;
     else
         y = exposeRect.y();
 
-    return LayoutRect(LayoutPoint(x, y), visibleRect.size());
+    return LayoutRect(LayoutPoint(x, y), nonZeroVisibleRect.size());
 }
 
 } // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/api/LayoutViewItem.h b/third_party/WebKit/Source/core/layout/api/LayoutViewItem.h
index f7fd8d3..f9e944dc 100644
--- a/third_party/WebKit/Source/core/layout/api/LayoutViewItem.h
+++ b/third_party/WebKit/Source/core/layout/api/LayoutViewItem.h
@@ -75,6 +75,11 @@
         return toView()->hitTest(result);
     }
 
+    IntRect selectionBounds()
+    {
+        return toView()->selectionBounds();
+    }
+
 private:
     LayoutView* toView() { return toLayoutView(layoutObject()); }
     const LayoutView* toView() const { return toLayoutView(layoutObject()); }
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
index 6eabed899..c63e283 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
@@ -231,11 +231,8 @@
     updateTransform(layoutObject()->styleRef());
     updateFilters(layoutObject()->styleRef());
     updateBackdropFilters(layoutObject()->styleRef());
-
-    if (RuntimeEnabledFeatures::cssCompositingEnabled()) {
-        updateLayerBlendMode(layoutObject()->styleRef());
-        updateIsRootForIsolatedGroup();
-    }
+    updateLayerBlendMode(layoutObject()->styleRef());
+    updateIsRootForIsolatedGroup();
 }
 
 void CompositedLayerMapping::destroyGraphicsLayers()
@@ -738,11 +735,8 @@
     if (m_owningLayer.getScrollableArea() && m_owningLayer.getScrollableArea()->scrollsOverflow())
         m_owningLayer.getScrollableArea()->positionOverflowControls();
 
-    if (RuntimeEnabledFeatures::cssCompositingEnabled()) {
-        updateLayerBlendMode(layoutObject()->styleRef());
-        updateIsRootForIsolatedGroup();
-    }
-
+    updateLayerBlendMode(layoutObject()->styleRef());
+    updateIsRootForIsolatedGroup();
     updateContentsRect();
     updateBackgroundColor();
     updateDrawsContent();
diff --git a/third_party/WebKit/Source/core/loader/DocumentLoader.cpp b/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
index 80bca0b..f146688 100644
--- a/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
@@ -645,10 +645,6 @@
     // A bunch of headers are set when the underlying ResourceLoader is created, and m_request needs to include those.
     // Even when using a cached resource, we may make some modification to the request, e.g. adding the referer header.
     m_request = mainResourceLoader() ? m_mainResource->resourceRequest() : fetchRequest.resourceRequest();
-    // If there was a fragment identifier on m_request, the cache will have stripped it. m_request should include
-    // the fragment identifier, so add that back in.
-    if (equalIgnoringFragmentIdentifier(m_request.url(), fetchRequest.url()))
-        m_request.setURL(fetchRequest.url());
     m_mainResource->addClient(this);
 }
 
diff --git a/third_party/WebKit/Source/core/loader/ImageLoader.cpp b/third_party/WebKit/Source/core/loader/ImageLoader.cpp
index c7e4591..425d692 100644
--- a/third_party/WebKit/Source/core/loader/ImageLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/ImageLoader.cpp
@@ -93,7 +93,7 @@
         , m_referrerPolicy(referrerPolicy)
     {
         ExecutionContext& context = m_loader->element()->document();
-        m_operationId = InspectorInstrumentation::traceAsyncOperationStarting(&context, "Load image");
+        InspectorInstrumentation::asyncTaskScheduled(&context, "Image", this);
         v8::Isolate* isolate = V8PerIsolateData::mainThreadIsolate();
         v8::HandleScope scope(isolate);
         // If we're invoked from C++ without a V8 context on the stack, we should
@@ -115,14 +115,13 @@
         if (!m_loader)
             return;
         ExecutionContext& context = m_loader->element()->document();
-        InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsyncOperationCompletedCallbackStarting(&context, m_operationId);
+        InspectorInstrumentation::AsyncTask asyncTask(&context, this);
         if (m_scriptState->contextIsValid()) {
             ScriptState::Scope scope(m_scriptState.get());
             m_loader->doUpdateFromElement(m_shouldBypassMainWorldCSP, m_updateBehavior, m_referrerPolicy);
         } else {
             m_loader->doUpdateFromElement(m_shouldBypassMainWorldCSP, m_updateBehavior, m_referrerPolicy);
         }
-        InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
     }
 
     void clearLoader()
@@ -143,7 +142,6 @@
     RefPtr<ScriptState> m_scriptState;
     WeakPtrFactory<Task> m_weakFactory;
     ReferrerPolicy m_referrerPolicy;
-    int m_operationId;
 };
 
 ImageLoader::ImageLoader(Element* element)
diff --git a/third_party/WebKit/Source/core/loader/TextTrackLoader.cpp b/third_party/WebKit/Source/core/loader/TextTrackLoader.cpp
index c7461a1..190a623d 100644
--- a/third_party/WebKit/Source/core/loader/TextTrackLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/TextTrackLoader.cpp
@@ -56,11 +56,11 @@
 
     if (m_newCuesAvailable) {
         m_newCuesAvailable = false;
-        m_client.newCuesAvailable(this);
+        m_client->newCuesAvailable(this);
     }
 
     if (m_state >= Finished)
-        m_client.cueLoadingCompleted(this, m_state == Failed);
+        m_client->cueLoadingCompleted(this, m_state == Failed);
 }
 
 void TextTrackLoader::cancelLoad()
@@ -133,7 +133,7 @@
 
 void TextTrackLoader::newRegionsParsed()
 {
-    m_client.newRegionsAvailable(this);
+    m_client->newRegionsAvailable(this);
 }
 
 void TextTrackLoader::fileFailedToParse()
@@ -164,6 +164,7 @@
 
 DEFINE_TRACE(TextTrackLoader)
 {
+    visitor->trace(m_client);
     visitor->trace(m_cueParser);
     visitor->trace(m_document);
     ResourceOwner<RawResource>::trace(visitor);
diff --git a/third_party/WebKit/Source/core/loader/TextTrackLoader.h b/third_party/WebKit/Source/core/loader/TextTrackLoader.h
index ddb2a0b..3ec27cd2 100644
--- a/third_party/WebKit/Source/core/loader/TextTrackLoader.h
+++ b/third_party/WebKit/Source/core/loader/TextTrackLoader.h
@@ -39,7 +39,7 @@
 class Document;
 class TextTrackLoader;
 
-class TextTrackLoaderClient {
+class TextTrackLoaderClient : public GarbageCollectedMixin {
 public:
     virtual ~TextTrackLoaderClient() {}
 
@@ -86,7 +86,7 @@
 
     Document& document() const { return *m_document; }
 
-    TextTrackLoaderClient& m_client;
+    Member<TextTrackLoaderClient> m_client;
     Member<VTTParser> m_cueParser;
     // FIXME: Remove this pointer and get the Document from m_client.
     Member<Document> m_document;
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp b/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp
index 50cf8909..cc6d5fd 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp
@@ -461,9 +461,25 @@
         ancestorBackgroundClipRect = m_paintLayer.clipper().backgroundClipRect(clipRectsContext);
     }
 
+    LayoutObject* object = m_paintLayer.layoutObject();
+    LayoutView* view = object->view();
+    bool isFixedPosObjectInPagedMedia = object->style()->position() == FixedPosition && object->container() == view && view->pageLogicalHeight();
     PaintLayer* paginationLayer = m_paintLayer.enclosingPaginationLayer();
     PaintLayerFragments fragments;
-    if (paginationLayer) {
+    if (isFixedPosObjectInPagedMedia) {
+        // "For paged media, boxes with fixed positions are repeated on every page."
+        // - https://www.w3.org/TR/2011/REC-CSS2-20110607/visuren.html#fixed-positioning
+        ASSERT(view->firstChild() && view->firstChild()->isLayoutBlock());
+        int pages = toLayoutBlock(view->firstChild())->logicalHeight() / view->pageLogicalHeight();
+        LayoutPoint paginationOffset;
+        for (int i = 0; i <= pages; i++) {
+            PaintLayerFragment fragment;
+            fragment.backgroundRect = paintingInfo.paintDirtyRect;
+            fragment.paginationOffset = paginationOffset;
+            fragments.append(fragment);
+            paginationOffset += LayoutPoint(0, view->pageLogicalHeight());
+        }
+    } else if (paginationLayer) {
         // FIXME: This is a mess. Look closely at this code and the code in Layer and fix any
         // issues in it & refactor to make it obvious from code structure what it does and that it's
         // correct.
@@ -493,7 +509,10 @@
         Optional<LayerClipRecorder> clipRecorder;
         if (parentLayer) {
             ClipRect clipRectForFragment(ancestorBackgroundClipRect);
-            clipRectForFragment.moveBy(fragment.paginationOffset);
+            // A fixed-position object is repeated on every page, but if it is clipped by an ancestor layer then
+            // the repetitions are clipped out.
+            if (!isFixedPosObjectInPagedMedia)
+                clipRectForFragment.moveBy(fragment.paginationOffset);
             clipRectForFragment.intersect(fragment.backgroundRect);
             if (clipRectForFragment.isEmpty())
                 continue;
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.cpp b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
index 49e5bca..31ac24a 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyle.cpp
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
@@ -718,9 +718,8 @@
         return true;
 
     if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) {
-        if (RuntimeEnabledFeatures::cssCompositingEnabled()
-            && (rareNonInheritedData->m_effectiveBlendMode != other.rareNonInheritedData->m_effectiveBlendMode
-                || rareNonInheritedData->m_isolation != other.rareNonInheritedData->m_isolation))
+        if (rareNonInheritedData->m_effectiveBlendMode != other.rareNonInheritedData->m_effectiveBlendMode
+            || rareNonInheritedData->m_isolation != other.rareNonInheritedData->m_isolation)
             return true;
 
         if (rareNonInheritedData->m_mask != other.rareNonInheritedData->m_mask
diff --git a/third_party/WebKit/Source/core/workers/WorkerEventQueue.cpp b/third_party/WebKit/Source/core/workers/WorkerEventQueue.cpp
index 336765e..c05bba0 100644
--- a/third_party/WebKit/Source/core/workers/WorkerEventQueue.cpp
+++ b/third_party/WebKit/Source/core/workers/WorkerEventQueue.cpp
@@ -69,13 +69,14 @@
             m_eventQueue->removeEvent(m_event.get());
     }
 
-    void dispatchEvent(ExecutionContext*, RawPtr<Event> prpEvent)
+    void dispatchEvent(ExecutionContext* context, RawPtr<Event> prpEvent)
     {
         // Stash the event on the stack in a RawPtr; trying to do this
         // in a single line causes an optimization bug with MSVC. MSVC generates code
         // that passes the event arg (forcing RawPtr to be released)
         // before the target is queried.
         RawPtr<Event> event = prpEvent;
+        InspectorInstrumentation::AsyncTask asyncTask(context, event);
         event->target()->dispatchEvent(event);
     }
 
@@ -109,7 +110,7 @@
 
 void WorkerEventQueue::removeEvent(Event* event)
 {
-    InspectorInstrumentation::didRemoveEvent(event->target(), event);
+    InspectorInstrumentation::asyncTaskCanceled(event->target()->getExecutionContext(), event);
     m_eventTaskMap.remove(event);
 }
 
@@ -117,7 +118,7 @@
 {
     if (m_isClosed)
         return false;
-    InspectorInstrumentation::didEnqueueEvent(event->target(), event);
+    InspectorInstrumentation::asyncTaskScheduled(event->target()->getExecutionContext(), event->type(), event);
     OwnPtr<EventDispatcherTask> task = EventDispatcherTask::create(event, this);
     m_eventTaskMap.add(event, task.get());
     m_executionContext->postTask(BLINK_FROM_HERE, task.release());
@@ -140,7 +141,7 @@
     for (const auto& entry : m_eventTaskMap) {
         Event* event = entry.key.get();
         EventDispatcherTask* task = entry.value;
-        InspectorInstrumentation::didRemoveEvent(event->target(), event);
+        InspectorInstrumentation::asyncTaskCanceled(event->target()->getExecutionContext(), event);
         task->cancel();
     }
     m_eventTaskMap.clear();
diff --git a/third_party/WebKit/Source/core/workers/WorkerThread.cpp b/third_party/WebKit/Source/core/workers/WorkerThread.cpp
index 31b9f57b5..edd99424 100644
--- a/third_party/WebKit/Source/core/workers/WorkerThread.cpp
+++ b/third_party/WebKit/Source/core/workers/WorkerThread.cpp
@@ -116,11 +116,8 @@
         return;
     }
 
-    if (isInstrumented)
-        InspectorInstrumentation::willPerformExecutionContextTask(globalScope, task.get());
+    InspectorInstrumentation::AsyncTask asyncTask(globalScope, task.get(), isInstrumented);
     task->performTask(globalScope);
-    if (isInstrumented)
-        InspectorInstrumentation::didPerformExecutionContextTask(globalScope);
 }
 
 PassOwnPtr<CrossThreadClosure> WorkerThread::createWorkerThreadTask(PassOwnPtr<ExecutionContextTask> task, bool isInstrumented)
@@ -130,7 +127,7 @@
     if (isInstrumented) {
         // TODO(hiroshige): This doesn't work when called on the main thread.
         // https://crbug.com/588497
-        InspectorInstrumentation::didPostExecutionContextTask(workerGlobalScope(), task.get());
+        InspectorInstrumentation::asyncTaskScheduled(workerGlobalScope(), "Worker task", task.get());
     }
     return threadSafeBind(&WorkerThread::performTask, AllowCrossThreadAccess(this), task, isInstrumented);
 }
@@ -347,7 +344,7 @@
     else
         terminateV8Execution();
 
-    InspectorInstrumentation::didKillAllExecutionContextTasks(m_workerGlobalScope.get());
+    InspectorInstrumentation::allAsyncTasksCanceled(m_workerGlobalScope.get());
     m_inspectorTaskRunner->kill();
     backingThread().postTask(BLINK_FROM_HERE, threadSafeBind(&WorkerThread::shutdown, AllowCrossThreadAccess(this)));
 }
diff --git a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
index e1ff6b8..ed385f4 100644
--- a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
+++ b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
@@ -856,11 +856,15 @@
         return;
     }
 
+    ASSERT(getExecutionContext());
+    ExecutionContext& executionContext = *this->getExecutionContext();
+
     // The presence of upload event listeners forces us to use preflighting because POSTing to an URL that does not
     // permit cross origin requests should look exactly like POSTing to an URL that does not respond at all.
     // Also, only async requests support upload progress events.
     bool uploadEvents = false;
     if (m_async) {
+        InspectorInstrumentation::asyncTaskScheduled(&executionContext, "XMLHttpRequest.send", this, true);
         dispatchProgressEvent(EventTypeNames::loadstart, 0, 0);
         if (httpBody && m_upload) {
             uploadEvents = m_upload->hasEventListeners();
@@ -874,9 +878,6 @@
     // added after the request is started.
     m_uploadEventsAllowed = m_sameOriginRequest || uploadEvents || !FetchUtils::isSimpleRequest(m_method, m_requestHeaders);
 
-    ASSERT(getExecutionContext());
-    ExecutionContext& executionContext = *this->getExecutionContext();
-
     ResourceRequest request(m_url);
     request.setHTTPMethod(m_method);
     request.setRequestContext(WebURLRequest::RequestContextXMLHttpRequest);
@@ -1068,10 +1069,11 @@
     unsigned long long loaded = receivedLength >= 0 ? static_cast<unsigned long long>(receivedLength) : 0;
     unsigned long long total = lengthComputable ? static_cast<unsigned long long>(expectedLength) : 0;
 
+    ExecutionContext* context = getExecutionContext();
+    InspectorInstrumentation::AsyncTask asyncTask(context, this, m_async);
     m_progressEventThrottle->dispatchProgressEvent(type, lengthComputable, loaded, total);
-
-    if (type == EventTypeNames::loadend)
-        InspectorInstrumentation::didDispatchXHRLoadendEvent(getExecutionContext(), this);
+    if (m_async && type == EventTypeNames::loadend)
+        InspectorInstrumentation::asyncTaskCanceled(context, this);
 }
 
 void XMLHttpRequest::dispatchProgressEventFromSnapshot(const AtomicString& type)
diff --git a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.h b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.h
index 13b6453..2e2b48c42 100644
--- a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.h
+++ b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.h
@@ -140,6 +140,7 @@
     void sendForInspectorXHRReplay(PassRefPtr<EncodedFormData>, ExceptionState&);
 
     XMLHttpRequestUpload* upload();
+    bool isAsync() { return m_async; }
 
     DEFINE_ATTRIBUTE_EVENT_LISTENER(readystatechange);
 
diff --git a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestProgressEventThrottle.cpp b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestProgressEventThrottle.cpp
index 6051ce7..7c9fbcd 100644
--- a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestProgressEventThrottle.cpp
+++ b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestProgressEventThrottle.cpp
@@ -119,6 +119,7 @@
         // the previously dispatched event changes the readyState (e.g. when
         // the event handler calls xhr.abort()). In such cases a
         // readystatechange should have been already dispatched if necessary.
+        InspectorInstrumentation::AsyncTask asyncTask(m_target->getExecutionContext(), m_target, m_target->isAsync());
         m_target->dispatchEvent(event);
     }
 }
@@ -128,6 +129,7 @@
     XMLHttpRequest::State state = m_target->readyState();
     if (m_target->readyState() == XMLHttpRequest::LOADING && m_hasDispatchedProgressProgressEvent) {
         TRACE_EVENT1("devtools.timeline", "XHRReadyStateChange", "data", InspectorXhrReadyStateChangeEvent::data(m_target->getExecutionContext(), m_target));
+        InspectorInstrumentation::AsyncTask asyncTask(m_target->getExecutionContext(), m_target, m_target->isAsync());
         m_target->dispatchEvent(Event::create(EventTypeNames::readystatechange));
         TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "UpdateCounters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data());
     }
@@ -136,6 +138,7 @@
         return;
 
     m_hasDispatchedProgressProgressEvent = true;
+    InspectorInstrumentation::AsyncTask asyncTask(m_target->getExecutionContext(), m_target, 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 07cd817..42456f2 100644
--- a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestUpload.cpp
+++ b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestUpload.cpp
@@ -27,6 +27,7 @@
 
 #include "core/EventTypeNames.h"
 #include "core/events/ProgressEvent.h"
+#include "core/inspector/InspectorInstrumentation.h"
 #include "wtf/Assertions.h"
 #include "wtf/text/AtomicString.h"
 
@@ -53,12 +54,14 @@
 {
     m_lastBytesSent = bytesSent;
     m_lastTotalBytesToBeSent = totalBytesToBeSent;
+    InspectorInstrumentation::AsyncTask asyncTask(getExecutionContext(), m_xmlHttpRequest, m_xmlHttpRequest->isAsync());
     dispatchEvent(ProgressEvent::create(EventTypeNames::progress, true, bytesSent, totalBytesToBeSent));
 }
 
 void XMLHttpRequestUpload::dispatchEventAndLoadEnd(const AtomicString& type, bool lengthComputable, unsigned long long bytesSent, unsigned long long total)
 {
     ASSERT(type == EventTypeNames::load || type == EventTypeNames::abort || type == EventTypeNames::error || type == EventTypeNames::timeout);
+    InspectorInstrumentation::AsyncTask asyncTask(getExecutionContext(), m_xmlHttpRequest, m_xmlHttpRequest->isAsync());
     dispatchEvent(ProgressEvent::create(type, lengthComputable, bytesSent, total));
     dispatchEvent(ProgressEvent::create(EventTypeNames::loadend, lengthComputable, bytesSent, total));
 }
@@ -66,6 +69,7 @@
 void XMLHttpRequestUpload::handleRequestError(const AtomicString& type)
 {
     bool lengthComputable = m_lastTotalBytesToBeSent > 0 && m_lastBytesSent <= m_lastTotalBytesToBeSent;
+    InspectorInstrumentation::AsyncTask asyncTask(getExecutionContext(), m_xmlHttpRequest, m_xmlHttpRequest->isAsync());
     dispatchEvent(ProgressEvent::create(EventTypeNames::progress, lengthComputable, m_lastBytesSent, m_lastTotalBytesToBeSent));
     dispatchEventAndLoadEnd(type, lengthComputable, m_lastBytesSent, m_lastTotalBytesToBeSent);
 }
diff --git a/third_party/WebKit/Source/modules/filesystem/FileSystemCallbacks.cpp b/third_party/WebKit/Source/modules/filesystem/FileSystemCallbacks.cpp
index 2101f38d..cfe3984 100644
--- a/third_party/WebKit/Source/modules/filesystem/FileSystemCallbacks.cpp
+++ b/third_party/WebKit/Source/modules/filesystem/FileSystemCallbacks.cpp
@@ -35,7 +35,6 @@
 #include "core/fileapi/File.h"
 #include "core/fileapi/FileError.h"
 #include "core/html/VoidCallback.h"
-#include "core/inspector/InspectorInstrumentation.h"
 #include "modules/filesystem/DOMFilePath.h"
 #include "modules/filesystem/DOMFileSystem.h"
 #include "modules/filesystem/DOMFileSystemBase.h"
@@ -59,20 +58,15 @@
     : m_errorCallback(errorCallback)
     , m_fileSystem(fileSystem)
     , m_executionContext(context)
-    , m_asyncOperationId(0)
 {
     if (m_fileSystem)
         m_fileSystem->addPendingCallbacks();
-    if (m_executionContext)
-        m_asyncOperationId = InspectorInstrumentation::traceAsyncOperationStarting(m_executionContext.get(), "FileSystem");
 }
 
 FileSystemCallbacksBase::~FileSystemCallbacksBase()
 {
     if (m_fileSystem)
         m_fileSystem->removePendingCallbacks();
-    if (m_asyncOperationId && m_executionContext)
-        InspectorInstrumentation::traceAsyncOperationCompleted(m_executionContext.get(), m_asyncOperationId);
 }
 
 void FileSystemCallbacksBase::didFail(int code)
@@ -90,26 +84,22 @@
 void FileSystemCallbacksBase::handleEventOrScheduleCallback(RawPtr<CB> callback, CBArg* arg)
 {
     ASSERT(callback);
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsyncOperationCompletedCallbackStarting(m_executionContext.get(), m_asyncOperationId);
     if (shouldScheduleCallback())
         DOMFileSystem::scheduleCallback(m_executionContext.get(), callback.get(), arg);
     else if (callback)
         callback->handleEvent(arg);
     m_executionContext.clear();
-    InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
 }
 
 template <typename CB>
 void FileSystemCallbacksBase::handleEventOrScheduleCallback(RawPtr<CB> callback)
 {
     ASSERT(callback);
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsyncOperationCompletedCallbackStarting(m_executionContext.get(), m_asyncOperationId);
     if (shouldScheduleCallback())
         DOMFileSystem::scheduleCallback(m_executionContext.get(), callback.get());
     else if (callback)
         callback->handleEvent();
     m_executionContext.clear();
-    InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
 }
 
 // EntryCallbacks -------------------------------------------------------------
@@ -167,12 +157,8 @@
     EntryHeapVector entries;
     entries.swap(m_entries);
     // FIXME: delay the callback iff shouldScheduleCallback() is true.
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsyncCallbackStarting(m_executionContext.get(), m_asyncOperationId);
     if (m_successCallback)
         m_successCallback->handleEvent(entries);
-    InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
-    if (!hasMore)
-        InspectorInstrumentation::traceAsyncOperationCompleted(m_executionContext.get(), m_asyncOperationId);
 }
 
 // FileSystemCallbacks --------------------------------------------------------
diff --git a/third_party/WebKit/Source/modules/filesystem/FileWriter.cpp b/third_party/WebKit/Source/modules/filesystem/FileWriter.cpp
index 4e26a86c..5e56067 100644
--- a/third_party/WebKit/Source/modules/filesystem/FileWriter.cpp
+++ b/third_party/WebKit/Source/modules/filesystem/FileWriter.cpp
@@ -63,7 +63,6 @@
     , m_numAborts(0)
     , m_recursionDepth(0)
     , m_lastProgressNotificationTimeMS(0)
-    , m_asyncOperationId(0)
 {
 }
 
@@ -250,7 +249,7 @@
 
 void FileWriter::doOperation(Operation operation)
 {
-    m_asyncOperationId = InspectorInstrumentation::traceAsyncOperationStarting(getExecutionContext(), "FileWriter", m_asyncOperationId);
+    InspectorInstrumentation::asyncTaskScheduled(getExecutionContext(), "FileWriter", this);
     switch (operation) {
     case OperationWrite:
         ASSERT(m_operationInProgress == OperationNone);
@@ -299,18 +298,16 @@
         fireEvent(EventTypeNames::write);
     fireEvent(EventTypeNames::writeend);
 
-    InspectorInstrumentation::traceAsyncOperationCompleted(getExecutionContext(), m_asyncOperationId);
-    m_asyncOperationId = 0;
+    InspectorInstrumentation::asyncTaskCanceled(getExecutionContext(), this);
 }
 
 void FileWriter::fireEvent(const AtomicString& type)
 {
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsyncCallbackStarting(getExecutionContext(), m_asyncOperationId);
+    InspectorInstrumentation::AsyncTask asyncTask(getExecutionContext(), this);
     ++m_recursionDepth;
     dispatchEvent(ProgressEvent::create(type, true, m_bytesWritten, m_bytesToWrite));
     --m_recursionDepth;
     ASSERT(m_recursionDepth >= 0);
-    InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
 }
 
 void FileWriter::setError(FileError::ErrorCode errorCode, ExceptionState& exceptionState)
diff --git a/third_party/WebKit/Source/modules/filesystem/FileWriter.h b/third_party/WebKit/Source/modules/filesystem/FileWriter.h
index e92f98a..11115fc6 100644
--- a/third_party/WebKit/Source/modules/filesystem/FileWriter.h
+++ b/third_party/WebKit/Source/modules/filesystem/FileWriter.h
@@ -132,7 +132,6 @@
     long long m_recursionDepth;
     double m_lastProgressNotificationTimeMS;
     Member<Blob> m_blobBeingWritten;
-    int m_asyncOperationId;
 };
 
 } // namespace blink
diff --git a/third_party/WebKit/Source/modules/indexeddb/WebIDBCallbacksImpl.cpp b/third_party/WebKit/Source/modules/indexeddb/WebIDBCallbacksImpl.cpp
index a7aeccf..b97c3024 100644
--- a/third_party/WebKit/Source/modules/indexeddb/WebIDBCallbacksImpl.cpp
+++ b/third_party/WebKit/Source/modules/indexeddb/WebIDBCallbacksImpl.cpp
@@ -60,19 +60,18 @@
 WebIDBCallbacksImpl::WebIDBCallbacksImpl(IDBRequest* request)
     : m_request(request)
 {
-    m_asyncOperationId = InspectorInstrumentation::traceAsyncOperationStarting(m_request->getExecutionContext(), "IndexedDB");
+    InspectorInstrumentation::asyncTaskScheduled(m_request->getExecutionContext(), "IndexedDB", this, true);
 }
 
 WebIDBCallbacksImpl::~WebIDBCallbacksImpl()
 {
-    InspectorInstrumentation::traceAsyncOperationCompleted(m_request->getExecutionContext(), m_asyncOperationId);
+    InspectorInstrumentation::asyncTaskCanceled(m_request->getExecutionContext(), this);
 }
 
 void WebIDBCallbacksImpl::onError(const WebIDBDatabaseError& error)
 {
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsyncCallbackStarting(m_request->getExecutionContext(), m_asyncOperationId);
+    InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext(), this);
     m_request->onError(DOMException::create(error.code(), error.message()));
-    InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
 }
 
 void WebIDBCallbacksImpl::onSuccess(const WebVector<WebString>& webStringList)
@@ -80,82 +79,71 @@
     Vector<String> stringList;
     for (size_t i = 0; i < webStringList.size(); ++i)
         stringList.append(webStringList[i]);
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsyncCallbackStarting(m_request->getExecutionContext(), m_asyncOperationId);
+    InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext(), this);
     m_request->onSuccess(stringList);
-    InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
 }
 
 void WebIDBCallbacksImpl::onSuccess(WebIDBCursor* cursor, const WebIDBKey& key, const WebIDBKey& primaryKey, const WebIDBValue& value)
 {
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsyncCallbackStarting(m_request->getExecutionContext(), m_asyncOperationId);
+    InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext(), this);
     m_request->onSuccess(adoptPtr(cursor), key, primaryKey, IDBValue::create(value));
-    InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
 }
 
 void WebIDBCallbacksImpl::onSuccess(WebIDBDatabase* backend, const WebIDBMetadata& metadata)
 {
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsyncCallbackStarting(m_request->getExecutionContext(), m_asyncOperationId);
+    InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext(), this);
     m_request->onSuccess(adoptPtr(backend), IDBDatabaseMetadata(metadata));
-    InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
 }
 
 void WebIDBCallbacksImpl::onSuccess(const WebIDBKey& key)
 {
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsyncCallbackStarting(m_request->getExecutionContext(), m_asyncOperationId);
+    InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext(), this);
     m_request->onSuccess(key);
-    InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
 }
 
 void WebIDBCallbacksImpl::onSuccess(const WebIDBValue& value)
 {
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsyncCallbackStarting(m_request->getExecutionContext(), m_asyncOperationId);
+    InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext(), this);
     m_request->onSuccess(IDBValue::create(value));
-    InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
 }
 
 void WebIDBCallbacksImpl::onSuccess(const WebVector<WebIDBValue>& values)
 {
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsyncCallbackStarting(m_request->getExecutionContext(), m_asyncOperationId);
+    InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext(), this);
     Vector<RefPtr<IDBValue>> idbValues(values.size());
     for (size_t i = 0; i < values.size(); ++i)
         idbValues[i] = IDBValue::create(values[i]);
     m_request->onSuccess(idbValues);
-    InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
 }
 
 void WebIDBCallbacksImpl::onSuccess(long long value)
 {
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsyncCallbackStarting(m_request->getExecutionContext(), m_asyncOperationId);
+    InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext(), this);
     m_request->onSuccess(value);
-    InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
 }
 
 void WebIDBCallbacksImpl::onSuccess()
 {
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsyncCallbackStarting(m_request->getExecutionContext(), m_asyncOperationId);
+    InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext(), this);
     m_request->onSuccess();
-    InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
 }
 
 void WebIDBCallbacksImpl::onSuccess(const WebIDBKey& key, const WebIDBKey& primaryKey, const WebIDBValue& value)
 {
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsyncCallbackStarting(m_request->getExecutionContext(), m_asyncOperationId);
+    InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext(), this);
     m_request->onSuccess(key, primaryKey, IDBValue::create(value));
-    InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
 }
 
 void WebIDBCallbacksImpl::onBlocked(long long oldVersion)
 {
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsyncCallbackStarting(m_request->getExecutionContext(), m_asyncOperationId);
+    InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext(), this);
     m_request->onBlocked(oldVersion);
-    InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
 }
 
 void WebIDBCallbacksImpl::onUpgradeNeeded(long long oldVersion, WebIDBDatabase* database, const WebIDBMetadata& metadata, unsigned short dataLoss, WebString dataLossMessage)
 {
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsyncCallbackStarting(m_request->getExecutionContext(), m_asyncOperationId);
+    InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext(), this);
     m_request->onUpgradeNeeded(oldVersion, adoptPtr(database), IDBDatabaseMetadata(metadata), static_cast<WebIDBDataLoss>(dataLoss), dataLossMessage);
-    InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
 }
 
 } // namespace blink
diff --git a/third_party/WebKit/Source/modules/indexeddb/WebIDBCallbacksImpl.h b/third_party/WebKit/Source/modules/indexeddb/WebIDBCallbacksImpl.h
index 94b890a..4f8d0c23 100644
--- a/third_party/WebKit/Source/modules/indexeddb/WebIDBCallbacksImpl.h
+++ b/third_party/WebKit/Source/modules/indexeddb/WebIDBCallbacksImpl.h
@@ -69,7 +69,6 @@
     explicit WebIDBCallbacksImpl(IDBRequest*);
 
     Persistent<IDBRequest> m_request;
-    int m_asyncOperationId;
 };
 
 } // namespace blink
diff --git a/third_party/WebKit/Source/modules/mediacapturefromelement/HTMLCanvasElementCapture.cpp b/third_party/WebKit/Source/modules/mediacapturefromelement/HTMLCanvasElementCapture.cpp
index 18550f32..17c81e4c 100644
--- a/third_party/WebKit/Source/modules/mediacapturefromelement/HTMLCanvasElementCapture.cpp
+++ b/third_party/WebKit/Source/modules/mediacapturefromelement/HTMLCanvasElementCapture.cpp
@@ -42,13 +42,13 @@
     }
 
     WebMediaStreamTrack track;
-    WebSize size(element.width(), element.height());
+    const WebSize size(element.width(), element.height());
     OwnPtr<WebCanvasCaptureHandler> handler;
     if (givenFrameRate)
         handler = adoptPtr(Platform::current()->createCanvasCaptureHandler(size, frameRate, &track));
     else
         handler = adoptPtr(Platform::current()->createCanvasCaptureHandler(size, kDefaultFrameRate, &track));
-    ASSERT(handler);
+
     if (!handler) {
         exceptionState.throwDOMException(NotSupportedError, "No CanvasCapture handler can be created.");
         return nullptr;
diff --git a/third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.cpp b/third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.cpp
index 80f1a9d..ce48adf 100644
--- a/third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.cpp
+++ b/third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.cpp
@@ -38,7 +38,7 @@
         return "paused";
     }
 
-    ASSERT_NOT_REACHED();
+    NOTREACHED();
     return String();
 }
 
@@ -88,7 +88,7 @@
                 audioBps = kSmallestPossibleOpusBitRate;
             }
         } else {
-            ASSERT(!audioBps);
+            DCHECK(!audioBps);
         }
     }
 
@@ -103,7 +103,7 @@
                 videoBps = kSmallestPossibleVpxBitRate;
             }
         } else {
-            ASSERT(!videoBps);
+            DCHECK(!videoBps);
         }
     }
 
@@ -143,10 +143,10 @@
     , m_state(State::Inactive)
     , m_dispatchScheduledEventRunner(AsyncMethodRunner<MediaRecorder>::create(this, &MediaRecorder::dispatchScheduledEvent))
 {
-    ASSERT(m_stream->getTracks().size());
+    DCHECK(m_stream->getTracks().size());
 
     m_recorderHandler = adoptPtr(Platform::current()->createMediaRecorderHandler());
-    ASSERT(m_recorderHandler);
+    DCHECK(m_recorderHandler);
 
     if (!m_recorderHandler) {
         exceptionState.throwDOMException(NotSupportedError, "No MediaRecorder handler can be created.");
@@ -323,7 +323,7 @@
 
 void MediaRecorder::stopRecording()
 {
-    ASSERT(m_state != State::Inactive);
+    DCHECK(m_state != State::Inactive);
     m_state = State::Inactive;
 
     m_recorderHandler->stop();
diff --git a/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp b/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
index d148896..b69172a 100644
--- a/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
+++ b/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
@@ -22,7 +22,6 @@
 #include "mojo/public/cpp/bindings/interface_request.h"
 #include "mojo/public/cpp/bindings/wtf_array.h"
 #include "platform/MojoHelper.h"
-#include "public/platform/Platform.h"
 #include "public/platform/ServiceRegistry.h"
 #include <utility>
 
@@ -172,8 +171,11 @@
     if (m_showResolver)
         return ScriptPromise::rejectWithDOMException(scriptState, DOMException::create(InvalidStateError, "Already called show() once"));
 
+    if (!scriptState->domWindow() || !scriptState->domWindow()->frame())
+        return ScriptPromise::rejectWithDOMException(scriptState, DOMException::create(InvalidStateError, "Cannot show the payment request"));
+
     DCHECK(!m_paymentProvider.is_bound());
-    blink::Platform::current()->serviceRegistry()->connectToRemoteService(mojo::GetProxy(&m_paymentProvider));
+    scriptState->domWindow()->frame()->serviceRegistry()->connectToRemoteService(mojo::GetProxy(&m_paymentProvider));
     m_paymentProvider.set_connection_error_handler(sameThreadBindForMojo(&PaymentRequest::OnError, this));
     m_paymentProvider->SetClient(m_clientBinding.CreateInterfacePtrAndBind());
     m_paymentProvider->Show(std::move(m_supportedMethods), mojom::wtf::PaymentDetails::From(m_details), mojom::wtf::PaymentOptions::From(m_options), m_stringifiedData.isNull() ? "" : m_stringifiedData);
diff --git a/third_party/WebKit/Source/modules/webdatabase/SQLStatement.cpp b/third_party/WebKit/Source/modules/webdatabase/SQLStatement.cpp
index 95f3799..80a8e3f 100644
--- a/third_party/WebKit/Source/modules/webdatabase/SQLStatement.cpp
+++ b/third_party/WebKit/Source/modules/webdatabase/SQLStatement.cpp
@@ -53,10 +53,9 @@
     SQLStatementErrorCallback* errorCallback)
     : m_statementCallback(callback)
     , m_statementErrorCallback(errorCallback)
-    , m_asyncOperationId(0)
 {
     if (hasCallback() || hasErrorCallback())
-        m_asyncOperationId = InspectorInstrumentation::traceAsyncOperationStarting(database->getExecutionContext(), "SQLStatement");
+        InspectorInstrumentation::asyncTaskScheduled(database->getExecutionContext(), "SQLStatement", this);
 }
 
 SQLStatement::~SQLStatement()
@@ -96,7 +95,7 @@
     SQLStatementErrorCallback* errorCallback = m_statementErrorCallback.release();
     SQLErrorData* error = m_backend->sqlError();
 
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsyncOperationCompletedCallbackStarting(transaction->database()->getExecutionContext(), m_asyncOperationId);
+    InspectorInstrumentation::AsyncTask asyncTask(transaction->database()->getExecutionContext(), this);
 
     // Call the appropriate statement callback and track if it resulted in an error,
     // because then we need to jump to the transaction error callback.
@@ -107,8 +106,6 @@
         callbackError = !callback->handleEvent(transaction, m_backend->sqlResultSet());
     }
 
-    InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
-
     return callbackError;
 }
 
diff --git a/third_party/WebKit/Source/modules/webdatabase/SQLStatement.h b/third_party/WebKit/Source/modules/webdatabase/SQLStatement.h
index b6e265b..6a598e0 100644
--- a/third_party/WebKit/Source/modules/webdatabase/SQLStatement.h
+++ b/third_party/WebKit/Source/modules/webdatabase/SQLStatement.h
@@ -64,7 +64,6 @@
 
     Member<SQLStatementCallback> m_statementCallback;
     Member<SQLStatementErrorCallback> m_statementErrorCallback;
-    int m_asyncOperationId;
 };
 
 } // namespace blink
diff --git a/third_party/WebKit/Source/modules/webdatabase/SQLTransaction.cpp b/third_party/WebKit/Source/modules/webdatabase/SQLTransaction.cpp
index a1df309..c1f8ed77 100644
--- a/third_party/WebKit/Source/modules/webdatabase/SQLTransaction.cpp
+++ b/third_party/WebKit/Source/modules/webdatabase/SQLTransaction.cpp
@@ -65,7 +65,7 @@
     , m_readOnly(readOnly)
 {
     ASSERT(m_database);
-    m_asyncOperationId = InspectorInstrumentation::traceAsyncOperationStarting(db->getExecutionContext(), "SQLTransaction");
+    InspectorInstrumentation::asyncTaskScheduled(db->getExecutionContext(), "SQLTransaction", this, true);
 }
 
 SQLTransaction::~SQLTransaction()
@@ -150,13 +150,12 @@
 SQLTransactionState SQLTransaction::deliverTransactionCallback()
 {
     bool shouldDeliverErrorCallback = false;
+    InspectorInstrumentation::AsyncTask asyncTask(m_database->getExecutionContext(), this);
 
     // Spec 4.3.2 4: Invoke the transaction callback with the new SQLTransaction object
     if (SQLTransactionCallback* callback = m_callback.release()) {
         m_executeSqlAllowed = true;
-        InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsyncCallbackStarting(m_database->getExecutionContext(), m_asyncOperationId);
         shouldDeliverErrorCallback = !callback->handleEvent(this);
-        InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
         m_executeSqlAllowed = false;
     }
 
@@ -173,7 +172,8 @@
 
 SQLTransactionState SQLTransaction::deliverTransactionErrorCallback()
 {
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsyncOperationCompletedCallbackStarting(m_database->getExecutionContext(), m_asyncOperationId);
+    InspectorInstrumentation::AsyncTask asyncTask(m_database->getExecutionContext(), this);
+    InspectorInstrumentation::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.
@@ -192,7 +192,6 @@
         m_transactionError = nullptr;
     }
 
-    InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
     clearCallbacks();
 
     // Spec 4.3.2.10: Rollback the transaction.
@@ -232,13 +231,13 @@
 
 SQLTransactionState SQLTransaction::deliverSuccessCallback()
 {
-    InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsyncOperationCompletedCallbackStarting(m_database->getExecutionContext(), m_asyncOperationId);
+    InspectorInstrumentation::AsyncTask asyncTask(m_database->getExecutionContext(), this);
+    InspectorInstrumentation::asyncTaskCanceled(m_database->getExecutionContext(), this);
 
     // Spec 4.3.2.8: Deliver success callback.
     if (VoidCallback* successCallback = m_successCallback.release())
         successCallback->handleEvent();
 
-    InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
     clearCallbacks();
 
     // Schedule a "post-success callback" step to return control to the database thread in case there
diff --git a/third_party/WebKit/Source/modules/webdatabase/SQLTransaction.h b/third_party/WebKit/Source/modules/webdatabase/SQLTransaction.h
index bd00e96..21e5eaf7 100644
--- a/third_party/WebKit/Source/modules/webdatabase/SQLTransaction.h
+++ b/third_party/WebKit/Source/modules/webdatabase/SQLTransaction.h
@@ -113,7 +113,6 @@
     OwnPtr<SQLErrorData> m_transactionError;
 
     bool m_readOnly;
-    int m_asyncOperationId;
 };
 
 } // namespace blink
diff --git a/third_party/WebKit/Source/platform/LayoutUnit.h b/third_party/WebKit/Source/platform/LayoutUnit.h
index f41fff9..6611ca34 100644
--- a/third_party/WebKit/Source/platform/LayoutUnit.h
+++ b/third_party/WebKit/Source/platform/LayoutUnit.h
@@ -62,7 +62,6 @@
     DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
 public:
     LayoutUnit() : m_value(0) { }
-    // TODO(leviw): All of the below constructors should be explicit. crbug.com/581254
     explicit LayoutUnit(int value) { setValue(value); }
     explicit LayoutUnit(unsigned short value) { setValue(value); }
     explicit LayoutUnit(unsigned value) { setValue(value); }
diff --git a/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in b/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in
index 3704501..2db162d 100644
--- a/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in
+++ b/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in
@@ -43,7 +43,6 @@
 CSSAdditiveAnimations status=experimental, depends_on=StackedCSSPropertyAnimations
 CSSBackdropFilter status=experimental
 CSSBoxReflectFilter
-CSSCompositing status=stable
 CSSContainment status=experimental
 CSSFontDisplay status=experimental
 CSSFontSizeAdjust status=experimental
@@ -119,6 +118,7 @@
 MediaCaptureFromVideo status=test
 MediaConstraints status=experimental
 MediaDevices status=stable
+MediaDocumentDownloadButton
 MediaRecorder status=stable
 MediaSession
 MediaSourceExperimental status=experimental
diff --git a/third_party/WebKit/Source/platform/blink_platform.gypi b/third_party/WebKit/Source/platform/blink_platform.gypi
index 8f77432..5b4ce41b 100644
--- a/third_party/WebKit/Source/platform/blink_platform.gypi
+++ b/third_party/WebKit/Source/platform/blink_platform.gypi
@@ -1049,8 +1049,6 @@
       'v8_inspector/ScriptBreakpoint.h',
       'v8_inspector/RemoteObjectId.cpp',
       'v8_inspector/RemoteObjectId.h',
-      'v8_inspector/V8AsyncCallTracker.cpp',
-      'v8_inspector/V8AsyncCallTracker.h',
       'v8_inspector/V8DebuggerAgentImpl.cpp',
       'v8_inspector/V8DebuggerAgentImpl.h',
       'v8_inspector/V8DebuggerImpl.cpp',
diff --git a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp
index b15b8f5..aac5c704 100644
--- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp
+++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp
@@ -46,22 +46,12 @@
 #include "third_party/skia/include/core/SkSurface.h"
 #include "third_party/skia/include/gpu/GrContext.h"
 #include "third_party/skia/include/gpu/gl/GrGLTypes.h"
-#include "wtf/RefCountedLeakCounter.h"
 
 namespace {
 enum {
     InvalidMailboxIndex = -1,
     MaxCanvasAnimationBacklog = 2, // Make sure the the GPU is never more than two animation frames behind.
 };
-
-#ifndef NDEBUG
-WTF::RefCountedLeakCounter& canvas2DLayerBridgeInstanceCounter()
-{
-    DEFINE_STATIC_LOCAL(WTF::RefCountedLeakCounter, staticCanvas2DLayerBridgeInstanceCounter, ("Canvas2DLayerBridge"));
-    return staticCanvas2DLayerBridgeInstanceCounter;
-}
-#endif
-
 } // namespace
 
 namespace blink {
@@ -132,9 +122,6 @@
     // Used by browser tests to detect the use of a Canvas2DLayerBridge.
     TRACE_EVENT_INSTANT0("test_gpu", "Canvas2DLayerBridgeCreation", TRACE_EVENT_SCOPE_GLOBAL);
     startRecording();
-#ifndef NDEBUG
-    canvas2DLayerBridgeInstanceCounter().increment();
-#endif
 }
 
 Canvas2DLayerBridge::~Canvas2DLayerBridge()
@@ -146,9 +133,6 @@
 
     m_layer.clear();
     ASSERT(m_mailboxes.size() == 0);
-#ifndef NDEBUG
-    canvas2DLayerBridgeInstanceCounter().decrement();
-#endif
 }
 
 void Canvas2DLayerBridge::startRecording()
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
index 0810046d..2091256b 100644
--- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
+++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
@@ -45,9 +45,6 @@
 #include "wtf/ArrayBufferContents.h"
 #include "wtf/CheckedNumeric.h"
 #include <algorithm>
-#ifndef NDEBUG
-#include "wtf/RefCountedLeakCounter.h"
-#endif
 
 namespace blink {
 
@@ -55,14 +52,6 @@
 
 const float s_resourceAdjustedRatio = 0.5;
 
-#ifndef NDEBUG
-WTF::RefCountedLeakCounter& drawingBufferCounter()
-{
-    DEFINE_STATIC_LOCAL(WTF::RefCountedLeakCounter, staticDrawingBufferCounter, ("DrawingBuffer"));
-    return staticDrawingBufferCounter;
-}
-#endif
-
 class ScopedTextureUnit0BindingRestorer {
     STACK_ALLOCATED();
     WTF_MAKE_NONCOPYABLE(ScopedTextureUnit0BindingRestorer);
@@ -173,9 +162,6 @@
 {
     // Used by browser tests to detect the use of a DrawingBuffer.
     TRACE_EVENT_INSTANT0("test_gpu", "DrawingBufferCreation", TRACE_EVENT_SCOPE_GLOBAL);
-#ifndef NDEBUG
-    drawingBufferCounter().increment();
-#endif
 }
 
 DrawingBuffer::~DrawingBuffer()
@@ -184,9 +170,6 @@
     ASSERT(m_textureMailboxes.isEmpty());
     m_layer.clear();
     m_contextProvider.clear();
-#ifndef NDEBUG
-    drawingBufferCounter().decrement();
-#endif
 }
 
 void DrawingBuffer::markContentsChanged()
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollbarThemeAura.cpp b/third_party/WebKit/Source/platform/scroll/ScrollbarThemeAura.cpp
index 8983050..8c9eb39 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollbarThemeAura.cpp
+++ b/third_party/WebKit/Source/platform/scroll/ScrollbarThemeAura.cpp
@@ -248,7 +248,7 @@
 void ScrollbarThemeAura::paintTrackBackground(GraphicsContext& context, const ScrollbarThemeClient& scrollbar, const IntRect& rect)
 {
     // Just assume a forward track part. We only paint the track as a single piece when there is no thumb.
-    if (!hasThumb(scrollbar))
+    if (!hasThumb(scrollbar) && !rect.isEmpty())
         paintTrackPiece(context, scrollbar, rect, ForwardTrackPart);
 }
 
diff --git a/third_party/WebKit/Source/platform/text/BidiCharacterRun.cpp b/third_party/WebKit/Source/platform/text/BidiCharacterRun.cpp
index 3bce36b..ed7c581 100644
--- a/third_party/WebKit/Source/platform/text/BidiCharacterRun.cpp
+++ b/third_party/WebKit/Source/platform/text/BidiCharacterRun.cpp
@@ -24,34 +24,17 @@
 #include "platform/text/BidiCharacterRun.h"
 
 #include "wtf/Partitions.h"
-#include "wtf/RefCountedLeakCounter.h"
 
 using namespace WTF;
 
 namespace blink {
-namespace {
-#ifndef NDEBUG
-static RefCountedLeakCounter& bidiRunCounter()
-{
-    DEFINE_STATIC_LOCAL(RefCountedLeakCounter, staticBidiRunCounter, ("BidiCharacterRun"));
-    return staticBidiRunCounter;
-}
-#endif
-} // namespace
-
 void* BidiCharacterRun::operator new(size_t sz)
 {
-#ifndef NDEBUG
-    bidiRunCounter().increment();
-#endif
     return partitionAlloc(Partitions::layoutPartition(), sz, WTF_HEAP_PROFILER_TYPE_NAME(BidiCharacterRun));
 }
 
 void BidiCharacterRun::operator delete(void* ptr)
 {
-#ifndef NDEBUG
-    bidiRunCounter().decrement();
-#endif
     partitionFree(ptr);
 }
 
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8AsyncCallTracker.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8AsyncCallTracker.cpp
deleted file mode 100644
index 7777248..0000000
--- a/third_party/WebKit/Source/platform/v8_inspector/V8AsyncCallTracker.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-// Copyright 2014 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 "platform/v8_inspector/V8AsyncCallTracker.h"
-
-#include "platform/inspector_protocol/Collections.h"
-#include "platform/inspector_protocol/String16.h"
-
-namespace blink {
-
-namespace {
-
-static const char v8AsyncTaskEventEnqueue[] = "enqueue";
-static const char v8AsyncTaskEventWillHandle[] = "willHandle";
-static const char v8AsyncTaskEventDidHandle[] = "didHandle";
-
-}
-
-static String16 makeV8AsyncTaskUniqueId(const String16& eventName, int id)
-{
-    String16Builder builder;
-    builder.append(eventName);
-    builder.append(" -> ");
-    builder.appendNumber(id);
-    return builder.toString();
-}
-
-V8AsyncCallTracker::V8AsyncCallTracker(V8DebuggerAgentImpl* debuggerAgent)
-    : m_debuggerAgent(debuggerAgent)
-{
-}
-
-V8AsyncCallTracker::~V8AsyncCallTracker()
-{
-    ASSERT(m_idToOperations.isEmpty());
-}
-
-void V8AsyncCallTracker::asyncCallTrackingStateChanged(bool)
-{
-}
-
-void V8AsyncCallTracker::resetAsyncOperations()
-{
-    for (auto& it : m_idToOperations)
-        completeOperations(it.second->map);
-    m_idToOperations.clear();
-}
-
-void V8AsyncCallTracker::contextDisposed(int contextId)
-{
-    completeOperations(m_idToOperations.get(contextId)->map);
-    m_idToOperations.remove(contextId);
-}
-
-void V8AsyncCallTracker::didReceiveV8AsyncTaskEvent(v8::Local<v8::Context> context, const String16& eventType, const String16& eventName, int id)
-{
-    ASSERT(m_debuggerAgent->trackingAsyncCalls());
-    if (eventType == v8AsyncTaskEventEnqueue)
-        didEnqueueV8AsyncTask(context, eventName, id);
-    else if (eventType == v8AsyncTaskEventWillHandle)
-        willHandleV8AsyncTask(context, eventName, id);
-    else if (eventType == v8AsyncTaskEventDidHandle)
-        m_debuggerAgent->traceAsyncCallbackCompleted();
-    else
-        ASSERT_NOT_REACHED();
-}
-
-void V8AsyncCallTracker::weakCallback(const v8::WeakCallbackInfo<Operations>& data)
-{
-    data.GetParameter()->target->contextDisposed(data.GetParameter()->contextId);
-}
-
-void V8AsyncCallTracker::didEnqueueV8AsyncTask(v8::Local<v8::Context> context, const String16& eventName, int id)
-{
-    ASSERT(!context.IsEmpty());
-    ASSERT(m_debuggerAgent->trackingAsyncCalls());
-    int operationId = m_debuggerAgent->traceAsyncOperationStarting(eventName);
-    if (!operationId)
-        return;
-    int contextId = V8Debugger::contextId(context);
-    Operations* operations = m_idToOperations.get(contextId);
-    if (!operations) {
-        OwnPtr<Operations> newOperations = adoptPtr(new Operations());
-        newOperations->contextId = contextId;
-        newOperations->target = this;
-        newOperations->context.Reset(context->GetIsolate(), context);
-        operations = newOperations.get();
-        m_idToOperations.set(contextId, newOperations.release());
-        operations->context.SetWeak(operations, V8AsyncCallTracker::weakCallback, v8::WeakCallbackType::kParameter);
-    }
-    operations->map.set(makeV8AsyncTaskUniqueId(eventName, id), operationId);
-}
-
-void V8AsyncCallTracker::willHandleV8AsyncTask(v8::Local<v8::Context> context, const String16& eventName, int id)
-{
-    ASSERT(!context.IsEmpty());
-    ASSERT(m_debuggerAgent->trackingAsyncCalls());
-    int contextId = V8Debugger::contextId(context);
-    if (Operations* operations = m_idToOperations.get(contextId)) {
-        String16 taskId = makeV8AsyncTaskUniqueId(eventName, id);
-        int operationId = operations->map.get(taskId);
-        m_debuggerAgent->traceAsyncCallbackStarting(operationId);
-        m_debuggerAgent->traceAsyncOperationCompleted(operationId);
-        operations->map.remove(taskId);
-    } else {
-        m_debuggerAgent->traceAsyncCallbackStarting(V8DebuggerAgentImpl::unknownAsyncOperationId);
-    }
-}
-
-void V8AsyncCallTracker::completeOperations(const protocol::HashMap<String16, int>& contextCallChains)
-{
-    for (const auto& it : contextCallChains)
-        m_debuggerAgent->traceAsyncOperationCompleted(*it.second);
-}
-
-} // namespace blink
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8AsyncCallTracker.h b/third_party/WebKit/Source/platform/v8_inspector/V8AsyncCallTracker.h
deleted file mode 100644
index 9af348d..0000000
--- a/third_party/WebKit/Source/platform/v8_inspector/V8AsyncCallTracker.h
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2014 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 V8AsyncCallTracker_h
-#define V8AsyncCallTracker_h
-
-#include "platform/inspector_protocol/Allocator.h"
-#include "platform/inspector_protocol/Collections.h"
-#include "platform/v8_inspector/V8DebuggerAgentImpl.h"
-
-#include <v8.h>
-
-namespace blink {
-
-class V8AsyncCallTracker final {
-    PROTOCOL_DISALLOW_COPY(V8AsyncCallTracker);
-public:
-    static PassOwnPtr<V8AsyncCallTracker> create(V8DebuggerAgentImpl* debuggerAgent)
-    {
-        return adoptPtr(new V8AsyncCallTracker(debuggerAgent));
-    }
-
-    ~V8AsyncCallTracker();
-
-    void asyncCallTrackingStateChanged(bool tracking);
-    void resetAsyncOperations();
-
-    void didReceiveV8AsyncTaskEvent(v8::Local<v8::Context>, const String16& eventType, const String16& eventName, int id);
-
-    void contextDisposed(int contextId);
-
-private:
-    struct Operations {
-        protocol::HashMap<String16, int> map;
-        int contextId;
-        V8AsyncCallTracker* target;
-        v8::Global<v8::Context> context;
-    };
-
-    static void weakCallback(const v8::WeakCallbackInfo<Operations>& data);
-
-    explicit V8AsyncCallTracker(V8DebuggerAgentImpl*);
-
-    void didEnqueueV8AsyncTask(v8::Local<v8::Context>, const String16& eventName, int id);
-    void willHandleV8AsyncTask(v8::Local<v8::Context>, const String16& eventName, int id);
-    void completeOperations(const protocol::HashMap<String16, int>& contextCallChains);
-
-    V8DebuggerAgentImpl* m_debuggerAgent;
-    protocol::HashMap<int, OwnPtr<Operations>> m_idToOperations;
-};
-
-} // namespace blink
-
-#endif // V8AsyncCallTracker_h
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.cpp
index c039c1c..04cf9816 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.cpp
@@ -13,7 +13,6 @@
 #include "platform/v8_inspector/MuteConsoleScope.h"
 #include "platform/v8_inspector/RemoteObjectId.h"
 #include "platform/v8_inspector/ScriptBreakpoint.h"
-#include "platform/v8_inspector/V8AsyncCallTracker.h"
 #include "platform/v8_inspector/V8InspectorConnectionImpl.h"
 #include "platform/v8_inspector/V8Regex.h"
 #include "platform/v8_inspector/V8RuntimeAgentImpl.h"
@@ -36,6 +35,12 @@
 using blink::protocol::Runtime::StackTrace;
 using blink::protocol::Runtime::RemoteObject;
 
+namespace {
+static const char v8AsyncTaskEventEnqueue[] = "enqueue";
+static const char v8AsyncTaskEventWillHandle[] = "willHandle";
+static const char v8AsyncTaskEventDidHandle[] = "didHandle";
+}
+
 namespace blink {
 
 namespace DebuggerAgentState {
@@ -57,8 +62,6 @@
 
 const char V8DebuggerAgent::backtraceObjectGroup[] = "backtrace";
 
-const int V8DebuggerAgent::unknownAsyncOperationId = 0;
-
 static String16 breakpointIdSuffix(V8DebuggerAgentImpl::BreakpointSource source)
 {
     switch (source) {
@@ -177,17 +180,9 @@
     , m_recursionLevelForStepOut(0)
     , m_recursionLevelForStepFrame(0)
     , m_skipAllPauses(false)
-    , m_lastAsyncOperationId(0)
     , m_maxAsyncCallStackDepth(0)
-    , m_currentAsyncCallChain(nullptr)
-    , m_nestedAsyncCallCount(0)
-    , m_currentAsyncOperationId(unknownAsyncOperationId)
-    , m_pendingTraceAsyncOperationCompleted(false)
 {
     m_connection->setDebuggerAgent(this);
-
-    // FIXME: remove once InjectedScriptManager moves to v8.
-    m_v8AsyncCallTracker = V8AsyncCallTracker::create(this);
     clearBreakDetails();
 }
 
@@ -263,11 +258,10 @@
 {
     if (depth <= 0) {
         m_maxAsyncCallStackDepth = 0;
-        resetAsyncCallTracker();
+        allAsyncTasksCanceled();
     } else {
         m_maxAsyncCallStackDepth = depth;
     }
-    m_v8AsyncCallTracker->asyncCallTrackingStateChanged(m_maxAsyncCallStackDepth);
 }
 
 void V8DebuggerAgentImpl::setInspectorState(protocol::DictionaryValue* state)
@@ -845,13 +839,22 @@
 
 bool V8DebuggerAgentImpl::v8AsyncTaskEventsEnabled() const
 {
-    return trackingAsyncCalls();
+    return m_maxAsyncCallStackDepth;
 }
 
 void V8DebuggerAgentImpl::didReceiveV8AsyncTaskEvent(v8::Local<v8::Context> context, const String16& eventType, const String16& eventName, int id)
 {
-    ASSERT(trackingAsyncCalls());
-    m_v8AsyncCallTracker->didReceiveV8AsyncTaskEvent(context, eventType, eventName, id);
+    ASSERT(m_maxAsyncCallStackDepth);
+    // The scopes for the ids are defined by the eventName namespaces. There are currently two namespaces: "Object." and "Promise.".
+    void* ptr = reinterpret_cast<void*>(id * 4 + (eventName[0] == 'P' ? 2 : 0) + 1);
+    if (eventType == v8AsyncTaskEventEnqueue)
+        asyncTaskScheduled(eventName, ptr, false);
+    else if (eventType == v8AsyncTaskEventWillHandle)
+        asyncTaskStarted(ptr);
+    else if (eventType == v8AsyncTaskEventDidHandle)
+        asyncTaskFinished(ptr);
+    else
+        ASSERT_NOT_REACHED();
 }
 
 void V8DebuggerAgentImpl::pause(ErrorString* errorString)
@@ -1049,98 +1052,75 @@
     internalSetAsyncCallStackDepth(depth);
 }
 
-int V8DebuggerAgentImpl::traceAsyncOperationStarting(const String16& description)
+void V8DebuggerAgentImpl::asyncTaskScheduled(const String16& taskName, void* task, bool recurring)
 {
-    v8::HandleScope scope(m_isolate);
-    OwnPtr<V8StackTraceImpl> chain = V8StackTraceImpl::capture(this, V8StackTrace::maxCallStackSizeToCapture, description);
-
-    do {
-        ++m_lastAsyncOperationId;
-        if (m_lastAsyncOperationId <= 0)
-            m_lastAsyncOperationId = 1;
-    } while (m_asyncOperations.contains(m_lastAsyncOperationId));
-
-    if (chain)
-        m_asyncOperations.set(m_lastAsyncOperationId, chain.release());
-
-    return m_lastAsyncOperationId;
-}
-
-void V8DebuggerAgentImpl::traceAsyncCallbackStarting(int operationId)
-{
-    ASSERT(operationId > 0 || operationId == unknownAsyncOperationId);
-    V8StackTraceImpl* chain = operationId > 0 ? m_asyncOperations.get(operationId) : nullptr;
-    // FIXME: extract recursion check into a delegate.
-    bool hasRecursionLevel = m_debugger->client()->hasRecursionLevel();
-    if (chain && !hasRecursionLevel) {
-        // There can be still an old m_currentAsyncCallChain set if we start running Microtasks
-        // right after executing a JS callback but before the corresponding traceAsyncCallbackCompleted().
-        // In this case just call traceAsyncCallbackCompleted() now, and the subsequent ones will be ignored.
-        //
-        // The nested levels count may be greater than 1, for example, when events are guarded via custom
-        // traceAsync* calls, like in window.postMessage(). In this case there will be a willHandleEvent
-        // instrumentation with unknownAsyncOperationId bumping up the nested levels count.
-        if (m_currentAsyncCallChain) {
-            ASSERT(m_nestedAsyncCallCount >= 1);
-            m_nestedAsyncCallCount = 1;
-            traceAsyncCallbackCompleted();
-        }
-
-        // Current AsyncCallChain corresponds to the bottommost JS call frame.
-        ASSERT(!m_currentAsyncCallChain);
-        m_currentAsyncCallChain = chain->clone();
-        m_currentAsyncOperationId = operationId;
-        m_pendingTraceAsyncOperationCompleted = false;
-        m_nestedAsyncCallCount = 1;
-    } else {
-        if (m_currentAsyncCallChain)
-            ++m_nestedAsyncCallCount;
-    }
-}
-
-void V8DebuggerAgentImpl::traceAsyncCallbackCompleted()
-{
-    if (!m_nestedAsyncCallCount)
+    if (!m_maxAsyncCallStackDepth)
         return;
-    ASSERT(m_currentAsyncCallChain);
-    --m_nestedAsyncCallCount;
-    if (!m_nestedAsyncCallCount)
-        clearCurrentAsyncOperation();
-}
-
-void V8DebuggerAgentImpl::traceAsyncOperationCompleted(int operationId)
-{
-    ASSERT(operationId > 0 || operationId == unknownAsyncOperationId);
-    if (operationId > 0) {
-        if (m_currentAsyncOperationId == operationId) {
-            if (m_pendingTraceAsyncOperationCompleted) {
-                m_pendingTraceAsyncOperationCompleted = false;
-            } else {
-                // Delay traceAsyncOperationCompleted() until the last async callback (being currently executed) is done.
-                m_pendingTraceAsyncOperationCompleted = true;
-                return;
-            }
-        }
-        m_asyncOperations.remove(operationId);
+    v8::HandleScope scope(m_isolate);
+    OwnPtr<V8StackTraceImpl> chain = V8StackTraceImpl::capture(this, V8StackTrace::maxCallStackSizeToCapture, taskName);
+    if (chain) {
+        m_asyncTaskStacks.set(task, chain.release());
+        if (recurring)
+            m_recurringTasks.add(task);
     }
 }
 
-void V8DebuggerAgentImpl::clearCurrentAsyncOperation()
+void V8DebuggerAgentImpl::asyncTaskCanceled(void* task)
 {
-    if (m_pendingTraceAsyncOperationCompleted && m_currentAsyncOperationId != unknownAsyncOperationId)
-        traceAsyncOperationCompleted(m_currentAsyncOperationId);
-
-    m_currentAsyncOperationId = unknownAsyncOperationId;
-    m_pendingTraceAsyncOperationCompleted = false;
-    m_nestedAsyncCallCount = 0;
-    m_currentAsyncCallChain.clear();
+    if (!m_maxAsyncCallStackDepth)
+        return;
+    m_asyncTaskStacks.remove(task);
+    m_recurringTasks.remove(task);
 }
 
-void V8DebuggerAgentImpl::resetAsyncCallTracker()
+void V8DebuggerAgentImpl::asyncTaskStarted(void* task)
 {
-    clearCurrentAsyncOperation();
-    m_v8AsyncCallTracker->resetAsyncOperations();
-    m_asyncOperations.clear();
+    // Not enabled, return.
+    if (!m_maxAsyncCallStackDepth)
+        return;
+
+#if ENABLE(ASSERT)
+    m_currentTasks.append(task);
+#endif
+
+    V8StackTraceImpl* stack = m_asyncTaskStacks.get(task);
+    // Needs to support following order of events:
+    // - asyncTaskScheduled
+    //   <-- attached here -->
+    // - asyncTaskStarted
+    // - asyncTaskCanceled <-- canceled before finished
+    //   <-- async stack requested here -->
+    // - asyncTaskFinished
+    m_currentStacks.append(stack ? stack->clone() : nullptr);
+}
+
+void V8DebuggerAgentImpl::asyncTaskFinished(void* task)
+{
+    if (!m_maxAsyncCallStackDepth)
+        return;
+    // We could start instrumenting half way and the stack is empty.
+    if (!m_currentStacks.size())
+        return;
+
+#if ENABLE(ASSERT)
+    ASSERT(m_currentTasks.last() == task);
+    m_currentTasks.removeLast();
+#endif
+
+    m_currentStacks.removeLast();
+    if (!m_recurringTasks.contains(task))
+        m_asyncTaskStacks.remove(task);
+}
+
+void V8DebuggerAgentImpl::allAsyncTasksCanceled()
+{
+    m_asyncTaskStacks.clear();
+    m_recurringTasks.clear();
+    m_currentStacks.clear();
+
+#if ENABLE(ASSERT)
+    m_currentTasks.clear();
+#endif
 }
 
 void V8DebuggerAgentImpl::setBlackboxedRanges(ErrorString* error, const String16& scriptId, PassOwnPtr<protocol::Array<protocol::Debugger::ScriptPosition>> inPositions)
@@ -1292,15 +1272,17 @@
 
 PassOwnPtr<StackTrace> V8DebuggerAgentImpl::currentAsyncStackTrace()
 {
-    if (m_pausedContext.IsEmpty() || !trackingAsyncCalls() || !m_currentAsyncCallChain)
+    if (m_pausedContext.IsEmpty() || !m_maxAsyncCallStackDepth || !m_currentStacks.size() || !m_currentStacks.last())
         return nullptr;
 
-    return m_currentAsyncCallChain->buildInspectorObjectForTail(this);
+    return m_currentStacks.last()->buildInspectorObjectForTail(this);
 }
 
 V8StackTraceImpl* V8DebuggerAgentImpl::currentAsyncCallChain()
 {
-    return trackingAsyncCalls() ? m_currentAsyncCallChain.get() : nullptr;
+    if (!m_currentStacks.size())
+        return nullptr;
+    return m_currentStacks.last().get();
 }
 
 void V8DebuggerAgentImpl::didParseSource(const V8DebuggerParsedScript& parsedScript)
@@ -1510,7 +1492,7 @@
     m_scripts.clear();
     m_blackboxedPositions.clear();
     m_breakpointIdToDebuggerBreakpointIds.clear();
-    resetAsyncCallTracker();
+    allAsyncTasksCanceled();
 }
 
 } // namespace blink
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.h b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.h
index 4ee50b9..9d10d488 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.h
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.h
@@ -16,7 +16,6 @@
 
 class JavaScriptCallFrame;
 class PromiseTracker;
-class V8AsyncCallTracker;
 class V8InspectorConnectionImpl;
 class V8StackTraceImpl;
 
@@ -149,12 +148,12 @@
     void setBreakpointAt(const String16& scriptId, int lineNumber, int columnNumber, BreakpointSource, const String16& condition = String16());
     void removeBreakpointAt(const String16& scriptId, int lineNumber, int columnNumber, BreakpointSource);
 
-    // Async call stacks implementation
-    int traceAsyncOperationStarting(const String16& description) override;
-    void traceAsyncCallbackStarting(int operationId) override;
-    void traceAsyncCallbackCompleted() override;
-    void traceAsyncOperationCompleted(int operationId) override;
-    bool trackingAsyncCalls() const override { return m_maxAsyncCallStackDepth; }
+    // Async call stacks implementation.
+    void asyncTaskScheduled(const String16& taskName, void* task, bool recurring) override;
+    void asyncTaskCanceled(void* task) override;
+    void asyncTaskStarted(void* task) override;
+    void asyncTaskFinished(void* task) override;
+    void allAsyncTasksCanceled() override;
 
     void reset();
 
@@ -181,9 +180,6 @@
     PassOwnPtr<protocol::Array<protocol::Debugger::CallFrame>> currentCallFrames(ErrorString*);
     PassOwnPtr<protocol::Runtime::StackTrace> currentAsyncStackTrace();
 
-    void clearCurrentAsyncOperation();
-    void resetAsyncCallTracker();
-
     void changeJavaScriptRecursionLevel(int step);
 
     void setPauseOnExceptionsImpl(ErrorString*, int);
@@ -237,17 +233,14 @@
     int m_recursionLevelForStepFrame;
     bool m_skipAllPauses;
 
-    // This field must be destroyed before the listeners set above.
-    OwnPtr<V8AsyncCallTracker> m_v8AsyncCallTracker;
-
-    using AsyncOperationIdToStackTrace = protocol::HashMap<int, OwnPtr<V8StackTraceImpl>>;
-    AsyncOperationIdToStackTrace m_asyncOperations;
-    int m_lastAsyncOperationId;
+    using AsyncTaskToStackTrace = protocol::HashMap<void*, OwnPtr<V8StackTraceImpl>>;
+    AsyncTaskToStackTrace m_asyncTaskStacks;
+    protocol::HashSet<void*> m_recurringTasks;
     int m_maxAsyncCallStackDepth;
-    OwnPtr<V8StackTraceImpl> m_currentAsyncCallChain;
-    unsigned m_nestedAsyncCallCount;
-    int m_currentAsyncOperationId;
-    bool m_pendingTraceAsyncOperationCompleted;
+#if ENABLE(ASSERT)
+    Vector<void*> m_currentTasks;
+#endif
+    Vector<OwnPtr<V8StackTraceImpl>> m_currentStacks;
     protocol::HashMap<String16, protocol::Vector<std::pair<int, int>>> m_blackboxedPositions;
 };
 
diff --git a/third_party/WebKit/Source/platform/v8_inspector/public/V8DebuggerAgent.h b/third_party/WebKit/Source/platform/v8_inspector/public/V8DebuggerAgent.h
index 79d8121..81613f5 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/public/V8DebuggerAgent.h
+++ b/third_party/WebKit/Source/platform/v8_inspector/public/V8DebuggerAgent.h
@@ -33,13 +33,12 @@
     virtual bool enabled() = 0;
     virtual V8Debugger& debugger() = 0;
 
-    // Async call stacks implementation
-    static const int unknownAsyncOperationId;
-    virtual int traceAsyncOperationStarting(const String16& description) = 0;
-    virtual void traceAsyncCallbackStarting(int operationId) = 0;
-    virtual void traceAsyncCallbackCompleted() = 0;
-    virtual void traceAsyncOperationCompleted(int operationId) = 0;
-    virtual bool trackingAsyncCalls() const = 0;
+    // Async call stacks implementation.
+    virtual void asyncTaskScheduled(const String16& taskName, void* task, bool recurring) = 0;
+    virtual void asyncTaskCanceled(void* task) = 0;
+    virtual void asyncTaskStarted(void* task) = 0;
+    virtual void asyncTaskFinished(void* task) = 0;
+    virtual void allAsyncTasksCanceled() = 0;
 };
 
 } // namespace blink
diff --git a/third_party/WebKit/Source/platform/v8_inspector/public/V8DebuggerClient.h b/third_party/WebKit/Source/platform/v8_inspector/public/V8DebuggerClient.h
index 881aee1..282ade5 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/public/V8DebuggerClient.h
+++ b/third_party/WebKit/Source/platform/v8_inspector/public/V8DebuggerClient.h
@@ -26,7 +26,6 @@
     virtual bool callingContextCanAccessContext(v8::Local<v8::Context> calling, v8::Local<v8::Context> target) = 0;
     virtual String16 valueSubtype(v8::Local<v8::Value>) = 0;
     virtual bool formatAccessorsAsProperties(v8::Local<v8::Value>) = 0;
-    virtual bool hasRecursionLevel() = 0;
     virtual bool isExecutionAllowed() = 0;
     virtual double currentTimeMS() = 0;
 };
diff --git a/third_party/WebKit/Source/web/WebDevToolsAgentImpl.cpp b/third_party/WebKit/Source/web/WebDevToolsAgentImpl.cpp
index ed9282b2..032e1471 100644
--- a/third_party/WebKit/Source/web/WebDevToolsAgentImpl.cpp
+++ b/third_party/WebKit/Source/web/WebDevToolsAgentImpl.cpp
@@ -61,7 +61,7 @@
 #include "core/inspector/PageConsoleAgent.h"
 #include "core/inspector/PageDebuggerAgent.h"
 #include "core/inspector/PageRuntimeAgent.h"
-#include "core/layout/LayoutView.h"
+#include "core/layout/api/LayoutViewItem.h"
 #include "core/page/FocusController.h"
 #include "core/page/Page.h"
 #include "modules/accessibility/InspectorAccessibilityAgent.h"
@@ -597,7 +597,7 @@
     dummyEvent.y = pointInRootFrame.y;
     IntPoint transformedPoint = PlatformMouseEventBuilder(m_webLocalFrameImpl->frameView(), dummyEvent).position();
     HitTestResult result(request, m_webLocalFrameImpl->frameView()->rootFrameToContents(transformedPoint));
-    m_webLocalFrameImpl->frame()->contentLayoutObject()->hitTest(result);
+    m_webLocalFrameImpl->frame()->contentLayoutItem().hitTest(result);
     Node* node = result.innerNode();
     if (!node && m_webLocalFrameImpl->frame()->document())
         node = m_webLocalFrameImpl->frame()->document()->documentElement();
diff --git a/third_party/WebKit/Source/web/WebRuntimeFeatures.cpp b/third_party/WebKit/Source/web/WebRuntimeFeatures.cpp
index 96a7dec..ee3184d0 100644
--- a/third_party/WebKit/Source/web/WebRuntimeFeatures.cpp
+++ b/third_party/WebKit/Source/web/WebRuntimeFeatures.cpp
@@ -150,6 +150,11 @@
     RuntimeEnabledFeatures::setMediaCaptureEnabled(enable);
 }
 
+void WebRuntimeFeatures::enableMediaDocumentDownloadButton(bool enable)
+{
+    RuntimeEnabledFeatures::setMediaDocumentDownloadButtonEnabled(enable);
+}
+
 void WebRuntimeFeatures::enableNotificationActionIcons(bool enable)
 {
     RuntimeEnabledFeatures::setNotificationActionIconsEnabled(enable);
diff --git a/third_party/WebKit/Source/web/tests/ViewportTest.cpp b/third_party/WebKit/Source/web/tests/ViewportTest.cpp
index e30a7834..d365edd 100644
--- a/third_party/WebKit/Source/web/tests/ViewportTest.cpp
+++ b/third_party/WebKit/Source/web/tests/ViewportTest.cpp
@@ -2786,14 +2786,8 @@
 
 TEST_F(ViewportTest, viewportTriggersGpuRasterization)
 {
-    FrameTestHelpers::WebViewHelper webViewHelper;
-
-    registerMockedHttpURLLoad("viewport/viewport-gpu-rasterization-disabled-without-viewport.html");
-    webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-gpu-rasterization-disabled-without-viewport.html", true, 0, 0, setViewportSettings);
-    webViewHelper.webView()->resize(WebSize(640, 480));
-    EXPECT_FALSE(webViewHelper.webViewImpl()->matchesHeuristicsForGpuRasterizationForTesting());
-
     registerMockedHttpURLLoad("viewport/viewport-gpu-rasterization.html");
+    FrameTestHelpers::WebViewHelper webViewHelper;
     webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-gpu-rasterization.html", true, 0, 0, setViewportSettings);
     webViewHelper.webView()->resize(WebSize(640, 480));
     EXPECT_TRUE(webViewHelper.webViewImpl()->matchesHeuristicsForGpuRasterizationForTesting());
@@ -2803,30 +2797,25 @@
     webViewHelper.webView()->resize(WebSize(640, 480));
     EXPECT_TRUE(webViewHelper.webViewImpl()->matchesHeuristicsForGpuRasterizationForTesting());
 
+    registerMockedHttpURLLoad("viewport/viewport-inferred-values-do-not-trigger-gpu-rasterization.html");
+    webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-inferred-values-do-not-trigger-gpu-rasterization.html", true, 0, 0, setViewportSettings);
+    webViewHelper.webView()->resize(WebSize(640, 480));
+    EXPECT_FALSE(webViewHelper.webViewImpl()->matchesHeuristicsForGpuRasterizationForTesting());
+
     registerMockedHttpURLLoad("viewport/viewport-1.html");
     webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-1.html", true, 0, 0, setViewportSettings);
     webViewHelper.webView()->resize(WebSize(640, 480));
-    EXPECT_TRUE(webViewHelper.webViewImpl()->matchesHeuristicsForGpuRasterizationForTesting());
+    EXPECT_FALSE(webViewHelper.webViewImpl()->matchesHeuristicsForGpuRasterizationForTesting());
 
     registerMockedHttpURLLoad("viewport/viewport-15.html");
     webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-15.html", true, 0, 0, setViewportSettings);
     webViewHelper.webView()->resize(WebSize(640, 480));
-    EXPECT_TRUE(webViewHelper.webViewImpl()->matchesHeuristicsForGpuRasterizationForTesting());
+    EXPECT_FALSE(webViewHelper.webViewImpl()->matchesHeuristicsForGpuRasterizationForTesting());
 
     registerMockedHttpURLLoad("viewport/viewport-130.html");
     webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-130.html", true, 0, 0, setViewportSettings);
     webViewHelper.webView()->resize(WebSize(640, 480));
-    EXPECT_TRUE(webViewHelper.webViewImpl()->matchesHeuristicsForGpuRasterizationForTesting());
-
-    registerMockedHttpURLLoad("viewport/viewport-legacy-handheldfriendly.html");
-    webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-handheldfriendly.html", true, 0, 0, setViewportSettings);
-    webViewHelper.webView()->resize(WebSize(640, 480));
-    EXPECT_TRUE(webViewHelper.webViewImpl()->matchesHeuristicsForGpuRasterizationForTesting());
-
-    registerMockedHttpURLLoad("viewport/viewport-legacy-mobileoptimized.html");
-    webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-handheldfriendly.html", true, 0, 0, setViewportSettings);
-    webViewHelper.webView()->resize(WebSize(640, 480));
-    EXPECT_TRUE(webViewHelper.webViewImpl()->matchesHeuristicsForGpuRasterizationForTesting());
+    EXPECT_FALSE(webViewHelper.webViewImpl()->matchesHeuristicsForGpuRasterizationForTesting());
 }
 
 class ConsoleMessageWebFrameClient : public FrameTestHelpers::TestWebFrameClient {
diff --git a/third_party/WebKit/Source/web/tests/WebViewTest.cpp b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
index 0c14dbd..ff7a400e 100644
--- a/third_party/WebKit/Source/web/tests/WebViewTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
@@ -975,6 +975,7 @@
 {
     URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("form_with_input.html"));
     WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "form_with_input.html");
+    webView->resize(WebSize(800, 600));
     webView->setInitialFocus(false);
     EXPECT_EQ(0, webView->mainFrame()->scrollOffset().width);
     EXPECT_EQ(0, webView->mainFrame()->scrollOffset().height);
diff --git a/third_party/WebKit/Source/web/tests/data/viewport/viewport-gpu-rasterization-disabled-without-viewport.html b/third_party/WebKit/Source/web/tests/data/viewport/viewport-gpu-rasterization-disabled-without-viewport.html
deleted file mode 100644
index 1e18b9c..0000000
--- a/third_party/WebKit/Source/web/tests/data/viewport/viewport-gpu-rasterization-disabled-without-viewport.html
+++ /dev/null
@@ -1,4 +0,0 @@
-<head>
-    <title>No viewport tag, no GPU rasterization trigger</title>
-</head>
-<body></body>
diff --git a/third_party/WebKit/Source/web/tests/data/viewport/viewport-inferred-values-do-not-trigger-gpu-rasterization.html b/third_party/WebKit/Source/web/tests/data/viewport/viewport-inferred-values-do-not-trigger-gpu-rasterization.html
new file mode 100644
index 0000000..67c15cd
--- /dev/null
+++ b/third_party/WebKit/Source/web/tests/data/viewport/viewport-inferred-values-do-not-trigger-gpu-rasterization.html
@@ -0,0 +1,5 @@
+<head>
+    <title>Viewport that triggers GPU rasterization</title>
+    <meta name="viewport" content="width=device-width, minimum-scale=yes, initial-scale=yes, user-scalable=yes">
+</head>
+<body></body>
diff --git a/third_party/WebKit/Source/wtf/RefCountedLeakCounter.cpp b/third_party/WebKit/Source/wtf/RefCountedLeakCounter.cpp
deleted file mode 100644
index 8f9eee4..0000000
--- a/third_party/WebKit/Source/wtf/RefCountedLeakCounter.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- *  Copyright (C) 2008 Apple Inc. All rights reserved.
- *
- *  This library is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Library General Public
- *  License as published by the Free Software Foundation; either
- *  version 2 of the License, or (at your option) any later version.
- *
- *  This library is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  Library General Public License for more details.
- *
- *  You should have received a copy of the GNU Library General Public License
- *  along with this library; see the file COPYING.LIB.  If not, write to
- *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
-
-#include "RefCountedLeakCounter.h"
-#include "wtf/Assertions.h"
-
-#if ENABLE(ASSERT)
-#include "wtf/Atomics.h"
-#endif
-
-namespace WTF {
-
-#if !ENABLE(ASSERT)
-
-RefCountedLeakCounter::RefCountedLeakCounter(const char*) { }
-RefCountedLeakCounter::~RefCountedLeakCounter() { }
-
-void RefCountedLeakCounter::increment() { }
-void RefCountedLeakCounter::decrement() { }
-
-#else
-
-RefCountedLeakCounter::RefCountedLeakCounter(const char* description)
-    : m_description(description)
-{
-}
-
-RefCountedLeakCounter::~RefCountedLeakCounter()
-{
-    if (!m_count)
-        return;
-
-    VLOG(0) << "LEAK: " << m_count << " " << m_description;
-}
-
-void RefCountedLeakCounter::increment()
-{
-    atomicIncrement(&m_count);
-}
-
-void RefCountedLeakCounter::decrement()
-{
-    atomicDecrement(&m_count);
-}
-
-#endif
-
-} // namespace WTF
diff --git a/third_party/WebKit/Source/wtf/RefCountedLeakCounter.h b/third_party/WebKit/Source/wtf/RefCountedLeakCounter.h
deleted file mode 100644
index a66c578..0000000
--- a/third_party/WebKit/Source/wtf/RefCountedLeakCounter.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *  Copyright (C) 2008 Apple Inc. All rights reserved.
- *
- *  This library is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Library General Public
- *  License as published by the Free Software Foundation; either
- *  version 2 of the License, or (at your option) any later version.
- *
- *  This library is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  Library General Public License for more details.
- *
- *  You should have received a copy of the GNU Library General Public License
- *  along with this library; see the file COPYING.LIB.  If not, write to
- *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- *  Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef RefCountedLeakCounter_h
-#define RefCountedLeakCounter_h
-
-#include "wtf/Assertions.h"
-#include "wtf/WTFExport.h"
-#include <cstddef>
-
-namespace WTF {
-
-struct WTF_EXPORT RefCountedLeakCounter {
-    explicit RefCountedLeakCounter(const char* description);
-    ~RefCountedLeakCounter();
-
-    void increment();
-    void decrement();
-
-#if ENABLE(ASSERT)
-private:
-    volatile int m_count;
-    const char* m_description;
-#endif
-};
-
-} // namespace WTF
-
-#endif
diff --git a/third_party/WebKit/Source/wtf/wtf.gypi b/third_party/WebKit/Source/wtf/wtf.gypi
index cb1f4f5f..6c526bb 100644
--- a/third_party/WebKit/Source/wtf/wtf.gypi
+++ b/third_party/WebKit/Source/wtf/wtf.gypi
@@ -92,8 +92,6 @@
             'PrintStream.cpp',
             'PrintStream.h',
             'RefCounted.h',
-            'RefCountedLeakCounter.cpp',
-            'RefCountedLeakCounter.h',
             'RefPtr.h',
             'RetainPtr.h',
             'SaturatedArithmetic.h',
diff --git a/third_party/WebKit/public/platform/WebLocalizedString.h b/third_party/WebKit/public/platform/WebLocalizedString.h
index 30f939d..54d61e24 100644
--- a/third_party/WebKit/public/platform/WebLocalizedString.h
+++ b/third_party/WebKit/public/platform/WebLocalizedString.h
@@ -105,6 +105,7 @@
         DateFormatMonthLabel,
         DateFormatYearLabel,
         DetailsLabel,
+        DownloadButtonLabel,
         FileButtonChooseFileLabel,
         FileButtonChooseMultipleFilesLabel,
         FileButtonNoFileSelectedLabel,
diff --git a/third_party/WebKit/public/web/WebRuntimeFeatures.h b/third_party/WebKit/public/web/WebRuntimeFeatures.h
index 19cebfa..b7c0094f 100644
--- a/third_party/WebKit/public/web/WebRuntimeFeatures.h
+++ b/third_party/WebKit/public/web/WebRuntimeFeatures.h
@@ -79,6 +79,7 @@
     BLINK_EXPORT static void enableFileSystem(bool);
     BLINK_EXPORT static void enableImageColorProfiles(bool);
     BLINK_EXPORT static void enableMediaCapture(bool);
+    BLINK_EXPORT static void enableMediaDocumentDownloadButton(bool);
     BLINK_EXPORT static void enableNavigatorContentUtils(bool);
     BLINK_EXPORT static void enableNetworkInformation(bool);
     BLINK_EXPORT static void enableNewMediaPlaybackUi(bool);
diff --git a/third_party/boringssl/boringssl.gypi b/third_party/boringssl/boringssl.gypi
index 742e241a..9e2fdbe 100644
--- a/third_party/boringssl/boringssl.gypi
+++ b/third_party/boringssl/boringssl.gypi
@@ -204,6 +204,8 @@
       'src/crypto/pkcs8/p8_pkey.c',
       'src/crypto/pkcs8/pkcs8.c',
       'src/crypto/poly1305/poly1305.c',
+      'src/crypto/poly1305/poly1305_arm.c',
+      'src/crypto/poly1305/poly1305_vec.c',
       'src/crypto/rand/deterministic.c',
       'src/crypto/rand/rand.c',
       'src/crypto/rand/urandom.c',
@@ -314,7 +316,6 @@
       'linux-aarch64/crypto/bn/armv8-mont.S',
       'linux-aarch64/crypto/chacha/chacha-armv8.S',
       'linux-aarch64/crypto/modes/ghashv8-armx64.S',
-      'linux-aarch64/crypto/poly1305/poly1305-armv8.S',
       'linux-aarch64/crypto/sha/sha1-armv8.S',
       'linux-aarch64/crypto/sha/sha256-armv8.S',
       'linux-aarch64/crypto/sha/sha512-armv8.S',
@@ -327,11 +328,11 @@
       'linux-arm/crypto/chacha/chacha-armv4.S',
       'linux-arm/crypto/modes/ghash-armv4.S',
       'linux-arm/crypto/modes/ghashv8-armx32.S',
-      'linux-arm/crypto/poly1305/poly1305-armv4.S',
       'linux-arm/crypto/sha/sha1-armv4-large.S',
       'linux-arm/crypto/sha/sha256-armv4.S',
       'linux-arm/crypto/sha/sha512-armv4.S',
       'src/crypto/curve25519/asm/x25519-asm-arm.S',
+      'src/crypto/poly1305/poly1305_arm_asm.S',
     ],
     'boringssl_linux_x86_sources': [
       'linux-x86/crypto/aes/aes-586.S',
@@ -343,7 +344,6 @@
       'linux-x86/crypto/chacha/chacha-x86.S',
       'linux-x86/crypto/md5/md5-586.S',
       'linux-x86/crypto/modes/ghash-x86.S',
-      'linux-x86/crypto/poly1305/poly1305-x86.S',
       'linux-x86/crypto/rc4/rc4-586.S',
       'linux-x86/crypto/sha/sha1-586.S',
       'linux-x86/crypto/sha/sha256-586.S',
@@ -363,7 +363,6 @@
       'linux-x86_64/crypto/md5/md5-x86_64.S',
       'linux-x86_64/crypto/modes/aesni-gcm-x86_64.S',
       'linux-x86_64/crypto/modes/ghash-x86_64.S',
-      'linux-x86_64/crypto/poly1305/poly1305-x86_64.S',
       'linux-x86_64/crypto/rand/rdrand-x86_64.S',
       'linux-x86_64/crypto/rc4/rc4-x86_64.S',
       'linux-x86_64/crypto/sha/sha1-x86_64.S',
@@ -381,7 +380,6 @@
       'mac-x86/crypto/chacha/chacha-x86.S',
       'mac-x86/crypto/md5/md5-586.S',
       'mac-x86/crypto/modes/ghash-x86.S',
-      'mac-x86/crypto/poly1305/poly1305-x86.S',
       'mac-x86/crypto/rc4/rc4-586.S',
       'mac-x86/crypto/sha/sha1-586.S',
       'mac-x86/crypto/sha/sha256-586.S',
@@ -401,7 +399,6 @@
       'mac-x86_64/crypto/md5/md5-x86_64.S',
       'mac-x86_64/crypto/modes/aesni-gcm-x86_64.S',
       'mac-x86_64/crypto/modes/ghash-x86_64.S',
-      'mac-x86_64/crypto/poly1305/poly1305-x86_64.S',
       'mac-x86_64/crypto/rand/rdrand-x86_64.S',
       'mac-x86_64/crypto/rc4/rc4-x86_64.S',
       'mac-x86_64/crypto/sha/sha1-x86_64.S',
@@ -418,7 +415,6 @@
       'win-x86/crypto/chacha/chacha-x86.asm',
       'win-x86/crypto/md5/md5-586.asm',
       'win-x86/crypto/modes/ghash-x86.asm',
-      'win-x86/crypto/poly1305/poly1305-x86.asm',
       'win-x86/crypto/rc4/rc4-586.asm',
       'win-x86/crypto/sha/sha1-586.asm',
       'win-x86/crypto/sha/sha256-586.asm',
@@ -438,7 +434,6 @@
       'win-x86_64/crypto/md5/md5-x86_64.asm',
       'win-x86_64/crypto/modes/aesni-gcm-x86_64.asm',
       'win-x86_64/crypto/modes/ghash-x86_64.asm',
-      'win-x86_64/crypto/poly1305/poly1305-x86_64.asm',
       'win-x86_64/crypto/rand/rdrand-x86_64.asm',
       'win-x86_64/crypto/rc4/rc4-x86_64.asm',
       'win-x86_64/crypto/sha/sha1-x86_64.asm',
diff --git a/third_party/boringssl/linux-aarch64/crypto/poly1305/poly1305-armv8.S b/third_party/boringssl/linux-aarch64/crypto/poly1305/poly1305-armv8.S
deleted file mode 100644
index 7b681aa..0000000
--- a/third_party/boringssl/linux-aarch64/crypto/poly1305/poly1305-armv8.S
+++ /dev/null
@@ -1,859 +0,0 @@
-#if defined(__aarch64__)
-#include <openssl/arm_arch.h>
-
-.text
-
-// forward "declarations" are required for Apple
-
-.globl	poly1305_blocks
-.hidden	poly1305_blocks
-.globl	poly1305_emit
-.hidden	poly1305_emit
-
-.globl	poly1305_init
-.hidden	poly1305_init
-.type	poly1305_init,%function
-.align	5
-poly1305_init:
-	cmp	x1,xzr
-	stp	xzr,xzr,[x0]		// zero hash value
-	stp	xzr,xzr,[x0,#16]	// [along with is_base2_26]
-
-	csel	x0,xzr,x0,eq
-	b.eq	.Lno_key
-
-#ifdef	__ILP32__
-	ldrsw	x11,.LOPENSSL_armcap_P
-#else
-	ldr	x11,.LOPENSSL_armcap_P
-#endif
-	adr	x10,.LOPENSSL_armcap_P
-
-	ldp	x7,x8,[x1]		// load key
-	mov	x9,#0xfffffffc0fffffff
-	movk	x9,#0x0fff,lsl#48
-	ldr	w17,[x10,x11]
-#ifdef	__ARMEB__
-	rev	x7,x7			// flip bytes
-	rev	x8,x8
-#endif
-	and	x7,x7,x9		// &=0ffffffc0fffffff
-	and	x9,x9,#-4
-	and	x8,x8,x9		// &=0ffffffc0ffffffc
-	stp	x7,x8,[x0,#32]	// save key value
-
-	tst	w17,#ARMV7_NEON
-
-	adr	x12,poly1305_blocks
-	adr	x7,poly1305_blocks_neon
-	adr	x13,poly1305_emit
-	adr	x8,poly1305_emit_neon
-
-	csel	x12,x12,x7,eq
-	csel	x13,x13,x8,eq
-
-	stp	x12,x13,[x2]
-
-	mov	x0,#1
-.Lno_key:
-	ret
-.size	poly1305_init,.-poly1305_init
-
-.type	poly1305_blocks,%function
-.align	5
-poly1305_blocks:
-	ands	x2,x2,#-16
-	b.eq	.Lno_data
-
-	ldp	x4,x5,[x0]		// load hash value
-	ldp	x7,x8,[x0,#32]	// load key value
-	ldr	x6,[x0,#16]
-	add	x9,x8,x8,lsr#2	// s1 = r1 + (r1 >> 2)
-	b	.Loop
-
-.align	5
-.Loop:
-	ldp	x10,x11,[x1],#16	// load input
-	sub	x2,x2,#16
-#ifdef	__ARMEB__
-	rev	x10,x10
-	rev	x11,x11
-#endif
-	adds	x4,x4,x10		// accumulate input
-	adcs	x5,x5,x11
-
-	mul	x12,x4,x7		// h0*r0
-	adc	x6,x6,x3
-	umulh	x13,x4,x7
-
-	mul	x10,x5,x9		// h1*5*r1
-	umulh	x11,x5,x9
-
-	adds	x12,x12,x10
-	mul	x10,x4,x8		// h0*r1
-	adc	x13,x13,x11
-	umulh	x14,x4,x8
-
-	adds	x13,x13,x10
-	mul	x10,x5,x7		// h1*r0
-	adc	x14,x14,xzr
-	umulh	x11,x5,x7
-
-	adds	x13,x13,x10
-	mul	x10,x6,x9		// h2*5*r1
-	adc	x14,x14,x11
-	mul	x11,x6,x7		// h2*r0
-
-	adds	x13,x13,x10
-	adc	x14,x14,x11
-
-	and	x10,x14,#-4		// final reduction
-	and	x6,x14,#3
-	add	x10,x10,x14,lsr#2
-	adds	x4,x12,x10
-	adc	x5,x13,xzr
-
-	cbnz	x2,.Loop
-
-	stp	x4,x5,[x0]		// store hash value
-	str	x6,[x0,#16]
-
-.Lno_data:
-	ret
-.size	poly1305_blocks,.-poly1305_blocks
-
-.type	poly1305_emit,%function
-.align	5
-poly1305_emit:
-	ldp	x4,x5,[x0]		// load hash base 2^64
-	ldr	x6,[x0,#16]
-	ldp	x10,x11,[x2]	// load nonce
-
-	adds	x12,x4,#5		// compare to modulus
-	adcs	x13,x5,xzr
-	adc	x14,x6,xzr
-
-	tst	x14,#-4			// see if it's carried/borrowed
-
-	csel	x4,x4,x12,eq
-	csel	x5,x5,x13,eq
-
-#ifdef	__ARMEB__
-	ror	x10,x10,#32		// flip nonce words
-	ror	x11,x11,#32
-#endif
-	adds	x4,x4,x10		// accumulate nonce
-	adc	x5,x5,x11
-#ifdef	__ARMEB__
-	rev	x4,x4			// flip output bytes
-	rev	x5,x5
-#endif
-	stp	x4,x5,[x1]		// write result
-
-	ret
-.size	poly1305_emit,.-poly1305_emit
-.type	poly1305_mult,%function
-.align	5
-poly1305_mult:
-	mul	x12,x4,x7		// h0*r0
-	umulh	x13,x4,x7
-
-	mul	x10,x5,x9		// h1*5*r1
-	umulh	x11,x5,x9
-
-	adds	x12,x12,x10
-	mul	x10,x4,x8		// h0*r1
-	adc	x13,x13,x11
-	umulh	x14,x4,x8
-
-	adds	x13,x13,x10
-	mul	x10,x5,x7		// h1*r0
-	adc	x14,x14,xzr
-	umulh	x11,x5,x7
-
-	adds	x13,x13,x10
-	mul	x10,x6,x9		// h2*5*r1
-	adc	x14,x14,x11
-	mul	x11,x6,x7		// h2*r0
-
-	adds	x13,x13,x10
-	adc	x14,x14,x11
-
-	and	x10,x14,#-4		// final reduction
-	and	x6,x14,#3
-	add	x10,x10,x14,lsr#2
-	adds	x4,x12,x10
-	adc	x5,x13,xzr
-
-	ret
-.size	poly1305_mult,.-poly1305_mult
-
-.type	poly1305_splat,%function
-.align	5
-poly1305_splat:
-	and	x12,x4,#0x03ffffff	// base 2^64 -> base 2^26
-	ubfx	x13,x4,#26,#26
-	extr	x14,x5,x4,#52
-	and	x14,x14,#0x03ffffff
-	ubfx	x15,x5,#14,#26
-	extr	x16,x6,x5,#40
-
-	str	w12,[x0,#16*0]	// r0
-	add	w12,w13,w13,lsl#2	// r1*5
-	str	w13,[x0,#16*1]	// r1
-	add	w13,w14,w14,lsl#2	// r2*5
-	str	w12,[x0,#16*2]	// s1
-	str	w14,[x0,#16*3]	// r2
-	add	w14,w15,w15,lsl#2	// r3*5
-	str	w13,[x0,#16*4]	// s2
-	str	w15,[x0,#16*5]	// r3
-	add	w15,w16,w16,lsl#2	// r4*5
-	str	w14,[x0,#16*6]	// s3
-	str	w16,[x0,#16*7]	// r4
-	str	w15,[x0,#16*8]	// s4
-
-	ret
-.size	poly1305_splat,.-poly1305_splat
-
-.type	poly1305_blocks_neon,%function
-.align	5
-poly1305_blocks_neon:
-	ldr	x17,[x0,#24]
-	cmp	x2,#128
-	b.hs	.Lblocks_neon
-	cbz	x17,poly1305_blocks
-
-.Lblocks_neon:
-	stp	x29,x30,[sp,#-80]!
-	add	x29,sp,#0
-
-	ands	x2,x2,#-16
-	b.eq	.Lno_data_neon
-
-	cbz	x17,.Lbase2_64_neon
-
-	ldp	w10,w11,[x0]		// load hash value base 2^26
-	ldp	w12,w13,[x0,#8]
-	ldr	w14,[x0,#16]
-
-	tst	x2,#31
-	b.eq	.Leven_neon
-
-	ldp	x7,x8,[x0,#32]	// load key value
-
-	add	x4,x10,x11,lsl#26	// base 2^26 -> base 2^64
-	lsr	x5,x12,#12
-	adds	x4,x4,x12,lsl#52
-	add	x5,x5,x13,lsl#14
-	adc	x5,x5,xzr
-	lsr	x6,x14,#24
-	adds	x5,x5,x14,lsl#40
-	adc	x14,x6,xzr		// can be partially reduced...
-
-	ldp	x12,x13,[x1],#16	// load input
-	sub	x2,x2,#16
-	add	x9,x8,x8,lsr#2	// s1 = r1 + (r1 >> 2)
-
-	and	x10,x14,#-4		// ... so reduce
-	and	x6,x14,#3
-	add	x10,x10,x14,lsr#2
-	adds	x4,x4,x10
-	adc	x5,x5,xzr
-
-#ifdef	__ARMEB__
-	rev	x12,x12
-	rev	x13,x13
-#endif
-	adds	x4,x4,x12		// accumulate input
-	adcs	x5,x5,x13
-	adc	x6,x6,x3
-
-	bl	poly1305_mult
-	ldr	x30,[sp,#8]
-
-	cbz	x3,.Lstore_base2_64_neon
-
-	and	x10,x4,#0x03ffffff	// base 2^64 -> base 2^26
-	ubfx	x11,x4,#26,#26
-	extr	x12,x5,x4,#52
-	and	x12,x12,#0x03ffffff
-	ubfx	x13,x5,#14,#26
-	extr	x14,x6,x5,#40
-
-	cbnz	x2,.Leven_neon
-
-	stp	w10,w11,[x0]		// store hash value base 2^26
-	stp	w12,w13,[x0,#8]
-	str	w14,[x0,#16]
-	b	.Lno_data_neon
-
-.align	4
-.Lstore_base2_64_neon:
-	stp	x4,x5,[x0]		// store hash value base 2^64
-	stp	x6,xzr,[x0,#16]	// note that is_base2_26 is zeroed
-	b	.Lno_data_neon
-
-.align	4
-.Lbase2_64_neon:
-	ldp	x7,x8,[x0,#32]	// load key value
-
-	ldp	x4,x5,[x0]		// load hash value base 2^64
-	ldr	x6,[x0,#16]
-
-	tst	x2,#31
-	b.eq	.Linit_neon
-
-	ldp	x12,x13,[x1],#16	// load input
-	sub	x2,x2,#16
-	add	x9,x8,x8,lsr#2	// s1 = r1 + (r1 >> 2)
-#ifdef	__ARMEB__
-	rev	x12,x12
-	rev	x13,x13
-#endif
-	adds	x4,x4,x12		// accumulate input
-	adcs	x5,x5,x13
-	adc	x6,x6,x3
-
-	bl	poly1305_mult
-
-.Linit_neon:
-	and	x10,x4,#0x03ffffff	// base 2^64 -> base 2^26
-	ubfx	x11,x4,#26,#26
-	extr	x12,x5,x4,#52
-	and	x12,x12,#0x03ffffff
-	ubfx	x13,x5,#14,#26
-	extr	x14,x6,x5,#40
-
-	stp	d8,d9,[sp,#16]		// meet ABI requirements
-	stp	d10,d11,[sp,#32]
-	stp	d12,d13,[sp,#48]
-	stp	d14,d15,[sp,#64]
-
-	fmov	d24,x10
-	fmov	d25,x11
-	fmov	d26,x12
-	fmov	d27,x13
-	fmov	d28,x14
-
-	////////////////////////////////// initialize r^n table
-	mov	x4,x7			// r^1
-	add	x9,x8,x8,lsr#2	// s1 = r1 + (r1 >> 2)
-	mov	x5,x8
-	mov	x6,xzr
-	add	x0,x0,#48+12
-	bl	poly1305_splat
-
-	bl	poly1305_mult		// r^2
-	sub	x0,x0,#4
-	bl	poly1305_splat
-
-	bl	poly1305_mult		// r^3
-	sub	x0,x0,#4
-	bl	poly1305_splat
-
-	bl	poly1305_mult		// r^4
-	sub	x0,x0,#4
-	bl	poly1305_splat
-	ldr	x30,[sp,#8]
-
-	add	x16,x1,#32
-	adr	x17,.Lzeros
-	subs	x2,x2,#64
-	csel	x16,x17,x16,lo
-
-	mov	x4,#1
-	str	x4,[x0,#-24]		// set is_base2_26
-	sub	x0,x0,#48		// restore original x0
-	b	.Ldo_neon
-
-.align	4
-.Leven_neon:
-	add	x16,x1,#32
-	adr	x17,.Lzeros
-	subs	x2,x2,#64
-	csel	x16,x17,x16,lo
-
-	stp	d8,d9,[sp,#16]		// meet ABI requirements
-	stp	d10,d11,[sp,#32]
-	stp	d12,d13,[sp,#48]
-	stp	d14,d15,[sp,#64]
-
-	fmov	d24,x10
-	fmov	d25,x11
-	fmov	d26,x12
-	fmov	d27,x13
-	fmov	d28,x14
-
-.Ldo_neon:
-	ldp	x8,x12,[x16],#16	// inp[2:3] (or zero)
-	ldp	x9,x13,[x16],#48
-
-	lsl	x3,x3,#24
-	add	x15,x0,#48
-
-#ifdef	__ARMEB__
-	rev	x8,x8
-	rev	x12,x12
-	rev	x9,x9
-	rev	x13,x13
-#endif
-	and	x4,x8,#0x03ffffff	// base 2^64 -> base 2^26
-	and	x5,x9,#0x03ffffff
-	ubfx	x6,x8,#26,#26
-	ubfx	x7,x9,#26,#26
-	add	x4,x4,x5,lsl#32		// bfi	x4,x5,#32,#32
-	extr	x8,x12,x8,#52
-	extr	x9,x13,x9,#52
-	add	x6,x6,x7,lsl#32		// bfi	x6,x7,#32,#32
-	fmov	d14,x4
-	and	x8,x8,#0x03ffffff
-	and	x9,x9,#0x03ffffff
-	ubfx	x10,x12,#14,#26
-	ubfx	x11,x13,#14,#26
-	add	x12,x3,x12,lsr#40
-	add	x13,x3,x13,lsr#40
-	add	x8,x8,x9,lsl#32		// bfi	x8,x9,#32,#32
-	fmov	d15,x6
-	add	x10,x10,x11,lsl#32	// bfi	x10,x11,#32,#32
-	add	x12,x12,x13,lsl#32	// bfi	x12,x13,#32,#32
-	fmov	d16,x8
-	fmov	d17,x10
-	fmov	d18,x12
-
-	ldp	x8,x12,[x1],#16	// inp[0:1]
-	ldp	x9,x13,[x1],#48
-
-	ld1	{v0.4s,v1.4s,v2.4s,v3.4s},[x15],#64
-	ld1	{v4.4s,v5.4s,v6.4s,v7.4s},[x15],#64
-	ld1	{v8.4s},[x15]
-
-#ifdef	__ARMEB__
-	rev	x8,x8
-	rev	x12,x12
-	rev	x9,x9
-	rev	x13,x13
-#endif
-	and	x4,x8,#0x03ffffff	// base 2^64 -> base 2^26
-	and	x5,x9,#0x03ffffff
-	ubfx	x6,x8,#26,#26
-	ubfx	x7,x9,#26,#26
-	add	x4,x4,x5,lsl#32		// bfi	x4,x5,#32,#32
-	extr	x8,x12,x8,#52
-	extr	x9,x13,x9,#52
-	add	x6,x6,x7,lsl#32		// bfi	x6,x7,#32,#32
-	fmov	d9,x4
-	and	x8,x8,#0x03ffffff
-	and	x9,x9,#0x03ffffff
-	ubfx	x10,x12,#14,#26
-	ubfx	x11,x13,#14,#26
-	add	x12,x3,x12,lsr#40
-	add	x13,x3,x13,lsr#40
-	add	x8,x8,x9,lsl#32		// bfi	x8,x9,#32,#32
-	fmov	d10,x6
-	add	x10,x10,x11,lsl#32	// bfi	x10,x11,#32,#32
-	add	x12,x12,x13,lsl#32	// bfi	x12,x13,#32,#32
-	fmov	d11,x8
-	fmov	d12,x10
-	fmov	d13,x12
-
-	b.ls	.Lskip_loop
-
-.align	4
-.Loop_neon:
-	////////////////////////////////////////////////////////////////
-	// ((inp[0]*r^4+inp[2]*r^2+inp[4])*r^4+inp[6]*r^2
-	// ((inp[1]*r^4+inp[3]*r^2+inp[5])*r^3+inp[7]*r
-	//   ___________________/
-	// ((inp[0]*r^4+inp[2]*r^2+inp[4])*r^4+inp[6]*r^2+inp[8])*r^2
-	// ((inp[1]*r^4+inp[3]*r^2+inp[5])*r^4+inp[7]*r^2+inp[9])*r
-	//   ___________________/ ____________________/
-	//
-	// Note that we start with inp[2:3]*r^2. This is because it
-	// doesn't depend on reduction in previous iteration.
-	////////////////////////////////////////////////////////////////
-	// d4 = h0*r4 + h1*r3   + h2*r2   + h3*r1   + h4*r0
-	// d3 = h0*r3 + h1*r2   + h2*r1   + h3*r0   + h4*5*r4
-	// d2 = h0*r2 + h1*r1   + h2*r0   + h3*5*r4 + h4*5*r3
-	// d1 = h0*r1 + h1*r0   + h2*5*r4 + h3*5*r3 + h4*5*r2
-	// d0 = h0*r0 + h1*5*r4 + h2*5*r3 + h3*5*r2 + h4*5*r1
-
-	subs	x2,x2,#64
-	umull	v23.2d,v14.2s,v7.s[2]
-	csel	x16,x17,x16,lo
-	umull	v22.2d,v14.2s,v5.s[2]
-	umull	v21.2d,v14.2s,v3.s[2]
-	ldp	x8,x12,[x16],#16	// inp[2:3] (or zero)
-	umull	v20.2d,v14.2s,v1.s[2]
-	ldp	x9,x13,[x16],#48
-	umull	v19.2d,v14.2s,v0.s[2]
-#ifdef	__ARMEB__
-	rev	x8,x8
-	rev	x12,x12
-	rev	x9,x9
-	rev	x13,x13
-#endif
-
-	umlal	v23.2d,v15.2s,v5.s[2]
-	and	x4,x8,#0x03ffffff	// base 2^64 -> base 2^26
-	umlal	v22.2d,v15.2s,v3.s[2]
-	and	x5,x9,#0x03ffffff
-	umlal	v21.2d,v15.2s,v1.s[2]
-	ubfx	x6,x8,#26,#26
-	umlal	v20.2d,v15.2s,v0.s[2]
-	ubfx	x7,x9,#26,#26
-	umlal	v19.2d,v15.2s,v8.s[2]
-	add	x4,x4,x5,lsl#32		// bfi	x4,x5,#32,#32
-
-	umlal	v23.2d,v16.2s,v3.s[2]
-	extr	x8,x12,x8,#52
-	umlal	v22.2d,v16.2s,v1.s[2]
-	extr	x9,x13,x9,#52
-	umlal	v21.2d,v16.2s,v0.s[2]
-	add	x6,x6,x7,lsl#32		// bfi	x6,x7,#32,#32
-	umlal	v20.2d,v16.2s,v8.s[2]
-	fmov	d14,x4
-	umlal	v19.2d,v16.2s,v6.s[2]
-	and	x8,x8,#0x03ffffff
-
-	umlal	v23.2d,v17.2s,v1.s[2]
-	and	x9,x9,#0x03ffffff
-	umlal	v22.2d,v17.2s,v0.s[2]
-	ubfx	x10,x12,#14,#26
-	umlal	v21.2d,v17.2s,v8.s[2]
-	ubfx	x11,x13,#14,#26
-	umlal	v20.2d,v17.2s,v6.s[2]
-	add	x8,x8,x9,lsl#32		// bfi	x8,x9,#32,#32
-	umlal	v19.2d,v17.2s,v4.s[2]
-	fmov	d15,x6
-
-	add	v11.2s,v11.2s,v26.2s
-	add	x12,x3,x12,lsr#40
-	umlal	v23.2d,v18.2s,v0.s[2]
-	add	x13,x3,x13,lsr#40
-	umlal	v22.2d,v18.2s,v8.s[2]
-	add	x10,x10,x11,lsl#32	// bfi	x10,x11,#32,#32
-	umlal	v21.2d,v18.2s,v6.s[2]
-	add	x12,x12,x13,lsl#32	// bfi	x12,x13,#32,#32
-	umlal	v20.2d,v18.2s,v4.s[2]
-	fmov	d16,x8
-	umlal	v19.2d,v18.2s,v2.s[2]
-	fmov	d17,x10
-
-	////////////////////////////////////////////////////////////////
-	// (hash+inp[0:1])*r^4 and accumulate
-
-	add	v9.2s,v9.2s,v24.2s
-	fmov	d18,x12
-	umlal	v22.2d,v11.2s,v1.s[0]
-	ldp	x8,x12,[x1],#16	// inp[0:1]
-	umlal	v19.2d,v11.2s,v6.s[0]
-	ldp	x9,x13,[x1],#48
-	umlal	v23.2d,v11.2s,v3.s[0]
-	umlal	v20.2d,v11.2s,v8.s[0]
-	umlal	v21.2d,v11.2s,v0.s[0]
-#ifdef	__ARMEB__
-	rev	x8,x8
-	rev	x12,x12
-	rev	x9,x9
-	rev	x13,x13
-#endif
-
-	add	v10.2s,v10.2s,v25.2s
-	umlal	v22.2d,v9.2s,v5.s[0]
-	umlal	v23.2d,v9.2s,v7.s[0]
-	and	x4,x8,#0x03ffffff	// base 2^64 -> base 2^26
-	umlal	v21.2d,v9.2s,v3.s[0]
-	and	x5,x9,#0x03ffffff
-	umlal	v19.2d,v9.2s,v0.s[0]
-	ubfx	x6,x8,#26,#26
-	umlal	v20.2d,v9.2s,v1.s[0]
-	ubfx	x7,x9,#26,#26
-
-	add	v12.2s,v12.2s,v27.2s
-	add	x4,x4,x5,lsl#32		// bfi	x4,x5,#32,#32
-	umlal	v22.2d,v10.2s,v3.s[0]
-	extr	x8,x12,x8,#52
-	umlal	v23.2d,v10.2s,v5.s[0]
-	extr	x9,x13,x9,#52
-	umlal	v19.2d,v10.2s,v8.s[0]
-	add	x6,x6,x7,lsl#32		// bfi	x6,x7,#32,#32
-	umlal	v21.2d,v10.2s,v1.s[0]
-	fmov	d9,x4
-	umlal	v20.2d,v10.2s,v0.s[0]
-	and	x8,x8,#0x03ffffff
-
-	add	v13.2s,v13.2s,v28.2s
-	and	x9,x9,#0x03ffffff
-	umlal	v22.2d,v12.2s,v0.s[0]
-	ubfx	x10,x12,#14,#26
-	umlal	v19.2d,v12.2s,v4.s[0]
-	ubfx	x11,x13,#14,#26
-	umlal	v23.2d,v12.2s,v1.s[0]
-	add	x8,x8,x9,lsl#32		// bfi	x8,x9,#32,#32
-	umlal	v20.2d,v12.2s,v6.s[0]
-	fmov	d10,x6
-	umlal	v21.2d,v12.2s,v8.s[0]
-	add	x12,x3,x12,lsr#40
-
-	umlal	v22.2d,v13.2s,v8.s[0]
-	add	x13,x3,x13,lsr#40
-	umlal	v19.2d,v13.2s,v2.s[0]
-	add	x10,x10,x11,lsl#32	// bfi	x10,x11,#32,#32
-	umlal	v23.2d,v13.2s,v0.s[0]
-	add	x12,x12,x13,lsl#32	// bfi	x12,x13,#32,#32
-	umlal	v20.2d,v13.2s,v4.s[0]
-	fmov	d11,x8
-	umlal	v21.2d,v13.2s,v6.s[0]
-	fmov	d12,x10
-
-	/////////////////////////////////////////////////////////////////
-	// lazy reduction as discussed in "NEON crypto" by D.J. Bernstein
-        // and P. Schwabe
-
-	ushr	v29.2d,v22.2d,#26
-	fmov	d13,x12
-	xtn	v27.2s,v22.2d
-	ushr	v30.2d,v19.2d,#26
-	xtn	v24.2s,v19.2d
-	add	v23.2d,v23.2d,v29.2d	// h3 -> h4
-	bic	v27.2s,#0xfc,lsl#24	// &=0x03ffffff
-	add	v20.2d,v20.2d,v30.2d	// h0 -> h1
-	bic	v24.2s,#0xfc,lsl#24
-
-	shrn	v29.2s,v23.2d,#26
-	xtn	v28.2s,v23.2d
-	ushr	v30.2d,v20.2d,#26
-	xtn	v25.2s,v20.2d
-	add	v21.2d,v21.2d,v30.2d	// h1 -> h2
-	bic	v28.2s,#0xfc,lsl#24
-	bic	v25.2s,#0xfc,lsl#24
-
-	add	v24.2s,v24.2s,v29.2s
-	shl	v29.2s,v29.2s,#2
-	shrn	v30.2s,v21.2d,#26
-	xtn	v26.2s,v21.2d
-	add	v24.2s,v24.2s,v29.2s		// h4 -> h0
-	add	v27.2s,v27.2s,v30.2s		// h2 -> h3
-	bic	v26.2s,#0xfc,lsl#24
-
-	ushr	v29.2s,v24.2s,#26
-	bic	v24.2s,#0xfc,lsl#24
-	ushr	v30.2s,v27.2s,#26
-	bic	v27.2s,#0xfc,lsl#24
-	add	v25.2s,v25.2s,v29.2s		// h0 -> h1
-	add	v28.2s,v28.2s,v30.2s		// h3 -> h4
-
-	b.hi	.Loop_neon
-
-.Lskip_loop:
-	dup	v16.2d,v16.d[0]
-	movi	v31.2d,#-1
-	add	v11.2s,v11.2s,v26.2s
-	ushr	v31.2d,v31.2d,#38
-
-	////////////////////////////////////////////////////////////////
-	// multiply (inp[0:1]+hash) or inp[2:3] by r^2:r^1
-
-	adds	x2,x2,#32
-	b.ne	.Long_tail
-
-	dup	v16.2d,v11.d[0]
-	add	v14.2s,v9.2s,v24.2s
-	add	v17.2s,v12.2s,v27.2s
-	add	v15.2s,v10.2s,v25.2s
-	add	v18.2s,v13.2s,v28.2s
-
-.Long_tail:
-	dup	v14.2d,v14.d[0]
-	umull2	v19.2d,v16.4s,v6.4s
-	umull2	v22.2d,v16.4s,v1.4s
-	umull2	v23.2d,v16.4s,v3.4s
-	umull2	v21.2d,v16.4s,v0.4s
-	umull2	v20.2d,v16.4s,v8.4s
-
-	dup	v15.2d,v15.d[0]
-	umlal2	v19.2d,v14.4s,v0.4s
-	umlal2	v21.2d,v14.4s,v3.4s
-	umlal2	v22.2d,v14.4s,v5.4s
-	umlal2	v23.2d,v14.4s,v7.4s
-	umlal2	v20.2d,v14.4s,v1.4s
-
-	dup	v17.2d,v17.d[0]
-	umlal2	v19.2d,v15.4s,v8.4s
-	umlal2	v22.2d,v15.4s,v3.4s
-	umlal2	v21.2d,v15.4s,v1.4s
-	umlal2	v23.2d,v15.4s,v5.4s
-	umlal2	v20.2d,v15.4s,v0.4s
-
-	dup	v18.2d,v18.d[0]
-	umlal2	v22.2d,v17.4s,v0.4s
-	umlal2	v23.2d,v17.4s,v1.4s
-	umlal2	v19.2d,v17.4s,v4.4s
-	umlal2	v20.2d,v17.4s,v6.4s
-	umlal2	v21.2d,v17.4s,v8.4s
-
-	umlal2	v22.2d,v18.4s,v8.4s
-	umlal2	v19.2d,v18.4s,v2.4s
-	umlal2	v23.2d,v18.4s,v0.4s
-	umlal2	v20.2d,v18.4s,v4.4s
-	umlal2	v21.2d,v18.4s,v6.4s
-
-	b.eq	.Lshort_tail
-
-	////////////////////////////////////////////////////////////////
-	// (hash+inp[0:1])*r^4:r^3 and accumulate
-
-	add	v9.2s,v9.2s,v24.2s
-	umlal	v22.2d,v11.2s,v1.2s
-	umlal	v19.2d,v11.2s,v6.2s
-	umlal	v23.2d,v11.2s,v3.2s
-	umlal	v20.2d,v11.2s,v8.2s
-	umlal	v21.2d,v11.2s,v0.2s
-
-	add	v10.2s,v10.2s,v25.2s
-	umlal	v22.2d,v9.2s,v5.2s
-	umlal	v19.2d,v9.2s,v0.2s
-	umlal	v23.2d,v9.2s,v7.2s
-	umlal	v20.2d,v9.2s,v1.2s
-	umlal	v21.2d,v9.2s,v3.2s
-
-	add	v12.2s,v12.2s,v27.2s
-	umlal	v22.2d,v10.2s,v3.2s
-	umlal	v19.2d,v10.2s,v8.2s
-	umlal	v23.2d,v10.2s,v5.2s
-	umlal	v20.2d,v10.2s,v0.2s
-	umlal	v21.2d,v10.2s,v1.2s
-
-	add	v13.2s,v13.2s,v28.2s
-	umlal	v22.2d,v12.2s,v0.2s
-	umlal	v19.2d,v12.2s,v4.2s
-	umlal	v23.2d,v12.2s,v1.2s
-	umlal	v20.2d,v12.2s,v6.2s
-	umlal	v21.2d,v12.2s,v8.2s
-
-	umlal	v22.2d,v13.2s,v8.2s
-	umlal	v19.2d,v13.2s,v2.2s
-	umlal	v23.2d,v13.2s,v0.2s
-	umlal	v20.2d,v13.2s,v4.2s
-	umlal	v21.2d,v13.2s,v6.2s
-
-.Lshort_tail:
-	////////////////////////////////////////////////////////////////
-	// horizontal add
-
-	addp	v22.2d,v22.2d,v22.2d
-	ldp	d8,d9,[sp,#16]		// meet ABI requirements
-	addp	v19.2d,v19.2d,v19.2d
-	ldp	d10,d11,[sp,#32]
-	addp	v23.2d,v23.2d,v23.2d
-	ldp	d12,d13,[sp,#48]
-	addp	v20.2d,v20.2d,v20.2d
-	ldp	d14,d15,[sp,#64]
-	addp	v21.2d,v21.2d,v21.2d
-
-	////////////////////////////////////////////////////////////////
-	// lazy reduction, but without narrowing
-
-	ushr	v29.2d,v22.2d,#26
-	and	v22.16b,v22.16b,v31.16b
-	ushr	v30.2d,v19.2d,#26
-	and	v19.16b,v19.16b,v31.16b
-
-	add	v23.2d,v23.2d,v29.2d	// h3 -> h4
-	add	v20.2d,v20.2d,v30.2d	// h0 -> h1
-
-	ushr	v29.2d,v23.2d,#26
-	and	v23.16b,v23.16b,v31.16b
-	ushr	v30.2d,v20.2d,#26
-	and	v20.16b,v20.16b,v31.16b
-	add	v21.2d,v21.2d,v30.2d	// h1 -> h2
-
-	add	v19.2d,v19.2d,v29.2d
-	shl	v29.2d,v29.2d,#2
-	ushr	v30.2d,v21.2d,#26
-	and	v21.16b,v21.16b,v31.16b
-	add	v19.2d,v19.2d,v29.2d	// h4 -> h0
-	add	v22.2d,v22.2d,v30.2d	// h2 -> h3
-
-	ushr	v29.2d,v19.2d,#26
-	and	v19.16b,v19.16b,v31.16b
-	ushr	v30.2d,v22.2d,#26
-	and	v22.16b,v22.16b,v31.16b
-	add	v20.2d,v20.2d,v29.2d	// h0 -> h1
-	add	v23.2d,v23.2d,v30.2d	// h3 -> h4
-
-	////////////////////////////////////////////////////////////////
-	// write the result, can be partially reduced
-
-	st4	{v19.s,v20.s,v21.s,v22.s}[0],[x0],#16
-	st1	{v23.s}[0],[x0]
-
-.Lno_data_neon:
-	ldr	x29,[sp],#80
-	ret
-.size	poly1305_blocks_neon,.-poly1305_blocks_neon
-
-.type	poly1305_emit_neon,%function
-.align	5
-poly1305_emit_neon:
-	ldr	x17,[x0,#24]
-	cbz	x17,poly1305_emit
-
-	ldp	w10,w11,[x0]		// load hash value base 2^26
-	ldp	w12,w13,[x0,#8]
-	ldr	w14,[x0,#16]
-
-	add	x4,x10,x11,lsl#26	// base 2^26 -> base 2^64
-	lsr	x5,x12,#12
-	adds	x4,x4,x12,lsl#52
-	add	x5,x5,x13,lsl#14
-	adc	x5,x5,xzr
-	lsr	x6,x14,#24
-	adds	x5,x5,x14,lsl#40
-	adc	x6,x6,xzr		// can be partially reduced...
-
-	ldp	x10,x11,[x2]	// load nonce
-
-	and	x12,x6,#-4		// ... so reduce
-	add	x12,x12,x6,lsr#2
-	and	x6,x6,#3
-	adds	x4,x4,x12
-	adc	x5,x5,xzr
-
-	adds	x12,x4,#5		// compare to modulus
-	adcs	x13,x5,xzr
-	adc	x14,x6,xzr
-
-	tst	x14,#-4			// see if it's carried/borrowed
-
-	csel	x4,x4,x12,eq
-	csel	x5,x5,x13,eq
-
-#ifdef	__ARMEB__
-	ror	x10,x10,#32		// flip nonce words
-	ror	x11,x11,#32
-#endif
-	adds	x4,x4,x10		// accumulate nonce
-	adc	x5,x5,x11
-#ifdef	__ARMEB__
-	rev	x4,x4			// flip output bytes
-	rev	x5,x5
-#endif
-	stp	x4,x5,[x1]		// write result
-
-	ret
-.size	poly1305_emit_neon,.-poly1305_emit_neon
-
-.align	5
-.Lzeros:
-.long	0,0,0,0,0,0,0,0
-.LOPENSSL_armcap_P:
-#ifdef	__ILP32__
-.long	OPENSSL_armcap_P-.
-#else
-.quad	OPENSSL_armcap_P-.
-#endif
-.byte	80,111,108,121,49,51,48,53,32,102,111,114,32,65,82,77,118,56,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
-.align	2
-.align	2
-#endif
diff --git a/third_party/boringssl/linux-arm/crypto/poly1305/poly1305-armv4.S b/third_party/boringssl/linux-arm/crypto/poly1305/poly1305-armv4.S
deleted file mode 100644
index acd96f2..0000000
--- a/third_party/boringssl/linux-arm/crypto/poly1305/poly1305-armv4.S
+++ /dev/null
@@ -1,1143 +0,0 @@
-#if defined(__arm__)
-#include <openssl/arm_arch.h>
-
-.text
-#if defined(__thumb2__)
-.syntax	unified
-.thumb
-#else
-.code	32
-#endif
-
-.globl	poly1305_emit
-.hidden	poly1305_emit
-.globl	poly1305_blocks
-.hidden	poly1305_blocks
-.globl	poly1305_init
-.hidden	poly1305_init
-.type	poly1305_init,%function
-.align	5
-poly1305_init:
-.Lpoly1305_init:
-	stmdb	sp!,{r4,r5,r6,r7,r8,r9,r10,r11}
-
-	eor	r3,r3,r3
-	cmp	r1,#0
-	str	r3,[r0,#0]		@ zero hash value
-	str	r3,[r0,#4]
-	str	r3,[r0,#8]
-	str	r3,[r0,#12]
-	str	r3,[r0,#16]
-	str	r3,[r0,#36]		@ is_base2_26
-	add	r0,r0,#20
-
-#ifdef	__thumb2__
-	it	eq
-#endif
-	moveq	r0,#0
-	beq	.Lno_key
-
-#if	__ARM_MAX_ARCH__>=7
-	adr	r11,.Lpoly1305_init
-	ldr	r12,.LOPENSSL_armcap
-#endif
-	ldrb	r4,[r1,#0]
-	mov	r10,#0x0fffffff
-	ldrb	r5,[r1,#1]
-	and	r3,r10,#-4		@ 0x0ffffffc
-	ldrb	r6,[r1,#2]
-	ldrb	r7,[r1,#3]
-	orr	r4,r4,r5,lsl#8
-	ldrb	r5,[r1,#4]
-	orr	r4,r4,r6,lsl#16
-	ldrb	r6,[r1,#5]
-	orr	r4,r4,r7,lsl#24
-	ldrb	r7,[r1,#6]
-	and	r4,r4,r10
-
-#if	__ARM_MAX_ARCH__>=7
-	ldr	r12,[r11,r12]		@ OPENSSL_armcap_P
-# ifdef	__APPLE__
-	ldr	r12,[r12]
-# endif
-#endif
-	ldrb	r8,[r1,#7]
-	orr	r5,r5,r6,lsl#8
-	ldrb	r6,[r1,#8]
-	orr	r5,r5,r7,lsl#16
-	ldrb	r7,[r1,#9]
-	orr	r5,r5,r8,lsl#24
-	ldrb	r8,[r1,#10]
-	and	r5,r5,r3
-
-#if	__ARM_MAX_ARCH__>=7
-	tst	r12,#ARMV7_NEON		@ check for NEON
-# ifdef	__APPLE__
-	adr	r9,poly1305_blocks_neon
-	adr	r11,poly1305_blocks
-#  ifdef __thumb2__
-	it	ne
-#  endif
-	movne	r11,r9
-	adr	r12,poly1305_emit
-	adr	r10,poly1305_emit_neon
-#  ifdef __thumb2__
-	it	ne
-#  endif
-	movne	r12,r10
-# else
-#  ifdef __thumb2__
-	itete	eq
-#  endif
-	addeq	r12,r11,#(poly1305_emit-.Lpoly1305_init)
-	addne	r12,r11,#(poly1305_emit_neon-.Lpoly1305_init)
-	addeq	r11,r11,#(poly1305_blocks-.Lpoly1305_init)
-	addne	r11,r11,#(poly1305_blocks_neon-.Lpoly1305_init)
-# endif
-# ifdef	__thumb2__
-	orr	r12,r12,#1	@ thumb-ify address
-	orr	r11,r11,#1
-# endif
-#endif
-	ldrb	r9,[r1,#11]
-	orr	r6,r6,r7,lsl#8
-	ldrb	r7,[r1,#12]
-	orr	r6,r6,r8,lsl#16
-	ldrb	r8,[r1,#13]
-	orr	r6,r6,r9,lsl#24
-	ldrb	r9,[r1,#14]
-	and	r6,r6,r3
-
-	ldrb	r10,[r1,#15]
-	orr	r7,r7,r8,lsl#8
-	str	r4,[r0,#0]
-	orr	r7,r7,r9,lsl#16
-	str	r5,[r0,#4]
-	orr	r7,r7,r10,lsl#24
-	str	r6,[r0,#8]
-	and	r7,r7,r3
-	str	r7,[r0,#12]
-#if	__ARM_MAX_ARCH__>=7
-	stmia	r2,{r11,r12}		@ fill functions table
-	mov	r0,#1
-#else
-	mov	r0,#0
-#endif
-.Lno_key:
-	ldmia	sp!,{r4,r5,r6,r7,r8,r9,r10,r11}
-#if	__ARM_ARCH__>=5
-	bx	lr				@ bx	lr
-#else
-	tst	lr,#1
-	moveq	pc,lr			@ be binary compatible with V4, yet
-.word	0xe12fff1e			@ interoperable with Thumb ISA:-)
-#endif
-.size	poly1305_init,.-poly1305_init
-.type	poly1305_blocks,%function
-.align	5
-poly1305_blocks:
-	stmdb	sp!,{r3,r4,r5,r6,r7,r8,r9,r10,r11,lr}
-
-	ands	r2,r2,#-16
-	beq	.Lno_data
-
-	cmp	r3,#0
-	add	r2,r2,r1		@ end pointer
-	sub	sp,sp,#32
-
-	ldmia	r0,{r4,r5,r6,r7,r8,r9,r10,r11,r12}		@ load context
-
-	str	r0,[sp,#12]		@ offload stuff
-	mov	lr,r1
-	str	r2,[sp,#16]
-	str	r10,[sp,#20]
-	str	r11,[sp,#24]
-	str	r12,[sp,#28]
-	b	.Loop
-
-.Loop:
-#if __ARM_ARCH__<7
-	ldrb	r0,[lr],#16		@ load input
-# ifdef	__thumb2__
-	it	hi
-# endif
-	addhi	r8,r8,#1		@ 1<<128
-	ldrb	r1,[lr,#-15]
-	ldrb	r2,[lr,#-14]
-	ldrb	r3,[lr,#-13]
-	orr	r1,r0,r1,lsl#8
-	ldrb	r0,[lr,#-12]
-	orr	r2,r1,r2,lsl#16
-	ldrb	r1,[lr,#-11]
-	orr	r3,r2,r3,lsl#24
-	ldrb	r2,[lr,#-10]
-	adds	r4,r4,r3		@ accumulate input
-
-	ldrb	r3,[lr,#-9]
-	orr	r1,r0,r1,lsl#8
-	ldrb	r0,[lr,#-8]
-	orr	r2,r1,r2,lsl#16
-	ldrb	r1,[lr,#-7]
-	orr	r3,r2,r3,lsl#24
-	ldrb	r2,[lr,#-6]
-	adcs	r5,r5,r3
-
-	ldrb	r3,[lr,#-5]
-	orr	r1,r0,r1,lsl#8
-	ldrb	r0,[lr,#-4]
-	orr	r2,r1,r2,lsl#16
-	ldrb	r1,[lr,#-3]
-	orr	r3,r2,r3,lsl#24
-	ldrb	r2,[lr,#-2]
-	adcs	r6,r6,r3
-
-	ldrb	r3,[lr,#-1]
-	orr	r1,r0,r1,lsl#8
-	str	lr,[sp,#8]		@ offload input pointer
-	orr	r2,r1,r2,lsl#16
-	add	r10,r10,r10,lsr#2
-	orr	r3,r2,r3,lsl#24
-#else
-	ldr	r0,[lr],#16		@ load input
-# ifdef	__thumb2__
-	it	hi
-# endif
-	addhi	r8,r8,#1		@ padbit
-	ldr	r1,[lr,#-12]
-	ldr	r2,[lr,#-8]
-	ldr	r3,[lr,#-4]
-# ifdef	__ARMEB__
-	rev	r0,r0
-	rev	r1,r1
-	rev	r2,r2
-	rev	r3,r3
-# endif
-	adds	r4,r4,r0		@ accumulate input
-	str	lr,[sp,#8]		@ offload input pointer
-	adcs	r5,r5,r1
-	add	r10,r10,r10,lsr#2
-	adcs	r6,r6,r2
-#endif
-	add	r11,r11,r11,lsr#2
-	adcs	r7,r7,r3
-	add	r12,r12,r12,lsr#2
-
-	umull	r2,r3,r5,r9
-	adc	r8,r8,#0
-	umull	r0,r1,r4,r9
-	umlal	r2,r3,r8,r10
-	umlal	r0,r1,r7,r10
-	ldr	r10,[sp,#20]		@ reload r10
-	umlal	r2,r3,r6,r12
-	umlal	r0,r1,r5,r12
-	umlal	r2,r3,r7,r11
-	umlal	r0,r1,r6,r11
-	umlal	r2,r3,r4,r10
-	str	r0,[sp,#0]		@ future r4
-	mul	r0,r11,r8
-	ldr	r11,[sp,#24]		@ reload r11
-	adds	r2,r2,r1		@ d1+=d0>>32
-	eor	r1,r1,r1
-	adc	lr,r3,#0		@ future r6
-	str	r2,[sp,#4]		@ future r5
-
-	mul	r2,r12,r8
-	eor	r3,r3,r3
-	umlal	r0,r1,r7,r12
-	ldr	r12,[sp,#28]		@ reload r12
-	umlal	r2,r3,r7,r9
-	umlal	r0,r1,r6,r9
-	umlal	r2,r3,r6,r10
-	umlal	r0,r1,r5,r10
-	umlal	r2,r3,r5,r11
-	umlal	r0,r1,r4,r11
-	umlal	r2,r3,r4,r12
-	ldr	r4,[sp,#0]
-	mul	r8,r9,r8
-	ldr	r5,[sp,#4]
-
-	adds	r6,lr,r0		@ d2+=d1>>32
-	ldr	lr,[sp,#8]		@ reload input pointer
-	adc	r1,r1,#0
-	adds	r7,r2,r1		@ d3+=d2>>32
-	ldr	r0,[sp,#16]		@ reload end pointer
-	adc	r3,r3,#0
-	add	r8,r8,r3		@ h4+=d3>>32
-
-	and	r1,r8,#-4
-	and	r8,r8,#3
-	add	r1,r1,r1,lsr#2		@ *=5
-	adds	r4,r4,r1
-	adcs	r5,r5,#0
-	adcs	r6,r6,#0
-	adc	r7,r7,#0
-
-	cmp	r0,lr			@ done yet?
-	bhi	.Loop
-
-	ldr	r0,[sp,#12]
-	add	sp,sp,#32
-	stmia	r0,{r4,r5,r6,r7,r8}		@ store the result
-
-.Lno_data:
-#if	__ARM_ARCH__>=5
-	ldmia	sp!,{r3,r4,r5,r6,r7,r8,r9,r10,r11,pc}
-#else
-	ldmia	sp!,{r3,r4,r5,r6,r7,r8,r9,r10,r11,lr}
-	tst	lr,#1
-	moveq	pc,lr			@ be binary compatible with V4, yet
-.word	0xe12fff1e			@ interoperable with Thumb ISA:-)
-#endif
-.size	poly1305_blocks,.-poly1305_blocks
-.type	poly1305_emit,%function
-.align	5
-poly1305_emit:
-	stmdb	sp!,{r4,r5,r6,r7,r8,r9,r10,r11}
-.Lpoly1305_emit_enter:
-
-	ldmia	r0,{r3,r4,r5,r6,r7}
-	adds	r8,r3,#5		@ compare to modulus
-	adcs	r9,r4,#0
-	adcs	r10,r5,#0
-	adcs	r11,r6,#0
-	adc	r7,r7,#0
-	tst	r7,#4			@ did it carry/borrow?
-
-#ifdef	__thumb2__
-	it	ne
-#endif
-	movne	r3,r8
-	ldr	r8,[r2,#0]
-#ifdef	__thumb2__
-	it	ne
-#endif
-	movne	r4,r9
-	ldr	r9,[r2,#4]
-#ifdef	__thumb2__
-	it	ne
-#endif
-	movne	r5,r10
-	ldr	r10,[r2,#8]
-#ifdef	__thumb2__
-	it	ne
-#endif
-	movne	r6,r11
-	ldr	r11,[r2,#12]
-
-	adds	r3,r3,r8
-	adcs	r4,r4,r9
-	adcs	r5,r5,r10
-	adc	r6,r6,r11
-
-#if __ARM_ARCH__>=7
-# ifdef __ARMEB__
-	rev	r3,r3
-	rev	r4,r4
-	rev	r5,r5
-	rev	r6,r6
-# endif
-	str	r3,[r1,#0]
-	str	r4,[r1,#4]
-	str	r5,[r1,#8]
-	str	r6,[r1,#12]
-#else
-	strb	r3,[r1,#0]
-	mov	r3,r3,lsr#8
-	strb	r4,[r1,#4]
-	mov	r4,r4,lsr#8
-	strb	r5,[r1,#8]
-	mov	r5,r5,lsr#8
-	strb	r6,[r1,#12]
-	mov	r6,r6,lsr#8
-
-	strb	r3,[r1,#1]
-	mov	r3,r3,lsr#8
-	strb	r4,[r1,#5]
-	mov	r4,r4,lsr#8
-	strb	r5,[r1,#9]
-	mov	r5,r5,lsr#8
-	strb	r6,[r1,#13]
-	mov	r6,r6,lsr#8
-
-	strb	r3,[r1,#2]
-	mov	r3,r3,lsr#8
-	strb	r4,[r1,#6]
-	mov	r4,r4,lsr#8
-	strb	r5,[r1,#10]
-	mov	r5,r5,lsr#8
-	strb	r6,[r1,#14]
-	mov	r6,r6,lsr#8
-
-	strb	r3,[r1,#3]
-	strb	r4,[r1,#7]
-	strb	r5,[r1,#11]
-	strb	r6,[r1,#15]
-#endif
-	ldmia	sp!,{r4,r5,r6,r7,r8,r9,r10,r11}
-#if	__ARM_ARCH__>=5
-	bx	lr				@ bx	lr
-#else
-	tst	lr,#1
-	moveq	pc,lr			@ be binary compatible with V4, yet
-.word	0xe12fff1e			@ interoperable with Thumb ISA:-)
-#endif
-.size	poly1305_emit,.-poly1305_emit
-#if	__ARM_MAX_ARCH__>=7
-.fpu	neon
-
-.type	poly1305_init_neon,%function
-.align	5
-poly1305_init_neon:
-	ldr	r4,[r0,#20]		@ load key base 2^32
-	ldr	r5,[r0,#24]
-	ldr	r6,[r0,#28]
-	ldr	r7,[r0,#32]
-
-	and	r2,r4,#0x03ffffff	@ base 2^32 -> base 2^26
-	mov	r3,r4,lsr#26
-	mov	r4,r5,lsr#20
-	orr	r3,r3,r5,lsl#6
-	mov	r5,r6,lsr#14
-	orr	r4,r4,r6,lsl#12
-	mov	r6,r7,lsr#8
-	orr	r5,r5,r7,lsl#18
-	and	r3,r3,#0x03ffffff
-	and	r4,r4,#0x03ffffff
-	and	r5,r5,#0x03ffffff
-
-	vdup.32	d0,r2			@ r^1 in both lanes
-	add	r2,r3,r3,lsl#2		@ *5
-	vdup.32	d1,r3
-	add	r3,r4,r4,lsl#2
-	vdup.32	d2,r2
-	vdup.32	d3,r4
-	add	r4,r5,r5,lsl#2
-	vdup.32	d4,r3
-	vdup.32	d5,r5
-	add	r5,r6,r6,lsl#2
-	vdup.32	d6,r4
-	vdup.32	d7,r6
-	vdup.32	d8,r5
-
-	mov	r5,#2		@ counter
-
-.Lsquare_neon:
-	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-	@ d0 = h0*r0 + h4*5*r1 + h3*5*r2 + h2*5*r3 + h1*5*r4
-	@ d1 = h1*r0 + h0*r1   + h4*5*r2 + h3*5*r3 + h2*5*r4
-	@ d2 = h2*r0 + h1*r1   + h0*r2   + h4*5*r3 + h3*5*r4
-	@ d3 = h3*r0 + h2*r1   + h1*r2   + h0*r3   + h4*5*r4
-	@ d4 = h4*r0 + h3*r1   + h2*r2   + h1*r3   + h0*r4
-
-	vmull.u32	q5,d0,d0[1]
-	vmull.u32	q6,d1,d0[1]
-	vmull.u32	q7,d3,d0[1]
-	vmull.u32	q8,d5,d0[1]
-	vmull.u32	q9,d7,d0[1]
-
-	vmlal.u32	q5,d7,d2[1]
-	vmlal.u32	q6,d0,d1[1]
-	vmlal.u32	q7,d1,d1[1]
-	vmlal.u32	q8,d3,d1[1]
-	vmlal.u32	q9,d5,d1[1]
-
-	vmlal.u32	q5,d5,d4[1]
-	vmlal.u32	q6,d7,d4[1]
-	vmlal.u32	q8,d1,d3[1]
-	vmlal.u32	q7,d0,d3[1]
-	vmlal.u32	q9,d3,d3[1]
-
-	vmlal.u32	q5,d3,d6[1]
-	vmlal.u32	q8,d0,d5[1]
-	vmlal.u32	q6,d5,d6[1]
-	vmlal.u32	q7,d7,d6[1]
-	vmlal.u32	q9,d1,d5[1]
-
-	vmlal.u32	q8,d7,d8[1]
-	vmlal.u32	q5,d1,d8[1]
-	vmlal.u32	q6,d3,d8[1]
-	vmlal.u32	q7,d5,d8[1]
-	vmlal.u32	q9,d0,d7[1]
-
-	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-	@ lazy reduction as discussed in "NEON crypto" by D.J. Bernstein
-	@ and P. Schwabe
-
-	vshr.u64	q15,q8,#26
-	vmovn.i64	d16,q8
-	vshr.u64	q4,q5,#26
-	vmovn.i64	d10,q5
-	vadd.i64	q9,q9,q15		@ h3 -> h4
-	vbic.i32	d16,#0xfc000000	@ &=0x03ffffff
-	vadd.i64	q6,q6,q4		@ h0 -> h1
-	vbic.i32	d10,#0xfc000000
-
-	vshrn.u64	d30,q9,#26
-	vmovn.i64	d18,q9
-	vshr.u64	q4,q6,#26
-	vmovn.i64	d12,q6
-	vadd.i64	q7,q7,q4		@ h1 -> h2
-	vbic.i32	d18,#0xfc000000
-	vbic.i32	d12,#0xfc000000
-
-	vadd.i32	d10,d10,d30
-	vshl.u32	d30,d30,#2
-	vshrn.u64	d8,q7,#26
-	vmovn.i64	d14,q7
-	vadd.i32	d10,d10,d30	@ h4 -> h0
-	vadd.i32	d16,d16,d8	@ h2 -> h3
-	vbic.i32	d14,#0xfc000000
-
-	vshr.u32	d30,d10,#26
-	vbic.i32	d10,#0xfc000000
-	vshr.u32	d8,d16,#26
-	vbic.i32	d16,#0xfc000000
-	vadd.i32	d12,d12,d30	@ h0 -> h1
-	vadd.i32	d18,d18,d8	@ h3 -> h4
-
-	subs	r5,r5,#1
-	beq	.Lsquare_break_neon
-
-	add	r6,r0,#(48+0*9*4)
-	add	r7,r0,#(48+1*9*4)
-
-	vtrn.32	d0,d10		@ r^2:r^1
-	vtrn.32	d3,d14
-	vtrn.32	d5,d16
-	vtrn.32	d1,d12
-	vtrn.32	d7,d18
-
-	vshl.u32	d4,d3,#2		@ *5
-	vshl.u32	d6,d5,#2
-	vshl.u32	d2,d1,#2
-	vshl.u32	d8,d7,#2
-	vadd.i32	d4,d4,d3
-	vadd.i32	d2,d2,d1
-	vadd.i32	d6,d6,d5
-	vadd.i32	d8,d8,d7
-
-	vst4.32	{d0[0],d1[0],d2[0],d3[0]},[r6]!
-	vst4.32	{d0[1],d1[1],d2[1],d3[1]},[r7]!
-	vst4.32	{d4[0],d5[0],d6[0],d7[0]},[r6]!
-	vst4.32	{d4[1],d5[1],d6[1],d7[1]},[r7]!
-	vst1.32	{d8[0]},[r6,:32]
-	vst1.32	{d8[1]},[r7,:32]
-
-	b	.Lsquare_neon
-
-.align	4
-.Lsquare_break_neon:
-	add	r6,r0,#(48+2*4*9)
-	add	r7,r0,#(48+3*4*9)
-
-	vmov	d0,d10		@ r^4:r^3
-	vshl.u32	d2,d12,#2		@ *5
-	vmov	d1,d12
-	vshl.u32	d4,d14,#2
-	vmov	d3,d14
-	vshl.u32	d6,d16,#2
-	vmov	d5,d16
-	vshl.u32	d8,d18,#2
-	vmov	d7,d18
-	vadd.i32	d2,d2,d12
-	vadd.i32	d4,d4,d14
-	vadd.i32	d6,d6,d16
-	vadd.i32	d8,d8,d18
-
-	vst4.32	{d0[0],d1[0],d2[0],d3[0]},[r6]!
-	vst4.32	{d0[1],d1[1],d2[1],d3[1]},[r7]!
-	vst4.32	{d4[0],d5[0],d6[0],d7[0]},[r6]!
-	vst4.32	{d4[1],d5[1],d6[1],d7[1]},[r7]!
-	vst1.32	{d8[0]},[r6]
-	vst1.32	{d8[1]},[r7]
-
-	bx	lr				@ bx	lr
-.size	poly1305_init_neon,.-poly1305_init_neon
-
-.type	poly1305_blocks_neon,%function
-.align	5
-poly1305_blocks_neon:
-	ldr	ip,[r0,#36]		@ is_base2_26
-	ands	r2,r2,#-16
-	beq	.Lno_data_neon
-
-	cmp	r2,#64
-	bhs	.Lenter_neon
-	tst	ip,ip			@ is_base2_26?
-	beq	poly1305_blocks
-
-.Lenter_neon:
-	stmdb	sp!,{r4,r5,r6,r7}
-	vstmdb	sp!,{d8,d9,d10,d11,d12,d13,d14,d15}		@ ABI specification says so
-
-	tst	ip,ip			@ is_base2_26?
-	bne	.Lbase2_26_neon
-
-	stmdb	sp!,{r1,r2,r3,lr}
-	bl	poly1305_init_neon
-
-	ldr	r4,[r0,#0]		@ load hash value base 2^32
-	ldr	r5,[r0,#4]
-	ldr	r6,[r0,#8]
-	ldr	r7,[r0,#12]
-	ldr	ip,[r0,#16]
-
-	and	r2,r4,#0x03ffffff	@ base 2^32 -> base 2^26
-	mov	r3,r4,lsr#26
-	veor	d10,d10,d10
-	mov	r4,r5,lsr#20
-	orr	r3,r3,r5,lsl#6
-	veor	d12,d12,d12
-	mov	r5,r6,lsr#14
-	orr	r4,r4,r6,lsl#12
-	veor	d14,d14,d14
-	mov	r6,r7,lsr#8
-	orr	r5,r5,r7,lsl#18
-	veor	d16,d16,d16
-	and	r3,r3,#0x03ffffff
-	orr	r6,r6,ip,lsl#24
-	veor	d18,d18,d18
-	and	r4,r4,#0x03ffffff
-	mov	r1,#1
-	and	r5,r5,#0x03ffffff
-	str	r1,[r0,#36]		@ is_base2_26
-
-	vmov.32	d10[0],r2
-	vmov.32	d12[0],r3
-	vmov.32	d14[0],r4
-	vmov.32	d16[0],r5
-	vmov.32	d18[0],r6
-	adr	r5,.Lzeros
-
-	ldmia	sp!,{r1,r2,r3,lr}
-	b	.Lbase2_32_neon
-
-.align	4
-.Lbase2_26_neon:
-	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-	@ load hash value
-
-	veor	d10,d10,d10
-	veor	d12,d12,d12
-	veor	d14,d14,d14
-	veor	d16,d16,d16
-	veor	d18,d18,d18
-	vld4.32	{d10[0],d12[0],d14[0],d16[0]},[r0]!
-	adr	r5,.Lzeros
-	vld1.32	{d18[0]},[r0]
-	sub	r0,r0,#16		@ rewind
-
-.Lbase2_32_neon:
-	add	r4,r1,#32
-	mov	r3,r3,lsl#24
-	tst	r2,#31
-	beq	.Leven
-
-	vld4.32	{d20[0],d22[0],d24[0],d26[0]},[r1]!
-	vmov.32	d28[0],r3
-	sub	r2,r2,#16
-	add	r4,r1,#32
-
-# ifdef	__ARMEB__
-	vrev32.8	q10,q10
-	vrev32.8	q13,q13
-	vrev32.8	q11,q11
-	vrev32.8	q12,q12
-# endif
-	vsri.u32	d28,d26,#8	@ base 2^32 -> base 2^26
-	vshl.u32	d26,d26,#18
-
-	vsri.u32	d26,d24,#14
-	vshl.u32	d24,d24,#12
-	vadd.i32	d29,d28,d18	@ add hash value and move to #hi
-
-	vbic.i32	d26,#0xfc000000
-	vsri.u32	d24,d22,#20
-	vshl.u32	d22,d22,#6
-
-	vbic.i32	d24,#0xfc000000
-	vsri.u32	d22,d20,#26
-	vadd.i32	d27,d26,d16
-
-	vbic.i32	d20,#0xfc000000
-	vbic.i32	d22,#0xfc000000
-	vadd.i32	d25,d24,d14
-
-	vadd.i32	d21,d20,d10
-	vadd.i32	d23,d22,d12
-
-	mov	r7,r5
-	add	r6,r0,#48
-
-	cmp	r2,r2
-	b	.Long_tail
-
-.align	4
-.Leven:
-	subs	r2,r2,#64
-# ifdef	__thumb2__
-	it	lo
-# endif
-	movlo	r4,r5
-
-	vmov.i32	q14,#1<<24		@ padbit, yes, always
-	vld4.32	{d20,d22,d24,d26},[r1]	@ inp[0:1]
-	add	r1,r1,#64
-	vld4.32	{d21,d23,d25,d27},[r4]	@ inp[2:3] (or 0)
-	add	r4,r4,#64
-# ifdef	__thumb2__
-	itt	hi
-# endif
-	addhi	r7,r0,#(48+1*9*4)
-	addhi	r6,r0,#(48+3*9*4)
-
-# ifdef	__ARMEB__
-	vrev32.8	q10,q10
-	vrev32.8	q13,q13
-	vrev32.8	q11,q11
-	vrev32.8	q12,q12
-# endif
-	vsri.u32	q14,q13,#8		@ base 2^32 -> base 2^26
-	vshl.u32	q13,q13,#18
-
-	vsri.u32	q13,q12,#14
-	vshl.u32	q12,q12,#12
-
-	vbic.i32	q13,#0xfc000000
-	vsri.u32	q12,q11,#20
-	vshl.u32	q11,q11,#6
-
-	vbic.i32	q12,#0xfc000000
-	vsri.u32	q11,q10,#26
-
-	vbic.i32	q10,#0xfc000000
-	vbic.i32	q11,#0xfc000000
-
-	bls	.Lskip_loop
-
-	vld4.32	{d0[1],d1[1],d2[1],d3[1]},[r7]!	@ load r^2
-	vld4.32	{d0[0],d1[0],d2[0],d3[0]},[r6]!	@ load r^4
-	vld4.32	{d4[1],d5[1],d6[1],d7[1]},[r7]!
-	vld4.32	{d4[0],d5[0],d6[0],d7[0]},[r6]!
-	b	.Loop_neon
-
-.align	5
-.Loop_neon:
-	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-	@ ((inp[0]*r^4+inp[2]*r^2+inp[4])*r^4+inp[6]*r^2
-	@ ((inp[1]*r^4+inp[3]*r^2+inp[5])*r^3+inp[7]*r
-	@   ___________________/
-	@ ((inp[0]*r^4+inp[2]*r^2+inp[4])*r^4+inp[6]*r^2+inp[8])*r^2
-	@ ((inp[1]*r^4+inp[3]*r^2+inp[5])*r^4+inp[7]*r^2+inp[9])*r
-	@   ___________________/ ____________________/
-	@
-	@ Note that we start with inp[2:3]*r^2. This is because it
-	@ doesn't depend on reduction in previous iteration.
-	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-	@ d4 = h4*r0 + h3*r1   + h2*r2   + h1*r3   + h0*r4
-	@ d3 = h3*r0 + h2*r1   + h1*r2   + h0*r3   + h4*5*r4
-	@ d2 = h2*r0 + h1*r1   + h0*r2   + h4*5*r3 + h3*5*r4
-	@ d1 = h1*r0 + h0*r1   + h4*5*r2 + h3*5*r3 + h2*5*r4
-	@ d0 = h0*r0 + h4*5*r1 + h3*5*r2 + h2*5*r3 + h1*5*r4
-
-	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-	@ inp[2:3]*r^2
-
-	vadd.i32	d24,d24,d14	@ accumulate inp[0:1]
-	vmull.u32	q7,d25,d0[1]
-	vadd.i32	d20,d20,d10
-	vmull.u32	q5,d21,d0[1]
-	vadd.i32	d26,d26,d16
-	vmull.u32	q8,d27,d0[1]
-	vmlal.u32	q7,d23,d1[1]
-	vadd.i32	d22,d22,d12
-	vmull.u32	q6,d23,d0[1]
-
-	vadd.i32	d28,d28,d18
-	vmull.u32	q9,d29,d0[1]
-	subs	r2,r2,#64
-	vmlal.u32	q5,d29,d2[1]
-# ifdef	__thumb2__
-	it	lo
-# endif
-	movlo	r4,r5
-	vmlal.u32	q8,d25,d1[1]
-	vld1.32	d8[1],[r7,:32]
-	vmlal.u32	q6,d21,d1[1]
-	vmlal.u32	q9,d27,d1[1]
-
-	vmlal.u32	q5,d27,d4[1]
-	vmlal.u32	q8,d23,d3[1]
-	vmlal.u32	q9,d25,d3[1]
-	vmlal.u32	q6,d29,d4[1]
-	vmlal.u32	q7,d21,d3[1]
-
-	vmlal.u32	q8,d21,d5[1]
-	vmlal.u32	q5,d25,d6[1]
-	vmlal.u32	q9,d23,d5[1]
-	vmlal.u32	q6,d27,d6[1]
-	vmlal.u32	q7,d29,d6[1]
-
-	vmlal.u32	q8,d29,d8[1]
-	vmlal.u32	q5,d23,d8[1]
-	vmlal.u32	q9,d21,d7[1]
-	vmlal.u32	q6,d25,d8[1]
-	vmlal.u32	q7,d27,d8[1]
-
-	vld4.32	{d21,d23,d25,d27},[r4]	@ inp[2:3] (or 0)
-	add	r4,r4,#64
-
-	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-	@ (hash+inp[0:1])*r^4 and accumulate
-
-	vmlal.u32	q8,d26,d0[0]
-	vmlal.u32	q5,d20,d0[0]
-	vmlal.u32	q9,d28,d0[0]
-	vmlal.u32	q6,d22,d0[0]
-	vmlal.u32	q7,d24,d0[0]
-	vld1.32	d8[0],[r6,:32]
-
-	vmlal.u32	q8,d24,d1[0]
-	vmlal.u32	q5,d28,d2[0]
-	vmlal.u32	q9,d26,d1[0]
-	vmlal.u32	q6,d20,d1[0]
-	vmlal.u32	q7,d22,d1[0]
-
-	vmlal.u32	q8,d22,d3[0]
-	vmlal.u32	q5,d26,d4[0]
-	vmlal.u32	q9,d24,d3[0]
-	vmlal.u32	q6,d28,d4[0]
-	vmlal.u32	q7,d20,d3[0]
-
-	vmlal.u32	q8,d20,d5[0]
-	vmlal.u32	q5,d24,d6[0]
-	vmlal.u32	q9,d22,d5[0]
-	vmlal.u32	q6,d26,d6[0]
-	vmlal.u32	q8,d28,d8[0]
-
-	vmlal.u32	q7,d28,d6[0]
-	vmlal.u32	q5,d22,d8[0]
-	vmlal.u32	q9,d20,d7[0]
-	vmov.i32	q14,#1<<24		@ padbit, yes, always
-	vmlal.u32	q6,d24,d8[0]
-	vmlal.u32	q7,d26,d8[0]
-
-	vld4.32	{d20,d22,d24,d26},[r1]	@ inp[0:1]
-	add	r1,r1,#64
-# ifdef	__ARMEB__
-	vrev32.8	q10,q10
-	vrev32.8	q11,q11
-	vrev32.8	q12,q12
-	vrev32.8	q13,q13
-# endif
-
-	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-	@ lazy reduction interleaved with base 2^32 -> base 2^26
-
-	vshr.u64	q15,q8,#26
-	vmovn.i64	d16,q8
-	vshr.u64	q4,q5,#26
-	vmovn.i64	d10,q5
-	vadd.i64	q9,q9,q15		@ h3 -> h4
-	vbic.i32	d16,#0xfc000000
-	vsri.u32	q14,q13,#8		@ base 2^32 -> base 2^26
-	vadd.i64	q6,q6,q4		@ h0 -> h1
-	vshl.u32	q13,q13,#18
-	vbic.i32	d10,#0xfc000000
-
-	vshrn.u64	d30,q9,#26
-	vmovn.i64	d18,q9
-	vshr.u64	q4,q6,#26
-	vmovn.i64	d12,q6
-	vadd.i64	q7,q7,q4		@ h1 -> h2
-	vsri.u32	q13,q12,#14
-	vbic.i32	d18,#0xfc000000
-	vshl.u32	q12,q12,#12
-	vbic.i32	d12,#0xfc000000
-
-	vadd.i32	d10,d10,d30
-	vshl.u32	d30,d30,#2
-	vbic.i32	q13,#0xfc000000
-	vshrn.u64	d8,q7,#26
-	vmovn.i64	d14,q7
-	vadd.i32	d10,d10,d30	@ h4 -> h0
-	vsri.u32	q12,q11,#20
-	vadd.i32	d16,d16,d8	@ h2 -> h3
-	vshl.u32	q11,q11,#6
-	vbic.i32	d14,#0xfc000000
-	vbic.i32	q12,#0xfc000000
-
-	vshr.u32	d30,d10,#26
-	vbic.i32	d10,#0xfc000000
-	vsri.u32	q11,q10,#26
-	vbic.i32	q10,#0xfc000000
-	vshr.u32	d8,d16,#26
-	vbic.i32	d16,#0xfc000000
-	vadd.i32	d12,d12,d30	@ h0 -> h1
-	vadd.i32	d18,d18,d8	@ h3 -> h4
-	vbic.i32	q11,#0xfc000000
-
-	bhi	.Loop_neon
-
-.Lskip_loop:
-	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-	@ multiply (inp[0:1]+hash) or inp[2:3] by r^2:r^1
-
-	add	r7,r0,#(48+0*9*4)
-	add	r6,r0,#(48+1*9*4)
-	adds	r2,r2,#32
-# ifdef	__thumb2__
-	it	ne
-# endif
-	movne	r2,#0
-	bne	.Long_tail
-
-	vadd.i32	d25,d24,d14	@ add hash value and move to #hi
-	vadd.i32	d21,d20,d10
-	vadd.i32	d27,d26,d16
-	vadd.i32	d23,d22,d12
-	vadd.i32	d29,d28,d18
-
-.Long_tail:
-	vld4.32	{d0[1],d1[1],d2[1],d3[1]},[r7]!	@ load r^1
-	vld4.32	{d0[0],d1[0],d2[0],d3[0]},[r6]!	@ load r^2
-
-	vadd.i32	d24,d24,d14	@ can be redundant
-	vmull.u32	q7,d25,d0
-	vadd.i32	d20,d20,d10
-	vmull.u32	q5,d21,d0
-	vadd.i32	d26,d26,d16
-	vmull.u32	q8,d27,d0
-	vadd.i32	d22,d22,d12
-	vmull.u32	q6,d23,d0
-	vadd.i32	d28,d28,d18
-	vmull.u32	q9,d29,d0
-
-	vmlal.u32	q5,d29,d2
-	vld4.32	{d4[1],d5[1],d6[1],d7[1]},[r7]!
-	vmlal.u32	q8,d25,d1
-	vld4.32	{d4[0],d5[0],d6[0],d7[0]},[r6]!
-	vmlal.u32	q6,d21,d1
-	vmlal.u32	q9,d27,d1
-	vmlal.u32	q7,d23,d1
-
-	vmlal.u32	q8,d23,d3
-	vld1.32	d8[1],[r7,:32]
-	vmlal.u32	q5,d27,d4
-	vld1.32	d8[0],[r6,:32]
-	vmlal.u32	q9,d25,d3
-	vmlal.u32	q6,d29,d4
-	vmlal.u32	q7,d21,d3
-
-	vmlal.u32	q8,d21,d5
-# ifdef	__thumb2__
-	it	ne
-# endif
-	addne	r7,r0,#(48+2*9*4)
-	vmlal.u32	q5,d25,d6
-# ifdef	__thumb2__
-	it	ne
-# endif
-	addne	r6,r0,#(48+3*9*4)
-	vmlal.u32	q9,d23,d5
-	vmlal.u32	q6,d27,d6
-	vmlal.u32	q7,d29,d6
-
-	vmlal.u32	q8,d29,d8
-	vorn	q0,q0,q0	@ all-ones, can be redundant
-	vmlal.u32	q5,d23,d8
-	vshr.u64	q0,q0,#38
-	vmlal.u32	q9,d21,d7
-	vmlal.u32	q6,d25,d8
-	vmlal.u32	q7,d27,d8
-
-	beq	.Lshort_tail
-
-	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-	@ (hash+inp[0:1])*r^4:r^3 and accumulate
-
-	vld4.32	{d0[1],d1[1],d2[1],d3[1]},[r7]!	@ load r^3
-	vld4.32	{d0[0],d1[0],d2[0],d3[0]},[r6]!	@ load r^4
-
-	vmlal.u32	q7,d24,d0
-	vmlal.u32	q5,d20,d0
-	vmlal.u32	q8,d26,d0
-	vmlal.u32	q6,d22,d0
-	vmlal.u32	q9,d28,d0
-
-	vmlal.u32	q5,d28,d2
-	vld4.32	{d4[1],d5[1],d6[1],d7[1]},[r7]!
-	vmlal.u32	q8,d24,d1
-	vld4.32	{d4[0],d5[0],d6[0],d7[0]},[r6]!
-	vmlal.u32	q6,d20,d1
-	vmlal.u32	q9,d26,d1
-	vmlal.u32	q7,d22,d1
-
-	vmlal.u32	q8,d22,d3
-	vld1.32	d8[1],[r7,:32]
-	vmlal.u32	q5,d26,d4
-	vld1.32	d8[0],[r6,:32]
-	vmlal.u32	q9,d24,d3
-	vmlal.u32	q6,d28,d4
-	vmlal.u32	q7,d20,d3
-
-	vmlal.u32	q8,d20,d5
-	vmlal.u32	q5,d24,d6
-	vmlal.u32	q9,d22,d5
-	vmlal.u32	q6,d26,d6
-	vmlal.u32	q7,d28,d6
-
-	vmlal.u32	q8,d28,d8
-	vorn	q0,q0,q0	@ all-ones
-	vmlal.u32	q5,d22,d8
-	vshr.u64	q0,q0,#38
-	vmlal.u32	q9,d20,d7
-	vmlal.u32	q6,d24,d8
-	vmlal.u32	q7,d26,d8
-
-.Lshort_tail:
-	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-	@ horizontal addition
-
-	vadd.i64	d16,d16,d17
-	vadd.i64	d10,d10,d11
-	vadd.i64	d18,d18,d19
-	vadd.i64	d12,d12,d13
-	vadd.i64	d14,d14,d15
-
-	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-	@ lazy reduction, but without narrowing
-
-	vshr.u64	q15,q8,#26
-	vand.i64	q8,q8,q0
-	vshr.u64	q4,q5,#26
-	vand.i64	q5,q5,q0
-	vadd.i64	q9,q9,q15		@ h3 -> h4
-	vadd.i64	q6,q6,q4		@ h0 -> h1
-
-	vshr.u64	q15,q9,#26
-	vand.i64	q9,q9,q0
-	vshr.u64	q4,q6,#26
-	vand.i64	q6,q6,q0
-	vadd.i64	q7,q7,q4		@ h1 -> h2
-
-	vadd.i64	q5,q5,q15
-	vshl.u64	q15,q15,#2
-	vshr.u64	q4,q7,#26
-	vand.i64	q7,q7,q0
-	vadd.i64	q5,q5,q15		@ h4 -> h0
-	vadd.i64	q8,q8,q4		@ h2 -> h3
-
-	vshr.u64	q15,q5,#26
-	vand.i64	q5,q5,q0
-	vshr.u64	q4,q8,#26
-	vand.i64	q8,q8,q0
-	vadd.i64	q6,q6,q15		@ h0 -> h1
-	vadd.i64	q9,q9,q4		@ h3 -> h4
-
-	cmp	r2,#0
-	bne	.Leven
-
-	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-	@ store hash value
-
-	vst4.32	{d10[0],d12[0],d14[0],d16[0]},[r0]!
-	vst1.32	{d18[0]},[r0]
-
-	vldmia	sp!,{d8,d9,d10,d11,d12,d13,d14,d15}			@ epilogue
-	ldmia	sp!,{r4,r5,r6,r7}
-.Lno_data_neon:
-	bx	lr					@ bx	lr
-.size	poly1305_blocks_neon,.-poly1305_blocks_neon
-
-.type	poly1305_emit_neon,%function
-.align	5
-poly1305_emit_neon:
-	ldr	ip,[r0,#36]		@ is_base2_26
-
-	stmdb	sp!,{r4,r5,r6,r7,r8,r9,r10,r11}
-
-	tst	ip,ip
-	beq	.Lpoly1305_emit_enter
-
-	ldmia	r0,{r3,r4,r5,r6,r7}
-	eor	r8,r8,r8
-
-	adds	r3,r3,r4,lsl#26	@ base 2^26 -> base 2^32
-	mov	r4,r4,lsr#6
-	adcs	r4,r4,r5,lsl#20
-	mov	r5,r5,lsr#12
-	adcs	r5,r5,r6,lsl#14
-	mov	r6,r6,lsr#18
-	adcs	r6,r6,r7,lsl#8
-	adc	r7,r8,r7,lsr#24	@ can be partially reduced ...
-
-	and	r8,r7,#-4		@ ... so reduce
-	and	r7,r6,#3
-	add	r8,r8,r8,lsr#2	@ *= 5
-	adds	r3,r3,r8
-	adcs	r4,r4,#0
-	adcs	r5,r5,#0
-	adc	r6,r6,#0
-
-	adds	r8,r3,#5		@ compare to modulus
-	adcs	r9,r4,#0
-	adcs	r10,r5,#0
-	adcs	r11,r6,#0
-	adc	r7,r7,#0
-	tst	r7,#4			@ did it carry/borrow?
-
-# ifdef	__thumb2__
-	it	ne
-# endif
-	movne	r3,r8
-	ldr	r8,[r2,#0]
-# ifdef	__thumb2__
-	it	ne
-# endif
-	movne	r4,r9
-	ldr	r9,[r2,#4]
-# ifdef	__thumb2__
-	it	ne
-# endif
-	movne	r5,r10
-	ldr	r10,[r2,#8]
-# ifdef	__thumb2__
-	it	ne
-# endif
-	movne	r6,r11
-	ldr	r11,[r2,#12]
-
-	adds	r3,r3,r8		@ accumulate nonce
-	adcs	r4,r4,r9
-	adcs	r5,r5,r10
-	adc	r6,r6,r11
-
-# ifdef __ARMEB__
-	rev	r3,r3
-	rev	r4,r4
-	rev	r5,r5
-	rev	r6,r6
-# endif
-	str	r3,[r1,#0]		@ store the result
-	str	r4,[r1,#4]
-	str	r5,[r1,#8]
-	str	r6,[r1,#12]
-
-	ldmia	sp!,{r4,r5,r6,r7,r8,r9,r10,r11}
-	bx	lr				@ bx	lr
-.size	poly1305_emit_neon,.-poly1305_emit_neon
-
-.align	5
-.Lzeros:
-.long	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-.LOPENSSL_armcap:
-.word	OPENSSL_armcap_P-.Lpoly1305_init
-#endif
-.byte	80,111,108,121,49,51,48,53,32,102,111,114,32,65,82,77,118,52,47,78,69,79,78,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
-.align	2
-.align	2
-#if	__ARM_MAX_ARCH__>=7
-.comm	OPENSSL_armcap_P,4,4
-#endif
-#endif
diff --git a/third_party/boringssl/linux-x86/crypto/poly1305/poly1305-x86.S b/third_party/boringssl/linux-x86/crypto/poly1305/poly1305-x86.S
deleted file mode 100644
index 146e314..0000000
--- a/third_party/boringssl/linux-x86/crypto/poly1305/poly1305-x86.S
+++ /dev/null
@@ -1,1361 +0,0 @@
-#if defined(__i386__)
-.file	"poly1305-x86.S"
-.text
-.align	64
-.globl	poly1305_init
-.hidden	poly1305_init
-.type	poly1305_init,@function
-.align	16
-poly1305_init:
-.L_poly1305_init_begin:
-	pushl	%ebp
-	pushl	%ebx
-	pushl	%esi
-	pushl	%edi
-	movl	20(%esp),%edi
-	movl	24(%esp),%esi
-	movl	28(%esp),%ebp
-	xorl	%eax,%eax
-	movl	%eax,(%edi)
-	movl	%eax,4(%edi)
-	movl	%eax,8(%edi)
-	movl	%eax,12(%edi)
-	movl	%eax,16(%edi)
-	movl	%eax,20(%edi)
-	cmpl	$0,%esi
-	je	.L000nokey
-	call	.L001pic_point
-.L001pic_point:
-	popl	%ebx
-	leal	poly1305_blocks-.L001pic_point(%ebx),%eax
-	leal	poly1305_emit-.L001pic_point(%ebx),%edx
-	leal	OPENSSL_ia32cap_P-.L001pic_point(%ebx),%edi
-	movl	(%edi),%ecx
-	andl	$83886080,%ecx
-	cmpl	$83886080,%ecx
-	jne	.L002no_sse2
-	leal	_poly1305_blocks_sse2-.L001pic_point(%ebx),%eax
-	leal	_poly1305_emit_sse2-.L001pic_point(%ebx),%edx
-.L002no_sse2:
-	movl	20(%esp),%edi
-	movl	%eax,(%ebp)
-	movl	%edx,4(%ebp)
-	movl	(%esi),%eax
-	movl	4(%esi),%ebx
-	movl	8(%esi),%ecx
-	movl	12(%esi),%edx
-	andl	$268435455,%eax
-	andl	$268435452,%ebx
-	andl	$268435452,%ecx
-	andl	$268435452,%edx
-	movl	%eax,24(%edi)
-	movl	%ebx,28(%edi)
-	movl	%ecx,32(%edi)
-	movl	%edx,36(%edi)
-	movl	$1,%eax
-.L000nokey:
-	popl	%edi
-	popl	%esi
-	popl	%ebx
-	popl	%ebp
-	ret
-.size	poly1305_init,.-.L_poly1305_init_begin
-.globl	poly1305_blocks
-.hidden	poly1305_blocks
-.type	poly1305_blocks,@function
-.align	16
-poly1305_blocks:
-.L_poly1305_blocks_begin:
-	pushl	%ebp
-	pushl	%ebx
-	pushl	%esi
-	pushl	%edi
-	movl	20(%esp),%edi
-	movl	24(%esp),%esi
-	movl	28(%esp),%ecx
-.Lenter_blocks:
-	andl	$-15,%ecx
-	jz	.L003nodata
-	subl	$64,%esp
-	movl	24(%edi),%eax
-	movl	28(%edi),%ebx
-	leal	(%esi,%ecx,1),%ebp
-	movl	32(%edi),%ecx
-	movl	36(%edi),%edx
-	movl	%ebp,92(%esp)
-	movl	%esi,%ebp
-	movl	%eax,36(%esp)
-	movl	%ebx,%eax
-	shrl	$2,%eax
-	movl	%ebx,40(%esp)
-	addl	%ebx,%eax
-	movl	%ecx,%ebx
-	shrl	$2,%ebx
-	movl	%ecx,44(%esp)
-	addl	%ecx,%ebx
-	movl	%edx,%ecx
-	shrl	$2,%ecx
-	movl	%edx,48(%esp)
-	addl	%edx,%ecx
-	movl	%eax,52(%esp)
-	movl	%ebx,56(%esp)
-	movl	%ecx,60(%esp)
-	movl	(%edi),%eax
-	movl	4(%edi),%ebx
-	movl	8(%edi),%ecx
-	movl	12(%edi),%esi
-	movl	16(%edi),%edi
-	jmp	.L004loop
-.align	32
-.L004loop:
-	addl	(%ebp),%eax
-	adcl	4(%ebp),%ebx
-	adcl	8(%ebp),%ecx
-	adcl	12(%ebp),%esi
-	leal	16(%ebp),%ebp
-	adcl	96(%esp),%edi
-	movl	%eax,(%esp)
-	movl	%esi,12(%esp)
-	mull	36(%esp)
-	movl	%edi,16(%esp)
-	movl	%eax,%edi
-	movl	%ebx,%eax
-	movl	%edx,%esi
-	mull	60(%esp)
-	addl	%eax,%edi
-	movl	%ecx,%eax
-	adcl	%edx,%esi
-	mull	56(%esp)
-	addl	%eax,%edi
-	movl	12(%esp),%eax
-	adcl	%edx,%esi
-	mull	52(%esp)
-	addl	%eax,%edi
-	movl	(%esp),%eax
-	adcl	%edx,%esi
-	mull	40(%esp)
-	movl	%edi,20(%esp)
-	xorl	%edi,%edi
-	addl	%eax,%esi
-	movl	%ebx,%eax
-	adcl	%edx,%edi
-	mull	36(%esp)
-	addl	%eax,%esi
-	movl	%ecx,%eax
-	adcl	%edx,%edi
-	mull	60(%esp)
-	addl	%eax,%esi
-	movl	12(%esp),%eax
-	adcl	%edx,%edi
-	mull	56(%esp)
-	addl	%eax,%esi
-	movl	16(%esp),%eax
-	adcl	%edx,%edi
-	imull	52(%esp),%eax
-	addl	%eax,%esi
-	movl	(%esp),%eax
-	adcl	$0,%edi
-	mull	44(%esp)
-	movl	%esi,24(%esp)
-	xorl	%esi,%esi
-	addl	%eax,%edi
-	movl	%ebx,%eax
-	adcl	%edx,%esi
-	mull	40(%esp)
-	addl	%eax,%edi
-	movl	%ecx,%eax
-	adcl	%edx,%esi
-	mull	36(%esp)
-	addl	%eax,%edi
-	movl	12(%esp),%eax
-	adcl	%edx,%esi
-	mull	60(%esp)
-	addl	%eax,%edi
-	movl	16(%esp),%eax
-	adcl	%edx,%esi
-	imull	56(%esp),%eax
-	addl	%eax,%edi
-	movl	(%esp),%eax
-	adcl	$0,%esi
-	mull	48(%esp)
-	movl	%edi,28(%esp)
-	xorl	%edi,%edi
-	addl	%eax,%esi
-	movl	%ebx,%eax
-	adcl	%edx,%edi
-	mull	44(%esp)
-	addl	%eax,%esi
-	movl	%ecx,%eax
-	adcl	%edx,%edi
-	mull	40(%esp)
-	addl	%eax,%esi
-	movl	12(%esp),%eax
-	adcl	%edx,%edi
-	mull	36(%esp)
-	addl	%eax,%esi
-	movl	16(%esp),%ecx
-	adcl	%edx,%edi
-	movl	%ecx,%edx
-	imull	60(%esp),%ecx
-	addl	%ecx,%esi
-	movl	20(%esp),%eax
-	adcl	$0,%edi
-	imull	36(%esp),%edx
-	addl	%edi,%edx
-	movl	24(%esp),%ebx
-	movl	28(%esp),%ecx
-	movl	%edx,%edi
-	shrl	$2,%edx
-	andl	$3,%edi
-	leal	(%edx,%edx,4),%edx
-	addl	%edx,%eax
-	adcl	$0,%ebx
-	adcl	$0,%ecx
-	adcl	$0,%esi
-	cmpl	92(%esp),%ebp
-	jne	.L004loop
-	movl	84(%esp),%edx
-	addl	$64,%esp
-	movl	%eax,(%edx)
-	movl	%ebx,4(%edx)
-	movl	%ecx,8(%edx)
-	movl	%esi,12(%edx)
-	movl	%edi,16(%edx)
-.L003nodata:
-	popl	%edi
-	popl	%esi
-	popl	%ebx
-	popl	%ebp
-	ret
-.size	poly1305_blocks,.-.L_poly1305_blocks_begin
-.globl	poly1305_emit
-.hidden	poly1305_emit
-.type	poly1305_emit,@function
-.align	16
-poly1305_emit:
-.L_poly1305_emit_begin:
-	pushl	%ebp
-	pushl	%ebx
-	pushl	%esi
-	pushl	%edi
-	movl	20(%esp),%ebp
-.Lenter_emit:
-	movl	24(%esp),%edi
-	movl	(%ebp),%eax
-	movl	4(%ebp),%ebx
-	movl	8(%ebp),%ecx
-	movl	12(%ebp),%edx
-	movl	16(%ebp),%esi
-	addl	$5,%eax
-	adcl	$0,%ebx
-	adcl	$0,%ecx
-	adcl	$0,%edx
-	adcl	$0,%esi
-	shrl	$2,%esi
-	negl	%esi
-	andl	%esi,%eax
-	andl	%esi,%ebx
-	andl	%esi,%ecx
-	andl	%esi,%edx
-	movl	%eax,(%edi)
-	movl	%ebx,4(%edi)
-	movl	%ecx,8(%edi)
-	movl	%edx,12(%edi)
-	notl	%esi
-	movl	(%ebp),%eax
-	movl	4(%ebp),%ebx
-	movl	8(%ebp),%ecx
-	movl	12(%ebp),%edx
-	movl	28(%esp),%ebp
-	andl	%esi,%eax
-	andl	%esi,%ebx
-	andl	%esi,%ecx
-	andl	%esi,%edx
-	orl	(%edi),%eax
-	orl	4(%edi),%ebx
-	orl	8(%edi),%ecx
-	orl	12(%edi),%edx
-	addl	(%ebp),%eax
-	adcl	4(%ebp),%ebx
-	adcl	8(%ebp),%ecx
-	adcl	12(%ebp),%edx
-	movl	%eax,(%edi)
-	movl	%ebx,4(%edi)
-	movl	%ecx,8(%edi)
-	movl	%edx,12(%edi)
-	popl	%edi
-	popl	%esi
-	popl	%ebx
-	popl	%ebp
-	ret
-.size	poly1305_emit,.-.L_poly1305_emit_begin
-.align	32
-.hidden	_poly1305_init_sse2
-.type	_poly1305_init_sse2,@function
-.align	16
-_poly1305_init_sse2:
-	movdqu	24(%edi),%xmm4
-	leal	48(%edi),%edi
-	movl	%esp,%ebp
-	subl	$224,%esp
-	andl	$-16,%esp
-	movq	64(%ebx),%xmm7
-	movdqa	%xmm4,%xmm0
-	movdqa	%xmm4,%xmm1
-	movdqa	%xmm4,%xmm2
-	pand	%xmm7,%xmm0
-	psrlq	$26,%xmm1
-	psrldq	$6,%xmm2
-	pand	%xmm7,%xmm1
-	movdqa	%xmm2,%xmm3
-	psrlq	$4,%xmm2
-	psrlq	$30,%xmm3
-	pand	%xmm7,%xmm2
-	pand	%xmm7,%xmm3
-	psrldq	$13,%xmm4
-	leal	144(%esp),%edx
-	movl	$2,%ecx
-.L005square:
-	movdqa	%xmm0,(%esp)
-	movdqa	%xmm1,16(%esp)
-	movdqa	%xmm2,32(%esp)
-	movdqa	%xmm3,48(%esp)
-	movdqa	%xmm4,64(%esp)
-	movdqa	%xmm1,%xmm6
-	movdqa	%xmm2,%xmm5
-	pslld	$2,%xmm6
-	pslld	$2,%xmm5
-	paddd	%xmm1,%xmm6
-	paddd	%xmm2,%xmm5
-	movdqa	%xmm6,80(%esp)
-	movdqa	%xmm5,96(%esp)
-	movdqa	%xmm3,%xmm6
-	movdqa	%xmm4,%xmm5
-	pslld	$2,%xmm6
-	pslld	$2,%xmm5
-	paddd	%xmm3,%xmm6
-	paddd	%xmm4,%xmm5
-	movdqa	%xmm6,112(%esp)
-	movdqa	%xmm5,128(%esp)
-	pshufd	$68,%xmm0,%xmm6
-	movdqa	%xmm1,%xmm5
-	pshufd	$68,%xmm1,%xmm1
-	pshufd	$68,%xmm2,%xmm2
-	pshufd	$68,%xmm3,%xmm3
-	pshufd	$68,%xmm4,%xmm4
-	movdqa	%xmm6,(%edx)
-	movdqa	%xmm1,16(%edx)
-	movdqa	%xmm2,32(%edx)
-	movdqa	%xmm3,48(%edx)
-	movdqa	%xmm4,64(%edx)
-	pmuludq	%xmm0,%xmm4
-	pmuludq	%xmm0,%xmm3
-	pmuludq	%xmm0,%xmm2
-	pmuludq	%xmm0,%xmm1
-	pmuludq	%xmm6,%xmm0
-	movdqa	%xmm5,%xmm6
-	pmuludq	48(%edx),%xmm5
-	movdqa	%xmm6,%xmm7
-	pmuludq	32(%edx),%xmm6
-	paddq	%xmm5,%xmm4
-	movdqa	%xmm7,%xmm5
-	pmuludq	16(%edx),%xmm7
-	paddq	%xmm6,%xmm3
-	movdqa	80(%esp),%xmm6
-	pmuludq	(%edx),%xmm5
-	paddq	%xmm7,%xmm2
-	pmuludq	64(%edx),%xmm6
-	movdqa	32(%esp),%xmm7
-	paddq	%xmm5,%xmm1
-	movdqa	%xmm7,%xmm5
-	pmuludq	32(%edx),%xmm7
-	paddq	%xmm6,%xmm0
-	movdqa	%xmm5,%xmm6
-	pmuludq	16(%edx),%xmm5
-	paddq	%xmm7,%xmm4
-	movdqa	96(%esp),%xmm7
-	pmuludq	(%edx),%xmm6
-	paddq	%xmm5,%xmm3
-	movdqa	%xmm7,%xmm5
-	pmuludq	64(%edx),%xmm7
-	paddq	%xmm6,%xmm2
-	pmuludq	48(%edx),%xmm5
-	movdqa	48(%esp),%xmm6
-	paddq	%xmm7,%xmm1
-	movdqa	%xmm6,%xmm7
-	pmuludq	16(%edx),%xmm6
-	paddq	%xmm5,%xmm0
-	movdqa	112(%esp),%xmm5
-	pmuludq	(%edx),%xmm7
-	paddq	%xmm6,%xmm4
-	movdqa	%xmm5,%xmm6
-	pmuludq	64(%edx),%xmm5
-	paddq	%xmm7,%xmm3
-	movdqa	%xmm6,%xmm7
-	pmuludq	48(%edx),%xmm6
-	paddq	%xmm5,%xmm2
-	pmuludq	32(%edx),%xmm7
-	movdqa	64(%esp),%xmm5
-	paddq	%xmm6,%xmm1
-	movdqa	128(%esp),%xmm6
-	pmuludq	(%edx),%xmm5
-	paddq	%xmm7,%xmm0
-	movdqa	%xmm6,%xmm7
-	pmuludq	64(%edx),%xmm6
-	paddq	%xmm5,%xmm4
-	movdqa	%xmm7,%xmm5
-	pmuludq	16(%edx),%xmm7
-	paddq	%xmm6,%xmm3
-	movdqa	%xmm5,%xmm6
-	pmuludq	32(%edx),%xmm5
-	paddq	%xmm7,%xmm0
-	pmuludq	48(%edx),%xmm6
-	movdqa	64(%ebx),%xmm7
-	paddq	%xmm5,%xmm1
-	paddq	%xmm6,%xmm2
-	movdqa	%xmm3,%xmm5
-	pand	%xmm7,%xmm3
-	psrlq	$26,%xmm5
-	paddq	%xmm4,%xmm5
-	movdqa	%xmm0,%xmm6
-	pand	%xmm7,%xmm0
-	psrlq	$26,%xmm6
-	movdqa	%xmm5,%xmm4
-	paddq	%xmm1,%xmm6
-	psrlq	$26,%xmm5
-	pand	%xmm7,%xmm4
-	movdqa	%xmm6,%xmm1
-	psrlq	$26,%xmm6
-	paddd	%xmm5,%xmm0
-	psllq	$2,%xmm5
-	paddq	%xmm2,%xmm6
-	paddd	%xmm0,%xmm5
-	pand	%xmm7,%xmm1
-	movdqa	%xmm6,%xmm2
-	psrlq	$26,%xmm6
-	pand	%xmm7,%xmm2
-	paddd	%xmm3,%xmm6
-	movdqa	%xmm5,%xmm0
-	psrlq	$26,%xmm5
-	movdqa	%xmm6,%xmm3
-	psrlq	$26,%xmm6
-	pand	%xmm7,%xmm0
-	paddd	%xmm5,%xmm1
-	pand	%xmm7,%xmm3
-	paddd	%xmm6,%xmm4
-	decl	%ecx
-	jz	.L006square_break
-	punpcklqdq	(%esp),%xmm0
-	punpcklqdq	16(%esp),%xmm1
-	punpcklqdq	32(%esp),%xmm2
-	punpcklqdq	48(%esp),%xmm3
-	punpcklqdq	64(%esp),%xmm4
-	jmp	.L005square
-.L006square_break:
-	psllq	$32,%xmm0
-	psllq	$32,%xmm1
-	psllq	$32,%xmm2
-	psllq	$32,%xmm3
-	psllq	$32,%xmm4
-	por	(%esp),%xmm0
-	por	16(%esp),%xmm1
-	por	32(%esp),%xmm2
-	por	48(%esp),%xmm3
-	por	64(%esp),%xmm4
-	pshufd	$141,%xmm0,%xmm0
-	pshufd	$141,%xmm1,%xmm1
-	pshufd	$141,%xmm2,%xmm2
-	pshufd	$141,%xmm3,%xmm3
-	pshufd	$141,%xmm4,%xmm4
-	movdqu	%xmm0,(%edi)
-	movdqu	%xmm1,16(%edi)
-	movdqu	%xmm2,32(%edi)
-	movdqu	%xmm3,48(%edi)
-	movdqu	%xmm4,64(%edi)
-	movdqa	%xmm1,%xmm6
-	movdqa	%xmm2,%xmm5
-	pslld	$2,%xmm6
-	pslld	$2,%xmm5
-	paddd	%xmm1,%xmm6
-	paddd	%xmm2,%xmm5
-	movdqu	%xmm6,80(%edi)
-	movdqu	%xmm5,96(%edi)
-	movdqa	%xmm3,%xmm6
-	movdqa	%xmm4,%xmm5
-	pslld	$2,%xmm6
-	pslld	$2,%xmm5
-	paddd	%xmm3,%xmm6
-	paddd	%xmm4,%xmm5
-	movdqu	%xmm6,112(%edi)
-	movdqu	%xmm5,128(%edi)
-	movl	%ebp,%esp
-	leal	-48(%edi),%edi
-	ret
-.size	_poly1305_init_sse2,.-_poly1305_init_sse2
-.align	32
-.hidden	_poly1305_blocks_sse2
-.type	_poly1305_blocks_sse2,@function
-.align	16
-_poly1305_blocks_sse2:
-	pushl	%ebp
-	pushl	%ebx
-	pushl	%esi
-	pushl	%edi
-	movl	20(%esp),%edi
-	movl	24(%esp),%esi
-	movl	28(%esp),%ecx
-	movl	20(%edi),%eax
-	andl	$-16,%ecx
-	jz	.L007nodata
-	cmpl	$64,%ecx
-	jae	.L008enter_sse2
-	testl	%eax,%eax
-	jz	.Lenter_blocks
-.align	16
-.L008enter_sse2:
-	call	.L009pic_point
-.L009pic_point:
-	popl	%ebx
-	leal	.Lconst_sse2-.L009pic_point(%ebx),%ebx
-	testl	%eax,%eax
-	jnz	.L010base2_26
-	call	_poly1305_init_sse2
-	movl	(%edi),%eax
-	movl	3(%edi),%ecx
-	movl	6(%edi),%edx
-	movl	9(%edi),%esi
-	movl	13(%edi),%ebp
-	movl	$1,20(%edi)
-	shrl	$2,%ecx
-	andl	$67108863,%eax
-	shrl	$4,%edx
-	andl	$67108863,%ecx
-	shrl	$6,%esi
-	andl	$67108863,%edx
-	movd	%eax,%xmm0
-	movd	%ecx,%xmm1
-	movd	%edx,%xmm2
-	movd	%esi,%xmm3
-	movd	%ebp,%xmm4
-	movl	24(%esp),%esi
-	movl	28(%esp),%ecx
-	jmp	.L011base2_32
-.align	16
-.L010base2_26:
-	movd	(%edi),%xmm0
-	movd	4(%edi),%xmm1
-	movd	8(%edi),%xmm2
-	movd	12(%edi),%xmm3
-	movd	16(%edi),%xmm4
-	movdqa	64(%ebx),%xmm7
-.L011base2_32:
-	movl	32(%esp),%eax
-	movl	%esp,%ebp
-	subl	$528,%esp
-	andl	$-16,%esp
-	leal	48(%edi),%edi
-	shll	$24,%eax
-	testl	$31,%ecx
-	jz	.L012even
-	movdqu	(%esi),%xmm6
-	leal	16(%esi),%esi
-	movdqa	%xmm6,%xmm5
-	pand	%xmm7,%xmm6
-	paddd	%xmm6,%xmm0
-	movdqa	%xmm5,%xmm6
-	psrlq	$26,%xmm5
-	psrldq	$6,%xmm6
-	pand	%xmm7,%xmm5
-	paddd	%xmm5,%xmm1
-	movdqa	%xmm6,%xmm5
-	psrlq	$4,%xmm6
-	pand	%xmm7,%xmm6
-	paddd	%xmm6,%xmm2
-	movdqa	%xmm5,%xmm6
-	psrlq	$30,%xmm5
-	pand	%xmm7,%xmm5
-	psrldq	$7,%xmm6
-	paddd	%xmm5,%xmm3
-	movd	%eax,%xmm5
-	paddd	%xmm6,%xmm4
-	movd	12(%edi),%xmm6
-	paddd	%xmm5,%xmm4
-	movdqa	%xmm0,(%esp)
-	movdqa	%xmm1,16(%esp)
-	movdqa	%xmm2,32(%esp)
-	movdqa	%xmm3,48(%esp)
-	movdqa	%xmm4,64(%esp)
-	pmuludq	%xmm6,%xmm0
-	pmuludq	%xmm6,%xmm1
-	pmuludq	%xmm6,%xmm2
-	movd	28(%edi),%xmm5
-	pmuludq	%xmm6,%xmm3
-	pmuludq	%xmm6,%xmm4
-	movdqa	%xmm5,%xmm6
-	pmuludq	48(%esp),%xmm5
-	movdqa	%xmm6,%xmm7
-	pmuludq	32(%esp),%xmm6
-	paddq	%xmm5,%xmm4
-	movdqa	%xmm7,%xmm5
-	pmuludq	16(%esp),%xmm7
-	paddq	%xmm6,%xmm3
-	movd	92(%edi),%xmm6
-	pmuludq	(%esp),%xmm5
-	paddq	%xmm7,%xmm2
-	pmuludq	64(%esp),%xmm6
-	movd	44(%edi),%xmm7
-	paddq	%xmm5,%xmm1
-	movdqa	%xmm7,%xmm5
-	pmuludq	32(%esp),%xmm7
-	paddq	%xmm6,%xmm0
-	movdqa	%xmm5,%xmm6
-	pmuludq	16(%esp),%xmm5
-	paddq	%xmm7,%xmm4
-	movd	108(%edi),%xmm7
-	pmuludq	(%esp),%xmm6
-	paddq	%xmm5,%xmm3
-	movdqa	%xmm7,%xmm5
-	pmuludq	64(%esp),%xmm7
-	paddq	%xmm6,%xmm2
-	pmuludq	48(%esp),%xmm5
-	movd	60(%edi),%xmm6
-	paddq	%xmm7,%xmm1
-	movdqa	%xmm6,%xmm7
-	pmuludq	16(%esp),%xmm6
-	paddq	%xmm5,%xmm0
-	movd	124(%edi),%xmm5
-	pmuludq	(%esp),%xmm7
-	paddq	%xmm6,%xmm4
-	movdqa	%xmm5,%xmm6
-	pmuludq	64(%esp),%xmm5
-	paddq	%xmm7,%xmm3
-	movdqa	%xmm6,%xmm7
-	pmuludq	48(%esp),%xmm6
-	paddq	%xmm5,%xmm2
-	pmuludq	32(%esp),%xmm7
-	movd	76(%edi),%xmm5
-	paddq	%xmm6,%xmm1
-	movd	140(%edi),%xmm6
-	pmuludq	(%esp),%xmm5
-	paddq	%xmm7,%xmm0
-	movdqa	%xmm6,%xmm7
-	pmuludq	64(%esp),%xmm6
-	paddq	%xmm5,%xmm4
-	movdqa	%xmm7,%xmm5
-	pmuludq	16(%esp),%xmm7
-	paddq	%xmm6,%xmm3
-	movdqa	%xmm5,%xmm6
-	pmuludq	32(%esp),%xmm5
-	paddq	%xmm7,%xmm0
-	pmuludq	48(%esp),%xmm6
-	movdqa	64(%ebx),%xmm7
-	paddq	%xmm5,%xmm1
-	paddq	%xmm6,%xmm2
-	movdqa	%xmm3,%xmm5
-	pand	%xmm7,%xmm3
-	psrlq	$26,%xmm5
-	paddq	%xmm4,%xmm5
-	movdqa	%xmm0,%xmm6
-	pand	%xmm7,%xmm0
-	psrlq	$26,%xmm6
-	movdqa	%xmm5,%xmm4
-	paddq	%xmm1,%xmm6
-	psrlq	$26,%xmm5
-	pand	%xmm7,%xmm4
-	movdqa	%xmm6,%xmm1
-	psrlq	$26,%xmm6
-	paddd	%xmm5,%xmm0
-	psllq	$2,%xmm5
-	paddq	%xmm2,%xmm6
-	paddd	%xmm0,%xmm5
-	pand	%xmm7,%xmm1
-	movdqa	%xmm6,%xmm2
-	psrlq	$26,%xmm6
-	pand	%xmm7,%xmm2
-	paddd	%xmm3,%xmm6
-	movdqa	%xmm5,%xmm0
-	psrlq	$26,%xmm5
-	movdqa	%xmm6,%xmm3
-	psrlq	$26,%xmm6
-	pand	%xmm7,%xmm0
-	paddd	%xmm5,%xmm1
-	pand	%xmm7,%xmm3
-	paddd	%xmm6,%xmm4
-	subl	$16,%ecx
-	jz	.L013done
-.L012even:
-	leal	384(%esp),%edx
-	leal	-32(%esi),%eax
-	subl	$64,%ecx
-	movdqu	(%edi),%xmm5
-	pshufd	$68,%xmm5,%xmm6
-	cmovbl	%eax,%esi
-	pshufd	$238,%xmm5,%xmm5
-	movdqa	%xmm6,(%edx)
-	leal	160(%esp),%eax
-	movdqu	16(%edi),%xmm6
-	movdqa	%xmm5,-144(%edx)
-	pshufd	$68,%xmm6,%xmm5
-	pshufd	$238,%xmm6,%xmm6
-	movdqa	%xmm5,16(%edx)
-	movdqu	32(%edi),%xmm5
-	movdqa	%xmm6,-128(%edx)
-	pshufd	$68,%xmm5,%xmm6
-	pshufd	$238,%xmm5,%xmm5
-	movdqa	%xmm6,32(%edx)
-	movdqu	48(%edi),%xmm6
-	movdqa	%xmm5,-112(%edx)
-	pshufd	$68,%xmm6,%xmm5
-	pshufd	$238,%xmm6,%xmm6
-	movdqa	%xmm5,48(%edx)
-	movdqu	64(%edi),%xmm5
-	movdqa	%xmm6,-96(%edx)
-	pshufd	$68,%xmm5,%xmm6
-	pshufd	$238,%xmm5,%xmm5
-	movdqa	%xmm6,64(%edx)
-	movdqu	80(%edi),%xmm6
-	movdqa	%xmm5,-80(%edx)
-	pshufd	$68,%xmm6,%xmm5
-	pshufd	$238,%xmm6,%xmm6
-	movdqa	%xmm5,80(%edx)
-	movdqu	96(%edi),%xmm5
-	movdqa	%xmm6,-64(%edx)
-	pshufd	$68,%xmm5,%xmm6
-	pshufd	$238,%xmm5,%xmm5
-	movdqa	%xmm6,96(%edx)
-	movdqu	112(%edi),%xmm6
-	movdqa	%xmm5,-48(%edx)
-	pshufd	$68,%xmm6,%xmm5
-	pshufd	$238,%xmm6,%xmm6
-	movdqa	%xmm5,112(%edx)
-	movdqu	128(%edi),%xmm5
-	movdqa	%xmm6,-32(%edx)
-	pshufd	$68,%xmm5,%xmm6
-	pshufd	$238,%xmm5,%xmm5
-	movdqa	%xmm6,128(%edx)
-	movdqa	%xmm5,-16(%edx)
-	movdqu	32(%esi),%xmm5
-	movdqu	48(%esi),%xmm6
-	leal	32(%esi),%esi
-	movdqa	%xmm2,112(%esp)
-	movdqa	%xmm3,128(%esp)
-	movdqa	%xmm4,144(%esp)
-	movdqa	%xmm5,%xmm2
-	movdqa	%xmm6,%xmm3
-	psrldq	$6,%xmm2
-	psrldq	$6,%xmm3
-	movdqa	%xmm5,%xmm4
-	punpcklqdq	%xmm3,%xmm2
-	punpckhqdq	%xmm6,%xmm4
-	punpcklqdq	%xmm6,%xmm5
-	movdqa	%xmm2,%xmm3
-	psrlq	$4,%xmm2
-	psrlq	$30,%xmm3
-	movdqa	%xmm5,%xmm6
-	psrlq	$40,%xmm4
-	psrlq	$26,%xmm6
-	pand	%xmm7,%xmm5
-	pand	%xmm7,%xmm6
-	pand	%xmm7,%xmm2
-	pand	%xmm7,%xmm3
-	por	(%ebx),%xmm4
-	movdqa	%xmm0,80(%esp)
-	movdqa	%xmm1,96(%esp)
-	jbe	.L014skip_loop
-	jmp	.L015loop
-.align	32
-.L015loop:
-	movdqa	-144(%edx),%xmm7
-	movdqa	%xmm6,16(%eax)
-	movdqa	%xmm2,32(%eax)
-	movdqa	%xmm3,48(%eax)
-	movdqa	%xmm4,64(%eax)
-	movdqa	%xmm5,%xmm1
-	pmuludq	%xmm7,%xmm5
-	movdqa	%xmm6,%xmm0
-	pmuludq	%xmm7,%xmm6
-	pmuludq	%xmm7,%xmm2
-	pmuludq	%xmm7,%xmm3
-	pmuludq	%xmm7,%xmm4
-	pmuludq	-16(%edx),%xmm0
-	movdqa	%xmm1,%xmm7
-	pmuludq	-128(%edx),%xmm1
-	paddq	%xmm5,%xmm0
-	movdqa	%xmm7,%xmm5
-	pmuludq	-112(%edx),%xmm7
-	paddq	%xmm6,%xmm1
-	movdqa	%xmm5,%xmm6
-	pmuludq	-96(%edx),%xmm5
-	paddq	%xmm7,%xmm2
-	movdqa	16(%eax),%xmm7
-	pmuludq	-80(%edx),%xmm6
-	paddq	%xmm5,%xmm3
-	movdqa	%xmm7,%xmm5
-	pmuludq	-128(%edx),%xmm7
-	paddq	%xmm6,%xmm4
-	movdqa	%xmm5,%xmm6
-	pmuludq	-112(%edx),%xmm5
-	paddq	%xmm7,%xmm2
-	movdqa	32(%eax),%xmm7
-	pmuludq	-96(%edx),%xmm6
-	paddq	%xmm5,%xmm3
-	movdqa	%xmm7,%xmm5
-	pmuludq	-32(%edx),%xmm7
-	paddq	%xmm6,%xmm4
-	movdqa	%xmm5,%xmm6
-	pmuludq	-16(%edx),%xmm5
-	paddq	%xmm7,%xmm0
-	movdqa	%xmm6,%xmm7
-	pmuludq	-128(%edx),%xmm6
-	paddq	%xmm5,%xmm1
-	movdqa	48(%eax),%xmm5
-	pmuludq	-112(%edx),%xmm7
-	paddq	%xmm6,%xmm3
-	movdqa	%xmm5,%xmm6
-	pmuludq	-48(%edx),%xmm5
-	paddq	%xmm7,%xmm4
-	movdqa	%xmm6,%xmm7
-	pmuludq	-32(%edx),%xmm6
-	paddq	%xmm5,%xmm0
-	movdqa	%xmm7,%xmm5
-	pmuludq	-16(%edx),%xmm7
-	paddq	%xmm6,%xmm1
-	movdqa	64(%eax),%xmm6
-	pmuludq	-128(%edx),%xmm5
-	paddq	%xmm7,%xmm2
-	movdqa	%xmm6,%xmm7
-	pmuludq	-16(%edx),%xmm6
-	paddq	%xmm5,%xmm4
-	movdqa	%xmm7,%xmm5
-	pmuludq	-64(%edx),%xmm7
-	paddq	%xmm6,%xmm3
-	movdqa	%xmm5,%xmm6
-	pmuludq	-48(%edx),%xmm5
-	paddq	%xmm7,%xmm0
-	movdqa	64(%ebx),%xmm7
-	pmuludq	-32(%edx),%xmm6
-	paddq	%xmm5,%xmm1
-	paddq	%xmm6,%xmm2
-	movdqu	-32(%esi),%xmm5
-	movdqu	-16(%esi),%xmm6
-	leal	32(%esi),%esi
-	movdqa	%xmm2,32(%esp)
-	movdqa	%xmm3,48(%esp)
-	movdqa	%xmm4,64(%esp)
-	movdqa	%xmm5,%xmm2
-	movdqa	%xmm6,%xmm3
-	psrldq	$6,%xmm2
-	psrldq	$6,%xmm3
-	movdqa	%xmm5,%xmm4
-	punpcklqdq	%xmm3,%xmm2
-	punpckhqdq	%xmm6,%xmm4
-	punpcklqdq	%xmm6,%xmm5
-	movdqa	%xmm2,%xmm3
-	psrlq	$4,%xmm2
-	psrlq	$30,%xmm3
-	movdqa	%xmm5,%xmm6
-	psrlq	$40,%xmm4
-	psrlq	$26,%xmm6
-	pand	%xmm7,%xmm5
-	pand	%xmm7,%xmm6
-	pand	%xmm7,%xmm2
-	pand	%xmm7,%xmm3
-	por	(%ebx),%xmm4
-	leal	-32(%esi),%eax
-	subl	$64,%ecx
-	paddd	80(%esp),%xmm5
-	paddd	96(%esp),%xmm6
-	paddd	112(%esp),%xmm2
-	paddd	128(%esp),%xmm3
-	paddd	144(%esp),%xmm4
-	cmovbl	%eax,%esi
-	leal	160(%esp),%eax
-	movdqa	(%edx),%xmm7
-	movdqa	%xmm1,16(%esp)
-	movdqa	%xmm6,16(%eax)
-	movdqa	%xmm2,32(%eax)
-	movdqa	%xmm3,48(%eax)
-	movdqa	%xmm4,64(%eax)
-	movdqa	%xmm5,%xmm1
-	pmuludq	%xmm7,%xmm5
-	paddq	%xmm0,%xmm5
-	movdqa	%xmm6,%xmm0
-	pmuludq	%xmm7,%xmm6
-	pmuludq	%xmm7,%xmm2
-	pmuludq	%xmm7,%xmm3
-	pmuludq	%xmm7,%xmm4
-	paddq	16(%esp),%xmm6
-	paddq	32(%esp),%xmm2
-	paddq	48(%esp),%xmm3
-	paddq	64(%esp),%xmm4
-	pmuludq	128(%edx),%xmm0
-	movdqa	%xmm1,%xmm7
-	pmuludq	16(%edx),%xmm1
-	paddq	%xmm5,%xmm0
-	movdqa	%xmm7,%xmm5
-	pmuludq	32(%edx),%xmm7
-	paddq	%xmm6,%xmm1
-	movdqa	%xmm5,%xmm6
-	pmuludq	48(%edx),%xmm5
-	paddq	%xmm7,%xmm2
-	movdqa	16(%eax),%xmm7
-	pmuludq	64(%edx),%xmm6
-	paddq	%xmm5,%xmm3
-	movdqa	%xmm7,%xmm5
-	pmuludq	16(%edx),%xmm7
-	paddq	%xmm6,%xmm4
-	movdqa	%xmm5,%xmm6
-	pmuludq	32(%edx),%xmm5
-	paddq	%xmm7,%xmm2
-	movdqa	32(%eax),%xmm7
-	pmuludq	48(%edx),%xmm6
-	paddq	%xmm5,%xmm3
-	movdqa	%xmm7,%xmm5
-	pmuludq	112(%edx),%xmm7
-	paddq	%xmm6,%xmm4
-	movdqa	%xmm5,%xmm6
-	pmuludq	128(%edx),%xmm5
-	paddq	%xmm7,%xmm0
-	movdqa	%xmm6,%xmm7
-	pmuludq	16(%edx),%xmm6
-	paddq	%xmm5,%xmm1
-	movdqa	48(%eax),%xmm5
-	pmuludq	32(%edx),%xmm7
-	paddq	%xmm6,%xmm3
-	movdqa	%xmm5,%xmm6
-	pmuludq	96(%edx),%xmm5
-	paddq	%xmm7,%xmm4
-	movdqa	%xmm6,%xmm7
-	pmuludq	112(%edx),%xmm6
-	paddq	%xmm5,%xmm0
-	movdqa	%xmm7,%xmm5
-	pmuludq	128(%edx),%xmm7
-	paddq	%xmm6,%xmm1
-	movdqa	64(%eax),%xmm6
-	pmuludq	16(%edx),%xmm5
-	paddq	%xmm7,%xmm2
-	movdqa	%xmm6,%xmm7
-	pmuludq	128(%edx),%xmm6
-	paddq	%xmm5,%xmm4
-	movdqa	%xmm7,%xmm5
-	pmuludq	80(%edx),%xmm7
-	paddq	%xmm6,%xmm3
-	movdqa	%xmm5,%xmm6
-	pmuludq	96(%edx),%xmm5
-	paddq	%xmm7,%xmm0
-	movdqa	64(%ebx),%xmm7
-	pmuludq	112(%edx),%xmm6
-	paddq	%xmm5,%xmm1
-	paddq	%xmm6,%xmm2
-	movdqa	%xmm3,%xmm5
-	pand	%xmm7,%xmm3
-	psrlq	$26,%xmm5
-	paddq	%xmm4,%xmm5
-	movdqa	%xmm0,%xmm6
-	pand	%xmm7,%xmm0
-	psrlq	$26,%xmm6
-	movdqa	%xmm5,%xmm4
-	paddq	%xmm1,%xmm6
-	psrlq	$26,%xmm5
-	pand	%xmm7,%xmm4
-	movdqa	%xmm6,%xmm1
-	psrlq	$26,%xmm6
-	paddd	%xmm5,%xmm0
-	psllq	$2,%xmm5
-	paddq	%xmm2,%xmm6
-	paddd	%xmm0,%xmm5
-	pand	%xmm7,%xmm1
-	movdqa	%xmm6,%xmm2
-	psrlq	$26,%xmm6
-	pand	%xmm7,%xmm2
-	paddd	%xmm3,%xmm6
-	movdqa	%xmm5,%xmm0
-	psrlq	$26,%xmm5
-	movdqa	%xmm6,%xmm3
-	psrlq	$26,%xmm6
-	pand	%xmm7,%xmm0
-	paddd	%xmm5,%xmm1
-	pand	%xmm7,%xmm3
-	paddd	%xmm6,%xmm4
-	movdqu	32(%esi),%xmm5
-	movdqu	48(%esi),%xmm6
-	leal	32(%esi),%esi
-	movdqa	%xmm2,112(%esp)
-	movdqa	%xmm3,128(%esp)
-	movdqa	%xmm4,144(%esp)
-	movdqa	%xmm5,%xmm2
-	movdqa	%xmm6,%xmm3
-	psrldq	$6,%xmm2
-	psrldq	$6,%xmm3
-	movdqa	%xmm5,%xmm4
-	punpcklqdq	%xmm3,%xmm2
-	punpckhqdq	%xmm6,%xmm4
-	punpcklqdq	%xmm6,%xmm5
-	movdqa	%xmm2,%xmm3
-	psrlq	$4,%xmm2
-	psrlq	$30,%xmm3
-	movdqa	%xmm5,%xmm6
-	psrlq	$40,%xmm4
-	psrlq	$26,%xmm6
-	pand	%xmm7,%xmm5
-	pand	%xmm7,%xmm6
-	pand	%xmm7,%xmm2
-	pand	%xmm7,%xmm3
-	por	(%ebx),%xmm4
-	movdqa	%xmm0,80(%esp)
-	movdqa	%xmm1,96(%esp)
-	ja	.L015loop
-.L014skip_loop:
-	pshufd	$16,-144(%edx),%xmm7
-	addl	$32,%ecx
-	jnz	.L016long_tail
-	paddd	%xmm0,%xmm5
-	paddd	%xmm1,%xmm6
-	paddd	112(%esp),%xmm2
-	paddd	128(%esp),%xmm3
-	paddd	144(%esp),%xmm4
-.L016long_tail:
-	movdqa	%xmm5,(%eax)
-	movdqa	%xmm6,16(%eax)
-	movdqa	%xmm2,32(%eax)
-	movdqa	%xmm3,48(%eax)
-	movdqa	%xmm4,64(%eax)
-	pmuludq	%xmm7,%xmm5
-	pmuludq	%xmm7,%xmm6
-	pmuludq	%xmm7,%xmm2
-	movdqa	%xmm5,%xmm0
-	pshufd	$16,-128(%edx),%xmm5
-	pmuludq	%xmm7,%xmm3
-	movdqa	%xmm6,%xmm1
-	pmuludq	%xmm7,%xmm4
-	movdqa	%xmm5,%xmm6
-	pmuludq	48(%eax),%xmm5
-	movdqa	%xmm6,%xmm7
-	pmuludq	32(%eax),%xmm6
-	paddq	%xmm5,%xmm4
-	movdqa	%xmm7,%xmm5
-	pmuludq	16(%eax),%xmm7
-	paddq	%xmm6,%xmm3
-	pshufd	$16,-64(%edx),%xmm6
-	pmuludq	(%eax),%xmm5
-	paddq	%xmm7,%xmm2
-	pmuludq	64(%eax),%xmm6
-	pshufd	$16,-112(%edx),%xmm7
-	paddq	%xmm5,%xmm1
-	movdqa	%xmm7,%xmm5
-	pmuludq	32(%eax),%xmm7
-	paddq	%xmm6,%xmm0
-	movdqa	%xmm5,%xmm6
-	pmuludq	16(%eax),%xmm5
-	paddq	%xmm7,%xmm4
-	pshufd	$16,-48(%edx),%xmm7
-	pmuludq	(%eax),%xmm6
-	paddq	%xmm5,%xmm3
-	movdqa	%xmm7,%xmm5
-	pmuludq	64(%eax),%xmm7
-	paddq	%xmm6,%xmm2
-	pmuludq	48(%eax),%xmm5
-	pshufd	$16,-96(%edx),%xmm6
-	paddq	%xmm7,%xmm1
-	movdqa	%xmm6,%xmm7
-	pmuludq	16(%eax),%xmm6
-	paddq	%xmm5,%xmm0
-	pshufd	$16,-32(%edx),%xmm5
-	pmuludq	(%eax),%xmm7
-	paddq	%xmm6,%xmm4
-	movdqa	%xmm5,%xmm6
-	pmuludq	64(%eax),%xmm5
-	paddq	%xmm7,%xmm3
-	movdqa	%xmm6,%xmm7
-	pmuludq	48(%eax),%xmm6
-	paddq	%xmm5,%xmm2
-	pmuludq	32(%eax),%xmm7
-	pshufd	$16,-80(%edx),%xmm5
-	paddq	%xmm6,%xmm1
-	pshufd	$16,-16(%edx),%xmm6
-	pmuludq	(%eax),%xmm5
-	paddq	%xmm7,%xmm0
-	movdqa	%xmm6,%xmm7
-	pmuludq	64(%eax),%xmm6
-	paddq	%xmm5,%xmm4
-	movdqa	%xmm7,%xmm5
-	pmuludq	16(%eax),%xmm7
-	paddq	%xmm6,%xmm3
-	movdqa	%xmm5,%xmm6
-	pmuludq	32(%eax),%xmm5
-	paddq	%xmm7,%xmm0
-	pmuludq	48(%eax),%xmm6
-	movdqa	64(%ebx),%xmm7
-	paddq	%xmm5,%xmm1
-	paddq	%xmm6,%xmm2
-	jz	.L017short_tail
-	movdqu	-32(%esi),%xmm5
-	movdqu	-16(%esi),%xmm6
-	leal	32(%esi),%esi
-	movdqa	%xmm2,32(%esp)
-	movdqa	%xmm3,48(%esp)
-	movdqa	%xmm4,64(%esp)
-	movdqa	%xmm5,%xmm2
-	movdqa	%xmm6,%xmm3
-	psrldq	$6,%xmm2
-	psrldq	$6,%xmm3
-	movdqa	%xmm5,%xmm4
-	punpcklqdq	%xmm3,%xmm2
-	punpckhqdq	%xmm6,%xmm4
-	punpcklqdq	%xmm6,%xmm5
-	movdqa	%xmm2,%xmm3
-	psrlq	$4,%xmm2
-	psrlq	$30,%xmm3
-	movdqa	%xmm5,%xmm6
-	psrlq	$40,%xmm4
-	psrlq	$26,%xmm6
-	pand	%xmm7,%xmm5
-	pand	%xmm7,%xmm6
-	pand	%xmm7,%xmm2
-	pand	%xmm7,%xmm3
-	por	(%ebx),%xmm4
-	pshufd	$16,(%edx),%xmm7
-	paddd	80(%esp),%xmm5
-	paddd	96(%esp),%xmm6
-	paddd	112(%esp),%xmm2
-	paddd	128(%esp),%xmm3
-	paddd	144(%esp),%xmm4
-	movdqa	%xmm5,(%esp)
-	pmuludq	%xmm7,%xmm5
-	movdqa	%xmm6,16(%esp)
-	pmuludq	%xmm7,%xmm6
-	paddq	%xmm5,%xmm0
-	movdqa	%xmm2,%xmm5
-	pmuludq	%xmm7,%xmm2
-	paddq	%xmm6,%xmm1
-	movdqa	%xmm3,%xmm6
-	pmuludq	%xmm7,%xmm3
-	paddq	32(%esp),%xmm2
-	movdqa	%xmm5,32(%esp)
-	pshufd	$16,16(%edx),%xmm5
-	paddq	48(%esp),%xmm3
-	movdqa	%xmm6,48(%esp)
-	movdqa	%xmm4,%xmm6
-	pmuludq	%xmm7,%xmm4
-	paddq	64(%esp),%xmm4
-	movdqa	%xmm6,64(%esp)
-	movdqa	%xmm5,%xmm6
-	pmuludq	48(%esp),%xmm5
-	movdqa	%xmm6,%xmm7
-	pmuludq	32(%esp),%xmm6
-	paddq	%xmm5,%xmm4
-	movdqa	%xmm7,%xmm5
-	pmuludq	16(%esp),%xmm7
-	paddq	%xmm6,%xmm3
-	pshufd	$16,80(%edx),%xmm6
-	pmuludq	(%esp),%xmm5
-	paddq	%xmm7,%xmm2
-	pmuludq	64(%esp),%xmm6
-	pshufd	$16,32(%edx),%xmm7
-	paddq	%xmm5,%xmm1
-	movdqa	%xmm7,%xmm5
-	pmuludq	32(%esp),%xmm7
-	paddq	%xmm6,%xmm0
-	movdqa	%xmm5,%xmm6
-	pmuludq	16(%esp),%xmm5
-	paddq	%xmm7,%xmm4
-	pshufd	$16,96(%edx),%xmm7
-	pmuludq	(%esp),%xmm6
-	paddq	%xmm5,%xmm3
-	movdqa	%xmm7,%xmm5
-	pmuludq	64(%esp),%xmm7
-	paddq	%xmm6,%xmm2
-	pmuludq	48(%esp),%xmm5
-	pshufd	$16,48(%edx),%xmm6
-	paddq	%xmm7,%xmm1
-	movdqa	%xmm6,%xmm7
-	pmuludq	16(%esp),%xmm6
-	paddq	%xmm5,%xmm0
-	pshufd	$16,112(%edx),%xmm5
-	pmuludq	(%esp),%xmm7
-	paddq	%xmm6,%xmm4
-	movdqa	%xmm5,%xmm6
-	pmuludq	64(%esp),%xmm5
-	paddq	%xmm7,%xmm3
-	movdqa	%xmm6,%xmm7
-	pmuludq	48(%esp),%xmm6
-	paddq	%xmm5,%xmm2
-	pmuludq	32(%esp),%xmm7
-	pshufd	$16,64(%edx),%xmm5
-	paddq	%xmm6,%xmm1
-	pshufd	$16,128(%edx),%xmm6
-	pmuludq	(%esp),%xmm5
-	paddq	%xmm7,%xmm0
-	movdqa	%xmm6,%xmm7
-	pmuludq	64(%esp),%xmm6
-	paddq	%xmm5,%xmm4
-	movdqa	%xmm7,%xmm5
-	pmuludq	16(%esp),%xmm7
-	paddq	%xmm6,%xmm3
-	movdqa	%xmm5,%xmm6
-	pmuludq	32(%esp),%xmm5
-	paddq	%xmm7,%xmm0
-	pmuludq	48(%esp),%xmm6
-	movdqa	64(%ebx),%xmm7
-	paddq	%xmm5,%xmm1
-	paddq	%xmm6,%xmm2
-.L017short_tail:
-	pshufd	$78,%xmm4,%xmm6
-	pshufd	$78,%xmm3,%xmm5
-	paddq	%xmm6,%xmm4
-	paddq	%xmm5,%xmm3
-	pshufd	$78,%xmm0,%xmm6
-	pshufd	$78,%xmm1,%xmm5
-	paddq	%xmm6,%xmm0
-	paddq	%xmm5,%xmm1
-	pshufd	$78,%xmm2,%xmm6
-	movdqa	%xmm3,%xmm5
-	pand	%xmm7,%xmm3
-	psrlq	$26,%xmm5
-	paddq	%xmm6,%xmm2
-	paddq	%xmm4,%xmm5
-	movdqa	%xmm0,%xmm6
-	pand	%xmm7,%xmm0
-	psrlq	$26,%xmm6
-	movdqa	%xmm5,%xmm4
-	paddq	%xmm1,%xmm6
-	psrlq	$26,%xmm5
-	pand	%xmm7,%xmm4
-	movdqa	%xmm6,%xmm1
-	psrlq	$26,%xmm6
-	paddd	%xmm5,%xmm0
-	psllq	$2,%xmm5
-	paddq	%xmm2,%xmm6
-	paddq	%xmm0,%xmm5
-	pand	%xmm7,%xmm1
-	movdqa	%xmm6,%xmm2
-	psrlq	$26,%xmm6
-	pand	%xmm7,%xmm2
-	paddd	%xmm3,%xmm6
-	movdqa	%xmm5,%xmm0
-	psrlq	$26,%xmm5
-	movdqa	%xmm6,%xmm3
-	psrlq	$26,%xmm6
-	pand	%xmm7,%xmm0
-	paddd	%xmm5,%xmm1
-	pand	%xmm7,%xmm3
-	paddd	%xmm6,%xmm4
-.L013done:
-	movd	%xmm0,-48(%edi)
-	movd	%xmm1,-44(%edi)
-	movd	%xmm2,-40(%edi)
-	movd	%xmm3,-36(%edi)
-	movd	%xmm4,-32(%edi)
-	movl	%ebp,%esp
-.L007nodata:
-	popl	%edi
-	popl	%esi
-	popl	%ebx
-	popl	%ebp
-	ret
-.size	_poly1305_blocks_sse2,.-_poly1305_blocks_sse2
-.align	32
-.hidden	_poly1305_emit_sse2
-.type	_poly1305_emit_sse2,@function
-.align	16
-_poly1305_emit_sse2:
-	pushl	%ebp
-	pushl	%ebx
-	pushl	%esi
-	pushl	%edi
-	movl	20(%esp),%ebp
-	cmpl	$0,20(%ebp)
-	je	.Lenter_emit
-	movl	(%ebp),%eax
-	movl	4(%ebp),%edi
-	movl	8(%ebp),%ecx
-	movl	12(%ebp),%edx
-	movl	16(%ebp),%esi
-	movl	%edi,%ebx
-	shll	$26,%edi
-	shrl	$6,%ebx
-	addl	%edi,%eax
-	movl	%ecx,%edi
-	adcl	$0,%ebx
-	shll	$20,%edi
-	shrl	$12,%ecx
-	addl	%edi,%ebx
-	movl	%edx,%edi
-	adcl	$0,%ecx
-	shll	$14,%edi
-	shrl	$18,%edx
-	addl	%edi,%ecx
-	movl	%esi,%edi
-	adcl	$0,%edx
-	shll	$8,%edi
-	shrl	$24,%esi
-	addl	%edi,%edx
-	adcl	$0,%esi
-	movl	%esi,%edi
-	andl	$3,%esi
-	shrl	$2,%edi
-	leal	(%edi,%edi,4),%ebp
-	movl	24(%esp),%edi
-	addl	%ebp,%eax
-	movl	28(%esp),%ebp
-	adcl	$0,%ebx
-	adcl	$0,%ecx
-	adcl	$0,%edx
-	movd	%eax,%xmm0
-	addl	$5,%eax
-	movd	%ebx,%xmm1
-	adcl	$0,%ebx
-	movd	%ecx,%xmm2
-	adcl	$0,%ecx
-	movd	%edx,%xmm3
-	adcl	$0,%edx
-	adcl	$0,%esi
-	shrl	$2,%esi
-	negl	%esi
-	andl	%esi,%eax
-	andl	%esi,%ebx
-	andl	%esi,%ecx
-	andl	%esi,%edx
-	movl	%eax,(%edi)
-	movd	%xmm0,%eax
-	movl	%ebx,4(%edi)
-	movd	%xmm1,%ebx
-	movl	%ecx,8(%edi)
-	movd	%xmm2,%ecx
-	movl	%edx,12(%edi)
-	movd	%xmm3,%edx
-	notl	%esi
-	andl	%esi,%eax
-	andl	%esi,%ebx
-	orl	(%edi),%eax
-	andl	%esi,%ecx
-	orl	4(%edi),%ebx
-	andl	%esi,%edx
-	orl	8(%edi),%ecx
-	orl	12(%edi),%edx
-	addl	(%ebp),%eax
-	adcl	4(%ebp),%ebx
-	movl	%eax,(%edi)
-	adcl	8(%ebp),%ecx
-	movl	%ebx,4(%edi)
-	adcl	12(%ebp),%edx
-	movl	%ecx,8(%edi)
-	movl	%edx,12(%edi)
-	popl	%edi
-	popl	%esi
-	popl	%ebx
-	popl	%ebp
-	ret
-.size	_poly1305_emit_sse2,.-_poly1305_emit_sse2
-.align	64
-.Lconst_sse2:
-.long	16777216,0,16777216,0,16777216,0,16777216,0
-.long	0,0,0,0,0,0,0,0
-.long	67108863,0,67108863,0,67108863,0,67108863,0
-.long	268435455,268435452,268435452,268435452
-.byte	80,111,108,121,49,51,48,53,32,102,111,114,32,120,56,54
-.byte	44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32
-.byte	60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111
-.byte	114,103,62,0
-.align	4
-#endif
diff --git a/third_party/boringssl/linux-x86_64/crypto/poly1305/poly1305-x86_64.S b/third_party/boringssl/linux-x86_64/crypto/poly1305/poly1305-x86_64.S
deleted file mode 100644
index d5a565b4..0000000
--- a/third_party/boringssl/linux-x86_64/crypto/poly1305/poly1305-x86_64.S
+++ /dev/null
@@ -1,1825 +0,0 @@
-#if defined(__x86_64__)
-.text	
-
-.extern	OPENSSL_ia32cap_P
-.hidden OPENSSL_ia32cap_P
-
-.globl	poly1305_init
-.hidden poly1305_init
-.globl	poly1305_blocks
-.hidden poly1305_blocks
-.globl	poly1305_emit
-.hidden poly1305_emit
-.type	poly1305_init,@function
-.align	32
-poly1305_init:
-	xorq	%rax,%rax
-	movq	%rax,0(%rdi)
-	movq	%rax,8(%rdi)
-	movq	%rax,16(%rdi)
-
-	cmpq	$0,%rsi
-	je	.Lno_key
-
-	leaq	poly1305_blocks(%rip),%r10
-	leaq	poly1305_emit(%rip),%r11
-	movq	OPENSSL_ia32cap_P+4(%rip),%r9
-	leaq	poly1305_blocks_avx(%rip),%rax
-	leaq	poly1305_emit_avx(%rip),%rcx
-	btq	$28,%r9
-	cmovcq	%rax,%r10
-	cmovcq	%rcx,%r11
-	leaq	poly1305_blocks_avx2(%rip),%rax
-	btq	$37,%r9
-	cmovcq	%rax,%r10
-	movq	$0x0ffffffc0fffffff,%rax
-	movq	$0x0ffffffc0ffffffc,%rcx
-	andq	0(%rsi),%rax
-	andq	8(%rsi),%rcx
-	movq	%rax,24(%rdi)
-	movq	%rcx,32(%rdi)
-	movq	%r10,0(%rdx)
-	movq	%r11,8(%rdx)
-	movl	$1,%eax
-.Lno_key:
-	.byte	0xf3,0xc3
-.size	poly1305_init,.-poly1305_init
-
-.type	poly1305_blocks,@function
-.align	32
-poly1305_blocks:
-.Lblocks:
-	subq	$16,%rdx
-	jc	.Lno_data
-
-	pushq	%rbx
-	pushq	%rbp
-	pushq	%r12
-	pushq	%r13
-	pushq	%r14
-	pushq	%r15
-.Lblocks_body:
-
-	movq	%rdx,%r15
-
-	movq	24(%rdi),%r11
-	movq	32(%rdi),%r13
-
-	movq	0(%rdi),%r14
-	movq	8(%rdi),%rbx
-	movq	16(%rdi),%rbp
-
-	movq	%r13,%r12
-	shrq	$2,%r13
-	movq	%r12,%rax
-	addq	%r12,%r13
-	jmp	.Loop
-
-.align	32
-.Loop:
-	addq	0(%rsi),%r14
-	adcq	8(%rsi),%rbx
-	leaq	16(%rsi),%rsi
-	adcq	%rcx,%rbp
-	mulq	%r14
-	movq	%rax,%r9
-	movq	%r11,%rax
-	movq	%rdx,%r10
-
-	mulq	%r14
-	movq	%rax,%r14
-	movq	%r11,%rax
-	movq	%rdx,%r8
-
-	mulq	%rbx
-	addq	%rax,%r9
-	movq	%r13,%rax
-	adcq	%rdx,%r10
-
-	mulq	%rbx
-	movq	%rbp,%rbx
-	addq	%rax,%r14
-	adcq	%rdx,%r8
-
-	imulq	%r13,%rbx
-	addq	%rbx,%r9
-	movq	%r8,%rbx
-	adcq	$0,%r10
-
-	imulq	%r11,%rbp
-	addq	%r9,%rbx
-	movq	$-4,%rax
-	adcq	%rbp,%r10
-
-	andq	%r10,%rax
-	movq	%r10,%rbp
-	shrq	$2,%r10
-	andq	$3,%rbp
-	addq	%r10,%rax
-	addq	%rax,%r14
-	adcq	$0,%rbx
-	movq	%r12,%rax
-	subq	$16,%r15
-	jnc	.Loop
-
-	movq	%r14,0(%rdi)
-	movq	%rbx,8(%rdi)
-	movq	%rbp,16(%rdi)
-
-	movq	0(%rsp),%r15
-	movq	8(%rsp),%r14
-	movq	16(%rsp),%r13
-	movq	24(%rsp),%r12
-	movq	32(%rsp),%rbp
-	movq	40(%rsp),%rbx
-	leaq	48(%rsp),%rsp
-.Lno_data:
-.Lblocks_epilogue:
-	.byte	0xf3,0xc3
-.size	poly1305_blocks,.-poly1305_blocks
-
-.type	poly1305_emit,@function
-.align	32
-poly1305_emit:
-.Lemit:
-	movq	0(%rdi),%r8
-	movq	8(%rdi),%r9
-	movq	16(%rdi),%r10
-
-	movq	%r8,%rax
-	addq	$5,%r8
-	movq	%r9,%rcx
-	adcq	$0,%r9
-	adcq	$0,%r10
-	shrq	$2,%r10
-	cmovnzq	%r8,%rax
-	cmovnzq	%r9,%rcx
-
-	addq	0(%rdx),%rax
-	adcq	8(%rdx),%rcx
-	movq	%rax,0(%rsi)
-	movq	%rcx,8(%rsi)
-
-	.byte	0xf3,0xc3
-.size	poly1305_emit,.-poly1305_emit
-.type	__poly1305_block,@function
-.align	32
-__poly1305_block:
-	mulq	%r14
-	movq	%rax,%r9
-	movq	%r11,%rax
-	movq	%rdx,%r10
-
-	mulq	%r14
-	movq	%rax,%r14
-	movq	%r11,%rax
-	movq	%rdx,%r8
-
-	mulq	%rbx
-	addq	%rax,%r9
-	movq	%r13,%rax
-	adcq	%rdx,%r10
-
-	mulq	%rbx
-	movq	%rbp,%rbx
-	addq	%rax,%r14
-	adcq	%rdx,%r8
-
-	imulq	%r13,%rbx
-	addq	%rbx,%r9
-	movq	%r8,%rbx
-	adcq	$0,%r10
-
-	imulq	%r11,%rbp
-	addq	%r9,%rbx
-	movq	$-4,%rax
-	adcq	%rbp,%r10
-
-	andq	%r10,%rax
-	movq	%r10,%rbp
-	shrq	$2,%r10
-	andq	$3,%rbp
-	addq	%r10,%rax
-	addq	%rax,%r14
-	adcq	$0,%rbx
-	.byte	0xf3,0xc3
-.size	__poly1305_block,.-__poly1305_block
-
-.type	__poly1305_init_avx,@function
-.align	32
-__poly1305_init_avx:
-	movq	%r11,%r14
-	movq	%r12,%rbx
-	xorq	%rbp,%rbp
-
-	leaq	48+64(%rdi),%rdi
-
-	movq	%r12,%rax
-	call	__poly1305_block
-
-	movl	$0x3ffffff,%eax
-	movl	$0x3ffffff,%edx
-	movq	%r14,%r8
-	andl	%r14d,%eax
-	movq	%r11,%r9
-	andl	%r11d,%edx
-	movl	%eax,-64(%rdi)
-	shrq	$26,%r8
-	movl	%edx,-60(%rdi)
-	shrq	$26,%r9
-
-	movl	$0x3ffffff,%eax
-	movl	$0x3ffffff,%edx
-	andl	%r8d,%eax
-	andl	%r9d,%edx
-	movl	%eax,-48(%rdi)
-	leal	(%rax,%rax,4),%eax
-	movl	%edx,-44(%rdi)
-	leal	(%rdx,%rdx,4),%edx
-	movl	%eax,-32(%rdi)
-	shrq	$26,%r8
-	movl	%edx,-28(%rdi)
-	shrq	$26,%r9
-
-	movq	%rbx,%rax
-	movq	%r12,%rdx
-	shlq	$12,%rax
-	shlq	$12,%rdx
-	orq	%r8,%rax
-	orq	%r9,%rdx
-	andl	$0x3ffffff,%eax
-	andl	$0x3ffffff,%edx
-	movl	%eax,-16(%rdi)
-	leal	(%rax,%rax,4),%eax
-	movl	%edx,-12(%rdi)
-	leal	(%rdx,%rdx,4),%edx
-	movl	%eax,0(%rdi)
-	movq	%rbx,%r8
-	movl	%edx,4(%rdi)
-	movq	%r12,%r9
-
-	movl	$0x3ffffff,%eax
-	movl	$0x3ffffff,%edx
-	shrq	$14,%r8
-	shrq	$14,%r9
-	andl	%r8d,%eax
-	andl	%r9d,%edx
-	movl	%eax,16(%rdi)
-	leal	(%rax,%rax,4),%eax
-	movl	%edx,20(%rdi)
-	leal	(%rdx,%rdx,4),%edx
-	movl	%eax,32(%rdi)
-	shrq	$26,%r8
-	movl	%edx,36(%rdi)
-	shrq	$26,%r9
-
-	movq	%rbp,%rax
-	shlq	$24,%rax
-	orq	%rax,%r8
-	movl	%r8d,48(%rdi)
-	leaq	(%r8,%r8,4),%r8
-	movl	%r9d,52(%rdi)
-	leaq	(%r9,%r9,4),%r9
-	movl	%r8d,64(%rdi)
-	movl	%r9d,68(%rdi)
-
-	movq	%r12,%rax
-	call	__poly1305_block
-
-	movl	$0x3ffffff,%eax
-	movq	%r14,%r8
-	andl	%r14d,%eax
-	shrq	$26,%r8
-	movl	%eax,-52(%rdi)
-
-	movl	$0x3ffffff,%edx
-	andl	%r8d,%edx
-	movl	%edx,-36(%rdi)
-	leal	(%rdx,%rdx,4),%edx
-	shrq	$26,%r8
-	movl	%edx,-20(%rdi)
-
-	movq	%rbx,%rax
-	shlq	$12,%rax
-	orq	%r8,%rax
-	andl	$0x3ffffff,%eax
-	movl	%eax,-4(%rdi)
-	leal	(%rax,%rax,4),%eax
-	movq	%rbx,%r8
-	movl	%eax,12(%rdi)
-
-	movl	$0x3ffffff,%edx
-	shrq	$14,%r8
-	andl	%r8d,%edx
-	movl	%edx,28(%rdi)
-	leal	(%rdx,%rdx,4),%edx
-	shrq	$26,%r8
-	movl	%edx,44(%rdi)
-
-	movq	%rbp,%rax
-	shlq	$24,%rax
-	orq	%rax,%r8
-	movl	%r8d,60(%rdi)
-	leaq	(%r8,%r8,4),%r8
-	movl	%r8d,76(%rdi)
-
-	movq	%r12,%rax
-	call	__poly1305_block
-
-	movl	$0x3ffffff,%eax
-	movq	%r14,%r8
-	andl	%r14d,%eax
-	shrq	$26,%r8
-	movl	%eax,-56(%rdi)
-
-	movl	$0x3ffffff,%edx
-	andl	%r8d,%edx
-	movl	%edx,-40(%rdi)
-	leal	(%rdx,%rdx,4),%edx
-	shrq	$26,%r8
-	movl	%edx,-24(%rdi)
-
-	movq	%rbx,%rax
-	shlq	$12,%rax
-	orq	%r8,%rax
-	andl	$0x3ffffff,%eax
-	movl	%eax,-8(%rdi)
-	leal	(%rax,%rax,4),%eax
-	movq	%rbx,%r8
-	movl	%eax,8(%rdi)
-
-	movl	$0x3ffffff,%edx
-	shrq	$14,%r8
-	andl	%r8d,%edx
-	movl	%edx,24(%rdi)
-	leal	(%rdx,%rdx,4),%edx
-	shrq	$26,%r8
-	movl	%edx,40(%rdi)
-
-	movq	%rbp,%rax
-	shlq	$24,%rax
-	orq	%rax,%r8
-	movl	%r8d,56(%rdi)
-	leaq	(%r8,%r8,4),%r8
-	movl	%r8d,72(%rdi)
-
-	leaq	-48-64(%rdi),%rdi
-	.byte	0xf3,0xc3
-.size	__poly1305_init_avx,.-__poly1305_init_avx
-
-.type	poly1305_blocks_avx,@function
-.align	32
-poly1305_blocks_avx:
-	movl	20(%rdi),%r8d
-	cmpq	$128,%rdx
-	jae	.Lblocks_avx
-	testl	%r8d,%r8d
-	jz	.Lblocks
-
-.Lblocks_avx:
-	andq	$-16,%rdx
-	jz	.Lno_data_avx
-
-	vzeroupper
-
-	testl	%r8d,%r8d
-	jz	.Lbase2_64_avx
-
-	testq	$31,%rdx
-	jz	.Leven_avx
-
-	pushq	%rbx
-	pushq	%rbp
-	pushq	%r12
-	pushq	%r13
-	pushq	%r14
-	pushq	%r15
-.Lblocks_avx_body:
-
-	movq	%rdx,%r15
-
-	movq	0(%rdi),%r8
-	movq	8(%rdi),%r9
-	movl	16(%rdi),%ebp
-
-	movq	24(%rdi),%r11
-	movq	32(%rdi),%r13
-
-
-	movl	%r8d,%r14d
-	andq	$-1<<31,%r8
-	movq	%r9,%r12
-	movl	%r9d,%ebx
-	andq	$-1<<31,%r9
-
-	shrq	$6,%r8
-	shlq	$52,%r12
-	addq	%r8,%r14
-	shrq	$12,%rbx
-	shrq	$18,%r9
-	addq	%r12,%r14
-	adcq	%r9,%rbx
-
-	movq	%rbp,%r8
-	shlq	$40,%r8
-	shrq	$24,%rbp
-	addq	%r8,%rbx
-	adcq	$0,%rbp
-
-	movq	$-4,%r9
-	movq	%rbp,%r8
-	andq	%rbp,%r9
-	shrq	$2,%r8
-	andq	$3,%rbp
-	addq	%r9,%r8
-	addq	%r8,%r14
-	adcq	$0,%rbx
-
-	movq	%r13,%r12
-	movq	%r13,%rax
-	shrq	$2,%r13
-	addq	%r12,%r13
-
-	addq	0(%rsi),%r14
-	adcq	8(%rsi),%rbx
-	leaq	16(%rsi),%rsi
-	adcq	%rcx,%rbp
-
-	call	__poly1305_block
-
-	testq	%rcx,%rcx
-	jz	.Lstore_base2_64_avx
-
-
-	movq	%r14,%rax
-	movq	%r14,%rdx
-	shrq	$52,%r14
-	movq	%rbx,%r11
-	movq	%rbx,%r12
-	shrq	$26,%rdx
-	andq	$0x3ffffff,%rax
-	shlq	$12,%r11
-	andq	$0x3ffffff,%rdx
-	shrq	$14,%rbx
-	orq	%r11,%r14
-	shlq	$24,%rbp
-	andq	$0x3ffffff,%r14
-	shrq	$40,%r12
-	andq	$0x3ffffff,%rbx
-	orq	%r12,%rbp
-
-	subq	$16,%r15
-	jz	.Lstore_base2_26_avx
-
-	vmovd	%eax,%xmm0
-	vmovd	%edx,%xmm1
-	vmovd	%r14d,%xmm2
-	vmovd	%ebx,%xmm3
-	vmovd	%ebp,%xmm4
-	jmp	.Lproceed_avx
-
-.align	32
-.Lstore_base2_64_avx:
-	movq	%r14,0(%rdi)
-	movq	%rbx,8(%rdi)
-	movq	%rbp,16(%rdi)
-	jmp	.Ldone_avx
-
-.align	16
-.Lstore_base2_26_avx:
-	movl	%eax,0(%rdi)
-	movl	%edx,4(%rdi)
-	movl	%r14d,8(%rdi)
-	movl	%ebx,12(%rdi)
-	movl	%ebp,16(%rdi)
-.align	16
-.Ldone_avx:
-	movq	0(%rsp),%r15
-	movq	8(%rsp),%r14
-	movq	16(%rsp),%r13
-	movq	24(%rsp),%r12
-	movq	32(%rsp),%rbp
-	movq	40(%rsp),%rbx
-	leaq	48(%rsp),%rsp
-.Lno_data_avx:
-.Lblocks_avx_epilogue:
-	.byte	0xf3,0xc3
-
-.align	32
-.Lbase2_64_avx:
-	pushq	%rbx
-	pushq	%rbp
-	pushq	%r12
-	pushq	%r13
-	pushq	%r14
-	pushq	%r15
-.Lbase2_64_avx_body:
-
-	movq	%rdx,%r15
-
-	movq	24(%rdi),%r11
-	movq	32(%rdi),%r13
-
-	movq	0(%rdi),%r14
-	movq	8(%rdi),%rbx
-	movl	16(%rdi),%ebp
-
-	movq	%r13,%r12
-	movq	%r13,%rax
-	shrq	$2,%r13
-	addq	%r12,%r13
-
-	testq	$31,%rdx
-	jz	.Linit_avx
-
-	addq	0(%rsi),%r14
-	adcq	8(%rsi),%rbx
-	leaq	16(%rsi),%rsi
-	adcq	%rcx,%rbp
-	subq	$16,%r15
-
-	call	__poly1305_block
-
-.Linit_avx:
-
-	movq	%r14,%rax
-	movq	%r14,%rdx
-	shrq	$52,%r14
-	movq	%rbx,%r8
-	movq	%rbx,%r9
-	shrq	$26,%rdx
-	andq	$0x3ffffff,%rax
-	shlq	$12,%r8
-	andq	$0x3ffffff,%rdx
-	shrq	$14,%rbx
-	orq	%r8,%r14
-	shlq	$24,%rbp
-	andq	$0x3ffffff,%r14
-	shrq	$40,%r9
-	andq	$0x3ffffff,%rbx
-	orq	%r9,%rbp
-
-	vmovd	%eax,%xmm0
-	vmovd	%edx,%xmm1
-	vmovd	%r14d,%xmm2
-	vmovd	%ebx,%xmm3
-	vmovd	%ebp,%xmm4
-	movl	$1,20(%rdi)
-
-	call	__poly1305_init_avx
-
-.Lproceed_avx:
-	movq	%r15,%rdx
-
-	movq	0(%rsp),%r15
-	movq	8(%rsp),%r14
-	movq	16(%rsp),%r13
-	movq	24(%rsp),%r12
-	movq	32(%rsp),%rbp
-	movq	40(%rsp),%rbx
-	leaq	48(%rsp),%rax
-	leaq	48(%rsp),%rsp
-.Lbase2_64_avx_epilogue:
-	jmp	.Ldo_avx
-
-.align	32
-.Leven_avx:
-	vmovd	0(%rdi),%xmm0
-	vmovd	4(%rdi),%xmm1
-	vmovd	8(%rdi),%xmm2
-	vmovd	12(%rdi),%xmm3
-	vmovd	16(%rdi),%xmm4
-
-.Ldo_avx:
-	leaq	-88(%rsp),%r11
-	subq	$0x178,%rsp
-	subq	$64,%rdx
-	leaq	-32(%rsi),%rax
-	cmovcq	%rax,%rsi
-
-	vmovdqu	48(%rdi),%xmm14
-	leaq	112(%rdi),%rdi
-	leaq	.Lconst(%rip),%rcx
-
-
-
-	vmovdqu	32(%rsi),%xmm5
-	vmovdqu	48(%rsi),%xmm6
-	vmovdqa	64(%rcx),%xmm15
-
-	vpsrldq	$6,%xmm5,%xmm7
-	vpsrldq	$6,%xmm6,%xmm8
-	vpunpckhqdq	%xmm6,%xmm5,%xmm9
-	vpunpcklqdq	%xmm6,%xmm5,%xmm5
-	vpunpcklqdq	%xmm8,%xmm7,%xmm8
-
-	vpsrlq	$40,%xmm9,%xmm9
-	vpsrlq	$26,%xmm5,%xmm6
-	vpand	%xmm15,%xmm5,%xmm5
-	vpsrlq	$4,%xmm8,%xmm7
-	vpand	%xmm15,%xmm6,%xmm6
-	vpsrlq	$30,%xmm8,%xmm8
-	vpand	%xmm15,%xmm7,%xmm7
-	vpand	%xmm15,%xmm8,%xmm8
-	vpor	32(%rcx),%xmm9,%xmm9
-
-	jbe	.Lskip_loop_avx
-
-
-	vmovdqu	-48(%rdi),%xmm11
-	vmovdqu	-32(%rdi),%xmm12
-	vpshufd	$0xEE,%xmm14,%xmm13
-	vpshufd	$0x44,%xmm14,%xmm10
-	vmovdqa	%xmm13,-144(%r11)
-	vmovdqa	%xmm10,0(%rsp)
-	vpshufd	$0xEE,%xmm11,%xmm14
-	vmovdqu	-16(%rdi),%xmm10
-	vpshufd	$0x44,%xmm11,%xmm11
-	vmovdqa	%xmm14,-128(%r11)
-	vmovdqa	%xmm11,16(%rsp)
-	vpshufd	$0xEE,%xmm12,%xmm13
-	vmovdqu	0(%rdi),%xmm11
-	vpshufd	$0x44,%xmm12,%xmm12
-	vmovdqa	%xmm13,-112(%r11)
-	vmovdqa	%xmm12,32(%rsp)
-	vpshufd	$0xEE,%xmm10,%xmm14
-	vmovdqu	16(%rdi),%xmm12
-	vpshufd	$0x44,%xmm10,%xmm10
-	vmovdqa	%xmm14,-96(%r11)
-	vmovdqa	%xmm10,48(%rsp)
-	vpshufd	$0xEE,%xmm11,%xmm13
-	vmovdqu	32(%rdi),%xmm10
-	vpshufd	$0x44,%xmm11,%xmm11
-	vmovdqa	%xmm13,-80(%r11)
-	vmovdqa	%xmm11,64(%rsp)
-	vpshufd	$0xEE,%xmm12,%xmm14
-	vmovdqu	48(%rdi),%xmm11
-	vpshufd	$0x44,%xmm12,%xmm12
-	vmovdqa	%xmm14,-64(%r11)
-	vmovdqa	%xmm12,80(%rsp)
-	vpshufd	$0xEE,%xmm10,%xmm13
-	vmovdqu	64(%rdi),%xmm12
-	vpshufd	$0x44,%xmm10,%xmm10
-	vmovdqa	%xmm13,-48(%r11)
-	vmovdqa	%xmm10,96(%rsp)
-	vpshufd	$0xEE,%xmm11,%xmm14
-	vpshufd	$0x44,%xmm11,%xmm11
-	vmovdqa	%xmm14,-32(%r11)
-	vmovdqa	%xmm11,112(%rsp)
-	vpshufd	$0xEE,%xmm12,%xmm13
-	vmovdqa	0(%rsp),%xmm14
-	vpshufd	$0x44,%xmm12,%xmm12
-	vmovdqa	%xmm13,-16(%r11)
-	vmovdqa	%xmm12,128(%rsp)
-
-	jmp	.Loop_avx
-
-.align	32
-.Loop_avx:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-	vpmuludq	%xmm5,%xmm14,%xmm10
-	vpmuludq	%xmm6,%xmm14,%xmm11
-	vmovdqa	%xmm2,32(%r11)
-	vpmuludq	%xmm7,%xmm14,%xmm12
-	vmovdqa	16(%rsp),%xmm2
-	vpmuludq	%xmm8,%xmm14,%xmm13
-	vpmuludq	%xmm9,%xmm14,%xmm14
-
-	vmovdqa	%xmm0,0(%r11)
-	vpmuludq	32(%rsp),%xmm9,%xmm0
-	vmovdqa	%xmm1,16(%r11)
-	vpmuludq	%xmm8,%xmm2,%xmm1
-	vpaddq	%xmm0,%xmm10,%xmm10
-	vpaddq	%xmm1,%xmm14,%xmm14
-	vmovdqa	%xmm3,48(%r11)
-	vpmuludq	%xmm7,%xmm2,%xmm0
-	vpmuludq	%xmm6,%xmm2,%xmm1
-	vpaddq	%xmm0,%xmm13,%xmm13
-	vmovdqa	48(%rsp),%xmm3
-	vpaddq	%xmm1,%xmm12,%xmm12
-	vmovdqa	%xmm4,64(%r11)
-	vpmuludq	%xmm5,%xmm2,%xmm2
-	vpmuludq	%xmm7,%xmm3,%xmm0
-	vpaddq	%xmm2,%xmm11,%xmm11
-
-	vmovdqa	64(%rsp),%xmm4
-	vpaddq	%xmm0,%xmm14,%xmm14
-	vpmuludq	%xmm6,%xmm3,%xmm1
-	vpmuludq	%xmm5,%xmm3,%xmm3
-	vpaddq	%xmm1,%xmm13,%xmm13
-	vmovdqa	80(%rsp),%xmm2
-	vpaddq	%xmm3,%xmm12,%xmm12
-	vpmuludq	%xmm9,%xmm4,%xmm0
-	vpmuludq	%xmm8,%xmm4,%xmm4
-	vpaddq	%xmm0,%xmm11,%xmm11
-	vmovdqa	96(%rsp),%xmm3
-	vpaddq	%xmm4,%xmm10,%xmm10
-
-	vmovdqa	128(%rsp),%xmm4
-	vpmuludq	%xmm6,%xmm2,%xmm1
-	vpmuludq	%xmm5,%xmm2,%xmm2
-	vpaddq	%xmm1,%xmm14,%xmm14
-	vpaddq	%xmm2,%xmm13,%xmm13
-	vpmuludq	%xmm9,%xmm3,%xmm0
-	vpmuludq	%xmm8,%xmm3,%xmm1
-	vpaddq	%xmm0,%xmm12,%xmm12
-	vmovdqu	0(%rsi),%xmm0
-	vpaddq	%xmm1,%xmm11,%xmm11
-	vpmuludq	%xmm7,%xmm3,%xmm3
-	vpmuludq	%xmm7,%xmm4,%xmm7
-	vpaddq	%xmm3,%xmm10,%xmm10
-
-	vmovdqu	16(%rsi),%xmm1
-	vpaddq	%xmm7,%xmm11,%xmm11
-	vpmuludq	%xmm8,%xmm4,%xmm8
-	vpmuludq	%xmm9,%xmm4,%xmm9
-	vpsrldq	$6,%xmm0,%xmm2
-	vpaddq	%xmm8,%xmm12,%xmm12
-	vpaddq	%xmm9,%xmm13,%xmm13
-	vpsrldq	$6,%xmm1,%xmm3
-	vpmuludq	112(%rsp),%xmm5,%xmm9
-	vpmuludq	%xmm6,%xmm4,%xmm5
-	vpunpckhqdq	%xmm1,%xmm0,%xmm4
-	vpaddq	%xmm9,%xmm14,%xmm14
-	vmovdqa	-144(%r11),%xmm9
-	vpaddq	%xmm5,%xmm10,%xmm10
-
-	vpunpcklqdq	%xmm1,%xmm0,%xmm0
-	vpunpcklqdq	%xmm3,%xmm2,%xmm3
-
-
-	vpsrldq	$5,%xmm4,%xmm4
-	vpsrlq	$26,%xmm0,%xmm1
-	vpand	%xmm15,%xmm0,%xmm0
-	vpsrlq	$4,%xmm3,%xmm2
-	vpand	%xmm15,%xmm1,%xmm1
-	vpand	0(%rcx),%xmm4,%xmm4
-	vpsrlq	$30,%xmm3,%xmm3
-	vpand	%xmm15,%xmm2,%xmm2
-	vpand	%xmm15,%xmm3,%xmm3
-	vpor	32(%rcx),%xmm4,%xmm4
-
-	vpaddq	0(%r11),%xmm0,%xmm0
-	vpaddq	16(%r11),%xmm1,%xmm1
-	vpaddq	32(%r11),%xmm2,%xmm2
-	vpaddq	48(%r11),%xmm3,%xmm3
-	vpaddq	64(%r11),%xmm4,%xmm4
-
-	leaq	32(%rsi),%rax
-	leaq	64(%rsi),%rsi
-	subq	$64,%rdx
-	cmovcq	%rax,%rsi
-
-
-
-
-
-
-
-
-
-
-	vpmuludq	%xmm0,%xmm9,%xmm5
-	vpmuludq	%xmm1,%xmm9,%xmm6
-	vpaddq	%xmm5,%xmm10,%xmm10
-	vpaddq	%xmm6,%xmm11,%xmm11
-	vmovdqa	-128(%r11),%xmm7
-	vpmuludq	%xmm2,%xmm9,%xmm5
-	vpmuludq	%xmm3,%xmm9,%xmm6
-	vpaddq	%xmm5,%xmm12,%xmm12
-	vpaddq	%xmm6,%xmm13,%xmm13
-	vpmuludq	%xmm4,%xmm9,%xmm9
-	vpmuludq	-112(%r11),%xmm4,%xmm5
-	vpaddq	%xmm9,%xmm14,%xmm14
-
-	vpaddq	%xmm5,%xmm10,%xmm10
-	vpmuludq	%xmm2,%xmm7,%xmm6
-	vpmuludq	%xmm3,%xmm7,%xmm5
-	vpaddq	%xmm6,%xmm13,%xmm13
-	vmovdqa	-96(%r11),%xmm8
-	vpaddq	%xmm5,%xmm14,%xmm14
-	vpmuludq	%xmm1,%xmm7,%xmm6
-	vpmuludq	%xmm0,%xmm7,%xmm7
-	vpaddq	%xmm6,%xmm12,%xmm12
-	vpaddq	%xmm7,%xmm11,%xmm11
-
-	vmovdqa	-80(%r11),%xmm9
-	vpmuludq	%xmm2,%xmm8,%xmm5
-	vpmuludq	%xmm1,%xmm8,%xmm6
-	vpaddq	%xmm5,%xmm14,%xmm14
-	vpaddq	%xmm6,%xmm13,%xmm13
-	vmovdqa	-64(%r11),%xmm7
-	vpmuludq	%xmm0,%xmm8,%xmm8
-	vpmuludq	%xmm4,%xmm9,%xmm5
-	vpaddq	%xmm8,%xmm12,%xmm12
-	vpaddq	%xmm5,%xmm11,%xmm11
-	vmovdqa	-48(%r11),%xmm8
-	vpmuludq	%xmm3,%xmm9,%xmm9
-	vpmuludq	%xmm1,%xmm7,%xmm6
-	vpaddq	%xmm9,%xmm10,%xmm10
-
-	vmovdqa	-16(%r11),%xmm9
-	vpaddq	%xmm6,%xmm14,%xmm14
-	vpmuludq	%xmm0,%xmm7,%xmm7
-	vpmuludq	%xmm4,%xmm8,%xmm5
-	vpaddq	%xmm7,%xmm13,%xmm13
-	vpaddq	%xmm5,%xmm12,%xmm12
-	vmovdqu	32(%rsi),%xmm5
-	vpmuludq	%xmm3,%xmm8,%xmm7
-	vpmuludq	%xmm2,%xmm8,%xmm8
-	vpaddq	%xmm7,%xmm11,%xmm11
-	vmovdqu	48(%rsi),%xmm6
-	vpaddq	%xmm8,%xmm10,%xmm10
-
-	vpmuludq	%xmm2,%xmm9,%xmm2
-	vpmuludq	%xmm3,%xmm9,%xmm3
-	vpsrldq	$6,%xmm5,%xmm7
-	vpaddq	%xmm2,%xmm11,%xmm11
-	vpmuludq	%xmm4,%xmm9,%xmm4
-	vpsrldq	$6,%xmm6,%xmm8
-	vpaddq	%xmm3,%xmm12,%xmm2
-	vpaddq	%xmm4,%xmm13,%xmm3
-	vpmuludq	-32(%r11),%xmm0,%xmm4
-	vpmuludq	%xmm1,%xmm9,%xmm0
-	vpunpckhqdq	%xmm6,%xmm5,%xmm9
-	vpaddq	%xmm4,%xmm14,%xmm4
-	vpaddq	%xmm0,%xmm10,%xmm0
-
-	vpunpcklqdq	%xmm6,%xmm5,%xmm5
-	vpunpcklqdq	%xmm8,%xmm7,%xmm8
-
-
-	vpsrldq	$5,%xmm9,%xmm9
-	vpsrlq	$26,%xmm5,%xmm6
-	vmovdqa	0(%rsp),%xmm14
-	vpand	%xmm15,%xmm5,%xmm5
-	vpsrlq	$4,%xmm8,%xmm7
-	vpand	%xmm15,%xmm6,%xmm6
-	vpand	0(%rcx),%xmm9,%xmm9
-	vpsrlq	$30,%xmm8,%xmm8
-	vpand	%xmm15,%xmm7,%xmm7
-	vpand	%xmm15,%xmm8,%xmm8
-	vpor	32(%rcx),%xmm9,%xmm9
-
-
-
-
-
-	vpsrlq	$26,%xmm3,%xmm13
-	vpand	%xmm15,%xmm3,%xmm3
-	vpaddq	%xmm13,%xmm4,%xmm4
-
-	vpsrlq	$26,%xmm0,%xmm10
-	vpand	%xmm15,%xmm0,%xmm0
-	vpaddq	%xmm10,%xmm11,%xmm1
-
-	vpsrlq	$26,%xmm4,%xmm10
-	vpand	%xmm15,%xmm4,%xmm4
-
-	vpsrlq	$26,%xmm1,%xmm11
-	vpand	%xmm15,%xmm1,%xmm1
-	vpaddq	%xmm11,%xmm2,%xmm2
-
-	vpaddq	%xmm10,%xmm0,%xmm0
-	vpsllq	$2,%xmm10,%xmm10
-	vpaddq	%xmm10,%xmm0,%xmm0
-
-	vpsrlq	$26,%xmm2,%xmm12
-	vpand	%xmm15,%xmm2,%xmm2
-	vpaddq	%xmm12,%xmm3,%xmm3
-
-	vpsrlq	$26,%xmm0,%xmm10
-	vpand	%xmm15,%xmm0,%xmm0
-	vpaddq	%xmm10,%xmm1,%xmm1
-
-	vpsrlq	$26,%xmm3,%xmm13
-	vpand	%xmm15,%xmm3,%xmm3
-	vpaddq	%xmm13,%xmm4,%xmm4
-
-	ja	.Loop_avx
-
-.Lskip_loop_avx:
-
-
-
-	vpshufd	$0x10,%xmm14,%xmm14
-	addq	$32,%rdx
-	jnz	.Long_tail_avx
-
-	vpaddq	%xmm2,%xmm7,%xmm7
-	vpaddq	%xmm0,%xmm5,%xmm5
-	vpaddq	%xmm1,%xmm6,%xmm6
-	vpaddq	%xmm3,%xmm8,%xmm8
-	vpaddq	%xmm4,%xmm9,%xmm9
-
-.Long_tail_avx:
-	vmovdqa	%xmm2,32(%r11)
-	vmovdqa	%xmm0,0(%r11)
-	vmovdqa	%xmm1,16(%r11)
-	vmovdqa	%xmm3,48(%r11)
-	vmovdqa	%xmm4,64(%r11)
-
-
-
-
-
-
-
-	vpmuludq	%xmm7,%xmm14,%xmm12
-	vpmuludq	%xmm5,%xmm14,%xmm10
-	vpshufd	$0x10,-48(%rdi),%xmm2
-	vpmuludq	%xmm6,%xmm14,%xmm11
-	vpmuludq	%xmm8,%xmm14,%xmm13
-	vpmuludq	%xmm9,%xmm14,%xmm14
-
-	vpmuludq	%xmm8,%xmm2,%xmm0
-	vpaddq	%xmm0,%xmm14,%xmm14
-	vpshufd	$0x10,-32(%rdi),%xmm3
-	vpmuludq	%xmm7,%xmm2,%xmm1
-	vpaddq	%xmm1,%xmm13,%xmm13
-	vpshufd	$0x10,-16(%rdi),%xmm4
-	vpmuludq	%xmm6,%xmm2,%xmm0
-	vpaddq	%xmm0,%xmm12,%xmm12
-	vpmuludq	%xmm5,%xmm2,%xmm2
-	vpaddq	%xmm2,%xmm11,%xmm11
-	vpmuludq	%xmm9,%xmm3,%xmm3
-	vpaddq	%xmm3,%xmm10,%xmm10
-
-	vpshufd	$0x10,0(%rdi),%xmm2
-	vpmuludq	%xmm7,%xmm4,%xmm1
-	vpaddq	%xmm1,%xmm14,%xmm14
-	vpmuludq	%xmm6,%xmm4,%xmm0
-	vpaddq	%xmm0,%xmm13,%xmm13
-	vpshufd	$0x10,16(%rdi),%xmm3
-	vpmuludq	%xmm5,%xmm4,%xmm4
-	vpaddq	%xmm4,%xmm12,%xmm12
-	vpmuludq	%xmm9,%xmm2,%xmm1
-	vpaddq	%xmm1,%xmm11,%xmm11
-	vpshufd	$0x10,32(%rdi),%xmm4
-	vpmuludq	%xmm8,%xmm2,%xmm2
-	vpaddq	%xmm2,%xmm10,%xmm10
-
-	vpmuludq	%xmm6,%xmm3,%xmm0
-	vpaddq	%xmm0,%xmm14,%xmm14
-	vpmuludq	%xmm5,%xmm3,%xmm3
-	vpaddq	%xmm3,%xmm13,%xmm13
-	vpshufd	$0x10,48(%rdi),%xmm2
-	vpmuludq	%xmm9,%xmm4,%xmm1
-	vpaddq	%xmm1,%xmm12,%xmm12
-	vpshufd	$0x10,64(%rdi),%xmm3
-	vpmuludq	%xmm8,%xmm4,%xmm0
-	vpaddq	%xmm0,%xmm11,%xmm11
-	vpmuludq	%xmm7,%xmm4,%xmm4
-	vpaddq	%xmm4,%xmm10,%xmm10
-
-	vpmuludq	%xmm5,%xmm2,%xmm2
-	vpaddq	%xmm2,%xmm14,%xmm14
-	vpmuludq	%xmm9,%xmm3,%xmm1
-	vpaddq	%xmm1,%xmm13,%xmm13
-	vpmuludq	%xmm8,%xmm3,%xmm0
-	vpaddq	%xmm0,%xmm12,%xmm12
-	vpmuludq	%xmm7,%xmm3,%xmm1
-	vpaddq	%xmm1,%xmm11,%xmm11
-	vpmuludq	%xmm6,%xmm3,%xmm3
-	vpaddq	%xmm3,%xmm10,%xmm10
-
-	jz	.Lshort_tail_avx
-
-	vmovdqu	0(%rsi),%xmm0
-	vmovdqu	16(%rsi),%xmm1
-
-	vpsrldq	$6,%xmm0,%xmm2
-	vpsrldq	$6,%xmm1,%xmm3
-	vpunpckhqdq	%xmm1,%xmm0,%xmm4
-	vpunpcklqdq	%xmm1,%xmm0,%xmm0
-	vpunpcklqdq	%xmm3,%xmm2,%xmm3
-
-	vpsrlq	$40,%xmm4,%xmm4
-	vpsrlq	$26,%xmm0,%xmm1
-	vpand	%xmm15,%xmm0,%xmm0
-	vpsrlq	$4,%xmm3,%xmm2
-	vpand	%xmm15,%xmm1,%xmm1
-	vpsrlq	$30,%xmm3,%xmm3
-	vpand	%xmm15,%xmm2,%xmm2
-	vpand	%xmm15,%xmm3,%xmm3
-	vpor	32(%rcx),%xmm4,%xmm4
-
-	vpshufd	$0x32,-64(%rdi),%xmm9
-	vpaddq	0(%r11),%xmm0,%xmm0
-	vpaddq	16(%r11),%xmm1,%xmm1
-	vpaddq	32(%r11),%xmm2,%xmm2
-	vpaddq	48(%r11),%xmm3,%xmm3
-	vpaddq	64(%r11),%xmm4,%xmm4
-
-
-
-
-	vpmuludq	%xmm0,%xmm9,%xmm5
-	vpaddq	%xmm5,%xmm10,%xmm10
-	vpmuludq	%xmm1,%xmm9,%xmm6
-	vpaddq	%xmm6,%xmm11,%xmm11
-	vpmuludq	%xmm2,%xmm9,%xmm5
-	vpaddq	%xmm5,%xmm12,%xmm12
-	vpshufd	$0x32,-48(%rdi),%xmm7
-	vpmuludq	%xmm3,%xmm9,%xmm6
-	vpaddq	%xmm6,%xmm13,%xmm13
-	vpmuludq	%xmm4,%xmm9,%xmm9
-	vpaddq	%xmm9,%xmm14,%xmm14
-
-	vpmuludq	%xmm3,%xmm7,%xmm5
-	vpaddq	%xmm5,%xmm14,%xmm14
-	vpshufd	$0x32,-32(%rdi),%xmm8
-	vpmuludq	%xmm2,%xmm7,%xmm6
-	vpaddq	%xmm6,%xmm13,%xmm13
-	vpshufd	$0x32,-16(%rdi),%xmm9
-	vpmuludq	%xmm1,%xmm7,%xmm5
-	vpaddq	%xmm5,%xmm12,%xmm12
-	vpmuludq	%xmm0,%xmm7,%xmm7
-	vpaddq	%xmm7,%xmm11,%xmm11
-	vpmuludq	%xmm4,%xmm8,%xmm8
-	vpaddq	%xmm8,%xmm10,%xmm10
-
-	vpshufd	$0x32,0(%rdi),%xmm7
-	vpmuludq	%xmm2,%xmm9,%xmm6
-	vpaddq	%xmm6,%xmm14,%xmm14
-	vpmuludq	%xmm1,%xmm9,%xmm5
-	vpaddq	%xmm5,%xmm13,%xmm13
-	vpshufd	$0x32,16(%rdi),%xmm8
-	vpmuludq	%xmm0,%xmm9,%xmm9
-	vpaddq	%xmm9,%xmm12,%xmm12
-	vpmuludq	%xmm4,%xmm7,%xmm6
-	vpaddq	%xmm6,%xmm11,%xmm11
-	vpshufd	$0x32,32(%rdi),%xmm9
-	vpmuludq	%xmm3,%xmm7,%xmm7
-	vpaddq	%xmm7,%xmm10,%xmm10
-
-	vpmuludq	%xmm1,%xmm8,%xmm5
-	vpaddq	%xmm5,%xmm14,%xmm14
-	vpmuludq	%xmm0,%xmm8,%xmm8
-	vpaddq	%xmm8,%xmm13,%xmm13
-	vpshufd	$0x32,48(%rdi),%xmm7
-	vpmuludq	%xmm4,%xmm9,%xmm6
-	vpaddq	%xmm6,%xmm12,%xmm12
-	vpshufd	$0x32,64(%rdi),%xmm8
-	vpmuludq	%xmm3,%xmm9,%xmm5
-	vpaddq	%xmm5,%xmm11,%xmm11
-	vpmuludq	%xmm2,%xmm9,%xmm9
-	vpaddq	%xmm9,%xmm10,%xmm10
-
-	vpmuludq	%xmm0,%xmm7,%xmm7
-	vpaddq	%xmm7,%xmm14,%xmm14
-	vpmuludq	%xmm4,%xmm8,%xmm6
-	vpaddq	%xmm6,%xmm13,%xmm13
-	vpmuludq	%xmm3,%xmm8,%xmm5
-	vpaddq	%xmm5,%xmm12,%xmm12
-	vpmuludq	%xmm2,%xmm8,%xmm6
-	vpaddq	%xmm6,%xmm11,%xmm11
-	vpmuludq	%xmm1,%xmm8,%xmm8
-	vpaddq	%xmm8,%xmm10,%xmm10
-
-.Lshort_tail_avx:
-
-
-
-	vpsrldq	$8,%xmm14,%xmm9
-	vpsrldq	$8,%xmm13,%xmm8
-	vpsrldq	$8,%xmm11,%xmm6
-	vpsrldq	$8,%xmm10,%xmm5
-	vpsrldq	$8,%xmm12,%xmm7
-	vpaddq	%xmm8,%xmm13,%xmm13
-	vpaddq	%xmm9,%xmm14,%xmm14
-	vpaddq	%xmm5,%xmm10,%xmm10
-	vpaddq	%xmm6,%xmm11,%xmm11
-	vpaddq	%xmm7,%xmm12,%xmm12
-
-
-
-
-	vpsrlq	$26,%xmm13,%xmm3
-	vpand	%xmm15,%xmm13,%xmm13
-	vpaddq	%xmm3,%xmm14,%xmm14
-
-	vpsrlq	$26,%xmm10,%xmm0
-	vpand	%xmm15,%xmm10,%xmm10
-	vpaddq	%xmm0,%xmm11,%xmm11
-
-	vpsrlq	$26,%xmm14,%xmm4
-	vpand	%xmm15,%xmm14,%xmm14
-
-	vpsrlq	$26,%xmm11,%xmm1
-	vpand	%xmm15,%xmm11,%xmm11
-	vpaddq	%xmm1,%xmm12,%xmm12
-
-	vpaddq	%xmm4,%xmm10,%xmm10
-	vpsllq	$2,%xmm4,%xmm4
-	vpaddq	%xmm4,%xmm10,%xmm10
-
-	vpsrlq	$26,%xmm12,%xmm2
-	vpand	%xmm15,%xmm12,%xmm12
-	vpaddq	%xmm2,%xmm13,%xmm13
-
-	vpsrlq	$26,%xmm10,%xmm0
-	vpand	%xmm15,%xmm10,%xmm10
-	vpaddq	%xmm0,%xmm11,%xmm11
-
-	vpsrlq	$26,%xmm13,%xmm3
-	vpand	%xmm15,%xmm13,%xmm13
-	vpaddq	%xmm3,%xmm14,%xmm14
-
-	vmovd	%xmm10,-112(%rdi)
-	vmovd	%xmm11,-108(%rdi)
-	vmovd	%xmm12,-104(%rdi)
-	vmovd	%xmm13,-100(%rdi)
-	vmovd	%xmm14,-96(%rdi)
-	leaq	88(%r11),%rsp
-	vzeroupper
-	.byte	0xf3,0xc3
-.size	poly1305_blocks_avx,.-poly1305_blocks_avx
-
-.type	poly1305_emit_avx,@function
-.align	32
-poly1305_emit_avx:
-	cmpl	$0,20(%rdi)
-	je	.Lemit
-
-	movl	0(%rdi),%eax
-	movl	4(%rdi),%ecx
-	movl	8(%rdi),%r8d
-	movl	12(%rdi),%r11d
-	movl	16(%rdi),%r10d
-
-	shlq	$26,%rcx
-	movq	%r8,%r9
-	shlq	$52,%r8
-	addq	%rcx,%rax
-	shrq	$12,%r9
-	addq	%rax,%r8
-	adcq	$0,%r9
-
-	shlq	$14,%r11
-	movq	%r10,%rax
-	shrq	$24,%r10
-	addq	%r11,%r9
-	shlq	$40,%rax
-	addq	%rax,%r9
-	adcq	$0,%r10
-
-	movq	%r10,%rax
-	movq	%r10,%rcx
-	andq	$3,%r10
-	shrq	$2,%rax
-	andq	$-4,%rcx
-	addq	%rcx,%rax
-	addq	%rax,%r8
-	adcq	$0,%r9
-
-	movq	%r8,%rax
-	addq	$5,%r8
-	movq	%r9,%rcx
-	adcq	$0,%r9
-	adcq	$0,%r10
-	shrq	$2,%r10
-	cmovnzq	%r8,%rax
-	cmovnzq	%r9,%rcx
-
-	addq	0(%rdx),%rax
-	adcq	8(%rdx),%rcx
-	movq	%rax,0(%rsi)
-	movq	%rcx,8(%rsi)
-
-	.byte	0xf3,0xc3
-.size	poly1305_emit_avx,.-poly1305_emit_avx
-.type	poly1305_blocks_avx2,@function
-.align	32
-poly1305_blocks_avx2:
-	movl	20(%rdi),%r8d
-	cmpq	$128,%rdx
-	jae	.Lblocks_avx2
-	testl	%r8d,%r8d
-	jz	.Lblocks
-
-.Lblocks_avx2:
-	andq	$-16,%rdx
-	jz	.Lno_data_avx2
-
-	vzeroupper
-
-	testl	%r8d,%r8d
-	jz	.Lbase2_64_avx2
-
-	testq	$63,%rdx
-	jz	.Leven_avx2
-
-	pushq	%rbx
-	pushq	%rbp
-	pushq	%r12
-	pushq	%r13
-	pushq	%r14
-	pushq	%r15
-.Lblocks_avx2_body:
-
-	movq	%rdx,%r15
-
-	movq	0(%rdi),%r8
-	movq	8(%rdi),%r9
-	movl	16(%rdi),%ebp
-
-	movq	24(%rdi),%r11
-	movq	32(%rdi),%r13
-
-
-	movl	%r8d,%r14d
-	andq	$-1<<31,%r8
-	movq	%r9,%r12
-	movl	%r9d,%ebx
-	andq	$-1<<31,%r9
-
-	shrq	$6,%r8
-	shlq	$52,%r12
-	addq	%r8,%r14
-	shrq	$12,%rbx
-	shrq	$18,%r9
-	addq	%r12,%r14
-	adcq	%r9,%rbx
-
-	movq	%rbp,%r8
-	shlq	$40,%r8
-	shrq	$24,%rbp
-	addq	%r8,%rbx
-	adcq	$0,%rbp
-
-	movq	$-4,%r9
-	movq	%rbp,%r8
-	andq	%rbp,%r9
-	shrq	$2,%r8
-	andq	$3,%rbp
-	addq	%r9,%r8
-	addq	%r8,%r14
-	adcq	$0,%rbx
-
-	movq	%r13,%r12
-	movq	%r13,%rax
-	shrq	$2,%r13
-	addq	%r12,%r13
-
-.Lbase2_26_pre_avx2:
-	addq	0(%rsi),%r14
-	adcq	8(%rsi),%rbx
-	leaq	16(%rsi),%rsi
-	adcq	%rcx,%rbp
-	subq	$16,%r15
-
-	call	__poly1305_block
-	movq	%r12,%rax
-
-	testq	$63,%r15
-	jnz	.Lbase2_26_pre_avx2
-
-	testq	%rcx,%rcx
-	jz	.Lstore_base2_64_avx2
-
-
-	movq	%r14,%rax
-	movq	%r14,%rdx
-	shrq	$52,%r14
-	movq	%rbx,%r11
-	movq	%rbx,%r12
-	shrq	$26,%rdx
-	andq	$0x3ffffff,%rax
-	shlq	$12,%r11
-	andq	$0x3ffffff,%rdx
-	shrq	$14,%rbx
-	orq	%r11,%r14
-	shlq	$24,%rbp
-	andq	$0x3ffffff,%r14
-	shrq	$40,%r12
-	andq	$0x3ffffff,%rbx
-	orq	%r12,%rbp
-
-	testq	%r15,%r15
-	jz	.Lstore_base2_26_avx2
-
-	vmovd	%eax,%xmm0
-	vmovd	%edx,%xmm1
-	vmovd	%r14d,%xmm2
-	vmovd	%ebx,%xmm3
-	vmovd	%ebp,%xmm4
-	jmp	.Lproceed_avx2
-
-.align	32
-.Lstore_base2_64_avx2:
-	movq	%r14,0(%rdi)
-	movq	%rbx,8(%rdi)
-	movq	%rbp,16(%rdi)
-	jmp	.Ldone_avx2
-
-.align	16
-.Lstore_base2_26_avx2:
-	movl	%eax,0(%rdi)
-	movl	%edx,4(%rdi)
-	movl	%r14d,8(%rdi)
-	movl	%ebx,12(%rdi)
-	movl	%ebp,16(%rdi)
-.align	16
-.Ldone_avx2:
-	movq	0(%rsp),%r15
-	movq	8(%rsp),%r14
-	movq	16(%rsp),%r13
-	movq	24(%rsp),%r12
-	movq	32(%rsp),%rbp
-	movq	40(%rsp),%rbx
-	leaq	48(%rsp),%rsp
-.Lno_data_avx2:
-.Lblocks_avx2_epilogue:
-	.byte	0xf3,0xc3
-
-.align	32
-.Lbase2_64_avx2:
-	pushq	%rbx
-	pushq	%rbp
-	pushq	%r12
-	pushq	%r13
-	pushq	%r14
-	pushq	%r15
-.Lbase2_64_avx2_body:
-
-	movq	%rdx,%r15
-
-	movq	24(%rdi),%r11
-	movq	32(%rdi),%r13
-
-	movq	0(%rdi),%r14
-	movq	8(%rdi),%rbx
-	movl	16(%rdi),%ebp
-
-	movq	%r13,%r12
-	movq	%r13,%rax
-	shrq	$2,%r13
-	addq	%r12,%r13
-
-	testq	$63,%rdx
-	jz	.Linit_avx2
-
-.Lbase2_64_pre_avx2:
-	addq	0(%rsi),%r14
-	adcq	8(%rsi),%rbx
-	leaq	16(%rsi),%rsi
-	adcq	%rcx,%rbp
-	subq	$16,%r15
-
-	call	__poly1305_block
-	movq	%r12,%rax
-
-	testq	$63,%r15
-	jnz	.Lbase2_64_pre_avx2
-
-.Linit_avx2:
-
-	movq	%r14,%rax
-	movq	%r14,%rdx
-	shrq	$52,%r14
-	movq	%rbx,%r8
-	movq	%rbx,%r9
-	shrq	$26,%rdx
-	andq	$0x3ffffff,%rax
-	shlq	$12,%r8
-	andq	$0x3ffffff,%rdx
-	shrq	$14,%rbx
-	orq	%r8,%r14
-	shlq	$24,%rbp
-	andq	$0x3ffffff,%r14
-	shrq	$40,%r9
-	andq	$0x3ffffff,%rbx
-	orq	%r9,%rbp
-
-	vmovd	%eax,%xmm0
-	vmovd	%edx,%xmm1
-	vmovd	%r14d,%xmm2
-	vmovd	%ebx,%xmm3
-	vmovd	%ebp,%xmm4
-	movl	$1,20(%rdi)
-
-	call	__poly1305_init_avx
-
-.Lproceed_avx2:
-	movq	%r15,%rdx
-
-	movq	0(%rsp),%r15
-	movq	8(%rsp),%r14
-	movq	16(%rsp),%r13
-	movq	24(%rsp),%r12
-	movq	32(%rsp),%rbp
-	movq	40(%rsp),%rbx
-	leaq	48(%rsp),%rax
-	leaq	48(%rsp),%rsp
-.Lbase2_64_avx2_epilogue:
-	jmp	.Ldo_avx2
-
-.align	32
-.Leven_avx2:
-	vmovd	0(%rdi),%xmm0
-	vmovd	4(%rdi),%xmm1
-	vmovd	8(%rdi),%xmm2
-	vmovd	12(%rdi),%xmm3
-	vmovd	16(%rdi),%xmm4
-
-.Ldo_avx2:
-	leaq	-8(%rsp),%r11
-	subq	$0x128,%rsp
-	leaq	48+64(%rdi),%rdi
-	leaq	.Lconst(%rip),%rcx
-
-
-	vmovdqu	-64(%rdi),%xmm9
-	andq	$-512,%rsp
-	vmovdqu	-48(%rdi),%xmm10
-	vmovdqu	-32(%rdi),%xmm6
-	vmovdqu	-16(%rdi),%xmm11
-	vmovdqu	0(%rdi),%xmm12
-	vmovdqu	16(%rdi),%xmm13
-	vmovdqu	32(%rdi),%xmm14
-	vpermq	$0x15,%ymm9,%ymm9
-	vmovdqu	48(%rdi),%xmm15
-	vpermq	$0x15,%ymm10,%ymm10
-	vpshufd	$0xc8,%ymm9,%ymm9
-	vmovdqu	64(%rdi),%xmm5
-	vpermq	$0x15,%ymm6,%ymm6
-	vpshufd	$0xc8,%ymm10,%ymm10
-	vmovdqa	%ymm9,0(%rsp)
-	vpermq	$0x15,%ymm11,%ymm11
-	vpshufd	$0xc8,%ymm6,%ymm6
-	vmovdqa	%ymm10,32(%rsp)
-	vpermq	$0x15,%ymm12,%ymm12
-	vpshufd	$0xc8,%ymm11,%ymm11
-	vmovdqa	%ymm6,64(%rsp)
-	vpermq	$0x15,%ymm13,%ymm13
-	vpshufd	$0xc8,%ymm12,%ymm12
-	vmovdqa	%ymm11,96(%rsp)
-	vpermq	$0x15,%ymm14,%ymm14
-	vpshufd	$0xc8,%ymm13,%ymm13
-	vmovdqa	%ymm12,128(%rsp)
-	vpermq	$0x15,%ymm15,%ymm15
-	vpshufd	$0xc8,%ymm14,%ymm14
-	vmovdqa	%ymm13,160(%rsp)
-	vpermq	$0x15,%ymm5,%ymm5
-	vpshufd	$0xc8,%ymm15,%ymm15
-	vmovdqa	%ymm14,192(%rsp)
-	vpshufd	$0xc8,%ymm5,%ymm5
-	vmovdqa	%ymm15,224(%rsp)
-	vmovdqa	%ymm5,256(%rsp)
-	vmovdqa	64(%rcx),%ymm5
-
-
-
-	vmovdqu	0(%rsi),%xmm7
-	vmovdqu	16(%rsi),%xmm8
-	vinserti128	$1,32(%rsi),%ymm7,%ymm7
-	vinserti128	$1,48(%rsi),%ymm8,%ymm8
-	leaq	64(%rsi),%rsi
-
-	vpsrldq	$6,%ymm7,%ymm9
-	vpsrldq	$6,%ymm8,%ymm10
-	vpunpckhqdq	%ymm8,%ymm7,%ymm6
-	vpunpcklqdq	%ymm10,%ymm9,%ymm9
-	vpunpcklqdq	%ymm8,%ymm7,%ymm7
-
-	vpsrlq	$30,%ymm9,%ymm10
-	vpsrlq	$4,%ymm9,%ymm9
-	vpsrlq	$26,%ymm7,%ymm8
-	vpsrlq	$40,%ymm6,%ymm6
-	vpand	%ymm5,%ymm9,%ymm9
-	vpand	%ymm5,%ymm7,%ymm7
-	vpand	%ymm5,%ymm8,%ymm8
-	vpand	%ymm5,%ymm10,%ymm10
-	vpor	32(%rcx),%ymm6,%ymm6
-
-	leaq	144(%rsp),%rax
-	vpaddq	%ymm2,%ymm9,%ymm2
-	subq	$64,%rdx
-	jz	.Ltail_avx2
-	jmp	.Loop_avx2
-
-.align	32
-.Loop_avx2:
-
-
-
-
-
-
-
-
-	vpaddq	%ymm0,%ymm7,%ymm0
-	vmovdqa	0(%rsp),%ymm7
-	vpaddq	%ymm1,%ymm8,%ymm1
-	vmovdqa	32(%rsp),%ymm8
-	vpaddq	%ymm3,%ymm10,%ymm3
-	vmovdqa	96(%rsp),%ymm9
-	vpaddq	%ymm4,%ymm6,%ymm4
-	vmovdqa	48(%rax),%ymm10
-	vmovdqa	112(%rax),%ymm5
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-	vpmuludq	%ymm2,%ymm7,%ymm13
-	vpmuludq	%ymm2,%ymm8,%ymm14
-	vpmuludq	%ymm2,%ymm9,%ymm15
-	vpmuludq	%ymm2,%ymm10,%ymm11
-	vpmuludq	%ymm2,%ymm5,%ymm12
-
-	vpmuludq	%ymm0,%ymm8,%ymm6
-	vpmuludq	%ymm1,%ymm8,%ymm2
-	vpaddq	%ymm6,%ymm12,%ymm12
-	vpaddq	%ymm2,%ymm13,%ymm13
-	vpmuludq	%ymm3,%ymm8,%ymm6
-	vpmuludq	64(%rsp),%ymm4,%ymm2
-	vpaddq	%ymm6,%ymm15,%ymm15
-	vpaddq	%ymm2,%ymm11,%ymm11
-	vmovdqa	-16(%rax),%ymm8
-
-	vpmuludq	%ymm0,%ymm7,%ymm6
-	vpmuludq	%ymm1,%ymm7,%ymm2
-	vpaddq	%ymm6,%ymm11,%ymm11
-	vpaddq	%ymm2,%ymm12,%ymm12
-	vpmuludq	%ymm3,%ymm7,%ymm6
-	vpmuludq	%ymm4,%ymm7,%ymm2
-	vmovdqu	0(%rsi),%xmm7
-	vpaddq	%ymm6,%ymm14,%ymm14
-	vpaddq	%ymm2,%ymm15,%ymm15
-	vinserti128	$1,32(%rsi),%ymm7,%ymm7
-
-	vpmuludq	%ymm3,%ymm8,%ymm6
-	vpmuludq	%ymm4,%ymm8,%ymm2
-	vmovdqu	16(%rsi),%xmm8
-	vpaddq	%ymm6,%ymm11,%ymm11
-	vpaddq	%ymm2,%ymm12,%ymm12
-	vmovdqa	16(%rax),%ymm2
-	vpmuludq	%ymm1,%ymm9,%ymm6
-	vpmuludq	%ymm0,%ymm9,%ymm9
-	vpaddq	%ymm6,%ymm14,%ymm14
-	vpaddq	%ymm9,%ymm13,%ymm13
-	vinserti128	$1,48(%rsi),%ymm8,%ymm8
-	leaq	64(%rsi),%rsi
-
-	vpmuludq	%ymm1,%ymm2,%ymm6
-	vpmuludq	%ymm0,%ymm2,%ymm2
-	vpsrldq	$6,%ymm7,%ymm9
-	vpaddq	%ymm6,%ymm15,%ymm15
-	vpaddq	%ymm2,%ymm14,%ymm14
-	vpmuludq	%ymm3,%ymm10,%ymm6
-	vpmuludq	%ymm4,%ymm10,%ymm2
-	vpsrldq	$6,%ymm8,%ymm10
-	vpaddq	%ymm6,%ymm12,%ymm12
-	vpaddq	%ymm2,%ymm13,%ymm13
-	vpunpckhqdq	%ymm8,%ymm7,%ymm6
-
-	vpmuludq	%ymm3,%ymm5,%ymm3
-	vpmuludq	%ymm4,%ymm5,%ymm4
-	vpunpcklqdq	%ymm8,%ymm7,%ymm7
-	vpaddq	%ymm3,%ymm13,%ymm2
-	vpaddq	%ymm4,%ymm14,%ymm3
-	vpunpcklqdq	%ymm10,%ymm9,%ymm10
-	vpmuludq	80(%rax),%ymm0,%ymm4
-	vpmuludq	%ymm1,%ymm5,%ymm0
-	vmovdqa	64(%rcx),%ymm5
-	vpaddq	%ymm4,%ymm15,%ymm4
-	vpaddq	%ymm0,%ymm11,%ymm0
-
-
-
-
-	vpsrlq	$26,%ymm3,%ymm14
-	vpand	%ymm5,%ymm3,%ymm3
-	vpaddq	%ymm14,%ymm4,%ymm4
-
-	vpsrlq	$26,%ymm0,%ymm11
-	vpand	%ymm5,%ymm0,%ymm0
-	vpaddq	%ymm11,%ymm12,%ymm1
-
-	vpsrlq	$26,%ymm4,%ymm15
-	vpand	%ymm5,%ymm4,%ymm4
-
-	vpsrlq	$4,%ymm10,%ymm9
-
-	vpsrlq	$26,%ymm1,%ymm12
-	vpand	%ymm5,%ymm1,%ymm1
-	vpaddq	%ymm12,%ymm2,%ymm2
-
-	vpaddq	%ymm15,%ymm0,%ymm0
-	vpsllq	$2,%ymm15,%ymm15
-	vpaddq	%ymm15,%ymm0,%ymm0
-
-	vpand	%ymm5,%ymm9,%ymm9
-	vpsrlq	$26,%ymm7,%ymm8
-
-	vpsrlq	$26,%ymm2,%ymm13
-	vpand	%ymm5,%ymm2,%ymm2
-	vpaddq	%ymm13,%ymm3,%ymm3
-
-	vpaddq	%ymm9,%ymm2,%ymm2
-	vpsrlq	$30,%ymm10,%ymm10
-
-	vpsrlq	$26,%ymm0,%ymm11
-	vpand	%ymm5,%ymm0,%ymm0
-	vpaddq	%ymm11,%ymm1,%ymm1
-
-	vpsrlq	$40,%ymm6,%ymm6
-
-	vpsrlq	$26,%ymm3,%ymm14
-	vpand	%ymm5,%ymm3,%ymm3
-	vpaddq	%ymm14,%ymm4,%ymm4
-
-	vpand	%ymm5,%ymm7,%ymm7
-	vpand	%ymm5,%ymm8,%ymm8
-	vpand	%ymm5,%ymm10,%ymm10
-	vpor	32(%rcx),%ymm6,%ymm6
-
-	subq	$64,%rdx
-	jnz	.Loop_avx2
-
-.byte	0x66,0x90
-.Ltail_avx2:
-
-
-
-
-
-
-
-	vpaddq	%ymm0,%ymm7,%ymm0
-	vmovdqu	4(%rsp),%ymm7
-	vpaddq	%ymm1,%ymm8,%ymm1
-	vmovdqu	36(%rsp),%ymm8
-	vpaddq	%ymm3,%ymm10,%ymm3
-	vmovdqu	100(%rsp),%ymm9
-	vpaddq	%ymm4,%ymm6,%ymm4
-	vmovdqu	52(%rax),%ymm10
-	vmovdqu	116(%rax),%ymm5
-
-	vpmuludq	%ymm2,%ymm7,%ymm13
-	vpmuludq	%ymm2,%ymm8,%ymm14
-	vpmuludq	%ymm2,%ymm9,%ymm15
-	vpmuludq	%ymm2,%ymm10,%ymm11
-	vpmuludq	%ymm2,%ymm5,%ymm12
-
-	vpmuludq	%ymm0,%ymm8,%ymm6
-	vpmuludq	%ymm1,%ymm8,%ymm2
-	vpaddq	%ymm6,%ymm12,%ymm12
-	vpaddq	%ymm2,%ymm13,%ymm13
-	vpmuludq	%ymm3,%ymm8,%ymm6
-	vpmuludq	68(%rsp),%ymm4,%ymm2
-	vpaddq	%ymm6,%ymm15,%ymm15
-	vpaddq	%ymm2,%ymm11,%ymm11
-
-	vpmuludq	%ymm0,%ymm7,%ymm6
-	vpmuludq	%ymm1,%ymm7,%ymm2
-	vpaddq	%ymm6,%ymm11,%ymm11
-	vmovdqu	-12(%rax),%ymm8
-	vpaddq	%ymm2,%ymm12,%ymm12
-	vpmuludq	%ymm3,%ymm7,%ymm6
-	vpmuludq	%ymm4,%ymm7,%ymm2
-	vpaddq	%ymm6,%ymm14,%ymm14
-	vpaddq	%ymm2,%ymm15,%ymm15
-
-	vpmuludq	%ymm3,%ymm8,%ymm6
-	vpmuludq	%ymm4,%ymm8,%ymm2
-	vpaddq	%ymm6,%ymm11,%ymm11
-	vpaddq	%ymm2,%ymm12,%ymm12
-	vmovdqu	20(%rax),%ymm2
-	vpmuludq	%ymm1,%ymm9,%ymm6
-	vpmuludq	%ymm0,%ymm9,%ymm9
-	vpaddq	%ymm6,%ymm14,%ymm14
-	vpaddq	%ymm9,%ymm13,%ymm13
-
-	vpmuludq	%ymm1,%ymm2,%ymm6
-	vpmuludq	%ymm0,%ymm2,%ymm2
-	vpaddq	%ymm6,%ymm15,%ymm15
-	vpaddq	%ymm2,%ymm14,%ymm14
-	vpmuludq	%ymm3,%ymm10,%ymm6
-	vpmuludq	%ymm4,%ymm10,%ymm2
-	vpaddq	%ymm6,%ymm12,%ymm12
-	vpaddq	%ymm2,%ymm13,%ymm13
-
-	vpmuludq	%ymm3,%ymm5,%ymm3
-	vpmuludq	%ymm4,%ymm5,%ymm4
-	vpaddq	%ymm3,%ymm13,%ymm2
-	vpaddq	%ymm4,%ymm14,%ymm3
-	vpmuludq	84(%rax),%ymm0,%ymm4
-	vpmuludq	%ymm1,%ymm5,%ymm0
-	vmovdqa	64(%rcx),%ymm5
-	vpaddq	%ymm4,%ymm15,%ymm4
-	vpaddq	%ymm0,%ymm11,%ymm0
-
-
-
-
-	vpsrldq	$8,%ymm12,%ymm8
-	vpsrldq	$8,%ymm2,%ymm9
-	vpsrldq	$8,%ymm3,%ymm10
-	vpsrldq	$8,%ymm4,%ymm6
-	vpsrldq	$8,%ymm0,%ymm7
-	vpaddq	%ymm8,%ymm12,%ymm12
-	vpaddq	%ymm9,%ymm2,%ymm2
-	vpaddq	%ymm10,%ymm3,%ymm3
-	vpaddq	%ymm6,%ymm4,%ymm4
-	vpaddq	%ymm7,%ymm0,%ymm0
-
-	vpermq	$0x2,%ymm3,%ymm10
-	vpermq	$0x2,%ymm4,%ymm6
-	vpermq	$0x2,%ymm0,%ymm7
-	vpermq	$0x2,%ymm12,%ymm8
-	vpermq	$0x2,%ymm2,%ymm9
-	vpaddq	%ymm10,%ymm3,%ymm3
-	vpaddq	%ymm6,%ymm4,%ymm4
-	vpaddq	%ymm7,%ymm0,%ymm0
-	vpaddq	%ymm8,%ymm12,%ymm12
-	vpaddq	%ymm9,%ymm2,%ymm2
-
-
-
-
-	vpsrlq	$26,%ymm3,%ymm14
-	vpand	%ymm5,%ymm3,%ymm3
-	vpaddq	%ymm14,%ymm4,%ymm4
-
-	vpsrlq	$26,%ymm0,%ymm11
-	vpand	%ymm5,%ymm0,%ymm0
-	vpaddq	%ymm11,%ymm12,%ymm1
-
-	vpsrlq	$26,%ymm4,%ymm15
-	vpand	%ymm5,%ymm4,%ymm4
-
-	vpsrlq	$26,%ymm1,%ymm12
-	vpand	%ymm5,%ymm1,%ymm1
-	vpaddq	%ymm12,%ymm2,%ymm2
-
-	vpaddq	%ymm15,%ymm0,%ymm0
-	vpsllq	$2,%ymm15,%ymm15
-	vpaddq	%ymm15,%ymm0,%ymm0
-
-	vpsrlq	$26,%ymm2,%ymm13
-	vpand	%ymm5,%ymm2,%ymm2
-	vpaddq	%ymm13,%ymm3,%ymm3
-
-	vpsrlq	$26,%ymm0,%ymm11
-	vpand	%ymm5,%ymm0,%ymm0
-	vpaddq	%ymm11,%ymm1,%ymm1
-
-	vpsrlq	$26,%ymm3,%ymm14
-	vpand	%ymm5,%ymm3,%ymm3
-	vpaddq	%ymm14,%ymm4,%ymm4
-
-	vmovd	%xmm0,-112(%rdi)
-	vmovd	%xmm1,-108(%rdi)
-	vmovd	%xmm2,-104(%rdi)
-	vmovd	%xmm3,-100(%rdi)
-	vmovd	%xmm4,-96(%rdi)
-	leaq	8(%r11),%rsp
-	vzeroupper
-	.byte	0xf3,0xc3
-.size	poly1305_blocks_avx2,.-poly1305_blocks_avx2
-.align	64
-.Lconst:
-.Lmask24:
-.long	0x0ffffff,0,0x0ffffff,0,0x0ffffff,0,0x0ffffff,0
-.L129:
-.long	1<<24,0,1<<24,0,1<<24,0,1<<24,0
-.Lmask26:
-.long	0x3ffffff,0,0x3ffffff,0,0x3ffffff,0,0x3ffffff,0
-.Lfive:
-.long	5,0,5,0,5,0,5,0
-.byte	80,111,108,121,49,51,48,53,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
-.align	16
-#endif
diff --git a/third_party/boringssl/mac-x86/crypto/poly1305/poly1305-x86.S b/third_party/boringssl/mac-x86/crypto/poly1305/poly1305-x86.S
deleted file mode 100644
index 8c423a1..0000000
--- a/third_party/boringssl/mac-x86/crypto/poly1305/poly1305-x86.S
+++ /dev/null
@@ -1,1353 +0,0 @@
-#if defined(__i386__)
-.file	"poly1305-x86.S"
-.text
-.align	6,0x90
-.globl	_poly1305_init
-.private_extern	_poly1305_init
-.align	4
-_poly1305_init:
-L_poly1305_init_begin:
-	pushl	%ebp
-	pushl	%ebx
-	pushl	%esi
-	pushl	%edi
-	movl	20(%esp),%edi
-	movl	24(%esp),%esi
-	movl	28(%esp),%ebp
-	xorl	%eax,%eax
-	movl	%eax,(%edi)
-	movl	%eax,4(%edi)
-	movl	%eax,8(%edi)
-	movl	%eax,12(%edi)
-	movl	%eax,16(%edi)
-	movl	%eax,20(%edi)
-	cmpl	$0,%esi
-	je	L000nokey
-	call	L001pic_point
-L001pic_point:
-	popl	%ebx
-	leal	_poly1305_blocks-L001pic_point(%ebx),%eax
-	leal	_poly1305_emit-L001pic_point(%ebx),%edx
-	movl	L_OPENSSL_ia32cap_P$non_lazy_ptr-L001pic_point(%ebx),%edi
-	movl	(%edi),%ecx
-	andl	$83886080,%ecx
-	cmpl	$83886080,%ecx
-	jne	L002no_sse2
-	leal	__poly1305_blocks_sse2-L001pic_point(%ebx),%eax
-	leal	__poly1305_emit_sse2-L001pic_point(%ebx),%edx
-L002no_sse2:
-	movl	20(%esp),%edi
-	movl	%eax,(%ebp)
-	movl	%edx,4(%ebp)
-	movl	(%esi),%eax
-	movl	4(%esi),%ebx
-	movl	8(%esi),%ecx
-	movl	12(%esi),%edx
-	andl	$268435455,%eax
-	andl	$268435452,%ebx
-	andl	$268435452,%ecx
-	andl	$268435452,%edx
-	movl	%eax,24(%edi)
-	movl	%ebx,28(%edi)
-	movl	%ecx,32(%edi)
-	movl	%edx,36(%edi)
-	movl	$1,%eax
-L000nokey:
-	popl	%edi
-	popl	%esi
-	popl	%ebx
-	popl	%ebp
-	ret
-.globl	_poly1305_blocks
-.private_extern	_poly1305_blocks
-.align	4
-_poly1305_blocks:
-L_poly1305_blocks_begin:
-	pushl	%ebp
-	pushl	%ebx
-	pushl	%esi
-	pushl	%edi
-	movl	20(%esp),%edi
-	movl	24(%esp),%esi
-	movl	28(%esp),%ecx
-Lenter_blocks:
-	andl	$-15,%ecx
-	jz	L003nodata
-	subl	$64,%esp
-	movl	24(%edi),%eax
-	movl	28(%edi),%ebx
-	leal	(%esi,%ecx,1),%ebp
-	movl	32(%edi),%ecx
-	movl	36(%edi),%edx
-	movl	%ebp,92(%esp)
-	movl	%esi,%ebp
-	movl	%eax,36(%esp)
-	movl	%ebx,%eax
-	shrl	$2,%eax
-	movl	%ebx,40(%esp)
-	addl	%ebx,%eax
-	movl	%ecx,%ebx
-	shrl	$2,%ebx
-	movl	%ecx,44(%esp)
-	addl	%ecx,%ebx
-	movl	%edx,%ecx
-	shrl	$2,%ecx
-	movl	%edx,48(%esp)
-	addl	%edx,%ecx
-	movl	%eax,52(%esp)
-	movl	%ebx,56(%esp)
-	movl	%ecx,60(%esp)
-	movl	(%edi),%eax
-	movl	4(%edi),%ebx
-	movl	8(%edi),%ecx
-	movl	12(%edi),%esi
-	movl	16(%edi),%edi
-	jmp	L004loop
-.align	5,0x90
-L004loop:
-	addl	(%ebp),%eax
-	adcl	4(%ebp),%ebx
-	adcl	8(%ebp),%ecx
-	adcl	12(%ebp),%esi
-	leal	16(%ebp),%ebp
-	adcl	96(%esp),%edi
-	movl	%eax,(%esp)
-	movl	%esi,12(%esp)
-	mull	36(%esp)
-	movl	%edi,16(%esp)
-	movl	%eax,%edi
-	movl	%ebx,%eax
-	movl	%edx,%esi
-	mull	60(%esp)
-	addl	%eax,%edi
-	movl	%ecx,%eax
-	adcl	%edx,%esi
-	mull	56(%esp)
-	addl	%eax,%edi
-	movl	12(%esp),%eax
-	adcl	%edx,%esi
-	mull	52(%esp)
-	addl	%eax,%edi
-	movl	(%esp),%eax
-	adcl	%edx,%esi
-	mull	40(%esp)
-	movl	%edi,20(%esp)
-	xorl	%edi,%edi
-	addl	%eax,%esi
-	movl	%ebx,%eax
-	adcl	%edx,%edi
-	mull	36(%esp)
-	addl	%eax,%esi
-	movl	%ecx,%eax
-	adcl	%edx,%edi
-	mull	60(%esp)
-	addl	%eax,%esi
-	movl	12(%esp),%eax
-	adcl	%edx,%edi
-	mull	56(%esp)
-	addl	%eax,%esi
-	movl	16(%esp),%eax
-	adcl	%edx,%edi
-	imull	52(%esp),%eax
-	addl	%eax,%esi
-	movl	(%esp),%eax
-	adcl	$0,%edi
-	mull	44(%esp)
-	movl	%esi,24(%esp)
-	xorl	%esi,%esi
-	addl	%eax,%edi
-	movl	%ebx,%eax
-	adcl	%edx,%esi
-	mull	40(%esp)
-	addl	%eax,%edi
-	movl	%ecx,%eax
-	adcl	%edx,%esi
-	mull	36(%esp)
-	addl	%eax,%edi
-	movl	12(%esp),%eax
-	adcl	%edx,%esi
-	mull	60(%esp)
-	addl	%eax,%edi
-	movl	16(%esp),%eax
-	adcl	%edx,%esi
-	imull	56(%esp),%eax
-	addl	%eax,%edi
-	movl	(%esp),%eax
-	adcl	$0,%esi
-	mull	48(%esp)
-	movl	%edi,28(%esp)
-	xorl	%edi,%edi
-	addl	%eax,%esi
-	movl	%ebx,%eax
-	adcl	%edx,%edi
-	mull	44(%esp)
-	addl	%eax,%esi
-	movl	%ecx,%eax
-	adcl	%edx,%edi
-	mull	40(%esp)
-	addl	%eax,%esi
-	movl	12(%esp),%eax
-	adcl	%edx,%edi
-	mull	36(%esp)
-	addl	%eax,%esi
-	movl	16(%esp),%ecx
-	adcl	%edx,%edi
-	movl	%ecx,%edx
-	imull	60(%esp),%ecx
-	addl	%ecx,%esi
-	movl	20(%esp),%eax
-	adcl	$0,%edi
-	imull	36(%esp),%edx
-	addl	%edi,%edx
-	movl	24(%esp),%ebx
-	movl	28(%esp),%ecx
-	movl	%edx,%edi
-	shrl	$2,%edx
-	andl	$3,%edi
-	leal	(%edx,%edx,4),%edx
-	addl	%edx,%eax
-	adcl	$0,%ebx
-	adcl	$0,%ecx
-	adcl	$0,%esi
-	cmpl	92(%esp),%ebp
-	jne	L004loop
-	movl	84(%esp),%edx
-	addl	$64,%esp
-	movl	%eax,(%edx)
-	movl	%ebx,4(%edx)
-	movl	%ecx,8(%edx)
-	movl	%esi,12(%edx)
-	movl	%edi,16(%edx)
-L003nodata:
-	popl	%edi
-	popl	%esi
-	popl	%ebx
-	popl	%ebp
-	ret
-.globl	_poly1305_emit
-.private_extern	_poly1305_emit
-.align	4
-_poly1305_emit:
-L_poly1305_emit_begin:
-	pushl	%ebp
-	pushl	%ebx
-	pushl	%esi
-	pushl	%edi
-	movl	20(%esp),%ebp
-Lenter_emit:
-	movl	24(%esp),%edi
-	movl	(%ebp),%eax
-	movl	4(%ebp),%ebx
-	movl	8(%ebp),%ecx
-	movl	12(%ebp),%edx
-	movl	16(%ebp),%esi
-	addl	$5,%eax
-	adcl	$0,%ebx
-	adcl	$0,%ecx
-	adcl	$0,%edx
-	adcl	$0,%esi
-	shrl	$2,%esi
-	negl	%esi
-	andl	%esi,%eax
-	andl	%esi,%ebx
-	andl	%esi,%ecx
-	andl	%esi,%edx
-	movl	%eax,(%edi)
-	movl	%ebx,4(%edi)
-	movl	%ecx,8(%edi)
-	movl	%edx,12(%edi)
-	notl	%esi
-	movl	(%ebp),%eax
-	movl	4(%ebp),%ebx
-	movl	8(%ebp),%ecx
-	movl	12(%ebp),%edx
-	movl	28(%esp),%ebp
-	andl	%esi,%eax
-	andl	%esi,%ebx
-	andl	%esi,%ecx
-	andl	%esi,%edx
-	orl	(%edi),%eax
-	orl	4(%edi),%ebx
-	orl	8(%edi),%ecx
-	orl	12(%edi),%edx
-	addl	(%ebp),%eax
-	adcl	4(%ebp),%ebx
-	adcl	8(%ebp),%ecx
-	adcl	12(%ebp),%edx
-	movl	%eax,(%edi)
-	movl	%ebx,4(%edi)
-	movl	%ecx,8(%edi)
-	movl	%edx,12(%edi)
-	popl	%edi
-	popl	%esi
-	popl	%ebx
-	popl	%ebp
-	ret
-.align	5,0x90
-.private_extern	__poly1305_init_sse2
-.align	4
-__poly1305_init_sse2:
-	movdqu	24(%edi),%xmm4
-	leal	48(%edi),%edi
-	movl	%esp,%ebp
-	subl	$224,%esp
-	andl	$-16,%esp
-	movq	64(%ebx),%xmm7
-	movdqa	%xmm4,%xmm0
-	movdqa	%xmm4,%xmm1
-	movdqa	%xmm4,%xmm2
-	pand	%xmm7,%xmm0
-	psrlq	$26,%xmm1
-	psrldq	$6,%xmm2
-	pand	%xmm7,%xmm1
-	movdqa	%xmm2,%xmm3
-	psrlq	$4,%xmm2
-	psrlq	$30,%xmm3
-	pand	%xmm7,%xmm2
-	pand	%xmm7,%xmm3
-	psrldq	$13,%xmm4
-	leal	144(%esp),%edx
-	movl	$2,%ecx
-L005square:
-	movdqa	%xmm0,(%esp)
-	movdqa	%xmm1,16(%esp)
-	movdqa	%xmm2,32(%esp)
-	movdqa	%xmm3,48(%esp)
-	movdqa	%xmm4,64(%esp)
-	movdqa	%xmm1,%xmm6
-	movdqa	%xmm2,%xmm5
-	pslld	$2,%xmm6
-	pslld	$2,%xmm5
-	paddd	%xmm1,%xmm6
-	paddd	%xmm2,%xmm5
-	movdqa	%xmm6,80(%esp)
-	movdqa	%xmm5,96(%esp)
-	movdqa	%xmm3,%xmm6
-	movdqa	%xmm4,%xmm5
-	pslld	$2,%xmm6
-	pslld	$2,%xmm5
-	paddd	%xmm3,%xmm6
-	paddd	%xmm4,%xmm5
-	movdqa	%xmm6,112(%esp)
-	movdqa	%xmm5,128(%esp)
-	pshufd	$68,%xmm0,%xmm6
-	movdqa	%xmm1,%xmm5
-	pshufd	$68,%xmm1,%xmm1
-	pshufd	$68,%xmm2,%xmm2
-	pshufd	$68,%xmm3,%xmm3
-	pshufd	$68,%xmm4,%xmm4
-	movdqa	%xmm6,(%edx)
-	movdqa	%xmm1,16(%edx)
-	movdqa	%xmm2,32(%edx)
-	movdqa	%xmm3,48(%edx)
-	movdqa	%xmm4,64(%edx)
-	pmuludq	%xmm0,%xmm4
-	pmuludq	%xmm0,%xmm3
-	pmuludq	%xmm0,%xmm2
-	pmuludq	%xmm0,%xmm1
-	pmuludq	%xmm6,%xmm0
-	movdqa	%xmm5,%xmm6
-	pmuludq	48(%edx),%xmm5
-	movdqa	%xmm6,%xmm7
-	pmuludq	32(%edx),%xmm6
-	paddq	%xmm5,%xmm4
-	movdqa	%xmm7,%xmm5
-	pmuludq	16(%edx),%xmm7
-	paddq	%xmm6,%xmm3
-	movdqa	80(%esp),%xmm6
-	pmuludq	(%edx),%xmm5
-	paddq	%xmm7,%xmm2
-	pmuludq	64(%edx),%xmm6
-	movdqa	32(%esp),%xmm7
-	paddq	%xmm5,%xmm1
-	movdqa	%xmm7,%xmm5
-	pmuludq	32(%edx),%xmm7
-	paddq	%xmm6,%xmm0
-	movdqa	%xmm5,%xmm6
-	pmuludq	16(%edx),%xmm5
-	paddq	%xmm7,%xmm4
-	movdqa	96(%esp),%xmm7
-	pmuludq	(%edx),%xmm6
-	paddq	%xmm5,%xmm3
-	movdqa	%xmm7,%xmm5
-	pmuludq	64(%edx),%xmm7
-	paddq	%xmm6,%xmm2
-	pmuludq	48(%edx),%xmm5
-	movdqa	48(%esp),%xmm6
-	paddq	%xmm7,%xmm1
-	movdqa	%xmm6,%xmm7
-	pmuludq	16(%edx),%xmm6
-	paddq	%xmm5,%xmm0
-	movdqa	112(%esp),%xmm5
-	pmuludq	(%edx),%xmm7
-	paddq	%xmm6,%xmm4
-	movdqa	%xmm5,%xmm6
-	pmuludq	64(%edx),%xmm5
-	paddq	%xmm7,%xmm3
-	movdqa	%xmm6,%xmm7
-	pmuludq	48(%edx),%xmm6
-	paddq	%xmm5,%xmm2
-	pmuludq	32(%edx),%xmm7
-	movdqa	64(%esp),%xmm5
-	paddq	%xmm6,%xmm1
-	movdqa	128(%esp),%xmm6
-	pmuludq	(%edx),%xmm5
-	paddq	%xmm7,%xmm0
-	movdqa	%xmm6,%xmm7
-	pmuludq	64(%edx),%xmm6
-	paddq	%xmm5,%xmm4
-	movdqa	%xmm7,%xmm5
-	pmuludq	16(%edx),%xmm7
-	paddq	%xmm6,%xmm3
-	movdqa	%xmm5,%xmm6
-	pmuludq	32(%edx),%xmm5
-	paddq	%xmm7,%xmm0
-	pmuludq	48(%edx),%xmm6
-	movdqa	64(%ebx),%xmm7
-	paddq	%xmm5,%xmm1
-	paddq	%xmm6,%xmm2
-	movdqa	%xmm3,%xmm5
-	pand	%xmm7,%xmm3
-	psrlq	$26,%xmm5
-	paddq	%xmm4,%xmm5
-	movdqa	%xmm0,%xmm6
-	pand	%xmm7,%xmm0
-	psrlq	$26,%xmm6
-	movdqa	%xmm5,%xmm4
-	paddq	%xmm1,%xmm6
-	psrlq	$26,%xmm5
-	pand	%xmm7,%xmm4
-	movdqa	%xmm6,%xmm1
-	psrlq	$26,%xmm6
-	paddd	%xmm5,%xmm0
-	psllq	$2,%xmm5
-	paddq	%xmm2,%xmm6
-	paddd	%xmm0,%xmm5
-	pand	%xmm7,%xmm1
-	movdqa	%xmm6,%xmm2
-	psrlq	$26,%xmm6
-	pand	%xmm7,%xmm2
-	paddd	%xmm3,%xmm6
-	movdqa	%xmm5,%xmm0
-	psrlq	$26,%xmm5
-	movdqa	%xmm6,%xmm3
-	psrlq	$26,%xmm6
-	pand	%xmm7,%xmm0
-	paddd	%xmm5,%xmm1
-	pand	%xmm7,%xmm3
-	paddd	%xmm6,%xmm4
-	decl	%ecx
-	jz	L006square_break
-	punpcklqdq	(%esp),%xmm0
-	punpcklqdq	16(%esp),%xmm1
-	punpcklqdq	32(%esp),%xmm2
-	punpcklqdq	48(%esp),%xmm3
-	punpcklqdq	64(%esp),%xmm4
-	jmp	L005square
-L006square_break:
-	psllq	$32,%xmm0
-	psllq	$32,%xmm1
-	psllq	$32,%xmm2
-	psllq	$32,%xmm3
-	psllq	$32,%xmm4
-	por	(%esp),%xmm0
-	por	16(%esp),%xmm1
-	por	32(%esp),%xmm2
-	por	48(%esp),%xmm3
-	por	64(%esp),%xmm4
-	pshufd	$141,%xmm0,%xmm0
-	pshufd	$141,%xmm1,%xmm1
-	pshufd	$141,%xmm2,%xmm2
-	pshufd	$141,%xmm3,%xmm3
-	pshufd	$141,%xmm4,%xmm4
-	movdqu	%xmm0,(%edi)
-	movdqu	%xmm1,16(%edi)
-	movdqu	%xmm2,32(%edi)
-	movdqu	%xmm3,48(%edi)
-	movdqu	%xmm4,64(%edi)
-	movdqa	%xmm1,%xmm6
-	movdqa	%xmm2,%xmm5
-	pslld	$2,%xmm6
-	pslld	$2,%xmm5
-	paddd	%xmm1,%xmm6
-	paddd	%xmm2,%xmm5
-	movdqu	%xmm6,80(%edi)
-	movdqu	%xmm5,96(%edi)
-	movdqa	%xmm3,%xmm6
-	movdqa	%xmm4,%xmm5
-	pslld	$2,%xmm6
-	pslld	$2,%xmm5
-	paddd	%xmm3,%xmm6
-	paddd	%xmm4,%xmm5
-	movdqu	%xmm6,112(%edi)
-	movdqu	%xmm5,128(%edi)
-	movl	%ebp,%esp
-	leal	-48(%edi),%edi
-	ret
-.align	5,0x90
-.private_extern	__poly1305_blocks_sse2
-.align	4
-__poly1305_blocks_sse2:
-	pushl	%ebp
-	pushl	%ebx
-	pushl	%esi
-	pushl	%edi
-	movl	20(%esp),%edi
-	movl	24(%esp),%esi
-	movl	28(%esp),%ecx
-	movl	20(%edi),%eax
-	andl	$-16,%ecx
-	jz	L007nodata
-	cmpl	$64,%ecx
-	jae	L008enter_sse2
-	testl	%eax,%eax
-	jz	Lenter_blocks
-.align	4,0x90
-L008enter_sse2:
-	call	L009pic_point
-L009pic_point:
-	popl	%ebx
-	leal	Lconst_sse2-L009pic_point(%ebx),%ebx
-	testl	%eax,%eax
-	jnz	L010base2_26
-	call	__poly1305_init_sse2
-	movl	(%edi),%eax
-	movl	3(%edi),%ecx
-	movl	6(%edi),%edx
-	movl	9(%edi),%esi
-	movl	13(%edi),%ebp
-	movl	$1,20(%edi)
-	shrl	$2,%ecx
-	andl	$67108863,%eax
-	shrl	$4,%edx
-	andl	$67108863,%ecx
-	shrl	$6,%esi
-	andl	$67108863,%edx
-	movd	%eax,%xmm0
-	movd	%ecx,%xmm1
-	movd	%edx,%xmm2
-	movd	%esi,%xmm3
-	movd	%ebp,%xmm4
-	movl	24(%esp),%esi
-	movl	28(%esp),%ecx
-	jmp	L011base2_32
-.align	4,0x90
-L010base2_26:
-	movd	(%edi),%xmm0
-	movd	4(%edi),%xmm1
-	movd	8(%edi),%xmm2
-	movd	12(%edi),%xmm3
-	movd	16(%edi),%xmm4
-	movdqa	64(%ebx),%xmm7
-L011base2_32:
-	movl	32(%esp),%eax
-	movl	%esp,%ebp
-	subl	$528,%esp
-	andl	$-16,%esp
-	leal	48(%edi),%edi
-	shll	$24,%eax
-	testl	$31,%ecx
-	jz	L012even
-	movdqu	(%esi),%xmm6
-	leal	16(%esi),%esi
-	movdqa	%xmm6,%xmm5
-	pand	%xmm7,%xmm6
-	paddd	%xmm6,%xmm0
-	movdqa	%xmm5,%xmm6
-	psrlq	$26,%xmm5
-	psrldq	$6,%xmm6
-	pand	%xmm7,%xmm5
-	paddd	%xmm5,%xmm1
-	movdqa	%xmm6,%xmm5
-	psrlq	$4,%xmm6
-	pand	%xmm7,%xmm6
-	paddd	%xmm6,%xmm2
-	movdqa	%xmm5,%xmm6
-	psrlq	$30,%xmm5
-	pand	%xmm7,%xmm5
-	psrldq	$7,%xmm6
-	paddd	%xmm5,%xmm3
-	movd	%eax,%xmm5
-	paddd	%xmm6,%xmm4
-	movd	12(%edi),%xmm6
-	paddd	%xmm5,%xmm4
-	movdqa	%xmm0,(%esp)
-	movdqa	%xmm1,16(%esp)
-	movdqa	%xmm2,32(%esp)
-	movdqa	%xmm3,48(%esp)
-	movdqa	%xmm4,64(%esp)
-	pmuludq	%xmm6,%xmm0
-	pmuludq	%xmm6,%xmm1
-	pmuludq	%xmm6,%xmm2
-	movd	28(%edi),%xmm5
-	pmuludq	%xmm6,%xmm3
-	pmuludq	%xmm6,%xmm4
-	movdqa	%xmm5,%xmm6
-	pmuludq	48(%esp),%xmm5
-	movdqa	%xmm6,%xmm7
-	pmuludq	32(%esp),%xmm6
-	paddq	%xmm5,%xmm4
-	movdqa	%xmm7,%xmm5
-	pmuludq	16(%esp),%xmm7
-	paddq	%xmm6,%xmm3
-	movd	92(%edi),%xmm6
-	pmuludq	(%esp),%xmm5
-	paddq	%xmm7,%xmm2
-	pmuludq	64(%esp),%xmm6
-	movd	44(%edi),%xmm7
-	paddq	%xmm5,%xmm1
-	movdqa	%xmm7,%xmm5
-	pmuludq	32(%esp),%xmm7
-	paddq	%xmm6,%xmm0
-	movdqa	%xmm5,%xmm6
-	pmuludq	16(%esp),%xmm5
-	paddq	%xmm7,%xmm4
-	movd	108(%edi),%xmm7
-	pmuludq	(%esp),%xmm6
-	paddq	%xmm5,%xmm3
-	movdqa	%xmm7,%xmm5
-	pmuludq	64(%esp),%xmm7
-	paddq	%xmm6,%xmm2
-	pmuludq	48(%esp),%xmm5
-	movd	60(%edi),%xmm6
-	paddq	%xmm7,%xmm1
-	movdqa	%xmm6,%xmm7
-	pmuludq	16(%esp),%xmm6
-	paddq	%xmm5,%xmm0
-	movd	124(%edi),%xmm5
-	pmuludq	(%esp),%xmm7
-	paddq	%xmm6,%xmm4
-	movdqa	%xmm5,%xmm6
-	pmuludq	64(%esp),%xmm5
-	paddq	%xmm7,%xmm3
-	movdqa	%xmm6,%xmm7
-	pmuludq	48(%esp),%xmm6
-	paddq	%xmm5,%xmm2
-	pmuludq	32(%esp),%xmm7
-	movd	76(%edi),%xmm5
-	paddq	%xmm6,%xmm1
-	movd	140(%edi),%xmm6
-	pmuludq	(%esp),%xmm5
-	paddq	%xmm7,%xmm0
-	movdqa	%xmm6,%xmm7
-	pmuludq	64(%esp),%xmm6
-	paddq	%xmm5,%xmm4
-	movdqa	%xmm7,%xmm5
-	pmuludq	16(%esp),%xmm7
-	paddq	%xmm6,%xmm3
-	movdqa	%xmm5,%xmm6
-	pmuludq	32(%esp),%xmm5
-	paddq	%xmm7,%xmm0
-	pmuludq	48(%esp),%xmm6
-	movdqa	64(%ebx),%xmm7
-	paddq	%xmm5,%xmm1
-	paddq	%xmm6,%xmm2
-	movdqa	%xmm3,%xmm5
-	pand	%xmm7,%xmm3
-	psrlq	$26,%xmm5
-	paddq	%xmm4,%xmm5
-	movdqa	%xmm0,%xmm6
-	pand	%xmm7,%xmm0
-	psrlq	$26,%xmm6
-	movdqa	%xmm5,%xmm4
-	paddq	%xmm1,%xmm6
-	psrlq	$26,%xmm5
-	pand	%xmm7,%xmm4
-	movdqa	%xmm6,%xmm1
-	psrlq	$26,%xmm6
-	paddd	%xmm5,%xmm0
-	psllq	$2,%xmm5
-	paddq	%xmm2,%xmm6
-	paddd	%xmm0,%xmm5
-	pand	%xmm7,%xmm1
-	movdqa	%xmm6,%xmm2
-	psrlq	$26,%xmm6
-	pand	%xmm7,%xmm2
-	paddd	%xmm3,%xmm6
-	movdqa	%xmm5,%xmm0
-	psrlq	$26,%xmm5
-	movdqa	%xmm6,%xmm3
-	psrlq	$26,%xmm6
-	pand	%xmm7,%xmm0
-	paddd	%xmm5,%xmm1
-	pand	%xmm7,%xmm3
-	paddd	%xmm6,%xmm4
-	subl	$16,%ecx
-	jz	L013done
-L012even:
-	leal	384(%esp),%edx
-	leal	-32(%esi),%eax
-	subl	$64,%ecx
-	movdqu	(%edi),%xmm5
-	pshufd	$68,%xmm5,%xmm6
-	cmovbl	%eax,%esi
-	pshufd	$238,%xmm5,%xmm5
-	movdqa	%xmm6,(%edx)
-	leal	160(%esp),%eax
-	movdqu	16(%edi),%xmm6
-	movdqa	%xmm5,-144(%edx)
-	pshufd	$68,%xmm6,%xmm5
-	pshufd	$238,%xmm6,%xmm6
-	movdqa	%xmm5,16(%edx)
-	movdqu	32(%edi),%xmm5
-	movdqa	%xmm6,-128(%edx)
-	pshufd	$68,%xmm5,%xmm6
-	pshufd	$238,%xmm5,%xmm5
-	movdqa	%xmm6,32(%edx)
-	movdqu	48(%edi),%xmm6
-	movdqa	%xmm5,-112(%edx)
-	pshufd	$68,%xmm6,%xmm5
-	pshufd	$238,%xmm6,%xmm6
-	movdqa	%xmm5,48(%edx)
-	movdqu	64(%edi),%xmm5
-	movdqa	%xmm6,-96(%edx)
-	pshufd	$68,%xmm5,%xmm6
-	pshufd	$238,%xmm5,%xmm5
-	movdqa	%xmm6,64(%edx)
-	movdqu	80(%edi),%xmm6
-	movdqa	%xmm5,-80(%edx)
-	pshufd	$68,%xmm6,%xmm5
-	pshufd	$238,%xmm6,%xmm6
-	movdqa	%xmm5,80(%edx)
-	movdqu	96(%edi),%xmm5
-	movdqa	%xmm6,-64(%edx)
-	pshufd	$68,%xmm5,%xmm6
-	pshufd	$238,%xmm5,%xmm5
-	movdqa	%xmm6,96(%edx)
-	movdqu	112(%edi),%xmm6
-	movdqa	%xmm5,-48(%edx)
-	pshufd	$68,%xmm6,%xmm5
-	pshufd	$238,%xmm6,%xmm6
-	movdqa	%xmm5,112(%edx)
-	movdqu	128(%edi),%xmm5
-	movdqa	%xmm6,-32(%edx)
-	pshufd	$68,%xmm5,%xmm6
-	pshufd	$238,%xmm5,%xmm5
-	movdqa	%xmm6,128(%edx)
-	movdqa	%xmm5,-16(%edx)
-	movdqu	32(%esi),%xmm5
-	movdqu	48(%esi),%xmm6
-	leal	32(%esi),%esi
-	movdqa	%xmm2,112(%esp)
-	movdqa	%xmm3,128(%esp)
-	movdqa	%xmm4,144(%esp)
-	movdqa	%xmm5,%xmm2
-	movdqa	%xmm6,%xmm3
-	psrldq	$6,%xmm2
-	psrldq	$6,%xmm3
-	movdqa	%xmm5,%xmm4
-	punpcklqdq	%xmm3,%xmm2
-	punpckhqdq	%xmm6,%xmm4
-	punpcklqdq	%xmm6,%xmm5
-	movdqa	%xmm2,%xmm3
-	psrlq	$4,%xmm2
-	psrlq	$30,%xmm3
-	movdqa	%xmm5,%xmm6
-	psrlq	$40,%xmm4
-	psrlq	$26,%xmm6
-	pand	%xmm7,%xmm5
-	pand	%xmm7,%xmm6
-	pand	%xmm7,%xmm2
-	pand	%xmm7,%xmm3
-	por	(%ebx),%xmm4
-	movdqa	%xmm0,80(%esp)
-	movdqa	%xmm1,96(%esp)
-	jbe	L014skip_loop
-	jmp	L015loop
-.align	5,0x90
-L015loop:
-	movdqa	-144(%edx),%xmm7
-	movdqa	%xmm6,16(%eax)
-	movdqa	%xmm2,32(%eax)
-	movdqa	%xmm3,48(%eax)
-	movdqa	%xmm4,64(%eax)
-	movdqa	%xmm5,%xmm1
-	pmuludq	%xmm7,%xmm5
-	movdqa	%xmm6,%xmm0
-	pmuludq	%xmm7,%xmm6
-	pmuludq	%xmm7,%xmm2
-	pmuludq	%xmm7,%xmm3
-	pmuludq	%xmm7,%xmm4
-	pmuludq	-16(%edx),%xmm0
-	movdqa	%xmm1,%xmm7
-	pmuludq	-128(%edx),%xmm1
-	paddq	%xmm5,%xmm0
-	movdqa	%xmm7,%xmm5
-	pmuludq	-112(%edx),%xmm7
-	paddq	%xmm6,%xmm1
-	movdqa	%xmm5,%xmm6
-	pmuludq	-96(%edx),%xmm5
-	paddq	%xmm7,%xmm2
-	movdqa	16(%eax),%xmm7
-	pmuludq	-80(%edx),%xmm6
-	paddq	%xmm5,%xmm3
-	movdqa	%xmm7,%xmm5
-	pmuludq	-128(%edx),%xmm7
-	paddq	%xmm6,%xmm4
-	movdqa	%xmm5,%xmm6
-	pmuludq	-112(%edx),%xmm5
-	paddq	%xmm7,%xmm2
-	movdqa	32(%eax),%xmm7
-	pmuludq	-96(%edx),%xmm6
-	paddq	%xmm5,%xmm3
-	movdqa	%xmm7,%xmm5
-	pmuludq	-32(%edx),%xmm7
-	paddq	%xmm6,%xmm4
-	movdqa	%xmm5,%xmm6
-	pmuludq	-16(%edx),%xmm5
-	paddq	%xmm7,%xmm0
-	movdqa	%xmm6,%xmm7
-	pmuludq	-128(%edx),%xmm6
-	paddq	%xmm5,%xmm1
-	movdqa	48(%eax),%xmm5
-	pmuludq	-112(%edx),%xmm7
-	paddq	%xmm6,%xmm3
-	movdqa	%xmm5,%xmm6
-	pmuludq	-48(%edx),%xmm5
-	paddq	%xmm7,%xmm4
-	movdqa	%xmm6,%xmm7
-	pmuludq	-32(%edx),%xmm6
-	paddq	%xmm5,%xmm0
-	movdqa	%xmm7,%xmm5
-	pmuludq	-16(%edx),%xmm7
-	paddq	%xmm6,%xmm1
-	movdqa	64(%eax),%xmm6
-	pmuludq	-128(%edx),%xmm5
-	paddq	%xmm7,%xmm2
-	movdqa	%xmm6,%xmm7
-	pmuludq	-16(%edx),%xmm6
-	paddq	%xmm5,%xmm4
-	movdqa	%xmm7,%xmm5
-	pmuludq	-64(%edx),%xmm7
-	paddq	%xmm6,%xmm3
-	movdqa	%xmm5,%xmm6
-	pmuludq	-48(%edx),%xmm5
-	paddq	%xmm7,%xmm0
-	movdqa	64(%ebx),%xmm7
-	pmuludq	-32(%edx),%xmm6
-	paddq	%xmm5,%xmm1
-	paddq	%xmm6,%xmm2
-	movdqu	-32(%esi),%xmm5
-	movdqu	-16(%esi),%xmm6
-	leal	32(%esi),%esi
-	movdqa	%xmm2,32(%esp)
-	movdqa	%xmm3,48(%esp)
-	movdqa	%xmm4,64(%esp)
-	movdqa	%xmm5,%xmm2
-	movdqa	%xmm6,%xmm3
-	psrldq	$6,%xmm2
-	psrldq	$6,%xmm3
-	movdqa	%xmm5,%xmm4
-	punpcklqdq	%xmm3,%xmm2
-	punpckhqdq	%xmm6,%xmm4
-	punpcklqdq	%xmm6,%xmm5
-	movdqa	%xmm2,%xmm3
-	psrlq	$4,%xmm2
-	psrlq	$30,%xmm3
-	movdqa	%xmm5,%xmm6
-	psrlq	$40,%xmm4
-	psrlq	$26,%xmm6
-	pand	%xmm7,%xmm5
-	pand	%xmm7,%xmm6
-	pand	%xmm7,%xmm2
-	pand	%xmm7,%xmm3
-	por	(%ebx),%xmm4
-	leal	-32(%esi),%eax
-	subl	$64,%ecx
-	paddd	80(%esp),%xmm5
-	paddd	96(%esp),%xmm6
-	paddd	112(%esp),%xmm2
-	paddd	128(%esp),%xmm3
-	paddd	144(%esp),%xmm4
-	cmovbl	%eax,%esi
-	leal	160(%esp),%eax
-	movdqa	(%edx),%xmm7
-	movdqa	%xmm1,16(%esp)
-	movdqa	%xmm6,16(%eax)
-	movdqa	%xmm2,32(%eax)
-	movdqa	%xmm3,48(%eax)
-	movdqa	%xmm4,64(%eax)
-	movdqa	%xmm5,%xmm1
-	pmuludq	%xmm7,%xmm5
-	paddq	%xmm0,%xmm5
-	movdqa	%xmm6,%xmm0
-	pmuludq	%xmm7,%xmm6
-	pmuludq	%xmm7,%xmm2
-	pmuludq	%xmm7,%xmm3
-	pmuludq	%xmm7,%xmm4
-	paddq	16(%esp),%xmm6
-	paddq	32(%esp),%xmm2
-	paddq	48(%esp),%xmm3
-	paddq	64(%esp),%xmm4
-	pmuludq	128(%edx),%xmm0
-	movdqa	%xmm1,%xmm7
-	pmuludq	16(%edx),%xmm1
-	paddq	%xmm5,%xmm0
-	movdqa	%xmm7,%xmm5
-	pmuludq	32(%edx),%xmm7
-	paddq	%xmm6,%xmm1
-	movdqa	%xmm5,%xmm6
-	pmuludq	48(%edx),%xmm5
-	paddq	%xmm7,%xmm2
-	movdqa	16(%eax),%xmm7
-	pmuludq	64(%edx),%xmm6
-	paddq	%xmm5,%xmm3
-	movdqa	%xmm7,%xmm5
-	pmuludq	16(%edx),%xmm7
-	paddq	%xmm6,%xmm4
-	movdqa	%xmm5,%xmm6
-	pmuludq	32(%edx),%xmm5
-	paddq	%xmm7,%xmm2
-	movdqa	32(%eax),%xmm7
-	pmuludq	48(%edx),%xmm6
-	paddq	%xmm5,%xmm3
-	movdqa	%xmm7,%xmm5
-	pmuludq	112(%edx),%xmm7
-	paddq	%xmm6,%xmm4
-	movdqa	%xmm5,%xmm6
-	pmuludq	128(%edx),%xmm5
-	paddq	%xmm7,%xmm0
-	movdqa	%xmm6,%xmm7
-	pmuludq	16(%edx),%xmm6
-	paddq	%xmm5,%xmm1
-	movdqa	48(%eax),%xmm5
-	pmuludq	32(%edx),%xmm7
-	paddq	%xmm6,%xmm3
-	movdqa	%xmm5,%xmm6
-	pmuludq	96(%edx),%xmm5
-	paddq	%xmm7,%xmm4
-	movdqa	%xmm6,%xmm7
-	pmuludq	112(%edx),%xmm6
-	paddq	%xmm5,%xmm0
-	movdqa	%xmm7,%xmm5
-	pmuludq	128(%edx),%xmm7
-	paddq	%xmm6,%xmm1
-	movdqa	64(%eax),%xmm6
-	pmuludq	16(%edx),%xmm5
-	paddq	%xmm7,%xmm2
-	movdqa	%xmm6,%xmm7
-	pmuludq	128(%edx),%xmm6
-	paddq	%xmm5,%xmm4
-	movdqa	%xmm7,%xmm5
-	pmuludq	80(%edx),%xmm7
-	paddq	%xmm6,%xmm3
-	movdqa	%xmm5,%xmm6
-	pmuludq	96(%edx),%xmm5
-	paddq	%xmm7,%xmm0
-	movdqa	64(%ebx),%xmm7
-	pmuludq	112(%edx),%xmm6
-	paddq	%xmm5,%xmm1
-	paddq	%xmm6,%xmm2
-	movdqa	%xmm3,%xmm5
-	pand	%xmm7,%xmm3
-	psrlq	$26,%xmm5
-	paddq	%xmm4,%xmm5
-	movdqa	%xmm0,%xmm6
-	pand	%xmm7,%xmm0
-	psrlq	$26,%xmm6
-	movdqa	%xmm5,%xmm4
-	paddq	%xmm1,%xmm6
-	psrlq	$26,%xmm5
-	pand	%xmm7,%xmm4
-	movdqa	%xmm6,%xmm1
-	psrlq	$26,%xmm6
-	paddd	%xmm5,%xmm0
-	psllq	$2,%xmm5
-	paddq	%xmm2,%xmm6
-	paddd	%xmm0,%xmm5
-	pand	%xmm7,%xmm1
-	movdqa	%xmm6,%xmm2
-	psrlq	$26,%xmm6
-	pand	%xmm7,%xmm2
-	paddd	%xmm3,%xmm6
-	movdqa	%xmm5,%xmm0
-	psrlq	$26,%xmm5
-	movdqa	%xmm6,%xmm3
-	psrlq	$26,%xmm6
-	pand	%xmm7,%xmm0
-	paddd	%xmm5,%xmm1
-	pand	%xmm7,%xmm3
-	paddd	%xmm6,%xmm4
-	movdqu	32(%esi),%xmm5
-	movdqu	48(%esi),%xmm6
-	leal	32(%esi),%esi
-	movdqa	%xmm2,112(%esp)
-	movdqa	%xmm3,128(%esp)
-	movdqa	%xmm4,144(%esp)
-	movdqa	%xmm5,%xmm2
-	movdqa	%xmm6,%xmm3
-	psrldq	$6,%xmm2
-	psrldq	$6,%xmm3
-	movdqa	%xmm5,%xmm4
-	punpcklqdq	%xmm3,%xmm2
-	punpckhqdq	%xmm6,%xmm4
-	punpcklqdq	%xmm6,%xmm5
-	movdqa	%xmm2,%xmm3
-	psrlq	$4,%xmm2
-	psrlq	$30,%xmm3
-	movdqa	%xmm5,%xmm6
-	psrlq	$40,%xmm4
-	psrlq	$26,%xmm6
-	pand	%xmm7,%xmm5
-	pand	%xmm7,%xmm6
-	pand	%xmm7,%xmm2
-	pand	%xmm7,%xmm3
-	por	(%ebx),%xmm4
-	movdqa	%xmm0,80(%esp)
-	movdqa	%xmm1,96(%esp)
-	ja	L015loop
-L014skip_loop:
-	pshufd	$16,-144(%edx),%xmm7
-	addl	$32,%ecx
-	jnz	L016long_tail
-	paddd	%xmm0,%xmm5
-	paddd	%xmm1,%xmm6
-	paddd	112(%esp),%xmm2
-	paddd	128(%esp),%xmm3
-	paddd	144(%esp),%xmm4
-L016long_tail:
-	movdqa	%xmm5,(%eax)
-	movdqa	%xmm6,16(%eax)
-	movdqa	%xmm2,32(%eax)
-	movdqa	%xmm3,48(%eax)
-	movdqa	%xmm4,64(%eax)
-	pmuludq	%xmm7,%xmm5
-	pmuludq	%xmm7,%xmm6
-	pmuludq	%xmm7,%xmm2
-	movdqa	%xmm5,%xmm0
-	pshufd	$16,-128(%edx),%xmm5
-	pmuludq	%xmm7,%xmm3
-	movdqa	%xmm6,%xmm1
-	pmuludq	%xmm7,%xmm4
-	movdqa	%xmm5,%xmm6
-	pmuludq	48(%eax),%xmm5
-	movdqa	%xmm6,%xmm7
-	pmuludq	32(%eax),%xmm6
-	paddq	%xmm5,%xmm4
-	movdqa	%xmm7,%xmm5
-	pmuludq	16(%eax),%xmm7
-	paddq	%xmm6,%xmm3
-	pshufd	$16,-64(%edx),%xmm6
-	pmuludq	(%eax),%xmm5
-	paddq	%xmm7,%xmm2
-	pmuludq	64(%eax),%xmm6
-	pshufd	$16,-112(%edx),%xmm7
-	paddq	%xmm5,%xmm1
-	movdqa	%xmm7,%xmm5
-	pmuludq	32(%eax),%xmm7
-	paddq	%xmm6,%xmm0
-	movdqa	%xmm5,%xmm6
-	pmuludq	16(%eax),%xmm5
-	paddq	%xmm7,%xmm4
-	pshufd	$16,-48(%edx),%xmm7
-	pmuludq	(%eax),%xmm6
-	paddq	%xmm5,%xmm3
-	movdqa	%xmm7,%xmm5
-	pmuludq	64(%eax),%xmm7
-	paddq	%xmm6,%xmm2
-	pmuludq	48(%eax),%xmm5
-	pshufd	$16,-96(%edx),%xmm6
-	paddq	%xmm7,%xmm1
-	movdqa	%xmm6,%xmm7
-	pmuludq	16(%eax),%xmm6
-	paddq	%xmm5,%xmm0
-	pshufd	$16,-32(%edx),%xmm5
-	pmuludq	(%eax),%xmm7
-	paddq	%xmm6,%xmm4
-	movdqa	%xmm5,%xmm6
-	pmuludq	64(%eax),%xmm5
-	paddq	%xmm7,%xmm3
-	movdqa	%xmm6,%xmm7
-	pmuludq	48(%eax),%xmm6
-	paddq	%xmm5,%xmm2
-	pmuludq	32(%eax),%xmm7
-	pshufd	$16,-80(%edx),%xmm5
-	paddq	%xmm6,%xmm1
-	pshufd	$16,-16(%edx),%xmm6
-	pmuludq	(%eax),%xmm5
-	paddq	%xmm7,%xmm0
-	movdqa	%xmm6,%xmm7
-	pmuludq	64(%eax),%xmm6
-	paddq	%xmm5,%xmm4
-	movdqa	%xmm7,%xmm5
-	pmuludq	16(%eax),%xmm7
-	paddq	%xmm6,%xmm3
-	movdqa	%xmm5,%xmm6
-	pmuludq	32(%eax),%xmm5
-	paddq	%xmm7,%xmm0
-	pmuludq	48(%eax),%xmm6
-	movdqa	64(%ebx),%xmm7
-	paddq	%xmm5,%xmm1
-	paddq	%xmm6,%xmm2
-	jz	L017short_tail
-	movdqu	-32(%esi),%xmm5
-	movdqu	-16(%esi),%xmm6
-	leal	32(%esi),%esi
-	movdqa	%xmm2,32(%esp)
-	movdqa	%xmm3,48(%esp)
-	movdqa	%xmm4,64(%esp)
-	movdqa	%xmm5,%xmm2
-	movdqa	%xmm6,%xmm3
-	psrldq	$6,%xmm2
-	psrldq	$6,%xmm3
-	movdqa	%xmm5,%xmm4
-	punpcklqdq	%xmm3,%xmm2
-	punpckhqdq	%xmm6,%xmm4
-	punpcklqdq	%xmm6,%xmm5
-	movdqa	%xmm2,%xmm3
-	psrlq	$4,%xmm2
-	psrlq	$30,%xmm3
-	movdqa	%xmm5,%xmm6
-	psrlq	$40,%xmm4
-	psrlq	$26,%xmm6
-	pand	%xmm7,%xmm5
-	pand	%xmm7,%xmm6
-	pand	%xmm7,%xmm2
-	pand	%xmm7,%xmm3
-	por	(%ebx),%xmm4
-	pshufd	$16,(%edx),%xmm7
-	paddd	80(%esp),%xmm5
-	paddd	96(%esp),%xmm6
-	paddd	112(%esp),%xmm2
-	paddd	128(%esp),%xmm3
-	paddd	144(%esp),%xmm4
-	movdqa	%xmm5,(%esp)
-	pmuludq	%xmm7,%xmm5
-	movdqa	%xmm6,16(%esp)
-	pmuludq	%xmm7,%xmm6
-	paddq	%xmm5,%xmm0
-	movdqa	%xmm2,%xmm5
-	pmuludq	%xmm7,%xmm2
-	paddq	%xmm6,%xmm1
-	movdqa	%xmm3,%xmm6
-	pmuludq	%xmm7,%xmm3
-	paddq	32(%esp),%xmm2
-	movdqa	%xmm5,32(%esp)
-	pshufd	$16,16(%edx),%xmm5
-	paddq	48(%esp),%xmm3
-	movdqa	%xmm6,48(%esp)
-	movdqa	%xmm4,%xmm6
-	pmuludq	%xmm7,%xmm4
-	paddq	64(%esp),%xmm4
-	movdqa	%xmm6,64(%esp)
-	movdqa	%xmm5,%xmm6
-	pmuludq	48(%esp),%xmm5
-	movdqa	%xmm6,%xmm7
-	pmuludq	32(%esp),%xmm6
-	paddq	%xmm5,%xmm4
-	movdqa	%xmm7,%xmm5
-	pmuludq	16(%esp),%xmm7
-	paddq	%xmm6,%xmm3
-	pshufd	$16,80(%edx),%xmm6
-	pmuludq	(%esp),%xmm5
-	paddq	%xmm7,%xmm2
-	pmuludq	64(%esp),%xmm6
-	pshufd	$16,32(%edx),%xmm7
-	paddq	%xmm5,%xmm1
-	movdqa	%xmm7,%xmm5
-	pmuludq	32(%esp),%xmm7
-	paddq	%xmm6,%xmm0
-	movdqa	%xmm5,%xmm6
-	pmuludq	16(%esp),%xmm5
-	paddq	%xmm7,%xmm4
-	pshufd	$16,96(%edx),%xmm7
-	pmuludq	(%esp),%xmm6
-	paddq	%xmm5,%xmm3
-	movdqa	%xmm7,%xmm5
-	pmuludq	64(%esp),%xmm7
-	paddq	%xmm6,%xmm2
-	pmuludq	48(%esp),%xmm5
-	pshufd	$16,48(%edx),%xmm6
-	paddq	%xmm7,%xmm1
-	movdqa	%xmm6,%xmm7
-	pmuludq	16(%esp),%xmm6
-	paddq	%xmm5,%xmm0
-	pshufd	$16,112(%edx),%xmm5
-	pmuludq	(%esp),%xmm7
-	paddq	%xmm6,%xmm4
-	movdqa	%xmm5,%xmm6
-	pmuludq	64(%esp),%xmm5
-	paddq	%xmm7,%xmm3
-	movdqa	%xmm6,%xmm7
-	pmuludq	48(%esp),%xmm6
-	paddq	%xmm5,%xmm2
-	pmuludq	32(%esp),%xmm7
-	pshufd	$16,64(%edx),%xmm5
-	paddq	%xmm6,%xmm1
-	pshufd	$16,128(%edx),%xmm6
-	pmuludq	(%esp),%xmm5
-	paddq	%xmm7,%xmm0
-	movdqa	%xmm6,%xmm7
-	pmuludq	64(%esp),%xmm6
-	paddq	%xmm5,%xmm4
-	movdqa	%xmm7,%xmm5
-	pmuludq	16(%esp),%xmm7
-	paddq	%xmm6,%xmm3
-	movdqa	%xmm5,%xmm6
-	pmuludq	32(%esp),%xmm5
-	paddq	%xmm7,%xmm0
-	pmuludq	48(%esp),%xmm6
-	movdqa	64(%ebx),%xmm7
-	paddq	%xmm5,%xmm1
-	paddq	%xmm6,%xmm2
-L017short_tail:
-	pshufd	$78,%xmm4,%xmm6
-	pshufd	$78,%xmm3,%xmm5
-	paddq	%xmm6,%xmm4
-	paddq	%xmm5,%xmm3
-	pshufd	$78,%xmm0,%xmm6
-	pshufd	$78,%xmm1,%xmm5
-	paddq	%xmm6,%xmm0
-	paddq	%xmm5,%xmm1
-	pshufd	$78,%xmm2,%xmm6
-	movdqa	%xmm3,%xmm5
-	pand	%xmm7,%xmm3
-	psrlq	$26,%xmm5
-	paddq	%xmm6,%xmm2
-	paddq	%xmm4,%xmm5
-	movdqa	%xmm0,%xmm6
-	pand	%xmm7,%xmm0
-	psrlq	$26,%xmm6
-	movdqa	%xmm5,%xmm4
-	paddq	%xmm1,%xmm6
-	psrlq	$26,%xmm5
-	pand	%xmm7,%xmm4
-	movdqa	%xmm6,%xmm1
-	psrlq	$26,%xmm6
-	paddd	%xmm5,%xmm0
-	psllq	$2,%xmm5
-	paddq	%xmm2,%xmm6
-	paddq	%xmm0,%xmm5
-	pand	%xmm7,%xmm1
-	movdqa	%xmm6,%xmm2
-	psrlq	$26,%xmm6
-	pand	%xmm7,%xmm2
-	paddd	%xmm3,%xmm6
-	movdqa	%xmm5,%xmm0
-	psrlq	$26,%xmm5
-	movdqa	%xmm6,%xmm3
-	psrlq	$26,%xmm6
-	pand	%xmm7,%xmm0
-	paddd	%xmm5,%xmm1
-	pand	%xmm7,%xmm3
-	paddd	%xmm6,%xmm4
-L013done:
-	movd	%xmm0,-48(%edi)
-	movd	%xmm1,-44(%edi)
-	movd	%xmm2,-40(%edi)
-	movd	%xmm3,-36(%edi)
-	movd	%xmm4,-32(%edi)
-	movl	%ebp,%esp
-L007nodata:
-	popl	%edi
-	popl	%esi
-	popl	%ebx
-	popl	%ebp
-	ret
-.align	5,0x90
-.private_extern	__poly1305_emit_sse2
-.align	4
-__poly1305_emit_sse2:
-	pushl	%ebp
-	pushl	%ebx
-	pushl	%esi
-	pushl	%edi
-	movl	20(%esp),%ebp
-	cmpl	$0,20(%ebp)
-	je	Lenter_emit
-	movl	(%ebp),%eax
-	movl	4(%ebp),%edi
-	movl	8(%ebp),%ecx
-	movl	12(%ebp),%edx
-	movl	16(%ebp),%esi
-	movl	%edi,%ebx
-	shll	$26,%edi
-	shrl	$6,%ebx
-	addl	%edi,%eax
-	movl	%ecx,%edi
-	adcl	$0,%ebx
-	shll	$20,%edi
-	shrl	$12,%ecx
-	addl	%edi,%ebx
-	movl	%edx,%edi
-	adcl	$0,%ecx
-	shll	$14,%edi
-	shrl	$18,%edx
-	addl	%edi,%ecx
-	movl	%esi,%edi
-	adcl	$0,%edx
-	shll	$8,%edi
-	shrl	$24,%esi
-	addl	%edi,%edx
-	adcl	$0,%esi
-	movl	%esi,%edi
-	andl	$3,%esi
-	shrl	$2,%edi
-	leal	(%edi,%edi,4),%ebp
-	movl	24(%esp),%edi
-	addl	%ebp,%eax
-	movl	28(%esp),%ebp
-	adcl	$0,%ebx
-	adcl	$0,%ecx
-	adcl	$0,%edx
-	movd	%eax,%xmm0
-	addl	$5,%eax
-	movd	%ebx,%xmm1
-	adcl	$0,%ebx
-	movd	%ecx,%xmm2
-	adcl	$0,%ecx
-	movd	%edx,%xmm3
-	adcl	$0,%edx
-	adcl	$0,%esi
-	shrl	$2,%esi
-	negl	%esi
-	andl	%esi,%eax
-	andl	%esi,%ebx
-	andl	%esi,%ecx
-	andl	%esi,%edx
-	movl	%eax,(%edi)
-	movd	%xmm0,%eax
-	movl	%ebx,4(%edi)
-	movd	%xmm1,%ebx
-	movl	%ecx,8(%edi)
-	movd	%xmm2,%ecx
-	movl	%edx,12(%edi)
-	movd	%xmm3,%edx
-	notl	%esi
-	andl	%esi,%eax
-	andl	%esi,%ebx
-	orl	(%edi),%eax
-	andl	%esi,%ecx
-	orl	4(%edi),%ebx
-	andl	%esi,%edx
-	orl	8(%edi),%ecx
-	orl	12(%edi),%edx
-	addl	(%ebp),%eax
-	adcl	4(%ebp),%ebx
-	movl	%eax,(%edi)
-	adcl	8(%ebp),%ecx
-	movl	%ebx,4(%edi)
-	adcl	12(%ebp),%edx
-	movl	%ecx,8(%edi)
-	movl	%edx,12(%edi)
-	popl	%edi
-	popl	%esi
-	popl	%ebx
-	popl	%ebp
-	ret
-.align	6,0x90
-Lconst_sse2:
-.long	16777216,0,16777216,0,16777216,0,16777216,0
-.long	0,0,0,0,0,0,0,0
-.long	67108863,0,67108863,0,67108863,0,67108863,0
-.long	268435455,268435452,268435452,268435452
-.byte	80,111,108,121,49,51,48,53,32,102,111,114,32,120,56,54
-.byte	44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32
-.byte	60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111
-.byte	114,103,62,0
-.align	2,0x90
-.section __IMPORT,__pointers,non_lazy_symbol_pointers
-L_OPENSSL_ia32cap_P$non_lazy_ptr:
-.indirect_symbol	_OPENSSL_ia32cap_P
-.long	0
-#endif
diff --git a/third_party/boringssl/mac-x86_64/crypto/poly1305/poly1305-x86_64.S b/third_party/boringssl/mac-x86_64/crypto/poly1305/poly1305-x86_64.S
deleted file mode 100644
index 91acc79..0000000
--- a/third_party/boringssl/mac-x86_64/crypto/poly1305/poly1305-x86_64.S
+++ /dev/null
@@ -1,1824 +0,0 @@
-#if defined(__x86_64__)
-.text	
-
-
-
-.globl	_poly1305_init
-.private_extern _poly1305_init
-.globl	_poly1305_blocks
-.private_extern _poly1305_blocks
-.globl	_poly1305_emit
-.private_extern _poly1305_emit
-
-.p2align	5
-_poly1305_init:
-	xorq	%rax,%rax
-	movq	%rax,0(%rdi)
-	movq	%rax,8(%rdi)
-	movq	%rax,16(%rdi)
-
-	cmpq	$0,%rsi
-	je	L$no_key
-
-	leaq	_poly1305_blocks(%rip),%r10
-	leaq	_poly1305_emit(%rip),%r11
-	movq	_OPENSSL_ia32cap_P+4(%rip),%r9
-	leaq	poly1305_blocks_avx(%rip),%rax
-	leaq	poly1305_emit_avx(%rip),%rcx
-	btq	$28,%r9
-	cmovcq	%rax,%r10
-	cmovcq	%rcx,%r11
-	leaq	poly1305_blocks_avx2(%rip),%rax
-	btq	$37,%r9
-	cmovcq	%rax,%r10
-	movq	$0x0ffffffc0fffffff,%rax
-	movq	$0x0ffffffc0ffffffc,%rcx
-	andq	0(%rsi),%rax
-	andq	8(%rsi),%rcx
-	movq	%rax,24(%rdi)
-	movq	%rcx,32(%rdi)
-	movq	%r10,0(%rdx)
-	movq	%r11,8(%rdx)
-	movl	$1,%eax
-L$no_key:
-	.byte	0xf3,0xc3
-
-
-
-.p2align	5
-_poly1305_blocks:
-L$blocks:
-	subq	$16,%rdx
-	jc	L$no_data
-
-	pushq	%rbx
-	pushq	%rbp
-	pushq	%r12
-	pushq	%r13
-	pushq	%r14
-	pushq	%r15
-L$blocks_body:
-
-	movq	%rdx,%r15
-
-	movq	24(%rdi),%r11
-	movq	32(%rdi),%r13
-
-	movq	0(%rdi),%r14
-	movq	8(%rdi),%rbx
-	movq	16(%rdi),%rbp
-
-	movq	%r13,%r12
-	shrq	$2,%r13
-	movq	%r12,%rax
-	addq	%r12,%r13
-	jmp	L$oop
-
-.p2align	5
-L$oop:
-	addq	0(%rsi),%r14
-	adcq	8(%rsi),%rbx
-	leaq	16(%rsi),%rsi
-	adcq	%rcx,%rbp
-	mulq	%r14
-	movq	%rax,%r9
-	movq	%r11,%rax
-	movq	%rdx,%r10
-
-	mulq	%r14
-	movq	%rax,%r14
-	movq	%r11,%rax
-	movq	%rdx,%r8
-
-	mulq	%rbx
-	addq	%rax,%r9
-	movq	%r13,%rax
-	adcq	%rdx,%r10
-
-	mulq	%rbx
-	movq	%rbp,%rbx
-	addq	%rax,%r14
-	adcq	%rdx,%r8
-
-	imulq	%r13,%rbx
-	addq	%rbx,%r9
-	movq	%r8,%rbx
-	adcq	$0,%r10
-
-	imulq	%r11,%rbp
-	addq	%r9,%rbx
-	movq	$-4,%rax
-	adcq	%rbp,%r10
-
-	andq	%r10,%rax
-	movq	%r10,%rbp
-	shrq	$2,%r10
-	andq	$3,%rbp
-	addq	%r10,%rax
-	addq	%rax,%r14
-	adcq	$0,%rbx
-	movq	%r12,%rax
-	subq	$16,%r15
-	jnc	L$oop
-
-	movq	%r14,0(%rdi)
-	movq	%rbx,8(%rdi)
-	movq	%rbp,16(%rdi)
-
-	movq	0(%rsp),%r15
-	movq	8(%rsp),%r14
-	movq	16(%rsp),%r13
-	movq	24(%rsp),%r12
-	movq	32(%rsp),%rbp
-	movq	40(%rsp),%rbx
-	leaq	48(%rsp),%rsp
-L$no_data:
-L$blocks_epilogue:
-	.byte	0xf3,0xc3
-
-
-
-.p2align	5
-_poly1305_emit:
-L$emit:
-	movq	0(%rdi),%r8
-	movq	8(%rdi),%r9
-	movq	16(%rdi),%r10
-
-	movq	%r8,%rax
-	addq	$5,%r8
-	movq	%r9,%rcx
-	adcq	$0,%r9
-	adcq	$0,%r10
-	shrq	$2,%r10
-	cmovnzq	%r8,%rax
-	cmovnzq	%r9,%rcx
-
-	addq	0(%rdx),%rax
-	adcq	8(%rdx),%rcx
-	movq	%rax,0(%rsi)
-	movq	%rcx,8(%rsi)
-
-	.byte	0xf3,0xc3
-
-
-.p2align	5
-__poly1305_block:
-	mulq	%r14
-	movq	%rax,%r9
-	movq	%r11,%rax
-	movq	%rdx,%r10
-
-	mulq	%r14
-	movq	%rax,%r14
-	movq	%r11,%rax
-	movq	%rdx,%r8
-
-	mulq	%rbx
-	addq	%rax,%r9
-	movq	%r13,%rax
-	adcq	%rdx,%r10
-
-	mulq	%rbx
-	movq	%rbp,%rbx
-	addq	%rax,%r14
-	adcq	%rdx,%r8
-
-	imulq	%r13,%rbx
-	addq	%rbx,%r9
-	movq	%r8,%rbx
-	adcq	$0,%r10
-
-	imulq	%r11,%rbp
-	addq	%r9,%rbx
-	movq	$-4,%rax
-	adcq	%rbp,%r10
-
-	andq	%r10,%rax
-	movq	%r10,%rbp
-	shrq	$2,%r10
-	andq	$3,%rbp
-	addq	%r10,%rax
-	addq	%rax,%r14
-	adcq	$0,%rbx
-	.byte	0xf3,0xc3
-
-
-
-.p2align	5
-__poly1305_init_avx:
-	movq	%r11,%r14
-	movq	%r12,%rbx
-	xorq	%rbp,%rbp
-
-	leaq	48+64(%rdi),%rdi
-
-	movq	%r12,%rax
-	call	__poly1305_block
-
-	movl	$0x3ffffff,%eax
-	movl	$0x3ffffff,%edx
-	movq	%r14,%r8
-	andl	%r14d,%eax
-	movq	%r11,%r9
-	andl	%r11d,%edx
-	movl	%eax,-64(%rdi)
-	shrq	$26,%r8
-	movl	%edx,-60(%rdi)
-	shrq	$26,%r9
-
-	movl	$0x3ffffff,%eax
-	movl	$0x3ffffff,%edx
-	andl	%r8d,%eax
-	andl	%r9d,%edx
-	movl	%eax,-48(%rdi)
-	leal	(%rax,%rax,4),%eax
-	movl	%edx,-44(%rdi)
-	leal	(%rdx,%rdx,4),%edx
-	movl	%eax,-32(%rdi)
-	shrq	$26,%r8
-	movl	%edx,-28(%rdi)
-	shrq	$26,%r9
-
-	movq	%rbx,%rax
-	movq	%r12,%rdx
-	shlq	$12,%rax
-	shlq	$12,%rdx
-	orq	%r8,%rax
-	orq	%r9,%rdx
-	andl	$0x3ffffff,%eax
-	andl	$0x3ffffff,%edx
-	movl	%eax,-16(%rdi)
-	leal	(%rax,%rax,4),%eax
-	movl	%edx,-12(%rdi)
-	leal	(%rdx,%rdx,4),%edx
-	movl	%eax,0(%rdi)
-	movq	%rbx,%r8
-	movl	%edx,4(%rdi)
-	movq	%r12,%r9
-
-	movl	$0x3ffffff,%eax
-	movl	$0x3ffffff,%edx
-	shrq	$14,%r8
-	shrq	$14,%r9
-	andl	%r8d,%eax
-	andl	%r9d,%edx
-	movl	%eax,16(%rdi)
-	leal	(%rax,%rax,4),%eax
-	movl	%edx,20(%rdi)
-	leal	(%rdx,%rdx,4),%edx
-	movl	%eax,32(%rdi)
-	shrq	$26,%r8
-	movl	%edx,36(%rdi)
-	shrq	$26,%r9
-
-	movq	%rbp,%rax
-	shlq	$24,%rax
-	orq	%rax,%r8
-	movl	%r8d,48(%rdi)
-	leaq	(%r8,%r8,4),%r8
-	movl	%r9d,52(%rdi)
-	leaq	(%r9,%r9,4),%r9
-	movl	%r8d,64(%rdi)
-	movl	%r9d,68(%rdi)
-
-	movq	%r12,%rax
-	call	__poly1305_block
-
-	movl	$0x3ffffff,%eax
-	movq	%r14,%r8
-	andl	%r14d,%eax
-	shrq	$26,%r8
-	movl	%eax,-52(%rdi)
-
-	movl	$0x3ffffff,%edx
-	andl	%r8d,%edx
-	movl	%edx,-36(%rdi)
-	leal	(%rdx,%rdx,4),%edx
-	shrq	$26,%r8
-	movl	%edx,-20(%rdi)
-
-	movq	%rbx,%rax
-	shlq	$12,%rax
-	orq	%r8,%rax
-	andl	$0x3ffffff,%eax
-	movl	%eax,-4(%rdi)
-	leal	(%rax,%rax,4),%eax
-	movq	%rbx,%r8
-	movl	%eax,12(%rdi)
-
-	movl	$0x3ffffff,%edx
-	shrq	$14,%r8
-	andl	%r8d,%edx
-	movl	%edx,28(%rdi)
-	leal	(%rdx,%rdx,4),%edx
-	shrq	$26,%r8
-	movl	%edx,44(%rdi)
-
-	movq	%rbp,%rax
-	shlq	$24,%rax
-	orq	%rax,%r8
-	movl	%r8d,60(%rdi)
-	leaq	(%r8,%r8,4),%r8
-	movl	%r8d,76(%rdi)
-
-	movq	%r12,%rax
-	call	__poly1305_block
-
-	movl	$0x3ffffff,%eax
-	movq	%r14,%r8
-	andl	%r14d,%eax
-	shrq	$26,%r8
-	movl	%eax,-56(%rdi)
-
-	movl	$0x3ffffff,%edx
-	andl	%r8d,%edx
-	movl	%edx,-40(%rdi)
-	leal	(%rdx,%rdx,4),%edx
-	shrq	$26,%r8
-	movl	%edx,-24(%rdi)
-
-	movq	%rbx,%rax
-	shlq	$12,%rax
-	orq	%r8,%rax
-	andl	$0x3ffffff,%eax
-	movl	%eax,-8(%rdi)
-	leal	(%rax,%rax,4),%eax
-	movq	%rbx,%r8
-	movl	%eax,8(%rdi)
-
-	movl	$0x3ffffff,%edx
-	shrq	$14,%r8
-	andl	%r8d,%edx
-	movl	%edx,24(%rdi)
-	leal	(%rdx,%rdx,4),%edx
-	shrq	$26,%r8
-	movl	%edx,40(%rdi)
-
-	movq	%rbp,%rax
-	shlq	$24,%rax
-	orq	%rax,%r8
-	movl	%r8d,56(%rdi)
-	leaq	(%r8,%r8,4),%r8
-	movl	%r8d,72(%rdi)
-
-	leaq	-48-64(%rdi),%rdi
-	.byte	0xf3,0xc3
-
-
-
-.p2align	5
-poly1305_blocks_avx:
-	movl	20(%rdi),%r8d
-	cmpq	$128,%rdx
-	jae	L$blocks_avx
-	testl	%r8d,%r8d
-	jz	L$blocks
-
-L$blocks_avx:
-	andq	$-16,%rdx
-	jz	L$no_data_avx
-
-	vzeroupper
-
-	testl	%r8d,%r8d
-	jz	L$base2_64_avx
-
-	testq	$31,%rdx
-	jz	L$even_avx
-
-	pushq	%rbx
-	pushq	%rbp
-	pushq	%r12
-	pushq	%r13
-	pushq	%r14
-	pushq	%r15
-L$blocks_avx_body:
-
-	movq	%rdx,%r15
-
-	movq	0(%rdi),%r8
-	movq	8(%rdi),%r9
-	movl	16(%rdi),%ebp
-
-	movq	24(%rdi),%r11
-	movq	32(%rdi),%r13
-
-
-	movl	%r8d,%r14d
-	andq	$-1<<31,%r8
-	movq	%r9,%r12
-	movl	%r9d,%ebx
-	andq	$-1<<31,%r9
-
-	shrq	$6,%r8
-	shlq	$52,%r12
-	addq	%r8,%r14
-	shrq	$12,%rbx
-	shrq	$18,%r9
-	addq	%r12,%r14
-	adcq	%r9,%rbx
-
-	movq	%rbp,%r8
-	shlq	$40,%r8
-	shrq	$24,%rbp
-	addq	%r8,%rbx
-	adcq	$0,%rbp
-
-	movq	$-4,%r9
-	movq	%rbp,%r8
-	andq	%rbp,%r9
-	shrq	$2,%r8
-	andq	$3,%rbp
-	addq	%r9,%r8
-	addq	%r8,%r14
-	adcq	$0,%rbx
-
-	movq	%r13,%r12
-	movq	%r13,%rax
-	shrq	$2,%r13
-	addq	%r12,%r13
-
-	addq	0(%rsi),%r14
-	adcq	8(%rsi),%rbx
-	leaq	16(%rsi),%rsi
-	adcq	%rcx,%rbp
-
-	call	__poly1305_block
-
-	testq	%rcx,%rcx
-	jz	L$store_base2_64_avx
-
-
-	movq	%r14,%rax
-	movq	%r14,%rdx
-	shrq	$52,%r14
-	movq	%rbx,%r11
-	movq	%rbx,%r12
-	shrq	$26,%rdx
-	andq	$0x3ffffff,%rax
-	shlq	$12,%r11
-	andq	$0x3ffffff,%rdx
-	shrq	$14,%rbx
-	orq	%r11,%r14
-	shlq	$24,%rbp
-	andq	$0x3ffffff,%r14
-	shrq	$40,%r12
-	andq	$0x3ffffff,%rbx
-	orq	%r12,%rbp
-
-	subq	$16,%r15
-	jz	L$store_base2_26_avx
-
-	vmovd	%eax,%xmm0
-	vmovd	%edx,%xmm1
-	vmovd	%r14d,%xmm2
-	vmovd	%ebx,%xmm3
-	vmovd	%ebp,%xmm4
-	jmp	L$proceed_avx
-
-.p2align	5
-L$store_base2_64_avx:
-	movq	%r14,0(%rdi)
-	movq	%rbx,8(%rdi)
-	movq	%rbp,16(%rdi)
-	jmp	L$done_avx
-
-.p2align	4
-L$store_base2_26_avx:
-	movl	%eax,0(%rdi)
-	movl	%edx,4(%rdi)
-	movl	%r14d,8(%rdi)
-	movl	%ebx,12(%rdi)
-	movl	%ebp,16(%rdi)
-.p2align	4
-L$done_avx:
-	movq	0(%rsp),%r15
-	movq	8(%rsp),%r14
-	movq	16(%rsp),%r13
-	movq	24(%rsp),%r12
-	movq	32(%rsp),%rbp
-	movq	40(%rsp),%rbx
-	leaq	48(%rsp),%rsp
-L$no_data_avx:
-L$blocks_avx_epilogue:
-	.byte	0xf3,0xc3
-
-.p2align	5
-L$base2_64_avx:
-	pushq	%rbx
-	pushq	%rbp
-	pushq	%r12
-	pushq	%r13
-	pushq	%r14
-	pushq	%r15
-L$base2_64_avx_body:
-
-	movq	%rdx,%r15
-
-	movq	24(%rdi),%r11
-	movq	32(%rdi),%r13
-
-	movq	0(%rdi),%r14
-	movq	8(%rdi),%rbx
-	movl	16(%rdi),%ebp
-
-	movq	%r13,%r12
-	movq	%r13,%rax
-	shrq	$2,%r13
-	addq	%r12,%r13
-
-	testq	$31,%rdx
-	jz	L$init_avx
-
-	addq	0(%rsi),%r14
-	adcq	8(%rsi),%rbx
-	leaq	16(%rsi),%rsi
-	adcq	%rcx,%rbp
-	subq	$16,%r15
-
-	call	__poly1305_block
-
-L$init_avx:
-
-	movq	%r14,%rax
-	movq	%r14,%rdx
-	shrq	$52,%r14
-	movq	%rbx,%r8
-	movq	%rbx,%r9
-	shrq	$26,%rdx
-	andq	$0x3ffffff,%rax
-	shlq	$12,%r8
-	andq	$0x3ffffff,%rdx
-	shrq	$14,%rbx
-	orq	%r8,%r14
-	shlq	$24,%rbp
-	andq	$0x3ffffff,%r14
-	shrq	$40,%r9
-	andq	$0x3ffffff,%rbx
-	orq	%r9,%rbp
-
-	vmovd	%eax,%xmm0
-	vmovd	%edx,%xmm1
-	vmovd	%r14d,%xmm2
-	vmovd	%ebx,%xmm3
-	vmovd	%ebp,%xmm4
-	movl	$1,20(%rdi)
-
-	call	__poly1305_init_avx
-
-L$proceed_avx:
-	movq	%r15,%rdx
-
-	movq	0(%rsp),%r15
-	movq	8(%rsp),%r14
-	movq	16(%rsp),%r13
-	movq	24(%rsp),%r12
-	movq	32(%rsp),%rbp
-	movq	40(%rsp),%rbx
-	leaq	48(%rsp),%rax
-	leaq	48(%rsp),%rsp
-L$base2_64_avx_epilogue:
-	jmp	L$do_avx
-
-.p2align	5
-L$even_avx:
-	vmovd	0(%rdi),%xmm0
-	vmovd	4(%rdi),%xmm1
-	vmovd	8(%rdi),%xmm2
-	vmovd	12(%rdi),%xmm3
-	vmovd	16(%rdi),%xmm4
-
-L$do_avx:
-	leaq	-88(%rsp),%r11
-	subq	$0x178,%rsp
-	subq	$64,%rdx
-	leaq	-32(%rsi),%rax
-	cmovcq	%rax,%rsi
-
-	vmovdqu	48(%rdi),%xmm14
-	leaq	112(%rdi),%rdi
-	leaq	L$const(%rip),%rcx
-
-
-
-	vmovdqu	32(%rsi),%xmm5
-	vmovdqu	48(%rsi),%xmm6
-	vmovdqa	64(%rcx),%xmm15
-
-	vpsrldq	$6,%xmm5,%xmm7
-	vpsrldq	$6,%xmm6,%xmm8
-	vpunpckhqdq	%xmm6,%xmm5,%xmm9
-	vpunpcklqdq	%xmm6,%xmm5,%xmm5
-	vpunpcklqdq	%xmm8,%xmm7,%xmm8
-
-	vpsrlq	$40,%xmm9,%xmm9
-	vpsrlq	$26,%xmm5,%xmm6
-	vpand	%xmm15,%xmm5,%xmm5
-	vpsrlq	$4,%xmm8,%xmm7
-	vpand	%xmm15,%xmm6,%xmm6
-	vpsrlq	$30,%xmm8,%xmm8
-	vpand	%xmm15,%xmm7,%xmm7
-	vpand	%xmm15,%xmm8,%xmm8
-	vpor	32(%rcx),%xmm9,%xmm9
-
-	jbe	L$skip_loop_avx
-
-
-	vmovdqu	-48(%rdi),%xmm11
-	vmovdqu	-32(%rdi),%xmm12
-	vpshufd	$0xEE,%xmm14,%xmm13
-	vpshufd	$0x44,%xmm14,%xmm10
-	vmovdqa	%xmm13,-144(%r11)
-	vmovdqa	%xmm10,0(%rsp)
-	vpshufd	$0xEE,%xmm11,%xmm14
-	vmovdqu	-16(%rdi),%xmm10
-	vpshufd	$0x44,%xmm11,%xmm11
-	vmovdqa	%xmm14,-128(%r11)
-	vmovdqa	%xmm11,16(%rsp)
-	vpshufd	$0xEE,%xmm12,%xmm13
-	vmovdqu	0(%rdi),%xmm11
-	vpshufd	$0x44,%xmm12,%xmm12
-	vmovdqa	%xmm13,-112(%r11)
-	vmovdqa	%xmm12,32(%rsp)
-	vpshufd	$0xEE,%xmm10,%xmm14
-	vmovdqu	16(%rdi),%xmm12
-	vpshufd	$0x44,%xmm10,%xmm10
-	vmovdqa	%xmm14,-96(%r11)
-	vmovdqa	%xmm10,48(%rsp)
-	vpshufd	$0xEE,%xmm11,%xmm13
-	vmovdqu	32(%rdi),%xmm10
-	vpshufd	$0x44,%xmm11,%xmm11
-	vmovdqa	%xmm13,-80(%r11)
-	vmovdqa	%xmm11,64(%rsp)
-	vpshufd	$0xEE,%xmm12,%xmm14
-	vmovdqu	48(%rdi),%xmm11
-	vpshufd	$0x44,%xmm12,%xmm12
-	vmovdqa	%xmm14,-64(%r11)
-	vmovdqa	%xmm12,80(%rsp)
-	vpshufd	$0xEE,%xmm10,%xmm13
-	vmovdqu	64(%rdi),%xmm12
-	vpshufd	$0x44,%xmm10,%xmm10
-	vmovdqa	%xmm13,-48(%r11)
-	vmovdqa	%xmm10,96(%rsp)
-	vpshufd	$0xEE,%xmm11,%xmm14
-	vpshufd	$0x44,%xmm11,%xmm11
-	vmovdqa	%xmm14,-32(%r11)
-	vmovdqa	%xmm11,112(%rsp)
-	vpshufd	$0xEE,%xmm12,%xmm13
-	vmovdqa	0(%rsp),%xmm14
-	vpshufd	$0x44,%xmm12,%xmm12
-	vmovdqa	%xmm13,-16(%r11)
-	vmovdqa	%xmm12,128(%rsp)
-
-	jmp	L$oop_avx
-
-.p2align	5
-L$oop_avx:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-	vpmuludq	%xmm5,%xmm14,%xmm10
-	vpmuludq	%xmm6,%xmm14,%xmm11
-	vmovdqa	%xmm2,32(%r11)
-	vpmuludq	%xmm7,%xmm14,%xmm12
-	vmovdqa	16(%rsp),%xmm2
-	vpmuludq	%xmm8,%xmm14,%xmm13
-	vpmuludq	%xmm9,%xmm14,%xmm14
-
-	vmovdqa	%xmm0,0(%r11)
-	vpmuludq	32(%rsp),%xmm9,%xmm0
-	vmovdqa	%xmm1,16(%r11)
-	vpmuludq	%xmm8,%xmm2,%xmm1
-	vpaddq	%xmm0,%xmm10,%xmm10
-	vpaddq	%xmm1,%xmm14,%xmm14
-	vmovdqa	%xmm3,48(%r11)
-	vpmuludq	%xmm7,%xmm2,%xmm0
-	vpmuludq	%xmm6,%xmm2,%xmm1
-	vpaddq	%xmm0,%xmm13,%xmm13
-	vmovdqa	48(%rsp),%xmm3
-	vpaddq	%xmm1,%xmm12,%xmm12
-	vmovdqa	%xmm4,64(%r11)
-	vpmuludq	%xmm5,%xmm2,%xmm2
-	vpmuludq	%xmm7,%xmm3,%xmm0
-	vpaddq	%xmm2,%xmm11,%xmm11
-
-	vmovdqa	64(%rsp),%xmm4
-	vpaddq	%xmm0,%xmm14,%xmm14
-	vpmuludq	%xmm6,%xmm3,%xmm1
-	vpmuludq	%xmm5,%xmm3,%xmm3
-	vpaddq	%xmm1,%xmm13,%xmm13
-	vmovdqa	80(%rsp),%xmm2
-	vpaddq	%xmm3,%xmm12,%xmm12
-	vpmuludq	%xmm9,%xmm4,%xmm0
-	vpmuludq	%xmm8,%xmm4,%xmm4
-	vpaddq	%xmm0,%xmm11,%xmm11
-	vmovdqa	96(%rsp),%xmm3
-	vpaddq	%xmm4,%xmm10,%xmm10
-
-	vmovdqa	128(%rsp),%xmm4
-	vpmuludq	%xmm6,%xmm2,%xmm1
-	vpmuludq	%xmm5,%xmm2,%xmm2
-	vpaddq	%xmm1,%xmm14,%xmm14
-	vpaddq	%xmm2,%xmm13,%xmm13
-	vpmuludq	%xmm9,%xmm3,%xmm0
-	vpmuludq	%xmm8,%xmm3,%xmm1
-	vpaddq	%xmm0,%xmm12,%xmm12
-	vmovdqu	0(%rsi),%xmm0
-	vpaddq	%xmm1,%xmm11,%xmm11
-	vpmuludq	%xmm7,%xmm3,%xmm3
-	vpmuludq	%xmm7,%xmm4,%xmm7
-	vpaddq	%xmm3,%xmm10,%xmm10
-
-	vmovdqu	16(%rsi),%xmm1
-	vpaddq	%xmm7,%xmm11,%xmm11
-	vpmuludq	%xmm8,%xmm4,%xmm8
-	vpmuludq	%xmm9,%xmm4,%xmm9
-	vpsrldq	$6,%xmm0,%xmm2
-	vpaddq	%xmm8,%xmm12,%xmm12
-	vpaddq	%xmm9,%xmm13,%xmm13
-	vpsrldq	$6,%xmm1,%xmm3
-	vpmuludq	112(%rsp),%xmm5,%xmm9
-	vpmuludq	%xmm6,%xmm4,%xmm5
-	vpunpckhqdq	%xmm1,%xmm0,%xmm4
-	vpaddq	%xmm9,%xmm14,%xmm14
-	vmovdqa	-144(%r11),%xmm9
-	vpaddq	%xmm5,%xmm10,%xmm10
-
-	vpunpcklqdq	%xmm1,%xmm0,%xmm0
-	vpunpcklqdq	%xmm3,%xmm2,%xmm3
-
-
-	vpsrldq	$5,%xmm4,%xmm4
-	vpsrlq	$26,%xmm0,%xmm1
-	vpand	%xmm15,%xmm0,%xmm0
-	vpsrlq	$4,%xmm3,%xmm2
-	vpand	%xmm15,%xmm1,%xmm1
-	vpand	0(%rcx),%xmm4,%xmm4
-	vpsrlq	$30,%xmm3,%xmm3
-	vpand	%xmm15,%xmm2,%xmm2
-	vpand	%xmm15,%xmm3,%xmm3
-	vpor	32(%rcx),%xmm4,%xmm4
-
-	vpaddq	0(%r11),%xmm0,%xmm0
-	vpaddq	16(%r11),%xmm1,%xmm1
-	vpaddq	32(%r11),%xmm2,%xmm2
-	vpaddq	48(%r11),%xmm3,%xmm3
-	vpaddq	64(%r11),%xmm4,%xmm4
-
-	leaq	32(%rsi),%rax
-	leaq	64(%rsi),%rsi
-	subq	$64,%rdx
-	cmovcq	%rax,%rsi
-
-
-
-
-
-
-
-
-
-
-	vpmuludq	%xmm0,%xmm9,%xmm5
-	vpmuludq	%xmm1,%xmm9,%xmm6
-	vpaddq	%xmm5,%xmm10,%xmm10
-	vpaddq	%xmm6,%xmm11,%xmm11
-	vmovdqa	-128(%r11),%xmm7
-	vpmuludq	%xmm2,%xmm9,%xmm5
-	vpmuludq	%xmm3,%xmm9,%xmm6
-	vpaddq	%xmm5,%xmm12,%xmm12
-	vpaddq	%xmm6,%xmm13,%xmm13
-	vpmuludq	%xmm4,%xmm9,%xmm9
-	vpmuludq	-112(%r11),%xmm4,%xmm5
-	vpaddq	%xmm9,%xmm14,%xmm14
-
-	vpaddq	%xmm5,%xmm10,%xmm10
-	vpmuludq	%xmm2,%xmm7,%xmm6
-	vpmuludq	%xmm3,%xmm7,%xmm5
-	vpaddq	%xmm6,%xmm13,%xmm13
-	vmovdqa	-96(%r11),%xmm8
-	vpaddq	%xmm5,%xmm14,%xmm14
-	vpmuludq	%xmm1,%xmm7,%xmm6
-	vpmuludq	%xmm0,%xmm7,%xmm7
-	vpaddq	%xmm6,%xmm12,%xmm12
-	vpaddq	%xmm7,%xmm11,%xmm11
-
-	vmovdqa	-80(%r11),%xmm9
-	vpmuludq	%xmm2,%xmm8,%xmm5
-	vpmuludq	%xmm1,%xmm8,%xmm6
-	vpaddq	%xmm5,%xmm14,%xmm14
-	vpaddq	%xmm6,%xmm13,%xmm13
-	vmovdqa	-64(%r11),%xmm7
-	vpmuludq	%xmm0,%xmm8,%xmm8
-	vpmuludq	%xmm4,%xmm9,%xmm5
-	vpaddq	%xmm8,%xmm12,%xmm12
-	vpaddq	%xmm5,%xmm11,%xmm11
-	vmovdqa	-48(%r11),%xmm8
-	vpmuludq	%xmm3,%xmm9,%xmm9
-	vpmuludq	%xmm1,%xmm7,%xmm6
-	vpaddq	%xmm9,%xmm10,%xmm10
-
-	vmovdqa	-16(%r11),%xmm9
-	vpaddq	%xmm6,%xmm14,%xmm14
-	vpmuludq	%xmm0,%xmm7,%xmm7
-	vpmuludq	%xmm4,%xmm8,%xmm5
-	vpaddq	%xmm7,%xmm13,%xmm13
-	vpaddq	%xmm5,%xmm12,%xmm12
-	vmovdqu	32(%rsi),%xmm5
-	vpmuludq	%xmm3,%xmm8,%xmm7
-	vpmuludq	%xmm2,%xmm8,%xmm8
-	vpaddq	%xmm7,%xmm11,%xmm11
-	vmovdqu	48(%rsi),%xmm6
-	vpaddq	%xmm8,%xmm10,%xmm10
-
-	vpmuludq	%xmm2,%xmm9,%xmm2
-	vpmuludq	%xmm3,%xmm9,%xmm3
-	vpsrldq	$6,%xmm5,%xmm7
-	vpaddq	%xmm2,%xmm11,%xmm11
-	vpmuludq	%xmm4,%xmm9,%xmm4
-	vpsrldq	$6,%xmm6,%xmm8
-	vpaddq	%xmm3,%xmm12,%xmm2
-	vpaddq	%xmm4,%xmm13,%xmm3
-	vpmuludq	-32(%r11),%xmm0,%xmm4
-	vpmuludq	%xmm1,%xmm9,%xmm0
-	vpunpckhqdq	%xmm6,%xmm5,%xmm9
-	vpaddq	%xmm4,%xmm14,%xmm4
-	vpaddq	%xmm0,%xmm10,%xmm0
-
-	vpunpcklqdq	%xmm6,%xmm5,%xmm5
-	vpunpcklqdq	%xmm8,%xmm7,%xmm8
-
-
-	vpsrldq	$5,%xmm9,%xmm9
-	vpsrlq	$26,%xmm5,%xmm6
-	vmovdqa	0(%rsp),%xmm14
-	vpand	%xmm15,%xmm5,%xmm5
-	vpsrlq	$4,%xmm8,%xmm7
-	vpand	%xmm15,%xmm6,%xmm6
-	vpand	0(%rcx),%xmm9,%xmm9
-	vpsrlq	$30,%xmm8,%xmm8
-	vpand	%xmm15,%xmm7,%xmm7
-	vpand	%xmm15,%xmm8,%xmm8
-	vpor	32(%rcx),%xmm9,%xmm9
-
-
-
-
-
-	vpsrlq	$26,%xmm3,%xmm13
-	vpand	%xmm15,%xmm3,%xmm3
-	vpaddq	%xmm13,%xmm4,%xmm4
-
-	vpsrlq	$26,%xmm0,%xmm10
-	vpand	%xmm15,%xmm0,%xmm0
-	vpaddq	%xmm10,%xmm11,%xmm1
-
-	vpsrlq	$26,%xmm4,%xmm10
-	vpand	%xmm15,%xmm4,%xmm4
-
-	vpsrlq	$26,%xmm1,%xmm11
-	vpand	%xmm15,%xmm1,%xmm1
-	vpaddq	%xmm11,%xmm2,%xmm2
-
-	vpaddq	%xmm10,%xmm0,%xmm0
-	vpsllq	$2,%xmm10,%xmm10
-	vpaddq	%xmm10,%xmm0,%xmm0
-
-	vpsrlq	$26,%xmm2,%xmm12
-	vpand	%xmm15,%xmm2,%xmm2
-	vpaddq	%xmm12,%xmm3,%xmm3
-
-	vpsrlq	$26,%xmm0,%xmm10
-	vpand	%xmm15,%xmm0,%xmm0
-	vpaddq	%xmm10,%xmm1,%xmm1
-
-	vpsrlq	$26,%xmm3,%xmm13
-	vpand	%xmm15,%xmm3,%xmm3
-	vpaddq	%xmm13,%xmm4,%xmm4
-
-	ja	L$oop_avx
-
-L$skip_loop_avx:
-
-
-
-	vpshufd	$0x10,%xmm14,%xmm14
-	addq	$32,%rdx
-	jnz	L$ong_tail_avx
-
-	vpaddq	%xmm2,%xmm7,%xmm7
-	vpaddq	%xmm0,%xmm5,%xmm5
-	vpaddq	%xmm1,%xmm6,%xmm6
-	vpaddq	%xmm3,%xmm8,%xmm8
-	vpaddq	%xmm4,%xmm9,%xmm9
-
-L$ong_tail_avx:
-	vmovdqa	%xmm2,32(%r11)
-	vmovdqa	%xmm0,0(%r11)
-	vmovdqa	%xmm1,16(%r11)
-	vmovdqa	%xmm3,48(%r11)
-	vmovdqa	%xmm4,64(%r11)
-
-
-
-
-
-
-
-	vpmuludq	%xmm7,%xmm14,%xmm12
-	vpmuludq	%xmm5,%xmm14,%xmm10
-	vpshufd	$0x10,-48(%rdi),%xmm2
-	vpmuludq	%xmm6,%xmm14,%xmm11
-	vpmuludq	%xmm8,%xmm14,%xmm13
-	vpmuludq	%xmm9,%xmm14,%xmm14
-
-	vpmuludq	%xmm8,%xmm2,%xmm0
-	vpaddq	%xmm0,%xmm14,%xmm14
-	vpshufd	$0x10,-32(%rdi),%xmm3
-	vpmuludq	%xmm7,%xmm2,%xmm1
-	vpaddq	%xmm1,%xmm13,%xmm13
-	vpshufd	$0x10,-16(%rdi),%xmm4
-	vpmuludq	%xmm6,%xmm2,%xmm0
-	vpaddq	%xmm0,%xmm12,%xmm12
-	vpmuludq	%xmm5,%xmm2,%xmm2
-	vpaddq	%xmm2,%xmm11,%xmm11
-	vpmuludq	%xmm9,%xmm3,%xmm3
-	vpaddq	%xmm3,%xmm10,%xmm10
-
-	vpshufd	$0x10,0(%rdi),%xmm2
-	vpmuludq	%xmm7,%xmm4,%xmm1
-	vpaddq	%xmm1,%xmm14,%xmm14
-	vpmuludq	%xmm6,%xmm4,%xmm0
-	vpaddq	%xmm0,%xmm13,%xmm13
-	vpshufd	$0x10,16(%rdi),%xmm3
-	vpmuludq	%xmm5,%xmm4,%xmm4
-	vpaddq	%xmm4,%xmm12,%xmm12
-	vpmuludq	%xmm9,%xmm2,%xmm1
-	vpaddq	%xmm1,%xmm11,%xmm11
-	vpshufd	$0x10,32(%rdi),%xmm4
-	vpmuludq	%xmm8,%xmm2,%xmm2
-	vpaddq	%xmm2,%xmm10,%xmm10
-
-	vpmuludq	%xmm6,%xmm3,%xmm0
-	vpaddq	%xmm0,%xmm14,%xmm14
-	vpmuludq	%xmm5,%xmm3,%xmm3
-	vpaddq	%xmm3,%xmm13,%xmm13
-	vpshufd	$0x10,48(%rdi),%xmm2
-	vpmuludq	%xmm9,%xmm4,%xmm1
-	vpaddq	%xmm1,%xmm12,%xmm12
-	vpshufd	$0x10,64(%rdi),%xmm3
-	vpmuludq	%xmm8,%xmm4,%xmm0
-	vpaddq	%xmm0,%xmm11,%xmm11
-	vpmuludq	%xmm7,%xmm4,%xmm4
-	vpaddq	%xmm4,%xmm10,%xmm10
-
-	vpmuludq	%xmm5,%xmm2,%xmm2
-	vpaddq	%xmm2,%xmm14,%xmm14
-	vpmuludq	%xmm9,%xmm3,%xmm1
-	vpaddq	%xmm1,%xmm13,%xmm13
-	vpmuludq	%xmm8,%xmm3,%xmm0
-	vpaddq	%xmm0,%xmm12,%xmm12
-	vpmuludq	%xmm7,%xmm3,%xmm1
-	vpaddq	%xmm1,%xmm11,%xmm11
-	vpmuludq	%xmm6,%xmm3,%xmm3
-	vpaddq	%xmm3,%xmm10,%xmm10
-
-	jz	L$short_tail_avx
-
-	vmovdqu	0(%rsi),%xmm0
-	vmovdqu	16(%rsi),%xmm1
-
-	vpsrldq	$6,%xmm0,%xmm2
-	vpsrldq	$6,%xmm1,%xmm3
-	vpunpckhqdq	%xmm1,%xmm0,%xmm4
-	vpunpcklqdq	%xmm1,%xmm0,%xmm0
-	vpunpcklqdq	%xmm3,%xmm2,%xmm3
-
-	vpsrlq	$40,%xmm4,%xmm4
-	vpsrlq	$26,%xmm0,%xmm1
-	vpand	%xmm15,%xmm0,%xmm0
-	vpsrlq	$4,%xmm3,%xmm2
-	vpand	%xmm15,%xmm1,%xmm1
-	vpsrlq	$30,%xmm3,%xmm3
-	vpand	%xmm15,%xmm2,%xmm2
-	vpand	%xmm15,%xmm3,%xmm3
-	vpor	32(%rcx),%xmm4,%xmm4
-
-	vpshufd	$0x32,-64(%rdi),%xmm9
-	vpaddq	0(%r11),%xmm0,%xmm0
-	vpaddq	16(%r11),%xmm1,%xmm1
-	vpaddq	32(%r11),%xmm2,%xmm2
-	vpaddq	48(%r11),%xmm3,%xmm3
-	vpaddq	64(%r11),%xmm4,%xmm4
-
-
-
-
-	vpmuludq	%xmm0,%xmm9,%xmm5
-	vpaddq	%xmm5,%xmm10,%xmm10
-	vpmuludq	%xmm1,%xmm9,%xmm6
-	vpaddq	%xmm6,%xmm11,%xmm11
-	vpmuludq	%xmm2,%xmm9,%xmm5
-	vpaddq	%xmm5,%xmm12,%xmm12
-	vpshufd	$0x32,-48(%rdi),%xmm7
-	vpmuludq	%xmm3,%xmm9,%xmm6
-	vpaddq	%xmm6,%xmm13,%xmm13
-	vpmuludq	%xmm4,%xmm9,%xmm9
-	vpaddq	%xmm9,%xmm14,%xmm14
-
-	vpmuludq	%xmm3,%xmm7,%xmm5
-	vpaddq	%xmm5,%xmm14,%xmm14
-	vpshufd	$0x32,-32(%rdi),%xmm8
-	vpmuludq	%xmm2,%xmm7,%xmm6
-	vpaddq	%xmm6,%xmm13,%xmm13
-	vpshufd	$0x32,-16(%rdi),%xmm9
-	vpmuludq	%xmm1,%xmm7,%xmm5
-	vpaddq	%xmm5,%xmm12,%xmm12
-	vpmuludq	%xmm0,%xmm7,%xmm7
-	vpaddq	%xmm7,%xmm11,%xmm11
-	vpmuludq	%xmm4,%xmm8,%xmm8
-	vpaddq	%xmm8,%xmm10,%xmm10
-
-	vpshufd	$0x32,0(%rdi),%xmm7
-	vpmuludq	%xmm2,%xmm9,%xmm6
-	vpaddq	%xmm6,%xmm14,%xmm14
-	vpmuludq	%xmm1,%xmm9,%xmm5
-	vpaddq	%xmm5,%xmm13,%xmm13
-	vpshufd	$0x32,16(%rdi),%xmm8
-	vpmuludq	%xmm0,%xmm9,%xmm9
-	vpaddq	%xmm9,%xmm12,%xmm12
-	vpmuludq	%xmm4,%xmm7,%xmm6
-	vpaddq	%xmm6,%xmm11,%xmm11
-	vpshufd	$0x32,32(%rdi),%xmm9
-	vpmuludq	%xmm3,%xmm7,%xmm7
-	vpaddq	%xmm7,%xmm10,%xmm10
-
-	vpmuludq	%xmm1,%xmm8,%xmm5
-	vpaddq	%xmm5,%xmm14,%xmm14
-	vpmuludq	%xmm0,%xmm8,%xmm8
-	vpaddq	%xmm8,%xmm13,%xmm13
-	vpshufd	$0x32,48(%rdi),%xmm7
-	vpmuludq	%xmm4,%xmm9,%xmm6
-	vpaddq	%xmm6,%xmm12,%xmm12
-	vpshufd	$0x32,64(%rdi),%xmm8
-	vpmuludq	%xmm3,%xmm9,%xmm5
-	vpaddq	%xmm5,%xmm11,%xmm11
-	vpmuludq	%xmm2,%xmm9,%xmm9
-	vpaddq	%xmm9,%xmm10,%xmm10
-
-	vpmuludq	%xmm0,%xmm7,%xmm7
-	vpaddq	%xmm7,%xmm14,%xmm14
-	vpmuludq	%xmm4,%xmm8,%xmm6
-	vpaddq	%xmm6,%xmm13,%xmm13
-	vpmuludq	%xmm3,%xmm8,%xmm5
-	vpaddq	%xmm5,%xmm12,%xmm12
-	vpmuludq	%xmm2,%xmm8,%xmm6
-	vpaddq	%xmm6,%xmm11,%xmm11
-	vpmuludq	%xmm1,%xmm8,%xmm8
-	vpaddq	%xmm8,%xmm10,%xmm10
-
-L$short_tail_avx:
-
-
-
-	vpsrldq	$8,%xmm14,%xmm9
-	vpsrldq	$8,%xmm13,%xmm8
-	vpsrldq	$8,%xmm11,%xmm6
-	vpsrldq	$8,%xmm10,%xmm5
-	vpsrldq	$8,%xmm12,%xmm7
-	vpaddq	%xmm8,%xmm13,%xmm13
-	vpaddq	%xmm9,%xmm14,%xmm14
-	vpaddq	%xmm5,%xmm10,%xmm10
-	vpaddq	%xmm6,%xmm11,%xmm11
-	vpaddq	%xmm7,%xmm12,%xmm12
-
-
-
-
-	vpsrlq	$26,%xmm13,%xmm3
-	vpand	%xmm15,%xmm13,%xmm13
-	vpaddq	%xmm3,%xmm14,%xmm14
-
-	vpsrlq	$26,%xmm10,%xmm0
-	vpand	%xmm15,%xmm10,%xmm10
-	vpaddq	%xmm0,%xmm11,%xmm11
-
-	vpsrlq	$26,%xmm14,%xmm4
-	vpand	%xmm15,%xmm14,%xmm14
-
-	vpsrlq	$26,%xmm11,%xmm1
-	vpand	%xmm15,%xmm11,%xmm11
-	vpaddq	%xmm1,%xmm12,%xmm12
-
-	vpaddq	%xmm4,%xmm10,%xmm10
-	vpsllq	$2,%xmm4,%xmm4
-	vpaddq	%xmm4,%xmm10,%xmm10
-
-	vpsrlq	$26,%xmm12,%xmm2
-	vpand	%xmm15,%xmm12,%xmm12
-	vpaddq	%xmm2,%xmm13,%xmm13
-
-	vpsrlq	$26,%xmm10,%xmm0
-	vpand	%xmm15,%xmm10,%xmm10
-	vpaddq	%xmm0,%xmm11,%xmm11
-
-	vpsrlq	$26,%xmm13,%xmm3
-	vpand	%xmm15,%xmm13,%xmm13
-	vpaddq	%xmm3,%xmm14,%xmm14
-
-	vmovd	%xmm10,-112(%rdi)
-	vmovd	%xmm11,-108(%rdi)
-	vmovd	%xmm12,-104(%rdi)
-	vmovd	%xmm13,-100(%rdi)
-	vmovd	%xmm14,-96(%rdi)
-	leaq	88(%r11),%rsp
-	vzeroupper
-	.byte	0xf3,0xc3
-
-
-
-.p2align	5
-poly1305_emit_avx:
-	cmpl	$0,20(%rdi)
-	je	L$emit
-
-	movl	0(%rdi),%eax
-	movl	4(%rdi),%ecx
-	movl	8(%rdi),%r8d
-	movl	12(%rdi),%r11d
-	movl	16(%rdi),%r10d
-
-	shlq	$26,%rcx
-	movq	%r8,%r9
-	shlq	$52,%r8
-	addq	%rcx,%rax
-	shrq	$12,%r9
-	addq	%rax,%r8
-	adcq	$0,%r9
-
-	shlq	$14,%r11
-	movq	%r10,%rax
-	shrq	$24,%r10
-	addq	%r11,%r9
-	shlq	$40,%rax
-	addq	%rax,%r9
-	adcq	$0,%r10
-
-	movq	%r10,%rax
-	movq	%r10,%rcx
-	andq	$3,%r10
-	shrq	$2,%rax
-	andq	$-4,%rcx
-	addq	%rcx,%rax
-	addq	%rax,%r8
-	adcq	$0,%r9
-
-	movq	%r8,%rax
-	addq	$5,%r8
-	movq	%r9,%rcx
-	adcq	$0,%r9
-	adcq	$0,%r10
-	shrq	$2,%r10
-	cmovnzq	%r8,%rax
-	cmovnzq	%r9,%rcx
-
-	addq	0(%rdx),%rax
-	adcq	8(%rdx),%rcx
-	movq	%rax,0(%rsi)
-	movq	%rcx,8(%rsi)
-
-	.byte	0xf3,0xc3
-
-
-.p2align	5
-poly1305_blocks_avx2:
-	movl	20(%rdi),%r8d
-	cmpq	$128,%rdx
-	jae	L$blocks_avx2
-	testl	%r8d,%r8d
-	jz	L$blocks
-
-L$blocks_avx2:
-	andq	$-16,%rdx
-	jz	L$no_data_avx2
-
-	vzeroupper
-
-	testl	%r8d,%r8d
-	jz	L$base2_64_avx2
-
-	testq	$63,%rdx
-	jz	L$even_avx2
-
-	pushq	%rbx
-	pushq	%rbp
-	pushq	%r12
-	pushq	%r13
-	pushq	%r14
-	pushq	%r15
-L$blocks_avx2_body:
-
-	movq	%rdx,%r15
-
-	movq	0(%rdi),%r8
-	movq	8(%rdi),%r9
-	movl	16(%rdi),%ebp
-
-	movq	24(%rdi),%r11
-	movq	32(%rdi),%r13
-
-
-	movl	%r8d,%r14d
-	andq	$-1<<31,%r8
-	movq	%r9,%r12
-	movl	%r9d,%ebx
-	andq	$-1<<31,%r9
-
-	shrq	$6,%r8
-	shlq	$52,%r12
-	addq	%r8,%r14
-	shrq	$12,%rbx
-	shrq	$18,%r9
-	addq	%r12,%r14
-	adcq	%r9,%rbx
-
-	movq	%rbp,%r8
-	shlq	$40,%r8
-	shrq	$24,%rbp
-	addq	%r8,%rbx
-	adcq	$0,%rbp
-
-	movq	$-4,%r9
-	movq	%rbp,%r8
-	andq	%rbp,%r9
-	shrq	$2,%r8
-	andq	$3,%rbp
-	addq	%r9,%r8
-	addq	%r8,%r14
-	adcq	$0,%rbx
-
-	movq	%r13,%r12
-	movq	%r13,%rax
-	shrq	$2,%r13
-	addq	%r12,%r13
-
-L$base2_26_pre_avx2:
-	addq	0(%rsi),%r14
-	adcq	8(%rsi),%rbx
-	leaq	16(%rsi),%rsi
-	adcq	%rcx,%rbp
-	subq	$16,%r15
-
-	call	__poly1305_block
-	movq	%r12,%rax
-
-	testq	$63,%r15
-	jnz	L$base2_26_pre_avx2
-
-	testq	%rcx,%rcx
-	jz	L$store_base2_64_avx2
-
-
-	movq	%r14,%rax
-	movq	%r14,%rdx
-	shrq	$52,%r14
-	movq	%rbx,%r11
-	movq	%rbx,%r12
-	shrq	$26,%rdx
-	andq	$0x3ffffff,%rax
-	shlq	$12,%r11
-	andq	$0x3ffffff,%rdx
-	shrq	$14,%rbx
-	orq	%r11,%r14
-	shlq	$24,%rbp
-	andq	$0x3ffffff,%r14
-	shrq	$40,%r12
-	andq	$0x3ffffff,%rbx
-	orq	%r12,%rbp
-
-	testq	%r15,%r15
-	jz	L$store_base2_26_avx2
-
-	vmovd	%eax,%xmm0
-	vmovd	%edx,%xmm1
-	vmovd	%r14d,%xmm2
-	vmovd	%ebx,%xmm3
-	vmovd	%ebp,%xmm4
-	jmp	L$proceed_avx2
-
-.p2align	5
-L$store_base2_64_avx2:
-	movq	%r14,0(%rdi)
-	movq	%rbx,8(%rdi)
-	movq	%rbp,16(%rdi)
-	jmp	L$done_avx2
-
-.p2align	4
-L$store_base2_26_avx2:
-	movl	%eax,0(%rdi)
-	movl	%edx,4(%rdi)
-	movl	%r14d,8(%rdi)
-	movl	%ebx,12(%rdi)
-	movl	%ebp,16(%rdi)
-.p2align	4
-L$done_avx2:
-	movq	0(%rsp),%r15
-	movq	8(%rsp),%r14
-	movq	16(%rsp),%r13
-	movq	24(%rsp),%r12
-	movq	32(%rsp),%rbp
-	movq	40(%rsp),%rbx
-	leaq	48(%rsp),%rsp
-L$no_data_avx2:
-L$blocks_avx2_epilogue:
-	.byte	0xf3,0xc3
-
-.p2align	5
-L$base2_64_avx2:
-	pushq	%rbx
-	pushq	%rbp
-	pushq	%r12
-	pushq	%r13
-	pushq	%r14
-	pushq	%r15
-L$base2_64_avx2_body:
-
-	movq	%rdx,%r15
-
-	movq	24(%rdi),%r11
-	movq	32(%rdi),%r13
-
-	movq	0(%rdi),%r14
-	movq	8(%rdi),%rbx
-	movl	16(%rdi),%ebp
-
-	movq	%r13,%r12
-	movq	%r13,%rax
-	shrq	$2,%r13
-	addq	%r12,%r13
-
-	testq	$63,%rdx
-	jz	L$init_avx2
-
-L$base2_64_pre_avx2:
-	addq	0(%rsi),%r14
-	adcq	8(%rsi),%rbx
-	leaq	16(%rsi),%rsi
-	adcq	%rcx,%rbp
-	subq	$16,%r15
-
-	call	__poly1305_block
-	movq	%r12,%rax
-
-	testq	$63,%r15
-	jnz	L$base2_64_pre_avx2
-
-L$init_avx2:
-
-	movq	%r14,%rax
-	movq	%r14,%rdx
-	shrq	$52,%r14
-	movq	%rbx,%r8
-	movq	%rbx,%r9
-	shrq	$26,%rdx
-	andq	$0x3ffffff,%rax
-	shlq	$12,%r8
-	andq	$0x3ffffff,%rdx
-	shrq	$14,%rbx
-	orq	%r8,%r14
-	shlq	$24,%rbp
-	andq	$0x3ffffff,%r14
-	shrq	$40,%r9
-	andq	$0x3ffffff,%rbx
-	orq	%r9,%rbp
-
-	vmovd	%eax,%xmm0
-	vmovd	%edx,%xmm1
-	vmovd	%r14d,%xmm2
-	vmovd	%ebx,%xmm3
-	vmovd	%ebp,%xmm4
-	movl	$1,20(%rdi)
-
-	call	__poly1305_init_avx
-
-L$proceed_avx2:
-	movq	%r15,%rdx
-
-	movq	0(%rsp),%r15
-	movq	8(%rsp),%r14
-	movq	16(%rsp),%r13
-	movq	24(%rsp),%r12
-	movq	32(%rsp),%rbp
-	movq	40(%rsp),%rbx
-	leaq	48(%rsp),%rax
-	leaq	48(%rsp),%rsp
-L$base2_64_avx2_epilogue:
-	jmp	L$do_avx2
-
-.p2align	5
-L$even_avx2:
-	vmovd	0(%rdi),%xmm0
-	vmovd	4(%rdi),%xmm1
-	vmovd	8(%rdi),%xmm2
-	vmovd	12(%rdi),%xmm3
-	vmovd	16(%rdi),%xmm4
-
-L$do_avx2:
-	leaq	-8(%rsp),%r11
-	subq	$0x128,%rsp
-	leaq	48+64(%rdi),%rdi
-	leaq	L$const(%rip),%rcx
-
-
-	vmovdqu	-64(%rdi),%xmm9
-	andq	$-512,%rsp
-	vmovdqu	-48(%rdi),%xmm10
-	vmovdqu	-32(%rdi),%xmm6
-	vmovdqu	-16(%rdi),%xmm11
-	vmovdqu	0(%rdi),%xmm12
-	vmovdqu	16(%rdi),%xmm13
-	vmovdqu	32(%rdi),%xmm14
-	vpermq	$0x15,%ymm9,%ymm9
-	vmovdqu	48(%rdi),%xmm15
-	vpermq	$0x15,%ymm10,%ymm10
-	vpshufd	$0xc8,%ymm9,%ymm9
-	vmovdqu	64(%rdi),%xmm5
-	vpermq	$0x15,%ymm6,%ymm6
-	vpshufd	$0xc8,%ymm10,%ymm10
-	vmovdqa	%ymm9,0(%rsp)
-	vpermq	$0x15,%ymm11,%ymm11
-	vpshufd	$0xc8,%ymm6,%ymm6
-	vmovdqa	%ymm10,32(%rsp)
-	vpermq	$0x15,%ymm12,%ymm12
-	vpshufd	$0xc8,%ymm11,%ymm11
-	vmovdqa	%ymm6,64(%rsp)
-	vpermq	$0x15,%ymm13,%ymm13
-	vpshufd	$0xc8,%ymm12,%ymm12
-	vmovdqa	%ymm11,96(%rsp)
-	vpermq	$0x15,%ymm14,%ymm14
-	vpshufd	$0xc8,%ymm13,%ymm13
-	vmovdqa	%ymm12,128(%rsp)
-	vpermq	$0x15,%ymm15,%ymm15
-	vpshufd	$0xc8,%ymm14,%ymm14
-	vmovdqa	%ymm13,160(%rsp)
-	vpermq	$0x15,%ymm5,%ymm5
-	vpshufd	$0xc8,%ymm15,%ymm15
-	vmovdqa	%ymm14,192(%rsp)
-	vpshufd	$0xc8,%ymm5,%ymm5
-	vmovdqa	%ymm15,224(%rsp)
-	vmovdqa	%ymm5,256(%rsp)
-	vmovdqa	64(%rcx),%ymm5
-
-
-
-	vmovdqu	0(%rsi),%xmm7
-	vmovdqu	16(%rsi),%xmm8
-	vinserti128	$1,32(%rsi),%ymm7,%ymm7
-	vinserti128	$1,48(%rsi),%ymm8,%ymm8
-	leaq	64(%rsi),%rsi
-
-	vpsrldq	$6,%ymm7,%ymm9
-	vpsrldq	$6,%ymm8,%ymm10
-	vpunpckhqdq	%ymm8,%ymm7,%ymm6
-	vpunpcklqdq	%ymm10,%ymm9,%ymm9
-	vpunpcklqdq	%ymm8,%ymm7,%ymm7
-
-	vpsrlq	$30,%ymm9,%ymm10
-	vpsrlq	$4,%ymm9,%ymm9
-	vpsrlq	$26,%ymm7,%ymm8
-	vpsrlq	$40,%ymm6,%ymm6
-	vpand	%ymm5,%ymm9,%ymm9
-	vpand	%ymm5,%ymm7,%ymm7
-	vpand	%ymm5,%ymm8,%ymm8
-	vpand	%ymm5,%ymm10,%ymm10
-	vpor	32(%rcx),%ymm6,%ymm6
-
-	leaq	144(%rsp),%rax
-	vpaddq	%ymm2,%ymm9,%ymm2
-	subq	$64,%rdx
-	jz	L$tail_avx2
-	jmp	L$oop_avx2
-
-.p2align	5
-L$oop_avx2:
-
-
-
-
-
-
-
-
-	vpaddq	%ymm0,%ymm7,%ymm0
-	vmovdqa	0(%rsp),%ymm7
-	vpaddq	%ymm1,%ymm8,%ymm1
-	vmovdqa	32(%rsp),%ymm8
-	vpaddq	%ymm3,%ymm10,%ymm3
-	vmovdqa	96(%rsp),%ymm9
-	vpaddq	%ymm4,%ymm6,%ymm4
-	vmovdqa	48(%rax),%ymm10
-	vmovdqa	112(%rax),%ymm5
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-	vpmuludq	%ymm2,%ymm7,%ymm13
-	vpmuludq	%ymm2,%ymm8,%ymm14
-	vpmuludq	%ymm2,%ymm9,%ymm15
-	vpmuludq	%ymm2,%ymm10,%ymm11
-	vpmuludq	%ymm2,%ymm5,%ymm12
-
-	vpmuludq	%ymm0,%ymm8,%ymm6
-	vpmuludq	%ymm1,%ymm8,%ymm2
-	vpaddq	%ymm6,%ymm12,%ymm12
-	vpaddq	%ymm2,%ymm13,%ymm13
-	vpmuludq	%ymm3,%ymm8,%ymm6
-	vpmuludq	64(%rsp),%ymm4,%ymm2
-	vpaddq	%ymm6,%ymm15,%ymm15
-	vpaddq	%ymm2,%ymm11,%ymm11
-	vmovdqa	-16(%rax),%ymm8
-
-	vpmuludq	%ymm0,%ymm7,%ymm6
-	vpmuludq	%ymm1,%ymm7,%ymm2
-	vpaddq	%ymm6,%ymm11,%ymm11
-	vpaddq	%ymm2,%ymm12,%ymm12
-	vpmuludq	%ymm3,%ymm7,%ymm6
-	vpmuludq	%ymm4,%ymm7,%ymm2
-	vmovdqu	0(%rsi),%xmm7
-	vpaddq	%ymm6,%ymm14,%ymm14
-	vpaddq	%ymm2,%ymm15,%ymm15
-	vinserti128	$1,32(%rsi),%ymm7,%ymm7
-
-	vpmuludq	%ymm3,%ymm8,%ymm6
-	vpmuludq	%ymm4,%ymm8,%ymm2
-	vmovdqu	16(%rsi),%xmm8
-	vpaddq	%ymm6,%ymm11,%ymm11
-	vpaddq	%ymm2,%ymm12,%ymm12
-	vmovdqa	16(%rax),%ymm2
-	vpmuludq	%ymm1,%ymm9,%ymm6
-	vpmuludq	%ymm0,%ymm9,%ymm9
-	vpaddq	%ymm6,%ymm14,%ymm14
-	vpaddq	%ymm9,%ymm13,%ymm13
-	vinserti128	$1,48(%rsi),%ymm8,%ymm8
-	leaq	64(%rsi),%rsi
-
-	vpmuludq	%ymm1,%ymm2,%ymm6
-	vpmuludq	%ymm0,%ymm2,%ymm2
-	vpsrldq	$6,%ymm7,%ymm9
-	vpaddq	%ymm6,%ymm15,%ymm15
-	vpaddq	%ymm2,%ymm14,%ymm14
-	vpmuludq	%ymm3,%ymm10,%ymm6
-	vpmuludq	%ymm4,%ymm10,%ymm2
-	vpsrldq	$6,%ymm8,%ymm10
-	vpaddq	%ymm6,%ymm12,%ymm12
-	vpaddq	%ymm2,%ymm13,%ymm13
-	vpunpckhqdq	%ymm8,%ymm7,%ymm6
-
-	vpmuludq	%ymm3,%ymm5,%ymm3
-	vpmuludq	%ymm4,%ymm5,%ymm4
-	vpunpcklqdq	%ymm8,%ymm7,%ymm7
-	vpaddq	%ymm3,%ymm13,%ymm2
-	vpaddq	%ymm4,%ymm14,%ymm3
-	vpunpcklqdq	%ymm10,%ymm9,%ymm10
-	vpmuludq	80(%rax),%ymm0,%ymm4
-	vpmuludq	%ymm1,%ymm5,%ymm0
-	vmovdqa	64(%rcx),%ymm5
-	vpaddq	%ymm4,%ymm15,%ymm4
-	vpaddq	%ymm0,%ymm11,%ymm0
-
-
-
-
-	vpsrlq	$26,%ymm3,%ymm14
-	vpand	%ymm5,%ymm3,%ymm3
-	vpaddq	%ymm14,%ymm4,%ymm4
-
-	vpsrlq	$26,%ymm0,%ymm11
-	vpand	%ymm5,%ymm0,%ymm0
-	vpaddq	%ymm11,%ymm12,%ymm1
-
-	vpsrlq	$26,%ymm4,%ymm15
-	vpand	%ymm5,%ymm4,%ymm4
-
-	vpsrlq	$4,%ymm10,%ymm9
-
-	vpsrlq	$26,%ymm1,%ymm12
-	vpand	%ymm5,%ymm1,%ymm1
-	vpaddq	%ymm12,%ymm2,%ymm2
-
-	vpaddq	%ymm15,%ymm0,%ymm0
-	vpsllq	$2,%ymm15,%ymm15
-	vpaddq	%ymm15,%ymm0,%ymm0
-
-	vpand	%ymm5,%ymm9,%ymm9
-	vpsrlq	$26,%ymm7,%ymm8
-
-	vpsrlq	$26,%ymm2,%ymm13
-	vpand	%ymm5,%ymm2,%ymm2
-	vpaddq	%ymm13,%ymm3,%ymm3
-
-	vpaddq	%ymm9,%ymm2,%ymm2
-	vpsrlq	$30,%ymm10,%ymm10
-
-	vpsrlq	$26,%ymm0,%ymm11
-	vpand	%ymm5,%ymm0,%ymm0
-	vpaddq	%ymm11,%ymm1,%ymm1
-
-	vpsrlq	$40,%ymm6,%ymm6
-
-	vpsrlq	$26,%ymm3,%ymm14
-	vpand	%ymm5,%ymm3,%ymm3
-	vpaddq	%ymm14,%ymm4,%ymm4
-
-	vpand	%ymm5,%ymm7,%ymm7
-	vpand	%ymm5,%ymm8,%ymm8
-	vpand	%ymm5,%ymm10,%ymm10
-	vpor	32(%rcx),%ymm6,%ymm6
-
-	subq	$64,%rdx
-	jnz	L$oop_avx2
-
-.byte	0x66,0x90
-L$tail_avx2:
-
-
-
-
-
-
-
-	vpaddq	%ymm0,%ymm7,%ymm0
-	vmovdqu	4(%rsp),%ymm7
-	vpaddq	%ymm1,%ymm8,%ymm1
-	vmovdqu	36(%rsp),%ymm8
-	vpaddq	%ymm3,%ymm10,%ymm3
-	vmovdqu	100(%rsp),%ymm9
-	vpaddq	%ymm4,%ymm6,%ymm4
-	vmovdqu	52(%rax),%ymm10
-	vmovdqu	116(%rax),%ymm5
-
-	vpmuludq	%ymm2,%ymm7,%ymm13
-	vpmuludq	%ymm2,%ymm8,%ymm14
-	vpmuludq	%ymm2,%ymm9,%ymm15
-	vpmuludq	%ymm2,%ymm10,%ymm11
-	vpmuludq	%ymm2,%ymm5,%ymm12
-
-	vpmuludq	%ymm0,%ymm8,%ymm6
-	vpmuludq	%ymm1,%ymm8,%ymm2
-	vpaddq	%ymm6,%ymm12,%ymm12
-	vpaddq	%ymm2,%ymm13,%ymm13
-	vpmuludq	%ymm3,%ymm8,%ymm6
-	vpmuludq	68(%rsp),%ymm4,%ymm2
-	vpaddq	%ymm6,%ymm15,%ymm15
-	vpaddq	%ymm2,%ymm11,%ymm11
-
-	vpmuludq	%ymm0,%ymm7,%ymm6
-	vpmuludq	%ymm1,%ymm7,%ymm2
-	vpaddq	%ymm6,%ymm11,%ymm11
-	vmovdqu	-12(%rax),%ymm8
-	vpaddq	%ymm2,%ymm12,%ymm12
-	vpmuludq	%ymm3,%ymm7,%ymm6
-	vpmuludq	%ymm4,%ymm7,%ymm2
-	vpaddq	%ymm6,%ymm14,%ymm14
-	vpaddq	%ymm2,%ymm15,%ymm15
-
-	vpmuludq	%ymm3,%ymm8,%ymm6
-	vpmuludq	%ymm4,%ymm8,%ymm2
-	vpaddq	%ymm6,%ymm11,%ymm11
-	vpaddq	%ymm2,%ymm12,%ymm12
-	vmovdqu	20(%rax),%ymm2
-	vpmuludq	%ymm1,%ymm9,%ymm6
-	vpmuludq	%ymm0,%ymm9,%ymm9
-	vpaddq	%ymm6,%ymm14,%ymm14
-	vpaddq	%ymm9,%ymm13,%ymm13
-
-	vpmuludq	%ymm1,%ymm2,%ymm6
-	vpmuludq	%ymm0,%ymm2,%ymm2
-	vpaddq	%ymm6,%ymm15,%ymm15
-	vpaddq	%ymm2,%ymm14,%ymm14
-	vpmuludq	%ymm3,%ymm10,%ymm6
-	vpmuludq	%ymm4,%ymm10,%ymm2
-	vpaddq	%ymm6,%ymm12,%ymm12
-	vpaddq	%ymm2,%ymm13,%ymm13
-
-	vpmuludq	%ymm3,%ymm5,%ymm3
-	vpmuludq	%ymm4,%ymm5,%ymm4
-	vpaddq	%ymm3,%ymm13,%ymm2
-	vpaddq	%ymm4,%ymm14,%ymm3
-	vpmuludq	84(%rax),%ymm0,%ymm4
-	vpmuludq	%ymm1,%ymm5,%ymm0
-	vmovdqa	64(%rcx),%ymm5
-	vpaddq	%ymm4,%ymm15,%ymm4
-	vpaddq	%ymm0,%ymm11,%ymm0
-
-
-
-
-	vpsrldq	$8,%ymm12,%ymm8
-	vpsrldq	$8,%ymm2,%ymm9
-	vpsrldq	$8,%ymm3,%ymm10
-	vpsrldq	$8,%ymm4,%ymm6
-	vpsrldq	$8,%ymm0,%ymm7
-	vpaddq	%ymm8,%ymm12,%ymm12
-	vpaddq	%ymm9,%ymm2,%ymm2
-	vpaddq	%ymm10,%ymm3,%ymm3
-	vpaddq	%ymm6,%ymm4,%ymm4
-	vpaddq	%ymm7,%ymm0,%ymm0
-
-	vpermq	$0x2,%ymm3,%ymm10
-	vpermq	$0x2,%ymm4,%ymm6
-	vpermq	$0x2,%ymm0,%ymm7
-	vpermq	$0x2,%ymm12,%ymm8
-	vpermq	$0x2,%ymm2,%ymm9
-	vpaddq	%ymm10,%ymm3,%ymm3
-	vpaddq	%ymm6,%ymm4,%ymm4
-	vpaddq	%ymm7,%ymm0,%ymm0
-	vpaddq	%ymm8,%ymm12,%ymm12
-	vpaddq	%ymm9,%ymm2,%ymm2
-
-
-
-
-	vpsrlq	$26,%ymm3,%ymm14
-	vpand	%ymm5,%ymm3,%ymm3
-	vpaddq	%ymm14,%ymm4,%ymm4
-
-	vpsrlq	$26,%ymm0,%ymm11
-	vpand	%ymm5,%ymm0,%ymm0
-	vpaddq	%ymm11,%ymm12,%ymm1
-
-	vpsrlq	$26,%ymm4,%ymm15
-	vpand	%ymm5,%ymm4,%ymm4
-
-	vpsrlq	$26,%ymm1,%ymm12
-	vpand	%ymm5,%ymm1,%ymm1
-	vpaddq	%ymm12,%ymm2,%ymm2
-
-	vpaddq	%ymm15,%ymm0,%ymm0
-	vpsllq	$2,%ymm15,%ymm15
-	vpaddq	%ymm15,%ymm0,%ymm0
-
-	vpsrlq	$26,%ymm2,%ymm13
-	vpand	%ymm5,%ymm2,%ymm2
-	vpaddq	%ymm13,%ymm3,%ymm3
-
-	vpsrlq	$26,%ymm0,%ymm11
-	vpand	%ymm5,%ymm0,%ymm0
-	vpaddq	%ymm11,%ymm1,%ymm1
-
-	vpsrlq	$26,%ymm3,%ymm14
-	vpand	%ymm5,%ymm3,%ymm3
-	vpaddq	%ymm14,%ymm4,%ymm4
-
-	vmovd	%xmm0,-112(%rdi)
-	vmovd	%xmm1,-108(%rdi)
-	vmovd	%xmm2,-104(%rdi)
-	vmovd	%xmm3,-100(%rdi)
-	vmovd	%xmm4,-96(%rdi)
-	leaq	8(%r11),%rsp
-	vzeroupper
-	.byte	0xf3,0xc3
-
-.p2align	6
-L$const:
-L$mask24:
-.long	0x0ffffff,0,0x0ffffff,0,0x0ffffff,0,0x0ffffff,0
-L$129:
-.long	1<<24,0,1<<24,0,1<<24,0,1<<24,0
-L$mask26:
-.long	0x3ffffff,0,0x3ffffff,0,0x3ffffff,0,0x3ffffff,0
-L$five:
-.long	5,0,5,0,5,0,5,0
-.byte	80,111,108,121,49,51,48,53,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
-.p2align	4
-#endif
diff --git a/third_party/boringssl/win-x86/crypto/poly1305/poly1305-x86.asm b/third_party/boringssl/win-x86/crypto/poly1305/poly1305-x86.asm
deleted file mode 100644
index e18777e2..0000000
--- a/third_party/boringssl/win-x86/crypto/poly1305/poly1305-x86.asm
+++ /dev/null
@@ -1,1358 +0,0 @@
-%ifidn __OUTPUT_FORMAT__,obj
-section	code	use32 class=code align=64
-%elifidn __OUTPUT_FORMAT__,win32
-%ifdef __YASM_VERSION_ID__
-%if __YASM_VERSION_ID__ < 01010000h
-%error yasm version 1.1.0 or later needed.
-%endif
-; Yasm automatically includes .00 and complains about redefining it.
-; https://www.tortall.net/projects/yasm/manual/html/objfmt-win32-safeseh.html
-%else
-$@feat.00 equ 1
-%endif
-section	.text	code align=64
-%else
-section	.text	code
-%endif
-;extern	_OPENSSL_ia32cap_P
-align	64
-global	_poly1305_init
-align	16
-_poly1305_init:
-L$_poly1305_init_begin:
-	push	ebp
-	push	ebx
-	push	esi
-	push	edi
-	mov	edi,DWORD [20+esp]
-	mov	esi,DWORD [24+esp]
-	mov	ebp,DWORD [28+esp]
-	xor	eax,eax
-	mov	DWORD [edi],eax
-	mov	DWORD [4+edi],eax
-	mov	DWORD [8+edi],eax
-	mov	DWORD [12+edi],eax
-	mov	DWORD [16+edi],eax
-	mov	DWORD [20+edi],eax
-	cmp	esi,0
-	je	NEAR L$000nokey
-	call	L$001pic_point
-L$001pic_point:
-	pop	ebx
-	lea	eax,[(_poly1305_blocks-L$001pic_point)+ebx]
-	lea	edx,[(_poly1305_emit-L$001pic_point)+ebx]
-	lea	edi,[_OPENSSL_ia32cap_P]
-	mov	ecx,DWORD [edi]
-	and	ecx,83886080
-	cmp	ecx,83886080
-	jne	NEAR L$002no_sse2
-	lea	eax,[(__poly1305_blocks_sse2-L$001pic_point)+ebx]
-	lea	edx,[(__poly1305_emit_sse2-L$001pic_point)+ebx]
-L$002no_sse2:
-	mov	edi,DWORD [20+esp]
-	mov	DWORD [ebp],eax
-	mov	DWORD [4+ebp],edx
-	mov	eax,DWORD [esi]
-	mov	ebx,DWORD [4+esi]
-	mov	ecx,DWORD [8+esi]
-	mov	edx,DWORD [12+esi]
-	and	eax,268435455
-	and	ebx,268435452
-	and	ecx,268435452
-	and	edx,268435452
-	mov	DWORD [24+edi],eax
-	mov	DWORD [28+edi],ebx
-	mov	DWORD [32+edi],ecx
-	mov	DWORD [36+edi],edx
-	mov	eax,1
-L$000nokey:
-	pop	edi
-	pop	esi
-	pop	ebx
-	pop	ebp
-	ret
-global	_poly1305_blocks
-align	16
-_poly1305_blocks:
-L$_poly1305_blocks_begin:
-	push	ebp
-	push	ebx
-	push	esi
-	push	edi
-	mov	edi,DWORD [20+esp]
-	mov	esi,DWORD [24+esp]
-	mov	ecx,DWORD [28+esp]
-L$enter_blocks:
-	and	ecx,-15
-	jz	NEAR L$003nodata
-	sub	esp,64
-	mov	eax,DWORD [24+edi]
-	mov	ebx,DWORD [28+edi]
-	lea	ebp,[ecx*1+esi]
-	mov	ecx,DWORD [32+edi]
-	mov	edx,DWORD [36+edi]
-	mov	DWORD [92+esp],ebp
-	mov	ebp,esi
-	mov	DWORD [36+esp],eax
-	mov	eax,ebx
-	shr	eax,2
-	mov	DWORD [40+esp],ebx
-	add	eax,ebx
-	mov	ebx,ecx
-	shr	ebx,2
-	mov	DWORD [44+esp],ecx
-	add	ebx,ecx
-	mov	ecx,edx
-	shr	ecx,2
-	mov	DWORD [48+esp],edx
-	add	ecx,edx
-	mov	DWORD [52+esp],eax
-	mov	DWORD [56+esp],ebx
-	mov	DWORD [60+esp],ecx
-	mov	eax,DWORD [edi]
-	mov	ebx,DWORD [4+edi]
-	mov	ecx,DWORD [8+edi]
-	mov	esi,DWORD [12+edi]
-	mov	edi,DWORD [16+edi]
-	jmp	NEAR L$004loop
-align	32
-L$004loop:
-	add	eax,DWORD [ebp]
-	adc	ebx,DWORD [4+ebp]
-	adc	ecx,DWORD [8+ebp]
-	adc	esi,DWORD [12+ebp]
-	lea	ebp,[16+ebp]
-	adc	edi,DWORD [96+esp]
-	mov	DWORD [esp],eax
-	mov	DWORD [12+esp],esi
-	mul	DWORD [36+esp]
-	mov	DWORD [16+esp],edi
-	mov	edi,eax
-	mov	eax,ebx
-	mov	esi,edx
-	mul	DWORD [60+esp]
-	add	edi,eax
-	mov	eax,ecx
-	adc	esi,edx
-	mul	DWORD [56+esp]
-	add	edi,eax
-	mov	eax,DWORD [12+esp]
-	adc	esi,edx
-	mul	DWORD [52+esp]
-	add	edi,eax
-	mov	eax,DWORD [esp]
-	adc	esi,edx
-	mul	DWORD [40+esp]
-	mov	DWORD [20+esp],edi
-	xor	edi,edi
-	add	esi,eax
-	mov	eax,ebx
-	adc	edi,edx
-	mul	DWORD [36+esp]
-	add	esi,eax
-	mov	eax,ecx
-	adc	edi,edx
-	mul	DWORD [60+esp]
-	add	esi,eax
-	mov	eax,DWORD [12+esp]
-	adc	edi,edx
-	mul	DWORD [56+esp]
-	add	esi,eax
-	mov	eax,DWORD [16+esp]
-	adc	edi,edx
-	imul	eax,DWORD [52+esp]
-	add	esi,eax
-	mov	eax,DWORD [esp]
-	adc	edi,0
-	mul	DWORD [44+esp]
-	mov	DWORD [24+esp],esi
-	xor	esi,esi
-	add	edi,eax
-	mov	eax,ebx
-	adc	esi,edx
-	mul	DWORD [40+esp]
-	add	edi,eax
-	mov	eax,ecx
-	adc	esi,edx
-	mul	DWORD [36+esp]
-	add	edi,eax
-	mov	eax,DWORD [12+esp]
-	adc	esi,edx
-	mul	DWORD [60+esp]
-	add	edi,eax
-	mov	eax,DWORD [16+esp]
-	adc	esi,edx
-	imul	eax,DWORD [56+esp]
-	add	edi,eax
-	mov	eax,DWORD [esp]
-	adc	esi,0
-	mul	DWORD [48+esp]
-	mov	DWORD [28+esp],edi
-	xor	edi,edi
-	add	esi,eax
-	mov	eax,ebx
-	adc	edi,edx
-	mul	DWORD [44+esp]
-	add	esi,eax
-	mov	eax,ecx
-	adc	edi,edx
-	mul	DWORD [40+esp]
-	add	esi,eax
-	mov	eax,DWORD [12+esp]
-	adc	edi,edx
-	mul	DWORD [36+esp]
-	add	esi,eax
-	mov	ecx,DWORD [16+esp]
-	adc	edi,edx
-	mov	edx,ecx
-	imul	ecx,DWORD [60+esp]
-	add	esi,ecx
-	mov	eax,DWORD [20+esp]
-	adc	edi,0
-	imul	edx,DWORD [36+esp]
-	add	edx,edi
-	mov	ebx,DWORD [24+esp]
-	mov	ecx,DWORD [28+esp]
-	mov	edi,edx
-	shr	edx,2
-	and	edi,3
-	lea	edx,[edx*4+edx]
-	add	eax,edx
-	adc	ebx,0
-	adc	ecx,0
-	adc	esi,0
-	cmp	ebp,DWORD [92+esp]
-	jne	NEAR L$004loop
-	mov	edx,DWORD [84+esp]
-	add	esp,64
-	mov	DWORD [edx],eax
-	mov	DWORD [4+edx],ebx
-	mov	DWORD [8+edx],ecx
-	mov	DWORD [12+edx],esi
-	mov	DWORD [16+edx],edi
-L$003nodata:
-	pop	edi
-	pop	esi
-	pop	ebx
-	pop	ebp
-	ret
-global	_poly1305_emit
-align	16
-_poly1305_emit:
-L$_poly1305_emit_begin:
-	push	ebp
-	push	ebx
-	push	esi
-	push	edi
-	mov	ebp,DWORD [20+esp]
-L$enter_emit:
-	mov	edi,DWORD [24+esp]
-	mov	eax,DWORD [ebp]
-	mov	ebx,DWORD [4+ebp]
-	mov	ecx,DWORD [8+ebp]
-	mov	edx,DWORD [12+ebp]
-	mov	esi,DWORD [16+ebp]
-	add	eax,5
-	adc	ebx,0
-	adc	ecx,0
-	adc	edx,0
-	adc	esi,0
-	shr	esi,2
-	neg	esi
-	and	eax,esi
-	and	ebx,esi
-	and	ecx,esi
-	and	edx,esi
-	mov	DWORD [edi],eax
-	mov	DWORD [4+edi],ebx
-	mov	DWORD [8+edi],ecx
-	mov	DWORD [12+edi],edx
-	not	esi
-	mov	eax,DWORD [ebp]
-	mov	ebx,DWORD [4+ebp]
-	mov	ecx,DWORD [8+ebp]
-	mov	edx,DWORD [12+ebp]
-	mov	ebp,DWORD [28+esp]
-	and	eax,esi
-	and	ebx,esi
-	and	ecx,esi
-	and	edx,esi
-	or	eax,DWORD [edi]
-	or	ebx,DWORD [4+edi]
-	or	ecx,DWORD [8+edi]
-	or	edx,DWORD [12+edi]
-	add	eax,DWORD [ebp]
-	adc	ebx,DWORD [4+ebp]
-	adc	ecx,DWORD [8+ebp]
-	adc	edx,DWORD [12+ebp]
-	mov	DWORD [edi],eax
-	mov	DWORD [4+edi],ebx
-	mov	DWORD [8+edi],ecx
-	mov	DWORD [12+edi],edx
-	pop	edi
-	pop	esi
-	pop	ebx
-	pop	ebp
-	ret
-align	32
-align	16
-__poly1305_init_sse2:
-	movdqu	xmm4,[24+edi]
-	lea	edi,[48+edi]
-	mov	ebp,esp
-	sub	esp,224
-	and	esp,-16
-	movq	xmm7,[64+ebx]
-	movdqa	xmm0,xmm4
-	movdqa	xmm1,xmm4
-	movdqa	xmm2,xmm4
-	pand	xmm0,xmm7
-	psrlq	xmm1,26
-	psrldq	xmm2,6
-	pand	xmm1,xmm7
-	movdqa	xmm3,xmm2
-	psrlq	xmm2,4
-	psrlq	xmm3,30
-	pand	xmm2,xmm7
-	pand	xmm3,xmm7
-	psrldq	xmm4,13
-	lea	edx,[144+esp]
-	mov	ecx,2
-L$005square:
-	movdqa	[esp],xmm0
-	movdqa	[16+esp],xmm1
-	movdqa	[32+esp],xmm2
-	movdqa	[48+esp],xmm3
-	movdqa	[64+esp],xmm4
-	movdqa	xmm6,xmm1
-	movdqa	xmm5,xmm2
-	pslld	xmm6,2
-	pslld	xmm5,2
-	paddd	xmm6,xmm1
-	paddd	xmm5,xmm2
-	movdqa	[80+esp],xmm6
-	movdqa	[96+esp],xmm5
-	movdqa	xmm6,xmm3
-	movdqa	xmm5,xmm4
-	pslld	xmm6,2
-	pslld	xmm5,2
-	paddd	xmm6,xmm3
-	paddd	xmm5,xmm4
-	movdqa	[112+esp],xmm6
-	movdqa	[128+esp],xmm5
-	pshufd	xmm6,xmm0,68
-	movdqa	xmm5,xmm1
-	pshufd	xmm1,xmm1,68
-	pshufd	xmm2,xmm2,68
-	pshufd	xmm3,xmm3,68
-	pshufd	xmm4,xmm4,68
-	movdqa	[edx],xmm6
-	movdqa	[16+edx],xmm1
-	movdqa	[32+edx],xmm2
-	movdqa	[48+edx],xmm3
-	movdqa	[64+edx],xmm4
-	pmuludq	xmm4,xmm0
-	pmuludq	xmm3,xmm0
-	pmuludq	xmm2,xmm0
-	pmuludq	xmm1,xmm0
-	pmuludq	xmm0,xmm6
-	movdqa	xmm6,xmm5
-	pmuludq	xmm5,[48+edx]
-	movdqa	xmm7,xmm6
-	pmuludq	xmm6,[32+edx]
-	paddq	xmm4,xmm5
-	movdqa	xmm5,xmm7
-	pmuludq	xmm7,[16+edx]
-	paddq	xmm3,xmm6
-	movdqa	xmm6,[80+esp]
-	pmuludq	xmm5,[edx]
-	paddq	xmm2,xmm7
-	pmuludq	xmm6,[64+edx]
-	movdqa	xmm7,[32+esp]
-	paddq	xmm1,xmm5
-	movdqa	xmm5,xmm7
-	pmuludq	xmm7,[32+edx]
-	paddq	xmm0,xmm6
-	movdqa	xmm6,xmm5
-	pmuludq	xmm5,[16+edx]
-	paddq	xmm4,xmm7
-	movdqa	xmm7,[96+esp]
-	pmuludq	xmm6,[edx]
-	paddq	xmm3,xmm5
-	movdqa	xmm5,xmm7
-	pmuludq	xmm7,[64+edx]
-	paddq	xmm2,xmm6
-	pmuludq	xmm5,[48+edx]
-	movdqa	xmm6,[48+esp]
-	paddq	xmm1,xmm7
-	movdqa	xmm7,xmm6
-	pmuludq	xmm6,[16+edx]
-	paddq	xmm0,xmm5
-	movdqa	xmm5,[112+esp]
-	pmuludq	xmm7,[edx]
-	paddq	xmm4,xmm6
-	movdqa	xmm6,xmm5
-	pmuludq	xmm5,[64+edx]
-	paddq	xmm3,xmm7
-	movdqa	xmm7,xmm6
-	pmuludq	xmm6,[48+edx]
-	paddq	xmm2,xmm5
-	pmuludq	xmm7,[32+edx]
-	movdqa	xmm5,[64+esp]
-	paddq	xmm1,xmm6
-	movdqa	xmm6,[128+esp]
-	pmuludq	xmm5,[edx]
-	paddq	xmm0,xmm7
-	movdqa	xmm7,xmm6
-	pmuludq	xmm6,[64+edx]
-	paddq	xmm4,xmm5
-	movdqa	xmm5,xmm7
-	pmuludq	xmm7,[16+edx]
-	paddq	xmm3,xmm6
-	movdqa	xmm6,xmm5
-	pmuludq	xmm5,[32+edx]
-	paddq	xmm0,xmm7
-	pmuludq	xmm6,[48+edx]
-	movdqa	xmm7,[64+ebx]
-	paddq	xmm1,xmm5
-	paddq	xmm2,xmm6
-	movdqa	xmm5,xmm3
-	pand	xmm3,xmm7
-	psrlq	xmm5,26
-	paddq	xmm5,xmm4
-	movdqa	xmm6,xmm0
-	pand	xmm0,xmm7
-	psrlq	xmm6,26
-	movdqa	xmm4,xmm5
-	paddq	xmm6,xmm1
-	psrlq	xmm5,26
-	pand	xmm4,xmm7
-	movdqa	xmm1,xmm6
-	psrlq	xmm6,26
-	paddd	xmm0,xmm5
-	psllq	xmm5,2
-	paddq	xmm6,xmm2
-	paddd	xmm5,xmm0
-	pand	xmm1,xmm7
-	movdqa	xmm2,xmm6
-	psrlq	xmm6,26
-	pand	xmm2,xmm7
-	paddd	xmm6,xmm3
-	movdqa	xmm0,xmm5
-	psrlq	xmm5,26
-	movdqa	xmm3,xmm6
-	psrlq	xmm6,26
-	pand	xmm0,xmm7
-	paddd	xmm1,xmm5
-	pand	xmm3,xmm7
-	paddd	xmm4,xmm6
-	dec	ecx
-	jz	NEAR L$006square_break
-	punpcklqdq	xmm0,[esp]
-	punpcklqdq	xmm1,[16+esp]
-	punpcklqdq	xmm2,[32+esp]
-	punpcklqdq	xmm3,[48+esp]
-	punpcklqdq	xmm4,[64+esp]
-	jmp	NEAR L$005square
-L$006square_break:
-	psllq	xmm0,32
-	psllq	xmm1,32
-	psllq	xmm2,32
-	psllq	xmm3,32
-	psllq	xmm4,32
-	por	xmm0,[esp]
-	por	xmm1,[16+esp]
-	por	xmm2,[32+esp]
-	por	xmm3,[48+esp]
-	por	xmm4,[64+esp]
-	pshufd	xmm0,xmm0,141
-	pshufd	xmm1,xmm1,141
-	pshufd	xmm2,xmm2,141
-	pshufd	xmm3,xmm3,141
-	pshufd	xmm4,xmm4,141
-	movdqu	[edi],xmm0
-	movdqu	[16+edi],xmm1
-	movdqu	[32+edi],xmm2
-	movdqu	[48+edi],xmm3
-	movdqu	[64+edi],xmm4
-	movdqa	xmm6,xmm1
-	movdqa	xmm5,xmm2
-	pslld	xmm6,2
-	pslld	xmm5,2
-	paddd	xmm6,xmm1
-	paddd	xmm5,xmm2
-	movdqu	[80+edi],xmm6
-	movdqu	[96+edi],xmm5
-	movdqa	xmm6,xmm3
-	movdqa	xmm5,xmm4
-	pslld	xmm6,2
-	pslld	xmm5,2
-	paddd	xmm6,xmm3
-	paddd	xmm5,xmm4
-	movdqu	[112+edi],xmm6
-	movdqu	[128+edi],xmm5
-	mov	esp,ebp
-	lea	edi,[edi-48]
-	ret
-align	32
-align	16
-__poly1305_blocks_sse2:
-	push	ebp
-	push	ebx
-	push	esi
-	push	edi
-	mov	edi,DWORD [20+esp]
-	mov	esi,DWORD [24+esp]
-	mov	ecx,DWORD [28+esp]
-	mov	eax,DWORD [20+edi]
-	and	ecx,-16
-	jz	NEAR L$007nodata
-	cmp	ecx,64
-	jae	NEAR L$008enter_sse2
-	test	eax,eax
-	jz	NEAR L$enter_blocks
-align	16
-L$008enter_sse2:
-	call	L$009pic_point
-L$009pic_point:
-	pop	ebx
-	lea	ebx,[(L$const_sse2-L$009pic_point)+ebx]
-	test	eax,eax
-	jnz	NEAR L$010base2_26
-	call	__poly1305_init_sse2
-	mov	eax,DWORD [edi]
-	mov	ecx,DWORD [3+edi]
-	mov	edx,DWORD [6+edi]
-	mov	esi,DWORD [9+edi]
-	mov	ebp,DWORD [13+edi]
-	mov	DWORD [20+edi],1
-	shr	ecx,2
-	and	eax,67108863
-	shr	edx,4
-	and	ecx,67108863
-	shr	esi,6
-	and	edx,67108863
-	movd	xmm0,eax
-	movd	xmm1,ecx
-	movd	xmm2,edx
-	movd	xmm3,esi
-	movd	xmm4,ebp
-	mov	esi,DWORD [24+esp]
-	mov	ecx,DWORD [28+esp]
-	jmp	NEAR L$011base2_32
-align	16
-L$010base2_26:
-	movd	xmm0,DWORD [edi]
-	movd	xmm1,DWORD [4+edi]
-	movd	xmm2,DWORD [8+edi]
-	movd	xmm3,DWORD [12+edi]
-	movd	xmm4,DWORD [16+edi]
-	movdqa	xmm7,[64+ebx]
-L$011base2_32:
-	mov	eax,DWORD [32+esp]
-	mov	ebp,esp
-	sub	esp,528
-	and	esp,-16
-	lea	edi,[48+edi]
-	shl	eax,24
-	test	ecx,31
-	jz	NEAR L$012even
-	movdqu	xmm6,[esi]
-	lea	esi,[16+esi]
-	movdqa	xmm5,xmm6
-	pand	xmm6,xmm7
-	paddd	xmm0,xmm6
-	movdqa	xmm6,xmm5
-	psrlq	xmm5,26
-	psrldq	xmm6,6
-	pand	xmm5,xmm7
-	paddd	xmm1,xmm5
-	movdqa	xmm5,xmm6
-	psrlq	xmm6,4
-	pand	xmm6,xmm7
-	paddd	xmm2,xmm6
-	movdqa	xmm6,xmm5
-	psrlq	xmm5,30
-	pand	xmm5,xmm7
-	psrldq	xmm6,7
-	paddd	xmm3,xmm5
-	movd	xmm5,eax
-	paddd	xmm4,xmm6
-	movd	xmm6,DWORD [12+edi]
-	paddd	xmm4,xmm5
-	movdqa	[esp],xmm0
-	movdqa	[16+esp],xmm1
-	movdqa	[32+esp],xmm2
-	movdqa	[48+esp],xmm3
-	movdqa	[64+esp],xmm4
-	pmuludq	xmm0,xmm6
-	pmuludq	xmm1,xmm6
-	pmuludq	xmm2,xmm6
-	movd	xmm5,DWORD [28+edi]
-	pmuludq	xmm3,xmm6
-	pmuludq	xmm4,xmm6
-	movdqa	xmm6,xmm5
-	pmuludq	xmm5,[48+esp]
-	movdqa	xmm7,xmm6
-	pmuludq	xmm6,[32+esp]
-	paddq	xmm4,xmm5
-	movdqa	xmm5,xmm7
-	pmuludq	xmm7,[16+esp]
-	paddq	xmm3,xmm6
-	movd	xmm6,DWORD [92+edi]
-	pmuludq	xmm5,[esp]
-	paddq	xmm2,xmm7
-	pmuludq	xmm6,[64+esp]
-	movd	xmm7,DWORD [44+edi]
-	paddq	xmm1,xmm5
-	movdqa	xmm5,xmm7
-	pmuludq	xmm7,[32+esp]
-	paddq	xmm0,xmm6
-	movdqa	xmm6,xmm5
-	pmuludq	xmm5,[16+esp]
-	paddq	xmm4,xmm7
-	movd	xmm7,DWORD [108+edi]
-	pmuludq	xmm6,[esp]
-	paddq	xmm3,xmm5
-	movdqa	xmm5,xmm7
-	pmuludq	xmm7,[64+esp]
-	paddq	xmm2,xmm6
-	pmuludq	xmm5,[48+esp]
-	movd	xmm6,DWORD [60+edi]
-	paddq	xmm1,xmm7
-	movdqa	xmm7,xmm6
-	pmuludq	xmm6,[16+esp]
-	paddq	xmm0,xmm5
-	movd	xmm5,DWORD [124+edi]
-	pmuludq	xmm7,[esp]
-	paddq	xmm4,xmm6
-	movdqa	xmm6,xmm5
-	pmuludq	xmm5,[64+esp]
-	paddq	xmm3,xmm7
-	movdqa	xmm7,xmm6
-	pmuludq	xmm6,[48+esp]
-	paddq	xmm2,xmm5
-	pmuludq	xmm7,[32+esp]
-	movd	xmm5,DWORD [76+edi]
-	paddq	xmm1,xmm6
-	movd	xmm6,DWORD [140+edi]
-	pmuludq	xmm5,[esp]
-	paddq	xmm0,xmm7
-	movdqa	xmm7,xmm6
-	pmuludq	xmm6,[64+esp]
-	paddq	xmm4,xmm5
-	movdqa	xmm5,xmm7
-	pmuludq	xmm7,[16+esp]
-	paddq	xmm3,xmm6
-	movdqa	xmm6,xmm5
-	pmuludq	xmm5,[32+esp]
-	paddq	xmm0,xmm7
-	pmuludq	xmm6,[48+esp]
-	movdqa	xmm7,[64+ebx]
-	paddq	xmm1,xmm5
-	paddq	xmm2,xmm6
-	movdqa	xmm5,xmm3
-	pand	xmm3,xmm7
-	psrlq	xmm5,26
-	paddq	xmm5,xmm4
-	movdqa	xmm6,xmm0
-	pand	xmm0,xmm7
-	psrlq	xmm6,26
-	movdqa	xmm4,xmm5
-	paddq	xmm6,xmm1
-	psrlq	xmm5,26
-	pand	xmm4,xmm7
-	movdqa	xmm1,xmm6
-	psrlq	xmm6,26
-	paddd	xmm0,xmm5
-	psllq	xmm5,2
-	paddq	xmm6,xmm2
-	paddd	xmm5,xmm0
-	pand	xmm1,xmm7
-	movdqa	xmm2,xmm6
-	psrlq	xmm6,26
-	pand	xmm2,xmm7
-	paddd	xmm6,xmm3
-	movdqa	xmm0,xmm5
-	psrlq	xmm5,26
-	movdqa	xmm3,xmm6
-	psrlq	xmm6,26
-	pand	xmm0,xmm7
-	paddd	xmm1,xmm5
-	pand	xmm3,xmm7
-	paddd	xmm4,xmm6
-	sub	ecx,16
-	jz	NEAR L$013done
-L$012even:
-	lea	edx,[384+esp]
-	lea	eax,[esi-32]
-	sub	ecx,64
-	movdqu	xmm5,[edi]
-	pshufd	xmm6,xmm5,68
-	cmovb	esi,eax
-	pshufd	xmm5,xmm5,238
-	movdqa	[edx],xmm6
-	lea	eax,[160+esp]
-	movdqu	xmm6,[16+edi]
-	movdqa	[edx-144],xmm5
-	pshufd	xmm5,xmm6,68
-	pshufd	xmm6,xmm6,238
-	movdqa	[16+edx],xmm5
-	movdqu	xmm5,[32+edi]
-	movdqa	[edx-128],xmm6
-	pshufd	xmm6,xmm5,68
-	pshufd	xmm5,xmm5,238
-	movdqa	[32+edx],xmm6
-	movdqu	xmm6,[48+edi]
-	movdqa	[edx-112],xmm5
-	pshufd	xmm5,xmm6,68
-	pshufd	xmm6,xmm6,238
-	movdqa	[48+edx],xmm5
-	movdqu	xmm5,[64+edi]
-	movdqa	[edx-96],xmm6
-	pshufd	xmm6,xmm5,68
-	pshufd	xmm5,xmm5,238
-	movdqa	[64+edx],xmm6
-	movdqu	xmm6,[80+edi]
-	movdqa	[edx-80],xmm5
-	pshufd	xmm5,xmm6,68
-	pshufd	xmm6,xmm6,238
-	movdqa	[80+edx],xmm5
-	movdqu	xmm5,[96+edi]
-	movdqa	[edx-64],xmm6
-	pshufd	xmm6,xmm5,68
-	pshufd	xmm5,xmm5,238
-	movdqa	[96+edx],xmm6
-	movdqu	xmm6,[112+edi]
-	movdqa	[edx-48],xmm5
-	pshufd	xmm5,xmm6,68
-	pshufd	xmm6,xmm6,238
-	movdqa	[112+edx],xmm5
-	movdqu	xmm5,[128+edi]
-	movdqa	[edx-32],xmm6
-	pshufd	xmm6,xmm5,68
-	pshufd	xmm5,xmm5,238
-	movdqa	[128+edx],xmm6
-	movdqa	[edx-16],xmm5
-	movdqu	xmm5,[32+esi]
-	movdqu	xmm6,[48+esi]
-	lea	esi,[32+esi]
-	movdqa	[112+esp],xmm2
-	movdqa	[128+esp],xmm3
-	movdqa	[144+esp],xmm4
-	movdqa	xmm2,xmm5
-	movdqa	xmm3,xmm6
-	psrldq	xmm2,6
-	psrldq	xmm3,6
-	movdqa	xmm4,xmm5
-	punpcklqdq	xmm2,xmm3
-	punpckhqdq	xmm4,xmm6
-	punpcklqdq	xmm5,xmm6
-	movdqa	xmm3,xmm2
-	psrlq	xmm2,4
-	psrlq	xmm3,30
-	movdqa	xmm6,xmm5
-	psrlq	xmm4,40
-	psrlq	xmm6,26
-	pand	xmm5,xmm7
-	pand	xmm6,xmm7
-	pand	xmm2,xmm7
-	pand	xmm3,xmm7
-	por	xmm4,[ebx]
-	movdqa	[80+esp],xmm0
-	movdqa	[96+esp],xmm1
-	jbe	NEAR L$014skip_loop
-	jmp	NEAR L$015loop
-align	32
-L$015loop:
-	movdqa	xmm7,[edx-144]
-	movdqa	[16+eax],xmm6
-	movdqa	[32+eax],xmm2
-	movdqa	[48+eax],xmm3
-	movdqa	[64+eax],xmm4
-	movdqa	xmm1,xmm5
-	pmuludq	xmm5,xmm7
-	movdqa	xmm0,xmm6
-	pmuludq	xmm6,xmm7
-	pmuludq	xmm2,xmm7
-	pmuludq	xmm3,xmm7
-	pmuludq	xmm4,xmm7
-	pmuludq	xmm0,[edx-16]
-	movdqa	xmm7,xmm1
-	pmuludq	xmm1,[edx-128]
-	paddq	xmm0,xmm5
-	movdqa	xmm5,xmm7
-	pmuludq	xmm7,[edx-112]
-	paddq	xmm1,xmm6
-	movdqa	xmm6,xmm5
-	pmuludq	xmm5,[edx-96]
-	paddq	xmm2,xmm7
-	movdqa	xmm7,[16+eax]
-	pmuludq	xmm6,[edx-80]
-	paddq	xmm3,xmm5
-	movdqa	xmm5,xmm7
-	pmuludq	xmm7,[edx-128]
-	paddq	xmm4,xmm6
-	movdqa	xmm6,xmm5
-	pmuludq	xmm5,[edx-112]
-	paddq	xmm2,xmm7
-	movdqa	xmm7,[32+eax]
-	pmuludq	xmm6,[edx-96]
-	paddq	xmm3,xmm5
-	movdqa	xmm5,xmm7
-	pmuludq	xmm7,[edx-32]
-	paddq	xmm4,xmm6
-	movdqa	xmm6,xmm5
-	pmuludq	xmm5,[edx-16]
-	paddq	xmm0,xmm7
-	movdqa	xmm7,xmm6
-	pmuludq	xmm6,[edx-128]
-	paddq	xmm1,xmm5
-	movdqa	xmm5,[48+eax]
-	pmuludq	xmm7,[edx-112]
-	paddq	xmm3,xmm6
-	movdqa	xmm6,xmm5
-	pmuludq	xmm5,[edx-48]
-	paddq	xmm4,xmm7
-	movdqa	xmm7,xmm6
-	pmuludq	xmm6,[edx-32]
-	paddq	xmm0,xmm5
-	movdqa	xmm5,xmm7
-	pmuludq	xmm7,[edx-16]
-	paddq	xmm1,xmm6
-	movdqa	xmm6,[64+eax]
-	pmuludq	xmm5,[edx-128]
-	paddq	xmm2,xmm7
-	movdqa	xmm7,xmm6
-	pmuludq	xmm6,[edx-16]
-	paddq	xmm4,xmm5
-	movdqa	xmm5,xmm7
-	pmuludq	xmm7,[edx-64]
-	paddq	xmm3,xmm6
-	movdqa	xmm6,xmm5
-	pmuludq	xmm5,[edx-48]
-	paddq	xmm0,xmm7
-	movdqa	xmm7,[64+ebx]
-	pmuludq	xmm6,[edx-32]
-	paddq	xmm1,xmm5
-	paddq	xmm2,xmm6
-	movdqu	xmm5,[esi-32]
-	movdqu	xmm6,[esi-16]
-	lea	esi,[32+esi]
-	movdqa	[32+esp],xmm2
-	movdqa	[48+esp],xmm3
-	movdqa	[64+esp],xmm4
-	movdqa	xmm2,xmm5
-	movdqa	xmm3,xmm6
-	psrldq	xmm2,6
-	psrldq	xmm3,6
-	movdqa	xmm4,xmm5
-	punpcklqdq	xmm2,xmm3
-	punpckhqdq	xmm4,xmm6
-	punpcklqdq	xmm5,xmm6
-	movdqa	xmm3,xmm2
-	psrlq	xmm2,4
-	psrlq	xmm3,30
-	movdqa	xmm6,xmm5
-	psrlq	xmm4,40
-	psrlq	xmm6,26
-	pand	xmm5,xmm7
-	pand	xmm6,xmm7
-	pand	xmm2,xmm7
-	pand	xmm3,xmm7
-	por	xmm4,[ebx]
-	lea	eax,[esi-32]
-	sub	ecx,64
-	paddd	xmm5,[80+esp]
-	paddd	xmm6,[96+esp]
-	paddd	xmm2,[112+esp]
-	paddd	xmm3,[128+esp]
-	paddd	xmm4,[144+esp]
-	cmovb	esi,eax
-	lea	eax,[160+esp]
-	movdqa	xmm7,[edx]
-	movdqa	[16+esp],xmm1
-	movdqa	[16+eax],xmm6
-	movdqa	[32+eax],xmm2
-	movdqa	[48+eax],xmm3
-	movdqa	[64+eax],xmm4
-	movdqa	xmm1,xmm5
-	pmuludq	xmm5,xmm7
-	paddq	xmm5,xmm0
-	movdqa	xmm0,xmm6
-	pmuludq	xmm6,xmm7
-	pmuludq	xmm2,xmm7
-	pmuludq	xmm3,xmm7
-	pmuludq	xmm4,xmm7
-	paddq	xmm6,[16+esp]
-	paddq	xmm2,[32+esp]
-	paddq	xmm3,[48+esp]
-	paddq	xmm4,[64+esp]
-	pmuludq	xmm0,[128+edx]
-	movdqa	xmm7,xmm1
-	pmuludq	xmm1,[16+edx]
-	paddq	xmm0,xmm5
-	movdqa	xmm5,xmm7
-	pmuludq	xmm7,[32+edx]
-	paddq	xmm1,xmm6
-	movdqa	xmm6,xmm5
-	pmuludq	xmm5,[48+edx]
-	paddq	xmm2,xmm7
-	movdqa	xmm7,[16+eax]
-	pmuludq	xmm6,[64+edx]
-	paddq	xmm3,xmm5
-	movdqa	xmm5,xmm7
-	pmuludq	xmm7,[16+edx]
-	paddq	xmm4,xmm6
-	movdqa	xmm6,xmm5
-	pmuludq	xmm5,[32+edx]
-	paddq	xmm2,xmm7
-	movdqa	xmm7,[32+eax]
-	pmuludq	xmm6,[48+edx]
-	paddq	xmm3,xmm5
-	movdqa	xmm5,xmm7
-	pmuludq	xmm7,[112+edx]
-	paddq	xmm4,xmm6
-	movdqa	xmm6,xmm5
-	pmuludq	xmm5,[128+edx]
-	paddq	xmm0,xmm7
-	movdqa	xmm7,xmm6
-	pmuludq	xmm6,[16+edx]
-	paddq	xmm1,xmm5
-	movdqa	xmm5,[48+eax]
-	pmuludq	xmm7,[32+edx]
-	paddq	xmm3,xmm6
-	movdqa	xmm6,xmm5
-	pmuludq	xmm5,[96+edx]
-	paddq	xmm4,xmm7
-	movdqa	xmm7,xmm6
-	pmuludq	xmm6,[112+edx]
-	paddq	xmm0,xmm5
-	movdqa	xmm5,xmm7
-	pmuludq	xmm7,[128+edx]
-	paddq	xmm1,xmm6
-	movdqa	xmm6,[64+eax]
-	pmuludq	xmm5,[16+edx]
-	paddq	xmm2,xmm7
-	movdqa	xmm7,xmm6
-	pmuludq	xmm6,[128+edx]
-	paddq	xmm4,xmm5
-	movdqa	xmm5,xmm7
-	pmuludq	xmm7,[80+edx]
-	paddq	xmm3,xmm6
-	movdqa	xmm6,xmm5
-	pmuludq	xmm5,[96+edx]
-	paddq	xmm0,xmm7
-	movdqa	xmm7,[64+ebx]
-	pmuludq	xmm6,[112+edx]
-	paddq	xmm1,xmm5
-	paddq	xmm2,xmm6
-	movdqa	xmm5,xmm3
-	pand	xmm3,xmm7
-	psrlq	xmm5,26
-	paddq	xmm5,xmm4
-	movdqa	xmm6,xmm0
-	pand	xmm0,xmm7
-	psrlq	xmm6,26
-	movdqa	xmm4,xmm5
-	paddq	xmm6,xmm1
-	psrlq	xmm5,26
-	pand	xmm4,xmm7
-	movdqa	xmm1,xmm6
-	psrlq	xmm6,26
-	paddd	xmm0,xmm5
-	psllq	xmm5,2
-	paddq	xmm6,xmm2
-	paddd	xmm5,xmm0
-	pand	xmm1,xmm7
-	movdqa	xmm2,xmm6
-	psrlq	xmm6,26
-	pand	xmm2,xmm7
-	paddd	xmm6,xmm3
-	movdqa	xmm0,xmm5
-	psrlq	xmm5,26
-	movdqa	xmm3,xmm6
-	psrlq	xmm6,26
-	pand	xmm0,xmm7
-	paddd	xmm1,xmm5
-	pand	xmm3,xmm7
-	paddd	xmm4,xmm6
-	movdqu	xmm5,[32+esi]
-	movdqu	xmm6,[48+esi]
-	lea	esi,[32+esi]
-	movdqa	[112+esp],xmm2
-	movdqa	[128+esp],xmm3
-	movdqa	[144+esp],xmm4
-	movdqa	xmm2,xmm5
-	movdqa	xmm3,xmm6
-	psrldq	xmm2,6
-	psrldq	xmm3,6
-	movdqa	xmm4,xmm5
-	punpcklqdq	xmm2,xmm3
-	punpckhqdq	xmm4,xmm6
-	punpcklqdq	xmm5,xmm6
-	movdqa	xmm3,xmm2
-	psrlq	xmm2,4
-	psrlq	xmm3,30
-	movdqa	xmm6,xmm5
-	psrlq	xmm4,40
-	psrlq	xmm6,26
-	pand	xmm5,xmm7
-	pand	xmm6,xmm7
-	pand	xmm2,xmm7
-	pand	xmm3,xmm7
-	por	xmm4,[ebx]
-	movdqa	[80+esp],xmm0
-	movdqa	[96+esp],xmm1
-	ja	NEAR L$015loop
-L$014skip_loop:
-	pshufd	xmm7,[edx-144],16
-	add	ecx,32
-	jnz	NEAR L$016long_tail
-	paddd	xmm5,xmm0
-	paddd	xmm6,xmm1
-	paddd	xmm2,[112+esp]
-	paddd	xmm3,[128+esp]
-	paddd	xmm4,[144+esp]
-L$016long_tail:
-	movdqa	[eax],xmm5
-	movdqa	[16+eax],xmm6
-	movdqa	[32+eax],xmm2
-	movdqa	[48+eax],xmm3
-	movdqa	[64+eax],xmm4
-	pmuludq	xmm5,xmm7
-	pmuludq	xmm6,xmm7
-	pmuludq	xmm2,xmm7
-	movdqa	xmm0,xmm5
-	pshufd	xmm5,[edx-128],16
-	pmuludq	xmm3,xmm7
-	movdqa	xmm1,xmm6
-	pmuludq	xmm4,xmm7
-	movdqa	xmm6,xmm5
-	pmuludq	xmm5,[48+eax]
-	movdqa	xmm7,xmm6
-	pmuludq	xmm6,[32+eax]
-	paddq	xmm4,xmm5
-	movdqa	xmm5,xmm7
-	pmuludq	xmm7,[16+eax]
-	paddq	xmm3,xmm6
-	pshufd	xmm6,[edx-64],16
-	pmuludq	xmm5,[eax]
-	paddq	xmm2,xmm7
-	pmuludq	xmm6,[64+eax]
-	pshufd	xmm7,[edx-112],16
-	paddq	xmm1,xmm5
-	movdqa	xmm5,xmm7
-	pmuludq	xmm7,[32+eax]
-	paddq	xmm0,xmm6
-	movdqa	xmm6,xmm5
-	pmuludq	xmm5,[16+eax]
-	paddq	xmm4,xmm7
-	pshufd	xmm7,[edx-48],16
-	pmuludq	xmm6,[eax]
-	paddq	xmm3,xmm5
-	movdqa	xmm5,xmm7
-	pmuludq	xmm7,[64+eax]
-	paddq	xmm2,xmm6
-	pmuludq	xmm5,[48+eax]
-	pshufd	xmm6,[edx-96],16
-	paddq	xmm1,xmm7
-	movdqa	xmm7,xmm6
-	pmuludq	xmm6,[16+eax]
-	paddq	xmm0,xmm5
-	pshufd	xmm5,[edx-32],16
-	pmuludq	xmm7,[eax]
-	paddq	xmm4,xmm6
-	movdqa	xmm6,xmm5
-	pmuludq	xmm5,[64+eax]
-	paddq	xmm3,xmm7
-	movdqa	xmm7,xmm6
-	pmuludq	xmm6,[48+eax]
-	paddq	xmm2,xmm5
-	pmuludq	xmm7,[32+eax]
-	pshufd	xmm5,[edx-80],16
-	paddq	xmm1,xmm6
-	pshufd	xmm6,[edx-16],16
-	pmuludq	xmm5,[eax]
-	paddq	xmm0,xmm7
-	movdqa	xmm7,xmm6
-	pmuludq	xmm6,[64+eax]
-	paddq	xmm4,xmm5
-	movdqa	xmm5,xmm7
-	pmuludq	xmm7,[16+eax]
-	paddq	xmm3,xmm6
-	movdqa	xmm6,xmm5
-	pmuludq	xmm5,[32+eax]
-	paddq	xmm0,xmm7
-	pmuludq	xmm6,[48+eax]
-	movdqa	xmm7,[64+ebx]
-	paddq	xmm1,xmm5
-	paddq	xmm2,xmm6
-	jz	NEAR L$017short_tail
-	movdqu	xmm5,[esi-32]
-	movdqu	xmm6,[esi-16]
-	lea	esi,[32+esi]
-	movdqa	[32+esp],xmm2
-	movdqa	[48+esp],xmm3
-	movdqa	[64+esp],xmm4
-	movdqa	xmm2,xmm5
-	movdqa	xmm3,xmm6
-	psrldq	xmm2,6
-	psrldq	xmm3,6
-	movdqa	xmm4,xmm5
-	punpcklqdq	xmm2,xmm3
-	punpckhqdq	xmm4,xmm6
-	punpcklqdq	xmm5,xmm6
-	movdqa	xmm3,xmm2
-	psrlq	xmm2,4
-	psrlq	xmm3,30
-	movdqa	xmm6,xmm5
-	psrlq	xmm4,40
-	psrlq	xmm6,26
-	pand	xmm5,xmm7
-	pand	xmm6,xmm7
-	pand	xmm2,xmm7
-	pand	xmm3,xmm7
-	por	xmm4,[ebx]
-	pshufd	xmm7,[edx],16
-	paddd	xmm5,[80+esp]
-	paddd	xmm6,[96+esp]
-	paddd	xmm2,[112+esp]
-	paddd	xmm3,[128+esp]
-	paddd	xmm4,[144+esp]
-	movdqa	[esp],xmm5
-	pmuludq	xmm5,xmm7
-	movdqa	[16+esp],xmm6
-	pmuludq	xmm6,xmm7
-	paddq	xmm0,xmm5
-	movdqa	xmm5,xmm2
-	pmuludq	xmm2,xmm7
-	paddq	xmm1,xmm6
-	movdqa	xmm6,xmm3
-	pmuludq	xmm3,xmm7
-	paddq	xmm2,[32+esp]
-	movdqa	[32+esp],xmm5
-	pshufd	xmm5,[16+edx],16
-	paddq	xmm3,[48+esp]
-	movdqa	[48+esp],xmm6
-	movdqa	xmm6,xmm4
-	pmuludq	xmm4,xmm7
-	paddq	xmm4,[64+esp]
-	movdqa	[64+esp],xmm6
-	movdqa	xmm6,xmm5
-	pmuludq	xmm5,[48+esp]
-	movdqa	xmm7,xmm6
-	pmuludq	xmm6,[32+esp]
-	paddq	xmm4,xmm5
-	movdqa	xmm5,xmm7
-	pmuludq	xmm7,[16+esp]
-	paddq	xmm3,xmm6
-	pshufd	xmm6,[80+edx],16
-	pmuludq	xmm5,[esp]
-	paddq	xmm2,xmm7
-	pmuludq	xmm6,[64+esp]
-	pshufd	xmm7,[32+edx],16
-	paddq	xmm1,xmm5
-	movdqa	xmm5,xmm7
-	pmuludq	xmm7,[32+esp]
-	paddq	xmm0,xmm6
-	movdqa	xmm6,xmm5
-	pmuludq	xmm5,[16+esp]
-	paddq	xmm4,xmm7
-	pshufd	xmm7,[96+edx],16
-	pmuludq	xmm6,[esp]
-	paddq	xmm3,xmm5
-	movdqa	xmm5,xmm7
-	pmuludq	xmm7,[64+esp]
-	paddq	xmm2,xmm6
-	pmuludq	xmm5,[48+esp]
-	pshufd	xmm6,[48+edx],16
-	paddq	xmm1,xmm7
-	movdqa	xmm7,xmm6
-	pmuludq	xmm6,[16+esp]
-	paddq	xmm0,xmm5
-	pshufd	xmm5,[112+edx],16
-	pmuludq	xmm7,[esp]
-	paddq	xmm4,xmm6
-	movdqa	xmm6,xmm5
-	pmuludq	xmm5,[64+esp]
-	paddq	xmm3,xmm7
-	movdqa	xmm7,xmm6
-	pmuludq	xmm6,[48+esp]
-	paddq	xmm2,xmm5
-	pmuludq	xmm7,[32+esp]
-	pshufd	xmm5,[64+edx],16
-	paddq	xmm1,xmm6
-	pshufd	xmm6,[128+edx],16
-	pmuludq	xmm5,[esp]
-	paddq	xmm0,xmm7
-	movdqa	xmm7,xmm6
-	pmuludq	xmm6,[64+esp]
-	paddq	xmm4,xmm5
-	movdqa	xmm5,xmm7
-	pmuludq	xmm7,[16+esp]
-	paddq	xmm3,xmm6
-	movdqa	xmm6,xmm5
-	pmuludq	xmm5,[32+esp]
-	paddq	xmm0,xmm7
-	pmuludq	xmm6,[48+esp]
-	movdqa	xmm7,[64+ebx]
-	paddq	xmm1,xmm5
-	paddq	xmm2,xmm6
-L$017short_tail:
-	pshufd	xmm6,xmm4,78
-	pshufd	xmm5,xmm3,78
-	paddq	xmm4,xmm6
-	paddq	xmm3,xmm5
-	pshufd	xmm6,xmm0,78
-	pshufd	xmm5,xmm1,78
-	paddq	xmm0,xmm6
-	paddq	xmm1,xmm5
-	pshufd	xmm6,xmm2,78
-	movdqa	xmm5,xmm3
-	pand	xmm3,xmm7
-	psrlq	xmm5,26
-	paddq	xmm2,xmm6
-	paddq	xmm5,xmm4
-	movdqa	xmm6,xmm0
-	pand	xmm0,xmm7
-	psrlq	xmm6,26
-	movdqa	xmm4,xmm5
-	paddq	xmm6,xmm1
-	psrlq	xmm5,26
-	pand	xmm4,xmm7
-	movdqa	xmm1,xmm6
-	psrlq	xmm6,26
-	paddd	xmm0,xmm5
-	psllq	xmm5,2
-	paddq	xmm6,xmm2
-	paddq	xmm5,xmm0
-	pand	xmm1,xmm7
-	movdqa	xmm2,xmm6
-	psrlq	xmm6,26
-	pand	xmm2,xmm7
-	paddd	xmm6,xmm3
-	movdqa	xmm0,xmm5
-	psrlq	xmm5,26
-	movdqa	xmm3,xmm6
-	psrlq	xmm6,26
-	pand	xmm0,xmm7
-	paddd	xmm1,xmm5
-	pand	xmm3,xmm7
-	paddd	xmm4,xmm6
-L$013done:
-	movd	DWORD [edi-48],xmm0
-	movd	DWORD [edi-44],xmm1
-	movd	DWORD [edi-40],xmm2
-	movd	DWORD [edi-36],xmm3
-	movd	DWORD [edi-32],xmm4
-	mov	esp,ebp
-L$007nodata:
-	pop	edi
-	pop	esi
-	pop	ebx
-	pop	ebp
-	ret
-align	32
-align	16
-__poly1305_emit_sse2:
-	push	ebp
-	push	ebx
-	push	esi
-	push	edi
-	mov	ebp,DWORD [20+esp]
-	cmp	DWORD [20+ebp],0
-	je	NEAR L$enter_emit
-	mov	eax,DWORD [ebp]
-	mov	edi,DWORD [4+ebp]
-	mov	ecx,DWORD [8+ebp]
-	mov	edx,DWORD [12+ebp]
-	mov	esi,DWORD [16+ebp]
-	mov	ebx,edi
-	shl	edi,26
-	shr	ebx,6
-	add	eax,edi
-	mov	edi,ecx
-	adc	ebx,0
-	shl	edi,20
-	shr	ecx,12
-	add	ebx,edi
-	mov	edi,edx
-	adc	ecx,0
-	shl	edi,14
-	shr	edx,18
-	add	ecx,edi
-	mov	edi,esi
-	adc	edx,0
-	shl	edi,8
-	shr	esi,24
-	add	edx,edi
-	adc	esi,0
-	mov	edi,esi
-	and	esi,3
-	shr	edi,2
-	lea	ebp,[edi*4+edi]
-	mov	edi,DWORD [24+esp]
-	add	eax,ebp
-	mov	ebp,DWORD [28+esp]
-	adc	ebx,0
-	adc	ecx,0
-	adc	edx,0
-	movd	xmm0,eax
-	add	eax,5
-	movd	xmm1,ebx
-	adc	ebx,0
-	movd	xmm2,ecx
-	adc	ecx,0
-	movd	xmm3,edx
-	adc	edx,0
-	adc	esi,0
-	shr	esi,2
-	neg	esi
-	and	eax,esi
-	and	ebx,esi
-	and	ecx,esi
-	and	edx,esi
-	mov	DWORD [edi],eax
-	movd	eax,xmm0
-	mov	DWORD [4+edi],ebx
-	movd	ebx,xmm1
-	mov	DWORD [8+edi],ecx
-	movd	ecx,xmm2
-	mov	DWORD [12+edi],edx
-	movd	edx,xmm3
-	not	esi
-	and	eax,esi
-	and	ebx,esi
-	or	eax,DWORD [edi]
-	and	ecx,esi
-	or	ebx,DWORD [4+edi]
-	and	edx,esi
-	or	ecx,DWORD [8+edi]
-	or	edx,DWORD [12+edi]
-	add	eax,DWORD [ebp]
-	adc	ebx,DWORD [4+ebp]
-	mov	DWORD [edi],eax
-	adc	ecx,DWORD [8+ebp]
-	mov	DWORD [4+edi],ebx
-	adc	edx,DWORD [12+ebp]
-	mov	DWORD [8+edi],ecx
-	mov	DWORD [12+edi],edx
-	pop	edi
-	pop	esi
-	pop	ebx
-	pop	ebp
-	ret
-align	64
-L$const_sse2:
-dd	16777216,0,16777216,0,16777216,0,16777216,0
-dd	0,0,0,0,0,0,0,0
-dd	67108863,0,67108863,0,67108863,0,67108863,0
-dd	268435455,268435452,268435452,268435452
-db	80,111,108,121,49,51,48,53,32,102,111,114,32,120,56,54
-db	44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32
-db	60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111
-db	114,103,62,0
-align	4
-segment	.bss
-common	_OPENSSL_ia32cap_P 16
diff --git a/third_party/boringssl/win-x86_64/crypto/poly1305/poly1305-x86_64.asm b/third_party/boringssl/win-x86_64/crypto/poly1305/poly1305-x86_64.asm
deleted file mode 100644
index 1d48c33..0000000
--- a/third_party/boringssl/win-x86_64/crypto/poly1305/poly1305-x86_64.asm
+++ /dev/null
@@ -1,2163 +0,0 @@
-default	rel
-%define XMMWORD
-%define YMMWORD
-%define ZMMWORD
-section	.text code align=64
-
-
-EXTERN	OPENSSL_ia32cap_P
-
-global	poly1305_init
-global	poly1305_blocks
-global	poly1305_emit
-
-ALIGN	32
-poly1305_init:
-	mov	QWORD[8+rsp],rdi	;WIN64 prologue
-	mov	QWORD[16+rsp],rsi
-	mov	rax,rsp
-$L$SEH_begin_poly1305_init:
-	mov	rdi,rcx
-	mov	rsi,rdx
-	mov	rdx,r8
-
-
-	xor	rax,rax
-	mov	QWORD[rdi],rax
-	mov	QWORD[8+rdi],rax
-	mov	QWORD[16+rdi],rax
-
-	cmp	rsi,0
-	je	NEAR $L$no_key
-
-	lea	r10,[poly1305_blocks]
-	lea	r11,[poly1305_emit]
-	mov	r9,QWORD[((OPENSSL_ia32cap_P+4))]
-	lea	rax,[poly1305_blocks_avx]
-	lea	rcx,[poly1305_emit_avx]
-	bt	r9,28
-	cmovc	r10,rax
-	cmovc	r11,rcx
-	lea	rax,[poly1305_blocks_avx2]
-	bt	r9,37
-	cmovc	r10,rax
-	mov	rax,0x0ffffffc0fffffff
-	mov	rcx,0x0ffffffc0ffffffc
-	and	rax,QWORD[rsi]
-	and	rcx,QWORD[8+rsi]
-	mov	QWORD[24+rdi],rax
-	mov	QWORD[32+rdi],rcx
-	mov	QWORD[rdx],r10
-	mov	QWORD[8+rdx],r11
-	mov	eax,1
-$L$no_key:
-	mov	rdi,QWORD[8+rsp]	;WIN64 epilogue
-	mov	rsi,QWORD[16+rsp]
-	DB	0F3h,0C3h		;repret
-$L$SEH_end_poly1305_init:
-
-
-ALIGN	32
-poly1305_blocks:
-	mov	QWORD[8+rsp],rdi	;WIN64 prologue
-	mov	QWORD[16+rsp],rsi
-	mov	rax,rsp
-$L$SEH_begin_poly1305_blocks:
-	mov	rdi,rcx
-	mov	rsi,rdx
-	mov	rdx,r8
-	mov	rcx,r9
-
-
-$L$blocks:
-	sub	rdx,16
-	jc	NEAR $L$no_data
-
-	push	rbx
-	push	rbp
-	push	r12
-	push	r13
-	push	r14
-	push	r15
-$L$blocks_body:
-
-	mov	r15,rdx
-
-	mov	r11,QWORD[24+rdi]
-	mov	r13,QWORD[32+rdi]
-
-	mov	r14,QWORD[rdi]
-	mov	rbx,QWORD[8+rdi]
-	mov	rbp,QWORD[16+rdi]
-
-	mov	r12,r13
-	shr	r13,2
-	mov	rax,r12
-	add	r13,r12
-	jmp	NEAR $L$oop
-
-ALIGN	32
-$L$oop:
-	add	r14,QWORD[rsi]
-	adc	rbx,QWORD[8+rsi]
-	lea	rsi,[16+rsi]
-	adc	rbp,rcx
-	mul	r14
-	mov	r9,rax
-	mov	rax,r11
-	mov	r10,rdx
-
-	mul	r14
-	mov	r14,rax
-	mov	rax,r11
-	mov	r8,rdx
-
-	mul	rbx
-	add	r9,rax
-	mov	rax,r13
-	adc	r10,rdx
-
-	mul	rbx
-	mov	rbx,rbp
-	add	r14,rax
-	adc	r8,rdx
-
-	imul	rbx,r13
-	add	r9,rbx
-	mov	rbx,r8
-	adc	r10,0
-
-	imul	rbp,r11
-	add	rbx,r9
-	mov	rax,-4
-	adc	r10,rbp
-
-	and	rax,r10
-	mov	rbp,r10
-	shr	r10,2
-	and	rbp,3
-	add	rax,r10
-	add	r14,rax
-	adc	rbx,0
-	mov	rax,r12
-	sub	r15,16
-	jnc	NEAR $L$oop
-
-	mov	QWORD[rdi],r14
-	mov	QWORD[8+rdi],rbx
-	mov	QWORD[16+rdi],rbp
-
-	mov	r15,QWORD[rsp]
-	mov	r14,QWORD[8+rsp]
-	mov	r13,QWORD[16+rsp]
-	mov	r12,QWORD[24+rsp]
-	mov	rbp,QWORD[32+rsp]
-	mov	rbx,QWORD[40+rsp]
-	lea	rsp,[48+rsp]
-$L$no_data:
-$L$blocks_epilogue:
-	mov	rdi,QWORD[8+rsp]	;WIN64 epilogue
-	mov	rsi,QWORD[16+rsp]
-	DB	0F3h,0C3h		;repret
-$L$SEH_end_poly1305_blocks:
-
-
-ALIGN	32
-poly1305_emit:
-	mov	QWORD[8+rsp],rdi	;WIN64 prologue
-	mov	QWORD[16+rsp],rsi
-	mov	rax,rsp
-$L$SEH_begin_poly1305_emit:
-	mov	rdi,rcx
-	mov	rsi,rdx
-	mov	rdx,r8
-
-
-$L$emit:
-	mov	r8,QWORD[rdi]
-	mov	r9,QWORD[8+rdi]
-	mov	r10,QWORD[16+rdi]
-
-	mov	rax,r8
-	add	r8,5
-	mov	rcx,r9
-	adc	r9,0
-	adc	r10,0
-	shr	r10,2
-	cmovnz	rax,r8
-	cmovnz	rcx,r9
-
-	add	rax,QWORD[rdx]
-	adc	rcx,QWORD[8+rdx]
-	mov	QWORD[rsi],rax
-	mov	QWORD[8+rsi],rcx
-
-	mov	rdi,QWORD[8+rsp]	;WIN64 epilogue
-	mov	rsi,QWORD[16+rsp]
-	DB	0F3h,0C3h		;repret
-$L$SEH_end_poly1305_emit:
-
-ALIGN	32
-__poly1305_block:
-	mul	r14
-	mov	r9,rax
-	mov	rax,r11
-	mov	r10,rdx
-
-	mul	r14
-	mov	r14,rax
-	mov	rax,r11
-	mov	r8,rdx
-
-	mul	rbx
-	add	r9,rax
-	mov	rax,r13
-	adc	r10,rdx
-
-	mul	rbx
-	mov	rbx,rbp
-	add	r14,rax
-	adc	r8,rdx
-
-	imul	rbx,r13
-	add	r9,rbx
-	mov	rbx,r8
-	adc	r10,0
-
-	imul	rbp,r11
-	add	rbx,r9
-	mov	rax,-4
-	adc	r10,rbp
-
-	and	rax,r10
-	mov	rbp,r10
-	shr	r10,2
-	and	rbp,3
-	add	rax,r10
-	add	r14,rax
-	adc	rbx,0
-	DB	0F3h,0C3h		;repret
-
-
-
-ALIGN	32
-__poly1305_init_avx:
-	mov	r14,r11
-	mov	rbx,r12
-	xor	rbp,rbp
-
-	lea	rdi,[((48+64))+rdi]
-
-	mov	rax,r12
-	call	__poly1305_block
-
-	mov	eax,0x3ffffff
-	mov	edx,0x3ffffff
-	mov	r8,r14
-	and	eax,r14d
-	mov	r9,r11
-	and	edx,r11d
-	mov	DWORD[((-64))+rdi],eax
-	shr	r8,26
-	mov	DWORD[((-60))+rdi],edx
-	shr	r9,26
-
-	mov	eax,0x3ffffff
-	mov	edx,0x3ffffff
-	and	eax,r8d
-	and	edx,r9d
-	mov	DWORD[((-48))+rdi],eax
-	lea	eax,[rax*4+rax]
-	mov	DWORD[((-44))+rdi],edx
-	lea	edx,[rdx*4+rdx]
-	mov	DWORD[((-32))+rdi],eax
-	shr	r8,26
-	mov	DWORD[((-28))+rdi],edx
-	shr	r9,26
-
-	mov	rax,rbx
-	mov	rdx,r12
-	shl	rax,12
-	shl	rdx,12
-	or	rax,r8
-	or	rdx,r9
-	and	eax,0x3ffffff
-	and	edx,0x3ffffff
-	mov	DWORD[((-16))+rdi],eax
-	lea	eax,[rax*4+rax]
-	mov	DWORD[((-12))+rdi],edx
-	lea	edx,[rdx*4+rdx]
-	mov	DWORD[rdi],eax
-	mov	r8,rbx
-	mov	DWORD[4+rdi],edx
-	mov	r9,r12
-
-	mov	eax,0x3ffffff
-	mov	edx,0x3ffffff
-	shr	r8,14
-	shr	r9,14
-	and	eax,r8d
-	and	edx,r9d
-	mov	DWORD[16+rdi],eax
-	lea	eax,[rax*4+rax]
-	mov	DWORD[20+rdi],edx
-	lea	edx,[rdx*4+rdx]
-	mov	DWORD[32+rdi],eax
-	shr	r8,26
-	mov	DWORD[36+rdi],edx
-	shr	r9,26
-
-	mov	rax,rbp
-	shl	rax,24
-	or	r8,rax
-	mov	DWORD[48+rdi],r8d
-	lea	r8,[r8*4+r8]
-	mov	DWORD[52+rdi],r9d
-	lea	r9,[r9*4+r9]
-	mov	DWORD[64+rdi],r8d
-	mov	DWORD[68+rdi],r9d
-
-	mov	rax,r12
-	call	__poly1305_block
-
-	mov	eax,0x3ffffff
-	mov	r8,r14
-	and	eax,r14d
-	shr	r8,26
-	mov	DWORD[((-52))+rdi],eax
-
-	mov	edx,0x3ffffff
-	and	edx,r8d
-	mov	DWORD[((-36))+rdi],edx
-	lea	edx,[rdx*4+rdx]
-	shr	r8,26
-	mov	DWORD[((-20))+rdi],edx
-
-	mov	rax,rbx
-	shl	rax,12
-	or	rax,r8
-	and	eax,0x3ffffff
-	mov	DWORD[((-4))+rdi],eax
-	lea	eax,[rax*4+rax]
-	mov	r8,rbx
-	mov	DWORD[12+rdi],eax
-
-	mov	edx,0x3ffffff
-	shr	r8,14
-	and	edx,r8d
-	mov	DWORD[28+rdi],edx
-	lea	edx,[rdx*4+rdx]
-	shr	r8,26
-	mov	DWORD[44+rdi],edx
-
-	mov	rax,rbp
-	shl	rax,24
-	or	r8,rax
-	mov	DWORD[60+rdi],r8d
-	lea	r8,[r8*4+r8]
-	mov	DWORD[76+rdi],r8d
-
-	mov	rax,r12
-	call	__poly1305_block
-
-	mov	eax,0x3ffffff
-	mov	r8,r14
-	and	eax,r14d
-	shr	r8,26
-	mov	DWORD[((-56))+rdi],eax
-
-	mov	edx,0x3ffffff
-	and	edx,r8d
-	mov	DWORD[((-40))+rdi],edx
-	lea	edx,[rdx*4+rdx]
-	shr	r8,26
-	mov	DWORD[((-24))+rdi],edx
-
-	mov	rax,rbx
-	shl	rax,12
-	or	rax,r8
-	and	eax,0x3ffffff
-	mov	DWORD[((-8))+rdi],eax
-	lea	eax,[rax*4+rax]
-	mov	r8,rbx
-	mov	DWORD[8+rdi],eax
-
-	mov	edx,0x3ffffff
-	shr	r8,14
-	and	edx,r8d
-	mov	DWORD[24+rdi],edx
-	lea	edx,[rdx*4+rdx]
-	shr	r8,26
-	mov	DWORD[40+rdi],edx
-
-	mov	rax,rbp
-	shl	rax,24
-	or	r8,rax
-	mov	DWORD[56+rdi],r8d
-	lea	r8,[r8*4+r8]
-	mov	DWORD[72+rdi],r8d
-
-	lea	rdi,[((-48-64))+rdi]
-	DB	0F3h,0C3h		;repret
-
-
-
-ALIGN	32
-poly1305_blocks_avx:
-	mov	QWORD[8+rsp],rdi	;WIN64 prologue
-	mov	QWORD[16+rsp],rsi
-	mov	rax,rsp
-$L$SEH_begin_poly1305_blocks_avx:
-	mov	rdi,rcx
-	mov	rsi,rdx
-	mov	rdx,r8
-	mov	rcx,r9
-
-
-	mov	r8d,DWORD[20+rdi]
-	cmp	rdx,128
-	jae	NEAR $L$blocks_avx
-	test	r8d,r8d
-	jz	NEAR $L$blocks
-
-$L$blocks_avx:
-	and	rdx,-16
-	jz	NEAR $L$no_data_avx
-
-	vzeroupper
-
-	test	r8d,r8d
-	jz	NEAR $L$base2_64_avx
-
-	test	rdx,31
-	jz	NEAR $L$even_avx
-
-	push	rbx
-	push	rbp
-	push	r12
-	push	r13
-	push	r14
-	push	r15
-$L$blocks_avx_body:
-
-	mov	r15,rdx
-
-	mov	r8,QWORD[rdi]
-	mov	r9,QWORD[8+rdi]
-	mov	ebp,DWORD[16+rdi]
-
-	mov	r11,QWORD[24+rdi]
-	mov	r13,QWORD[32+rdi]
-
-
-	mov	r14d,r8d
-	and	r8,-1<<31
-	mov	r12,r9
-	mov	ebx,r9d
-	and	r9,-1<<31
-
-	shr	r8,6
-	shl	r12,52
-	add	r14,r8
-	shr	rbx,12
-	shr	r9,18
-	add	r14,r12
-	adc	rbx,r9
-
-	mov	r8,rbp
-	shl	r8,40
-	shr	rbp,24
-	add	rbx,r8
-	adc	rbp,0
-
-	mov	r9,-4
-	mov	r8,rbp
-	and	r9,rbp
-	shr	r8,2
-	and	rbp,3
-	add	r8,r9
-	add	r14,r8
-	adc	rbx,0
-
-	mov	r12,r13
-	mov	rax,r13
-	shr	r13,2
-	add	r13,r12
-
-	add	r14,QWORD[rsi]
-	adc	rbx,QWORD[8+rsi]
-	lea	rsi,[16+rsi]
-	adc	rbp,rcx
-
-	call	__poly1305_block
-
-	test	rcx,rcx
-	jz	NEAR $L$store_base2_64_avx
-
-
-	mov	rax,r14
-	mov	rdx,r14
-	shr	r14,52
-	mov	r11,rbx
-	mov	r12,rbx
-	shr	rdx,26
-	and	rax,0x3ffffff
-	shl	r11,12
-	and	rdx,0x3ffffff
-	shr	rbx,14
-	or	r14,r11
-	shl	rbp,24
-	and	r14,0x3ffffff
-	shr	r12,40
-	and	rbx,0x3ffffff
-	or	rbp,r12
-
-	sub	r15,16
-	jz	NEAR $L$store_base2_26_avx
-
-	vmovd	xmm0,eax
-	vmovd	xmm1,edx
-	vmovd	xmm2,r14d
-	vmovd	xmm3,ebx
-	vmovd	xmm4,ebp
-	jmp	NEAR $L$proceed_avx
-
-ALIGN	32
-$L$store_base2_64_avx:
-	mov	QWORD[rdi],r14
-	mov	QWORD[8+rdi],rbx
-	mov	QWORD[16+rdi],rbp
-	jmp	NEAR $L$done_avx
-
-ALIGN	16
-$L$store_base2_26_avx:
-	mov	DWORD[rdi],eax
-	mov	DWORD[4+rdi],edx
-	mov	DWORD[8+rdi],r14d
-	mov	DWORD[12+rdi],ebx
-	mov	DWORD[16+rdi],ebp
-ALIGN	16
-$L$done_avx:
-	mov	r15,QWORD[rsp]
-	mov	r14,QWORD[8+rsp]
-	mov	r13,QWORD[16+rsp]
-	mov	r12,QWORD[24+rsp]
-	mov	rbp,QWORD[32+rsp]
-	mov	rbx,QWORD[40+rsp]
-	lea	rsp,[48+rsp]
-$L$no_data_avx:
-$L$blocks_avx_epilogue:
-	mov	rdi,QWORD[8+rsp]	;WIN64 epilogue
-	mov	rsi,QWORD[16+rsp]
-	DB	0F3h,0C3h		;repret
-
-ALIGN	32
-$L$base2_64_avx:
-	push	rbx
-	push	rbp
-	push	r12
-	push	r13
-	push	r14
-	push	r15
-$L$base2_64_avx_body:
-
-	mov	r15,rdx
-
-	mov	r11,QWORD[24+rdi]
-	mov	r13,QWORD[32+rdi]
-
-	mov	r14,QWORD[rdi]
-	mov	rbx,QWORD[8+rdi]
-	mov	ebp,DWORD[16+rdi]
-
-	mov	r12,r13
-	mov	rax,r13
-	shr	r13,2
-	add	r13,r12
-
-	test	rdx,31
-	jz	NEAR $L$init_avx
-
-	add	r14,QWORD[rsi]
-	adc	rbx,QWORD[8+rsi]
-	lea	rsi,[16+rsi]
-	adc	rbp,rcx
-	sub	r15,16
-
-	call	__poly1305_block
-
-$L$init_avx:
-
-	mov	rax,r14
-	mov	rdx,r14
-	shr	r14,52
-	mov	r8,rbx
-	mov	r9,rbx
-	shr	rdx,26
-	and	rax,0x3ffffff
-	shl	r8,12
-	and	rdx,0x3ffffff
-	shr	rbx,14
-	or	r14,r8
-	shl	rbp,24
-	and	r14,0x3ffffff
-	shr	r9,40
-	and	rbx,0x3ffffff
-	or	rbp,r9
-
-	vmovd	xmm0,eax
-	vmovd	xmm1,edx
-	vmovd	xmm2,r14d
-	vmovd	xmm3,ebx
-	vmovd	xmm4,ebp
-	mov	DWORD[20+rdi],1
-
-	call	__poly1305_init_avx
-
-$L$proceed_avx:
-	mov	rdx,r15
-
-	mov	r15,QWORD[rsp]
-	mov	r14,QWORD[8+rsp]
-	mov	r13,QWORD[16+rsp]
-	mov	r12,QWORD[24+rsp]
-	mov	rbp,QWORD[32+rsp]
-	mov	rbx,QWORD[40+rsp]
-	lea	rax,[48+rsp]
-	lea	rsp,[48+rsp]
-$L$base2_64_avx_epilogue:
-	jmp	NEAR $L$do_avx
-
-ALIGN	32
-$L$even_avx:
-	vmovd	xmm0,DWORD[rdi]
-	vmovd	xmm1,DWORD[4+rdi]
-	vmovd	xmm2,DWORD[8+rdi]
-	vmovd	xmm3,DWORD[12+rdi]
-	vmovd	xmm4,DWORD[16+rdi]
-
-$L$do_avx:
-	lea	r11,[((-248))+rsp]
-	sub	rsp,0x218
-	vmovdqa	XMMWORD[80+r11],xmm6
-	vmovdqa	XMMWORD[96+r11],xmm7
-	vmovdqa	XMMWORD[112+r11],xmm8
-	vmovdqa	XMMWORD[128+r11],xmm9
-	vmovdqa	XMMWORD[144+r11],xmm10
-	vmovdqa	XMMWORD[160+r11],xmm11
-	vmovdqa	XMMWORD[176+r11],xmm12
-	vmovdqa	XMMWORD[192+r11],xmm13
-	vmovdqa	XMMWORD[208+r11],xmm14
-	vmovdqa	XMMWORD[224+r11],xmm15
-$L$do_avx_body:
-	sub	rdx,64
-	lea	rax,[((-32))+rsi]
-	cmovc	rsi,rax
-
-	vmovdqu	xmm14,XMMWORD[48+rdi]
-	lea	rdi,[112+rdi]
-	lea	rcx,[$L$const]
-
-
-
-	vmovdqu	xmm5,XMMWORD[32+rsi]
-	vmovdqu	xmm6,XMMWORD[48+rsi]
-	vmovdqa	xmm15,XMMWORD[64+rcx]
-
-	vpsrldq	xmm7,xmm5,6
-	vpsrldq	xmm8,xmm6,6
-	vpunpckhqdq	xmm9,xmm5,xmm6
-	vpunpcklqdq	xmm5,xmm5,xmm6
-	vpunpcklqdq	xmm8,xmm7,xmm8
-
-	vpsrlq	xmm9,xmm9,40
-	vpsrlq	xmm6,xmm5,26
-	vpand	xmm5,xmm5,xmm15
-	vpsrlq	xmm7,xmm8,4
-	vpand	xmm6,xmm6,xmm15
-	vpsrlq	xmm8,xmm8,30
-	vpand	xmm7,xmm7,xmm15
-	vpand	xmm8,xmm8,xmm15
-	vpor	xmm9,xmm9,XMMWORD[32+rcx]
-
-	jbe	NEAR $L$skip_loop_avx
-
-
-	vmovdqu	xmm11,XMMWORD[((-48))+rdi]
-	vmovdqu	xmm12,XMMWORD[((-32))+rdi]
-	vpshufd	xmm13,xmm14,0xEE
-	vpshufd	xmm10,xmm14,0x44
-	vmovdqa	XMMWORD[(-144)+r11],xmm13
-	vmovdqa	XMMWORD[rsp],xmm10
-	vpshufd	xmm14,xmm11,0xEE
-	vmovdqu	xmm10,XMMWORD[((-16))+rdi]
-	vpshufd	xmm11,xmm11,0x44
-	vmovdqa	XMMWORD[(-128)+r11],xmm14
-	vmovdqa	XMMWORD[16+rsp],xmm11
-	vpshufd	xmm13,xmm12,0xEE
-	vmovdqu	xmm11,XMMWORD[rdi]
-	vpshufd	xmm12,xmm12,0x44
-	vmovdqa	XMMWORD[(-112)+r11],xmm13
-	vmovdqa	XMMWORD[32+rsp],xmm12
-	vpshufd	xmm14,xmm10,0xEE
-	vmovdqu	xmm12,XMMWORD[16+rdi]
-	vpshufd	xmm10,xmm10,0x44
-	vmovdqa	XMMWORD[(-96)+r11],xmm14
-	vmovdqa	XMMWORD[48+rsp],xmm10
-	vpshufd	xmm13,xmm11,0xEE
-	vmovdqu	xmm10,XMMWORD[32+rdi]
-	vpshufd	xmm11,xmm11,0x44
-	vmovdqa	XMMWORD[(-80)+r11],xmm13
-	vmovdqa	XMMWORD[64+rsp],xmm11
-	vpshufd	xmm14,xmm12,0xEE
-	vmovdqu	xmm11,XMMWORD[48+rdi]
-	vpshufd	xmm12,xmm12,0x44
-	vmovdqa	XMMWORD[(-64)+r11],xmm14
-	vmovdqa	XMMWORD[80+rsp],xmm12
-	vpshufd	xmm13,xmm10,0xEE
-	vmovdqu	xmm12,XMMWORD[64+rdi]
-	vpshufd	xmm10,xmm10,0x44
-	vmovdqa	XMMWORD[(-48)+r11],xmm13
-	vmovdqa	XMMWORD[96+rsp],xmm10
-	vpshufd	xmm14,xmm11,0xEE
-	vpshufd	xmm11,xmm11,0x44
-	vmovdqa	XMMWORD[(-32)+r11],xmm14
-	vmovdqa	XMMWORD[112+rsp],xmm11
-	vpshufd	xmm13,xmm12,0xEE
-	vmovdqa	xmm14,XMMWORD[rsp]
-	vpshufd	xmm12,xmm12,0x44
-	vmovdqa	XMMWORD[(-16)+r11],xmm13
-	vmovdqa	XMMWORD[128+rsp],xmm12
-
-	jmp	NEAR $L$oop_avx
-
-ALIGN	32
-$L$oop_avx:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-	vpmuludq	xmm10,xmm14,xmm5
-	vpmuludq	xmm11,xmm14,xmm6
-	vmovdqa	XMMWORD[32+r11],xmm2
-	vpmuludq	xmm12,xmm14,xmm7
-	vmovdqa	xmm2,XMMWORD[16+rsp]
-	vpmuludq	xmm13,xmm14,xmm8
-	vpmuludq	xmm14,xmm14,xmm9
-
-	vmovdqa	XMMWORD[r11],xmm0
-	vpmuludq	xmm0,xmm9,XMMWORD[32+rsp]
-	vmovdqa	XMMWORD[16+r11],xmm1
-	vpmuludq	xmm1,xmm2,xmm8
-	vpaddq	xmm10,xmm10,xmm0
-	vpaddq	xmm14,xmm14,xmm1
-	vmovdqa	XMMWORD[48+r11],xmm3
-	vpmuludq	xmm0,xmm2,xmm7
-	vpmuludq	xmm1,xmm2,xmm6
-	vpaddq	xmm13,xmm13,xmm0
-	vmovdqa	xmm3,XMMWORD[48+rsp]
-	vpaddq	xmm12,xmm12,xmm1
-	vmovdqa	XMMWORD[64+r11],xmm4
-	vpmuludq	xmm2,xmm2,xmm5
-	vpmuludq	xmm0,xmm3,xmm7
-	vpaddq	xmm11,xmm11,xmm2
-
-	vmovdqa	xmm4,XMMWORD[64+rsp]
-	vpaddq	xmm14,xmm14,xmm0
-	vpmuludq	xmm1,xmm3,xmm6
-	vpmuludq	xmm3,xmm3,xmm5
-	vpaddq	xmm13,xmm13,xmm1
-	vmovdqa	xmm2,XMMWORD[80+rsp]
-	vpaddq	xmm12,xmm12,xmm3
-	vpmuludq	xmm0,xmm4,xmm9
-	vpmuludq	xmm4,xmm4,xmm8
-	vpaddq	xmm11,xmm11,xmm0
-	vmovdqa	xmm3,XMMWORD[96+rsp]
-	vpaddq	xmm10,xmm10,xmm4
-
-	vmovdqa	xmm4,XMMWORD[128+rsp]
-	vpmuludq	xmm1,xmm2,xmm6
-	vpmuludq	xmm2,xmm2,xmm5
-	vpaddq	xmm14,xmm14,xmm1
-	vpaddq	xmm13,xmm13,xmm2
-	vpmuludq	xmm0,xmm3,xmm9
-	vpmuludq	xmm1,xmm3,xmm8
-	vpaddq	xmm12,xmm12,xmm0
-	vmovdqu	xmm0,XMMWORD[rsi]
-	vpaddq	xmm11,xmm11,xmm1
-	vpmuludq	xmm3,xmm3,xmm7
-	vpmuludq	xmm7,xmm4,xmm7
-	vpaddq	xmm10,xmm10,xmm3
-
-	vmovdqu	xmm1,XMMWORD[16+rsi]
-	vpaddq	xmm11,xmm11,xmm7
-	vpmuludq	xmm8,xmm4,xmm8
-	vpmuludq	xmm9,xmm4,xmm9
-	vpsrldq	xmm2,xmm0,6
-	vpaddq	xmm12,xmm12,xmm8
-	vpaddq	xmm13,xmm13,xmm9
-	vpsrldq	xmm3,xmm1,6
-	vpmuludq	xmm9,xmm5,XMMWORD[112+rsp]
-	vpmuludq	xmm5,xmm4,xmm6
-	vpunpckhqdq	xmm4,xmm0,xmm1
-	vpaddq	xmm14,xmm14,xmm9
-	vmovdqa	xmm9,XMMWORD[((-144))+r11]
-	vpaddq	xmm10,xmm10,xmm5
-
-	vpunpcklqdq	xmm0,xmm0,xmm1
-	vpunpcklqdq	xmm3,xmm2,xmm3
-
-
-	vpsrldq	xmm4,xmm4,5
-	vpsrlq	xmm1,xmm0,26
-	vpand	xmm0,xmm0,xmm15
-	vpsrlq	xmm2,xmm3,4
-	vpand	xmm1,xmm1,xmm15
-	vpand	xmm4,xmm4,XMMWORD[rcx]
-	vpsrlq	xmm3,xmm3,30
-	vpand	xmm2,xmm2,xmm15
-	vpand	xmm3,xmm3,xmm15
-	vpor	xmm4,xmm4,XMMWORD[32+rcx]
-
-	vpaddq	xmm0,xmm0,XMMWORD[r11]
-	vpaddq	xmm1,xmm1,XMMWORD[16+r11]
-	vpaddq	xmm2,xmm2,XMMWORD[32+r11]
-	vpaddq	xmm3,xmm3,XMMWORD[48+r11]
-	vpaddq	xmm4,xmm4,XMMWORD[64+r11]
-
-	lea	rax,[32+rsi]
-	lea	rsi,[64+rsi]
-	sub	rdx,64
-	cmovc	rsi,rax
-
-
-
-
-
-
-
-
-
-
-	vpmuludq	xmm5,xmm9,xmm0
-	vpmuludq	xmm6,xmm9,xmm1
-	vpaddq	xmm10,xmm10,xmm5
-	vpaddq	xmm11,xmm11,xmm6
-	vmovdqa	xmm7,XMMWORD[((-128))+r11]
-	vpmuludq	xmm5,xmm9,xmm2
-	vpmuludq	xmm6,xmm9,xmm3
-	vpaddq	xmm12,xmm12,xmm5
-	vpaddq	xmm13,xmm13,xmm6
-	vpmuludq	xmm9,xmm9,xmm4
-	vpmuludq	xmm5,xmm4,XMMWORD[((-112))+r11]
-	vpaddq	xmm14,xmm14,xmm9
-
-	vpaddq	xmm10,xmm10,xmm5
-	vpmuludq	xmm6,xmm7,xmm2
-	vpmuludq	xmm5,xmm7,xmm3
-	vpaddq	xmm13,xmm13,xmm6
-	vmovdqa	xmm8,XMMWORD[((-96))+r11]
-	vpaddq	xmm14,xmm14,xmm5
-	vpmuludq	xmm6,xmm7,xmm1
-	vpmuludq	xmm7,xmm7,xmm0
-	vpaddq	xmm12,xmm12,xmm6
-	vpaddq	xmm11,xmm11,xmm7
-
-	vmovdqa	xmm9,XMMWORD[((-80))+r11]
-	vpmuludq	xmm5,xmm8,xmm2
-	vpmuludq	xmm6,xmm8,xmm1
-	vpaddq	xmm14,xmm14,xmm5
-	vpaddq	xmm13,xmm13,xmm6
-	vmovdqa	xmm7,XMMWORD[((-64))+r11]
-	vpmuludq	xmm8,xmm8,xmm0
-	vpmuludq	xmm5,xmm9,xmm4
-	vpaddq	xmm12,xmm12,xmm8
-	vpaddq	xmm11,xmm11,xmm5
-	vmovdqa	xmm8,XMMWORD[((-48))+r11]
-	vpmuludq	xmm9,xmm9,xmm3
-	vpmuludq	xmm6,xmm7,xmm1
-	vpaddq	xmm10,xmm10,xmm9
-
-	vmovdqa	xmm9,XMMWORD[((-16))+r11]
-	vpaddq	xmm14,xmm14,xmm6
-	vpmuludq	xmm7,xmm7,xmm0
-	vpmuludq	xmm5,xmm8,xmm4
-	vpaddq	xmm13,xmm13,xmm7
-	vpaddq	xmm12,xmm12,xmm5
-	vmovdqu	xmm5,XMMWORD[32+rsi]
-	vpmuludq	xmm7,xmm8,xmm3
-	vpmuludq	xmm8,xmm8,xmm2
-	vpaddq	xmm11,xmm11,xmm7
-	vmovdqu	xmm6,XMMWORD[48+rsi]
-	vpaddq	xmm10,xmm10,xmm8
-
-	vpmuludq	xmm2,xmm9,xmm2
-	vpmuludq	xmm3,xmm9,xmm3
-	vpsrldq	xmm7,xmm5,6
-	vpaddq	xmm11,xmm11,xmm2
-	vpmuludq	xmm4,xmm9,xmm4
-	vpsrldq	xmm8,xmm6,6
-	vpaddq	xmm2,xmm12,xmm3
-	vpaddq	xmm3,xmm13,xmm4
-	vpmuludq	xmm4,xmm0,XMMWORD[((-32))+r11]
-	vpmuludq	xmm0,xmm9,xmm1
-	vpunpckhqdq	xmm9,xmm5,xmm6
-	vpaddq	xmm4,xmm14,xmm4
-	vpaddq	xmm0,xmm10,xmm0
-
-	vpunpcklqdq	xmm5,xmm5,xmm6
-	vpunpcklqdq	xmm8,xmm7,xmm8
-
-
-	vpsrldq	xmm9,xmm9,5
-	vpsrlq	xmm6,xmm5,26
-	vmovdqa	xmm14,XMMWORD[rsp]
-	vpand	xmm5,xmm5,xmm15
-	vpsrlq	xmm7,xmm8,4
-	vpand	xmm6,xmm6,xmm15
-	vpand	xmm9,xmm9,XMMWORD[rcx]
-	vpsrlq	xmm8,xmm8,30
-	vpand	xmm7,xmm7,xmm15
-	vpand	xmm8,xmm8,xmm15
-	vpor	xmm9,xmm9,XMMWORD[32+rcx]
-
-
-
-
-
-	vpsrlq	xmm13,xmm3,26
-	vpand	xmm3,xmm3,xmm15
-	vpaddq	xmm4,xmm4,xmm13
-
-	vpsrlq	xmm10,xmm0,26
-	vpand	xmm0,xmm0,xmm15
-	vpaddq	xmm1,xmm11,xmm10
-
-	vpsrlq	xmm10,xmm4,26
-	vpand	xmm4,xmm4,xmm15
-
-	vpsrlq	xmm11,xmm1,26
-	vpand	xmm1,xmm1,xmm15
-	vpaddq	xmm2,xmm2,xmm11
-
-	vpaddq	xmm0,xmm0,xmm10
-	vpsllq	xmm10,xmm10,2
-	vpaddq	xmm0,xmm0,xmm10
-
-	vpsrlq	xmm12,xmm2,26
-	vpand	xmm2,xmm2,xmm15
-	vpaddq	xmm3,xmm3,xmm12
-
-	vpsrlq	xmm10,xmm0,26
-	vpand	xmm0,xmm0,xmm15
-	vpaddq	xmm1,xmm1,xmm10
-
-	vpsrlq	xmm13,xmm3,26
-	vpand	xmm3,xmm3,xmm15
-	vpaddq	xmm4,xmm4,xmm13
-
-	ja	NEAR $L$oop_avx
-
-$L$skip_loop_avx:
-
-
-
-	vpshufd	xmm14,xmm14,0x10
-	add	rdx,32
-	jnz	NEAR $L$ong_tail_avx
-
-	vpaddq	xmm7,xmm7,xmm2
-	vpaddq	xmm5,xmm5,xmm0
-	vpaddq	xmm6,xmm6,xmm1
-	vpaddq	xmm8,xmm8,xmm3
-	vpaddq	xmm9,xmm9,xmm4
-
-$L$ong_tail_avx:
-	vmovdqa	XMMWORD[32+r11],xmm2
-	vmovdqa	XMMWORD[r11],xmm0
-	vmovdqa	XMMWORD[16+r11],xmm1
-	vmovdqa	XMMWORD[48+r11],xmm3
-	vmovdqa	XMMWORD[64+r11],xmm4
-
-
-
-
-
-
-
-	vpmuludq	xmm12,xmm14,xmm7
-	vpmuludq	xmm10,xmm14,xmm5
-	vpshufd	xmm2,XMMWORD[((-48))+rdi],0x10
-	vpmuludq	xmm11,xmm14,xmm6
-	vpmuludq	xmm13,xmm14,xmm8
-	vpmuludq	xmm14,xmm14,xmm9
-
-	vpmuludq	xmm0,xmm2,xmm8
-	vpaddq	xmm14,xmm14,xmm0
-	vpshufd	xmm3,XMMWORD[((-32))+rdi],0x10
-	vpmuludq	xmm1,xmm2,xmm7
-	vpaddq	xmm13,xmm13,xmm1
-	vpshufd	xmm4,XMMWORD[((-16))+rdi],0x10
-	vpmuludq	xmm0,xmm2,xmm6
-	vpaddq	xmm12,xmm12,xmm0
-	vpmuludq	xmm2,xmm2,xmm5
-	vpaddq	xmm11,xmm11,xmm2
-	vpmuludq	xmm3,xmm3,xmm9
-	vpaddq	xmm10,xmm10,xmm3
-
-	vpshufd	xmm2,XMMWORD[rdi],0x10
-	vpmuludq	xmm1,xmm4,xmm7
-	vpaddq	xmm14,xmm14,xmm1
-	vpmuludq	xmm0,xmm4,xmm6
-	vpaddq	xmm13,xmm13,xmm0
-	vpshufd	xmm3,XMMWORD[16+rdi],0x10
-	vpmuludq	xmm4,xmm4,xmm5
-	vpaddq	xmm12,xmm12,xmm4
-	vpmuludq	xmm1,xmm2,xmm9
-	vpaddq	xmm11,xmm11,xmm1
-	vpshufd	xmm4,XMMWORD[32+rdi],0x10
-	vpmuludq	xmm2,xmm2,xmm8
-	vpaddq	xmm10,xmm10,xmm2
-
-	vpmuludq	xmm0,xmm3,xmm6
-	vpaddq	xmm14,xmm14,xmm0
-	vpmuludq	xmm3,xmm3,xmm5
-	vpaddq	xmm13,xmm13,xmm3
-	vpshufd	xmm2,XMMWORD[48+rdi],0x10
-	vpmuludq	xmm1,xmm4,xmm9
-	vpaddq	xmm12,xmm12,xmm1
-	vpshufd	xmm3,XMMWORD[64+rdi],0x10
-	vpmuludq	xmm0,xmm4,xmm8
-	vpaddq	xmm11,xmm11,xmm0
-	vpmuludq	xmm4,xmm4,xmm7
-	vpaddq	xmm10,xmm10,xmm4
-
-	vpmuludq	xmm2,xmm2,xmm5
-	vpaddq	xmm14,xmm14,xmm2
-	vpmuludq	xmm1,xmm3,xmm9
-	vpaddq	xmm13,xmm13,xmm1
-	vpmuludq	xmm0,xmm3,xmm8
-	vpaddq	xmm12,xmm12,xmm0
-	vpmuludq	xmm1,xmm3,xmm7
-	vpaddq	xmm11,xmm11,xmm1
-	vpmuludq	xmm3,xmm3,xmm6
-	vpaddq	xmm10,xmm10,xmm3
-
-	jz	NEAR $L$short_tail_avx
-
-	vmovdqu	xmm0,XMMWORD[rsi]
-	vmovdqu	xmm1,XMMWORD[16+rsi]
-
-	vpsrldq	xmm2,xmm0,6
-	vpsrldq	xmm3,xmm1,6
-	vpunpckhqdq	xmm4,xmm0,xmm1
-	vpunpcklqdq	xmm0,xmm0,xmm1
-	vpunpcklqdq	xmm3,xmm2,xmm3
-
-	vpsrlq	xmm4,xmm4,40
-	vpsrlq	xmm1,xmm0,26
-	vpand	xmm0,xmm0,xmm15
-	vpsrlq	xmm2,xmm3,4
-	vpand	xmm1,xmm1,xmm15
-	vpsrlq	xmm3,xmm3,30
-	vpand	xmm2,xmm2,xmm15
-	vpand	xmm3,xmm3,xmm15
-	vpor	xmm4,xmm4,XMMWORD[32+rcx]
-
-	vpshufd	xmm9,XMMWORD[((-64))+rdi],0x32
-	vpaddq	xmm0,xmm0,XMMWORD[r11]
-	vpaddq	xmm1,xmm1,XMMWORD[16+r11]
-	vpaddq	xmm2,xmm2,XMMWORD[32+r11]
-	vpaddq	xmm3,xmm3,XMMWORD[48+r11]
-	vpaddq	xmm4,xmm4,XMMWORD[64+r11]
-
-
-
-
-	vpmuludq	xmm5,xmm9,xmm0
-	vpaddq	xmm10,xmm10,xmm5
-	vpmuludq	xmm6,xmm9,xmm1
-	vpaddq	xmm11,xmm11,xmm6
-	vpmuludq	xmm5,xmm9,xmm2
-	vpaddq	xmm12,xmm12,xmm5
-	vpshufd	xmm7,XMMWORD[((-48))+rdi],0x32
-	vpmuludq	xmm6,xmm9,xmm3
-	vpaddq	xmm13,xmm13,xmm6
-	vpmuludq	xmm9,xmm9,xmm4
-	vpaddq	xmm14,xmm14,xmm9
-
-	vpmuludq	xmm5,xmm7,xmm3
-	vpaddq	xmm14,xmm14,xmm5
-	vpshufd	xmm8,XMMWORD[((-32))+rdi],0x32
-	vpmuludq	xmm6,xmm7,xmm2
-	vpaddq	xmm13,xmm13,xmm6
-	vpshufd	xmm9,XMMWORD[((-16))+rdi],0x32
-	vpmuludq	xmm5,xmm7,xmm1
-	vpaddq	xmm12,xmm12,xmm5
-	vpmuludq	xmm7,xmm7,xmm0
-	vpaddq	xmm11,xmm11,xmm7
-	vpmuludq	xmm8,xmm8,xmm4
-	vpaddq	xmm10,xmm10,xmm8
-
-	vpshufd	xmm7,XMMWORD[rdi],0x32
-	vpmuludq	xmm6,xmm9,xmm2
-	vpaddq	xmm14,xmm14,xmm6
-	vpmuludq	xmm5,xmm9,xmm1
-	vpaddq	xmm13,xmm13,xmm5
-	vpshufd	xmm8,XMMWORD[16+rdi],0x32
-	vpmuludq	xmm9,xmm9,xmm0
-	vpaddq	xmm12,xmm12,xmm9
-	vpmuludq	xmm6,xmm7,xmm4
-	vpaddq	xmm11,xmm11,xmm6
-	vpshufd	xmm9,XMMWORD[32+rdi],0x32
-	vpmuludq	xmm7,xmm7,xmm3
-	vpaddq	xmm10,xmm10,xmm7
-
-	vpmuludq	xmm5,xmm8,xmm1
-	vpaddq	xmm14,xmm14,xmm5
-	vpmuludq	xmm8,xmm8,xmm0
-	vpaddq	xmm13,xmm13,xmm8
-	vpshufd	xmm7,XMMWORD[48+rdi],0x32
-	vpmuludq	xmm6,xmm9,xmm4
-	vpaddq	xmm12,xmm12,xmm6
-	vpshufd	xmm8,XMMWORD[64+rdi],0x32
-	vpmuludq	xmm5,xmm9,xmm3
-	vpaddq	xmm11,xmm11,xmm5
-	vpmuludq	xmm9,xmm9,xmm2
-	vpaddq	xmm10,xmm10,xmm9
-
-	vpmuludq	xmm7,xmm7,xmm0
-	vpaddq	xmm14,xmm14,xmm7
-	vpmuludq	xmm6,xmm8,xmm4
-	vpaddq	xmm13,xmm13,xmm6
-	vpmuludq	xmm5,xmm8,xmm3
-	vpaddq	xmm12,xmm12,xmm5
-	vpmuludq	xmm6,xmm8,xmm2
-	vpaddq	xmm11,xmm11,xmm6
-	vpmuludq	xmm8,xmm8,xmm1
-	vpaddq	xmm10,xmm10,xmm8
-
-$L$short_tail_avx:
-
-
-
-	vpsrldq	xmm9,xmm14,8
-	vpsrldq	xmm8,xmm13,8
-	vpsrldq	xmm6,xmm11,8
-	vpsrldq	xmm5,xmm10,8
-	vpsrldq	xmm7,xmm12,8
-	vpaddq	xmm13,xmm13,xmm8
-	vpaddq	xmm14,xmm14,xmm9
-	vpaddq	xmm10,xmm10,xmm5
-	vpaddq	xmm11,xmm11,xmm6
-	vpaddq	xmm12,xmm12,xmm7
-
-
-
-
-	vpsrlq	xmm3,xmm13,26
-	vpand	xmm13,xmm13,xmm15
-	vpaddq	xmm14,xmm14,xmm3
-
-	vpsrlq	xmm0,xmm10,26
-	vpand	xmm10,xmm10,xmm15
-	vpaddq	xmm11,xmm11,xmm0
-
-	vpsrlq	xmm4,xmm14,26
-	vpand	xmm14,xmm14,xmm15
-
-	vpsrlq	xmm1,xmm11,26
-	vpand	xmm11,xmm11,xmm15
-	vpaddq	xmm12,xmm12,xmm1
-
-	vpaddq	xmm10,xmm10,xmm4
-	vpsllq	xmm4,xmm4,2
-	vpaddq	xmm10,xmm10,xmm4
-
-	vpsrlq	xmm2,xmm12,26
-	vpand	xmm12,xmm12,xmm15
-	vpaddq	xmm13,xmm13,xmm2
-
-	vpsrlq	xmm0,xmm10,26
-	vpand	xmm10,xmm10,xmm15
-	vpaddq	xmm11,xmm11,xmm0
-
-	vpsrlq	xmm3,xmm13,26
-	vpand	xmm13,xmm13,xmm15
-	vpaddq	xmm14,xmm14,xmm3
-
-	vmovd	DWORD[(-112)+rdi],xmm10
-	vmovd	DWORD[(-108)+rdi],xmm11
-	vmovd	DWORD[(-104)+rdi],xmm12
-	vmovd	DWORD[(-100)+rdi],xmm13
-	vmovd	DWORD[(-96)+rdi],xmm14
-	vmovdqa	xmm6,XMMWORD[80+r11]
-	vmovdqa	xmm7,XMMWORD[96+r11]
-	vmovdqa	xmm8,XMMWORD[112+r11]
-	vmovdqa	xmm9,XMMWORD[128+r11]
-	vmovdqa	xmm10,XMMWORD[144+r11]
-	vmovdqa	xmm11,XMMWORD[160+r11]
-	vmovdqa	xmm12,XMMWORD[176+r11]
-	vmovdqa	xmm13,XMMWORD[192+r11]
-	vmovdqa	xmm14,XMMWORD[208+r11]
-	vmovdqa	xmm15,XMMWORD[224+r11]
-	lea	rsp,[248+r11]
-$L$do_avx_epilogue:
-	vzeroupper
-	mov	rdi,QWORD[8+rsp]	;WIN64 epilogue
-	mov	rsi,QWORD[16+rsp]
-	DB	0F3h,0C3h		;repret
-$L$SEH_end_poly1305_blocks_avx:
-
-
-ALIGN	32
-poly1305_emit_avx:
-	mov	QWORD[8+rsp],rdi	;WIN64 prologue
-	mov	QWORD[16+rsp],rsi
-	mov	rax,rsp
-$L$SEH_begin_poly1305_emit_avx:
-	mov	rdi,rcx
-	mov	rsi,rdx
-	mov	rdx,r8
-
-
-	cmp	DWORD[20+rdi],0
-	je	NEAR $L$emit
-
-	mov	eax,DWORD[rdi]
-	mov	ecx,DWORD[4+rdi]
-	mov	r8d,DWORD[8+rdi]
-	mov	r11d,DWORD[12+rdi]
-	mov	r10d,DWORD[16+rdi]
-
-	shl	rcx,26
-	mov	r9,r8
-	shl	r8,52
-	add	rax,rcx
-	shr	r9,12
-	add	r8,rax
-	adc	r9,0
-
-	shl	r11,14
-	mov	rax,r10
-	shr	r10,24
-	add	r9,r11
-	shl	rax,40
-	add	r9,rax
-	adc	r10,0
-
-	mov	rax,r10
-	mov	rcx,r10
-	and	r10,3
-	shr	rax,2
-	and	rcx,-4
-	add	rax,rcx
-	add	r8,rax
-	adc	r9,0
-
-	mov	rax,r8
-	add	r8,5
-	mov	rcx,r9
-	adc	r9,0
-	adc	r10,0
-	shr	r10,2
-	cmovnz	rax,r8
-	cmovnz	rcx,r9
-
-	add	rax,QWORD[rdx]
-	adc	rcx,QWORD[8+rdx]
-	mov	QWORD[rsi],rax
-	mov	QWORD[8+rsi],rcx
-
-	mov	rdi,QWORD[8+rsp]	;WIN64 epilogue
-	mov	rsi,QWORD[16+rsp]
-	DB	0F3h,0C3h		;repret
-$L$SEH_end_poly1305_emit_avx:
-
-ALIGN	32
-poly1305_blocks_avx2:
-	mov	QWORD[8+rsp],rdi	;WIN64 prologue
-	mov	QWORD[16+rsp],rsi
-	mov	rax,rsp
-$L$SEH_begin_poly1305_blocks_avx2:
-	mov	rdi,rcx
-	mov	rsi,rdx
-	mov	rdx,r8
-	mov	rcx,r9
-
-
-	mov	r8d,DWORD[20+rdi]
-	cmp	rdx,128
-	jae	NEAR $L$blocks_avx2
-	test	r8d,r8d
-	jz	NEAR $L$blocks
-
-$L$blocks_avx2:
-	and	rdx,-16
-	jz	NEAR $L$no_data_avx2
-
-	vzeroupper
-
-	test	r8d,r8d
-	jz	NEAR $L$base2_64_avx2
-
-	test	rdx,63
-	jz	NEAR $L$even_avx2
-
-	push	rbx
-	push	rbp
-	push	r12
-	push	r13
-	push	r14
-	push	r15
-$L$blocks_avx2_body:
-
-	mov	r15,rdx
-
-	mov	r8,QWORD[rdi]
-	mov	r9,QWORD[8+rdi]
-	mov	ebp,DWORD[16+rdi]
-
-	mov	r11,QWORD[24+rdi]
-	mov	r13,QWORD[32+rdi]
-
-
-	mov	r14d,r8d
-	and	r8,-1<<31
-	mov	r12,r9
-	mov	ebx,r9d
-	and	r9,-1<<31
-
-	shr	r8,6
-	shl	r12,52
-	add	r14,r8
-	shr	rbx,12
-	shr	r9,18
-	add	r14,r12
-	adc	rbx,r9
-
-	mov	r8,rbp
-	shl	r8,40
-	shr	rbp,24
-	add	rbx,r8
-	adc	rbp,0
-
-	mov	r9,-4
-	mov	r8,rbp
-	and	r9,rbp
-	shr	r8,2
-	and	rbp,3
-	add	r8,r9
-	add	r14,r8
-	adc	rbx,0
-
-	mov	r12,r13
-	mov	rax,r13
-	shr	r13,2
-	add	r13,r12
-
-$L$base2_26_pre_avx2:
-	add	r14,QWORD[rsi]
-	adc	rbx,QWORD[8+rsi]
-	lea	rsi,[16+rsi]
-	adc	rbp,rcx
-	sub	r15,16
-
-	call	__poly1305_block
-	mov	rax,r12
-
-	test	r15,63
-	jnz	NEAR $L$base2_26_pre_avx2
-
-	test	rcx,rcx
-	jz	NEAR $L$store_base2_64_avx2
-
-
-	mov	rax,r14
-	mov	rdx,r14
-	shr	r14,52
-	mov	r11,rbx
-	mov	r12,rbx
-	shr	rdx,26
-	and	rax,0x3ffffff
-	shl	r11,12
-	and	rdx,0x3ffffff
-	shr	rbx,14
-	or	r14,r11
-	shl	rbp,24
-	and	r14,0x3ffffff
-	shr	r12,40
-	and	rbx,0x3ffffff
-	or	rbp,r12
-
-	test	r15,r15
-	jz	NEAR $L$store_base2_26_avx2
-
-	vmovd	xmm0,eax
-	vmovd	xmm1,edx
-	vmovd	xmm2,r14d
-	vmovd	xmm3,ebx
-	vmovd	xmm4,ebp
-	jmp	NEAR $L$proceed_avx2
-
-ALIGN	32
-$L$store_base2_64_avx2:
-	mov	QWORD[rdi],r14
-	mov	QWORD[8+rdi],rbx
-	mov	QWORD[16+rdi],rbp
-	jmp	NEAR $L$done_avx2
-
-ALIGN	16
-$L$store_base2_26_avx2:
-	mov	DWORD[rdi],eax
-	mov	DWORD[4+rdi],edx
-	mov	DWORD[8+rdi],r14d
-	mov	DWORD[12+rdi],ebx
-	mov	DWORD[16+rdi],ebp
-ALIGN	16
-$L$done_avx2:
-	mov	r15,QWORD[rsp]
-	mov	r14,QWORD[8+rsp]
-	mov	r13,QWORD[16+rsp]
-	mov	r12,QWORD[24+rsp]
-	mov	rbp,QWORD[32+rsp]
-	mov	rbx,QWORD[40+rsp]
-	lea	rsp,[48+rsp]
-$L$no_data_avx2:
-$L$blocks_avx2_epilogue:
-	mov	rdi,QWORD[8+rsp]	;WIN64 epilogue
-	mov	rsi,QWORD[16+rsp]
-	DB	0F3h,0C3h		;repret
-
-ALIGN	32
-$L$base2_64_avx2:
-	push	rbx
-	push	rbp
-	push	r12
-	push	r13
-	push	r14
-	push	r15
-$L$base2_64_avx2_body:
-
-	mov	r15,rdx
-
-	mov	r11,QWORD[24+rdi]
-	mov	r13,QWORD[32+rdi]
-
-	mov	r14,QWORD[rdi]
-	mov	rbx,QWORD[8+rdi]
-	mov	ebp,DWORD[16+rdi]
-
-	mov	r12,r13
-	mov	rax,r13
-	shr	r13,2
-	add	r13,r12
-
-	test	rdx,63
-	jz	NEAR $L$init_avx2
-
-$L$base2_64_pre_avx2:
-	add	r14,QWORD[rsi]
-	adc	rbx,QWORD[8+rsi]
-	lea	rsi,[16+rsi]
-	adc	rbp,rcx
-	sub	r15,16
-
-	call	__poly1305_block
-	mov	rax,r12
-
-	test	r15,63
-	jnz	NEAR $L$base2_64_pre_avx2
-
-$L$init_avx2:
-
-	mov	rax,r14
-	mov	rdx,r14
-	shr	r14,52
-	mov	r8,rbx
-	mov	r9,rbx
-	shr	rdx,26
-	and	rax,0x3ffffff
-	shl	r8,12
-	and	rdx,0x3ffffff
-	shr	rbx,14
-	or	r14,r8
-	shl	rbp,24
-	and	r14,0x3ffffff
-	shr	r9,40
-	and	rbx,0x3ffffff
-	or	rbp,r9
-
-	vmovd	xmm0,eax
-	vmovd	xmm1,edx
-	vmovd	xmm2,r14d
-	vmovd	xmm3,ebx
-	vmovd	xmm4,ebp
-	mov	DWORD[20+rdi],1
-
-	call	__poly1305_init_avx
-
-$L$proceed_avx2:
-	mov	rdx,r15
-
-	mov	r15,QWORD[rsp]
-	mov	r14,QWORD[8+rsp]
-	mov	r13,QWORD[16+rsp]
-	mov	r12,QWORD[24+rsp]
-	mov	rbp,QWORD[32+rsp]
-	mov	rbx,QWORD[40+rsp]
-	lea	rax,[48+rsp]
-	lea	rsp,[48+rsp]
-$L$base2_64_avx2_epilogue:
-	jmp	NEAR $L$do_avx2
-
-ALIGN	32
-$L$even_avx2:
-	vmovd	xmm0,DWORD[rdi]
-	vmovd	xmm1,DWORD[4+rdi]
-	vmovd	xmm2,DWORD[8+rdi]
-	vmovd	xmm3,DWORD[12+rdi]
-	vmovd	xmm4,DWORD[16+rdi]
-
-$L$do_avx2:
-	lea	r11,[((-248))+rsp]
-	sub	rsp,0x1c8
-	vmovdqa	XMMWORD[80+r11],xmm6
-	vmovdqa	XMMWORD[96+r11],xmm7
-	vmovdqa	XMMWORD[112+r11],xmm8
-	vmovdqa	XMMWORD[128+r11],xmm9
-	vmovdqa	XMMWORD[144+r11],xmm10
-	vmovdqa	XMMWORD[160+r11],xmm11
-	vmovdqa	XMMWORD[176+r11],xmm12
-	vmovdqa	XMMWORD[192+r11],xmm13
-	vmovdqa	XMMWORD[208+r11],xmm14
-	vmovdqa	XMMWORD[224+r11],xmm15
-$L$do_avx2_body:
-	lea	rdi,[((48+64))+rdi]
-	lea	rcx,[$L$const]
-
-
-	vmovdqu	xmm9,XMMWORD[((-64))+rdi]
-	and	rsp,-512
-	vmovdqu	xmm10,XMMWORD[((-48))+rdi]
-	vmovdqu	xmm6,XMMWORD[((-32))+rdi]
-	vmovdqu	xmm11,XMMWORD[((-16))+rdi]
-	vmovdqu	xmm12,XMMWORD[rdi]
-	vmovdqu	xmm13,XMMWORD[16+rdi]
-	vmovdqu	xmm14,XMMWORD[32+rdi]
-	vpermq	ymm9,ymm9,0x15
-	vmovdqu	xmm15,XMMWORD[48+rdi]
-	vpermq	ymm10,ymm10,0x15
-	vpshufd	ymm9,ymm9,0xc8
-	vmovdqu	xmm5,XMMWORD[64+rdi]
-	vpermq	ymm6,ymm6,0x15
-	vpshufd	ymm10,ymm10,0xc8
-	vmovdqa	YMMWORD[rsp],ymm9
-	vpermq	ymm11,ymm11,0x15
-	vpshufd	ymm6,ymm6,0xc8
-	vmovdqa	YMMWORD[32+rsp],ymm10
-	vpermq	ymm12,ymm12,0x15
-	vpshufd	ymm11,ymm11,0xc8
-	vmovdqa	YMMWORD[64+rsp],ymm6
-	vpermq	ymm13,ymm13,0x15
-	vpshufd	ymm12,ymm12,0xc8
-	vmovdqa	YMMWORD[96+rsp],ymm11
-	vpermq	ymm14,ymm14,0x15
-	vpshufd	ymm13,ymm13,0xc8
-	vmovdqa	YMMWORD[128+rsp],ymm12
-	vpermq	ymm15,ymm15,0x15
-	vpshufd	ymm14,ymm14,0xc8
-	vmovdqa	YMMWORD[160+rsp],ymm13
-	vpermq	ymm5,ymm5,0x15
-	vpshufd	ymm15,ymm15,0xc8
-	vmovdqa	YMMWORD[192+rsp],ymm14
-	vpshufd	ymm5,ymm5,0xc8
-	vmovdqa	YMMWORD[224+rsp],ymm15
-	vmovdqa	YMMWORD[256+rsp],ymm5
-	vmovdqa	ymm5,YMMWORD[64+rcx]
-
-
-
-	vmovdqu	xmm7,XMMWORD[rsi]
-	vmovdqu	xmm8,XMMWORD[16+rsi]
-	vinserti128	ymm7,ymm7,XMMWORD[32+rsi],1
-	vinserti128	ymm8,ymm8,XMMWORD[48+rsi],1
-	lea	rsi,[64+rsi]
-
-	vpsrldq	ymm9,ymm7,6
-	vpsrldq	ymm10,ymm8,6
-	vpunpckhqdq	ymm6,ymm7,ymm8
-	vpunpcklqdq	ymm9,ymm9,ymm10
-	vpunpcklqdq	ymm7,ymm7,ymm8
-
-	vpsrlq	ymm10,ymm9,30
-	vpsrlq	ymm9,ymm9,4
-	vpsrlq	ymm8,ymm7,26
-	vpsrlq	ymm6,ymm6,40
-	vpand	ymm9,ymm9,ymm5
-	vpand	ymm7,ymm7,ymm5
-	vpand	ymm8,ymm8,ymm5
-	vpand	ymm10,ymm10,ymm5
-	vpor	ymm6,ymm6,YMMWORD[32+rcx]
-
-	lea	rax,[144+rsp]
-	vpaddq	ymm2,ymm9,ymm2
-	sub	rdx,64
-	jz	NEAR $L$tail_avx2
-	jmp	NEAR $L$oop_avx2
-
-ALIGN	32
-$L$oop_avx2:
-
-
-
-
-
-
-
-
-	vpaddq	ymm0,ymm7,ymm0
-	vmovdqa	ymm7,YMMWORD[rsp]
-	vpaddq	ymm1,ymm8,ymm1
-	vmovdqa	ymm8,YMMWORD[32+rsp]
-	vpaddq	ymm3,ymm10,ymm3
-	vmovdqa	ymm9,YMMWORD[96+rsp]
-	vpaddq	ymm4,ymm6,ymm4
-	vmovdqa	ymm10,YMMWORD[48+rax]
-	vmovdqa	ymm5,YMMWORD[112+rax]
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-	vpmuludq	ymm13,ymm7,ymm2
-	vpmuludq	ymm14,ymm8,ymm2
-	vpmuludq	ymm15,ymm9,ymm2
-	vpmuludq	ymm11,ymm10,ymm2
-	vpmuludq	ymm12,ymm5,ymm2
-
-	vpmuludq	ymm6,ymm8,ymm0
-	vpmuludq	ymm2,ymm8,ymm1
-	vpaddq	ymm12,ymm12,ymm6
-	vpaddq	ymm13,ymm13,ymm2
-	vpmuludq	ymm6,ymm8,ymm3
-	vpmuludq	ymm2,ymm4,YMMWORD[64+rsp]
-	vpaddq	ymm15,ymm15,ymm6
-	vpaddq	ymm11,ymm11,ymm2
-	vmovdqa	ymm8,YMMWORD[((-16))+rax]
-
-	vpmuludq	ymm6,ymm7,ymm0
-	vpmuludq	ymm2,ymm7,ymm1
-	vpaddq	ymm11,ymm11,ymm6
-	vpaddq	ymm12,ymm12,ymm2
-	vpmuludq	ymm6,ymm7,ymm3
-	vpmuludq	ymm2,ymm7,ymm4
-	vmovdqu	xmm7,XMMWORD[rsi]
-	vpaddq	ymm14,ymm14,ymm6
-	vpaddq	ymm15,ymm15,ymm2
-	vinserti128	ymm7,ymm7,XMMWORD[32+rsi],1
-
-	vpmuludq	ymm6,ymm8,ymm3
-	vpmuludq	ymm2,ymm8,ymm4
-	vmovdqu	xmm8,XMMWORD[16+rsi]
-	vpaddq	ymm11,ymm11,ymm6
-	vpaddq	ymm12,ymm12,ymm2
-	vmovdqa	ymm2,YMMWORD[16+rax]
-	vpmuludq	ymm6,ymm9,ymm1
-	vpmuludq	ymm9,ymm9,ymm0
-	vpaddq	ymm14,ymm14,ymm6
-	vpaddq	ymm13,ymm13,ymm9
-	vinserti128	ymm8,ymm8,XMMWORD[48+rsi],1
-	lea	rsi,[64+rsi]
-
-	vpmuludq	ymm6,ymm2,ymm1
-	vpmuludq	ymm2,ymm2,ymm0
-	vpsrldq	ymm9,ymm7,6
-	vpaddq	ymm15,ymm15,ymm6
-	vpaddq	ymm14,ymm14,ymm2
-	vpmuludq	ymm6,ymm10,ymm3
-	vpmuludq	ymm2,ymm10,ymm4
-	vpsrldq	ymm10,ymm8,6
-	vpaddq	ymm12,ymm12,ymm6
-	vpaddq	ymm13,ymm13,ymm2
-	vpunpckhqdq	ymm6,ymm7,ymm8
-
-	vpmuludq	ymm3,ymm5,ymm3
-	vpmuludq	ymm4,ymm5,ymm4
-	vpunpcklqdq	ymm7,ymm7,ymm8
-	vpaddq	ymm2,ymm13,ymm3
-	vpaddq	ymm3,ymm14,ymm4
-	vpunpcklqdq	ymm10,ymm9,ymm10
-	vpmuludq	ymm4,ymm0,YMMWORD[80+rax]
-	vpmuludq	ymm0,ymm5,ymm1
-	vmovdqa	ymm5,YMMWORD[64+rcx]
-	vpaddq	ymm4,ymm15,ymm4
-	vpaddq	ymm0,ymm11,ymm0
-
-
-
-
-	vpsrlq	ymm14,ymm3,26
-	vpand	ymm3,ymm3,ymm5
-	vpaddq	ymm4,ymm4,ymm14
-
-	vpsrlq	ymm11,ymm0,26
-	vpand	ymm0,ymm0,ymm5
-	vpaddq	ymm1,ymm12,ymm11
-
-	vpsrlq	ymm15,ymm4,26
-	vpand	ymm4,ymm4,ymm5
-
-	vpsrlq	ymm9,ymm10,4
-
-	vpsrlq	ymm12,ymm1,26
-	vpand	ymm1,ymm1,ymm5
-	vpaddq	ymm2,ymm2,ymm12
-
-	vpaddq	ymm0,ymm0,ymm15
-	vpsllq	ymm15,ymm15,2
-	vpaddq	ymm0,ymm0,ymm15
-
-	vpand	ymm9,ymm9,ymm5
-	vpsrlq	ymm8,ymm7,26
-
-	vpsrlq	ymm13,ymm2,26
-	vpand	ymm2,ymm2,ymm5
-	vpaddq	ymm3,ymm3,ymm13
-
-	vpaddq	ymm2,ymm2,ymm9
-	vpsrlq	ymm10,ymm10,30
-
-	vpsrlq	ymm11,ymm0,26
-	vpand	ymm0,ymm0,ymm5
-	vpaddq	ymm1,ymm1,ymm11
-
-	vpsrlq	ymm6,ymm6,40
-
-	vpsrlq	ymm14,ymm3,26
-	vpand	ymm3,ymm3,ymm5
-	vpaddq	ymm4,ymm4,ymm14
-
-	vpand	ymm7,ymm7,ymm5
-	vpand	ymm8,ymm8,ymm5
-	vpand	ymm10,ymm10,ymm5
-	vpor	ymm6,ymm6,YMMWORD[32+rcx]
-
-	sub	rdx,64
-	jnz	NEAR $L$oop_avx2
-
-DB	0x66,0x90
-$L$tail_avx2:
-
-
-
-
-
-
-
-	vpaddq	ymm0,ymm7,ymm0
-	vmovdqu	ymm7,YMMWORD[4+rsp]
-	vpaddq	ymm1,ymm8,ymm1
-	vmovdqu	ymm8,YMMWORD[36+rsp]
-	vpaddq	ymm3,ymm10,ymm3
-	vmovdqu	ymm9,YMMWORD[100+rsp]
-	vpaddq	ymm4,ymm6,ymm4
-	vmovdqu	ymm10,YMMWORD[52+rax]
-	vmovdqu	ymm5,YMMWORD[116+rax]
-
-	vpmuludq	ymm13,ymm7,ymm2
-	vpmuludq	ymm14,ymm8,ymm2
-	vpmuludq	ymm15,ymm9,ymm2
-	vpmuludq	ymm11,ymm10,ymm2
-	vpmuludq	ymm12,ymm5,ymm2
-
-	vpmuludq	ymm6,ymm8,ymm0
-	vpmuludq	ymm2,ymm8,ymm1
-	vpaddq	ymm12,ymm12,ymm6
-	vpaddq	ymm13,ymm13,ymm2
-	vpmuludq	ymm6,ymm8,ymm3
-	vpmuludq	ymm2,ymm4,YMMWORD[68+rsp]
-	vpaddq	ymm15,ymm15,ymm6
-	vpaddq	ymm11,ymm11,ymm2
-
-	vpmuludq	ymm6,ymm7,ymm0
-	vpmuludq	ymm2,ymm7,ymm1
-	vpaddq	ymm11,ymm11,ymm6
-	vmovdqu	ymm8,YMMWORD[((-12))+rax]
-	vpaddq	ymm12,ymm12,ymm2
-	vpmuludq	ymm6,ymm7,ymm3
-	vpmuludq	ymm2,ymm7,ymm4
-	vpaddq	ymm14,ymm14,ymm6
-	vpaddq	ymm15,ymm15,ymm2
-
-	vpmuludq	ymm6,ymm8,ymm3
-	vpmuludq	ymm2,ymm8,ymm4
-	vpaddq	ymm11,ymm11,ymm6
-	vpaddq	ymm12,ymm12,ymm2
-	vmovdqu	ymm2,YMMWORD[20+rax]
-	vpmuludq	ymm6,ymm9,ymm1
-	vpmuludq	ymm9,ymm9,ymm0
-	vpaddq	ymm14,ymm14,ymm6
-	vpaddq	ymm13,ymm13,ymm9
-
-	vpmuludq	ymm6,ymm2,ymm1
-	vpmuludq	ymm2,ymm2,ymm0
-	vpaddq	ymm15,ymm15,ymm6
-	vpaddq	ymm14,ymm14,ymm2
-	vpmuludq	ymm6,ymm10,ymm3
-	vpmuludq	ymm2,ymm10,ymm4
-	vpaddq	ymm12,ymm12,ymm6
-	vpaddq	ymm13,ymm13,ymm2
-
-	vpmuludq	ymm3,ymm5,ymm3
-	vpmuludq	ymm4,ymm5,ymm4
-	vpaddq	ymm2,ymm13,ymm3
-	vpaddq	ymm3,ymm14,ymm4
-	vpmuludq	ymm4,ymm0,YMMWORD[84+rax]
-	vpmuludq	ymm0,ymm5,ymm1
-	vmovdqa	ymm5,YMMWORD[64+rcx]
-	vpaddq	ymm4,ymm15,ymm4
-	vpaddq	ymm0,ymm11,ymm0
-
-
-
-
-	vpsrldq	ymm8,ymm12,8
-	vpsrldq	ymm9,ymm2,8
-	vpsrldq	ymm10,ymm3,8
-	vpsrldq	ymm6,ymm4,8
-	vpsrldq	ymm7,ymm0,8
-	vpaddq	ymm12,ymm12,ymm8
-	vpaddq	ymm2,ymm2,ymm9
-	vpaddq	ymm3,ymm3,ymm10
-	vpaddq	ymm4,ymm4,ymm6
-	vpaddq	ymm0,ymm0,ymm7
-
-	vpermq	ymm10,ymm3,0x2
-	vpermq	ymm6,ymm4,0x2
-	vpermq	ymm7,ymm0,0x2
-	vpermq	ymm8,ymm12,0x2
-	vpermq	ymm9,ymm2,0x2
-	vpaddq	ymm3,ymm3,ymm10
-	vpaddq	ymm4,ymm4,ymm6
-	vpaddq	ymm0,ymm0,ymm7
-	vpaddq	ymm12,ymm12,ymm8
-	vpaddq	ymm2,ymm2,ymm9
-
-
-
-
-	vpsrlq	ymm14,ymm3,26
-	vpand	ymm3,ymm3,ymm5
-	vpaddq	ymm4,ymm4,ymm14
-
-	vpsrlq	ymm11,ymm0,26
-	vpand	ymm0,ymm0,ymm5
-	vpaddq	ymm1,ymm12,ymm11
-
-	vpsrlq	ymm15,ymm4,26
-	vpand	ymm4,ymm4,ymm5
-
-	vpsrlq	ymm12,ymm1,26
-	vpand	ymm1,ymm1,ymm5
-	vpaddq	ymm2,ymm2,ymm12
-
-	vpaddq	ymm0,ymm0,ymm15
-	vpsllq	ymm15,ymm15,2
-	vpaddq	ymm0,ymm0,ymm15
-
-	vpsrlq	ymm13,ymm2,26
-	vpand	ymm2,ymm2,ymm5
-	vpaddq	ymm3,ymm3,ymm13
-
-	vpsrlq	ymm11,ymm0,26
-	vpand	ymm0,ymm0,ymm5
-	vpaddq	ymm1,ymm1,ymm11
-
-	vpsrlq	ymm14,ymm3,26
-	vpand	ymm3,ymm3,ymm5
-	vpaddq	ymm4,ymm4,ymm14
-
-	vmovd	DWORD[(-112)+rdi],xmm0
-	vmovd	DWORD[(-108)+rdi],xmm1
-	vmovd	DWORD[(-104)+rdi],xmm2
-	vmovd	DWORD[(-100)+rdi],xmm3
-	vmovd	DWORD[(-96)+rdi],xmm4
-	vmovdqa	xmm6,XMMWORD[80+r11]
-	vmovdqa	xmm7,XMMWORD[96+r11]
-	vmovdqa	xmm8,XMMWORD[112+r11]
-	vmovdqa	xmm9,XMMWORD[128+r11]
-	vmovdqa	xmm10,XMMWORD[144+r11]
-	vmovdqa	xmm11,XMMWORD[160+r11]
-	vmovdqa	xmm12,XMMWORD[176+r11]
-	vmovdqa	xmm13,XMMWORD[192+r11]
-	vmovdqa	xmm14,XMMWORD[208+r11]
-	vmovdqa	xmm15,XMMWORD[224+r11]
-	lea	rsp,[248+r11]
-$L$do_avx2_epilogue:
-	vzeroupper
-	mov	rdi,QWORD[8+rsp]	;WIN64 epilogue
-	mov	rsi,QWORD[16+rsp]
-	DB	0F3h,0C3h		;repret
-$L$SEH_end_poly1305_blocks_avx2:
-ALIGN	64
-$L$const:
-$L$mask24:
-	DD	0x0ffffff,0,0x0ffffff,0,0x0ffffff,0,0x0ffffff,0
-$L$129:
-	DD	1<<24,0,1<<24,0,1<<24,0,1<<24,0
-$L$mask26:
-	DD	0x3ffffff,0,0x3ffffff,0,0x3ffffff,0,0x3ffffff,0
-$L$five:
-	DD	5,0,5,0,5,0,5,0
-DB	80,111,108,121,49,51,48,53,32,102,111,114,32,120,56,54
-DB	95,54,52,44,32,67,82,89,80,84,79,71,65,77,83,32
-DB	98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115
-DB	108,46,111,114,103,62,0
-ALIGN	16
-EXTERN	__imp_RtlVirtualUnwind
-
-ALIGN	16
-se_handler:
-	push	rsi
-	push	rdi
-	push	rbx
-	push	rbp
-	push	r12
-	push	r13
-	push	r14
-	push	r15
-	pushfq
-	sub	rsp,64
-
-	mov	rax,QWORD[120+r8]
-	mov	rbx,QWORD[248+r8]
-
-	mov	rsi,QWORD[8+r9]
-	mov	r11,QWORD[56+r9]
-
-	mov	r10d,DWORD[r11]
-	lea	r10,[r10*1+rsi]
-	cmp	rbx,r10
-	jb	NEAR $L$common_seh_tail
-
-	mov	rax,QWORD[152+r8]
-
-	mov	r10d,DWORD[4+r11]
-	lea	r10,[r10*1+rsi]
-	cmp	rbx,r10
-	jae	NEAR $L$common_seh_tail
-
-	lea	rax,[48+rax]
-
-	mov	rbx,QWORD[((-8))+rax]
-	mov	rbp,QWORD[((-16))+rax]
-	mov	r12,QWORD[((-24))+rax]
-	mov	r13,QWORD[((-32))+rax]
-	mov	r14,QWORD[((-40))+rax]
-	mov	r15,QWORD[((-48))+rax]
-	mov	QWORD[144+r8],rbx
-	mov	QWORD[160+r8],rbp
-	mov	QWORD[216+r8],r12
-	mov	QWORD[224+r8],r13
-	mov	QWORD[232+r8],r14
-	mov	QWORD[240+r8],r15
-
-	jmp	NEAR $L$common_seh_tail
-
-
-
-ALIGN	16
-avx_handler:
-	push	rsi
-	push	rdi
-	push	rbx
-	push	rbp
-	push	r12
-	push	r13
-	push	r14
-	push	r15
-	pushfq
-	sub	rsp,64
-
-	mov	rax,QWORD[120+r8]
-	mov	rbx,QWORD[248+r8]
-
-	mov	rsi,QWORD[8+r9]
-	mov	r11,QWORD[56+r9]
-
-	mov	r10d,DWORD[r11]
-	lea	r10,[r10*1+rsi]
-	cmp	rbx,r10
-	jb	NEAR $L$common_seh_tail
-
-	mov	rax,QWORD[152+r8]
-
-	mov	r10d,DWORD[4+r11]
-	lea	r10,[r10*1+rsi]
-	cmp	rbx,r10
-	jae	NEAR $L$common_seh_tail
-
-	mov	rax,QWORD[208+r8]
-
-	lea	rsi,[80+rax]
-	lea	rax,[248+rax]
-	lea	rdi,[512+r8]
-	mov	ecx,20
-	DD	0xa548f3fc
-
-$L$common_seh_tail:
-	mov	rdi,QWORD[8+rax]
-	mov	rsi,QWORD[16+rax]
-	mov	QWORD[152+r8],rax
-	mov	QWORD[168+r8],rsi
-	mov	QWORD[176+r8],rdi
-
-	mov	rdi,QWORD[40+r9]
-	mov	rsi,r8
-	mov	ecx,154
-	DD	0xa548f3fc
-
-	mov	rsi,r9
-	xor	rcx,rcx
-	mov	rdx,QWORD[8+rsi]
-	mov	r8,QWORD[rsi]
-	mov	r9,QWORD[16+rsi]
-	mov	r10,QWORD[40+rsi]
-	lea	r11,[56+rsi]
-	lea	r12,[24+rsi]
-	mov	QWORD[32+rsp],r10
-	mov	QWORD[40+rsp],r11
-	mov	QWORD[48+rsp],r12
-	mov	QWORD[56+rsp],rcx
-	call	QWORD[__imp_RtlVirtualUnwind]
-
-	mov	eax,1
-	add	rsp,64
-	popfq
-	pop	r15
-	pop	r14
-	pop	r13
-	pop	r12
-	pop	rbp
-	pop	rbx
-	pop	rdi
-	pop	rsi
-	DB	0F3h,0C3h		;repret
-
-
-section	.pdata rdata align=4
-ALIGN	4
-	DD	$L$SEH_begin_poly1305_init wrt ..imagebase
-	DD	$L$SEH_end_poly1305_init wrt ..imagebase
-	DD	$L$SEH_info_poly1305_init wrt ..imagebase
-
-	DD	$L$SEH_begin_poly1305_blocks wrt ..imagebase
-	DD	$L$SEH_end_poly1305_blocks wrt ..imagebase
-	DD	$L$SEH_info_poly1305_blocks wrt ..imagebase
-
-	DD	$L$SEH_begin_poly1305_emit wrt ..imagebase
-	DD	$L$SEH_end_poly1305_emit wrt ..imagebase
-	DD	$L$SEH_info_poly1305_emit wrt ..imagebase
-	DD	$L$SEH_begin_poly1305_blocks_avx wrt ..imagebase
-	DD	$L$base2_64_avx wrt ..imagebase
-	DD	$L$SEH_info_poly1305_blocks_avx_1 wrt ..imagebase
-
-	DD	$L$base2_64_avx wrt ..imagebase
-	DD	$L$even_avx wrt ..imagebase
-	DD	$L$SEH_info_poly1305_blocks_avx_2 wrt ..imagebase
-
-	DD	$L$even_avx wrt ..imagebase
-	DD	$L$SEH_end_poly1305_blocks_avx wrt ..imagebase
-	DD	$L$SEH_info_poly1305_blocks_avx_3 wrt ..imagebase
-
-	DD	$L$SEH_begin_poly1305_emit_avx wrt ..imagebase
-	DD	$L$SEH_end_poly1305_emit_avx wrt ..imagebase
-	DD	$L$SEH_info_poly1305_emit_avx wrt ..imagebase
-	DD	$L$SEH_begin_poly1305_blocks_avx2 wrt ..imagebase
-	DD	$L$base2_64_avx2 wrt ..imagebase
-	DD	$L$SEH_info_poly1305_blocks_avx2_1 wrt ..imagebase
-
-	DD	$L$base2_64_avx2 wrt ..imagebase
-	DD	$L$even_avx2 wrt ..imagebase
-	DD	$L$SEH_info_poly1305_blocks_avx2_2 wrt ..imagebase
-
-	DD	$L$even_avx2 wrt ..imagebase
-	DD	$L$SEH_end_poly1305_blocks_avx2 wrt ..imagebase
-	DD	$L$SEH_info_poly1305_blocks_avx2_3 wrt ..imagebase
-section	.xdata rdata align=8
-ALIGN	8
-$L$SEH_info_poly1305_init:
-DB	9,0,0,0
-	DD	se_handler wrt ..imagebase
-	DD	$L$SEH_begin_poly1305_init wrt ..imagebase,$L$SEH_begin_poly1305_init wrt ..imagebase
-
-$L$SEH_info_poly1305_blocks:
-DB	9,0,0,0
-	DD	se_handler wrt ..imagebase
-	DD	$L$blocks_body wrt ..imagebase,$L$blocks_epilogue wrt ..imagebase
-
-$L$SEH_info_poly1305_emit:
-DB	9,0,0,0
-	DD	se_handler wrt ..imagebase
-	DD	$L$SEH_begin_poly1305_emit wrt ..imagebase,$L$SEH_begin_poly1305_emit wrt ..imagebase
-$L$SEH_info_poly1305_blocks_avx_1:
-DB	9,0,0,0
-	DD	se_handler wrt ..imagebase
-	DD	$L$blocks_avx_body wrt ..imagebase,$L$blocks_avx_epilogue wrt ..imagebase
-
-$L$SEH_info_poly1305_blocks_avx_2:
-DB	9,0,0,0
-	DD	se_handler wrt ..imagebase
-	DD	$L$base2_64_avx_body wrt ..imagebase,$L$base2_64_avx_epilogue wrt ..imagebase
-
-$L$SEH_info_poly1305_blocks_avx_3:
-DB	9,0,0,0
-	DD	avx_handler wrt ..imagebase
-	DD	$L$do_avx_body wrt ..imagebase,$L$do_avx_epilogue wrt ..imagebase
-
-$L$SEH_info_poly1305_emit_avx:
-DB	9,0,0,0
-	DD	se_handler wrt ..imagebase
-	DD	$L$SEH_begin_poly1305_emit_avx wrt ..imagebase,$L$SEH_begin_poly1305_emit_avx wrt ..imagebase
-$L$SEH_info_poly1305_blocks_avx2_1:
-DB	9,0,0,0
-	DD	se_handler wrt ..imagebase
-	DD	$L$blocks_avx2_body wrt ..imagebase,$L$blocks_avx2_epilogue wrt ..imagebase
-
-$L$SEH_info_poly1305_blocks_avx2_2:
-DB	9,0,0,0
-	DD	se_handler wrt ..imagebase
-	DD	$L$base2_64_avx2_body wrt ..imagebase,$L$base2_64_avx2_epilogue wrt ..imagebase
-
-$L$SEH_info_poly1305_blocks_avx2_3:
-DB	9,0,0,0
-	DD	avx_handler wrt ..imagebase
-	DD	$L$do_avx2_body wrt ..imagebase,$L$do_avx2_epilogue wrt ..imagebase
diff --git a/third_party/polymer/v1_0/chromium.patch b/third_party/polymer/v1_0/chromium.patch
index d67b3e7..9b27dc9 100644
--- a/third_party/polymer/v1_0/chromium.patch
+++ b/third_party/polymer/v1_0/chromium.patch
@@ -23,91 +23,3 @@
  },
  removeCustomPropAssignment: function (cssText) {
  return cssText.replace(this._rx.customProp, '').replace(this._rx.mixinProp, '');
-diff --git a/components-chromium/paper-input/paper-input-addon-behavior-extracted.js b/components-chromium/paper-input/paper-input-addon-behavior-extracted.js
-index d3e469c2..94313dd 100644
---- a/components-chromium/paper-input/paper-input-addon-behavior-extracted.js
-+++ b/components-chromium/paper-input/paper-input-addon-behavior-extracted.js
-@@ -17,10 +17,10 @@
-     /**
-      * The function called by `<paper-input-container>` when the input value or validity changes.
-      * @param {{
--     *   inputElement: (Node|undefined),
-+     *   inputElement: (Element|undefined),
-      *   value: (string|undefined),
--     *   invalid: (boolean|undefined)
--     * }} state All properties are optional -
-+     *   invalid: boolean
-+     * }} state -
-      *     inputElement: The input element.
-      *     value: The input value.
-      *     invalid: True if the input value is invalid.
-@@ -28,4 +28,4 @@
-     update: function(state) {
-     }
-
--  };
-\ No newline at end of file
-+  };
-diff --git a/components-chromium/paper-input/paper-input-char-counter-extracted.js b/comp
-onents-chromium/paper-input/paper-input-char-counter-extracted.js
-index 6577627..e5bb409 100644
---- a/components-chromium/paper-input/paper-input-char-counter-extracted.js
-+++ b/components-chromium/paper-input/paper-input-char-counter-extracted.js
-@@ -12,6 +12,17 @@ Polymer({
-       }
-     },
-
-+    /**
-+     * This overrides the update function in PaperInputAddonBehavior.
-+     * @param {{
-+     *   inputElement: (Element|undefined),
-+     *   value: (string|undefined),
-+     *   invalid: boolean
-+     * }} state -
-+     *     inputElement: The input element.
-+     *     value: The input value.
-+     *     invalid: True if the input value is invalid.
-+     */
-     update: function(state) {
-       if (!state.inputElement) {
-         return;
-@@ -20,11 +31,11 @@ Polymer({
-       state.value = state.value || '';
-
--      var counter = state.value.length;
-+      var counter = state.value.length.toString();
-
-       if (state.inputElement.hasAttribute('maxlength')) {
-         counter += '/' + state.inputElement.getAttribute('maxlength');
-       }
-
-       this._charCounterStr = counter;
-     }
--  });
-\ No newline at end of file
-+  });
-diff --git a/components-chromium/paper-input/paper-input-error-extracted.js b/components-chromium/paper-input/paper-input-error-extracted.js
-index ac6fe00..fb45601 100644
---- a/components-chromium/paper-input/paper-input-error-extracted.js
-+++ b/components-chromium/paper-input/paper-input-error-extracted.js
-@@ -16,7 +16,18 @@ Polymer({
-       }
-     },
-
-+    /**
-+     * This overrides the update function in PaperInputAddonBehavior.
-+     * @param {{
-+     *   inputElement: (Element|undefined),
-+     *   value: (string|undefined),
-+     *   invalid: boolean
-+     * }} state -
-+     *     inputElement: The input element.
-+     *     value: The input value.
-+     *     invalid: True if the input value is invalid.
-+     */
-     update: function(state) {
-       this._setInvalid(state.invalid);
-     }
--  });
-\ No newline at end of file
-+  });
diff --git a/third_party/vulkan/BUILD.gn b/third_party/vulkan/BUILD.gn
new file mode 100644
index 0000000..b7388a2
--- /dev/null
+++ b/third_party/vulkan/BUILD.gn
@@ -0,0 +1,7 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+config("vulkan_headers") {
+  include_dirs = [ "include" ]
+}
diff --git a/third_party/vulkan/LICENSE b/third_party/vulkan/LICENSE
new file mode 100644
index 0000000..808bfa2
--- /dev/null
+++ b/third_party/vulkan/LICENSE
@@ -0,0 +1,81 @@
+
+Copyright (C) 2015 Valve Corporation
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+
+
+
+Copyright (C) 2016 Valve Corporation
+Copyright (C) 2016 Google Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+
+
+
+stb_trutype.h:
+stb_truetype.h - v1.07 - public domain
+authored from 2009-2015 by Sean Barrett / RAD Game Tools
+
+LICENSE
+
+This software is in the public domain. Where that dedication is not
+recognized, you are granted a perpetual, irrevocable license to copy,
+distribute, and modify this file as you see fit.
+
+
+
+glm:
+///////////////////////////////////////////////////////////////////////////////////
+/// OpenGL Mathematics (glm.g-truc.net)
+///
+/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
+/// Permission is hereby granted, free of charge, to any person obtaining a copy
+/// of this software and associated documentation files (the "Software"), to deal
+/// in the Software without restriction, including without limitation the rights
+/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+/// copies of the Software, and to permit persons to whom the Software is
+/// furnished to do so, subject to the following conditions:
+/// 
+/// The above copyright notice and this permission notice shall be included in
+/// all copies or substantial portions of the Software.
+/// 
+/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+/// THE SOFTWARE.
+///
+
diff --git a/third_party/vulkan/OWNERS b/third_party/vulkan/OWNERS
new file mode 100644
index 0000000..905e1f4
--- /dev/null
+++ b/third_party/vulkan/OWNERS
@@ -0,0 +1,2 @@
+piman@chromium.org
+dyen@chromium.org
diff --git a/third_party/vulkan/README.chromium b/third_party/vulkan/README.chromium
new file mode 100644
index 0000000..85ffc4bb
--- /dev/null
+++ b/third_party/vulkan/README.chromium
@@ -0,0 +1,15 @@
+Name: Vulkan API headers
+Short Name: Vulkan
+URL: https://github.com/LunarG/VulkanTools/tree/master/include/vulkan
+Version: Unknown
+Security Critical: yes
+License: MIT
+License File: LICENSE
+
+Description:
+This simply includes the include files for the Vulkan SDK. Eventually this
+will just be taken from the build system.
+
+Local Modifications:
+Placed the include files into "third_party/vulkan/include/vulkan".
+Added OWNERS, README.chromium and BUILD.gn file.
diff --git a/third_party/vulkan/include/vulkan/vk_debug_marker_layer.h b/third_party/vulkan/include/vulkan/vk_debug_marker_layer.h
new file mode 100644
index 0000000..e882b02
--- /dev/null
+++ b/third_party/vulkan/include/vulkan/vk_debug_marker_layer.h
@@ -0,0 +1,44 @@
+//
+// File: vk_debug_marker_layer.h
+//
+/*
+ * Copyright (c) 2015-2016 The Khronos Group Inc.
+ * Copyright (c) 2015-2016 Valve Corporation
+ * Copyright (c) 2015-2016 LunarG, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and/or associated documentation files (the "Materials"), to
+ * deal in the Materials without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Materials, and to permit persons to whom the Materials are
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice(s) and this permission notice shall be included in
+ * all copies or substantial portions of the Materials.
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE
+ * USE OR OTHER DEALINGS IN THE MATERIALS.
+ *
+ * Authors:
+ *   Jon Ashburn <jon@lunarg.com>
+ *   Courtney Goeltzenleuchter <courtney@lunarg.com>
+ */
+
+#pragma once
+
+#include "vulkan.h"
+#include "vk_lunarg_debug_marker.h"
+#include "vk_layer.h"
+
+typedef struct VkLayerDebugMarkerDispatchTable_ {
+    PFN_vkCmdDbgMarkerBegin CmdDbgMarkerBegin;
+    PFN_vkCmdDbgMarkerEnd CmdDbgMarkerEnd;
+    PFN_vkDbgSetObjectTag DbgSetObjectTag;
+    PFN_vkDbgSetObjectName DbgSetObjectName;
+} VkLayerDebugMarkerDispatchTable;
diff --git a/third_party/vulkan/include/vulkan/vk_layer.h b/third_party/vulkan/include/vulkan/vk_layer.h
new file mode 100644
index 0000000..2487043
--- /dev/null
+++ b/third_party/vulkan/include/vulkan/vk_layer.h
@@ -0,0 +1,313 @@
+//
+// File: vk_layer.h
+//
+/*
+ * Copyright (c) 2015-2016 The Khronos Group Inc.
+ * Copyright (c) 2015-2016 Valve Corporation
+ * Copyright (c) 2015-2016 LunarG, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and/or associated documentation files (the "Materials"), to
+ * deal in the Materials without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Materials, and to permit persons to whom the Materials are
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice(s) and this permission notice shall be included in
+ * all copies or substantial portions of the Materials.
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE
+ * USE OR OTHER DEALINGS IN THE MATERIALS.
+ *
+ */
+
+/* Need to define dispatch table
+ * Core struct can then have ptr to dispatch table at the top
+ * Along with object ptrs for current and next OBJ
+ */
+#pragma once
+
+#include "vulkan.h"
+#include "vk_lunarg_debug_marker.h"
+#if defined(__GNUC__) && __GNUC__ >= 4
+#define VK_LAYER_EXPORT __attribute__((visibility("default")))
+#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
+#define VK_LAYER_EXPORT __attribute__((visibility("default")))
+#else
+#define VK_LAYER_EXPORT
+#endif
+
+typedef struct VkLayerDispatchTable_ {
+    PFN_vkGetDeviceProcAddr GetDeviceProcAddr;
+    PFN_vkDestroyDevice DestroyDevice;
+    PFN_vkGetDeviceQueue GetDeviceQueue;
+    PFN_vkQueueSubmit QueueSubmit;
+    PFN_vkQueueWaitIdle QueueWaitIdle;
+    PFN_vkDeviceWaitIdle DeviceWaitIdle;
+    PFN_vkAllocateMemory AllocateMemory;
+    PFN_vkFreeMemory FreeMemory;
+    PFN_vkMapMemory MapMemory;
+    PFN_vkUnmapMemory UnmapMemory;
+    PFN_vkFlushMappedMemoryRanges FlushMappedMemoryRanges;
+    PFN_vkInvalidateMappedMemoryRanges InvalidateMappedMemoryRanges;
+    PFN_vkGetDeviceMemoryCommitment GetDeviceMemoryCommitment;
+    PFN_vkGetImageSparseMemoryRequirements GetImageSparseMemoryRequirements;
+    PFN_vkGetImageMemoryRequirements GetImageMemoryRequirements;
+    PFN_vkGetBufferMemoryRequirements GetBufferMemoryRequirements;
+    PFN_vkBindImageMemory BindImageMemory;
+    PFN_vkBindBufferMemory BindBufferMemory;
+    PFN_vkQueueBindSparse QueueBindSparse;
+    PFN_vkCreateFence CreateFence;
+    PFN_vkDestroyFence DestroyFence;
+    PFN_vkGetFenceStatus GetFenceStatus;
+    PFN_vkResetFences ResetFences;
+    PFN_vkWaitForFences WaitForFences;
+    PFN_vkCreateSemaphore CreateSemaphore;
+    PFN_vkDestroySemaphore DestroySemaphore;
+    PFN_vkCreateEvent CreateEvent;
+    PFN_vkDestroyEvent DestroyEvent;
+    PFN_vkGetEventStatus GetEventStatus;
+    PFN_vkSetEvent SetEvent;
+    PFN_vkResetEvent ResetEvent;
+    PFN_vkCreateQueryPool CreateQueryPool;
+    PFN_vkDestroyQueryPool DestroyQueryPool;
+    PFN_vkGetQueryPoolResults GetQueryPoolResults;
+    PFN_vkCreateBuffer CreateBuffer;
+    PFN_vkDestroyBuffer DestroyBuffer;
+    PFN_vkCreateBufferView CreateBufferView;
+    PFN_vkDestroyBufferView DestroyBufferView;
+    PFN_vkCreateImage CreateImage;
+    PFN_vkDestroyImage DestroyImage;
+    PFN_vkGetImageSubresourceLayout GetImageSubresourceLayout;
+    PFN_vkCreateImageView CreateImageView;
+    PFN_vkDestroyImageView DestroyImageView;
+    PFN_vkCreateShaderModule CreateShaderModule;
+    PFN_vkDestroyShaderModule DestroyShaderModule;
+    PFN_vkCreatePipelineCache CreatePipelineCache;
+    PFN_vkDestroyPipelineCache DestroyPipelineCache;
+    PFN_vkGetPipelineCacheData GetPipelineCacheData;
+    PFN_vkMergePipelineCaches MergePipelineCaches;
+    PFN_vkCreateGraphicsPipelines CreateGraphicsPipelines;
+    PFN_vkCreateComputePipelines CreateComputePipelines;
+    PFN_vkDestroyPipeline DestroyPipeline;
+    PFN_vkCreatePipelineLayout CreatePipelineLayout;
+    PFN_vkDestroyPipelineLayout DestroyPipelineLayout;
+    PFN_vkCreateSampler CreateSampler;
+    PFN_vkDestroySampler DestroySampler;
+    PFN_vkCreateDescriptorSetLayout CreateDescriptorSetLayout;
+    PFN_vkDestroyDescriptorSetLayout DestroyDescriptorSetLayout;
+    PFN_vkCreateDescriptorPool CreateDescriptorPool;
+    PFN_vkDestroyDescriptorPool DestroyDescriptorPool;
+    PFN_vkResetDescriptorPool ResetDescriptorPool;
+    PFN_vkAllocateDescriptorSets AllocateDescriptorSets;
+    PFN_vkFreeDescriptorSets FreeDescriptorSets;
+    PFN_vkUpdateDescriptorSets UpdateDescriptorSets;
+    PFN_vkCreateFramebuffer CreateFramebuffer;
+    PFN_vkDestroyFramebuffer DestroyFramebuffer;
+    PFN_vkCreateRenderPass CreateRenderPass;
+    PFN_vkDestroyRenderPass DestroyRenderPass;
+    PFN_vkGetRenderAreaGranularity GetRenderAreaGranularity;
+    PFN_vkCreateCommandPool CreateCommandPool;
+    PFN_vkDestroyCommandPool DestroyCommandPool;
+    PFN_vkResetCommandPool ResetCommandPool;
+    PFN_vkAllocateCommandBuffers AllocateCommandBuffers;
+    PFN_vkFreeCommandBuffers FreeCommandBuffers;
+    PFN_vkBeginCommandBuffer BeginCommandBuffer;
+    PFN_vkEndCommandBuffer EndCommandBuffer;
+    PFN_vkResetCommandBuffer ResetCommandBuffer;
+    PFN_vkCmdBindPipeline CmdBindPipeline;
+    PFN_vkCmdBindDescriptorSets CmdBindDescriptorSets;
+    PFN_vkCmdBindVertexBuffers CmdBindVertexBuffers;
+    PFN_vkCmdBindIndexBuffer CmdBindIndexBuffer;
+    PFN_vkCmdSetViewport CmdSetViewport;
+    PFN_vkCmdSetScissor CmdSetScissor;
+    PFN_vkCmdSetLineWidth CmdSetLineWidth;
+    PFN_vkCmdSetDepthBias CmdSetDepthBias;
+    PFN_vkCmdSetBlendConstants CmdSetBlendConstants;
+    PFN_vkCmdSetDepthBounds CmdSetDepthBounds;
+    PFN_vkCmdSetStencilCompareMask CmdSetStencilCompareMask;
+    PFN_vkCmdSetStencilWriteMask CmdSetStencilWriteMask;
+    PFN_vkCmdSetStencilReference CmdSetStencilReference;
+    PFN_vkCmdDraw CmdDraw;
+    PFN_vkCmdDrawIndexed CmdDrawIndexed;
+    PFN_vkCmdDrawIndirect CmdDrawIndirect;
+    PFN_vkCmdDrawIndexedIndirect CmdDrawIndexedIndirect;
+    PFN_vkCmdDispatch CmdDispatch;
+    PFN_vkCmdDispatchIndirect CmdDispatchIndirect;
+    PFN_vkCmdCopyBuffer CmdCopyBuffer;
+    PFN_vkCmdCopyImage CmdCopyImage;
+    PFN_vkCmdBlitImage CmdBlitImage;
+    PFN_vkCmdCopyBufferToImage CmdCopyBufferToImage;
+    PFN_vkCmdCopyImageToBuffer CmdCopyImageToBuffer;
+    PFN_vkCmdUpdateBuffer CmdUpdateBuffer;
+    PFN_vkCmdFillBuffer CmdFillBuffer;
+    PFN_vkCmdClearColorImage CmdClearColorImage;
+    PFN_vkCmdClearDepthStencilImage CmdClearDepthStencilImage;
+    PFN_vkCmdClearAttachments CmdClearAttachments;
+    PFN_vkCmdResolveImage CmdResolveImage;
+    PFN_vkCmdSetEvent CmdSetEvent;
+    PFN_vkCmdResetEvent CmdResetEvent;
+    PFN_vkCmdWaitEvents CmdWaitEvents;
+    PFN_vkCmdPipelineBarrier CmdPipelineBarrier;
+    PFN_vkCmdBeginQuery CmdBeginQuery;
+    PFN_vkCmdEndQuery CmdEndQuery;
+    PFN_vkCmdResetQueryPool CmdResetQueryPool;
+    PFN_vkCmdWriteTimestamp CmdWriteTimestamp;
+    PFN_vkCmdCopyQueryPoolResults CmdCopyQueryPoolResults;
+    PFN_vkCmdPushConstants CmdPushConstants;
+    PFN_vkCmdBeginRenderPass CmdBeginRenderPass;
+    PFN_vkCmdNextSubpass CmdNextSubpass;
+    PFN_vkCmdEndRenderPass CmdEndRenderPass;
+    PFN_vkCmdExecuteCommands CmdExecuteCommands;
+    PFN_vkCreateSwapchainKHR CreateSwapchainKHR;
+    PFN_vkDestroySwapchainKHR DestroySwapchainKHR;
+    PFN_vkGetSwapchainImagesKHR GetSwapchainImagesKHR;
+    PFN_vkAcquireNextImageKHR AcquireNextImageKHR;
+    PFN_vkQueuePresentKHR QueuePresentKHR;
+} VkLayerDispatchTable;
+
+typedef struct VkLayerInstanceDispatchTable_ {
+    PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
+    PFN_vkDestroyInstance DestroyInstance;
+    PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices;
+    PFN_vkGetPhysicalDeviceFeatures GetPhysicalDeviceFeatures;
+    PFN_vkGetPhysicalDeviceImageFormatProperties
+        GetPhysicalDeviceImageFormatProperties;
+    PFN_vkGetPhysicalDeviceFormatProperties GetPhysicalDeviceFormatProperties;
+    PFN_vkGetPhysicalDeviceSparseImageFormatProperties
+        GetPhysicalDeviceSparseImageFormatProperties;
+    PFN_vkGetPhysicalDeviceProperties GetPhysicalDeviceProperties;
+    PFN_vkGetPhysicalDeviceQueueFamilyProperties
+        GetPhysicalDeviceQueueFamilyProperties;
+    PFN_vkGetPhysicalDeviceMemoryProperties GetPhysicalDeviceMemoryProperties;
+    PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties;
+    PFN_vkEnumerateDeviceLayerProperties EnumerateDeviceLayerProperties;
+    PFN_vkDestroySurfaceKHR DestroySurfaceKHR;
+    PFN_vkGetPhysicalDeviceSurfaceSupportKHR GetPhysicalDeviceSurfaceSupportKHR;
+    PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR
+        GetPhysicalDeviceSurfaceCapabilitiesKHR;
+    PFN_vkGetPhysicalDeviceSurfaceFormatsKHR GetPhysicalDeviceSurfaceFormatsKHR;
+    PFN_vkGetPhysicalDeviceSurfacePresentModesKHR
+        GetPhysicalDeviceSurfacePresentModesKHR;
+    PFN_vkCreateDebugReportCallbackEXT CreateDebugReportCallbackEXT;
+    PFN_vkDestroyDebugReportCallbackEXT DestroyDebugReportCallbackEXT;
+    PFN_vkDebugReportMessageEXT DebugReportMessageEXT;
+#ifdef VK_USE_PLATFORM_MIR_KHR
+    PFN_vkCreateMirSurfaceKHR CreateMirSurfaceKHR;
+    PFN_vkGetPhysicalDeviceMirPresentationSupportKHR
+        GetPhysicalDeviceMirPresentationSupportKHR;
+#endif
+#ifdef VK_USE_PLATFORM_WAYLAND_KHR
+    PFN_vkCreateWaylandSurfaceKHR CreateWaylandSurfaceKHR;
+    PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR
+        GetPhysicalDeviceWaylandPresentationSupportKHR;
+#endif
+#ifdef VK_USE_PLATFORM_WIN32_KHR
+    PFN_vkCreateWin32SurfaceKHR CreateWin32SurfaceKHR;
+    PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR
+        GetPhysicalDeviceWin32PresentationSupportKHR;
+#endif
+#ifdef VK_USE_PLATFORM_XCB_KHR
+    PFN_vkCreateXcbSurfaceKHR CreateXcbSurfaceKHR;
+    PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR
+        GetPhysicalDeviceXcbPresentationSupportKHR;
+#endif
+#ifdef VK_USE_PLATFORM_XLIB_KHR
+    PFN_vkCreateXlibSurfaceKHR CreateXlibSurfaceKHR;
+    PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR
+        GetPhysicalDeviceXlibPresentationSupportKHR;
+#endif
+#ifdef VK_USE_PLATFORM_ANDROID_KHR
+    PFN_vkCreateAndroidSurfaceKHR CreateAndroidSurfaceKHR;
+#endif
+} VkLayerInstanceDispatchTable;
+
+// LL node for tree of dbg callback functions
+typedef struct VkLayerDbgFunctionNode_ {
+    VkDebugReportCallbackEXT msgCallback;
+    PFN_vkDebugReportCallbackEXT pfnMsgCallback;
+    VkFlags msgFlags;
+    void *pUserData;
+    struct VkLayerDbgFunctionNode_ *pNext;
+} VkLayerDbgFunctionNode;
+
+typedef enum VkLayerDbgAction_ {
+    VK_DBG_LAYER_ACTION_IGNORE = 0x0,
+    VK_DBG_LAYER_ACTION_CALLBACK = 0x1,
+    VK_DBG_LAYER_ACTION_LOG_MSG = 0x2,
+    VK_DBG_LAYER_ACTION_BREAK = 0x4,
+    VK_DBG_LAYER_ACTION_DEBUG_OUTPUT = 0x8,
+} VkLayerDbgAction;
+
+// ------------------------------------------------------------------------------------------------
+// CreateInstance and CreateDevice support structures
+
+typedef enum VkLayerFunction_ {
+    VK_LAYER_LINK_INFO = 0,
+    VK_LAYER_DEVICE_INFO = 1,
+    VK_LAYER_INSTANCE_INFO = 2
+} VkLayerFunction;
+
+/*
+ * When creating the device chain the loader needs to pass
+ * down information about it's device structure needed at
+ * the end of the chain. Passing the data via the
+ * VkLayerInstanceInfo avoids issues with finding the
+ * exact instance being used.
+ */
+typedef struct VkLayerInstanceInfo_ {
+    void *instance_info;
+    PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr;
+} VkLayerInstanceInfo;
+
+typedef struct VkLayerInstanceLink_ {
+    struct VkLayerInstanceLink_ *pNext;
+    PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr;
+} VkLayerInstanceLink;
+
+/*
+ * When creating the device chain the loader needs to pass
+ * down information about it's device structure needed at
+ * the end of the chain. Passing the data via the
+ * VkLayerDeviceInfo avoids issues with finding the
+ * exact instance being used.
+ */
+typedef struct VkLayerDeviceInfo_ {
+    void *device_info;
+    PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr;
+} VkLayerDeviceInfo;
+
+typedef struct {
+    VkStructureType sType; // VK_STRUCTURE_TYPE_LAYER_INSTANCE_CREATE_INFO
+    const void *pNext;
+    VkLayerFunction function;
+    union {
+        VkLayerInstanceLink *pLayerInfo;
+        VkLayerInstanceInfo instanceInfo;
+    } u;
+} VkLayerInstanceCreateInfo;
+
+typedef struct VkLayerDeviceLink_ {
+    struct VkLayerDeviceLink_ *pNext;
+    PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr;
+    PFN_vkGetDeviceProcAddr pfnNextGetDeviceProcAddr;
+} VkLayerDeviceLink;
+
+typedef struct {
+    VkStructureType sType; // VK_STRUCTURE_TYPE_LAYER_DEVICE_CREATE_INFO
+    const void *pNext;
+    VkLayerFunction function;
+    union {
+        VkLayerDeviceLink *pLayerInfo;
+        VkLayerDeviceInfo deviceInfo;
+    } u;
+} VkLayerDeviceCreateInfo;
+
+// ------------------------------------------------------------------------------------------------
+// API functions
diff --git a/third_party/vulkan/include/vulkan/vk_platform.h b/third_party/vulkan/include/vulkan/vk_platform.h
new file mode 100644
index 0000000..a53e725a
--- /dev/null
+++ b/third_party/vulkan/include/vulkan/vk_platform.h
@@ -0,0 +1,127 @@
+//
+// File: vk_platform.h
+//
+/*
+** Copyright (c) 2014-2015 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+
+#ifndef __VK_PLATFORM_H__
+#define __VK_PLATFORM_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif // __cplusplus
+
+/*
+***************************************************************************************************
+*   Platform-specific directives and type declarations
+***************************************************************************************************
+*/
+
+/* Platform-specific calling convention macros.
+ *
+ * Platforms should define these so that Vulkan clients call Vulkan commands
+ * with the same calling conventions that the Vulkan implementation expects.
+ *
+ * VKAPI_ATTR - Placed before the return type in function declarations.
+ *              Useful for C++11 and GCC/Clang-style function attribute syntax.
+ * VKAPI_CALL - Placed after the return type in function declarations.
+ *              Useful for MSVC-style calling convention syntax.
+ * VKAPI_PTR  - Placed between the '(' and '*' in function pointer types.
+ *
+ * Function declaration:  VKAPI_ATTR void VKAPI_CALL vkCommand(void);
+ * Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void);
+ */
+#if defined(_WIN32)
+    // On Windows, Vulkan commands use the stdcall convention
+    #define VKAPI_ATTR
+    #define VKAPI_CALL __stdcall
+    #define VKAPI_PTR  VKAPI_CALL
+#elif defined(__ANDROID__) && defined(__ARM_EABI__) && !defined(__ARM_ARCH_7A__)
+    // Android does not support Vulkan in native code using the "armeabi" ABI.
+    #error "Vulkan requires the 'armeabi-v7a' or 'armeabi-v7a-hard' ABI on 32-bit ARM CPUs"
+#elif defined(__ANDROID__) && defined(__ARM_ARCH_7A__)
+    // On Android/ARMv7a, Vulkan functions use the armeabi-v7a-hard calling
+    // convention, even if the application's native code is compiled with the
+    // armeabi-v7a calling convention.
+    #define VKAPI_ATTR __attribute__((pcs("aapcs-vfp")))
+    #define VKAPI_CALL
+    #define VKAPI_PTR  VKAPI_ATTR
+#else
+    // On other platforms, use the default calling convention
+    #define VKAPI_ATTR
+    #define VKAPI_CALL
+    #define VKAPI_PTR
+#endif
+
+#include <stddef.h>
+
+#if !defined(VK_NO_STDINT_H)
+    #if defined(_MSC_VER) && (_MSC_VER < 1600)
+        typedef signed   __int8  int8_t;
+        typedef unsigned __int8  uint8_t;
+        typedef signed   __int16 int16_t;
+        typedef unsigned __int16 uint16_t;
+        typedef signed   __int32 int32_t;
+        typedef unsigned __int32 uint32_t;
+        typedef signed   __int64 int64_t;
+        typedef unsigned __int64 uint64_t;
+    #else
+        #include <stdint.h>
+    #endif
+#endif // !defined(VK_NO_STDINT_H)
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
+
+// Platform-specific headers required by platform window system extensions.
+// These are enabled prior to #including "vulkan.h". The same enable then
+// controls inclusion of the extension interfaces in vulkan.h.
+
+#ifdef VK_USE_PLATFORM_ANDROID_KHR
+#include <android/native_window.h>
+#endif
+
+#ifdef VK_USE_PLATFORM_MIR_KHR
+#include <mir_toolkit/client_types.h>
+#endif
+
+#ifdef VK_USE_PLATFORM_WAYLAND_KHR
+#include <wayland-client.h>
+#endif
+
+#ifdef VK_USE_PLATFORM_WIN32_KHR
+#include <windows.h>
+#endif
+
+#ifdef VK_USE_PLATFORM_XLIB_KHR
+#include <X11/Xlib.h>
+#endif
+
+#ifdef VK_USE_PLATFORM_XCB_KHR
+#include <xcb/xcb.h>
+#endif
+
+#endif // __VK_PLATFORM_H__
diff --git a/third_party/vulkan/include/vulkan/vk_sdk_platform.h b/third_party/vulkan/include/vulkan/vk_sdk_platform.h
new file mode 100644
index 0000000..f79396bac
--- /dev/null
+++ b/third_party/vulkan/include/vulkan/vk_sdk_platform.h
@@ -0,0 +1,53 @@
+//
+// File: vk_sdk_platform.h
+//
+/*
+ * Copyright (c) 2015-2016 The Khronos Group Inc.
+ * Copyright (c) 2015-2016 Valve Corporation
+ * Copyright (c) 2015-2016 LunarG, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and/or associated documentation files (the "Materials"), to
+ * deal in the Materials without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Materials, and to permit persons to whom the Materials are
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice(s) and this permission notice shall be included in
+ * all copies or substantial portions of the Materials.
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE
+ * USE OR OTHER DEALINGS IN THE MATERIALS.
+ */
+
+#ifndef VK_SDK_PLATFORM_H
+#define VK_SDK_PLATFORM_H
+
+#if defined(_WIN32)
+#define NOMINMAX
+#ifndef __cplusplus
+#undef inline
+#define inline __inline
+#endif // __cplusplus
+
+#if (defined(_MSC_VER) && _MSC_VER < 1900 /*vs2015*/)
+// C99:
+// Microsoft didn't implement C99 in Visual Studio; but started adding it with
+// VS2013.  However, VS2013 still didn't have snprintf().  The following is a
+// work-around (Note: The _CRT_SECURE_NO_WARNINGS macro must be set in the
+// "CMakeLists.txt" file).
+// NOTE: This is fixed in Visual Studio 2015.
+#define snprintf _snprintf
+#endif
+
+#define strdup _strdup
+
+#endif // _WIN32
+
+#endif // VK_SDK_PLATFORM_H
diff --git a/third_party/vulkan/include/vulkan/vulkan.h b/third_party/vulkan/include/vulkan/vulkan.h
new file mode 100644
index 0000000..cd6a71a
--- /dev/null
+++ b/third_party/vulkan/include/vulkan/vulkan.h
@@ -0,0 +1,3775 @@
+#ifndef __vulkan_h_
+#define __vulkan_h_ 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2015-2016 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+/*
+** This header is generated from the Khronos Vulkan XML API Registry.
+**
+*/
+
+
+#define VK_VERSION_1_0 1
+#include "vk_platform.h"
+
+#define VK_MAKE_VERSION(major, minor, patch) \
+    (((major) << 22) | ((minor) << 12) | (patch))
+
+// Vulkan API version supported by this file
+#define VK_API_VERSION VK_MAKE_VERSION(1, 0, 3)
+
+#define VK_VERSION_MAJOR(version) ((uint32_t)(version) >> 22)
+#define VK_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3ff)
+#define VK_VERSION_PATCH(version) ((uint32_t)(version) & 0xfff)
+
+#define VK_NULL_HANDLE 0
+        
+
+
+#define VK_DEFINE_HANDLE(object) typedef struct object##_T* object;
+
+
+#if defined(__LP64__) || defined(_WIN64) || defined(__x86_64__) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
+        #define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T *object;
+#else
+        #define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object;
+#endif
+        
+
+
+typedef uint32_t VkFlags;
+typedef uint32_t VkBool32;
+typedef uint64_t VkDeviceSize;
+typedef uint32_t VkSampleMask;
+
+VK_DEFINE_HANDLE(VkInstance)
+VK_DEFINE_HANDLE(VkPhysicalDevice)
+VK_DEFINE_HANDLE(VkDevice)
+VK_DEFINE_HANDLE(VkQueue)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSemaphore)
+VK_DEFINE_HANDLE(VkCommandBuffer)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkFence)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDeviceMemory)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkBuffer)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkImage)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkEvent)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkQueryPool)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkBufferView)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkImageView)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkShaderModule)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPipelineCache)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPipelineLayout)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkRenderPass)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPipeline)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorSetLayout)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSampler)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorPool)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorSet)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkFramebuffer)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkCommandPool)
+
+#define VK_LOD_CLAMP_NONE                 1000.0f
+#define VK_REMAINING_MIP_LEVELS           (~0U)
+#define VK_REMAINING_ARRAY_LAYERS         (~0U)
+#define VK_WHOLE_SIZE                     (~0ULL)
+#define VK_ATTACHMENT_UNUSED              (~0U)
+#define VK_TRUE                           1
+#define VK_FALSE                          0
+#define VK_QUEUE_FAMILY_IGNORED           (~0U)
+#define VK_SUBPASS_EXTERNAL               (~0U)
+#define VK_MAX_PHYSICAL_DEVICE_NAME_SIZE  256
+#define VK_UUID_SIZE                      16
+#define VK_MAX_MEMORY_TYPES               32
+#define VK_MAX_MEMORY_HEAPS               16
+#define VK_MAX_EXTENSION_NAME_SIZE        256
+#define VK_MAX_DESCRIPTION_SIZE           256
+
+
+typedef enum VkPipelineCacheHeaderVersion {
+    VK_PIPELINE_CACHE_HEADER_VERSION_ONE = 1,
+    VK_PIPELINE_CACHE_HEADER_VERSION_BEGIN_RANGE = VK_PIPELINE_CACHE_HEADER_VERSION_ONE,
+    VK_PIPELINE_CACHE_HEADER_VERSION_END_RANGE = VK_PIPELINE_CACHE_HEADER_VERSION_ONE,
+    VK_PIPELINE_CACHE_HEADER_VERSION_RANGE_SIZE = (VK_PIPELINE_CACHE_HEADER_VERSION_ONE - VK_PIPELINE_CACHE_HEADER_VERSION_ONE + 1),
+    VK_PIPELINE_CACHE_HEADER_VERSION_MAX_ENUM = 0x7FFFFFFF
+} VkPipelineCacheHeaderVersion;
+
+typedef enum VkResult {
+    VK_SUCCESS = 0,
+    VK_NOT_READY = 1,
+    VK_TIMEOUT = 2,
+    VK_EVENT_SET = 3,
+    VK_EVENT_RESET = 4,
+    VK_INCOMPLETE = 5,
+    VK_ERROR_OUT_OF_HOST_MEMORY = -1,
+    VK_ERROR_OUT_OF_DEVICE_MEMORY = -2,
+    VK_ERROR_INITIALIZATION_FAILED = -3,
+    VK_ERROR_DEVICE_LOST = -4,
+    VK_ERROR_MEMORY_MAP_FAILED = -5,
+    VK_ERROR_LAYER_NOT_PRESENT = -6,
+    VK_ERROR_EXTENSION_NOT_PRESENT = -7,
+    VK_ERROR_FEATURE_NOT_PRESENT = -8,
+    VK_ERROR_INCOMPATIBLE_DRIVER = -9,
+    VK_ERROR_TOO_MANY_OBJECTS = -10,
+    VK_ERROR_FORMAT_NOT_SUPPORTED = -11,
+    VK_ERROR_SURFACE_LOST_KHR = -1000000000,
+    VK_ERROR_NATIVE_WINDOW_IN_USE_KHR = -1000000001,
+    VK_SUBOPTIMAL_KHR = 1000001003,
+    VK_ERROR_OUT_OF_DATE_KHR = -1000001004,
+    VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = -1000003001,
+    VK_ERROR_VALIDATION_FAILED_EXT = -1000011001,
+    VK_RESULT_BEGIN_RANGE = VK_ERROR_FORMAT_NOT_SUPPORTED,
+    VK_RESULT_END_RANGE = VK_INCOMPLETE,
+    VK_RESULT_RANGE_SIZE = (VK_INCOMPLETE - VK_ERROR_FORMAT_NOT_SUPPORTED + 1),
+    VK_RESULT_MAX_ENUM = 0x7FFFFFFF
+} VkResult;
+
+typedef enum VkStructureType {
+    VK_STRUCTURE_TYPE_APPLICATION_INFO = 0,
+    VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO = 1,
+    VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO = 2,
+    VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO = 3,
+    VK_STRUCTURE_TYPE_SUBMIT_INFO = 4,
+    VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO = 5,
+    VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE = 6,
+    VK_STRUCTURE_TYPE_BIND_SPARSE_INFO = 7,
+    VK_STRUCTURE_TYPE_FENCE_CREATE_INFO = 8,
+    VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO = 9,
+    VK_STRUCTURE_TYPE_EVENT_CREATE_INFO = 10,
+    VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO = 11,
+    VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO = 12,
+    VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO = 13,
+    VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO = 14,
+    VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO = 15,
+    VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO = 16,
+    VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO = 17,
+    VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO = 18,
+    VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO = 19,
+    VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO = 20,
+    VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO = 21,
+    VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO = 22,
+    VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO = 23,
+    VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO = 24,
+    VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO = 25,
+    VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO = 26,
+    VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO = 27,
+    VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO = 28,
+    VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO = 29,
+    VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO = 30,
+    VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO = 31,
+    VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO = 32,
+    VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO = 33,
+    VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO = 34,
+    VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET = 35,
+    VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET = 36,
+    VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO = 37,
+    VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO = 38,
+    VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO = 39,
+    VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO = 40,
+    VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO = 41,
+    VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO = 42,
+    VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO = 43,
+    VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER = 44,
+    VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER = 45,
+    VK_STRUCTURE_TYPE_MEMORY_BARRIER = 46,
+    VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO = 47,
+    VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO = 48,
+    VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR = 1000001000,
+    VK_STRUCTURE_TYPE_PRESENT_INFO_KHR = 1000001001,
+    VK_STRUCTURE_TYPE_DISPLAY_MODE_CREATE_INFO_KHR = 1000002000,
+    VK_STRUCTURE_TYPE_DISPLAY_SURFACE_CREATE_INFO_KHR = 1000002001,
+    VK_STRUCTURE_TYPE_DISPLAY_PRESENT_INFO_KHR = 1000003000,
+    VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR = 1000004000,
+    VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR = 1000005000,
+    VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR = 1000006000,
+    VK_STRUCTURE_TYPE_MIR_SURFACE_CREATE_INFO_KHR = 1000007000,
+    VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR = 1000008000,
+    VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR = 1000009000,
+    VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT = 1000011000,
+    VK_STRUCTURE_TYPE_BEGIN_RANGE = VK_STRUCTURE_TYPE_APPLICATION_INFO,
+    VK_STRUCTURE_TYPE_END_RANGE = VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO,
+    VK_STRUCTURE_TYPE_RANGE_SIZE = (VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO - VK_STRUCTURE_TYPE_APPLICATION_INFO + 1),
+    VK_STRUCTURE_TYPE_MAX_ENUM = 0x7FFFFFFF
+} VkStructureType;
+
+typedef enum VkSystemAllocationScope {
+    VK_SYSTEM_ALLOCATION_SCOPE_COMMAND = 0,
+    VK_SYSTEM_ALLOCATION_SCOPE_OBJECT = 1,
+    VK_SYSTEM_ALLOCATION_SCOPE_CACHE = 2,
+    VK_SYSTEM_ALLOCATION_SCOPE_DEVICE = 3,
+    VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE = 4,
+    VK_SYSTEM_ALLOCATION_SCOPE_BEGIN_RANGE = VK_SYSTEM_ALLOCATION_SCOPE_COMMAND,
+    VK_SYSTEM_ALLOCATION_SCOPE_END_RANGE = VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE,
+    VK_SYSTEM_ALLOCATION_SCOPE_RANGE_SIZE = (VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE - VK_SYSTEM_ALLOCATION_SCOPE_COMMAND + 1),
+    VK_SYSTEM_ALLOCATION_SCOPE_MAX_ENUM = 0x7FFFFFFF
+} VkSystemAllocationScope;
+
+typedef enum VkInternalAllocationType {
+    VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE = 0,
+    VK_INTERNAL_ALLOCATION_TYPE_BEGIN_RANGE = VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE,
+    VK_INTERNAL_ALLOCATION_TYPE_END_RANGE = VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE,
+    VK_INTERNAL_ALLOCATION_TYPE_RANGE_SIZE = (VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE - VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE + 1),
+    VK_INTERNAL_ALLOCATION_TYPE_MAX_ENUM = 0x7FFFFFFF
+} VkInternalAllocationType;
+
+typedef enum VkFormat {
+    VK_FORMAT_UNDEFINED = 0,
+    VK_FORMAT_R4G4_UNORM_PACK8 = 1,
+    VK_FORMAT_R4G4B4A4_UNORM_PACK16 = 2,
+    VK_FORMAT_B4G4R4A4_UNORM_PACK16 = 3,
+    VK_FORMAT_R5G6B5_UNORM_PACK16 = 4,
+    VK_FORMAT_B5G6R5_UNORM_PACK16 = 5,
+    VK_FORMAT_R5G5B5A1_UNORM_PACK16 = 6,
+    VK_FORMAT_B5G5R5A1_UNORM_PACK16 = 7,
+    VK_FORMAT_A1R5G5B5_UNORM_PACK16 = 8,
+    VK_FORMAT_R8_UNORM = 9,
+    VK_FORMAT_R8_SNORM = 10,
+    VK_FORMAT_R8_USCALED = 11,
+    VK_FORMAT_R8_SSCALED = 12,
+    VK_FORMAT_R8_UINT = 13,
+    VK_FORMAT_R8_SINT = 14,
+    VK_FORMAT_R8_SRGB = 15,
+    VK_FORMAT_R8G8_UNORM = 16,
+    VK_FORMAT_R8G8_SNORM = 17,
+    VK_FORMAT_R8G8_USCALED = 18,
+    VK_FORMAT_R8G8_SSCALED = 19,
+    VK_FORMAT_R8G8_UINT = 20,
+    VK_FORMAT_R8G8_SINT = 21,
+    VK_FORMAT_R8G8_SRGB = 22,
+    VK_FORMAT_R8G8B8_UNORM = 23,
+    VK_FORMAT_R8G8B8_SNORM = 24,
+    VK_FORMAT_R8G8B8_USCALED = 25,
+    VK_FORMAT_R8G8B8_SSCALED = 26,
+    VK_FORMAT_R8G8B8_UINT = 27,
+    VK_FORMAT_R8G8B8_SINT = 28,
+    VK_FORMAT_R8G8B8_SRGB = 29,
+    VK_FORMAT_B8G8R8_UNORM = 30,
+    VK_FORMAT_B8G8R8_SNORM = 31,
+    VK_FORMAT_B8G8R8_USCALED = 32,
+    VK_FORMAT_B8G8R8_SSCALED = 33,
+    VK_FORMAT_B8G8R8_UINT = 34,
+    VK_FORMAT_B8G8R8_SINT = 35,
+    VK_FORMAT_B8G8R8_SRGB = 36,
+    VK_FORMAT_R8G8B8A8_UNORM = 37,
+    VK_FORMAT_R8G8B8A8_SNORM = 38,
+    VK_FORMAT_R8G8B8A8_USCALED = 39,
+    VK_FORMAT_R8G8B8A8_SSCALED = 40,
+    VK_FORMAT_R8G8B8A8_UINT = 41,
+    VK_FORMAT_R8G8B8A8_SINT = 42,
+    VK_FORMAT_R8G8B8A8_SRGB = 43,
+    VK_FORMAT_B8G8R8A8_UNORM = 44,
+    VK_FORMAT_B8G8R8A8_SNORM = 45,
+    VK_FORMAT_B8G8R8A8_USCALED = 46,
+    VK_FORMAT_B8G8R8A8_SSCALED = 47,
+    VK_FORMAT_B8G8R8A8_UINT = 48,
+    VK_FORMAT_B8G8R8A8_SINT = 49,
+    VK_FORMAT_B8G8R8A8_SRGB = 50,
+    VK_FORMAT_A8B8G8R8_UNORM_PACK32 = 51,
+    VK_FORMAT_A8B8G8R8_SNORM_PACK32 = 52,
+    VK_FORMAT_A8B8G8R8_USCALED_PACK32 = 53,
+    VK_FORMAT_A8B8G8R8_SSCALED_PACK32 = 54,
+    VK_FORMAT_A8B8G8R8_UINT_PACK32 = 55,
+    VK_FORMAT_A8B8G8R8_SINT_PACK32 = 56,
+    VK_FORMAT_A8B8G8R8_SRGB_PACK32 = 57,
+    VK_FORMAT_A2R10G10B10_UNORM_PACK32 = 58,
+    VK_FORMAT_A2R10G10B10_SNORM_PACK32 = 59,
+    VK_FORMAT_A2R10G10B10_USCALED_PACK32 = 60,
+    VK_FORMAT_A2R10G10B10_SSCALED_PACK32 = 61,
+    VK_FORMAT_A2R10G10B10_UINT_PACK32 = 62,
+    VK_FORMAT_A2R10G10B10_SINT_PACK32 = 63,
+    VK_FORMAT_A2B10G10R10_UNORM_PACK32 = 64,
+    VK_FORMAT_A2B10G10R10_SNORM_PACK32 = 65,
+    VK_FORMAT_A2B10G10R10_USCALED_PACK32 = 66,
+    VK_FORMAT_A2B10G10R10_SSCALED_PACK32 = 67,
+    VK_FORMAT_A2B10G10R10_UINT_PACK32 = 68,
+    VK_FORMAT_A2B10G10R10_SINT_PACK32 = 69,
+    VK_FORMAT_R16_UNORM = 70,
+    VK_FORMAT_R16_SNORM = 71,
+    VK_FORMAT_R16_USCALED = 72,
+    VK_FORMAT_R16_SSCALED = 73,
+    VK_FORMAT_R16_UINT = 74,
+    VK_FORMAT_R16_SINT = 75,
+    VK_FORMAT_R16_SFLOAT = 76,
+    VK_FORMAT_R16G16_UNORM = 77,
+    VK_FORMAT_R16G16_SNORM = 78,
+    VK_FORMAT_R16G16_USCALED = 79,
+    VK_FORMAT_R16G16_SSCALED = 80,
+    VK_FORMAT_R16G16_UINT = 81,
+    VK_FORMAT_R16G16_SINT = 82,
+    VK_FORMAT_R16G16_SFLOAT = 83,
+    VK_FORMAT_R16G16B16_UNORM = 84,
+    VK_FORMAT_R16G16B16_SNORM = 85,
+    VK_FORMAT_R16G16B16_USCALED = 86,
+    VK_FORMAT_R16G16B16_SSCALED = 87,
+    VK_FORMAT_R16G16B16_UINT = 88,
+    VK_FORMAT_R16G16B16_SINT = 89,
+    VK_FORMAT_R16G16B16_SFLOAT = 90,
+    VK_FORMAT_R16G16B16A16_UNORM = 91,
+    VK_FORMAT_R16G16B16A16_SNORM = 92,
+    VK_FORMAT_R16G16B16A16_USCALED = 93,
+    VK_FORMAT_R16G16B16A16_SSCALED = 94,
+    VK_FORMAT_R16G16B16A16_UINT = 95,
+    VK_FORMAT_R16G16B16A16_SINT = 96,
+    VK_FORMAT_R16G16B16A16_SFLOAT = 97,
+    VK_FORMAT_R32_UINT = 98,
+    VK_FORMAT_R32_SINT = 99,
+    VK_FORMAT_R32_SFLOAT = 100,
+    VK_FORMAT_R32G32_UINT = 101,
+    VK_FORMAT_R32G32_SINT = 102,
+    VK_FORMAT_R32G32_SFLOAT = 103,
+    VK_FORMAT_R32G32B32_UINT = 104,
+    VK_FORMAT_R32G32B32_SINT = 105,
+    VK_FORMAT_R32G32B32_SFLOAT = 106,
+    VK_FORMAT_R32G32B32A32_UINT = 107,
+    VK_FORMAT_R32G32B32A32_SINT = 108,
+    VK_FORMAT_R32G32B32A32_SFLOAT = 109,
+    VK_FORMAT_R64_UINT = 110,
+    VK_FORMAT_R64_SINT = 111,
+    VK_FORMAT_R64_SFLOAT = 112,
+    VK_FORMAT_R64G64_UINT = 113,
+    VK_FORMAT_R64G64_SINT = 114,
+    VK_FORMAT_R64G64_SFLOAT = 115,
+    VK_FORMAT_R64G64B64_UINT = 116,
+    VK_FORMAT_R64G64B64_SINT = 117,
+    VK_FORMAT_R64G64B64_SFLOAT = 118,
+    VK_FORMAT_R64G64B64A64_UINT = 119,
+    VK_FORMAT_R64G64B64A64_SINT = 120,
+    VK_FORMAT_R64G64B64A64_SFLOAT = 121,
+    VK_FORMAT_B10G11R11_UFLOAT_PACK32 = 122,
+    VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 = 123,
+    VK_FORMAT_D16_UNORM = 124,
+    VK_FORMAT_X8_D24_UNORM_PACK32 = 125,
+    VK_FORMAT_D32_SFLOAT = 126,
+    VK_FORMAT_S8_UINT = 127,
+    VK_FORMAT_D16_UNORM_S8_UINT = 128,
+    VK_FORMAT_D24_UNORM_S8_UINT = 129,
+    VK_FORMAT_D32_SFLOAT_S8_UINT = 130,
+    VK_FORMAT_BC1_RGB_UNORM_BLOCK = 131,
+    VK_FORMAT_BC1_RGB_SRGB_BLOCK = 132,
+    VK_FORMAT_BC1_RGBA_UNORM_BLOCK = 133,
+    VK_FORMAT_BC1_RGBA_SRGB_BLOCK = 134,
+    VK_FORMAT_BC2_UNORM_BLOCK = 135,
+    VK_FORMAT_BC2_SRGB_BLOCK = 136,
+    VK_FORMAT_BC3_UNORM_BLOCK = 137,
+    VK_FORMAT_BC3_SRGB_BLOCK = 138,
+    VK_FORMAT_BC4_UNORM_BLOCK = 139,
+    VK_FORMAT_BC4_SNORM_BLOCK = 140,
+    VK_FORMAT_BC5_UNORM_BLOCK = 141,
+    VK_FORMAT_BC5_SNORM_BLOCK = 142,
+    VK_FORMAT_BC6H_UFLOAT_BLOCK = 143,
+    VK_FORMAT_BC6H_SFLOAT_BLOCK = 144,
+    VK_FORMAT_BC7_UNORM_BLOCK = 145,
+    VK_FORMAT_BC7_SRGB_BLOCK = 146,
+    VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK = 147,
+    VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK = 148,
+    VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK = 149,
+    VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK = 150,
+    VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK = 151,
+    VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK = 152,
+    VK_FORMAT_EAC_R11_UNORM_BLOCK = 153,
+    VK_FORMAT_EAC_R11_SNORM_BLOCK = 154,
+    VK_FORMAT_EAC_R11G11_UNORM_BLOCK = 155,
+    VK_FORMAT_EAC_R11G11_SNORM_BLOCK = 156,
+    VK_FORMAT_ASTC_4x4_UNORM_BLOCK = 157,
+    VK_FORMAT_ASTC_4x4_SRGB_BLOCK = 158,
+    VK_FORMAT_ASTC_5x4_UNORM_BLOCK = 159,
+    VK_FORMAT_ASTC_5x4_SRGB_BLOCK = 160,
+    VK_FORMAT_ASTC_5x5_UNORM_BLOCK = 161,
+    VK_FORMAT_ASTC_5x5_SRGB_BLOCK = 162,
+    VK_FORMAT_ASTC_6x5_UNORM_BLOCK = 163,
+    VK_FORMAT_ASTC_6x5_SRGB_BLOCK = 164,
+    VK_FORMAT_ASTC_6x6_UNORM_BLOCK = 165,
+    VK_FORMAT_ASTC_6x6_SRGB_BLOCK = 166,
+    VK_FORMAT_ASTC_8x5_UNORM_BLOCK = 167,
+    VK_FORMAT_ASTC_8x5_SRGB_BLOCK = 168,
+    VK_FORMAT_ASTC_8x6_UNORM_BLOCK = 169,
+    VK_FORMAT_ASTC_8x6_SRGB_BLOCK = 170,
+    VK_FORMAT_ASTC_8x8_UNORM_BLOCK = 171,
+    VK_FORMAT_ASTC_8x8_SRGB_BLOCK = 172,
+    VK_FORMAT_ASTC_10x5_UNORM_BLOCK = 173,
+    VK_FORMAT_ASTC_10x5_SRGB_BLOCK = 174,
+    VK_FORMAT_ASTC_10x6_UNORM_BLOCK = 175,
+    VK_FORMAT_ASTC_10x6_SRGB_BLOCK = 176,
+    VK_FORMAT_ASTC_10x8_UNORM_BLOCK = 177,
+    VK_FORMAT_ASTC_10x8_SRGB_BLOCK = 178,
+    VK_FORMAT_ASTC_10x10_UNORM_BLOCK = 179,
+    VK_FORMAT_ASTC_10x10_SRGB_BLOCK = 180,
+    VK_FORMAT_ASTC_12x10_UNORM_BLOCK = 181,
+    VK_FORMAT_ASTC_12x10_SRGB_BLOCK = 182,
+    VK_FORMAT_ASTC_12x12_UNORM_BLOCK = 183,
+    VK_FORMAT_ASTC_12x12_SRGB_BLOCK = 184,
+    VK_FORMAT_BEGIN_RANGE = VK_FORMAT_UNDEFINED,
+    VK_FORMAT_END_RANGE = VK_FORMAT_ASTC_12x12_SRGB_BLOCK,
+    VK_FORMAT_RANGE_SIZE = (VK_FORMAT_ASTC_12x12_SRGB_BLOCK - VK_FORMAT_UNDEFINED + 1),
+    VK_FORMAT_MAX_ENUM = 0x7FFFFFFF
+} VkFormat;
+
+typedef enum VkImageType {
+    VK_IMAGE_TYPE_1D = 0,
+    VK_IMAGE_TYPE_2D = 1,
+    VK_IMAGE_TYPE_3D = 2,
+    VK_IMAGE_TYPE_BEGIN_RANGE = VK_IMAGE_TYPE_1D,
+    VK_IMAGE_TYPE_END_RANGE = VK_IMAGE_TYPE_3D,
+    VK_IMAGE_TYPE_RANGE_SIZE = (VK_IMAGE_TYPE_3D - VK_IMAGE_TYPE_1D + 1),
+    VK_IMAGE_TYPE_MAX_ENUM = 0x7FFFFFFF
+} VkImageType;
+
+typedef enum VkImageTiling {
+    VK_IMAGE_TILING_OPTIMAL = 0,
+    VK_IMAGE_TILING_LINEAR = 1,
+    VK_IMAGE_TILING_BEGIN_RANGE = VK_IMAGE_TILING_OPTIMAL,
+    VK_IMAGE_TILING_END_RANGE = VK_IMAGE_TILING_LINEAR,
+    VK_IMAGE_TILING_RANGE_SIZE = (VK_IMAGE_TILING_LINEAR - VK_IMAGE_TILING_OPTIMAL + 1),
+    VK_IMAGE_TILING_MAX_ENUM = 0x7FFFFFFF
+} VkImageTiling;
+
+typedef enum VkPhysicalDeviceType {
+    VK_PHYSICAL_DEVICE_TYPE_OTHER = 0,
+    VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU = 1,
+    VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU = 2,
+    VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU = 3,
+    VK_PHYSICAL_DEVICE_TYPE_CPU = 4,
+    VK_PHYSICAL_DEVICE_TYPE_BEGIN_RANGE = VK_PHYSICAL_DEVICE_TYPE_OTHER,
+    VK_PHYSICAL_DEVICE_TYPE_END_RANGE = VK_PHYSICAL_DEVICE_TYPE_CPU,
+    VK_PHYSICAL_DEVICE_TYPE_RANGE_SIZE = (VK_PHYSICAL_DEVICE_TYPE_CPU - VK_PHYSICAL_DEVICE_TYPE_OTHER + 1),
+    VK_PHYSICAL_DEVICE_TYPE_MAX_ENUM = 0x7FFFFFFF
+} VkPhysicalDeviceType;
+
+typedef enum VkQueryType {
+    VK_QUERY_TYPE_OCCLUSION = 0,
+    VK_QUERY_TYPE_PIPELINE_STATISTICS = 1,
+    VK_QUERY_TYPE_TIMESTAMP = 2,
+    VK_QUERY_TYPE_BEGIN_RANGE = VK_QUERY_TYPE_OCCLUSION,
+    VK_QUERY_TYPE_END_RANGE = VK_QUERY_TYPE_TIMESTAMP,
+    VK_QUERY_TYPE_RANGE_SIZE = (VK_QUERY_TYPE_TIMESTAMP - VK_QUERY_TYPE_OCCLUSION + 1),
+    VK_QUERY_TYPE_MAX_ENUM = 0x7FFFFFFF
+} VkQueryType;
+
+typedef enum VkSharingMode {
+    VK_SHARING_MODE_EXCLUSIVE = 0,
+    VK_SHARING_MODE_CONCURRENT = 1,
+    VK_SHARING_MODE_BEGIN_RANGE = VK_SHARING_MODE_EXCLUSIVE,
+    VK_SHARING_MODE_END_RANGE = VK_SHARING_MODE_CONCURRENT,
+    VK_SHARING_MODE_RANGE_SIZE = (VK_SHARING_MODE_CONCURRENT - VK_SHARING_MODE_EXCLUSIVE + 1),
+    VK_SHARING_MODE_MAX_ENUM = 0x7FFFFFFF
+} VkSharingMode;
+
+typedef enum VkImageLayout {
+    VK_IMAGE_LAYOUT_UNDEFINED = 0,
+    VK_IMAGE_LAYOUT_GENERAL = 1,
+    VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL = 2,
+    VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL = 3,
+    VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL = 4,
+    VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL = 5,
+    VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL = 6,
+    VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL = 7,
+    VK_IMAGE_LAYOUT_PREINITIALIZED = 8,
+    VK_IMAGE_LAYOUT_PRESENT_SRC_KHR = 1000001002,
+    VK_IMAGE_LAYOUT_BEGIN_RANGE = VK_IMAGE_LAYOUT_UNDEFINED,
+    VK_IMAGE_LAYOUT_END_RANGE = VK_IMAGE_LAYOUT_PREINITIALIZED,
+    VK_IMAGE_LAYOUT_RANGE_SIZE = (VK_IMAGE_LAYOUT_PREINITIALIZED - VK_IMAGE_LAYOUT_UNDEFINED + 1),
+    VK_IMAGE_LAYOUT_MAX_ENUM = 0x7FFFFFFF
+} VkImageLayout;
+
+typedef enum VkImageViewType {
+    VK_IMAGE_VIEW_TYPE_1D = 0,
+    VK_IMAGE_VIEW_TYPE_2D = 1,
+    VK_IMAGE_VIEW_TYPE_3D = 2,
+    VK_IMAGE_VIEW_TYPE_CUBE = 3,
+    VK_IMAGE_VIEW_TYPE_1D_ARRAY = 4,
+    VK_IMAGE_VIEW_TYPE_2D_ARRAY = 5,
+    VK_IMAGE_VIEW_TYPE_CUBE_ARRAY = 6,
+    VK_IMAGE_VIEW_TYPE_BEGIN_RANGE = VK_IMAGE_VIEW_TYPE_1D,
+    VK_IMAGE_VIEW_TYPE_END_RANGE = VK_IMAGE_VIEW_TYPE_CUBE_ARRAY,
+    VK_IMAGE_VIEW_TYPE_RANGE_SIZE = (VK_IMAGE_VIEW_TYPE_CUBE_ARRAY - VK_IMAGE_VIEW_TYPE_1D + 1),
+    VK_IMAGE_VIEW_TYPE_MAX_ENUM = 0x7FFFFFFF
+} VkImageViewType;
+
+typedef enum VkComponentSwizzle {
+    VK_COMPONENT_SWIZZLE_IDENTITY = 0,
+    VK_COMPONENT_SWIZZLE_ZERO = 1,
+    VK_COMPONENT_SWIZZLE_ONE = 2,
+    VK_COMPONENT_SWIZZLE_R = 3,
+    VK_COMPONENT_SWIZZLE_G = 4,
+    VK_COMPONENT_SWIZZLE_B = 5,
+    VK_COMPONENT_SWIZZLE_A = 6,
+    VK_COMPONENT_SWIZZLE_BEGIN_RANGE = VK_COMPONENT_SWIZZLE_IDENTITY,
+    VK_COMPONENT_SWIZZLE_END_RANGE = VK_COMPONENT_SWIZZLE_A,
+    VK_COMPONENT_SWIZZLE_RANGE_SIZE = (VK_COMPONENT_SWIZZLE_A - VK_COMPONENT_SWIZZLE_IDENTITY + 1),
+    VK_COMPONENT_SWIZZLE_MAX_ENUM = 0x7FFFFFFF
+} VkComponentSwizzle;
+
+typedef enum VkVertexInputRate {
+    VK_VERTEX_INPUT_RATE_VERTEX = 0,
+    VK_VERTEX_INPUT_RATE_INSTANCE = 1,
+    VK_VERTEX_INPUT_RATE_BEGIN_RANGE = VK_VERTEX_INPUT_RATE_VERTEX,
+    VK_VERTEX_INPUT_RATE_END_RANGE = VK_VERTEX_INPUT_RATE_INSTANCE,
+    VK_VERTEX_INPUT_RATE_RANGE_SIZE = (VK_VERTEX_INPUT_RATE_INSTANCE - VK_VERTEX_INPUT_RATE_VERTEX + 1),
+    VK_VERTEX_INPUT_RATE_MAX_ENUM = 0x7FFFFFFF
+} VkVertexInputRate;
+
+typedef enum VkPrimitiveTopology {
+    VK_PRIMITIVE_TOPOLOGY_POINT_LIST = 0,
+    VK_PRIMITIVE_TOPOLOGY_LINE_LIST = 1,
+    VK_PRIMITIVE_TOPOLOGY_LINE_STRIP = 2,
+    VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST = 3,
+    VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP = 4,
+    VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN = 5,
+    VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY = 6,
+    VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY = 7,
+    VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY = 8,
+    VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY = 9,
+    VK_PRIMITIVE_TOPOLOGY_PATCH_LIST = 10,
+    VK_PRIMITIVE_TOPOLOGY_BEGIN_RANGE = VK_PRIMITIVE_TOPOLOGY_POINT_LIST,
+    VK_PRIMITIVE_TOPOLOGY_END_RANGE = VK_PRIMITIVE_TOPOLOGY_PATCH_LIST,
+    VK_PRIMITIVE_TOPOLOGY_RANGE_SIZE = (VK_PRIMITIVE_TOPOLOGY_PATCH_LIST - VK_PRIMITIVE_TOPOLOGY_POINT_LIST + 1),
+    VK_PRIMITIVE_TOPOLOGY_MAX_ENUM = 0x7FFFFFFF
+} VkPrimitiveTopology;
+
+typedef enum VkPolygonMode {
+    VK_POLYGON_MODE_FILL = 0,
+    VK_POLYGON_MODE_LINE = 1,
+    VK_POLYGON_MODE_POINT = 2,
+    VK_POLYGON_MODE_BEGIN_RANGE = VK_POLYGON_MODE_FILL,
+    VK_POLYGON_MODE_END_RANGE = VK_POLYGON_MODE_POINT,
+    VK_POLYGON_MODE_RANGE_SIZE = (VK_POLYGON_MODE_POINT - VK_POLYGON_MODE_FILL + 1),
+    VK_POLYGON_MODE_MAX_ENUM = 0x7FFFFFFF
+} VkPolygonMode;
+
+typedef enum VkFrontFace {
+    VK_FRONT_FACE_COUNTER_CLOCKWISE = 0,
+    VK_FRONT_FACE_CLOCKWISE = 1,
+    VK_FRONT_FACE_BEGIN_RANGE = VK_FRONT_FACE_COUNTER_CLOCKWISE,
+    VK_FRONT_FACE_END_RANGE = VK_FRONT_FACE_CLOCKWISE,
+    VK_FRONT_FACE_RANGE_SIZE = (VK_FRONT_FACE_CLOCKWISE - VK_FRONT_FACE_COUNTER_CLOCKWISE + 1),
+    VK_FRONT_FACE_MAX_ENUM = 0x7FFFFFFF
+} VkFrontFace;
+
+typedef enum VkCompareOp {
+    VK_COMPARE_OP_NEVER = 0,
+    VK_COMPARE_OP_LESS = 1,
+    VK_COMPARE_OP_EQUAL = 2,
+    VK_COMPARE_OP_LESS_OR_EQUAL = 3,
+    VK_COMPARE_OP_GREATER = 4,
+    VK_COMPARE_OP_NOT_EQUAL = 5,
+    VK_COMPARE_OP_GREATER_OR_EQUAL = 6,
+    VK_COMPARE_OP_ALWAYS = 7,
+    VK_COMPARE_OP_BEGIN_RANGE = VK_COMPARE_OP_NEVER,
+    VK_COMPARE_OP_END_RANGE = VK_COMPARE_OP_ALWAYS,
+    VK_COMPARE_OP_RANGE_SIZE = (VK_COMPARE_OP_ALWAYS - VK_COMPARE_OP_NEVER + 1),
+    VK_COMPARE_OP_MAX_ENUM = 0x7FFFFFFF
+} VkCompareOp;
+
+typedef enum VkStencilOp {
+    VK_STENCIL_OP_KEEP = 0,
+    VK_STENCIL_OP_ZERO = 1,
+    VK_STENCIL_OP_REPLACE = 2,
+    VK_STENCIL_OP_INCREMENT_AND_CLAMP = 3,
+    VK_STENCIL_OP_DECREMENT_AND_CLAMP = 4,
+    VK_STENCIL_OP_INVERT = 5,
+    VK_STENCIL_OP_INCREMENT_AND_WRAP = 6,
+    VK_STENCIL_OP_DECREMENT_AND_WRAP = 7,
+    VK_STENCIL_OP_BEGIN_RANGE = VK_STENCIL_OP_KEEP,
+    VK_STENCIL_OP_END_RANGE = VK_STENCIL_OP_DECREMENT_AND_WRAP,
+    VK_STENCIL_OP_RANGE_SIZE = (VK_STENCIL_OP_DECREMENT_AND_WRAP - VK_STENCIL_OP_KEEP + 1),
+    VK_STENCIL_OP_MAX_ENUM = 0x7FFFFFFF
+} VkStencilOp;
+
+typedef enum VkLogicOp {
+    VK_LOGIC_OP_CLEAR = 0,
+    VK_LOGIC_OP_AND = 1,
+    VK_LOGIC_OP_AND_REVERSE = 2,
+    VK_LOGIC_OP_COPY = 3,
+    VK_LOGIC_OP_AND_INVERTED = 4,
+    VK_LOGIC_OP_NO_OP = 5,
+    VK_LOGIC_OP_XOR = 6,
+    VK_LOGIC_OP_OR = 7,
+    VK_LOGIC_OP_NOR = 8,
+    VK_LOGIC_OP_EQUIVALENT = 9,
+    VK_LOGIC_OP_INVERT = 10,
+    VK_LOGIC_OP_OR_REVERSE = 11,
+    VK_LOGIC_OP_COPY_INVERTED = 12,
+    VK_LOGIC_OP_OR_INVERTED = 13,
+    VK_LOGIC_OP_NAND = 14,
+    VK_LOGIC_OP_SET = 15,
+    VK_LOGIC_OP_BEGIN_RANGE = VK_LOGIC_OP_CLEAR,
+    VK_LOGIC_OP_END_RANGE = VK_LOGIC_OP_SET,
+    VK_LOGIC_OP_RANGE_SIZE = (VK_LOGIC_OP_SET - VK_LOGIC_OP_CLEAR + 1),
+    VK_LOGIC_OP_MAX_ENUM = 0x7FFFFFFF
+} VkLogicOp;
+
+typedef enum VkBlendFactor {
+    VK_BLEND_FACTOR_ZERO = 0,
+    VK_BLEND_FACTOR_ONE = 1,
+    VK_BLEND_FACTOR_SRC_COLOR = 2,
+    VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR = 3,
+    VK_BLEND_FACTOR_DST_COLOR = 4,
+    VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR = 5,
+    VK_BLEND_FACTOR_SRC_ALPHA = 6,
+    VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA = 7,
+    VK_BLEND_FACTOR_DST_ALPHA = 8,
+    VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA = 9,
+    VK_BLEND_FACTOR_CONSTANT_COLOR = 10,
+    VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR = 11,
+    VK_BLEND_FACTOR_CONSTANT_ALPHA = 12,
+    VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA = 13,
+    VK_BLEND_FACTOR_SRC_ALPHA_SATURATE = 14,
+    VK_BLEND_FACTOR_SRC1_COLOR = 15,
+    VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR = 16,
+    VK_BLEND_FACTOR_SRC1_ALPHA = 17,
+    VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA = 18,
+    VK_BLEND_FACTOR_BEGIN_RANGE = VK_BLEND_FACTOR_ZERO,
+    VK_BLEND_FACTOR_END_RANGE = VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA,
+    VK_BLEND_FACTOR_RANGE_SIZE = (VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA - VK_BLEND_FACTOR_ZERO + 1),
+    VK_BLEND_FACTOR_MAX_ENUM = 0x7FFFFFFF
+} VkBlendFactor;
+
+typedef enum VkBlendOp {
+    VK_BLEND_OP_ADD = 0,
+    VK_BLEND_OP_SUBTRACT = 1,
+    VK_BLEND_OP_REVERSE_SUBTRACT = 2,
+    VK_BLEND_OP_MIN = 3,
+    VK_BLEND_OP_MAX = 4,
+    VK_BLEND_OP_BEGIN_RANGE = VK_BLEND_OP_ADD,
+    VK_BLEND_OP_END_RANGE = VK_BLEND_OP_MAX,
+    VK_BLEND_OP_RANGE_SIZE = (VK_BLEND_OP_MAX - VK_BLEND_OP_ADD + 1),
+    VK_BLEND_OP_MAX_ENUM = 0x7FFFFFFF
+} VkBlendOp;
+
+typedef enum VkDynamicState {
+    VK_DYNAMIC_STATE_VIEWPORT = 0,
+    VK_DYNAMIC_STATE_SCISSOR = 1,
+    VK_DYNAMIC_STATE_LINE_WIDTH = 2,
+    VK_DYNAMIC_STATE_DEPTH_BIAS = 3,
+    VK_DYNAMIC_STATE_BLEND_CONSTANTS = 4,
+    VK_DYNAMIC_STATE_DEPTH_BOUNDS = 5,
+    VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK = 6,
+    VK_DYNAMIC_STATE_STENCIL_WRITE_MASK = 7,
+    VK_DYNAMIC_STATE_STENCIL_REFERENCE = 8,
+    VK_DYNAMIC_STATE_BEGIN_RANGE = VK_DYNAMIC_STATE_VIEWPORT,
+    VK_DYNAMIC_STATE_END_RANGE = VK_DYNAMIC_STATE_STENCIL_REFERENCE,
+    VK_DYNAMIC_STATE_RANGE_SIZE = (VK_DYNAMIC_STATE_STENCIL_REFERENCE - VK_DYNAMIC_STATE_VIEWPORT + 1),
+    VK_DYNAMIC_STATE_MAX_ENUM = 0x7FFFFFFF
+} VkDynamicState;
+
+typedef enum VkFilter {
+    VK_FILTER_NEAREST = 0,
+    VK_FILTER_LINEAR = 1,
+    VK_FILTER_BEGIN_RANGE = VK_FILTER_NEAREST,
+    VK_FILTER_END_RANGE = VK_FILTER_LINEAR,
+    VK_FILTER_RANGE_SIZE = (VK_FILTER_LINEAR - VK_FILTER_NEAREST + 1),
+    VK_FILTER_MAX_ENUM = 0x7FFFFFFF
+} VkFilter;
+
+typedef enum VkSamplerMipmapMode {
+    VK_SAMPLER_MIPMAP_MODE_NEAREST = 0,
+    VK_SAMPLER_MIPMAP_MODE_LINEAR = 1,
+    VK_SAMPLER_MIPMAP_MODE_BEGIN_RANGE = VK_SAMPLER_MIPMAP_MODE_NEAREST,
+    VK_SAMPLER_MIPMAP_MODE_END_RANGE = VK_SAMPLER_MIPMAP_MODE_LINEAR,
+    VK_SAMPLER_MIPMAP_MODE_RANGE_SIZE = (VK_SAMPLER_MIPMAP_MODE_LINEAR - VK_SAMPLER_MIPMAP_MODE_NEAREST + 1),
+    VK_SAMPLER_MIPMAP_MODE_MAX_ENUM = 0x7FFFFFFF
+} VkSamplerMipmapMode;
+
+typedef enum VkSamplerAddressMode {
+    VK_SAMPLER_ADDRESS_MODE_REPEAT = 0,
+    VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT = 1,
+    VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE = 2,
+    VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER = 3,
+    VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE = 4,
+    VK_SAMPLER_ADDRESS_MODE_BEGIN_RANGE = VK_SAMPLER_ADDRESS_MODE_REPEAT,
+    VK_SAMPLER_ADDRESS_MODE_END_RANGE = VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE,
+    VK_SAMPLER_ADDRESS_MODE_RANGE_SIZE = (VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE - VK_SAMPLER_ADDRESS_MODE_REPEAT + 1),
+    VK_SAMPLER_ADDRESS_MODE_MAX_ENUM = 0x7FFFFFFF
+} VkSamplerAddressMode;
+
+typedef enum VkBorderColor {
+    VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK = 0,
+    VK_BORDER_COLOR_INT_TRANSPARENT_BLACK = 1,
+    VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK = 2,
+    VK_BORDER_COLOR_INT_OPAQUE_BLACK = 3,
+    VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE = 4,
+    VK_BORDER_COLOR_INT_OPAQUE_WHITE = 5,
+    VK_BORDER_COLOR_BEGIN_RANGE = VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK,
+    VK_BORDER_COLOR_END_RANGE = VK_BORDER_COLOR_INT_OPAQUE_WHITE,
+    VK_BORDER_COLOR_RANGE_SIZE = (VK_BORDER_COLOR_INT_OPAQUE_WHITE - VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK + 1),
+    VK_BORDER_COLOR_MAX_ENUM = 0x7FFFFFFF
+} VkBorderColor;
+
+typedef enum VkDescriptorType {
+    VK_DESCRIPTOR_TYPE_SAMPLER = 0,
+    VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER = 1,
+    VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE = 2,
+    VK_DESCRIPTOR_TYPE_STORAGE_IMAGE = 3,
+    VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER = 4,
+    VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER = 5,
+    VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER = 6,
+    VK_DESCRIPTOR_TYPE_STORAGE_BUFFER = 7,
+    VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC = 8,
+    VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC = 9,
+    VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT = 10,
+    VK_DESCRIPTOR_TYPE_BEGIN_RANGE = VK_DESCRIPTOR_TYPE_SAMPLER,
+    VK_DESCRIPTOR_TYPE_END_RANGE = VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT,
+    VK_DESCRIPTOR_TYPE_RANGE_SIZE = (VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT - VK_DESCRIPTOR_TYPE_SAMPLER + 1),
+    VK_DESCRIPTOR_TYPE_MAX_ENUM = 0x7FFFFFFF
+} VkDescriptorType;
+
+typedef enum VkAttachmentLoadOp {
+    VK_ATTACHMENT_LOAD_OP_LOAD = 0,
+    VK_ATTACHMENT_LOAD_OP_CLEAR = 1,
+    VK_ATTACHMENT_LOAD_OP_DONT_CARE = 2,
+    VK_ATTACHMENT_LOAD_OP_BEGIN_RANGE = VK_ATTACHMENT_LOAD_OP_LOAD,
+    VK_ATTACHMENT_LOAD_OP_END_RANGE = VK_ATTACHMENT_LOAD_OP_DONT_CARE,
+    VK_ATTACHMENT_LOAD_OP_RANGE_SIZE = (VK_ATTACHMENT_LOAD_OP_DONT_CARE - VK_ATTACHMENT_LOAD_OP_LOAD + 1),
+    VK_ATTACHMENT_LOAD_OP_MAX_ENUM = 0x7FFFFFFF
+} VkAttachmentLoadOp;
+
+typedef enum VkAttachmentStoreOp {
+    VK_ATTACHMENT_STORE_OP_STORE = 0,
+    VK_ATTACHMENT_STORE_OP_DONT_CARE = 1,
+    VK_ATTACHMENT_STORE_OP_BEGIN_RANGE = VK_ATTACHMENT_STORE_OP_STORE,
+    VK_ATTACHMENT_STORE_OP_END_RANGE = VK_ATTACHMENT_STORE_OP_DONT_CARE,
+    VK_ATTACHMENT_STORE_OP_RANGE_SIZE = (VK_ATTACHMENT_STORE_OP_DONT_CARE - VK_ATTACHMENT_STORE_OP_STORE + 1),
+    VK_ATTACHMENT_STORE_OP_MAX_ENUM = 0x7FFFFFFF
+} VkAttachmentStoreOp;
+
+typedef enum VkPipelineBindPoint {
+    VK_PIPELINE_BIND_POINT_GRAPHICS = 0,
+    VK_PIPELINE_BIND_POINT_COMPUTE = 1,
+    VK_PIPELINE_BIND_POINT_BEGIN_RANGE = VK_PIPELINE_BIND_POINT_GRAPHICS,
+    VK_PIPELINE_BIND_POINT_END_RANGE = VK_PIPELINE_BIND_POINT_COMPUTE,
+    VK_PIPELINE_BIND_POINT_RANGE_SIZE = (VK_PIPELINE_BIND_POINT_COMPUTE - VK_PIPELINE_BIND_POINT_GRAPHICS + 1),
+    VK_PIPELINE_BIND_POINT_MAX_ENUM = 0x7FFFFFFF
+} VkPipelineBindPoint;
+
+typedef enum VkCommandBufferLevel {
+    VK_COMMAND_BUFFER_LEVEL_PRIMARY = 0,
+    VK_COMMAND_BUFFER_LEVEL_SECONDARY = 1,
+    VK_COMMAND_BUFFER_LEVEL_BEGIN_RANGE = VK_COMMAND_BUFFER_LEVEL_PRIMARY,
+    VK_COMMAND_BUFFER_LEVEL_END_RANGE = VK_COMMAND_BUFFER_LEVEL_SECONDARY,
+    VK_COMMAND_BUFFER_LEVEL_RANGE_SIZE = (VK_COMMAND_BUFFER_LEVEL_SECONDARY - VK_COMMAND_BUFFER_LEVEL_PRIMARY + 1),
+    VK_COMMAND_BUFFER_LEVEL_MAX_ENUM = 0x7FFFFFFF
+} VkCommandBufferLevel;
+
+typedef enum VkIndexType {
+    VK_INDEX_TYPE_UINT16 = 0,
+    VK_INDEX_TYPE_UINT32 = 1,
+    VK_INDEX_TYPE_BEGIN_RANGE = VK_INDEX_TYPE_UINT16,
+    VK_INDEX_TYPE_END_RANGE = VK_INDEX_TYPE_UINT32,
+    VK_INDEX_TYPE_RANGE_SIZE = (VK_INDEX_TYPE_UINT32 - VK_INDEX_TYPE_UINT16 + 1),
+    VK_INDEX_TYPE_MAX_ENUM = 0x7FFFFFFF
+} VkIndexType;
+
+typedef enum VkSubpassContents {
+    VK_SUBPASS_CONTENTS_INLINE = 0,
+    VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS = 1,
+    VK_SUBPASS_CONTENTS_BEGIN_RANGE = VK_SUBPASS_CONTENTS_INLINE,
+    VK_SUBPASS_CONTENTS_END_RANGE = VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS,
+    VK_SUBPASS_CONTENTS_RANGE_SIZE = (VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS - VK_SUBPASS_CONTENTS_INLINE + 1),
+    VK_SUBPASS_CONTENTS_MAX_ENUM = 0x7FFFFFFF
+} VkSubpassContents;
+
+typedef VkFlags VkInstanceCreateFlags;
+
+typedef enum VkFormatFeatureFlagBits {
+    VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT = 0x00000001,
+    VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT = 0x00000002,
+    VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT = 0x00000004,
+    VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000008,
+    VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT = 0x00000010,
+    VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT = 0x00000020,
+    VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT = 0x00000040,
+    VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT = 0x00000080,
+    VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT = 0x00000100,
+    VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000200,
+    VK_FORMAT_FEATURE_BLIT_SRC_BIT = 0x00000400,
+    VK_FORMAT_FEATURE_BLIT_DST_BIT = 0x00000800,
+    VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT = 0x00001000,
+} VkFormatFeatureFlagBits;
+typedef VkFlags VkFormatFeatureFlags;
+
+typedef enum VkImageUsageFlagBits {
+    VK_IMAGE_USAGE_TRANSFER_SRC_BIT = 0x00000001,
+    VK_IMAGE_USAGE_TRANSFER_DST_BIT = 0x00000002,
+    VK_IMAGE_USAGE_SAMPLED_BIT = 0x00000004,
+    VK_IMAGE_USAGE_STORAGE_BIT = 0x00000008,
+    VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT = 0x00000010,
+    VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000020,
+    VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT = 0x00000040,
+    VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT = 0x00000080,
+} VkImageUsageFlagBits;
+typedef VkFlags VkImageUsageFlags;
+
+typedef enum VkImageCreateFlagBits {
+    VK_IMAGE_CREATE_SPARSE_BINDING_BIT = 0x00000001,
+    VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002,
+    VK_IMAGE_CREATE_SPARSE_ALIASED_BIT = 0x00000004,
+    VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT = 0x00000008,
+    VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT = 0x00000010,
+} VkImageCreateFlagBits;
+typedef VkFlags VkImageCreateFlags;
+
+typedef enum VkSampleCountFlagBits {
+    VK_SAMPLE_COUNT_1_BIT = 0x00000001,
+    VK_SAMPLE_COUNT_2_BIT = 0x00000002,
+    VK_SAMPLE_COUNT_4_BIT = 0x00000004,
+    VK_SAMPLE_COUNT_8_BIT = 0x00000008,
+    VK_SAMPLE_COUNT_16_BIT = 0x00000010,
+    VK_SAMPLE_COUNT_32_BIT = 0x00000020,
+    VK_SAMPLE_COUNT_64_BIT = 0x00000040,
+} VkSampleCountFlagBits;
+typedef VkFlags VkSampleCountFlags;
+
+typedef enum VkQueueFlagBits {
+    VK_QUEUE_GRAPHICS_BIT = 0x00000001,
+    VK_QUEUE_COMPUTE_BIT = 0x00000002,
+    VK_QUEUE_TRANSFER_BIT = 0x00000004,
+    VK_QUEUE_SPARSE_BINDING_BIT = 0x00000008,
+} VkQueueFlagBits;
+typedef VkFlags VkQueueFlags;
+
+typedef enum VkMemoryPropertyFlagBits {
+    VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT = 0x00000001,
+    VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT = 0x00000002,
+    VK_MEMORY_PROPERTY_HOST_COHERENT_BIT = 0x00000004,
+    VK_MEMORY_PROPERTY_HOST_CACHED_BIT = 0x00000008,
+    VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT = 0x00000010,
+} VkMemoryPropertyFlagBits;
+typedef VkFlags VkMemoryPropertyFlags;
+
+typedef enum VkMemoryHeapFlagBits {
+    VK_MEMORY_HEAP_DEVICE_LOCAL_BIT = 0x00000001,
+} VkMemoryHeapFlagBits;
+typedef VkFlags VkMemoryHeapFlags;
+typedef VkFlags VkDeviceCreateFlags;
+typedef VkFlags VkDeviceQueueCreateFlags;
+
+typedef enum VkPipelineStageFlagBits {
+    VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT = 0x00000001,
+    VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT = 0x00000002,
+    VK_PIPELINE_STAGE_VERTEX_INPUT_BIT = 0x00000004,
+    VK_PIPELINE_STAGE_VERTEX_SHADER_BIT = 0x00000008,
+    VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT = 0x00000010,
+    VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT = 0x00000020,
+    VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT = 0x00000040,
+    VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT = 0x00000080,
+    VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT = 0x00000100,
+    VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT = 0x00000200,
+    VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT = 0x00000400,
+    VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT = 0x00000800,
+    VK_PIPELINE_STAGE_TRANSFER_BIT = 0x00001000,
+    VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT = 0x00002000,
+    VK_PIPELINE_STAGE_HOST_BIT = 0x00004000,
+    VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT = 0x00008000,
+    VK_PIPELINE_STAGE_ALL_COMMANDS_BIT = 0x00010000,
+} VkPipelineStageFlagBits;
+typedef VkFlags VkPipelineStageFlags;
+typedef VkFlags VkMemoryMapFlags;
+
+typedef enum VkImageAspectFlagBits {
+    VK_IMAGE_ASPECT_COLOR_BIT = 0x00000001,
+    VK_IMAGE_ASPECT_DEPTH_BIT = 0x00000002,
+    VK_IMAGE_ASPECT_STENCIL_BIT = 0x00000004,
+    VK_IMAGE_ASPECT_METADATA_BIT = 0x00000008,
+} VkImageAspectFlagBits;
+typedef VkFlags VkImageAspectFlags;
+
+typedef enum VkSparseImageFormatFlagBits {
+    VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT = 0x00000001,
+    VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT = 0x00000002,
+    VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT = 0x00000004,
+} VkSparseImageFormatFlagBits;
+typedef VkFlags VkSparseImageFormatFlags;
+
+typedef enum VkSparseMemoryBindFlagBits {
+    VK_SPARSE_MEMORY_BIND_METADATA_BIT = 0x00000001,
+} VkSparseMemoryBindFlagBits;
+typedef VkFlags VkSparseMemoryBindFlags;
+
+typedef enum VkFenceCreateFlagBits {
+    VK_FENCE_CREATE_SIGNALED_BIT = 0x00000001,
+} VkFenceCreateFlagBits;
+typedef VkFlags VkFenceCreateFlags;
+typedef VkFlags VkSemaphoreCreateFlags;
+typedef VkFlags VkEventCreateFlags;
+typedef VkFlags VkQueryPoolCreateFlags;
+
+typedef enum VkQueryPipelineStatisticFlagBits {
+    VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT = 0x00000001,
+    VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT = 0x00000002,
+    VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT = 0x00000004,
+    VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT = 0x00000008,
+    VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT = 0x00000010,
+    VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT = 0x00000020,
+    VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT = 0x00000040,
+    VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT = 0x00000080,
+    VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT = 0x00000100,
+    VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT = 0x00000200,
+    VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT = 0x00000400,
+} VkQueryPipelineStatisticFlagBits;
+typedef VkFlags VkQueryPipelineStatisticFlags;
+
+typedef enum VkQueryResultFlagBits {
+    VK_QUERY_RESULT_64_BIT = 0x00000001,
+    VK_QUERY_RESULT_WAIT_BIT = 0x00000002,
+    VK_QUERY_RESULT_WITH_AVAILABILITY_BIT = 0x00000004,
+    VK_QUERY_RESULT_PARTIAL_BIT = 0x00000008,
+} VkQueryResultFlagBits;
+typedef VkFlags VkQueryResultFlags;
+
+typedef enum VkBufferCreateFlagBits {
+    VK_BUFFER_CREATE_SPARSE_BINDING_BIT = 0x00000001,
+    VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002,
+    VK_BUFFER_CREATE_SPARSE_ALIASED_BIT = 0x00000004,
+} VkBufferCreateFlagBits;
+typedef VkFlags VkBufferCreateFlags;
+
+typedef enum VkBufferUsageFlagBits {
+    VK_BUFFER_USAGE_TRANSFER_SRC_BIT = 0x00000001,
+    VK_BUFFER_USAGE_TRANSFER_DST_BIT = 0x00000002,
+    VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000004,
+    VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT = 0x00000008,
+    VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT = 0x00000010,
+    VK_BUFFER_USAGE_STORAGE_BUFFER_BIT = 0x00000020,
+    VK_BUFFER_USAGE_INDEX_BUFFER_BIT = 0x00000040,
+    VK_BUFFER_USAGE_VERTEX_BUFFER_BIT = 0x00000080,
+    VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT = 0x00000100,
+} VkBufferUsageFlagBits;
+typedef VkFlags VkBufferUsageFlags;
+typedef VkFlags VkBufferViewCreateFlags;
+typedef VkFlags VkImageViewCreateFlags;
+typedef VkFlags VkShaderModuleCreateFlags;
+typedef VkFlags VkPipelineCacheCreateFlags;
+
+typedef enum VkPipelineCreateFlagBits {
+    VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT = 0x00000001,
+    VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT = 0x00000002,
+    VK_PIPELINE_CREATE_DERIVATIVE_BIT = 0x00000004,
+} VkPipelineCreateFlagBits;
+typedef VkFlags VkPipelineCreateFlags;
+typedef VkFlags VkPipelineShaderStageCreateFlags;
+
+typedef enum VkShaderStageFlagBits {
+    VK_SHADER_STAGE_VERTEX_BIT = 0x00000001,
+    VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT = 0x00000002,
+    VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT = 0x00000004,
+    VK_SHADER_STAGE_GEOMETRY_BIT = 0x00000008,
+    VK_SHADER_STAGE_FRAGMENT_BIT = 0x00000010,
+    VK_SHADER_STAGE_COMPUTE_BIT = 0x00000020,
+    VK_SHADER_STAGE_ALL_GRAPHICS = 0x1F,
+    VK_SHADER_STAGE_ALL = 0x7FFFFFFF,
+} VkShaderStageFlagBits;
+typedef VkFlags VkPipelineVertexInputStateCreateFlags;
+typedef VkFlags VkPipelineInputAssemblyStateCreateFlags;
+typedef VkFlags VkPipelineTessellationStateCreateFlags;
+typedef VkFlags VkPipelineViewportStateCreateFlags;
+typedef VkFlags VkPipelineRasterizationStateCreateFlags;
+
+typedef enum VkCullModeFlagBits {
+    VK_CULL_MODE_NONE = 0,
+    VK_CULL_MODE_FRONT_BIT = 0x00000001,
+    VK_CULL_MODE_BACK_BIT = 0x00000002,
+    VK_CULL_MODE_FRONT_AND_BACK = 0x3,
+} VkCullModeFlagBits;
+typedef VkFlags VkCullModeFlags;
+typedef VkFlags VkPipelineMultisampleStateCreateFlags;
+typedef VkFlags VkPipelineDepthStencilStateCreateFlags;
+typedef VkFlags VkPipelineColorBlendStateCreateFlags;
+
+typedef enum VkColorComponentFlagBits {
+    VK_COLOR_COMPONENT_R_BIT = 0x00000001,
+    VK_COLOR_COMPONENT_G_BIT = 0x00000002,
+    VK_COLOR_COMPONENT_B_BIT = 0x00000004,
+    VK_COLOR_COMPONENT_A_BIT = 0x00000008,
+} VkColorComponentFlagBits;
+typedef VkFlags VkColorComponentFlags;
+typedef VkFlags VkPipelineDynamicStateCreateFlags;
+typedef VkFlags VkPipelineLayoutCreateFlags;
+typedef VkFlags VkShaderStageFlags;
+typedef VkFlags VkSamplerCreateFlags;
+typedef VkFlags VkDescriptorSetLayoutCreateFlags;
+
+typedef enum VkDescriptorPoolCreateFlagBits {
+    VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT = 0x00000001,
+} VkDescriptorPoolCreateFlagBits;
+typedef VkFlags VkDescriptorPoolCreateFlags;
+typedef VkFlags VkDescriptorPoolResetFlags;
+typedef VkFlags VkFramebufferCreateFlags;
+typedef VkFlags VkRenderPassCreateFlags;
+
+typedef enum VkAttachmentDescriptionFlagBits {
+    VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT = 0x00000001,
+} VkAttachmentDescriptionFlagBits;
+typedef VkFlags VkAttachmentDescriptionFlags;
+typedef VkFlags VkSubpassDescriptionFlags;
+
+typedef enum VkAccessFlagBits {
+    VK_ACCESS_INDIRECT_COMMAND_READ_BIT = 0x00000001,
+    VK_ACCESS_INDEX_READ_BIT = 0x00000002,
+    VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT = 0x00000004,
+    VK_ACCESS_UNIFORM_READ_BIT = 0x00000008,
+    VK_ACCESS_INPUT_ATTACHMENT_READ_BIT = 0x00000010,
+    VK_ACCESS_SHADER_READ_BIT = 0x00000020,
+    VK_ACCESS_SHADER_WRITE_BIT = 0x00000040,
+    VK_ACCESS_COLOR_ATTACHMENT_READ_BIT = 0x00000080,
+    VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT = 0x00000100,
+    VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT = 0x00000200,
+    VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT = 0x00000400,
+    VK_ACCESS_TRANSFER_READ_BIT = 0x00000800,
+    VK_ACCESS_TRANSFER_WRITE_BIT = 0x00001000,
+    VK_ACCESS_HOST_READ_BIT = 0x00002000,
+    VK_ACCESS_HOST_WRITE_BIT = 0x00004000,
+    VK_ACCESS_MEMORY_READ_BIT = 0x00008000,
+    VK_ACCESS_MEMORY_WRITE_BIT = 0x00010000,
+} VkAccessFlagBits;
+typedef VkFlags VkAccessFlags;
+
+typedef enum VkDependencyFlagBits {
+    VK_DEPENDENCY_BY_REGION_BIT = 0x00000001,
+} VkDependencyFlagBits;
+typedef VkFlags VkDependencyFlags;
+
+typedef enum VkCommandPoolCreateFlagBits {
+    VK_COMMAND_POOL_CREATE_TRANSIENT_BIT = 0x00000001,
+    VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT = 0x00000002,
+} VkCommandPoolCreateFlagBits;
+typedef VkFlags VkCommandPoolCreateFlags;
+
+typedef enum VkCommandPoolResetFlagBits {
+    VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT = 0x00000001,
+} VkCommandPoolResetFlagBits;
+typedef VkFlags VkCommandPoolResetFlags;
+
+typedef enum VkCommandBufferUsageFlagBits {
+    VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT = 0x00000001,
+    VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT = 0x00000002,
+    VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT = 0x00000004,
+} VkCommandBufferUsageFlagBits;
+typedef VkFlags VkCommandBufferUsageFlags;
+
+typedef enum VkQueryControlFlagBits {
+    VK_QUERY_CONTROL_PRECISE_BIT = 0x00000001,
+} VkQueryControlFlagBits;
+typedef VkFlags VkQueryControlFlags;
+
+typedef enum VkCommandBufferResetFlagBits {
+    VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT = 0x00000001,
+} VkCommandBufferResetFlagBits;
+typedef VkFlags VkCommandBufferResetFlags;
+
+typedef enum VkStencilFaceFlagBits {
+    VK_STENCIL_FACE_FRONT_BIT = 0x00000001,
+    VK_STENCIL_FACE_BACK_BIT = 0x00000002,
+    VK_STENCIL_FRONT_AND_BACK = 0x3,
+} VkStencilFaceFlagBits;
+typedef VkFlags VkStencilFaceFlags;
+
+typedef void* (VKAPI_PTR *PFN_vkAllocationFunction)(
+    void*                                       pUserData,
+    size_t                                      size,
+    size_t                                      alignment,
+    VkSystemAllocationScope                     allocationScope);
+
+typedef void* (VKAPI_PTR *PFN_vkReallocationFunction)(
+    void*                                       pUserData,
+    void*                                       pOriginal,
+    size_t                                      size,
+    size_t                                      alignment,
+    VkSystemAllocationScope                     allocationScope);
+
+typedef void (VKAPI_PTR *PFN_vkFreeFunction)(
+    void*                                       pUserData,
+    void*                                       pMemory);
+
+typedef void (VKAPI_PTR *PFN_vkInternalAllocationNotification)(
+    void*                                       pUserData,
+    size_t                                      size,
+    VkInternalAllocationType                    allocationType,
+    VkSystemAllocationScope                     allocationScope);
+
+typedef void (VKAPI_PTR *PFN_vkInternalFreeNotification)(
+    void*                                       pUserData,
+    size_t                                      size,
+    VkInternalAllocationType                    allocationType,
+    VkSystemAllocationScope                     allocationScope);
+
+typedef void (VKAPI_PTR *PFN_vkVoidFunction)(void);
+
+typedef struct VkApplicationInfo {
+    VkStructureType    sType;
+    const void*        pNext;
+    const char*        pApplicationName;
+    uint32_t           applicationVersion;
+    const char*        pEngineName;
+    uint32_t           engineVersion;
+    uint32_t           apiVersion;
+} VkApplicationInfo;
+
+typedef struct VkInstanceCreateInfo {
+    VkStructureType             sType;
+    const void*                 pNext;
+    VkInstanceCreateFlags       flags;
+    const VkApplicationInfo*    pApplicationInfo;
+    uint32_t                    enabledLayerCount;
+    const char* const*          ppEnabledLayerNames;
+    uint32_t                    enabledExtensionCount;
+    const char* const*          ppEnabledExtensionNames;
+} VkInstanceCreateInfo;
+
+typedef struct VkAllocationCallbacks {
+    void*                                   pUserData;
+    PFN_vkAllocationFunction                pfnAllocation;
+    PFN_vkReallocationFunction              pfnReallocation;
+    PFN_vkFreeFunction                      pfnFree;
+    PFN_vkInternalAllocationNotification    pfnInternalAllocation;
+    PFN_vkInternalFreeNotification          pfnInternalFree;
+} VkAllocationCallbacks;
+
+typedef struct VkPhysicalDeviceFeatures {
+    VkBool32    robustBufferAccess;
+    VkBool32    fullDrawIndexUint32;
+    VkBool32    imageCubeArray;
+    VkBool32    independentBlend;
+    VkBool32    geometryShader;
+    VkBool32    tessellationShader;
+    VkBool32    sampleRateShading;
+    VkBool32    dualSrcBlend;
+    VkBool32    logicOp;
+    VkBool32    multiDrawIndirect;
+    VkBool32    drawIndirectFirstInstance;
+    VkBool32    depthClamp;
+    VkBool32    depthBiasClamp;
+    VkBool32    fillModeNonSolid;
+    VkBool32    depthBounds;
+    VkBool32    wideLines;
+    VkBool32    largePoints;
+    VkBool32    alphaToOne;
+    VkBool32    multiViewport;
+    VkBool32    samplerAnisotropy;
+    VkBool32    textureCompressionETC2;
+    VkBool32    textureCompressionASTC_LDR;
+    VkBool32    textureCompressionBC;
+    VkBool32    occlusionQueryPrecise;
+    VkBool32    pipelineStatisticsQuery;
+    VkBool32    vertexPipelineStoresAndAtomics;
+    VkBool32    fragmentStoresAndAtomics;
+    VkBool32    shaderTessellationAndGeometryPointSize;
+    VkBool32    shaderImageGatherExtended;
+    VkBool32    shaderStorageImageExtendedFormats;
+    VkBool32    shaderStorageImageMultisample;
+    VkBool32    shaderStorageImageReadWithoutFormat;
+    VkBool32    shaderStorageImageWriteWithoutFormat;
+    VkBool32    shaderUniformBufferArrayDynamicIndexing;
+    VkBool32    shaderSampledImageArrayDynamicIndexing;
+    VkBool32    shaderStorageBufferArrayDynamicIndexing;
+    VkBool32    shaderStorageImageArrayDynamicIndexing;
+    VkBool32    shaderClipDistance;
+    VkBool32    shaderCullDistance;
+    VkBool32    shaderFloat64;
+    VkBool32    shaderInt64;
+    VkBool32    shaderInt16;
+    VkBool32    shaderResourceResidency;
+    VkBool32    shaderResourceMinLod;
+    VkBool32    sparseBinding;
+    VkBool32    sparseResidencyBuffer;
+    VkBool32    sparseResidencyImage2D;
+    VkBool32    sparseResidencyImage3D;
+    VkBool32    sparseResidency2Samples;
+    VkBool32    sparseResidency4Samples;
+    VkBool32    sparseResidency8Samples;
+    VkBool32    sparseResidency16Samples;
+    VkBool32    sparseResidencyAliased;
+    VkBool32    variableMultisampleRate;
+    VkBool32    inheritedQueries;
+} VkPhysicalDeviceFeatures;
+
+typedef struct VkFormatProperties {
+    VkFormatFeatureFlags    linearTilingFeatures;
+    VkFormatFeatureFlags    optimalTilingFeatures;
+    VkFormatFeatureFlags    bufferFeatures;
+} VkFormatProperties;
+
+typedef struct VkExtent3D {
+    uint32_t    width;
+    uint32_t    height;
+    uint32_t    depth;
+} VkExtent3D;
+
+typedef struct VkImageFormatProperties {
+    VkExtent3D            maxExtent;
+    uint32_t              maxMipLevels;
+    uint32_t              maxArrayLayers;
+    VkSampleCountFlags    sampleCounts;
+    VkDeviceSize          maxResourceSize;
+} VkImageFormatProperties;
+
+typedef struct VkPhysicalDeviceLimits {
+    uint32_t              maxImageDimension1D;
+    uint32_t              maxImageDimension2D;
+    uint32_t              maxImageDimension3D;
+    uint32_t              maxImageDimensionCube;
+    uint32_t              maxImageArrayLayers;
+    uint32_t              maxTexelBufferElements;
+    uint32_t              maxUniformBufferRange;
+    uint32_t              maxStorageBufferRange;
+    uint32_t              maxPushConstantsSize;
+    uint32_t              maxMemoryAllocationCount;
+    uint32_t              maxSamplerAllocationCount;
+    VkDeviceSize          bufferImageGranularity;
+    VkDeviceSize          sparseAddressSpaceSize;
+    uint32_t              maxBoundDescriptorSets;
+    uint32_t              maxPerStageDescriptorSamplers;
+    uint32_t              maxPerStageDescriptorUniformBuffers;
+    uint32_t              maxPerStageDescriptorStorageBuffers;
+    uint32_t              maxPerStageDescriptorSampledImages;
+    uint32_t              maxPerStageDescriptorStorageImages;
+    uint32_t              maxPerStageDescriptorInputAttachments;
+    uint32_t              maxPerStageResources;
+    uint32_t              maxDescriptorSetSamplers;
+    uint32_t              maxDescriptorSetUniformBuffers;
+    uint32_t              maxDescriptorSetUniformBuffersDynamic;
+    uint32_t              maxDescriptorSetStorageBuffers;
+    uint32_t              maxDescriptorSetStorageBuffersDynamic;
+    uint32_t              maxDescriptorSetSampledImages;
+    uint32_t              maxDescriptorSetStorageImages;
+    uint32_t              maxDescriptorSetInputAttachments;
+    uint32_t              maxVertexInputAttributes;
+    uint32_t              maxVertexInputBindings;
+    uint32_t              maxVertexInputAttributeOffset;
+    uint32_t              maxVertexInputBindingStride;
+    uint32_t              maxVertexOutputComponents;
+    uint32_t              maxTessellationGenerationLevel;
+    uint32_t              maxTessellationPatchSize;
+    uint32_t              maxTessellationControlPerVertexInputComponents;
+    uint32_t              maxTessellationControlPerVertexOutputComponents;
+    uint32_t              maxTessellationControlPerPatchOutputComponents;
+    uint32_t              maxTessellationControlTotalOutputComponents;
+    uint32_t              maxTessellationEvaluationInputComponents;
+    uint32_t              maxTessellationEvaluationOutputComponents;
+    uint32_t              maxGeometryShaderInvocations;
+    uint32_t              maxGeometryInputComponents;
+    uint32_t              maxGeometryOutputComponents;
+    uint32_t              maxGeometryOutputVertices;
+    uint32_t              maxGeometryTotalOutputComponents;
+    uint32_t              maxFragmentInputComponents;
+    uint32_t              maxFragmentOutputAttachments;
+    uint32_t              maxFragmentDualSrcAttachments;
+    uint32_t              maxFragmentCombinedOutputResources;
+    uint32_t              maxComputeSharedMemorySize;
+    uint32_t              maxComputeWorkGroupCount[3];
+    uint32_t              maxComputeWorkGroupInvocations;
+    uint32_t              maxComputeWorkGroupSize[3];
+    uint32_t              subPixelPrecisionBits;
+    uint32_t              subTexelPrecisionBits;
+    uint32_t              mipmapPrecisionBits;
+    uint32_t              maxDrawIndexedIndexValue;
+    uint32_t              maxDrawIndirectCount;
+    float                 maxSamplerLodBias;
+    float                 maxSamplerAnisotropy;
+    uint32_t              maxViewports;
+    uint32_t              maxViewportDimensions[2];
+    float                 viewportBoundsRange[2];
+    uint32_t              viewportSubPixelBits;
+    size_t                minMemoryMapAlignment;
+    VkDeviceSize          minTexelBufferOffsetAlignment;
+    VkDeviceSize          minUniformBufferOffsetAlignment;
+    VkDeviceSize          minStorageBufferOffsetAlignment;
+    int32_t               minTexelOffset;
+    uint32_t              maxTexelOffset;
+    int32_t               minTexelGatherOffset;
+    uint32_t              maxTexelGatherOffset;
+    float                 minInterpolationOffset;
+    float                 maxInterpolationOffset;
+    uint32_t              subPixelInterpolationOffsetBits;
+    uint32_t              maxFramebufferWidth;
+    uint32_t              maxFramebufferHeight;
+    uint32_t              maxFramebufferLayers;
+    VkSampleCountFlags    framebufferColorSampleCounts;
+    VkSampleCountFlags    framebufferDepthSampleCounts;
+    VkSampleCountFlags    framebufferStencilSampleCounts;
+    VkSampleCountFlags    framebufferNoAttachmentsSampleCounts;
+    uint32_t              maxColorAttachments;
+    VkSampleCountFlags    sampledImageColorSampleCounts;
+    VkSampleCountFlags    sampledImageIntegerSampleCounts;
+    VkSampleCountFlags    sampledImageDepthSampleCounts;
+    VkSampleCountFlags    sampledImageStencilSampleCounts;
+    VkSampleCountFlags    storageImageSampleCounts;
+    uint32_t              maxSampleMaskWords;
+    VkBool32              timestampComputeAndGraphics;
+    float                 timestampPeriod;
+    uint32_t              maxClipDistances;
+    uint32_t              maxCullDistances;
+    uint32_t              maxCombinedClipAndCullDistances;
+    uint32_t              discreteQueuePriorities;
+    float                 pointSizeRange[2];
+    float                 lineWidthRange[2];
+    float                 pointSizeGranularity;
+    float                 lineWidthGranularity;
+    VkBool32              strictLines;
+    VkBool32              standardSampleLocations;
+    VkDeviceSize          optimalBufferCopyOffsetAlignment;
+    VkDeviceSize          optimalBufferCopyRowPitchAlignment;
+    VkDeviceSize          nonCoherentAtomSize;
+} VkPhysicalDeviceLimits;
+
+typedef struct VkPhysicalDeviceSparseProperties {
+    VkBool32    residencyStandard2DBlockShape;
+    VkBool32    residencyStandard2DMultisampleBlockShape;
+    VkBool32    residencyStandard3DBlockShape;
+    VkBool32    residencyAlignedMipSize;
+    VkBool32    residencyNonResidentStrict;
+} VkPhysicalDeviceSparseProperties;
+
+typedef struct VkPhysicalDeviceProperties {
+    uint32_t                            apiVersion;
+    uint32_t                            driverVersion;
+    uint32_t                            vendorID;
+    uint32_t                            deviceID;
+    VkPhysicalDeviceType                deviceType;
+    char                                deviceName[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE];
+    uint8_t                             pipelineCacheUUID[VK_UUID_SIZE];
+    VkPhysicalDeviceLimits              limits;
+    VkPhysicalDeviceSparseProperties    sparseProperties;
+} VkPhysicalDeviceProperties;
+
+typedef struct VkQueueFamilyProperties {
+    VkQueueFlags    queueFlags;
+    uint32_t        queueCount;
+    uint32_t        timestampValidBits;
+    VkExtent3D      minImageTransferGranularity;
+} VkQueueFamilyProperties;
+
+typedef struct VkMemoryType {
+    VkMemoryPropertyFlags    propertyFlags;
+    uint32_t                 heapIndex;
+} VkMemoryType;
+
+typedef struct VkMemoryHeap {
+    VkDeviceSize         size;
+    VkMemoryHeapFlags    flags;
+} VkMemoryHeap;
+
+typedef struct VkPhysicalDeviceMemoryProperties {
+    uint32_t        memoryTypeCount;
+    VkMemoryType    memoryTypes[VK_MAX_MEMORY_TYPES];
+    uint32_t        memoryHeapCount;
+    VkMemoryHeap    memoryHeaps[VK_MAX_MEMORY_HEAPS];
+} VkPhysicalDeviceMemoryProperties;
+
+typedef struct VkDeviceQueueCreateInfo {
+    VkStructureType             sType;
+    const void*                 pNext;
+    VkDeviceQueueCreateFlags    flags;
+    uint32_t                    queueFamilyIndex;
+    uint32_t                    queueCount;
+    const float*                pQueuePriorities;
+} VkDeviceQueueCreateInfo;
+
+typedef struct VkDeviceCreateInfo {
+    VkStructureType                    sType;
+    const void*                        pNext;
+    VkDeviceCreateFlags                flags;
+    uint32_t                           queueCreateInfoCount;
+    const VkDeviceQueueCreateInfo*     pQueueCreateInfos;
+    uint32_t                           enabledLayerCount;
+    const char* const*                 ppEnabledLayerNames;
+    uint32_t                           enabledExtensionCount;
+    const char* const*                 ppEnabledExtensionNames;
+    const VkPhysicalDeviceFeatures*    pEnabledFeatures;
+} VkDeviceCreateInfo;
+
+typedef struct VkExtensionProperties {
+    char        extensionName[VK_MAX_EXTENSION_NAME_SIZE];
+    uint32_t    specVersion;
+} VkExtensionProperties;
+
+typedef struct VkLayerProperties {
+    char        layerName[VK_MAX_EXTENSION_NAME_SIZE];
+    uint32_t    specVersion;
+    uint32_t    implementationVersion;
+    char        description[VK_MAX_DESCRIPTION_SIZE];
+} VkLayerProperties;
+
+typedef struct VkSubmitInfo {
+    VkStructureType                sType;
+    const void*                    pNext;
+    uint32_t                       waitSemaphoreCount;
+    const VkSemaphore*             pWaitSemaphores;
+    const VkPipelineStageFlags*    pWaitDstStageMask;
+    uint32_t                       commandBufferCount;
+    const VkCommandBuffer*         pCommandBuffers;
+    uint32_t                       signalSemaphoreCount;
+    const VkSemaphore*             pSignalSemaphores;
+} VkSubmitInfo;
+
+typedef struct VkMemoryAllocateInfo {
+    VkStructureType    sType;
+    const void*        pNext;
+    VkDeviceSize       allocationSize;
+    uint32_t           memoryTypeIndex;
+} VkMemoryAllocateInfo;
+
+typedef struct VkMappedMemoryRange {
+    VkStructureType    sType;
+    const void*        pNext;
+    VkDeviceMemory     memory;
+    VkDeviceSize       offset;
+    VkDeviceSize       size;
+} VkMappedMemoryRange;
+
+typedef struct VkMemoryRequirements {
+    VkDeviceSize    size;
+    VkDeviceSize    alignment;
+    uint32_t        memoryTypeBits;
+} VkMemoryRequirements;
+
+typedef struct VkSparseImageFormatProperties {
+    VkImageAspectFlags          aspectMask;
+    VkExtent3D                  imageGranularity;
+    VkSparseImageFormatFlags    flags;
+} VkSparseImageFormatProperties;
+
+typedef struct VkSparseImageMemoryRequirements {
+    VkSparseImageFormatProperties    formatProperties;
+    uint32_t                         imageMipTailFirstLod;
+    VkDeviceSize                     imageMipTailSize;
+    VkDeviceSize                     imageMipTailOffset;
+    VkDeviceSize                     imageMipTailStride;
+} VkSparseImageMemoryRequirements;
+
+typedef struct VkSparseMemoryBind {
+    VkDeviceSize               resourceOffset;
+    VkDeviceSize               size;
+    VkDeviceMemory             memory;
+    VkDeviceSize               memoryOffset;
+    VkSparseMemoryBindFlags    flags;
+} VkSparseMemoryBind;
+
+typedef struct VkSparseBufferMemoryBindInfo {
+    VkBuffer                     buffer;
+    uint32_t                     bindCount;
+    const VkSparseMemoryBind*    pBinds;
+} VkSparseBufferMemoryBindInfo;
+
+typedef struct VkSparseImageOpaqueMemoryBindInfo {
+    VkImage                      image;
+    uint32_t                     bindCount;
+    const VkSparseMemoryBind*    pBinds;
+} VkSparseImageOpaqueMemoryBindInfo;
+
+typedef struct VkImageSubresource {
+    VkImageAspectFlags    aspectMask;
+    uint32_t              mipLevel;
+    uint32_t              arrayLayer;
+} VkImageSubresource;
+
+typedef struct VkOffset3D {
+    int32_t    x;
+    int32_t    y;
+    int32_t    z;
+} VkOffset3D;
+
+typedef struct VkSparseImageMemoryBind {
+    VkImageSubresource         subresource;
+    VkOffset3D                 offset;
+    VkExtent3D                 extent;
+    VkDeviceMemory             memory;
+    VkDeviceSize               memoryOffset;
+    VkSparseMemoryBindFlags    flags;
+} VkSparseImageMemoryBind;
+
+typedef struct VkSparseImageMemoryBindInfo {
+    VkImage                           image;
+    uint32_t                          bindCount;
+    const VkSparseImageMemoryBind*    pBinds;
+} VkSparseImageMemoryBindInfo;
+
+typedef struct VkBindSparseInfo {
+    VkStructureType                             sType;
+    const void*                                 pNext;
+    uint32_t                                    waitSemaphoreCount;
+    const VkSemaphore*                          pWaitSemaphores;
+    uint32_t                                    bufferBindCount;
+    const VkSparseBufferMemoryBindInfo*         pBufferBinds;
+    uint32_t                                    imageOpaqueBindCount;
+    const VkSparseImageOpaqueMemoryBindInfo*    pImageOpaqueBinds;
+    uint32_t                                    imageBindCount;
+    const VkSparseImageMemoryBindInfo*          pImageBinds;
+    uint32_t                                    signalSemaphoreCount;
+    const VkSemaphore*                          pSignalSemaphores;
+} VkBindSparseInfo;
+
+typedef struct VkFenceCreateInfo {
+    VkStructureType       sType;
+    const void*           pNext;
+    VkFenceCreateFlags    flags;
+} VkFenceCreateInfo;
+
+typedef struct VkSemaphoreCreateInfo {
+    VkStructureType           sType;
+    const void*               pNext;
+    VkSemaphoreCreateFlags    flags;
+} VkSemaphoreCreateInfo;
+
+typedef struct VkEventCreateInfo {
+    VkStructureType       sType;
+    const void*           pNext;
+    VkEventCreateFlags    flags;
+} VkEventCreateInfo;
+
+typedef struct VkQueryPoolCreateInfo {
+    VkStructureType                  sType;
+    const void*                      pNext;
+    VkQueryPoolCreateFlags           flags;
+    VkQueryType                      queryType;
+    uint32_t                         queryCount;
+    VkQueryPipelineStatisticFlags    pipelineStatistics;
+} VkQueryPoolCreateInfo;
+
+typedef struct VkBufferCreateInfo {
+    VkStructureType        sType;
+    const void*            pNext;
+    VkBufferCreateFlags    flags;
+    VkDeviceSize           size;
+    VkBufferUsageFlags     usage;
+    VkSharingMode          sharingMode;
+    uint32_t               queueFamilyIndexCount;
+    const uint32_t*        pQueueFamilyIndices;
+} VkBufferCreateInfo;
+
+typedef struct VkBufferViewCreateInfo {
+    VkStructureType            sType;
+    const void*                pNext;
+    VkBufferViewCreateFlags    flags;
+    VkBuffer                   buffer;
+    VkFormat                   format;
+    VkDeviceSize               offset;
+    VkDeviceSize               range;
+} VkBufferViewCreateInfo;
+
+typedef struct VkImageCreateInfo {
+    VkStructureType          sType;
+    const void*              pNext;
+    VkImageCreateFlags       flags;
+    VkImageType              imageType;
+    VkFormat                 format;
+    VkExtent3D               extent;
+    uint32_t                 mipLevels;
+    uint32_t                 arrayLayers;
+    VkSampleCountFlagBits    samples;
+    VkImageTiling            tiling;
+    VkImageUsageFlags        usage;
+    VkSharingMode            sharingMode;
+    uint32_t                 queueFamilyIndexCount;
+    const uint32_t*          pQueueFamilyIndices;
+    VkImageLayout            initialLayout;
+} VkImageCreateInfo;
+
+typedef struct VkSubresourceLayout {
+    VkDeviceSize    offset;
+    VkDeviceSize    size;
+    VkDeviceSize    rowPitch;
+    VkDeviceSize    arrayPitch;
+    VkDeviceSize    depthPitch;
+} VkSubresourceLayout;
+
+typedef struct VkComponentMapping {
+    VkComponentSwizzle    r;
+    VkComponentSwizzle    g;
+    VkComponentSwizzle    b;
+    VkComponentSwizzle    a;
+} VkComponentMapping;
+
+typedef struct VkImageSubresourceRange {
+    VkImageAspectFlags    aspectMask;
+    uint32_t              baseMipLevel;
+    uint32_t              levelCount;
+    uint32_t              baseArrayLayer;
+    uint32_t              layerCount;
+} VkImageSubresourceRange;
+
+typedef struct VkImageViewCreateInfo {
+    VkStructureType            sType;
+    const void*                pNext;
+    VkImageViewCreateFlags     flags;
+    VkImage                    image;
+    VkImageViewType            viewType;
+    VkFormat                   format;
+    VkComponentMapping         components;
+    VkImageSubresourceRange    subresourceRange;
+} VkImageViewCreateInfo;
+
+typedef struct VkShaderModuleCreateInfo {
+    VkStructureType              sType;
+    const void*                  pNext;
+    VkShaderModuleCreateFlags    flags;
+    size_t                       codeSize;
+    const uint32_t*              pCode;
+} VkShaderModuleCreateInfo;
+
+typedef struct VkPipelineCacheCreateInfo {
+    VkStructureType               sType;
+    const void*                   pNext;
+    VkPipelineCacheCreateFlags    flags;
+    size_t                        initialDataSize;
+    const void*                   pInitialData;
+} VkPipelineCacheCreateInfo;
+
+typedef struct VkSpecializationMapEntry {
+    uint32_t    constantID;
+    uint32_t    offset;
+    size_t      size;
+} VkSpecializationMapEntry;
+
+typedef struct VkSpecializationInfo {
+    uint32_t                           mapEntryCount;
+    const VkSpecializationMapEntry*    pMapEntries;
+    size_t                             dataSize;
+    const void*                        pData;
+} VkSpecializationInfo;
+
+typedef struct VkPipelineShaderStageCreateInfo {
+    VkStructureType                     sType;
+    const void*                         pNext;
+    VkPipelineShaderStageCreateFlags    flags;
+    VkShaderStageFlagBits               stage;
+    VkShaderModule                      module;
+    const char*                         pName;
+    const VkSpecializationInfo*         pSpecializationInfo;
+} VkPipelineShaderStageCreateInfo;
+
+typedef struct VkVertexInputBindingDescription {
+    uint32_t             binding;
+    uint32_t             stride;
+    VkVertexInputRate    inputRate;
+} VkVertexInputBindingDescription;
+
+typedef struct VkVertexInputAttributeDescription {
+    uint32_t    location;
+    uint32_t    binding;
+    VkFormat    format;
+    uint32_t    offset;
+} VkVertexInputAttributeDescription;
+
+typedef struct VkPipelineVertexInputStateCreateInfo {
+    VkStructureType                             sType;
+    const void*                                 pNext;
+    VkPipelineVertexInputStateCreateFlags       flags;
+    uint32_t                                    vertexBindingDescriptionCount;
+    const VkVertexInputBindingDescription*      pVertexBindingDescriptions;
+    uint32_t                                    vertexAttributeDescriptionCount;
+    const VkVertexInputAttributeDescription*    pVertexAttributeDescriptions;
+} VkPipelineVertexInputStateCreateInfo;
+
+typedef struct VkPipelineInputAssemblyStateCreateInfo {
+    VkStructureType                            sType;
+    const void*                                pNext;
+    VkPipelineInputAssemblyStateCreateFlags    flags;
+    VkPrimitiveTopology                        topology;
+    VkBool32                                   primitiveRestartEnable;
+} VkPipelineInputAssemblyStateCreateInfo;
+
+typedef struct VkPipelineTessellationStateCreateInfo {
+    VkStructureType                           sType;
+    const void*                               pNext;
+    VkPipelineTessellationStateCreateFlags    flags;
+    uint32_t                                  patchControlPoints;
+} VkPipelineTessellationStateCreateInfo;
+
+typedef struct VkViewport {
+    float    x;
+    float    y;
+    float    width;
+    float    height;
+    float    minDepth;
+    float    maxDepth;
+} VkViewport;
+
+typedef struct VkOffset2D {
+    int32_t    x;
+    int32_t    y;
+} VkOffset2D;
+
+typedef struct VkExtent2D {
+    uint32_t    width;
+    uint32_t    height;
+} VkExtent2D;
+
+typedef struct VkRect2D {
+    VkOffset2D    offset;
+    VkExtent2D    extent;
+} VkRect2D;
+
+typedef struct VkPipelineViewportStateCreateInfo {
+    VkStructureType                       sType;
+    const void*                           pNext;
+    VkPipelineViewportStateCreateFlags    flags;
+    uint32_t                              viewportCount;
+    const VkViewport*                     pViewports;
+    uint32_t                              scissorCount;
+    const VkRect2D*                       pScissors;
+} VkPipelineViewportStateCreateInfo;
+
+typedef struct VkPipelineRasterizationStateCreateInfo {
+    VkStructureType                            sType;
+    const void*                                pNext;
+    VkPipelineRasterizationStateCreateFlags    flags;
+    VkBool32                                   depthClampEnable;
+    VkBool32                                   rasterizerDiscardEnable;
+    VkPolygonMode                              polygonMode;
+    VkCullModeFlags                            cullMode;
+    VkFrontFace                                frontFace;
+    VkBool32                                   depthBiasEnable;
+    float                                      depthBiasConstantFactor;
+    float                                      depthBiasClamp;
+    float                                      depthBiasSlopeFactor;
+    float                                      lineWidth;
+} VkPipelineRasterizationStateCreateInfo;
+
+typedef struct VkPipelineMultisampleStateCreateInfo {
+    VkStructureType                          sType;
+    const void*                              pNext;
+    VkPipelineMultisampleStateCreateFlags    flags;
+    VkSampleCountFlagBits                    rasterizationSamples;
+    VkBool32                                 sampleShadingEnable;
+    float                                    minSampleShading;
+    const VkSampleMask*                      pSampleMask;
+    VkBool32                                 alphaToCoverageEnable;
+    VkBool32                                 alphaToOneEnable;
+} VkPipelineMultisampleStateCreateInfo;
+
+typedef struct VkStencilOpState {
+    VkStencilOp    failOp;
+    VkStencilOp    passOp;
+    VkStencilOp    depthFailOp;
+    VkCompareOp    compareOp;
+    uint32_t       compareMask;
+    uint32_t       writeMask;
+    uint32_t       reference;
+} VkStencilOpState;
+
+typedef struct VkPipelineDepthStencilStateCreateInfo {
+    VkStructureType                           sType;
+    const void*                               pNext;
+    VkPipelineDepthStencilStateCreateFlags    flags;
+    VkBool32                                  depthTestEnable;
+    VkBool32                                  depthWriteEnable;
+    VkCompareOp                               depthCompareOp;
+    VkBool32                                  depthBoundsTestEnable;
+    VkBool32                                  stencilTestEnable;
+    VkStencilOpState                          front;
+    VkStencilOpState                          back;
+    float                                     minDepthBounds;
+    float                                     maxDepthBounds;
+} VkPipelineDepthStencilStateCreateInfo;
+
+typedef struct VkPipelineColorBlendAttachmentState {
+    VkBool32                 blendEnable;
+    VkBlendFactor            srcColorBlendFactor;
+    VkBlendFactor            dstColorBlendFactor;
+    VkBlendOp                colorBlendOp;
+    VkBlendFactor            srcAlphaBlendFactor;
+    VkBlendFactor            dstAlphaBlendFactor;
+    VkBlendOp                alphaBlendOp;
+    VkColorComponentFlags    colorWriteMask;
+} VkPipelineColorBlendAttachmentState;
+
+typedef struct VkPipelineColorBlendStateCreateInfo {
+    VkStructureType                               sType;
+    const void*                                   pNext;
+    VkPipelineColorBlendStateCreateFlags          flags;
+    VkBool32                                      logicOpEnable;
+    VkLogicOp                                     logicOp;
+    uint32_t                                      attachmentCount;
+    const VkPipelineColorBlendAttachmentState*    pAttachments;
+    float                                         blendConstants[4];
+} VkPipelineColorBlendStateCreateInfo;
+
+typedef struct VkPipelineDynamicStateCreateInfo {
+    VkStructureType                      sType;
+    const void*                          pNext;
+    VkPipelineDynamicStateCreateFlags    flags;
+    uint32_t                             dynamicStateCount;
+    const VkDynamicState*                pDynamicStates;
+} VkPipelineDynamicStateCreateInfo;
+
+typedef struct VkGraphicsPipelineCreateInfo {
+    VkStructureType                                  sType;
+    const void*                                      pNext;
+    VkPipelineCreateFlags                            flags;
+    uint32_t                                         stageCount;
+    const VkPipelineShaderStageCreateInfo*           pStages;
+    const VkPipelineVertexInputStateCreateInfo*      pVertexInputState;
+    const VkPipelineInputAssemblyStateCreateInfo*    pInputAssemblyState;
+    const VkPipelineTessellationStateCreateInfo*     pTessellationState;
+    const VkPipelineViewportStateCreateInfo*         pViewportState;
+    const VkPipelineRasterizationStateCreateInfo*    pRasterizationState;
+    const VkPipelineMultisampleStateCreateInfo*      pMultisampleState;
+    const VkPipelineDepthStencilStateCreateInfo*     pDepthStencilState;
+    const VkPipelineColorBlendStateCreateInfo*       pColorBlendState;
+    const VkPipelineDynamicStateCreateInfo*          pDynamicState;
+    VkPipelineLayout                                 layout;
+    VkRenderPass                                     renderPass;
+    uint32_t                                         subpass;
+    VkPipeline                                       basePipelineHandle;
+    int32_t                                          basePipelineIndex;
+} VkGraphicsPipelineCreateInfo;
+
+typedef struct VkComputePipelineCreateInfo {
+    VkStructureType                    sType;
+    const void*                        pNext;
+    VkPipelineCreateFlags              flags;
+    VkPipelineShaderStageCreateInfo    stage;
+    VkPipelineLayout                   layout;
+    VkPipeline                         basePipelineHandle;
+    int32_t                            basePipelineIndex;
+} VkComputePipelineCreateInfo;
+
+typedef struct VkPushConstantRange {
+    VkShaderStageFlags    stageFlags;
+    uint32_t              offset;
+    uint32_t              size;
+} VkPushConstantRange;
+
+typedef struct VkPipelineLayoutCreateInfo {
+    VkStructureType                 sType;
+    const void*                     pNext;
+    VkPipelineLayoutCreateFlags     flags;
+    uint32_t                        setLayoutCount;
+    const VkDescriptorSetLayout*    pSetLayouts;
+    uint32_t                        pushConstantRangeCount;
+    const VkPushConstantRange*      pPushConstantRanges;
+} VkPipelineLayoutCreateInfo;
+
+typedef struct VkSamplerCreateInfo {
+    VkStructureType         sType;
+    const void*             pNext;
+    VkSamplerCreateFlags    flags;
+    VkFilter                magFilter;
+    VkFilter                minFilter;
+    VkSamplerMipmapMode     mipmapMode;
+    VkSamplerAddressMode    addressModeU;
+    VkSamplerAddressMode    addressModeV;
+    VkSamplerAddressMode    addressModeW;
+    float                   mipLodBias;
+    VkBool32                anisotropyEnable;
+    float                   maxAnisotropy;
+    VkBool32                compareEnable;
+    VkCompareOp             compareOp;
+    float                   minLod;
+    float                   maxLod;
+    VkBorderColor           borderColor;
+    VkBool32                unnormalizedCoordinates;
+} VkSamplerCreateInfo;
+
+typedef struct VkDescriptorSetLayoutBinding {
+    uint32_t              binding;
+    VkDescriptorType      descriptorType;
+    uint32_t              descriptorCount;
+    VkShaderStageFlags    stageFlags;
+    const VkSampler*      pImmutableSamplers;
+} VkDescriptorSetLayoutBinding;
+
+typedef struct VkDescriptorSetLayoutCreateInfo {
+    VkStructureType                        sType;
+    const void*                            pNext;
+    VkDescriptorSetLayoutCreateFlags       flags;
+    uint32_t                               bindingCount;
+    const VkDescriptorSetLayoutBinding*    pBindings;
+} VkDescriptorSetLayoutCreateInfo;
+
+typedef struct VkDescriptorPoolSize {
+    VkDescriptorType    type;
+    uint32_t            descriptorCount;
+} VkDescriptorPoolSize;
+
+typedef struct VkDescriptorPoolCreateInfo {
+    VkStructureType                sType;
+    const void*                    pNext;
+    VkDescriptorPoolCreateFlags    flags;
+    uint32_t                       maxSets;
+    uint32_t                       poolSizeCount;
+    const VkDescriptorPoolSize*    pPoolSizes;
+} VkDescriptorPoolCreateInfo;
+
+typedef struct VkDescriptorSetAllocateInfo {
+    VkStructureType                 sType;
+    const void*                     pNext;
+    VkDescriptorPool                descriptorPool;
+    uint32_t                        descriptorSetCount;
+    const VkDescriptorSetLayout*    pSetLayouts;
+} VkDescriptorSetAllocateInfo;
+
+typedef struct VkDescriptorImageInfo {
+    VkSampler        sampler;
+    VkImageView      imageView;
+    VkImageLayout    imageLayout;
+} VkDescriptorImageInfo;
+
+typedef struct VkDescriptorBufferInfo {
+    VkBuffer        buffer;
+    VkDeviceSize    offset;
+    VkDeviceSize    range;
+} VkDescriptorBufferInfo;
+
+typedef struct VkWriteDescriptorSet {
+    VkStructureType                  sType;
+    const void*                      pNext;
+    VkDescriptorSet                  dstSet;
+    uint32_t                         dstBinding;
+    uint32_t                         dstArrayElement;
+    uint32_t                         descriptorCount;
+    VkDescriptorType                 descriptorType;
+    const VkDescriptorImageInfo*     pImageInfo;
+    const VkDescriptorBufferInfo*    pBufferInfo;
+    const VkBufferView*              pTexelBufferView;
+} VkWriteDescriptorSet;
+
+typedef struct VkCopyDescriptorSet {
+    VkStructureType    sType;
+    const void*        pNext;
+    VkDescriptorSet    srcSet;
+    uint32_t           srcBinding;
+    uint32_t           srcArrayElement;
+    VkDescriptorSet    dstSet;
+    uint32_t           dstBinding;
+    uint32_t           dstArrayElement;
+    uint32_t           descriptorCount;
+} VkCopyDescriptorSet;
+
+typedef struct VkFramebufferCreateInfo {
+    VkStructureType             sType;
+    const void*                 pNext;
+    VkFramebufferCreateFlags    flags;
+    VkRenderPass                renderPass;
+    uint32_t                    attachmentCount;
+    const VkImageView*          pAttachments;
+    uint32_t                    width;
+    uint32_t                    height;
+    uint32_t                    layers;
+} VkFramebufferCreateInfo;
+
+typedef struct VkAttachmentDescription {
+    VkAttachmentDescriptionFlags    flags;
+    VkFormat                        format;
+    VkSampleCountFlagBits           samples;
+    VkAttachmentLoadOp              loadOp;
+    VkAttachmentStoreOp             storeOp;
+    VkAttachmentLoadOp              stencilLoadOp;
+    VkAttachmentStoreOp             stencilStoreOp;
+    VkImageLayout                   initialLayout;
+    VkImageLayout                   finalLayout;
+} VkAttachmentDescription;
+
+typedef struct VkAttachmentReference {
+    uint32_t         attachment;
+    VkImageLayout    layout;
+} VkAttachmentReference;
+
+typedef struct VkSubpassDescription {
+    VkSubpassDescriptionFlags       flags;
+    VkPipelineBindPoint             pipelineBindPoint;
+    uint32_t                        inputAttachmentCount;
+    const VkAttachmentReference*    pInputAttachments;
+    uint32_t                        colorAttachmentCount;
+    const VkAttachmentReference*    pColorAttachments;
+    const VkAttachmentReference*    pResolveAttachments;
+    const VkAttachmentReference*    pDepthStencilAttachment;
+    uint32_t                        preserveAttachmentCount;
+    const uint32_t*                 pPreserveAttachments;
+} VkSubpassDescription;
+
+typedef struct VkSubpassDependency {
+    uint32_t                srcSubpass;
+    uint32_t                dstSubpass;
+    VkPipelineStageFlags    srcStageMask;
+    VkPipelineStageFlags    dstStageMask;
+    VkAccessFlags           srcAccessMask;
+    VkAccessFlags           dstAccessMask;
+    VkDependencyFlags       dependencyFlags;
+} VkSubpassDependency;
+
+typedef struct VkRenderPassCreateInfo {
+    VkStructureType                   sType;
+    const void*                       pNext;
+    VkRenderPassCreateFlags           flags;
+    uint32_t                          attachmentCount;
+    const VkAttachmentDescription*    pAttachments;
+    uint32_t                          subpassCount;
+    const VkSubpassDescription*       pSubpasses;
+    uint32_t                          dependencyCount;
+    const VkSubpassDependency*        pDependencies;
+} VkRenderPassCreateInfo;
+
+typedef struct VkCommandPoolCreateInfo {
+    VkStructureType             sType;
+    const void*                 pNext;
+    VkCommandPoolCreateFlags    flags;
+    uint32_t                    queueFamilyIndex;
+} VkCommandPoolCreateInfo;
+
+typedef struct VkCommandBufferAllocateInfo {
+    VkStructureType         sType;
+    const void*             pNext;
+    VkCommandPool           commandPool;
+    VkCommandBufferLevel    level;
+    uint32_t                commandBufferCount;
+} VkCommandBufferAllocateInfo;
+
+typedef struct VkCommandBufferInheritanceInfo {
+    VkStructureType                  sType;
+    const void*                      pNext;
+    VkRenderPass                     renderPass;
+    uint32_t                         subpass;
+    VkFramebuffer                    framebuffer;
+    VkBool32                         occlusionQueryEnable;
+    VkQueryControlFlags              queryFlags;
+    VkQueryPipelineStatisticFlags    pipelineStatistics;
+} VkCommandBufferInheritanceInfo;
+
+typedef struct VkCommandBufferBeginInfo {
+    VkStructureType                          sType;
+    const void*                              pNext;
+    VkCommandBufferUsageFlags                flags;
+    const VkCommandBufferInheritanceInfo*    pInheritanceInfo;
+} VkCommandBufferBeginInfo;
+
+typedef struct VkBufferCopy {
+    VkDeviceSize    srcOffset;
+    VkDeviceSize    dstOffset;
+    VkDeviceSize    size;
+} VkBufferCopy;
+
+typedef struct VkImageSubresourceLayers {
+    VkImageAspectFlags    aspectMask;
+    uint32_t              mipLevel;
+    uint32_t              baseArrayLayer;
+    uint32_t              layerCount;
+} VkImageSubresourceLayers;
+
+typedef struct VkImageCopy {
+    VkImageSubresourceLayers    srcSubresource;
+    VkOffset3D                  srcOffset;
+    VkImageSubresourceLayers    dstSubresource;
+    VkOffset3D                  dstOffset;
+    VkExtent3D                  extent;
+} VkImageCopy;
+
+typedef struct VkImageBlit {
+    VkImageSubresourceLayers    srcSubresource;
+    VkOffset3D                  srcOffsets[2];
+    VkImageSubresourceLayers    dstSubresource;
+    VkOffset3D                  dstOffsets[2];
+} VkImageBlit;
+
+typedef struct VkBufferImageCopy {
+    VkDeviceSize                bufferOffset;
+    uint32_t                    bufferRowLength;
+    uint32_t                    bufferImageHeight;
+    VkImageSubresourceLayers    imageSubresource;
+    VkOffset3D                  imageOffset;
+    VkExtent3D                  imageExtent;
+} VkBufferImageCopy;
+
+typedef union VkClearColorValue {
+    float       float32[4];
+    int32_t     int32[4];
+    uint32_t    uint32[4];
+} VkClearColorValue;
+
+typedef struct VkClearDepthStencilValue {
+    float       depth;
+    uint32_t    stencil;
+} VkClearDepthStencilValue;
+
+typedef union VkClearValue {
+    VkClearColorValue           color;
+    VkClearDepthStencilValue    depthStencil;
+} VkClearValue;
+
+typedef struct VkClearAttachment {
+    VkImageAspectFlags    aspectMask;
+    uint32_t              colorAttachment;
+    VkClearValue          clearValue;
+} VkClearAttachment;
+
+typedef struct VkClearRect {
+    VkRect2D    rect;
+    uint32_t    baseArrayLayer;
+    uint32_t    layerCount;
+} VkClearRect;
+
+typedef struct VkImageResolve {
+    VkImageSubresourceLayers    srcSubresource;
+    VkOffset3D                  srcOffset;
+    VkImageSubresourceLayers    dstSubresource;
+    VkOffset3D                  dstOffset;
+    VkExtent3D                  extent;
+} VkImageResolve;
+
+typedef struct VkMemoryBarrier {
+    VkStructureType    sType;
+    const void*        pNext;
+    VkAccessFlags      srcAccessMask;
+    VkAccessFlags      dstAccessMask;
+} VkMemoryBarrier;
+
+typedef struct VkBufferMemoryBarrier {
+    VkStructureType    sType;
+    const void*        pNext;
+    VkAccessFlags      srcAccessMask;
+    VkAccessFlags      dstAccessMask;
+    uint32_t           srcQueueFamilyIndex;
+    uint32_t           dstQueueFamilyIndex;
+    VkBuffer           buffer;
+    VkDeviceSize       offset;
+    VkDeviceSize       size;
+} VkBufferMemoryBarrier;
+
+typedef struct VkImageMemoryBarrier {
+    VkStructureType            sType;
+    const void*                pNext;
+    VkAccessFlags              srcAccessMask;
+    VkAccessFlags              dstAccessMask;
+    VkImageLayout              oldLayout;
+    VkImageLayout              newLayout;
+    uint32_t                   srcQueueFamilyIndex;
+    uint32_t                   dstQueueFamilyIndex;
+    VkImage                    image;
+    VkImageSubresourceRange    subresourceRange;
+} VkImageMemoryBarrier;
+
+typedef struct VkRenderPassBeginInfo {
+    VkStructureType        sType;
+    const void*            pNext;
+    VkRenderPass           renderPass;
+    VkFramebuffer          framebuffer;
+    VkRect2D               renderArea;
+    uint32_t               clearValueCount;
+    const VkClearValue*    pClearValues;
+} VkRenderPassBeginInfo;
+
+typedef struct VkDispatchIndirectCommand {
+    uint32_t    x;
+    uint32_t    y;
+    uint32_t    z;
+} VkDispatchIndirectCommand;
+
+typedef struct VkDrawIndexedIndirectCommand {
+    uint32_t    indexCount;
+    uint32_t    instanceCount;
+    uint32_t    firstIndex;
+    int32_t     vertexOffset;
+    uint32_t    firstInstance;
+} VkDrawIndexedIndirectCommand;
+
+typedef struct VkDrawIndirectCommand {
+    uint32_t    vertexCount;
+    uint32_t    instanceCount;
+    uint32_t    firstVertex;
+    uint32_t    firstInstance;
+} VkDrawIndirectCommand;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkCreateInstance)(const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance);
+typedef void (VKAPI_PTR *PFN_vkDestroyInstance)(VkInstance instance, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkEnumeratePhysicalDevices)(VkInstance instance, uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices);
+typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFeatures)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures* pFeatures);
+typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFormatProperties)(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties* pFormatProperties);
+typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceImageFormatProperties)(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* pImageFormatProperties);
+typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceProperties)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties* pProperties);
+typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceQueueFamilyProperties)(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties* pQueueFamilyProperties);
+typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceMemoryProperties)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties* pMemoryProperties);
+typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_vkGetInstanceProcAddr)(VkInstance instance, const char* pName);
+typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_vkGetDeviceProcAddr)(VkDevice device, const char* pName);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateDevice)(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDevice* pDevice);
+typedef void (VKAPI_PTR *PFN_vkDestroyDevice)(VkDevice device, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkEnumerateInstanceExtensionProperties)(const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties);
+typedef VkResult (VKAPI_PTR *PFN_vkEnumerateDeviceExtensionProperties)(VkPhysicalDevice physicalDevice, const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties);
+typedef VkResult (VKAPI_PTR *PFN_vkEnumerateInstanceLayerProperties)(uint32_t* pPropertyCount, VkLayerProperties* pProperties);
+typedef VkResult (VKAPI_PTR *PFN_vkEnumerateDeviceLayerProperties)(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkLayerProperties* pProperties);
+typedef void (VKAPI_PTR *PFN_vkGetDeviceQueue)(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue* pQueue);
+typedef VkResult (VKAPI_PTR *PFN_vkQueueSubmit)(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmits, VkFence fence);
+typedef VkResult (VKAPI_PTR *PFN_vkQueueWaitIdle)(VkQueue queue);
+typedef VkResult (VKAPI_PTR *PFN_vkDeviceWaitIdle)(VkDevice device);
+typedef VkResult (VKAPI_PTR *PFN_vkAllocateMemory)(VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory);
+typedef void (VKAPI_PTR *PFN_vkFreeMemory)(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkMapMemory)(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void** ppData);
+typedef void (VKAPI_PTR *PFN_vkUnmapMemory)(VkDevice device, VkDeviceMemory memory);
+typedef VkResult (VKAPI_PTR *PFN_vkFlushMappedMemoryRanges)(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges);
+typedef VkResult (VKAPI_PTR *PFN_vkInvalidateMappedMemoryRanges)(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges);
+typedef void (VKAPI_PTR *PFN_vkGetDeviceMemoryCommitment)(VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes);
+typedef VkResult (VKAPI_PTR *PFN_vkBindBufferMemory)(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset);
+typedef VkResult (VKAPI_PTR *PFN_vkBindImageMemory)(VkDevice device, VkImage image, VkDeviceMemory memory, VkDeviceSize memoryOffset);
+typedef void (VKAPI_PTR *PFN_vkGetBufferMemoryRequirements)(VkDevice device, VkBuffer buffer, VkMemoryRequirements* pMemoryRequirements);
+typedef void (VKAPI_PTR *PFN_vkGetImageMemoryRequirements)(VkDevice device, VkImage image, VkMemoryRequirements* pMemoryRequirements);
+typedef void (VKAPI_PTR *PFN_vkGetImageSparseMemoryRequirements)(VkDevice device, VkImage image, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements* pSparseMemoryRequirements);
+typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceSparseImageFormatProperties)(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, uint32_t* pPropertyCount, VkSparseImageFormatProperties* pProperties);
+typedef VkResult (VKAPI_PTR *PFN_vkQueueBindSparse)(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo* pBindInfo, VkFence fence);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateFence)(VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence);
+typedef void (VKAPI_PTR *PFN_vkDestroyFence)(VkDevice device, VkFence fence, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkResetFences)(VkDevice device, uint32_t fenceCount, const VkFence* pFences);
+typedef VkResult (VKAPI_PTR *PFN_vkGetFenceStatus)(VkDevice device, VkFence fence);
+typedef VkResult (VKAPI_PTR *PFN_vkWaitForFences)(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateSemaphore)(VkDevice device, const VkSemaphoreCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSemaphore* pSemaphore);
+typedef void (VKAPI_PTR *PFN_vkDestroySemaphore)(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateEvent)(VkDevice device, const VkEventCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkEvent* pEvent);
+typedef void (VKAPI_PTR *PFN_vkDestroyEvent)(VkDevice device, VkEvent event, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkGetEventStatus)(VkDevice device, VkEvent event);
+typedef VkResult (VKAPI_PTR *PFN_vkSetEvent)(VkDevice device, VkEvent event);
+typedef VkResult (VKAPI_PTR *PFN_vkResetEvent)(VkDevice device, VkEvent event);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateQueryPool)(VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkQueryPool* pQueryPool);
+typedef void (VKAPI_PTR *PFN_vkDestroyQueryPool)(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkGetQueryPoolResults)(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateBuffer)(VkDevice device, const VkBufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBuffer* pBuffer);
+typedef void (VKAPI_PTR *PFN_vkDestroyBuffer)(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateBufferView)(VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBufferView* pView);
+typedef void (VKAPI_PTR *PFN_vkDestroyBufferView)(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateImage)(VkDevice device, const VkImageCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImage* pImage);
+typedef void (VKAPI_PTR *PFN_vkDestroyImage)(VkDevice device, VkImage image, const VkAllocationCallbacks* pAllocator);
+typedef void (VKAPI_PTR *PFN_vkGetImageSubresourceLayout)(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateImageView)(VkDevice device, const VkImageViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImageView* pView);
+typedef void (VKAPI_PTR *PFN_vkDestroyImageView)(VkDevice device, VkImageView imageView, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateShaderModule)(VkDevice device, const VkShaderModuleCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkShaderModule* pShaderModule);
+typedef void (VKAPI_PTR *PFN_vkDestroyShaderModule)(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkCreatePipelineCache)(VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineCache* pPipelineCache);
+typedef void (VKAPI_PTR *PFN_vkDestroyPipelineCache)(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkGetPipelineCacheData)(VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData);
+typedef VkResult (VKAPI_PTR *PFN_vkMergePipelineCaches)(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateGraphicsPipelines)(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkGraphicsPipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateComputePipelines)(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkComputePipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines);
+typedef void (VKAPI_PTR *PFN_vkDestroyPipeline)(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkCreatePipelineLayout)(VkDevice device, const VkPipelineLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineLayout* pPipelineLayout);
+typedef void (VKAPI_PTR *PFN_vkDestroyPipelineLayout)(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateSampler)(VkDevice device, const VkSamplerCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSampler* pSampler);
+typedef void (VKAPI_PTR *PFN_vkDestroySampler)(VkDevice device, VkSampler sampler, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateDescriptorSetLayout)(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorSetLayout* pSetLayout);
+typedef void (VKAPI_PTR *PFN_vkDestroyDescriptorSetLayout)(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateDescriptorPool)(VkDevice device, const VkDescriptorPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorPool* pDescriptorPool);
+typedef void (VKAPI_PTR *PFN_vkDestroyDescriptorPool)(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkResetDescriptorPool)(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags);
+typedef VkResult (VKAPI_PTR *PFN_vkAllocateDescriptorSets)(VkDevice device, const VkDescriptorSetAllocateInfo* pAllocateInfo, VkDescriptorSet* pDescriptorSets);
+typedef VkResult (VKAPI_PTR *PFN_vkFreeDescriptorSets)(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets);
+typedef void (VKAPI_PTR *PFN_vkUpdateDescriptorSets)(VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet* pDescriptorCopies);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateFramebuffer)(VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFramebuffer* pFramebuffer);
+typedef void (VKAPI_PTR *PFN_vkDestroyFramebuffer)(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateRenderPass)(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkRenderPass* pRenderPass);
+typedef void (VKAPI_PTR *PFN_vkDestroyRenderPass)(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks* pAllocator);
+typedef void (VKAPI_PTR *PFN_vkGetRenderAreaGranularity)(VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateCommandPool)(VkDevice device, const VkCommandPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkCommandPool* pCommandPool);
+typedef void (VKAPI_PTR *PFN_vkDestroyCommandPool)(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkResetCommandPool)(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags);
+typedef VkResult (VKAPI_PTR *PFN_vkAllocateCommandBuffers)(VkDevice device, const VkCommandBufferAllocateInfo* pAllocateInfo, VkCommandBuffer* pCommandBuffers);
+typedef void (VKAPI_PTR *PFN_vkFreeCommandBuffers)(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers);
+typedef VkResult (VKAPI_PTR *PFN_vkBeginCommandBuffer)(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo* pBeginInfo);
+typedef VkResult (VKAPI_PTR *PFN_vkEndCommandBuffer)(VkCommandBuffer commandBuffer);
+typedef VkResult (VKAPI_PTR *PFN_vkResetCommandBuffer)(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags);
+typedef void (VKAPI_PTR *PFN_vkCmdBindPipeline)(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline);
+typedef void (VKAPI_PTR *PFN_vkCmdSetViewport)(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewport* pViewports);
+typedef void (VKAPI_PTR *PFN_vkCmdSetScissor)(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D* pScissors);
+typedef void (VKAPI_PTR *PFN_vkCmdSetLineWidth)(VkCommandBuffer commandBuffer, float lineWidth);
+typedef void (VKAPI_PTR *PFN_vkCmdSetDepthBias)(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor);
+typedef void (VKAPI_PTR *PFN_vkCmdSetBlendConstants)(VkCommandBuffer commandBuffer, const float blendConstants[4]);
+typedef void (VKAPI_PTR *PFN_vkCmdSetDepthBounds)(VkCommandBuffer commandBuffer, float minDepthBounds, float maxDepthBounds);
+typedef void (VKAPI_PTR *PFN_vkCmdSetStencilCompareMask)(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t compareMask);
+typedef void (VKAPI_PTR *PFN_vkCmdSetStencilWriteMask)(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t writeMask);
+typedef void (VKAPI_PTR *PFN_vkCmdSetStencilReference)(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference);
+typedef void (VKAPI_PTR *PFN_vkCmdBindDescriptorSets)(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t* pDynamicOffsets);
+typedef void (VKAPI_PTR *PFN_vkCmdBindIndexBuffer)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType);
+typedef void (VKAPI_PTR *PFN_vkCmdBindVertexBuffers)(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets);
+typedef void (VKAPI_PTR *PFN_vkCmdDraw)(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance);
+typedef void (VKAPI_PTR *PFN_vkCmdDrawIndexed)(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance);
+typedef void (VKAPI_PTR *PFN_vkCmdDrawIndirect)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride);
+typedef void (VKAPI_PTR *PFN_vkCmdDrawIndexedIndirect)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride);
+typedef void (VKAPI_PTR *PFN_vkCmdDispatch)(VkCommandBuffer commandBuffer, uint32_t x, uint32_t y, uint32_t z);
+typedef void (VKAPI_PTR *PFN_vkCmdDispatchIndirect)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset);
+typedef void (VKAPI_PTR *PFN_vkCmdCopyBuffer)(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferCopy* pRegions);
+typedef void (VKAPI_PTR *PFN_vkCmdCopyImage)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageCopy* pRegions);
+typedef void (VKAPI_PTR *PFN_vkCmdBlitImage)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageBlit* pRegions, VkFilter filter);
+typedef void (VKAPI_PTR *PFN_vkCmdCopyBufferToImage)(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions);
+typedef void (VKAPI_PTR *PFN_vkCmdCopyImageToBuffer)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions);
+typedef void (VKAPI_PTR *PFN_vkCmdUpdateBuffer)(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, const uint32_t* pData);
+typedef void (VKAPI_PTR *PFN_vkCmdFillBuffer)(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data);
+typedef void (VKAPI_PTR *PFN_vkCmdClearColorImage)(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges);
+typedef void (VKAPI_PTR *PFN_vkCmdClearDepthStencilImage)(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges);
+typedef void (VKAPI_PTR *PFN_vkCmdClearAttachments)(VkCommandBuffer commandBuffer, uint32_t attachmentCount, const VkClearAttachment* pAttachments, uint32_t rectCount, const VkClearRect* pRects);
+typedef void (VKAPI_PTR *PFN_vkCmdResolveImage)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageResolve* pRegions);
+typedef void (VKAPI_PTR *PFN_vkCmdSetEvent)(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask);
+typedef void (VKAPI_PTR *PFN_vkCmdResetEvent)(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask);
+typedef void (VKAPI_PTR *PFN_vkCmdWaitEvents)(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent* pEvents, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, uint32_t memoryBarrierCount, const VkMemoryBarrier* pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier* pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier* pImageMemoryBarriers);
+typedef void (VKAPI_PTR *PFN_vkCmdPipelineBarrier)(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, uint32_t memoryBarrierCount, const VkMemoryBarrier* pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier* pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier* pImageMemoryBarriers);
+typedef void (VKAPI_PTR *PFN_vkCmdBeginQuery)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, VkQueryControlFlags flags);
+typedef void (VKAPI_PTR *PFN_vkCmdEndQuery)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query);
+typedef void (VKAPI_PTR *PFN_vkCmdResetQueryPool)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount);
+typedef void (VKAPI_PTR *PFN_vkCmdWriteTimestamp)(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t query);
+typedef void (VKAPI_PTR *PFN_vkCmdCopyQueryPoolResults)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize stride, VkQueryResultFlags flags);
+typedef void (VKAPI_PTR *PFN_vkCmdPushConstants)(VkCommandBuffer commandBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size, const void* pValues);
+typedef void (VKAPI_PTR *PFN_vkCmdBeginRenderPass)(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, VkSubpassContents contents);
+typedef void (VKAPI_PTR *PFN_vkCmdNextSubpass)(VkCommandBuffer commandBuffer, VkSubpassContents contents);
+typedef void (VKAPI_PTR *PFN_vkCmdEndRenderPass)(VkCommandBuffer commandBuffer);
+typedef void (VKAPI_PTR *PFN_vkCmdExecuteCommands)(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(
+    const VkInstanceCreateInfo*                 pCreateInfo,
+    const VkAllocationCallbacks*                pAllocator,
+    VkInstance*                                 pInstance);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyInstance(
+    VkInstance                                  instance,
+    const VkAllocationCallbacks*                pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDevices(
+    VkInstance                                  instance,
+    uint32_t*                                   pPhysicalDeviceCount,
+    VkPhysicalDevice*                           pPhysicalDevices);
+
+VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures(
+    VkPhysicalDevice                            physicalDevice,
+    VkPhysicalDeviceFeatures*                   pFeatures);
+
+VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties(
+    VkPhysicalDevice                            physicalDevice,
+    VkFormat                                    format,
+    VkFormatProperties*                         pFormatProperties);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties(
+    VkPhysicalDevice                            physicalDevice,
+    VkFormat                                    format,
+    VkImageType                                 type,
+    VkImageTiling                               tiling,
+    VkImageUsageFlags                           usage,
+    VkImageCreateFlags                          flags,
+    VkImageFormatProperties*                    pImageFormatProperties);
+
+VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties(
+    VkPhysicalDevice                            physicalDevice,
+    VkPhysicalDeviceProperties*                 pProperties);
+
+VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties(
+    VkPhysicalDevice                            physicalDevice,
+    uint32_t*                                   pQueueFamilyPropertyCount,
+    VkQueueFamilyProperties*                    pQueueFamilyProperties);
+
+VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties(
+    VkPhysicalDevice                            physicalDevice,
+    VkPhysicalDeviceMemoryProperties*           pMemoryProperties);
+
+VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(
+    VkInstance                                  instance,
+    const char*                                 pName);
+
+VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(
+    VkDevice                                    device,
+    const char*                                 pName);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice(
+    VkPhysicalDevice                            physicalDevice,
+    const VkDeviceCreateInfo*                   pCreateInfo,
+    const VkAllocationCallbacks*                pAllocator,
+    VkDevice*                                   pDevice);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyDevice(
+    VkDevice                                    device,
+    const VkAllocationCallbacks*                pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceExtensionProperties(
+    const char*                                 pLayerName,
+    uint32_t*                                   pPropertyCount,
+    VkExtensionProperties*                      pProperties);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceExtensionProperties(
+    VkPhysicalDevice                            physicalDevice,
+    const char*                                 pLayerName,
+    uint32_t*                                   pPropertyCount,
+    VkExtensionProperties*                      pProperties);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties(
+    uint32_t*                                   pPropertyCount,
+    VkLayerProperties*                          pProperties);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceLayerProperties(
+    VkPhysicalDevice                            physicalDevice,
+    uint32_t*                                   pPropertyCount,
+    VkLayerProperties*                          pProperties);
+
+VKAPI_ATTR void VKAPI_CALL vkGetDeviceQueue(
+    VkDevice                                    device,
+    uint32_t                                    queueFamilyIndex,
+    uint32_t                                    queueIndex,
+    VkQueue*                                    pQueue);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkQueueSubmit(
+    VkQueue                                     queue,
+    uint32_t                                    submitCount,
+    const VkSubmitInfo*                         pSubmits,
+    VkFence                                     fence);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkQueueWaitIdle(
+    VkQueue                                     queue);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkDeviceWaitIdle(
+    VkDevice                                    device);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkAllocateMemory(
+    VkDevice                                    device,
+    const VkMemoryAllocateInfo*                 pAllocateInfo,
+    const VkAllocationCallbacks*                pAllocator,
+    VkDeviceMemory*                             pMemory);
+
+VKAPI_ATTR void VKAPI_CALL vkFreeMemory(
+    VkDevice                                    device,
+    VkDeviceMemory                              memory,
+    const VkAllocationCallbacks*                pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkMapMemory(
+    VkDevice                                    device,
+    VkDeviceMemory                              memory,
+    VkDeviceSize                                offset,
+    VkDeviceSize                                size,
+    VkMemoryMapFlags                            flags,
+    void**                                      ppData);
+
+VKAPI_ATTR void VKAPI_CALL vkUnmapMemory(
+    VkDevice                                    device,
+    VkDeviceMemory                              memory);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkFlushMappedMemoryRanges(
+    VkDevice                                    device,
+    uint32_t                                    memoryRangeCount,
+    const VkMappedMemoryRange*                  pMemoryRanges);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkInvalidateMappedMemoryRanges(
+    VkDevice                                    device,
+    uint32_t                                    memoryRangeCount,
+    const VkMappedMemoryRange*                  pMemoryRanges);
+
+VKAPI_ATTR void VKAPI_CALL vkGetDeviceMemoryCommitment(
+    VkDevice                                    device,
+    VkDeviceMemory                              memory,
+    VkDeviceSize*                               pCommittedMemoryInBytes);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory(
+    VkDevice                                    device,
+    VkBuffer                                    buffer,
+    VkDeviceMemory                              memory,
+    VkDeviceSize                                memoryOffset);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkBindImageMemory(
+    VkDevice                                    device,
+    VkImage                                     image,
+    VkDeviceMemory                              memory,
+    VkDeviceSize                                memoryOffset);
+
+VKAPI_ATTR void VKAPI_CALL vkGetBufferMemoryRequirements(
+    VkDevice                                    device,
+    VkBuffer                                    buffer,
+    VkMemoryRequirements*                       pMemoryRequirements);
+
+VKAPI_ATTR void VKAPI_CALL vkGetImageMemoryRequirements(
+    VkDevice                                    device,
+    VkImage                                     image,
+    VkMemoryRequirements*                       pMemoryRequirements);
+
+VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements(
+    VkDevice                                    device,
+    VkImage                                     image,
+    uint32_t*                                   pSparseMemoryRequirementCount,
+    VkSparseImageMemoryRequirements*            pSparseMemoryRequirements);
+
+VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties(
+    VkPhysicalDevice                            physicalDevice,
+    VkFormat                                    format,
+    VkImageType                                 type,
+    VkSampleCountFlagBits                       samples,
+    VkImageUsageFlags                           usage,
+    VkImageTiling                               tiling,
+    uint32_t*                                   pPropertyCount,
+    VkSparseImageFormatProperties*              pProperties);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkQueueBindSparse(
+    VkQueue                                     queue,
+    uint32_t                                    bindInfoCount,
+    const VkBindSparseInfo*                     pBindInfo,
+    VkFence                                     fence);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateFence(
+    VkDevice                                    device,
+    const VkFenceCreateInfo*                    pCreateInfo,
+    const VkAllocationCallbacks*                pAllocator,
+    VkFence*                                    pFence);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyFence(
+    VkDevice                                    device,
+    VkFence                                     fence,
+    const VkAllocationCallbacks*                pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkResetFences(
+    VkDevice                                    device,
+    uint32_t                                    fenceCount,
+    const VkFence*                              pFences);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceStatus(
+    VkDevice                                    device,
+    VkFence                                     fence);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkWaitForFences(
+    VkDevice                                    device,
+    uint32_t                                    fenceCount,
+    const VkFence*                              pFences,
+    VkBool32                                    waitAll,
+    uint64_t                                    timeout);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateSemaphore(
+    VkDevice                                    device,
+    const VkSemaphoreCreateInfo*                pCreateInfo,
+    const VkAllocationCallbacks*                pAllocator,
+    VkSemaphore*                                pSemaphore);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroySemaphore(
+    VkDevice                                    device,
+    VkSemaphore                                 semaphore,
+    const VkAllocationCallbacks*                pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateEvent(
+    VkDevice                                    device,
+    const VkEventCreateInfo*                    pCreateInfo,
+    const VkAllocationCallbacks*                pAllocator,
+    VkEvent*                                    pEvent);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyEvent(
+    VkDevice                                    device,
+    VkEvent                                     event,
+    const VkAllocationCallbacks*                pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetEventStatus(
+    VkDevice                                    device,
+    VkEvent                                     event);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkSetEvent(
+    VkDevice                                    device,
+    VkEvent                                     event);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkResetEvent(
+    VkDevice                                    device,
+    VkEvent                                     event);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateQueryPool(
+    VkDevice                                    device,
+    const VkQueryPoolCreateInfo*                pCreateInfo,
+    const VkAllocationCallbacks*                pAllocator,
+    VkQueryPool*                                pQueryPool);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyQueryPool(
+    VkDevice                                    device,
+    VkQueryPool                                 queryPool,
+    const VkAllocationCallbacks*                pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetQueryPoolResults(
+    VkDevice                                    device,
+    VkQueryPool                                 queryPool,
+    uint32_t                                    firstQuery,
+    uint32_t                                    queryCount,
+    size_t                                      dataSize,
+    void*                                       pData,
+    VkDeviceSize                                stride,
+    VkQueryResultFlags                          flags);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateBuffer(
+    VkDevice                                    device,
+    const VkBufferCreateInfo*                   pCreateInfo,
+    const VkAllocationCallbacks*                pAllocator,
+    VkBuffer*                                   pBuffer);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyBuffer(
+    VkDevice                                    device,
+    VkBuffer                                    buffer,
+    const VkAllocationCallbacks*                pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateBufferView(
+    VkDevice                                    device,
+    const VkBufferViewCreateInfo*               pCreateInfo,
+    const VkAllocationCallbacks*                pAllocator,
+    VkBufferView*                               pView);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyBufferView(
+    VkDevice                                    device,
+    VkBufferView                                bufferView,
+    const VkAllocationCallbacks*                pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateImage(
+    VkDevice                                    device,
+    const VkImageCreateInfo*                    pCreateInfo,
+    const VkAllocationCallbacks*                pAllocator,
+    VkImage*                                    pImage);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyImage(
+    VkDevice                                    device,
+    VkImage                                     image,
+    const VkAllocationCallbacks*                pAllocator);
+
+VKAPI_ATTR void VKAPI_CALL vkGetImageSubresourceLayout(
+    VkDevice                                    device,
+    VkImage                                     image,
+    const VkImageSubresource*                   pSubresource,
+    VkSubresourceLayout*                        pLayout);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateImageView(
+    VkDevice                                    device,
+    const VkImageViewCreateInfo*                pCreateInfo,
+    const VkAllocationCallbacks*                pAllocator,
+    VkImageView*                                pView);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyImageView(
+    VkDevice                                    device,
+    VkImageView                                 imageView,
+    const VkAllocationCallbacks*                pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateShaderModule(
+    VkDevice                                    device,
+    const VkShaderModuleCreateInfo*             pCreateInfo,
+    const VkAllocationCallbacks*                pAllocator,
+    VkShaderModule*                             pShaderModule);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyShaderModule(
+    VkDevice                                    device,
+    VkShaderModule                              shaderModule,
+    const VkAllocationCallbacks*                pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineCache(
+    VkDevice                                    device,
+    const VkPipelineCacheCreateInfo*            pCreateInfo,
+    const VkAllocationCallbacks*                pAllocator,
+    VkPipelineCache*                            pPipelineCache);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyPipelineCache(
+    VkDevice                                    device,
+    VkPipelineCache                             pipelineCache,
+    const VkAllocationCallbacks*                pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetPipelineCacheData(
+    VkDevice                                    device,
+    VkPipelineCache                             pipelineCache,
+    size_t*                                     pDataSize,
+    void*                                       pData);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkMergePipelineCaches(
+    VkDevice                                    device,
+    VkPipelineCache                             dstCache,
+    uint32_t                                    srcCacheCount,
+    const VkPipelineCache*                      pSrcCaches);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateGraphicsPipelines(
+    VkDevice                                    device,
+    VkPipelineCache                             pipelineCache,
+    uint32_t                                    createInfoCount,
+    const VkGraphicsPipelineCreateInfo*         pCreateInfos,
+    const VkAllocationCallbacks*                pAllocator,
+    VkPipeline*                                 pPipelines);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateComputePipelines(
+    VkDevice                                    device,
+    VkPipelineCache                             pipelineCache,
+    uint32_t                                    createInfoCount,
+    const VkComputePipelineCreateInfo*          pCreateInfos,
+    const VkAllocationCallbacks*                pAllocator,
+    VkPipeline*                                 pPipelines);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyPipeline(
+    VkDevice                                    device,
+    VkPipeline                                  pipeline,
+    const VkAllocationCallbacks*                pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineLayout(
+    VkDevice                                    device,
+    const VkPipelineLayoutCreateInfo*           pCreateInfo,
+    const VkAllocationCallbacks*                pAllocator,
+    VkPipelineLayout*                           pPipelineLayout);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyPipelineLayout(
+    VkDevice                                    device,
+    VkPipelineLayout                            pipelineLayout,
+    const VkAllocationCallbacks*                pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateSampler(
+    VkDevice                                    device,
+    const VkSamplerCreateInfo*                  pCreateInfo,
+    const VkAllocationCallbacks*                pAllocator,
+    VkSampler*                                  pSampler);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroySampler(
+    VkDevice                                    device,
+    VkSampler                                   sampler,
+    const VkAllocationCallbacks*                pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorSetLayout(
+    VkDevice                                    device,
+    const VkDescriptorSetLayoutCreateInfo*      pCreateInfo,
+    const VkAllocationCallbacks*                pAllocator,
+    VkDescriptorSetLayout*                      pSetLayout);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorSetLayout(
+    VkDevice                                    device,
+    VkDescriptorSetLayout                       descriptorSetLayout,
+    const VkAllocationCallbacks*                pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorPool(
+    VkDevice                                    device,
+    const VkDescriptorPoolCreateInfo*           pCreateInfo,
+    const VkAllocationCallbacks*                pAllocator,
+    VkDescriptorPool*                           pDescriptorPool);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorPool(
+    VkDevice                                    device,
+    VkDescriptorPool                            descriptorPool,
+    const VkAllocationCallbacks*                pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkResetDescriptorPool(
+    VkDevice                                    device,
+    VkDescriptorPool                            descriptorPool,
+    VkDescriptorPoolResetFlags                  flags);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkAllocateDescriptorSets(
+    VkDevice                                    device,
+    const VkDescriptorSetAllocateInfo*          pAllocateInfo,
+    VkDescriptorSet*                            pDescriptorSets);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkFreeDescriptorSets(
+    VkDevice                                    device,
+    VkDescriptorPool                            descriptorPool,
+    uint32_t                                    descriptorSetCount,
+    const VkDescriptorSet*                      pDescriptorSets);
+
+VKAPI_ATTR void VKAPI_CALL vkUpdateDescriptorSets(
+    VkDevice                                    device,
+    uint32_t                                    descriptorWriteCount,
+    const VkWriteDescriptorSet*                 pDescriptorWrites,
+    uint32_t                                    descriptorCopyCount,
+    const VkCopyDescriptorSet*                  pDescriptorCopies);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateFramebuffer(
+    VkDevice                                    device,
+    const VkFramebufferCreateInfo*              pCreateInfo,
+    const VkAllocationCallbacks*                pAllocator,
+    VkFramebuffer*                              pFramebuffer);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyFramebuffer(
+    VkDevice                                    device,
+    VkFramebuffer                               framebuffer,
+    const VkAllocationCallbacks*                pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateRenderPass(
+    VkDevice                                    device,
+    const VkRenderPassCreateInfo*               pCreateInfo,
+    const VkAllocationCallbacks*                pAllocator,
+    VkRenderPass*                               pRenderPass);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyRenderPass(
+    VkDevice                                    device,
+    VkRenderPass                                renderPass,
+    const VkAllocationCallbacks*                pAllocator);
+
+VKAPI_ATTR void VKAPI_CALL vkGetRenderAreaGranularity(
+    VkDevice                                    device,
+    VkRenderPass                                renderPass,
+    VkExtent2D*                                 pGranularity);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateCommandPool(
+    VkDevice                                    device,
+    const VkCommandPoolCreateInfo*              pCreateInfo,
+    const VkAllocationCallbacks*                pAllocator,
+    VkCommandPool*                              pCommandPool);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyCommandPool(
+    VkDevice                                    device,
+    VkCommandPool                               commandPool,
+    const VkAllocationCallbacks*                pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandPool(
+    VkDevice                                    device,
+    VkCommandPool                               commandPool,
+    VkCommandPoolResetFlags                     flags);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkAllocateCommandBuffers(
+    VkDevice                                    device,
+    const VkCommandBufferAllocateInfo*          pAllocateInfo,
+    VkCommandBuffer*                            pCommandBuffers);
+
+VKAPI_ATTR void VKAPI_CALL vkFreeCommandBuffers(
+    VkDevice                                    device,
+    VkCommandPool                               commandPool,
+    uint32_t                                    commandBufferCount,
+    const VkCommandBuffer*                      pCommandBuffers);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkBeginCommandBuffer(
+    VkCommandBuffer                             commandBuffer,
+    const VkCommandBufferBeginInfo*             pBeginInfo);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkEndCommandBuffer(
+    VkCommandBuffer                             commandBuffer);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandBuffer(
+    VkCommandBuffer                             commandBuffer,
+    VkCommandBufferResetFlags                   flags);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdBindPipeline(
+    VkCommandBuffer                             commandBuffer,
+    VkPipelineBindPoint                         pipelineBindPoint,
+    VkPipeline                                  pipeline);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdSetViewport(
+    VkCommandBuffer                             commandBuffer,
+    uint32_t                                    firstViewport,
+    uint32_t                                    viewportCount,
+    const VkViewport*                           pViewports);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdSetScissor(
+    VkCommandBuffer                             commandBuffer,
+    uint32_t                                    firstScissor,
+    uint32_t                                    scissorCount,
+    const VkRect2D*                             pScissors);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdSetLineWidth(
+    VkCommandBuffer                             commandBuffer,
+    float                                       lineWidth);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBias(
+    VkCommandBuffer                             commandBuffer,
+    float                                       depthBiasConstantFactor,
+    float                                       depthBiasClamp,
+    float                                       depthBiasSlopeFactor);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdSetBlendConstants(
+    VkCommandBuffer                             commandBuffer,
+    const float                                 blendConstants[4]);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBounds(
+    VkCommandBuffer                             commandBuffer,
+    float                                       minDepthBounds,
+    float                                       maxDepthBounds);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilCompareMask(
+    VkCommandBuffer                             commandBuffer,
+    VkStencilFaceFlags                          faceMask,
+    uint32_t                                    compareMask);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilWriteMask(
+    VkCommandBuffer                             commandBuffer,
+    VkStencilFaceFlags                          faceMask,
+    uint32_t                                    writeMask);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilReference(
+    VkCommandBuffer                             commandBuffer,
+    VkStencilFaceFlags                          faceMask,
+    uint32_t                                    reference);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdBindDescriptorSets(
+    VkCommandBuffer                             commandBuffer,
+    VkPipelineBindPoint                         pipelineBindPoint,
+    VkPipelineLayout                            layout,
+    uint32_t                                    firstSet,
+    uint32_t                                    descriptorSetCount,
+    const VkDescriptorSet*                      pDescriptorSets,
+    uint32_t                                    dynamicOffsetCount,
+    const uint32_t*                             pDynamicOffsets);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdBindIndexBuffer(
+    VkCommandBuffer                             commandBuffer,
+    VkBuffer                                    buffer,
+    VkDeviceSize                                offset,
+    VkIndexType                                 indexType);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdBindVertexBuffers(
+    VkCommandBuffer                             commandBuffer,
+    uint32_t                                    firstBinding,
+    uint32_t                                    bindingCount,
+    const VkBuffer*                             pBuffers,
+    const VkDeviceSize*                         pOffsets);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdDraw(
+    VkCommandBuffer                             commandBuffer,
+    uint32_t                                    vertexCount,
+    uint32_t                                    instanceCount,
+    uint32_t                                    firstVertex,
+    uint32_t                                    firstInstance);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexed(
+    VkCommandBuffer                             commandBuffer,
+    uint32_t                                    indexCount,
+    uint32_t                                    instanceCount,
+    uint32_t                                    firstIndex,
+    int32_t                                     vertexOffset,
+    uint32_t                                    firstInstance);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirect(
+    VkCommandBuffer                             commandBuffer,
+    VkBuffer                                    buffer,
+    VkDeviceSize                                offset,
+    uint32_t                                    drawCount,
+    uint32_t                                    stride);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirect(
+    VkCommandBuffer                             commandBuffer,
+    VkBuffer                                    buffer,
+    VkDeviceSize                                offset,
+    uint32_t                                    drawCount,
+    uint32_t                                    stride);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdDispatch(
+    VkCommandBuffer                             commandBuffer,
+    uint32_t                                    x,
+    uint32_t                                    y,
+    uint32_t                                    z);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdDispatchIndirect(
+    VkCommandBuffer                             commandBuffer,
+    VkBuffer                                    buffer,
+    VkDeviceSize                                offset);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdCopyBuffer(
+    VkCommandBuffer                             commandBuffer,
+    VkBuffer                                    srcBuffer,
+    VkBuffer                                    dstBuffer,
+    uint32_t                                    regionCount,
+    const VkBufferCopy*                         pRegions);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdCopyImage(
+    VkCommandBuffer                             commandBuffer,
+    VkImage                                     srcImage,
+    VkImageLayout                               srcImageLayout,
+    VkImage                                     dstImage,
+    VkImageLayout                               dstImageLayout,
+    uint32_t                                    regionCount,
+    const VkImageCopy*                          pRegions);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdBlitImage(
+    VkCommandBuffer                             commandBuffer,
+    VkImage                                     srcImage,
+    VkImageLayout                               srcImageLayout,
+    VkImage                                     dstImage,
+    VkImageLayout                               dstImageLayout,
+    uint32_t                                    regionCount,
+    const VkImageBlit*                          pRegions,
+    VkFilter                                    filter);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdCopyBufferToImage(
+    VkCommandBuffer                             commandBuffer,
+    VkBuffer                                    srcBuffer,
+    VkImage                                     dstImage,
+    VkImageLayout                               dstImageLayout,
+    uint32_t                                    regionCount,
+    const VkBufferImageCopy*                    pRegions);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdCopyImageToBuffer(
+    VkCommandBuffer                             commandBuffer,
+    VkImage                                     srcImage,
+    VkImageLayout                               srcImageLayout,
+    VkBuffer                                    dstBuffer,
+    uint32_t                                    regionCount,
+    const VkBufferImageCopy*                    pRegions);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdUpdateBuffer(
+    VkCommandBuffer                             commandBuffer,
+    VkBuffer                                    dstBuffer,
+    VkDeviceSize                                dstOffset,
+    VkDeviceSize                                dataSize,
+    const uint32_t*                             pData);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdFillBuffer(
+    VkCommandBuffer                             commandBuffer,
+    VkBuffer                                    dstBuffer,
+    VkDeviceSize                                dstOffset,
+    VkDeviceSize                                size,
+    uint32_t                                    data);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdClearColorImage(
+    VkCommandBuffer                             commandBuffer,
+    VkImage                                     image,
+    VkImageLayout                               imageLayout,
+    const VkClearColorValue*                    pColor,
+    uint32_t                                    rangeCount,
+    const VkImageSubresourceRange*              pRanges);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdClearDepthStencilImage(
+    VkCommandBuffer                             commandBuffer,
+    VkImage                                     image,
+    VkImageLayout                               imageLayout,
+    const VkClearDepthStencilValue*             pDepthStencil,
+    uint32_t                                    rangeCount,
+    const VkImageSubresourceRange*              pRanges);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdClearAttachments(
+    VkCommandBuffer                             commandBuffer,
+    uint32_t                                    attachmentCount,
+    const VkClearAttachment*                    pAttachments,
+    uint32_t                                    rectCount,
+    const VkClearRect*                          pRects);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdResolveImage(
+    VkCommandBuffer                             commandBuffer,
+    VkImage                                     srcImage,
+    VkImageLayout                               srcImageLayout,
+    VkImage                                     dstImage,
+    VkImageLayout                               dstImageLayout,
+    uint32_t                                    regionCount,
+    const VkImageResolve*                       pRegions);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdSetEvent(
+    VkCommandBuffer                             commandBuffer,
+    VkEvent                                     event,
+    VkPipelineStageFlags                        stageMask);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdResetEvent(
+    VkCommandBuffer                             commandBuffer,
+    VkEvent                                     event,
+    VkPipelineStageFlags                        stageMask);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdWaitEvents(
+    VkCommandBuffer                             commandBuffer,
+    uint32_t                                    eventCount,
+    const VkEvent*                              pEvents,
+    VkPipelineStageFlags                        srcStageMask,
+    VkPipelineStageFlags                        dstStageMask,
+    uint32_t                                    memoryBarrierCount,
+    const VkMemoryBarrier*                      pMemoryBarriers,
+    uint32_t                                    bufferMemoryBarrierCount,
+    const VkBufferMemoryBarrier*                pBufferMemoryBarriers,
+    uint32_t                                    imageMemoryBarrierCount,
+    const VkImageMemoryBarrier*                 pImageMemoryBarriers);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdPipelineBarrier(
+    VkCommandBuffer                             commandBuffer,
+    VkPipelineStageFlags                        srcStageMask,
+    VkPipelineStageFlags                        dstStageMask,
+    VkDependencyFlags                           dependencyFlags,
+    uint32_t                                    memoryBarrierCount,
+    const VkMemoryBarrier*                      pMemoryBarriers,
+    uint32_t                                    bufferMemoryBarrierCount,
+    const VkBufferMemoryBarrier*                pBufferMemoryBarriers,
+    uint32_t                                    imageMemoryBarrierCount,
+    const VkImageMemoryBarrier*                 pImageMemoryBarriers);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdBeginQuery(
+    VkCommandBuffer                             commandBuffer,
+    VkQueryPool                                 queryPool,
+    uint32_t                                    query,
+    VkQueryControlFlags                         flags);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdEndQuery(
+    VkCommandBuffer                             commandBuffer,
+    VkQueryPool                                 queryPool,
+    uint32_t                                    query);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdResetQueryPool(
+    VkCommandBuffer                             commandBuffer,
+    VkQueryPool                                 queryPool,
+    uint32_t                                    firstQuery,
+    uint32_t                                    queryCount);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdWriteTimestamp(
+    VkCommandBuffer                             commandBuffer,
+    VkPipelineStageFlagBits                     pipelineStage,
+    VkQueryPool                                 queryPool,
+    uint32_t                                    query);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdCopyQueryPoolResults(
+    VkCommandBuffer                             commandBuffer,
+    VkQueryPool                                 queryPool,
+    uint32_t                                    firstQuery,
+    uint32_t                                    queryCount,
+    VkBuffer                                    dstBuffer,
+    VkDeviceSize                                dstOffset,
+    VkDeviceSize                                stride,
+    VkQueryResultFlags                          flags);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdPushConstants(
+    VkCommandBuffer                             commandBuffer,
+    VkPipelineLayout                            layout,
+    VkShaderStageFlags                          stageFlags,
+    uint32_t                                    offset,
+    uint32_t                                    size,
+    const void*                                 pValues);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdBeginRenderPass(
+    VkCommandBuffer                             commandBuffer,
+    const VkRenderPassBeginInfo*                pRenderPassBegin,
+    VkSubpassContents                           contents);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdNextSubpass(
+    VkCommandBuffer                             commandBuffer,
+    VkSubpassContents                           contents);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdEndRenderPass(
+    VkCommandBuffer                             commandBuffer);
+
+VKAPI_ATTR void VKAPI_CALL vkCmdExecuteCommands(
+    VkCommandBuffer                             commandBuffer,
+    uint32_t                                    commandBufferCount,
+    const VkCommandBuffer*                      pCommandBuffers);
+#endif
+
+#define VK_KHR_surface 1
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR)
+
+#define VK_KHR_SURFACE_SPEC_VERSION       25
+#define VK_KHR_SURFACE_EXTENSION_NAME     "VK_KHR_surface"
+
+
+typedef enum VkColorSpaceKHR {
+    VK_COLORSPACE_SRGB_NONLINEAR_KHR = 0,
+    VK_COLORSPACE_BEGIN_RANGE = VK_COLORSPACE_SRGB_NONLINEAR_KHR,
+    VK_COLORSPACE_END_RANGE = VK_COLORSPACE_SRGB_NONLINEAR_KHR,
+    VK_COLORSPACE_RANGE_SIZE = (VK_COLORSPACE_SRGB_NONLINEAR_KHR - VK_COLORSPACE_SRGB_NONLINEAR_KHR + 1),
+    VK_COLORSPACE_MAX_ENUM = 0x7FFFFFFF
+} VkColorSpaceKHR;
+
+typedef enum VkPresentModeKHR {
+    VK_PRESENT_MODE_IMMEDIATE_KHR = 0,
+    VK_PRESENT_MODE_MAILBOX_KHR = 1,
+    VK_PRESENT_MODE_FIFO_KHR = 2,
+    VK_PRESENT_MODE_FIFO_RELAXED_KHR = 3,
+    VK_PRESENT_MODE_BEGIN_RANGE = VK_PRESENT_MODE_IMMEDIATE_KHR,
+    VK_PRESENT_MODE_END_RANGE = VK_PRESENT_MODE_FIFO_RELAXED_KHR,
+    VK_PRESENT_MODE_RANGE_SIZE = (VK_PRESENT_MODE_FIFO_RELAXED_KHR - VK_PRESENT_MODE_IMMEDIATE_KHR + 1),
+    VK_PRESENT_MODE_MAX_ENUM = 0x7FFFFFFF
+} VkPresentModeKHR;
+
+
+typedef enum VkSurfaceTransformFlagBitsKHR {
+    VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR = 0x00000001,
+    VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR = 0x00000002,
+    VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR = 0x00000004,
+    VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR = 0x00000008,
+    VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_BIT_KHR = 0x00000010,
+    VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90_BIT_KHR = 0x00000020,
+    VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT_KHR = 0x00000040,
+    VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR = 0x00000080,
+    VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR = 0x00000100,
+} VkSurfaceTransformFlagBitsKHR;
+typedef VkFlags VkSurfaceTransformFlagsKHR;
+
+typedef enum VkCompositeAlphaFlagBitsKHR {
+    VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR = 0x00000001,
+    VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR = 0x00000002,
+    VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR = 0x00000004,
+    VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR = 0x00000008,
+} VkCompositeAlphaFlagBitsKHR;
+typedef VkFlags VkCompositeAlphaFlagsKHR;
+
+typedef struct VkSurfaceCapabilitiesKHR {
+    uint32_t                         minImageCount;
+    uint32_t                         maxImageCount;
+    VkExtent2D                       currentExtent;
+    VkExtent2D                       minImageExtent;
+    VkExtent2D                       maxImageExtent;
+    uint32_t                         maxImageArrayLayers;
+    VkSurfaceTransformFlagsKHR       supportedTransforms;
+    VkSurfaceTransformFlagBitsKHR    currentTransform;
+    VkCompositeAlphaFlagsKHR         supportedCompositeAlpha;
+    VkImageUsageFlags                supportedUsageFlags;
+} VkSurfaceCapabilitiesKHR;
+
+typedef struct VkSurfaceFormatKHR {
+    VkFormat           format;
+    VkColorSpaceKHR    colorSpace;
+} VkSurfaceFormatKHR;
+
+
+typedef void (VKAPI_PTR *PFN_vkDestroySurfaceKHR)(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, VkSurfaceKHR surface, VkBool32* pSupported);
+typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR* pSurfaceCapabilities);
+typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceFormatsKHR)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pSurfaceFormatCount, VkSurfaceFormatKHR* pSurfaceFormats);
+typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfacePresentModesKHR)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pPresentModeCount, VkPresentModeKHR* pPresentModes);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR void VKAPI_CALL vkDestroySurfaceKHR(
+    VkInstance                                  instance,
+    VkSurfaceKHR                                surface,
+    const VkAllocationCallbacks*                pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceSupportKHR(
+    VkPhysicalDevice                            physicalDevice,
+    uint32_t                                    queueFamilyIndex,
+    VkSurfaceKHR                                surface,
+    VkBool32*                                   pSupported);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilitiesKHR(
+    VkPhysicalDevice                            physicalDevice,
+    VkSurfaceKHR                                surface,
+    VkSurfaceCapabilitiesKHR*                   pSurfaceCapabilities);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceFormatsKHR(
+    VkPhysicalDevice                            physicalDevice,
+    VkSurfaceKHR                                surface,
+    uint32_t*                                   pSurfaceFormatCount,
+    VkSurfaceFormatKHR*                         pSurfaceFormats);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfacePresentModesKHR(
+    VkPhysicalDevice                            physicalDevice,
+    VkSurfaceKHR                                surface,
+    uint32_t*                                   pPresentModeCount,
+    VkPresentModeKHR*                           pPresentModes);
+#endif
+
+#define VK_KHR_swapchain 1
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSwapchainKHR)
+
+#define VK_KHR_SWAPCHAIN_SPEC_VERSION     67
+#define VK_KHR_SWAPCHAIN_EXTENSION_NAME   "VK_KHR_swapchain"
+
+typedef VkFlags VkSwapchainCreateFlagsKHR;
+
+typedef struct VkSwapchainCreateInfoKHR {
+    VkStructureType                  sType;
+    const void*                      pNext;
+    VkSwapchainCreateFlagsKHR        flags;
+    VkSurfaceKHR                     surface;
+    uint32_t                         minImageCount;
+    VkFormat                         imageFormat;
+    VkColorSpaceKHR                  imageColorSpace;
+    VkExtent2D                       imageExtent;
+    uint32_t                         imageArrayLayers;
+    VkImageUsageFlags                imageUsage;
+    VkSharingMode                    imageSharingMode;
+    uint32_t                         queueFamilyIndexCount;
+    const uint32_t*                  pQueueFamilyIndices;
+    VkSurfaceTransformFlagBitsKHR    preTransform;
+    VkCompositeAlphaFlagBitsKHR      compositeAlpha;
+    VkPresentModeKHR                 presentMode;
+    VkBool32                         clipped;
+    VkSwapchainKHR                   oldSwapchain;
+} VkSwapchainCreateInfoKHR;
+
+typedef struct VkPresentInfoKHR {
+    VkStructureType          sType;
+    const void*              pNext;
+    uint32_t                 waitSemaphoreCount;
+    const VkSemaphore*       pWaitSemaphores;
+    uint32_t                 swapchainCount;
+    const VkSwapchainKHR*    pSwapchains;
+    const uint32_t*          pImageIndices;
+    VkResult*                pResults;
+} VkPresentInfoKHR;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkCreateSwapchainKHR)(VkDevice device, const VkSwapchainCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSwapchainKHR* pSwapchain);
+typedef void (VKAPI_PTR *PFN_vkDestroySwapchainKHR)(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks* pAllocator);
+typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainImagesKHR)(VkDevice device, VkSwapchainKHR swapchain, uint32_t* pSwapchainImageCount, VkImage* pSwapchainImages);
+typedef VkResult (VKAPI_PTR *PFN_vkAcquireNextImageKHR)(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t* pImageIndex);
+typedef VkResult (VKAPI_PTR *PFN_vkQueuePresentKHR)(VkQueue queue, const VkPresentInfoKHR* pPresentInfo);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateSwapchainKHR(
+    VkDevice                                    device,
+    const VkSwapchainCreateInfoKHR*             pCreateInfo,
+    const VkAllocationCallbacks*                pAllocator,
+    VkSwapchainKHR*                             pSwapchain);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroySwapchainKHR(
+    VkDevice                                    device,
+    VkSwapchainKHR                              swapchain,
+    const VkAllocationCallbacks*                pAllocator);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainImagesKHR(
+    VkDevice                                    device,
+    VkSwapchainKHR                              swapchain,
+    uint32_t*                                   pSwapchainImageCount,
+    VkImage*                                    pSwapchainImages);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkAcquireNextImageKHR(
+    VkDevice                                    device,
+    VkSwapchainKHR                              swapchain,
+    uint64_t                                    timeout,
+    VkSemaphore                                 semaphore,
+    VkFence                                     fence,
+    uint32_t*                                   pImageIndex);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkQueuePresentKHR(
+    VkQueue                                     queue,
+    const VkPresentInfoKHR*                     pPresentInfo);
+#endif
+
+#define VK_KHR_display 1
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDisplayKHR)
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDisplayModeKHR)
+
+#define VK_KHR_DISPLAY_SPEC_VERSION       21
+#define VK_KHR_DISPLAY_EXTENSION_NAME     "VK_KHR_display"
+
+
+typedef enum VkDisplayPlaneAlphaFlagBitsKHR {
+    VK_DISPLAY_PLANE_ALPHA_OPAQUE_BIT_KHR = 0x00000001,
+    VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR = 0x00000002,
+    VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_BIT_KHR = 0x00000004,
+    VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_PREMULTIPLIED_BIT_KHR = 0x00000008,
+} VkDisplayPlaneAlphaFlagBitsKHR;
+typedef VkFlags VkDisplayModeCreateFlagsKHR;
+typedef VkFlags VkDisplayPlaneAlphaFlagsKHR;
+typedef VkFlags VkDisplaySurfaceCreateFlagsKHR;
+
+typedef struct VkDisplayPropertiesKHR {
+    VkDisplayKHR                  display;
+    const char*                   displayName;
+    VkExtent2D                    physicalDimensions;
+    VkExtent2D                    physicalResolution;
+    VkSurfaceTransformFlagsKHR    supportedTransforms;
+    VkBool32                      planeReorderPossible;
+    VkBool32                      persistentContent;
+} VkDisplayPropertiesKHR;
+
+typedef struct VkDisplayModeParametersKHR {
+    VkExtent2D    visibleRegion;
+    uint32_t      refreshRate;
+} VkDisplayModeParametersKHR;
+
+typedef struct VkDisplayModePropertiesKHR {
+    VkDisplayModeKHR              displayMode;
+    VkDisplayModeParametersKHR    parameters;
+} VkDisplayModePropertiesKHR;
+
+typedef struct VkDisplayModeCreateInfoKHR {
+    VkStructureType                sType;
+    const void*                    pNext;
+    VkDisplayModeCreateFlagsKHR    flags;
+    VkDisplayModeParametersKHR     parameters;
+} VkDisplayModeCreateInfoKHR;
+
+typedef struct VkDisplayPlaneCapabilitiesKHR {
+    VkDisplayPlaneAlphaFlagsKHR    supportedAlpha;
+    VkOffset2D                     minSrcPosition;
+    VkOffset2D                     maxSrcPosition;
+    VkExtent2D                     minSrcExtent;
+    VkExtent2D                     maxSrcExtent;
+    VkOffset2D                     minDstPosition;
+    VkOffset2D                     maxDstPosition;
+    VkExtent2D                     minDstExtent;
+    VkExtent2D                     maxDstExtent;
+} VkDisplayPlaneCapabilitiesKHR;
+
+typedef struct VkDisplayPlanePropertiesKHR {
+    VkDisplayKHR    currentDisplay;
+    uint32_t        currentStackIndex;
+} VkDisplayPlanePropertiesKHR;
+
+typedef struct VkDisplaySurfaceCreateInfoKHR {
+    VkStructureType                   sType;
+    const void*                       pNext;
+    VkDisplaySurfaceCreateFlagsKHR    flags;
+    VkDisplayModeKHR                  displayMode;
+    uint32_t                          planeIndex;
+    uint32_t                          planeStackIndex;
+    VkSurfaceTransformFlagBitsKHR     transform;
+    float                             globalAlpha;
+    VkDisplayPlaneAlphaFlagBitsKHR    alphaMode;
+    VkExtent2D                        imageExtent;
+} VkDisplaySurfaceCreateInfoKHR;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceDisplayPropertiesKHR)(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkDisplayPropertiesKHR* pProperties);
+typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR)(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkDisplayPlanePropertiesKHR* pProperties);
+typedef VkResult (VKAPI_PTR *PFN_vkGetDisplayPlaneSupportedDisplaysKHR)(VkPhysicalDevice physicalDevice, uint32_t planeIndex, uint32_t* pDisplayCount, VkDisplayKHR* pDisplays);
+typedef VkResult (VKAPI_PTR *PFN_vkGetDisplayModePropertiesKHR)(VkPhysicalDevice physicalDevice, VkDisplayKHR display, uint32_t* pPropertyCount, VkDisplayModePropertiesKHR* pProperties);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateDisplayModeKHR)(VkPhysicalDevice physicalDevice, VkDisplayKHR display, const VkDisplayModeCreateInfoKHR*pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDisplayModeKHR* pMode);
+typedef VkResult (VKAPI_PTR *PFN_vkGetDisplayPlaneCapabilitiesKHR)(VkPhysicalDevice physicalDevice, VkDisplayModeKHR mode, uint32_t planeIndex, VkDisplayPlaneCapabilitiesKHR* pCapabilities);
+typedef VkResult (VKAPI_PTR *PFN_vkCreateDisplayPlaneSurfaceKHR)(VkInstance instance, const VkDisplaySurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceDisplayPropertiesKHR(
+    VkPhysicalDevice                            physicalDevice,
+    uint32_t*                                   pPropertyCount,
+    VkDisplayPropertiesKHR*                     pProperties);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceDisplayPlanePropertiesKHR(
+    VkPhysicalDevice                            physicalDevice,
+    uint32_t*                                   pPropertyCount,
+    VkDisplayPlanePropertiesKHR*                pProperties);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayPlaneSupportedDisplaysKHR(
+    VkPhysicalDevice                            physicalDevice,
+    uint32_t                                    planeIndex,
+    uint32_t*                                   pDisplayCount,
+    VkDisplayKHR*                               pDisplays);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayModePropertiesKHR(
+    VkPhysicalDevice                            physicalDevice,
+    VkDisplayKHR                                display,
+    uint32_t*                                   pPropertyCount,
+    VkDisplayModePropertiesKHR*                 pProperties);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateDisplayModeKHR(
+    VkPhysicalDevice                            physicalDevice,
+    VkDisplayKHR                                display,
+    const VkDisplayModeCreateInfoKHR*           pCreateInfo,
+    const VkAllocationCallbacks*                pAllocator,
+    VkDisplayModeKHR*                           pMode);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayPlaneCapabilitiesKHR(
+    VkPhysicalDevice                            physicalDevice,
+    VkDisplayModeKHR                            mode,
+    uint32_t                                    planeIndex,
+    VkDisplayPlaneCapabilitiesKHR*              pCapabilities);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateDisplayPlaneSurfaceKHR(
+    VkInstance                                  instance,
+    const VkDisplaySurfaceCreateInfoKHR*        pCreateInfo,
+    const VkAllocationCallbacks*                pAllocator,
+    VkSurfaceKHR*                               pSurface);
+#endif
+
+#define VK_KHR_display_swapchain 1
+#define VK_KHR_DISPLAY_SWAPCHAIN_SPEC_VERSION 9
+#define VK_KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME "VK_KHR_display_swapchain"
+
+typedef struct VkDisplayPresentInfoKHR {
+    VkStructureType    sType;
+    const void*        pNext;
+    VkRect2D           srcRect;
+    VkRect2D           dstRect;
+    VkBool32           persistent;
+} VkDisplayPresentInfoKHR;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkCreateSharedSwapchainsKHR)(VkDevice device, uint32_t swapchainCount, const VkSwapchainCreateInfoKHR* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkSwapchainKHR* pSwapchains);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateSharedSwapchainsKHR(
+    VkDevice                                    device,
+    uint32_t                                    swapchainCount,
+    const VkSwapchainCreateInfoKHR*             pCreateInfos,
+    const VkAllocationCallbacks*                pAllocator,
+    VkSwapchainKHR*                             pSwapchains);
+#endif
+
+#ifdef VK_USE_PLATFORM_XLIB_KHR
+#define VK_KHR_xlib_surface 1
+#include <X11/Xlib.h>
+
+#define VK_KHR_XLIB_SURFACE_SPEC_VERSION  6
+#define VK_KHR_XLIB_SURFACE_EXTENSION_NAME "VK_KHR_xlib_surface"
+
+typedef VkFlags VkXlibSurfaceCreateFlagsKHR;
+
+typedef struct VkXlibSurfaceCreateInfoKHR {
+    VkStructureType                sType;
+    const void*                    pNext;
+    VkXlibSurfaceCreateFlagsKHR    flags;
+    Display*                       dpy;
+    Window                         window;
+} VkXlibSurfaceCreateInfoKHR;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkCreateXlibSurfaceKHR)(VkInstance instance, const VkXlibSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
+typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, Display* dpy, VisualID visualID);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateXlibSurfaceKHR(
+    VkInstance                                  instance,
+    const VkXlibSurfaceCreateInfoKHR*           pCreateInfo,
+    const VkAllocationCallbacks*                pAllocator,
+    VkSurfaceKHR*                               pSurface);
+
+VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXlibPresentationSupportKHR(
+    VkPhysicalDevice                            physicalDevice,
+    uint32_t                                    queueFamilyIndex,
+    Display*                                    dpy,
+    VisualID                                    visualID);
+#endif
+#endif /* VK_USE_PLATFORM_XLIB_KHR */
+
+#ifdef VK_USE_PLATFORM_XCB_KHR
+#define VK_KHR_xcb_surface 1
+#include <xcb/xcb.h>
+
+#define VK_KHR_XCB_SURFACE_SPEC_VERSION   6
+#define VK_KHR_XCB_SURFACE_EXTENSION_NAME "VK_KHR_xcb_surface"
+
+typedef VkFlags VkXcbSurfaceCreateFlagsKHR;
+
+typedef struct VkXcbSurfaceCreateInfoKHR {
+    VkStructureType               sType;
+    const void*                   pNext;
+    VkXcbSurfaceCreateFlagsKHR    flags;
+    xcb_connection_t*             connection;
+    xcb_window_t                  window;
+} VkXcbSurfaceCreateInfoKHR;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkCreateXcbSurfaceKHR)(VkInstance instance, const VkXcbSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
+typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, xcb_connection_t* connection, xcb_visualid_t visual_id);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateXcbSurfaceKHR(
+    VkInstance                                  instance,
+    const VkXcbSurfaceCreateInfoKHR*            pCreateInfo,
+    const VkAllocationCallbacks*                pAllocator,
+    VkSurfaceKHR*                               pSurface);
+
+VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXcbPresentationSupportKHR(
+    VkPhysicalDevice                            physicalDevice,
+    uint32_t                                    queueFamilyIndex,
+    xcb_connection_t*                           connection,
+    xcb_visualid_t                              visual_id);
+#endif
+#endif /* VK_USE_PLATFORM_XCB_KHR */
+
+#ifdef VK_USE_PLATFORM_WAYLAND_KHR
+#define VK_KHR_wayland_surface 1
+#include <wayland-client.h>
+
+#define VK_KHR_WAYLAND_SURFACE_SPEC_VERSION 5
+#define VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME "VK_KHR_wayland_surface"
+
+typedef VkFlags VkWaylandSurfaceCreateFlagsKHR;
+
+typedef struct VkWaylandSurfaceCreateInfoKHR {
+    VkStructureType                   sType;
+    const void*                       pNext;
+    VkWaylandSurfaceCreateFlagsKHR    flags;
+    struct wl_display*                display;
+    struct wl_surface*                surface;
+} VkWaylandSurfaceCreateInfoKHR;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkCreateWaylandSurfaceKHR)(VkInstance instance, const VkWaylandSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
+typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, struct wl_display* display);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateWaylandSurfaceKHR(
+    VkInstance                                  instance,
+    const VkWaylandSurfaceCreateInfoKHR*        pCreateInfo,
+    const VkAllocationCallbacks*                pAllocator,
+    VkSurfaceKHR*                               pSurface);
+
+VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWaylandPresentationSupportKHR(
+    VkPhysicalDevice                            physicalDevice,
+    uint32_t                                    queueFamilyIndex,
+    struct wl_display*                          display);
+#endif
+#endif /* VK_USE_PLATFORM_WAYLAND_KHR */
+
+#ifdef VK_USE_PLATFORM_MIR_KHR
+#define VK_KHR_mir_surface 1
+#include <mir_toolkit/client_types.h>
+
+#define VK_KHR_MIR_SURFACE_SPEC_VERSION   4
+#define VK_KHR_MIR_SURFACE_EXTENSION_NAME "VK_KHR_mir_surface"
+
+typedef VkFlags VkMirSurfaceCreateFlagsKHR;
+
+typedef struct VkMirSurfaceCreateInfoKHR {
+    VkStructureType               sType;
+    const void*                   pNext;
+    VkMirSurfaceCreateFlagsKHR    flags;
+    MirConnection*                connection;
+    MirSurface*                   mirSurface;
+} VkMirSurfaceCreateInfoKHR;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkCreateMirSurfaceKHR)(VkInstance instance, const VkMirSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
+typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceMirPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, MirConnection* connection);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateMirSurfaceKHR(
+    VkInstance                                  instance,
+    const VkMirSurfaceCreateInfoKHR*            pCreateInfo,
+    const VkAllocationCallbacks*                pAllocator,
+    VkSurfaceKHR*                               pSurface);
+
+VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceMirPresentationSupportKHR(
+    VkPhysicalDevice                            physicalDevice,
+    uint32_t                                    queueFamilyIndex,
+    MirConnection*                              connection);
+#endif
+#endif /* VK_USE_PLATFORM_MIR_KHR */
+
+#ifdef VK_USE_PLATFORM_ANDROID_KHR
+#define VK_KHR_android_surface 1
+#include <android/native_window.h>
+
+#define VK_KHR_ANDROID_SURFACE_SPEC_VERSION 6
+#define VK_KHR_ANDROID_SURFACE_EXTENSION_NAME "VK_KHR_android_surface"
+
+typedef VkFlags VkAndroidSurfaceCreateFlagsKHR;
+
+typedef struct VkAndroidSurfaceCreateInfoKHR {
+    VkStructureType                   sType;
+    const void*                       pNext;
+    VkAndroidSurfaceCreateFlagsKHR    flags;
+    ANativeWindow*                    window;
+} VkAndroidSurfaceCreateInfoKHR;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkCreateAndroidSurfaceKHR)(VkInstance instance, const VkAndroidSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateAndroidSurfaceKHR(
+    VkInstance                                  instance,
+    const VkAndroidSurfaceCreateInfoKHR*        pCreateInfo,
+    const VkAllocationCallbacks*                pAllocator,
+    VkSurfaceKHR*                               pSurface);
+#endif
+#endif /* VK_USE_PLATFORM_ANDROID_KHR */
+
+#ifdef VK_USE_PLATFORM_WIN32_KHR
+#define VK_KHR_win32_surface 1
+#include <windows.h>
+
+#define VK_KHR_WIN32_SURFACE_SPEC_VERSION 5
+#define VK_KHR_WIN32_SURFACE_EXTENSION_NAME "VK_KHR_win32_surface"
+
+typedef VkFlags VkWin32SurfaceCreateFlagsKHR;
+
+typedef struct VkWin32SurfaceCreateInfoKHR {
+    VkStructureType                 sType;
+    const void*                     pNext;
+    VkWin32SurfaceCreateFlagsKHR    flags;
+    HINSTANCE                       hinstance;
+    HWND                            hwnd;
+} VkWin32SurfaceCreateInfoKHR;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkCreateWin32SurfaceKHR)(VkInstance instance, const VkWin32SurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
+typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateWin32SurfaceKHR(
+    VkInstance                                  instance,
+    const VkWin32SurfaceCreateInfoKHR*          pCreateInfo,
+    const VkAllocationCallbacks*                pAllocator,
+    VkSurfaceKHR*                               pSurface);
+
+VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWin32PresentationSupportKHR(
+    VkPhysicalDevice                            physicalDevice,
+    uint32_t                                    queueFamilyIndex);
+#endif
+#endif /* VK_USE_PLATFORM_WIN32_KHR */
+
+#define VK_EXT_debug_report 1
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDebugReportCallbackEXT)
+
+#define VK_EXT_DEBUG_REPORT_SPEC_VERSION  1
+#define VK_EXT_DEBUG_REPORT_EXTENSION_NAME "VK_EXT_debug_report"
+
+
+typedef enum VkDebugReportObjectTypeEXT {
+    VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT = 0,
+    VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT = 1,
+    VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT = 2,
+    VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT = 3,
+    VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT = 4,
+    VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT = 5,
+    VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT = 6,
+    VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT = 7,
+    VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT = 8,
+    VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT = 9,
+    VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT = 10,
+    VK_DEBUG_REPORT_OBJECT_TYPE_EVENT_EXT = 11,
+    VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT = 12,
+    VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_VIEW_EXT = 13,
+    VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_VIEW_EXT = 14,
+    VK_DEBUG_REPORT_OBJECT_TYPE_SHADER_MODULE_EXT = 15,
+    VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_CACHE_EXT = 16,
+    VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_LAYOUT_EXT = 17,
+    VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT = 18,
+    VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT = 19,
+    VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT_EXT = 20,
+    VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_EXT = 21,
+    VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT = 22,
+    VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT = 23,
+    VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT = 24,
+    VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_POOL_EXT = 25,
+    VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT = 26,
+    VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT = 27,
+    VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_EXT = 28,
+} VkDebugReportObjectTypeEXT;
+
+typedef enum VkDebugReportErrorEXT {
+    VK_DEBUG_REPORT_ERROR_NONE_EXT = 0,
+    VK_DEBUG_REPORT_ERROR_CALLBACK_REF_EXT = 1,
+} VkDebugReportErrorEXT;
+
+
+typedef enum VkDebugReportFlagBitsEXT {
+    VK_DEBUG_REPORT_INFORMATION_BIT_EXT = 0x00000001,
+    VK_DEBUG_REPORT_WARNING_BIT_EXT = 0x00000002,
+    VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT = 0x00000004,
+    VK_DEBUG_REPORT_ERROR_BIT_EXT = 0x00000008,
+    VK_DEBUG_REPORT_DEBUG_BIT_EXT = 0x00000010,
+} VkDebugReportFlagBitsEXT;
+typedef VkFlags VkDebugReportFlagsEXT;
+
+typedef VkBool32 (VKAPI_PTR *PFN_vkDebugReportCallbackEXT)(
+    VkDebugReportFlagsEXT                       flags,
+    VkDebugReportObjectTypeEXT                  objectType,
+    uint64_t                                    object,
+    size_t                                      location,
+    int32_t                                     messageCode,
+    const char*                                 pLayerPrefix,
+    const char*                                 pMessage,
+    void*                                       pUserData);
+
+
+typedef struct VkDebugReportCallbackCreateInfoEXT {
+    VkStructureType                 sType;
+    const void*                     pNext;
+    VkDebugReportFlagsEXT           flags;
+    PFN_vkDebugReportCallbackEXT    pfnCallback;
+    void*                           pUserData;
+} VkDebugReportCallbackCreateInfoEXT;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkCreateDebugReportCallbackEXT)(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDebugReportCallbackEXT* pCallback);
+typedef void (VKAPI_PTR *PFN_vkDestroyDebugReportCallbackEXT)(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks* pAllocator);
+typedef void (VKAPI_PTR *PFN_vkDebugReportMessageEXT)(VkInstance instance, VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char* pLayerPrefix, const char* pMessage);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateDebugReportCallbackEXT(
+    VkInstance                                  instance,
+    const VkDebugReportCallbackCreateInfoEXT*   pCreateInfo,
+    const VkAllocationCallbacks*                pAllocator,
+    VkDebugReportCallbackEXT*                   pCallback);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyDebugReportCallbackEXT(
+    VkInstance                                  instance,
+    VkDebugReportCallbackEXT                    callback,
+    const VkAllocationCallbacks*                pAllocator);
+
+VKAPI_ATTR void VKAPI_CALL vkDebugReportMessageEXT(
+    VkInstance                                  instance,
+    VkDebugReportFlagsEXT                       flags,
+    VkDebugReportObjectTypeEXT                  objectType,
+    uint64_t                                    object,
+    size_t                                      location,
+    int32_t                                     messageCode,
+    const char*                                 pLayerPrefix,
+    const char*                                 pMessage);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index b7615c8..464cf491 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -3341,6 +3341,14 @@
   </summary>
 </histogram>
 
+<histogram name="Blink.MediaDocument.DownloadButton"
+    enum="MediaDocumentDownloadButtonType">
+  <owner>qinmin@chromium.org</owner>
+  <summary>
+    Records how the download button on the MediaDocument is used.
+  </summary>
+</histogram>
+
 <histogram name="Blink.MediaElement.Autoplay" enum="MediaElementAutoPlay">
   <owner>oysteine@chromium.org</owner>
   <summary>
@@ -41382,6 +41390,15 @@
   </summary>
 </histogram>
 
+<histogram name="Renderer.ViewportZoomBugCount" enum="BooleanHit">
+  <owner>kkhorimoto@chromium.org</owner>
+  <summary>
+    [iOS] A boolean that is used to indicate that the WebKit rendering bug in
+    http://crbug.com/583231 has occurred. This occurs when a page with no
+    viewport tag is rendered with an unusable zoom scale. Only logged on iOS.
+  </summary>
+</histogram>
+
 <histogram name="Renderer2.FinishDocToFinish">
   <owner>Please list the metric's owners. Add more owner tags as needed.</owner>
   <summary>
@@ -75811,6 +75828,11 @@
   <int value="3" label="Not shown"/>
 </enum>
 
+<enum name="MediaDocumentDownloadButtonType" type="int">
+  <int value="0" label="Shown"/>
+  <int value="1" label="Clicked"/>
+</enum>
+
 <enum name="MediaElementAutoPlay" type="int">
   <int value="0" label="Media element with autoplay seen"/>
   <int value="1"
@@ -82839,6 +82861,11 @@
       label="Connection established in response to CONNECT request was
              abnormally closed"/>
   <int value="34" label="Peer exhibiting suspect behavior."/>
+  <int value="35" label="Inadequate security."/>
+  <int value="36" label="HTTP/1.1 required."/>
+<!-- More SpdyFramer::SpdyErrors -->
+
+  <int value="37" label="Invalid control frame size."/>
 </enum>
 
 <enum name="SpdyProtocolVersion" type="int">
diff --git a/tools/perf/benchmarks/benchmark_smoke_unittest.py b/tools/perf/benchmarks/benchmark_smoke_unittest.py
index f19d1d2..898f895d3 100644
--- a/tools/perf/benchmarks/benchmark_smoke_unittest.py
+++ b/tools/perf/benchmarks/benchmark_smoke_unittest.py
@@ -30,6 +30,7 @@
 from benchmarks import speedometer
 from benchmarks import sunspider
 from benchmarks import text_selection
+from benchmarks import tracing
 
 
 def SmokeTestGenerator(benchmark):
@@ -86,7 +87,7 @@
     speedometer,  # Takes 101 seconds.
     jetstream,  # Take 206 seconds.
     text_selection,  # Always fails on cq bot.
-    memory  # Flaky on bots, crbug.com/513767
+    memory  # Flaky on bots, crbug.com/513767.
 }
 
 # Some smoke benchmark tests that run quickly on desktop platform can be very
@@ -94,6 +95,7 @@
 _ANDROID_BLACK_LIST_MODULES = {
     kraken,  # Takes 275 seconds on Android.
     sunspider,  # Takes 163 seconds on Android.
+    tracing,  # Failed on Android bot, crbug.com/600989.
 }
 
 
diff --git a/tools/perf/benchmarks/tracing.py b/tools/perf/benchmarks/tracing.py
index 4c863dc..95cc44d 100644
--- a/tools/perf/benchmarks/tracing.py
+++ b/tools/perf/benchmarks/tracing.py
@@ -7,10 +7,8 @@
 from telemetry.web_perf import timeline_based_measurement
 
 import page_sets
-from telemetry import benchmark
 
 
-@benchmark.Disabled('android')
 class TracingWithDebugOverhead(perf_benchmark.PerfBenchmark):
 
   page_set = page_sets.Top10PageSet
diff --git a/tools/perf/core/stacktrace_unittest.py b/tools/perf/core/stacktrace_unittest.py
index 7d63db1..59baa655 100644
--- a/tools/perf/core/stacktrace_unittest.py
+++ b/tools/perf/core/stacktrace_unittest.py
@@ -2,6 +2,9 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
+import tempfile
+import os
+
 from telemetry.core import exceptions
 from telemetry import decorators
 from telemetry.testing import tab_test_case
@@ -18,10 +21,9 @@
   # disabled shortly so just disable it for now.
   @decorators.Disabled('snowleopard')
   def testStackTrace(self):
-    try:
+    with self.assertRaises(exceptions.DevtoolsTargetCrashException) as c:
       self._tab.Navigate('chrome://crash', timeout=5)
-    except exceptions.DevtoolsTargetCrashException as e:
-      self.assertIn('Thread 0 (crashed)', '\n'.join(e.stack_trace))
+      self.assertIn('Thread 0 (crashed)', '\n'.join(c.exception.stack_trace))
 
   # Stack traces aren't working on Android yet.
   # TODO(kbr): this test doesn't work on the Windows Swarming bots
@@ -29,7 +31,36 @@
   @decorators.Enabled('mac', 'linux')
   @decorators.Disabled('snowleopard')
   def testCrashSymbols(self):
-    try:
+    with self.assertRaises(exceptions.DevtoolsTargetCrashException) as c:
       self._tab.Navigate('chrome://crash', timeout=5)
-    except exceptions.DevtoolsTargetCrashException as e:
-      self.assertIn('CrashIntentionally', '\n'.join(e.stack_trace))
+      self.assertIn('CrashIntentionally', '\n'.join(c.exception.stack_trace))
+
+  # The breakpad file specific test only apply to platforms which use the
+  # breakpad symbol format. This also must be tested in isolation because it can
+  # potentially interfere with other tests symbol parsing.
+  @decorators.Enabled('mac', 'linux')
+  @decorators.Isolated
+  def testBadBreakpadFileIgnored(self):
+    # pylint: disable=protected-access
+    executable_path = self._browser._browser_backend._executable
+    executable = os.path.basename(executable_path)
+    with tempfile.NamedTemporaryFile(mode='wt',
+                                     dir=os.path.dirname(executable_path),
+                                     prefix=executable + '.breakpad',
+                                     delete=True) as f:
+      # Do not write anything to file, it will just be an invalid empty file.
+      f.flush()
+      with self.assertRaises(exceptions.DevtoolsTargetCrashException) as c:
+        self._tab.Navigate('chrome://crash', timeout=5)
+        # The symbol directory should now contain our breakpad file.
+        tmp_dir = os.path.join(self._browser._browser_backend._tmp_minidump_dir)
+
+        # Symbol directory should have been created.
+        symbol_dir = os.path.join(tmp_dir, 'symbols', executable)
+        self.assertTrue(os.path.isdir(symbol_dir))
+
+        # A single symbol file should still exist here.
+        self.assertEqual(1, len(os.listdir(symbol_dir)))
+
+        # Stack trace should still work.
+        self.assertIn('CrashIntentionally', '\n'.join(c.exception.stack_trace))
diff --git a/tools/roll_webgl_conformance.py b/tools/roll_webgl_conformance.py
index cc41bf1..7ea056f 100755
--- a/tools/roll_webgl_conformance.py
+++ b/tools/roll_webgl_conformance.py
@@ -229,7 +229,7 @@
     readme.write(m)
     readme.truncate()
 
-  def PrepareRoll(self, ignore_checks):
+  def PrepareRoll(self, ignore_checks, skip_tryjobs):
     # TODO(kjellander): use os.path.normcase, os.path.join etc for all paths for
     # cross platform compatibility.
 
@@ -280,20 +280,20 @@
       self._RunCommand(['git', 'cl', 'upload'],
                        extra_env={'EDITOR': 'true'})
 
-      # Kick off tryjobs.
-      base_try_cmd = ['git', 'cl', 'try']
-      self._RunCommand(base_try_cmd)
-
-      if extra_trybots:
-        # Run additional tryjobs.
-        # TODO(kbr): this should not be necessary -- the
-        # CQ_INCLUDE_TRYBOTS directive above should handle it.
-        # http://crbug.com/585237
-        for trybot in extra_trybots:
-          for builder in trybot['buildernames']:
-            self._RunCommand(base_try_cmd + [
-                '-m', trybot['mastername'],
-                '-b', builder])
+      if not skip_tryjobs:
+        # Kick off tryjobs.
+        base_try_cmd = ['git', 'cl', 'try']
+        self._RunCommand(base_try_cmd)
+        if extra_trybots:
+          # Run additional tryjobs.
+          # TODO(kbr): this should not be necessary -- the
+          # CQ_INCLUDE_TRYBOTS directive above should handle it.
+          # http://crbug.com/585237
+          for trybot in extra_trybots:
+            for builder in trybot['buildernames']:
+              self._RunCommand(base_try_cmd + [
+                  '-m', trybot['mastername'],
+                  '-b', builder])
 
       cl_info = self._GetCLInfo()
       print 'Issue: %d URL: %s' % (cl_info.issue, cl_info.url)
@@ -365,6 +365,11 @@
       help=('Skips checks for being on the master branch, dirty workspaces and '
             'the updating of the checkout. Will still delete and create local '
             'Git branches.'))
+  parser.add_argument('--skip-tryjobs', action='store_true', default=False,
+      help=('Skip the dry-run tryjobs for the newly generated CL. Use this '
+            'when you expect to have to make many changes to the WebGL '
+            'conformance test expectations in the same CL and want to avoid '
+            'wasted tryjobs.'))
   parser.add_argument('-v', '--verbose', action='store_true', default=False,
       help='Be extra verbose in printing of log messages.')
   args = parser.parse_args()
@@ -378,7 +383,7 @@
   if args.abort:
     return autoroller.Abort()
   else:
-    return autoroller.PrepareRoll(args.ignore_checks)
+    return autoroller.PrepareRoll(args.ignore_checks, args.skip_tryjobs)
 
 if __name__ == '__main__':
   sys.exit(main())
diff --git a/ui/android/java/src/org/chromium/ui/widget/TextViewWithClickableSpans.java b/ui/android/java/src/org/chromium/ui/widget/TextViewWithClickableSpans.java
index e7587e9d..d8f5fbf 100644
--- a/ui/android/java/src/org/chromium/ui/widget/TextViewWithClickableSpans.java
+++ b/ui/android/java/src/org/chromium/ui/widget/TextViewWithClickableSpans.java
@@ -4,6 +4,7 @@
 
 package org.chromium.ui.widget;
 
+import android.annotation.SuppressLint;
 import android.content.Context;
 import android.os.Bundle;
 import android.text.Layout;
@@ -78,6 +79,7 @@
     }
 
     @Override
+    @SuppressLint("ClickableViewAccessibility")
     public boolean onTouchEvent(MotionEvent event) {
         boolean superResult = super.onTouchEvent(event);
 
diff --git a/ui/app_list/BUILD.gn b/ui/app_list/BUILD.gn
index b90ba0e69..ef310d1 100644
--- a/ui/app_list/BUILD.gn
+++ b/ui/app_list/BUILD.gn
@@ -282,11 +282,6 @@
     "test/run_all_unittests.cc",
   ]
 
-  # TODO: Add to data_deps instead once GN has rolled past #339778.
-  data = [
-    "$root_out_dir/ui_test.pak",
-  ]
-
   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
 
   deps = [
@@ -302,11 +297,11 @@
     "//ui/gfx:test_support",
     "//ui/gl:test_support",
     "//ui/resources",
-    "//ui/resources:ui_test_pak",
   ]
 
   data_deps = [
     "//third_party/mesa:osmesa",
+    "//ui/resources:ui_test_pak_data",
   ]
 
   if (toolkit_views) {
diff --git a/ui/app_list/shower/BUILD.gn b/ui/app_list/shower/BUILD.gn
new file mode 100644
index 0000000..d573fd2
--- /dev/null
+++ b/ui/app_list/shower/BUILD.gn
@@ -0,0 +1,71 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//testing/test.gni")
+import("//build/config/ui.gni")
+
+assert(use_aura)
+
+component("shower") {
+  sources = [
+    "app_list_shower.h",
+    "app_list_shower_delegate.h",
+    "app_list_shower_delegate_factory.h",
+    "app_list_shower_export.h",
+    "app_list_shower_impl.cc",
+    "app_list_shower_impl.h",
+  ]
+
+  defines = [ "APP_LIST_SHOWER_IMPLEMENTATION" ]
+
+  public_deps = [
+    "//base",
+    "//ui/app_list",
+    "//ui/aura",
+    "//ui/compositor",
+    "//ui/gfx/geometry",
+    "//ui/views",
+  ]
+}
+
+source_set("test_support") {
+  sources = [
+    "test/app_list_shower_impl_test_api.cc",
+    "test/app_list_shower_impl_test_api.h",
+  ]
+
+  public_deps = [
+    ":shower",
+  ]
+  deps = [
+    "//base",
+  ]
+}
+
+test("app_list_shower_unittests") {
+  sources = [
+    "app_list_shower_impl_unittest.cc",
+    "test/run_all_unittests.cc",
+  ]
+
+  configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
+
+  deps = [
+    ":shower",
+    ":test_support",
+    "//base",
+    "//base/test:test_support",
+    "//testing/gtest",
+    "//ui/app_list:test_support",
+    "//ui/aura:aura",
+    "//ui/aura:test_support",
+    "//ui/base",
+    "//ui/gl:test_support",
+    "//ui/wm:wm",
+  ]
+
+  data_deps = [
+    "//ui/resources:ui_test_pak_data",
+  ]
+}
diff --git a/ui/app_list/shower/app_list_shower.gyp b/ui/app_list/shower/app_list_shower.gyp
new file mode 100644
index 0000000..1d342622
--- /dev/null
+++ b/ui/app_list/shower/app_list_shower.gyp
@@ -0,0 +1,107 @@
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+  'variables': {
+    'chromium_code': 1,
+  },
+  'targets': [
+    {
+      # GN version: //ui/app_list/shower
+      'target_name': 'app_list_shower',
+      'type': '<(component)',
+      'dependencies': [
+        '../../../base/base.gyp:base',
+        '../../../skia/skia.gyp:skia',
+        '../../aura/aura.gyp:aura',
+        '../../compositor/compositor.gyp:compositor',
+        '../../events/events.gyp:events_base',
+        '../../events/events.gyp:events',
+        '../../gfx/gfx.gyp:gfx_geometry',
+        '../../views/views.gyp:views',
+        '../app_list.gyp:app_list',
+      ],
+      'defines': [
+        'APP_LIST_SHOWER_IMPLEMENTATION',
+      ],
+      'sources': [
+        # Note: sources list duplicated in GN build.
+        'app_list_shower.h',
+        'app_list_shower_delegate.h',
+        'app_list_shower_delegate_factory.h',
+        'app_list_shower_export.h',
+        'app_list_shower_impl.cc',
+        'app_list_shower_impl.h',
+      ],
+      # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
+      'msvs_disabled_warnings': [ 4267, ],
+    },
+    {
+      # GN version: //ui/app_list/shower:test_support
+      'target_name': 'app_list_shower_test_support',
+      'type': 'static_library',
+      'dependencies': [
+        '../../../base/base.gyp:base',
+        '../../../skia/skia.gyp:skia',
+        'app_list_shower',
+      ],
+      'sources': [
+        # Note: sources list duplicated in GN build.
+        'test/app_list_shower_impl_test_api.cc',
+        'test/app_list_shower_impl_test_api.h',
+      ],
+    },
+    {
+      # GN version: //ui/app_list/shower:app_list_shower_unittests
+      'target_name': 'app_list_shower_unittests',
+      'type': 'executable',
+      'dependencies': [
+        '../../../base/base.gyp:base',
+        '../../../base/base.gyp:test_support_base',
+        '../../../skia/skia.gyp:skia',
+        '../../../testing/gtest.gyp:gtest',
+        '../../aura/aura.gyp:aura_test_support',
+        '../../resources/ui_resources.gyp:ui_test_pak',
+        '../../views/views.gyp:views',
+        '../../wm/wm.gyp:wm',
+        '../app_list.gyp:app_list_test_support',
+        'app_list_shower',
+        'app_list_shower_test_support',
+      ],
+      'sources': [
+        # Note: sources list duplicated in GN build.
+        'app_list_shower_impl_unittest.cc',
+        'test/run_all_unittests.cc',
+      ],
+      # Disable c4267 warnings until we fix size_t to int truncations.
+      'msvs_disabled_warnings': [ 4267, ],
+    },
+  ],
+  'conditions': [
+    ['test_isolation_mode != "noop"', {
+      'targets': [
+        {
+          'target_name': 'app_list_shower_unittests_run',
+          'type': 'none',
+          'dependencies': [
+            'app_list_shower_unittests',
+          ],
+          'includes': [
+            '../../../build/isolate.gypi',
+          ],
+          'sources': [
+            'app_list_shower_unittests.isolate',
+          ],
+          'conditions': [
+            ['use_x11 == 1', {
+              'dependencies': [
+                '../../../tools/xdisplaycheck/xdisplaycheck.gyp:xdisplaycheck',
+              ],
+            }],
+          ],
+        },
+      ],
+    }],
+  ],
+}
diff --git a/ui/app_list/shower/app_list_shower.h b/ui/app_list/shower/app_list_shower.h
new file mode 100644
index 0000000..ac94a4a
--- /dev/null
+++ b/ui/app_list/shower/app_list_shower.h
@@ -0,0 +1,40 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_APP_LIST_SHOWER_APP_LIST_SHOWER_H_
+#define UI_APP_LIST_SHOWER_APP_LIST_SHOWER_H_
+
+#include "ui/app_list/shower/app_list_shower_export.h"
+
+namespace aura {
+class Window;
+}
+
+namespace app_list {
+
+// Interface for showing and hiding the app list.
+class APP_LIST_SHOWER_EXPORT AppListShower {
+ public:
+  virtual ~AppListShower() {}
+
+  // Show/hide app list window. The |window| is used to deterime in
+  // which display (in which the |window| exists) the app list should
+  // be shown.
+  virtual void Show(aura::Window* window) = 0;
+
+  // Invoked to dismiss app list. This may leave the view open but hidden from
+  // the user.
+  virtual void Dismiss() = 0;
+
+  // Whether the app list's aura::Window is currently visible.
+  virtual bool IsVisible() const = 0;
+
+  // Returns target visibility. This may differ from IsVisible() if a
+  // visibility transition is in progress.
+  virtual bool GetTargetVisibility() const = 0;
+};
+
+}  // namespace app_list
+
+#endif  // UI_APP_LIST_SHOWER_APP_LIST_SHOWER_H_
diff --git a/ui/app_list/shower/app_list_shower_delegate.h b/ui/app_list/shower/app_list_shower_delegate.h
new file mode 100644
index 0000000..76b35731
--- /dev/null
+++ b/ui/app_list/shower/app_list_shower_delegate.h
@@ -0,0 +1,55 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_APP_LIST_SHOWER_APP_LIST_SHOWER_DELEGATE_H_
+#define UI_APP_LIST_SHOWER_APP_LIST_SHOWER_DELEGATE_H_
+
+#include "ui/app_list/shower/app_list_shower_export.h"
+
+namespace aura {
+class Window;
+}
+
+namespace gfx {
+class Vector2d;
+}
+
+namespace app_list {
+
+class AppListView;
+class AppListViewDelegate;
+
+// Delegate of AppListShower which allows to customize AppListShower's behavior.
+// The design of this interface was heavily influenced by the needs of Ash's
+// app list implementation (see ash::AppListShowerDelegate).
+class APP_LIST_SHOWER_EXPORT AppListShowerDelegate {
+ public:
+  virtual ~AppListShowerDelegate() {}
+
+  // Returns the delegate for the app list view, possibly creating one.
+  virtual AppListViewDelegate* GetViewDelegate() = 0;
+
+  // Called to initialize the layout of the app list.
+  virtual void Init(AppListView* view,
+                    aura::Window* root_window,
+                    int current_apps_page) = 0;
+
+  // Called when app list is shown.
+  virtual void OnShown(aura::Window* root_window) = 0;
+
+  // Called when app list is dismissed
+  virtual void OnDismissed() = 0;
+
+  // Update app list bounds if necessary.
+  virtual void UpdateBounds() = 0;
+
+  // Returns the offset vector by which the app list window should animate
+  // when it gets hidden.
+  virtual gfx::Vector2d GetVisibilityAnimationOffset(
+      aura::Window* root_window) = 0;
+};
+
+}  // namespace app_list
+
+#endif  // UI_APP_LIST_SHOWER_APP_LIST_SHOWER_DELEGATE_H_
diff --git a/ui/app_list/shower/app_list_shower_delegate_factory.h b/ui/app_list/shower/app_list_shower_delegate_factory.h
new file mode 100644
index 0000000..2c3d09e
--- /dev/null
+++ b/ui/app_list/shower/app_list_shower_delegate_factory.h
@@ -0,0 +1,26 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_APP_LIST_SHOWER_APP_LIST_SHOWER_DELEGATE_FACTORY_H_
+#define UI_APP_LIST_SHOWER_APP_LIST_SHOWER_DELEGATE_FACTORY_H_
+
+#include "base/memory/scoped_ptr.h"
+#include "ui/app_list/shower/app_list_shower_export.h"
+
+namespace app_list {
+
+class AppListShower;
+class AppListShowerDelegate;
+
+class APP_LIST_SHOWER_EXPORT AppListShowerDelegateFactory {
+ public:
+  virtual ~AppListShowerDelegateFactory() {}
+
+  virtual scoped_ptr<AppListShowerDelegate> GetDelegate(
+      AppListShower* shower) = 0;
+};
+
+}  // namespace app_list
+
+#endif  // UI_APP_LIST_SHOWER_APP_LIST_SHOWER_DELEGATE_FACTORY_H_
diff --git a/ui/app_list/shower/app_list_shower_export.h b/ui/app_list/shower/app_list_shower_export.h
new file mode 100644
index 0000000..571c26f
--- /dev/null
+++ b/ui/app_list/shower/app_list_shower_export.h
@@ -0,0 +1,32 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_APP_LIST_SHOWER_APP_LIST_SHOWER_EXPORT_H_
+#define UI_APP_LIST_SHOWER_APP_LIST_SHOWER_EXPORT_H_
+
+// Defines APP_LIST_SHOWER_EXPORT so that functionality implemented by the
+// app_list shower module can be exported to consumers.
+
+#if defined(COMPONENT_BUILD)
+#if defined(WIN32)
+
+#if defined(APP_LIST_SHOWER_IMPLEMENTATION)
+#define APP_LIST_SHOWER_EXPORT __declspec(dllexport)
+#else
+#define APP_LIST_SHOWER_EXPORT __declspec(dllimport)
+#endif  // defined(APP_LIST_SHOWER_IMPLEMENTATION)
+
+#else  // defined(WIN32)
+#if defined(APP_LIST_SHOWER_IMPLEMENTATION)
+#define APP_LIST_SHOWER_EXPORT __attribute__((visibility("default")))
+#else
+#define APP_LIST_SHOWER_EXPORT
+#endif
+#endif
+
+#else  // defined(COMPONENT_BUILD)
+#define APP_LIST_SHOWER_EXPORT
+#endif
+
+#endif  // UI_APP_LIST_SHOWER_APP_LIST_SHOWER_EXPORT_H_
diff --git a/ui/app_list/shower/app_list_shower_impl.cc b/ui/app_list/shower/app_list_shower_impl.cc
new file mode 100644
index 0000000..3fa39d1
--- /dev/null
+++ b/ui/app_list/shower/app_list_shower_impl.cc
@@ -0,0 +1,264 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/app_list/shower/app_list_shower_impl.h"
+
+#include "ui/app_list/app_list_constants.h"
+#include "ui/app_list/app_list_switches.h"
+#include "ui/app_list/pagination_model.h"
+#include "ui/app_list/shower/app_list_shower_delegate_factory.h"
+#include "ui/app_list/views/app_list_view.h"
+#include "ui/aura/client/focus_client.h"
+#include "ui/aura/window.h"
+#include "ui/compositor/layer.h"
+#include "ui/compositor/scoped_layer_animation_settings.h"
+#include "ui/views/widget/widget.h"
+
+namespace app_list {
+namespace {
+
+// Duration for show/hide animation in milliseconds.
+const int kAnimationDurationMs = 200;
+
+// The maximum shift in pixels when over-scroll happens.
+const int kMaxOverScrollShift = 48;
+
+ui::Layer* GetLayer(views::Widget* widget) {
+  return widget->GetNativeView()->layer();
+}
+
+}  // namespace
+
+AppListShowerImpl::AppListShowerImpl(AppListShowerDelegateFactory* factory)
+    : factory_(factory) {
+  DCHECK(factory);
+}
+
+AppListShowerImpl::~AppListShowerImpl() {
+  shower_delegate_.reset();
+  // Ensures app list view goes before the controller since pagination model
+  // lives in the controller and app list view would access it on destruction.
+  if (view_) {
+    view_->GetAppsPaginationModel()->RemoveObserver(this);
+    if (view_->GetWidget())
+      view_->GetWidget()->CloseNow();
+  }
+}
+
+aura::Window* AppListShowerImpl::GetWindow() {
+  return is_visible_ && view_ ? view_->GetWidget()->GetNativeWindow() : nullptr;
+}
+
+void AppListShowerImpl::Show(aura::Window* window) {
+  if (is_visible_)
+    return;
+
+  DCHECK(window);
+  is_visible_ = true;
+  aura::Window* root_window = window->GetRootWindow();
+  if (view_) {
+    ScheduleAnimation();
+  } else {
+    shower_delegate_ = factory_->GetDelegate(this);
+    AppListViewDelegate* view_delegate = shower_delegate_->GetViewDelegate();
+    DCHECK(view_delegate);
+    // Note the AppListViewDelegate outlives the AppListView. For Ash, the view
+    // is destroyed when dismissed.
+    AppListView* view = new AppListView(view_delegate);
+    shower_delegate_->Init(view, root_window, current_apps_page_);
+    SetView(view);
+  }
+  shower_delegate_->OnShown(root_window);
+}
+
+void AppListShowerImpl::Dismiss() {
+  if (!is_visible_)
+    return;
+
+  // If the app list is currently visible, there should be an existing view.
+  DCHECK(view_);
+
+  is_visible_ = false;
+
+  // Our widget is currently active. When the animation completes we'll hide
+  // the widget, changing activation. If a menu is shown before the animation
+  // completes then the activation change triggers the menu to close. By
+  // deactivating now we ensure there is no activation change when the
+  // animation completes and any menus stay open.
+  view_->GetWidget()->Deactivate();
+
+  shower_delegate_->OnDismissed();
+  ScheduleAnimation();
+}
+
+bool AppListShowerImpl::IsVisible() const {
+  return view_ && view_->GetWidget()->IsVisible();
+}
+
+bool AppListShowerImpl::GetTargetVisibility() const {
+  return is_visible_;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// AppListShowerImpl, private:
+
+void AppListShowerImpl::SetView(AppListView* view) {
+  DCHECK(view_ == nullptr);
+  DCHECK(is_visible_);
+
+  view_ = view;
+  views::Widget* widget = view_->GetWidget();
+  widget->AddObserver(this);
+  widget->GetNativeView()->GetRootWindow()->AddObserver(this);
+  aura::client::GetFocusClient(widget->GetNativeView())->AddObserver(this);
+  view_->GetAppsPaginationModel()->AddObserver(this);
+  view_->ShowWhenReady();
+}
+
+void AppListShowerImpl::ResetView() {
+  if (!view_)
+    return;
+
+  views::Widget* widget = view_->GetWidget();
+  widget->RemoveObserver(this);
+  GetLayer(widget)->GetAnimator()->RemoveObserver(this);
+  shower_delegate_.reset();
+  widget->GetNativeView()->GetRootWindow()->RemoveObserver(this);
+  aura::client::GetFocusClient(widget->GetNativeView())->RemoveObserver(this);
+
+  view_->GetAppsPaginationModel()->RemoveObserver(this);
+
+  view_ = nullptr;
+}
+
+void AppListShowerImpl::ScheduleAnimation() {
+  // Stop observing previous animation.
+  StopObservingImplicitAnimations();
+
+  views::Widget* widget = view_->GetWidget();
+  ui::Layer* layer = GetLayer(widget);
+  layer->GetAnimator()->StopAnimating();
+
+  gfx::Rect target_bounds;
+  gfx::Vector2d offset = shower_delegate_->GetVisibilityAnimationOffset(
+      widget->GetNativeView()->GetRootWindow());
+  if (is_visible_) {
+    target_bounds = widget->GetWindowBoundsInScreen();
+    gfx::Rect start_bounds = gfx::Rect(target_bounds);
+    start_bounds.Offset(offset);
+    widget->SetBounds(start_bounds);
+  } else {
+    target_bounds = widget->GetWindowBoundsInScreen();
+    target_bounds.Offset(offset);
+  }
+
+  ui::ScopedLayerAnimationSettings animation(layer->GetAnimator());
+  animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds(
+      is_visible_ ? 0 : kAnimationDurationMs));
+  animation.AddObserver(this);
+
+  layer->SetOpacity(is_visible_ ? 1.0 : 0.0);
+  widget->SetBounds(target_bounds);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// AppListShowerImpl,  aura::client::FocusChangeObserver implementation:
+
+void AppListShowerImpl::OnWindowFocused(aura::Window* gained_focus,
+                                        aura::Window* lost_focus) {
+  if (view_ && is_visible_) {
+    aura::Window* applist_window = view_->GetWidget()->GetNativeView();
+    aura::Window* applist_container = applist_window->parent();
+    if (applist_container->Contains(lost_focus) &&
+        (!gained_focus || !applist_container->Contains(gained_focus)) &&
+        !switches::ShouldNotDismissOnBlur()) {
+      Dismiss();
+    }
+  }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// AppListShowerImpl,  aura::WindowObserver implementation:
+void AppListShowerImpl::OnWindowBoundsChanged(aura::Window* root,
+                                              const gfx::Rect& old_bounds,
+                                              const gfx::Rect& new_bounds) {
+  if (shower_delegate_)
+    shower_delegate_->UpdateBounds();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// AppListShowerImpl, ui::ImplicitAnimationObserver implementation:
+
+void AppListShowerImpl::OnImplicitAnimationsCompleted() {
+  if (is_visible_)
+    view_->GetWidget()->Activate();
+  else
+    view_->GetWidget()->Close();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// AppListShowerImpl, views::WidgetObserver implementation:
+
+void AppListShowerImpl::OnWidgetDestroying(views::Widget* widget) {
+  DCHECK(view_->GetWidget() == widget);
+  if (is_visible_)
+    Dismiss();
+  ResetView();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// AppListShowerImpl, PaginationModelObserver implementation:
+
+void AppListShowerImpl::TotalPagesChanged() {}
+
+void AppListShowerImpl::SelectedPageChanged(int old_selected,
+                                            int new_selected) {
+  current_apps_page_ = new_selected;
+}
+
+void AppListShowerImpl::TransitionStarted() {}
+
+void AppListShowerImpl::TransitionChanged() {
+  // |view_| could be NULL when app list is closed with a running transition.
+  if (!view_)
+    return;
+
+  PaginationModel* pagination_model = view_->GetAppsPaginationModel();
+
+  const PaginationModel::Transition& transition =
+      pagination_model->transition();
+  if (pagination_model->is_valid_page(transition.target_page))
+    return;
+
+  views::Widget* widget = view_->GetWidget();
+  ui::LayerAnimator* widget_animator =
+      widget->GetNativeView()->layer()->GetAnimator();
+  if (!pagination_model->IsRevertingCurrentTransition()) {
+    // Update cached |view_bounds_| if it is the first over-scroll move and
+    // widget does not have running animations.
+    if (!should_snap_back_ && !widget_animator->is_animating())
+      view_bounds_ = widget->GetWindowBoundsInScreen();
+
+    const int current_page = pagination_model->selected_page();
+    const int dir = transition.target_page > current_page ? -1 : 1;
+
+    const double progress = 1.0 - pow(1.0 - transition.progress, 4);
+    const int shift = kMaxOverScrollShift * progress * dir;
+
+    gfx::Rect shifted(view_bounds_);
+    shifted.set_x(shifted.x() + shift);
+
+    widget->SetBounds(shifted);
+
+    should_snap_back_ = true;
+  } else if (should_snap_back_) {
+    should_snap_back_ = false;
+    ui::ScopedLayerAnimationSettings animation(widget_animator);
+    animation.SetTransitionDuration(
+        base::TimeDelta::FromMilliseconds(kOverscrollPageTransitionDurationMs));
+    widget->SetBounds(view_bounds_);
+  }
+}
+
+}  // namespace app_list
diff --git a/ui/app_list/shower/app_list_shower_impl.h b/ui/app_list/shower/app_list_shower_impl.h
new file mode 100644
index 0000000..85cce85
--- /dev/null
+++ b/ui/app_list/shower/app_list_shower_impl.h
@@ -0,0 +1,118 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_APP_LIST_SHOWER_APP_LIST_SHOWER_IMPL_H_
+#define UI_APP_LIST_SHOWER_APP_LIST_SHOWER_IMPL_H_
+
+#include "base/compiler_specific.h"
+#include "base/macros.h"
+#include "ui/app_list/pagination_model_observer.h"
+#include "ui/app_list/shower/app_list_shower.h"
+#include "ui/app_list/shower/app_list_shower_delegate.h"
+#include "ui/aura/client/focus_change_observer.h"
+#include "ui/aura/window_observer.h"
+#include "ui/compositor/layer_animation_observer.h"
+#include "ui/gfx/geometry/rect.h"
+#include "ui/views/widget/widget_observer.h"
+
+namespace app_list {
+class AppListView;
+class AppListViewDelegate;
+class AppListShowerDelegateFactory;
+
+namespace test {
+class AppListShowerImplTestApi;
+}
+
+class AppListShowerImplTest;
+class AppListViewDelegate;
+
+// Manages app list UI. Creates AppListView and schedules showing/hiding
+// animation. While the UI is visible, it monitors things such as app list
+// activation state to auto dismiss the UI. Delegates the responsibility
+// for laying out the app list UI to ash::AppListLayoutDelegate.
+class APP_LIST_SHOWER_EXPORT AppListShowerImpl
+    : public AppListShower,
+      public aura::client::FocusChangeObserver,
+      public aura::WindowObserver,
+      public ui::ImplicitAnimationObserver,
+      public views::WidgetObserver,
+      public PaginationModelObserver {
+ public:
+  explicit AppListShowerImpl(AppListShowerDelegateFactory* factory);
+  ~AppListShowerImpl() override;
+
+  // Returns app list window or NULL if it is not visible.
+  aura::Window* GetWindow();
+
+  // Returns app list view if one exists, or NULL otherwise.
+  AppListView* GetView() { return view_; }
+
+  // AppListShower:
+  void Show(aura::Window* window) override;
+  void Dismiss() override;
+  bool IsVisible() const override;
+  bool GetTargetVisibility() const override;
+
+ private:
+  friend class test::AppListShowerImplTestApi;
+
+  // Sets the app list view and attempts to show it.
+  void SetView(AppListView* view);
+
+  // Forgets the view.
+  void ResetView();
+
+  // Starts show/hide animation.
+  void ScheduleAnimation();
+
+  // aura::client::FocusChangeObserver overrides:
+  void OnWindowFocused(aura::Window* gained_focus,
+                       aura::Window* lost_focus) override;
+
+  // aura::WindowObserver overrides:
+  void OnWindowBoundsChanged(aura::Window* root,
+                             const gfx::Rect& old_bounds,
+                             const gfx::Rect& new_bounds) override;
+
+  // ui::ImplicitAnimationObserver overrides:
+  void OnImplicitAnimationsCompleted() override;
+
+  // views::WidgetObserver overrides:
+  void OnWidgetDestroying(views::Widget* widget) override;
+
+  // PaginationModelObserver overrides:
+  void TotalPagesChanged() override;
+  void SelectedPageChanged(int old_selected, int new_selected) override;
+  void TransitionStarted() override;
+  void TransitionChanged() override;
+
+  // Not owned
+  AppListShowerDelegateFactory* const factory_;
+
+  // Responsible for laying out the app list UI.
+  scoped_ptr<AppListShowerDelegate> shower_delegate_;
+
+  // Whether we should show or hide app list widget.
+  bool is_visible_ = false;
+
+  // The AppListView this class manages, owned by its widget.
+  AppListView* view_ = nullptr;
+
+  // The current page of the AppsGridView of |view_|. This is stored outside of
+  // the view's PaginationModel, so that it persists when the view is destroyed.
+  int current_apps_page_ = -1;
+
+  // Cached bounds of |view_| for snapping back animation after over-scroll.
+  gfx::Rect view_bounds_;
+
+  // Whether should schedule snap back animation.
+  bool should_snap_back_ = false;
+
+  DISALLOW_COPY_AND_ASSIGN(AppListShowerImpl);
+};
+
+}  // namespace app_list
+
+#endif  // UI_APP_LIST_SHOWER_APP_LIST_SHOWER_IMPL_H_
diff --git a/ui/app_list/shower/app_list_shower_impl_unittest.cc b/ui/app_list/shower/app_list_shower_impl_unittest.cc
new file mode 100644
index 0000000..c3a6c36
--- /dev/null
+++ b/ui/app_list/shower/app_list_shower_impl_unittest.cc
@@ -0,0 +1,202 @@
+// Copyright 2013 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 "base/memory/scoped_ptr.h"
+#include "ui/app_list/shower/app_list_shower_delegate_factory.h"
+#include "ui/app_list/shower/app_list_shower_impl.h"
+#include "ui/app_list/shower/test/app_list_shower_impl_test_api.h"
+#include "ui/app_list/test/app_list_test_view_delegate.h"
+#include "ui/app_list/views/app_list_view.h"
+#include "ui/aura/client/focus_client.h"
+#include "ui/aura/test/aura_test_base.h"
+#include "ui/aura/window.h"
+#include "ui/wm/core/default_activation_client.h"
+#include "ui/wm/core/window_util.h"
+
+namespace app_list {
+
+namespace {
+
+// Test stub for AppListShowerDelegate
+class AppListShowerDelegateTest : public AppListShowerDelegate {
+ public:
+  AppListShowerDelegateTest(aura::Window* container,
+                            test::AppListTestViewDelegate* view_delegate)
+      : container_(container), view_delegate_(view_delegate) {}
+  ~AppListShowerDelegateTest() override {}
+
+  bool init_called() const { return init_called_; }
+  bool on_shown_called() const { return on_shown_called_; }
+  bool on_dismissed_called() const { return on_dismissed_called_; }
+  bool update_bounds_called() const { return update_bounds_called_; }
+
+ private:
+  // AppListShowerDelegate:
+  AppListViewDelegate* GetViewDelegate() override { return view_delegate_; }
+  void Init(AppListView* view,
+            aura::Window* root_window,
+            int current_apps_page) override {
+    init_called_ = true;
+    view_ = view;
+    view->InitAsFramelessWindow(container_, current_apps_page,
+                                gfx::Rect(100, 50, 300, 200));
+  }
+  void OnShown(aura::Window*) override { on_shown_called_ = true; }
+  void OnDismissed() override { on_dismissed_called_ = true; }
+  void UpdateBounds() override { update_bounds_called_ = true; }
+  gfx::Vector2d GetVisibilityAnimationOffset(aura::Window*) override {
+    return gfx::Vector2d(0, 0);
+  }
+
+ private:
+  aura::Window* container_;
+  test::AppListTestViewDelegate* view_delegate_;
+  AppListView* view_ = nullptr;
+  bool init_called_ = false;
+  bool on_shown_called_ = false;
+  bool on_dismissed_called_ = false;
+  bool update_bounds_called_ = false;
+
+  DISALLOW_COPY_AND_ASSIGN(AppListShowerDelegateTest);
+};
+
+// Test fake for AppListShowerDelegateFactory, creates instances of
+// AppListShowerDelegateTest.
+class AppListShowerDelegateFactoryTest : public AppListShowerDelegateFactory {
+ public:
+  explicit AppListShowerDelegateFactoryTest(aura::Window* container)
+      : container_(container) {}
+  ~AppListShowerDelegateFactoryTest() override {}
+
+  AppListShowerDelegateTest* current_delegate() { return current_delegate_; }
+
+  // AppListShowerDelegateFactory:
+  scoped_ptr<AppListShowerDelegate> GetDelegate(
+      AppListShower* shower) override {
+    current_delegate_ =
+        new AppListShowerDelegateTest(container_, &app_list_view_delegate_);
+    return make_scoped_ptr(current_delegate_);
+  }
+
+ private:
+  aura::Window* container_;
+  AppListShowerDelegateTest* current_delegate_ = nullptr;
+  test::AppListTestViewDelegate app_list_view_delegate_;
+
+  DISALLOW_COPY_AND_ASSIGN(AppListShowerDelegateFactoryTest);
+};
+
+}  // namespace
+
+class AppListShowerImplTest : public aura::test::AuraTestBase {
+ public:
+  AppListShowerImplTest();
+  ~AppListShowerImplTest() override;
+
+  AppListShowerImpl* shower() { return shower_.get(); }
+  aura::Window* container() { return container_.get(); }
+
+  // Don't cache the return of this method - a new delegate is created every
+  // time the app list is shown.
+  AppListShowerDelegateTest* delegate() { return factory_->current_delegate(); }
+
+  // aura::test::AuraTestBase:
+  void SetUp() override;
+  void TearDown() override;
+
+ private:
+  scoped_ptr<AppListShowerDelegateFactoryTest> factory_;
+  scoped_ptr<AppListShowerImpl> shower_;
+  scoped_ptr<aura::Window> container_;
+
+  DISALLOW_COPY_AND_ASSIGN(AppListShowerImplTest);
+};
+
+AppListShowerImplTest::AppListShowerImplTest() {}
+
+AppListShowerImplTest::~AppListShowerImplTest() {}
+
+void AppListShowerImplTest::SetUp() {
+  AuraTestBase::SetUp();
+  new wm::DefaultActivationClient(root_window());
+  container_.reset(CreateNormalWindow(0, root_window(), nullptr));
+  factory_.reset(new AppListShowerDelegateFactoryTest(container_.get()));
+  shower_.reset(new AppListShowerImpl(factory_.get()));
+}
+
+void AppListShowerImplTest::TearDown() {
+  container_.reset();
+  AuraTestBase::TearDown();
+}
+
+// Tests that app launcher is dismissed when focus moves to a window which is
+// not app list window's sibling and that appropriate delegate callbacks are
+// executed when the app launcher is shown and then when the app launcher is
+// dismissed.
+TEST_F(AppListShowerImplTest, HideOnFocusOut) {
+  aura::client::FocusClient* focus_client =
+      aura::client::GetFocusClient(root_window());
+  shower()->Show(container());
+  EXPECT_TRUE(delegate()->init_called());
+  EXPECT_TRUE(delegate()->on_shown_called());
+  EXPECT_FALSE(delegate()->on_dismissed_called());
+  EXPECT_FALSE(delegate()->update_bounds_called());
+  focus_client->FocusWindow(shower()->GetWindow());
+  EXPECT_TRUE(shower()->GetTargetVisibility());
+
+  scoped_ptr<aura::Window> window(
+      CreateNormalWindow(1, root_window(), nullptr));
+  focus_client->FocusWindow(window.get());
+
+  EXPECT_TRUE(delegate()->on_dismissed_called());
+  EXPECT_FALSE(delegate()->update_bounds_called());
+  EXPECT_FALSE(shower()->GetTargetVisibility());
+}
+
+// Tests that app launcher remains visible when focus moves to a window which
+// is app list window's sibling and that appropriate delegate callbacks are
+// executed when the app launcher is shown.
+TEST_F(AppListShowerImplTest, RemainVisibleWhenFocusingToSibling) {
+  aura::client::FocusClient* focus_client =
+      aura::client::GetFocusClient(root_window());
+  shower()->Show(container());
+  focus_client->FocusWindow(shower()->GetWindow());
+  EXPECT_TRUE(shower()->GetTargetVisibility());
+  EXPECT_TRUE(delegate()->init_called());
+  EXPECT_TRUE(delegate()->on_shown_called());
+  EXPECT_FALSE(delegate()->on_dismissed_called());
+  EXPECT_FALSE(delegate()->update_bounds_called());
+
+  // Create a sibling window.
+  scoped_ptr<aura::Window> window(CreateNormalWindow(1, container(), nullptr));
+  focus_client->FocusWindow(window.get());
+
+  EXPECT_TRUE(shower()->GetTargetVisibility());
+  EXPECT_FALSE(delegate()->on_dismissed_called());
+  EXPECT_FALSE(delegate()->update_bounds_called());
+}
+
+// Tests that UpdateBounds is called on the delegate when the root window
+// is resized.
+TEST_F(AppListShowerImplTest, RootWindowResize) {
+  shower()->Show(container());
+  EXPECT_FALSE(delegate()->update_bounds_called());
+  gfx::Rect bounds = root_window()->bounds();
+  bounds.Inset(-10, 0);
+  root_window()->SetBounds(bounds);
+  EXPECT_TRUE(delegate()->update_bounds_called());
+}
+
+// Tests that the app list is dismissed and the delegate is destroyed when the
+// app list's widget is destroyed.
+TEST_F(AppListShowerImplTest, WidgetDestroyed) {
+  shower()->Show(container());
+  EXPECT_TRUE(shower()->GetTargetVisibility());
+  shower()->GetView()->GetWidget()->CloseNow();
+  EXPECT_FALSE(shower()->GetTargetVisibility());
+  test::AppListShowerImplTestApi shower_test_api(shower());
+  EXPECT_FALSE(shower_test_api.shower_delegate());
+}
+
+}  // namespace app_list
diff --git a/ui/app_list/shower/app_list_shower_unittests.isolate b/ui/app_list/shower/app_list_shower_unittests.isolate
new file mode 100644
index 0000000..2a89e3e
--- /dev/null
+++ b/ui/app_list/shower/app_list_shower_unittests.isolate
@@ -0,0 +1,78 @@
+# Copyright (c) 2014 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.
+{
+  'conditions': [
+    ['use_x11==0', {
+      'variables': {
+        'command': [
+          '../../../testing/test_env.py',
+          '<(PRODUCT_DIR)/app_list_shower_unittests<(EXECUTABLE_SUFFIX)',
+          '--brave-new-test-launcher',
+          '--test-launcher-bot-mode',
+          '--asan=<(asan)',
+          '--msan=<(msan)',
+          '--tsan=<(tsan)',
+        ],
+      },
+    }],
+    ['use_x11==1', {
+      'variables': {
+        'command': [
+          '../../../testing/xvfb.py',
+          '<(PRODUCT_DIR)',
+          '<(PRODUCT_DIR)/app_list_shower_unittests<(EXECUTABLE_SUFFIX)',
+          '--brave-new-test-launcher',
+          '--test-launcher-bot-mode',
+          '--asan=<(asan)',
+          '--msan=<(msan)',
+          '--tsan=<(tsan)',
+        ],
+        'files': [
+          '../../../testing/xvfb.py',
+          '<(PRODUCT_DIR)/xdisplaycheck<(EXECUTABLE_SUFFIX)',
+        ],
+      },
+    }],
+    ['OS=="linux" or OS=="mac" or OS=="win"', {
+      'variables': {
+        'files': [
+          '../../../testing/test_env.py',
+          '<(PRODUCT_DIR)/ui_test.pak',
+        ],
+      },
+    }],
+    ['OS=="linux"', {
+      'variables': {
+        'files': [
+          '<(PRODUCT_DIR)/libosmesa.so',
+        ],
+      },
+    }],
+    ['OS=="mac"', {
+      'variables': {
+        'files': [
+          '<(PRODUCT_DIR)/osmesa.so',
+        ],
+      },
+    }],
+    ['OS=="win"', {
+      'variables': {
+        'files': [
+          '<(PRODUCT_DIR)/osmesa.dll',
+        ],
+      },
+    }],
+    ['OS=="mac" and asan==1 and fastbuild==0', {
+      'variables': {
+        'files': [
+          '<(PRODUCT_DIR)/app_list_shower_unittests.dSYM/',
+          '<(PRODUCT_DIR)/osmesa.so.dSYM/',
+        ],
+      },
+    }],
+  ],
+  'includes': [
+    '../../../base/base.isolate',
+  ],
+}
diff --git a/ui/app_list/shower/test/DEPS b/ui/app_list/shower/test/DEPS
new file mode 100644
index 0000000..c451d9cf
--- /dev/null
+++ b/ui/app_list/shower/test/DEPS
@@ -0,0 +1,3 @@
+include_rules = [
+  "+ui/gl/test/gl_surface_test_support.h",  # To initialize GL for tests.
+]
diff --git a/ui/app_list/shower/test/app_list_shower_impl_test_api.cc b/ui/app_list/shower/test/app_list_shower_impl_test_api.cc
new file mode 100644
index 0000000..9423b37
--- /dev/null
+++ b/ui/app_list/shower/test/app_list_shower_impl_test_api.cc
@@ -0,0 +1,25 @@
+// Copyright 2013 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/app_list/shower/test/app_list_shower_impl_test_api.h"
+
+#include "ui/app_list/shower/app_list_shower_impl.h"
+#include "ui/app_list/views/app_list_view.h"
+
+namespace app_list {
+namespace test {
+
+AppListShowerImplTestApi::AppListShowerImplTestApi(AppListShowerImpl* shower)
+    : shower_(shower) {}
+
+AppListView* AppListShowerImplTestApi::view() {
+  return shower_->view_;
+}
+
+AppListShowerDelegate* AppListShowerImplTestApi::shower_delegate() {
+  return shower_->shower_delegate_.get();
+}
+
+}  // namespace test
+}  // namespace app_list
diff --git a/ui/app_list/shower/test/app_list_shower_impl_test_api.h b/ui/app_list/shower/test/app_list_shower_impl_test_api.h
new file mode 100644
index 0000000..8f59587
--- /dev/null
+++ b/ui/app_list/shower/test/app_list_shower_impl_test_api.h
@@ -0,0 +1,34 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_APP_LIST_SHOWER_TEST_APP_LIST_SHOWER_IMPL_TEST_API_H_
+#define UI_APP_LIST_SHOWER_TEST_APP_LIST_SHOWER_IMPL_TEST_API_H_
+
+#include "base/macros.h"
+
+namespace app_list {
+class AppListShowerDelegate;
+class AppListShowerImpl;
+class AppListView;
+
+namespace test {
+
+// Accesses private data from an AppListController for testing.
+class AppListShowerImplTestApi {
+ public:
+  explicit AppListShowerImplTestApi(AppListShowerImpl* shower);
+
+  AppListView* view();
+  AppListShowerDelegate* shower_delegate();
+
+ private:
+  AppListShowerImpl* const shower_;
+
+  DISALLOW_COPY_AND_ASSIGN(AppListShowerImplTestApi);
+};
+
+}  // namespace test
+}  // namespace app_list
+
+#endif  // UI_APP_LIST_SHOWER_TEST_APP_LIST_SHOWER_IMPL_TEST_API_H_
diff --git a/ui/app_list/shower/test/run_all_unittests.cc b/ui/app_list/shower/test/run_all_unittests.cc
new file mode 100644
index 0000000..880399b
--- /dev/null
+++ b/ui/app_list/shower/test/run_all_unittests.cc
@@ -0,0 +1,49 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/bind.h"
+#include "base/macros.h"
+#include "base/path_service.h"
+#include "base/test/launcher/unit_test_launcher.h"
+#include "base/test/test_suite.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/base/resource/resource_bundle.h"
+#include "ui/base/ui_base_paths.h"
+#include "ui/gl/test/gl_surface_test_support.h"
+
+namespace {
+
+class AppListShowerTestSuite : public base::TestSuite {
+ public:
+  AppListShowerTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {}
+
+ protected:
+  void Initialize() override {
+    gfx::GLSurfaceTestSupport::InitializeOneOff();
+    base::TestSuite::Initialize();
+    ui::RegisterPathProvider();
+
+    base::FilePath ui_test_pak_path;
+    ASSERT_TRUE(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path));
+    ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path);
+  }
+
+  void Shutdown() override {
+    ui::ResourceBundle::CleanupSharedInstance();
+    base::TestSuite::Shutdown();
+  }
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(AppListShowerTestSuite);
+};
+
+}  // namespace
+
+int main(int argc, char** argv) {
+  AppListShowerTestSuite test_suite(argc, argv);
+
+  return base::LaunchUnitTests(
+      argc, argv,
+      base::Bind(&AppListShowerTestSuite::Run, base::Unretained(&test_suite)));
+}
diff --git a/ui/views/mus/native_widget_mus.cc b/ui/views/mus/native_widget_mus.cc
index 2e98b9cd5..98de907f 100644
--- a/ui/views/mus/native_widget_mus.cc
+++ b/ui/views/mus/native_widget_mus.cc
@@ -690,12 +690,14 @@
 }
 
 void NativeWidgetMus::Deactivate() {
-  // NOTIMPLEMENTED();
+  if (IsActive())
+    window_->connection()->ClearFocus();
 }
 
 bool NativeWidgetMus::IsActive() const {
-  // NOTIMPLEMENTED();
-  return true;
+  mus::Window* focused =
+      window_ ? window_->connection()->GetFocusedWindow() : nullptr;
+  return focused && window_->Contains(focused);
 }
 
 void NativeWidgetMus::SetAlwaysOnTop(bool always_on_top) {
@@ -807,7 +809,12 @@
 }
 
 void NativeWidgetMus::ClearNativeFocus() {
-  // NOTIMPLEMENTED();
+  if (!IsActive())
+    return;
+  mus::Window* focused =
+      window_ ? window_->connection()->GetFocusedWindow() : nullptr;
+  if (focused && window_->Contains(focused) && focused != window_)
+    window_->SetFocus();
 }
 
 gfx::Rect NativeWidgetMus::GetWorkAreaBoundsInScreen() const {
diff --git a/ui/webui/resources/css/text_defaults.css b/ui/webui/resources/css/text_defaults.css
index 0b7f55a..ac98968 100644
--- a/ui/webui/resources/css/text_defaults.css
+++ b/ui/webui/resources/css/text_defaults.css
@@ -20,10 +20,10 @@
 }
 
 body {
-  font-family: $i18n{fontFamily};
+  font-family: $i18nRaw{fontFamily};
   font-size: $i18n{fontSize};
 }
 
 button {
-  font-family: $i18n{fontFamily};
+  font-family: $i18nRaw{fontFamily};
 }
diff --git a/ui/webui/resources/css/text_defaults_md.css b/ui/webui/resources/css/text_defaults_md.css
index db23f69..b378ba293 100644
--- a/ui/webui/resources/css/text_defaults_md.css
+++ b/ui/webui/resources/css/text_defaults_md.css
@@ -22,10 +22,10 @@
 }
 
 body {
-  font-family: Roboto, $i18n{fontFamily};
+  font-family: Roboto, $i18nRaw{fontFamily};
   font-size: 81.25%
 }
 
 button {
-  font-family: Roboto, $i18n{fontFamily};
+  font-family: Roboto, $i18nRaw{fontFamily};
 }