Merge from Chromium at DEPS revision r213605

This commit was generated by merge_to_master.py.

Change-Id: I5ef9e03bf077dac295a7904f06b3cb6dec9fe213
diff --git a/.DEPS.git b/.DEPS.git
index aaef337..f08ac72 100644
--- a/.DEPS.git
+++ b/.DEPS.git
@@ -11,7 +11,7 @@
     'git_url':
          'https://chromium.googlesource.com',
     'webkit_rev':
-         '@e976d5810ac68f54fccc88dccc2e8b95f8754737'
+         '@9494eb3ac7df18c763bb17667bc39bdd7b853751'
 }
 
 deps = {
@@ -98,11 +98,11 @@
     'src/third_party/sfntly/cpp/src':
         Var('git_url') + '/external/sfntly/cpp/src.git@cfb2f1743f0169ad8d01035458617bce97107539',
     'src/third_party/skia/gyp':
-        Var('git_url') + '/external/skia/gyp.git@6488041938586522ce313bc5000a2a4516e45052',
+        Var('git_url') + '/external/skia/gyp.git@f52cb2de30a9008d67ac3456e1cf9136fe661b76',
     'src/third_party/skia/include':
-        Var('git_url') + '/external/skia/include.git@9de8c6d9afed64d2b1129952f353ee49e3155e1c',
+        Var('git_url') + '/external/skia/include.git@3a7536753d16cde4a270978c9c1a20c287823661',
     'src/third_party/skia/src':
-        Var('git_url') + '/external/skia/src.git@6b8cd0006c55d1cf1a13dbb049018c16e6696ef6',
+        Var('git_url') + '/external/skia/src.git@9a38b14fa51cf074f3f6100baa8a2acd27ba822c',
     'src/third_party/smhasher/src':
         Var('git_url') + '/external/smhasher.git@6f63a4882e6b2cf87e8eec1a3ef8644e0d963283',
     'src/third_party/snappy/src':
@@ -284,7 +284,7 @@
         'src/chrome/tools/test/reference_build/chrome_linux':
             Var('git_url') + '/chromium/reference_builds/chrome_linux.git@216cf5b1b3e97e285e0ee361f54e8f7a30c6af00',
         'src/third_party/chromite':
-            Var('git_url') + '/chromiumos/chromite.git@785fedc51fc430445d8f397440012ea3b489bac9',
+            Var('git_url') + '/chromiumos/chromite.git@93281fa6a9fa1af48aae02d0a9c142a4450af51e',
         'src/third_party/cros_dbus_cplusplus/source':
             Var('git_url') + '/chromiumos/third_party/dbus-cplusplus.git@5e8f6d9db5c2abfb91d91f751184f25bb5cd0900',
         'src/third_party/cros_system_api':
diff --git a/DEPS b/DEPS
index b37eadd..7a21929 100644
--- a/DEPS
+++ b/DEPS
@@ -8,7 +8,7 @@
   "sourceforge_url": "http://%(repo)s.svn.sourceforge.net/svnroot/%(repo)s",
   "webkit_trunk": "http://src.chromium.org/blink/trunk",
   "nacl_trunk": "http://src.chromium.org/native_client/trunk",
-  "webkit_revision": "154818",
+  "webkit_revision": "154842",
   "chromium_git": "https://chromium.googlesource.com",
   "chromiumos_git": "https://chromium.googlesource.com/chromiumos",
   "swig_revision": "69281",
@@ -29,7 +29,7 @@
   "ffmpeg_hash": "245a8c0cdfdd5ab3da9045089661017e9ddd8d0e",
 
   "sfntly_revision": "134",
-  "skia_revision": "10239",
+  "skia_revision": "10309",
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling Skia
   # and V8 without interference from each other.
@@ -445,7 +445,7 @@
     # Build tools for targeting ChromeOS.
     "src/third_party/chromite":
       Var("chromiumos_git") + "/chromite.git" +
-      "@785fedc51fc430445d8f397440012ea3b489bac9",
+      "@93281fa6a9fa1af48aae02d0a9c142a4450af51e",
 
     # Dependency of chromite.git.
     "src/third_party/pyelftools":
diff --git a/android_webview/android_webview_common.target.darwin-arm.mk b/android_webview/android_webview_common.target.darwin-arm.mk
index ca0eabd..eeffccf 100644
--- a/android_webview/android_webview_common.target.darwin-arm.mk
+++ b/android_webview/android_webview_common.target.darwin-arm.mk
@@ -137,12 +137,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/ui/ui_resources \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -246,12 +246,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/ui/ui_resources \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/android_webview/android_webview_common.target.darwin-mips.mk b/android_webview/android_webview_common.target.darwin-mips.mk
index 7596a9e..e6c9982 100644
--- a/android_webview/android_webview_common.target.darwin-mips.mk
+++ b/android_webview/android_webview_common.target.darwin-mips.mk
@@ -136,12 +136,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/ui/ui_resources \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -244,12 +244,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/ui/ui_resources \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/android_webview/android_webview_common.target.darwin-x86.mk b/android_webview/android_webview_common.target.darwin-x86.mk
index a49c063..981ecf0 100644
--- a/android_webview/android_webview_common.target.darwin-x86.mk
+++ b/android_webview/android_webview_common.target.darwin-x86.mk
@@ -139,12 +139,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/ui/ui_resources \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -251,12 +251,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/ui/ui_resources \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/android_webview/android_webview_common.target.linux-arm.mk b/android_webview/android_webview_common.target.linux-arm.mk
index ca0eabd..eeffccf 100644
--- a/android_webview/android_webview_common.target.linux-arm.mk
+++ b/android_webview/android_webview_common.target.linux-arm.mk
@@ -137,12 +137,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/ui/ui_resources \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -246,12 +246,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/ui/ui_resources \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/android_webview/android_webview_common.target.linux-mips.mk b/android_webview/android_webview_common.target.linux-mips.mk
index 7596a9e..e6c9982 100644
--- a/android_webview/android_webview_common.target.linux-mips.mk
+++ b/android_webview/android_webview_common.target.linux-mips.mk
@@ -136,12 +136,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/ui/ui_resources \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -244,12 +244,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/ui/ui_resources \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/android_webview/android_webview_common.target.linux-x86.mk b/android_webview/android_webview_common.target.linux-x86.mk
index a49c063..981ecf0 100644
--- a/android_webview/android_webview_common.target.linux-x86.mk
+++ b/android_webview/android_webview_common.target.linux-x86.mk
@@ -139,12 +139,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/ui/ui_resources \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -251,12 +251,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/ui/ui_resources \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java
index c94c1ab..00dc0ab 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -143,8 +143,9 @@
     private final InterceptNavigationDelegateImpl mInterceptNavigationDelegate;
     private final InternalAccessDelegate mInternalAccessAdapter;
     private final AwLayoutSizer mLayoutSizer;
-    private final AwScrollOffsetManager mScrollOffsetManager;
     private final AwZoomControls mZoomControls;
+    private final AwScrollOffsetManager mScrollOffsetManager;
+    private OverScrollGlow mOverScrollGlow;
     // This can be accessed on any thread after construction. See AwContentsIoThreadClient.
     private final AwSettings mSettings;
 
@@ -481,6 +482,8 @@
         mContentsClient.setDIPScale(mDIPScale);
         mScrollOffsetManager = new AwScrollOffsetManager(new AwScrollOffsetManagerDelegate());
 
+        setOverScrollMode(mContainerView.getOverScrollMode());
+
         setNewAwContents(nativeInit(browserContext));
     }
 
@@ -659,6 +662,12 @@
             Log.w(TAG, "nativeOnDraw failed; clearing to background color.");
             canvas.drawColor(getEffectiveBackgroundColor());
         }
+
+        if (mOverScrollGlow != null && mOverScrollGlow.drawEdgeGlows(canvas,
+                    mScrollOffsetManager.computeMaximumHorizontalScrollOffset(),
+                    mScrollOffsetManager.computeMaximumVerticalScrollOffset())) {
+            mContainerView.invalidate();
+        }
     }
 
     public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
@@ -673,23 +682,6 @@
         return (int) Math.ceil(mContentViewCore.getContentWidthCss());
     }
 
-    /**
-     * Called by the embedder when the scroll offset of the containing view has changed.
-     * @see View#onScrollChanged(int,int)
-     */
-    public void onContainerViewScrollChanged(int l, int t, int oldl, int oldt) {
-        mScrollOffsetManager.onContainerViewScrollChanged(l, t);
-    }
-
-    /**
-     * Called by the embedder when the containing view is to be scrolled or overscrolled.
-     * @see View#onOverScrolled(int,int,int,int)
-     */
-    public void onContainerViewOverScrolled(int scrollX, int scrollY, boolean clampedX,
-            boolean clampedY) {
-        mScrollOffsetManager.onContainerViewOverScrolled(scrollX, scrollY, clampedX, clampedY);
-    }
-
     public Picture capturePicture() {
         return nativeCapturePicture(mNativeAwContents);
     }
@@ -854,6 +846,44 @@
     }
 
     /**
+     * @see View#setOverScrollMode(int)
+     */
+    public void setOverScrollMode(int mode) {
+        if (mode != View.OVER_SCROLL_NEVER) {
+            mOverScrollGlow = new OverScrollGlow(mContainerView);
+        } else {
+            mOverScrollGlow = null;
+        }
+    }
+
+    /**
+     * Called by the embedder when the scroll offset of the containing view has changed.
+     * @see View#onScrollChanged(int,int)
+     */
+    public void onContainerViewScrollChanged(int l, int t, int oldl, int oldt) {
+        mScrollOffsetManager.onContainerViewScrollChanged(l, t);
+    }
+
+    /**
+     * Called by the embedder when the containing view is to be scrolled or overscrolled.
+     * @see View#onOverScrolled(int,int,int,int)
+     */
+    public void onContainerViewOverScrolled(int scrollX, int scrollY, boolean clampedX,
+            boolean clampedY) {
+        int oldX = mContainerView.getScrollX();
+        int oldY = mContainerView.getScrollY();
+
+        mScrollOffsetManager.onContainerViewOverScrolled(scrollX, scrollY, clampedX, clampedY);
+
+        if (mOverScrollGlow != null) {
+            mOverScrollGlow.pullGlow(mContainerView.getScrollX(), mContainerView.getScrollY(),
+                    oldX, oldY,
+                    mScrollOffsetManager.computeMaximumHorizontalScrollOffset(),
+                    mScrollOffsetManager.computeMaximumVerticalScrollOffset());
+        }
+    }
+
+    /**
      * @see View#computeHorizontalScrollRange()
      */
     public int computeHorizontalScrollRange() {
@@ -1250,6 +1280,10 @@
                                           (int)Math.round(event.getY(actionIndex) / mDIPScale));
         }
 
+        if (mOverScrollGlow != null && event.getActionMasked() == MotionEvent.ACTION_UP) {
+            mOverScrollGlow.releaseAll();
+        }
+
         return rv;
     }
 
@@ -1382,7 +1416,6 @@
         nativeSetVisibility(mNativeAwContents, mIsVisible);
     }
 
-
     /**
      * Key for opaque state in bundle. Note this is only public for tests.
      */
@@ -1632,7 +1665,15 @@
 
     @CalledByNative
     private void didOverscroll(int deltaX, int deltaY) {
+        if (mOverScrollGlow != null) {
+            mOverScrollGlow.setOverScrollDeltas(deltaX, deltaY);
+        }
+
         mScrollOffsetManager.overscrollBy(deltaX, deltaY);
+
+        if (mOverScrollGlow != null && mOverScrollGlow.isAnimating()) {
+            mContainerView.invalidate();
+        }
     }
 
     // -------------------------------------------------------------------------------------------
diff --git a/android_webview/java/src/org/chromium/android_webview/OverScrollGlow.java b/android_webview/java/src/org/chromium/android_webview/OverScrollGlow.java
new file mode 100644
index 0000000..5023c39
--- /dev/null
+++ b/android_webview/java/src/org/chromium/android_webview/OverScrollGlow.java
@@ -0,0 +1,210 @@
+// 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.
+
+package org.chromium.android_webview;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.graphics.Canvas;
+import android.graphics.drawable.Drawable;
+import android.view.View;
+import android.widget.EdgeEffect;
+
+/**
+ * This class manages the edge glow effect when a WebView is flung or pulled beyond the edges.
+ */
+class OverScrollGlow {
+    private View mHostView;
+
+    private EdgeEffect mEdgeGlowTop;
+    private EdgeEffect mEdgeGlowBottom;
+    private EdgeEffect mEdgeGlowLeft;
+    private EdgeEffect mEdgeGlowRight;
+
+    private int mOverScrollDeltaX;
+    private int mOverScrollDeltaY;
+
+    public OverScrollGlow(View host) {
+        mHostView = host;
+        Context context = host.getContext();
+        mEdgeGlowTop = new EdgeEffect(context);
+        mEdgeGlowBottom = new EdgeEffect(context);
+        mEdgeGlowLeft = new EdgeEffect(context);
+        mEdgeGlowRight = new EdgeEffect(context);
+    }
+
+    /**
+     * Pull leftover touch scroll distance into one of the edge glows as appropriate.
+     *
+     * @param x Current X scroll offset
+     * @param y Current Y scroll offset
+     * @param oldX Old X scroll offset
+     * @param oldY Old Y scroll offset
+     * @param maxX Maximum range for horizontal scrolling
+     * @param maxY Maximum range for vertical scrolling
+     */
+    public void pullGlow(int x, int y, int oldX, int oldY, int maxX, int maxY) {
+        // Only show overscroll bars if there was no movement in any direction
+        // as a result of scrolling.
+        if (oldX == mHostView.getScrollX() && oldY == mHostView.getScrollY()) {
+            // Don't show left/right glows if we fit the whole content.
+            // Also don't show if there was vertical movement.
+            if (maxX > 0) {
+                final int pulledToX = oldX + mOverScrollDeltaX;
+                if (pulledToX < 0) {
+                    mEdgeGlowLeft.onPull((float) mOverScrollDeltaX / mHostView.getWidth());
+                    if (!mEdgeGlowRight.isFinished()) {
+                        mEdgeGlowRight.onRelease();
+                    }
+                } else if (pulledToX > maxX) {
+                    mEdgeGlowRight.onPull((float) mOverScrollDeltaX / mHostView.getWidth());
+                    if (!mEdgeGlowLeft.isFinished()) {
+                        mEdgeGlowLeft.onRelease();
+                    }
+                }
+                mOverScrollDeltaX = 0;
+            }
+
+            if (maxY > 0 || mHostView.getOverScrollMode() == View.OVER_SCROLL_ALWAYS) {
+                final int pulledToY = oldY + mOverScrollDeltaY;
+                if (pulledToY < 0) {
+                    mEdgeGlowTop.onPull((float) mOverScrollDeltaY / mHostView.getHeight());
+                    if (!mEdgeGlowBottom.isFinished()) {
+                        mEdgeGlowBottom.onRelease();
+                    }
+                } else if (pulledToY > maxY) {
+                    mEdgeGlowBottom.onPull((float) mOverScrollDeltaY / mHostView.getHeight());
+                    if (!mEdgeGlowTop.isFinished()) {
+                        mEdgeGlowTop.onRelease();
+                    }
+                }
+                mOverScrollDeltaY = 0;
+            }
+        }
+    }
+
+    /**
+     * Absorb leftover fling velocity into one of the edge glows as appropriate.
+     *
+     * @param x Current X scroll offset
+     * @param y Current Y scroll offset
+     * @param oldX Old X scroll offset
+     * @param oldY Old Y scroll offset
+     * @param rangeX Maximum range for horizontal scrolling
+     * @param rangeY Maximum range for vertical scrolling
+     * @param currentFlingVelocity Current fling velocity
+     */
+    public void absorbGlow(int x, int y, int oldX, int oldY, int rangeX, int rangeY,
+            float currentFlingVelocity) {
+        if (rangeY > 0 || mHostView.getOverScrollMode() == View.OVER_SCROLL_ALWAYS) {
+            if (y < 0 && oldY >= 0) {
+                mEdgeGlowTop.onAbsorb((int) currentFlingVelocity);
+                if (!mEdgeGlowBottom.isFinished()) {
+                    mEdgeGlowBottom.onRelease();
+                }
+            } else if (y > rangeY && oldY <= rangeY) {
+                mEdgeGlowBottom.onAbsorb((int) currentFlingVelocity);
+                if (!mEdgeGlowTop.isFinished()) {
+                    mEdgeGlowTop.onRelease();
+                }
+            }
+        }
+
+        if (rangeX > 0) {
+            if (x < 0 && oldX >= 0) {
+                mEdgeGlowLeft.onAbsorb((int) currentFlingVelocity);
+                if (!mEdgeGlowRight.isFinished()) {
+                    mEdgeGlowRight.onRelease();
+                }
+            } else if (x > rangeX && oldX <= rangeX) {
+                mEdgeGlowRight.onAbsorb((int) currentFlingVelocity);
+                if (!mEdgeGlowLeft.isFinished()) {
+                    mEdgeGlowLeft.onRelease();
+                }
+            }
+        }
+    }
+
+    /**
+     * Set touch delta values indicating the current amount of overscroll.
+     *
+     * @param deltaX
+     * @param deltaY
+     */
+    public void setOverScrollDeltas(int deltaX, int deltaY) {
+        mOverScrollDeltaX += deltaX;
+        mOverScrollDeltaY += deltaY;
+    }
+
+    /**
+     * Draw the glow effect along the sides of the widget.
+     *
+     * @param canvas Canvas to draw into, transformed into view coordinates.
+     * @param maxScrollX maximum horizontal scroll offset
+     * @param maxScrollY maximum vertical scroll offset
+     * @return true if glow effects are still animating and the view should invalidate again.
+     */
+    public boolean drawEdgeGlows(Canvas canvas, int maxScrollX, int maxScrollY) {
+        final int scrollX = mHostView.getScrollX();
+        final int scrollY = mHostView.getScrollY();
+        final int width = mHostView.getWidth();
+        int height = mHostView.getHeight();
+
+        boolean invalidateForGlow = false;
+        if (!mEdgeGlowTop.isFinished()) {
+            final int restoreCount = canvas.save();
+
+            canvas.translate(scrollX, Math.min(0, scrollY));
+            mEdgeGlowTop.setSize(width, height);
+            invalidateForGlow |= mEdgeGlowTop.draw(canvas);
+            canvas.restoreToCount(restoreCount);
+        }
+        if (!mEdgeGlowBottom.isFinished()) {
+            final int restoreCount = canvas.save();
+
+            canvas.translate(-width + scrollX, Math.max(maxScrollY, scrollY) + height);
+            canvas.rotate(180, width, 0);
+            mEdgeGlowBottom.setSize(width, height);
+            invalidateForGlow |= mEdgeGlowBottom.draw(canvas);
+            canvas.restoreToCount(restoreCount);
+        }
+        if (!mEdgeGlowLeft.isFinished()) {
+            final int restoreCount = canvas.save();
+
+            canvas.rotate(270);
+            canvas.translate(-height - scrollY, Math.min(0, scrollX));
+            mEdgeGlowLeft.setSize(height, width);
+            invalidateForGlow |= mEdgeGlowLeft.draw(canvas);
+            canvas.restoreToCount(restoreCount);
+        }
+        if (!mEdgeGlowRight.isFinished()) {
+            final int restoreCount = canvas.save();
+
+            canvas.rotate(90);
+            canvas.translate(scrollY, -(Math.max(scrollX, maxScrollX) + width));
+            mEdgeGlowRight.setSize(height, width);
+            invalidateForGlow |= mEdgeGlowRight.draw(canvas);
+            canvas.restoreToCount(restoreCount);
+        }
+        return invalidateForGlow;
+    }
+
+    /**
+     * @return True if any glow is still animating
+     */
+    public boolean isAnimating() {
+        return (!mEdgeGlowTop.isFinished() || !mEdgeGlowBottom.isFinished() ||
+                !mEdgeGlowLeft.isFinished() || !mEdgeGlowRight.isFinished());
+    }
+
+    /**
+     * Release all glows from any touch pulls in progress.
+     */
+    public void releaseAll() {
+        mEdgeGlowTop.onRelease();
+        mEdgeGlowBottom.onRelease();
+        mEdgeGlowLeft.onRelease();
+        mEdgeGlowRight.onRelease();
+    }
+}
diff --git a/android_webview/libwebviewchromium.target.darwin-arm.mk b/android_webview/libwebviewchromium.target.darwin-arm.mk
index 546dfd2..d960ecb 100644
--- a/android_webview/libwebviewchromium.target.darwin-arm.mk
+++ b/android_webview/libwebviewchromium.target.darwin-arm.mk
@@ -310,9 +310,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -395,9 +395,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/android_webview/libwebviewchromium.target.darwin-mips.mk b/android_webview/libwebviewchromium.target.darwin-mips.mk
index 3237968..5fa84ba 100644
--- a/android_webview/libwebviewchromium.target.darwin-mips.mk
+++ b/android_webview/libwebviewchromium.target.darwin-mips.mk
@@ -305,9 +305,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -389,9 +389,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/android_webview/libwebviewchromium.target.darwin-x86.mk b/android_webview/libwebviewchromium.target.darwin-x86.mk
index dfefc41..a2dfd78 100644
--- a/android_webview/libwebviewchromium.target.darwin-x86.mk
+++ b/android_webview/libwebviewchromium.target.darwin-x86.mk
@@ -315,9 +315,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -403,9 +403,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/android_webview/libwebviewchromium.target.linux-arm.mk b/android_webview/libwebviewchromium.target.linux-arm.mk
index 546dfd2..d960ecb 100644
--- a/android_webview/libwebviewchromium.target.linux-arm.mk
+++ b/android_webview/libwebviewchromium.target.linux-arm.mk
@@ -310,9 +310,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -395,9 +395,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/android_webview/libwebviewchromium.target.linux-mips.mk b/android_webview/libwebviewchromium.target.linux-mips.mk
index 3237968..5fa84ba 100644
--- a/android_webview/libwebviewchromium.target.linux-mips.mk
+++ b/android_webview/libwebviewchromium.target.linux-mips.mk
@@ -305,9 +305,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -389,9 +389,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/android_webview/libwebviewchromium.target.linux-x86.mk b/android_webview/libwebviewchromium.target.linux-x86.mk
index dfefc41..a2dfd78 100644
--- a/android_webview/libwebviewchromium.target.linux-x86.mk
+++ b/android_webview/libwebviewchromium.target.linux-x86.mk
@@ -315,9 +315,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -403,9 +403,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/android_webview/native/aw_quota_manager_bridge_impl.cc b/android_webview/native/aw_quota_manager_bridge_impl.cc
index 6427588..e9cb8ac 100644
--- a/android_webview/native/aw_quota_manager_bridge_impl.cc
+++ b/android_webview/native/aw_quota_manager_bridge_impl.cc
@@ -185,21 +185,28 @@
   return quota_manager;
 }
 
-// Cannot directly call StoragePartition clear data methods because cookies are
-// controlled separately.
 void AwQuotaManagerBridgeImpl::DeleteAllData(JNIEnv* env, jobject object) {
   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-  GetStoragePartition()->AsyncClearData(
-      StoragePartition::kQuotaManagedTemporaryStorage |
-      StoragePartition::kLocalDomStorage |
-      StoragePartition::kSessionDomStorage);
+  GetStoragePartition()->ClearDataForUnboundedRange(
+      // Clear all web storage data except cookies.
+      StoragePartition::REMOVE_DATA_MASK_APPCACHE |
+          StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
+          StoragePartition::REMOVE_DATA_MASK_INDEXEDDB |
+          StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE |
+          StoragePartition::REMOVE_DATA_MASK_WEBSQL,
+      StoragePartition::kQuotaManagedTemporaryStorage);
 }
 
 void AwQuotaManagerBridgeImpl::DeleteOrigin(
     JNIEnv* env, jobject object, jstring origin) {
   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
   StoragePartition* storage_partition = GetStoragePartition();
-  storage_partition->AsyncClearDataForOrigin(
+  storage_partition->ClearDataForOrigin(
+      // All (temporary) QuotaClient types.
+      StoragePartition::REMOVE_DATA_MASK_APPCACHE |
+          StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
+          StoragePartition::REMOVE_DATA_MASK_INDEXEDDB |
+          StoragePartition::REMOVE_DATA_MASK_WEBSQL,
       StoragePartition::kQuotaManagedTemporaryStorage,
       GURL(base::android::ConvertJavaStringToUTF16(env, origin)),
       storage_partition->GetURLRequestContext());
diff --git a/android_webview/native/webview_native.target.darwin-arm.mk b/android_webview/native/webview_native.target.darwin-arm.mk
index 5029fc3..933ba49 100644
--- a/android_webview/native/webview_native.target.darwin-arm.mk
+++ b/android_webview/native/webview_native.target.darwin-arm.mk
@@ -119,12 +119,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/android_webview \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -229,12 +229,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/android_webview \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/android_webview/native/webview_native.target.darwin-mips.mk b/android_webview/native/webview_native.target.darwin-mips.mk
index b12867c..2f11f10 100644
--- a/android_webview/native/webview_native.target.darwin-mips.mk
+++ b/android_webview/native/webview_native.target.darwin-mips.mk
@@ -118,12 +118,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/android_webview \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -227,12 +227,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/android_webview \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/android_webview/native/webview_native.target.darwin-x86.mk b/android_webview/native/webview_native.target.darwin-x86.mk
index d61cf79..fd9bd3b 100644
--- a/android_webview/native/webview_native.target.darwin-x86.mk
+++ b/android_webview/native/webview_native.target.darwin-x86.mk
@@ -120,12 +120,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/android_webview \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -232,12 +232,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/android_webview \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/android_webview/native/webview_native.target.linux-arm.mk b/android_webview/native/webview_native.target.linux-arm.mk
index 5029fc3..933ba49 100644
--- a/android_webview/native/webview_native.target.linux-arm.mk
+++ b/android_webview/native/webview_native.target.linux-arm.mk
@@ -119,12 +119,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/android_webview \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -229,12 +229,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/android_webview \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/android_webview/native/webview_native.target.linux-mips.mk b/android_webview/native/webview_native.target.linux-mips.mk
index b12867c..2f11f10 100644
--- a/android_webview/native/webview_native.target.linux-mips.mk
+++ b/android_webview/native/webview_native.target.linux-mips.mk
@@ -118,12 +118,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/android_webview \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -227,12 +227,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/android_webview \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/android_webview/native/webview_native.target.linux-x86.mk b/android_webview/native/webview_native.target.linux-x86.mk
index d61cf79..fd9bd3b 100644
--- a/android_webview/native/webview_native.target.linux-x86.mk
+++ b/android_webview/native/webview_native.target.linux-x86.mk
@@ -120,12 +120,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/android_webview \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -232,12 +232,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/android_webview \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/android_webview/tools/known_issues.py b/android_webview/tools/known_issues.py
index 9d9abae..e563ecd 100644
--- a/android_webview/tools/known_issues.py
+++ b/android_webview/tools/known_issues.py
@@ -58,16 +58,6 @@
     'third_party/icu': [
         # Incompatible code from ICU's repository.
         'source/data/brkitr',
-
-        # Code we don't want to build/include by accident from ICU's repository.
-        'android',
-        'build',
-        'linux',
-        'mac',
-        'patches',
-        'public',
-        'source',
-        'windows',
     ],
 }
 
diff --git a/apps/app_shim/chrome_main_app_mode_mac.mm b/apps/app_shim/chrome_main_app_mode_mac.mm
index 56d19dd..6aa92c2 100644
--- a/apps/app_shim/chrome_main_app_mode_mac.mm
+++ b/apps/app_shim/chrome_main_app_mode_mac.mm
@@ -389,6 +389,7 @@
     bool success =
         base::mac::OpenApplicationWithPath(info->chrome_outer_bundle_path,
                                            command_line,
+                                           kLSLaunchDefaults,
                                            &psn);
     if (!success)
       return 1;
diff --git a/apps/app_shim/extension_app_shim_handler_mac.cc b/apps/app_shim/extension_app_shim_handler_mac.cc
index 2dc2d5b..1349f91 100644
--- a/apps/app_shim/extension_app_shim_handler_mac.cc
+++ b/apps/app_shim/extension_app_shim_handler_mac.cc
@@ -347,6 +347,7 @@
   HostMap::iterator it = hosts_.find(make_pair(profile, app_id));
   if (it != hosts_.end()) {
     it->second->OnAppLaunchComplete(APP_SHIM_LAUNCH_SUCCESS);
+    OnShimFocus(it->second, APP_SHIM_FOCUS_NORMAL);
     return;
   }
 
diff --git a/apps/app_shim/extension_app_shim_handler_mac_unittest.cc b/apps/app_shim/extension_app_shim_handler_mac_unittest.cc
index ca8ccc3..33941de 100644
--- a/apps/app_shim/extension_app_shim_handler_mac_unittest.cc
+++ b/apps/app_shim/extension_app_shim_handler_mac_unittest.cc
@@ -214,8 +214,10 @@
   handler_->OnShimLaunch(&host_bb_, normal_launch);
   EXPECT_EQ(&host_bb_, handler_->FindHost(&profile_b_, kTestAppIdB));
 
-  // Activation when there is a registered shim finishes launch with success.
+  // Activation when there is a registered shim finishes launch with success and
+  // focuses the app.
   EXPECT_CALL(host_aa_, OnAppLaunchComplete(APP_SHIM_LAUNCH_SUCCESS));
+  EXPECT_CALL(*handler_, OnShimFocus(&host_aa_, APP_SHIM_FOCUS_NORMAL));
   handler_->OnAppActivated(&profile_a_, kTestAppIdA);
 
   // Starting and closing a second host just focuses the app.
diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc
index 7039d56..635ceba 100644
--- a/ash/root_window_controller.cc
+++ b/ash/root_window_controller.cc
@@ -258,13 +258,9 @@
       container = GetContainer(kShellWindowId_SystemModalContainer);
     }
   } else {
-    user::LoginStatus login = Shell::GetInstance()->system_tray_delegate() ?
-        Shell::GetInstance()->system_tray_delegate()->GetUserLoginStatus() :
-        user::LOGGED_IN_NONE;
-    int modal_window_id = (login == user::LOGGED_IN_LOCKED ||
-                           login == user::LOGGED_IN_NONE) ?
-        kShellWindowId_LockSystemModalContainer :
-        kShellWindowId_SystemModalContainer;
+    int modal_window_id = Shell::GetInstance()->session_state_delegate()
+        ->IsUserSessionBlocked() ? kShellWindowId_LockSystemModalContainer :
+                                   kShellWindowId_SystemModalContainer;
     container = GetContainer(modal_window_id);
   }
   return container ? static_cast<SystemModalContainerLayoutManager*>(
diff --git a/ash/root_window_controller_unittest.cc b/ash/root_window_controller_unittest.cc
index 2d69b15..b27cc52 100644
--- a/ash/root_window_controller_unittest.cc
+++ b/ash/root_window_controller_unittest.cc
@@ -370,6 +370,55 @@
               session_modal_widget->GetNativeView()));
 }
 
+TEST_F(RootWindowControllerTest, ModalContainerBlockedSession) {
+  UpdateDisplay("600x600");
+  Shell* shell = Shell::GetInstance();
+  internal::RootWindowController* controller =
+      shell->GetPrimaryRootWindowController();
+  aura::Window* lock_container =
+      Shell::GetContainer(controller->root_window(),
+                          internal::kShellWindowId_LockScreenContainer);
+  for (int block_reason = FIRST_BLOCK_REASON;
+       block_reason < NUMBER_OF_BLOCK_REASONS;
+       ++block_reason) {
+    views::Widget* session_modal_widget =
+          CreateModalWidget(gfx::Rect(300, 10, 100, 100));
+    EXPECT_EQ(Shell::GetContainer(controller->root_window(),
+        internal::kShellWindowId_SystemModalContainer)->layout_manager(),
+            controller->GetSystemModalLayoutManager(
+                session_modal_widget->GetNativeView()));
+    EXPECT_EQ(Shell::GetContainer(controller->root_window(),
+        internal::kShellWindowId_SystemModalContainer)->layout_manager(),
+            controller->GetSystemModalLayoutManager(NULL));
+    session_modal_widget->Close();
+
+    BlockUserSession(static_cast<UserSessionBlockReason>(block_reason));
+
+    EXPECT_EQ(Shell::GetContainer(controller->root_window(),
+        internal::kShellWindowId_LockSystemModalContainer)->layout_manager(),
+            controller->GetSystemModalLayoutManager(NULL));
+
+    views::Widget* lock_modal_widget =
+        CreateModalWidgetWithParent(gfx::Rect(300, 10, 100, 100),
+                                    lock_container);
+    EXPECT_EQ(Shell::GetContainer(controller->root_window(),
+        internal::kShellWindowId_LockSystemModalContainer)->layout_manager(),
+              controller->GetSystemModalLayoutManager(
+                  lock_modal_widget->GetNativeView()));
+
+    session_modal_widget =
+          CreateModalWidget(gfx::Rect(300, 10, 100, 100));
+    EXPECT_EQ(Shell::GetContainer(controller->root_window(),
+        internal::kShellWindowId_SystemModalContainer)->layout_manager(),
+            controller->GetSystemModalLayoutManager(
+                session_modal_widget->GetNativeView()));
+    session_modal_widget->Close();
+
+    lock_modal_widget->Close();
+    UnblockUserSession();
+  }
+}
+
 // Test that GetFullscreenWindow() returns a fullscreen window only if the
 // fullscreen window is in the active workspace.
 TEST_F(RootWindowControllerTest, GetFullscreenWindow) {
@@ -412,21 +461,16 @@
       CreateTestWidget(gfx::Rect(0, 0, 100, 100))->GetNativeView();
   session_window->Show();
 
-  // Lock screen.
-  Shell::GetInstance()->session_state_delegate()->LockScreen();
-  lock_window->Focus();
-  EXPECT_TRUE(lock_window->HasFocus());
-  session_window->Focus();
-  EXPECT_FALSE(session_window->HasFocus());
-  Shell::GetInstance()->session_state_delegate()->UnlockScreen();
-
-  // Session not started yet.
-  SetSessionStarted(false);
-  lock_window->Focus();
-  EXPECT_TRUE(lock_window->HasFocus());
-  session_window->Focus();
-  EXPECT_FALSE(session_window->HasFocus());
-  SetSessionStarted(true);
+  for (int block_reason = FIRST_BLOCK_REASON;
+       block_reason < NUMBER_OF_BLOCK_REASONS;
+       ++block_reason) {
+    BlockUserSession(static_cast<UserSessionBlockReason>(block_reason));
+    lock_window->Focus();
+    EXPECT_TRUE(lock_window->HasFocus());
+    session_window->Focus();
+    EXPECT_FALSE(session_window->HasFocus());
+    UnblockUserSession();
+  }
 }
 
 }  // namespace test
diff --git a/ash/session_state_delegate.h b/ash/session_state_delegate.h
index d3ecac8..0f2c569 100644
--- a/ash/session_state_delegate.h
+++ b/ash/session_state_delegate.h
@@ -56,6 +56,11 @@
   // Unlocks the screen.
   virtual void UnlockScreen() = 0;
 
+  // Returns |true| if user session blocked by some overlying UI. It can be
+  // login screen, lock screen or screen for adding users into multi-profile
+  // session.
+  virtual bool IsUserSessionBlocked() const = 0;
+
   // Gets the displayed name for the user with the given |index|.
   // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|.
   virtual const base::string16 GetUserDisplayName(
diff --git a/ash/session_state_delegate_stub.cc b/ash/session_state_delegate_stub.cc
index a05b5bf..31f7345 100644
--- a/ash/session_state_delegate_stub.cc
+++ b/ash/session_state_delegate_stub.cc
@@ -48,6 +48,10 @@
   Shell::GetInstance()->UpdateShelfVisibility();
 }
 
+bool SessionStateDelegateStub::IsUserSessionBlocked() const  {
+  return !IsActiveUserSessionStarted() || IsScreenLocked();
+}
+
 const base::string16 SessionStateDelegateStub::GetUserDisplayName(
     MultiProfileIndex index) const {
   return UTF8ToUTF16("stub-user");
diff --git a/ash/session_state_delegate_stub.h b/ash/session_state_delegate_stub.h
index 81d372f..1843383 100644
--- a/ash/session_state_delegate_stub.h
+++ b/ash/session_state_delegate_stub.h
@@ -26,6 +26,7 @@
   virtual bool IsScreenLocked() const OVERRIDE;
   virtual void LockScreen() OVERRIDE;
   virtual void UnlockScreen() OVERRIDE;
+  virtual bool IsUserSessionBlocked() const OVERRIDE;
   virtual const base::string16 GetUserDisplayName(
       ash::MultiProfileIndex index) const OVERRIDE;
   virtual const std::string GetUserEmail(
diff --git a/ash/system/monitor/tray_monitor.cc b/ash/system/monitor/tray_monitor.cc
index b9e6e63..eb9a4db 100644
--- a/ash/system/monitor/tray_monitor.cc
+++ b/ash/system/monitor/tray_monitor.cc
@@ -5,7 +5,8 @@
 #include "ash/system/monitor/tray_monitor.h"
 
 #include "ash/system/tray/tray_item_view.h"
-#include "base/process_util.h"
+#include "base/process/memory.h"
+#include "base/process/process_metrics.h"
 #include "base/strings/stringprintf.h"
 #include "base/strings/utf_string_conversions.h"
 #include "content/public/browser/gpu_data_manager.h"
diff --git a/ash/system/monitor/tray_monitor.h b/ash/system/monitor/tray_monitor.h
index cd5734f..31c4f14 100644
--- a/ash/system/monitor/tray_monitor.h
+++ b/ash/system/monitor/tray_monitor.h
@@ -8,7 +8,7 @@
 #include <list>
 
 #include "ash/system/tray/system_tray_item.h"
-#include "base/process.h"
+#include "base/process/process.h"
 #include "base/timer/timer.h"
 
 namespace views {
diff --git a/ash/system/tray/system_tray.cc b/ash/system/tray/system_tray.cc
index 929ef35..65b959a 100644
--- a/ash/system/tray/system_tray.cc
+++ b/ash/system/tray/system_tray.cc
@@ -437,6 +437,8 @@
                                            menu_width,
                                            kTrayPopupMaxWidth);
     init_params.can_activate = can_activate;
+    init_params.first_item_has_no_margin =
+        ash::switches::UseAlternateShelfLayout();
     if (detailed) {
       // This is the case where a volume control or brightness control bubble
       // is created.
@@ -470,7 +472,7 @@
 }
 
 void SystemTray::UpdateNotificationBubble() {
-  // Only show the notification buble if we have notifications.
+  // Only show the notification bubble if we have notifications.
   if (notification_items_.empty()) {
     DestroyNotificationBubble();
     return;
@@ -499,6 +501,8 @@
                                          GetAnchorAlignment(),
                                          kTrayPopupMinWidth,
                                          kTrayPopupMaxWidth);
+  init_params.first_item_has_no_margin =
+      ash::switches::UseAlternateShelfLayout();
   init_params.arrow_color = kBackgroundColor;
   init_params.arrow_offset = GetTrayXOffset(notification_items_[0]);
   notification_bubble_.reset(
diff --git a/ash/system/web_notification/web_notification_tray.cc b/ash/system/web_notification/web_notification_tray.cc
index e52ff00..4f47c6b 100644
--- a/ash/system/web_notification/web_notification_tray.cc
+++ b/ash/system/web_notification/web_notification_tray.cc
@@ -263,8 +263,10 @@
 
   should_block_shelf_auto_hide_ = true;
   message_center::MessageCenterBubble* message_center_bubble =
-      new message_center::MessageCenterBubble(message_center(),
-                                              message_center_tray_.get());
+      new message_center::MessageCenterBubble(
+          message_center(),
+          message_center_tray_.get(),
+          ash::switches::UseAlternateShelfLayout());
 
   int max_height = 0;
   aura::Window* status_area_window = status_area_widget()->GetNativeView();
@@ -337,7 +339,8 @@
           GetWidget()->GetNativeView()->GetRootWindow(),
           internal::kShellWindowId_StatusContainer),
       message_center(),
-      message_center_tray_.get()));
+      message_center_tray_.get(),
+      ash::switches::UseAlternateShelfLayout()));
   work_area_observer_.reset(new internal::WorkAreaObserver(
       popup_collection_.get(), GetShelfLayoutManager()));
   return true;
diff --git a/ash/test/ash_test_base.cc b/ash/test/ash_test_base.cc
index 72281af..85ba7ae 100644
--- a/ash/test/ash_test_base.cc
+++ b/ash/test/ash_test_base.cc
@@ -289,5 +289,38 @@
       SetCanLockScreen(can_lock_screen);
 }
 
+void AshTestBase::SetUserAddingScreenRunning(bool user_adding_screen_running) {
+  ash_test_helper_->test_shell_delegate()->test_session_state_delegate()->
+      SetUserAddingScreenRunning(user_adding_screen_running);
+}
+
+void AshTestBase::BlockUserSession(UserSessionBlockReason block_reason) {
+  switch (block_reason) {
+    case BLOCKED_BY_LOCK_SCREEN:
+      SetSessionStarted(true);
+      SetUserAddingScreenRunning(false);
+      Shell::GetInstance()->session_state_delegate()->LockScreen();
+      break;
+    case BLOCKED_BY_LOGIN_SCREEN:
+      SetUserAddingScreenRunning(false);
+      SetSessionStarted(false);
+      break;
+    case BLOCKED_BY_USER_ADDING_SCREEN:
+      SetUserAddingScreenRunning(true);
+      SetSessionStarted(true);
+      break;
+    default:
+      NOTREACHED();
+      break;
+  }
+}
+
+void AshTestBase::UnblockUserSession() {
+  Shell::GetInstance()->session_state_delegate()->UnlockScreen();
+  SetSessionStarted(true);
+  SetUserAddingScreenRunning(false);
+}
+
+
 }  // namespace test
 }  // namespace ash
diff --git a/ash/test/ash_test_base.h b/ash/test/ash_test_base.h
index 62afcd8..c0567be 100644
--- a/ash/test/ash_test_base.h
+++ b/ash/test/ash_test_base.h
@@ -94,6 +94,14 @@
   aura::test::EventGenerator& GetEventGenerator();
 
  protected:
+  enum UserSessionBlockReason {
+    FIRST_BLOCK_REASON,
+    BLOCKED_BY_LOCK_SCREEN = FIRST_BLOCK_REASON,
+    BLOCKED_BY_LOGIN_SCREEN,
+    BLOCKED_BY_USER_ADDING_SCREEN,
+    NUMBER_OF_BLOCK_REASONS
+  };
+
   // True if the running environment supports multiple displays,
   // or false otherwise (e.g. win8 bot).
   static bool SupportsMultipleDisplays();
@@ -109,6 +117,12 @@
   void SetSessionStarted(bool session_started);
   void SetUserLoggedIn(bool user_logged_in);
   void SetCanLockScreen(bool can_lock_screen);
+  void SetUserAddingScreenRunning(bool user_adding_screen_running);
+
+  // Methods to emulate blocking and unblocking user session with given
+  // |block_reason|.
+  void BlockUserSession(UserSessionBlockReason block_reason);
+  void UnblockUserSession();
 
  private:
   bool setup_called_;
diff --git a/ash/test/test_session_state_delegate.cc b/ash/test/test_session_state_delegate.cc
index 7af9e3c..f7812d7 100644
--- a/ash/test/test_session_state_delegate.cc
+++ b/ash/test/test_session_state_delegate.cc
@@ -17,6 +17,7 @@
       active_user_session_started_(false),
       can_lock_screen_(true),
       screen_locked_(false),
+      user_adding_screen_running_(false),
       logged_in_users_(1) {
 }
 
@@ -53,6 +54,11 @@
   screen_locked_ = false;
 }
 
+bool TestSessionStateDelegate::IsUserSessionBlocked() const {
+  return !IsActiveUserSessionStarted() || IsScreenLocked() ||
+      user_adding_screen_running_;
+}
+
 void TestSessionStateDelegate::SetHasActiveUser(bool has_active_user) {
   has_active_user_ = has_active_user;
   if (!has_active_user)
@@ -76,6 +82,11 @@
   can_lock_screen_ = can_lock_screen;
 }
 
+void TestSessionStateDelegate::SetUserAddingScreenRunning(
+    bool user_adding_screen_running) {
+  user_adding_screen_running_ = user_adding_screen_running;
+}
+
 const base::string16 TestSessionStateDelegate::GetUserDisplayName(
     MultiProfileIndex index) const {
   return UTF8ToUTF16("Über tray Über tray Über tray Über tray");
diff --git a/ash/test/test_session_state_delegate.h b/ash/test/test_session_state_delegate.h
index f9466ff..520c634 100644
--- a/ash/test/test_session_state_delegate.h
+++ b/ash/test/test_session_state_delegate.h
@@ -29,6 +29,7 @@
   virtual bool IsScreenLocked() const OVERRIDE;
   virtual void LockScreen() OVERRIDE;
   virtual void UnlockScreen() OVERRIDE;
+  virtual bool IsUserSessionBlocked() const OVERRIDE;
   virtual const base::string16 GetUserDisplayName(
       ash::MultiProfileIndex index) const OVERRIDE;
   virtual const std::string GetUserEmail(
@@ -61,6 +62,10 @@
   // is an active user.
   void SetCanLockScreen(bool can_lock_screen);
 
+  // Updates the internal state that indicates whether user adding screen is
+  // running now.
+  void SetUserAddingScreenRunning(bool user_adding_screen_running);
+
  private:
   // Whether a session is in progress and there is an active user.
   bool has_active_user_;
@@ -77,6 +82,9 @@
   // Whether the screen is currently locked.
   bool screen_locked_;
 
+  // Whether user addding screen is running now.
+  bool user_adding_screen_running_;
+
   // The number of users logged in.
   int logged_in_users_;
 
diff --git a/ash/wm/app_list_controller.cc b/ash/wm/app_list_controller.cc
index 7685993..68845b0 100644
--- a/ash/wm/app_list_controller.cc
+++ b/ash/wm/app_list_controller.cc
@@ -38,6 +38,16 @@
 // The maximum shift in pixels when over-scroll happens.
 const int kMaxOverScrollShift = 48;
 
+// The alternate shelf style adjusts the bubble to be flush with the shelf
+// when there is no bubble-tip. This is the tip height which needs to be
+// offsetted.
+const int kArrowTipHeight = 10;
+
+// The minimal anchor position offset to make sure that the bubble is still on
+// the screen with 8 pixels spacing on the left / right. This constant is a
+// result of minimal bubble arrow sizes and offsets.
+const int kMinimalAnchorPositionOffset = 60;
+
 ui::Layer* GetLayer(views::Widget* widget) {
   return widget->GetNativeView()->layer();
 }
@@ -77,6 +87,44 @@
   return offseted;
 }
 
+// Using |button_bounds|, determine the anchor so that the bubble gets shown
+// above the shelf (used for the alternate shelf theme).
+gfx::Point GetAdjustAnchorPositionToShelf(
+    const gfx::Rect& button_bounds, views::Widget* widget) {
+  DCHECK(Shell::HasInstance());
+  ShelfAlignment shelf_alignment = Shell::GetInstance()->GetShelfAlignment(
+      widget->GetNativeView()->GetRootWindow());
+  gfx::Point anchor(button_bounds.CenterPoint());
+  switch (shelf_alignment) {
+    case SHELF_ALIGNMENT_TOP:
+    case SHELF_ALIGNMENT_BOTTOM:
+      {
+        if (base::i18n::IsRTL()) {
+          int screen_width = widget->GetWorkAreaBoundsInScreen().width();
+          anchor.set_x(std::min(screen_width - kMinimalAnchorPositionOffset,
+                                anchor.x()));
+        } else {
+          anchor.set_x(std::max(kMinimalAnchorPositionOffset, anchor.x()));
+        }
+        int offset = button_bounds.height() / 2 - kArrowTipHeight;
+        if (shelf_alignment == SHELF_ALIGNMENT_TOP)
+          offset = -offset;
+        anchor.set_y(anchor.y() - offset);
+      }
+      break;
+    case SHELF_ALIGNMENT_LEFT:
+      anchor.set_x(button_bounds.right() - kArrowTipHeight);
+      anchor.set_y(std::max(kMinimalAnchorPositionOffset, anchor.y()));
+      break;
+    case SHELF_ALIGNMENT_RIGHT:
+      anchor.set_x(button_bounds.x() + kArrowTipHeight);
+      anchor.set_y(std::max(kMinimalAnchorPositionOffset, anchor.y()));
+      break;
+  }
+
+  return anchor;
+}
+
 }  // namespace
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -121,22 +169,19 @@
         Shell::GetInstance()->delegate()->CreateAppListViewDelegate());
     aura::Window* container = GetRootWindowController(window->GetRootWindow())->
         GetContainer(kShellWindowId_AppListContainer);
-    // TODO(harrym): find a better solution for this.
     if (ash::switches::UseAlternateShelfLayout()) {
       gfx::Rect applist_button_bounds = Launcher::ForWindow(container)->
           GetAppListButtonView()->GetBoundsInScreen();
-      gfx::Point anchor = applist_button_bounds.origin();
-      if (anchor.x() == 0)
-        anchor.set_x(applist_button_bounds.right());
-      if (anchor.y() == 0)
-        anchor.set_y(applist_button_bounds.bottom());
       view->InitAsBubble(
           container,
           pagination_model_.get(),
           NULL,
-          anchor,
+          GetAdjustAnchorPositionToShelf(applist_button_bounds,
+              Launcher::ForWindow(container)->GetAppListButtonView()->
+                  GetWidget()),
           GetBubbleArrow(container),
           true /* border_accepts_events */);
+      view->SetArrowPaintType(views::BubbleBorder::PAINT_NONE);
     } else {
       view->InitAsBubble(
           container,
@@ -146,8 +191,6 @@
           GetBubbleArrow(container),
           true /* border_accepts_events */);
     }
-    if (ash::switches::UseAlternateShelfLayout())
-      view->SetArrowPaintType(views::BubbleBorder::PAINT_NONE);
     SetView(view);
   }
 }
diff --git a/ash/wm/dock/docked_window_layout_manager.cc b/ash/wm/dock/docked_window_layout_manager.cc
index c991dc4..d9d1c07 100644
--- a/ash/wm/dock/docked_window_layout_manager.cc
+++ b/ash/wm/dock/docked_window_layout_manager.cc
@@ -29,6 +29,7 @@
 const int DockedWindowLayoutManager::kMinDockWidth = 200;
 const int DockedWindowLayoutManager::kMaxDockWidth = 450;
 const int DockedWindowLayoutManager::kMinDockGap = 2;
+const int kWindowIdealSpacing = 4;
 
 namespace {
 
@@ -49,6 +50,11 @@
           window->type() != aura::client::WINDOW_TYPE_POPUP);
 }
 
+bool CompareWindowPos(const aura::Window* win1, const aura::Window* win2) {
+  return win1->GetTargetBounds().CenterPoint().y() <
+      win2->GetTargetBounds().CenterPoint().y();
+}
+
 }  // namespace
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -62,7 +68,8 @@
       shelf_layout_manager_(NULL),
       shelf_hidden_(false),
       docked_width_(0),
-      alignment_(DOCKED_ALIGNMENT_NONE) {
+      alignment_(DOCKED_ALIGNMENT_NONE),
+      last_active_window_(NULL) {
   DCHECK(dock_container);
   aura::client::GetActivationClient(Shell::GetPrimaryRootWindow())->
       AddObserver(this);
@@ -127,7 +134,13 @@
     if (!found_docked_window)
       alignment_ = AlignmentOfWindow(dragged_window_);
   }
-  dragged_window_ = NULL;
+
+  // We no longer need to observe |dragged_window_| unless it is added back;
+  if (dragged_window_) {
+    if (dragged_window_->parent() != dock_container_)
+      dragged_window_->RemoveObserver(this);
+    dragged_window_ = NULL;
+  }
 
   Relayout();
   UpdateDockBounds();
@@ -226,7 +239,10 @@
   // If this is the first window getting docked - update alignment.
   if (alignment_ == DOCKED_ALIGNMENT_NONE)
     alignment_ = AlignmentOfWindow(child);
-  child->AddObserver(this);
+  // We need to observe a child unless it is a |dragged_window_| that just got
+  // added back in which case we are already observing it.
+  if (child != dragged_window_)
+    child->AddObserver(this);
   Relayout();
   UpdateDockBounds();
 }
@@ -248,7 +264,14 @@
   if (!found_docked_window)
     alignment_ = DOCKED_ALIGNMENT_NONE;
 
-  child->RemoveObserver(this);
+  // Keep track of former children if they are dragged as they can be reparented
+  // temporarily just for the drag.
+  if (child != dragged_window_)
+    child->RemoveObserver(this);
+
+  if (last_active_window_ == child)
+    last_active_window_ = NULL;
+
   // Close the dock and expand workspace work area.
   Relayout();
 
@@ -326,6 +349,20 @@
     RestoreWindow(window);
 }
 
+void DockedWindowLayoutManager::OnWindowBoundsChanged(
+    aura::Window* window,
+    const gfx::Rect& old_bounds,
+    const gfx::Rect& new_bounds) {
+  if (window == dragged_window_)
+    Relayout();
+}
+
+void DockedWindowLayoutManager::OnWindowDestroying(aura::Window* window) {
+  if (dragged_window_ == window)
+    dragged_window_ = NULL;
+}
+
+
 ////////////////////////////////////////////////////////////////////////////////
 // DockLayoutManager, aura::client::ActivationChangeObserver implementation:
 
@@ -408,6 +445,7 @@
 
   gfx::Rect dock_bounds = dock_container_->bounds();
   aura::Window* active_window = NULL;
+  aura::Window::Windows visible_windows;
   docked_width_ = 0;
   for (size_t i = 0; i < dock_container_->children().size(); ++i) {
     aura::Window* window(dock_container_->children()[i]);
@@ -423,35 +461,71 @@
       window->Hide();
       continue;
     }
-
     if (window->HasFocus() ||
         window->Contains(
             aura::client::GetFocusClient(window)->GetFocusedWindow())) {
       DCHECK(!active_window);
       active_window = window;
     }
+    visible_windows.push_back(window);
+  }
 
-    // all docked windows other than the one currently dragged remain stuck
-    // to the screen edge
+  // Consider windows that were formerly children of the |dock_container_|
+  // when fanning out other child windows.
+  if (dragged_window_ && dragged_window_->parent() != dock_container_)
+    visible_windows.push_back(dragged_window_);
+
+  // Sort windows by their center positions and fan out overlapping
+  // windows.
+  std::sort(visible_windows.begin(), visible_windows.end(), CompareWindowPos);
+  gfx::Display display = Shell::GetScreen()->GetDisplayNearestWindow(
+      dock_container_);
+  const gfx::Rect work_area = display.work_area();
+  int available_room = work_area.height();
+  for (aura::Window::Windows::const_iterator iter = visible_windows.begin();
+      iter != visible_windows.end(); ++iter) {
+    available_room -= (*iter)->bounds().height();
+  }
+  const int num_windows = visible_windows.size();
+  const float delta = (float)available_room /
+      ((available_room > 0 || num_windows <= 1) ?
+          num_windows + 1 : num_windows - 1);
+  float y_pos = (available_room > 0) ? delta : 0;
+
+  for (aura::Window::Windows::const_iterator iter = visible_windows.begin();
+      iter != visible_windows.end(); ++iter) {
+    aura::Window* window = *iter;
     gfx::Rect bounds = window->GetTargetBounds();
-    if (window != dragged_window_) {
-      switch (alignment_) {
-        case DOCKED_ALIGNMENT_LEFT:
-          bounds.set_x(0);
-          break;
-        case DOCKED_ALIGNMENT_RIGHT:
-          bounds.set_x(dock_bounds.right() - bounds.width());
-          break;
-        case DOCKED_ALIGNMENT_NONE:
-          NOTREACHED() << "Relayout called when dock alignment is 'NONE'";
-          break;
-      }
-      // Keep the dock at least kMinDockWidth when all windows in it overhang.
-      docked_width_ = std::min(kMaxDockWidth,
-                               std::max(docked_width_,
-                                        bounds.width() > kMaxDockWidth ?
-                                            kMinDockWidth : bounds.width()));
+    // Do not force position of a single window.
+    if (num_windows == 1)
+      y_pos = bounds.y();
+
+    // Fan out windows evenly distributing the overlap or remaining free space.
+    bounds.set_y(std::max(work_area.y(),
+                          std::min(work_area.bottom() - bounds.height(),
+                                   static_cast<int>(y_pos + 0.5))));
+    y_pos += bounds.height() + delta;
+
+    // All docked windows other than the one currently dragged remain stuck
+    // to the screen edge.
+    if (window == dragged_window_)
+      continue;
+    switch (alignment_) {
+      case DOCKED_ALIGNMENT_LEFT:
+        bounds.set_x(0);
+        break;
+      case DOCKED_ALIGNMENT_RIGHT:
+        bounds.set_x(dock_bounds.right() - bounds.width());
+        break;
+      case DOCKED_ALIGNMENT_NONE:
+        NOTREACHED() << "Relayout called when dock alignment is 'NONE'";
+        break;
     }
+    // Keep the dock at least kMinDockWidth when all windows in it overhang.
+    docked_width_ = std::min(kMaxDockWidth,
+                             std::max(docked_width_,
+                                      bounds.width() > kMaxDockWidth ?
+                                          kMinDockWidth : bounds.width()));
     SetChildBoundsDirect(window, bounds);
   }
   UpdateStacking(active_window);
@@ -475,8 +549,57 @@
 }
 
 void DockedWindowLayoutManager::UpdateStacking(aura::Window* active_window) {
-  // TODO(varkha): Implement restacking to ensure that all docked windows are at
-  // least partially visible and selectable.
+  if (!active_window) {
+    if (!last_active_window_)
+      return;
+    active_window = last_active_window_;
+  }
+
+  // We want to to stack the windows like a deck of cards:
+  //  ,------.
+  // |,------.|
+  // |,------.|
+  // | active |
+  // | window |
+  // |`------'|
+  // |`------'|
+  //  `------'
+  // We use the middle of each window to figure out how to stack the window.
+  // This allows us to update the stacking when a window is being dragged around
+  // by the titlebar.
+  std::map<int, aura::Window*> window_ordering;
+  for (aura::Window::Windows::const_iterator it =
+           dock_container_->children().begin();
+       it != dock_container_->children().end(); ++it) {
+    gfx::Rect bounds = (*it)->bounds();
+    window_ordering.insert(std::make_pair(bounds.y() + bounds.height() / 2,
+                                          *it));
+  }
+  int active_center_y = active_window->bounds().CenterPoint().y();
+
+  aura::Window* previous_window = NULL;
+  for (std::map<int, aura::Window*>::const_iterator it =
+       window_ordering.begin();
+       it != window_ordering.end() && it->first < active_center_y; ++it) {
+    if (previous_window)
+      dock_container_->StackChildAbove(it->second, previous_window);
+    previous_window = it->second;
+  }
+
+  previous_window = NULL;
+  for (std::map<int, aura::Window*>::const_reverse_iterator it =
+       window_ordering.rbegin();
+       it != window_ordering.rend() && it->first > active_center_y; ++it) {
+    if (previous_window)
+      dock_container_->StackChildAbove(it->second, previous_window);
+    previous_window = it->second;
+  }
+
+  if (active_window->parent() == dock_container_)
+    dock_container_->StackChildAtTop(active_window);
+  if (dragged_window_ && dragged_window_->parent() == dock_container_)
+    dock_container_->StackChildAtTop(dragged_window_);
+  last_active_window_ = active_window;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
diff --git a/ash/wm/dock/docked_window_layout_manager.h b/ash/wm/dock/docked_window_layout_manager.h
index c5ef469..28c81fc 100644
--- a/ash/wm/dock/docked_window_layout_manager.h
+++ b/ash/wm/dock/docked_window_layout_manager.h
@@ -103,6 +103,10 @@
   virtual void OnWindowPropertyChanged(aura::Window* window,
                                        const void* key,
                                        intptr_t old) OVERRIDE;
+  virtual void OnWindowBoundsChanged(aura::Window* window,
+                                     const gfx::Rect& old_bounds,
+                                     const gfx::Rect& new_bounds) OVERRIDE;
+  virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
 
   // aura::client::ActivationChangeObserver:
   virtual void OnWindowActivated(aura::Window* gained_active,
@@ -174,6 +178,10 @@
   // Side of the screen that the dock is positioned at.
   DockedAlignment alignment_;
 
+  // The last active window. Used to maintain stacking order even if no windows
+  // are currently focused.
+  aura::Window* last_active_window_;
+
   // Observers of dock bounds changes.
   ObserverList<DockedWindowLayoutManagerObserver> observer_list_;
 
diff --git a/ash/wm/dock/docked_window_layout_manager_unittest.cc b/ash/wm/dock/docked_window_layout_manager_unittest.cc
index 81d1caf..f3e6647 100644
--- a/ash/wm/dock/docked_window_layout_manager_unittest.cc
+++ b/ash/wm/dock/docked_window_layout_manager_unittest.cc
@@ -8,6 +8,7 @@
 #include "ash/launcher/launcher.h"
 #include "ash/launcher/launcher_model.h"
 #include "ash/root_window_controller.h"
+#include "ash/screen_ash.h"
 #include "ash/shelf/shelf_layout_manager.h"
 #include "ash/shelf/shelf_types.h"
 #include "ash/shelf/shelf_widget.h"
@@ -44,7 +45,7 @@
     CommandLine::ForCurrentProcess()->AppendSwitch(
         ash::switches::kAshEnableDockedWindows);
     AshTestBase::SetUp();
-    UpdateDisplay("600x400");
+    UpdateDisplay("600x600");
     ASSERT_TRUE(test::TestLauncherDelegate::instance());
 
     launcher_view_test_.reset(new test::LauncherViewTestAPI(
@@ -154,6 +155,20 @@
         window_type_ == aura::client::WINDOW_TYPE_PANEL ? -100 : 20);
   }
 
+  void DragToVerticalPositionAndToEdge(DockedEdge edge,
+                                       aura::Window* window,
+                                       int y) {
+    DragToVerticalPositionRelativeToEdge(edge, window, 0, y);
+  }
+
+  void DragToVerticalPositionRelativeToEdge(DockedEdge edge,
+                                            aura::Window* window,
+                                            int dx,
+                                            int y) {
+    gfx::Rect initial_bounds = window->GetBoundsInScreen();
+    DragVerticallyAndRelativeToEdge(edge, window, dx, y - initial_bounds.y());
+  }
+
   // Detach if our window is a panel, then drag it vertically by |dy| and
   // horizontally to the edge with an added offset from the edge of |dx|.
   void DragVerticallyAndRelativeToEdge(DockedEdge edge,
@@ -184,7 +199,7 @@
     }
 
     // avoid snap by clicking away from the border
-    ASSERT_NO_FATAL_FAILURE(DragStartAtOffsetFromwindowOrigin(window, 5, 5));
+    ASSERT_NO_FATAL_FAILURE(DragStartAtOffsetFromwindowOrigin(window, 25, 5));
 
     // Drag the window left or right to the edge (or almost to it).
     if (edge == DOCKED_EDGE_LEFT)
@@ -197,8 +212,9 @@
     DragEnd();
 
     // x-coordinate can get adjusted by snapping or sticking.
-    // y-coordinate should not change by possible docking.
-    EXPECT_EQ(initial_bounds.y() + dy, window->GetBoundsInScreen().y());
+    // y-coordinate could be changed by possible automatic layout if docked.
+    if (window->parent()->id() != internal::kShellWindowId_DockedContainer)
+      EXPECT_EQ(initial_bounds.y() + dy, window->GetBoundsInScreen().y());
   }
 
  private:
@@ -228,8 +244,124 @@
   EXPECT_EQ(internal::kShellWindowId_DockedContainer, window->parent()->id());
 }
 
-//TODO(varkha): Add more tests for fanning windows in the dock.
-// See http://crbug.com/233334.
+// Adds two windows and tests that the gaps are evenly distributed.
+TEST_P(DockedWindowLayoutManagerTest, AddTwoWindows) {
+  if (!SupportsHostWindowResize())
+    return;
+
+  scoped_ptr<aura::Window> w1(CreateTestWindow(gfx::Rect(0, 0, 201, 201)));
+  scoped_ptr<aura::Window> w2(CreateTestWindow(gfx::Rect(0, 0, 210, 202)));
+  DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, w1.get(), 20);
+  DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, w2.get(), 300);
+
+  // The windows should be attached and snapped to the right side of the screen.
+  EXPECT_EQ(w1->GetRootWindow()->bounds().right(),
+            w1->GetBoundsInScreen().right());
+  EXPECT_EQ(internal::kShellWindowId_DockedContainer, w1->parent()->id());
+  EXPECT_EQ(w2->GetRootWindow()->bounds().right(),
+            w2->GetBoundsInScreen().right());
+  EXPECT_EQ(internal::kShellWindowId_DockedContainer, w2->parent()->id());
+
+  // Test that the gaps differ at most by a single pixel.
+  int gap1 = w1->GetBoundsInScreen().y();
+  int gap2 = w2->GetBoundsInScreen().y() - w1->GetBoundsInScreen().bottom();
+  int gap3 = ScreenAsh::GetDisplayWorkAreaBoundsInParent(w1.get()).bottom() -
+      w2->GetBoundsInScreen().bottom();
+  EXPECT_LE(abs(gap1 - gap2), 1);
+  EXPECT_LE(abs(gap2 - gap3), 1);
+  EXPECT_LE(abs(gap3 - gap1), 1);
+}
+
+// Adds two non-overlapping windows and tests layout after a drag.
+TEST_P(DockedWindowLayoutManagerTest, TwoWindowsDragging) {
+  if (!SupportsHostWindowResize())
+    return;
+
+  scoped_ptr<aura::Window> w1(CreateTestWindow(gfx::Rect(0, 0, 201, 201)));
+  scoped_ptr<aura::Window> w2(CreateTestWindow(gfx::Rect(0, 0, 210, 202)));
+  DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, w1.get(), 20);
+  DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, w2.get(), 300);
+
+  // The windows should be attached and snapped to the right side of the screen.
+  EXPECT_EQ(w1->GetRootWindow()->bounds().right(),
+            w1->GetBoundsInScreen().right());
+  EXPECT_EQ(internal::kShellWindowId_DockedContainer, w1->parent()->id());
+  EXPECT_EQ(w2->GetRootWindow()->bounds().right(),
+            w2->GetBoundsInScreen().right());
+  EXPECT_EQ(internal::kShellWindowId_DockedContainer, w2->parent()->id());
+
+  // Drag w2 above w1.
+  ASSERT_NO_FATAL_FAILURE(DragStartAtOffsetFromwindowOrigin(w2.get(), 0, 20));
+  DragMove(0, w1->bounds().y() - w2->bounds().y() - 20);
+  DragEnd();
+
+  // Test the new windows order and that the gaps differ at most by a pixel.
+  int gap1 = w2->GetBoundsInScreen().y();
+  int gap2 = w1->GetBoundsInScreen().y() - w2->GetBoundsInScreen().bottom();
+  int gap3 = ScreenAsh::GetDisplayWorkAreaBoundsInParent(w1.get()).bottom() -
+      w1->GetBoundsInScreen().bottom();
+  EXPECT_LE(abs(gap1 - gap2), 1);
+  EXPECT_LE(abs(gap2 - gap3), 1);
+  EXPECT_LE(abs(gap3 - gap1), 1);
+}
+
+// Adds three overlapping windows and tests layout after a drag.
+TEST_P(DockedWindowLayoutManagerTest, ThreeWindowsDragging) {
+  if (!SupportsHostWindowResize())
+    return;
+
+  scoped_ptr<aura::Window> w1(CreateTestWindow(gfx::Rect(0, 0, 201, 201)));
+  DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, w1.get(), 20);
+  scoped_ptr<aura::Window> w2(CreateTestWindow(gfx::Rect(0, 0, 210, 202)));
+  DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, w2.get(), 100);
+  scoped_ptr<aura::Window> w3(CreateTestWindow(gfx::Rect(0, 0, 220, 204)));
+  DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, w3.get(), 300);
+
+  // All windows should be attached and snapped to the right side of the screen.
+  EXPECT_EQ(w1->GetRootWindow()->bounds().right(),
+            w1->GetBoundsInScreen().right());
+  EXPECT_EQ(internal::kShellWindowId_DockedContainer, w1->parent()->id());
+  EXPECT_EQ(w2->GetRootWindow()->bounds().right(),
+            w2->GetBoundsInScreen().right());
+  EXPECT_EQ(internal::kShellWindowId_DockedContainer, w2->parent()->id());
+  EXPECT_EQ(w3->GetRootWindow()->bounds().right(),
+            w3->GetBoundsInScreen().right());
+  EXPECT_EQ(internal::kShellWindowId_DockedContainer, w3->parent()->id());
+
+  // Test that the top and bottom windows are clamped in work area and
+  // that the overlaps between the windows differ at most by a pixel.
+  int overlap1 = w1->GetBoundsInScreen().y();
+  int overlap2 = w1->GetBoundsInScreen().bottom() - w2->GetBoundsInScreen().y();
+  int overlap3 = w2->GetBoundsInScreen().bottom() - w3->GetBoundsInScreen().y();
+  int overlap4 =
+      ScreenAsh::GetDisplayWorkAreaBoundsInParent(w3.get()).bottom() -
+      w3->GetBoundsInScreen().bottom();
+  EXPECT_EQ(0, overlap1);
+  EXPECT_LE(abs(overlap2 - overlap3), 1);
+  EXPECT_EQ(0, overlap4);
+
+  // Drag w1 below w2.
+  ASSERT_NO_FATAL_FAILURE(DragStartAtOffsetFromwindowOrigin(w1.get(), 0, 20));
+  DragMove(0, w2->bounds().y() - w1->bounds().y() + 20);
+
+  // During the drag the windows get rearranged and the top and the bottom
+  // should be clamped by the work area.
+  EXPECT_EQ(0, w2->GetBoundsInScreen().y());
+  EXPECT_GT(w1->GetBoundsInScreen().y(), w2->GetBoundsInScreen().y());
+  EXPECT_EQ(ScreenAsh::GetDisplayWorkAreaBoundsInParent(w3.get()).bottom(),
+            w3->GetBoundsInScreen().bottom());
+  DragEnd();
+
+  // Test the new windows order and that the overlaps differ at most by a pixel.
+  overlap1 = w2->GetBoundsInScreen().y();
+  overlap2 = w2->GetBoundsInScreen().bottom() - w1->GetBoundsInScreen().y();
+  overlap3 = w1->GetBoundsInScreen().bottom() - w3->GetBoundsInScreen().y();
+  overlap4 = ScreenAsh::GetDisplayWorkAreaBoundsInParent(w3.get()).bottom() -
+      w3->GetBoundsInScreen().bottom();
+  EXPECT_EQ(0, overlap1);
+  EXPECT_LE(abs(overlap2 - overlap3), 1);
+  EXPECT_EQ(0, overlap4);
+}
 
 // Tests run twice - on both panels and normal windows
 INSTANTIATE_TEST_CASE_P(NormalOrPanel,
diff --git a/ash/wm/dock/docked_window_resizer_unittest.cc b/ash/wm/dock/docked_window_resizer_unittest.cc
index 7e1ea23..0a5aa0a 100644
--- a/ash/wm/dock/docked_window_resizer_unittest.cc
+++ b/ash/wm/dock/docked_window_resizer_unittest.cc
@@ -224,8 +224,9 @@
     DragEnd();
 
     // x-coordinate can get adjusted by snapping or sticking.
-    // y-coordinate should not change by possible docking.
-    EXPECT_EQ(initial_bounds.y() + dy, window->GetBoundsInScreen().y());
+    // y-coordinate could be changed by possible automatic layout if docked.
+    if (window->parent()->id() != internal::kShellWindowId_DockedContainer)
+      EXPECT_EQ(initial_bounds.y() + dy, window->GetBoundsInScreen().y());
   }
 
   bool test_panels() const {
@@ -454,9 +455,10 @@
             w2->GetBoundsInScreen().right());
   EXPECT_EQ(internal::kShellWindowId_DockedContainer, w2->parent()->id());
 
-  // Detach by dragging left (should get undocked)
+  // Detach by dragging left (should get undocked).
   ASSERT_NO_FATAL_FAILURE(DragStart(w2.get()));
-  DragMove(-32, -10);
+  // Drag up as well to avoid attaching panels to launcher shelf.
+  DragMove(-32, -100);
   // Release the mouse and the window should be no longer attached to the edge.
   DragEnd();
 
@@ -651,7 +653,8 @@
       w2.get(),
       w2->bounds().width()/2 + 10,
       0));
-  DragMove(-(w2->bounds().width()/2 + 20), 10);
+  // Drag up as well to avoid attaching panels to launcher shelf.
+  DragMove(-(w2->bounds().width()/2 + 20), -100);
   // Release the mouse and the window should be no longer attached to the edge.
   DragEnd();
 
@@ -985,7 +988,8 @@
 
   // Undock the second window. Docked area should shrink to its minimum size.
   ASSERT_NO_FATAL_FAILURE(DragStart(w2.get()));
-  DragMove(-40, 10);
+  // Drag up as well to avoid attaching panels to launcher shelf.
+  DragMove(-40, -100);
   // Alignment set to "RIGHT" since we have another window docked.
   EXPECT_EQ(DOCKED_ALIGNMENT_RIGHT, manager->alignment_);
   // Release the mouse and the window should be no longer attached to the edge.
diff --git a/ash/wm/event_client_impl.cc b/ash/wm/event_client_impl.cc
index 9e121d1..fcdc1b4 100644
--- a/ash/wm/event_client_impl.cc
+++ b/ash/wm/event_client_impl.cc
@@ -23,10 +23,7 @@
   const aura::RootWindow* root_window = window ? window->GetRootWindow() : NULL;
   if (!root_window)
     return true;
-  ash::SessionStateDelegate* state_delegate =
-      Shell::GetInstance()->session_state_delegate();
-  if (!state_delegate->IsActiveUserSessionStarted() ||
-      state_delegate->IsScreenLocked()) {
+  if (Shell::GetInstance()->session_state_delegate()->IsUserSessionBlocked()) {
     const aura::Window* lock_screen_containers = Shell::GetContainer(
         root_window,
         kShellWindowId_LockScreenContainersContainer);
diff --git a/ash/wm/panels/panel_layout_manager.h b/ash/wm/panels/panel_layout_manager.h
index 9d72fc1..f3b128c 100644
--- a/ash/wm/panels/panel_layout_manager.h
+++ b/ash/wm/panels/panel_layout_manager.h
@@ -172,8 +172,8 @@
   // Tracks the visibility of the shelf. Defaults to false when there is no
   // shelf.
   bool shelf_hidden_;
-  // The last active panel. Used to maintain stacking even if no panels are
-  // currently focused.
+  // The last active panel. Used to maintain stacking order even if no panels
+  // are currently focused.
   aura::Window* last_active_panel_;
   base::WeakPtrFactory<PanelLayoutManager> weak_factory_;
 
diff --git a/ash/wm/stacking_controller.cc b/ash/wm/stacking_controller.cc
index 24f38d5..026924c 100644
--- a/ash/wm/stacking_controller.cc
+++ b/ash/wm/stacking_controller.cc
@@ -129,8 +129,7 @@
   // background pages) assume that the window belongs to user session.
   SessionStateDelegate* session_state_delegate =
       Shell::GetInstance()->session_state_delegate();
-  if ((!session_state_delegate->IsScreenLocked() &&
-       session_state_delegate->IsActiveUserSessionStarted()) ||
+  if (!session_state_delegate->IsUserSessionBlocked() ||
       !window->transient_parent()) {
     return GetContainerById(root,
                             internal::kShellWindowId_SystemModalContainer);
diff --git a/ash/wm/system_modal_container_layout_manager.cc b/ash/wm/system_modal_container_layout_manager.cc
index 9d1ed1b..9b23e62 100644
--- a/ash/wm/system_modal_container_layout_manager.cc
+++ b/ash/wm/system_modal_container_layout_manager.cc
@@ -66,9 +66,7 @@
          child->type() == aura::client::WINDOW_TYPE_POPUP);
   DCHECK(
       container_->id() != internal::kShellWindowId_LockSystemModalContainer ||
-      Shell::GetInstance()->session_state_delegate()->IsScreenLocked() ||
-      !Shell::GetInstance()->session_state_delegate()->
-          IsActiveUserSessionStarted());
+      Shell::GetInstance()->session_state_delegate()->IsUserSessionBlocked());
 
   child->AddObserver(this);
   if (child->GetProperty(aura::client::kModalKey) != ui::MODAL_TYPE_NONE)
@@ -121,11 +119,6 @@
     modal_background_ = NULL;
 }
 
-
-////////////////////////////////////////////////////////////////////////////////
-// SystemModalContainerLayoutManager,
-//     SystemModalContainerEventFilter::Delegate implementation:
-
 bool SystemModalContainerLayoutManager::CanWindowReceiveEvents(
     aura::Window* window) {
   // We could get when we're at lock screen and there is modal window at
@@ -138,7 +131,7 @@
     return true;
   // This container can not handle events if the screen is locked and it is not
   // above the lock screen layer (crbug.com/110920).
-  if (Shell::GetInstance()->session_state_delegate()->IsScreenLocked() &&
+  if (Shell::GetInstance()->session_state_delegate()->IsUserSessionBlocked() &&
       container_->id() < ash::internal::kShellWindowId_LockScreenContainer)
     return true;
   return wm::GetActivatableWindow(window) == modal_window();
diff --git a/ash/wm/system_modal_container_layout_manager_unittest.cc b/ash/wm/system_modal_container_layout_manager_unittest.cc
index 35891ef..52643f4 100644
--- a/ash/wm/system_modal_container_layout_manager_unittest.cc
+++ b/ash/wm/system_modal_container_layout_manager_unittest.cc
@@ -311,33 +311,34 @@
   e1.ClickLeftButton();
   EXPECT_EQ(1, transient_delegate->mouse_presses());
 
-  // Create a window in the lock screen container and ensure that it receives
-  // the mouse event instead of the modal window (crbug.com/110920).
-  Shell::GetInstance()->session_state_delegate()->LockScreen();
-  EventTestWindow* lock_delegate = new EventTestWindow(false);
-  scoped_ptr<aura::Window> lock(lock_delegate->OpenTestWindowWithParent(
-      Shell::GetPrimaryRootWindowController()->GetContainer(
-          ash::internal::kShellWindowId_LockScreenContainer)));
-  EXPECT_TRUE(wm::IsActiveWindow(lock.get()));
-  e1.ClickLeftButton();
-  EXPECT_EQ(1, lock_delegate->mouse_presses());
+  for (int block_reason = FIRST_BLOCK_REASON;
+       block_reason < NUMBER_OF_BLOCK_REASONS;
+       ++block_reason) {
+    // Create a window in the lock screen container and ensure that it receives
+    // the mouse event instead of the modal window (crbug.com/110920).
+    BlockUserSession(static_cast<UserSessionBlockReason>(block_reason));
+    EventTestWindow* lock_delegate = new EventTestWindow(false);
+    scoped_ptr<aura::Window> lock(lock_delegate->OpenTestWindowWithParent(
+        Shell::GetPrimaryRootWindowController()->GetContainer(
+            ash::internal::kShellWindowId_LockScreenContainer)));
+    EXPECT_TRUE(wm::IsActiveWindow(lock.get()));
+    e1.ClickLeftButton();
+    EXPECT_EQ(1, lock_delegate->mouse_presses());
 
-  // Make sure that a modal container created by the lock screen can still
-  // receive mouse events.
-  EventTestWindow* lock_modal_delegate = new EventTestWindow(true);
-  aura::Window* lock_modal =
-      lock_modal_delegate->OpenTestWindowWithParent(lock.get());
-  EXPECT_TRUE(wm::IsActiveWindow(lock_modal));
-  e1.ClickLeftButton();
-  EXPECT_EQ(1, lock_modal_delegate->mouse_presses());
-
-  // Verify that none of the other containers received any more mouse presses.
-  EXPECT_EQ(1, main_delegate->mouse_presses());
-  EXPECT_EQ(1, transient_delegate->mouse_presses());
-  EXPECT_EQ(1, lock_delegate->mouse_presses());
-  EXPECT_EQ(1, lock_modal_delegate->mouse_presses());
-
-  Shell::GetInstance()->session_state_delegate()->UnlockScreen();
+    // Make sure that a modal container created by the lock screen can still
+    // receive mouse events.
+    EventTestWindow* lock_modal_delegate = new EventTestWindow(true);
+    aura::Window* lock_modal =
+        lock_modal_delegate->OpenTestWindowWithParent(lock.get());
+    EXPECT_TRUE(wm::IsActiveWindow(lock_modal));
+    e1.ClickLeftButton();
+    // Verify that none of the other containers received any more mouse presses.
+    EXPECT_EQ(1, lock_modal_delegate->mouse_presses());
+    EXPECT_EQ(1, lock_delegate->mouse_presses());
+    EXPECT_EQ(1, main_delegate->mouse_presses());
+    EXPECT_EQ(1, transient_delegate->mouse_presses());
+    UnblockUserSession();
+  }
 }
 
 // Makes sure we don't crash if a modal window is shown while the parent window
@@ -407,34 +408,38 @@
   EXPECT_FALSE(AllRootWindowsHaveModalBackgrounds());
   EXPECT_FALSE(AllRootWindowsHaveLockedModalBackgrounds());
 
-  // Normal system modal window while locked.  Shows locked system modal
-  // background.
-  Shell::GetInstance()->session_state_delegate()->LockScreen();
-  scoped_ptr<aura::Window> lock_parent(OpenTestWindowWithParent(
-      Shell::GetPrimaryRootWindowController()->GetContainer(
-          ash::internal::kShellWindowId_LockScreenContainer),
-      false));
-  scoped_ptr<aura::Window> lock_modal_window(OpenTestWindowWithParent(
-      lock_parent.get(), true));
-  lock_parent->Show();
-  lock_modal_window->Show();
-  EXPECT_FALSE(AllRootWindowsHaveModalBackgrounds());
-  EXPECT_TRUE(AllRootWindowsHaveLockedModalBackgrounds());
-  TestWindow::CloseTestWindow(lock_modal_window.release());
+  for (int block_reason = FIRST_BLOCK_REASON;
+       block_reason < NUMBER_OF_BLOCK_REASONS;
+       ++block_reason) {
+    // Normal system modal window while blocked.  Shows blocked system modal
+    // background.
+    BlockUserSession(static_cast<UserSessionBlockReason>(block_reason));
+    scoped_ptr<aura::Window> lock_parent(OpenTestWindowWithParent(
+        Shell::GetPrimaryRootWindowController()->GetContainer(
+            ash::internal::kShellWindowId_LockScreenContainer),
+        false));
+    scoped_ptr<aura::Window> lock_modal_window(OpenTestWindowWithParent(
+        lock_parent.get(), true));
+    lock_parent->Show();
+    lock_modal_window->Show();
+    EXPECT_FALSE(AllRootWindowsHaveModalBackgrounds());
+    EXPECT_TRUE(AllRootWindowsHaveLockedModalBackgrounds());
+    TestWindow::CloseTestWindow(lock_modal_window.release());
 
-  // Normal system modal window while locked, but it belongs to the normal
-  // window.  Shouldn't show locked system modal background, but normal.
-  scoped_ptr<aura::Window> modal_window2(
-      OpenTestWindowWithParent(parent.get(), true));
-  modal_window2->Show();
-  EXPECT_TRUE(AllRootWindowsHaveModalBackgrounds());
-  EXPECT_FALSE(AllRootWindowsHaveLockedModalBackgrounds());
-  TestWindow::CloseTestWindow(modal_window2.release());
-
-  // Here we should check the behavior of the locked system modal dialog when
-  // unlocked, but such case isn't handled very well right now.
-  // See crbug.com/157660
-  // TODO(mukai): add the test case when the bug is fixed.
+    // Normal system modal window while blocked, but it belongs to the normal
+    // window.  Shouldn't show blocked system modal background, but normal.
+    scoped_ptr<aura::Window> modal_window(
+        OpenTestWindowWithParent(parent.get(), true));
+    modal_window->Show();
+    EXPECT_TRUE(AllRootWindowsHaveModalBackgrounds());
+    EXPECT_FALSE(AllRootWindowsHaveLockedModalBackgrounds());
+    TestWindow::CloseTestWindow(modal_window.release());
+    UnblockUserSession();
+    // Here we should check the behavior of the locked system modal dialog when
+    // unlocked, but such case isn't handled very well right now.
+    // See crbug.com/157660
+    // TODO(mukai): add the test case when the bug is fixed.
+  }
 }
 
 TEST_F(SystemModalContainerLayoutManagerTest, MultiDisplays) {
diff --git a/base/android/java/src/org/chromium/base/ThreadUtils.java b/base/android/java/src/org/chromium/base/ThreadUtils.java
index cdf73c3..a880ede 100644
--- a/base/android/java/src/org/chromium/base/ThreadUtils.java
+++ b/base/android/java/src/org/chromium/base/ThreadUtils.java
@@ -18,8 +18,8 @@
 public class ThreadUtils {
 
     /**
-     * Run the supplied Runnable on the main thread. The method will block until
-     * the Runnable completes.
+     * Run the supplied Runnable on the main thread. The method will block until the Runnable
+     * completes.
      *
      * @param r The Runnable to run.
      */
@@ -38,8 +38,8 @@
     }
 
     /**
-     * Run the supplied Callable on the main thread, wrapping any exceptions in
-     * a RuntimeException. The method will block until the Callable completes.
+     * Run the supplied Callable on the main thread, wrapping any exceptions in a RuntimeException.
+     * The method will block until the Callable completes.
      *
      * @param c The Callable to run
      * @return The result of the callable
@@ -53,8 +53,8 @@
     }
 
     /**
-     * Run the supplied Callable on the main thread, The method will block until
-     * the Callable completes.
+     * Run the supplied Callable on the main thread, The method will block until the Callable
+     * completes.
      *
      * @param c The Callable to run
      * @return The result of the callable
@@ -71,8 +71,8 @@
     }
 
     /**
-     * Run the supplied FutureTask on the main thread. The method will block
-     * only if the current thread is the main thread.
+     * Run the supplied FutureTask on the main thread. The method will block only if the current
+     * thread is the main thread.
      *
      * @param task The FutureTask to run
      * @return The queried task (to aid inline construction)
@@ -87,8 +87,8 @@
     }
 
     /**
-     * Run the supplied Callable on the main thread. The method will block
-     * only if the current thread is the main thread.
+     * Run the supplied Callable on the main thread. The method will block only if the current
+     * thread is the main thread.
      *
      * @param c The Callable to run
      * @return A FutureTask wrapping the callable to retrieve results
@@ -98,8 +98,8 @@
     }
 
     /**
-     * Run the supplied Runnable on the main thread. The method will block
-     * only if the current thread is the main thread.
+     * Run the supplied Runnable on the main thread. The method will block only if the current
+     * thread is the main thread.
      *
      * @param r The Runnable to run
      */
@@ -112,8 +112,8 @@
     }
 
     /**
-     * Post the supplied FutureTask to run on the main thread. The method will
-     * not block, even if called on the UI thread.
+     * Post the supplied FutureTask to run on the main thread. The method will not block, even if
+     * called on the UI thread.
      *
      * @param task The FutureTask to run
      * @return The queried task (to aid inline construction)
@@ -124,8 +124,8 @@
     }
 
     /**
-     * Post the supplied Runnable to run on the main thread. The method will
-     * not block, even if called on the UI thread.
+     * Post the supplied Runnable to run on the main thread. The method will not block, even if
+     * called on the UI thread.
      *
      * @param task The Runnable to run
      */
@@ -134,6 +134,17 @@
     }
 
     /**
+     * Post the supplied Runnable to run on the main thread after the given amount of time. The
+     * method will not block, even if called on the UI thread.
+     *
+     * @param task The Runnable to run
+     * @param delayMillis The delay in milliseconds until the Runnable will be run
+     */
+    public static void postOnUiThreadDelayed(Runnable r, long delayMillis) {
+        LazyHolder.sUiThreadHandler.postDelayed(r, delayMillis);
+    }
+
+    /**
      * Asserts that the current thread is running on the main thread.
      */
     public static void assertOnUiThread() {
diff --git a/base/base.gyp b/base/base.gyp
index 56a036a..6f22d5a 100644
--- a/base/base.gyp
+++ b/base/base.gyp
@@ -469,6 +469,7 @@
         'debug/leak_tracker_unittest.cc',
         'debug/proc_maps_linux_unittest.cc',
         'debug/stack_trace_unittest.cc',
+        'debug/trace_event_memory_unittest.cc',
         'debug/trace_event_unittest.cc',
         'debug/trace_event_unittest.h',
         'debug/trace_event_win_unittest.cc',
diff --git a/base/base.gypi b/base/base.gypi
index 02abd4b..5085018 100644
--- a/base/base.gypi
+++ b/base/base.gypi
@@ -148,6 +148,8 @@
           'debug/trace_event_impl.cc',
           'debug/trace_event_impl.h',
           'debug/trace_event_impl_constants.cc',
+          'debug/trace_event_memory.cc',
+          'debug/trace_event_memory.h',
           'debug/trace_event_win.cc',
           'deferred_sequenced_task_runner.cc',
           'deferred_sequenced_task_runner.h',
diff --git a/base/base.target.darwin-arm.mk b/base/base.target.darwin-arm.mk
index b3d14ad..74f22a6 100644
--- a/base/base.target.darwin-arm.mk
+++ b/base/base.target.darwin-arm.mk
@@ -76,6 +76,7 @@
 	base/debug/trace_event_android.cc \
 	base/debug/trace_event_impl.cc \
 	base/debug/trace_event_impl_constants.cc \
+	base/debug/trace_event_memory.cc \
 	base/deferred_sequenced_task_runner.cc \
 	base/environment.cc \
 	base/file_util.cc \
@@ -287,8 +288,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/base \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/base \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
@@ -370,8 +371,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/base \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/base \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
diff --git a/base/base.target.darwin-mips.mk b/base/base.target.darwin-mips.mk
index 1d53363..2b401e0 100644
--- a/base/base.target.darwin-mips.mk
+++ b/base/base.target.darwin-mips.mk
@@ -76,6 +76,7 @@
 	base/debug/trace_event_android.cc \
 	base/debug/trace_event_impl.cc \
 	base/debug/trace_event_impl_constants.cc \
+	base/debug/trace_event_memory.cc \
 	base/deferred_sequenced_task_runner.cc \
 	base/environment.cc \
 	base/file_util.cc \
@@ -286,8 +287,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/base \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/base \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
@@ -368,8 +369,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/base \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/base \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
diff --git a/base/base.target.darwin-x86.mk b/base/base.target.darwin-x86.mk
index 1f8c32d..db132a3 100644
--- a/base/base.target.darwin-x86.mk
+++ b/base/base.target.darwin-x86.mk
@@ -77,6 +77,7 @@
 	base/debug/trace_event_android.cc \
 	base/debug/trace_event_impl.cc \
 	base/debug/trace_event_impl_constants.cc \
+	base/debug/trace_event_memory.cc \
 	base/deferred_sequenced_task_runner.cc \
 	base/environment.cc \
 	base/file_util.cc \
@@ -290,8 +291,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/base \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/base \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
@@ -376,8 +377,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/base \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/base \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
diff --git a/base/base.target.linux-arm.mk b/base/base.target.linux-arm.mk
index b3d14ad..74f22a6 100644
--- a/base/base.target.linux-arm.mk
+++ b/base/base.target.linux-arm.mk
@@ -76,6 +76,7 @@
 	base/debug/trace_event_android.cc \
 	base/debug/trace_event_impl.cc \
 	base/debug/trace_event_impl_constants.cc \
+	base/debug/trace_event_memory.cc \
 	base/deferred_sequenced_task_runner.cc \
 	base/environment.cc \
 	base/file_util.cc \
@@ -287,8 +288,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/base \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/base \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
@@ -370,8 +371,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/base \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/base \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
diff --git a/base/base.target.linux-mips.mk b/base/base.target.linux-mips.mk
index 1d53363..2b401e0 100644
--- a/base/base.target.linux-mips.mk
+++ b/base/base.target.linux-mips.mk
@@ -76,6 +76,7 @@
 	base/debug/trace_event_android.cc \
 	base/debug/trace_event_impl.cc \
 	base/debug/trace_event_impl_constants.cc \
+	base/debug/trace_event_memory.cc \
 	base/deferred_sequenced_task_runner.cc \
 	base/environment.cc \
 	base/file_util.cc \
@@ -286,8 +287,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/base \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/base \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
@@ -368,8 +369,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/base \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/base \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
diff --git a/base/base.target.linux-x86.mk b/base/base.target.linux-x86.mk
index 1f8c32d..db132a3 100644
--- a/base/base.target.linux-x86.mk
+++ b/base/base.target.linux-x86.mk
@@ -77,6 +77,7 @@
 	base/debug/trace_event_android.cc \
 	base/debug/trace_event_impl.cc \
 	base/debug/trace_event_impl_constants.cc \
+	base/debug/trace_event_memory.cc \
 	base/deferred_sequenced_task_runner.cc \
 	base/environment.cc \
 	base/file_util.cc \
@@ -290,8 +291,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/base \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/base \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
@@ -376,8 +377,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/base \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/base \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
diff --git a/base/base_i18n.target.darwin-arm.mk b/base/base_i18n.target.darwin-arm.mk
index bd575ac..64b12d73 100644
--- a/base/base_i18n.target.darwin-arm.mk
+++ b/base/base_i18n.target.darwin-arm.mk
@@ -104,9 +104,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
@@ -191,9 +191,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
diff --git a/base/base_i18n.target.darwin-mips.mk b/base/base_i18n.target.darwin-mips.mk
index 74eaadf..9e05929 100644
--- a/base/base_i18n.target.darwin-mips.mk
+++ b/base/base_i18n.target.darwin-mips.mk
@@ -103,9 +103,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
@@ -189,9 +189,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
diff --git a/base/base_i18n.target.darwin-x86.mk b/base/base_i18n.target.darwin-x86.mk
index 39c3589..48c88f1 100644
--- a/base/base_i18n.target.darwin-x86.mk
+++ b/base/base_i18n.target.darwin-x86.mk
@@ -106,9 +106,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
@@ -196,9 +196,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
diff --git a/base/base_i18n.target.linux-arm.mk b/base/base_i18n.target.linux-arm.mk
index bd575ac..64b12d73 100644
--- a/base/base_i18n.target.linux-arm.mk
+++ b/base/base_i18n.target.linux-arm.mk
@@ -104,9 +104,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
@@ -191,9 +191,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
diff --git a/base/base_i18n.target.linux-mips.mk b/base/base_i18n.target.linux-mips.mk
index 74eaadf..9e05929 100644
--- a/base/base_i18n.target.linux-mips.mk
+++ b/base/base_i18n.target.linux-mips.mk
@@ -103,9 +103,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
@@ -189,9 +189,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
diff --git a/base/base_i18n.target.linux-x86.mk b/base/base_i18n.target.linux-x86.mk
index 39c3589..48c88f1 100644
--- a/base/base_i18n.target.linux-x86.mk
+++ b/base/base_i18n.target.linux-x86.mk
@@ -106,9 +106,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
@@ -196,9 +196,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
diff --git a/base/debug/trace_event.h b/base/debug/trace_event.h
index c17c008..f6a903d 100644
--- a/base/debug/trace_event.h
+++ b/base/debug/trace_event.h
@@ -193,6 +193,7 @@
 
 #include "base/atomicops.h"
 #include "base/debug/trace_event_impl.h"
+#include "base/debug/trace_event_memory.h"
 #include "build/build_config.h"
 
 // By default, const char* argument values are assumed to have long-lived scope
@@ -220,13 +221,16 @@
 // - category and name strings must have application lifetime (statics or
 //   literals). They may not include " chars.
 #define TRACE_EVENT0(category_group, name) \
+    INTERNAL_TRACE_MEMORY(category_group, name) \
     INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name)
 #define TRACE_EVENT1(category_group, name, arg1_name, arg1_val) \
+    INTERNAL_TRACE_MEMORY(category_group, name) \
     INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name, arg1_name, arg1_val)
-#define TRACE_EVENT2(category_group, name, arg1_name, arg1_val, arg2_name, \
-                     arg2_val) \
-    INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name, arg1_name, arg1_val, \
-        arg2_name, arg2_val)
+#define TRACE_EVENT2( \
+    category_group, name, arg1_name, arg1_val, arg2_name, arg2_val) \
+  INTERNAL_TRACE_MEMORY(category_group, name) \
+  INTERNAL_TRACE_EVENT_ADD_SCOPED( \
+      category_group, name, arg1_name, arg1_val, arg2_name, arg2_val)
 
 // UNSHIPPED_TRACE_EVENT* are like TRACE_EVENT* except that they are not
 // included in official builds.
diff --git a/base/debug/trace_event_impl.cc b/base/debug/trace_event_impl.cc
index e061ea1..3b92646 100644
--- a/base/debug/trace_event_impl.cc
+++ b/base/debug/trace_event_impl.cc
@@ -1083,6 +1083,14 @@
     enabled_state_observer_list_.erase(it);
 }
 
+bool TraceLog::HasEnabledStateObserver(EnabledStateObserver* listener) const {
+  std::vector<EnabledStateObserver*>::const_iterator it =
+      std::find(enabled_state_observer_list_.begin(),
+                enabled_state_observer_list_.end(),
+                listener);
+  return it != enabled_state_observer_list_.end();
+}
+
 float TraceLog::GetBufferPercentFull() const {
   return (float)((double)logged_events_->Size()/(double)kTraceEventBufferSize);
 }
@@ -1107,6 +1115,9 @@
 };
 
 void TraceLog::Flush(const TraceLog::OutputCallback& cb) {
+  // Ignore memory allocations from here down.
+  INTERNAL_TRACE_MEMORY(TRACE_DISABLED_BY_DEFAULT("memory"),
+                        TRACE_MEMORY_IGNORE);
   scoped_ptr<TraceBuffer> previous_logged_events;
   {
     AutoLock lock(lock_);
diff --git a/base/debug/trace_event_impl.h b/base/debug/trace_event_impl.h
index 0449090..0f30c1e 100644
--- a/base/debug/trace_event_impl.h
+++ b/base/debug/trace_event_impl.h
@@ -345,6 +345,7 @@
   };
   void AddEnabledStateObserver(EnabledStateObserver* listener);
   void RemoveEnabledStateObserver(EnabledStateObserver* listener);
+  bool HasEnabledStateObserver(EnabledStateObserver* listener) const;
 
   float GetBufferPercentFull() const;
 
diff --git a/base/debug/trace_event_memory.cc b/base/debug/trace_event_memory.cc
new file mode 100644
index 0000000..fb5f65b
--- /dev/null
+++ b/base/debug/trace_event_memory.cc
@@ -0,0 +1,414 @@
+// 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/debug/trace_event_memory.h"
+
+#include "base/debug/leak_annotations.h"
+#include "base/debug/trace_event.h"
+#include "base/lazy_instance.h"
+#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/message_loop/message_loop.h"
+#include "base/strings/string_number_conversions.h"
+#include "base/strings/string_util.h"
+#include "base/threading/thread_local_storage.h"
+
+namespace base {
+namespace debug {
+
+namespace {
+
+// Maximum number of nested TRACE_MEMORY scopes to record. Must be greater than
+// or equal to HeapProfileTable::kMaxStackDepth.
+const size_t kMaxStackSize = 32;
+
+/////////////////////////////////////////////////////////////////////////////
+// Holds a memory dump until the tracing system needs to serialize it.
+class MemoryDumpHolder : public base::debug::ConvertableToTraceFormat {
+ public:
+  // Takes ownership of dump, which must be a JSON string, allocated with
+  // malloc() and NULL terminated.
+  explicit MemoryDumpHolder(char* dump) : dump_(dump) {}
+  virtual ~MemoryDumpHolder() { free(dump_); }
+
+  // base::debug::ConvertableToTraceFormat overrides:
+  virtual void AppendAsTraceFormat(std::string* out) const OVERRIDE {
+    AppendHeapProfileAsTraceFormat(dump_, out);
+  }
+
+ private:
+  char* dump_;
+
+  DISALLOW_COPY_AND_ASSIGN(MemoryDumpHolder);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+// Records a stack of TRACE_MEMORY events. One per thread is required.
+struct TraceMemoryStack {
+  TraceMemoryStack() : index_(0) {
+    memset(category_stack_, 0, kMaxStackSize * sizeof(category_stack_[0]));
+  }
+
+  // Points to the next free entry.
+  size_t index_;
+  const char* category_stack_[kMaxStackSize];
+};
+
+// Pointer to a TraceMemoryStack per thread.
+base::ThreadLocalStorage::StaticSlot tls_trace_memory_stack = TLS_INITIALIZER;
+
+// Clean up memory pointed to by our thread-local storage.
+void DeleteStackOnThreadCleanup(void* value) {
+  TraceMemoryStack* stack = static_cast<TraceMemoryStack*>(value);
+  delete stack;
+}
+
+// Initializes the thread-local TraceMemoryStack pointer. Returns true on
+// success or if it is already initialized.
+bool InitThreadLocalStorage() {
+  if (tls_trace_memory_stack.initialized())
+    return true;
+  // Initialize the thread-local storage key, returning true on success.
+  return tls_trace_memory_stack.Initialize(&DeleteStackOnThreadCleanup);
+}
+
+// Clean up thread-local-storage in the main thread.
+void CleanupThreadLocalStorage() {
+  if (!tls_trace_memory_stack.initialized())
+    return;
+  TraceMemoryStack* stack =
+      static_cast<TraceMemoryStack*>(tls_trace_memory_stack.Get());
+  delete stack;
+  tls_trace_memory_stack.Set(NULL);
+  // Intentionally do not release the thread-local-storage key here, that is,
+  // do not call tls_trace_memory_stack.Free(). Other threads have lazily
+  // created pointers in thread-local-storage via GetTraceMemoryStack() below.
+  // Those threads need to run the DeleteStack() destructor function when they
+  // exit. If we release the key the destructor will not be called and those
+  // threads will not clean up their memory.
+}
+
+// Returns the thread-local trace memory stack for the current thread, creating
+// one if needed. Returns NULL if the thread-local storage key isn't
+// initialized, which indicates that heap profiling isn't running.
+TraceMemoryStack* GetTraceMemoryStack() {
+  TraceMemoryStack* stack =
+      static_cast<TraceMemoryStack*>(tls_trace_memory_stack.Get());
+  // Lazily initialize TraceMemoryStack objects for new threads.
+  if (!stack) {
+    stack = new TraceMemoryStack;
+    tls_trace_memory_stack.Set(stack);
+  }
+  return stack;
+}
+
+// Returns a "pseudo-stack" of pointers to trace events.
+// TODO(jamescook): Record both category and name, perhaps in a pair for speed.
+int GetPseudoStack(int skip_count_ignored, void** stack_out) {
+  // If the tracing system isn't fully initialized, just skip this allocation.
+  // Attempting to initialize will allocate memory, causing this function to
+  // be called recursively from inside the allocator.
+  if (!tls_trace_memory_stack.initialized() || !tls_trace_memory_stack.Get())
+    return 0;
+  TraceMemoryStack* stack =
+      static_cast<TraceMemoryStack*>(tls_trace_memory_stack.Get());
+  // Copy at most kMaxStackSize stack entries.
+  const size_t count = std::min(stack->index_, kMaxStackSize);
+  // Notes that memcpy() works for zero bytes.
+  memcpy(stack_out,
+         stack->category_stack_,
+         count * sizeof(stack->category_stack_[0]));
+  // Function must return an int to match the signature required by tcmalloc.
+  return static_cast<int>(count);
+}
+
+}  // namespace
+
+//////////////////////////////////////////////////////////////////////////////
+
+TraceMemoryController::TraceMemoryController(
+    scoped_refptr<MessageLoopProxy> message_loop_proxy,
+    HeapProfilerStartFunction heap_profiler_start_function,
+    HeapProfilerStopFunction heap_profiler_stop_function,
+    GetHeapProfileFunction get_heap_profile_function)
+    : message_loop_proxy_(message_loop_proxy),
+      heap_profiler_start_function_(heap_profiler_start_function),
+      heap_profiler_stop_function_(heap_profiler_stop_function),
+      get_heap_profile_function_(get_heap_profile_function),
+      weak_factory_(this) {
+  // Force the "memory" category to show up in the trace viewer.
+  TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("memory"), "init");
+  // Watch for the tracing system being enabled.
+  TraceLog::GetInstance()->AddEnabledStateObserver(this);
+}
+
+TraceMemoryController::~TraceMemoryController() {
+  if (dump_timer_.IsRunning())
+    StopProfiling();
+  TraceLog::GetInstance()->RemoveEnabledStateObserver(this);
+}
+
+  // base::debug::TraceLog::EnabledStateChangedObserver overrides:
+void TraceMemoryController::OnTraceLogEnabled() {
+  // Check to see if tracing is enabled for the memory category.
+  bool enabled;
+  TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("memory"),
+                                     &enabled);
+  if (!enabled)
+    return;
+  DVLOG(1) << "OnTraceLogEnabled";
+  message_loop_proxy_->PostTask(
+      FROM_HERE,
+      base::Bind(&TraceMemoryController::StartProfiling,
+                 weak_factory_.GetWeakPtr()));
+}
+
+void TraceMemoryController::OnTraceLogDisabled() {
+  // The memory category is always disabled before OnTraceLogDisabled() is
+  // called, so we cannot tell if it was enabled before. Always try to turn
+  // off profiling.
+  DVLOG(1) << "OnTraceLogDisabled";
+  message_loop_proxy_->PostTask(
+      FROM_HERE,
+      base::Bind(&TraceMemoryController::StopProfiling,
+                 weak_factory_.GetWeakPtr()));
+}
+
+void TraceMemoryController::StartProfiling() {
+  // Watch for the tracing framework sending enabling more than once.
+  if (dump_timer_.IsRunning())
+    return;
+  DVLOG(1) << "Starting trace memory";
+  if (!InitThreadLocalStorage())
+    return;
+  ScopedTraceMemory::set_enabled(true);
+  // Call ::HeapProfilerWithPseudoStackStart().
+  heap_profiler_start_function_(&GetPseudoStack);
+  const int kDumpIntervalSeconds = 5;
+  dump_timer_.Start(FROM_HERE,
+                    TimeDelta::FromSeconds(kDumpIntervalSeconds),
+                    base::Bind(&TraceMemoryController::DumpMemoryProfile,
+                               weak_factory_.GetWeakPtr()));
+}
+
+void TraceMemoryController::DumpMemoryProfile() {
+  // Don't trace allocations here in the memory tracing system.
+  INTERNAL_TRACE_MEMORY(TRACE_DISABLED_BY_DEFAULT("memory"),
+                        TRACE_MEMORY_IGNORE);
+
+  DVLOG(1) << "DumpMemoryProfile";
+  // MemoryDumpHolder takes ownership of this string. See GetHeapProfile() in
+  // tcmalloc for details.
+  char* dump = get_heap_profile_function_();
+  scoped_ptr<MemoryDumpHolder> dump_holder(new MemoryDumpHolder(dump));
+  const int kSnapshotId = 1;
+  TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(
+      TRACE_DISABLED_BY_DEFAULT("memory"),
+      "memory::Heap",
+      kSnapshotId,
+      dump_holder.PassAs<base::debug::ConvertableToTraceFormat>());
+}
+
+void TraceMemoryController::StopProfiling() {
+  // Watch for the tracing framework sending disabled more than once.
+  if (!dump_timer_.IsRunning())
+    return;
+  DVLOG(1) << "Stopping trace memory";
+  dump_timer_.Stop();
+  ScopedTraceMemory::set_enabled(false);
+  CleanupThreadLocalStorage();
+  // Call ::HeapProfilerStop().
+  heap_profiler_stop_function_();
+}
+
+bool TraceMemoryController::IsTimerRunningForTest() const {
+  return dump_timer_.IsRunning();
+}
+
+/////////////////////////////////////////////////////////////////////////////
+
+// static
+bool ScopedTraceMemory::enabled_ = false;
+
+ScopedTraceMemory::ScopedTraceMemory(const char* category) {
+  // Not enabled indicates that the trace system isn't running, so don't
+  // record anything.
+  if (!enabled_)
+    return;
+  // Get our thread's copy of the stack.
+  TraceMemoryStack* trace_memory_stack = GetTraceMemoryStack();
+  const size_t index = trace_memory_stack->index_;
+  // Allow deep nesting of stacks (needed for tests), but only record
+  // |kMaxStackSize| entries.
+  if (index < kMaxStackSize)
+    trace_memory_stack->category_stack_[index] = category;
+  trace_memory_stack->index_++;
+}
+
+ScopedTraceMemory::~ScopedTraceMemory() {
+  // Not enabled indicates that the trace system isn't running, so don't
+  // record anything.
+  if (!enabled_)
+    return;
+  // Get our thread's copy of the stack.
+  TraceMemoryStack* trace_memory_stack = GetTraceMemoryStack();
+  // The tracing system can be turned on with ScopedTraceMemory objects
+  // allocated on the stack, so avoid potential underflow as they are destroyed.
+  if (trace_memory_stack->index_ > 0)
+    trace_memory_stack->index_--;
+}
+
+// static
+void ScopedTraceMemory::InitForTest() {
+  InitThreadLocalStorage();
+  enabled_ = true;
+}
+
+// static
+void ScopedTraceMemory::CleanupForTest() {
+  enabled_ = false;
+  CleanupThreadLocalStorage();
+}
+
+// static
+int ScopedTraceMemory::GetStackIndexForTest() {
+  TraceMemoryStack* stack = GetTraceMemoryStack();
+  return static_cast<int>(stack->index_);
+}
+
+// static
+const char* ScopedTraceMemory::GetItemForTest(int index) {
+  TraceMemoryStack* stack = GetTraceMemoryStack();
+  return stack->category_stack_[index];
+}
+
+/////////////////////////////////////////////////////////////////////////////
+
+void AppendHeapProfileAsTraceFormat(const char* input, std::string* output) {
+  // Heap profile output has a header total line, then a list of stacks with
+  // memory totals, like this:
+  //
+  // heap profile:    357:    55227 [ 14653:  2624014] @ heapprofile
+  //    95:    40940 [   649:   114260] @ 0x7fa7f4b3be13
+  //    77:    32546 [   742:   106234] @
+  //    68:     4195 [  1087:    98009] @ 0x7fa7fa9b9ba0 0x7fa7f4b3be13
+  //
+  // MAPPED_LIBRARIES:
+  // 1be411fc1000-1be4139e4000 rw-p 00000000 00:00 0
+  // 1be4139e4000-1be4139e5000 ---p 00000000 00:00 0
+  // ...
+  //
+  // Skip input after MAPPED_LIBRARIES.
+  std::string input_string;
+  const char* mapped_libraries = strstr(input, "MAPPED_LIBRARIES");
+  if (mapped_libraries) {
+    input_string.assign(input, mapped_libraries - input);
+  } else {
+    input_string.assign(input);
+  }
+
+  std::vector<std::string> lines;
+  size_t line_count = Tokenize(input_string, "\n", &lines);
+  if (line_count == 0) {
+    DLOG(WARNING) << "No lines found";
+    return;
+  }
+
+  // Handle the initial summary line.
+  output->append("[");
+  AppendHeapProfileTotalsAsTraceFormat(lines[0], output);
+
+  // Handle the following stack trace lines.
+  for (size_t i = 1; i < line_count; ++i) {
+    const std::string& line = lines[i];
+    AppendHeapProfileLineAsTraceFormat(line, output);
+  }
+  output->append("]\n");
+}
+
+void AppendHeapProfileTotalsAsTraceFormat(const std::string& line,
+                                          std::string* output) {
+  // This is what a line looks like:
+  // heap profile:    357:    55227 [ 14653:  2624014] @ heapprofile
+  //
+  // The numbers represent total allocations since profiling was enabled.
+  // From the example above:
+  //     357 = Outstanding allocations (mallocs - frees)
+  //   55227 = Outstanding bytes (malloc bytes - free bytes)
+  //   14653 = Total allocations (mallocs)
+  // 2624014 = Total bytes (malloc bytes)
+  std::vector<std::string> tokens;
+  Tokenize(line, " :[]@", &tokens);
+  if (tokens.size() < 4) {
+    DLOG(WARNING) << "Invalid totals line " << line;
+    return;
+  }
+  DCHECK_EQ(tokens[0], "heap");
+  DCHECK_EQ(tokens[1], "profile");
+  output->append("{\"current_allocs\": ");
+  output->append(tokens[2]);
+  output->append(", \"current_bytes\": ");
+  output->append(tokens[3]);
+  output->append(", \"trace\": \"\"}");
+}
+
+bool AppendHeapProfileLineAsTraceFormat(const std::string& line,
+                                        std::string* output) {
+  // This is what a line looks like:
+  //    68:     4195 [  1087:    98009] @ 0x7fa7fa9b9ba0 0x7fa7f4b3be13
+  //
+  // The numbers represent allocations for a particular stack trace since
+  // profiling was enabled. From the example above:
+  //    68 = Outstanding allocations (mallocs - frees)
+  //  4195 = Outstanding bytes (malloc bytes - free bytes)
+  //  1087 = Total allocations (mallocs)
+  // 98009 = Total bytes (malloc bytes)
+  //
+  // 0x7fa7fa9b9ba0 0x7fa7f4b3be13 = Stack trace represented as pointers to
+  //                                 static strings from trace event names.
+  std::vector<std::string> tokens;
+  Tokenize(line, " :[]@", &tokens);
+  // It's valid to have no stack addresses, so only require 4 tokens.
+  if (tokens.size() < 4) {
+    DLOG(WARNING) << "Invalid line " << line;
+    return false;
+  }
+  // Don't bother with stacks that have no current allocations.
+  if (tokens[0] == "0")
+    return false;
+  output->append(",\n");
+  output->append("{\"current_allocs\": ");
+  output->append(tokens[0]);
+  output->append(", \"current_bytes\": ");
+  output->append(tokens[1]);
+  output->append(", \"trace\": \"");
+
+  // Convert the "stack addresses" into strings.
+  const std::string kSingleQuote = "'";
+  for (size_t t = 4; t < tokens.size(); ++t) {
+    // Each stack address is a pointer to a constant trace name string.
+    uint64 address = 0;
+    if (!base::HexStringToUInt64(tokens[t], &address))
+      break;
+    // This is ugly but otherwise tcmalloc would need to gain a special output
+    // serializer for pseudo-stacks. Note that this cast also handles 64-bit to
+    // 32-bit conversion if necessary. Tests use a null address.
+    const char* trace_name =
+        address ? reinterpret_cast<const char*>(address) : "null";
+
+    // Some trace name strings have double quotes, convert them to single.
+    std::string trace_name_string(trace_name);
+    ReplaceChars(trace_name_string, "\"", kSingleQuote, &trace_name_string);
+
+    output->append(trace_name_string);
+
+    // Trace viewer expects a trailing space.
+    output->append(" ");
+  }
+  output->append("\"}");
+  return true;
+}
+
+}  // namespace debug
+}  // namespace base
diff --git a/base/debug/trace_event_memory.h b/base/debug/trace_event_memory.h
new file mode 100644
index 0000000..0d82198
--- /dev/null
+++ b/base/debug/trace_event_memory.h
@@ -0,0 +1,152 @@
+// 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 BASE_DEBUG_TRACE_EVENT_MEMORY_H_
+#define BASE_DEBUG_TRACE_EVENT_MEMORY_H_
+
+#include "base/base_export.h"
+#include "base/debug/trace_event_impl.h"
+#include "base/gtest_prod_util.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
+#include "base/timer/timer.h"
+
+// TODO(jamescook): Windows support for memory tracing.
+#if !defined(NO_TCMALLOC) && !defined(OS_NACL) && \
+    (defined(OS_LINUX) || defined(OS_ANDROID))
+#define TCMALLOC_TRACE_MEMORY_SUPPORTED 1
+#endif
+
+namespace base {
+
+class MessageLoopProxy;
+
+namespace debug {
+
+// Watches for chrome://tracing to be enabled or disabled. When tracing is
+// enabled, also enables tcmalloc heap profiling. This class is the preferred
+// way to turn trace-base heap memory profiling on and off.
+class BASE_EXPORT TraceMemoryController
+    : public TraceLog::EnabledStateObserver {
+ public:
+  typedef int (*StackGeneratorFunction)(int skip_count, void** stack);
+  typedef void (*HeapProfilerStartFunction)(StackGeneratorFunction callback);
+  typedef void (*HeapProfilerStopFunction)();
+  typedef char* (*GetHeapProfileFunction)();
+
+  // |message_loop_proxy| must be a proxy to the primary thread for the client
+  // process, e.g. the UI thread in a browser. The function pointers must be
+  // pointers to tcmalloc heap profiling functions; by avoiding direct calls to
+  // these functions we avoid a dependency on third_party/tcmalloc from base.
+  TraceMemoryController(
+      scoped_refptr<MessageLoopProxy> message_loop_proxy,
+      HeapProfilerStartFunction heap_profiler_start_function,
+      HeapProfilerStopFunction heap_profiler_stop_function,
+      GetHeapProfileFunction get_heap_profile_function);
+  virtual ~TraceMemoryController();
+
+  // base::debug::TraceLog::EnabledStateChangedObserver overrides:
+  virtual void OnTraceLogEnabled() OVERRIDE;
+  virtual void OnTraceLogDisabled() OVERRIDE;
+
+  // Starts heap memory profiling.
+  void StartProfiling();
+
+  // Captures a heap profile.
+  void DumpMemoryProfile();
+
+  // If memory tracing is enabled, dumps a memory profile to the tracing system.
+  void StopProfiling();
+
+ private:
+  FRIEND_TEST_ALL_PREFIXES(TraceMemoryTest, TraceMemoryController);
+
+  bool IsTimerRunningForTest() const;
+
+  // Ensures the observer starts and stops tracing on the primary thread.
+  scoped_refptr<MessageLoopProxy> message_loop_proxy_;
+
+  // Pointers to tcmalloc heap profiling functions. Allows this class to use
+  // tcmalloc functions without introducing a dependency from base to tcmalloc.
+  HeapProfilerStartFunction heap_profiler_start_function_;
+  HeapProfilerStopFunction heap_profiler_stop_function_;
+  GetHeapProfileFunction get_heap_profile_function_;
+
+  // Timer to schedule memory profile dumps.
+  RepeatingTimer<TraceMemoryController> dump_timer_;
+
+  WeakPtrFactory<TraceMemoryController> weak_factory_;
+
+  DISALLOW_COPY_AND_ASSIGN(TraceMemoryController);
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+// A scoped context for memory tracing. Pushes the name onto a stack for
+// recording by tcmalloc heap profiling.
+class BASE_EXPORT ScopedTraceMemory {
+ public:
+  // Memory for |name| must be static, for example, a literal string in
+  // a TRACE_EVENT macro.
+  explicit ScopedTraceMemory(const char* name);
+  ~ScopedTraceMemory();
+
+  // Enables the storing of trace names on a per-thread stack.
+  static void set_enabled(bool enabled) { enabled_ = enabled; }
+
+  // Testing interface:
+  static void InitForTest();
+  static void CleanupForTest();
+  static int GetStackIndexForTest();
+  static const char* GetItemForTest(int index);
+
+ private:
+  static bool enabled_;
+  DISALLOW_COPY_AND_ASSIGN(ScopedTraceMemory);
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+// Converts tcmalloc's heap profiler data with pseudo-stacks in |input| to
+// trace event compatible JSON and appends to |output|. Visible for testing.
+BASE_EXPORT void AppendHeapProfileAsTraceFormat(const char* input,
+                                                std::string* output);
+
+// Converts the first |line| of heap profiler data, which contains totals for
+// all allocations in a special format, into trace event compatible JSON and
+// appends to |output|. Visible for testing.
+BASE_EXPORT void AppendHeapProfileTotalsAsTraceFormat(const std::string& line,
+                                                      std::string* output);
+
+// Converts a single |line| of heap profiler data into trace event compatible
+// JSON and appends to |output|. Returns true if the line was valid and has a
+// non-zero number of current allocations. Visible for testing.
+BASE_EXPORT bool AppendHeapProfileLineAsTraceFormat(const std::string& line,
+                                                    std::string* output);
+
+}  // namespace debug
+}  // namespace base
+
+// Make local variables with unique names based on the line number. Note that
+// the extra level of redirection is needed.
+#define INTERNAL_TRACE_MEMORY_ID3(line) trace_memory_unique_##line
+#define INTERNAL_TRACE_MEMORY_ID2(line) INTERNAL_TRACE_MEMORY_ID3(line)
+#define INTERNAL_TRACE_MEMORY_ID INTERNAL_TRACE_MEMORY_ID2(__LINE__)
+
+// This is the core macro that adds a scope to each TRACE_EVENT location.
+// It generates a unique local variable name using the macros above.
+// TODO(jamescook): Make it record both category and name.
+#if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED)
+#define INTERNAL_TRACE_MEMORY(category, name) \
+  base::debug::ScopedTraceMemory INTERNAL_TRACE_MEMORY_ID(name);
+#else
+#define INTERNAL_TRACE_MEMORY(category, name)
+#endif  // defined(TRACE_MEMORY_SUPPORTED)
+
+// A special trace name that allows us to ignore memory allocations inside
+// the memory dump system itself. The allocations are recorded, but the
+// visualizer skips them. Must match the value in heap.js.
+#define TRACE_MEMORY_IGNORE "trace-memory-ignore"
+
+#endif  // BASE_DEBUG_TRACE_EVENT_MEMORY_H_
diff --git a/base/debug/trace_event_memory_unittest.cc b/base/debug/trace_event_memory_unittest.cc
new file mode 100644
index 0000000..7c4eae6
--- /dev/null
+++ b/base/debug/trace_event_memory_unittest.cc
@@ -0,0 +1,211 @@
+// 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/debug/trace_event_memory.h"
+
+#include <sstream>
+#include <string>
+
+#include "base/debug/trace_event_impl.h"
+#include "base/message_loop/message_loop.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+#if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED)
+#include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h"
+#endif
+
+namespace base {
+namespace debug {
+
+// Tests for the trace event memory tracking system. Exists as a class so it
+// can be a friend of TraceMemoryController.
+class TraceMemoryTest : public testing::Test {
+ public:
+  TraceMemoryTest() {}
+  virtual ~TraceMemoryTest() {}
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(TraceMemoryTest);
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+#if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED)
+
+TEST_F(TraceMemoryTest, TraceMemoryController) {
+  MessageLoop message_loop;
+
+  // Start with no observers of the TraceLog.
+  EXPECT_EQ(0u, TraceLog::GetInstance()->GetObserverCountForTest());
+
+  // Creating a controller adds it to the TraceLog observer list.
+  scoped_ptr<TraceMemoryController> controller(
+      new TraceMemoryController(
+          message_loop.message_loop_proxy(),
+          ::HeapProfilerWithPseudoStackStart,
+          ::HeapProfilerStop,
+          ::GetHeapProfile));
+  EXPECT_EQ(1u, TraceLog::GetInstance()->GetObserverCountForTest());
+  EXPECT_TRUE(
+      TraceLog::GetInstance()->HasEnabledStateObserver(controller.get()));
+
+  // By default the observer isn't dumping memory profiles.
+  EXPECT_FALSE(controller->IsTimerRunningForTest());
+
+  // Simulate enabling tracing.
+  controller->StartProfiling();
+  message_loop.RunUntilIdle();
+  EXPECT_TRUE(controller->IsTimerRunningForTest());
+
+  // Simulate disabling tracing.
+  controller->StopProfiling();
+  message_loop.RunUntilIdle();
+  EXPECT_FALSE(controller->IsTimerRunningForTest());
+
+  // Deleting the observer removes it from the TraceLog observer list.
+  controller.reset();
+  EXPECT_EQ(0u, TraceLog::GetInstance()->GetObserverCountForTest());
+}
+
+TEST_F(TraceMemoryTest, ScopedTraceMemory) {
+  ScopedTraceMemory::InitForTest();
+
+  // Start with an empty stack.
+  EXPECT_EQ(0, ScopedTraceMemory::GetStackIndexForTest());
+
+  {
+    // Push an item.
+    const char kScope1[] = "scope1";
+    ScopedTraceMemory scope1(kScope1);
+    EXPECT_EQ(1, ScopedTraceMemory::GetStackIndexForTest());
+    EXPECT_EQ(kScope1, ScopedTraceMemory::GetItemForTest(0));
+
+    {
+      // One more item.
+      const char kScope2[] = "scope2";
+      ScopedTraceMemory scope2(kScope2);
+      EXPECT_EQ(2, ScopedTraceMemory::GetStackIndexForTest());
+      EXPECT_EQ(kScope2, ScopedTraceMemory::GetItemForTest(1));
+    }
+
+    // Ended scope 2.
+    EXPECT_EQ(1, ScopedTraceMemory::GetStackIndexForTest());
+  }
+
+  // Ended scope 1.
+  EXPECT_EQ(0, ScopedTraceMemory::GetStackIndexForTest());
+
+  ScopedTraceMemory::CleanupForTest();
+}
+
+void TestDeepScopeNesting(int current, int depth) {
+  EXPECT_EQ(current, ScopedTraceMemory::GetStackIndexForTest());
+  const char kCategory[] = "foo";
+  ScopedTraceMemory scope(kCategory);
+  if (current < depth)
+    TestDeepScopeNesting(current + 1, depth);
+  EXPECT_EQ(current + 1, ScopedTraceMemory::GetStackIndexForTest());
+}
+
+TEST_F(TraceMemoryTest, DeepScopeNesting) {
+  ScopedTraceMemory::InitForTest();
+
+  // Ensure really deep scopes don't crash.
+  TestDeepScopeNesting(0, 100);
+
+  ScopedTraceMemory::CleanupForTest();
+}
+
+#endif  // defined(TRACE_MEMORY_SUPPORTED)
+
+/////////////////////////////////////////////////////////////////////////////
+
+TEST_F(TraceMemoryTest, AppendHeapProfileTotalsAsTraceFormat) {
+  // Empty input gives empty output.
+  std::string empty_output;
+  AppendHeapProfileTotalsAsTraceFormat("", &empty_output);
+  EXPECT_EQ("", empty_output);
+
+  // Typical case.
+  const char input[] =
+      "heap profile:    357:    55227 [ 14653:  2624014] @ heapprofile";
+  const std::string kExpectedOutput =
+      "{\"current_allocs\": 357, \"current_bytes\": 55227, \"trace\": \"\"}";
+  std::string output;
+  AppendHeapProfileTotalsAsTraceFormat(input, &output);
+  EXPECT_EQ(kExpectedOutput, output);
+}
+
+TEST_F(TraceMemoryTest, AppendHeapProfileLineAsTraceFormat) {
+  // Empty input gives empty output.
+  std::string empty_output;
+  EXPECT_FALSE(AppendHeapProfileLineAsTraceFormat("", &empty_output));
+  EXPECT_EQ("", empty_output);
+
+  // Invalid input returns false.
+  std::string junk_output;
+  EXPECT_FALSE(AppendHeapProfileLineAsTraceFormat("junk", &junk_output));
+
+  // Input with the addresses of name1 and name2.
+  const char kName1[] = "name1";
+  const char kName2[] = "name2";
+  std::ostringstream input;
+  input << "   68:     4195 [  1087:    98009] @ " << &kName1 << " " << &kName2;
+  const std::string kExpectedOutput =
+      ",\n"
+      "{"
+      "\"current_allocs\": 68, "
+      "\"current_bytes\": 4195, "
+      "\"trace\": \"name1 name2 \""
+      "}";
+  std::string output;
+  EXPECT_TRUE(
+      AppendHeapProfileLineAsTraceFormat(input.str().c_str(), &output));
+  EXPECT_EQ(kExpectedOutput, output);
+
+  // Zero current allocations is skipped.
+  std::ostringstream zero_input;
+  zero_input << "   0:     0 [  1087:    98009] @ " << &kName1 << " "
+             << &kName2;
+  std::string zero_output;
+  EXPECT_FALSE(AppendHeapProfileLineAsTraceFormat(zero_input.str().c_str(),
+                                                  &zero_output));
+  EXPECT_EQ("", zero_output);
+}
+
+TEST_F(TraceMemoryTest, AppendHeapProfileAsTraceFormat) {
+  // Empty input gives empty output.
+  std::string empty_output;
+  AppendHeapProfileAsTraceFormat("", &empty_output);
+  EXPECT_EQ("", empty_output);
+
+  // Typical case.
+  const char input[] =
+      "heap profile:    357:    55227 [ 14653:  2624014] @ heapprofile\n"
+      "   95:    40940 [   649:   114260] @\n"
+      "   77:    32546 [   742:   106234] @ 0x0 0x0\n"
+      "    0:        0 [   132:     4236] @ 0x0\n"
+      "\n"
+      "MAPPED_LIBRARIES:\n"
+      "1be411fc1000-1be4139e4000 rw-p 00000000 00:00 0\n"
+      "1be4139e4000-1be4139e5000 ---p 00000000 00:00 0\n";
+  const std::string kExpectedOutput =
+      "[{"
+      "\"current_allocs\": 357, "
+      "\"current_bytes\": 55227, "
+      "\"trace\": \"\"},\n"
+      "{\"current_allocs\": 95, "
+      "\"current_bytes\": 40940, "
+      "\"trace\": \"\"},\n"
+      "{\"current_allocs\": 77, "
+      "\"current_bytes\": 32546, "
+      "\"trace\": \"null null \""
+      "}]\n";
+  std::string output;
+  AppendHeapProfileAsTraceFormat(input, &output);
+  EXPECT_EQ(kExpectedOutput, output);
+}
+
+}  // namespace debug
+}  // namespace base
diff --git a/base/mac/launch_services_util.cc b/base/mac/launch_services_util.cc
index 0081500..6121081 100644
--- a/base/mac/launch_services_util.cc
+++ b/base/mac/launch_services_util.cc
@@ -4,8 +4,6 @@
 
 #include "base/mac/launch_services_util.h"
 
-#include <ApplicationServices/ApplicationServices.h>
-
 #include "base/logging.h"
 #include "base/mac/mac_logging.h"
 #include "base/mac/mac_util.h"
@@ -16,6 +14,7 @@
 
 bool OpenApplicationWithPath(const base::FilePath& bundle_path,
                              const CommandLine& command_line,
+                             LSLaunchFlags launch_flags,
                              ProcessSerialNumber* out_psn) {
   FSRef app_fsref;
   if (!base::mac::FSRefFromPath(bundle_path.value(), &app_fsref)) {
@@ -45,7 +44,7 @@
 
   LSApplicationParameters ls_parameters = {
     0,     // version
-    kLSLaunchDefaults,
+    launch_flags,
     &app_fsref,
     NULL,  // asyncLaunchRefCon
     NULL,  // environment
diff --git a/base/mac/launch_services_util.h b/base/mac/launch_services_util.h
index cd17950..d4aa9ff 100644
--- a/base/mac/launch_services_util.h
+++ b/base/mac/launch_services_util.h
@@ -5,6 +5,8 @@
 #ifndef BASE_MAC_LAUNCH_SERVICES_UTIL_H_
 #define BASE_MAC_LAUNCH_SERVICES_UTIL_H_
 
+#include <ApplicationServices/ApplicationServices.h>
+
 #include "base/base_export.h"
 #include "base/command_line.h"
 #include "base/files/file_path.h"
@@ -16,11 +18,13 @@
 
 // Launches the application bundle at |bundle_path|, passing argv[1..] from
 // |command_line| as command line arguments if the app isn't already running.
+// |launch_flags| are passed directly to LSApplicationParameters.
 // |out_psn|, if not NULL, will be set to the process serial number of the
 // application's main process if the app was successfully launched.
 // Returns true if the app was successfully launched.
 BASE_EXPORT bool OpenApplicationWithPath(const base::FilePath& bundle_path,
                                          const CommandLine& command_line,
+                                         LSLaunchFlags launch_flags,
                                          ProcessSerialNumber* out_psn);
 
 }  // namespace mac
diff --git a/base/test/test_timeouts.cc b/base/test/test_timeouts.cc
index e8e4153..ed689c2 100644
--- a/base/test/test_timeouts.cc
+++ b/base/test/test_timeouts.cc
@@ -5,6 +5,7 @@
 #include "base/test/test_timeouts.h"
 
 #include "base/command_line.h"
+#include "base/debug/debugger.h"
 #include "base/logging.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/test/test_switches.h"
@@ -19,6 +20,8 @@
 static const int kTimeoutMultiplier = 1;
 #endif
 
+const int kAlmostInfiniteTimeoutMs = 100000000;
+
 // Sets value to the greatest of:
 // 1) value's current value multiplied by kTimeoutMultiplier (assuming
 // InitializeTimeout is called only once per value).
@@ -71,10 +74,17 @@
   }
   initialized_ = true;
 
+  if (base::debug::BeingDebugged()) {
+    fprintf(stdout,
+        "Detected presence of a debugger, running without test timeouts.\n");
+  }
+
   // Note that these timeouts MUST be initialized in the correct order as
   // per the CHECKS below.
   InitializeTimeout(switches::kTestTinyTimeout, &tiny_timeout_ms_);
-  InitializeTimeout(switches::kUiTestActionTimeout, tiny_timeout_ms_,
+  InitializeTimeout(switches::kUiTestActionTimeout,
+                    base::debug::BeingDebugged() ? kAlmostInfiniteTimeoutMs
+                                                 : tiny_timeout_ms_,
                     &action_timeout_ms_);
   InitializeTimeout(switches::kUiTestActionMaxTimeout, action_timeout_ms_,
                     &action_max_timeout_ms_);
diff --git a/build/android/adb_profile_chrome b/build/android/adb_profile_chrome
index 09d7bda..c4445d1 100755
--- a/build/android/adb_profile_chrome
+++ b/build/android/adb_profile_chrome
@@ -44,7 +44,7 @@
   TRACE_FILE=$(adb logcat -d | \
       grep "Logging performance trace to file: " | \
       tail -1 | \
-      sed -E "s/.*\/storage\/emulated\/.+\/([^\r]+).*/\/sdcard\/Download\/\\1/")
+      perl -pi -e "s/.*\/storage\/emulated\/.+\/([^\r]+).*/\/sdcard\/Download\/\\1/g")
   if [ -z "$TRACE_FILE" ]; then
     echo "Unable to determine trace file name"
     exit 1
diff --git a/build/android/buildbot/bb_device_status_check.py b/build/android/buildbot/bb_device_status_check.py
index 7e93557..452eea7 100755
--- a/build/android/buildbot/bb_device_status_check.py
+++ b/build/android/buildbot/bb_device_status_check.py
@@ -59,7 +59,10 @@
     battery_level = int(re.findall('level: (\d+)', battery)[0])
     battery_temp = float(re.findall('temperature: (\d+)', battery)[0]) / 10
   sub_info = device_adb.GetSubscriberInfo()
-  imei_slice = re.findall('Device ID = (\d+)', sub_info)[0][-6:]
+  imei_slice = ''
+  device_id = re.findall('Device ID = (\d+)', sub_info)
+  if device_id and len(device_id):
+    imei_slice = device_id[0][-6:]
   report = ['Device %s (%s)' % (serial, device_type),
             '  Build: %s (%s)' %
               (device_build, device_adb.GetBuildFingerprint()),
diff --git a/build/android/buildbot/bb_device_steps.py b/build/android/buildbot/bb_device_steps.py
index 45187d5..41d47ca 100755
--- a/build/android/buildbot/bb_device_steps.py
+++ b/build/android/buildbot/bb_device_steps.py
@@ -156,12 +156,15 @@
   RunCmd(['build/android/adb_install_apk.py'] + args, halt_on_failure=True)
 
 
-def RunInstrumentationSuite(options, test, flunk_on_failure=True):
+def RunInstrumentationSuite(options, test, flunk_on_failure=True,
+                            python_only=False):
   """Manages an invocation of test_runner.py for instrumentation tests.
 
   Args:
     options: options object
     test: An I_TEST namedtuple
+    flunk_on_failure: Flunk the step if tests fail.
+    Python: Run only host driven Python tests.
   """
   bb_annotations.PrintNamedStep('%s_instrumentation_tests' % test.name.lower())
 
@@ -172,9 +175,9 @@
     args.append('--release')
   if options.asan:
     args.append('--tool=asan')
-  if options.upload_to_flakiness_server:
+  if options.flakiness_server:
     args.append('--flakiness-dashboard-server=%s' %
-                constants.UPSTREAM_FLAKINESS_SERVER)
+                options.flakiness_server)
   if test.host_driven_root:
     args.append('--python_test_root=%s' % test.host_driven_root)
   if test.annotation:
@@ -183,6 +186,8 @@
     args.extend(['-E', test.exclude_annotation])
   if test.extra_flags:
     args.extend(test.extra_flags)
+  if python_only:
+    args.append('-p')
 
   RunCmd(['build/android/test_runner.py', 'instrumentation'] + args,
          flunk_on_failure=flunk_on_failure)
@@ -359,8 +364,10 @@
                     help='Install an apk by name')
   parser.add_option('--reboot', action='store_true',
                     help='Reboot devices before running tests')
-  parser.add_option('--upload-to-flakiness-server', action='store_true',
-                    help='Upload the results to the flakiness dashboard.')
+  parser.add_option(
+      '--flakiness-server',
+      help='The flakiness dashboard server to which the results should be '
+           'uploaded.')
   parser.add_option(
       '--auto-reconnect', action='store_true',
       help='Push script to device which restarts adbd on disconnections.')
diff --git a/build/android/buildbot/bb_run_bot.py b/build/android/buildbot/bb_run_bot.py
index 2d9bc12..6718aef 100755
--- a/build/android/buildbot/bb_run_bot.py
+++ b/build/android/buildbot/bb_run_bot.py
@@ -15,6 +15,10 @@
 
 import bb_utils
 
+sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
+from pylib import constants
+
+
 _BotConfig = collections.namedtuple(
     'BotConfig', ['bot_id', 'host_obj', 'test_obj'])
 
@@ -111,7 +115,8 @@
   std_build_steps = ['compile', 'zip_build']
   std_test_steps = ['extract_build']
   std_tests = ['ui', 'unit']
-  flakiness_server = '--upload-to-flakiness-server'
+  flakiness_server = (
+      '--flakiness-server=%s' % constants.UPSTREAM_FLAKINESS_SERVER)
   experimental = ['--experimental']
 
   B = BotConfig
diff --git a/build/common.gypi b/build/common.gypi
index a21d812..62aa480 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -3133,10 +3133,7 @@
               # this is worth fixing.
               '-Wno-c++11-narrowing',
 
-              # This warns about code like |"0x%08"NACL_PRIxPTR| -- with C++11
-              # user-defined literals, this is now a string literal with a UD
-              # suffix. However, this is used heavily in NaCl code, so disable
-              # the warning for now.
+              # TODO(thakis): Remove, http://crbug.com/263960
               '-Wno-reserved-user-defined-literal',
 
               # Clang considers the `register` keyword as deprecated, but e.g.
@@ -3830,10 +3827,7 @@
                 # this is worth fixing.
                 '-Wno-c++11-narrowing',
 
-                # This warns about code like |"0x%08"NACL_PRIxPTR| -- with C++11
-                # user-defined literals, this is now a string literal with a UD
-                # suffix. However, this is used heavily in NaCl code, so disable
-                # the warning for now.
+                # TODO(thakis): Remove, http://crbug.com/263960
                 '-Wno-reserved-user-defined-literal',
 
                 # Don't die on dtoa code that uses a char as an array index.
@@ -4141,6 +4135,7 @@
             '-Wno-unnamed-type-template-args',
             # Match OS X clang C++11 warning settings.
             '-Wno-c++11-narrowing',
+            # TODO(thakis): Remove, http://crbug.com/263960
             '-Wno-reserved-user-defined-literal',
           ],
         },
diff --git a/build/shim_headers.gypi b/build/shim_headers.gypi
index 0c885be..4291468 100644
--- a/build/shim_headers.gypi
+++ b/build/shim_headers.gypi
@@ -20,6 +20,9 @@
     'include_dirs+++': [
       '<(shim_headers_path)',
     ],
+    'include_dirs++++': [
+      '<(shim_headers_path)',
+    ],
   },
   'actions': [
     {
diff --git a/build/util/LASTCHANGE b/build/util/LASTCHANGE
index 4b28ec8..31ae365 100644
--- a/build/util/LASTCHANGE
+++ b/build/util/LASTCHANGE
@@ -1 +1 @@
-LASTCHANGE=213371
+LASTCHANGE=213605
diff --git a/build/util/LASTCHANGE.blink b/build/util/LASTCHANGE.blink
index 67dcb3f..39ed5b7 100644
--- a/build/util/LASTCHANGE.blink
+++ b/build/util/LASTCHANGE.blink
@@ -1 +1 @@
-LASTCHANGE=154818
+LASTCHANGE=154842
diff --git a/cc/cc.gyp b/cc/cc.gyp
index 1a02053..d934767 100644
--- a/cc/cc.gyp
+++ b/cc/cc.gyp
@@ -5,358 +5,6 @@
 {
   'variables': {
     'chromium_code': 1,
-    'cc_source_files': [
-      'animation/animation.cc',
-      'animation/animation.h',
-      'animation/animation_curve.cc',
-      'animation/animation_curve.h',
-      'animation/animation_delegate.h',
-      'animation/animation_events.cc',
-      'animation/animation_events.h',
-      'animation/animation_id_provider.cc',
-      'animation/animation_id_provider.h',
-      'animation/animation_registrar.cc',
-      'animation/animation_registrar.h',
-      'animation/keyframed_animation_curve.cc',
-      'animation/keyframed_animation_curve.h',
-      'animation/layer_animation_controller.cc',
-      'animation/layer_animation_controller.h',
-      'animation/layer_animation_event_observer.h',
-      'animation/layer_animation_value_observer.h',
-      'animation/scrollbar_animation_controller.h',
-      'animation/scrollbar_animation_controller_linear_fade.cc',
-      'animation/scrollbar_animation_controller_linear_fade.h',
-      'animation/timing_function.cc',
-      'animation/timing_function.h',
-      'animation/transform_operation.cc',
-      'animation/transform_operation.h',
-      'animation/transform_operations.cc',
-      'animation/transform_operations.h',
-      'base/completion_event.h',
-      'base/invalidation_region.cc',
-      'base/invalidation_region.h',
-      'base/math_util.cc',
-      'base/math_util.h',
-      'base/region.cc',
-      'base/region.h',
-      'base/scoped_ptr_algorithm.h',
-      'base/scoped_ptr_deque.h',
-      'base/scoped_ptr_hash_map.h',
-      'base/scoped_ptr_vector.h',
-      'base/switches.cc',
-      'base/switches.h',
-      'base/tiling_data.cc',
-      'base/tiling_data.h',
-      'base/util.h',
-      'debug/debug_colors.cc',
-      'debug/debug_colors.h',
-      'debug/debug_rect_history.cc',
-      'debug/debug_rect_history.h',
-      'debug/devtools_instrumentation.h',
-      'debug/fake_web_graphics_context_3d.cc',
-      'debug/fake_web_graphics_context_3d.h',
-      'debug/frame_rate_counter.cc',
-      'debug/frame_rate_counter.h',
-      'debug/layer_tree_debug_state.cc',
-      'debug/layer_tree_debug_state.h',
-      'debug/overdraw_metrics.cc',
-      'debug/overdraw_metrics.h',
-      'debug/paint_time_counter.cc',
-      'debug/paint_time_counter.h',
-      'debug/rendering_stats.cc',
-      'debug/rendering_stats.h',
-      'debug/rendering_stats_instrumentation.cc',
-      'debug/rendering_stats_instrumentation.h',
-      'debug/ring_buffer.h',
-      'debug/traced_picture.cc',
-      'debug/traced_picture.h',
-      'debug/traced_value.cc',
-      'debug/traced_value.h',
-      'input/input_handler.h',
-      'input/page_scale_animation.cc',
-      'input/page_scale_animation.h',
-      'input/top_controls_manager.cc',
-      'input/top_controls_manager.h',
-      'input/top_controls_manager_client.h',
-      'layers/append_quads_data.h',
-      'layers/compositing_reasons.h',
-      'layers/content_layer.cc',
-      'layers/content_layer.h',
-      'layers/content_layer_client.h',
-      'layers/contents_scaling_layer.cc',
-      'layers/contents_scaling_layer.h',
-      'layers/delegated_renderer_layer.cc',
-      'layers/delegated_renderer_layer.h',
-      'layers/delegated_renderer_layer_client.h',
-      'layers/delegated_renderer_layer_impl.cc',
-      'layers/delegated_renderer_layer_impl.h',
-      'layers/draw_properties.h',
-      'layers/heads_up_display_layer.cc',
-      'layers/heads_up_display_layer.h',
-      'layers/heads_up_display_layer_impl.cc',
-      'layers/heads_up_display_layer_impl.h',
-      'layers/image_layer.cc',
-      'layers/image_layer.h',
-      'layers/io_surface_layer.cc',
-      'layers/io_surface_layer.h',
-      'layers/io_surface_layer_impl.cc',
-      'layers/io_surface_layer_impl.h',
-      'layers/layer.cc',
-      'layers/layer.h',
-      'layers/layer_impl.cc',
-      'layers/layer_impl.h',
-      'layers/layer_iterator.cc',
-      'layers/layer_iterator.h',
-      'layers/layer_lists.cc',
-      'layers/layer_lists.h',
-      'layers/layer_position_constraint.cc',
-      'layers/layer_position_constraint.h',
-      'layers/nine_patch_layer.cc',
-      'layers/nine_patch_layer.h',
-      'layers/nine_patch_layer_impl.cc',
-      'layers/nine_patch_layer_impl.h',
-      'layers/paint_properties.h',
-      'layers/picture_image_layer.cc',
-      'layers/picture_image_layer.h',
-      'layers/picture_image_layer_impl.cc',
-      'layers/picture_image_layer_impl.h',
-      'layers/picture_layer.cc',
-      'layers/picture_layer.h',
-      'layers/picture_layer_impl.cc',
-      'layers/picture_layer_impl.h',
-      'layers/quad_sink.h',
-      'layers/render_pass_sink.h',
-      'layers/render_surface.cc',
-      'layers/render_surface.h',
-      'layers/render_surface_impl.cc',
-      'layers/render_surface_impl.h',
-      'layers/scrollbar_layer.cc',
-      'layers/scrollbar_layer.h',
-      'layers/scrollbar_layer_impl.cc',
-      'layers/scrollbar_layer_impl.h',
-      'layers/solid_color_layer.cc',
-      'layers/solid_color_layer.h',
-      'layers/solid_color_layer_impl.cc',
-      'layers/solid_color_layer_impl.h',
-      'layers/texture_layer.cc',
-      'layers/texture_layer.h',
-      'layers/texture_layer_client.h',
-      'layers/texture_layer_impl.cc',
-      'layers/texture_layer_impl.h',
-      'layers/tiled_layer.cc',
-      'layers/tiled_layer.h',
-      'layers/tiled_layer_impl.cc',
-      'layers/tiled_layer_impl.h',
-      'layers/video_frame_provider.h',
-      'layers/video_frame_provider_client_impl.cc',
-      'layers/video_frame_provider_client_impl.h',
-      'layers/video_layer.cc',
-      'layers/video_layer.h',
-      'layers/video_layer_impl.cc',
-      'layers/video_layer_impl.h',
-      'output/begin_frame_args.cc',
-      'output/begin_frame_args.h',
-      'output/compositor_frame.cc',
-      'output/compositor_frame.h',
-      'output/compositor_frame_ack.cc',
-      'output/compositor_frame_ack.h',
-      'output/compositor_frame_metadata.cc',
-      'output/compositor_frame_metadata.h',
-      'output/context_provider.h',
-      'output/copy_output_request.cc',
-      'output/copy_output_request.h',
-      'output/copy_output_result.cc',
-      'output/copy_output_result.h',
-      'output/delegated_frame_data.h',
-      'output/delegated_frame_data.cc',
-      'output/delegating_renderer.cc',
-      'output/delegating_renderer.h',
-      'output/direct_renderer.cc',
-      'output/direct_renderer.h',
-      'output/filter_operation.cc',
-      'output/filter_operation.h',
-      'output/filter_operations.cc',
-      'output/filter_operations.h',
-      'output/geometry_binding.cc',
-      'output/geometry_binding.h',
-      'output/gl_frame_data.h',
-      'output/gl_frame_data.cc',
-      'output/gl_renderer.cc',
-      'output/gl_renderer.h',
-      'output/gl_renderer_draw_cache.cc',
-      'output/gl_renderer_draw_cache.h',
-      'output/managed_memory_policy.cc',
-      'output/managed_memory_policy.h',
-      'output/output_surface.cc',
-      'output/output_surface.h',
-      'output/output_surface_client.h',
-      'output/program_binding.cc',
-      'output/program_binding.h',
-      'output/render_surface_filters.cc',
-      'output/render_surface_filters.h',
-      'output/renderer.cc',
-      'output/renderer.h',
-      'output/shader.cc',
-      'output/shader.h',
-      'output/software_frame_data.cc',
-      'output/software_frame_data.h',
-      'output/software_output_device.cc',
-      'output/software_output_device.h',
-      'output/software_renderer.cc',
-      'output/software_renderer.h',
-      'quads/checkerboard_draw_quad.cc',
-      'quads/checkerboard_draw_quad.h',
-      'quads/content_draw_quad_base.cc',
-      'quads/content_draw_quad_base.h',
-      'quads/debug_border_draw_quad.cc',
-      'quads/debug_border_draw_quad.h',
-      'quads/draw_quad.cc',
-      'quads/draw_quad.h',
-      'quads/io_surface_draw_quad.cc',
-      'quads/io_surface_draw_quad.h',
-      'quads/picture_draw_quad.cc',
-      'quads/picture_draw_quad.h',
-      'quads/render_pass.cc',
-      'quads/render_pass.h',
-      'quads/render_pass_draw_quad.cc',
-      'quads/render_pass_draw_quad.h',
-      'quads/shared_quad_state.cc',
-      'quads/shared_quad_state.h',
-      'quads/solid_color_draw_quad.cc',
-      'quads/solid_color_draw_quad.h',
-      'quads/stream_video_draw_quad.cc',
-      'quads/stream_video_draw_quad.h',
-      'quads/texture_draw_quad.cc',
-      'quads/texture_draw_quad.h',
-      'quads/tile_draw_quad.cc',
-      'quads/tile_draw_quad.h',
-      'quads/yuv_video_draw_quad.cc',
-      'quads/yuv_video_draw_quad.h',
-      'resources/bitmap_content_layer_updater.cc',
-      'resources/bitmap_content_layer_updater.h',
-      'resources/bitmap_skpicture_content_layer_updater.cc',
-      'resources/bitmap_skpicture_content_layer_updater.h',
-      'resources/caching_bitmap_content_layer_updater.cc',
-      'resources/caching_bitmap_content_layer_updater.h',
-      'resources/content_layer_updater.cc',
-      'resources/content_layer_updater.h',
-      'resources/image_layer_updater.cc',
-      'resources/image_layer_updater.h',
-      'resources/image_raster_worker_pool.cc',
-      'resources/image_raster_worker_pool.h',
-      'resources/layer_painter.h',
-      'resources/layer_quad.cc',
-      'resources/layer_quad.h',
-      'resources/layer_tiling_data.cc',
-      'resources/layer_tiling_data.h',
-      'resources/layer_updater.cc',
-      'resources/layer_updater.h',
-      'resources/managed_tile_state.cc',
-      'resources/managed_tile_state.h',
-      'resources/memory_history.cc',
-      'resources/memory_history.h',
-      'resources/picture.cc',
-      'resources/picture.h',
-      'resources/picture_layer_tiling.cc',
-      'resources/picture_layer_tiling.h',
-      'resources/picture_layer_tiling_set.cc',
-      'resources/picture_layer_tiling_set.h',
-      'resources/picture_pile.cc',
-      'resources/picture_pile.h',
-      'resources/picture_pile_base.cc',
-      'resources/picture_pile_base.h',
-      'resources/picture_pile_impl.cc',
-      'resources/picture_pile_impl.h',
-      'resources/pixel_buffer_raster_worker_pool.cc',
-      'resources/pixel_buffer_raster_worker_pool.h',
-      'resources/platform_color.h',
-      'resources/prioritized_resource.cc',
-      'resources/prioritized_resource.h',
-      'resources/prioritized_resource_manager.cc',
-      'resources/prioritized_resource_manager.h',
-      'resources/priority_calculator.cc',
-      'resources/priority_calculator.h',
-      'resources/raster_mode.cc',
-      'resources/raster_mode.h',
-      'resources/raster_worker_pool.cc',
-      'resources/raster_worker_pool.h',
-      'resources/resource.cc',
-      'resources/resource.h',
-      'resources/resource_pool.cc',
-      'resources/resource_pool.h',
-      'resources/resource_provider.cc',
-      'resources/resource_provider.h',
-      'resources/resource_update.cc',
-      'resources/resource_update.h',
-      'resources/resource_update_controller.cc',
-      'resources/resource_update_controller.h',
-      'resources/resource_update_queue.cc',
-      'resources/resource_update_queue.h',
-      'resources/scoped_resource.cc',
-      'resources/scoped_resource.h',
-      'resources/skpicture_content_layer_updater.cc',
-      'resources/skpicture_content_layer_updater.h',
-      'resources/sync_point_helper.cc',
-      'resources/sync_point_helper.h',
-      'resources/texture_mailbox.cc',
-      'resources/texture_mailbox.h',
-      'resources/tile.cc',
-      'resources/tile.h',
-      'resources/tile_manager.cc',
-      'resources/tile_manager.h',
-      'resources/tile_priority.cc',
-      'resources/tile_priority.h',
-      'resources/transferable_resource.cc',
-      'resources/transferable_resource.h',
-      'resources/video_resource_updater.cc',
-      'resources/video_resource_updater.h',
-      'resources/worker_pool.cc',
-      'resources/worker_pool.h',
-      'scheduler/delay_based_time_source.cc',
-      'scheduler/delay_based_time_source.h',
-      'scheduler/frame_rate_controller.cc',
-      'scheduler/frame_rate_controller.h',
-      'scheduler/rate_limiter.cc',
-      'scheduler/rate_limiter.h',
-      'scheduler/rolling_time_delta_history.cc',
-      'scheduler/rolling_time_delta_history.h',
-      'scheduler/scheduler.cc',
-      'scheduler/scheduler.h',
-      'scheduler/scheduler_settings.cc',
-      'scheduler/scheduler_settings.h',
-      'scheduler/scheduler_state_machine.cc',
-      'scheduler/scheduler_state_machine.h',
-      'scheduler/texture_uploader.cc',
-      'scheduler/texture_uploader.h',
-      'scheduler/time_source.h',
-      'trees/damage_tracker.cc',
-      'trees/damage_tracker.h',
-      'trees/layer_sorter.cc',
-      'trees/layer_sorter.h',
-      'trees/layer_tree_host.cc',
-      'trees/layer_tree_host.h',
-      'trees/layer_tree_host_client.h',
-      'trees/layer_tree_host_common.cc',
-      'trees/layer_tree_host_common.h',
-      'trees/layer_tree_host_impl.cc',
-      'trees/layer_tree_host_impl.h',
-      'trees/layer_tree_impl.cc',
-      'trees/layer_tree_impl.h',
-      'trees/layer_tree_settings.cc',
-      'trees/layer_tree_settings.h',
-      'trees/occlusion_tracker.cc',
-      'trees/occlusion_tracker.h',
-      'trees/proxy.cc',
-      'trees/proxy.h',
-      'trees/quad_culler.cc',
-      'trees/quad_culler.h',
-      'trees/single_thread_proxy.cc',
-      'trees/single_thread_proxy.h',
-      'trees/thread_proxy.cc',
-      'trees/thread_proxy.h',
-      'trees/tree_synchronizer.cc',
-      'trees/tree_synchronizer.h',
-    ],
   },
   'targets': [
     {
@@ -376,7 +24,356 @@
         'CC_IMPLEMENTATION=1',
       ],
       'sources': [
-        '<@(cc_source_files)',
+        'animation/animation.cc',
+        'animation/animation.h',
+        'animation/animation_curve.cc',
+        'animation/animation_curve.h',
+        'animation/animation_delegate.h',
+        'animation/animation_events.cc',
+        'animation/animation_events.h',
+        'animation/animation_id_provider.cc',
+        'animation/animation_id_provider.h',
+        'animation/animation_registrar.cc',
+        'animation/animation_registrar.h',
+        'animation/keyframed_animation_curve.cc',
+        'animation/keyframed_animation_curve.h',
+        'animation/layer_animation_controller.cc',
+        'animation/layer_animation_controller.h',
+        'animation/layer_animation_event_observer.h',
+        'animation/layer_animation_value_observer.h',
+        'animation/scrollbar_animation_controller.h',
+        'animation/scrollbar_animation_controller_linear_fade.cc',
+        'animation/scrollbar_animation_controller_linear_fade.h',
+        'animation/timing_function.cc',
+        'animation/timing_function.h',
+        'animation/transform_operation.cc',
+        'animation/transform_operation.h',
+        'animation/transform_operations.cc',
+        'animation/transform_operations.h',
+        'base/completion_event.h',
+        'base/invalidation_region.cc',
+        'base/invalidation_region.h',
+        'base/math_util.cc',
+        'base/math_util.h',
+        'base/region.cc',
+        'base/region.h',
+        'base/scoped_ptr_algorithm.h',
+        'base/scoped_ptr_deque.h',
+        'base/scoped_ptr_hash_map.h',
+        'base/scoped_ptr_vector.h',
+        'base/switches.cc',
+        'base/switches.h',
+        'base/tiling_data.cc',
+        'base/tiling_data.h',
+        'base/util.h',
+        'debug/debug_colors.cc',
+        'debug/debug_colors.h',
+        'debug/debug_rect_history.cc',
+        'debug/debug_rect_history.h',
+        'debug/devtools_instrumentation.h',
+        'debug/fake_web_graphics_context_3d.cc',
+        'debug/fake_web_graphics_context_3d.h',
+        'debug/frame_rate_counter.cc',
+        'debug/frame_rate_counter.h',
+        'debug/layer_tree_debug_state.cc',
+        'debug/layer_tree_debug_state.h',
+        'debug/overdraw_metrics.cc',
+        'debug/overdraw_metrics.h',
+        'debug/paint_time_counter.cc',
+        'debug/paint_time_counter.h',
+        'debug/rendering_stats.cc',
+        'debug/rendering_stats.h',
+        'debug/rendering_stats_instrumentation.cc',
+        'debug/rendering_stats_instrumentation.h',
+        'debug/ring_buffer.h',
+        'debug/traced_picture.cc',
+        'debug/traced_picture.h',
+        'debug/traced_value.cc',
+        'debug/traced_value.h',
+        'input/input_handler.h',
+        'input/page_scale_animation.cc',
+        'input/page_scale_animation.h',
+        'input/top_controls_manager.cc',
+        'input/top_controls_manager.h',
+        'input/top_controls_manager_client.h',
+        'layers/append_quads_data.h',
+        'layers/compositing_reasons.h',
+        'layers/content_layer.cc',
+        'layers/content_layer.h',
+        'layers/content_layer_client.h',
+        'layers/contents_scaling_layer.cc',
+        'layers/contents_scaling_layer.h',
+        'layers/delegated_renderer_layer.cc',
+        'layers/delegated_renderer_layer.h',
+        'layers/delegated_renderer_layer_client.h',
+        'layers/delegated_renderer_layer_impl.cc',
+        'layers/delegated_renderer_layer_impl.h',
+        'layers/draw_properties.h',
+        'layers/heads_up_display_layer.cc',
+        'layers/heads_up_display_layer.h',
+        'layers/heads_up_display_layer_impl.cc',
+        'layers/heads_up_display_layer_impl.h',
+        'layers/image_layer.cc',
+        'layers/image_layer.h',
+        'layers/io_surface_layer.cc',
+        'layers/io_surface_layer.h',
+        'layers/io_surface_layer_impl.cc',
+        'layers/io_surface_layer_impl.h',
+        'layers/layer.cc',
+        'layers/layer.h',
+        'layers/layer_impl.cc',
+        'layers/layer_impl.h',
+        'layers/layer_iterator.cc',
+        'layers/layer_iterator.h',
+        'layers/layer_lists.cc',
+        'layers/layer_lists.h',
+        'layers/layer_position_constraint.cc',
+        'layers/layer_position_constraint.h',
+        'layers/nine_patch_layer.cc',
+        'layers/nine_patch_layer.h',
+        'layers/nine_patch_layer_impl.cc',
+        'layers/nine_patch_layer_impl.h',
+        'layers/paint_properties.h',
+        'layers/picture_image_layer.cc',
+        'layers/picture_image_layer.h',
+        'layers/picture_image_layer_impl.cc',
+        'layers/picture_image_layer_impl.h',
+        'layers/picture_layer.cc',
+        'layers/picture_layer.h',
+        'layers/picture_layer_impl.cc',
+        'layers/picture_layer_impl.h',
+        'layers/quad_sink.h',
+        'layers/render_pass_sink.h',
+        'layers/render_surface.cc',
+        'layers/render_surface.h',
+        'layers/render_surface_impl.cc',
+        'layers/render_surface_impl.h',
+        'layers/scrollbar_layer.cc',
+        'layers/scrollbar_layer.h',
+        'layers/scrollbar_layer_impl.cc',
+        'layers/scrollbar_layer_impl.h',
+        'layers/solid_color_layer.cc',
+        'layers/solid_color_layer.h',
+        'layers/solid_color_layer_impl.cc',
+        'layers/solid_color_layer_impl.h',
+        'layers/texture_layer.cc',
+        'layers/texture_layer.h',
+        'layers/texture_layer_client.h',
+        'layers/texture_layer_impl.cc',
+        'layers/texture_layer_impl.h',
+        'layers/tiled_layer.cc',
+        'layers/tiled_layer.h',
+        'layers/tiled_layer_impl.cc',
+        'layers/tiled_layer_impl.h',
+        'layers/video_frame_provider.h',
+        'layers/video_frame_provider_client_impl.cc',
+        'layers/video_frame_provider_client_impl.h',
+        'layers/video_layer.cc',
+        'layers/video_layer.h',
+        'layers/video_layer_impl.cc',
+        'layers/video_layer_impl.h',
+        'output/begin_frame_args.cc',
+        'output/begin_frame_args.h',
+        'output/compositor_frame.cc',
+        'output/compositor_frame.h',
+        'output/compositor_frame_ack.cc',
+        'output/compositor_frame_ack.h',
+        'output/compositor_frame_metadata.cc',
+        'output/compositor_frame_metadata.h',
+        'output/context_provider.h',
+        'output/copy_output_request.cc',
+        'output/copy_output_request.h',
+        'output/copy_output_result.cc',
+        'output/copy_output_result.h',
+        'output/delegated_frame_data.h',
+        'output/delegated_frame_data.cc',
+        'output/delegating_renderer.cc',
+        'output/delegating_renderer.h',
+        'output/direct_renderer.cc',
+        'output/direct_renderer.h',
+        'output/filter_operation.cc',
+        'output/filter_operation.h',
+        'output/filter_operations.cc',
+        'output/filter_operations.h',
+        'output/geometry_binding.cc',
+        'output/geometry_binding.h',
+        'output/gl_frame_data.h',
+        'output/gl_frame_data.cc',
+        'output/gl_renderer.cc',
+        'output/gl_renderer.h',
+        'output/gl_renderer_draw_cache.cc',
+        'output/gl_renderer_draw_cache.h',
+        'output/managed_memory_policy.cc',
+        'output/managed_memory_policy.h',
+        'output/output_surface.cc',
+        'output/output_surface.h',
+        'output/output_surface_client.h',
+        'output/program_binding.cc',
+        'output/program_binding.h',
+        'output/render_surface_filters.cc',
+        'output/render_surface_filters.h',
+        'output/renderer.cc',
+        'output/renderer.h',
+        'output/shader.cc',
+        'output/shader.h',
+        'output/software_frame_data.cc',
+        'output/software_frame_data.h',
+        'output/software_output_device.cc',
+        'output/software_output_device.h',
+        'output/software_renderer.cc',
+        'output/software_renderer.h',
+        'quads/checkerboard_draw_quad.cc',
+        'quads/checkerboard_draw_quad.h',
+        'quads/content_draw_quad_base.cc',
+        'quads/content_draw_quad_base.h',
+        'quads/debug_border_draw_quad.cc',
+        'quads/debug_border_draw_quad.h',
+        'quads/draw_quad.cc',
+        'quads/draw_quad.h',
+        'quads/io_surface_draw_quad.cc',
+        'quads/io_surface_draw_quad.h',
+        'quads/picture_draw_quad.cc',
+        'quads/picture_draw_quad.h',
+        'quads/render_pass.cc',
+        'quads/render_pass.h',
+        'quads/render_pass_draw_quad.cc',
+        'quads/render_pass_draw_quad.h',
+        'quads/shared_quad_state.cc',
+        'quads/shared_quad_state.h',
+        'quads/solid_color_draw_quad.cc',
+        'quads/solid_color_draw_quad.h',
+        'quads/stream_video_draw_quad.cc',
+        'quads/stream_video_draw_quad.h',
+        'quads/texture_draw_quad.cc',
+        'quads/texture_draw_quad.h',
+        'quads/tile_draw_quad.cc',
+        'quads/tile_draw_quad.h',
+        'quads/yuv_video_draw_quad.cc',
+        'quads/yuv_video_draw_quad.h',
+        'resources/bitmap_content_layer_updater.cc',
+        'resources/bitmap_content_layer_updater.h',
+        'resources/bitmap_skpicture_content_layer_updater.cc',
+        'resources/bitmap_skpicture_content_layer_updater.h',
+        'resources/caching_bitmap_content_layer_updater.cc',
+        'resources/caching_bitmap_content_layer_updater.h',
+        'resources/content_layer_updater.cc',
+        'resources/content_layer_updater.h',
+        'resources/image_layer_updater.cc',
+        'resources/image_layer_updater.h',
+        'resources/image_raster_worker_pool.cc',
+        'resources/image_raster_worker_pool.h',
+        'resources/layer_painter.h',
+        'resources/layer_quad.cc',
+        'resources/layer_quad.h',
+        'resources/layer_tiling_data.cc',
+        'resources/layer_tiling_data.h',
+        'resources/layer_updater.cc',
+        'resources/layer_updater.h',
+        'resources/managed_tile_state.cc',
+        'resources/managed_tile_state.h',
+        'resources/memory_history.cc',
+        'resources/memory_history.h',
+        'resources/picture.cc',
+        'resources/picture.h',
+        'resources/picture_layer_tiling.cc',
+        'resources/picture_layer_tiling.h',
+        'resources/picture_layer_tiling_set.cc',
+        'resources/picture_layer_tiling_set.h',
+        'resources/picture_pile.cc',
+        'resources/picture_pile.h',
+        'resources/picture_pile_base.cc',
+        'resources/picture_pile_base.h',
+        'resources/picture_pile_impl.cc',
+        'resources/picture_pile_impl.h',
+        'resources/pixel_buffer_raster_worker_pool.cc',
+        'resources/pixel_buffer_raster_worker_pool.h',
+        'resources/platform_color.h',
+        'resources/prioritized_resource.cc',
+        'resources/prioritized_resource.h',
+        'resources/prioritized_resource_manager.cc',
+        'resources/prioritized_resource_manager.h',
+        'resources/priority_calculator.cc',
+        'resources/priority_calculator.h',
+        'resources/raster_mode.cc',
+        'resources/raster_mode.h',
+        'resources/raster_worker_pool.cc',
+        'resources/raster_worker_pool.h',
+        'resources/resource.cc',
+        'resources/resource.h',
+        'resources/resource_pool.cc',
+        'resources/resource_pool.h',
+        'resources/resource_provider.cc',
+        'resources/resource_provider.h',
+        'resources/resource_update.cc',
+        'resources/resource_update.h',
+        'resources/resource_update_controller.cc',
+        'resources/resource_update_controller.h',
+        'resources/resource_update_queue.cc',
+        'resources/resource_update_queue.h',
+        'resources/scoped_resource.cc',
+        'resources/scoped_resource.h',
+        'resources/skpicture_content_layer_updater.cc',
+        'resources/skpicture_content_layer_updater.h',
+        'resources/sync_point_helper.cc',
+        'resources/sync_point_helper.h',
+        'resources/texture_mailbox.cc',
+        'resources/texture_mailbox.h',
+        'resources/tile.cc',
+        'resources/tile.h',
+        'resources/tile_manager.cc',
+        'resources/tile_manager.h',
+        'resources/tile_priority.cc',
+        'resources/tile_priority.h',
+        'resources/transferable_resource.cc',
+        'resources/transferable_resource.h',
+        'resources/video_resource_updater.cc',
+        'resources/video_resource_updater.h',
+        'resources/worker_pool.cc',
+        'resources/worker_pool.h',
+        'scheduler/delay_based_time_source.cc',
+        'scheduler/delay_based_time_source.h',
+        'scheduler/frame_rate_controller.cc',
+        'scheduler/frame_rate_controller.h',
+        'scheduler/rate_limiter.cc',
+        'scheduler/rate_limiter.h',
+        'scheduler/rolling_time_delta_history.cc',
+        'scheduler/rolling_time_delta_history.h',
+        'scheduler/scheduler.cc',
+        'scheduler/scheduler.h',
+        'scheduler/scheduler_settings.cc',
+        'scheduler/scheduler_settings.h',
+        'scheduler/scheduler_state_machine.cc',
+        'scheduler/scheduler_state_machine.h',
+        'scheduler/texture_uploader.cc',
+        'scheduler/texture_uploader.h',
+        'scheduler/time_source.h',
+        'trees/damage_tracker.cc',
+        'trees/damage_tracker.h',
+        'trees/layer_sorter.cc',
+        'trees/layer_sorter.h',
+        'trees/layer_tree_host.cc',
+        'trees/layer_tree_host.h',
+        'trees/layer_tree_host_client.h',
+        'trees/layer_tree_host_common.cc',
+        'trees/layer_tree_host_common.h',
+        'trees/layer_tree_host_impl.cc',
+        'trees/layer_tree_host_impl.h',
+        'trees/layer_tree_impl.cc',
+        'trees/layer_tree_impl.h',
+        'trees/layer_tree_settings.cc',
+        'trees/layer_tree_settings.h',
+        'trees/occlusion_tracker.cc',
+        'trees/occlusion_tracker.h',
+        'trees/proxy.cc',
+        'trees/proxy.h',
+        'trees/quad_culler.cc',
+        'trees/quad_culler.h',
+        'trees/single_thread_proxy.cc',
+        'trees/single_thread_proxy.h',
+        'trees/thread_proxy.cc',
+        'trees/thread_proxy.h',
+        'trees/tree_synchronizer.cc',
+        'trees/tree_synchronizer.h',
       ],
       # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
       'msvs_disabled_warnings': [ 4267, ],
diff --git a/cc/cc.target.darwin-arm.mk b/cc/cc.target.darwin-arm.mk
index d173193..4b322bf 100644
--- a/cc/cc.target.darwin-arm.mk
+++ b/cc/cc.target.darwin-arm.mk
@@ -263,12 +263,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -377,12 +377,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
diff --git a/cc/cc.target.darwin-mips.mk b/cc/cc.target.darwin-mips.mk
index b00d6b8..36433ff 100644
--- a/cc/cc.target.darwin-mips.mk
+++ b/cc/cc.target.darwin-mips.mk
@@ -262,12 +262,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -375,12 +375,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
diff --git a/cc/cc.target.darwin-x86.mk b/cc/cc.target.darwin-x86.mk
index 586ed00..2126313 100644
--- a/cc/cc.target.darwin-x86.mk
+++ b/cc/cc.target.darwin-x86.mk
@@ -264,12 +264,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -380,12 +380,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
diff --git a/cc/cc.target.linux-arm.mk b/cc/cc.target.linux-arm.mk
index d173193..4b322bf 100644
--- a/cc/cc.target.linux-arm.mk
+++ b/cc/cc.target.linux-arm.mk
@@ -263,12 +263,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -377,12 +377,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
diff --git a/cc/cc.target.linux-mips.mk b/cc/cc.target.linux-mips.mk
index b00d6b8..36433ff 100644
--- a/cc/cc.target.linux-mips.mk
+++ b/cc/cc.target.linux-mips.mk
@@ -262,12 +262,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -375,12 +375,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
diff --git a/cc/cc.target.linux-x86.mk b/cc/cc.target.linux-x86.mk
index 586ed00..2126313 100644
--- a/cc/cc.target.linux-x86.mk
+++ b/cc/cc.target.linux-x86.mk
@@ -264,12 +264,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -380,12 +380,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
diff --git a/cc/debug/benchmark_instrumentation.h b/cc/debug/benchmark_instrumentation.h
index 006bdf7..615fbe9 100644
--- a/cc/debug/benchmark_instrumentation.h
+++ b/cc/debug/benchmark_instrumentation.h
@@ -11,10 +11,9 @@
 namespace benchmark_instrumentation {
 // Please do not change the string constants in this file (or the TRACE_EVENT
 // calls that use them) without updating
-// tools/perf/perf_tools/rasterize_and_record_benchmark.py accordingly.
+// tools/perf/measurements/rasterize_and_record_benchmark.py accordingly.
 // The benchmark searches for events and their arguments by name.
 const char kCategory[] = "cc,benchmark";
-const char kCommitNumber[] = "commit_number";
 const char kSourceFrameNumber[] = "source_frame_number";
 const char kData[] = "data";
 const char kWidth[] = "width";
diff --git a/cc/layers/picture_layer.cc b/cc/layers/picture_layer.cc
index a5cd2ad..5438a8c 100644
--- a/cc/layers/picture_layer.cc
+++ b/cc/layers/picture_layer.cc
@@ -87,8 +87,8 @@
 
   TRACE_EVENT1(benchmark_instrumentation::kCategory,
                benchmark_instrumentation::kPictureLayerUpdate,
-               benchmark_instrumentation::kCommitNumber,
-               layer_tree_host()->commit_number());
+               benchmark_instrumentation::kSourceFrameNumber,
+               layer_tree_host()->source_frame_number());
 
   pile_->Resize(paint_properties().bounds);
 
diff --git a/cc/scheduler/scheduler_state_machine.cc b/cc/scheduler/scheduler_state_machine.cc
index eed9f15..3747c0b 100644
--- a/cc/scheduler/scheduler_state_machine.cc
+++ b/cc/scheduler/scheduler_state_machine.cc
@@ -83,12 +83,12 @@
                       main_thread_needs_layer_textures_);
   base::StringAppendF(&str, "inside_begin_frame_ = %d; ",
       inside_begin_frame_);
-  base::StringAppendF(&str, "last_frame_time_ = %"PRId64"; ",
+  base::StringAppendF(&str, "last_frame_time_ = %" PRId64 "; ",
       (last_begin_frame_args_.frame_time - base::TimeTicks())
           .InMilliseconds());
-  base::StringAppendF(&str, "last_deadline_ = %"PRId64"; ",
+  base::StringAppendF(&str, "last_deadline_ = %" PRId64 "; ",
       (last_begin_frame_args_.deadline - base::TimeTicks()).InMilliseconds());
-  base::StringAppendF(&str, "last_interval_ = %"PRId64"; ",
+  base::StringAppendF(&str, "last_interval_ = %" PRId64 "; ",
       last_begin_frame_args_.interval.InMilliseconds());
   base::StringAppendF(&str, "visible_ = %d; ", visible_);
   base::StringAppendF(&str, "can_start_ = %d; ", can_start_);
diff --git a/cc/test/data/background_filter_blur_outsets.png b/cc/test/data/background_filter_blur_outsets.png
index 1d10149..9234496 100644
--- a/cc/test/data/background_filter_blur_outsets.png
+++ b/cc/test/data/background_filter_blur_outsets.png
Binary files differ
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index 0d90c59..3f4a279 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -82,7 +82,7 @@
       needs_full_tree_sync_(true),
       needs_filter_context_(false),
       client_(client),
-      commit_number_(0),
+      source_frame_number_(0),
       rendering_stats_instrumentation_(RenderingStatsInstrumentation::Create()),
       output_surface_can_be_initialized_(true),
       output_surface_lost_(true),
@@ -293,7 +293,7 @@
     sync_tree = host_impl->active_tree();
   }
 
-  sync_tree->set_source_frame_number(commit_number());
+  sync_tree->set_source_frame_number(source_frame_number());
 
   if (needs_full_tree_sync_)
     sync_tree->SetRootLayer(TreeSynchronizer::SynchronizeTrees(
@@ -367,7 +367,7 @@
     sync_tree->DidBecomeActive();
   }
 
-  commit_number_++;
+  source_frame_number_++;
 }
 
 void LayerTreeHost::WillCommit() {
@@ -696,8 +696,8 @@
                                  ResourceUpdateQueue* queue) {
   TRACE_EVENT1(benchmark_instrumentation::kCategory,
                benchmark_instrumentation::kLayerTreeHostUpdateLayers,
-               benchmark_instrumentation::kCommitNumber,
-               commit_number());
+               benchmark_instrumentation::kSourceFrameNumber,
+               source_frame_number());
 
   RenderSurfaceLayerList update_list;
   {
diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h
index 0fd3abb..f04871a 100644
--- a/cc/trees/layer_tree_host.h
+++ b/cc/trees/layer_tree_host.h
@@ -152,7 +152,7 @@
   // Test only hook
   virtual void DidDeferCommit();
 
-  int commit_number() const { return commit_number_; }
+  int source_frame_number() const { return source_frame_number_; }
 
   void SetNeedsDisplayOnAllLayers();
 
@@ -299,7 +299,7 @@
   LayerTreeHostClient* client_;
   scoped_ptr<Proxy> proxy_;
 
-  int commit_number_;
+  int source_frame_number_;
   scoped_ptr<RenderingStatsInstrumentation> rendering_stats_instrumentation_;
 
   bool output_surface_can_be_initialized_;
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
index f001205..0a8f5f6 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -8522,5 +8522,64 @@
   EXPECT_EQ(root->id(), root->render_surface()->layer_list().at(0)->id());
 }
 
+TEST_F(LayerTreeHostCommonTest, VisibleContentRectInsideSurface) {
+  FakeImplProxy proxy;
+  FakeLayerTreeHostImpl host_impl(&proxy);
+  host_impl.CreatePendingTree();
+  const gfx::Transform identity_matrix;
+
+  scoped_refptr<Layer> root = Layer::Create();
+  SetLayerPropertiesForTesting(root.get(),
+                               identity_matrix,
+                               identity_matrix,
+                               gfx::PointF(),
+                               gfx::PointF(),
+                               gfx::Size(50, 50),
+                               false);
+  root->SetIsDrawable(true);
+
+  // The surface is moved slightly outside of the viewport.
+  scoped_refptr<Layer> surface = Layer::Create();
+  SetLayerPropertiesForTesting(surface.get(),
+                               identity_matrix,
+                               identity_matrix,
+                               gfx::PointF(),
+                               gfx::PointF(-10, -20),
+                               gfx::Size(),
+                               false);
+  surface->SetForceRenderSurface(true);
+
+  scoped_refptr<Layer> surface_child = Layer::Create();
+  SetLayerPropertiesForTesting(surface_child.get(),
+                               identity_matrix,
+                               identity_matrix,
+                               gfx::PointF(),
+                               gfx::PointF(),
+                               gfx::Size(50, 50),
+                               false);
+  surface_child->SetIsDrawable(true);
+
+  surface->AddChild(surface_child);
+  root->AddChild(surface);
+
+  RenderSurfaceLayerList render_surface_layer_list;
+  int dummy_max_texture_size = 512;
+  LayerTreeHostCommon::CalculateDrawProperties(root.get(),
+                                               root->bounds(),
+                                               gfx::Transform(),
+                                               1.f,
+                                               1.f,
+                                               NULL,
+                                               dummy_max_texture_size,
+                                               false,
+                                               true,  // can_adjust_raster_scale
+                                               &render_surface_layer_list);
+
+  // The visible_content_rect for the |surface_child| should not be clipped by
+  // the viewport.
+  EXPECT_EQ(gfx::Rect(50, 50).ToString(),
+            surface_child->visible_content_rect().ToString());
+}
+
 }  // namespace
 }  // namespace cc
diff --git a/cc/trees/layer_tree_host_pixeltest_filters.cc b/cc/trees/layer_tree_host_pixeltest_filters.cc
index f9125b9..c6c1a78 100644
--- a/cc/trees/layer_tree_host_pixeltest_filters.cc
+++ b/cc/trees/layer_tree_host_pixeltest_filters.cc
@@ -51,7 +51,7 @@
                base::FilePath(FILE_PATH_LITERAL("background_filter_blur.png")));
 }
 
-TEST_F(LayerTreeHostFiltersPixelTest, BackgroundFilterBlurOutsets) {
+TEST_F(LayerTreeHostFiltersPixelTest, DISABLED_BackgroundFilterBlurOutsets) {
   scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer(
       gfx::Rect(200, 200), SK_ColorWHITE);
 
diff --git a/cc/trees/layer_tree_host_pixeltest_readback.cc b/cc/trees/layer_tree_host_pixeltest_readback.cc
index bd6e217..9b5fadd 100644
--- a/cc/trees/layer_tree_host_pixeltest_readback.cc
+++ b/cc/trees/layer_tree_host_pixeltest_readback.cc
@@ -816,6 +816,28 @@
                                      "green_small_with_blue_corner.png")));
 }
 
+TEST_F(LayerTreeHostReadbackPixelTest, ReadbackNonRootLayerOutsideViewport) {
+  scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer(
+      gfx::Rect(200, 200), SK_ColorWHITE);
+
+  scoped_refptr<SolidColorLayer> green = CreateSolidColorLayer(
+      gfx::Rect(200, 200), SK_ColorGREEN);
+  // Only the top left quarter of the layer is inside the viewport, so the
+  // blue layer is entirely outside.
+  green->SetPosition(gfx::Point(100, 100));
+  background->AddChild(green);
+
+  scoped_refptr<SolidColorLayer> blue = CreateSolidColorLayer(
+      gfx::Rect(150, 150, 50, 50), SK_ColorBLUE);
+  green->AddChild(blue);
+
+  RunPixelTestWithReadbackTarget(GL_WITH_DEFAULT,
+                                 background,
+                                 green.get(),
+                                 base::FilePath(FILE_PATH_LITERAL(
+                                     "green_with_blue_corner.png")));
+}
+
 }  // namespace
 }  // namespace cc
 
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index 7c940bb..4d76820 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -350,7 +350,7 @@
   }
 
   virtual void DidCommit() OVERRIDE {
-    switch (layer_tree_host()->commit_number()) {
+    switch (layer_tree_host()->source_frame_number()) {
       case 1:
         // Changing the device scale factor causes a commit. It also changes
         // the content bounds of |scaled_layer_|, which should not generate
@@ -359,7 +359,7 @@
         break;
       default:
         // No extra commits.
-        EXPECT_EQ(2, layer_tree_host()->commit_number());
+        EXPECT_EQ(2, layer_tree_host()->source_frame_number());
     }
   }
 
@@ -411,7 +411,7 @@
   }
 
   virtual void DidCommit() OVERRIDE {
-    switch (layer_tree_host()->commit_number()) {
+    switch (layer_tree_host()->source_frame_number()) {
       case 1:
         // Changing the device scale factor causes a commit. It also changes
         // the content bounds of |scrollbar_|, which should not generate
@@ -420,7 +420,7 @@
         break;
       default:
         // No extra commits.
-        EXPECT_EQ(2, layer_tree_host()->commit_number());
+        EXPECT_EQ(2, layer_tree_host()->source_frame_number());
     }
   }
 
@@ -849,7 +849,7 @@
   }
 
   virtual void DidCommitAndDrawFrame() OVERRIDE {
-    switch (layer_tree_host()->commit_number()) {
+    switch (layer_tree_host()->source_frame_number()) {
       case 1:
         layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.5f, 2.f);
         layer_tree_host()->StartPageScaleAnimation(
@@ -1277,7 +1277,7 @@
   }
 
   virtual void DidCommitAndDrawFrame() OVERRIDE {
-    switch (layer_tree_host()->commit_number()) {
+    switch (layer_tree_host()->source_frame_number()) {
       case 1:
         parent_->SetNeedsDisplay();
         child_->SetNeedsDisplay();
@@ -1306,7 +1306,7 @@
         EndTest();
         break;
       default:
-        NOTREACHED() << layer_tree_host()->commit_number();
+        NOTREACHED() << layer_tree_host()->source_frame_number();
         break;
     }
   }
@@ -1552,7 +1552,7 @@
   }
 
   virtual void DidCommitAndDrawFrame() OVERRIDE {
-    if (layer_tree_host()->commit_number() < 2)
+    if (layer_tree_host()->source_frame_number() < 2)
       root_layer_->SetNeedsDisplay();
   }
 
@@ -2170,7 +2170,7 @@
   virtual void AfterTest() OVERRIDE {}
 
   virtual void DidCommit() OVERRIDE {
-    switch (layer_tree_host()->commit_number()) {
+    switch (layer_tree_host()->source_frame_number()) {
       case 1:
         // The first update consists one LCD notification and one paint.
         EXPECT_EQ(1, client_.lcd_notification_count());
@@ -2192,7 +2192,7 @@
         break;
       default:
         // Verify that there is not extra commit due to layer invalidation.
-        EXPECT_EQ(3, layer_tree_host()->commit_number());
+        EXPECT_EQ(3, layer_tree_host()->source_frame_number());
         // LCD notification count should have incremented due to
         // change in layer opacity.
         EXPECT_EQ(2, client_.lcd_notification_count());
@@ -2519,7 +2519,7 @@
   }
 
   void NextStep() {
-    int frame = layer_tree_host()->commit_number();
+    int frame = layer_tree_host()->source_frame_number();
     switch (frame) {
       case 1:
         child->RequestCopyOfOutput(CopyOutputRequest::CreateBitmapRequest(
@@ -2648,7 +2648,7 @@
   }
 
   virtual void DidCommit() OVERRIDE {
-    int frame = layer_tree_host()->commit_number();
+    int frame = layer_tree_host()->source_frame_number();
     switch (frame) {
       case 1:
         main_destroyed_->RequestCopyOfOutput(
@@ -2988,7 +2988,7 @@
   }
 
   virtual void DidCommit() OVERRIDE {
-    if (layer_tree_host()->commit_number() == 1) {
+    if (layer_tree_host()->source_frame_number() == 1) {
       // Allow drawing.
       layer_tree_host()->SetViewportSize(gfx::Size(root_->bounds()));
 
@@ -3032,7 +3032,7 @@
   // Round 5: commit + draw
 
   virtual void DidCommit() OVERRIDE {
-    int commit = layer_tree_host()->commit_number();
+    int commit = layer_tree_host()->source_frame_number();
     switch (commit) {
       case 2:
         // Round 2 done.
@@ -3053,7 +3053,7 @@
   }
 
   virtual void DidCompleteSwapBuffers() OVERRIDE {
-    int commit = layer_tree_host()->commit_number();
+    int commit = layer_tree_host()->source_frame_number();
     ++frame_;
     char pixels[4] = {0};
     switch (frame_) {
@@ -3455,7 +3455,7 @@
   }
 
   virtual void DidCommitAndDrawFrame() OVERRIDE {
-    switch (layer_tree_host()->commit_number()) {
+    switch (layer_tree_host()->source_frame_number()) {
       case 0:
         break;
       case 1: {
@@ -3538,7 +3538,7 @@
     : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren {
  protected:
   virtual void DidCommitAndDrawFrame() OVERRIDE {
-    int last_source_frame_number = layer_tree_host()->commit_number() - 1;
+    int last_source_frame_number = layer_tree_host()->source_frame_number() - 1;
     switch (last_source_frame_number) {
       case 0:
         EXPECT_FALSE(root_->needs_push_properties());
@@ -3578,7 +3578,7 @@
     : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren {
  protected:
   virtual void DidCommitAndDrawFrame() OVERRIDE {
-    int last_source_frame_number = layer_tree_host()->commit_number() - 1;
+    int last_source_frame_number = layer_tree_host()->source_frame_number() - 1;
     switch (last_source_frame_number) {
       case 0:
         layer_tree_host()->SetRootLayer(root_);
@@ -3661,7 +3661,7 @@
     : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren {
  protected:
   virtual void DidCommitAndDrawFrame() OVERRIDE {
-    int last_source_frame_number = layer_tree_host()->commit_number() - 1;
+    int last_source_frame_number = layer_tree_host()->source_frame_number() - 1;
     switch (last_source_frame_number) {
       case 0:
         layer_tree_host()->SetRootLayer(root_);
@@ -3709,7 +3709,7 @@
     : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren {
  protected:
   virtual void DidCommitAndDrawFrame() OVERRIDE {
-    int last_source_frame_number = layer_tree_host()->commit_number() - 1;
+    int last_source_frame_number = layer_tree_host()->source_frame_number() - 1;
     switch (last_source_frame_number) {
       case 0:
         layer_tree_host()->SetRootLayer(root_);
@@ -3777,7 +3777,7 @@
     : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren {
  protected:
   virtual void DidCommitAndDrawFrame() OVERRIDE {
-    int last_source_frame_number = layer_tree_host()->commit_number() - 1;
+    int last_source_frame_number = layer_tree_host()->source_frame_number() - 1;
     switch (last_source_frame_number) {
       case 0:
         layer_tree_host()->SetRootLayer(root_);
@@ -3841,7 +3841,7 @@
     : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren {
  protected:
   virtual void DidCommitAndDrawFrame() OVERRIDE {
-    int last_source_frame_number = layer_tree_host()->commit_number() - 1;
+    int last_source_frame_number = layer_tree_host()->source_frame_number() - 1;
     switch (last_source_frame_number) {
       case 0:
         layer_tree_host()->SetRootLayer(root_);
diff --git a/cc/trees/layer_tree_host_unittest_animation.cc b/cc/trees/layer_tree_host_unittest_animation.cc
index fa4b886..703ad75 100644
--- a/cc/trees/layer_tree_host_unittest_animation.cc
+++ b/cc/trees/layer_tree_host_unittest_animation.cc
@@ -492,7 +492,7 @@
   }
 
   virtual void DidCommit() OVERRIDE {
-    if (layer_tree_host()->commit_number() == 1) {
+    if (layer_tree_host()->source_frame_number() == 1) {
       scoped_refptr<Layer> layer = Layer::Create();
       layer->set_layer_animation_delegate(this);
 
@@ -530,7 +530,7 @@
   virtual void Animate(base::TimeTicks) OVERRIDE {
     // We shouldn't animate on the CompositeAndReadback-forced commit, but we
     // should for the SetNeedsCommit-triggered commit.
-    animated_commit_ = layer_tree_host()->commit_number();
+    animated_commit_ = layer_tree_host()->source_frame_number();
     EXPECT_NE(2, animated_commit_);
   }
 
@@ -539,7 +539,7 @@
   }
 
   virtual void DidCommit() OVERRIDE {
-    switch (layer_tree_host()->commit_number()) {
+    switch (layer_tree_host()->source_frame_number()) {
       case 1:
         layer_tree_host()->SetNeedsCommit();
         break;
@@ -751,7 +751,7 @@
   }
 
   virtual void DidCommitAndDrawFrame() OVERRIDE {
-    switch (layer_tree_host()->commit_number()) {
+    switch (layer_tree_host()->source_frame_number()) {
       case 1:
         // The animation is longer than 1 BeginFrame interval.
         AddOpacityTransitionToLayer(content_.get(), 0.1, 0.2f, 0.8f, false);
diff --git a/cc/trees/layer_tree_host_unittest_context.cc b/cc/trees/layer_tree_host_unittest_context.cc
index 94f15c2..ccb7afd 100644
--- a/cc/trees/layer_tree_host_unittest_context.cc
+++ b/cc/trees/layer_tree_host_unittest_context.cc
@@ -1294,7 +1294,7 @@
   virtual void DidCommitAndDrawFrame() OVERRIDE {
     ASSERT_TRUE(layer_tree_host()->hud_layer());
     // End the test once we know the 3nd frame drew.
-    if (layer_tree_host()->commit_number() == 4)
+    if (layer_tree_host()->source_frame_number() == 4)
       EndTest();
     else
       layer_tree_host()->SetNeedsCommit();
diff --git a/cc/trees/layer_tree_host_unittest_damage.cc b/cc/trees/layer_tree_host_unittest_damage.cc
index 0feabf7..523eecd 100644
--- a/cc/trees/layer_tree_host_unittest_damage.cc
+++ b/cc/trees/layer_tree_host_unittest_damage.cc
@@ -74,7 +74,7 @@
   }
 
   virtual void DidCommit() OVERRIDE {
-    int next_frame = layer_tree_host()->commit_number();
+    int next_frame = layer_tree_host()->source_frame_number();
     switch (next_frame) {
       case 1:
         layer_tree_host()->SetNeedsCommit();
@@ -157,7 +157,7 @@
   }
 
   virtual void DidCommitAndDrawFrame() OVERRIDE {
-    int next_frame = layer_tree_host()->commit_number();
+    int next_frame = layer_tree_host()->source_frame_number();
     switch (next_frame) {
       case 1: {
         char pixels[4];
diff --git a/cc/trees/layer_tree_host_unittest_delegated.cc b/cc/trees/layer_tree_host_unittest_delegated.cc
index 141f3af..08ba3e0 100644
--- a/cc/trees/layer_tree_host_unittest_delegated.cc
+++ b/cc/trees/layer_tree_host_unittest_delegated.cc
@@ -204,7 +204,7 @@
         first_draw_for_source_frame_(true) {}
 
   virtual void DidCommit() OVERRIDE {
-    int next_source_frame_number = layer_tree_host()->commit_number();
+    int next_source_frame_number = layer_tree_host()->source_frame_number();
     switch (next_source_frame_number) {
       case 1:
         // The first time the layer gets a frame the whole layer should be
@@ -483,7 +483,7 @@
     scoped_ptr<DelegatedFrameData> frame;
     TransferableResourceArray resources;
 
-    int next_source_frame_number = layer_tree_host()->commit_number();
+    int next_source_frame_number = layer_tree_host()->source_frame_number();
     switch (next_source_frame_number) {
       case 1:
         // Generate a frame with two resources in it.
@@ -555,7 +555,7 @@
     scoped_ptr<DelegatedFrameData> frame;
     TransferableResourceArray resources;
 
-    int next_source_frame_number = layer_tree_host()->commit_number();
+    int next_source_frame_number = layer_tree_host()->source_frame_number();
     switch (next_source_frame_number) {
       case 1:
         // Generate a frame with some resources in it.
@@ -616,7 +616,7 @@
     scoped_ptr<DelegatedFrameData> frame;
     TransferableResourceArray resources;
 
-    int next_source_frame_number = layer_tree_host()->commit_number();
+    int next_source_frame_number = layer_tree_host()->source_frame_number();
     switch (next_source_frame_number) {
       case 1:
         // Generate a frame with some resources in it.
@@ -715,7 +715,7 @@
     scoped_ptr<DelegatedFrameData> frame;
     TransferableResourceArray resources;
 
-    int next_source_frame_number = layer_tree_host()->commit_number();
+    int next_source_frame_number = layer_tree_host()->source_frame_number();
     switch (next_source_frame_number) {
       case 1:
         // Generate a frame with some resources in it.
@@ -821,7 +821,7 @@
     scoped_ptr<DelegatedFrameData> frame;
     TransferableResourceArray resources;
 
-    int next_source_frame_number = layer_tree_host()->commit_number();
+    int next_source_frame_number = layer_tree_host()->source_frame_number();
     switch (next_source_frame_number) {
       case 1:
         // Generate a frame with some resources in it.
@@ -965,7 +965,7 @@
     scoped_ptr<DelegatedFrameData> frame;
     TransferableResourceArray resources;
 
-    int next_source_frame_number = layer_tree_host()->commit_number();
+    int next_source_frame_number = layer_tree_host()->source_frame_number();
     switch (next_source_frame_number) {
       case 1:
         // This frame includes two resources in it, but only uses one.
@@ -1022,7 +1022,7 @@
     scoped_ptr<DelegatedFrameData> frame;
     TransferableResourceArray resources;
 
-    int next_source_frame_number = layer_tree_host()->commit_number();
+    int next_source_frame_number = layer_tree_host()->source_frame_number();
     switch (next_source_frame_number) {
       case 1:
         // This frame includes two resources in it.
@@ -1087,7 +1087,7 @@
     scoped_ptr<DelegatedFrameData> frame;
     TransferableResourceArray resources;
 
-    int next_source_frame_number = layer_tree_host()->commit_number();
+    int next_source_frame_number = layer_tree_host()->source_frame_number();
     switch (next_source_frame_number) {
       case 1:
         // This frame includes two resources in it.
@@ -1207,7 +1207,7 @@
     scoped_ptr<DelegatedFrameData> frame;
     TransferableResourceArray resources;
 
-    int next_source_frame_number = layer_tree_host()->commit_number();
+    int next_source_frame_number = layer_tree_host()->source_frame_number();
     switch (next_source_frame_number) {
       case 1:
         frame = CreateFrameData(gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0, 1, 1));
diff --git a/cc/trees/layer_tree_host_unittest_picture.cc b/cc/trees/layer_tree_host_unittest_picture.cc
index f9f302e..731f692 100644
--- a/cc/trees/layer_tree_host_unittest_picture.cc
+++ b/cc/trees/layer_tree_host_unittest_picture.cc
@@ -38,7 +38,7 @@
   }
 
   virtual void DidCommit() OVERRIDE {
-    switch (layer_tree_host()->commit_number()) {
+    switch (layer_tree_host()->source_frame_number()) {
       case 2:
         // Drop the picture layer from the tree.
         layer_tree_host()->root_layer()->children()[0]->RemoveFromParent();
diff --git a/cc/trees/layer_tree_host_unittest_scroll.cc b/cc/trees/layer_tree_host_unittest_scroll.cc
index e531194..b07b386 100644
--- a/cc/trees/layer_tree_host_unittest_scroll.cc
+++ b/cc/trees/layer_tree_host_unittest_scroll.cc
@@ -38,7 +38,7 @@
 
   virtual void Layout() OVERRIDE {
     Layer* root = layer_tree_host()->root_layer();
-    if (!layer_tree_host()->commit_number()) {
+    if (!layer_tree_host()->source_frame_number()) {
       EXPECT_VECTOR_EQ(initial_scroll_, root->scroll_offset());
     } else {
       EXPECT_VECTOR_EQ(initial_scroll_ + scroll_amount_, root->scroll_offset());
@@ -103,7 +103,7 @@
 
   virtual void BeginCommitOnThread(LayerTreeHostImpl* impl) OVERRIDE {
     Layer* root = layer_tree_host()->root_layer();
-    switch (layer_tree_host()->commit_number()) {
+    switch (layer_tree_host()->source_frame_number()) {
       case 0:
         EXPECT_VECTOR_EQ(root->scroll_offset(), initial_scroll_);
         break;
@@ -300,7 +300,7 @@
     EXPECT_VECTOR_EQ(gfx::Vector2d(),
                      expected_no_scroll_layer_->scroll_offset());
 
-    switch (layer_tree_host()->commit_number()) {
+    switch (layer_tree_host()->source_frame_number()) {
       case 0:
         EXPECT_VECTOR_EQ(initial_offset_,
                          expected_scroll_layer_->scroll_offset());
@@ -559,7 +559,7 @@
 
   virtual void Layout() OVERRIDE {
     Layer* root = layer_tree_host()->root_layer();
-    if (!layer_tree_host()->commit_number()) {
+    if (!layer_tree_host()->source_frame_number()) {
       EXPECT_VECTOR_EQ(root->scroll_offset(), initial_scroll_);
     } else {
       EXPECT_VECTOR_EQ(root->scroll_offset(),
diff --git a/chrome/VERSION b/chrome/VERSION
index 41983f5..e905f18 100644
--- a/chrome/VERSION
+++ b/chrome/VERSION
@@ -1,4 +1,4 @@
 MAJOR=30
 MINOR=0
-BUILD=1575
+BUILD=1576
 PATCH=0
diff --git a/chrome/app/cf_resources.rc b/chrome/app/cf_resources.rc
index a989d1a..af6bc7a 100644
--- a/chrome/app/cf_resources.rc
+++ b/chrome/app/cf_resources.rc
@@ -55,8 +55,8 @@
 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
 FONT 8, "MS Shell Dlg", 400, 0, 0x0
 BEGIN
-    LTEXT           "This site is using the Chrome Frame plug-in which will soon be unsupported. Please uninstall it and upgrade to a modern browser.",IDC_TD_PROMPT_MESSAGE,3,3,414,8
-    LTEXT           "Learn more.",IDC_TD_PROMPT_LINK,238,3,42,8
-    PUSHBUTTON      "Uninstall",IDUNINSTALL,285,2,50,12
-    DEFPUSHBUTTON   "Dismiss",IDDISMISS,340,2,50,12
+    LTEXT           "This site is using the Chrome Frame plug-in which will soon be unsupported. Please uninstall it and upgrade to a modern browser.",IDC_TD_PROMPT_MESSAGE,3,3,260,8
+    LTEXT           "Learn more.",IDC_TD_PROMPT_LINK,270,3,42,8
+    PUSHBUTTON      "Uninstall",IDUNINSTALL,319,2,50,12
+    DEFPUSHBUTTON   "Dismiss",IDDISMISS,377,2,18,18
 END
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index aadfb94..4d19df6 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -6681,6 +6681,12 @@
       <message name="IDS_FLAGS_OVERSCROLL_HISTORY_NAVIGATION_DESCRIPTION" desc="Description for the flag to disable history navigation from horizontal overscroll.">
         Experimental history navigation in response to horizontal overscroll.
       </message>
+      <message name="IDS_FLAGS_SCROLL_END_EFFECT_NAME" desc="Title for the flag for scroll end effect from vertical overscroll.">
+        Scroll end effect
+      </message>
+      <message name="IDS_FLAGS_SCROLL_END_EFFECT_DESCRIPTION" desc="Description for the flag that controls scroll end effect from vertical overscroll.">
+        Experimental scroll end effect in response to vertical overscroll.
+      </message>
       <message name="IDS_FLAGS_ENABLE_SYNC_FAVICONS_NAME" desc="Title for the flag to enable the favicon sync datatype">
         Enable favicon sync.
       </message>
@@ -12582,16 +12588,16 @@
       <message name="IDS_FILE_BROWSER_DRIVE_DIRECTORY_LABEL" desc="/drive directory label.">
         Google Drive
       </message>
-      <message name="IDS_FILE_BROWSER_DRIVE_MY_DRIVE_LABEL" desc="Label for the Google Drive 'My Drive' collection. This should match translation message 4067434660812487349 of Drive Web interface." meaning="Label for 'My Drive' collection in ChromeOS Files.app.">
+      <message name="IDS_FILE_BROWSER_DRIVE_MY_DRIVE_LABEL" desc="A label for the 'My Drive' collection of Google Drive.">
         My Drive
       </message>
-      <message name="IDS_FILE_BROWSER_DRIVE_SHARED_WITH_ME_COLLECTION_LABEL" desc="Label for the Google Drive 'Shared with me' collection. This should match translation message 8629632661309528847 of Drive Web interface." meaning="Label for files 'Shared with me' in ChromeOS Files.app.">
+      <message name="IDS_FILE_BROWSER_DRIVE_SHARED_WITH_ME_COLLECTION_LABEL" desc="A label for the 'shared with me' collection of Google Drive.">
         Shared with me
       </message>
-      <message name="IDS_FILE_BROWSER_DRIVE_RECENT_COLLECTION_LABEL" desc="Label for the Google Drive 'Recent' collection. This should match translation message 327779651963668892 of Drive Web interface." meaning="Label for 'Recent'ly used files in ChromeOS Files.app.">
+      <message name="IDS_FILE_BROWSER_DRIVE_RECENT_COLLECTION_LABEL" desc="A label for the 'Recent' collection of Google Drive.">
         Recent
       </message>
-      <message name="IDS_FILE_BROWSER_DRIVE_OFFLINE_COLLECTION_LABEL" desc="Label for the Google Drive 'Offline' collection. This should match translation message 7092967268927957493 of Drive Web interface." meaning="Label for 'Offline' available files in ChromeOS Files.app.">
+      <message name="IDS_FILE_BROWSER_DRIVE_OFFLINE_COLLECTION_LABEL" desc="A label for the 'Offline' collection of Google Drive.">
         Offline
       </message>
       <message name="IDS_FILE_BROWSER_DOWNLOADS_DIRECTORY_LABEL" desc="Downloads local directory label.">
@@ -13006,11 +13012,11 @@
       <message name="IDS_FILE_BROWSER_ZIP_SELECTION_BUTTON_LABEL" desc="Menu item label, showing dialog to create zip file for selected files.">
         Zip selection
       </message>
-      <message name="IDS_FILE_BROWSER_PIN_FOLDER_BUTTON_LABEL" desc="Menu item label, pinning the selected folder to the left nav.">
-        Pin folder
+      <message name="IDS_FILE_BROWSER_CREATE_FOLDER_SHORTCUT_BUTTON_LABEL" desc="Menu item label, creating a shortcut of the selected folder to the left nav.">
+        Create shortcut
       </message>
-      <message name="IDS_FILE_BROWSER_UNPIN_FOLDER_BUTTON_LABEL" desc="Menu item label, unpinning the selected folder from the left nav.">
-        Unpin
+      <message name="IDS_FILE_BROWSER_REMOVE_FOLDER_SHORTCUT_BUTTON_LABEL" desc="Menu item label, unpinning the selected folder from the left nav.">
+        Remove shortcut
       </message>
       <message name="IDS_FILE_BROWSER_SHARE_BUTTON_LABEL" desc="Menu item label, showing dialog to share the selected file.">
         Share
@@ -15682,7 +15688,7 @@
     </message>
     <message name="IDS_RESET_PROFILE_SETTINGS_EXPLANATION" desc="A label describing the consequences of the 'reset profile settings' feature">
       Your browser settings will be restored to their original defaults. This will reset your homepage, new tab page, and search engine, disable your extensions and clear your cookies, content settings and site data.
-    </message>    
+    </message>
     <message name="IDS_RESET_PROFILE_SETTINGS_BUTTON" desc="The text on the button in chrome://settings that allows resetting some settings in a profile">
       Reset profile settings...
     </message>
diff --git a/chrome/app/nacl_fork_delegate_linux.cc b/chrome/app/nacl_fork_delegate_linux.cc
index 857c7a3..f152498 100644
--- a/chrome/app/nacl_fork_delegate_linux.cc
+++ b/chrome/app/nacl_fork_delegate_linux.cc
@@ -13,6 +13,7 @@
 
 #include "base/basictypes.h"
 #include "base/command_line.h"
+#include "base/cpu.h"
 #include "base/files/file_path.h"
 #include "base/logging.h"
 #include "base/path_service.h"
@@ -27,24 +28,41 @@
 
 namespace {
 
-// Using nacl_helper_bootstrap is not necessary on x86-64 because
-// NaCl's x86-64 sandbox is not zero-address-based.  Starting
-// nacl_helper through nacl_helper_bootstrap works on x86-64, but it
-// leaves nacl_helper_bootstrap mapped at a fixed address at the
-// bottom of the address space, which is undesirable because it
-// effectively defeats ASLR.
-#if defined(ARCH_CPU_X86_64)
-const bool kUseNaClBootstrap = false;
-#else
-const bool kUseNaClBootstrap = true;
-#endif
-
 // Note these need to match up with their counterparts in nacl_helper_linux.c
 // and nacl_helper_bootstrap_linux.c.
 const char kNaClHelperReservedAtZero[] =
     "--reserved_at_zero=0xXXXXXXXXXXXXXXXX";
 const char kNaClHelperRDebug[] = "--r_debug=0xXXXXXXXXXXXXXXXX";
 
+#if defined(ARCH_CPU_X86)
+bool NonZeroSegmentBaseIsSlow() {
+  base::CPU cpuid;
+  // Using a non-zero segment base is known to be very slow on Intel
+  // Atom CPUs.  See "Segmentation-based Memory Protection Mechanism
+  // on Intel Atom Microarchitecture: Coding Optimizations" (Leonardo
+  // Potenza, Intel).
+  //
+  // The following list of CPU model numbers is taken from:
+  // "Intel 64 and IA-32 Architectures Software Developer's Manual"
+  // (http://download.intel.com/products/processor/manual/325462.pdf),
+  // "Table 35-1. CPUID Signature Values of DisplayFamily_DisplayModel"
+  // (Volume 3C, 35-1), which contains:
+  //   "06_36H - Intel Atom S Processor Family
+  //    06_1CH, 06_26H, 06_27H, 06_35, 06_36 - Intel Atom Processor Family"
+  if (cpuid.family() == 6) {
+    switch (cpuid.model()) {
+      case 0x1c:
+      case 0x26:
+      case 0x27:
+      case 0x35:
+      case 0x36:
+        return true;
+    }
+  }
+  return false;
+}
+#endif
+
 }
 
 NaClForkDelegate::NaClForkDelegate()
@@ -64,6 +82,25 @@
   fds_to_map.push_back(std::make_pair(fds[1], kNaClZygoteDescriptor));
   fds_to_map.push_back(std::make_pair(sandboxdesc, kNaClSandboxDescriptor));
 
+  // Using nacl_helper_bootstrap is not necessary on x86-64 because
+  // NaCl's x86-64 sandbox is not zero-address-based.  Starting
+  // nacl_helper through nacl_helper_bootstrap works on x86-64, but it
+  // leaves nacl_helper_bootstrap mapped at a fixed address at the
+  // bottom of the address space, which is undesirable because it
+  // effectively defeats ASLR.
+#if defined(ARCH_CPU_X86_64)
+  bool kUseNaClBootstrap = false;
+#elif defined(ARCH_CPU_X86)
+  // Performance vs. security trade-off: We prefer using a
+  // non-zero-address-based sandbox on x86-32 because it provides some
+  // ASLR and so is more secure.  However, on Atom CPUs, using a
+  // non-zero segment base is very slow, so we use a zero-based
+  // sandbox on those.
+  bool kUseNaClBootstrap = NonZeroSegmentBaseIsSlow();
+#else
+  bool kUseNaClBootstrap = true;
+#endif
+
   status_ = kNaClHelperUnused;
   base::FilePath helper_exe;
   base::FilePath helper_bootstrap_exe;
diff --git a/chrome/app/theme/default_100_percent/common/cf_close_strip.bmp b/chrome/app/theme/default_100_percent/common/cf_close_strip.bmp
new file mode 100644
index 0000000..056d550
--- /dev/null
+++ b/chrome/app/theme/default_100_percent/common/cf_close_strip.bmp
Binary files differ
diff --git a/chrome/app/theme/default_100_percent/common/error_network_offline.png b/chrome/app/theme/default_100_percent/common/error_network_offline.png
new file mode 100644
index 0000000..3eb1178
--- /dev/null
+++ b/chrome/app/theme/default_100_percent/common/error_network_offline.png
Binary files differ
diff --git a/chrome/app/theme/default_200_percent/common/error_network_offline.png b/chrome/app/theme/default_200_percent/common/error_network_offline.png
new file mode 100644
index 0000000..5ae5738
--- /dev/null
+++ b/chrome/app/theme/default_200_percent/common/error_network_offline.png
Binary files differ
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index ca66678..9879d13 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -715,7 +715,8 @@
     IDS_FLAGS_ENABLE_QUIC_HTTPS_NAME,
     IDS_FLAGS_ENABLE_QUIC_HTTPS_DESCRIPTION,
     kOsAll,
-    SINGLE_VALUE_TYPE(switches::kEnableQuicHttps)
+    ENABLE_DISABLE_VALUE_TYPE(switches::kEnableQuicHttps,
+                              switches::kDisableQuicHttps)
   },
   {
     "enable-spdy4a2",
@@ -1323,6 +1324,15 @@
   },
 #endif
   {
+    "scroll-end-effect",
+    IDS_FLAGS_SCROLL_END_EFFECT_NAME,
+    IDS_FLAGS_SCROLL_END_EFFECT_DESCRIPTION,
+    kOsCrOS,
+    ENABLE_DISABLE_VALUE_TYPE_AND_VALUE(
+        switches::kScrollEndEffect, "1",
+        switches::kScrollEndEffect, "0")
+  },
+  {
     "enable-touch-drag-drop",
     IDS_FLAGS_ENABLE_TOUCH_DRAG_DROP_NAME,
     IDS_FLAGS_ENABLE_TOUCH_DRAG_DROP_DESCRIPTION,
diff --git a/chrome/browser/android/crash_dump_manager.cc b/chrome/browser/android/crash_dump_manager.cc
index de2923e..5604f68 100644
--- a/chrome/browser/android/crash_dump_manager.cc
+++ b/chrome/browser/android/crash_dump_manager.cc
@@ -10,7 +10,7 @@
 #include "base/logging.h"
 #include "base/path_service.h"
 #include "base/posix/global_descriptors.h"
-#include "base/process.h"
+#include "base/process/process.h"
 #include "base/rand_util.h"
 #include "base/stl_util.h"
 #include "base/strings/stringprintf.h"
diff --git a/chrome/browser/android/crash_dump_manager.h b/chrome/browser/android/crash_dump_manager.h
index 0c25a89..16c24a0 100644
--- a/chrome/browser/android/crash_dump_manager.h
+++ b/chrome/browser/android/crash_dump_manager.h
@@ -9,7 +9,7 @@
 
 #include "base/files/file_path.h"
 #include "base/platform_file.h"
-#include "base/process.h"
+#include "base/process/process.h"
 #include "base/synchronization/lock.h"
 #include "content/public/browser/browser_child_process_observer.h"
 #include "content/public/browser/notification_observer.h"
diff --git a/chrome/browser/autocomplete/extension_app_provider_unittest.cc b/chrome/browser/autocomplete/extension_app_provider_unittest.cc
index f9eec44..7ccafc2 100644
--- a/chrome/browser/autocomplete/extension_app_provider_unittest.cc
+++ b/chrome/browser/autocomplete/extension_app_provider_unittest.cc
@@ -42,7 +42,7 @@
 
 void ExtensionAppProviderTest::SetUp() {
   profile_.reset(new TestingProfile());
-  profile_->CreateHistoryService(true, false);
+  ASSERT_TRUE(profile_->CreateHistoryService(true, false));
   profile_->BlockUntilHistoryProcessesPendingRequests();
   history_service_ =
       HistoryServiceFactory::GetForProfile(profile_.get(),
diff --git a/chrome/browser/autocomplete/history_quick_provider_unittest.cc b/chrome/browser/autocomplete/history_quick_provider_unittest.cc
index fe50366..3b203cc 100644
--- a/chrome/browser/autocomplete/history_quick_provider_unittest.cc
+++ b/chrome/browser/autocomplete/history_quick_provider_unittest.cc
@@ -151,7 +151,7 @@
 
 void HistoryQuickProviderTest::SetUp() {
   profile_.reset(new TestingProfile());
-  profile_->CreateHistoryService(true, false);
+  ASSERT_TRUE(profile_->CreateHistoryService(true, false));
   profile_->CreateBookmarkModel(true);
   ui_test_utils::WaitForBookmarkModelToLoad(profile_.get());
   profile_->BlockUntilHistoryIndexIsRefreshed();
@@ -212,7 +212,7 @@
       // Mark the most recent |cur.typed_count| visits as typed.
       std::string sql_cmd_line = base::StringPrintf(
           "INSERT INTO \"visits\" VALUES(%" PRIuS ", %" PRIuS ", %" PRId64
-          ", 0, %d, 0, 0, 1)",
+          ", 0, %d, 0, 1)",
           visit_id++, i + 1, visit_time.ToInternalValue(),
           (j < cur.typed_count) ? content::PAGE_TRANSITION_TYPED :
                                   content::PAGE_TRANSITION_LINK);
diff --git a/chrome/browser/autocomplete/history_url_provider_unittest.cc b/chrome/browser/autocomplete/history_url_provider_unittest.cc
index b26c9a0..0138751 100644
--- a/chrome/browser/autocomplete/history_url_provider_unittest.cc
+++ b/chrome/browser/autocomplete/history_url_provider_unittest.cc
@@ -152,12 +152,12 @@
 
   // testing::Test
   virtual void SetUp() {
-    SetUpImpl(false);
+    ASSERT_TRUE(SetUpImpl(false));
   }
   virtual void TearDown();
 
   // Does the real setup.
-  void SetUpImpl(bool no_db);
+  bool SetUpImpl(bool no_db) WARN_UNUSED_RESULT;
 
   // Fills test data into the history system.
   void FillData();
@@ -195,7 +195,7 @@
 class HistoryURLProviderTestNoDB : public HistoryURLProviderTest {
  protected:
   virtual void SetUp() {
-    SetUpImpl(true);
+    ASSERT_TRUE(SetUpImpl(true));
   }
 };
 
@@ -204,9 +204,10 @@
     base::MessageLoop::current()->Quit();
 }
 
-void HistoryURLProviderTest::SetUpImpl(bool no_db) {
+bool HistoryURLProviderTest::SetUpImpl(bool no_db) {
   profile_.reset(new TestingProfile());
-  profile_->CreateHistoryService(true, no_db);
+  if (!(profile_->CreateHistoryService(true, no_db)))
+    return false;
   if (!no_db) {
     profile_->BlockUntilHistoryProcessesPendingRequests();
     profile_->BlockUntilHistoryIndexIsRefreshed();
@@ -219,6 +220,7 @@
   TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse(
       profile_.get(), &HistoryURLProviderTest::CreateTemplateURLService);
   FillData();
+  return true;
 }
 
 void HistoryURLProviderTest::TearDown() {
diff --git a/chrome/browser/autocomplete/search_provider_unittest.cc b/chrome/browser/autocomplete/search_provider_unittest.cc
index 4aeb1c1..ef4bfa4 100644
--- a/chrome/browser/autocomplete/search_provider_unittest.cc
+++ b/chrome/browser/autocomplete/search_provider_unittest.cc
@@ -183,7 +183,7 @@
   test_factory_.set_remove_fetcher_on_delete(true);
 
   // We need both the history service and template url model loaded.
-  profile_.CreateHistoryService(true, false);
+  ASSERT_TRUE(profile_.CreateHistoryService(true, false));
   TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse(
       &profile_, &TemplateURLServiceFactory::BuildInstanceFor);
 
diff --git a/chrome/browser/autocomplete/shortcuts_provider_unittest.cc b/chrome/browser/autocomplete/shortcuts_provider_unittest.cc
index 735313b..bd700aa 100644
--- a/chrome/browser/autocomplete/shortcuts_provider_unittest.cc
+++ b/chrome/browser/autocomplete/shortcuts_provider_unittest.cc
@@ -179,7 +179,7 @@
       &profile_, &ShortcutsBackendFactory::BuildProfileNoDatabaseForTesting);
   backend_ = ShortcutsBackendFactory::GetForProfile(&profile_);
   ASSERT_TRUE(backend_.get());
-  profile_.CreateHistoryService(true, false);
+  ASSERT_TRUE(profile_.CreateHistoryService(true, false));
   provider_ = new ShortcutsProvider(this, &profile_);
   FillData(shortcut_test_db, arraysize(shortcut_test_db));
 }
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index 316ccc0..0793da1 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -18,7 +18,6 @@
 #include "base/message_loop/message_loop.h"
 #include "base/path_service.h"
 #include "base/prefs/pref_service.h"
-#include "base/process_util.h"
 #include "base/stl_util.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_util.h"
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
index ea10c51..55b25f9 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -18,8 +18,8 @@
 #include "base/json/string_escape.h"
 #include "base/path_service.h"
 #include "base/prefs/pref_service.h"
-#include "base/process.h"
-#include "base/process_util.h"
+#include "base/process/process.h"
+#include "base/process/process_iterator.h"
 #include "base/sequenced_task_runner.h"
 #include "base/strings/stringprintf.h"
 #include "base/strings/utf_string_conversions.h"
diff --git a/chrome/browser/bookmarks/bookmark_html_writer_unittest.cc b/chrome/browser/bookmarks/bookmark_html_writer_unittest.cc
index b9c7bed..8f532bc 100644
--- a/chrome/browser/bookmarks/bookmark_html_writer_unittest.cc
+++ b/chrome/browser/bookmarks/bookmark_html_writer_unittest.cc
@@ -148,7 +148,7 @@
   content::TestBrowserThreadBundle thread_bundle;
 
   TestingProfile profile;
-  profile.CreateHistoryService(true, false);
+  ASSERT_TRUE(profile.CreateHistoryService(true, false));
   profile.BlockUntilHistoryProcessesPendingRequests();
   profile.CreateFaviconService();
   profile.CreateBookmarkModel(true);
diff --git a/chrome/browser/bookmarks/bookmark_index_unittest.cc b/chrome/browser/bookmarks/bookmark_index_unittest.cc
index 724b6c8..caef831 100644
--- a/chrome/browser/bookmarks/bookmark_index_unittest.cc
+++ b/chrome/browser/bookmarks/bookmark_index_unittest.cc
@@ -236,7 +236,7 @@
   content::TestBrowserThreadBundle thread_bundle;
 
   TestingProfile profile;
-  profile.CreateHistoryService(true, false);
+  ASSERT_TRUE(profile.CreateHistoryService(true, false));
   profile.BlockUntilHistoryProcessesPendingRequests();
   profile.CreateBookmarkModel(true);
 
diff --git a/chrome/browser/bookmarks/bookmark_model_unittest.cc b/chrome/browser/bookmarks/bookmark_model_unittest.cc
index 06610d7..65f5c65 100644
--- a/chrome/browser/bookmarks/bookmark_model_unittest.cc
+++ b/chrome/browser/bookmarks/bookmark_model_unittest.cc
@@ -910,15 +910,6 @@
     ui_test_utils::WaitForBookmarkModelToLoad(bb_model_);
   }
 
-  // Destroys the current profile, creates a new one and creates the history
-  // service.
-  void RecreateProfile() {
-    // Need to shutdown the old one before creating a new one.
-    profile_.reset(NULL);
-    profile_.reset(new TestingProfile());
-    profile_->CreateHistoryService(true, false);
-  }
-
   // The profile.
   scoped_ptr<TestingProfile> profile_;
   BookmarkModel* bb_model_;
@@ -954,7 +945,7 @@
     profile_.reset(NULL);
     profile_.reset(new TestingProfile());
     profile_->CreateBookmarkModel(true);
-    profile_->CreateHistoryService(true, false);
+    ASSERT_TRUE(profile_->CreateHistoryService(true, false));
     BlockTillBookmarkModelLoaded();
 
     TestNode bbn;
diff --git a/chrome/browser/browser_about_handler.h b/chrome/browser/browser_about_handler.h
index efc2c70..640101d 100644
--- a/chrome/browser/browser_about_handler.h
+++ b/chrome/browser/browser_about_handler.h
@@ -9,7 +9,7 @@
 #include <string>
 #include <vector>
 
-#include "base/process.h"
+#include "base/process/process.h"
 #include "base/strings/stringprintf.h"
 #include "build/build_config.h"  // USE_TCMALLOC
 
diff --git a/chrome/browser/browser_process_platform_part_aurawin.cc b/chrome/browser/browser_process_platform_part_aurawin.cc
index 34813a6..068a3ee 100644
--- a/chrome/browser/browser_process_platform_part_aurawin.cc
+++ b/chrome/browser/browser_process_platform_part_aurawin.cc
@@ -6,7 +6,7 @@
 
 #include "base/command_line.h"
 #include "base/logging.h"
-#include "base/process_util.h"
+#include "base/process/kill.h"
 #include "base/win/windows_version.h"
 #include "chrome/browser/browser_process.h"
 #include "chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.h"
diff --git a/chrome/browser/browser_shutdown.cc b/chrome/browser/browser_shutdown.cc
index 5dc8651..bfbe171 100644
--- a/chrome/browser/browser_shutdown.cc
+++ b/chrome/browser/browser_shutdown.cc
@@ -15,7 +15,6 @@
 #include "base/path_service.h"
 #include "base/prefs/pref_registry_simple.h"
 #include "base/prefs/pref_service.h"
-#include "base/process_util.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/stringprintf.h"
 #include "base/threading/thread.h"
diff --git a/chrome/browser/browsing_data/browsing_data_remover.cc b/chrome/browser/browsing_data/browsing_data_remover.cc
index 15b8959..1eb406a 100644
--- a/chrome/browser/browsing_data/browsing_data_remover.cc
+++ b/chrome/browser/browsing_data/browsing_data_remover.cc
@@ -849,8 +849,10 @@
 void BrowsingDataRemover::ClearShaderCacheOnUIThread() {
   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
 
-  BrowserContext::GetDefaultStoragePartition(profile_)->AsyncClearDataBetween(
-      content::StoragePartition::kShaderStorage, delete_begin_, delete_end_,
+  BrowserContext::GetDefaultStoragePartition(profile_)->ClearDataForRange(
+      content::StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE,
+      content::StoragePartition::kAllStorage,
+      delete_begin_, delete_end_,
       base::Bind(&BrowsingDataRemover::ClearedShaderCache,
                  base::Unretained(this)));
 }
diff --git a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
index fc758e4..b0746c2 100644
--- a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
+++ b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
@@ -331,11 +331,14 @@
 
 class RemoveHistoryTester {
  public:
-  explicit RemoveHistoryTester(TestingProfile* profile)
-      : query_url_success_(false) {
-    profile->CreateHistoryService(true, false);
+  RemoveHistoryTester() : query_url_success_(false), history_service_(NULL) {}
+
+  bool Init(TestingProfile* profile) WARN_UNUSED_RESULT {
+    if (!profile->CreateHistoryService(true, false))
+      return false;
     history_service_ = HistoryServiceFactory::GetForProfile(
         profile, Profile::EXPLICIT_ACCESS);
+    return true;
   }
 
   // Returns true, if the given URL exists in the history service.
@@ -824,7 +827,8 @@
 }
 
 TEST_F(BrowsingDataRemoverTest, RemoveHistoryForever) {
-  RemoveHistoryTester tester(GetProfile());
+  RemoveHistoryTester tester;
+  ASSERT_TRUE(tester.Init(GetProfile()));
 
   tester.AddHistory(kOrigin1, base::Time::Now());
   ASSERT_TRUE(tester.HistoryContainsURL(kOrigin1));
@@ -838,7 +842,8 @@
 }
 
 TEST_F(BrowsingDataRemoverTest, RemoveHistoryForLastHour) {
-  RemoveHistoryTester tester(GetProfile());
+  RemoveHistoryTester tester;
+  ASSERT_TRUE(tester.Init(GetProfile()));
 
   base::Time two_hours_ago = base::Time::Now() - base::TimeDelta::FromHours(2);
 
@@ -860,7 +865,8 @@
 // here.
 #if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON)
 TEST_F(BrowsingDataRemoverTest, RemoveHistoryProhibited) {
-  RemoveHistoryTester tester(GetProfile());
+  RemoveHistoryTester tester;
+  ASSERT_TRUE(tester.Init(GetProfile()));
   PrefService* prefs = GetProfile()->GetPrefs();
   prefs->SetBoolean(prefs::kAllowDeletingBrowserHistory, false);
 
@@ -884,7 +890,8 @@
 
 TEST_F(BrowsingDataRemoverTest, RemoveMultipleTypes) {
   // Add some history.
-  RemoveHistoryTester history_tester(GetProfile());
+  RemoveHistoryTester history_tester;
+  ASSERT_TRUE(history_tester.Init(GetProfile()));
   history_tester.AddHistory(kOrigin1, base::Time::Now());
   ASSERT_TRUE(history_tester.HistoryContainsURL(kOrigin1));
 
@@ -913,7 +920,8 @@
   prefs->SetBoolean(prefs::kAllowDeletingBrowserHistory, false);
 
   // Add some history.
-  RemoveHistoryTester history_tester(GetProfile());
+  RemoveHistoryTester history_tester;
+  ASSERT_TRUE(history_tester.Init(GetProfile()));
   history_tester.AddHistory(kOrigin1, base::Time::Now());
   ASSERT_TRUE(history_tester.HistoryContainsURL(kOrigin1));
 
@@ -1286,7 +1294,8 @@
 }
 
 TEST_F(BrowsingDataRemoverTest, OriginBasedHistoryRemoval) {
-  RemoveHistoryTester tester(GetProfile());
+  RemoveHistoryTester tester;
+  ASSERT_TRUE(tester.Init(GetProfile()));
 
   base::Time two_hours_ago = base::Time::Now() - base::TimeDelta::FromHours(2);
 
@@ -1307,7 +1316,8 @@
 }
 
 TEST_F(BrowsingDataRemoverTest, OriginAndTimeBasedHistoryRemoval) {
-  RemoveHistoryTester tester(GetProfile());
+  RemoveHistoryTester tester;
+  ASSERT_TRUE(tester.Init(GetProfile()));
 
   base::Time two_hours_ago = base::Time::Now() - base::TimeDelta::FromHours(2);
 
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
index 5d316ee..19c1690 100644
--- a/chrome/browser/chrome_browser_main.cc
+++ b/chrome/browser/chrome_browser_main.cc
@@ -25,8 +25,7 @@
 #include "base/prefs/pref_registry_simple.h"
 #include "base/prefs/pref_service.h"
 #include "base/prefs/pref_value_store.h"
-#include "base/process_info.h"
-#include "base/process_util.h"
+#include "base/process/process_info.h"
 #include "base/run_loop.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_piece.h"
@@ -82,6 +81,7 @@
 #include "chrome/browser/pref_service_flags_storage.h"
 #include "chrome/browser/prefs/chrome_pref_service_factory.h"
 #include "chrome/browser/prefs/command_line_pref_store.h"
+#include "chrome/browser/prefs/pref_metrics_service.h"
 #include "chrome/browser/prefs/scoped_user_pref_update.h"
 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h"
 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.h"
@@ -1522,6 +1522,9 @@
   NaClProcessHost::EarlyStartup(new NaClBrowserDelegateImpl);
 #endif
 
+  // Make sure initial prefs are recorded
+  PrefMetricsService::Factory::GetForProfile(profile_);
+
   PreBrowserStart();
 
   // Instantiate the notification UI manager, as this triggers a perf timer
@@ -1687,10 +1690,11 @@
   for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
     chrome_extra_parts_[i]->PostMainMessageLoopRun();
 
-  // TranslateManager's URL fetchers should be destructed in the main thread
+  // Some tests don't set parameters.ui_task, so they started translate
+  // language fetch that was never completed so we need to cleanup here
   // otherwise it will be done by the destructor in a wrong thread.
-  if (translate_manager_ != NULL)
-    translate_manager_->CleanupPendingUrlFetcher();
+  if (parameters().ui_task == NULL && translate_manager_ != NULL)
+    translate_manager_->CleanupPendingUlrFetcher();
 
   if (notify_result_ == ProcessSingleton::PROCESS_NONE)
     process_singleton_->Cleanup();
diff --git a/chrome/browser/chrome_main_browsertest.cc b/chrome/browser/chrome_main_browsertest.cc
index d1fc436..d8cbfd6 100644
--- a/chrome/browser/chrome_main_browsertest.cc
+++ b/chrome/browser/chrome_main_browsertest.cc
@@ -6,7 +6,7 @@
 
 #include "base/command_line.h"
 #include "base/path_service.h"
-#include "base/process_util.h"
+#include "base/process/launch.h"
 #include "chrome/browser/chrome_notification_types.h"
 #include "chrome/browser/ui/browser.h"
 #include "chrome/browser/ui/browser_commands.h"
diff --git a/chrome/browser/chrome_plugin_browsertest.cc b/chrome/browser/chrome_plugin_browsertest.cc
index 6b2bcba..5386e42 100644
--- a/chrome/browser/chrome_plugin_browsertest.cc
+++ b/chrome/browser/chrome_plugin_browsertest.cc
@@ -10,7 +10,7 @@
 #include "base/file_util.h"
 #include "base/memory/ref_counted.h"
 #include "base/path_service.h"
-#include "base/process_util.h"
+#include "base/process/kill.h"
 #include "base/strings/utf_string_conversions.h"
 #include "chrome/browser/plugins/plugin_prefs.h"
 #include "chrome/browser/ui/browser.h"
diff --git a/chrome/browser/chrome_process_finder_win.cc b/chrome/browser/chrome_process_finder_win.cc
index abd6c2b..e1d66ee 100644
--- a/chrome/browser/chrome_process_finder_win.cc
+++ b/chrome/browser/chrome_process_finder_win.cc
@@ -11,8 +11,8 @@
 #include "base/file_util.h"
 #include "base/files/file_path.h"
 #include "base/logging.h"
-#include "base/process_info.h"
-#include "base/process_util.h"
+#include "base/process/process_handle.h"
+#include "base/process/process_info.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/stringprintf.h"
 #include "base/strings/utf_string_conversions.h"
diff --git a/chrome/browser/chromeos/boot_times_loader.cc b/chrome/browser/chromeos/boot_times_loader.cc
index bd94c2d..2fd1b0a 100644
--- a/chrome/browser/chromeos/boot_times_loader.cc
+++ b/chrome/browser/chromeos/boot_times_loader.cc
@@ -15,7 +15,6 @@
 #include "base/message_loop/message_loop.h"
 #include "base/message_loop/message_loop_proxy.h"
 #include "base/metrics/histogram.h"
-#include "base/process_util.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_util.h"
 #include "base/strings/stringprintf.h"
diff --git a/chrome/browser/chromeos/drive/dummy_file_system.h b/chrome/browser/chromeos/drive/dummy_file_system.h
index 92e546f..f614ce0 100644
--- a/chrome/browser/chromeos/drive/dummy_file_system.h
+++ b/chrome/browser/chromeos/drive/dummy_file_system.h
@@ -79,6 +79,10 @@
       const SearchMetadataCallback& callback) OVERRIDE {}
   virtual void GetAvailableSpace(
       const GetAvailableSpaceCallback& callback) OVERRIDE {}
+  virtual void GetShareUrl(
+      const base::FilePath& file_path,
+      const GURL& embed_origin,
+      const GetShareUrlCallback& callback) OVERRIDE {}
   virtual void GetMetadata(
       const GetFilesystemMetadataCallback& callback) OVERRIDE {}
   virtual void MarkCacheFileAsMounted(
diff --git a/chrome/browser/chromeos/drive/fake_file_system.cc b/chrome/browser/chromeos/drive/fake_file_system.cc
index 234aadb..1bb1ca3 100644
--- a/chrome/browser/chromeos/drive/fake_file_system.cc
+++ b/chrome/browser/chromeos/drive/fake_file_system.cc
@@ -198,6 +198,13 @@
   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
 }
 
+void FakeFileSystem::GetShareUrl(
+    const base::FilePath& file_path,
+    const GURL& embed_origin,
+    const GetShareUrlCallback& callback) {
+  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+}
+
 void FakeFileSystem::GetMetadata(
     const GetFilesystemMetadataCallback& callback) {
   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
diff --git a/chrome/browser/chromeos/drive/fake_file_system.h b/chrome/browser/chromeos/drive/fake_file_system.h
index c1320ad..c59975a 100644
--- a/chrome/browser/chromeos/drive/fake_file_system.h
+++ b/chrome/browser/chromeos/drive/fake_file_system.h
@@ -111,6 +111,10 @@
                               const SearchMetadataCallback& callback) OVERRIDE;
   virtual void GetAvailableSpace(
       const GetAvailableSpaceCallback& callback) OVERRIDE;
+  virtual void GetShareUrl(
+      const base::FilePath& file_path,
+      const GURL& embed_origin,
+      const GetShareUrlCallback& callback) OVERRIDE;
   virtual void GetMetadata(
       const GetFilesystemMetadataCallback& callback) OVERRIDE;
   virtual void MarkCacheFileAsMounted(
diff --git a/chrome/browser/chromeos/drive/file_cache.cc b/chrome/browser/chromeos/drive/file_cache.cc
index 32455e9..1b1ef5e 100644
--- a/chrome/browser/chromeos/drive/file_cache.cc
+++ b/chrome/browser/chromeos/drive/file_cache.cc
@@ -390,7 +390,6 @@
 }
 
 void FileCache::MarkDirtyOnUIThread(const std::string& resource_id,
-                                    const std::string& md5,
                                     const FileOperationCallback& callback) {
   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
   DCHECK(!callback.is_null());
@@ -398,28 +397,20 @@
   base::PostTaskAndReplyWithResult(
       blocking_task_runner_.get(),
       FROM_HERE,
-      base::Bind(
-          &FileCache::MarkDirty, base::Unretained(this), resource_id, md5),
+      base::Bind(&FileCache::MarkDirty, base::Unretained(this), resource_id),
       callback);
 }
 
-FileError FileCache::MarkDirty(const std::string& resource_id,
-                               const std::string& md5) {
+FileError FileCache::MarkDirty(const std::string& resource_id) {
   AssertOnSequencedWorkerPool();
 
-  // If file has already been marked dirty in previous instance of chrome, we
-  // would have lost the md5 info during cache initialization, because the file
-  // would have been renamed to .local extension.
-  // So, search for entry in cache without comparing md5.
-
   // Marking a file dirty means its entry and actual file blob must exist in
   // cache.
   FileCacheEntry cache_entry;
-  if (!GetCacheEntry(resource_id, md5, &cache_entry) ||
+  if (!storage_->GetCacheEntry(resource_id, &cache_entry) ||
       !cache_entry.is_present()) {
-    LOG(WARNING) << "Can't mark dirty a file that wasn't cached: res_id="
-                 << resource_id
-                 << ", md5=" << md5;
+    LOG(WARNING) << "Can't mark dirty a file that wasn't cached: "
+                 << resource_id;
     return FILE_ERROR_NOT_FOUND;
   }
 
diff --git a/chrome/browser/chromeos/drive/file_cache.h b/chrome/browser/chromeos/drive/file_cache.h
index 7777077..c576b7b 100644
--- a/chrome/browser/chromeos/drive/file_cache.h
+++ b/chrome/browser/chromeos/drive/file_cache.h
@@ -200,12 +200,10 @@
   // |callback| must not be null.
   // Must be called on the UI thread.
   void MarkDirtyOnUIThread(const std::string& resource_id,
-                           const std::string& md5,
                            const FileOperationCallback& callback);
 
   // Marks the specified entry dirty.
-  FileError MarkDirty(const std::string& resource_id,
-                      const std::string& md5);
+  FileError MarkDirty(const std::string& resource_id);
 
   // Clears dirty state of the specified entry.
   FileError ClearDirty(const std::string& resource_id,
diff --git a/chrome/browser/chromeos/drive/file_cache_unittest.cc b/chrome/browser/chromeos/drive/file_cache_unittest.cc
index 6f70aca..f18830a 100644
--- a/chrome/browser/chromeos/drive/file_cache_unittest.cc
+++ b/chrome/browser/chromeos/drive/file_cache_unittest.cc
@@ -200,7 +200,6 @@
   }
 
   void TestMarkDirty(const std::string& resource_id,
-                     const std::string& md5,
                      FileError expected_error,
                      int expected_cache_state) {
     expected_error_ = expected_error;
@@ -208,17 +207,17 @@
 
     FileError error = FILE_ERROR_OK;
     cache_->MarkDirtyOnUIThread(
-        resource_id, md5,
+        resource_id,
         google_apis::test_util::CreateCopyResultCallback(&error));
     test_util::RunBlockingPoolTask();
 
-    VerifyCacheFileState(error, resource_id, md5);
+    VerifyCacheFileState(error, resource_id, std::string());
 
     // Verify filename.
     if (error == FILE_ERROR_OK) {
       base::FilePath cache_file_path;
       cache_->GetFileOnUIThread(
-          resource_id, md5,
+          resource_id, std::string(),
           google_apis::test_util::CreateCopyResultCallback(
               &error, &cache_file_path));
       test_util::RunBlockingPoolTask();
@@ -554,7 +553,7 @@
                    FILE_ERROR_OK, TEST_CACHE_STATE_PRESENT);
 
   // Mark the file dirty.
-  TestMarkDirty(resource_id, md5, FILE_ERROR_OK,
+  TestMarkDirty(resource_id, FILE_ERROR_OK,
                 TEST_CACHE_STATE_PRESENT | TEST_CACHE_STATE_DIRTY);
 
   // Clear dirty state of the file.
@@ -572,7 +571,7 @@
           TEST_CACHE_STATE_PRESENT | TEST_CACHE_STATE_PINNED);
 
   // Mark the file dirty.
-  TestMarkDirty(resource_id, md5, FILE_ERROR_OK,
+  TestMarkDirty(resource_id, FILE_ERROR_OK,
                 TEST_CACHE_STATE_PRESENT |
                 TEST_CACHE_STATE_DIRTY |
                 TEST_CACHE_STATE_PINNED);
@@ -589,7 +588,7 @@
   // First store a file to cache and mark it as dirty.
   TestStoreToCache(resource_id, md5, dummy_file_path_,
                    FILE_ERROR_OK, TEST_CACHE_STATE_PRESENT);
-  TestMarkDirty(resource_id, md5, FILE_ERROR_OK,
+  TestMarkDirty(resource_id, FILE_ERROR_OK,
                 TEST_CACHE_STATE_PRESENT | TEST_CACHE_STATE_DIRTY);
 
   // Verifies dirty file exists.
@@ -628,11 +627,11 @@
                    FILE_ERROR_OK, TEST_CACHE_STATE_PRESENT);
 
   // Mark the file dirty.
-  TestMarkDirty(resource_id, md5, FILE_ERROR_OK,
+  TestMarkDirty(resource_id, FILE_ERROR_OK,
                 TEST_CACHE_STATE_PRESENT | TEST_CACHE_STATE_DIRTY);
 
   // Again, mark the file dirty.  Nothing should change.
-  TestMarkDirty(resource_id, md5, FILE_ERROR_OK,
+  TestMarkDirty(resource_id, FILE_ERROR_OK,
                 TEST_CACHE_STATE_PRESENT | TEST_CACHE_STATE_DIRTY);
 
   // Clear dirty state of the file.
@@ -648,7 +647,7 @@
   std::string md5("abcdef0123456789");
 
   // Mark a non-existent file dirty.
-  TestMarkDirty(resource_id, md5, FILE_ERROR_NOT_FOUND, TEST_CACHE_STATE_NONE);
+  TestMarkDirty(resource_id, FILE_ERROR_NOT_FOUND, TEST_CACHE_STATE_NONE);
 
   // Clear dirty state of a non-existent file.
   TestClearDirty(resource_id, md5, FILE_ERROR_NOT_FOUND, TEST_CACHE_STATE_NONE);
@@ -663,7 +662,7 @@
 
   // Mark an existing file dirty, then store a new file to the same resource id
   // but different md5, which should fail.
-  TestMarkDirty(resource_id, md5, FILE_ERROR_OK,
+  TestMarkDirty(resource_id, FILE_ERROR_OK,
                 TEST_CACHE_STATE_PRESENT | TEST_CACHE_STATE_DIRTY);
   md5 = "new_md5";
   TestStoreToCache(resource_id, md5, dummy_file_path_,
@@ -680,7 +679,7 @@
                    FILE_ERROR_OK, TEST_CACHE_STATE_PRESENT);
   TestPin(resource_id, FILE_ERROR_OK,
           TEST_CACHE_STATE_PRESENT | TEST_CACHE_STATE_PINNED);
-  TestMarkDirty(resource_id, md5, FILE_ERROR_OK,
+  TestMarkDirty(resource_id, FILE_ERROR_OK,
                 TEST_CACHE_STATE_PRESENT |
                 TEST_CACHE_STATE_PINNED |
                 TEST_CACHE_STATE_DIRTY);
diff --git a/chrome/browser/chromeos/drive/file_system.cc b/chrome/browser/chromeos/drive/file_system.cc
index b3b22b5..674dbc4 100644
--- a/chrome/browser/chromeos/drive/file_system.cc
+++ b/chrome/browser/chromeos/drive/file_system.cc
@@ -671,6 +671,72 @@
                about_resource->quota_bytes_used());
 }
 
+void FileSystem::GetShareUrl(
+    const base::FilePath& file_path,
+    const GURL& embed_origin,
+    const GetShareUrlCallback& callback) {
+  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+  DCHECK(!callback.is_null());
+
+  // Resolve the resource id.
+  resource_metadata_->GetResourceEntryByPathOnUIThread(
+      file_path,
+      base::Bind(&FileSystem::GetShareUrlAfterGetResourceEntry,
+                 weak_ptr_factory_.GetWeakPtr(),
+                 file_path,
+                 embed_origin,
+                 callback));
+}
+
+void FileSystem::GetShareUrlAfterGetResourceEntry(
+    const base::FilePath& file_path,
+    const GURL& embed_origin,
+    const GetShareUrlCallback& callback,
+    FileError error,
+    scoped_ptr<ResourceEntry> entry) {
+  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+  DCHECK(!callback.is_null());
+
+  if (error != FILE_ERROR_OK) {
+    callback.Run(error, GURL());
+    return;
+  }
+  if (util::IsSpecialResourceId(entry->resource_id())) {
+    // Do not load special directories. Just return.
+    callback.Run(FILE_ERROR_FAILED, GURL());
+    return;
+  }
+
+  scheduler_->GetShareUrl(
+      entry->resource_id(),
+      embed_origin,
+      ClientContext(USER_INITIATED),
+      base::Bind(&FileSystem::OnGetResourceEntryForGetShareUrl,
+                 weak_ptr_factory_.GetWeakPtr(),
+                 callback));
+}
+
+void FileSystem::OnGetResourceEntryForGetShareUrl(
+    const GetShareUrlCallback& callback,
+    google_apis::GDataErrorCode status,
+    const GURL& share_url) {
+  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+  DCHECK(!callback.is_null());
+
+  FileError error = util::GDataToFileError(status);
+  if (error != FILE_ERROR_OK) {
+    callback.Run(error, GURL());
+    return;
+  }
+
+  if (share_url.is_empty()) {
+    callback.Run(FILE_ERROR_FAILED, GURL());
+    return;
+  }
+
+  callback.Run(FILE_ERROR_OK, share_url);
+}
+
 void FileSystem::Search(const std::string& search_query,
                         const GURL& next_url,
                         const SearchCallback& callback) {
diff --git a/chrome/browser/chromeos/drive/file_system.h b/chrome/browser/chromeos/drive/file_system.h
index 351f637..2d471e3 100644
--- a/chrome/browser/chromeos/drive/file_system.h
+++ b/chrome/browser/chromeos/drive/file_system.h
@@ -136,6 +136,10 @@
       const ReadDirectoryCallback& callback) OVERRIDE;
   virtual void GetAvailableSpace(
       const GetAvailableSpaceCallback& callback) OVERRIDE;
+  virtual void GetShareUrl(
+      const base::FilePath& file_path,
+      const GURL& embed_origin,
+      const GetShareUrlCallback& callback) OVERRIDE;
   virtual void GetMetadata(
       const GetFilesystemMetadataCallback& callback) OVERRIDE;
   virtual void MarkCacheFileAsMounted(
@@ -292,6 +296,19 @@
       FileError error,
       scoped_ptr<ResourceEntry> entry);
 
+  // Part of GetShareUrl. Resolves the resource entry to get the resource it,
+  // and then uses it to ask for the share url. |callback| must not be null.
+  void GetShareUrlAfterGetResourceEntry(
+      const base::FilePath& file_path,
+      const GURL& embed_origin,
+      const GetShareUrlCallback& callback,
+      FileError error,
+      scoped_ptr<ResourceEntry> entry);
+  void OnGetResourceEntryForGetShareUrl(
+      const GetShareUrlCallback& callback,
+      google_apis::GDataErrorCode status,
+      const GURL& share_url);
+
   // Used to get Drive related preferences.
   PrefService* pref_service_;
 
diff --git a/chrome/browser/chromeos/drive/file_system/copy_operation.cc b/chrome/browser/chromeos/drive/file_system/copy_operation.cc
index 3b10008..f83b918 100644
--- a/chrome/browser/chromeos/drive/file_system/copy_operation.cc
+++ b/chrome/browser/chromeos/drive/file_system/copy_operation.cc
@@ -46,7 +46,7 @@
                                  internal::FileCache::FILE_OPERATION_COPY);
   if (error != FILE_ERROR_OK)
     return error;
-  return cache->MarkDirty(resource_id, md5);
+  return cache->MarkDirty(resource_id);
 }
 
 }  // namespace
diff --git a/chrome/browser/chromeos/drive/file_system/download_operation_unittest.cc b/chrome/browser/chromeos/drive/file_system/download_operation_unittest.cc
index 5d0f298..3bf85c2 100644
--- a/chrome/browser/chromeos/drive/file_system/download_operation_unittest.cc
+++ b/chrome/browser/chromeos/drive/file_system/download_operation_unittest.cc
@@ -414,7 +414,6 @@
   EXPECT_EQ(FILE_ERROR_OK, error);
   cache()->MarkDirtyOnUIThread(
       src_entry.resource_id(),
-      src_entry.file_specific_info().md5(),
       google_apis::test_util::CreateCopyResultCallback(&error));
   test_util::RunBlockingPoolTask();
   EXPECT_EQ(FILE_ERROR_OK, error);
diff --git a/chrome/browser/chromeos/drive/file_system/open_file_operation.cc b/chrome/browser/chromeos/drive/file_system/open_file_operation.cc
index 4a49830..d23c488 100644
--- a/chrome/browser/chromeos/drive/file_system/open_file_operation.cc
+++ b/chrome/browser/chromeos/drive/file_system/open_file_operation.cc
@@ -28,7 +28,7 @@
                                const std::string& resource_id,
                                const std::string& md5,
                                base::FilePath* local_file_path) {
-  FileError error = cache->MarkDirty(resource_id, md5);
+  FileError error = cache->MarkDirty(resource_id);
   if (error != FILE_ERROR_OK)
     return error;
 
diff --git a/chrome/browser/chromeos/drive/file_system/truncate_operation.cc b/chrome/browser/chromeos/drive/file_system/truncate_operation.cc
index df3918c..3711aaa 100644
--- a/chrome/browser/chromeos/drive/file_system/truncate_operation.cc
+++ b/chrome/browser/chromeos/drive/file_system/truncate_operation.cc
@@ -48,12 +48,11 @@
 // then marks the resource is dirty on |cache|.
 FileError TruncateOnBlockingPool(internal::FileCache* cache,
                                  const std::string& resource_id,
-                                 const std::string& md5,
                                  const base::FilePath& local_cache_path,
                                  int64 length) {
   DCHECK(cache);
 
-  FileError error = cache->MarkDirty(resource_id, md5);
+  FileError error = cache->MarkDirty(resource_id);
   if (error != FILE_ERROR_OK)
     return error;
 
@@ -149,7 +148,7 @@
       FROM_HERE,
       base::Bind(&TruncateOnBlockingPool,
                  base::Unretained(cache_),
-                 entry->resource_id(), entry->file_specific_info().md5(),
+                 entry->resource_id(),
                  local_file_path, length),
       base::Bind(
           &TruncateOperation::TruncateAfterTruncateOnBlockingPool,
diff --git a/chrome/browser/chromeos/drive/file_system/update_operation_unittest.cc b/chrome/browser/chromeos/drive/file_system/update_operation_unittest.cc
index b9aa729..7ce3ebc 100644
--- a/chrome/browser/chromeos/drive/file_system/update_operation_unittest.cc
+++ b/chrome/browser/chromeos/drive/file_system/update_operation_unittest.cc
@@ -57,7 +57,7 @@
   // Add the dirty bit.
   error = FILE_ERROR_FAILED;
   cache()->MarkDirtyOnUIThread(
-      kResourceId, kMd5,
+      kResourceId,
       google_apis::test_util::CreateCopyResultCallback(&error));
   test_util::RunBlockingPoolTask();
   EXPECT_EQ(FILE_ERROR_OK, error);
@@ -132,7 +132,7 @@
   // Add the dirty bit.
   error = FILE_ERROR_FAILED;
   cache()->MarkDirtyOnUIThread(
-      kResourceId, kMd5,
+      kResourceId,
       google_apis::test_util::CreateCopyResultCallback(&error));
   test_util::RunBlockingPoolTask();
   EXPECT_EQ(FILE_ERROR_OK, error);
@@ -178,7 +178,7 @@
   // Again mark the cache file dirty.
   error = FILE_ERROR_FAILED;
   cache()->MarkDirtyOnUIThread(
-      kResourceId, server_entry->file_md5(),
+      kResourceId,
       google_apis::test_util::CreateCopyResultCallback(&error));
   test_util::RunBlockingPoolTask();
   EXPECT_EQ(FILE_ERROR_OK, error);
diff --git a/chrome/browser/chromeos/drive/file_system_interface.h b/chrome/browser/chromeos/drive/file_system_interface.h
index 98ccf11..93b5324 100644
--- a/chrome/browser/chromeos/drive/file_system_interface.h
+++ b/chrome/browser/chromeos/drive/file_system_interface.h
@@ -112,6 +112,10 @@
                             int64 bytes_total,
                             int64 bytes_used)> GetAvailableSpaceCallback;
 
+// Used to get the url to the sharing dialog.
+typedef base::Callback<void(FileError error,
+                            const GURL& share_url)> GetShareUrlCallback;
+
 // Used to get filesystem metadata.
 typedef base::Callback<void(const FileSystemMetadata&)>
     GetFilesystemMetadataCallback;
@@ -382,6 +386,13 @@
   // and returns it to the callback.
   virtual void GetAvailableSpace(const GetAvailableSpaceCallback& callback) = 0;
 
+  // Fetches the url to the sharing dialog to be embedded in |embed_origin|,
+  // for the specified file or directory. |callback| must not be null.
+  virtual void GetShareUrl(
+      const base::FilePath& file_path,
+      const GURL& embed_origin,
+      const GetShareUrlCallback& callback) = 0;
+
   // Returns miscellaneous metadata of the file system like the largest
   // timestamp. Used in chrome:drive-internals. |callback| must not be null.
   virtual void GetMetadata(
diff --git a/chrome/browser/chromeos/drive/file_system_unittest.cc b/chrome/browser/chromeos/drive/file_system_unittest.cc
index a5a7922..95bfd1b 100644
--- a/chrome/browser/chromeos/drive/file_system_unittest.cc
+++ b/chrome/browser/chromeos/drive/file_system_unittest.cc
@@ -846,4 +846,46 @@
   EXPECT_EQ(FILE_ERROR_OK, cache_->Remove(entry->resource_id()));
 }
 
+TEST_F(FileSystemTest, GetShareUrl) {
+  ASSERT_TRUE(LoadFullResourceList());
+
+  const base::FilePath kFileInRoot(FILE_PATH_LITERAL("drive/root/File 1.txt"));
+  const GURL kEmbedOrigin("chrome-extension://test-id");
+
+  // Try to fetch the URL for the sharing dialog.
+  FileError error = FILE_ERROR_FAILED;
+  GURL share_url;
+  file_system_->GetShareUrl(
+      kFileInRoot,
+      kEmbedOrigin,
+      google_apis::test_util::CreateCopyResultCallback(&error, &share_url));
+  test_util::RunBlockingPoolTask();
+
+  // Verify the share url to the sharing dialog.
+  EXPECT_EQ(FILE_ERROR_OK, error);
+  EXPECT_EQ(GURL("https://file_link_share/"), share_url);
+}
+
+TEST_F(FileSystemTest, GetShareUrlNotAvailable) {
+  ASSERT_TRUE(LoadFullResourceList());
+
+  const base::FilePath kFileInRoot(
+      FILE_PATH_LITERAL("drive/root/Directory 1/SubDirectory File 1.txt"));
+  const GURL kEmbedOrigin("chrome-extension://test-id");
+
+  // Try to fetch the URL for the sharing dialog.
+  FileError error = FILE_ERROR_FAILED;
+  GURL share_url;
+
+  file_system_->GetShareUrl(
+      kFileInRoot,
+      kEmbedOrigin,
+      google_apis::test_util::CreateCopyResultCallback(&error, &share_url));
+  test_util::RunBlockingPoolTask();
+
+  // Verify the error and the share url, which should be empty.
+  EXPECT_EQ(FILE_ERROR_FAILED, error);
+  EXPECT_TRUE(share_url.is_empty());
+}
+
 }   // namespace drive
diff --git a/chrome/browser/chromeos/drive/job_list.cc b/chrome/browser/chromeos/drive/job_list.cc
index ae87b46..accb090 100644
--- a/chrome/browser/chromeos/drive/job_list.cc
+++ b/chrome/browser/chromeos/drive/job_list.cc
@@ -28,6 +28,8 @@
       return "TYPE_CONTINUE_GET_RESOURCE_LIST";
     case TYPE_GET_RESOURCE_ENTRY:
       return "TYPE_GET_RESOURCE_ENTRY";
+    case TYPE_GET_SHARE_URL:
+      return "TYPE_GET_SHARE_URL";
     case TYPE_DELETE_RESOURCE:
       return "TYPE_DELETE_RESOURCE";
     case TYPE_COPY_RESOURCE:
@@ -115,6 +117,7 @@
     case TYPE_GET_CHANGE_LIST:
     case TYPE_CONTINUE_GET_RESOURCE_LIST:
     case TYPE_GET_RESOURCE_ENTRY:
+    case TYPE_GET_SHARE_URL:
     case TYPE_DELETE_RESOURCE:
     case TYPE_COPY_RESOURCE:
     case TYPE_COPY_HOSTED_DOCUMENT:
diff --git a/chrome/browser/chromeos/drive/job_list.h b/chrome/browser/chromeos/drive/job_list.h
index 8859b03..dbd74b9 100644
--- a/chrome/browser/chromeos/drive/job_list.h
+++ b/chrome/browser/chromeos/drive/job_list.h
@@ -23,6 +23,7 @@
   TYPE_GET_CHANGE_LIST,
   TYPE_CONTINUE_GET_RESOURCE_LIST,
   TYPE_GET_RESOURCE_ENTRY,
+  TYPE_GET_SHARE_URL,
   TYPE_DELETE_RESOURCE,
   TYPE_COPY_RESOURCE,
   TYPE_COPY_HOSTED_DOCUMENT,
diff --git a/chrome/browser/chromeos/drive/job_scheduler.cc b/chrome/browser/chromeos/drive/job_scheduler.cc
index 83a3d00..c8e48af 100644
--- a/chrome/browser/chromeos/drive/job_scheduler.cc
+++ b/chrome/browser/chromeos/drive/job_scheduler.cc
@@ -334,6 +334,29 @@
   StartJob(new_job);
 }
 
+void JobScheduler::GetShareUrl(
+    const std::string& resource_id,
+    const GURL& embed_origin,
+    const ClientContext& context,
+    const google_apis::GetShareUrlCallback& callback) {
+  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+  DCHECK(!callback.is_null());
+
+  JobEntry* new_job = CreateNewJob(TYPE_GET_SHARE_URL);
+  new_job->context = context;
+  new_job->task = base::Bind(
+      &DriveServiceInterface::GetShareUrl,
+      base::Unretained(drive_service_),
+      resource_id,
+      embed_origin,
+      base::Bind(&JobScheduler::OnGetShareUrlJobDone,
+                 weak_ptr_factory_.GetWeakPtr(),
+                 new_job->job_info.job_id,
+                 callback));
+  new_job->abort_callback = google_apis::CreateErrorRunCallback(callback);
+  StartJob(new_job);
+}
+
 void JobScheduler::DeleteResource(
     const std::string& resource_id,
     const google_apis::EntryActionCallback& callback) {
@@ -850,6 +873,18 @@
     callback.Run(error, about_resource.Pass());
 }
 
+void JobScheduler::OnGetShareUrlJobDone(
+    JobID job_id,
+    const google_apis::GetShareUrlCallback& callback,
+    google_apis::GDataErrorCode error,
+    const GURL& share_url) {
+  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+  DCHECK(!callback.is_null());
+
+  if (OnJobDone(job_id, error))
+    callback.Run(error, share_url);
+}
+
 void JobScheduler::OnGetAppListJobDone(
     JobID job_id,
     const google_apis::GetAppListCallback& callback,
@@ -952,6 +987,7 @@
     case TYPE_GET_CHANGE_LIST:
     case TYPE_CONTINUE_GET_RESOURCE_LIST:
     case TYPE_GET_RESOURCE_ENTRY:
+    case TYPE_GET_SHARE_URL:
     case TYPE_DELETE_RESOURCE:
     case TYPE_COPY_RESOURCE:
     case TYPE_COPY_HOSTED_DOCUMENT:
diff --git a/chrome/browser/chromeos/drive/job_scheduler.h b/chrome/browser/chromeos/drive/job_scheduler.h
index 404ce7f..d10f8c9 100644
--- a/chrome/browser/chromeos/drive/job_scheduler.h
+++ b/chrome/browser/chromeos/drive/job_scheduler.h
@@ -102,6 +102,11 @@
                         const ClientContext& context,
                         const google_apis::GetResourceEntryCallback& callback);
 
+  // Adds a GetShareUrl operation to the queue.
+  void GetShareUrl(const std::string& resource_id,
+                   const GURL& embed_origin,
+                   const ClientContext& context,
+                   const google_apis::GetShareUrlCallback& callback);
 
   // Adds a DeleteResource operation to the queue.
   void DeleteResource(const std::string& resource_id,
@@ -270,6 +275,13 @@
       google_apis::GDataErrorCode error,
       scoped_ptr<google_apis::AboutResource> about_resource);
 
+  // Callback for job finishing with a GetShareUrlCallback.
+  void OnGetShareUrlJobDone(
+      JobID job_id,
+      const google_apis::GetShareUrlCallback& callback,
+      google_apis::GDataErrorCode error,
+      const GURL& share_url);
+
   // Callback for job finishing with a GetAppListCallback.
   void OnGetAppListJobDone(
       JobID job_id,
diff --git a/chrome/browser/chromeos/drive/job_scheduler_unittest.cc b/chrome/browser/chromeos/drive/job_scheduler_unittest.cc
index f734529..40050a3 100644
--- a/chrome/browser/chromeos/drive/job_scheduler_unittest.cc
+++ b/chrome/browser/chromeos/drive/job_scheduler_unittest.cc
@@ -304,6 +304,23 @@
   ASSERT_TRUE(entry);
 }
 
+TEST_F(JobSchedulerTest, GetShareUrl) {
+  ConnectToWifi();
+
+  google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
+  GURL share_url;
+
+  scheduler_->GetShareUrl(
+      "file:2_file_resource_id",  // resource ID
+      GURL("chrome-extension://test-id/"), // embed origin
+      ClientContext(USER_INITIATED),
+      google_apis::test_util::CreateCopyResultCallback(&error, &share_url));
+  base::RunLoop().RunUntilIdle();
+
+  ASSERT_EQ(google_apis::HTTP_SUCCESS, error);
+  ASSERT_FALSE(share_url.is_empty());
+}
+
 TEST_F(JobSchedulerTest, DeleteResource) {
   ConnectToWifi();
 
diff --git a/chrome/browser/chromeos/drive/remove_stale_cache_files_unittest.cc b/chrome/browser/chromeos/drive/remove_stale_cache_files_unittest.cc
index 751b6a8..41e647b 100644
--- a/chrome/browser/chromeos/drive/remove_stale_cache_files_unittest.cc
+++ b/chrome/browser/chromeos/drive/remove_stale_cache_files_unittest.cc
@@ -94,7 +94,7 @@
   EXPECT_EQ(FILE_ERROR_OK,
             cache_->Store(resource_id_1, md5_1, dummy_file,
                           FileCache::FILE_OPERATION_COPY));
-  EXPECT_EQ(FILE_ERROR_OK, cache_->MarkDirty(resource_id_1, md5_1));
+  EXPECT_EQ(FILE_ERROR_OK, cache_->MarkDirty(resource_id_1));
 
   // Dirty and mismatching-MD5 entry.
   std::string resource_id_2("file:2");
@@ -103,7 +103,7 @@
   EXPECT_EQ(FILE_ERROR_OK,
             cache_->Store(resource_id_2, md5_2_cache, dummy_file,
                           FileCache::FILE_OPERATION_COPY));
-  EXPECT_EQ(FILE_ERROR_OK, cache_->MarkDirty(resource_id_2, md5_2_cache));
+  EXPECT_EQ(FILE_ERROR_OK, cache_->MarkDirty(resource_id_2));
 
   ResourceEntry entry;
   entry.set_resource_id(resource_id_2);
diff --git a/chrome/browser/chromeos/drive/sync_client_unittest.cc b/chrome/browser/chromeos/drive/sync_client_unittest.cc
index de42956..c209643 100644
--- a/chrome/browser/chromeos/drive/sync_client_unittest.cc
+++ b/chrome/browser/chromeos/drive/sync_client_unittest.cc
@@ -178,8 +178,7 @@
               cache_->Store(resource_ids_["dirty"], md5_dirty,
                             temp_file, FileCache::FILE_OPERATION_COPY));
     EXPECT_EQ(FILE_ERROR_OK, cache_->Pin(resource_ids_["dirty"]));
-    EXPECT_EQ(FILE_ERROR_OK,
-              cache_->MarkDirty(resource_ids_["dirty"], md5_dirty));
+    EXPECT_EQ(FILE_ERROR_OK, cache_->MarkDirty(resource_ids_["dirty"]));
 
     // Load data from the service to the metadata.
     FileError error = FILE_ERROR_FAILED;
diff --git a/chrome/browser/chromeos/drive/test_util.cc b/chrome/browser/chromeos/drive/test_util.cc
index 1a70d69..c2cd679 100644
--- a/chrome/browser/chromeos/drive/test_util.cc
+++ b/chrome/browser/chromeos/drive/test_util.cc
@@ -158,7 +158,6 @@
       FileError error = FILE_ERROR_OK;
       cache->MarkDirtyOnUIThread(
           resources[i].resource_id,
-          resources[i].md5,
           google_apis::test_util::CreateCopyResultCallback(&error));
       test_util::RunBlockingPoolTask();
       if (error != FILE_ERROR_OK)
diff --git a/chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.cc b/chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.cc
index 35f3f6a..5f9e4ca 100644
--- a/chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.cc
@@ -441,6 +441,7 @@
   registry->RegisterFunction<ValidatePathNameLengthFunction>();
   registry->RegisterFunction<ZoomFunction>();
   registry->RegisterFunction<RequestAccessTokenFunction>();
+  registry->RegisterFunction<GetShareUrlFunction>();
   event_router_->ObserveFileSystemEvents();
 }
 
@@ -1985,10 +1986,10 @@
   SET_STRING("CUT_BUTTON_LABEL", IDS_FILE_BROWSER_CUT_BUTTON_LABEL);
   SET_STRING("ZIP_SELECTION_BUTTON_LABEL",
              IDS_FILE_BROWSER_ZIP_SELECTION_BUTTON_LABEL);
-  SET_STRING("PIN_FOLDER_BUTTON_LABEL",
-             IDS_FILE_BROWSER_PIN_FOLDER_BUTTON_LABEL);
-  SET_STRING("UNPIN_FOLDER_BUTTON_LABEL",
-             IDS_FILE_BROWSER_UNPIN_FOLDER_BUTTON_LABEL);
+  SET_STRING("CREATE_FOLDER_SHORTCUT_BUTTON_LABEL",
+             IDS_FILE_BROWSER_CREATE_FOLDER_SHORTCUT_BUTTON_LABEL);
+  SET_STRING("REMOVE_FOLDER_SHORTCUT_BUTTON_LABEL",
+             IDS_FILE_BROWSER_REMOVE_FOLDER_SHORTCUT_BUTTON_LABEL);
   SET_STRING("SHARE_BUTTON_LABEL",
              IDS_FILE_BROWSER_SHARE_BUTTON_LABEL);
 
@@ -3077,3 +3078,45 @@
   SetResult(new base::StringValue(access_token));
   SendResponse(true);
 }
+
+GetShareUrlFunction::GetShareUrlFunction() {
+}
+
+GetShareUrlFunction::~GetShareUrlFunction() {
+}
+
+bool GetShareUrlFunction::RunImpl() {
+  std::string file_url;
+  if (!args_->GetString(0, &file_url))
+    return false;
+
+  const base::FilePath path = GetLocalPathFromURL(GURL(file_url));
+  DCHECK(drive::util::IsUnderDriveMountPoint(path));
+
+  base::FilePath drive_path = drive::util::ExtractDrivePath(path);
+
+  drive::DriveIntegrationService* integration_service =
+      drive::DriveIntegrationServiceFactory::GetForProfile(profile_);
+  // |integration_service| is NULL if Drive is disabled.
+  if (!integration_service)
+    return false;
+
+  integration_service->file_system()->GetShareUrl(
+      drive_path,
+      file_manager_util::GetFileBrowserExtensionUrl(),  // embed origin
+      base::Bind(&GetShareUrlFunction::OnGetShareUrl, this));
+  return true;
+}
+
+
+void GetShareUrlFunction::OnGetShareUrl(drive::FileError error,
+                                        const GURL& share_url) {
+  if (error != drive::FILE_ERROR_OK) {
+    error_ = "Share Url for this item is not available.";
+    SendResponse(false);
+    return;
+  }
+
+  SetResult(new base::StringValue(share_url.spec()));
+  SendResponse(true);
+}
diff --git a/chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.h b/chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.h
index bf5ff1e..e29b7bf 100644
--- a/chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.h
+++ b/chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.h
@@ -780,9 +780,28 @@
   // AsyncExtensionFunction overrides.
   virtual bool RunImpl() OVERRIDE;
 
-  // Received the cached auth token (if available) or the fetched one.
+  // Callback with a cached auth token (if available) or a fetched one.
   void OnAccessTokenFetched(google_apis::GDataErrorCode code,
                             const std::string& access_token);
 };
 
+// Implements the chrome.fileBrowserPrivate.getShareUrl method.
+class GetShareUrlFunction : public FileBrowserFunction {
+ public:
+  DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.getShareUrl",
+                             FILEBROWSERPRIVATE_GETSHAREURL)
+
+  GetShareUrlFunction();
+
+ protected:
+  virtual ~GetShareUrlFunction();
+
+  // AsyncExtensionFunction overrides.
+  virtual bool RunImpl() OVERRIDE;
+
+  // Callback with an url to the sharing dialog as |share_url|, called by
+  // FileSystem::GetShareUrl.
+  void OnGetShareUrl(drive::FileError error, const GURL& share_url);
+};
+
 #endif  // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_FILE_BROWSER_PRIVATE_API_H_
diff --git a/chrome/browser/chromeos/fileapi/file_system_backend.cc b/chrome/browser/chromeos/fileapi/file_system_backend.cc
index fce5776..a259b1a 100644
--- a/chrome/browser/chromeos/fileapi/file_system_backend.cc
+++ b/chrome/browser/chromeos/fileapi/file_system_backend.cc
@@ -106,12 +106,14 @@
   }
 }
 
-void FileSystemBackend::InitializeFileSystem(
+void FileSystemBackend::Initialize(fileapi::FileSystemContext* context) {
+}
+
+void FileSystemBackend::OpenFileSystem(
     const GURL& origin_url,
     fileapi::FileSystemType type,
     fileapi::OpenFileSystemMode mode,
-    fileapi::FileSystemContext* context,
-    const InitializeFileSystemCallback& callback) {
+    const OpenFileSystemCallback& callback) {
   DCHECK(fileapi::IsolatedContext::IsIsolatedType(type));
   // Nothing to validate for external filesystem.
   callback.Run(GetFileSystemRootURI(origin_url, type),
diff --git a/chrome/browser/chromeos/fileapi/file_system_backend.h b/chrome/browser/chromeos/fileapi/file_system_backend.h
index d08c34a..1ca1050 100644
--- a/chrome/browser/chromeos/fileapi/file_system_backend.h
+++ b/chrome/browser/chromeos/fileapi/file_system_backend.h
@@ -66,7 +66,7 @@
 //
 class FileSystemBackend : public fileapi::ExternalFileSystemBackend {
  public:
-  using fileapi::FileSystemBackend::InitializeFileSystemCallback;
+  using fileapi::FileSystemBackend::OpenFileSystemCallback;
 
   // FileSystemBackend will take an ownership of a |mount_points|
   // reference. On the other hand, |system_mount_points| will be kept as a raw
@@ -90,12 +90,12 @@
 
   // fileapi::FileSystemBackend overrides.
   virtual bool CanHandleType(fileapi::FileSystemType type) const OVERRIDE;
-  virtual void InitializeFileSystem(
+  virtual void Initialize(fileapi::FileSystemContext* context) OVERRIDE;
+  virtual void OpenFileSystem(
       const GURL& origin_url,
       fileapi::FileSystemType type,
       fileapi::OpenFileSystemMode mode,
-      fileapi::FileSystemContext* context,
-      const InitializeFileSystemCallback& callback) OVERRIDE;
+      const OpenFileSystemCallback& callback) OVERRIDE;
   virtual fileapi::FileSystemFileUtil* GetFileUtil(
       fileapi::FileSystemType type) OVERRIDE;
   virtual fileapi::AsyncFileUtil* GetAsyncFileUtil(
diff --git a/chrome/browser/chromeos/input_method/ibus_controller_impl.h b/chrome/browser/chromeos/input_method/ibus_controller_impl.h
index 0852d87..af0892a 100644
--- a/chrome/browser/chromeos/input_method/ibus_controller_impl.h
+++ b/chrome/browser/chromeos/input_method/ibus_controller_impl.h
@@ -8,7 +8,6 @@
 #include <string>
 #include <vector>
 
-#include "base/process_util.h"
 #include "base/threading/thread_checker.h"
 #include "chrome/browser/chromeos/input_method/ibus_controller_base.h"
 #include "chromeos/dbus/ibus/ibus_panel_service.h"
diff --git a/chrome/browser/chromeos/input_method/input_method_manager_impl.cc b/chrome/browser/chromeos/input_method/input_method_manager_impl.cc
index 7f2fa95..56ade22 100644
--- a/chrome/browser/chromeos/input_method/input_method_manager_impl.cc
+++ b/chrome/browser/chromeos/input_method/input_method_manager_impl.cc
@@ -75,6 +75,8 @@
   { "m17n:vi:viqr", "_comp_ime_jhffeifommiaekmbkkjlpmilogcfdohpvkd_vi_viqr" },
   { "m17n:vi:telex",
     "_comp_ime_jhffeifommiaekmbkkjlpmilogcfdohpvkd_vi_telex" },
+  { "m17n:vi:vni",
+    "_comp_ime_jhffeifommiaekmbkkjlpmilogcfdohpvkd_vi_vni" },
   { "m17n:am:sera",
     "_comp_ime_jhffeifommiaekmbkkjlpmilogcfdohpvkd_ethi" },
   { "m17n:bn:itrans",
@@ -88,7 +90,7 @@
   { "m17n:ml:itrans",
     "_comp_ime_jhffeifommiaekmbkkjlpmilogcfdohpvkd_ml_phone" },
   { "m17n:mr:itrans",
-    "_comp_ime_jhffeifommiaekmbkkjlpmilogcfdohpvkd_deva_phone-" },
+    "_comp_ime_jhffeifommiaekmbkkjlpmilogcfdohpvkd_deva_phone" },
   { "m17n:te:itrans",
     "_comp_ime_jhffeifommiaekmbkkjlpmilogcfdohpvkd_te_phone" },
   { "m17n:fa:isiri", "_comp_ime_jhffeifommiaekmbkkjlpmilogcfdohpvkd_fa" },
diff --git a/chrome/browser/chromeos/login/chrome_restart_request.cc b/chrome/browser/chromeos/login/chrome_restart_request.cc
index d8f2671..aa317f3 100644
--- a/chrome/browser/chromeos/login/chrome_restart_request.cc
+++ b/chrome/browser/chromeos/login/chrome_restart_request.cc
@@ -14,7 +14,7 @@
 #include "base/path_service.h"
 #include "base/prefs/json_pref_store.h"
 #include "base/prefs/pref_service.h"
-#include "base/process_util.h"
+#include "base/process/launch.h"
 #include "base/strings/string_split.h"
 #include "base/strings/stringprintf.h"
 #include "base/timer/timer.h"
diff --git a/chrome/browser/chromeos/memory/oom_priority_manager.cc b/chrome/browser/chromeos/memory/oom_priority_manager.cc
index 85b6217..69477ae 100644
--- a/chrome/browser/chromeos/memory/oom_priority_manager.cc
+++ b/chrome/browser/chromeos/memory/oom_priority_manager.cc
@@ -13,8 +13,7 @@
 #include "base/command_line.h"
 #include "base/metrics/field_trial.h"
 #include "base/metrics/histogram.h"
-#include "base/process.h"
-#include "base/process_util.h"
+#include "base/process/process.h"
 #include "base/strings/string16.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_util.h"
diff --git a/chrome/browser/chromeos/memory/oom_priority_manager.h b/chrome/browser/chromeos/memory/oom_priority_manager.h
index f666db7..2834291 100644
--- a/chrome/browser/chromeos/memory/oom_priority_manager.h
+++ b/chrome/browser/chromeos/memory/oom_priority_manager.h
@@ -11,7 +11,7 @@
 #include "base/containers/hash_tables.h"
 #include "base/gtest_prod_util.h"
 #include "base/memory/scoped_ptr.h"
-#include "base/process.h"
+#include "base/process/process.h"
 #include "base/strings/string16.h"
 #include "base/synchronization/lock.h"
 #include "base/time/time.h"
diff --git a/chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chromeos.cc b/chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chromeos.cc
index 0cb76cc..d013d5e 100644
--- a/chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chromeos.cc
+++ b/chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chromeos.cc
@@ -134,16 +134,20 @@
   base::FilePath policy_key_dir;
   CHECK(PathService::Get(chromeos::DIR_USER_POLICY_KEYS, &policy_key_dir));
 
-  scoped_ptr<CloudPolicyStore> store(
+  scoped_ptr<UserCloudPolicyStoreChromeOS> store(
       new UserCloudPolicyStoreChromeOS(
           chromeos::DBusThreadManager::Get()->GetCryptohomeClient(),
           chromeos::DBusThreadManager::Get()->GetSessionManagerClient(),
           username, policy_key_dir, token_cache_file, policy_cache_file));
+  if (force_immediate_load)
+    store->LoadImmediately();
+
   scoped_ptr<ResourceCache> resource_cache;
   if (command_line->HasSwitch(switches::kEnableComponentCloudPolicy))
     resource_cache.reset(new ResourceCache(resource_cache_dir));
+
   scoped_ptr<UserCloudPolicyManagerChromeOS> manager(
-      new UserCloudPolicyManagerChromeOS(store.Pass(),
+      new UserCloudPolicyManagerChromeOS(store.PassAs<CloudPolicyStore>(),
                                          resource_cache.Pass(),
                                          wait_for_initial_policy));
   manager->Init();
diff --git a/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.cc b/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.cc
index c6cb989..2d6232d 100644
--- a/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.cc
+++ b/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.cc
@@ -203,6 +203,54 @@
                  weak_factory_.GetWeakPtr()));
 }
 
+void UserCloudPolicyStoreChromeOS::LoadImmediately() {
+  // This blocking DBus call is in the startup path and will block the UI
+  // thread. This only happens when the Profile is created synchronously, which
+  // on ChromeOS happens whenever the browser is restarted into the same
+  // session. That happens when the browser crashes, or right after signin if
+  // the user has flags configured in about:flags.
+  // However, on those paths we must load policy synchronously so that the
+  // Profile initialization never sees unmanaged prefs, which would lead to
+  // data loss. http://crbug.com/263061
+  std::string policy_blob =
+      session_manager_client_->BlockingRetrievePolicyForUser(username_);
+  if (policy_blob.empty()) {
+    // The session manager doesn't have policy, or the call failed.
+    // Just notify that the load is done, and don't bother with the legacy
+    // caches in this case.
+    NotifyStoreLoaded();
+    return;
+  }
+
+  scoped_ptr<em::PolicyFetchResponse> policy(new em::PolicyFetchResponse());
+  if (!policy->ParseFromString(policy_blob)) {
+    status_ = STATUS_PARSE_ERROR;
+    NotifyStoreError();
+    return;
+  }
+
+  std::string sanitized_username =
+      cryptohome_client_->BlockingGetSanitizedUsername(username_);
+  if (sanitized_username.empty()) {
+    status_ = STATUS_LOAD_ERROR;
+    NotifyStoreError();
+    return;
+  }
+
+  policy_key_path_ = user_policy_key_dir_.Append(
+      base::StringPrintf(kPolicyKeyFile, sanitized_username.c_str()));
+  LoadPolicyKey(policy_key_path_, &policy_key_);
+  policy_key_loaded_ = true;
+
+  scoped_ptr<UserCloudPolicyValidator> validator =
+      CreateValidator(policy.Pass());
+  validator->ValidateUsername(username_);
+  const bool allow_rotation = false;
+  validator->ValidateSignature(policy_key_, allow_rotation);
+  validator->RunValidation();
+  OnRetrievedPolicyValidated(validator.get());
+}
+
 void UserCloudPolicyStoreChromeOS::ValidatePolicyForStore(
     scoped_ptr<em::PolicyFetchResponse> policy) {
   // Create and configure a validator.
diff --git a/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.h b/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.h
index 4f1ff6d..913235d 100644
--- a/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.h
+++ b/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.h
@@ -49,6 +49,9 @@
       const enterprise_management::PolicyFetchResponse& policy) OVERRIDE;
   virtual void Load() OVERRIDE;
 
+  // Loads the policy synchronously on the current thread.
+  void LoadImmediately();
+
  private:
   // Starts validation of |policy| before storing it.
   void ValidatePolicyForStore(
diff --git a/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos_unittest.cc b/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos_unittest.cc
index a05504e..993f789 100644
--- a/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos_unittest.cc
+++ b/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos_unittest.cc
@@ -32,6 +32,7 @@
 using testing::Eq;
 using testing::Mock;
 using testing::Property;
+using testing::Return;
 using testing::SaveArg;
 using testing::_;
 
@@ -519,6 +520,104 @@
   EXPECT_FALSE(base::PathExists(policy_file()));
 }
 
+TEST_F(UserCloudPolicyStoreChromeOSTest, LoadImmediately) {
+  EXPECT_CALL(observer_, OnStoreLoaded(store_.get()));
+  EXPECT_CALL(session_manager_client_,
+              BlockingRetrievePolicyForUser(PolicyBuilder::kFakeUsername))
+      .WillOnce(Return(policy_.GetBlob()));
+  EXPECT_CALL(cryptohome_client_,
+              BlockingGetSanitizedUsername(PolicyBuilder::kFakeUsername))
+      .WillOnce(Return(kSanitizedUsername));
+
+  EXPECT_FALSE(store_->policy());
+  store_->LoadImmediately();
+  // Note: verify that the |observer_| got notified synchronously, without
+  // having to spin the current loop. TearDown() will flush the loop so this
+  // must be done within the test.
+  Mock::VerifyAndClearExpectations(&observer_);
+  Mock::VerifyAndClearExpectations(&session_manager_client_);
+  Mock::VerifyAndClearExpectations(&cryptohome_client_);
+
+  // The policy should become available without having to spin any loops.
+  ASSERT_TRUE(store_->policy());
+  EXPECT_EQ(policy_.policy_data().SerializeAsString(),
+            store_->policy()->SerializeAsString());
+  VerifyPolicyMap(kDefaultHomepage);
+  EXPECT_EQ(CloudPolicyStore::STATUS_OK, store_->status());
+}
+
+TEST_F(UserCloudPolicyStoreChromeOSTest, LoadImmediatelyNoPolicy) {
+  EXPECT_CALL(observer_, OnStoreLoaded(store_.get()));
+  EXPECT_CALL(session_manager_client_,
+              BlockingRetrievePolicyForUser(PolicyBuilder::kFakeUsername))
+      .WillOnce(Return(""));
+
+  EXPECT_FALSE(store_->policy());
+  store_->LoadImmediately();
+  Mock::VerifyAndClearExpectations(&observer_);
+  Mock::VerifyAndClearExpectations(&session_manager_client_);
+
+  EXPECT_FALSE(store_->policy());
+  EXPECT_TRUE(store_->policy_map().empty());
+  EXPECT_EQ(CloudPolicyStore::STATUS_OK, store_->status());
+}
+
+TEST_F(UserCloudPolicyStoreChromeOSTest, LoadImmediatelyInvalidBlob) {
+  EXPECT_CALL(observer_, OnStoreError(store_.get()));
+  EXPECT_CALL(session_manager_client_,
+              BlockingRetrievePolicyForUser(PolicyBuilder::kFakeUsername))
+      .WillOnce(Return("le blob"));
+
+  EXPECT_FALSE(store_->policy());
+  store_->LoadImmediately();
+  Mock::VerifyAndClearExpectations(&observer_);
+  Mock::VerifyAndClearExpectations(&session_manager_client_);
+
+  EXPECT_FALSE(store_->policy());
+  EXPECT_TRUE(store_->policy_map().empty());
+  EXPECT_EQ(CloudPolicyStore::STATUS_PARSE_ERROR, store_->status());
+}
+
+TEST_F(UserCloudPolicyStoreChromeOSTest, LoadImmediatelyDBusFailure) {
+  EXPECT_CALL(observer_, OnStoreError(store_.get()));
+  EXPECT_CALL(session_manager_client_,
+              BlockingRetrievePolicyForUser(PolicyBuilder::kFakeUsername))
+      .WillOnce(Return(policy_.GetBlob()));
+  EXPECT_CALL(cryptohome_client_,
+              BlockingGetSanitizedUsername(PolicyBuilder::kFakeUsername))
+      .WillOnce(Return(""));
+
+  EXPECT_FALSE(store_->policy());
+  store_->LoadImmediately();
+  Mock::VerifyAndClearExpectations(&observer_);
+  Mock::VerifyAndClearExpectations(&session_manager_client_);
+  Mock::VerifyAndClearExpectations(&cryptohome_client_);
+
+  EXPECT_FALSE(store_->policy());
+  EXPECT_TRUE(store_->policy_map().empty());
+  EXPECT_EQ(CloudPolicyStore::STATUS_LOAD_ERROR, store_->status());
+}
+
+TEST_F(UserCloudPolicyStoreChromeOSTest, LoadImmediatelyNoUserPolicyKey) {
+  EXPECT_CALL(observer_, OnStoreError(store_.get()));
+  EXPECT_CALL(session_manager_client_,
+              BlockingRetrievePolicyForUser(PolicyBuilder::kFakeUsername))
+      .WillOnce(Return(policy_.GetBlob()));
+  EXPECT_CALL(cryptohome_client_,
+              BlockingGetSanitizedUsername(PolicyBuilder::kFakeUsername))
+      .WillOnce(Return("wrong"));
+
+  EXPECT_FALSE(store_->policy());
+  store_->LoadImmediately();
+  Mock::VerifyAndClearExpectations(&observer_);
+  Mock::VerifyAndClearExpectations(&session_manager_client_);
+  Mock::VerifyAndClearExpectations(&cryptohome_client_);
+
+  EXPECT_FALSE(store_->policy());
+  EXPECT_TRUE(store_->policy_map().empty());
+  EXPECT_EQ(CloudPolicyStore::STATUS_VALIDATION_ERROR, store_->status());
+}
+
 }  // namespace
 
 }  // namespace policy
diff --git a/chrome/browser/chromeos/settings/device_settings_test_helper.cc b/chrome/browser/chromeos/settings/device_settings_test_helper.cc
index 6545edb..d99553a 100644
--- a/chrome/browser/chromeos/settings/device_settings_test_helper.cc
+++ b/chrome/browser/chromeos/settings/device_settings_test_helper.cc
@@ -138,6 +138,11 @@
     const RetrievePolicyCallback& callback) {
 }
 
+std::string DeviceSettingsTestHelper::BlockingRetrievePolicyForUser(
+    const std::string& username) {
+  return "";
+}
+
 void DeviceSettingsTestHelper::RetrieveDeviceLocalAccountPolicy(
     const std::string& account_id,
     const RetrievePolicyCallback& callback) {
diff --git a/chrome/browser/chromeos/settings/device_settings_test_helper.h b/chrome/browser/chromeos/settings/device_settings_test_helper.h
index ae7d52e..8e38806 100644
--- a/chrome/browser/chromeos/settings/device_settings_test_helper.h
+++ b/chrome/browser/chromeos/settings/device_settings_test_helper.h
@@ -99,6 +99,8 @@
   virtual void RetrievePolicyForUser(
       const std::string& username,
       const RetrievePolicyCallback& callback) OVERRIDE;
+  virtual std::string BlockingRetrievePolicyForUser(
+      const std::string& username) OVERRIDE;
   virtual void RetrieveDeviceLocalAccountPolicy(
       const std::string& account_id,
       const RetrievePolicyCallback& callback) OVERRIDE;
diff --git a/chrome/browser/chromeos/system/input_device_settings.cc b/chrome/browser/chromeos/system/input_device_settings.cc
index 09c17ae..48d3629 100644
--- a/chrome/browser/chromeos/system/input_device_settings.cc
+++ b/chrome/browser/chromeos/system/input_device_settings.cc
@@ -15,8 +15,9 @@
 #include "base/files/file_path.h"
 #include "base/memory/ref_counted.h"
 #include "base/message_loop/message_loop.h"
-#include "base/process.h"
-#include "base/process_util.h"
+#include "base/process/kill.h"
+#include "base/process/launch.h"
+#include "base/process/process_handle.h"
 #include "base/strings/stringprintf.h"
 #include "base/task_runner.h"
 #include "base/threading/sequenced_worker_pool.h"
diff --git a/chrome/browser/chromeos/system_logs/command_line_log_source.cc b/chrome/browser/chromeos/system_logs/command_line_log_source.cc
index 5781876..43b7651 100644
--- a/chrome/browser/chromeos/system_logs/command_line_log_source.cc
+++ b/chrome/browser/chromeos/system_logs/command_line_log_source.cc
@@ -11,7 +11,7 @@
 #include "base/command_line.h"
 #include "base/files/file_path.h"
 #include "base/logging.h"
-#include "base/process_util.h"
+#include "base/process/launch.h"
 #include "content/public/browser/browser_thread.h"
 
 using content::BrowserThread;
diff --git a/chrome/browser/component_updater/DEPS b/chrome/browser/component_updater/DEPS
index 37c1ed1..2c90430 100644
--- a/chrome/browser/component_updater/DEPS
+++ b/chrome/browser/component_updater/DEPS
@@ -1,3 +1,4 @@
 include_rules = [
+  "+ppapi/shared_impl/ppapi_permissions.h",
   "+third_party/widevine"
 ]
diff --git a/chrome/browser/component_updater/component_patcher_win.cc b/chrome/browser/component_updater/component_patcher_win.cc
index 76a72c5..d583819 100644
--- a/chrome/browser/component_updater/component_patcher_win.cc
+++ b/chrome/browser/component_updater/component_patcher_win.cc
@@ -10,7 +10,8 @@
 #include "base/command_line.h"
 #include "base/file_util.h"
 #include "base/path_service.h"
-#include "base/process_util.h"
+#include "base/process/kill.h"
+#include "base/process/launch.h"
 #include "base/strings/string_util.h"
 #include "base/win/scoped_handle.h"
 #include "chrome/installer/util/util_constants.h"
diff --git a/chrome/browser/component_updater/component_updater_service.cc b/chrome/browser/component_updater/component_updater_service.cc
index cd1ee8ef4..1a5bc76 100644
--- a/chrome/browser/component_updater/component_updater_service.cc
+++ b/chrome/browser/component_updater/component_updater_service.cc
@@ -30,7 +30,6 @@
 #include "chrome/common/chrome_utility_messages.h"
 #include "chrome/common/chrome_version_info.h"
 #include "chrome/common/extensions/extension.h"
-#include "chrome/common/omaha_query_params/omaha_query_params.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/notification_service.h"
 #include "content/public/browser/utility_process_host.h"
@@ -359,7 +358,6 @@
   base::OneShotTimer<CrxUpdateService> timer_;
 
   const Version chrome_version_;
-  const std::string prod_id_;
 
   bool running_;
 
@@ -375,8 +373,6 @@
           config->PingUrl(),
           config->RequestContext())),
       chrome_version_(chrome::VersionInfo().Version()),
-      prod_id_(chrome::OmahaQueryParams::GetProdIdString(
-          chrome::OmahaQueryParams::CHROME)),
       running_(false) {
  }
 
diff --git a/chrome/browser/component_updater/pepper_flash_component_installer.cc b/chrome/browser/component_updater/pepper_flash_component_installer.cc
index 0897fe6..d9ac58c 100644
--- a/chrome/browser/component_updater/pepper_flash_component_installer.cc
+++ b/chrome/browser/component_updater/pepper_flash_component_installer.cc
@@ -34,6 +34,7 @@
 #include "content/public/browser/plugin_service.h"
 #include "content/public/common/pepper_plugin_info.h"
 #include "ppapi/c/private/ppb_pdf.h"
+#include "ppapi/shared_impl/ppapi_permissions.h"
 #include "webkit/common/plugins/ppapi/ppapi_utils.h"
 #include "webkit/plugins/plugin_constants.h"
 
diff --git a/chrome/browser/component_updater/recovery_component_installer.cc b/chrome/browser/component_updater/recovery_component_installer.cc
index 625afd6..db620fe 100644
--- a/chrome/browser/component_updater/recovery_component_installer.cc
+++ b/chrome/browser/component_updater/recovery_component_installer.cc
@@ -14,7 +14,7 @@
 #include "base/path_service.h"
 #include "base/prefs/pref_registry_simple.h"
 #include "base/prefs/pref_service.h"
-#include "base/process_util.h"
+#include "base/process/launch.h"
 #include "base/strings/string_util.h"
 #include "base/values.h"
 #include "chrome/browser/component_updater/component_updater_service.h"
diff --git a/chrome/browser/devtools/adb/android_usb_device.cc b/chrome/browser/devtools/adb/android_usb_device.cc
index 9408328..a30b9e1 100644
--- a/chrome/browser/devtools/adb/android_usb_device.cc
+++ b/chrome/browser/devtools/adb/android_usb_device.cc
@@ -9,6 +9,7 @@
 #include "base/base64.h"
 #include "base/lazy_instance.h"
 #include "base/message_loop/message_loop.h"
+#include "base/strings/string_util.h"
 #include "base/strings/stringprintf.h"
 #include "chrome/browser/devtools/adb/android_rsa.h"
 #include "chrome/browser/devtools/adb/android_usb_socket.h"
@@ -40,54 +41,12 @@
 base::LazyInstance<AndroidUsbDevices>::Leaky g_devices =
     LAZY_INSTANCE_INITIALIZER;
 
-static std::string ReadSerialNumSync(libusb_device_handle* handle) {
-  libusb_device* device = libusb_get_device(handle);
-  libusb_device_descriptor descriptor;
-  if (libusb_get_device_descriptor(device, &descriptor) != LIBUSB_SUCCESS)
-    return std::string();
-
-  if (!descriptor.iSerialNumber)
-    return std::string();
-
-  uint16 languages[128] = {0};
-  memset(languages, 0, sizeof(languages));
-
-  int res = libusb_control_transfer(
-      handle,
-      LIBUSB_ENDPOINT_IN |  LIBUSB_REQUEST_TYPE_STANDARD |
-          LIBUSB_RECIPIENT_DEVICE,
-      LIBUSB_REQUEST_GET_DESCRIPTOR, LIBUSB_DT_STRING << 8, 0,
-      reinterpret_cast<uint8*>(languages), sizeof(languages), 0);
-
-  if (res <= 0) {
-    LOG(ERROR) << "Failed to get languages count";
-    return std::string();
-  }
-
-  int language_count = (res - 2) / 2;
-  uint16 buffer[128] = {0};
-  for (int i = 1; i <= language_count; ++i) {
-    memset(buffer, 0, sizeof(buffer));
-
-    res = libusb_control_transfer(
-        handle,
-        LIBUSB_ENDPOINT_IN |  LIBUSB_REQUEST_TYPE_STANDARD |
-            LIBUSB_RECIPIENT_DEVICE,
-        LIBUSB_REQUEST_GET_DESCRIPTOR,
-        (LIBUSB_DT_STRING << 8) | descriptor.iSerialNumber,
-        languages[i], reinterpret_cast<uint8*>(buffer), sizeof(buffer), 0);
-
-    if (res > 0) {
-        res /= 2;
-        char serial[256] = {0};
-        int j;
-        for (j = 1; j < res; ++j)
-          serial[j - 1] = buffer[j];
-        serial[j - 1] = '\0';
-        return std::string(serial, j);
-    }
-  }
-  return std::string();
+static std::string ReadSerialNumSync(scoped_refptr<UsbDeviceHandle> handle) {
+  base::string16 serial;
+  if (!handle->GetSerial(&serial))
+    return "";
+  else
+    return UTF16ToASCII(serial);
 }
 
 static void ClaimInterface(
@@ -130,7 +89,7 @@
   if (!usb_device->ClaimInterface(1))
     return;
 
-  std::string serial = ReadSerialNumSync(usb_device->handle());
+  std::string serial = ReadSerialNumSync(usb_device);
   scoped_refptr<AndroidUsbDevice> device =
       new AndroidUsbDevice(rsa_key, usb_device, serial, inbound_address,
                            outbound_address, zero_mask);
diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc
index b07cba9..37445e1 100644
--- a/chrome/browser/download/download_browsertest.cc
+++ b/chrome/browser/download/download_browsertest.cc
@@ -2804,8 +2804,6 @@
 
   // Get the infobar at index 0.
   InfoBarDelegate* infobar = infobar_service->infobar_at(0);
-  ASSERT_TRUE(infobar != NULL);
-
   ConfirmInfoBarDelegate* confirm_infobar = infobar->AsConfirmInfoBarDelegate();
   ASSERT_TRUE(confirm_infobar != NULL);
 
diff --git a/chrome/browser/download/download_target_determiner_unittest.cc b/chrome/browser/download/download_target_determiner_unittest.cc
index ed943f7..46a1803 100644
--- a/chrome/browser/download/download_target_determiner_unittest.cc
+++ b/chrome/browser/download/download_target_determiner_unittest.cc
@@ -1087,7 +1087,7 @@
                 base::FilePath(FILE_PATH_LITERAL("foo.html"))));
 
   // First the history service must exist.
-  profile()->CreateHistoryService(false, false);
+  ASSERT_TRUE(profile()->CreateHistoryService(false, false));
 
   GURL url("http://visited.example.com/visited-link.html");
   // The time of visit is picked to be several seconds prior to the most recent
diff --git a/chrome/browser/drive/drive_api_service.cc b/chrome/browser/drive/drive_api_service.cc
index 5526fbb..9c963bd 100644
--- a/chrome/browser/drive/drive_api_service.cc
+++ b/chrome/browser/drive/drive_api_service.cc
@@ -43,6 +43,8 @@
 using google_apis::GetFilelistRequest;
 using google_apis::GetResourceEntryCallback;
 using google_apis::GetResourceListCallback;
+using google_apis::GetShareUrlCallback;
+using google_apis::HTTP_NOT_IMPLEMENTED;
 using google_apis::HTTP_SUCCESS;
 using google_apis::InitiateUploadCallback;
 using google_apis::ProgressCallback;
@@ -461,6 +463,20 @@
       base::Bind(&ParseResourceEntryAndRun, callback)));
 }
 
+CancelCallback DriveAPIService::GetShareUrl(
+    const std::string& resource_id,
+    const GURL& embed_origin,
+    const GetShareUrlCallback& callback) {
+  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+  DCHECK(!callback.is_null());
+
+  // TODO(mtomasz): Implement this, once it is supported by the Drive API.
+  NOTIMPLEMENTED();
+  callback.Run(HTTP_NOT_IMPLEMENTED, GURL());
+
+  return CancelCallback();
+}
+
 CancelCallback DriveAPIService::GetAboutResource(
     const GetAboutResourceCallback& callback) {
   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
diff --git a/chrome/browser/drive/drive_api_service.h b/chrome/browser/drive/drive_api_service.h
index f2b2957..5c68586 100644
--- a/chrome/browser/drive/drive_api_service.h
+++ b/chrome/browser/drive/drive_api_service.h
@@ -89,6 +89,10 @@
   virtual google_apis::CancelCallback GetResourceEntry(
       const std::string& resource_id,
       const google_apis::GetResourceEntryCallback& callback) OVERRIDE;
+  virtual google_apis::CancelCallback GetShareUrl(
+      const std::string& resource_id,
+      const GURL& embed_origin,
+      const google_apis::GetShareUrlCallback& callback) OVERRIDE;
   virtual google_apis::CancelCallback GetAboutResource(
       const google_apis::GetAboutResourceCallback& callback) OVERRIDE;
   virtual google_apis::CancelCallback GetAppList(
diff --git a/chrome/browser/drive/drive_service_interface.h b/chrome/browser/drive/drive_service_interface.h
index 7774727..a0149f5 100644
--- a/chrome/browser/drive/drive_service_interface.h
+++ b/chrome/browser/drive/drive_service_interface.h
@@ -155,6 +155,15 @@
       const std::string& resource_id,
       const google_apis::GetResourceEntryCallback& callback) = 0;
 
+  // Fetches an url for the sharing dialog for a single entry with id
+  // |resource_id|, to be embedded in a webview or an iframe with origin
+  // |embed_origin|. The url is returned via |callback| with results on the
+  // calling thread. |callback| must not be null.
+  virtual google_apis::CancelCallback GetShareUrl(
+      const std::string& resource_id,
+      const GURL& embed_origin,
+      const google_apis::GetShareUrlCallback& callback) = 0;
+
   // Gets the about resource information from the server.
   // Upon completion, invokes |callback| with results on the calling thread.
   // |callback| must not be null.
diff --git a/chrome/browser/drive/dummy_drive_service.cc b/chrome/browser/drive/dummy_drive_service.cc
index 6d3d241..caf2d76 100644
--- a/chrome/browser/drive/dummy_drive_service.cc
+++ b/chrome/browser/drive/dummy_drive_service.cc
@@ -14,6 +14,7 @@
 using google_apis::GetContentCallback;
 using google_apis::GetResourceEntryCallback;
 using google_apis::GetResourceListCallback;
+using google_apis::GetShareUrlCallback;
 using google_apis::InitiateUploadCallback;
 using google_apis::ProgressCallback;
 using google_apis::UploadRangeCallback;
@@ -81,6 +82,11 @@
     const std::string& resource_id,
     const GetResourceEntryCallback& callback) { return CancelCallback(); }
 
+CancelCallback DummyDriveService::GetShareUrl(
+    const std::string& resource_id,
+    const GURL& embed_origin,
+    const GetShareUrlCallback& callback) { return CancelCallback(); }
+
 CancelCallback DummyDriveService::GetAboutResource(
     const GetAboutResourceCallback& callback) { return CancelCallback(); }
 
diff --git a/chrome/browser/drive/dummy_drive_service.h b/chrome/browser/drive/dummy_drive_service.h
index 8ebc922..315ad25 100644
--- a/chrome/browser/drive/dummy_drive_service.h
+++ b/chrome/browser/drive/dummy_drive_service.h
@@ -52,6 +52,10 @@
   virtual google_apis::CancelCallback GetResourceEntry(
       const std::string& resource_id,
       const google_apis::GetResourceEntryCallback& callback) OVERRIDE;
+  virtual google_apis::CancelCallback GetShareUrl(
+      const std::string& resource_id,
+      const GURL& embed_origin,
+      const google_apis::GetShareUrlCallback& callback) OVERRIDE;
   virtual google_apis::CancelCallback GetAboutResource(
       const google_apis::GetAboutResourceCallback& callback) OVERRIDE;
   virtual google_apis::CancelCallback GetAppList(
diff --git a/chrome/browser/drive/event_logger.cc b/chrome/browser/drive/event_logger.cc
index 630a6be..0ba4034 100644
--- a/chrome/browser/drive/event_logger.cc
+++ b/chrome/browser/drive/event_logger.cc
@@ -4,6 +4,7 @@
 
 #include "chrome/browser/drive/event_logger.h"
 
+#include "base/logging.h"
 #include "base/strings/stringprintf.h"
 
 namespace drive {
@@ -30,6 +31,8 @@
   base::StringAppendV(&what, format, args);
   va_end(args);
 
+  DVLOG(1) << what;
+
   base::AutoLock auto_lock(lock_);
   history_.push_back(Event(next_event_id_, what));
   ++next_event_id_;
diff --git a/chrome/browser/drive/fake_drive_service.cc b/chrome/browser/drive/fake_drive_service.cc
index 36808b3..6c92c98 100644
--- a/chrome/browser/drive/fake_drive_service.cc
+++ b/chrome/browser/drive/fake_drive_service.cc
@@ -42,6 +42,7 @@
 using google_apis::GetContentCallback;
 using google_apis::GetResourceEntryCallback;
 using google_apis::GetResourceListCallback;
+using google_apis::GetShareUrlCallback;
 using google_apis::HTTP_BAD_REQUEST;
 using google_apis::HTTP_CREATED;
 using google_apis::HTTP_NOT_FOUND;
@@ -460,6 +461,49 @@
   return CancelCallback();
 }
 
+CancelCallback FakeDriveService::GetShareUrl(
+    const std::string& resource_id,
+    const GURL& /* embed_origin */,
+    const GetShareUrlCallback& callback) {
+  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+  DCHECK(!callback.is_null());
+
+  if (offline_) {
+    scoped_ptr<ResourceEntry> null;
+    base::MessageLoop::current()->PostTask(
+        FROM_HERE,
+        base::Bind(callback,
+                   GDATA_NO_CONNECTION,
+                   GURL()));
+    return CancelCallback();
+  }
+
+  base::DictionaryValue* entry = FindEntryByResourceId(resource_id);
+  if (entry) {
+    // Share urls are stored in the resource entry, and they do not rely on the
+    // embedding origin.
+    scoped_ptr<ResourceEntry> resource_entry =
+        ResourceEntry::CreateFrom(*entry);
+    const Link* share_url = resource_entry->GetLinkByType(Link::LINK_SHARE);
+    if (share_url) {
+      base::MessageLoop::current()->PostTask(
+          FROM_HERE,
+          base::Bind(callback, HTTP_SUCCESS, share_url->href()));
+    } else {
+      base::MessageLoop::current()->PostTask(
+          FROM_HERE,
+          base::Bind(callback, HTTP_SUCCESS, GURL()));
+    }
+    return CancelCallback();
+  }
+
+  scoped_ptr<ResourceEntry> null;
+  base::MessageLoop::current()->PostTask(
+      FROM_HERE,
+      base::Bind(callback, HTTP_NOT_FOUND, GURL()));
+  return CancelCallback();
+}
+
 CancelCallback FakeDriveService::GetAboutResource(
     const GetAboutResourceCallback& callback) {
   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
diff --git a/chrome/browser/drive/fake_drive_service.h b/chrome/browser/drive/fake_drive_service.h
index 369eaa0..52fdfc6 100644
--- a/chrome/browser/drive/fake_drive_service.h
+++ b/chrome/browser/drive/fake_drive_service.h
@@ -114,6 +114,10 @@
   virtual google_apis::CancelCallback GetResourceEntry(
       const std::string& resource_id,
       const google_apis::GetResourceEntryCallback& callback) OVERRIDE;
+  virtual google_apis::CancelCallback GetShareUrl(
+      const std::string& resource_id,
+      const GURL& embed_origin,
+      const google_apis::GetShareUrlCallback& callback) OVERRIDE;
   virtual google_apis::CancelCallback GetAboutResource(
       const google_apis::GetAboutResourceCallback& callback) OVERRIDE;
   virtual google_apis::CancelCallback GetAppList(
diff --git a/chrome/browser/drive/fake_drive_service_unittest.cc b/chrome/browser/drive/fake_drive_service_unittest.cc
index 7104094..ea988fe 100644
--- a/chrome/browser/drive/fake_drive_service_unittest.cc
+++ b/chrome/browser/drive/fake_drive_service_unittest.cc
@@ -806,6 +806,23 @@
   EXPECT_FALSE(resource_entry);
 }
 
+TEST_F(FakeDriveServiceTest, GetShareUrl) {
+  ASSERT_TRUE(fake_service_.LoadResourceListForWapi(
+      "gdata/root_feed.json"));
+
+  const std::string kResourceId = "file:2_file_resource_id";
+  GDataErrorCode error = GDATA_OTHER_ERROR;
+  GURL share_url;
+  fake_service_.GetShareUrl(
+      kResourceId,
+      GURL(),  // embed origin
+      test_util::CreateCopyResultCallback(&error, &share_url));
+  base::RunLoop().RunUntilIdle();
+
+  EXPECT_EQ(HTTP_SUCCESS, error);
+  EXPECT_FALSE(share_url.is_empty());
+}
+
 TEST_F(FakeDriveServiceTest, DeleteResource_ExistingFile) {
   ASSERT_TRUE(fake_service_.LoadResourceListForWapi(
       "gdata/root_feed.json"));
diff --git a/chrome/browser/drive/gdata_wapi_service.cc b/chrome/browser/drive/gdata_wapi_service.cc
index 239e888..d4e0b90 100644
--- a/chrome/browser/drive/gdata_wapi_service.cc
+++ b/chrome/browser/drive/gdata_wapi_service.cc
@@ -46,11 +46,13 @@
 using google_apis::GetResourceEntryRequest;
 using google_apis::GetResourceListCallback;
 using google_apis::GetResourceListRequest;
+using google_apis::GetShareUrlCallback;
 using google_apis::GetUploadStatusRequest;
 using google_apis::HTTP_NOT_IMPLEMENTED;
 using google_apis::InitiateUploadCallback;
 using google_apis::InitiateUploadExistingFileRequest;
 using google_apis::InitiateUploadNewFileRequest;
+using google_apis::Link;
 using google_apis::ProgressCallback;
 using google_apis::RemoveResourceFromDirectoryRequest;
 using google_apis::RenameResourceRequest;
@@ -96,6 +98,30 @@
   callback.Run(error, entry.Pass());
 }
 
+// Extracts an url to the sharing dialog and returns it via |callback|. If
+// the share url doesn't exist, then an empty url is returned.
+void ParseShareUrlAndRun(const GetShareUrlCallback& callback,
+                         GDataErrorCode error,
+                         scoped_ptr<base::Value> value) {
+  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+  if (!value) {
+    callback.Run(error, GURL());
+    return;
+  }
+
+  // Parsing ResourceEntry is cheap enough to do on UI thread.
+  scoped_ptr<ResourceEntry> entry =
+      google_apis::ResourceEntry::ExtractAndParse(*value);
+  if (!entry) {
+    callback.Run(GDATA_PARSE_ERROR, GURL());
+    return;
+  }
+
+  const Link* share_link = entry->GetLinkByType(Link::LINK_SHARE);
+  callback.Run(error, share_link ? share_link->href() : GURL());
+}
+
 void ParseAboutResourceAndRun(
     const GetAboutResourceCallback& callback,
     GDataErrorCode error,
@@ -301,10 +327,27 @@
       new GetResourceEntryRequest(sender_.get(),
                                   url_generator_,
                                   resource_id,
+                                  GURL(),
                                   base::Bind(&ParseResourceEntryAndRun,
                                              callback)));
 }
 
+CancelCallback GDataWapiService::GetShareUrl(
+    const std::string& resource_id,
+    const GURL& embed_origin,
+    const GetShareUrlCallback& callback) {
+  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+  DCHECK(!callback.is_null());
+
+  return sender_->StartRequestWithRetry(
+      new GetResourceEntryRequest(sender_.get(),
+                                  url_generator_,
+                                  resource_id,
+                                  embed_origin,
+                                  base::Bind(&ParseShareUrlAndRun,
+                                             callback)));
+}
+
 CancelCallback GDataWapiService::GetAboutResource(
     const GetAboutResourceCallback& callback) {
   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
diff --git a/chrome/browser/drive/gdata_wapi_service.h b/chrome/browser/drive/gdata_wapi_service.h
index 297c154..11294e9 100644
--- a/chrome/browser/drive/gdata_wapi_service.h
+++ b/chrome/browser/drive/gdata_wapi_service.h
@@ -90,6 +90,10 @@
   virtual google_apis::CancelCallback GetResourceEntry(
       const std::string& resource_id,
       const google_apis::GetResourceEntryCallback& callback) OVERRIDE;
+  virtual google_apis::CancelCallback GetShareUrl(
+      const std::string& resource_id,
+      const GURL& embed_origin,
+      const google_apis::GetShareUrlCallback& callback) OVERRIDE;
   virtual google_apis::CancelCallback GetAboutResource(
       const google_apis::GetAboutResourceCallback& callback) OVERRIDE;
   virtual google_apis::CancelCallback GetAppList(
diff --git a/chrome/browser/extensions/api/debugger/debugger_api.cc b/chrome/browser/extensions/api/debugger/debugger_api.cc
index b1d8962..f29ea9a 100644
--- a/chrome/browser/extensions/api/debugger/debugger_api.cc
+++ b/chrome/browser/extensions/api/debugger/debugger_api.cc
@@ -566,15 +566,14 @@
     return false;
   }
 
-  ExtensionDevToolsInfoBarDelegate* infobar_delegate = NULL;
-
+  ExtensionDevToolsInfoBarDelegate* infobar = NULL;
   if (!CommandLine::ForCurrentProcess()->
        HasSwitch(switches::kSilentDebuggerExtensionAPI)) {
     // Do not attach to the target if for any reason the infobar cannot be shown
     // for this WebContents instance.
-    infobar_delegate = ExtensionDevToolsInfoBarDelegate::Create(
+    infobar = ExtensionDevToolsInfoBarDelegate::Create(
           agent_host_->GetRenderViewHost(), GetExtension()->name());
-    if (!infobar_delegate) {
+    if (!infobar) {
       error_ = ErrorUtils::FormatErrorMessage(
           keys::kSilentDebuggingRequired,
           switches::kSilentDebuggerExtensionAPI);
@@ -582,12 +581,9 @@
     }
   }
 
-  new ExtensionDevToolsClientHost(profile(),
-                                  agent_host_.get(),
-                                  GetExtension()->id(),
-                                  GetExtension()->name(),
-                                  debuggee_,
-                                  infobar_delegate);
+  new ExtensionDevToolsClientHost(profile(), agent_host_.get(),
+                                  GetExtension()->id(), GetExtension()->name(),
+                                  debuggee_, infobar);
   SendResponse(true);
   return true;
 }
diff --git a/chrome/browser/extensions/api/messaging/native_message_process_host.cc b/chrome/browser/extensions/api/messaging/native_message_process_host.cc
index b39ea79..749cb43 100644
--- a/chrome/browser/extensions/api/messaging/native_message_process_host.cc
+++ b/chrome/browser/extensions/api/messaging/native_message_process_host.cc
@@ -8,7 +8,6 @@
 #include "base/files/file_path.h"
 #include "base/logging.h"
 #include "base/platform_file.h"
-#include "base/process_util.h"
 #include "base/values.h"
 #include "chrome/browser/extensions/api/messaging/native_messaging_host_manifest.h"
 #include "chrome/browser/extensions/api/messaging/native_process_launcher.h"
diff --git a/chrome/browser/extensions/api/messaging/native_message_process_host.h b/chrome/browser/extensions/api/messaging/native_message_process_host.h
index c4692f1..8458b28 100644
--- a/chrome/browser/extensions/api/messaging/native_message_process_host.h
+++ b/chrome/browser/extensions/api/messaging/native_message_process_host.h
@@ -11,7 +11,7 @@
 #include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/message_loop/message_loop.h"
-#include "base/process.h"
+#include "base/process/process.h"
 #include "chrome/browser/extensions/api/messaging/native_process_launcher.h"
 #include "content/public/browser/browser_thread.h"
 
diff --git a/chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc b/chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc
index 5fd9338..8653d10 100644
--- a/chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc
+++ b/chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc
@@ -13,7 +13,6 @@
 #include "base/message_loop/message_loop.h"
 #include "base/path_service.h"
 #include "base/platform_file.h"
-#include "base/process_util.h"
 #include "base/run_loop.h"
 #include "base/strings/stringprintf.h"
 #include "base/test/test_timeouts.h"
diff --git a/chrome/browser/extensions/api/messaging/native_process_launcher.cc b/chrome/browser/extensions/api/messaging/native_process_launcher.cc
index a10801e..654158a 100644
--- a/chrome/browser/extensions/api/messaging/native_process_launcher.cc
+++ b/chrome/browser/extensions/api/messaging/native_process_launcher.cc
@@ -11,7 +11,6 @@
 #include "base/logging.h"
 #include "base/memory/ref_counted.h"
 #include "base/path_service.h"
-#include "base/process_util.h"
 #include "base/strings/string_split.h"
 #include "base/threading/sequenced_worker_pool.h"
 #include "chrome/browser/extensions/api/messaging/native_messaging_host_manifest.h"
diff --git a/chrome/browser/extensions/api/messaging/native_process_launcher.h b/chrome/browser/extensions/api/messaging/native_process_launcher.h
index aff6c87..0f5122bd 100644
--- a/chrome/browser/extensions/api/messaging/native_process_launcher.h
+++ b/chrome/browser/extensions/api/messaging/native_process_launcher.h
@@ -8,7 +8,7 @@
 #include "base/callback_forward.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/platform_file.h"
-#include "base/process.h"
+#include "base/process/process.h"
 
 class CommandLine;
 class GURL;
diff --git a/chrome/browser/extensions/api/messaging/native_process_launcher_posix.cc b/chrome/browser/extensions/api/messaging/native_process_launcher_posix.cc
index 411fb02..3cc4bc6 100644
--- a/chrome/browser/extensions/api/messaging/native_process_launcher_posix.cc
+++ b/chrome/browser/extensions/api/messaging/native_process_launcher_posix.cc
@@ -8,7 +8,7 @@
 #include "base/file_util.h"
 #include "base/logging.h"
 #include "base/posix/eintr_wrapper.h"
-#include "base/process_util.h"
+#include "base/process/launch.h"
 #include "chrome/browser/extensions/api/messaging/native_messaging_host_manifest.h"
 
 namespace extensions {
diff --git a/chrome/browser/extensions/api/messaging/native_process_launcher_win.cc b/chrome/browser/extensions/api/messaging/native_process_launcher_win.cc
index 70d0fd6..0eed352 100644
--- a/chrome/browser/extensions/api/messaging/native_process_launcher_win.cc
+++ b/chrome/browser/extensions/api/messaging/native_process_launcher_win.cc
@@ -8,7 +8,8 @@
 
 #include "base/command_line.h"
 #include "base/logging.h"
-#include "base/process_util.h"
+#include "base/process/kill.h"
+#include "base/process/launch.h"
 #include "base/strings/string16.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/stringprintf.h"
diff --git a/chrome/browser/extensions/api/omnibox/omnibox_api.cc b/chrome/browser/extensions/api/omnibox/omnibox_api.cc
index 64066db..9a07ee9 100644
--- a/chrome/browser/extensions/api/omnibox/omnibox_api.cc
+++ b/chrome/browser/extensions/api/omnibox/omnibox_api.cc
@@ -242,8 +242,10 @@
       }
     }
   } else if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) {
+    if (content::Details<UnloadedExtensionInfo>(details)->already_disabled)
+      return;
     const Extension* extension =
-        content::Details<const UnloadedExtensionInfo>(details)->extension;
+        content::Details<UnloadedExtensionInfo>(details)->extension;
     if (!OmniboxInfo::GetKeyword(extension).empty()) {
       if (url_service_) {
         if (url_service_->loaded())
diff --git a/chrome/browser/extensions/api/record/record_api.cc b/chrome/browser/extensions/api/record/record_api.cc
index 820c346..b381316 100644
--- a/chrome/browser/extensions/api/record/record_api.cc
+++ b/chrome/browser/extensions/api/record/record_api.cc
@@ -9,7 +9,8 @@
 #include "base/file_util.h"
 #include "base/logging.h"
 #include "base/memory/ref_counted.h"
-#include "base/process_util.h"
+#include "base/process/kill.h"
+#include "base/process/launch.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_split.h"
 #include "base/strings/string_util.h"
diff --git a/chrome/browser/extensions/api/system_info_storage/system_info_storage_apitest.cc b/chrome/browser/extensions/api/system_info_storage/system_info_storage_apitest.cc
index 671f628..cd8207d 100644
--- a/chrome/browser/extensions/api/system_info_storage/system_info_storage_apitest.cc
+++ b/chrome/browser/extensions/api/system_info_storage/system_info_storage_apitest.cc
@@ -1,10 +1,10 @@
 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
+
 #include "base/command_line.h"
 #include "base/message_loop/message_loop.h"
 #include "base/strings/utf_string_conversions.h"
-#include "base/timer/timer.h"
 #include "chrome/browser/extensions/api/system_info_storage/storage_info_provider.h"
 #include "chrome/browser/extensions/api/system_info_storage/test_storage_info_provider.h"
 #include "chrome/browser/extensions/extension_apitest.h"
@@ -27,7 +27,7 @@
 using extensions::TestStorageUnitInfo;
 using extensions::TestStorageInfoProvider;
 
-struct TestStorageUnitInfo kTestingData[] = {
+const struct TestStorageUnitInfo kTestingData[] = {
   {"dcim:device:0004", "transient:0004", "0xbeaf", kStorageTypeUnknown,
     4098, 1000, 0},
   {"path:device:002", "transient:002", "/home", kStorageTypeFixed,
@@ -36,14 +36,14 @@
     10000, 1000, 4097}
 };
 
-struct TestStorageUnitInfo kRemovableStorageData[] = {
+const struct TestStorageUnitInfo kRemovableStorageData[] = {
   {"dcim:device:0004", "transient:0004", "/media/usb1",
     kStorageTypeRemovable, 4098, 1000, 1}
 };
 
 }  // namespace
 
-class SystemInfoStorageApiTest: public ExtensionApiTest {
+class SystemInfoStorageApiTest : public ExtensionApiTest {
  public:
   SystemInfoStorageApiTest() {}
   virtual ~SystemInfoStorageApiTest() {}
@@ -59,8 +59,7 @@
   }
 
   void AttachRemovableStorage(const std::string& device_id) {
-    size_t len = arraysize(kRemovableStorageData);
-    for (size_t i = 0; i < len; ++i) {
+    for (size_t i = 0; i < arraysize(kRemovableStorageData); ++i) {
       if (kRemovableStorageData[i].device_id != device_id)
         continue;
 
diff --git a/chrome/browser/extensions/data_deleter.cc b/chrome/browser/extensions/data_deleter.cc
index 46518b0..8c8fe4f 100644
--- a/chrome/browser/extensions/data_deleter.cc
+++ b/chrome/browser/extensions/data_deleter.cc
@@ -41,16 +41,19 @@
     // preserve this code path without checking for isolation because it's
     // simpler than special casing.  This code should go away once we merge
     // the various URLRequestContexts (http://crbug.com/159193).
-    partition->AsyncClearDataForOrigin(
+    partition->ClearDataForOrigin(
+        content::StoragePartition::REMOVE_DATA_MASK_ALL,
         content::StoragePartition::kAllStorage,
         storage_origin,
         profile->GetRequestContextForExtensions());
   } else {
     // We don't need to worry about the media request context because that
     // shares the same cookie store as the main request context.
-    partition->AsyncClearDataForOrigin(content::StoragePartition::kAllStorage,
-                                       storage_origin,
-                                       partition->GetURLRequestContext());
+    partition->ClearDataForOrigin(
+        content::StoragePartition::REMOVE_DATA_MASK_ALL,
+        content::StoragePartition::kAllStorage,
+        storage_origin,
+        partition->GetURLRequestContext());
   }
 
   // Begin removal of the settings for the current extension.
diff --git a/chrome/browser/extensions/extension_crash_recovery_browsertest.cc b/chrome/browser/extensions/extension_crash_recovery_browsertest.cc
index 5ca5607..42956ca 100644
--- a/chrome/browser/extensions/extension_crash_recovery_browsertest.cc
+++ b/chrome/browser/extensions/extension_crash_recovery_browsertest.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/process_util.h"
 #include "chrome/browser/browser_process.h"
 #include "chrome/browser/extensions/extension_browsertest.h"
 #include "chrome/browser/extensions/extension_host.h"
diff --git a/chrome/browser/extensions/extension_function.h b/chrome/browser/extensions/extension_function.h
index 4afc40d..8ffee2e 100644
--- a/chrome/browser/extensions/extension_function.h
+++ b/chrome/browser/extensions/extension_function.h
@@ -13,7 +13,7 @@
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
-#include "base/process.h"
+#include "base/process/process.h"
 #include "base/sequenced_task_runner_helpers.h"
 #include "chrome/browser/extensions/extension_function_histogram_value.h"
 #include "chrome/browser/extensions/extension_info_map.h"
diff --git a/chrome/browser/extensions/extension_function_dispatcher.cc b/chrome/browser/extensions/extension_function_dispatcher.cc
index 47241e9..1109652 100644
--- a/chrome/browser/extensions/extension_function_dispatcher.cc
+++ b/chrome/browser/extensions/extension_function_dispatcher.cc
@@ -9,8 +9,7 @@
 #include "base/lazy_instance.h"
 #include "base/logging.h"
 #include "base/memory/ref_counted.h"
-#include "base/process.h"
-#include "base/process_util.h"
+#include "base/process/process.h"
 #include "base/values.h"
 #include "build/build_config.h"
 #include "chrome/browser/extensions/activity_log/activity_log.h"
diff --git a/chrome/browser/extensions/extension_function_histogram_value.h b/chrome/browser/extensions/extension_function_histogram_value.h
index f9123fd..77da406 100644
--- a/chrome/browser/extensions/extension_function_histogram_value.h
+++ b/chrome/browser/extensions/extension_function_histogram_value.h
@@ -571,6 +571,7 @@
   SYSTEM_DISPLAY_GETINFO,
   SYSTEM_DISPLAY_SETDISPLAYPROPERTIES,
   SYSTEM_MEMORY_GETINFO,
+  FILEBROWSERPRIVATE_GETSHAREURL,
   ENUM_BOUNDARY // Last entry: Add new entries above.
 };
 
diff --git a/chrome/browser/extensions/extension_protocols.cc b/chrome/browser/extensions/extension_protocols.cc
index 2385d0e..fdafe9f 100644
--- a/chrome/browser/extensions/extension_protocols.cc
+++ b/chrome/browser/extensions/extension_protocols.cc
@@ -74,7 +74,7 @@
   if (!last_modified_time.is_null()) {
     // Hash the time and make an etag to avoid exposing the exact
     // user installation time of the extension.
-    std::string hash = base::StringPrintf("%"PRId64"",
+    std::string hash = base::StringPrintf("%" PRId64,
                                           last_modified_time.ToInternalValue());
     hash = base::SHA1HashString(hash);
     std::string etag;
diff --git a/chrome/browser/extensions/extension_url_rewrite_browsertest.cc b/chrome/browser/extensions/extension_url_rewrite_browsertest.cc
index 0764187..0eb343f 100644
--- a/chrome/browser/extensions/extension_url_rewrite_browsertest.cc
+++ b/chrome/browser/extensions/extension_url_rewrite_browsertest.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/process_util.h"
 #include "base/strings/sys_string_conversions.h"
 #include "base/strings/utf_string_conversions.h"
 #include "chrome/browser/extensions/component_loader.h"
diff --git a/chrome/browser/extensions/extension_web_ui_override_registrar.cc b/chrome/browser/extensions/extension_web_ui_override_registrar.cc
index aab0a03..8ce1f8b 100644
--- a/chrome/browser/extensions/extension_web_ui_override_registrar.cc
+++ b/chrome/browser/extensions/extension_web_ui_override_registrar.cc
@@ -35,8 +35,10 @@
         profile_, URLOverrides::GetChromeURLOverrides(extension));
 
   } else if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) {
+    if (content::Details<UnloadedExtensionInfo>(details)->already_disabled)
+      return;
     const Extension* extension =
-        content::Details<const UnloadedExtensionInfo>(details)->extension;
+        content::Details<UnloadedExtensionInfo>(details)->extension;
     ExtensionWebUI::UnregisterChromeURLOverrides(
         profile_, URLOverrides::GetChromeURLOverrides(extension));
   }
diff --git a/chrome/browser/extensions/extensions_quota_service_unittest.cc b/chrome/browser/extensions/extensions_quota_service_unittest.cc
index 9cb6fdc..a0438ff 100644
--- a/chrome/browser/extensions/extensions_quota_service_unittest.cc
+++ b/chrome/browser/extensions/extensions_quota_service_unittest.cc
@@ -3,7 +3,7 @@
 // found in the LICENSE file.
 
 #include "base/message_loop/message_loop.h"
-#include "base/process.h"
+#include "base/process/process.h"
 #include "base/stl_util.h"
 #include "base/strings/string_util.h"
 #include "chrome/browser/extensions/extension_function.h"
diff --git a/chrome/browser/extensions/external_loader.cc b/chrome/browser/extensions/external_loader.cc
index e64d51a..c706a43 100644
--- a/chrome/browser/extensions/external_loader.cc
+++ b/chrome/browser/extensions/external_loader.cc
@@ -14,8 +14,7 @@
 namespace extensions {
 
 ExternalLoader::ExternalLoader()
-    : owner_(NULL),
-      running_(false) {
+    : owner_(NULL) {
 }
 
 void ExternalLoader::Init(ExternalProviderImpl* owner) {
@@ -40,7 +39,6 @@
 
 void ExternalLoader::LoadFinished() {
   CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-  running_ = false;
   if (owner_) {
     owner_->SetPrefs(prefs_.release());
   }
diff --git a/chrome/browser/extensions/external_loader.h b/chrome/browser/extensions/external_loader.h
index 1215836..86ffee3 100644
--- a/chrome/browser/extensions/external_loader.h
+++ b/chrome/browser/extensions/external_loader.h
@@ -71,10 +71,6 @@
 
   ExternalProviderImpl* owner_;  // weak
 
-  // Set to true if loading the extensions is already running. New requests
-  // are ignored while this is set true.
-  bool running_;
-
   DISALLOW_COPY_AND_ASSIGN(ExternalLoader);
 };
 
diff --git a/chrome/browser/extensions/gtalk_extension_browsertest.cc b/chrome/browser/extensions/gtalk_extension_browsertest.cc
index 94a5ecd..42e4ecc 100644
--- a/chrome/browser/extensions/gtalk_extension_browsertest.cc
+++ b/chrome/browser/extensions/gtalk_extension_browsertest.cc
@@ -3,7 +3,6 @@
 // found in the LICENSE file.
 
 #include "base/bind.h"
-#include "base/process_util.h"
 #include "chrome/browser/browser_process.h"
 #include "chrome/browser/chrome_notification_types.h"
 #include "chrome/browser/extensions/extension_browsertest.h"
diff --git a/chrome/browser/extensions/platform_app_launcher.cc b/chrome/browser/extensions/platform_app_launcher.cc
index 66d1133..19356ee 100644
--- a/chrome/browser/extensions/platform_app_launcher.cc
+++ b/chrome/browser/extensions/platform_app_launcher.cc
@@ -288,9 +288,8 @@
   // On Windows 8's single window Metro mode we can not launch platform apps.
   // Offer to switch Chrome to desktop mode.
   if (win8::IsSingleWindowMetroMode()) {
-    chrome::AppMetroInfoBarDelegateWin::Create(
-        profile,
-        chrome::AppMetroInfoBarDelegateWin::LAUNCH_PACKAGED_APP,
+    AppMetroInfoBarDelegateWin::Create(
+        profile, AppMetroInfoBarDelegateWin::LAUNCH_PACKAGED_APP,
         extension->id());
     return;
   }
diff --git a/chrome/browser/first_run/first_run_internal_win.cc b/chrome/browser/first_run/first_run_internal_win.cc
index 5cb5228..e87ba72 100644
--- a/chrome/browser/first_run/first_run_internal_win.cc
+++ b/chrome/browser/first_run/first_run_internal_win.cc
@@ -13,8 +13,9 @@
 #include "base/file_util.h"
 #include "base/files/file_path.h"
 #include "base/path_service.h"
-#include "base/process.h"
-#include "base/process_util.h"
+#include "base/process/kill.h"
+#include "base/process/launch.h"
+#include "base/process/process.h"
 #include "base/threading/sequenced_worker_pool.h"
 #include "base/time/time.h"
 #include "base/win/metro.h"
diff --git a/chrome/browser/first_run/upgrade_util_linux.cc b/chrome/browser/first_run/upgrade_util_linux.cc
index 22b252c..8d6d8a9 100644
--- a/chrome/browser/first_run/upgrade_util_linux.cc
+++ b/chrome/browser/first_run/upgrade_util_linux.cc
@@ -11,7 +11,7 @@
 #include "base/logging.h"
 #include "base/path_service.h"
 #include "base/platform_file.h"
-#include "base/process_util.h"
+#include "base/process/launch.h"
 #include "chrome/browser/first_run/upgrade_util_linux.h"
 
 namespace {
diff --git a/chrome/browser/first_run/upgrade_util_win.cc b/chrome/browser/first_run/upgrade_util_win.cc
index c669aa0..5361146 100644
--- a/chrome/browser/first_run/upgrade_util_win.cc
+++ b/chrome/browser/first_run/upgrade_util_win.cc
@@ -17,7 +17,8 @@
 #include "base/files/file_path.h"
 #include "base/logging.h"
 #include "base/path_service.h"
-#include "base/process_util.h"
+#include "base/process/launch.h"
+#include "base/process/process_handle.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_util.h"
 #include "base/strings/stringprintf.h"
diff --git a/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc b/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc
index 7a1c0e5..a7687c2 100644
--- a/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc
+++ b/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc
@@ -406,7 +406,7 @@
   ConfirmInfoBarDelegate* infobar_delegate =
       infobar_service()->infobar_at(0)->AsConfirmInfoBarDelegate();
   ASSERT_TRUE(infobar_delegate);
-  // Accept the frame
+  // Accept the frame.
   infobar_delegate->Accept();
   CheckTabContentsState(requesting_frame, CONTENT_SETTING_ALLOW);
   CheckPermissionMessageSent(0, true);
@@ -613,9 +613,7 @@
   RequestGeolocationPermission(RequestID(1), requesting_frame_1);
   // Ensure only one infobar is created.
   ASSERT_EQ(1U, infobar_service()->infobar_count());
-  ConfirmInfoBarDelegate* infobar =
-      infobar_service()->infobar_at(0)->AsConfirmInfoBarDelegate();
-  ASSERT_TRUE(infobar);
+  InfoBarDelegate* infobar = infobar_service()->infobar_at(0);
 
   // Delete the tab contents.
   DeleteContents();
diff --git a/chrome/browser/google_apis/base_requests.cc b/chrome/browser/google_apis/base_requests.cc
index 8963eb9..2dbadde 100644
--- a/chrome/browser/google_apis/base_requests.cc
+++ b/chrome/browser/google_apis/base_requests.cc
@@ -490,8 +490,9 @@
                            scoped_ptr<base::Value>());
 
     OnProcessURLFetchResultsComplete(true);
-  } else {
-    // There might be explanation of unexpected error code in response.
+  } else if (code == HTTP_CREATED || code == HTTP_SUCCESS) {
+    // The upload is successfully done. Parse the response which should be
+    // the entry's metadata.
     std::string response_content;
     source->GetResponseAsString(&response_content);
 
@@ -500,16 +501,21 @@
               base::Bind(&UploadRangeRequestBase::OnDataParsed,
                          weak_ptr_factory_.GetWeakPtr(),
                          code));
+  } else {
+    // Failed to upload. Run callbacks to notify the error.
+    OnRangeRequestComplete(
+        UploadRangeResponse(code, -1, -1), scoped_ptr<base::Value>());
+    OnProcessURLFetchResultsComplete(false);
   }
 }
 
 void UploadRangeRequestBase::OnDataParsed(GDataErrorCode code,
                                           scoped_ptr<base::Value> value) {
   DCHECK(CalledOnValidThread());
+  DCHECK(code == HTTP_CREATED || code == HTTP_SUCCESS);
 
   OnRangeRequestComplete(UploadRangeResponse(code, -1, -1), value.Pass());
-  OnProcessURLFetchResultsComplete(
-      code == HTTP_CREATED || code == HTTP_SUCCESS);
+  OnProcessURLFetchResultsComplete(true);
 }
 
 void UploadRangeRequestBase::RunCallbackOnPrematureFailure(
diff --git a/chrome/browser/google_apis/drive_api_requests_unittest.cc b/chrome/browser/google_apis/drive_api_requests_unittest.cc
index 050e757..bdba3d8 100644
--- a/chrome/browser/google_apis/drive_api_requests_unittest.cc
+++ b/chrome/browser/google_apis/drive_api_requests_unittest.cc
@@ -68,6 +68,9 @@
         base::Bind(&DriveApiRequestsTest::HandleDataFileRequest,
                    base::Unretained(this)));
     test_server_.RegisterRequestHandler(
+        base::Bind(&DriveApiRequestsTest::HandlePreconditionFailedRequest,
+                   base::Unretained(this)));
+    test_server_.RegisterRequestHandler(
         base::Bind(&DriveApiRequestsTest::HandleResumeUploadRequest,
                    base::Unretained(this)));
     test_server_.RegisterRequestHandler(
@@ -105,6 +108,10 @@
   // for initiating file uploading.
   std::string expected_upload_path_;
 
+  // This is a path to the file which contains expected response for
+  // PRECONDITION_FAILED response.
+  base::FilePath expected_precondition_failed_file_path_;
+
   // These are content and its type in the expected response from the server.
   // See also HandleContentResponse below.
   std::string expected_content_type_;
@@ -162,6 +169,33 @@
         expected_data_file_path_).PassAs<net::test_server::HttpResponse>();
   }
 
+  // Returns PRECONDITION_FAILED response for ETag mismatching with error JSON
+  // content specified by |expected_precondition_failed_file_path_|.
+  // To use this method, it is necessary to set the variable to the appropriate
+  // file path before sending the request to the server.
+  scoped_ptr<net::test_server::HttpResponse> HandlePreconditionFailedRequest(
+      const net::test_server::HttpRequest& request) {
+    if (expected_precondition_failed_file_path_.empty()) {
+      // The file is not specified. Delegate the process to the next handler.
+      return scoped_ptr<net::test_server::HttpResponse>();
+    }
+
+    http_request_ = request;
+
+    scoped_ptr<net::test_server::BasicHttpResponse> response(
+        new net::test_server::BasicHttpResponse);
+    response->set_code(net::HTTP_PRECONDITION_FAILED);
+
+    std::string content;
+    if (file_util::ReadFileToString(expected_precondition_failed_file_path_,
+                                    &content)) {
+      response->set_content(content);
+      response->set_content_type("application/json");
+    }
+
+    return response.PassAs<net::test_server::HttpResponse>();
+  }
+
   // Returns the response based on set expected upload url.
   // The response contains the url in its "Location: " header. Also, it doesn't
   // have any content.
@@ -181,19 +215,10 @@
     scoped_ptr<net::test_server::BasicHttpResponse> response(
         new net::test_server::BasicHttpResponse);
 
-    // Check an ETag.
-    std::map<std::string, std::string>::const_iterator found =
-        request.headers.find("If-Match");
-    if (found != request.headers.end() &&
-        found->second != "*" &&
-        found->second != kTestETag) {
-      response->set_code(net::HTTP_PRECONDITION_FAILED);
-      return response.PassAs<net::test_server::HttpResponse>();
-    }
-
     // Check if the X-Upload-Content-Length is present. If yes, store the
     // length of the file.
-    found = request.headers.find("X-Upload-Content-Length");
+    std::map<std::string, std::string>::const_iterator found =
+        request.headers.find("X-Upload-Content-Length");
     if (found == request.headers.end() ||
         !base::StringToInt64(found->second, &content_length_)) {
       return scoped_ptr<net::test_server::HttpResponse>();
@@ -1314,6 +1339,11 @@
   // Set an expected url for uploading.
   expected_upload_path_ = kTestUploadExistingFilePath;
 
+  // If it turned out that the etag is conflicting, PRECONDITION_FAILED should
+  // be returned.
+  expected_precondition_failed_file_path_ =
+      test_util::GetTestFilePath("drive/error.json");
+
   const char kTestContentType[] = "text/plain";
   const std::string kTestContent(100, 'a');
 
@@ -1351,6 +1381,102 @@
   EXPECT_TRUE(http_request_.content.empty());
 }
 
+TEST_F(DriveApiRequestsTest,
+       UploadExistingFileRequestWithETagConflictOnResumeUpload) {
+  // Set an expected url for uploading.
+  expected_upload_path_ = kTestUploadExistingFilePath;
+
+  const char kTestContentType[] = "text/plain";
+  const std::string kTestContent(100, 'a');
+  const base::FilePath kTestFilePath =
+      temp_dir_.path().AppendASCII("upload_file.txt");
+  ASSERT_TRUE(test_util::WriteStringToFile(kTestFilePath, kTestContent));
+
+  GDataErrorCode error = GDATA_OTHER_ERROR;
+  GURL upload_url;
+
+  // Initiate uploading a new file to the directory with "parent_resource_id".
+  {
+    base::RunLoop run_loop;
+    drive::InitiateUploadExistingFileRequest* request =
+        new drive::InitiateUploadExistingFileRequest(
+            request_sender_.get(),
+            *url_generator_,
+            kTestContentType,
+            kTestContent.size(),
+            "resource_id",  // The resource id of the file to be overwritten.
+            kTestETag,
+            test_util::CreateQuitCallback(
+                &run_loop,
+                test_util::CreateCopyResultCallback(&error, &upload_url)));
+    request_sender_->StartRequestWithRetry(request);
+    run_loop.Run();
+  }
+
+  EXPECT_EQ(HTTP_SUCCESS, error);
+  EXPECT_EQ(kTestUploadExistingFilePath, upload_url.path());
+  EXPECT_EQ(kTestContentType, http_request_.headers["X-Upload-Content-Type"]);
+  EXPECT_EQ(base::Int64ToString(kTestContent.size()),
+            http_request_.headers["X-Upload-Content-Length"]);
+  EXPECT_EQ(kTestETag, http_request_.headers["If-Match"]);
+
+  EXPECT_EQ(net::test_server::METHOD_PUT, http_request_.method);
+  EXPECT_EQ("/upload/drive/v2/files/resource_id?uploadType=resumable",
+            http_request_.relative_url);
+  EXPECT_TRUE(http_request_.has_content);
+  EXPECT_TRUE(http_request_.content.empty());
+
+  // Set PRECONDITION_FAILED to the server. This is the emulation of the
+  // confliction during uploading.
+  expected_precondition_failed_file_path_ =
+      test_util::GetTestFilePath("drive/error.json");
+
+  // Upload the content to the upload URL.
+  UploadRangeResponse response;
+  scoped_ptr<FileResource> new_entry;
+
+  {
+    base::RunLoop run_loop;
+    drive::ResumeUploadRequest* resume_request =
+        new drive::ResumeUploadRequest(
+            request_sender_.get(),
+            upload_url,
+            0,  // start_position
+            kTestContent.size(),  // end_position (exclusive)
+            kTestContent.size(),  // content_length,
+            kTestContentType,
+            kTestFilePath,
+            test_util::CreateQuitCallback(
+                &run_loop,
+                test_util::CreateCopyResultCallback(&response, &new_entry)),
+            ProgressCallback());
+    request_sender_->StartRequestWithRetry(resume_request);
+    run_loop.Run();
+  }
+
+  // METHOD_PUT should be used to upload data.
+  EXPECT_EQ(net::test_server::METHOD_PUT, http_request_.method);
+  // Request should go to the upload URL.
+  EXPECT_EQ(upload_url.path(), http_request_.relative_url);
+  // Content-Range header should be added.
+  EXPECT_EQ("bytes 0-" +
+            base::Int64ToString(kTestContent.size() - 1) + "/" +
+            base::Int64ToString(kTestContent.size()),
+            http_request_.headers["Content-Range"]);
+  // The upload content should be set in the HTTP request.
+  EXPECT_TRUE(http_request_.has_content);
+  EXPECT_EQ(kTestContent, http_request_.content);
+
+  // Check the response.
+  EXPECT_EQ(HTTP_PRECONDITION, response.code);
+  // The start and end positions should be set to -1 for error.
+  EXPECT_EQ(-1, response.start_position_received);
+  EXPECT_EQ(-1, response.end_position_received);
+
+  // New entry should be NULL.
+  EXPECT_FALSE(new_entry.get());
+}
+
 TEST_F(DriveApiRequestsTest, DownloadFileRequest) {
   const base::FilePath kDownloadedFilePath =
       temp_dir_.path().AppendASCII("cache_file");
diff --git a/chrome/browser/google_apis/drive_common_callbacks.h b/chrome/browser/google_apis/drive_common_callbacks.h
index d39e43c..fb6d760 100644
--- a/chrome/browser/google_apis/drive_common_callbacks.h
+++ b/chrome/browser/google_apis/drive_common_callbacks.h
@@ -27,15 +27,18 @@
                             scoped_ptr<ResourceEntry> entry)>
     GetResourceEntryCallback;
 
-// Callback used for gettign AboutResource.
+// Callback used for getting AboutResource.
 typedef base::Callback<void(GDataErrorCode error,
                             scoped_ptr<AboutResource> about_resource)>
     GetAboutResourceCallback;
 
+// Callback used for getting ShareUrl.
+typedef base::Callback<void(GDataErrorCode error,
+                            const GURL& share_url)> GetShareUrlCallback;
+
 // Callback used for getting AppList.
 typedef base::Callback<void(GDataErrorCode error,
-                            scoped_ptr<AppList> app_list)>
-    GetAppListCallback;
+                            scoped_ptr<AppList> app_list)> GetAppListCallback;
 
 // Callback used for handling UploadRangeResponse.
 typedef base::Callback<void(
diff --git a/chrome/browser/google_apis/gdata_wapi_requests.cc b/chrome/browser/google_apis/gdata_wapi_requests.cc
index 0b22d34..1141db2 100644
--- a/chrome/browser/google_apis/gdata_wapi_requests.cc
+++ b/chrome/browser/google_apis/gdata_wapi_requests.cc
@@ -217,17 +217,20 @@
     RequestSender* sender,
     const GDataWapiUrlGenerator& url_generator,
     const std::string& resource_id,
+    const GURL& embed_origin,
     const GetDataCallback& callback)
     : GetDataRequest(sender, callback),
       url_generator_(url_generator),
-      resource_id_(resource_id) {
+      resource_id_(resource_id),
+      embed_origin_(embed_origin) {
   DCHECK(!callback.is_null());
 }
 
 GetResourceEntryRequest::~GetResourceEntryRequest() {}
 
 GURL GetResourceEntryRequest::GetURL() const {
-  return url_generator_.GenerateEditUrl(resource_id_);
+  return url_generator_.GenerateEditUrlWithEmbedOrigin(
+      resource_id_, embed_origin_);
 }
 
 //========================= GetAccountMetadataRequest ========================
diff --git a/chrome/browser/google_apis/gdata_wapi_requests.h b/chrome/browser/google_apis/gdata_wapi_requests.h
index fa6c6d9..e646b75 100644
--- a/chrome/browser/google_apis/gdata_wapi_requests.h
+++ b/chrome/browser/google_apis/gdata_wapi_requests.h
@@ -105,6 +105,7 @@
   GetResourceEntryRequest(RequestSender* sender,
                           const GDataWapiUrlGenerator& url_generator,
                           const std::string& resource_id,
+                          const GURL& embed_origin,
                           const GetDataCallback& callback);
   virtual ~GetResourceEntryRequest();
 
@@ -116,6 +117,8 @@
   const GDataWapiUrlGenerator url_generator_;
   // Resource id of the requested entry.
   const std::string resource_id_;
+  // Embed origin for an url to the sharing dialog. Can be empty.
+  const GURL& embed_origin_;
 
   DISALLOW_COPY_AND_ASSIGN(GetResourceEntryRequest);
 };
diff --git a/chrome/browser/google_apis/gdata_wapi_requests_unittest.cc b/chrome/browser/google_apis/gdata_wapi_requests_unittest.cc
index 2283b41..609eb05 100644
--- a/chrome/browser/google_apis/gdata_wapi_requests_unittest.cc
+++ b/chrome/browser/google_apis/gdata_wapi_requests_unittest.cc
@@ -481,6 +481,7 @@
         request_sender_.get(),
         *url_generator_,
         "file:2_file_resource_id",  // resource ID
+        GURL(),  // embed origin
         test_util::CreateQuitCallback(
             &run_loop,
             test_util::CreateCopyResultCallback(&result_code, &result_data)));
@@ -508,6 +509,7 @@
         request_sender_.get(),
         *url_generator_,
         "<invalid>",  // resource ID
+        GURL(),  // embed origin
         test_util::CreateQuitCallback(
             &run_loop,
             test_util::CreateCopyResultCallback(&result_code, &result_data)));
diff --git a/chrome/browser/google_apis/gdata_wapi_url_generator.cc b/chrome/browser/google_apis/gdata_wapi_url_generator.cc
index f4956a8..9d09bf1 100644
--- a/chrome/browser/google_apis/gdata_wapi_url_generator.cc
+++ b/chrome/browser/google_apis/gdata_wapi_url_generator.cc
@@ -162,6 +162,24 @@
   return base_url_.Resolve(kGetEditURLPrefix + net::EscapePath(resource_id));
 }
 
+GURL GDataWapiUrlGenerator::GenerateEditUrlWithEmbedOrigin(
+    const std::string& resource_id, const GURL& embed_origin) const {
+  GURL url = GenerateEditUrl(resource_id);
+  if (!embed_origin.is_empty()) {
+    // Construct a valid serialized embed origin from an url, according to
+    // WD-html5-20110525. Such string has to be built manually, since
+    // GURL::spec() always adds the trailing slash. Moreover, ports are
+    // currently not supported.
+    DCHECK(!embed_origin.has_port());
+    DCHECK(!embed_origin.has_path() || embed_origin.path() == "/");
+    const std::string serialized_embed_origin =
+        embed_origin.scheme() + "://" + embed_origin.host();
+    url = net::AppendOrReplaceQueryParameter(
+        url, "embedOrigin", serialized_embed_origin);
+  }
+  return url;
+}
+
 GURL GDataWapiUrlGenerator::GenerateContentUrl(
     const std::string& resource_id) const {
   if (resource_id.empty()) {
diff --git a/chrome/browser/google_apis/gdata_wapi_url_generator.h b/chrome/browser/google_apis/gdata_wapi_url_generator.h
index 31d17f9..4e23c69 100644
--- a/chrome/browser/google_apis/gdata_wapi_url_generator.h
+++ b/chrome/browser/google_apis/gdata_wapi_url_generator.h
@@ -94,6 +94,13 @@
   // edit urls.
   GURL GenerateEditUrlWithoutParams(const std::string& resource_id) const;
 
+  // Generates a URL for getting or editing the resource entry of the given
+  // resource ID with additionally passed embed origin. This is used to fetch
+  // share urls for the sharing dialog to be embedded with the |embed_origin|
+  // origin.
+  GURL GenerateEditUrlWithEmbedOrigin(const std::string& resource_id,
+                                      const GURL& embed_origin) const;
+
   // Generates a URL for editing the contents in the directory specified
   // by the given resource ID.
   GURL GenerateContentUrl(const std::string& resource_id) const;
diff --git a/chrome/browser/google_apis/gdata_wapi_url_generator_unittest.cc b/chrome/browser/google_apis/gdata_wapi_url_generator_unittest.cc
index ef8f1da..8dd60dc 100644
--- a/chrome/browser/google_apis/gdata_wapi_url_generator_unittest.cc
+++ b/chrome/browser/google_apis/gdata_wapi_url_generator_unittest.cc
@@ -147,6 +147,21 @@
       url_generator_.GenerateEditUrlWithoutParams("XXX").spec());
 }
 
+TEST_F(GDataWapiUrlGeneratorTest, GenerateEditUrlWithEmbedOrigin) {
+  EXPECT_EQ(
+      "https://docs.google.com/feeds/default/private/full/XXX?v=3&alt=json"
+      "&showroot=true&embedOrigin=chrome-extension%3A%2F%2Ftest",
+      url_generator_.GenerateEditUrlWithEmbedOrigin(
+          "XXX",
+          GURL("chrome-extension://test")).spec());
+  EXPECT_EQ(
+      "https://docs.google.com/feeds/default/private/full/XXX?v=3&alt=json"
+      "&showroot=true",
+      url_generator_.GenerateEditUrlWithEmbedOrigin(
+          "XXX",
+          GURL()).spec());
+}
+
 TEST_F(GDataWapiUrlGeneratorTest, GenerateContentUrl) {
   EXPECT_EQ(
       "https://docs.google.com/feeds/default/private/full/"
diff --git a/chrome/browser/history/android/android_history_provider_service_unittest.cc b/chrome/browser/history/android/android_history_provider_service_unittest.cc
index 7919849..6b882f5 100644
--- a/chrome/browser/history/android/android_history_provider_service_unittest.cc
+++ b/chrome/browser/history/android/android_history_provider_service_unittest.cc
@@ -53,7 +53,7 @@
 
     testing_profile_->CreateBookmarkModel(true);
     ui_test_utils::WaitForBookmarkModelToLoad(testing_profile_);
-    testing_profile_->CreateHistoryService(true, false);
+    ASSERT_TRUE(testing_profile_->CreateHistoryService(true, false));
     service_.reset(new AndroidHistoryProviderService(testing_profile_));
   }
 
diff --git a/chrome/browser/history/android/sqlite_cursor_unittest.cc b/chrome/browser/history/android/sqlite_cursor_unittest.cc
index 7491cd1..fc98bcb 100644
--- a/chrome/browser/history/android/sqlite_cursor_unittest.cc
+++ b/chrome/browser/history/android/sqlite_cursor_unittest.cc
@@ -63,7 +63,7 @@
     ui_test_utils::WaitForBookmarkModelToLoad(testing_profile_);
 
     testing_profile_->CreateFaviconService();
-    testing_profile_->CreateHistoryService(true, false);
+    ASSERT_TRUE(testing_profile_->CreateHistoryService(true, false));
     service_.reset(new AndroidHistoryProviderService(testing_profile_));
     hs_ = HistoryServiceFactory::GetForProfile(testing_profile_,
                                                Profile::EXPLICIT_ACCESS);
diff --git a/chrome/browser/history/expire_history_backend.cc b/chrome/browser/history/expire_history_backend.cc
index 5c33897..370a62b 100644
--- a/chrome/browser/history/expire_history_backend.cc
+++ b/chrome/browser/history/expire_history_backend.cc
@@ -19,8 +19,6 @@
 #include "chrome/browser/history/archived_database.h"
 #include "chrome/browser/history/history_database.h"
 #include "chrome/browser/history/history_notifications.h"
-#include "chrome/browser/history/text_database.h"
-#include "chrome/browser/history/text_database_manager.h"
 #include "chrome/browser/history/thumbnail_database.h"
 
 using base::Time;
@@ -172,10 +170,6 @@
   // The list of all favicon urls that were actually deleted from the thumbnail
   // db.
   std::set<GURL> expired_favicons;
-
-  // Tracks the set of databases that have changed so we can optimize when
-  // when we're done.
-  TextDatabaseManager::ChangeSet text_db_changes;
 };
 
 ExpireHistoryBackend::ExpireHistoryBackend(
@@ -185,7 +179,6 @@
       main_db_(NULL),
       archived_db_(NULL),
       thumb_db_(NULL),
-      text_db_(NULL),
       weak_factory_(this),
       bookmark_service_(bookmark_service) {
 }
@@ -195,12 +188,10 @@
 
 void ExpireHistoryBackend::SetDatabases(HistoryDatabase* main_db,
                                         ArchivedDatabase* archived_db,
-                                        ThumbnailDatabase* thumb_db,
-                                        TextDatabaseManager* text_db) {
+                                        ThumbnailDatabase* thumb_db) {
   main_db_ = main_db;
   archived_db_ = archived_db;
   thumb_db_ = thumb_db;
-  text_db_ = text_db;
 }
 
 void ExpireHistoryBackend::DeleteURL(const GURL& url) {
@@ -242,9 +233,6 @@
   DeleteFaviconsIfPossible(dependencies.affected_favicons,
                            &dependencies.expired_favicons);
 
-  if (text_db_)
-    text_db_->OptimizeChangedDatabases(dependencies.text_db_changes);
-
   BroadcastDeleteNotifications(&dependencies, DELETION_USER_INITIATED);
 }
 
@@ -253,10 +241,6 @@
   if (!main_db_)
     return;
 
-  // There may be stuff in the text database manager's temporary cache.
-  if (text_db_)
-    text_db_->DeleteFromUncommitted(restrict_urls, begin_time, end_time);
-
   // Find the affected visits and delete them.
   // TODO(brettw): bug 1171164: We should query the archived database here, too.
   VisitVector visits;
@@ -290,10 +274,6 @@
   if (!main_db_)
     return;
 
-  // There may be stuff in the text database manager's temporary cache.
-  if (text_db_)
-    text_db_->DeleteFromUncommittedForTimes(times);
-
   // Find the affected visits and delete them.
   // TODO(brettw): bug 1171164: We should query the archived database here, too.
   VisitVector visits;
@@ -368,7 +348,6 @@
   // Initialize the queue with all tasks for the first set of iterations.
   InitWorkQueue();
   ScheduleArchive();
-  ScheduleExpireHistoryIndexFiles();
 }
 
 void ExpireHistoryBackend::DeleteFaviconsIfPossible(
@@ -422,21 +401,11 @@
     // Add the URL row to the affected URL list.
     std::map<URLID, URLRow>::const_iterator found =
         dependencies->affected_urls.find(visits[i].url_id);
-    const URLRow* cur_row = NULL;
     if (found == dependencies->affected_urls.end()) {
       URLRow row;
       if (!main_db_->GetURLRow(visits[i].url_id, &row))
         continue;
       dependencies->affected_urls[visits[i].url_id] = row;
-      cur_row = &dependencies->affected_urls[visits[i].url_id];
-    } else {
-      cur_row = &found->second;
-    }
-
-    // Delete any associated full-text indexed data.
-    if (visits[i].is_indexed && text_db_) {
-      text_db_->DeletePageData(visits[i].visit_time, cur_row->url(),
-                               &dependencies->text_db_changes);
     }
   }
 }
@@ -447,13 +416,6 @@
     DeleteDependencies* dependencies) {
   main_db_->DeleteSegmentForURL(url_row.id());
 
-  // The URL may be in the text database manager's temporary cache.
-  if (text_db_) {
-    std::set<GURL> restrict_urls;
-    restrict_urls.insert(url_row.url());
-    text_db_->DeleteFromUncommitted(restrict_urls, base::Time(), base::Time());
-  }
-
   if (!is_bookmarked) {
     dependencies->deleted_urls.push_back(url_row);
 
@@ -722,48 +684,6 @@
   // TODO(brettw): Bug 1067331: write this to clean up any errors.
 }
 
-void ExpireHistoryBackend::ScheduleExpireHistoryIndexFiles() {
-  if (!text_db_) {
-    // Can't expire old history index files because we
-    // don't know where they're located.
-    return;
-  }
-
-  TimeDelta delay = TimeDelta::FromMinutes(kIndexExpirationDelayMin);
-  base::MessageLoop::current()->PostDelayedTask(
-      FROM_HERE,
-      base::Bind(&ExpireHistoryBackend::DoExpireHistoryIndexFiles,
-                 weak_factory_.GetWeakPtr()),
-      delay);
-}
-
-void ExpireHistoryBackend::DoExpireHistoryIndexFiles() {
-  if (!text_db_) {
-    // The text database may have been closed since the task was scheduled.
-    return;
-  }
-
-  Time::Exploded exploded;
-  Time::Now().LocalExplode(&exploded);
-  int cutoff_month =
-      exploded.year * 12 + exploded.month - kStoreHistoryIndexesForMonths;
-  TextDatabase::DBIdent cutoff_id =
-      (cutoff_month / 12) * 100 + (cutoff_month % 12);
-
-  base::FilePath::StringType history_index_files_pattern =
-      TextDatabase::file_base();
-  history_index_files_pattern.append(FILE_PATH_LITERAL("*"));
-  base::FileEnumerator file_enumerator(
-      text_db_->GetDir(), false, base::FileEnumerator::FILES,
-      history_index_files_pattern);
-  for (base::FilePath file = file_enumerator.Next(); !file.empty();
-       file = file_enumerator.Next()) {
-    TextDatabase::DBIdent file_id = TextDatabase::FileNameToID(file);
-    if (file_id < cutoff_id)
-      sql::Connection::Delete(file);
-  }
-}
-
 BookmarkService* ExpireHistoryBackend::GetBookmarkService() {
   // We use the bookmark service to determine if a URL is bookmarked. The
   // bookmark service is loaded on a separate thread and may not be done by the
diff --git a/chrome/browser/history/expire_history_backend.h b/chrome/browser/history/expire_history_backend.h
index 626ad12..2e3d27e 100644
--- a/chrome/browser/history/expire_history_backend.h
+++ b/chrome/browser/history/expire_history_backend.h
@@ -25,7 +25,6 @@
 class ArchivedDatabase;
 class HistoryDatabase;
 struct HistoryDetails;
-class TextDatabaseManager;
 class ThumbnailDatabase;
 
 // Delegate used to broadcast notifications to the main thread.
@@ -76,8 +75,7 @@
   // Completes initialization by setting the databases that this class will use.
   void SetDatabases(HistoryDatabase* main_db,
                     ArchivedDatabase* archived_db,
-                    ThumbnailDatabase* thumb_db,
-                    TextDatabaseManager* text_db);
+                    ThumbnailDatabase* thumb_db);
 
   // Begins periodic expiration of history older than the given threshold. This
   // will continue until the object is deleted.
@@ -128,9 +126,6 @@
   // Deletes the visit-related stuff for all the visits in the given list, and
   // adds the rows for unique URLs affected to the affected_urls list in
   // the dependencies structure.
-  //
-  // Deleted information is the visits themselves and the full-text index
-  // entries corresponding to them.
   void DeleteVisitRelatedInfo(const VisitVector& visits,
                               DeleteDependencies* dependencies);
 
@@ -138,8 +133,7 @@
   void ArchiveVisits(const VisitVector& visits);
 
   // Finds or deletes dependency information for the given URL. Information that
-  // is specific to this URL (URL row, thumbnails, full text indexed stuff,
-  // etc.) is deleted.
+  // is specific to this URL (URL row, thumbnails, etc.) is deleted.
   //
   // This does not affect the visits! This is used for expiration as well as
   // deleting from the UI, and they handle visits differently.
@@ -240,12 +234,6 @@
   // and deletes items. For example, URLs with no visits.
   void ParanoidExpireHistory();
 
-  // Schedules a call to DoExpireHistoryIndexFiles.
-  void ScheduleExpireHistoryIndexFiles();
-
-  // Deletes old history index files.
-  void DoExpireHistoryIndexFiles();
-
   // Returns the BookmarkService, blocking until it is loaded. This may return
   // NULL.
   BookmarkService* GetBookmarkService();
@@ -269,7 +257,6 @@
   HistoryDatabase* main_db_;       // Main history database.
   ArchivedDatabase* archived_db_;  // Old history.
   ThumbnailDatabase* thumb_db_;    // Thumbnails and favicons.
-  TextDatabaseManager* text_db_;   // Full text index.
 
   // Used to generate runnable methods to do timers on this class. They will be
   // automatically canceled when this class is deleted.
diff --git a/chrome/browser/history/expire_history_backend_unittest.cc b/chrome/browser/history/expire_history_backend_unittest.cc
index d36a6a1..59852a1 100644
--- a/chrome/browser/history/expire_history_backend_unittest.cc
+++ b/chrome/browser/history/expire_history_backend_unittest.cc
@@ -23,7 +23,6 @@
 #include "chrome/browser/history/expire_history_backend.h"
 #include "chrome/browser/history/history_database.h"
 #include "chrome/browser/history/history_notifications.h"
-#include "chrome/browser/history/text_database_manager.h"
 #include "chrome/browser/history/thumbnail_database.h"
 #include "chrome/browser/history/top_sites.h"
 #include "chrome/common/thumbnail_score.h"
@@ -77,10 +76,6 @@
   chrome::FaviconID GetFavicon(const GURL& page_url,
                                chrome::IconType icon_type);
 
-  // Returns the number of text matches for the given URL in the example data
-  // added by AddExampleData.
-  int CountTextMatchesForURL(const GURL& url);
-
   // EXPECTs that each URL-specific history thing (basically, everything but
   // favicons) is gone.
   void EnsureURLInfoGone(const URLRow& row);
@@ -114,7 +109,6 @@
   scoped_ptr<HistoryDatabase> main_db_;
   scoped_ptr<ArchivedDatabase> archived_db_;
   scoped_ptr<ThumbnailDatabase> thumb_db_;
-  scoped_ptr<TextDatabaseManager> text_db_;
   TestingProfile profile_;
   scoped_refptr<TopSites> top_sites_;
 
@@ -147,13 +141,7 @@
     if (thumb_db_->Init(thumb_name, NULL, main_db_.get()) != sql::INIT_OK)
       thumb_db_.reset();
 
-    text_db_.reset(new TextDatabaseManager(path(),
-                                           main_db_.get(), main_db_.get()));
-    if (!text_db_->Init(NULL))
-      text_db_.reset();
-
-    expirer_.SetDatabases(main_db_.get(), archived_db_.get(), thumb_db_.get(),
-                          text_db_.get());
+    expirer_.SetDatabases(main_db_.get(), archived_db_.get(), thumb_db_.get());
     profile_.CreateTopSites();
     profile_.BlockUntilTopSitesLoaded();
     top_sites_ = profile_.GetTopSites();
@@ -164,12 +152,11 @@
 
     ClearLastNotifications();
 
-    expirer_.SetDatabases(NULL, NULL, NULL, NULL);
+    expirer_.SetDatabases(NULL, NULL, NULL);
 
     main_db_.reset();
     archived_db_.reset();
     thumb_db_.reset();
-    text_db_.reset();
   }
 
   // BroadcastNotificationDelegate implementation.
@@ -199,7 +186,7 @@
 // The IDs of the added URLs, and the times of the four added visits will be
 // added to the given arrays.
 void ExpireHistoryTest::AddExampleData(URLID url_ids[3], Time visit_times[4]) {
-  if (!main_db_.get() || !text_db_)
+  if (!main_db_.get())
     return;
 
   // Four times for each visit.
@@ -251,45 +238,23 @@
   VisitRow visit_row1;
   visit_row1.url_id = url_ids[0];
   visit_row1.visit_time = visit_times[0];
-  visit_row1.is_indexed = true;
   main_db_->AddVisit(&visit_row1, SOURCE_BROWSED);
 
   VisitRow visit_row2;
   visit_row2.url_id = url_ids[1];
   visit_row2.visit_time = visit_times[1];
-  visit_row2.is_indexed = true;
   main_db_->AddVisit(&visit_row2, SOURCE_BROWSED);
 
   VisitRow visit_row3;
   visit_row3.url_id = url_ids[1];
   visit_row3.visit_time = visit_times[2];
-  visit_row3.is_indexed = true;
   visit_row3.transition = content::PAGE_TRANSITION_TYPED;
   main_db_->AddVisit(&visit_row3, SOURCE_BROWSED);
 
   VisitRow visit_row4;
   visit_row4.url_id = url_ids[2];
   visit_row4.visit_time = visit_times[3];
-  visit_row4.is_indexed = true;
   main_db_->AddVisit(&visit_row4, SOURCE_BROWSED);
-
-  // Full text index for each visit.
-  text_db_->AddPageData(url_row1.url(), visit_row1.url_id, visit_row1.visit_id,
-                        visit_row1.visit_time, UTF8ToUTF16("title"),
-                        UTF8ToUTF16("body"));
-
-  text_db_->AddPageData(url_row2.url(), visit_row2.url_id, visit_row2.visit_id,
-                        visit_row2.visit_time, UTF8ToUTF16("title"),
-                        UTF8ToUTF16("body"));
-  text_db_->AddPageData(url_row2.url(), visit_row3.url_id, visit_row3.visit_id,
-                        visit_row3.visit_time, UTF8ToUTF16("title"),
-                        UTF8ToUTF16("body"));
-
-  // Note the special text in this URL. We'll search the file for this string
-  // to make sure it doesn't hang around after the delete.
-  text_db_->AddPageData(url_row3.url(), visit_row4.url_id, visit_row4.visit_id,
-                        visit_row4.visit_time, UTF8ToUTF16("title"),
-                        UTF8ToUTF16("goats body"));
 }
 
 void ExpireHistoryTest::AddExampleSourceData(const GURL& url, URLID* id) {
@@ -349,33 +314,11 @@
   return top_sites_->GetPageThumbnail(url, &data);
 }
 
-int ExpireHistoryTest::CountTextMatchesForURL(const GURL& url) {
-  if (!text_db_)
-    return 0;
-
-  // "body" should match all pages in the example data.
-  std::vector<TextDatabase::Match> results;
-  QueryOptions options;
-  Time first_time;
-  text_db_->GetTextMatches(UTF8ToUTF16("body"), options,
-                           &results, &first_time);
-
-  int count = 0;
-  for (size_t i = 0; i < results.size(); i++) {
-    if (results[i].url == url)
-      count++;
-  }
-  return count;
-}
-
 void ExpireHistoryTest::EnsureURLInfoGone(const URLRow& row) {
   // Verify the URL no longer exists.
   URLRow temp_row;
   EXPECT_FALSE(main_db_->GetURLRow(row.id(), &temp_row));
 
-  // The indexed data should be gone.
-  EXPECT_EQ(0, CountTextMatchesForURL(row.url()));
-
   // There should be no visits.
   VisitVector visits;
   main_db_->GetVisitsForURL(row.id(), &visits);
@@ -471,46 +414,10 @@
   VisitVector visits;
   main_db_->GetVisitsForURL(url_ids[2], &visits);
   ASSERT_EQ(1U, visits.size());
-  EXPECT_EQ(1, CountTextMatchesForURL(last_row.url()));
-
-  // In this test we also make sure that any pending entries in the text
-  // database manager are removed.
-  text_db_->AddPageURL(last_row.url(), last_row.id(), visits[0].visit_id,
-                       visits[0].visit_time);
-
-  // Compute the text DB filename.
-  base::FilePath fts_filename = path().Append(
-      TextDatabase::IDToFileName(text_db_->TimeToID(visit_times[3])));
-
-  // When checking the file, the database must be closed. We then re-initialize
-  // it just like the test set-up did.
-  text_db_.reset();
-  EXPECT_TRUE(IsStringInFile(fts_filename, "goats"));
-  text_db_.reset(new TextDatabaseManager(path(),
-                                         main_db_.get(), main_db_.get()));
-  ASSERT_TRUE(text_db_->Init(NULL));
-  expirer_.SetDatabases(main_db_.get(), archived_db_.get(), thumb_db_.get(),
-                        text_db_.get());
 
   // Delete the URL and its dependencies.
   expirer_.DeleteURL(last_row.url());
 
-  // The string should be removed from the file. FTS can mark it as gone but
-  // doesn't remove it from the file, we want to be sure we're doing the latter.
-  text_db_.reset();
-  EXPECT_FALSE(IsStringInFile(fts_filename, "goats"));
-  text_db_.reset(new TextDatabaseManager(path(),
-                                         main_db_.get(), main_db_.get()));
-  ASSERT_TRUE(text_db_->Init(NULL));
-  expirer_.SetDatabases(main_db_.get(), archived_db_.get(), thumb_db_.get(),
-                        text_db_.get());
-
-  // Run the text database expirer. This will flush any pending entries so we
-  // can check that nothing was committed. We use a time far in the future so
-  // that anything added recently will get flushed.
-  TimeTicks expiration_time = TimeTicks::Now() + TimeDelta::FromDays(1);
-  text_db_->FlushOldChangesForTime(expiration_time);
-
   // All the normal data + the favicon should be gone.
   EnsureURLInfoGone(last_row);
   EXPECT_FALSE(GetFavicon(last_row.url(), chrome::FAVICON));
@@ -535,7 +442,6 @@
   VisitVector visits;
   main_db_->GetVisitsForURL(url_ids[1], &visits);
   EXPECT_EQ(2U, visits.size());
-  EXPECT_EQ(1, CountTextMatchesForURL(last_row.url()));
 
   // Delete the URL and its dependencies.
   expirer_.DeleteURL(last_row.url());
@@ -568,9 +474,6 @@
   chrome::FaviconID favicon_id = GetFavicon(url_row.url(), chrome::FAVICON);
   EXPECT_TRUE(HasFavicon(favicon_id));
 
-  // But there should be no fts.
-  ASSERT_EQ(0, CountTextMatchesForURL(url_row.url()));
-
   // And no visits.
   VisitVector visits;
   main_db_->GetVisitsForURL(url_row.id(), &visits);
@@ -637,29 +540,18 @@
   ASSERT_TRUE(main_db_->GetURLRow(url_ids[1], &url_row1));
   ASSERT_TRUE(main_db_->GetURLRow(url_ids[2], &url_row2));
 
-  // In this test we also make sure that any pending entries in the text
-  // database manager are removed.
   VisitVector visits;
   main_db_->GetVisitsForURL(url_ids[2], &visits);
   ASSERT_EQ(1U, visits.size());
-  text_db_->AddPageURL(url_row2.url(), url_row2.id(), visits[0].visit_id,
-                       visits[0].visit_time);
 
   // This should delete the last two visits.
   std::set<GURL> restrict_urls;
   expirer_.ExpireHistoryBetween(restrict_urls, visit_times[2], Time());
 
-  // Run the text database expirer. This will flush any pending entries so we
-  // can check that nothing was committed. We use a time far in the future so
-  // that anything added recently will get flushed.
-  TimeTicks expiration_time = TimeTicks::Now() + TimeDelta::FromDays(1);
-  text_db_->FlushOldChangesForTime(expiration_time);
-
   // Verify that the middle URL had its last visit deleted only.
   visits.clear();
   main_db_->GetVisitsForURL(url_ids[1], &visits);
   EXPECT_EQ(1U, visits.size());
-  EXPECT_EQ(0, CountTextMatchesForURL(url_row1.url()));
 
   // Verify that the middle URL visit time and visit counts were updated.
   URLRow temp_row;
@@ -693,13 +585,9 @@
   ASSERT_TRUE(main_db_->GetURLRow(url_ids[1], &url_row1));
   ASSERT_TRUE(main_db_->GetURLRow(url_ids[2], &url_row2));
 
-  // In this test we also make sure that any pending entries in the text
-  // database manager are removed.
   VisitVector visits;
   main_db_->GetVisitsForURL(url_ids[2], &visits);
   ASSERT_EQ(1U, visits.size());
-  text_db_->AddPageURL(url_row2.url(), url_row2.id(), visits[0].visit_id,
-                       visits[0].visit_time);
 
   // This should delete the last two visits.
   std::vector<base::Time> times;
@@ -707,17 +595,10 @@
   times.push_back(visit_times[2]);
   expirer_.ExpireHistoryForTimes(times);
 
-  // Run the text database expirer. This will flush any pending entries so we
-  // can check that nothing was committed. We use a time far in the future so
-  // that anything added recently will get flushed.
-  TimeTicks expiration_time = TimeTicks::Now() + TimeDelta::FromDays(1);
-  text_db_->FlushOldChangesForTime(expiration_time);
-
   // Verify that the middle URL had its last visit deleted only.
   visits.clear();
   main_db_->GetVisitsForURL(url_ids[1], &visits);
   EXPECT_EQ(1U, visits.size());
-  EXPECT_EQ(0, CountTextMatchesForURL(url_row1.url()));
 
   // Verify that the middle URL visit time and visit counts were updated.
   URLRow temp_row;
@@ -753,30 +634,19 @@
   ASSERT_TRUE(main_db_->GetURLRow(url_ids[1], &url_row1));
   ASSERT_TRUE(main_db_->GetURLRow(url_ids[2], &url_row2));
 
-  // In this test we also make sure that any pending entries in the text
-  // database manager are removed.
   VisitVector visits;
   main_db_->GetVisitsForURL(url_ids[2], &visits);
   ASSERT_EQ(1U, visits.size());
-  text_db_->AddPageURL(url_row2.url(), url_row2.id(), visits[0].visit_id,
-                       visits[0].visit_time);
 
   // This should delete the last two visits.
   std::set<GURL> restrict_urls;
   restrict_urls.insert(url_row1.url());
   expirer_.ExpireHistoryBetween(restrict_urls, visit_times[2], Time());
 
-  // Run the text database expirer. This will flush any pending entries so we
-  // can check that nothing was committed. We use a time far in the future so
-  // that anything added recently will get flushed.
-  TimeTicks expiration_time = TimeTicks::Now() + TimeDelta::FromDays(1);
-  text_db_->FlushOldChangesForTime(expiration_time);
-
   // Verify that the middle URL had its last visit deleted only.
   visits.clear();
   main_db_->GetVisitsForURL(url_ids[1], &visits);
   EXPECT_EQ(1U, visits.size());
-  EXPECT_EQ(0, CountTextMatchesForURL(url_row1.url()));
 
   // Verify that the middle URL visit time and visit counts were updated.
   URLRow temp_row;
diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc
index adaff5a..83a2afd 100644
--- a/chrome/browser/history/history_backend.cc
+++ b/chrome/browser/history/history_backend.cc
@@ -14,6 +14,7 @@
 #include "base/basictypes.h"
 #include "base/bind.h"
 #include "base/compiler_specific.h"
+#include "base/files/file_enumerator.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/memory/scoped_vector.h"
 #include "base/message_loop/message_loop.h"
@@ -68,10 +69,6 @@
 
       (this does not store visit segments as they expire after 3 mos.)
 
-    TextDatabaseManager (manages multiple text database for different times)
-      TextDatabase (represents a single month of full-text index).
-      ...more TextDatabase objects...
-
     ExpireHistoryBackend (manages moving things from HistoryDatabase to
                           the ArchivedDatabase and deleting)
 */
@@ -168,53 +165,6 @@
   scoped_refptr<HistoryBackend> history_backend_;
 };
 
-// Handles querying first the main database, then the full text database if that
-// fails. It will optionally keep track of all URLs seen so duplicates can be
-// eliminated. This is used by the querying sub-functions.
-//
-// TODO(brettw): This class may be able to be simplified or eliminated. After
-// this was written, QueryResults can efficiently look up by URL, so the need
-// for this extra set of previously queried URLs is less important.
-class HistoryBackend::URLQuerier {
- public:
-  URLQuerier(URLDatabase* main_db, URLDatabase* archived_db, bool track_unique)
-      : main_db_(main_db),
-        archived_db_(archived_db),
-        track_unique_(track_unique) {
-  }
-
-  // When we're tracking unique URLs, returns true if this URL has been
-  // previously queried. Only call when tracking unique URLs.
-  bool HasURL(const GURL& url) {
-    DCHECK(track_unique_);
-    return unique_urls_.find(url) != unique_urls_.end();
-  }
-
-  bool GetRowForURL(const GURL& url, URLRow* row) {
-    if (!main_db_->GetRowForURL(url, row)) {
-      if (!archived_db_ || !archived_db_->GetRowForURL(url, row)) {
-        // This row is neither in the main nor the archived DB.
-        return false;
-      }
-    }
-
-    if (track_unique_)
-      unique_urls_.insert(url);
-    return true;
-  }
-
- private:
-  URLDatabase* main_db_;  // Guaranteed non-NULL.
-  URLDatabase* archived_db_;  // Possibly NULL.
-
-  bool track_unique_;
-
-  // When track_unique_ is set, this is updated with every URL seen so far.
-  std::set<GURL> unique_urls_;
-
-  DISALLOW_COPY_AND_ASSIGN(URLQuerier);
-};
-
 // HistoryBackend --------------------------------------------------------------
 
 HistoryBackend::HistoryBackend(const base::FilePath& history_dir,
@@ -582,7 +532,7 @@
     }
 
     // Last, save this redirect chain for later so we can set titles & favicons
-    // on the redirected pages properly. It is indexed by the destination page.
+    // on the redirected pages properly.
     recent_redirects_.Put(request.url, redirects);
   }
 
@@ -600,11 +550,6 @@
                       last_ids.second);
   }
 
-  if (text_database_) {
-    text_database_->AddPageURL(request.url, last_ids.first, last_ids.second,
-                               request.time);
-  }
-
   ScheduleCommit();
 }
 
@@ -617,12 +562,14 @@
 
   TimeTicks beginning_time = TimeTicks::Now();
 
-  // Compute the file names. Note that the index file can be removed when the
-  // text db manager is finished being hooked up.
+  // Compute the file names.
   base::FilePath history_name = history_dir_.Append(chrome::kHistoryFilename);
   base::FilePath thumbnail_name = GetThumbnailFileName();
   base::FilePath archived_name = GetArchivedFileName();
 
+  // Delete the old index database files which are no longer used.
+  DeleteFTSIndexDatabases();
+
   // History database.
   db_.reset(new HistoryDatabase());
 
@@ -662,8 +609,8 @@
     delete mem_backend;  // Error case, run without the in-memory DB.
   db_->BeginExclusiveMode();  // Must be after the mem backend read the data.
 
-  // Create the history publisher which needs to be passed on to the text and
-  // thumbnail databases for publishing history.
+  // Create the history publisher which needs to be passed on to the thumbnail
+  // database for publishing history.
   history_publisher_.reset(new HistoryPublisher());
   if (!history_publisher_->Init()) {
     // The init may fail when there are no indexers wanting our history.
@@ -671,22 +618,6 @@
     history_publisher_.reset();
   }
 
-  // Full-text database. This has to be first so we can pass it to the
-  // HistoryDatabase for migration.
-  text_database_.reset(new TextDatabaseManager(history_dir_,
-                                               db_.get(), db_.get()));
-  if (!text_database_->Init(history_publisher_.get())) {
-    LOG(WARNING) << "Text database initialization failed, running without it.";
-    text_database_.reset();
-  }
-  if (db_->needs_version_17_migration()) {
-    // See needs_version_17_migration() decl for more. In this case, we want
-    // to erase all the text database files. This must be done after the text
-    // database manager has been initialized, since it knows about all the
-    // files it manages.
-    text_database_->DeleteAll();
-  }
-
   // Thumbnail database.
   thumbnail_db_.reset(new ThumbnailDatabase());
   if (!db_->GetNeedsThumbnailMigration()) {
@@ -739,7 +670,7 @@
   // The main DB initialization should intuitively be first (not that it
   // actually matters) and the expirer should be set last.
   expirer_.SetDatabases(db_.get(), archived_db_.get(),
-                        thumbnail_db_.get(), text_database_.get());
+                        thumbnail_db_.get());
 
   // Open the long-running transaction.
   db_->BeginTransaction();
@@ -747,8 +678,6 @@
     thumbnail_db_->BeginTransaction();
   if (archived_db_)
     archived_db_->BeginTransaction();
-  if (text_database_)
-    text_database_->BeginTransaction();
 
   // Get the first item in our database.
   db_->GetStartDate(&first_recorded_time_);
@@ -794,10 +723,6 @@
     archived_db_->CommitTransaction();
     archived_db_.reset();
   }
-  if (text_database_) {
-    text_database_->CommitTransaction();
-    text_database_.reset();
-  }
 }
 
 std::pair<URLID, VisitID> HistoryBackend::AddPageVisit(
@@ -861,14 +786,6 @@
       return std::make_pair(0, 0);
     }
     url_info.id_ = url_id;
-
-    // We don't actually add the URL to the full text index at this point. It
-    // might be nice to do this so that even if we get no title or body, the
-    // user can search for URL components and get the page.
-    //
-    // However, in most cases, we'll get at least a title and usually contents,
-    // and this add will be redundant, slowing everything down. As a result,
-    // we ignore this edge case.
   }
 
   // Add the visit with the time to the database.
@@ -938,26 +855,6 @@
       }
     }
 
-    // Add the page to the full text index. This function is also used for
-    // importing. Even though we don't have page contents, we can at least
-    // add the title and URL to the index so they can be searched. We don't
-    // bother to delete any already-existing FTS entries for the URL, since
-    // this is normally called on import.
-    //
-    // If you ever import *after* first run (selecting import from the menu),
-    // then these additional entries will "shadow" the originals when querying
-    // for the most recent match only, and the user won't get snippets. This is
-    // a very minor issue, and fixing it will make import slower, so we don't
-    // bother.
-    bool has_indexed = false;
-    if (text_database_) {
-      // We do not have to make it update the visit database, below, we will
-      // create the visit entry with the indexed flag set.
-      has_indexed = text_database_->AddPageData(i->url(), url_id, 0,
-                                                i->last_visit(),
-                                                i->title(), string16());
-    }
-
     // Sync code manages the visits itself.
     if (visit_source != SOURCE_SYNCED) {
       // Make up a visit to correspond to the last visit to the page.
@@ -966,7 +863,6 @@
                               content::PAGE_TRANSITION_LINK |
                               content::PAGE_TRANSITION_CHAIN_START |
                               content::PAGE_TRANSITION_CHAIN_END), 0);
-      visit_info.is_indexed = has_indexed;
       if (!visit_database->AddVisit(&visit_info, visit_source)) {
         NOTREACHED() << "Adding visit failed.";
         return;
@@ -1001,10 +897,6 @@
   if (!db_)
     return;
 
-  // Update the full text index.
-  if (text_database_)
-    text_database_->AddPageTitle(url, title);
-
   // Search for recent redirects which should get the same title. We make a
   // dummy list containing the exact URL visited if there are no redirects so
   // the processing below can be the same.
@@ -1499,59 +1391,6 @@
     result->set_reached_beginning(true);
 }
 
-void HistoryBackend::QueryHistoryFTS(const string16& text_query,
-                                     const QueryOptions& options,
-                                     QueryResults* result) {
-  if (!text_database_)
-    return;
-
-  // Full text query, first get all the FTS results in the time range.
-  std::vector<TextDatabase::Match> fts_matches;
-  Time first_time_searched;
-  text_database_->GetTextMatches(text_query, options,
-                                 &fts_matches, &first_time_searched);
-
-  URLQuerier querier(db_.get(), archived_db_.get(), true);
-
-  // Now get the row and visit information for each one.
-  URLResult url_result;  // Declare outside loop to prevent re-construction.
-  for (size_t i = 0; i < fts_matches.size(); i++) {
-    if (options.max_count != 0 &&
-        static_cast<int>(result->size()) >= options.max_count)
-      break;  // Got too many items.
-
-    // Get the URL, querying the main and archived databases as necessary. If
-    // this is not found, the history and full text search databases are out
-    // of sync and we give up with this result.
-    if (!querier.GetRowForURL(fts_matches[i].url, &url_result))
-      continue;
-
-    if (!url_result.url().is_valid())
-      continue;  // Don't report invalid URLs in case of corruption.
-
-    // Copy over the FTS stuff that the URLDatabase doesn't know about.
-    // We do this with swap() to avoid copying, since we know we don't
-    // need the original any more. Note that we override the title with the
-    // one from FTS, since that will match the title_match_positions (the
-    // FTS title and the history DB title may differ).
-    url_result.set_title(fts_matches[i].title);
-    url_result.title_match_positions_.swap(
-        fts_matches[i].title_match_positions);
-    url_result.snippet_.Swap(&fts_matches[i].snippet);
-
-    // The visit time also comes from the full text search database. Since it
-    // has the time, we can avoid an extra query of the visits table.
-    url_result.set_visit_time(fts_matches[i].time);
-
-    // Add it to the vector, this will clear our |url_row| object as a
-    // result of the swap.
-    result->AppendURLBySwapping(&url_result);
-  }
-
-  if (first_time_searched <= first_recorded_time_)
-    result->set_reached_beginning(true);
-}
-
 // Frontend to GetMostRecentRedirectsFrom from the history thread.
 void HistoryBackend::QueryRedirectsFrom(
     scoped_refptr<QueryRedirectsRequest> request,
@@ -1811,14 +1650,6 @@
   provider->ExecuteWithDB(this, db_.get(), params);
 }
 
-void HistoryBackend::SetPageContents(const GURL& url,
-                                     const string16& contents) {
-  // This is histogrammed in the text database manager.
-  if (!text_database_)
-    return;
-  text_database_->AddPageContents(url, contents);
-}
-
 void HistoryBackend::SetPageThumbnail(
     const GURL& url,
     const gfx::Image* thumbnail,
@@ -1902,6 +1733,23 @@
   }
 }
 
+void HistoryBackend::DeleteFTSIndexDatabases() {
+  // Find files on disk matching the text databases file pattern so we can
+  // quickly test for and delete them.
+  base::FilePath::StringType filepattern =
+      FILE_PATH_LITERAL("History Index *");
+  base::FileEnumerator enumerator(
+      history_dir_, false, base::FileEnumerator::FILES, filepattern);
+  int num_databases_deleted = 0;
+  base::FilePath current_file;
+  while (!(current_file = enumerator.Next()).empty()) {
+    if (sql::Connection::Delete(current_file))
+      num_databases_deleted++;
+  }
+  UMA_HISTOGRAM_COUNTS("History.DeleteFTSIndexDatabases",
+                       num_databases_deleted);
+}
+
 bool HistoryBackend::GetThumbnailFromOlderRedirect(
     const GURL& page_url,
     std::vector<unsigned char>* data) {
@@ -2668,11 +2516,6 @@
     archived_db_->CommitTransaction();
     archived_db_->BeginTransaction();
   }
-
-  if (text_database_) {
-    text_database_->CommitTransaction();
-    text_database_->BeginTransaction();
-  }
 }
 
 void HistoryBackend::ScheduleCommit() {
@@ -2903,7 +2746,7 @@
 
   // The expirer keeps tabs on the active databases. Tell it about the
   // databases which will be closed.
-  expirer_.SetDatabases(NULL, NULL, NULL, NULL);
+  expirer_.SetDatabases(NULL, NULL, NULL);
 
   // Reopen a new transaction for |db_| for the sake of CloseAllDatabases().
   db_->BeginTransaction();
@@ -2993,15 +2836,7 @@
     LOG(ERROR) << "Main history could not be cleared";
   kept_urls.clear();
 
-  // Delete FTS files & archived history.
-  if (text_database_) {
-    // We assume that the text database has one transaction on them that we need
-    // to close & restart (the long-running history transaction).
-    text_database_->CommitTransaction();
-    text_database_->DeleteAll();
-    text_database_->BeginTransaction();
-  }
-
+  // Delete archived history.
   if (archived_db_) {
     // Close the database and delete the file.
     archived_db_.reset();
diff --git a/chrome/browser/history/history_backend.h b/chrome/browser/history/history_backend.h
index c4010b7..fd92878 100644
--- a/chrome/browser/history/history_backend.h
+++ b/chrome/browser/history/history_backend.h
@@ -20,7 +20,6 @@
 #include "chrome/browser/history/history_database.h"
 #include "chrome/browser/history/history_marshaling.h"
 #include "chrome/browser/history/history_types.h"
-#include "chrome/browser/history/text_database_manager.h"
 #include "chrome/browser/history/thumbnail_database.h"
 #include "chrome/browser/history/visit_tracker.h"
 #include "chrome/browser/search_engines/template_url_id.h"
@@ -162,11 +161,6 @@
                              const GURL& url,
                              base::Time end_ts);
 
-
-  // Indexing ------------------------------------------------------------------
-
-  void SetPageContents(const GURL& url, const string16& contents);
-
   // Querying ------------------------------------------------------------------
 
   // ScheduleAutocomplete() never frees |provider| (which is globally live).
@@ -564,6 +558,7 @@
   FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, QueryFilteredURLs);
   FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, UpdateVisitDuration);
   FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, ExpireHistoryForTimes);
+  FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, DeleteFTSIndexDatabases);
 
   friend class ::TestingProfile;
 
@@ -658,9 +653,6 @@
                         const string16& text_query,
                         const QueryOptions& options,
                         QueryResults* result);
-  void QueryHistoryFTS(const string16& text_query,
-                       const QueryOptions& options,
-                       QueryResults* result);
 
   // Committing ----------------------------------------------------------------
 
@@ -843,6 +835,9 @@
   // The IDs of the URLs may change.
   bool ClearAllMainHistory(const URLRows& kept_urls);
 
+  // Deletes the FTS index database files, which are no longer used.
+  void DeleteFTSIndexDatabases();
+
   // Returns the BookmarkService, blocking until it is loaded. This may return
   // NULL during testing.
   BookmarkService* GetBookmarkService();
@@ -875,10 +870,6 @@
   // Stores old history in a larger, slower database.
   scoped_ptr<ArchivedDatabase> archived_db_;
 
-  // Full text database manager, possibly NULL if the database could not be
-  // created.
-  scoped_ptr<TextDatabaseManager> text_database_;
-
   // Manages expiration between the various databases.
   ExpireHistoryBackend expirer_;
 
diff --git a/chrome/browser/history/history_backend_unittest.cc b/chrome/browser/history/history_backend_unittest.cc
index 7bd2328..8bb0111 100644
--- a/chrome/browser/history/history_backend_unittest.cc
+++ b/chrome/browser/history/history_backend_unittest.cc
@@ -5,6 +5,7 @@
 #include <algorithm>
 #include <set>
 #include <vector>
+#include <fstream>
 
 #include "base/basictypes.h"
 #include "base/bind.h"
@@ -15,6 +16,7 @@
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/path_service.h"
+#include "base/platform_file.h"
 #include "base/strings/string16.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/utf_string_conversions.h"
@@ -504,12 +506,10 @@
   VisitVector visits;
   backend_->db_->GetVisitsForURL(row1_id, &visits);
   ASSERT_EQ(1U, visits.size());
-  VisitID visit1_id = visits[0].visit_id;
 
   visits.clear();
   backend_->db_->GetVisitsForURL(row2_id, &visits);
   ASSERT_EQ(1U, visits.size());
-  VisitID visit2_id = visits[0].visit_id;
 
   // The in-memory backend should have been set and it should have gotten the
   // typed URL.
@@ -539,16 +539,6 @@
   bookmark_model_.AddURL(
       bookmark_model_.bookmark_bar_node(), 0, string16(), row1.url());
 
-  // Set full text index for each one.
-  backend_->text_database_->AddPageData(row1.url(), row1_id, visit1_id,
-                                        row1.last_visit(),
-                                        UTF8ToUTF16("Title 1"),
-                                        UTF8ToUTF16("Body 1"));
-  backend_->text_database_->AddPageData(row2.url(), row2_id, visit2_id,
-                                        row2.last_visit(),
-                                        UTF8ToUTF16("Title 2"),
-                                        UTF8ToUTF16("Body 2"));
-
   // Now finally clear all history.
   backend_->DeleteAllHistory();
 
@@ -615,15 +605,6 @@
 
   // The first URL should still be bookmarked.
   EXPECT_TRUE(bookmark_model_.IsBookmarked(row1.url()));
-
-  // The full text database should have no data.
-  std::vector<TextDatabase::Match> text_matches;
-  Time first_time_searched;
-  backend_->text_database_->GetTextMatches(UTF8ToUTF16("Body"),
-                                           QueryOptions(),
-                                           &text_matches,
-                                           &first_time_searched);
-  EXPECT_EQ(0U, text_matches.size());
 }
 
 // Checks that adding a visit, then calling DeleteAll, and then trying to add
@@ -659,9 +640,8 @@
   backend_->db_->GetAllVisitsInRange(Time(), Time(), 0, &all_visits);
   ASSERT_EQ(0U, all_visits.size());
 
-  // Try and set the full text index.
+  // Try and set the title.
   backend_->SetPageTitle(url, UTF8ToUTF16("Title"));
-  backend_->SetPageContents(url, UTF8ToUTF16("Body"));
 
   // The row should still be deleted.
   EXPECT_FALSE(backend_->db_->GetRowForURL(url, &outrow));
@@ -669,15 +649,6 @@
   // The visit should still be deleted.
   backend_->db_->GetAllVisitsInRange(Time(), Time(), 0, &all_visits);
   ASSERT_EQ(0U, all_visits.size());
-
-  // The full text database should have no data.
-  std::vector<TextDatabase::Match> text_matches;
-  Time first_time_searched;
-  backend_->text_database_->GetTextMatches(UTF8ToUTF16("Body"),
-                                           QueryOptions(),
-                                           &text_matches,
-                                           &first_time_searched);
-  EXPECT_EQ(0U, text_matches.size());
 }
 
 TEST_F(HistoryBackendTest, URLsNoLongerBookmarked) {
@@ -2791,7 +2762,7 @@
 TEST_F(HistoryBackendTest, RemoveNotification) {
   scoped_ptr<TestingProfile> profile(new TestingProfile());
 
-  profile->CreateHistoryService(false, false);
+  ASSERT_TRUE(profile->CreateHistoryService(false, false));
   profile->CreateBookmarkModel(true);
   BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile.get());
   ui_test_utils::WaitForBookmarkModelToLoad(model);
@@ -2812,4 +2783,42 @@
   service->DeleteURL(url);
 }
 
+// Simple function to create a new dummy file.
+void CreateDummyFile(const base::FilePath& filename) {
+  std::wofstream file;
+  file.open(filename.value().c_str());
+  ASSERT_TRUE(file.is_open());
+  file << L"Dummy";
+  file.close();
+}
+
+// Test DeleteFTSIndexDatabases deletes expected files.
+TEST_F(HistoryBackendTest, DeleteFTSIndexDatabases) {
+  ASSERT_TRUE(backend_.get());
+
+  base::FilePath history_path(getTestDir());
+  base::FilePath db1(history_path.AppendASCII("History Index 2013-05"));
+  base::FilePath db1_journal(db1.InsertBeforeExtensionASCII("-journal"));
+  base::FilePath db1_wal(db1.InsertBeforeExtensionASCII("-wal"));
+  base::FilePath db2_symlink(history_path.AppendASCII("History Index 2013-06"));
+  base::FilePath db2_actual(history_path.AppendASCII("Underlying DB"));
+
+  // Setup dummy index database files.
+  CreateDummyFile(db1);
+  CreateDummyFile(db1_journal);
+  CreateDummyFile(db1_wal);
+  CreateDummyFile(db2_actual);
+#if defined(OS_POSIX)
+  EXPECT_TRUE(file_util::CreateSymbolicLink(db2_actual, db2_symlink));
+#endif
+
+  // Delete all DTS index databases.
+  backend_->DeleteFTSIndexDatabases();
+  EXPECT_FALSE(base::PathExists(db1));
+  EXPECT_FALSE(base::PathExists(db1_wal));
+  EXPECT_FALSE(base::PathExists(db1_journal));
+  EXPECT_FALSE(base::PathExists(db2_symlink));
+  EXPECT_TRUE(base::PathExists(db2_actual));  // Symlinks shouldn't be followed.
+}
+
 }  // namespace history
diff --git a/chrome/browser/history/history_database.cc b/chrome/browser/history/history_database.cc
index 3db7acd..20cb023 100644
--- a/chrome/browser/history/history_database.cc
+++ b/chrome/browser/history/history_database.cc
@@ -441,15 +441,13 @@
 #if !defined(OS_WIN)
 void HistoryDatabase::MigrateTimeEpoch() {
   // Update all the times in the URLs and visits table in the main database.
-  // For visits, clear the indexed flag since we'll delete the FTS databases in
-  // the next step.
   ignore_result(db_.Execute(
       "UPDATE urls "
       "SET last_visit_time = last_visit_time + 11644473600000000 "
       "WHERE id IN (SELECT id FROM urls WHERE last_visit_time > 0);"));
   ignore_result(db_.Execute(
       "UPDATE visits "
-      "SET visit_time = visit_time + 11644473600000000, is_indexed = 0 "
+      "SET visit_time = visit_time + 11644473600000000 "
       "WHERE id IN (SELECT id FROM visits WHERE visit_time > 0);"));
   ignore_result(db_.Execute(
       "UPDATE segment_usage "
diff --git a/chrome/browser/history/history_service.cc b/chrome/browser/history/history_service.cc
index b697f37..644dc85 100644
--- a/chrome/browser/history/history_service.cc
+++ b/chrome/browser/history/history_service.cc
@@ -14,10 +14,6 @@
 //                                      -> SQLite connection to History
 //                                   -> ArchivedDatabase
 //                                      -> SQLite connection to Archived History
-//                                   -> TextDatabaseManager
-//                                      -> SQLite connection to one month's data
-//                                      -> SQLite connection to one month's data
-//                                      ...
 //                                   -> ThumbnailDatabase
 //                                      -> SQLite connection to Thumbnails
 //                                         (and favicons)
@@ -597,16 +593,6 @@
                     &HistoryBackend::AddPagesWithDetails, info, visit_source);
 }
 
-void HistoryService::SetPageContents(const GURL& url,
-                                     const string16& contents) {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  if (!CanAddURL(url))
-    return;
-
-  ScheduleAndForget(PRIORITY_LOW, &HistoryBackend::SetPageContents,
-                    url, contents);
-}
-
 HistoryService::Handle HistoryService::GetPageThumbnail(
     const GURL& page_url,
     CancelableRequestConsumerBase* consumer,
diff --git a/chrome/browser/history/history_service.h b/chrome/browser/history/history_service.h
index 060614d..1662571 100644
--- a/chrome/browser/history/history_service.h
+++ b/chrome/browser/history/history_service.h
@@ -236,13 +236,6 @@
                              const GURL& url,
                              base::Time end_ts);
 
-  // Indexing ------------------------------------------------------------------
-
-  // Notifies history of the body text of the given recently-visited URL.
-  // If the URL was not visited "recently enough," the history system may
-  // discard it.
-  void SetPageContents(const GURL& url, const string16& contents);
-
   // Querying ------------------------------------------------------------------
 
   // Returns the information about the requested URL. If the URL is found,
diff --git a/chrome/browser/history/history_tab_helper.cc b/chrome/browser/history/history_tab_helper.cc
index f0285ab..96c545e 100644
--- a/chrome/browser/history/history_tab_helper.cc
+++ b/chrome/browser/history/history_tab_helper.cc
@@ -81,16 +81,6 @@
   return add_page_args;
 }
 
-bool HistoryTabHelper::OnMessageReceived(const IPC::Message& message) {
-  bool handled = true;
-  IPC_BEGIN_MESSAGE_MAP(HistoryTabHelper, message)
-    IPC_MESSAGE_HANDLER(ChromeViewHostMsg_PageContents, OnPageContents)
-    IPC_MESSAGE_UNHANDLED(handled = false)
-  IPC_END_MESSAGE_MAP()
-
-  return handled;
-}
-
 void HistoryTabHelper::DidNavigateMainFrame(
     const content::LoadCommittedDetails& details,
     const content::FrameNavigateParams& params) {
@@ -154,26 +144,6 @@
   }
 }
 
-void HistoryTabHelper::OnPageContents(const GURL& url,
-                                      int32 page_id,
-                                      const string16& contents) {
-  // Don't index any https pages. People generally don't want their bank
-  // accounts, etc. indexed on their computer, especially since some of these
-  // things are not marked cachable.
-  // TODO(brettw) we may want to consider more elaborate heuristics such as
-  // the cachability of the page. We may also want to consider subframes (this
-  // test will still index subframes if the subframe is SSL).
-  // TODO(zelidrag) bug chromium-os:2808 - figure out if we want to reenable
-  // content indexing for chromeos in some future releases.
-#if !defined(OS_CHROMEOS)
-  if (!url.SchemeIsSecure()) {
-    HistoryService* hs = GetHistoryService();
-    if (hs)
-      hs->SetPageContents(url, contents);
-  }
-#endif
-}
-
 HistoryService* HistoryTabHelper::GetHistoryService() {
   Profile* profile =
       Profile::FromBrowserContext(web_contents()->GetBrowserContext());
diff --git a/chrome/browser/history/history_tab_helper.h b/chrome/browser/history/history_tab_helper.h
index 95c4ee0..2f613fa 100644
--- a/chrome/browser/history/history_tab_helper.h
+++ b/chrome/browser/history/history_tab_helper.h
@@ -46,7 +46,6 @@
   friend class content::WebContentsUserData<HistoryTabHelper>;
 
   // content::WebContentsObserver implementation.
-  virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
   virtual void DidNavigateMainFrame(
       const content::LoadCommittedDetails& details,
       const content::FrameNavigateParams& params) OVERRIDE;
diff --git a/chrome/browser/history/history_types.cc b/chrome/browser/history/history_types.cc
index f0e6439..f766a0b 100644
--- a/chrome/browser/history/history_types.cc
+++ b/chrome/browser/history/history_types.cc
@@ -69,8 +69,7 @@
       url_id(0),
       referring_visit(0),
       transition(content::PAGE_TRANSITION_LINK),
-      segment_id(0),
-      is_indexed(false) {
+      segment_id(0) {
 }
 
 VisitRow::VisitRow(URLID arg_url_id,
@@ -83,8 +82,7 @@
       visit_time(arg_visit_time),
       referring_visit(arg_referring_visit),
       transition(arg_transition),
-      segment_id(arg_segment_id),
-      is_indexed(false) {
+      segment_id(arg_segment_id) {
 }
 
 VisitRow::~VisitRow() {
@@ -246,7 +244,6 @@
 
 QueryOptions::QueryOptions()
     : max_count(0),
-      body_only(false),
       duplicate_policy(QueryOptions::REMOVE_ALL_DUPLICATES) {
 }
 
diff --git a/chrome/browser/history/history_types.h b/chrome/browser/history/history_types.h
index 7fd1295..f23a310 100644
--- a/chrome/browser/history/history_types.h
+++ b/chrome/browser/history/history_types.h
@@ -246,13 +246,6 @@
   // If 0, the segment id is null in the table.
   SegmentID segment_id;
 
-  // True when this visit has indexed data for it. We try to keep this in sync
-  // with the full text index: when we add or remove things from there, we will
-  // update the visit table as well. However, that file could get deleted, or
-  // out of sync in various ways, so this flag should be false when things
-  // change.
-  bool is_indexed;
-
   // Record how much time a user has this visit starting from the user
   // opened this visit to the user closed or ended this visit.
   // This includes both active and inactive time as long as
@@ -460,10 +453,6 @@
   // enough room. When 0, this will return everything (the default).
   int max_count;
 
-  // Only search within the page body if true, otherwise search all columns
-  // including url and time. Defaults to false.
-  bool body_only;
-
   enum DuplicateHandling {
     // Omit visits for which there is a more recent visit to the same URL.
     // Each URL in the results will appear only once.
diff --git a/chrome/browser/history/in_memory_url_index_unittest.cc b/chrome/browser/history/in_memory_url_index_unittest.cc
index 1e0f72e..4556665 100644
--- a/chrome/browser/history/in_memory_url_index_unittest.cc
+++ b/chrome/browser/history/in_memory_url_index_unittest.cc
@@ -186,7 +186,7 @@
 
 void InMemoryURLIndexTest::SetUp() {
   // We cannot access the database until the backend has been loaded.
-  profile_.CreateHistoryService(true, false);
+  ASSERT_TRUE(profile_.CreateHistoryService(true, false));
   profile_.CreateBookmarkModel(true);
   ui_test_utils::WaitForBookmarkModelToLoad(&profile_);
   profile_.BlockUntilHistoryProcessesPendingRequests();
diff --git a/chrome/browser/history/text_database.cc b/chrome/browser/history/text_database.cc
deleted file mode 100644
index 0f5db89..0000000
--- a/chrome/browser/history/text_database.cc
+++ /dev/null
@@ -1,353 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <limits>
-#include <set>
-#include <string>
-
-#include "chrome/browser/history/text_database.h"
-
-#include "base/file_util.h"
-#include "base/logging.h"
-#include "base/metrics/histogram.h"
-#include "base/strings/string_number_conversions.h"
-#include "base/strings/stringprintf.h"
-#include "base/strings/utf_string_conversions.h"
-#include "sql/statement.h"
-#include "sql/transaction.h"
-
-// There are two tables in each database, one full-text search (FTS) table which
-// indexes the contents and title of the pages. The other is a regular SQLITE
-// table which contains non-indexed information about the page. All columns of
-// a FTS table are indexed using the text search algorithm, which isn't what we
-// want for things like times. If this were in the FTS table, there would be
-// different words in the index for each time number.
-//
-// "pages" FTS table:
-//   url    URL of the page so searches will match the URL.
-//   title  Title of the page.
-//   body   Body of the page.
-//
-// "info" regular table:
-//   time     Time the corresponding FTS entry was visited.
-//
-// We do joins across these two tables by using their internal rowids, which we
-// keep in sync between the two tables. The internal rowid is the only part of
-// an FTS table that is indexed like a normal table, and the index over it is
-// free since sqlite always indexes the internal rowid.
-
-namespace history {
-
-namespace {
-
-// Version 1 uses FTS2 for index files.
-// Version 2 uses FTS3.
-static const int kCurrentVersionNumber = 2;
-static const int kCompatibleVersionNumber = 2;
-
-// Snippet computation relies on the index of the columns in the original
-// create statement. These are the 0-based indices (as strings) of the
-// corresponding columns.
-const char kTitleColumnIndex[] = "1";
-const char kBodyColumnIndex[] = "2";
-
-// The string prepended to the database identifier to generate the filename.
-const base::FilePath::CharType kFilePrefix[] =
-    FILE_PATH_LITERAL("History Index ");
-
-}  // namespace
-
-TextDatabase::Match::Match() {}
-
-TextDatabase::Match::~Match() {}
-
-TextDatabase::TextDatabase(const base::FilePath& path,
-                           DBIdent id,
-                           bool allow_create)
-    : path_(path),
-      ident_(id),
-      allow_create_(allow_create) {
-  // Compute the file name.
-  file_name_ = path_.Append(IDToFileName(ident_));
-}
-
-TextDatabase::~TextDatabase() {
-}
-
-// static
-const base::FilePath::CharType* TextDatabase::file_base() {
-  return kFilePrefix;
-}
-
-// static
-base::FilePath TextDatabase::IDToFileName(DBIdent id) {
-  // Identifiers are intended to be a combination of the year and month, for
-  // example, 200801 for January 2008. We convert this to
-  // "History Index 2008-01". However, we don't make assumptions about this
-  // scheme: the caller should assign IDs as it feels fit with the knowledge
-  // that they will apppear on disk in this form.
-  base::FilePath::StringType filename(file_base());
-  base::StringAppendF(&filename, FILE_PATH_LITERAL("%d-%02d"),
-                      id / 100, id % 100);
-  return base::FilePath(filename);
-}
-
-// static
-TextDatabase::DBIdent TextDatabase::FileNameToID(
-    const base::FilePath& file_path) {
-  base::FilePath::StringType file_name = file_path.BaseName().value();
-
-  // We don't actually check the prefix here. Since the file system could
-  // be case insensitive in ways we can't predict (NTFS), checking could
-  // potentially be the wrong thing to do. Instead, we just look for a suffix.
-  static const size_t kIDStringLength = 7;  // Room for "xxxx-xx".
-  if (file_name.length() < kIDStringLength)
-    return 0;
-  const base::FilePath::StringType suffix(
-      &file_name[file_name.length() - kIDStringLength]);
-
-  if (suffix.length() != kIDStringLength ||
-      suffix[4] != FILE_PATH_LITERAL('-')) {
-    return 0;
-  }
-
-  // TODO: Once StringPiece supports a templated interface over the
-  // underlying string type, use it here instead of substr, since that
-  // will avoid needless string copies.  StringPiece cannot be used
-  // right now because base::FilePath::StringType could use either 8 or 16 bit
-  // characters, depending on the OS.
-  int year, month;
-  base::StringToInt(suffix.substr(0, 4), &year);
-  base::StringToInt(suffix.substr(5, 2), &month);
-
-  return year * 100 + month;
-}
-
-bool TextDatabase::Init() {
-  // Make sure, if we're not allowed to create the file, that it exists.
-  if (!allow_create_) {
-    if (!base::PathExists(file_name_))
-      return false;
-  }
-
-  db_.set_histogram_tag("Text");
-
-  // Set the database page size to something a little larger to give us
-  // better performance (we're typically seek rather than bandwidth limited).
-  // This only has an effect before any tables have been created, otherwise
-  // this is a NOP. Must be a power of 2 and a max of 8192.
-  db_.set_page_size(4096);
-
-  // The default cache size is 2000 which give >8MB of data. Since we will often
-  // have 2-3 of these objects, each with their own 8MB, this adds up very fast.
-  // We therefore reduce the size so when there are multiple objects, we're not
-  // too big.
-  db_.set_cache_size(512);
-
-  // Run the database in exclusive mode. Nobody else should be accessing the
-  // database while we're running, and this will give somewhat improved perf.
-  db_.set_exclusive_locking();
-
-  // Attach the database to our index file.
-  if (!db_.Open(file_name_))
-    return false;
-
-  // Meta table tracking version information.
-  if (!meta_table_.Init(&db_, kCurrentVersionNumber, kCompatibleVersionNumber))
-    return false;
-  if (meta_table_.GetCompatibleVersionNumber() > kCurrentVersionNumber) {
-    // This version is too new. We don't bother notifying the user on this
-    // error, and just fail to use the file. Normally if they have version skew,
-    // they will get it for the main history file and it won't be necessary
-    // here. If that's not the case, since this is only indexed data, it's
-    // probably better to just not give FTS results than strange errors when
-    // everything else is working OK.
-    LOG(WARNING) << "Text database is too new.";
-    return false;
-  }
-
-  return CreateTables();
-}
-
-void TextDatabase::BeginTransaction() {
-  db_.BeginTransaction();
-}
-
-void TextDatabase::CommitTransaction() {
-  db_.CommitTransaction();
-}
-
-bool TextDatabase::CreateTables() {
-  // FTS table of page contents.
-  if (!db_.DoesTableExist("pages")) {
-    if (!db_.Execute("CREATE VIRTUAL TABLE pages USING fts3("
-                     "TOKENIZE icu,"
-                     "url LONGVARCHAR,"
-                     "title LONGVARCHAR,"
-                     "body LONGVARCHAR)"))
-      return false;
-  }
-
-  // Non-FTS table containing URLs and times so we can efficiently find them
-  // using a regular index (all FTS columns are special and are treated as
-  // full-text-search, which is not what we want when retrieving this data).
-  if (!db_.DoesTableExist("info")) {
-    // Note that there is no point in creating an index over time. Since
-    // we must always query the entire FTS table (it can not efficiently do
-    // subsets), we will always end up doing that first, and joining the info
-    // table off of that.
-    if (!db_.Execute("CREATE TABLE info(time INTEGER NOT NULL)"))
-      return false;
-  }
-
-  // Create the index.
-  return db_.Execute("CREATE INDEX IF NOT EXISTS info_time ON info(time)");
-}
-
-bool TextDatabase::AddPageData(base::Time time,
-                               const std::string& url,
-                               const std::string& title,
-                               const std::string& contents) {
-  sql::Transaction committer(&db_);
-  if (!committer.Begin())
-    return false;
-
-  // Add to the pages table.
-  sql::Statement add_to_pages(db_.GetCachedStatement(SQL_FROM_HERE,
-      "INSERT INTO pages (url, title, body) VALUES (?,?,?)"));
-  add_to_pages.BindString(0, url);
-  add_to_pages.BindString(1, title);
-  add_to_pages.BindString(2, contents);
-  if (!add_to_pages.Run())
-    return false;
-
-  int64 rowid = db_.GetLastInsertRowId();
-
-  // Add to the info table with the same rowid.
-  sql::Statement add_to_info(db_.GetCachedStatement(SQL_FROM_HERE,
-      "INSERT INTO info (rowid, time) VALUES (?,?)"));
-  add_to_info.BindInt64(0, rowid);
-  add_to_info.BindInt64(1, time.ToInternalValue());
-
-  if (!add_to_info.Run())
-    return false;
-
-  return committer.Commit();
-}
-
-void TextDatabase::DeletePageData(base::Time time, const std::string& url) {
-  // First get all rows that match. Selecing on time (which has an index) allows
-  // us to avoid brute-force searches on the full-text-index table (there will
-  // generally be only one match per time).
-  sql::Statement select_ids(db_.GetCachedStatement(SQL_FROM_HERE,
-      "SELECT info.rowid "
-      "FROM info JOIN pages ON info.rowid = pages.rowid "
-      "WHERE info.time=? AND pages.url=?"));
-  select_ids.BindInt64(0, time.ToInternalValue());
-  select_ids.BindString(1, url);
-
-  std::set<int64> rows_to_delete;
-  while (select_ids.Step())
-    rows_to_delete.insert(select_ids.ColumnInt64(0));
-
-  // Delete from the pages table.
-  sql::Statement delete_page(db_.GetCachedStatement(SQL_FROM_HERE,
-      "DELETE FROM pages WHERE rowid=?"));
-
-  for (std::set<int64>::const_iterator i = rows_to_delete.begin();
-       i != rows_to_delete.end(); ++i) {
-    delete_page.BindInt64(0, *i);
-    if (!delete_page.Run())
-      return;
-    delete_page.Reset(true);
-  }
-
-  // Delete from the info table.
-  sql::Statement delete_info(db_.GetCachedStatement(SQL_FROM_HERE,
-      "DELETE FROM info WHERE rowid=?"));
-
-  for (std::set<int64>::const_iterator i = rows_to_delete.begin();
-       i != rows_to_delete.end(); ++i) {
-    delete_info.BindInt64(0, *i);
-    if (!delete_info.Run())
-      return;
-    delete_info.Reset(true);
-  }
-}
-
-void TextDatabase::Optimize() {
-  sql::Statement statement(db_.GetCachedStatement(SQL_FROM_HERE,
-      "SELECT OPTIMIZE(pages) FROM pages LIMIT 1"));
-  statement.Run();
-}
-
-bool TextDatabase::GetTextMatches(const std::string& query,
-                                  const QueryOptions& options,
-                                  std::vector<Match>* results,
-                                  URLSet* found_urls) {
-  std::string sql = "SELECT url, title, time, offsets(pages), body FROM pages "
-                    "LEFT OUTER JOIN info ON pages.rowid = info.rowid WHERE ";
-  sql += options.body_only ? "body " : "pages ";
-  sql += "MATCH ? AND time >= ? AND time < ? ";
-  // Times may not be unique, so also sort by rowid to ensure a stable order.
-  sql += "ORDER BY time DESC, info.rowid DESC";
-
-  // Generate unique IDs for the two possible variations of the statement,
-  // so they don't share the same cached prepared statement.
-  sql::StatementID body_only_id = SQL_FROM_HERE;
-  sql::StatementID pages_id = SQL_FROM_HERE;
-
-  sql::Statement statement(db_.GetCachedStatement(
-      (options.body_only ? body_only_id : pages_id), sql.c_str()));
-
-  statement.BindString(0, query);
-  statement.BindInt64(1, options.EffectiveBeginTime());
-  statement.BindInt64(2, options.EffectiveEndTime());
-
-  // |results| may not be initially empty, so keep track of how many were added
-  // by this call.
-  int result_count = 0;
-
-  while (statement.Step()) {
-    // TODO(brettw) allow canceling the query in the middle.
-    // if (canceled_or_something)
-    //   break;
-
-    GURL url(statement.ColumnString(0));
-    URLSet::const_iterator found_url = found_urls->find(url);
-    if (found_url != found_urls->end())
-      continue;  // Don't add this duplicate.
-
-    if (++result_count > options.EffectiveMaxCount())
-      break;
-
-    // Fill the results into the vector (avoid copying the URL with Swap()).
-    results->resize(results->size() + 1);
-    Match& match = results->at(results->size() - 1);
-    match.url.Swap(&url);
-
-    match.title = statement.ColumnString16(1);
-    match.time = base::Time::FromInternalValue(statement.ColumnInt64(2));
-
-    // Extract any matches in the title.
-    std::string offsets_str = statement.ColumnString(3);
-    Snippet::ExtractMatchPositions(offsets_str, kTitleColumnIndex,
-                                   &match.title_match_positions);
-    Snippet::ConvertMatchPositionsToWide(statement.ColumnString(1),
-                                         &match.title_match_positions);
-
-    // Extract the matches in the body.
-    Snippet::MatchPositions match_positions;
-    Snippet::ExtractMatchPositions(offsets_str, kBodyColumnIndex,
-                                   &match_positions);
-
-    // Compute the snippet based on those matches.
-    std::string body = statement.ColumnString(4);
-    match.snippet.ComputeSnippet(match_positions, body);
-  }
-  statement.Reset(true);
-  return result_count > options.EffectiveMaxCount();
-}
-
-}  // namespace history
diff --git a/chrome/browser/history/text_database.h b/chrome/browser/history/text_database.h
deleted file mode 100644
index ddb247b..0000000
--- a/chrome/browser/history/text_database.h
+++ /dev/null
@@ -1,165 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_HISTORY_TEXT_DATABASE_H_
-#define CHROME_BROWSER_HISTORY_TEXT_DATABASE_H_
-
-#include <set>
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/files/file_path.h"
-#include "base/strings/string16.h"
-#include "chrome/browser/history/history_types.h"
-#include "sql/connection.h"
-#include "sql/meta_table.h"
-#include "url/gurl.h"
-
-namespace history {
-
-// Encapsulation of a full-text indexed database file.
-class TextDatabase {
- public:
-  typedef int DBIdent;
-
-  typedef std::set<GURL> URLSet;
-
-  // Returned from the search function.
-  struct Match {
-    Match();
-    ~Match();
-
-    // URL of the match.
-    GURL url;
-
-    // The title is returned because the title in the text database and the URL
-    // database may differ. This happens because we capture the title when the
-    // body is captured, and don't update it later.
-    string16 title;
-
-    // Time the page that was returned was visited.
-    base::Time time;
-
-    // Identifies any found matches in the title of the document. These are not
-    // included in the snippet.
-    Snippet::MatchPositions title_match_positions;
-
-    // Snippet of the match we generated from the body.
-    Snippet snippet;
-  };
-
-  // Note: You must call init which must succeed before using this class.
-  //
-  // Computes the matches for the query, returning results in decreasing order
-  // of visit time.
-  //
-  // This function will attach the new database to the given database
-  // connection. This allows one sqlite3 object to share many TextDatabases,
-  // meaning that they will all share the same cache, which allows us to limit
-  // the total size that text indexing databasii can take up.
-  //
-  // |file_name| is the name of the file on disk.
-  //
-  // ID is the identifier for the database. It should uniquely identify it among
-  // other databases on disk and in the sqlite connection.
-  //
-  // |allow_create| indicates if we want to allow creation of the file if it
-  // doesn't exist. For files associated with older time periods, we don't want
-  // to create them if they don't exist, so this flag would be false.
-  TextDatabase(const base::FilePath& path,
-               DBIdent id,
-               bool allow_create);
-  ~TextDatabase();
-
-  // Initializes the database connection and creates the file if the class
-  // was created with |allow_create|. If the file couldn't be opened or
-  // created, this will return false. No other functions should be called
-  // after this.
-  bool Init();
-
-  // Allows updates to be batched. This gives higher performance when multiple
-  // updates are happening because every insert doesn't require a sync to disk.
-  // Transactions can be nested, only the outermost one will actually count.
-  void BeginTransaction();
-  void CommitTransaction();
-
-  // For testing, returns the file name of the database so it can be deleted
-  // after the test. This is valid even before Init() is called.
-  const base::FilePath& file_name() const { return file_name_; }
-
-  // Returns a NULL-terminated string that is the base of history index files,
-  // which is the part before the database identifier. For example
-  // "History Index *". This is for finding existing database files.
-  static const base::FilePath::CharType* file_base();
-
-  // Converts a filename on disk (optionally including a path) to a database
-  // identifier. If the filename doesn't have the correct format, returns 0.
-  static DBIdent FileNameToID(const base::FilePath& file_path);
-
-  // Changing operations -------------------------------------------------------
-
-  // Adds the given data to the page. Returns true on success. The data should
-  // already be converted to UTF-8.
-  bool AddPageData(base::Time time,
-                   const std::string& url,
-                   const std::string& title,
-                   const std::string& contents);
-
-  // Deletes the indexed data exactly matching the given URL/time pair.
-  void DeletePageData(base::Time time, const std::string& url);
-
-  // Optimizes the tree inside the database. This will, in addition to making
-  // access faster, remove any deleted data from the database (normally it is
-  // added again as "removed" and it is manually cleaned up when it decides to
-  // optimize it naturally). It is bad for privacy if a user is deleting a
-  // page from history but it still exists in the full text database in some
-  // form. This function will clean that up.
-  void Optimize();
-
-  // Querying ------------------------------------------------------------------
-
-  // Executes the given query. See QueryOptions for more info on input.
-  //
-  // The results are appended to any existing ones in |*results|.
-  //
-  // Any URLs found will be added to |unique_urls|. If a URL is already in the
-  // set, additional results will not be added (giving the ability to uniquify
-  // URL results).
-  //
-  // Callers must run QueryParser on the user text and pass the results of the
-  // QueryParser to this method as the query string.
-  //
-  // Returns true if there are more results available, i.e. if the number of
-  // results was restricted by |options.max_count|.
-  bool GetTextMatches(const std::string& query,
-                      const QueryOptions& options,
-                      std::vector<Match>* results,
-                      URLSet* unique_urls);
-
-  // Converts the given database identifier to a filename. This does not include
-  // the path, just the file and extension.
-  static base::FilePath IDToFileName(DBIdent id);
-
- private:
-  // Ensures that the tables and indices are created. Returns true on success.
-  bool CreateTables();
-
-  // The sql database. Not valid until Init is called.
-  sql::Connection db_;
-
-  const base::FilePath path_;
-  const DBIdent ident_;
-  const bool allow_create_;
-
-  // Full file name of the file on disk, computed in Init().
-  base::FilePath file_name_;
-
-  sql::MetaTable meta_table_;
-
-  DISALLOW_COPY_AND_ASSIGN(TextDatabase);
-};
-
-}  // namespace history
-
-#endif  // CHROME_BROWSER_HISTORY_TEXT_DATABASE_H_
diff --git a/chrome/browser/history/text_database_manager.cc b/chrome/browser/history/text_database_manager.cc
deleted file mode 100644
index c43a5fc..0000000
--- a/chrome/browser/history/text_database_manager.cc
+++ /dev/null
@@ -1,586 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/history/text_database_manager.h"
-
-#include <algorithm>
-#include <functional>
-
-#include "base/bind.h"
-#include "base/compiler_specific.h"
-#include "base/files/file_enumerator.h"
-#include "base/logging.h"
-#include "base/message_loop/message_loop.h"
-#include "base/metrics/histogram.h"
-#include "base/strings/string_util.h"
-#include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/history/history_publisher.h"
-#include "chrome/browser/history/visit_database.h"
-
-using base::Time;
-using base::TimeDelta;
-using base::TimeTicks;
-
-namespace history {
-
-namespace {
-
-// The number of database files we will be attached to at once.
-const int kCacheDBSize = 5;
-
-std::string ConvertStringForIndexer(const string16& input) {
-  // TODO(evanm): other transformations here?
-  return UTF16ToUTF8(CollapseWhitespace(input, false));
-}
-
-// Data older than this will be committed to the full text index even if we
-// haven't gotten a title and/or body.
-const int kExpirationSeconds = 20;
-
-}  // namespace
-
-// TextDatabaseManager::ChangeSet ----------------------------------------------
-
-TextDatabaseManager::ChangeSet::ChangeSet() {}
-
-TextDatabaseManager::ChangeSet::~ChangeSet() {}
-
-// TextDatabaseManager::PageInfo -----------------------------------------------
-
-TextDatabaseManager::PageInfo::PageInfo(URLID url_id,
-                                        VisitID visit_id,
-                                        Time visit_time)
-    : url_id_(url_id),
-      visit_id_(visit_id),
-      visit_time_(visit_time) {
-  added_time_ = TimeTicks::Now();
-}
-
-TextDatabaseManager::PageInfo::~PageInfo() {}
-
-void TextDatabaseManager::PageInfo::set_title(const string16& ttl) {
-  if (ttl.empty())  // Make the title nonempty when we set it for EverybodySet.
-    title_ = ASCIIToUTF16(" ");
-  else
-    title_ = ttl;
-}
-
-void TextDatabaseManager::PageInfo::set_body(const string16& bdy) {
-  if (bdy.empty())  // Make the body nonempty when we set it for EverybodySet.
-    body_ = ASCIIToUTF16(" ");
-  else
-    body_ = bdy;
-}
-
-bool TextDatabaseManager::PageInfo::Expired(TimeTicks now) const {
-  return now - added_time_ > base::TimeDelta::FromSeconds(kExpirationSeconds);
-}
-
-// TextDatabaseManager ---------------------------------------------------------
-
-TextDatabaseManager::TextDatabaseManager(const base::FilePath& dir,
-                                         URLDatabase* url_database,
-                                         VisitDatabase* visit_database)
-    : dir_(dir),
-      url_database_(url_database),
-      visit_database_(visit_database),
-      recent_changes_(RecentChangeList::NO_AUTO_EVICT),
-      transaction_nesting_(0),
-      db_cache_(DBCache::NO_AUTO_EVICT),
-      present_databases_loaded_(false),
-      weak_factory_(this),
-      history_publisher_(NULL) {
-}
-
-TextDatabaseManager::~TextDatabaseManager() {
-  if (transaction_nesting_)
-    CommitTransaction();
-}
-
-// static
-TextDatabase::DBIdent TextDatabaseManager::TimeToID(Time time) {
-  Time::Exploded exploded;
-  time.UTCExplode(&exploded);
-
-  // We combine the month and year into a 6-digit number (200801 for
-  // January, 2008). The month is 1-based.
-  return exploded.year * 100 + exploded.month;
-}
-
-// static
-Time TextDatabaseManager::IDToTime(TextDatabase::DBIdent id) {
-  Time::Exploded exploded;
-  memset(&exploded, 0, sizeof(Time::Exploded));
-  exploded.year = id / 100;
-  exploded.month = id % 100;
-  return Time::FromUTCExploded(exploded);
-}
-
-bool TextDatabaseManager::Init(const HistoryPublisher* history_publisher) {
-  history_publisher_ = history_publisher;
-
-  // Start checking recent changes and committing them.
-  ScheduleFlushOldChanges();
-  return true;
-}
-
-void TextDatabaseManager::BeginTransaction() {
-  transaction_nesting_++;
-}
-
-void TextDatabaseManager::CommitTransaction() {
-  DCHECK(transaction_nesting_);
-  transaction_nesting_--;
-  if (transaction_nesting_)
-    return;  // Still more nesting of transactions before committing.
-
-  // Commit all databases with open transactions on them.
-  for (DBIdentSet::const_iterator i = open_transactions_.begin();
-       i != open_transactions_.end(); ++i) {
-    DBCache::iterator iter = db_cache_.Get(*i);
-    if (iter == db_cache_.end()) {
-      NOTREACHED() << "All open transactions should be cached.";
-      continue;
-    }
-    iter->second->CommitTransaction();
-  }
-  open_transactions_.clear();
-
-  // Now that the transaction is over, we can expire old connections.
-  db_cache_.ShrinkToSize(kCacheDBSize);
-}
-
-void TextDatabaseManager::InitDBList() {
-  if (present_databases_loaded_)
-    return;
-
-  present_databases_loaded_ = true;
-
-  // Find files on disk matching our pattern so we can quickly test for them.
-  base::FilePath::StringType filepattern(TextDatabase::file_base());
-  filepattern.append(FILE_PATH_LITERAL("*"));
-  base::FileEnumerator enumerator(
-      dir_, false, base::FileEnumerator::FILES, filepattern);
-  base::FilePath cur_file;
-  while (!(cur_file = enumerator.Next()).empty()) {
-    // Convert to the number representing this file.
-    TextDatabase::DBIdent id = TextDatabase::FileNameToID(cur_file);
-    if (id)  // Will be 0 on error.
-      present_databases_.insert(id);
-  }
-}
-
-void TextDatabaseManager::AddPageURL(const GURL& url,
-                                     URLID url_id,
-                                     VisitID visit_id,
-                                     Time time) {
-  // Delete any existing page info.
-  RecentChangeList::iterator found = recent_changes_.Peek(url);
-  if (found != recent_changes_.end())
-    recent_changes_.Erase(found);
-
-  // Just save this info for later. We will save it when it expires or when all
-  // the data is complete.
-  recent_changes_.Put(url, PageInfo(url_id, visit_id, time));
-}
-
-void TextDatabaseManager::AddPageTitle(const GURL& url,
-                                       const string16& title) {
-  RecentChangeList::iterator found = recent_changes_.Peek(url);
-  if (found == recent_changes_.end()) {
-    // This page is not in our cache of recent pages. This is very much an edge
-    // case as normally a title will come in <20 seconds after the page commits,
-    // and WebContents will avoid spamming us with >1 title per page. However,
-    // it could come up if your connection is unhappy, and we don't want to
-    // miss anything.
-    //
-    // To solve this problem, we'll just associate the most recent visit with
-    // the new title and index that using the regular code path.
-    URLRow url_row;
-    if (!url_database_->GetRowForURL(url, &url_row))
-      return;  // URL is unknown, give up.
-    VisitRow visit;
-    if (!visit_database_->GetMostRecentVisitForURL(url_row.id(), &visit))
-      return;  // No recent visit, give up.
-
-    if (visit.is_indexed) {
-      // If this page was already indexed, we could have a body that came in
-      // first and we don't want to overwrite it. We could go query for the
-      // current body, or have a special setter for only the title, but this is
-      // not worth it for this edge case.
-      //
-      // It will be almost impossible for the title to take longer than
-      // kExpirationSeconds yet we got a body in less than that time, since
-      // the title should always come in first.
-      return;
-    }
-
-    AddPageData(url, url_row.id(), visit.visit_id, visit.visit_time,
-                title, string16());
-    return;  // We don't know about this page, give up.
-  }
-
-  PageInfo& info = found->second;
-  if (info.has_body()) {
-    // This info is complete, write to the database.
-    AddPageData(url, info.url_id(), info.visit_id(), info.visit_time(),
-                title, info.body());
-    recent_changes_.Erase(found);
-    return;
-  }
-
-  info.set_title(title);
-}
-
-void TextDatabaseManager::AddPageContents(const GURL& url,
-                                          const string16& body) {
-  RecentChangeList::iterator found = recent_changes_.Peek(url);
-  if (found == recent_changes_.end()) {
-    // This page is not in our cache of recent pages. This means that the page
-    // took more than kExpirationSeconds to load. Often, this will be the result
-    // of a very slow iframe or other resource on the page that makes us think
-    // it's still loading.
-    //
-    // As a fallback, set the most recent visit's contents using the input, and
-    // use the last set title in the URL table as the title to index.
-    URLRow url_row;
-    if (!url_database_->GetRowForURL(url, &url_row))
-      return;  // URL is unknown, give up.
-    VisitRow visit;
-    if (!visit_database_->GetMostRecentVisitForURL(url_row.id(), &visit))
-      return;  // No recent visit, give up.
-
-    // Use the title from the URL row as the title for the indexing.
-    AddPageData(url, url_row.id(), visit.visit_id, visit.visit_time,
-                url_row.title(), body);
-    return;
-  }
-
-  PageInfo& info = found->second;
-  if (info.has_title()) {
-    // This info is complete, write to the database.
-    AddPageData(url, info.url_id(), info.visit_id(), info.visit_time(),
-                info.title(), body);
-    recent_changes_.Erase(found);
-    return;
-  }
-
-  info.set_body(body);
-}
-
-bool TextDatabaseManager::AddPageData(const GURL& url,
-                                      URLID url_id,
-                                      VisitID visit_id,
-                                      Time visit_time,
-                                      const string16& title,
-                                      const string16& body) {
-  TextDatabase* db = GetDBForTime(visit_time, true);
-  if (!db)
-    return false;
-
-  TimeTicks beginning_time = TimeTicks::Now();
-
-  // First delete any recently-indexed data for this page. This will delete
-  // anything in the main database, but we don't bother looking through the
-  // archived database.
-  VisitVector visits;
-  visit_database_->GetIndexedVisitsForURL(url_id, &visits);
-  for (size_t i = 0; i < visits.size(); i++) {
-    visits[i].is_indexed = false;
-    visit_database_->UpdateVisitRow(visits[i]);
-    DeletePageData(visits[i].visit_time, url, NULL);
-  }
-
-  if (visit_id) {
-    // We're supposed to update the visit database, so load the visit.
-    VisitRow row;
-    if (!visit_database_->GetRowForVisit(visit_id, &row)) {
-      // This situation can occur if Chrome's history is in the process of
-      // being updated, and then the browsing history is deleted before all
-      // updates have been completely performed.  In this case, a stale update
-      // to the database is attempted, leading to the warning below.
-      DLOG(WARNING) << "Could not find requested visit #" << visit_id;
-      return false;
-    }
-
-    DCHECK(visit_time == row.visit_time);
-
-    // Update the visit database to reference our addition.
-    row.is_indexed = true;
-    if (!visit_database_->UpdateVisitRow(row))
-      return false;
-  }
-
-  // Now index the data.
-  std::string url_str = URLDatabase::GURLToDatabaseURL(url);
-  bool success = db->AddPageData(visit_time, url_str,
-                                 ConvertStringForIndexer(title),
-                                 ConvertStringForIndexer(body));
-
-  UMA_HISTOGRAM_TIMES("History.AddFTSData",
-                      TimeTicks::Now() - beginning_time);
-
-  if (history_publisher_)
-    history_publisher_->PublishPageContent(visit_time, url, title, body);
-
-  return success;
-}
-
-void TextDatabaseManager::DeletePageData(Time time, const GURL& url,
-                                         ChangeSet* change_set) {
-  TextDatabase::DBIdent db_ident = TimeToID(time);
-
-  // We want to open the database for writing, but only if it exists. To
-  // achieve this, we check whether it exists by saying we're not going to
-  // write to it (avoiding the autocreation code normally called when writing)
-  // and then access it for writing only if it succeeds.
-  TextDatabase* db = GetDB(db_ident, false);
-  if (!db)
-    return;
-  db = GetDB(db_ident, true);
-
-  if (change_set)
-    change_set->Add(db_ident);
-
-  db->DeletePageData(time, URLDatabase::GURLToDatabaseURL(url));
-}
-
-void TextDatabaseManager::DeleteFromUncommitted(
-    const std::set<GURL>& restrict_urls, Time begin, Time end) {
-  // First find the beginning of the range to delete. Recall that the list
-  // has the most recent item at the beginning. There won't normally be very
-  // many items, so a brute-force search is fine.
-  RecentChangeList::iterator cur = recent_changes_.begin();
-  if (!end.is_null()) {
-    // Walk from the beginning of the list backwards in time to find the newest
-    // entry that should be deleted.
-    while (cur != recent_changes_.end() && cur->second.visit_time() >= end)
-      ++cur;
-  }
-
-  // Now delete all visits up to the oldest one we were supposed to delete.
-  // Note that if begin is_null, it will be less than or equal to any other
-  // time.
-  if (restrict_urls.empty()) {
-    while (cur != recent_changes_.end() && cur->second.visit_time() >= begin)
-      cur = recent_changes_.Erase(cur);
-  } else {
-    while (cur != recent_changes_.end() && cur->second.visit_time() >= begin) {
-      if (restrict_urls.find(cur->first) != restrict_urls.end())
-        cur = recent_changes_.Erase(cur);
-      else
-        ++cur;
-    }
-  }
-}
-
-void TextDatabaseManager::DeleteFromUncommittedForTimes(
-    const std::vector<base::Time>& times) {
-  // |times| must be in reverse chronological order, i.e. each member
-  // must be earlier than or the same as the one before it.
-  DCHECK(
-      std::adjacent_find(
-          times.begin(), times.end(), std::less<base::Time>()) ==
-      times.end());
-
-  // Both |recent_changes_| and |times| are in reverse chronological order.
-  RecentChangeList::iterator it = recent_changes_.begin();
-  std::vector<base::Time>::const_iterator time_it = times.begin();
-  while (it != recent_changes_.end() && time_it != times.end()) {
-    base::Time visit_time = it->second.visit_time();
-    if (visit_time == *time_it) {
-      it = recent_changes_.Erase(it);
-    } else if (visit_time < *time_it) {
-      ++time_it;
-    } else /* if (visit_time > *time_it) */ {
-      ++it;
-    }
-  }
-}
-
-void TextDatabaseManager::DeleteAll() {
-  DCHECK_EQ(0, transaction_nesting_) << "Calling deleteAll in a transaction.";
-
-  InitDBList();
-
-  // Delete uncommitted entries.
-  recent_changes_.Clear();
-
-  // Close all open databases.
-  db_cache_.Clear();
-
-  // Now go through and delete all the files.
-  for (DBIdentSet::iterator i = present_databases_.begin();
-       i != present_databases_.end(); ++i) {
-    base::FilePath file_name = dir_.Append(TextDatabase::IDToFileName(*i));
-    sql::Connection::Delete(file_name);
-  }
-}
-
-void TextDatabaseManager::OptimizeChangedDatabases(
-    const ChangeSet& change_set) {
-  for (ChangeSet::DBSet::const_iterator i =
-           change_set.changed_databases_.begin();
-       i != change_set.changed_databases_.end(); ++i) {
-    // We want to open the database for writing, but only if it exists. To
-    // achieve this, we check whether it exists by saying we're not going to
-    // write to it (avoiding the autocreation code normally called when writing)
-    // and then access it for writing only if it succeeds.
-    TextDatabase* db = GetDB(*i, false);
-    if (!db)
-      continue;
-    db = GetDB(*i, true);
-    if (!db)
-      continue;  // The file may have changed or something.
-    db->Optimize();
-  }
-}
-
-void TextDatabaseManager::GetTextMatches(
-    const string16& query,
-    const QueryOptions& options,
-    std::vector<TextDatabase::Match>* results,
-    Time* first_time_searched) {
-  results->clear();
-
-  *first_time_searched = options.begin_time;
-
-  InitDBList();
-  if (present_databases_.empty())
-    return;  // Nothing to search.
-
-  // Get the query into the proper format for the individual DBs.
-  string16 fts_query16;
-  query_parser_.ParseQuery(query, &fts_query16);
-  std::string fts_query = UTF16ToUTF8(fts_query16);
-
-  // Need a copy of the options so we can modify the max count for each call
-  // to the individual databases.
-  QueryOptions cur_options(options);
-
-  // Compute the minimum and maximum values for the identifiers that could
-  // encompass the input time range.
-  TextDatabase::DBIdent min_ident = options.begin_time.is_null() ?
-      *present_databases_.begin() :
-      TimeToID(options.begin_time);
-  TextDatabase::DBIdent max_ident = options.end_time.is_null() ?
-      *present_databases_.rbegin() :
-      TimeToID(options.end_time);
-
-  // Iterate over the databases from the most recent backwards.
-  TextDatabase::URLSet found_urls;
-  for (DBIdentSet::reverse_iterator i = present_databases_.rbegin();
-       i != present_databases_.rend();
-       ++i) {
-    // TODO(brettw) allow canceling the query in the middle.
-    // if (canceled_or_something)
-    //   break;
-
-    // This code is stupid, we just loop until we find the correct starting
-    // time range rather than search in an intelligent way. Users will have a
-    // few dozen files at most, so this should not be an issue.
-    if (*i > max_ident)
-      continue;  // Haven't gotten to the time range yet.
-    if (*i < min_ident)
-      break;  // Covered all the time range.
-
-    TextDatabase* cur_db = GetDB(*i, false);
-    if (!cur_db)
-      continue;
-
-    // Adjust the max count according to how many results we've already got.
-    if (options.max_count) {
-      cur_options.max_count = options.max_count -
-          static_cast<int>(results->size());
-    }
-
-    bool has_more_results = cur_db->GetTextMatches(
-        fts_query, cur_options, results, &found_urls);
-
-    DCHECK(static_cast<int>(results->size()) <= options.EffectiveMaxCount());
-
-    if (has_more_results ||
-        static_cast<int>(results->size()) == options.EffectiveMaxCount()) {
-      // Since the search proceeds backwards in time, the last result we have
-      // gives the first time searched.
-      *first_time_searched = results->back().time;
-      break;
-    }
-  }
-}
-
-size_t TextDatabaseManager::GetUncommittedEntryCountForTest() const {
-  return recent_changes_.size();
-}
-
-TextDatabase* TextDatabaseManager::GetDB(TextDatabase::DBIdent id,
-                                         bool for_writing) {
-  DBCache::iterator found_db = db_cache_.Get(id);
-  if (found_db != db_cache_.end()) {
-    if (transaction_nesting_ && for_writing &&
-        open_transactions_.find(id) == open_transactions_.end()) {
-      // If we currently have an open transaction, that database is not yet
-      // part of the transaction, and the database will be written to, it needs
-      // to be part of our transaction.
-      found_db->second->BeginTransaction();
-      open_transactions_.insert(id);
-    }
-    return found_db->second;
-  }
-
-  // Need to make the database.
-  TextDatabase* new_db = new TextDatabase(dir_, id, for_writing);
-  if (!new_db->Init()) {
-    delete new_db;
-    return NULL;
-  }
-  db_cache_.Put(id, new_db);
-  present_databases_.insert(id);
-
-  if (transaction_nesting_ && for_writing) {
-    // If we currently have an open transaction and the new database will be
-    // written to, it needs to be part of our transaction.
-    new_db->BeginTransaction();
-    open_transactions_.insert(id);
-  }
-
-  // When no transaction is open, allow this new one to kick out an old one.
-  if (!transaction_nesting_)
-    db_cache_.ShrinkToSize(kCacheDBSize);
-
-  return new_db;
-}
-
-TextDatabase* TextDatabaseManager::GetDBForTime(Time time,
-                                                bool create_if_necessary) {
-  return GetDB(TimeToID(time), create_if_necessary);
-}
-
-void TextDatabaseManager::ScheduleFlushOldChanges() {
-  weak_factory_.InvalidateWeakPtrs();
-  base::MessageLoop::current()->PostDelayedTask(
-      FROM_HERE,
-      base::Bind(&TextDatabaseManager::FlushOldChanges,
-                 weak_factory_.GetWeakPtr()),
-      base::TimeDelta::FromSeconds(kExpirationSeconds));
-}
-
-void TextDatabaseManager::FlushOldChanges() {
-  FlushOldChangesForTime(TimeTicks::Now());
-}
-
-void TextDatabaseManager::FlushOldChangesForTime(TimeTicks now) {
-  // The end of the list is the oldest, so we just start from there committing
-  // things until we get something too new.
-  RecentChangeList::reverse_iterator i = recent_changes_.rbegin();
-  while (i != recent_changes_.rend() && i->second.Expired(now)) {
-    AddPageData(i->first, i->second.url_id(), i->second.visit_id(),
-                i->second.visit_time(), i->second.title(), i->second.body());
-    i = recent_changes_.Erase(i);
-  }
-
-  ScheduleFlushOldChanges();
-}
-
-}  // namespace history
diff --git a/chrome/browser/history/text_database_manager.h b/chrome/browser/history/text_database_manager.h
deleted file mode 100644
index 986274c..0000000
--- a/chrome/browser/history/text_database_manager.h
+++ /dev/null
@@ -1,320 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_HISTORY_TEXT_DATABASE_MANAGER_H_
-#define CHROME_BROWSER_HISTORY_TEXT_DATABASE_MANAGER_H_
-
-#include <cstddef>
-#include <set>
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/containers/mru_cache.h"
-#include "base/files/file_path.h"
-#include "base/gtest_prod_util.h"
-#include "base/memory/weak_ptr.h"
-#include "base/strings/string16.h"
-#include "chrome/browser/history/history_types.h"
-#include "chrome/browser/history/query_parser.h"
-#include "chrome/browser/history/text_database.h"
-#include "chrome/browser/history/url_database.h"
-
-namespace history {
-
-class HistoryPublisher;
-class VisitDatabase;
-
-// Manages a set of text databases representing different time periods. This
-// will page them in and out as necessary, and will manage queries for times
-// spanning multiple databases.
-//
-// It will also keep a list of partial changes, such as page adds and title and
-// body sets, all of which come in at different times for a given page. When
-// all data is received or enough time has elapsed since adding, the indexed
-// data will be committed.
-//
-// This allows us to minimize inserts and modifications, which are slow for the
-// full text database, since each page's information is added exactly once.
-//
-// Note: be careful to delete the relevant entries from this uncommitted list
-// when clearing history or this information may get added to the database soon
-// after the clear.
-class TextDatabaseManager {
- public:
-  // Tracks a set of changes (only deletes need to be supported now) to the
-  // databases. This is opaque to the caller, but allows it to pass back a list
-  // of all database that it has caused a change to.
-  //
-  // This is necessary for the feature where we optimize full text databases
-  // which have changed as a result of the user deleting history via
-  // OptimizeChangedDatabases. We want to do each affected database only once at
-  // the end of the delete, but we don't want the caller to have to worry about
-  // our internals.
-  class ChangeSet {
-   public:
-    ChangeSet();
-    ~ChangeSet();
-
-   private:
-    friend class TextDatabaseManager;
-
-    typedef std::set<TextDatabase::DBIdent> DBSet;
-
-    void Add(TextDatabase::DBIdent id) { changed_databases_.insert(id); }
-
-    DBSet changed_databases_;
-  };
-
-  // You must call Init() to complete initialization.
-  //
-  // |dir| is the directory that will hold the full text database files (there
-  // will be many files named by their date ranges).
-  //
-  // The visit database is a pointer owned by the caller for the main database
-  // (of recent visits). The visit database will be updated to refer to the
-  // added text database entries.
-  TextDatabaseManager(const base::FilePath& dir,
-                      URLDatabase* url_database,
-                      VisitDatabase* visit_database);
-  ~TextDatabaseManager();
-
-  // Must call before using other functions. If it returns false, no other
-  // functions should be called.
-  bool Init(const HistoryPublisher* history_publisher);
-
-  // Returns the directory that holds the full text database files.
-  const base::FilePath& GetDir() { return dir_; }
-
-  // Allows scoping updates. This also allows things to go faster since every
-  // page add doesn't need to be committed to disk (slow). Note that files will
-  // still get created during a transaction.
-  void BeginTransaction();
-  void CommitTransaction();
-
-  // Sets specific information for the given page to be added to the database.
-  // In normal operation, URLs will be added as the user visits them, the titles
-  // and bodies will come in some time after that. These changes will be
-  // automatically coalesced and added to the database some time in the future
-  // using AddPageData().
-  //
-  // AddPageURL must be called for a given URL (+ its corresponding ID) before
-  // either the title or body set. The visit ID specifies the visit that will
-  // get updated to refer to the full text indexed information. The visit time
-  // should be the time corresponding to that visit in the database.
-  void AddPageURL(const GURL& url, URLID url_id, VisitID visit_id,
-                  base::Time visit_time);
-  void AddPageTitle(const GURL& url, const string16& title);
-  void AddPageContents(const GURL& url, const string16& body);
-
-  // Adds the given data to the appropriate database file, returning true on
-  // success. The visit database row identified by |visit_id| will be updated
-  // to refer to the full text index entry. If the visit ID is 0, the visit
-  // database will not be updated.
-  bool AddPageData(const GURL& url,
-                   URLID url_id,
-                   VisitID visit_id,
-                   base::Time visit_time,
-                   const string16& title,
-                   const string16& body);
-
-  // Deletes the instance of indexed data identified by the given time and URL.
-  // Any changes will be tracked in the optional change set for use when calling
-  // OptimizeChangedDatabases later. change_set can be NULL.
-  void DeletePageData(base::Time time, const GURL& url,
-                      ChangeSet* change_set);
-
-  // The text database manager keeps a list of changes that are made to the
-  // file AddPageURL/Title/Body that may not be committed to the database yet.
-  // This function removes entries from this list happening between the given
-  // time range. It is called when the user clears their history for a time
-  // range, and we don't want any of our data to "leak." If restrict_urls is
-  // not empty, only changes on those URLs are deleted.
-  //
-  // Either or both times my be is_null to be unbounded in that direction. When
-  // non-null, the range is [begin, end).
-  void DeleteFromUncommitted(const std::set<GURL>& restrict_urls,
-                             base::Time begin, base::Time end);
-
-  // This function removes entries from the same list as
-  // DeleteFromUncommitted() with times belonging to the given list of
-  // times, which must be in reverse chronological order.
-  void DeleteFromUncommittedForTimes(const std::vector<base::Time>& times);
-
-  // Deletes all full text search data by removing the files from the disk.
-  // This must be called OUTSIDE of a transaction since it actually deletes the
-  // files rather than messing with the database.
-  void DeleteAll();
-
-  // Calls optimize on all the databases identified in a given change set (see
-  // the definition of ChangeSet above for more). Optimizing means that old data
-  // will be removed rather than marked unused.
-  void OptimizeChangedDatabases(const ChangeSet& change_set);
-
-  // Executes the given query. See QueryOptions for more info on input.
-  //
-  // The results are filled into |results|, and the first time considered for
-  // the output is in |first_time_searched| (see QueryResults for more).
-  //
-  // This function will return more than one match per URL if there is more than
-  // one entry for that URL in the database.
-  void GetTextMatches(const string16& query,
-                      const QueryOptions& options,
-                      std::vector<TextDatabase::Match>* results,
-                      base::Time* first_time_searched);
-
-  size_t GetUncommittedEntryCountForTest() const;
-
- private:
-  // These tests call ExpireRecentChangesForTime to force expiration.
-  FRIEND_TEST_ALL_PREFIXES(TextDatabaseManagerTest, InsertPartial);
-  FRIEND_TEST_ALL_PREFIXES(TextDatabaseManagerTest, PartialComplete);
-  FRIEND_TEST_ALL_PREFIXES(ExpireHistoryTest, DeleteURLAndFavicon);
-  FRIEND_TEST_ALL_PREFIXES(ExpireHistoryTest, FlushRecentURLsUnstarred);
-  FRIEND_TEST_ALL_PREFIXES(ExpireHistoryTest, FlushURLsForTimes);
-  FRIEND_TEST_ALL_PREFIXES(ExpireHistoryTest,
-                           FlushRecentURLsUnstarredRestricted);
-
-  // Stores "recent stuff" that has happened with the page, since the page
-  // visit, title, and body all come in at different times.
-  class PageInfo {
-   public:
-    PageInfo(URLID url_id, VisitID visit_id, base::Time visit_time);
-    ~PageInfo();
-
-    // Getters.
-    URLID url_id() const { return url_id_; }
-    VisitID visit_id() const { return visit_id_; }
-    base::Time visit_time() const { return visit_time_; }
-    const string16& title() const { return title_; }
-    const string16& body() const { return body_; }
-
-    // Setters, we can only update the title and body.
-    void set_title(const string16& ttl);
-    void set_body(const string16& bdy);
-
-    // Returns true if both the title or body of the entry has been set. Since
-    // both the title and body setters will "fix" empty strings to be a space,
-    // these indicate if the setter was ever called.
-    bool has_title() const { return !title_.empty(); }
-    bool has_body() { return !body_.empty(); }
-
-    // Returns true if this entry was added too long ago and we should give up
-    // waiting for more data. The current time is passed in as an argument so we
-    // can check many without re-querying the timer.
-    bool Expired(base::TimeTicks now) const;
-
-   private:
-    URLID url_id_;
-    VisitID visit_id_;
-
-    // Time of the visit of the URL. This will be the value stored in the URL
-    // and visit tables for the entry.
-    base::Time visit_time_;
-
-    // When this page entry was created. We have a cap on the maximum time that
-    // an entry will be in the queue before being flushed to the database.
-    base::TimeTicks added_time_;
-
-    // Will be the string " " when they are set to distinguish set and unset.
-    string16 title_;
-    string16 body_;
-  };
-
-  // Converts the given time to a database identifier or vice-versa.
-  static TextDatabase::DBIdent TimeToID(base::Time time);
-  static base::Time IDToTime(TextDatabase::DBIdent id);
-
-  // Returns a text database for the given identifier or time. This file will
-  // be created if it doesn't exist and |for_writing| is set. On error,
-  // including the case where the file doesn't exist and |for_writing|
-  // is false, it will return NULL.
-  //
-  // When |for_writing| is set, a transaction on the database will be opened
-  // if there is a transaction open on this manager.
-  //
-  // The pointer will be tracked in the cache. The caller should not store it
-  // or delete it since it will get automatically deleted as necessary.
-  TextDatabase* GetDB(TextDatabase::DBIdent id, bool for_writing);
-  TextDatabase* GetDBForTime(base::Time time, bool for_writing);
-
-  // Populates the present_databases_ list based on which files are on disk.
-  // When the list is already initialized, this will do nothing, so you can
-  // call it whenever you want to ensure the present_databases_ set is filled.
-  void InitDBList();
-
-  // Schedules a call to ExpireRecentChanges in the future.
-  void ScheduleFlushOldChanges();
-
-  // Checks the recent_changes_ list and commits partial data that has been
-  // around too long.
-  void FlushOldChanges();
-
-  // Given "now," this will expire old things from the recent_changes_ list.
-  // This is used as the backend for FlushOldChanges and is called directly
-  // by the unit tests with fake times.
-  void FlushOldChangesForTime(base::TimeTicks now);
-
-  // Directory holding our index files.
-  const base::FilePath dir_;
-
-  // Non-owning pointers to the recent history databases for URLs and visits.
-  URLDatabase* url_database_;
-  VisitDatabase* visit_database_;
-
-  // Lists recent additions that we have not yet filled out with the title and
-  // body. Sorted by time, we will flush them when they are complete or have
-  // been in the queue too long without modification.
-  //
-  // We kind of abuse the MRUCache because we never move things around in it
-  // using Get. Instead, we keep them in the order they were inserted, since
-  // this is the metric we use to measure age. The MRUCache gives us an ordered
-  // list with fast lookup by URL.
-  typedef base::MRUCache<GURL, PageInfo> RecentChangeList;
-  RecentChangeList recent_changes_;
-
-  // Nesting levels of transactions. Since sqlite only allows one open
-  // transaction, we simulate nested transactions by mapping the outermost one
-  // to a real transaction. Since this object never needs to do ROLLBACK, losing
-  // the ability for all transactions to rollback is inconsequential.
-  int transaction_nesting_;
-
-  // The cache owns the TextDatabase pointers, they will be automagically
-  // deleted when the cache entry is removed or expired.
-  typedef base::OwningMRUCache<TextDatabase::DBIdent, TextDatabase*> DBCache;
-  DBCache db_cache_;
-
-  // Tells us about the existence of database files on disk. All existing
-  // databases will be in here, and non-existent ones will not, so we don't
-  // have to check the disk every time.
-  //
-  // This set is populated LAZILY by InitDBList(), you should call that function
-  // before accessing the list.
-  //
-  // Note that iterators will work on the keys in-order. Normally, reverse
-  // iterators will be used to iterate the keys in reverse-order.
-  typedef std::set<TextDatabase::DBIdent> DBIdentSet;
-  DBIdentSet present_databases_;
-  bool present_databases_loaded_;  // Set by InitDBList when populated.
-
-  // Lists all databases with open transactions. These will have to be closed
-  // when the transaction is committed.
-  DBIdentSet open_transactions_;
-
-  QueryParser query_parser_;
-
-  // Generates tasks for our periodic checking of expired "recent changes".
-  base::WeakPtrFactory<TextDatabaseManager> weak_factory_;
-
-  // This object is created and managed by the history backend. We maintain an
-  // opaque pointer to the object for our use.
-  // This can be NULL if there are no indexers registered to receive indexing
-  // data from us.
-  const HistoryPublisher* history_publisher_;
-
-  DISALLOW_COPY_AND_ASSIGN(TextDatabaseManager);
-};
-
-}  // namespace history
-
-#endif  // CHROME_BROWSER_HISTORY_TEXT_DATABASE_MANAGER_H_
diff --git a/chrome/browser/history/text_database_manager_unittest.cc b/chrome/browser/history/text_database_manager_unittest.cc
deleted file mode 100644
index 0ea76f6..0000000
--- a/chrome/browser/history/text_database_manager_unittest.cc
+++ /dev/null
@@ -1,598 +0,0 @@
-// Copyright (c) 2011 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 <set>
-
-#include "base/file_util.h"
-#include "base/files/file_path.h"
-#include "base/message_loop/message_loop.h"
-#include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/history/text_database_manager.h"
-#include "chrome/browser/history/visit_database.h"
-#include "sql/connection.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-using base::Time;
-using base::TimeDelta;
-using base::TimeTicks;
-
-namespace history {
-
-namespace {
-
-const char* kURL1 = "http://www.google.com/asdf";
-const char* kTitle1 = "Google A";
-const char* kBody1 = "FOO page one.";
-
-const char* kURL2 = "http://www.google.com/qwer";
-const char* kTitle2 = "Google B";
-const char* kBody2 = "FOO two.";
-
-const char* kURL3 = "http://www.google.com/zxcv";
-const char* kTitle3 = "Google C";
-const char* kBody3 = "FOO drei";
-
-const char* kURL4 = "http://www.google.com/hjkl";
-const char* kTitle4 = "Google D";
-const char* kBody4 = "FOO lalala four.";
-
-const char* kURL5 = "http://www.google.com/uiop";
-const char* kTitle5 = "Google cinq";
-const char* kBody5 = "FOO page one.";
-
-// This provides a simple implementation of a URL+VisitDatabase using an
-// in-memory sqlite connection. The text database manager expects to be able to
-// update the visit database to keep in sync.
-class InMemDB : public URLDatabase, public VisitDatabase {
- public:
-  InMemDB() {
-    EXPECT_TRUE(db_.OpenInMemory());
-    CreateURLTable(false);
-    InitVisitTable();
-  }
-  virtual ~InMemDB() {
-  }
-
- private:
-  virtual sql::Connection& GetDB() OVERRIDE { return db_; }
-
-  sql::Connection db_;
-
-  DISALLOW_COPY_AND_ASSIGN(InMemDB);
-};
-
-// Adds all the pages once, and the first page once more in the next month.
-// The times of all the pages will be filled into |*times|.
-void AddAllPages(TextDatabaseManager& manager, VisitDatabase* visit_db,
-                 std::vector<Time>* times) {
-  Time::Exploded exploded;
-  memset(&exploded, 0, sizeof(Time::Exploded));
-
-  // Put the visits in two different months so it will query across databases.
-  exploded.year = 2008;
-  exploded.month = 1;
-  exploded.day_of_month = 3;
-
-  VisitRow visit_row;
-  visit_row.url_id = 1;
-  visit_row.visit_time = Time::FromUTCExploded(exploded);
-  visit_row.referring_visit = 0;
-  visit_row.transition = content::PageTransitionFromInt(0);
-  visit_row.segment_id = 0;
-  visit_row.is_indexed = false;
-  visit_db->AddVisit(&visit_row, SOURCE_BROWSED);
-
-  times->push_back(visit_row.visit_time);
-  manager.AddPageData(GURL(kURL1), visit_row.url_id, visit_row.visit_id,
-                      visit_row.visit_time, UTF8ToUTF16(kTitle1),
-                      UTF8ToUTF16(kBody1));
-
-  exploded.day_of_month++;
-  visit_row.url_id = 2;
-  visit_row.visit_time = Time::FromUTCExploded(exploded);
-  visit_db->AddVisit(&visit_row, SOURCE_BROWSED);
-  times->push_back(visit_row.visit_time);
-  manager.AddPageData(GURL(kURL2), visit_row.url_id, visit_row.visit_id,
-                      visit_row.visit_time, UTF8ToUTF16(kTitle2),
-                      UTF8ToUTF16(kBody2));
-
-  exploded.day_of_month++;
-  visit_row.url_id = 2;
-  visit_row.visit_time = Time::FromUTCExploded(exploded);
-  visit_db->AddVisit(&visit_row, SOURCE_BROWSED);
-  times->push_back(visit_row.visit_time);
-  manager.AddPageData(GURL(kURL3), visit_row.url_id, visit_row.visit_id,
-                      visit_row.visit_time, UTF8ToUTF16(kTitle3),
-                      UTF8ToUTF16(kBody3));
-
-  // Put the next ones in the next month.
-  exploded.month++;
-  visit_row.url_id = 2;
-  visit_row.visit_time = Time::FromUTCExploded(exploded);
-  visit_db->AddVisit(&visit_row, SOURCE_BROWSED);
-  times->push_back(visit_row.visit_time);
-  manager.AddPageData(GURL(kURL4), visit_row.url_id, visit_row.visit_id,
-                      visit_row.visit_time, UTF8ToUTF16(kTitle4),
-                      UTF8ToUTF16(kBody4));
-
-  exploded.day_of_month++;
-  visit_row.url_id = 2;
-  visit_row.visit_time = Time::FromUTCExploded(exploded);
-  visit_db->AddVisit(&visit_row, SOURCE_BROWSED);
-  times->push_back(visit_row.visit_time);
-  manager.AddPageData(GURL(kURL5), visit_row.url_id, visit_row.visit_id,
-                      visit_row.visit_time, UTF8ToUTF16(kTitle5),
-                      UTF8ToUTF16(kBody5));
-
-  // Put the first one in again in the second month.
-  exploded.day_of_month++;
-  visit_row.url_id = 2;
-  visit_row.visit_time = Time::FromUTCExploded(exploded);
-  visit_db->AddVisit(&visit_row, SOURCE_BROWSED);
-  times->push_back(visit_row.visit_time);
-  manager.AddPageData(GURL(kURL1), visit_row.url_id, visit_row.visit_id,
-                      visit_row.visit_time, UTF8ToUTF16(kTitle1),
-                      UTF8ToUTF16(kBody1));
-}
-
-bool ResultsHaveURL(const std::vector<TextDatabase::Match>& results,
-                    const char* url) {
-  GURL gurl(url);
-  for (size_t i = 0; i < results.size(); i++) {
-    if (results[i].url == gurl)
-      return true;
-  }
-  return false;
-}
-
-}  // namespace
-
-class TextDatabaseManagerTest : public testing::Test {
- public:
-  // Called manually by the test so it can report failure to initialize.
-  bool Init() {
-    return file_util::CreateNewTempDirectory(
-        FILE_PATH_LITERAL("TestSearchTest"), &dir_);
-  }
-
- protected:
-  virtual void SetUp() {
-  }
-
-  virtual void TearDown() {
-    base::DeleteFile(dir_, true);
-  }
-
-  base::MessageLoop message_loop_;
-
-  // Directory containing the databases.
-  base::FilePath dir_;
-};
-
-// Tests basic querying.
-TEST_F(TextDatabaseManagerTest, InsertQuery) {
-  ASSERT_TRUE(Init());
-  InMemDB visit_db;
-  TextDatabaseManager manager(dir_, &visit_db, &visit_db);
-  ASSERT_TRUE(manager.Init(NULL));
-
-  std::vector<Time> times;
-  AddAllPages(manager, &visit_db, &times);
-
-  QueryOptions options;
-  options.begin_time = times[0] - TimeDelta::FromDays(100);
-  options.end_time = times[times.size() - 1] + TimeDelta::FromDays(100);
-  std::vector<TextDatabase::Match> results;
-  Time first_time_searched;
-  manager.GetTextMatches(UTF8ToUTF16("FOO"), options,
-                         &results, &first_time_searched);
-
-  // We should have matched every page.
-  EXPECT_EQ(6U, results.size());
-  EXPECT_TRUE(ResultsHaveURL(results, kURL1));
-  EXPECT_TRUE(ResultsHaveURL(results, kURL2));
-  EXPECT_TRUE(ResultsHaveURL(results, kURL3));
-  EXPECT_TRUE(ResultsHaveURL(results, kURL4));
-  EXPECT_TRUE(ResultsHaveURL(results, kURL5));
-
-  // The first time searched should have been the first page's time or before
-  // (it could have eliminated some time for us).
-  EXPECT_TRUE(first_time_searched <= times[0]);
-}
-
-// Tests that adding page components piecemeal will get them added properly.
-// This does not supply a visit to update, this mode is used only by the unit
-// tests right now, but we test it anyway.
-TEST_F(TextDatabaseManagerTest, InsertCompleteNoVisit) {
-  ASSERT_TRUE(Init());
-  InMemDB visit_db;
-  TextDatabaseManager manager(dir_, &visit_db, &visit_db);
-  ASSERT_TRUE(manager.Init(NULL));
-
-  // First add one without a visit.
-  const GURL url(kURL1);
-  manager.AddPageURL(url, 0, 0, Time::Now());
-  manager.AddPageTitle(url, UTF8ToUTF16(kTitle1));
-  manager.AddPageContents(url, UTF8ToUTF16(kBody1));
-
-  // Check that the page got added.
-  QueryOptions options;
-  std::vector<TextDatabase::Match> results;
-  Time first_time_searched;
-
-  manager.GetTextMatches(UTF8ToUTF16("FOO"), options,
-                         &results, &first_time_searched);
-  ASSERT_EQ(1U, results.size());
-  EXPECT_EQ(kTitle1, UTF16ToUTF8(results[0].title));
-}
-
-// Like InsertCompleteNoVisit but specifies a visit to update. We check that the
-// visit was updated properly.
-TEST_F(TextDatabaseManagerTest, InsertCompleteVisit) {
-  ASSERT_TRUE(Init());
-  InMemDB visit_db;
-  TextDatabaseManager manager(dir_, &visit_db, &visit_db);
-  ASSERT_TRUE(manager.Init(NULL));
-
-  // First add a visit to a page. We can just make up a URL ID since there is
-  // not actually any URL database around.
-  VisitRow visit;
-  visit.url_id = 1;
-  visit.visit_time = Time::Now();
-  visit.referring_visit = 0;
-  visit.transition = content::PAGE_TRANSITION_LINK;
-  visit.segment_id = 0;
-  visit.is_indexed = false;
-  visit_db.AddVisit(&visit, SOURCE_BROWSED);
-
-  // Add a full text indexed entry for that visit.
-  const GURL url(kURL2);
-  manager.AddPageURL(url, visit.url_id, visit.visit_id, visit.visit_time);
-  manager.AddPageContents(url, UTF8ToUTF16(kBody2));
-  manager.AddPageTitle(url, UTF8ToUTF16(kTitle2));
-
-  // Check that the page got added.
-  QueryOptions options;
-  std::vector<TextDatabase::Match> results;
-  Time first_time_searched;
-
-  manager.GetTextMatches(UTF8ToUTF16("FOO"), options,
-                         &results, &first_time_searched);
-  ASSERT_EQ(1U, results.size());
-  EXPECT_EQ(kTitle2, UTF16ToUTF8(results[0].title));
-
-  // Check that the visit got updated for its new indexed state.
-  VisitRow out_visit;
-  ASSERT_TRUE(visit_db.GetRowForVisit(visit.visit_id, &out_visit));
-  EXPECT_TRUE(out_visit.is_indexed);
-}
-
-// Tests that partial inserts that expire are added to the database.
-TEST_F(TextDatabaseManagerTest, InsertPartial) {
-  ASSERT_TRUE(Init());
-  InMemDB visit_db;
-  TextDatabaseManager manager(dir_, &visit_db, &visit_db);
-  ASSERT_TRUE(manager.Init(NULL));
-
-  // Add the first one with just a URL.
-  GURL url1(kURL1);
-  manager.AddPageURL(url1, 0, 0, Time::Now());
-
-  // Now add a second one with a URL and title.
-  GURL url2(kURL2);
-  manager.AddPageURL(url2, 0, 0, Time::Now());
-  manager.AddPageTitle(url2, UTF8ToUTF16(kTitle2));
-
-  // The third one has a URL and body.
-  GURL url3(kURL3);
-  manager.AddPageURL(url3, 0, 0, Time::Now());
-  manager.AddPageContents(url3, UTF8ToUTF16(kBody3));
-
-  // Expire stuff very fast. This assumes that the time between the first
-  // AddPageURL and this line is less than the expiration time (20 seconds).
-  TimeTicks added_time = TimeTicks::Now();
-  TimeTicks expire_time = added_time + TimeDelta::FromSeconds(5);
-  manager.FlushOldChangesForTime(expire_time);
-
-  // Do a query, nothing should be added yet.
-  QueryOptions options;
-  std::vector<TextDatabase::Match> results;
-  Time first_time_searched;
-  manager.GetTextMatches(UTF8ToUTF16("google"), options,
-                         &results, &first_time_searched);
-  ASSERT_EQ(0U, results.size());
-
-  // Compute a time threshold that will cause everything to be flushed, and
-  // poke at the manager's internals to cause this to happen.
-  expire_time = added_time + TimeDelta::FromDays(1);
-  manager.FlushOldChangesForTime(expire_time);
-
-  // Now we should have all 3 URLs added.
-  manager.GetTextMatches(UTF8ToUTF16("google"), options,
-                         &results, &first_time_searched);
-  ASSERT_EQ(3U, results.size());
-  EXPECT_TRUE(ResultsHaveURL(results, kURL1));
-  EXPECT_TRUE(ResultsHaveURL(results, kURL2));
-  EXPECT_TRUE(ResultsHaveURL(results, kURL3));
-}
-
-// Tests that partial inserts (due to timeouts) will still get updated if the
-// data comes in later.
-TEST_F(TextDatabaseManagerTest, PartialComplete) {
-  ASSERT_TRUE(Init());
-  InMemDB visit_db;
-  TextDatabaseManager manager(dir_, &visit_db, &visit_db);
-  ASSERT_TRUE(manager.Init(NULL));
-
-  Time added_time = Time::Now();
-  GURL url(kURL1);
-
-  // We have to have the URL in the URL and visit databases for this test to
-  // work.
-  URLRow url_row(url);
-  url_row.set_title(UTF8ToUTF16("chocolate"));
-  URLID url_id = visit_db.AddURL(url_row);
-  ASSERT_TRUE(url_id);
-  VisitRow visit_row;
-  visit_row.url_id = url_id;
-  visit_row.visit_time = added_time;
-  visit_db.AddVisit(&visit_row, SOURCE_BROWSED);
-
-  // Add a URL with no title or body, and say that it expired.
-  manager.AddPageURL(url, 0, 0, added_time);
-  TimeTicks expire_time = TimeTicks::Now() + TimeDelta::FromDays(1);
-  manager.FlushOldChangesForTime(expire_time);
-
-  // Add the title. We should be able to query based on that. The title in the
-  // URL row we set above should not come into the picture.
-  manager.AddPageTitle(url, UTF8ToUTF16("Some unique title"));
-  Time first_time_searched;
-  QueryOptions options;
-  std::vector<TextDatabase::Match> results;
-  manager.GetTextMatches(UTF8ToUTF16("unique"), options,
-                         &results, &first_time_searched);
-  EXPECT_EQ(1U, results.size());
-  manager.GetTextMatches(UTF8ToUTF16("chocolate"), options,
-                         &results, &first_time_searched);
-  EXPECT_EQ(0U, results.size());
-
-  // Now add the body, which should be queryable.
-  manager.AddPageContents(url, UTF8ToUTF16("Very awesome body"));
-  manager.GetTextMatches(UTF8ToUTF16("awesome"), options, &results, &first_time_searched);
-  EXPECT_EQ(1U, results.size());
-
-  // Adding the body will actually copy the title from the URL table rather
-  // than the previously indexed row (we made them not match above). This isn't
-  // necessarily what we want, but it's how it's implemented, and we don't want
-  // to regress it.
-  manager.GetTextMatches(UTF8ToUTF16("chocolate"), options, &results, &first_time_searched);
-  EXPECT_EQ(1U, results.size());
-}
-
-// Tests that changes get properly committed to disk.
-TEST_F(TextDatabaseManagerTest, Writing) {
-  ASSERT_TRUE(Init());
-
-  QueryOptions options;
-  std::vector<TextDatabase::Match> results;
-  Time first_time_searched;
-
-  InMemDB visit_db;
-
-  // Create the manager and write some stuff to it.
-  {
-    TextDatabaseManager manager(dir_, &visit_db, &visit_db);
-    ASSERT_TRUE(manager.Init(NULL));
-
-    std::vector<Time> times;
-    AddAllPages(manager, &visit_db, &times);
-
-    // We should have matched every page.
-    manager.GetTextMatches(UTF8ToUTF16("FOO"), options, &results, &first_time_searched);
-    EXPECT_EQ(6U, results.size());
-  }
-  results.clear();
-
-  // Recreate the manager and make sure it finds the written stuff.
-  {
-    TextDatabaseManager manager(dir_, &visit_db, &visit_db);
-    ASSERT_TRUE(manager.Init(NULL));
-
-    // We should have matched every page again.
-    manager.GetTextMatches(UTF8ToUTF16("FOO"), options,
-                           &results, &first_time_searched);
-    EXPECT_EQ(6U, results.size());
-  }
-}
-
-// Tests that changes get properly committed to disk, as in the Writing test
-// above, but when there is a transaction around the adds.
-TEST_F(TextDatabaseManagerTest, WritingTransaction) {
-  ASSERT_TRUE(Init());
-
-  QueryOptions options;
-  std::vector<TextDatabase::Match> results;
-  Time first_time_searched;
-
-  InMemDB visit_db;
-
-  // Create the manager and write some stuff to it.
-  {
-    TextDatabaseManager manager(dir_, &visit_db, &visit_db);
-    ASSERT_TRUE(manager.Init(NULL));
-
-    std::vector<Time> times;
-    manager.BeginTransaction();
-    AddAllPages(manager, &visit_db, &times);
-    // "Forget" to commit, it should be autocommittedd for us.
-
-    // We should have matched every page.
-    manager.GetTextMatches(UTF8ToUTF16("FOO"), options,
-                           &results, &first_time_searched);
-    EXPECT_EQ(6U, results.size());
-  }
-  results.clear();
-
-  // Recreate the manager and make sure it finds the written stuff.
-  {
-    TextDatabaseManager manager(dir_, &visit_db, &visit_db);
-    ASSERT_TRUE(manager.Init(NULL));
-
-    // We should have matched every page again.
-    manager.GetTextMatches(UTF8ToUTF16("FOO"), options,
-                           &results, &first_time_searched);
-    EXPECT_EQ(6U, results.size());
-  }
-}
-
-// Tests querying where the maximum number of items is met.
-TEST_F(TextDatabaseManagerTest, QueryMax) {
-  ASSERT_TRUE(Init());
-  InMemDB visit_db;
-  TextDatabaseManager manager(dir_, &visit_db, &visit_db);
-  ASSERT_TRUE(manager.Init(NULL));
-
-  std::vector<Time> times;
-  AddAllPages(manager, &visit_db, &times);
-
-  string16 foo = UTF8ToUTF16("FOO");
-
-  QueryOptions options;
-  options.begin_time = times[0] - TimeDelta::FromDays(100);
-  options.end_time = times[times.size() - 1] + TimeDelta::FromDays(100);
-  options.max_count = 2;
-  std::vector<TextDatabase::Match> results;
-  Time first_time_searched;
-  manager.GetTextMatches(foo, options, &results, &first_time_searched);
-
-  // We should have gotten the last two pages as results (the first page is
-  // also the last).
-  EXPECT_EQ(2U, results.size());
-  EXPECT_TRUE(first_time_searched <= times[4]);
-  EXPECT_TRUE(ResultsHaveURL(results, kURL5));
-  EXPECT_TRUE(ResultsHaveURL(results, kURL1));
-
-  // Asking for 4 pages, the first one should be in another DB.
-  options.max_count = 4;
-  manager.GetTextMatches(foo, options, &results, &first_time_searched);
-
-  EXPECT_EQ(4U, results.size());
-  EXPECT_TRUE(first_time_searched <= times[4]);
-  EXPECT_TRUE(ResultsHaveURL(results, kURL3));
-  EXPECT_TRUE(ResultsHaveURL(results, kURL4));
-  EXPECT_TRUE(ResultsHaveURL(results, kURL5));
-  EXPECT_TRUE(ResultsHaveURL(results, kURL1));
-}
-
-// Tests querying backwards in time in chunks.
-TEST_F(TextDatabaseManagerTest, QueryBackwards) {
-  ASSERT_TRUE(Init());
-  InMemDB visit_db;
-  TextDatabaseManager manager(dir_, &visit_db, &visit_db);
-  ASSERT_TRUE(manager.Init(NULL));
-
-  std::vector<Time> times;
-  AddAllPages(manager, &visit_db, &times);
-
-  string16 foo = UTF8ToUTF16("FOO");
-
-  // First do a query for all time, but with a max of 2. This will give us the
-  // last two results and will tell us where to start searching when we want
-  // to go back in time.
-  QueryOptions options;
-  options.begin_time = times[0] - TimeDelta::FromDays(100);
-  options.end_time = times[times.size() - 1] + TimeDelta::FromDays(100);
-  options.max_count = 2;
-  std::vector<TextDatabase::Match> results;
-  Time first_time_searched;
-  manager.GetTextMatches(foo, options, &results, &first_time_searched);
-
-  // Check that we got the last two results.
-  EXPECT_EQ(2U, results.size());
-  EXPECT_TRUE(first_time_searched <= times[4]);
-  EXPECT_TRUE(ResultsHaveURL(results, kURL5));
-  EXPECT_TRUE(ResultsHaveURL(results, kURL1));
-
-  // Query the previous two URLs and make sure we got the correct ones.
-  options.end_time = first_time_searched;
-  manager.GetTextMatches(foo, options, &results, &first_time_searched);
-  EXPECT_EQ(2U, results.size());
-  EXPECT_TRUE(first_time_searched <= times[2]);
-  EXPECT_TRUE(ResultsHaveURL(results, kURL3));
-  EXPECT_TRUE(ResultsHaveURL(results, kURL4));
-
-  // Query the previous two URLs...
-  options.end_time = first_time_searched;
-  manager.GetTextMatches(foo, options, &results, &first_time_searched);
-  EXPECT_EQ(2U, results.size());
-  EXPECT_TRUE(first_time_searched <= times[0]);
-  EXPECT_TRUE(ResultsHaveURL(results, kURL2));
-  EXPECT_TRUE(ResultsHaveURL(results, kURL1));
-
-  // Try to query some more, there should be no results.
-  options.end_time = first_time_searched;
-  manager.GetTextMatches(foo, options, &results, &first_time_searched);
-  EXPECT_EQ(0U, results.size());
-}
-
-// Tests deletion of uncommitted entries.
-TEST_F(TextDatabaseManagerTest, DeleteUncommitted) {
-  ASSERT_TRUE(Init());
-  InMemDB visit_db;
-  TextDatabaseManager manager(dir_, &visit_db, &visit_db);
-  ASSERT_TRUE(manager.Init(NULL));
-
-  manager.AddPageURL(GURL(kURL1), 0, 0, Time::FromInternalValue(1));
-  manager.AddPageURL(GURL(kURL2), 0, 0, Time::FromInternalValue(2));
-  manager.AddPageURL(GURL(kURL3), 0, 0, Time::FromInternalValue(3));
-  manager.AddPageURL(GURL(kURL4), 0, 0, Time::FromInternalValue(4));
-  manager.AddPageURL(GURL(kURL5), 0, 0, Time::FromInternalValue(5));
-
-  EXPECT_EQ(5u, manager.GetUncommittedEntryCountForTest());
-
-  // Should delete the first two entries.
-  manager.DeleteFromUncommitted(std::set<GURL>(),
-                                Time::FromInternalValue(1),
-                                Time::FromInternalValue(3));
-
-  EXPECT_EQ(3u, manager.GetUncommittedEntryCountForTest());
-
-  // Should delete the third entry.
-  {
-    std::set<GURL> urls;
-    urls.insert(GURL(kURL3));
-    manager.DeleteFromUncommitted(urls, Time(), Time());
-  }
-
-  EXPECT_EQ(2u, manager.GetUncommittedEntryCountForTest());
-}
-
-// Tests deletion of uncommitted entries by time.
-TEST_F(TextDatabaseManagerTest, DeleteUncommittedForTimes) {
-  ASSERT_TRUE(Init());
-  InMemDB visit_db;
-  TextDatabaseManager manager(dir_, &visit_db, &visit_db);
-  ASSERT_TRUE(manager.Init(NULL));
-
-  manager.AddPageURL(GURL(kURL1), 0, 0, Time::FromInternalValue(2));
-  manager.AddPageURL(GURL(kURL2), 0, 0, Time::FromInternalValue(3));
-  manager.AddPageURL(GURL(kURL3), 0, 0, Time::FromInternalValue(4));
-  manager.AddPageURL(GURL(kURL4), 0, 0, Time::FromInternalValue(5));
-  manager.AddPageURL(GURL(kURL5), 0, 0, Time::FromInternalValue(6));
-
-  EXPECT_EQ(5u, manager.GetUncommittedEntryCountForTest());
-
-  std::vector<base::Time> times;
-  times.push_back(Time::FromInternalValue(9));
-  times.push_back(Time::FromInternalValue(7));
-  times.push_back(Time::FromInternalValue(5));
-  times.push_back(Time::FromInternalValue(5));
-  times.push_back(Time::FromInternalValue(3));
-  times.push_back(Time::FromInternalValue(1));
-  manager.DeleteFromUncommittedForTimes(times);
-
-  EXPECT_EQ(3u, manager.GetUncommittedEntryCountForTest());
-}
-
-}  // namespace history
diff --git a/chrome/browser/history/top_sites_impl_unittest.cc b/chrome/browser/history/top_sites_impl_unittest.cc
index 251accb..a0b9f22 100644
--- a/chrome/browser/history/top_sites_impl_unittest.cc
+++ b/chrome/browser/history/top_sites_impl_unittest.cc
@@ -149,7 +149,7 @@
   virtual void SetUp() {
     profile_.reset(new TestingProfile);
     if (CreateHistoryAndTopSites()) {
-      profile_->CreateHistoryService(false, false);
+      ASSERT_TRUE(profile_->CreateHistoryService(false, false));
       profile_->CreateTopSites();
       profile_->BlockUntilTopSitesLoaded();
     }
@@ -360,7 +360,7 @@
         data_path.AppendASCII("thumbnails.3.sql"),
         profile()->GetPath().Append(chrome::kThumbnailsFilename)));
 
-    profile()->CreateHistoryService(false, false);
+    ASSERT_TRUE(profile()->CreateHistoryService(false, false));
     profile()->CreateTopSites();
     profile()->BlockUntilTopSitesLoaded();
   }
@@ -914,7 +914,7 @@
                    profile()->GetPath().Append(chrome::kThumbnailsFilename)));
 
   // Recreate top sites and make sure everything is still there.
-  profile()->CreateHistoryService(false, false);
+  ASSERT_TRUE(profile()->CreateHistoryService(false, false));
   RecreateTopSitesAndBlock();
 
   ASSERT_NO_FATAL_FAILURE(MigrationAssertions());
@@ -1207,7 +1207,7 @@
   EXPECT_FALSE(IsTopSitesLoaded());
 
   // Load history, which should make TopSites finish loading too.
-  profile()->CreateHistoryService(false, false);
+  ASSERT_TRUE(profile()->CreateHistoryService(false, false));
   profile()->BlockUntilTopSitesLoaded();
   EXPECT_TRUE(IsTopSitesLoaded());
 }
@@ -1227,7 +1227,7 @@
 // Makes sure if history is unloaded after topsites is loaded we don't hit any
 // assertions.
 TEST_F(TopSitesUnloadTest, UnloadHistoryTest) {
-  profile()->CreateHistoryService(false, false);
+  ASSERT_TRUE(profile()->CreateHistoryService(false, false));
   profile()->CreateTopSites();
   profile()->BlockUntilTopSitesLoaded();
   HistoryServiceFactory::GetForProfile(
@@ -1250,7 +1250,7 @@
       profile()->GetPath().Append(chrome::kThumbnailsFilename)));
 
   // Create history and block until it's loaded.
-  profile()->CreateHistoryService(false, false);
+  ASSERT_TRUE(profile()->CreateHistoryService(false, false));
   profile()->BlockUntilHistoryProcessesPendingRequests();
 
   // Create top sites and unload history.
diff --git a/chrome/browser/history/top_sites_likely_impl_unittest.cc b/chrome/browser/history/top_sites_likely_impl_unittest.cc
index 8ef73a2..01a9504 100644
--- a/chrome/browser/history/top_sites_likely_impl_unittest.cc
+++ b/chrome/browser/history/top_sites_likely_impl_unittest.cc
@@ -149,7 +149,7 @@
   virtual void SetUp() {
     profile_.reset(new TestingProfile);
     if (CreateHistoryAndTopSites()) {
-      profile_->CreateHistoryService(false, false);
+      ASSERT_TRUE(profile_->CreateHistoryService(false, false));
       profile_->CreateTopSites();
       profile_->BlockUntilTopSitesLoaded();
     }
@@ -361,7 +361,7 @@
         data_path.AppendASCII("thumbnails.3.sql"),
         profile()->GetPath().Append(chrome::kThumbnailsFilename)));
 
-    profile()->CreateHistoryService(false, false);
+    ASSERT_TRUE(profile()->CreateHistoryService(false, false));
     profile()->CreateTopSites();
     profile()->BlockUntilTopSitesLoaded();
   }
@@ -915,7 +915,7 @@
                    profile()->GetPath().Append(chrome::kThumbnailsFilename)));
 
   // Recreate top sites and make sure everything is still there.
-  profile()->CreateHistoryService(false, false);
+  ASSERT_TRUE(profile()->CreateHistoryService(false, false));
   RecreateTopSitesAndBlock();
 
   ASSERT_NO_FATAL_FAILURE(MigrationAssertions());
@@ -1208,7 +1208,7 @@
   EXPECT_FALSE(IsTopSitesLoaded());
 
   // Load history, which should make TopSites finish loading too.
-  profile()->CreateHistoryService(false, false);
+  ASSERT_TRUE(profile()->CreateHistoryService(false, false));
   profile()->BlockUntilTopSitesLoaded();
   EXPECT_TRUE(IsTopSitesLoaded());
 }
@@ -1228,7 +1228,7 @@
 // Makes sure if history is unloaded after topsites is loaded we don't hit any
 // assertions.
 TEST_F(TopSitesLikelyUnloadTest, UnloadHistoryTest) {
-  profile()->CreateHistoryService(false, false);
+  ASSERT_TRUE(profile()->CreateHistoryService(false, false));
   profile()->CreateTopSites();
   profile()->BlockUntilTopSitesLoaded();
   HistoryServiceFactory::GetForProfile(
@@ -1251,7 +1251,7 @@
       profile()->GetPath().Append(chrome::kThumbnailsFilename)));
 
   // Create history and block until it's loaded.
-  profile()->CreateHistoryService(false, false);
+  ASSERT_TRUE(profile()->CreateHistoryService(false, false));
   profile()->BlockUntilHistoryProcessesPendingRequests();
 
   // Create top sites and unload history.
diff --git a/chrome/browser/history/visit_database.cc b/chrome/browser/history/visit_database.cc
index 883fe6f..5e04c02 100644
--- a/chrome/browser/history/visit_database.cc
+++ b/chrome/browser/history/visit_database.cc
@@ -34,19 +34,10 @@
         "from_visit INTEGER,"
         "transition INTEGER DEFAULT 0 NOT NULL,"
         "segment_id INTEGER,"
-        // True when we have indexed data for this visit.
-        "is_indexed BOOLEAN,"
+        // Some old DBs may have an "is_indexed" field here, but this is no
+        // longer used and should NOT be read or written from any longer.
         "visit_duration INTEGER DEFAULT 0 NOT NULL)"))
       return false;
-  } else if (!GetDB().DoesColumnExist("visits", "is_indexed")) {
-    // Old versions don't have the is_indexed column, we can just add that and
-    // not worry about different database revisions, since old ones will
-    // continue to work.
-    //
-    // TODO(brettw) this should be removed once we think everybody has been
-    // updated (added early Mar 2008).
-    if (!GetDB().Execute("ALTER TABLE visits ADD COLUMN is_indexed BOOLEAN"))
-      return false;
   }
 
   // Visit source table contains the source information for all the visits. To
@@ -98,9 +89,8 @@
   visit->referring_visit = statement.ColumnInt64(3);
   visit->transition = content::PageTransitionFromInt(statement.ColumnInt(4));
   visit->segment_id = statement.ColumnInt64(5);
-  visit->is_indexed = !!statement.ColumnInt(6);
   visit->visit_duration =
-      base::TimeDelta::FromInternalValue(statement.ColumnInt64(7));
+      base::TimeDelta::FromInternalValue(statement.ColumnInt64(6));
 }
 
 // static
@@ -154,15 +144,14 @@
 VisitID VisitDatabase::AddVisit(VisitRow* visit, VisitSource source) {
   sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE,
       "INSERT INTO visits "
-      "(url, visit_time, from_visit, transition, segment_id, is_indexed, "
-      "visit_duration) VALUES (?,?,?,?,?,?,?)"));
+      "(url, visit_time, from_visit, transition, segment_id, "
+      "visit_duration) VALUES (?,?,?,?,?,?)"));
   statement.BindInt64(0, visit->url_id);
   statement.BindInt64(1, visit->visit_time.ToInternalValue());
   statement.BindInt64(2, visit->referring_visit);
   statement.BindInt64(3, visit->transition);
   statement.BindInt64(4, visit->segment_id);
-  statement.BindInt64(5, visit->is_indexed);
-  statement.BindInt64(6, visit->visit_duration.ToInternalValue());
+  statement.BindInt64(5, visit->visit_duration.ToInternalValue());
 
   if (!statement.Run()) {
     VLOG(0) << "Failed to execute visit insert statement:  "
@@ -241,16 +230,15 @@
 
   sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE,
       "UPDATE visits SET "
-      "url=?,visit_time=?,from_visit=?,transition=?,segment_id=?,is_indexed=?,"
+      "url=?,visit_time=?,from_visit=?,transition=?,segment_id=?,"
       "visit_duration=? WHERE id=?"));
   statement.BindInt64(0, visit.url_id);
   statement.BindInt64(1, visit.visit_time.ToInternalValue());
   statement.BindInt64(2, visit.referring_visit);
   statement.BindInt64(3, visit.transition);
   statement.BindInt64(4, visit.segment_id);
-  statement.BindInt64(5, visit.is_indexed);
-  statement.BindInt64(6, visit.visit_duration.ToInternalValue());
-  statement.BindInt64(7, visit.visit_id);
+  statement.BindInt64(5, visit.visit_duration.ToInternalValue());
+  statement.BindInt64(6, visit.visit_id);
 
   return statement.Run();
 }
@@ -267,17 +255,6 @@
   return FillVisitVector(statement, visits);
 }
 
-bool VisitDatabase::GetIndexedVisitsForURL(URLID url_id, VisitVector* visits) {
-  visits->clear();
-
-  sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE,
-      "SELECT" HISTORY_VISIT_ROW_FIELDS
-      "FROM visits "
-      "WHERE url=? AND is_indexed=1"));
-  statement.BindInt64(0, url_id);
-  return FillVisitVector(statement, visits);
-}
-
 bool VisitDatabase::GetVisitsForURLWithOptions(URLID url_id,
                                                const QueryOptions& options,
                                                VisitVector* visits) {
diff --git a/chrome/browser/history/visit_database.h b/chrome/browser/history/visit_database.h
index effaa8f..f196c88 100644
--- a/chrome/browser/history/visit_database.h
+++ b/chrome/browser/history/visit_database.h
@@ -58,11 +58,6 @@
   // may still be no matches).
   bool GetVisitsForURL(URLID url_id, VisitVector* visits);
 
-  // Fills in the given vector with all of the visits for the given page ID that
-  // have the |is_indexed| field set to true, in no particular order.
-  // Returns true on success (although there may still be no matches).
-  bool GetIndexedVisitsForURL(URLID url_id, VisitVector* visits);
-
   // Fills in the given vector with the visits for the given page ID which
   // match the set of options passed, sorted in ascending order of date.
   //
@@ -230,8 +225,7 @@
 
 // Rows, in order, of the visit table.
 #define HISTORY_VISIT_ROW_FIELDS \
-    " id,url,visit_time,from_visit,transition,segment_id,is_indexed," \
-    "visit_duration "
+    " id,url,visit_time,from_visit,transition,segment_id,visit_duration "
 
 }  // namespace history
 
diff --git a/chrome/browser/history/visit_database_unittest.cc b/chrome/browser/history/visit_database_unittest.cc
index a6146b4..df8075e 100644
--- a/chrome/browser/history/visit_database_unittest.cc
+++ b/chrome/browser/history/visit_database_unittest.cc
@@ -29,8 +29,7 @@
          a.url_id == b.url_id &&
          a.visit_time == b.visit_time &&
          a.referring_visit == b.referring_visit &&
-         a.transition == b.transition &&
-         a.is_indexed == b.is_indexed;
+         a.transition == b.transition;
 }
 
 }  // namespace
@@ -148,7 +147,6 @@
   modification.transition = content::PAGE_TRANSITION_TYPED;
   modification.visit_time = Time::Now() + TimeDelta::FromDays(1);
   modification.referring_visit = 9292;
-  modification.is_indexed = true;
   UpdateVisitRow(modification);
 
   // Check that the mutated version was written.
@@ -387,31 +385,4 @@
   EXPECT_EQ(SOURCE_EXTENSION, sources[matches[0].visit_id]);
 }
 
-TEST_F(VisitDatabaseTest, GetIndexedVisits) {
-  // Add non-indexed visits.
-  int url_id = 111;
-  VisitRow visit_info1(
-      url_id, Time::Now(), 0, content::PAGE_TRANSITION_LINK, 0);
-  ASSERT_TRUE(AddVisit(&visit_info1, SOURCE_BROWSED));
-
-  VisitRow visit_info2(
-      url_id, Time::Now(), 0, content::PAGE_TRANSITION_TYPED, 0);
-  ASSERT_TRUE(AddVisit(&visit_info2, SOURCE_SYNCED));
-
-  std::vector<VisitRow> visits;
-  EXPECT_TRUE(GetVisitsForURL(url_id, &visits));
-  EXPECT_EQ(static_cast<size_t>(2), visits.size());
-  EXPECT_TRUE(GetIndexedVisitsForURL(url_id, &visits));
-  EXPECT_EQ(static_cast<size_t>(0), visits.size());
-
-  VisitRow visit_info3(
-      url_id, Time::Now(), 2, content::PAGE_TRANSITION_TYPED, 0);
-  visit_info3.is_indexed = true;
-  ASSERT_TRUE(AddVisit(&visit_info3, SOURCE_SYNCED));
-  EXPECT_TRUE(GetVisitsForURL(url_id, &visits));
-  EXPECT_EQ(static_cast<size_t>(3), visits.size());
-  EXPECT_TRUE(GetIndexedVisitsForURL(url_id, &visits));
-  EXPECT_EQ(static_cast<size_t>(1), visits.size());
-}
-
 }  // namespace history
diff --git a/chrome/browser/importer/firefox_profile_lock_unittest.cc b/chrome/browser/importer/firefox_profile_lock_unittest.cc
index 95a4b4b..c93d987 100644
--- a/chrome/browser/importer/firefox_profile_lock_unittest.cc
+++ b/chrome/browser/importer/firefox_profile_lock_unittest.cc
@@ -5,7 +5,6 @@
 #include "base/file_util.h"
 #include "base/files/scoped_temp_dir.h"
 #include "base/path_service.h"
-#include "base/process_util.h"
 #include "base/strings/string_util.h"
 #include "build/build_config.h"
 #include "chrome/browser/importer/firefox_profile_lock.h"
diff --git a/chrome/browser/importer/profile_writer_unittest.cc b/chrome/browser/importer/profile_writer_unittest.cc
index 2f6334b..4641e83 100644
--- a/chrome/browser/importer/profile_writer_unittest.cc
+++ b/chrome/browser/importer/profile_writer_unittest.cc
@@ -194,7 +194,7 @@
 // Verify that history entires are not duplicated when added twice.
 TEST_F(ProfileWriterTest, CheckHistoryAfterWritingDataTwice) {
   TestingProfile profile;
-  profile.CreateHistoryService(true, false);
+  ASSERT_TRUE(profile.CreateHistoryService(true, false));
   profile.BlockUntilHistoryProcessesPendingRequests();
 
   CreateHistoryPageEntries();
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index 44cd6cd..46586a1 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -96,6 +96,7 @@
 
 const char kQuicFieldTrialName[] = "QUIC";
 const char kQuicFieldTrialEnabledGroupName[] = "Enabled";
+const char kQuicFieldTrialHttpsEnabledGroupName[] = "HttpsEnabled";
 
 #if defined(OS_MACOSX) && !defined(OS_IOS)
 void ObserveKeychainEvents() {
@@ -550,8 +551,8 @@
   }
   bool enable_quic = ShouldEnableQuic(command_line);
   globals_->enable_quic.set(enable_quic);
-  if (enable_quic && command_line.HasSwitch(switches::kEnableQuicHttps))
-    globals_->enable_quic_https.set(true);
+  if (enable_quic)
+    globals_->enable_quic_https.set(ShouldEnableQuicHttps(command_line));
   if (command_line.HasSwitch(switches::kOriginToForceQuicOn)) {
     net::HostPortPair quic_origin =
         net::HostPortPair::FromString(
@@ -974,9 +975,28 @@
   if (command_line.HasSwitch(switches::kDisableQuic))
     return false;
 
-  if (command_line.HasSwitch(switches::kEnableQuic)) {
+  if (command_line.HasSwitch(switches::kEnableQuic))
     return true;
-  }
 
-  return quic_trial_group == kQuicFieldTrialEnabledGroupName;
+  // QUIC should be enabled if we are in either field trial group.
+  return quic_trial_group == kQuicFieldTrialEnabledGroupName ||
+      quic_trial_group == kQuicFieldTrialHttpsEnabledGroupName;
+}
+
+bool IOThread::ShouldEnableQuicHttps(const CommandLine& command_line) {
+  // Always fetch the field trial group to ensure it is reported correctly.
+  // The command line flags will be associated with a group that is reported
+  // so long as trial is actually queried.
+  std::string quic_trial_group =
+      base::FieldTrialList::FindFullName(kQuicFieldTrialName);
+
+  if (command_line.HasSwitch(switches::kDisableQuicHttps))
+    return false;
+
+  if (command_line.HasSwitch(switches::kEnableQuicHttps))
+    return true;
+
+  // HTTPS over QUIC should only be enabled if we are in the https
+  // field trial group.
+  return quic_trial_group == kQuicFieldTrialHttpsEnabledGroupName;
 }
diff --git a/chrome/browser/io_thread.h b/chrome/browser/io_thread.h
index 4408a50..9901afd 100644
--- a/chrome/browser/io_thread.h
+++ b/chrome/browser/io_thread.h
@@ -262,6 +262,10 @@
   // of a field trial or a command line flag.
   bool ShouldEnableQuic(const CommandLine& command_line);
 
+  // Returns true if HTTPS over QUIC should be enabled, either as a result
+  // of a field trial or a command line flag.
+  bool ShouldEnableQuicHttps(const CommandLine& command_line);
+
   // The NetLog is owned by the browser process, to allow logging from other
   // threads during shutdown, but is used most frequently on the IOThread.
   ChromeNetLog* net_log_;
diff --git a/chrome/browser/local_discovery/service_discovery_host_client.cc b/chrome/browser/local_discovery/service_discovery_host_client.cc
index 3a2c172..74aeb81 100644
--- a/chrome/browser/local_discovery/service_discovery_host_client.cc
+++ b/chrome/browser/local_discovery/service_discovery_host_client.cc
@@ -87,6 +87,41 @@
   bool started_;
 };
 
+class ServiceDiscoveryHostClient::LocalDomainResolverProxy
+    : public LocalDomainResolver {
+ public:
+  LocalDomainResolverProxy(ServiceDiscoveryHostClient* host,
+                       const std::string& domain,
+                       net::AddressFamily address_family,
+                       const LocalDomainResolver::IPAddressCallback& callback)
+      : host_(host),
+        domain_(domain),
+        address_family_(address_family),
+        id_(host->RegisterLocalDomainResolverCallback(callback)),
+        started_(false) {
+  }
+
+  virtual ~LocalDomainResolverProxy() {
+    host_->UnregisterLocalDomainResolverCallback(id_);
+    if (started_)
+      host_->Send(new LocalDiscoveryMsg_DestroyLocalDomainResolver(id_));
+  }
+
+  virtual void Start() OVERRIDE {
+    DCHECK(!started_);
+    host_->Send(new LocalDiscoveryMsg_ResolveLocalDomain(id_, domain_,
+                                                         address_family_));
+    started_ = true;
+  }
+
+ private:
+  scoped_refptr<ServiceDiscoveryHostClient> host_;
+  std::string domain_;
+  net::AddressFamily address_family_;
+  const uint64 id_;
+  bool started_;
+};
+
 ServiceDiscoveryHostClient::ServiceDiscoveryHostClient() : current_id_(0) {
   callback_runner_ = base::MessageLoop::current()->message_loop_proxy();
 }
@@ -118,8 +153,9 @@
     const std::string& domain,
     net::AddressFamily address_family,
     const LocalDomainResolver::IPAddressCallback& callback) {
-  NOTIMPLEMENTED();  // TODO(noamsml): Multiprocess domain resolver
-  return scoped_ptr<LocalDomainResolver>();
+  DCHECK(CalledOnValidThread());
+  return scoped_ptr<LocalDomainResolver>(new LocalDomainResolverProxy(
+      this, domain, address_family, callback));
 }
 
 uint64 ServiceDiscoveryHostClient::RegisterWatcherCallback(
@@ -138,6 +174,14 @@
   return current_id_;
 }
 
+uint64 ServiceDiscoveryHostClient::RegisterLocalDomainResolverCallback(
+    const LocalDomainResolver::IPAddressCallback& callback) {
+  DCHECK(CalledOnValidThread());
+  DCHECK(!ContainsKey(domain_resolver_callbacks_, current_id_ + 1));
+  domain_resolver_callbacks_[++current_id_] = callback;
+  return current_id_;
+}
+
 void ServiceDiscoveryHostClient::UnregisterWatcherCallback(uint64 id) {
   DCHECK(CalledOnValidThread());
   DCHECK(ContainsKey(service_watcher_callbacks_, id));
@@ -150,6 +194,13 @@
   service_resolver_callbacks_.erase(id);
 }
 
+void ServiceDiscoveryHostClient::UnregisterLocalDomainResolverCallback(
+    uint64 id) {
+  DCHECK(CalledOnValidThread());
+  DCHECK(ContainsKey(domain_resolver_callbacks_, id));
+  domain_resolver_callbacks_.erase(id);
+}
+
 void ServiceDiscoveryHostClient::Start() {
   DCHECK(CalledOnValidThread());
   BrowserThread::PostTask(
@@ -205,6 +256,8 @@
                         OnWatcherCallback)
     IPC_MESSAGE_HANDLER(LocalDiscoveryHostMsg_ResolverCallback,
                         OnResolverCallback)
+    IPC_MESSAGE_HANDLER(LocalDiscoveryHostMsg_LocalDomainResolverCallback,
+                        OnLocalDomainResolverCallback)
     IPC_MESSAGE_UNHANDLED(handled = false)
   IPC_END_MESSAGE_MAP()
   return handled;
@@ -232,6 +285,17 @@
                  status, description));
 }
 
+void ServiceDiscoveryHostClient::OnLocalDomainResolverCallback(
+    uint64 id,
+    bool success,
+    const net::IPAddressNumber& ip_address) {
+  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+  callback_runner_->PostTask(
+      FROM_HERE,
+      base::Bind(&ServiceDiscoveryHostClient::RunLocalDomainResolverCallback,
+                 this, id, success, ip_address));
+}
+
 void ServiceDiscoveryHostClient::RunWatcherCallback(
     uint64 id,
     ServiceWatcher::UpdateType update,
@@ -252,4 +316,14 @@
     it->second.Run(status, description);
 }
 
+void ServiceDiscoveryHostClient::RunLocalDomainResolverCallback(
+    uint64 id,
+    bool success,
+    const net::IPAddressNumber& ip_address) {
+  DCHECK(CalledOnValidThread());
+  DomainResolverCallbacks::iterator it = domain_resolver_callbacks_.find(id);
+  if (it != domain_resolver_callbacks_.end() && !it->second.is_null())
+    it->second.Run(success, ip_address);
+}
+
 }  // namespace local_discovery
diff --git a/chrome/browser/local_discovery/service_discovery_host_client.h b/chrome/browser/local_discovery/service_discovery_host_client.h
index 28cdcce..302b660 100644
--- a/chrome/browser/local_discovery/service_discovery_host_client.h
+++ b/chrome/browser/local_discovery/service_discovery_host_client.h
@@ -57,10 +57,13 @@
  private:
   class ServiceWatcherProxy;
   class ServiceResolverProxy;
+  class LocalDomainResolverProxy;
 
   typedef std::map<uint64, ServiceWatcher::UpdatedCallback> WatcherCallbacks;
   typedef std::map<uint64, ServiceResolver::ResolveCompleteCallback>
       ResolverCallbacks;
+  typedef std::map<uint64, LocalDomainResolver::IPAddressCallback>
+      DomainResolverCallbacks;
 
   void StartOnIOThread();
   void ShutdownOnIOThread();
@@ -72,8 +75,12 @@
       const ServiceWatcher::UpdatedCallback& callback);
   uint64 RegisterResolverCallback(
       const ServiceResolver::ResolveCompleteCallback& callback);
+  uint64 RegisterLocalDomainResolverCallback(
+      const LocalDomainResolver::IPAddressCallback& callback);
+
   void UnregisterWatcherCallback(uint64 id);
   void UnregisterResolverCallback(uint64 id);
+  void UnregisterLocalDomainResolverCallback(uint64 id);
 
   // IPC Message handlers.
   void OnWatcherCallback(uint64 id,
@@ -82,6 +89,10 @@
   void OnResolverCallback(uint64 id,
                           ServiceResolver::RequestStatus status,
                           const ServiceDescription& description);
+  void OnLocalDomainResolverCallback(uint64 id,
+                                     bool success,
+                                     const net::IPAddressNumber& address);
+
 
   // Runs watcher callback on owning thread.
   void RunWatcherCallback(uint64 id,
@@ -91,6 +102,11 @@
   void RunResolverCallback(uint64 id,
                            ServiceResolver::RequestStatus status,
                            const ServiceDescription& description);
+  // Runs local domain resolver callback on owning thread.
+  void RunLocalDomainResolverCallback(uint64 id,
+                                      bool success,
+                                      const net::IPAddressNumber& address);
+
 
   base::WeakPtr<content::UtilityProcessHost> utility_host_;
 
@@ -98,6 +114,7 @@
   uint64 current_id_;
   WatcherCallbacks service_watcher_callbacks_;
   ResolverCallbacks service_resolver_callbacks_;
+  DomainResolverCallbacks domain_resolver_callbacks_;
   scoped_refptr<base::TaskRunner> callback_runner_;
 
   DISALLOW_COPY_AND_ASSIGN(ServiceDiscoveryHostClient);
diff --git a/chrome/browser/mac/relauncher.cc b/chrome/browser/mac/relauncher.cc
index aa4794f..5d8357f 100644
--- a/chrome/browser/mac/relauncher.cc
+++ b/chrome/browser/mac/relauncher.cc
@@ -25,7 +25,7 @@
 #include "base/mac/scoped_cftyperef.h"
 #include "base/path_service.h"
 #include "base/posix/eintr_wrapper.h"
-#include "base/process_util.h"
+#include "base/process/launch.h"
 #include "base/strings/stringprintf.h"
 #include "base/strings/sys_string_conversions.h"
 #include "chrome/browser/mac/install_from_dmg.h"
diff --git a/chrome/browser/managed_mode/managed_mode_navigation_observer.cc b/chrome/browser/managed_mode/managed_mode_navigation_observer.cc
index 0366bab..ff32fe7 100644
--- a/chrome/browser/managed_mode/managed_mode_navigation_observer.cc
+++ b/chrome/browser/managed_mode/managed_mode_navigation_observer.cc
@@ -74,8 +74,8 @@
 
 class ManagedModeWarningInfoBarDelegate : public ConfirmInfoBarDelegate {
  public:
-  // Creates a managed mode warning delegate and adds it to |infobar_service|.
-  // Returns the delegate if it was successfully added.
+  // Creates a managed mode warning infobar delegate and adds it to
+  // |infobar_service|.  Returns the delegate if it was successfully added.
   static InfoBarDelegate* Create(InfoBarService* infobar_service);
 
  private:
@@ -153,7 +153,7 @@
 ManagedModeNavigationObserver::ManagedModeNavigationObserver(
     content::WebContents* web_contents)
     : WebContentsObserver(web_contents),
-      warn_infobar_delegate_(NULL) {
+      warn_infobar_(NULL) {
   Profile* profile =
       Profile::FromBrowserContext(web_contents->GetBrowserContext());
   managed_user_service_ = ManagedUserServiceFactory::GetForProfile(profile);
@@ -161,8 +161,8 @@
 }
 
 void ManagedModeNavigationObserver::WarnInfoBarDismissed() {
-  DCHECK(warn_infobar_delegate_);
-  warn_infobar_delegate_ = NULL;
+  DCHECK(warn_infobar_);
+  warn_infobar_ = NULL;
 }
 
 void ManagedModeNavigationObserver::ProvisionalChangeToMainFrameUrl(
@@ -171,14 +171,12 @@
   ManagedModeURLFilter::FilteringBehavior behavior =
       url_filter_->GetFilteringBehaviorForURL(url);
 
-  if (behavior == ManagedModeURLFilter::WARN || !warn_infobar_delegate_)
+  if (behavior == ManagedModeURLFilter::WARN || !warn_infobar_)
     return;
 
   // If we shouldn't have a warn infobar remove it here.
-  InfoBarService* infobar_service =
-      InfoBarService::FromWebContents(web_contents());
-  infobar_service->RemoveInfoBar(warn_infobar_delegate_);
-  warn_infobar_delegate_ = NULL;
+  InfoBarService::FromWebContents(web_contents())->RemoveInfoBar(warn_infobar_);
+  warn_infobar_ = NULL;
 }
 
 void ManagedModeNavigationObserver::DidCommitProvisionalLoadForFrame(
@@ -194,8 +192,8 @@
   ManagedModeURLFilter::FilteringBehavior behavior =
       url_filter_->GetFilteringBehaviorForURL(url);
 
-  if (behavior == ManagedModeURLFilter::WARN && !warn_infobar_delegate_) {
-    warn_infobar_delegate_ = ManagedModeWarningInfoBarDelegate::Create(
+  if (behavior == ManagedModeURLFilter::WARN && !warn_infobar_) {
+    warn_infobar_ = ManagedModeWarningInfoBarDelegate::Create(
         InfoBarService::FromWebContents(web_contents()));
   }
 }
diff --git a/chrome/browser/managed_mode/managed_mode_navigation_observer.h b/chrome/browser/managed_mode/managed_mode_navigation_observer.h
index 59015e4..292255e 100644
--- a/chrome/browser/managed_mode/managed_mode_navigation_observer.h
+++ b/chrome/browser/managed_mode/managed_mode_navigation_observer.h
@@ -66,7 +66,7 @@
   const ManagedModeURLFilter* url_filter_;
 
   // Owned by the InfoBarService, which has the same lifetime as this object.
-  InfoBarDelegate* warn_infobar_delegate_;
+  InfoBarDelegate* warn_infobar_;
 
   ScopedVector<const content::NavigationEntry> blocked_navigations_;
 
diff --git a/chrome/browser/media/chrome_media_stream_infobar_browsertest.cc b/chrome/browser/media/chrome_media_stream_infobar_browsertest.cc
index a0aada7..10827b0 100644
--- a/chrome/browser/media/chrome_media_stream_infobar_browsertest.cc
+++ b/chrome/browser/media/chrome_media_stream_infobar_browsertest.cc
@@ -4,7 +4,6 @@
 
 #include "base/file_util.h"
 #include "base/path_service.h"
-#include "base/process_util.h"
 #include "base/strings/stringprintf.h"
 #include "base/test/test_timeouts.h"
 #include "base/time/time.h"
diff --git a/chrome/browser/media/chrome_webrtc_browsertest.cc b/chrome/browser/media/chrome_webrtc_browsertest.cc
index b9c6b51..16b1421 100644
--- a/chrome/browser/media/chrome_webrtc_browsertest.cc
+++ b/chrome/browser/media/chrome_webrtc_browsertest.cc
@@ -5,7 +5,7 @@
 #include "base/command_line.h"
 #include "base/file_util.h"
 #include "base/path_service.h"
-#include "base/process_util.h"
+#include "base/process/launch.h"
 #include "base/strings/string_split.h"
 #include "base/strings/stringprintf.h"
 #include "base/synchronization/waitable_event.h"
@@ -122,7 +122,7 @@
     infobar_added.Wait();
     content::Details<InfoBarAddedDetails> details(infobar_added.details());
     MediaStreamInfoBarDelegate* media_infobar =
-        details.ptr()->AsMediaStreamInfoBarDelegate();
+        details->AsMediaStreamInfoBarDelegate();
     media_infobar->Accept();
 
     // Wait for WebRTC to call the success callback.
diff --git a/chrome/browser/media/chrome_webrtc_video_quality_browsertest.cc b/chrome/browser/media/chrome_webrtc_video_quality_browsertest.cc
index f6c5a97..e911a6e 100644
--- a/chrome/browser/media/chrome_webrtc_video_quality_browsertest.cc
+++ b/chrome/browser/media/chrome_webrtc_video_quality_browsertest.cc
@@ -5,7 +5,7 @@
 #include "base/environment.h"
 #include "base/file_util.h"
 #include "base/path_service.h"
-#include "base/process_util.h"
+#include "base/process/launch.h"
 #include "base/strings/string_split.h"
 #include "base/strings/stringprintf.h"
 #include "base/test/test_timeouts.h"
@@ -194,7 +194,7 @@
     infobar_added.Wait();
     content::Details<InfoBarAddedDetails> details(infobar_added.details());
     MediaStreamInfoBarDelegate* media_infobar =
-        details.ptr()->AsMediaStreamInfoBarDelegate();
+        details->AsMediaStreamInfoBarDelegate();
     media_infobar->Accept();
 
     // Wait for WebRTC to call the success callback.
diff --git a/chrome/browser/media_galleries/fileapi/device_media_async_file_util.cc b/chrome/browser/media_galleries/fileapi/device_media_async_file_util.cc
index 9f4b4a0..24f749b 100644
--- a/chrome/browser/media_galleries/fileapi/device_media_async_file_util.cc
+++ b/chrome/browser/media_galleries/fileapi/device_media_async_file_util.cc
@@ -13,12 +13,9 @@
 #include "chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h"
 #include "chrome/browser/media_galleries/fileapi/mtp_device_map_service.h"
 #include "chrome/browser/media_galleries/fileapi/native_media_file_util.h"
-#include "webkit/browser/fileapi/file_system_context.h"
+#include "content/public/browser/browser_thread.h"
 #include "webkit/browser/fileapi/file_system_operation_context.h"
-#include "webkit/browser/fileapi/file_system_task_runners.h"
 #include "webkit/browser/fileapi/file_system_url.h"
-#include "webkit/browser/fileapi/isolated_context.h"
-#include "webkit/browser/fileapi/native_file_util.h"
 #include "webkit/common/blob/shareable_file_reference.h"
 
 using fileapi::FileSystemOperationContext;
@@ -29,19 +26,12 @@
 
 namespace {
 
-const base::FilePath::CharType kDeviceMediaAsyncFileUtilTempDir[] =
-    FILE_PATH_LITERAL("DeviceMediaFileSystem");
-
-// Returns true if the current thread is IO thread.
-bool IsOnIOThread(FileSystemOperationContext* context) {
-  return context->file_system_context()->task_runners()->
-      io_task_runner()->RunsTasksOnCurrentThread();
-}
+const char kDeviceMediaAsyncFileUtilTempDir[] = "DeviceMediaFileSystem";
 
 // Called on the IO thread.
 MTPDeviceAsyncDelegate* GetMTPDeviceDelegate(
     FileSystemOperationContext* context) {
-  DCHECK(IsOnIOThread(context));
+  DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
   return MTPDeviceMapService::GetInstance()->GetMTPDeviceAsyncDelegate(
       context->GetUserValue<std::string>(
           MediaFileSystemBackend::kMTPDeviceDelegateURLKey));
@@ -59,7 +49,7 @@
     base::FilePath* snapshot_file_path) {
   DCHECK(snapshot_file_path);
   base::FilePath isolated_media_file_system_dir_path =
-      profile_path.Append(kDeviceMediaAsyncFileUtilTempDir);
+      profile_path.AppendASCII(kDeviceMediaAsyncFileUtilTempDir);
   if (!file_util::CreateDirectory(isolated_media_file_system_dir_path) ||
       !file_util::CreateTemporaryFileInDir(isolated_media_file_system_dir_path,
                                            snapshot_file_path)) {
@@ -86,7 +76,7 @@
     const FileSystemURL& url,
     int file_flags,
     const CreateOrOpenCallback& callback) {
-  DCHECK(IsOnIOThread(context.get()));
+  DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
   NOTIMPLEMENTED();
   base::PlatformFile invalid_file = base::kInvalidPlatformFileValue;
   callback.Run(base::PLATFORM_FILE_ERROR_SECURITY,
@@ -98,7 +88,7 @@
     scoped_ptr<FileSystemOperationContext> context,
     const FileSystemURL& url,
     const EnsureFileExistsCallback& callback) {
-  DCHECK(IsOnIOThread(context.get()));
+  DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
   NOTIMPLEMENTED();
   callback.Run(base::PLATFORM_FILE_ERROR_SECURITY, false);
 }
@@ -109,7 +99,7 @@
     bool exclusive,
     bool recursive,
     const StatusCallback& callback) {
-  DCHECK(IsOnIOThread(context.get()));
+  DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
   NOTIMPLEMENTED();
   callback.Run(base::PLATFORM_FILE_ERROR_SECURITY);
 }
@@ -118,30 +108,27 @@
     scoped_ptr<FileSystemOperationContext> context,
     const FileSystemURL& url,
     const GetFileInfoCallback& callback) {
-  DCHECK(IsOnIOThread(context.get()));
+  DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
   MTPDeviceAsyncDelegate* delegate = GetMTPDeviceDelegate(context.get());
   if (!delegate) {
-    OnGetFileInfoError(callback, url.path(),
-                       base::PLATFORM_FILE_ERROR_NOT_FOUND);
+    OnGetFileInfoError(callback, base::PLATFORM_FILE_ERROR_NOT_FOUND);
     return;
   }
   delegate->GetFileInfo(
       url.path(),
       base::Bind(&DeviceMediaAsyncFileUtil::OnDidGetFileInfo,
                  weak_ptr_factory_.GetWeakPtr(),
-                 callback,
-                 url.path()),
+                 callback),
       base::Bind(&DeviceMediaAsyncFileUtil::OnGetFileInfoError,
                  weak_ptr_factory_.GetWeakPtr(),
-                 callback,
-                 url.path()));
+                 callback));
 }
 
 void DeviceMediaAsyncFileUtil::ReadDirectory(
     scoped_ptr<FileSystemOperationContext> context,
     const FileSystemURL& url,
     const ReadDirectoryCallback& callback) {
-  DCHECK(IsOnIOThread(context.get()));
+  DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
   MTPDeviceAsyncDelegate* delegate = GetMTPDeviceDelegate(context.get());
   if (!delegate) {
     OnReadDirectoryError(callback, base::PLATFORM_FILE_ERROR_NOT_FOUND);
@@ -163,7 +150,7 @@
     const base::Time& last_access_time,
     const base::Time& last_modified_time,
     const StatusCallback& callback) {
-  DCHECK(IsOnIOThread(context.get()));
+  DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
   NOTIMPLEMENTED();
   callback.Run(base::PLATFORM_FILE_ERROR_SECURITY);
 }
@@ -173,7 +160,7 @@
     const FileSystemURL& url,
     int64 length,
     const StatusCallback& callback) {
-  DCHECK(IsOnIOThread(context.get()));
+  DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
   NOTIMPLEMENTED();
   callback.Run(base::PLATFORM_FILE_ERROR_SECURITY);
 }
@@ -183,7 +170,7 @@
     const FileSystemURL& src_url,
     const FileSystemURL& dest_url,
     const StatusCallback& callback) {
-  DCHECK(IsOnIOThread(context.get()));
+  DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
   NOTIMPLEMENTED();
   callback.Run(base::PLATFORM_FILE_ERROR_SECURITY);
 }
@@ -193,7 +180,7 @@
     const FileSystemURL& src_url,
     const FileSystemURL& dest_url,
     const StatusCallback& callback) {
-  DCHECK(IsOnIOThread(context.get()));
+  DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
   NOTIMPLEMENTED();
   callback.Run(base::PLATFORM_FILE_ERROR_SECURITY);
 }
@@ -203,7 +190,7 @@
     const base::FilePath& src_file_path,
     const FileSystemURL& dest_url,
     const StatusCallback& callback) {
-  DCHECK(IsOnIOThread(context.get()));
+  DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
   NOTIMPLEMENTED();
   callback.Run(base::PLATFORM_FILE_ERROR_SECURITY);
 }
@@ -212,7 +199,7 @@
     scoped_ptr<FileSystemOperationContext> context,
     const FileSystemURL& url,
     const StatusCallback& callback) {
-  DCHECK(IsOnIOThread(context.get()));
+  DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
   NOTIMPLEMENTED();
   callback.Run(base::PLATFORM_FILE_ERROR_SECURITY);
 }
@@ -221,7 +208,7 @@
     scoped_ptr<FileSystemOperationContext> context,
     const FileSystemURL& url,
     const StatusCallback& callback) {
-  DCHECK(IsOnIOThread(context.get()));
+  DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
   NOTIMPLEMENTED();
   callback.Run(base::PLATFORM_FILE_ERROR_SECURITY);
 }
@@ -230,7 +217,7 @@
     scoped_ptr<FileSystemOperationContext> context,
     const FileSystemURL& url,
     const StatusCallback& callback) {
-  DCHECK(IsOnIOThread(context.get()));
+  DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
   callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION);
 }
 
@@ -238,7 +225,7 @@
     scoped_ptr<FileSystemOperationContext> context,
     const FileSystemURL& url,
     const CreateSnapshotFileCallback& callback) {
-  DCHECK(IsOnIOThread(context.get()));
+  DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
   MTPDeviceAsyncDelegate* delegate = GetMTPDeviceDelegate(context.get());
   if (!delegate) {
     OnCreateSnapshotFileError(callback, base::PLATFORM_FILE_ERROR_NOT_FOUND);
@@ -269,16 +256,12 @@
 
 void DeviceMediaAsyncFileUtil::OnDidGetFileInfo(
     const AsyncFileUtil::GetFileInfoCallback& callback,
-    // TODO(thestig): remove this.
-    const base::FilePath& platform_path,
     const base::PlatformFileInfo& file_info) {
   callback.Run(base::PLATFORM_FILE_OK, file_info);
 }
 
 void DeviceMediaAsyncFileUtil::OnGetFileInfoError(
     const AsyncFileUtil::GetFileInfoCallback& callback,
-    // TODO(thestig): remove this.
-    const base::FilePath& platform_path,
     base::PlatformFileError error) {
   callback.Run(error, base::PlatformFileInfo());
 }
@@ -338,7 +321,7 @@
     const AsyncFileUtil::CreateSnapshotFileCallback& callback,
     const base::FilePath& device_file_path,
     base::FilePath* snapshot_file_path) {
-  DCHECK(IsOnIOThread(context.get()));
+  DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
   if (!snapshot_file_path || snapshot_file_path->empty()) {
     OnCreateSnapshotFileError(callback, base::PLATFORM_FILE_ERROR_FAILED);
     return;
diff --git a/chrome/browser/media_galleries/fileapi/device_media_async_file_util.h b/chrome/browser/media_galleries/fileapi/device_media_async_file_util.h
index f6e2e9f..cb4c6a8 100644
--- a/chrome/browser/media_galleries/fileapi/device_media_async_file_util.h
+++ b/chrome/browser/media_galleries/fileapi/device_media_async_file_util.h
@@ -104,20 +104,18 @@
   // Use Create() to get an instance of DeviceMediaAsyncFileUtil.
   explicit DeviceMediaAsyncFileUtil(const base::FilePath& profile_path);
 
-  // Called when GetFileInfo method call succeeds. |file_info|
-  // contains the |platform_path| file details. |callback| is invoked
-  // to complete the GetFileInfo request.
+  // Called when GetFileInfo method call succeeds. |file_info| contains the
+  // file details of the requested url. |callback| is invoked to complete the
+  // GetFileInfo request.
   void OnDidGetFileInfo(
       const AsyncFileUtil::GetFileInfoCallback& callback,
-      const base::FilePath& platform_path,
       const base::PlatformFileInfo& file_info);
 
   // Called when GetFileInfo method call failed to get the details of file
-  // specified by the |platform_path|. |callback| is invoked to notify the
+  // specified by the requested url. |callback| is invoked to notify the
   // caller about the platform file |error|.
   void OnGetFileInfoError(
       const AsyncFileUtil::GetFileInfoCallback& callback,
-      const base::FilePath& platform_path,
       base::PlatformFileError error);
 
   // Called when ReadDirectory method call succeeds. |callback| is invoked to
diff --git a/chrome/browser/media_galleries/fileapi/media_file_system_backend.cc b/chrome/browser/media_galleries/fileapi/media_file_system_backend.cc
index 308b252..59809bb 100644
--- a/chrome/browser/media_galleries/fileapi/media_file_system_backend.cc
+++ b/chrome/browser/media_galleries/fileapi/media_file_system_backend.cc
@@ -103,12 +103,14 @@
   }
 }
 
-void MediaFileSystemBackend::InitializeFileSystem(
+void MediaFileSystemBackend::Initialize(fileapi::FileSystemContext* context) {
+}
+
+void MediaFileSystemBackend::OpenFileSystem(
     const GURL& origin_url,
     fileapi::FileSystemType type,
     fileapi::OpenFileSystemMode mode,
-    fileapi::FileSystemContext* context,
-    const InitializeFileSystemCallback& callback) {
+    const OpenFileSystemCallback& callback) {
   // We never allow opening a new isolated FileSystem via usual OpenFileSystem.
   base::MessageLoopProxy::current()->PostTask(
       FROM_HERE,
diff --git a/chrome/browser/media_galleries/fileapi/media_file_system_backend.h b/chrome/browser/media_galleries/fileapi/media_file_system_backend.h
index 3026664..e1763a8 100644
--- a/chrome/browser/media_galleries/fileapi/media_file_system_backend.h
+++ b/chrome/browser/media_galleries/fileapi/media_file_system_backend.h
@@ -39,12 +39,12 @@
 
   // FileSystemBackend implementation.
   virtual bool CanHandleType(fileapi::FileSystemType type) const OVERRIDE;
-  virtual void InitializeFileSystem(
+  virtual void Initialize(fileapi::FileSystemContext* context) OVERRIDE;
+  virtual void OpenFileSystem(
       const GURL& origin_url,
       fileapi::FileSystemType type,
       fileapi::OpenFileSystemMode mode,
-      fileapi::FileSystemContext* context,
-      const InitializeFileSystemCallback& callback) OVERRIDE;
+      const OpenFileSystemCallback& callback) OVERRIDE;
   virtual fileapi::FileSystemFileUtil* GetFileUtil(
       fileapi::FileSystemType type) OVERRIDE;
   virtual fileapi::AsyncFileUtil* GetAsyncFileUtil(
diff --git a/chrome/browser/media_galleries/fileapi/native_media_file_util.cc b/chrome/browser/media_galleries/fileapi/native_media_file_util.cc
index c9e1d6f..85f111e 100644
--- a/chrome/browser/media_galleries/fileapi/native_media_file_util.cc
+++ b/chrome/browser/media_galleries/fileapi/native_media_file_util.cc
@@ -330,10 +330,8 @@
     const GetFileInfoCallback& callback) {
   DCHECK(IsOnTaskRunnerThread(context.get()));
   base::PlatformFileInfo file_info;
-  // TODO(thestig): remove this.
-  base::FilePath platform_path;
   base::PlatformFileError error =
-      GetFileInfoSync(context.get(), url, &file_info, &platform_path);
+      GetFileInfoSync(context.get(), url, &file_info, NULL);
   content::BrowserThread::PostTask(
       content::BrowserThread::IO,
       FROM_HERE,
diff --git a/chrome/browser/memory_details.cc b/chrome/browser/memory_details.cc
index 1dad6f9..48d2d0a 100644
--- a/chrome/browser/memory_details.cc
+++ b/chrome/browser/memory_details.cc
@@ -7,7 +7,6 @@
 #include "base/bind.h"
 #include "base/file_version_info.h"
 #include "base/metrics/histogram.h"
-#include "base/process_util.h"
 #include "base/strings/string_util.h"
 #include "base/strings/stringprintf.h"
 #include "base/strings/utf_string_conversions.h"
diff --git a/chrome/browser/memory_details.h b/chrome/browser/memory_details.h
index be4d51f..cfbd68e 100644
--- a/chrome/browser/memory_details.h
+++ b/chrome/browser/memory_details.h
@@ -8,7 +8,7 @@
 #include <vector>
 
 #include "base/memory/ref_counted.h"
-#include "base/process_util.h"
+#include "base/process/process_metrics.h"
 #include "base/strings/string16.h"
 #include "chrome/browser/site_details.h"
 #include "content/public/common/process_type.h"
diff --git a/chrome/browser/memory_details_android.cc b/chrome/browser/memory_details_android.cc
index c524a2b..9be87ae 100644
--- a/chrome/browser/memory_details_android.cc
+++ b/chrome/browser/memory_details_android.cc
@@ -9,7 +9,6 @@
 #include <vector>
 
 #include "base/bind.h"
-#include "base/process_util.h"
 #include "base/memory/scoped_ptr.h"
 #include "chrome/common/chrome_constants.h"
 #include "content/public/browser/browser_thread.h"
diff --git a/chrome/browser/memory_details_linux.cc b/chrome/browser/memory_details_linux.cc
index 31bed8d..cbb9f4c 100644
--- a/chrome/browser/memory_details_linux.cc
+++ b/chrome/browser/memory_details_linux.cc
@@ -12,7 +12,8 @@
 
 #include "base/bind.h"
 #include "base/file_util.h"
-#include "base/process_util.h"
+#include "base/process/process_iterator.h"
+#include "base/process/process_metrics.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_util.h"
 #include "base/strings/utf_string_conversions.h"
diff --git a/chrome/browser/memory_details_mac.cc b/chrome/browser/memory_details_mac.cc
index a7ba52c..56158bf 100644
--- a/chrome/browser/memory_details_mac.cc
+++ b/chrome/browser/memory_details_mac.cc
@@ -12,7 +12,7 @@
 #include "base/file_version_info.h"
 #include "base/files/file_path.h"
 #include "base/mac/mac_util.h"
-#include "base/process_util.h"
+#include "base/process/process_iterator.h"
 #include "base/strings/string_util.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/threading/thread.h"
diff --git a/chrome/browser/memory_details_win.cc b/chrome/browser/memory_details_win.cc
index 5ce6032..ab9d36b 100644
--- a/chrome/browser/memory_details_win.cc
+++ b/chrome/browser/memory_details_win.cc
@@ -5,6 +5,7 @@
 #include "chrome/browser/memory_details.h"
 
 #include <psapi.h>
+#include <TlHelp32.h>
 
 #include "base/bind.h"
 #include "base/file_version_info.h"
diff --git a/chrome/browser/metrics/metrics_service.h b/chrome/browser/metrics/metrics_service.h
index b84172a..27437ec 100644
--- a/chrome/browser/metrics/metrics_service.h
+++ b/chrome/browser/metrics/metrics_service.h
@@ -17,7 +17,7 @@
 #include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/metrics/field_trial.h"
-#include "base/process_util.h"
+#include "base/process/kill.h"
 #include "chrome/browser/metrics/metrics_log.h"
 #include "chrome/browser/metrics/tracking_synchronizer_observer.h"
 #include "chrome/common/metrics/metrics_service_base.h"
diff --git a/chrome/browser/metrics/perf_provider_chromeos.cc b/chrome/browser/metrics/perf_provider_chromeos.cc
index 623033d..f3a1625 100644
--- a/chrome/browser/metrics/perf_provider_chromeos.cc
+++ b/chrome/browser/metrics/perf_provider_chromeos.cc
@@ -10,7 +10,6 @@
 #include "base/command_line.h"
 #include "base/compiler_specific.h"
 #include "base/metrics/histogram.h"
-#include "base/process_util.h"
 #include "base/rand_util.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/threading/sequenced_worker_pool.h"
diff --git a/chrome/browser/metrics/tracking_synchronizer.cc b/chrome/browser/metrics/tracking_synchronizer.cc
index aeda223..fd4505a 100644
--- a/chrome/browser/metrics/tracking_synchronizer.cc
+++ b/chrome/browser/metrics/tracking_synchronizer.cc
@@ -6,7 +6,6 @@
 
 #include "base/bind.h"
 #include "base/metrics/histogram.h"
-#include "base/process_util.h"
 #include "base/threading/thread.h"
 #include "base/tracked_objects.h"
 #include "chrome/browser/metrics/tracking_synchronizer_observer.h"
diff --git a/chrome/browser/nacl_host/nacl_broker_host_win.h b/chrome/browser/nacl_host/nacl_broker_host_win.h
index 30bc88d..80f2303 100644
--- a/chrome/browser/nacl_host/nacl_broker_host_win.h
+++ b/chrome/browser/nacl_host/nacl_broker_host_win.h
@@ -9,7 +9,7 @@
 
 #include "base/basictypes.h"
 #include "base/memory/scoped_ptr.h"
-#include "base/process.h"
+#include "base/process/process.h"
 #include "content/public/browser/browser_child_process_host_delegate.h"
 
 namespace content {
diff --git a/chrome/browser/nacl_host/nacl_process_host.cc b/chrome/browser/nacl_host/nacl_process_host.cc
index 59879e4..21754ba 100644
--- a/chrome/browser/nacl_host/nacl_process_host.cc
+++ b/chrome/browser/nacl_host/nacl_process_host.cc
@@ -15,7 +15,7 @@
 #include "base/message_loop/message_loop.h"
 #include "base/metrics/histogram.h"
 #include "base/path_service.h"
-#include "base/process_util.h"
+#include "base/process/process_iterator.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_split.h"
 #include "base/strings/string_util.h"
diff --git a/chrome/browser/nacl_host/nacl_process_host.h b/chrome/browser/nacl_host/nacl_process_host.h
index 808a274..f2133a1 100644
--- a/chrome/browser/nacl_host/nacl_process_host.h
+++ b/chrome/browser/nacl_host/nacl_process_host.h
@@ -12,7 +12,7 @@
 #include "base/memory/ref_counted.h"
 #include "base/memory/weak_ptr.h"
 #include "base/message_loop/message_loop.h"
-#include "base/process.h"
+#include "base/process/process.h"
 #include "components/nacl/common/nacl_types.h"
 #include "content/public/browser/browser_child_process_host_delegate.h"
 #include "content/public/browser/browser_child_process_host_iterator.h"
diff --git a/chrome/browser/nacl_host/test/gdb_debug_stub_browsertest.cc b/chrome/browser/nacl_host/test/gdb_debug_stub_browsertest.cc
index a522dce..03b5894 100644
--- a/chrome/browser/nacl_host/test/gdb_debug_stub_browsertest.cc
+++ b/chrome/browser/nacl_host/test/gdb_debug_stub_browsertest.cc
@@ -5,7 +5,8 @@
 #include "base/command_line.h"
 #include "base/environment.h"
 #include "base/path_service.h"
-#include "base/process_util.h"
+#include "base/process/kill.h"
+#include "base/process/launch.h"
 #include "base/strings/string_number_conversions.h"
 #include "chrome/browser/nacl_host/nacl_browser.h"
 #include "chrome/test/ppapi/ppapi_test.h"
diff --git a/chrome/browser/nacl_host/test/mock_nacl_gdb.cc b/chrome/browser/nacl_host/test/mock_nacl_gdb.cc
index 4635aa4..097f1f9 100644
--- a/chrome/browser/nacl_host/test/mock_nacl_gdb.cc
+++ b/chrome/browser/nacl_host/test/mock_nacl_gdb.cc
@@ -10,7 +10,6 @@
 #include "base/file_util.h"
 #include "base/logging.h"
 #include "base/memory/scoped_ptr.h"
-#include "base/process_util.h"
 
 static const char kEvalCommand[] = "--eval-command";
 static const char kCommand[] = "--command";
diff --git a/chrome/browser/notifications/notification_browsertest.cc b/chrome/browser/notifications/notification_browsertest.cc
index 496147c..f015843 100644
--- a/chrome/browser/notifications/notification_browsertest.cc
+++ b/chrome/browser/notifications/notification_browsertest.cc
@@ -221,7 +221,7 @@
   void AllowOrigin(const GURL& origin);
   void AllowAllOrigins();
 
-  void VerifyInfobar(const Browser* browser, int index);
+  void VerifyInfoBar(const Browser* browser, int index);
   std::string CreateNotification(Browser* browser,
                                  bool wait_for_new_balloon,
                                  const char* icon,
@@ -232,9 +232,9 @@
                                        bool wait_for_new_balloon);
   bool RequestPermissionAndWait(Browser* browser);
   bool CancelNotification(const char* notification_id, Browser* browser);
-  bool PerformActionOnInfobar(Browser* browser,
+  bool PerformActionOnInfoBar(Browser* browser,
                               InfobarAction action,
-                              int infobar_index,
+                              size_t infobar_index,
                               int tab_index);
   void GetPrefsByContentSetting(ContentSetting setting,
                                 ContentSettingsForOneType* settings);
@@ -319,13 +319,13 @@
       CONTENT_SETTING_ALLOW);
 }
 
-void NotificationsTest::VerifyInfobar(const Browser* browser, int index) {
+void NotificationsTest::VerifyInfoBar(const Browser* browser, int index) {
   InfoBarService* infobar_service = InfoBarService::FromWebContents(
       browser->tab_strip_model()->GetWebContentsAt(index));
 
   ASSERT_EQ(1U, infobar_service->infobar_count());
-  InfoBarDelegate* infobar = infobar_service->infobar_at(0);
-  ConfirmInfoBarDelegate* confirm_infobar = infobar->AsConfirmInfoBarDelegate();
+  ConfirmInfoBarDelegate* confirm_infobar =
+      infobar_service->infobar_at(0)->AsConfirmInfoBarDelegate();
   ASSERT_TRUE(confirm_infobar);
   int buttons = confirm_infobar->GetButtons();
   EXPECT_TRUE(buttons & ConfirmInfoBarDelegate::BUTTON_OK);
@@ -399,33 +399,44 @@
   return observer->Wait();
 }
 
-bool NotificationsTest::PerformActionOnInfobar(
+bool NotificationsTest::PerformActionOnInfoBar(
     Browser* browser,
     InfobarAction action,
-    int infobar_index,
+    size_t infobar_index,
     int tab_index) {
   InfoBarService* infobar_service = InfoBarService::FromWebContents(
       browser->tab_strip_model()->GetWebContentsAt(tab_index));
+  if (infobar_index >= infobar_service->infobar_count()) {
+    ADD_FAILURE();
+    return false;
+  }
 
-  InfoBarDelegate* infobar = infobar_service->infobar_at(infobar_index);
+  InfoBarDelegate* infobar_delegate =
+      infobar_service->infobar_at(infobar_index);
   switch (action) {
     case DISMISS:
-      infobar->InfoBarDismissed();
-      infobar_service->RemoveInfoBar(infobar);
+      infobar_delegate->InfoBarDismissed();
+      infobar_service->RemoveInfoBar(infobar_delegate);
       return true;
 
     case ALLOW: {
-      ConfirmInfoBarDelegate* confirm_bar = infobar->AsConfirmInfoBarDelegate();
-      if (confirm_bar->Accept()) {
-        infobar_service->RemoveInfoBar(infobar);
+      ConfirmInfoBarDelegate* confirm_infobar_delegate =
+          infobar_delegate->AsConfirmInfoBarDelegate();
+      if (!confirm_infobar_delegate) {
+        ADD_FAILURE();
+      } else if (confirm_infobar_delegate->Accept()) {
+        infobar_service->RemoveInfoBar(infobar_delegate);
         return true;
       }
     }
 
     case DENY: {
-      ConfirmInfoBarDelegate* confirm_bar = infobar->AsConfirmInfoBarDelegate();
-      if (confirm_bar->Cancel()) {
-        infobar_service->RemoveInfoBar(infobar);
+      ConfirmInfoBarDelegate* confirm_infobar_delegate =
+          infobar_delegate->AsConfirmInfoBarDelegate();
+      if (!confirm_infobar_delegate) {
+        ADD_FAILURE();
+      } else if (confirm_infobar_delegate->Cancel()) {
+        infobar_service->RemoveInfoBar(infobar_delegate);
         return true;
       }
     }
@@ -602,7 +613,7 @@
   ASSERT_TRUE(RequestPermissionAndWait(browser()));
 
   ASSERT_EQ(0, GetNotificationCount());
-  VerifyInfobar(browser(), 0);
+  ASSERT_NO_FATAL_FAILURE(VerifyInfoBar(browser(), 0));
 }
 
 IN_PROC_BROWSER_TEST_F(NotificationsTest, TestAllowOnPermissionInfobar) {
@@ -621,7 +632,7 @@
   ASSERT_EQ(0, GetNotificationCount());
 
   ASSERT_TRUE(RequestPermissionAndWait(browser()));
-  ASSERT_TRUE(PerformActionOnInfobar(browser(), ALLOW, 0, 0));
+  ASSERT_TRUE(PerformActionOnInfoBar(browser(), ALLOW, 0, 0));
 
   CreateSimpleNotification(browser(), true);
   EXPECT_EQ(1, GetNotificationCount());
@@ -634,7 +645,7 @@
   // when Deny is chosen from permission infobar.
   ui_test_utils::NavigateToURL(browser(), GetTestPageURL());
   ASSERT_TRUE(RequestPermissionAndWait(browser()));
-  PerformActionOnInfobar(browser(), DENY, 0, 0);
+  PerformActionOnInfoBar(browser(), DENY, 0, 0);
   CreateSimpleNotification(browser(), false);
   ASSERT_EQ(0, GetNotificationCount());
   ContentSettingsForOneType settings;
@@ -648,7 +659,7 @@
   // Test that no notification is created when permission infobar is dismissed.
   ui_test_utils::NavigateToURL(browser(), GetTestPageURL());
   ASSERT_TRUE(RequestPermissionAndWait(browser()));
-  PerformActionOnInfobar(browser(), DISMISS, 0, 0);
+  PerformActionOnInfoBar(browser(), DISMISS, 0, 0);
   CreateSimpleNotification(browser(), false);
   ASSERT_EQ(0, GetNotificationCount());
   ContentSettingsForOneType settings;
@@ -800,13 +811,13 @@
   Browser* incognito = CreateIncognitoBrowser();
   ui_test_utils::NavigateToURL(incognito, GetTestPageURL());
   ASSERT_TRUE(RequestPermissionAndWait(incognito));
-  PerformActionOnInfobar(incognito, DENY, 0, 0);
+  PerformActionOnInfoBar(incognito, DENY, 0, 0);
   CloseBrowserWindow(incognito);
 
   incognito = CreateIncognitoBrowser();
   ui_test_utils::NavigateToURL(incognito, GetTestPageURL());
   ASSERT_TRUE(RequestPermissionAndWait(incognito));
-  PerformActionOnInfobar(incognito, ALLOW, 0, 0);
+  PerformActionOnInfoBar(incognito, ALLOW, 0, 0);
   CreateSimpleNotification(incognito, true);
   ASSERT_EQ(1, GetNotificationCount());
   CloseBrowserWindow(incognito);
@@ -893,7 +904,7 @@
   ui_test_utils::NavigateToURL(browser, GetTestPageURL());
   browser->tab_strip_model()->ActivateTabAt(0, true);
   ASSERT_TRUE(RequestPermissionAndWait(browser));
-  PerformActionOnInfobar(browser, ALLOW, 0, 0);
+  PerformActionOnInfoBar(browser, ALLOW, 0, 0);
   CreateSimpleNotification(browser, true);
   ASSERT_EQ(1, GetNotificationCount());
 }
@@ -941,7 +952,7 @@
   ASSERT_TRUE(RequestPermissionAndWait(browser()));
   ui_test_utils::NavigateToURL(browser(), GetTestPageURL());
   ASSERT_TRUE(RequestPermissionAndWait(browser()));
-  PerformActionOnInfobar(browser(), ALLOW, 0, 0);
+  PerformActionOnInfoBar(browser(), ALLOW, 0, 0);
   CreateSimpleNotification(browser(), true);
   ASSERT_EQ(1, GetNotificationCount());
 }
diff --git a/chrome/browser/page_cycler/page_cycler.cc b/chrome/browser/page_cycler/page_cycler.cc
index 7fcf078..51e1eb8 100644
--- a/chrome/browser/page_cycler/page_cycler.cc
+++ b/chrome/browser/page_cycler/page_cycler.cc
@@ -8,7 +8,6 @@
 #include "base/file_util.h"
 #include "base/files/file_path.h"
 #include "base/message_loop/message_loop.h"
-#include "base/process_util.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_split.h"
 #include "base/strings/utf_string_conversions.h"
diff --git a/chrome/browser/performance_monitor/performance_monitor.cc b/chrome/browser/performance_monitor/performance_monitor.cc
index 1886a2d..5ed870f 100644
--- a/chrome/browser/performance_monitor/performance_monitor.cc
+++ b/chrome/browser/performance_monitor/performance_monitor.cc
@@ -10,7 +10,7 @@
 #include "base/bind.h"
 #include "base/command_line.h"
 #include "base/logging.h"
-#include "base/process_util.h"
+#include "base/process/process_iterator.h"
 #include "base/stl_util.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/threading/worker_pool.h"
diff --git a/chrome/browser/performance_monitor/performance_monitor.h b/chrome/browser/performance_monitor/performance_monitor.h
index d8cd74e..a054f58 100644
--- a/chrome/browser/performance_monitor/performance_monitor.h
+++ b/chrome/browser/performance_monitor/performance_monitor.h
@@ -13,8 +13,7 @@
 #include "base/memory/linked_ptr.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/memory/singleton.h"
-#include "base/process.h"
-#include "base/process_util.h"
+#include "base/process/process_metrics.h"
 #include "base/timer/timer.h"
 #include "chrome/browser/performance_monitor/database.h"
 #include "chrome/browser/performance_monitor/event.h"
diff --git a/chrome/browser/platform_util_linux.cc b/chrome/browser/platform_util_linux.cc
index 6f88b16..60d4467 100644
--- a/chrome/browser/platform_util_linux.cc
+++ b/chrome/browser/platform_util_linux.cc
@@ -6,7 +6,8 @@
 
 #include "base/bind.h"
 #include "base/file_util.h"
-#include "base/process_util.h"
+#include "base/process/kill.h"
+#include "base/process/launch.h"
 #include "base/strings/utf_string_conversions.h"
 #include "content/public/browser/browser_thread.h"
 #include "url/gurl.h"
diff --git a/chrome/browser/plugins/plugin_finder_unittest.cc b/chrome/browser/plugins/plugin_finder_unittest.cc
index 726b146..a6317a6 100644
--- a/chrome/browser/plugins/plugin_finder_unittest.cc
+++ b/chrome/browser/plugins/plugin_finder_unittest.cc
@@ -69,4 +69,5 @@
           << "Invalid security status \"" << status_str << "\"";
     }
   }
+  delete version;
 }
diff --git a/chrome/browser/plugins/plugin_installer.cc b/chrome/browser/plugins/plugin_installer.cc
index 653d129..69864ad 100644
--- a/chrome/browser/plugins/plugin_installer.cc
+++ b/chrome/browser/plugins/plugin_installer.cc
@@ -6,7 +6,7 @@
 
 #include "base/bind.h"
 #include "base/bind_helpers.h"
-#include "base/process.h"
+#include "base/process/process.h"
 #include "base/strings/stringprintf.h"
 #include "chrome/browser/download/download_service.h"
 #include "chrome/browser/download/download_service_factory.h"
diff --git a/chrome/browser/plugins/plugin_observer.cc b/chrome/browser/plugins/plugin_observer.cc
index 7c9cd67..7668168 100644
--- a/chrome/browser/plugins/plugin_observer.cc
+++ b/chrome/browser/plugins/plugin_observer.cc
@@ -8,7 +8,6 @@
 #include "base/bind.h"
 #include "base/debug/crash_logging.h"
 #include "base/metrics/histogram.h"
-#include "base/process_util.h"
 #include "base/stl_util.h"
 #include "base/strings/utf_string_conversions.h"
 #include "chrome/browser/browser_process.h"
diff --git a/chrome/browser/policy/configuration_policy_pref_store.cc b/chrome/browser/policy/configuration_policy_pref_store.cc
index 8b7d10a..c054471 100644
--- a/chrome/browser/policy/configuration_policy_pref_store.cc
+++ b/chrome/browser/policy/configuration_policy_pref_store.cc
@@ -88,6 +88,16 @@
 void ConfigurationPolicyPrefStore::OnPolicyServiceInitialized(
     PolicyDomain domain) {
   if (domain == POLICY_DOMAIN_CHROME) {
+    // Subtle: the current implementation of PolicyServiceImpl sends out this
+    // notification before invoking OnPolicyUpdated(), which gets posted to
+    // execute "soon" after on the current message loop.
+    // But the PrefService will start reading the preferences published by
+    // this store once OnInitializationCompleted() is sent out, so make sure
+    // this is reading the current policies before doing so.
+    // TODO(joaodasilva): remove this, and fix the order of notifications from
+    // the PolicyService instead. http://crbug.com/263728
+    Refresh();
+
     FOR_EACH_OBSERVER(PrefStore::Observer, observers_,
                       OnInitializationCompleted(true));
   }
diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc
index 869c9bf..b5667a4 100644
--- a/chrome/browser/policy/policy_browsertest.cc
+++ b/chrome/browser/policy/policy_browsertest.cc
@@ -1160,8 +1160,7 @@
   ui_test_utils::NavigateToURL(browser(), url);
   // This should have triggered the dangerous plugin infobar.
   ASSERT_EQ(1u, infobar_service->infobar_count());
-  InfoBarDelegate* infobar_delegate = infobar_service->infobar_at(0);
-  EXPECT_TRUE(infobar_delegate->AsConfirmInfoBarDelegate());
+  EXPECT_TRUE(infobar_service->infobar_at(0)->AsConfirmInfoBarDelegate());
   // And the plugin isn't running.
   EXPECT_EQ(0, CountPlugins());
 
diff --git a/chrome/browser/policy/policy_loader_win_unittest.cc b/chrome/browser/policy/policy_loader_win_unittest.cc
index a6492de..3417d9f 100644
--- a/chrome/browser/policy/policy_loader_win_unittest.cc
+++ b/chrome/browser/policy/policy_loader_win_unittest.cc
@@ -19,7 +19,7 @@
 #include "base/files/scoped_temp_dir.h"
 #include "base/json/json_writer.h"
 #include "base/path_service.h"
-#include "base/process.h"
+#include "base/process/process.h"
 #include "base/strings/string16.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_util.h"
diff --git a/chrome/browser/predictors/autocomplete_action_predictor_unittest.cc b/chrome/browser/predictors/autocomplete_action_predictor_unittest.cc
index 921ba20..c13641b 100644
--- a/chrome/browser/predictors/autocomplete_action_predictor_unittest.cc
+++ b/chrome/browser/predictors/autocomplete_action_predictor_unittest.cc
@@ -102,7 +102,7 @@
         switches::kPrerenderFromOmniboxSwitchValueEnabled);
 
     predictor_->CreateLocalCachesFromDatabase();
-    profile_->CreateHistoryService(true, false);
+    ASSERT_TRUE(profile_->CreateHistoryService(true, false));
     profile_->BlockUntilHistoryProcessesPendingRequests();
 
     ASSERT_TRUE(predictor_->initialized_);
diff --git a/chrome/browser/predictors/resource_prefetch_predictor_unittest.cc b/chrome/browser/predictors/resource_prefetch_predictor_unittest.cc
index 56d90c6..b0d7fe3 100644
--- a/chrome/browser/predictors/resource_prefetch_predictor_unittest.cc
+++ b/chrome/browser/predictors/resource_prefetch_predictor_unittest.cc
@@ -186,7 +186,7 @@
 void ResourcePrefetchPredictorTest::SetUp() {
   InitializeSampleData();
 
-  profile_->CreateHistoryService(true, false);
+  ASSERT_TRUE(profile_->CreateHistoryService(true, false));
   profile_->BlockUntilHistoryProcessesPendingRequests();
   EXPECT_TRUE(HistoryServiceFactory::GetForProfile(profile_.get(),
                                                    Profile::EXPLICIT_ACCESS));
diff --git a/chrome/browser/prefs/pref_metrics_service.cc b/chrome/browser/prefs/pref_metrics_service.cc
new file mode 100644
index 0000000..ed1d538
--- /dev/null
+++ b/chrome/browser/prefs/pref_metrics_service.cc
@@ -0,0 +1,67 @@
+// 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 "chrome/browser/prefs/pref_metrics_service.h"
+
+#include "base/metrics/histogram.h"
+#include "base/prefs/pref_service.h"
+#include "chrome/browser/profiles/incognito_helpers.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/common/pref_names.h"
+#include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
+
+PrefMetricsService::PrefMetricsService(Profile* profile)
+    : profile_(profile) {
+  RecordLaunchPrefs();
+}
+
+PrefMetricsService::~PrefMetricsService() {
+}
+
+void PrefMetricsService::RecordLaunchPrefs() {
+  UMA_HISTOGRAM_BOOLEAN("Settings.ShowHomeButton",
+      profile_->GetPrefs()->GetBoolean(prefs::kShowHomeButton));
+  UMA_HISTOGRAM_BOOLEAN("Settings.HomePageIsNewTabPage",
+      profile_->GetPrefs()->GetBoolean(prefs::kHomePageIsNewTabPage));
+}
+
+// static
+PrefMetricsService::Factory* PrefMetricsService::Factory::GetInstance() {
+  return Singleton<PrefMetricsService::Factory>::get();
+}
+
+// static
+PrefMetricsService* PrefMetricsService::Factory::GetForProfile(
+    Profile* profile) {
+  return static_cast<PrefMetricsService*>(
+      GetInstance()->GetServiceForBrowserContext(profile, true));
+}
+
+PrefMetricsService::Factory::Factory()
+    : BrowserContextKeyedServiceFactory(
+        "PrefMetricsService",
+        BrowserContextDependencyManager::GetInstance()) {
+}
+
+PrefMetricsService::Factory::~Factory() {
+}
+
+BrowserContextKeyedService*
+PrefMetricsService::Factory::BuildServiceInstanceFor(
+    content::BrowserContext* profile) const {
+  return new PrefMetricsService(static_cast<Profile*>(profile));
+}
+
+bool PrefMetricsService::Factory::ServiceIsCreatedWithBrowserContext() const {
+  return true;
+}
+
+bool PrefMetricsService::Factory::ServiceIsNULLWhileTesting() const {
+  return false;
+}
+
+content::BrowserContext* PrefMetricsService::Factory::GetBrowserContextToUse(
+    content::BrowserContext* context) const {
+  return chrome::GetBrowserContextRedirectedInIncognito(context);
+}
diff --git a/chrome/browser/prefs/pref_metrics_service.h b/chrome/browser/prefs/pref_metrics_service.h
new file mode 100644
index 0000000..647cd94
--- /dev/null
+++ b/chrome/browser/prefs/pref_metrics_service.h
@@ -0,0 +1,44 @@
+// 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 CHROME_BROWSER_PREFS_PREF_METRICS_SERVICE_H_
+#define CHROME_BROWSER_PREFS_PREF_METRICS_SERVICE_H_
+
+#include "base/memory/singleton.h"
+#include "chrome/browser/profiles/profile.h"
+#include "components/browser_context_keyed_service/browser_context_keyed_service.h"
+#include "components/browser_context_keyed_service/browser_context_keyed_service_factory.h"
+
+// PrefMetricsService is responsible for recording prefs-related UMA stats.
+class PrefMetricsService : public BrowserContextKeyedService {
+ public:
+  explicit PrefMetricsService(Profile* profile);
+  virtual ~PrefMetricsService();
+
+  class Factory : public BrowserContextKeyedServiceFactory {
+   public:
+    static Factory* GetInstance();
+    static PrefMetricsService* GetForProfile(Profile* profile);
+   private:
+    friend struct DefaultSingletonTraits<Factory>;
+
+    Factory();
+    virtual ~Factory();
+
+    // BrowserContextKeyedServiceFactory implementation
+    virtual BrowserContextKeyedService* BuildServiceInstanceFor(
+        content::BrowserContext* profile) const OVERRIDE;
+    virtual bool ServiceIsCreatedWithBrowserContext() const OVERRIDE;
+    virtual bool ServiceIsNULLWhileTesting() const OVERRIDE;
+    virtual content::BrowserContext* GetBrowserContextToUse(
+        content::BrowserContext* context) const OVERRIDE;
+  };
+ private:
+  // Record prefs state on browser context creation.
+  void RecordLaunchPrefs();
+
+  Profile* profile_;
+};
+
+#endif  // CHROME_BROWSER_PREFS_PREF_METRICS_SERVICE_H_
diff --git a/chrome/browser/printing/cloud_print/test/cloud_print_policy_browsertest.cc b/chrome/browser/printing/cloud_print/test/cloud_print_policy_browsertest.cc
index eb238e5..d298a2d 100644
--- a/chrome/browser/printing/cloud_print/test/cloud_print_policy_browsertest.cc
+++ b/chrome/browser/printing/cloud_print/test/cloud_print_policy_browsertest.cc
@@ -4,7 +4,8 @@
 
 #include "base/command_line.h"
 #include "base/path_service.h"
-#include "base/process_util.h"
+#include "base/process/kill.h"
+#include "base/process/launch.h"
 #include "base/test/test_timeouts.h"
 #include "chrome/browser/chrome_notification_types.h"
 #include "chrome/common/chrome_result_codes.h"
diff --git a/chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc b/chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc
index 7064156..4336fc3 100644
--- a/chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc
+++ b/chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc
@@ -9,7 +9,7 @@
 #include "base/bind.h"
 #include "base/command_line.h"
 #include "base/message_loop/message_loop.h"
-#include "base/process_util.h"
+#include "base/process/kill.h"
 #include "base/rand_util.h"
 #include "base/synchronization/waitable_event.h"
 #include "base/test/multiprocess_test.h"
diff --git a/chrome/browser/printing/printer_manager_dialog_linux.cc b/chrome/browser/printing/printer_manager_dialog_linux.cc
index 87bacba..fec3b02 100644
--- a/chrome/browser/printing/printer_manager_dialog_linux.cc
+++ b/chrome/browser/printing/printer_manager_dialog_linux.cc
@@ -9,7 +9,8 @@
 #include "base/memory/scoped_ptr.h"
 #include "base/message_loop/message_loop.h"
 #include "base/nix/xdg_util.h"
-#include "base/process_util.h"
+#include "base/process/kill.h"
+#include "base/process/launch.h"
 #include "content/public/browser/browser_thread.h"
 
 using base::Environment;
diff --git a/chrome/browser/printing/printing_layout_browsertest.cc b/chrome/browser/printing/printing_layout_browsertest.cc
index d653031..1d80518 100644
--- a/chrome/browser/printing/printing_layout_browsertest.cc
+++ b/chrome/browser/printing/printing_layout_browsertest.cc
@@ -8,7 +8,6 @@
 #include "base/files/file_path.h"
 #include "base/message_loop/message_loop.h"
 #include "base/path_service.h"
-#include "base/process_util.h"
 #include "base/strings/string_util.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/test/test_file_util.h"
diff --git a/chrome/browser/printing/printing_message_filter.cc b/chrome/browser/printing/printing_message_filter.cc
index 09ad68f..e0e2036 100644
--- a/chrome/browser/printing/printing_message_filter.cc
+++ b/chrome/browser/printing/printing_message_filter.cc
@@ -7,7 +7,6 @@
 #include <string>
 
 #include "base/bind.h"
-#include "base/process_util.h"
 #include "chrome/browser/browser_process.h"
 #include "chrome/browser/printing/printer_query.h"
 #include "chrome/browser/printing/print_job_manager.h"
diff --git a/chrome/browser/process_info_snapshot.h b/chrome/browser/process_info_snapshot.h
index 62cd134..575fbe2 100644
--- a/chrome/browser/process_info_snapshot.h
+++ b/chrome/browser/process_info_snapshot.h
@@ -11,7 +11,8 @@
 #include <string>
 #include <vector>
 
-#include "base/process_util.h"
+#include "base/process/process_handle.h"
+#include "base/process/process_metrics.h"
 
 // A class which captures process information at a given point in time when its
 // |Sample()| method is called. This information can then be probed by PID.
diff --git a/chrome/browser/process_info_snapshot_mac.cc b/chrome/browser/process_info_snapshot_mac.cc
index 7f27d0c..94a1bc0 100644
--- a/chrome/browser/process_info_snapshot_mac.cc
+++ b/chrome/browser/process_info_snapshot_mac.cc
@@ -9,7 +9,9 @@
 #include <sstream>
 
 #include "base/command_line.h"
+#include "base/files/file_path.h"
 #include "base/logging.h"
+#include "base/process/launch.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_util.h"
 #include "base/threading/thread.h"
diff --git a/chrome/browser/process_info_snapshot_mac_unittest.cc b/chrome/browser/process_info_snapshot_mac_unittest.cc
index 980dc91..c30a883 100644
--- a/chrome/browser/process_info_snapshot_mac_unittest.cc
+++ b/chrome/browser/process_info_snapshot_mac_unittest.cc
@@ -13,8 +13,10 @@
 #include "base/files/file_path.h"
 #include "base/logging.h"
 #include "base/posix/eintr_wrapper.h"
-#include "base/process_util.h"
-
+#include "base/process/kill.h"
+#include "base/process/launch.h"
+#include "base/process/process_handle.h"
+#include "base/process/process_metrics.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 typedef testing::Test ProcessInfoSnapshotMacTest;
diff --git a/chrome/browser/process_singleton.h b/chrome/browser/process_singleton.h
index a584147..1594cd5 100644
--- a/chrome/browser/process_singleton.h
+++ b/chrome/browser/process_singleton.h
@@ -20,7 +20,7 @@
 #include "base/files/file_path.h"
 #include "base/logging.h"
 #include "base/memory/ref_counted.h"
-#include "base/process.h"
+#include "base/process/process.h"
 #include "base/threading/non_thread_safe.h"
 #include "ui/gfx/native_widget_types.h"
 
diff --git a/chrome/browser/process_singleton_browsertest.cc b/chrome/browser/process_singleton_browsertest.cc
index d5dc29d..ad09a1c 100644
--- a/chrome/browser/process_singleton_browsertest.cc
+++ b/chrome/browser/process_singleton_browsertest.cc
@@ -16,7 +16,9 @@
 #include "base/files/scoped_temp_dir.h"
 #include "base/memory/ref_counted.h"
 #include "base/path_service.h"
-#include "base/process_util.h"
+#include "base/process/kill.h"
+#include "base/process/launch.h"
+#include "base/process/process_iterator.h"
 #include "base/synchronization/waitable_event.h"
 #include "base/test/test_timeouts.h"
 #include "base/threading/thread.h"
diff --git a/chrome/browser/process_singleton_linux.cc b/chrome/browser/process_singleton_linux.cc
index 4aea4fd..fbba09f 100644
--- a/chrome/browser/process_singleton_linux.cc
+++ b/chrome/browser/process_singleton_linux.cc
@@ -65,7 +65,6 @@
 #include "base/message_loop/message_loop.h"
 #include "base/path_service.h"
 #include "base/posix/eintr_wrapper.h"
-#include "base/process_util.h"
 #include "base/rand_util.h"
 #include "base/safe_strerror_posix.h"
 #include "base/sequenced_task_runner_helpers.h"
diff --git a/chrome/browser/process_singleton_linux_unittest.cc b/chrome/browser/process_singleton_linux_unittest.cc
index 5e62996..df20e0e 100644
--- a/chrome/browser/process_singleton_linux_unittest.cc
+++ b/chrome/browser/process_singleton_linux_unittest.cc
@@ -17,7 +17,6 @@
 #include "base/files/file_path.h"
 #include "base/files/scoped_temp_dir.h"
 #include "base/message_loop/message_loop.h"
-#include "base/process_util.h"
 #include "base/strings/stringprintf.h"
 #include "base/synchronization/waitable_event.h"
 #include "base/test/test_timeouts.h"
diff --git a/chrome/browser/process_singleton_win.cc b/chrome/browser/process_singleton_win.cc
index 94647c7..e82bf79 100644
--- a/chrome/browser/process_singleton_win.cc
+++ b/chrome/browser/process_singleton_win.cc
@@ -11,8 +11,8 @@
 #include "base/command_line.h"
 #include "base/files/file_path.h"
 #include "base/path_service.h"
-#include "base/process_info.h"
-#include "base/process_util.h"
+#include "base/process/kill.h"
+#include "base/process/process_info.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/stringprintf.h"
 #include "base/strings/utf_string_conversions.h"
diff --git a/chrome/browser/profiles/profile_manager_unittest.cc b/chrome/browser/profiles/profile_manager_unittest.cc
index ca66dba..3b49eac 100644
--- a/chrome/browser/profiles/profile_manager_unittest.cc
+++ b/chrome/browser/profiles/profile_manager_unittest.cc
@@ -215,14 +215,14 @@
   ASSERT_TRUE(profile2);
 
   // Force lazy-init of some profile services to simulate use.
-  profile1->CreateHistoryService(true, false);
+  ASSERT_TRUE(profile1->CreateHistoryService(true, false));
   EXPECT_TRUE(HistoryServiceFactory::GetForProfile(profile1,
                                                    Profile::EXPLICIT_ACCESS));
   profile1->CreateBookmarkModel(true);
   EXPECT_TRUE(BookmarkModelFactory::GetForProfile(profile1));
   profile2->CreateBookmarkModel(true);
   EXPECT_TRUE(BookmarkModelFactory::GetForProfile(profile2));
-  profile2->CreateHistoryService(true, false);
+  ASSERT_TRUE(profile2->CreateHistoryService(true, false));
   EXPECT_TRUE(HistoryServiceFactory::GetForProfile(profile2,
                                                    Profile::EXPLICIT_ACCESS));
 
diff --git a/chrome/browser/renderer_host/pepper/pepper_flash_drm_host.cc b/chrome/browser/renderer_host/pepper/pepper_flash_drm_host.cc
index 98870a1..22f79d9 100644
--- a/chrome/browser/renderer_host/pepper/pepper_flash_drm_host.cc
+++ b/chrome/browser/renderer_host/pepper/pepper_flash_drm_host.cc
@@ -50,7 +50,6 @@
         render_id_(render_id),
         monitor_(NULL),
         request_sent_(0) {
-    GetMonitor();
   }
 
   int64_t GetMonitor() {
@@ -131,6 +130,7 @@
 
   fetcher_ = new DeviceIDFetcher(render_process_id);
   monitor_finder_ = new MonitorFinder(render_process_id, render_view_id);
+  monitor_finder_->GetMonitor();
 }
 
 PepperFlashDRMHost::~PepperFlashDRMHost() {
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 2034b13..f48f404 100644
--- a/chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc
+++ b/chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc
@@ -3,7 +3,6 @@
 // found in the LICENSE file.
 
 #include "base/command_line.h"
-#include "base/process_util.h"
 #include "chrome/browser/chrome_notification_types.h"
 #include "chrome/browser/devtools/devtools_window.h"
 #include "chrome/browser/ui/browser.h"
diff --git a/chrome/browser/renderer_host/web_cache_manager_browsertest.cc b/chrome/browser/renderer_host/web_cache_manager_browsertest.cc
index 575a54d..a917ed5 100644
--- a/chrome/browser/renderer_host/web_cache_manager_browsertest.cc
+++ b/chrome/browser/renderer_host/web_cache_manager_browsertest.cc
@@ -5,7 +5,6 @@
 #include <string>
 
 #include "base/message_loop/message_loop.h"
-#include "base/process_util.h"
 #include "chrome/browser/renderer_host/web_cache_manager.h"
 #include "chrome/browser/ui/browser.h"
 #include "chrome/browser/ui/browser_commands.h"
diff --git a/chrome/browser/resources/extensions/extensions.js b/chrome/browser/resources/extensions/extensions.js
index 10d092c..89bfa71 100644
--- a/chrome/browser/resources/extensions/extensions.js
+++ b/chrome/browser/resources/extensions/extensions.js
@@ -54,12 +54,16 @@
       var toSend = null;
       // Files lack a check if they're a directory, but we can find out through
       // its item entry.
-      var fileIndex = e.dataTransfer.types.indexOf('Files');
-      if (e.dataTransfer.items[fileIndex].webkitGetAsEntry().isDirectory)
-        toSend = 'installDroppedDirectory';
+      for (var i = 0; i < e.dataTransfer.items.length; ++i) {
+        if (e.dataTransfer.items[i].kind == 'file' &&
+            e.dataTransfer.items[i].webkitGetAsEntry().isDirectory) {
+          toSend = 'installDroppedDirectory';
+          break;
+        }
+      }
       // Only process files that look like extensions. Other files should
       // navigate the browser normally.
-      else if (/\.(crx|user\.js)$/i.test(e.dataTransfer.files[0].name))
+      if (!toSend && /\.(crx|user\.js)$/i.test(e.dataTransfer.files[0].name))
         toSend = 'installDroppedFile';
 
       if (toSend) {
diff --git a/chrome/browser/resources/feedback.html b/chrome/browser/resources/feedback.html
index f25910c..b5ea6cc 100644
--- a/chrome/browser/resources/feedback.html
+++ b/chrome/browser/resources/feedback.html
@@ -7,8 +7,11 @@
 <link rel="stylesheet" href="chrome://resources/css/chrome_shared.css">
 <link rel="stylesheet" href="feedback.css">
 
+<script src="chrome://resources/js/cr.js"></script>
 <script src="chrome://resources/js/load_time_data.js"></script>
 <script src="chrome://resources/js/util.js"></script>
+<script src="chrome://resources/js/cr/ui.js"></script>
+<script src="chrome://resources/js/cr/ui/focus_manager.js"></script>
 <script src="chrome://feedback/feedback.js"></script>
 <script src="chrome://feedback/strings.js"></script>
 </head>
diff --git a/chrome/browser/resources/feedback.js b/chrome/browser/resources/feedback.js
index 15d37ec..6cb16f6 100644
--- a/chrome/browser/resources/feedback.js
+++ b/chrome/browser/resources/feedback.js
@@ -280,6 +280,7 @@
  * Window onload handler, sets up the page.
  */
 function load() {
+  cr.ui.FocusManager.disableMouseFocusOnButtons();
   if ($('attach-file'))
     $('attach-file').addEventListener('change', onFileSelected);
 
diff --git a/chrome/browser/resources/file_manager/js/file_copy_manager.js b/chrome/browser/resources/file_manager/js/file_copy_manager.js
index fccce39..9fe76ce 100644
--- a/chrome/browser/resources/file_manager/js/file_copy_manager.js
+++ b/chrome/browser/resources/file_manager/js/file_copy_manager.js
@@ -746,12 +746,7 @@
     }
 
     self.sendProgressEvent_('PROGRESS');
-
-    // We yield a few ms between copies to give the browser a chance to service
-    // events (like perhaps the user clicking to cancel the copy, for example).
-    setTimeout(function() {
-      self.serviceNextCopyTaskEntry_(task, onEntryServiced, errorCallback);
-    }, 10);
+    self.serviceNextCopyTaskEntry_(task, onEntryServiced, errorCallback);
   };
 
   this.serviceNextCopyTaskEntry_(task, onEntryServiced, errorCallback);
@@ -831,58 +826,12 @@
     onError('FILESYSTEM_ERROR', err);
   };
 
-  /**
-   * Resolves the immediate parent directory entry and the file name of a
-   * given path, where the path is specified by a directory (not necessarily
-   * the immediate parent) and a path (not necessarily the file name) related
-   * to that directory. For instance,
-   *   Given:
-   *     |dirEntry| = DirectoryEntry('/root/dir1')
-   *     |relativePath| = 'dir2/file'
-   *
-   *   Return:
-   *     |parentDirEntry| = DirectoryEntry('/root/dir1/dir2')
-   *     |fileName| = 'file'
-   *
-   * @param {DirectoryEntry} dirEntry A directory entry.
-   * @param {string} relativePath A path relative to |dirEntry|.
-   * @param {function(Entry,string)} successCallback A callback for returning
-   *     the |parentDirEntry| and |fileName| upon success.
-   * @param {function(FileError)} errorCallback An error callback when there is
-   *     an error getting |parentDirEntry|.
-   */
-  var resolveDirAndBaseName = function(dirEntry, relativePath,
-                                 successCallback, errorCallback) {
-    // |intermediatePath| contains the intermediate path components
-    // that are appended to |dirEntry| to form |parentDirEntry|.
-    var intermediatePath = '';
-    var fileName = relativePath;
-
-    // Extract the file name component from |relativePath|.
-    var index = relativePath.lastIndexOf('/');
-    if (index != -1) {
-      intermediatePath = relativePath.substr(0, index);
-      fileName = relativePath.substr(index + 1);
-    }
-
-    if (intermediatePath == '') {
-      successCallback(dirEntry, fileName);
-    } else {
-      dirEntry.getDirectory(intermediatePath,
-                            {create: false},
-                            function(entry) {
-                              successCallback(entry, fileName);
-                            },
-                            errorCallback);
-    }
-  };
-
   var onDeduplicated = function(targetRelativePath) {
     if (task.move) {
-      resolveDirAndBaseName(
-          targetDirEntry, targetRelativePath,
-          function(dirEntry, fileName) {
-            sourceEntry.moveTo(dirEntry, fileName,
+      targetDirEntry.getDirectory(
+          PathUtil.dirname(targetRelativePath), {create: false},
+          function(dirEntry) {
+            sourceEntry.moveTo(dirEntry, PathUtil.basename(targetRelativePath),
                                onFilesystemMoveComplete.bind(self, sourceEntry),
                                onFilesystemError);
           },
@@ -960,12 +909,13 @@
       };
 
       if (task.sourceOnDrive && task.targetOnDrive) {
-        resolveDirAndBaseName(
-            targetDirEntry, targetRelativePath,
-            function(dirEntry, fileName) {
+        targetDirEntry.getDirectory(
+            PathUtil.dirname(targetRelativePath), {create: false},
+            function(dirEntry) {
               onStartTransfer();
-              sourceEntry.copyTo(dirEntry, fileName, onSuccessTransfer,
-                                                     onFailTransfer);
+              sourceEntry.copyTo(
+                  dirEntry, PathUtil.basename(targetRelativePath),
+                  onSuccessTransfer, onFailTransfer);
             },
             onFilesystemError);
         return;
diff --git a/chrome/browser/resources/file_manager/js/file_manager.js b/chrome/browser/resources/file_manager/js/file_manager.js
index 029af9c..66cb272 100644
--- a/chrome/browser/resources/file_manager/js/file_manager.js
+++ b/chrome/browser/resources/file_manager/js/file_manager.js
@@ -637,13 +637,13 @@
 
     var doc = this.document_;
 
-    CommandUtil.registerCommand(doc, 'newfolder',
+    CommandUtil.registerCommand(this.dialogContainer_, 'newfolder',
         Commands.newFolderCommand, this, this.directoryModel_);
 
-    CommandUtil.registerCommand(doc, 'newwindow',
+    CommandUtil.registerCommand(this.dialogContainer_, 'newwindow',
         Commands.newWindowCommand, this, this.directoryModel_);
 
-    CommandUtil.registerCommand(doc, 'change-default-app',
+    CommandUtil.registerCommand(this.dialogContainer_, 'change-default-app',
         Commands.changeDefaultAppCommand, this);
 
     CommandUtil.registerCommand(this.volumeList_, 'unmount',
@@ -652,52 +652,58 @@
     CommandUtil.registerCommand(this.volumeList_, 'import-photos',
         Commands.importCommand, this.volumeList_);
 
-    CommandUtil.registerCommand(doc, 'format',
+    CommandUtil.registerCommand(this.dialogContainer_, 'format',
         Commands.formatCommand, this.volumeList_, this,
         this.directoryModel_);
 
-    CommandUtil.registerCommand(doc, 'delete',
+    CommandUtil.registerCommand(this.dialogContainer_, 'delete',
         Commands.deleteFileCommand, this);
 
-    CommandUtil.registerCommand(doc, 'rename',
+    CommandUtil.registerCommand(this.dialogContainer_, 'rename',
         Commands.renameFileCommand, this);
 
-    CommandUtil.registerCommand(doc, 'volume-help',
+    CommandUtil.registerCommand(this.dialogContainer_, 'volume-help',
         Commands.volumeHelpCommand, this);
 
-    CommandUtil.registerCommand(doc, 'drive-buy-more-space',
+    CommandUtil.registerCommand(this.dialogContainer_, 'drive-buy-more-space',
         Commands.driveBuySpaceCommand, this);
 
-    CommandUtil.registerCommand(doc, 'drive-clear-local-cache',
-        Commands.driveClearCacheCommand, this);
+    CommandUtil.registerCommand(this.dialogContainer_,
+        'drive-clear-local-cache', Commands.driveClearCacheCommand, this);
 
-    CommandUtil.registerCommand(doc, 'drive-go-to-drive',
+    CommandUtil.registerCommand(this.dialogContainer_, 'drive-go-to-drive',
         Commands.driveGoToDriveCommand, this);
 
-    CommandUtil.registerCommand(doc, 'paste',
+    CommandUtil.registerCommand(this.dialogContainer_, 'paste',
         Commands.pasteFileCommand, doc, this.fileTransferController_);
 
-    CommandUtil.registerCommand(doc, 'open-with',
+    CommandUtil.registerCommand(this.dialogContainer_, 'open-with',
         Commands.openWithCommand, this);
 
-    CommandUtil.registerCommand(doc, 'toggle-pinned',
+    CommandUtil.registerCommand(this.dialogContainer_, 'toggle-pinned',
         Commands.togglePinnedCommand, this);
 
-    CommandUtil.registerCommand(doc, 'zip-selection',
+    CommandUtil.registerCommand(this.dialogContainer_, 'zip-selection',
         Commands.zipSelectionCommand, this, this.directoryModel_);
 
-    CommandUtil.registerCommand(doc, 'share', Commands.shareCommand, this);
-    CommandUtil.registerCommand(doc, 'pin', Commands.pinCommand, this);
-    CommandUtil.registerCommand(doc, 'unpin',
-        Commands.unpinCommand, this, this.volumeList_);
+    CommandUtil.registerCommand(this.dialogContainer_, 'share',
+        Commands.shareCommand, this);
 
-    CommandUtil.registerCommand(doc, 'search', Commands.searchCommand, this,
+    CommandUtil.registerCommand(this.dialogContainer_,
+        'create-folder-shortcut', Commands.createFolderShortcutCommand, this);
+
+    CommandUtil.registerCommand(this.dialogContainer_,
+        'remove-folder-shortcut', Commands.removeFolderShortcutCommand, this,
+        this.volumeList_);
+
+    CommandUtil.registerCommand(this.dialogContainer_, 'search',
+        Commands.searchCommand, this,
         this.dialogDom_.querySelector('#search-box'));
 
     // Register commands with CTRL-1..9 shortcuts for switching between
     // volumes.
     for (var i = 1; i <= 9; i++) {
-      CommandUtil.registerCommand(doc,
+      CommandUtil.registerCommand(this.dialogContainer_,
                                   'volume-switch-' + i,
                                   Commands.volumeSwitchCommand,
                                   this.volumeList_,
@@ -901,7 +907,7 @@
     this.alert = new d.AlertDialog(this.dialogDom_);
     this.confirm = new d.ConfirmDialog(this.dialogDom_);
     this.prompt = new d.PromptDialog(this.dialogDom_);
-    this.shareDialog_ = new ShareDialog(this.dialogDom_, this.metadataCache_);
+    this.shareDialog_ = new ShareDialog(this.dialogDom_);
     this.defaultTaskPicker =
         new cr.filebrowser.DefaultActionDialog(this.dialogDom_);
   };
@@ -2241,31 +2247,30 @@
   };
 
   /**
-   * Pin the selected folder.
+   * Creates a folder shortcut.
+   * @param {string} path A shortcut which refers to |path| to be created.
    */
-  FileManager.prototype.pinSelection = function() {
-    var entries = this.getSelection().entries;
-    var entry = entries[0];
+  FileManager.prototype.createFolderShortcut = function(path) {
     // Duplicate entry.
-    if (this.isFolderPinned(entry.fullPath))
+    if (this.folderShortcutExists(path))
       return;
 
-    this.folderShortcutsModel_.add(entry.fullPath);
+    this.folderShortcutsModel_.add(path);
   };
 
   /**
-   * Checkes if the folder is pinned or not.
+   * Checkes if the shortcut which refers to the given folder exists or not.
    * @param {string} path Path of the folder to be checked.
    */
-  FileManager.prototype.isFolderPinned = function(path) {
+  FileManager.prototype.folderShortcutExists = function(path) {
     return this.folderShortcutsModel_.exists(path);
   };
 
   /**
-   * Unpins the pinned folder.
-   * @param {string} path Path of the pinned folder to be unpinnned.
+   * Removes the folder shortcut.
+   * @param {string} path The shortcut which refers to |path| is to be removed.
    */
-  FileManager.prototype.unpinFolder = function(path) {
+  FileManager.prototype.removeFolderShortcut = function(path) {
     this.folderShortcutsModel_.remove(path);
   };
 
diff --git a/chrome/browser/resources/file_manager/js/file_manager_commands.js b/chrome/browser/resources/file_manager/js/file_manager_commands.js
index f8c8b8d..1cd279e 100644
--- a/chrome/browser/resources/file_manager/js/file_manager_commands.js
+++ b/chrome/browser/resources/file_manager/js/file_manager_commands.js
@@ -175,6 +175,7 @@
 
     event.canExecute = (rootType == RootType.ARCHIVE ||
                         rootType == RootType.REMOVABLE);
+    event.command.setHidden(!event.canExecute);
     event.command.label = rootType == RootType.ARCHIVE ?
         str('CLOSE_ARCHIVE_BUTTON_LABEL') :
         str('UNMOUNT_DEVICE_BUTTON_LABEL');
@@ -537,22 +538,22 @@
     var selection = fileManager.getSelection();
     event.canExecute = fileManager.isOnDrive() &&
         !fileManager.isDriveOffline() &&
-        selection && selection.totalCount == 1 &&
-        selection.directoryCount == 0;
+        selection && selection.totalCount == 1;
     event.command.setHidden(!fileManager.isOnDrive());
   }
 };
 
 /**
- * Pins the selected folder (single only).
+ * Creates a shortcut of the selected folder (single only).
  */
-Commands.pinCommand = {
+Commands.createFolderShortcutCommand = {
   /**
    * @param {Event} event Command event.
    * @param {FileManager} fileManager The file manager instance.
    */
   execute: function(event, fileManager) {
-    fileManager.pinSelection();
+    var entries = fileManager.getSelection().entries;
+    fileManager.createFolderShortcut(entries[0].fullPath);
   },
   /**
    * @param {Event} event Command event.
@@ -570,15 +571,15 @@
     var onlyOneFolderSelected =
         selection && selection.directoryCount == 1 && selection.fileCount == 0;
     event.canExecute = onlyOneFolderSelected &&
-        !fileManager.isFolderPinned(selectionEntries[0].fullPath);
+        !fileManager.folderShortcutExists(selectionEntries[0].fullPath);
     event.command.setHidden(!onlyOneFolderSelected);
   }
 };
 
 /**
- * Unpin the pinned folder.
+ * Removes the folder shortcut.
  */
-Commands.unpinCommand = {
+Commands.removeFolderShortcutCommand = {
   /**
    * @param {Event} event Command event.
    * @param {FileManager} fileManager The file manager instance.
@@ -588,7 +589,7 @@
     var path = CommandUtil.getCommandRoot(event, directoryTree);
 
     if (path)
-      fileManager.unpinFolder(path);
+      fileManager.removeFolderShortcut(path);
   },
   /**
    * @param {Event} event Command event.
@@ -603,9 +604,9 @@
     }
 
     var path = CommandUtil.getCommandRoot(event, directoryTree);
-    var isPinned = path && !PathUtil.isRootPath(path);
-    event.canExecute = isPinned;
-    event.command.setHidden(!isPinned);
+    var isShortcut = path && fileManager.folderShortcutExists(path);
+    event.canExecute = isShortcut;
+    event.command.setHidden(!isShortcut);
   }
 };
 
diff --git a/chrome/browser/resources/file_manager/js/path_util.js b/chrome/browser/resources/file_manager/js/path_util.js
index db97d8f..d6561d4 100644
--- a/chrome/browser/resources/file_manager/js/path_util.js
+++ b/chrome/browser/resources/file_manager/js/path_util.js
@@ -114,6 +114,54 @@
 };
 
 /**
+ * Returns a directory part of the given |path|. In other words, the path
+ * without its base name.
+ *
+ * Examples:
+ * PathUtil.dirname('abc') -> ''
+ * PathUtil.dirname('a/b') -> 'a'
+ * PathUtil.dirname('a/b/') -> 'a/b'
+ * PathUtil.dirname('a/b/c') -> 'a/b'
+ * PathUtil.dirname('/') -> '/'
+ * PathUtil.dirname('/abc') -> '/'
+ * PathUtil.dirname('/abc/def') -> '/abc'
+ * PathUtil.dirname('') -> ''
+ *
+ * @param {string} path The path to be parsed.
+ * @return {string} The directory path.
+ */
+PathUtil.dirname = function(path) {
+  var index = path.lastIndexOf('/');
+  if (index < 0)
+    return '';
+  if (index == 0)
+    return '/';
+  return path.substring(0, index);
+};
+
+/**
+ * Returns the base name (the last component) of the given |path|. If the
+ * |path| ends with '/', returns an empty component.
+ *
+ * Examples:
+ * PathUtil.basename('abc') -> 'abc'
+ * PathUtil.basename('a/b') -> 'b'
+ * PathUtil.basename('a/b/') -> ''
+ * PathUtil.basename('a/b/c') -> 'c'
+ * PathUtil.basename('/') -> ''
+ * PathUtil.basename('/abc') -> 'abc'
+ * PathUtil.basename('/abc/def') -> 'def'
+ * PathUtil.basename('') -> ''
+ *
+ * @param {string} path The path to be parsed.
+ * @return {string} The base name.
+ */
+PathUtil.basename = function(path) {
+  var index = path.lastIndexOf('/');
+  return index >= 0 ? path.substring(index + 1) : path;
+};
+
+/**
  * Join path components into a single path. Can be called either with a list of
  * components as arguments, or with an array of components as the only argument.
  *
diff --git a/chrome/browser/resources/file_manager/js/share_dialog.js b/chrome/browser/resources/file_manager/js/share_dialog.js
index 852912e..e05e0c5 100644
--- a/chrome/browser/resources/file_manager/js/share_dialog.js
+++ b/chrome/browser/resources/file_manager/js/share_dialog.js
@@ -6,15 +6,13 @@
 
 /**
  * @param {HTMLElement} parentNode Node to be parent for this dialog.
- * @param {MetadataCache} metadataCache Metadata cache.
  * @constructor
  * @extends {cr.ui.dialogs.BaseDialog}
  * @implements {ShareClient.Observer}
  */
-function ShareDialog(parentNode, metadataCache) {
+function ShareDialog(parentNode) {
   this.queue_ = new AsyncUtil.Queue();
   this.onQueueTaskFinished_ = null;
-  this.metadataCache_ = metadataCache;
   this.shareClient_ = null;
   this.spinner_ = null;
   this.spinnerWrapper_ = null;
@@ -218,28 +216,44 @@
     this.webView_.setAttribute('tabIndex', '-1');
     this.webViewAuthorizer_ = new ShareDialog.WebViewAuthorizer(
         ShareClient.SHARE_TARGET, this.webView_);
+    this.webView_.addEventListener('newwindow', function(e) {
+      // Discard the window object and reopen in an external window.
+      e.window.discard();
+      chrome.windows.create({url: e.targetUrl});
+      e.preventDefault();
+    });
 
     cr.ui.dialogs.BaseDialog.prototype.show.call(this, '', null, null, null);
 
     // Initialize and authorize the Web View tag asynchronously.
     var group = new AsyncUtil.Group();
+
+    // Fetches an url to the sharing dialog.
+    var shareUrl;
+    var getShareUrlClosure = function(callback) {
+      chrome.fileBrowserPrivate.getShareUrl(
+          entry.toURL(),
+          function(inShareUrl) {
+            if (!chrome.runtime.lastError)
+              shareUrl = inShareUrl;
+            callback();
+          });
+    };
+
+    group.add(getShareUrlClosure);
     group.add(this.webViewAuthorizer_.initialize.bind(this.webViewAuthorizer_));
     group.add(this.webViewAuthorizer_.authorize.bind(this.webViewAuthorizer_));
 
+    // Loads the share widget once all the previous async calls are finished.
     group.run(function() {
-      // Loads the metadata and later the share widget.
-      this.metadataCache_.get(entry, 'drive', function(metadata) {
-        if (!metadata.shareUrl) {
-          onError();
-          return;
-        }
-        var shareUrl = metadata.shareUrl + '&embedOrigin=' +
-            ShareClient.SHARE_ORIGIN;
-        this.shareClient_ = new ShareClient(this.webView_,
-                                            shareUrl,
-                                            this);
-        this.shareClient_.load();
-      }.bind(this));
+      if (!shareUrl) {
+        onError();
+        return;
+      }
+      this.shareClient_ = new ShareClient(this.webView_,
+                                          shareUrl,
+                                          this);
+      this.shareClient_.load();
     }.bind(this));
   }.bind(this));
 };
diff --git a/chrome/browser/resources/file_manager/main.html b/chrome/browser/resources/file_manager/main.html
index 91ac96d..91e3e46 100644
--- a/chrome/browser/resources/file_manager/main.html
+++ b/chrome/browser/resources/file_manager/main.html
@@ -133,8 +133,10 @@
       <command id="rename" i18n-values="label:RENAME_BUTTON_LABEL"
                shortcut="Enter-Ctrl">
       <command id="delete" shortcut="U+007F">
-      <command id="pin" i18n-values="label:PIN_FOLDER_BUTTON_LABEL">
-      <command id="unpin" i18n-values="label:UNPIN_FOLDER_BUTTON_LABEL">
+      <command id="create-folder-shortcut"
+               i18n-values="label:CREATE_FOLDER_SHORTCUT_BUTTON_LABEL">
+      <command id="remove-folder-shortcut"
+               i18n-values="label:REMOVE_FOLDER_SHORTCUT_BUTTON_LABEL">
       <command id="newfolder" i18n-values="label:NEW_FOLDER_BUTTON_LABEL"
                shortcut="U+0045-Ctrl">
       <command id="newwindow" i18n-values="label:NEW_WINDOW_BUTTON_LABEL">
@@ -186,7 +188,7 @@
       <hr id="default-action-separator" visibleif="full-page" hidden>
       <menuitem command="#toggle-pinned" checkable></menuitem>
       <menuitem command="#share"></menuitem>
-      <menuitem command="#pin"></menuitem>
+      <menuitem command="#create-folder-shortcut"></menuitem>
       <hr command="#share">
       <menuitem command="#cut" visibleif="full-page"></menuitem>
       <menuitem command="#copy" visibleif="full-page"></menuitem>
@@ -203,7 +205,7 @@
       <menuitem command="#import-photos"></menuitem>
       <menuitem command="#unmount"></menuitem>
       <menuitem command="#format"></menuitem>
-      <menuitem command="#unpin"></menuitem>
+      <menuitem command="#remove-folder-shortcut"></menuitem>
     </menu>
 
     <menu id="gear-menu" class="chrome-menu" showShortcuts>
diff --git a/chrome/browser/resources/help/help.html b/chrome/browser/resources/help/help.html
index 40658fd..8e34d84 100644
--- a/chrome/browser/resources/help/help.html
+++ b/chrome/browser/resources/help/help.html
@@ -15,8 +15,9 @@
   <script src="chrome://resources/js/cr.js"></script>
   <script src="chrome://resources/js/load_time_data.js"></script>
   <script src="chrome://resources/js/util.js"></script>
-<if expr="pp_ifdef('chromeos')">
   <script src="chrome://resources/js/cr/ui.js"></script>
+  <script src="chrome://resources/js/cr/ui/focus_manager.js"></script>
+<if expr="pp_ifdef('chromeos')">
   <script src="chrome://resources/js/cr/ui/bubble.js"></script>
   <script src="chrome://resources/js/cr/ui/overlay.js"></script>
   <script src="chrome://resources/js/event_tracker.js"></script>
diff --git a/chrome/browser/resources/help/help.js b/chrome/browser/resources/help/help.js
index a8f61bd..a7cb70e 100644
--- a/chrome/browser/resources/help/help.js
+++ b/chrome/browser/resources/help/help.js
@@ -143,6 +143,8 @@
         };
       }
 
+      cr.ui.FocusManager.disableMouseFocusOnButtons();
+
       // Attempt to update.
       chrome.send('onPageLoaded');
     },
diff --git a/chrome/browser/resources/history/history.html b/chrome/browser/resources/history/history.html
index df5d8ea..6c82921 100644
--- a/chrome/browser/resources/history/history.html
+++ b/chrome/browser/resources/history/history.html
@@ -62,6 +62,12 @@
 <body i18n-values=".style.fontFamily:fontfamily">
 </if>
 
+<if expr="not is_android and not pp_ifdef('ios')">
+<div id="overlay" class="overlay" hidden>
+  <include src="alert_overlay.html">
+</div>
+</if>
+
 <div id="history-page" class="page">
   <header>
     <h1 i18n-content="history"></h1>
@@ -139,11 +145,5 @@
 
 <script src="chrome://history-frame/strings.js"></script>
 <script src="chrome://resources/js/i18n_template2.js"></script>
-
-<if expr="not is_android and not pp_ifdef('ios')">
-<div id="overlay" class="overlay" hidden>
-    <include src="alert_overlay.html">
-</div>
-</if>
 </body>
 </html>
diff --git a/chrome/browser/resources/history/history.js b/chrome/browser/resources/history/history.js
index b6eb19a..637dc78 100644
--- a/chrome/browser/resources/history/history.js
+++ b/chrome/browser/resources/history/history.js
@@ -3,6 +3,7 @@
 // found in the LICENSE file.
 
 <include src="../uber/uber_utils.js">
+<include src="history_focus_manager.js">
 
 ///////////////////////////////////////////////////////////////////////////////
 // Globals:
@@ -1487,6 +1488,7 @@
     cr.ui.overlay.setupOverlay($('overlay'));
     cr.ui.overlay.globalInitialization();
   }
+  HistoryFocusManager.getInstance().initialize();
 
   var doSearch = function(e) {
     recordUmaAction('HistoryPage_Search');
diff --git a/chrome/browser/resources/history/history_focus_manager.js b/chrome/browser/resources/history/history_focus_manager.js
new file mode 100644
index 0000000..540f331
--- /dev/null
+++ b/chrome/browser/resources/history/history_focus_manager.js
@@ -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.
+
+var FocusManager = cr.ui.FocusManager;
+
+/**
+ * A history-specific FocusManager implementation, which ensures that elements
+ * "background" pages (i.e., those in a dialog that is not the topmost overlay)
+ * do not receive focus.
+ * @constructor
+ */
+function HistoryFocusManager() {
+}
+
+cr.addSingletonGetter(HistoryFocusManager);
+
+HistoryFocusManager.prototype = {
+  __proto__: FocusManager.prototype,
+
+  /** @override */
+  getFocusParent: function() {
+    return document.querySelector('#overlay .showing') || $('history-page');
+  },
+};
diff --git a/chrome/browser/resources/inspect/inspect.js b/chrome/browser/resources/inspect/inspect.js
index 6920b3f..860bf67 100644
--- a/chrome/browser/resources/inspect/inspect.js
+++ b/chrome/browser/resources/inspect/inspect.js
@@ -2,15 +2,6 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-function requestData() {
-  var xhr = new XMLHttpRequest();
-  xhr.open('GET', 'targets-data.json', false);
-  xhr.send(null);
-  if (xhr.status === 200)
-    return JSON.parse(xhr.responseText);
-  return [];
-}
-
 function inspect(data) {
   chrome.send('inspect', [data]);
 }
@@ -38,8 +29,9 @@
     tabHeader.addEventListener('click', selectTab.bind(null, tabContent.id));
     $('navigation').appendChild(tabHeader);
   }
-  selectTab('devices-tab');
-  populateLists();
+  var selectedTabName = window.location.hash.slice(1) || 'devices';
+  selectTab(selectedTabName + '-tab');
+  chrome.send('init-ui');
 }
 
 function selectTab(id) {
@@ -58,20 +50,15 @@
   }
 }
 
-function populateLists() {
-  var data = requestData();
-
+function populateLists(data) {
   removeChildren('pages');
   removeChildren('extensions');
   removeChildren('apps');
-  removeChildren('workers');
   removeChildren('others');
 
   for (var i = 0; i < data.length; i++) {
     if (data[i].type === 'page')
       addToPagesList(data[i]);
-    else if (data[i].type === 'worker')
-      addToWorkersList(data[i]);
     else if (data[i].type === 'extension')
       addToExtensionsList(data[i]);
     else if (data[i].type === 'app')
@@ -81,6 +68,13 @@
   }
 }
 
+function populateWorkersList(data) {
+  removeChildren('workers');
+
+  for (var i = 0; i < data.length; i++)
+    addToWorkersList(data[i]);
+}
+
 function populateDeviceLists(pages) {
   var pagesDigest = JSON.stringify(pages);
   if (!pages || pagesDigest == window.pagesDigest)
diff --git a/chrome/browser/resources/sync_setup_overlay.js b/chrome/browser/resources/sync_setup_overlay.js
index ef4f619..80ca474 100644
--- a/chrome/browser/resources/sync_setup_overlay.js
+++ b/chrome/browser/resources/sync_setup_overlay.js
@@ -81,6 +81,9 @@
         chrome.send('SyncSetupStopSyncing');
         self.closeOverlay_();
       };
+      $('sync-configure-content').onclick = function() {
+        self.onConfigurationClicked_();
+      };
     },
 
     showOverlay_: function() {
@@ -110,6 +113,29 @@
       $('sync-custom-passphrase').hidden = !visible;
     },
 
+    onConfigurationClicked_: function() {
+      // Avoid to foucus on labeled checkboxes and radio buttons.
+      // We don't want to show focus rings for them when labels are clicked.
+      if (event.target.tagName == 'INPUT')
+        return;
+      for (var node = event.target; node; node = node.parentNode) {
+        if (node.tagName != 'LABEL')
+          continue;
+        var control = node.control;
+        if (!control || control.disabled)
+          return;
+        if (control.type == 'checkbox') {
+          control.checked = !control.checked;
+          event.preventDefault();
+        } else if (control.type == 'radio') {
+          control.checked = !control.checked;
+          this.onEncryptionRadioChanged_();
+          event.preventDefault();
+        }
+        return;
+      }
+    },
+
     /**
      * Sets the checked state of the individual sync data type checkboxes in the
      * advanced sync settings dialog.
diff --git a/chrome/browser/resources/translate_internals/translate_internals.css b/chrome/browser/resources/translate_internals/translate_internals.css
index 85b2ca3..6952cb5 100644
--- a/chrome/browser/resources/translate_internals/translate_internals.css
+++ b/chrome/browser/resources/translate_internals/translate_internals.css
@@ -41,16 +41,16 @@
   white-space: pre-wrap;
 }
 
-#prefs ul {
+#tabpanel-prefs ul {
   list-style-type: none;
   padding-left: 0;
 }
 
-#prefs ul li {
+#tabpanel-prefs ul li {
   width: 100%;
 }
 
-#prefs ul li button {
+#tabpanel-prefs ul li button {
   background-color: transparent;
   border-style: solid;
   border-width: 1px;
diff --git a/chrome/browser/resources/translate_internals/translate_internals.html b/chrome/browser/resources/translate_internals/translate_internals.html
index 53f1427..dcff99a 100644
--- a/chrome/browser/resources/translate_internals/translate_internals.html
+++ b/chrome/browser/resources/translate_internals/translate_internals.html
@@ -32,25 +32,25 @@
       </tabs>
       <tabpanels>
 
-        <tabpanel id="prefs">
+        <tabpanel id="tabpanel-prefs">
           <div>
             <include src="prefs.html"/>
           </div>
         </tabpanel>
 
-        <tabpanel id="detection-logs">
+        <tabpanel id="tabpanel-detection-logs">
           <div>
             <include src="detection_logs.html"/>
           </div>
         </tabpanel>
 
-        <tabpanel id="error-logs">
+        <tabpanel id="tabpanel-error-logs">
           <div>
             <include src="error_logs.html"/>
           </div>
         </tabpanel>
 
-        <tabpanel id="event-logs">
+        <tabpanel id="tabpanel-event-logs">
           <div>
             <include src="event_logs.html"/>
           </div>
diff --git a/chrome/browser/resources/translate_internals/translate_internals.js b/chrome/browser/resources/translate_internals/translate_internals.js
index a0553a6..2774ff3 100644
--- a/chrome/browser/resources/translate_internals/translate_internals.js
+++ b/chrome/browser/resources/translate_internals/translate_internals.js
@@ -31,6 +31,36 @@
         $('prefs-blocked-languages').hidden = true;
         $('prefs-language-blacklist').querySelector('h2 span').hidden = true;
       }
+
+      var tabpanelNodeList = document.getElementsByTagName('tabpanel');
+      var tabpanels = Array.prototype.slice.call(tabpanelNodeList, 0);
+      var tabpanelIds = tabpanels.map(function(tab) {
+        return tab.id;
+      });
+
+      var tabNodeList = document.getElementsByTagName('tab');
+      var tabs = Array.prototype.slice.call(tabNodeList, 0);
+      tabs.forEach(function(tab) {
+        tab.onclick = function(e) {
+          var tabbox = document.querySelector('tabbox');
+          var tabpanel = tabpanels[tabbox.selectedIndex];
+          var hash = tabpanel.id.match(/(?:^tabpanel-)(.+)/)[1];
+          window.location.hash = hash;
+        };
+      });
+
+      window.onhashchange = function(e) {
+        var hash = window.location.hash;
+
+        // Remove the first character '#'.
+        hash = hash.substring(1);
+
+        var id = 'tabpanel-' + hash;
+        if (tabpanelIds.indexOf(id) == -1)
+          return;
+
+        $(id).selected = true;
+      };
     }
 
     /**
@@ -299,7 +329,8 @@
       contentTD.textContent = '';
       contentTD.appendChild(div);
 
-      var tbody = $('detection-logs').getElementsByTagName('tbody')[0];
+      var tabpanel = $('tabpanel-detection-logs');
+      var tbody = tabpanel.getElementsByTagName('tbody')[0];
       tbody.appendChild(tr);
     }
 
@@ -319,7 +350,8 @@
           details['error'] + ': ' + formatTranslateErrorsType(details['error']),
           'error-logs-error');
 
-      var tbody = $('error-logs').getElementsByTagName('tbody')[0];
+      var tabpanel = $('tabpanel-error-logs');
+      var tbody = tabpanel.getElementsByTagName('tbody')[0];
       tbody.appendChild(tr);
     }
 
diff --git a/chrome/browser/resources/uber/uber_utils.js b/chrome/browser/resources/uber/uber_utils.js
index 763b556..5afc7e0 100644
--- a/chrome/browser/resources/uber/uber_utils.js
+++ b/chrome/browser/resources/uber/uber_utils.js
@@ -22,6 +22,10 @@
     headerElements = document.getElementsByTagName('header');
     document.addEventListener('scroll', handleScroll);
 
+    // Prevent the navigation from being stuck in a disabled state when a
+    // content page is reloaded while an overlay is visible (crbug.com/246939).
+    invokeMethodOnParent('stopInterceptingEvents');
+
     // Trigger the scroll handler to tell the navigation if our page started
     // with some scroll (happens when you use tab restore).
     handleScroll();
diff --git a/chrome/browser/safe_browsing/browser_feature_extractor.cc b/chrome/browser/safe_browsing/browser_feature_extractor.cc
index 6cfb98f..ed8408d 100644
--- a/chrome/browser/safe_browsing/browser_feature_extractor.cc
+++ b/chrome/browser/safe_browsing/browser_feature_extractor.cc
@@ -118,7 +118,7 @@
     if (redirect_chain[i].SchemeIsSecure()) {
       printable_redirect = features::kSecureRedirectValue;
     }
-    AddFeature(base::StringPrintf("%s%s[%"PRIuS"]=%s",
+    AddFeature(base::StringPrintf("%s%s[%" PRIuS "]=%s",
                                   feature_prefix.c_str(),
                                   features::kRedirect,
                                   i,
diff --git a/chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc b/chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc
index dce0cf5..c54c71c 100644
--- a/chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc
+++ b/chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc
@@ -51,7 +51,8 @@
  protected:
   virtual void SetUp() {
     ChromeRenderViewHostTestHarness::SetUp();
-    profile()->CreateHistoryService(true /* delete_file */, false /* no_db */);
+    ASSERT_TRUE(profile()->CreateHistoryService(
+        true /* delete_file */, false /* no_db */));
     service_.reset(new StrictMock<MockClientSideDetectionService>());
     extractor_.reset(
         new BrowserFeatureExtractor(web_contents(), service_.get()));
diff --git a/chrome/browser/safe_browsing/malware_details_unittest.cc b/chrome/browser/safe_browsing/malware_details_unittest.cc
index 3e8ee59..f093426 100644
--- a/chrome/browser/safe_browsing/malware_details_unittest.cc
+++ b/chrome/browser/safe_browsing/malware_details_unittest.cc
@@ -188,7 +188,8 @@
 
   virtual void SetUp() OVERRIDE {
     ChromeRenderViewHostTestHarness::SetUp();
-    profile()->CreateHistoryService(true /* delete_file */, false /* no_db */);
+    ASSERT_TRUE(profile()->CreateHistoryService(
+        true /* delete_file */, false /* no_db */));
   }
 
   virtual void TearDown() OVERRIDE {
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc
index 5ed1bf9..5f4d322 100644
--- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.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 <list>
+
 #include "base/prefs/pref_service.h"
 #include "base/run_loop.h"
 #include "chrome/browser/profiles/profile.h"
diff --git a/chrome/browser/safe_browsing/safe_browsing_database.cc b/chrome/browser/safe_browsing/safe_browsing_database.cc
index f1339b3..9f43ecd 100644
--- a/chrome/browser/safe_browsing/safe_browsing_database.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_database.cc
@@ -12,7 +12,7 @@
 #include "base/message_loop/message_loop.h"
 #include "base/metrics/histogram.h"
 #include "base/metrics/stats_counters.h"
-#include "base/process_util.h"
+#include "base/process/process_metrics.h"
 #include "base/time/time.h"
 #include "chrome/browser/safe_browsing/prefix_set.h"
 #include "chrome/browser/safe_browsing/safe_browsing_store_file.h"
diff --git a/chrome/browser/safe_browsing/safe_browsing_test.cc b/chrome/browser/safe_browsing/safe_browsing_test.cc
index 5d0d488..2333936 100644
--- a/chrome/browser/safe_browsing/safe_browsing_test.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_test.cc
@@ -20,7 +20,6 @@
 #include "base/command_line.h"
 #include "base/environment.h"
 #include "base/path_service.h"
-#include "base/process_util.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_split.h"
 #include "base/strings/stringprintf.h"
diff --git a/chrome/browser/search_engines/template_url_service_unittest.cc b/chrome/browser/search_engines/template_url_service_unittest.cc
index a230386..42cd071 100644
--- a/chrome/browser/search_engines/template_url_service_unittest.cc
+++ b/chrome/browser/search_engines/template_url_service_unittest.cc
@@ -1148,7 +1148,7 @@
 // KEYWORD visits.
 TEST_F(TemplateURLServiceTest, GenerateVisitOnKeyword) {
   test_util_.VerifyLoad();
-  test_util_.profile()->CreateHistoryService(true, false);
+  ASSERT_TRUE(test_util_.profile()->CreateHistoryService(true, false));
 
   // Create a keyword.
   TemplateURL* t_url = AddKeywordWithDate(
diff --git a/chrome/browser/service/service_process_control.cc b/chrome/browser/service/service_process_control.cc
index 7c17a1f..9106178 100644
--- a/chrome/browser/service/service_process_control.cc
+++ b/chrome/browser/service/service_process_control.cc
@@ -8,7 +8,7 @@
 #include "base/bind_helpers.h"
 #include "base/command_line.h"
 #include "base/files/file_path.h"
-#include "base/process_util.h"
+#include "base/process/launch.h"
 #include "base/stl_util.h"
 #include "base/threading/thread.h"
 #include "base/threading/thread_restrictions.h"
diff --git a/chrome/browser/service/service_process_control.h b/chrome/browser/service/service_process_control.h
index 5f79882..901be12 100644
--- a/chrome/browser/service/service_process_control.h
+++ b/chrome/browser/service/service_process_control.h
@@ -15,7 +15,7 @@
 #include "base/id_map.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/memory/singleton.h"
-#include "base/process.h"
+#include "base/process/process.h"
 #include "content/public/browser/notification_observer.h"
 #include "content/public/browser/notification_registrar.h"
 #include "ipc/ipc_channel_proxy.h"
diff --git a/chrome/browser/service/service_process_control_browsertest.cc b/chrome/browser/service/service_process_control_browsertest.cc
index 5922b46..94293f5 100644
--- a/chrome/browser/service/service_process_control_browsertest.cc
+++ b/chrome/browser/service/service_process_control_browsertest.cc
@@ -4,7 +4,9 @@
 
 #include "base/bind.h"
 #include "base/bind_helpers.h"
-#include "base/process_util.h"
+#include "base/process/kill.h"
+#include "base/process/process_handle.h"
+#include "base/process/process_iterator.h"
 #include "base/test/test_timeouts.h"
 #include "chrome/browser/service/service_process_control.h"
 #include "chrome/browser/ui/browser.h"
diff --git a/chrome/browser/sessions/session_restore_browsertest.cc b/chrome/browser/sessions/session_restore_browsertest.cc
index 6154185..ba9fe9d 100644
--- a/chrome/browser/sessions/session_restore_browsertest.cc
+++ b/chrome/browser/sessions/session_restore_browsertest.cc
@@ -4,6 +4,7 @@
 
 #include "base/command_line.h"
 #include "base/files/file_path.h"
+#include "base/process/launch.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/time/time.h"
 #include "chrome/browser/browser_process.h"
diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc
index 536be8e..ffefa81 100644
--- a/chrome/browser/shell_integration_linux.cc
+++ b/chrome/browser/shell_integration_linux.cc
@@ -26,7 +26,8 @@
 #include "base/message_loop/message_loop.h"
 #include "base/path_service.h"
 #include "base/posix/eintr_wrapper.h"
-#include "base/process_util.h"
+#include "base/process/kill.h"
+#include "base/process/launch.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_tokenizer.h"
 #include "base/strings/string_util.h"
diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc
index cd45137..f9868fc 100644
--- a/chrome/browser/ssl/ssl_browser_tests.cc
+++ b/chrome/browser/ssl/ssl_browser_tests.cc
@@ -1292,7 +1292,7 @@
 // - navigate to a bad HTTPS (expect unsafe content and filtered frame), then
 //   back
 // - navigate to HTTP (expect insecure content), then back
-IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestGoodFrameNavigation) {
+IN_PROC_BROWSER_TEST_F(SSLUITest, TestGoodFrameNavigation) {
   ASSERT_TRUE(test_server()->Start());
   ASSERT_TRUE(https_server_.Start());
   ASSERT_TRUE(https_server_expired_.Start());
diff --git a/chrome/browser/storage_monitor/storage_monitor_linux.cc b/chrome/browser/storage_monitor/storage_monitor_linux.cc
index f2154ed..29131c5 100644
--- a/chrome/browser/storage_monitor/storage_monitor_linux.cc
+++ b/chrome/browser/storage_monitor/storage_monitor_linux.cc
@@ -15,8 +15,8 @@
 #include "base/bind.h"
 #include "base/command_line.h"
 #include "base/metrics/histogram.h"
-#include "base/process.h"
-#include "base/process_util.h"
+#include "base/process/kill.h"
+#include "base/process/launch.h"
 #include "base/stl_util.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_util.h"
diff --git a/chrome/browser/sync/test/integration/sync_test.cc b/chrome/browser/sync/test/integration/sync_test.cc
index ff6ed2c..061fcad 100644
--- a/chrome/browser/sync/test/integration/sync_test.cc
+++ b/chrome/browser/sync/test/integration/sync_test.cc
@@ -11,6 +11,7 @@
 #include "base/command_line.h"
 #include "base/message_loop/message_loop.h"
 #include "base/path_service.h"
+#include "base/process/launch.h"
 #include "base/strings/string_util.h"
 #include "base/strings/stringprintf.h"
 #include "base/strings/utf_string_conversions.h"
diff --git a/chrome/browser/sync/test/integration/sync_test.h b/chrome/browser/sync/test/integration/sync_test.h
index 720b4d4..0aae307 100644
--- a/chrome/browser/sync/test/integration/sync_test.h
+++ b/chrome/browser/sync/test/integration/sync_test.h
@@ -12,7 +12,6 @@
 #include "base/compiler_specific.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/memory/scoped_vector.h"
-#include "base/process_util.h"
 #include "chrome/test/base/in_process_browser_test.h"
 #include "net/dns/mock_host_resolver.h"
 #include "sync/internal_api/public/base/model_type.h"
diff --git a/chrome/browser/task_manager/browser_process_resource_provider.h b/chrome/browser/task_manager/browser_process_resource_provider.h
index 3759cc3..81ae797 100644
--- a/chrome/browser/task_manager/browser_process_resource_provider.h
+++ b/chrome/browser/task_manager/browser_process_resource_provider.h
@@ -7,7 +7,6 @@
 
 #include "base/basictypes.h"
 #include "base/compiler_specific.h"
-#include "base/process_util.h"
 #include "chrome/browser/task_manager/resource_provider.h"
 #include "content/public/browser/browser_child_process_observer.h"
 #include "content/public/browser/child_process_data.h"
diff --git a/chrome/browser/task_manager/os_resource_win.h b/chrome/browser/task_manager/os_resource_win.h
index f18000c..f04e59b 100644
--- a/chrome/browser/task_manager/os_resource_win.h
+++ b/chrome/browser/task_manager/os_resource_win.h
@@ -5,7 +5,7 @@
 #ifndef CHROME_BROWSER_TASK_MANAGER_OS_RESOURCE_WIN_H_
 #define CHROME_BROWSER_TASK_MANAGER_OS_RESOURCE_WIN_H_
 
-#include "base/process_util.h"
+#include "base/process/process_handle.h"
 
 namespace task_manager {
 
diff --git a/chrome/browser/task_manager/resource_provider.h b/chrome/browser/task_manager/resource_provider.h
index 243730d..7d32009 100644
--- a/chrome/browser/task_manager/resource_provider.h
+++ b/chrome/browser/task_manager/resource_provider.h
@@ -7,7 +7,7 @@
 
 #include "base/basictypes.h"
 #include "base/memory/ref_counted.h"
-#include "base/process_util.h"
+#include "base/process/process_handle.h"
 #include "base/strings/string16.h"
 #include "third_party/WebKit/public/web/WebCache.h"
 
diff --git a/chrome/browser/task_manager/task_manager.cc b/chrome/browser/task_manager/task_manager.cc
index 3dbbb7f..1a9154a 100644
--- a/chrome/browser/task_manager/task_manager.cc
+++ b/chrome/browser/task_manager/task_manager.cc
@@ -8,7 +8,7 @@
 #include "base/i18n/number_formatting.h"
 #include "base/i18n/rtl.h"
 #include "base/prefs/pref_registry_simple.h"
-#include "base/process_util.h"
+#include "base/process/process_metrics.h"
 #include "base/rand_util.h"
 #include "base/stl_util.h"
 #include "base/strings/string16.h"
diff --git a/chrome/browser/task_manager/task_manager.h b/chrome/browser/task_manager/task_manager.h
index 7554747..80573e1 100644
--- a/chrome/browser/task_manager/task_manager.h
+++ b/chrome/browser/task_manager/task_manager.h
@@ -13,7 +13,6 @@
 #include "base/memory/ref_counted.h"
 #include "base/memory/singleton.h"
 #include "base/observer_list.h"
-#include "base/process_util.h"
 #include "base/strings/string16.h"
 #include "base/timer/timer.h"
 #include "chrome/browser/renderer_host/web_cache_manager.h"
diff --git a/chrome/browser/task_manager/task_manager_unittest.cc b/chrome/browser/task_manager/task_manager_unittest.cc
index 4af9c74..6b1d39c 100644
--- a/chrome/browser/task_manager/task_manager_unittest.cc
+++ b/chrome/browser/task_manager/task_manager_unittest.cc
@@ -7,7 +7,6 @@
 #include <string>
 
 #include "base/message_loop/message_loop.h"
-#include "base/process_util.h"
 #include "base/strings/utf_string_conversions.h"
 #include "chrome/browser/task_manager/resource_provider.h"
 #include "grit/chromium_strings.h"
diff --git a/chrome/browser/task_profiler/task_profiler_data_serializer_unittest.cc b/chrome/browser/task_profiler/task_profiler_data_serializer_unittest.cc
index 6d05fb1..8067b46 100644
--- a/chrome/browser/task_profiler/task_profiler_data_serializer_unittest.cc
+++ b/chrome/browser/task_profiler/task_profiler_data_serializer_unittest.cc
@@ -6,7 +6,7 @@
 
 #include "base/basictypes.h"
 #include "base/json/json_writer.h"
-#include "base/process_util.h"
+#include "base/process/process_handle.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/tracked_objects.h"
 #include "base/values.h"
diff --git a/chrome/browser/three_d_api_observer.cc b/chrome/browser/three_d_api_observer.cc
index f3976bf..5efe5cd 100644
--- a/chrome/browser/three_d_api_observer.cc
+++ b/chrome/browser/three_d_api_observer.cc
@@ -9,18 +9,15 @@
 #include "chrome/browser/infobars/infobar_service.h"
 #include "chrome/browser/tab_contents/tab_util.h"
 #include "content/public/browser/gpu_data_manager.h"
-#include "content/public/browser/web_contents.h"
-#include "content/public/common/three_d_api_types.h"
 #include "grit/generated_resources.h"
 #include "ui/base/l10n/l10n_util.h"
-#include "url/gurl.h"
 
 
-// ThreeDAPIInfoBarDelegate ---------------------------------------------
+// ThreeDAPIInfoBarDelegate ---------------------------------------------------
 
 class ThreeDAPIInfoBarDelegate : public ConfirmInfoBarDelegate {
  public:
-  // Creates a 3D API delegate and adds it to |infobar_service|.
+  // Creates a 3D API infobar delegate and adds it to |infobar_service|.
   static void Create(InfoBarService* infobar_service,
                      const GURL& url,
                      content::ThreeDAPIType requester);
@@ -154,7 +151,7 @@
 }
 
 
-// ThreeDAPIObserver ----------------------------------------------------
+// ThreeDAPIObserver ----------------------------------------------------------
 
 ThreeDAPIObserver::ThreeDAPIObserver() {
   content::GpuDataManager::GetInstance()->AddObserver(this);
diff --git a/chrome/browser/translate/translate_browsertest.cc b/chrome/browser/translate/translate_browsertest.cc
index 440d5c4..10ec0a3 100644
--- a/chrome/browser/translate/translate_browsertest.cc
+++ b/chrome/browser/translate/translate_browsertest.cc
@@ -2,9 +2,6 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef CHROME_BROWSER_TRANSLATE_TRANSLATE_BROWSERTEST_H_
-#define CHROME_BROWSER_TRANSLATE_TRANSLATE_BROWSERTEST_H_
-
 #include "base/files/file_path.h"
 #include "base/strings/string_util.h"
 #include "base/strings/utf_string_conversions.h"
@@ -102,9 +99,9 @@
   infobar.Wait();
 
   // Perform Chrome Translate.
-  InfoBarDelegate* delegate = infobar_service->infobar_at(0);
-  ASSERT_TRUE(delegate);
-  TranslateInfoBarDelegate* translate = delegate->AsTranslateInfoBarDelegate();
+  ASSERT_EQ(1U, infobar_service->infobar_count());
+  TranslateInfoBarDelegate* translate =
+      infobar_service->infobar_at(0)->AsTranslateInfoBarDelegate();
   ASSERT_TRUE(translate);
   translate->Translate();
 
@@ -291,5 +288,3 @@
   // Check there is not infobar.
   EXPECT_EQ(0U, infobar_service->infobar_count());
 }
-
-#endif  // CHROME_BROWSER_TRANSLATE_TRANSLATE_BROWSERTEST_H_
diff --git a/chrome/browser/translate/translate_manager.cc b/chrome/browser/translate/translate_manager.cc
index 70d9210..057084e 100644
--- a/chrome/browser/translate/translate_manager.cc
+++ b/chrome/browser/translate/translate_manager.cc
@@ -84,10 +84,6 @@
 }  // namespace
 
 TranslateManager::~TranslateManager() {
-  // CleanupPendingUrlFetcher should be called ahead of destructing.
-  DCHECK(language_list_.get() == NULL);
-  DCHECK(script_.get() == NULL);
-
   weak_method_factory_.InvalidateWeakPtrs();
 }
 
@@ -638,7 +634,7 @@
     NOTREACHED();
 }
 
-void TranslateManager::CleanupPendingUrlFetcher() {
+void TranslateManager::CleanupPendingUlrFetcher() {
   language_list_.reset();
   script_.reset();
 }
diff --git a/chrome/browser/translate/translate_manager.h b/chrome/browser/translate/translate_manager.h
index da673f7..8355ab1 100644
--- a/chrome/browser/translate/translate_manager.h
+++ b/chrome/browser/translate/translate_manager.h
@@ -92,7 +92,7 @@
 
   // Allows caller to cleanup pending URLFetcher objects to make sure they
   // get released in the appropriate thread... Mainly for tests.
-  void CleanupPendingUrlFetcher();
+  void CleanupPendingUlrFetcher();
 
   // Translates the page contents from |source_lang| to |target_lang|.
   // The actual translation might be performed asynchronously if the translate
diff --git a/chrome/browser/ui/app_list/app_list_service.cc b/chrome/browser/ui/app_list/app_list_service.cc
index 8ae72eb..8120aae 100644
--- a/chrome/browser/ui/app_list/app_list_service.cc
+++ b/chrome/browser/ui/app_list/app_list_service.cc
@@ -7,7 +7,7 @@
 #include "base/command_line.h"
 #include "base/metrics/histogram.h"
 #include "base/prefs/pref_registry_simple.h"
-#include "base/process_info.h"
+#include "base/process/process_info.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/time/time.h"
 #include "chrome/common/chrome_switches.h"
diff --git a/chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controller.cc b/chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controller.cc
index f699b37..11bdcca 100644
--- a/chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controller.cc
+++ b/chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controller.cc
@@ -55,7 +55,10 @@
       BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH);
   for (BrowserList::const_iterator it = ash_browser_list->begin();
        it != ash_browser_list->end(); ++it) {
-    if ((*it)->window()->GetNativeWindow() == window)
+    // During browser creation it is possible that this function is called
+    // before a browser got a window (see crbug.com/263563).
+    if ((*it)->window() &&
+        (*it)->window()->GetNativeWindow() == window)
       return true;
   }
   return false;
diff --git a/chrome/browser/ui/ash/session_state_delegate_chromeos.cc b/chrome/browser/ui/ash/session_state_delegate_chromeos.cc
index faba973..790de57 100644
--- a/chrome/browser/ui/ash/session_state_delegate_chromeos.cc
+++ b/chrome/browser/ui/ash/session_state_delegate_chromeos.cc
@@ -8,6 +8,7 @@
 #include "base/logging.h"
 #include "chrome/browser/chromeos/login/screen_locker.h"
 #include "chrome/browser/chromeos/login/user.h"
+#include "chrome/browser/chromeos/login/user_adding_screen.h"
 #include "chrome/browser/chromeos/login/user_manager.h"
 #include "chromeos/dbus/dbus_thread_manager.h"
 #include "chromeos/dbus/session_manager_client.h"
@@ -54,6 +55,11 @@
   NOTIMPLEMENTED();
 }
 
+bool SessionStateDelegateChromeos::IsUserSessionBlocked() const {
+  return !IsActiveUserSessionStarted() || IsScreenLocked() ||
+         chromeos::UserAddingScreen::Get()->IsRunning();
+}
+
 const base::string16 SessionStateDelegateChromeos::GetUserDisplayName(
     ash::MultiProfileIndex index) const {
   DCHECK_LT(index, NumberOfLoggedInUsers());
diff --git a/chrome/browser/ui/ash/session_state_delegate_chromeos.h b/chrome/browser/ui/ash/session_state_delegate_chromeos.h
index 025713f..4ed4009 100644
--- a/chrome/browser/ui/ash/session_state_delegate_chromeos.h
+++ b/chrome/browser/ui/ash/session_state_delegate_chromeos.h
@@ -30,6 +30,7 @@
   virtual bool IsScreenLocked() const OVERRIDE;
   virtual void LockScreen() OVERRIDE;
   virtual void UnlockScreen() OVERRIDE;
+  virtual bool IsUserSessionBlocked() const OVERRIDE;
   virtual const base::string16 GetUserDisplayName(
       ash::MultiProfileIndex index) const OVERRIDE;
   virtual const std::string GetUserEmail(
diff --git a/chrome/browser/ui/ash/session_state_delegate_views.cc b/chrome/browser/ui/ash/session_state_delegate_views.cc
index d649ff3..a1389ca 100644
--- a/chrome/browser/ui/ash/session_state_delegate_views.cc
+++ b/chrome/browser/ui/ash/session_state_delegate_views.cc
@@ -46,6 +46,10 @@
 void SessionStateDelegate::UnlockScreen() {
 }
 
+bool SessionStateDelegate::IsUserSessionBlocked() const {
+  return false;
+}
+
 const base::string16 SessionStateDelegate::GetUserDisplayName(
     ash::MultiProfileIndex index) const {
   NOTIMPLEMENTED();
diff --git a/chrome/browser/ui/ash/session_state_delegate_views.h b/chrome/browser/ui/ash/session_state_delegate_views.h
index 614b1c2..eae117e 100644
--- a/chrome/browser/ui/ash/session_state_delegate_views.h
+++ b/chrome/browser/ui/ash/session_state_delegate_views.h
@@ -27,6 +27,7 @@
   virtual bool IsScreenLocked() const OVERRIDE;
   virtual void LockScreen() OVERRIDE;
   virtual void UnlockScreen() OVERRIDE;
+  virtual bool IsUserSessionBlocked() const OVERRIDE;
   virtual const base::string16 GetUserDisplayName(
       ash::MultiProfileIndex index) const OVERRIDE;
   virtual const std::string GetUserEmail(
diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
index a5e4030..2fe7f2f 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
@@ -2341,6 +2341,7 @@
       is_submitting_(false),
       choose_another_instrument_or_address_(false),
       wallet_server_validation_recoverable_(true),
+      data_was_passed_back_(false),
       autocheckout_state_(AUTOCHECKOUT_NOT_STARTED),
       was_ui_latency_logged_(false),
       deemphasized_render_view_(false) {
@@ -3213,6 +3214,7 @@
   // Callback should be called as late as possible.
   callback_.Run(&form_structure_, !wallet_items_ ? std::string() :
       wallet_items_->google_transaction_id());
+  data_was_passed_back_ = true;
 
   // This might delete us.
   if (GetDialogType() == DIALOG_TYPE_REQUEST_AUTOCOMPLETE)
@@ -3409,6 +3411,9 @@
 }
 
 void AutofillDialogControllerImpl::MaybeShowCreditCardBubble() {
+  if (!data_was_passed_back_)
+    return;
+
   if (newly_saved_card_) {
     AutofillCreditCardBubbleController::ShowNewCardSavedBubble(
         web_contents(), newly_saved_card_->TypeAndLastFourDigits());
diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.h b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.h
index eadf103..88e7429 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.h
+++ b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.h
@@ -679,6 +679,9 @@
   // recoverable.
   bool wallet_server_validation_recoverable_;
 
+  // Whether |callback_| was Run() with a filled |form_structure_|.
+  bool data_was_passed_back_;
+
   typedef std::map<AutofillFieldType,
       std::pair<base::string16, base::string16> > TypeErrorInputMap;
   typedef std::map<DialogSection, TypeErrorInputMap> WalletValidationErrors;
diff --git a/chrome/browser/ui/bookmarks/bookmark_prompt_controller_unittest.cc b/chrome/browser/ui/bookmarks/bookmark_prompt_controller_unittest.cc
index fa79f1b..169f451 100644
--- a/chrome/browser/ui/bookmarks/bookmark_prompt_controller_unittest.cc
+++ b/chrome/browser/ui/bookmarks/bookmark_prompt_controller_unittest.cc
@@ -65,8 +65,8 @@
     TestingBrowserProcess::GetGlobal()->
         SetBookmarkPromptController(new BookmarkPromptController);
     BrowserWithTestWindowTest::SetUp();
-    static_cast<TestingProfile*>(browser()->profile())->
-        CreateHistoryService(true, false);
+    ASSERT_TRUE(static_cast<TestingProfile*>(browser()->profile())->
+        CreateHistoryService(true, false));
     static_cast<TestingProfile*>(browser()->profile())->
         BlockUntilHistoryIndexIsRefreshed();
     // Simulate browser activation.
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 852fd4d..3020251 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -19,7 +19,7 @@
 #include "base/metrics/histogram.h"
 #include "base/path_service.h"
 #include "base/prefs/pref_service.h"
-#include "base/process_info.h"
+#include "base/process/process_info.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_util.h"
 #include "base/strings/stringprintf.h"
@@ -1194,6 +1194,10 @@
   return unload_controller_->TabsNeedBeforeUnloadFired();
 }
 
+void Browser::OverscrollUpdate(int delta_y) {
+  window_->OverscrollUpdate(delta_y);
+}
+
 bool Browser::IsMouseLocked() const {
   return fullscreen_controller_->IsMouseLocked();
 }
diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h
index a26587d..2093f48 100644
--- a/chrome/browser/ui/browser.h
+++ b/chrome/browser/ui/browser.h
@@ -434,6 +434,7 @@
   virtual void HandleKeyboardEvent(
       content::WebContents* source,
       const content::NativeWebKeyboardEvent& event) OVERRIDE;
+  virtual void OverscrollUpdate(int delta_y) OVERRIDE;
 
   bool is_type_tabbed() const { return type_ == TYPE_TABBED; }
   bool is_type_popup() const { return type_ == TYPE_POPUP; }
diff --git a/chrome/browser/ui/browser_unittest.cc b/chrome/browser/ui/browser_unittest.cc
index 27cb23f..ff86091 100644
--- a/chrome/browser/ui/browser_unittest.cc
+++ b/chrome/browser/ui/browser_unittest.cc
@@ -4,7 +4,6 @@
 
 #include "chrome/browser/ui/browser.h"
 
-#include "base/process_util.h"
 #include "chrome/browser/ui/tabs/tab_strip_model.h"
 #include "chrome/test/base/browser_with_test_window_test.h"
 #include "content/public/browser/site_instance.h"
diff --git a/chrome/browser/ui/browser_window.h b/chrome/browser/ui/browser_window.h
index 6ce54f2..ac21b8f 100644
--- a/chrome/browser/ui/browser_window.h
+++ b/chrome/browser/ui/browser_window.h
@@ -355,6 +355,10 @@
       const content::PasswordForm& form,
       autofill::PasswordGenerator* password_generator) = 0;
 
+  // Invoked when the amount of vertical overscroll changes. |delta_y| is the
+  // amount of overscroll that has occured in the y-direction.
+  virtual void OverscrollUpdate(int delta_y) {}
+
  protected:
   friend void chrome::CloseAllBrowsers();
   friend class BrowserView;
diff --git a/chrome/browser/ui/cocoa/hung_renderer_controller.mm b/chrome/browser/ui/cocoa/hung_renderer_controller.mm
index dc21d44..01b1ef9 100644
--- a/chrome/browser/ui/cocoa/hung_renderer_controller.mm
+++ b/chrome/browser/ui/cocoa/hung_renderer_controller.mm
@@ -8,7 +8,6 @@
 
 #include "base/mac/bundle_locations.h"
 #include "base/mac/mac_util.h"
-#include "base/process_util.h"
 #include "base/strings/sys_string_conversions.h"
 #include "chrome/browser/favicon/favicon_tab_helper.h"
 #include "chrome/browser/ui/browser_dialogs.h"
diff --git a/chrome/browser/ui/extensions/app_metro_infobar_delegate_win.cc b/chrome/browser/ui/extensions/app_metro_infobar_delegate_win.cc
index 79bb302..a08aa86 100644
--- a/chrome/browser/ui/extensions/app_metro_infobar_delegate_win.cc
+++ b/chrome/browser/ui/extensions/app_metro_infobar_delegate_win.cc
@@ -24,11 +24,11 @@
 #include "ui/base/l10n/l10n_util.h"
 #include "win8/util/win8_util.h"
 
-namespace chrome {
-
 // static
 void AppMetroInfoBarDelegateWin::Create(
-    Profile* profile, Mode mode, const std::string& extension_id) {
+    Profile* profile,
+    Mode mode,
+    const std::string& extension_id) {
   DCHECK(win8::IsSingleWindowMetroMode());
   DCHECK_EQ(mode == SHOW_APP_LIST, extension_id.empty());
 
@@ -38,12 +38,9 @@
       profile, chrome::HOST_DESKTOP_TYPE_NATIVE);
 
   // Create a new tab at about:blank, and add the infobar.
-  content::OpenURLParams params(GURL(content::kAboutBlankURL),
-                                content::Referrer(),
-                                NEW_FOREGROUND_TAB,
-                                content::PAGE_TRANSITION_LINK,
-                                false);
-  content::WebContents* web_contents = browser->OpenURL(params);
+  content::WebContents* web_contents = browser->OpenURL(content::OpenURLParams(
+      GURL(content::kAboutBlankURL), content::Referrer(), NEW_FOREGROUND_TAB,
+      content::PAGE_TRANSITION_LINK, false));
   InfoBarService* info_bar_service =
       InfoBarService::FromWebContents(web_contents);
   info_bar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>(
@@ -111,13 +108,10 @@
 
 bool AppMetroInfoBarDelegateWin::LinkClicked(
     WindowOpenDisposition disposition) {
-  content::OpenURLParams params(
+  web_contents()->OpenURL(content::OpenURLParams(
       GURL("https://support.google.com/chrome/?p=ib_redirect_to_desktop"),
       content::Referrer(),
       (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
-      content::PAGE_TRANSITION_LINK, false);
-  web_contents()->OpenURL(params);
+      content::PAGE_TRANSITION_LINK, false));
   return false;
 }
-
-}  // namespace chrome
diff --git a/chrome/browser/ui/extensions/app_metro_infobar_delegate_win.h b/chrome/browser/ui/extensions/app_metro_infobar_delegate_win.h
index 3742f31..1f625f7 100644
--- a/chrome/browser/ui/extensions/app_metro_infobar_delegate_win.h
+++ b/chrome/browser/ui/extensions/app_metro_infobar_delegate_win.h
@@ -5,19 +5,13 @@
 #ifndef CHROME_BROWSER_UI_EXTENSIONS_APP_METRO_INFOBAR_DELEGATE_WIN_H_
 #define CHROME_BROWSER_UI_EXTENSIONS_APP_METRO_INFOBAR_DELEGATE_WIN_H_
 
-#include "base/strings/string16.h"
+#include <string>
+
 #include "chrome/browser/infobars/confirm_infobar_delegate.h"
-#include "chrome/browser/infobars/infobar_service.h"
-#include "ui/base/window_open_disposition.h"
 
+class InfoBarService;
 class Profile;
 
-namespace gfx {
-class Image;
-}
-
-namespace chrome {
-
 // This infobar operates by opening a new tab on about:blank, showing an
 // infobar offering to relaunch the browser in metro mode, and then relaunching
 // in Desktop mode if confirmed.
@@ -28,16 +22,16 @@
     LAUNCH_PACKAGED_APP
   };
 
-  // Creates an instance of the app metro infobar delegate, adds it to a new
-  // browser tab, then activates Metro mode.
+  // Creates an app metro infobar delegate, adds it to a new browser tab, then
+  // activates Metro mode.
   static void Create(Profile* profile,
                      Mode mode,
                      const std::string& extension_id);
 
  private:
-  explicit AppMetroInfoBarDelegateWin(InfoBarService* infobar_service,
-                                      Mode mode,
-                                      const std::string& extension_id);
+  AppMetroInfoBarDelegateWin(InfoBarService* infobar_service,
+                             Mode mode,
+                             const std::string& extension_id);
   virtual ~AppMetroInfoBarDelegateWin();
 
   // ConfirmInfoBarDelegate overrides:
@@ -55,6 +49,4 @@
   DISALLOW_COPY_AND_ASSIGN(AppMetroInfoBarDelegateWin);
 };
 
-}  // namespace chrome
-
 #endif  // CHROME_BROWSER_UI_EXTENSIONS_APP_METRO_INFOBAR_DELEGATE_WIN_H_
diff --git a/chrome/browser/ui/gtk/hung_renderer_dialog_gtk.cc b/chrome/browser/ui/gtk/hung_renderer_dialog_gtk.cc
index c0ea1ac..5f76454 100644
--- a/chrome/browser/ui/gtk/hung_renderer_dialog_gtk.cc
+++ b/chrome/browser/ui/gtk/hung_renderer_dialog_gtk.cc
@@ -6,7 +6,6 @@
 
 #include <gtk/gtk.h>
 
-#include "base/process_util.h"
 #include "base/strings/utf_string_conversions.h"
 #include "chrome/browser/favicon/favicon_tab_helper.h"
 #include "chrome/browser/ui/gtk/gtk_util.h"
diff --git a/chrome/browser/ui/hung_plugin_tab_helper.cc b/chrome/browser/ui/hung_plugin_tab_helper.cc
index 1428d1a..da038fa 100644
--- a/chrome/browser/ui/hung_plugin_tab_helper.cc
+++ b/chrome/browser/ui/hung_plugin_tab_helper.cc
@@ -7,8 +7,7 @@
 #include "base/bind.h"
 #include "base/files/file_path.h"
 #include "base/memory/scoped_ptr.h"
-#include "base/process.h"
-#include "base/process_util.h"
+#include "base/process/process.h"
 #include "base/rand_util.h"
 #include "build/build_config.h"
 #include "chrome/browser/chrome_notification_types.h"
diff --git a/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_kde.cc b/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_kde.cc
index dd329b0..717e9d7 100644
--- a/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_kde.cc
+++ b/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_kde.cc
@@ -10,7 +10,7 @@
 #include "base/logging.h"
 #include "base/nix/mime_util_xdg.h"
 #include "base/nix/xdg_util.h"
-#include "base/process_util.h"
+#include "base/process/launch.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_util.h"
 #include "base/strings/utf_string_conversions.h"
diff --git a/chrome/browser/ui/omnibox/alternate_nav_infobar_delegate.cc b/chrome/browser/ui/omnibox/alternate_nav_infobar_delegate.cc
index 0002aec..ba9fc0a 100644
--- a/chrome/browser/ui/omnibox/alternate_nav_infobar_delegate.cc
+++ b/chrome/browser/ui/omnibox/alternate_nav_infobar_delegate.cc
@@ -11,6 +11,7 @@
 #include "grit/theme_resources.h"
 #include "ui/base/l10n/l10n_util.h"
 
+
 // static
 void AlternateNavInfoBarDelegate::Create(InfoBarService* infobar_service,
                                          const GURL& alternate_nav_url) {
diff --git a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc
index 88dd32e..c110148 100644
--- a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc
+++ b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc
@@ -320,7 +320,6 @@
                                         entry.visit_count,
                                         entry.typed_count, time, false,
                                         history::SOURCE_BROWSED);
-    history_service->SetPageContents(url, UTF8ToUTF16(entry.body));
     if (entry.starred)
       bookmark_utils::AddIfNotBookmarked(bookmark_model, url, string16());
     // Wait at least for the AddPageWithDetails() call to finish.
diff --git a/chrome/browser/ui/sad_tab.h b/chrome/browser/ui/sad_tab.h
index e2932a2..e22b149 100644
--- a/chrome/browser/ui/sad_tab.h
+++ b/chrome/browser/ui/sad_tab.h
@@ -5,7 +5,7 @@
 #ifndef CHROME_BROWSER_UI_SAD_TAB_H_
 #define CHROME_BROWSER_UI_SAD_TAB_H_
 
-#include "base/process_util.h"
+#include "base/process/kill.h"
 #include "chrome/browser/ui/sad_tab_types.h"
 
 namespace content {
diff --git a/chrome/browser/ui/search/instant_ntp.h b/chrome/browser/ui/search/instant_ntp.h
index 0505f25..93870ff 100644
--- a/chrome/browser/ui/search/instant_ntp.h
+++ b/chrome/browser/ui/search/instant_ntp.h
@@ -11,7 +11,6 @@
 #include "base/compiler_specific.h"
 #include "base/gtest_prod_util.h"
 #include "base/memory/scoped_ptr.h"
-#include "base/process_util.h"
 #include "chrome/browser/ui/search/instant_loader.h"
 #include "chrome/browser/ui/search/instant_page.h"
 
diff --git a/chrome/browser/ui/startup/google_api_keys_infobar_delegate.cc b/chrome/browser/ui/startup/google_api_keys_infobar_delegate.cc
index 00ed8ab..42f1d55 100644
--- a/chrome/browser/ui/startup/google_api_keys_infobar_delegate.cc
+++ b/chrome/browser/ui/startup/google_api_keys_infobar_delegate.cc
@@ -11,6 +11,7 @@
 #include "grit/generated_resources.h"
 #include "ui/base/l10n/l10n_util.h"
 
+
 // static
 void GoogleApiKeysInfoBarDelegate::Create(InfoBarService* infobar_service) {
   if (google_apis::HasKeysConfigured())
@@ -42,12 +43,10 @@
 
 bool GoogleApiKeysInfoBarDelegate::LinkClicked(
     WindowOpenDisposition disposition) {
-  web_contents()->OpenURL(
-      content::OpenURLParams(
-          GURL("http://www.chromium.org/developers/how-tos/api-keys"),
-          content::Referrer(),
-          (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
-          content::PAGE_TRANSITION_LINK,
-          false));
+  web_contents()->OpenURL(content::OpenURLParams(
+      GURL("http://www.chromium.org/developers/how-tos/api-keys"),
+      content::Referrer(),
+      (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
+      content::PAGE_TRANSITION_LINK, false));
   return false;
 }
diff --git a/chrome/browser/ui/startup/google_api_keys_infobar_delegate.h b/chrome/browser/ui/startup/google_api_keys_infobar_delegate.h
index 6b01f78..dad3bf5 100644
--- a/chrome/browser/ui/startup/google_api_keys_infobar_delegate.h
+++ b/chrome/browser/ui/startup/google_api_keys_infobar_delegate.h
@@ -15,7 +15,7 @@
 // An infobar that is run with a string and a "Learn More" link.
 class GoogleApiKeysInfoBarDelegate : public ConfirmInfoBarDelegate {
  public:
-  // If Google API keys are missing, creates a missing Google API Keys info bar
+  // If Google API keys are missing, creates a missing Google API Keys infobar
   // delegate and adds it to |infobar_service|.
   static void Create(InfoBarService* infobar_service);
 
diff --git a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
index 1126df4..55b3633 100644
--- a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
@@ -180,8 +180,7 @@
   StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run);
   // This should create a new window, but re-use the profile from |popup|. If
   // it used a NULL or invalid profile, it would crash.
-  launch.OpenURLsInBrowser(popup, false, urls,
-                           chrome::HOST_DESKTOP_TYPE_NATIVE);
+  launch.OpenURLsInBrowser(popup, false, urls, chrome::GetActiveDesktop());
   ASSERT_NE(popup, observer.added_browser_);
   BrowserList::RemoveObserver(&observer);
 }
diff --git a/chrome/browser/ui/sync/one_click_signin_sync_starter.cc b/chrome/browser/ui/sync/one_click_signin_sync_starter.cc
index d5c232a..298f887 100644
--- a/chrome/browser/ui/sync/one_click_signin_sync_starter.cc
+++ b/chrome/browser/ui/sync/one_click_signin_sync_starter.cc
@@ -357,24 +357,10 @@
 }
 
 void OneClickSigninSyncStarter::SigninSuccess() {
-  // Before handing control back to sync setup, update the auth error state of
-  // ProfileSyncService if needed. This is necessary because ProfileSyncService
-  // will normally update its auth error state only after attempting a sync
-  // cycle, and we do not want old auth errors to remain visible on the menu or
-  // the settings page.
-  // TODO(rsimha): We shouldn't have to do this here. PSS must update its auth
-  // state after the backend is inititialized if it waiting_for_auth() is true.
-  ProfileSyncService* profile_sync_service = GetProfileSyncService();
-  if (profile_sync_service &&
-      profile_sync_service->GetAuthError().state() !=
-          GoogleServiceAuthError::NONE) {
-    profile_sync_service->UpdateAuthErrorState(
-        GoogleServiceAuthError::AuthErrorNone());
-  }
-
   switch (start_mode_) {
     case SYNC_WITH_DEFAULT_SETTINGS: {
       // Just kick off the sync machine, no need to configure it first.
+      ProfileSyncService* profile_sync_service = GetProfileSyncService();
       if (profile_sync_service)
         profile_sync_service->SetSyncSetupCompleted();
       FinishProfileSyncServiceSetup();
diff --git a/chrome/browser/ui/sync/profile_signin_confirmation_helper_unittest.cc b/chrome/browser/ui/sync/profile_signin_confirmation_helper_unittest.cc
index e815d38..0fc79ad 100644
--- a/chrome/browser/ui/sync/profile_signin_confirmation_helper_unittest.cc
+++ b/chrome/browser/ui/sync/profile_signin_confirmation_helper_unittest.cc
@@ -138,7 +138,7 @@
     profile_->CreateBookmarkModel(true);
     model_ = BookmarkModelFactory::GetForProfile(profile_.get());
     ui_test_utils::WaitForBookmarkModelToLoad(model_);
-    profile_->CreateHistoryService(true, false);
+    ASSERT_TRUE(profile_->CreateHistoryService(true, false));
     extensions::TestExtensionSystem* system =
         static_cast<extensions::TestExtensionSystem*>(
             extensions::ExtensionSystem::Get(profile_.get()));
diff --git a/chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc b/chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc
index 4f2af32..9339fbe 100644
--- a/chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc
+++ b/chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc
@@ -497,7 +497,7 @@
 
 // Test asynchronous loading of favicon from history service.
 TEST_F(BackFwdMenuModelTest, FaviconLoadTest) {
-  profile()->CreateHistoryService(true, false);
+  ASSERT_TRUE(profile()->CreateHistoryService(true, false));
   profile()->CreateFaviconService();
   Browser::CreateParams native_params(profile(), chrome::GetActiveDesktop());
   scoped_ptr<Browser> browser(
diff --git a/chrome/browser/ui/views/app_list/app_list_controller_win.cc b/chrome/browser/ui/views/app_list/app_list_controller_win.cc
index 6bbb595..6028f1a 100644
--- a/chrome/browser/ui/views/app_list/app_list_controller_win.cc
+++ b/chrome/browser/ui/views/app_list/app_list_controller_win.cc
@@ -513,9 +513,8 @@
   if (win8::IsSingleWindowMetroMode()) {
     // This request came from Windows 8 in desktop mode, but chrome is currently
     // running in Metro mode.
-    chrome::AppMetroInfoBarDelegateWin::Create(
-        requested_profile,
-        chrome::AppMetroInfoBarDelegateWin::SHOW_APP_LIST,
+    AppMetroInfoBarDelegateWin::Create(
+        requested_profile, AppMetroInfoBarDelegateWin::SHOW_APP_LIST,
         std::string());
     return;
   }
diff --git a/chrome/browser/ui/views/autofill/autofill_dialog_views.cc b/chrome/browser/ui/views/autofill/autofill_dialog_views.cc
index 29dda7c..a376e94 100644
--- a/chrome/browser/ui/views/autofill/autofill_dialog_views.cc
+++ b/chrome/browser/ui/views/autofill/autofill_dialog_views.cc
@@ -78,7 +78,10 @@
 const int kNotificationPadding = 14;
 
 // Vertical padding above and below each detail section (in pixels).
-const int kDetailSectionInset = 10;
+const int kDetailSectionVerticalPadding = 10;
+
+// Horizontal padding before each detail section (in pixels).
+const int kDetailSectionIndent = 20;
 
 const int kAutocheckoutStepsAreaPadding = 28;
 const int kAutocheckoutStepInset = 20;
@@ -98,11 +101,10 @@
 // A border color for the legal document view.
 SkColor kSubtleBorderColor = SkColorSetARGB(10, 0, 0, 0);
 
-// The top padding, in pixels, for the suggestions menu dropdown arrows.
-const int kMenuButtonTopOffset = 5;
-
-// The side padding, in pixels, for the suggestions menu dropdown arrows.
-const int kMenuButtonHorizontalPadding = 20;
+// The top and bottom padding, in pixels, for the suggestions menu dropdown
+// arrows.
+const int kMenuButtonTopInset = 3;
+const int kMenuButtonBottomInset = 6;
 
 // The padding around text in the overlay view.
 const int kOverlayTextPadding = 20;
@@ -122,21 +124,6 @@
 typedef ui::MultiAnimation::Part Part;
 typedef ui::MultiAnimation::Parts Parts;
 
-views::Border* CreateLabelAlignmentBorder() {
-  // TODO(estade): this should be made to match the native textfield top
-  // inset. It's hard to get at, so for now it's hard-coded.
-  return views::Border::CreateEmptyBorder(4, 0, 0, 0);
-}
-
-// Returns a label that describes a details section.
-views::Label* CreateDetailsSectionLabel(const string16& text) {
-  views::Label* label = new views::Label(text);
-  label->SetHorizontalAlignment(gfx::ALIGN_RIGHT);
-  label->SetFont(label->font().DeriveFont(0, gfx::Font::BOLD));
-  label->set_border(CreateLabelAlignmentBorder());
-  return label;
-}
-
 // Draws an arrow at the top of |canvas| pointing to |tip_x|.
 void DrawArrow(gfx::Canvas* canvas, int tip_x, const SkColor& color) {
   const int arrow_half_width = kArrowWidth / 2.0f;
@@ -844,31 +831,43 @@
       forward_mouse_events_(false) {
   set_notify_enter_exit_on_child(true);
 
-  views::GridLayout* layout = new views::GridLayout(this);
-  layout->SetInsets(kDetailSectionInset, 0, kDetailSectionInset, 0);
-  SetLayoutManager(layout);
+  set_border(views::Border::CreateEmptyBorder(kDetailSectionVerticalPadding,
+                                              kDetailSectionIndent,
+                                              kDetailSectionVerticalPadding,
+                                              kDetailSectionIndent));
 
+  views::Label* label_view = new views::Label(label);
+  label_view->SetHorizontalAlignment(gfx::ALIGN_LEFT);
+
+  views::View* label_bar = new views::View();
+  views::GridLayout* label_bar_layout = new views::GridLayout(label_bar);
+  label_bar->SetLayoutManager(label_bar_layout);
   const int kColumnSetId = 0;
-  views::ColumnSet* column_set = layout->AddColumnSet(kColumnSetId);
-  // TODO(estade): pull out these constants, and figure out better values
-  // for them.
-  column_set->AddColumn(views::GridLayout::FILL,
-                        views::GridLayout::LEADING,
-                        0,
-                        views::GridLayout::FIXED,
-                        180,
-                        0);
-  column_set->AddPaddingColumn(0, 30);
-  column_set->AddColumn(views::GridLayout::FILL,
-                        views::GridLayout::LEADING,
-                        0,
-                        views::GridLayout::FIXED,
-                        300,
-                        0);
+  views::ColumnSet* columns = label_bar_layout->AddColumnSet(kColumnSetId);
+  // TODO(estade): do something about this '480'.
+  columns->AddColumn(views::GridLayout::LEADING,
+                     views::GridLayout::LEADING,
+                     0,
+                     views::GridLayout::FIXED,
+                     480,
+                     0);
+  columns->AddColumn(views::GridLayout::LEADING,
+                     views::GridLayout::LEADING,
+                     0,
+                     views::GridLayout::USE_PREF,
+                     0,
+                     0);
+  label_bar_layout->StartRow(0, kColumnSetId);
+  label_bar_layout->AddView(label_view);
+  label_bar_layout->AddView(proxy_button);
+  // TODO(estade): Make this the correct color, also sometimes hide the border.
+  label_bar->set_border(
+      views::Border::CreateSolidSidedBorder(0, 0, 1, 0, SK_ColorLTGRAY));
 
-  layout->StartRow(0, kColumnSetId);
-  layout->AddView(CreateDetailsSectionLabel(label));
-  layout->AddView(controls);
+  // TODO(estade): do something about this '7'.
+  SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 7));
+  AddChildView(label_bar);
+  AddChildView(controls);
 }
 
 AutofillDialogViews::SectionContainer::~SectionContainer() {}
@@ -956,7 +955,6 @@
           new DecoratedTextfield(string16(), string16(), autofill_dialog)) {
   // Label and icon.
   label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
-  label_->set_border(CreateLabelAlignmentBorder());
   label_container_->AddChildView(icon_);
   label_container_->AddChildView(label_);
   label_container_->AddChildView(decorated_);
@@ -1725,31 +1723,11 @@
       controller_->LabelForSection(section),
       inputs_container,
       group->suggested_button);
+  DCHECK(group->suggested_button->parent());
   UpdateDetailsGroupState(*group);
 }
 
 views::View* AutofillDialogViews::CreateInputsContainer(DialogSection section) {
-  views::View* inputs_container = new views::View();
-  views::GridLayout* layout = new views::GridLayout(inputs_container);
-  inputs_container->SetLayoutManager(layout);
-
-  int kColumnSetId = 0;
-  views::ColumnSet* column_set = layout->AddColumnSet(kColumnSetId);
-  column_set->AddColumn(views::GridLayout::FILL,
-                        views::GridLayout::LEADING,
-                        1,
-                        views::GridLayout::USE_PREF,
-                        0,
-                        0);
-  // A column for the menu button.
-  column_set->AddColumn(views::GridLayout::CENTER,
-                        views::GridLayout::LEADING,
-                        0,
-                        views::GridLayout::USE_PREF,
-                        0,
-                        0);
-  layout->StartRow(0, kColumnSetId);
-
   // The |info_view| holds |manual_inputs| and |suggested_info|, allowing the
   // dialog to toggle which is shown.
   views::View* info_view = new views::View();
@@ -1761,8 +1739,9 @@
   SuggestionView* suggested_info =
       new SuggestionView(controller_->EditSuggestionText(), this);
   info_view->AddChildView(suggested_info);
-  layout->AddView(info_view);
 
+  // TODO(estade): It might be slightly more OO if this button were created
+  // and listened to by the section container.
   views::ImageButton* menu_button = new views::ImageButton(this);
   ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
   menu_button->SetImage(views::Button::STATE_NORMAL,
@@ -1774,17 +1753,16 @@
   menu_button->SetImage(views::Button::STATE_DISABLED,
       rb.GetImageSkiaNamed(IDR_AUTOFILL_DIALOG_MENU_BUTTON_D));
   menu_button->set_border(views::Border::CreateEmptyBorder(
-      kMenuButtonTopOffset,
-      kMenuButtonHorizontalPadding,
-      0,
-      kMenuButtonHorizontalPadding));
-  layout->AddView(menu_button);
+      kMenuButtonTopInset,
+      kDetailSectionIndent,
+      kMenuButtonBottomInset,
+      0));
 
   DetailsGroup* group = GroupForSection(section);
   group->suggested_button = menu_button;
   group->manual_input = manual_inputs;
   group->suggested_info = suggested_info;
-  return inputs_container;
+  return info_view;
 }
 
 // TODO(estade): we should be using Chrome-style constrained window padding
diff --git a/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc b/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc
index 09951a3..11103c1 100644
--- a/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc
+++ b/chrome/browser/ui/views/find_bar_host_interactive_uitest.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/process_util.h"
 #include "base/strings/string_util.h"
 #include "base/strings/utf_string_conversions.h"
 #include "chrome/browser/chrome_notification_types.h"
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc
index 98f40fc..67491f6 100644
--- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc
+++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc
@@ -264,28 +264,50 @@
 }
 
 bool BrowserNonClientFrameViewAsh::HitTestRect(const gfx::Rect& rect) const {
+  if (!views::View::HitTestRect(rect)) {
+    // |rect| is outside BrowserNonClientFrameViewAsh's bounds.
+    return false;
+  }
   // If the rect is outside the bounds of the client area, claim it.
-  if (NonClientFrameView::HitTestRect(rect))
+  // TODO(tdanderson): Implement View::ConvertRectToTarget().
+  gfx::Point rect_in_client_view_coords_origin(rect.origin());
+  View::ConvertPointToTarget(this, frame()->client_view(),
+      &rect_in_client_view_coords_origin);
+  gfx::Rect rect_in_client_view_coords(
+      rect_in_client_view_coords_origin, rect.size());
+  if (!frame()->client_view()->HitTestRect(rect_in_client_view_coords))
     return true;
 
-  // Otherwise claim it only if it's in a non-tab portion of the tabstrip.
-  if (!browser_view()->tabstrip())
-    return false;
-  gfx::Rect tabstrip_bounds(browser_view()->tabstrip()->bounds());
-  gfx::Point tabstrip_origin(tabstrip_bounds.origin());
-  View::ConvertPointToTarget(frame()->client_view(), this, &tabstrip_origin);
-  tabstrip_bounds.set_origin(tabstrip_origin);
-  if (rect.bottom() > tabstrip_bounds.bottom())
+  // Otherwise, claim |rect| only if it is above the bottom of the tabstrip in
+  // a non-tab portion.
+  TabStrip* tabstrip = browser_view()->tabstrip();
+  if (!tabstrip || !browser_view()->IsTabStripVisible())
     return false;
 
-  // We convert from our parent's coordinates since we assume we fill its bounds
-  // completely. We need to do this since we're not a parent of the tabstrip,
-  // meaning ConvertPointToTarget would otherwise return something bogus.
-  // TODO(tdanderson): Initialize |browser_view_point| using |rect| instead of
-  // its center point once GetEventHandlerForRect() is implemented.
-  gfx::Point browser_view_point(rect.CenterPoint());
-  View::ConvertPointToTarget(parent(), browser_view(), &browser_view_point);
-  return browser_view()->IsPositionInWindowCaption(browser_view_point);
+  gfx::Point rect_in_tabstrip_coords_origin(rect.origin());
+  View::ConvertPointToTarget(this, tabstrip,
+      &rect_in_tabstrip_coords_origin);
+  gfx::Rect rect_in_tabstrip_coords(rect_in_tabstrip_coords_origin,
+      rect.size());
+
+  if (rect_in_tabstrip_coords.bottom() > tabstrip->GetLocalBounds().bottom()) {
+    // |rect| is below the tabstrip.
+    return false;
+  }
+
+  if (tabstrip->HitTestRect(rect_in_tabstrip_coords)) {
+    // Claim |rect| if it is in a non-tab portion of the tabstrip.
+    // TODO(tdanderson): Pass |rect_in_tabstrip_coords| instead of its center
+    // point to TabStrip::IsPositionInWindowCaption() once
+    // GetEventHandlerForRect() is implemented.
+    return tabstrip->IsPositionInWindowCaption(
+        rect_in_tabstrip_coords.CenterPoint());
+  }
+
+  // We claim |rect| because it is above the bottom of the tabstrip, but
+  // not in the tabstrip. In particular, the window controls are right of
+  // the tabstrip.
+  return true;
 }
 
 void BrowserNonClientFrameViewAsh::GetAccessibleState(
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc
index 7e7add1..5093269 100644
--- a/chrome/browser/ui/views/frame/browser_view.cc
+++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -608,17 +608,6 @@
   return *GetThemeProvider()->GetImageSkiaNamed(GetOTRIconResourceID());
 }
 
-bool BrowserView::IsPositionInWindowCaption(const gfx::Point& point) {
-  if (window_switcher_button_) {
-    gfx::Point window_switcher_point(point);
-    views::View::ConvertPointToTarget(this, window_switcher_button_,
-                                      &window_switcher_point);
-    if (window_switcher_button_->HitTestPoint(window_switcher_point))
-      return false;
-  }
-  return GetBrowserViewLayout()->IsPositionInWindowCaption(point);
-}
-
 ///////////////////////////////////////////////////////////////////////////////
 // BrowserView, BrowserWindow implementation:
 
@@ -1791,7 +1780,7 @@
   // overlapping tabs.
   for (int i = 0; i < child_count(); ++i) {
     View* child = child_at(i);
-    if (child != infobar_container_)
+    if (child != infobar_container_ && !child->layer())
       child->Paint(canvas);
   }
 
@@ -2586,6 +2575,9 @@
   bubble->GetWidget()->Show();
 }
 
+void BrowserView::OverscrollUpdate(int delta_y) {
+}
+
 void BrowserView::DoCutCopyPaste(void (content::RenderWidgetHost::*method)(),
 #if defined(OS_WIN)
                                  int windows_msg_id,
diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h
index 6d0c871..798d564 100644
--- a/chrome/browser/ui/views/frame/browser_view.h
+++ b/chrome/browser/ui/views/frame/browser_view.h
@@ -232,10 +232,6 @@
     return browser_->is_type_tabbed();
   }
 
-  // Returns true if the specified point(BrowserView coordinates) is in
-  // in the window caption area of the browser window.
-  bool IsPositionInWindowCaption(const gfx::Point& point);
-
   // See ImmersiveModeController for description.
   ImmersiveModeController* immersive_mode_controller() const {
     return immersive_mode_controller_.get();
@@ -374,6 +370,7 @@
       const gfx::Rect& rect,
       const content::PasswordForm& form,
       autofill::PasswordGenerator* password_generator) OVERRIDE;
+  virtual void OverscrollUpdate(int delta_y) OVERRIDE;
 
   // Overridden from BrowserWindowTesting:
   virtual BookmarkBarView* GetBookmarkBarView() const OVERRIDE;
diff --git a/chrome/browser/ui/views/frame/browser_view_layout.cc b/chrome/browser/ui/views/frame/browser_view_layout.cc
index 0a936d2..46b140a 100644
--- a/chrome/browser/ui/views/frame/browser_view_layout.cc
+++ b/chrome/browser/ui/views/frame/browser_view_layout.cc
@@ -243,20 +243,7 @@
   return bounding_box;
 }
 
-bool BrowserViewLayout::IsPositionInWindowCaption(
-    const gfx::Point& point) {
-  // Tab strip may transiently have no parent between the RemoveChildView() and
-  // AddChildView() caused by reparenting during an immersive mode reveal.
-  // During this window report that the point didn't hit a tab.
-  if (!tab_strip_->parent())
-    return true;
-  gfx::Point tabstrip_point(point);
-  views::View::ConvertPointToTarget(browser_view_, tab_strip_, &tabstrip_point);
-  return tab_strip_->IsPositionInWindowCaption(tabstrip_point);
-}
-
-int BrowserViewLayout::NonClientHitTest(
-    const gfx::Point& point) {
+int BrowserViewLayout::NonClientHitTest(const gfx::Point& point) {
   // Since the TabStrip only renders in some parts of the top of the window,
   // the un-obscured area is considered to be part of the non-client caption
   // area of the window. So we need to treat hit-tests in these regions as
@@ -282,7 +269,7 @@
     // The top few pixels of the TabStrip are a drop-shadow - as we're pretty
     // starved of dragable area, let's give it to window dragging (this also
     // makes sense visually).
-    if (!browser_view_->IsMaximized() &&
+    if (!(browser_view_->IsMaximized() || browser_view_->IsFullscreen()) &&
         (point_in_browser_view_coords.y() <
             (tab_strip_->y() + kTabShadowSize))) {
       // We return HTNOWHERE as this is a signal to our containing
@@ -301,16 +288,27 @@
   if (bv_bounds.Contains(point))
     return HTCLIENT;
 
-  // If the point's y coordinate is above the top of the toolbar, but not in
-  // the tabstrip (per previous checking in this function), then we consider it
-  // in the window caption (e.g. the area to the right of the tabstrip
-  // underneath the window controls). However, note that we DO NOT return
-  // HTCAPTION here, because when the window is maximized the window controls
-  // will fall into this space (since the BrowserView is sized to entire size
-  // of the window at that point), and the HTCAPTION value will cause the
-  // window controls not to work. So we return HTNOWHERE so that the caller
-  // will hit-test the window controls before finally falling back to
-  // HTCAPTION.
+  // If the point is within the bounds of the window switcher button, the point
+  // is considered to be within the client area.
+  views::View* window_switcher_button = delegate_->GetWindowSwitcherButton();
+  if (window_switcher_button && window_switcher_button->visible()) {
+    gfx::Point window_switcher_point(point_in_browser_view_coords);
+    views::View::ConvertPointToTarget(browser_view_, window_switcher_button,
+                                      &window_switcher_point);
+    if (window_switcher_button->HitTestPoint(window_switcher_point))
+      return HTCLIENT;
+  }
+
+  // If the point's y coordinate is above the top of the toolbar, but neither
+  // over the tabstrip nor over the window switcher button (per previous
+  // checking in this function), then we consider it in the window caption
+  // (e.g. the area to the right of the tabstrip underneath the window
+  // controls). However, note that we DO NOT return HTCAPTION here, because
+  // when the window is maximized the window controls will fall into this
+  // space (since the BrowserView is sized to entire size of the window at that
+  // point), and the HTCAPTION value will cause the window controls not to work.
+  // So we return HTNOWHERE so that the caller will hit-test the window controls
+  // before finally falling back to HTCAPTION.
   bv_bounds = browser_view_->bounds();
   bv_bounds.set_height(toolbar_->y());
   if (bv_bounds.Contains(point))
diff --git a/chrome/browser/ui/views/frame/browser_view_layout.h b/chrome/browser/ui/views/frame/browser_view_layout.h
index dd64a40..4019802 100644
--- a/chrome/browser/ui/views/frame/browser_view_layout.h
+++ b/chrome/browser/ui/views/frame/browser_view_layout.h
@@ -76,10 +76,6 @@
   // Returns the bounding box, in widget coordinates,  for the find bar.
   gfx::Rect GetFindBarBoundingBox() const;
 
-  // Returns true if the specified point(BrowserView coordinates) is in
-  // in the window caption area of the browser window.
-  bool IsPositionInWindowCaption(const gfx::Point& point);
-
   // Tests to see if the specified |point| (in nonclient view's coordinates)
   // is within the views managed by the laymanager. Returns one of
   // HitTestCompat enum defined in ui/base/hit_test.h.
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
index 3e0547b..e43a517 100644
--- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
+++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
@@ -438,29 +438,67 @@
 }
 
 bool OpaqueBrowserFrameView::HitTestRect(const gfx::Rect& rect) const {
-  // If |rect| does not intersect the bounds of the client area, claim it.
-  bool in_nonclient = NonClientFrameView::HitTestRect(rect);
-  if (in_nonclient)
-    return in_nonclient;
-
-  // Otherwise claim it only if it's in a non-tab portion of the tabstrip.
-  if (!browser_view()->tabstrip())
+  if (!views::View::HitTestRect(rect)) {
+    // |rect| is outside OpaqueBrowserFrameView's bounds.
     return false;
-  gfx::Rect tabstrip_bounds(browser_view()->tabstrip()->bounds());
-  gfx::Point tabstrip_origin(tabstrip_bounds.origin());
-  View::ConvertPointToTarget(frame()->client_view(), this, &tabstrip_origin);
-  tabstrip_bounds.set_origin(tabstrip_origin);
-  if (rect.bottom() > tabstrip_bounds.bottom())
+  }
+
+  // If the rect is outside the bounds of the client area, claim it.
+  // TODO(tdanderson): Implement View::ConvertRectToTarget().
+  gfx::Point rect_in_client_view_coords_origin(rect.origin());
+  View::ConvertPointToTarget(this, frame()->client_view(),
+      &rect_in_client_view_coords_origin);
+  gfx::Rect rect_in_client_view_coords(
+      rect_in_client_view_coords_origin, rect.size());
+  if (!frame()->client_view()->HitTestRect(rect_in_client_view_coords))
+    return true;
+
+  // Otherwise, claim |rect| only if it is above the bottom of the tabstrip in
+  // a non-tab portion.
+  TabStrip* tabstrip = browser_view()->tabstrip();
+  if (!tabstrip || !browser_view()->IsTabStripVisible())
     return false;
 
-  // We convert from our parent's coordinates since we assume we fill its bounds
-  // completely. We need to do this since we're not a parent of the tabstrip,
-  // meaning ConvertPointToTarget would otherwise return something bogus.
-  // TODO(tdanderson): Initialize |browser_view_point| using |rect| instead of
-  // its center point once GetEventHandlerForRect() is implemented.
-  gfx::Point browser_view_point(rect.CenterPoint());
-  View::ConvertPointToTarget(parent(), browser_view(), &browser_view_point);
-  return browser_view()->IsPositionInWindowCaption(browser_view_point);
+  gfx::Point rect_in_tabstrip_coords_origin(rect.origin());
+  View::ConvertPointToTarget(this, tabstrip,
+      &rect_in_tabstrip_coords_origin);
+  gfx::Rect rect_in_tabstrip_coords(
+      rect_in_tabstrip_coords_origin, rect.size());
+
+  if (rect_in_tabstrip_coords.bottom() > tabstrip->GetLocalBounds().bottom()) {
+    // |rect| is below the tabstrip.
+    return false;
+  }
+
+  if (tabstrip->HitTestRect(rect_in_tabstrip_coords)) {
+    // Claim |rect| if it is in a non-tab portion of the tabstrip.
+    // TODO(tdanderson): Pass |rect_in_tabstrip_coords| instead of its center
+    // point to TabStrip::IsPositionInWindowCaption() once
+    // GetEventHandlerForRect() is implemented.
+    return tabstrip->IsPositionInWindowCaption(
+        rect_in_tabstrip_coords.CenterPoint());
+  }
+
+  // The window switcher button is to the right of the tabstrip but is
+  // part of the client view.
+  views::View* window_switcher_button =
+      browser_view()->window_switcher_button();
+  if (window_switcher_button && window_switcher_button->visible()) {
+    gfx::Point rect_in_window_switcher_coords_origin(rect.origin());
+    View::ConvertPointToTarget(this, window_switcher_button,
+        &rect_in_window_switcher_coords_origin);
+    gfx::Rect rect_in_window_switcher_coords(
+        rect_in_window_switcher_coords_origin, rect.size());
+
+    if (window_switcher_button->HitTestRect(rect_in_window_switcher_coords))
+      return false;
+  }
+
+  // We claim |rect| because it is above the bottom of the tabstrip, but
+  // neither in the tabstrip nor in the window switcher button. In particular,
+  // the avatar label/button is left of the tabstrip and the window controls
+  // are right of the tabstrip.
+  return true;
 }
 
 void OpaqueBrowserFrameView::GetAccessibleState(
diff --git a/chrome/browser/ui/views/hung_renderer_view.cc b/chrome/browser/ui/views/hung_renderer_view.cc
index 665064b..7f86a71 100644
--- a/chrome/browser/ui/views/hung_renderer_view.cc
+++ b/chrome/browser/ui/views/hung_renderer_view.cc
@@ -10,7 +10,6 @@
 
 #include "base/i18n/rtl.h"
 #include "base/memory/scoped_vector.h"
-#include "base/process_util.h"
 #include "base/strings/utf_string_conversions.h"
 #include "chrome/browser/favicon/favicon_tab_helper.h"
 #include "chrome/browser/platform_util.h"
diff --git a/chrome/browser/ui/views/message_center/web_notification_tray.cc b/chrome/browser/ui/views/message_center/web_notification_tray.cc
index 655bb3a..5f25c9d 100644
--- a/chrome/browser/ui/views/message_center/web_notification_tray.cc
+++ b/chrome/browser/ui/views/message_center/web_notification_tray.cc
@@ -137,7 +137,7 @@
 
 bool WebNotificationTray::ShowPopups() {
   popup_collection_.reset(new message_center::MessagePopupCollection(
-      NULL, message_center(), message_center_tray_.get()));
+      NULL, message_center(), message_center_tray_.get(), false));
   return true;
 }
 
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
index 0a5c54f..12d34bb 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
@@ -600,15 +600,7 @@
 #if defined(OS_CHROMEOS)
   return ime_candidate_window_open_;
 #else
-  // We need const_cast here because there is no const version of
-  // View::GetInputMethod().  It's because Widget::GetInputMethod(), called from
-  // View::GetInputMethod(), creates a new views::InputMethod at the first-time
-  // call.  Except for this point, none of this method, View::GetInputMethod()
-  // or Widget::GetInputMethod() modifies the state of their instances.
-  // TODO(yukishiino): Make {View,Widget}::GetInputMethod() const and make the
-  // underlying input method object mutable.
-  const views::InputMethod* input_method =
-      const_cast<OmniboxViewViews*>(this)->GetInputMethod();
+  const views::InputMethod* input_method = this->GetInputMethod();
   return input_method && input_method->IsCandidatePopupOpen();
 #endif
 }
diff --git a/chrome/browser/ui/views/tabs/tab_renderer_data.h b/chrome/browser/ui/views/tabs/tab_renderer_data.h
index ddfe4dd..b06fea8 100644
--- a/chrome/browser/ui/views/tabs/tab_renderer_data.h
+++ b/chrome/browser/ui/views/tabs/tab_renderer_data.h
@@ -5,7 +5,7 @@
 #ifndef CHROME_BROWSER_UI_VIEWS_TABS_TAB_RENDERER_DATA_H_
 #define CHROME_BROWSER_UI_VIEWS_TABS_TAB_RENDERER_DATA_H_
 
-#include "base/process_util.h"
+#include "base/process/kill.h"
 #include "base/strings/string16.h"
 #include "chrome/browser/ui/views/chrome_views_export.h"
 #include "ui/gfx/image/image_skia.h"
diff --git a/chrome/browser/ui/views/uninstall_view.cc b/chrome/browser/ui/views/uninstall_view.cc
index 9285109..d483098 100644
--- a/chrome/browser/ui/views/uninstall_view.cc
+++ b/chrome/browser/ui/views/uninstall_view.cc
@@ -5,7 +5,7 @@
 #include "chrome/browser/ui/views/uninstall_view.h"
 
 #include "base/message_loop/message_loop.h"
-#include "base/process_util.h"
+#include "base/process/launch.h"
 #include "base/run_loop.h"
 #include "chrome/browser/browser_process.h"
 #include "chrome/browser/shell_integration.h"
diff --git a/chrome/browser/ui/website_settings/website_settings_unittest.cc b/chrome/browser/ui/website_settings/website_settings_unittest.cc
index f599c9d..ab5cba0 100644
--- a/chrome/browser/ui/website_settings/website_settings_unittest.cc
+++ b/chrome/browser/ui/website_settings/website_settings_unittest.cc
@@ -389,7 +389,7 @@
   website_settings()->OnSitePermissionChanged(
       CONTENT_SETTINGS_TYPE_GEOLOCATION, CONTENT_SETTING_ALLOW);
   website_settings()->OnUIClosing();
-  EXPECT_EQ(1u, infobar_service()->infobar_count());
+  ASSERT_EQ(1u, infobar_service()->infobar_count());
 
   // Removing an |InfoBarDelegate| from the |InfoBarService| does not delete
   // it. Hence the |delegate| must be cleaned up after it was removed from the
diff --git a/chrome/browser/ui/webui/chromeos/choose_mobile_network_ui.cc b/chrome/browser/ui/webui/chromeos/choose_mobile_network_ui.cc
index ab318e1..c5123cb 100644
--- a/chrome/browser/ui/webui/chromeos/choose_mobile_network_ui.cc
+++ b/chrome/browser/ui/webui/chromeos/choose_mobile_network_ui.cc
@@ -9,19 +9,25 @@
 
 #include "base/bind.h"
 #include "base/bind_helpers.h"
+#include "base/location.h"
 #include "base/logging.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_piece.h"
 #include "base/values.h"
-#include "chrome/browser/chromeos/cros/network_library.h"
 #include "chrome/browser/profiles/profile.h"
 #include "chrome/common/url_constants.h"
+#include "chromeos/network/device_state.h"
+#include "chromeos/network/network_device_handler.h"
+#include "chromeos/network/network_event_log.h"
+#include "chromeos/network/network_state_handler.h"
+#include "chromeos/network/network_state_handler_observer.h"
 #include "content/public/browser/web_contents.h"
 #include "content/public/browser/web_ui.h"
 #include "content/public/browser/web_ui_data_source.h"
 #include "content/public/browser/web_ui_message_handler.h"
 #include "grit/browser_resources.h"
 #include "grit/generated_resources.h"
+#include "third_party/cros_system_api/dbus/service_constants.h"
 #include "ui/base/l10n/l10n_util.h"
 #include "ui/base/resource/resource_bundle.h"
 
@@ -68,9 +74,24 @@
   return source;
 }
 
+chromeos::NetworkDeviceHandler* GetNetworkDeviceHandler() {
+  return chromeos::NetworkHandler::Get()->network_device_handler();
+}
+
+chromeos::NetworkStateHandler* GetNetworkStateHandler() {
+  return chromeos::NetworkHandler::Get()->network_state_handler();
+}
+
+void NetworkOperationErrorCallback(
+    const std::string& operation_name,
+    const std::string& error_name,
+    scoped_ptr<base::DictionaryValue> error_data) {
+  NET_LOG_ERROR("Operation failed: " + error_name, operation_name);
+}
+
 class ChooseMobileNetworkHandler
     : public WebUIMessageHandler,
-      public NetworkLibrary::NetworkDeviceObserver {
+      public NetworkStateHandlerObserver {
  public:
   ChooseMobileNetworkHandler();
   virtual ~ChooseMobileNetworkHandler();
@@ -78,9 +99,8 @@
   // WebUIMessageHandler implementation.
   virtual void RegisterMessages() OVERRIDE;
 
-  // NetworkDeviceObserver implementation.
-  virtual void OnNetworkDeviceFoundNetworks(
-      NetworkLibrary* cros, const NetworkDevice* device) OVERRIDE;
+  // NetworkStateHandlerObserver implementation.
+  virtual void DeviceListChanged() OVERRIDE;
 
  private:
   // Handlers for JS WebUI messages.
@@ -99,20 +119,27 @@
 // ChooseMobileNetworkHandler implementation.
 
 ChooseMobileNetworkHandler::ChooseMobileNetworkHandler()
-    : is_page_ready_(false), has_pending_results_(false) {
-  NetworkLibrary* cros = NetworkLibrary::Get();
-  if (const NetworkDevice* cellular = cros->FindCellularDevice()) {
-    device_path_ = cellular->device_path();
-    cros->AddNetworkDeviceObserver(device_path_, this);
+    : is_page_ready_(false),
+      has_pending_results_(false) {
+  NetworkStateHandler* handler = GetNetworkStateHandler();
+  const DeviceState* cellular = handler->GetDeviceStateByType(
+      flimflam::kTypeCellular);
+  if (!cellular) {
+    NET_LOG_ERROR(
+        "A cellular device is not available.",
+        "Cannot initiate a cellular network scan without a cellular device.");
+    return;
   }
-  cros->RequestCellularScan();
+  handler->AddObserver(this, FROM_HERE);
+  device_path_ = cellular->path();
+  GetNetworkDeviceHandler()->ProposeScan(
+      device_path_,
+      base::Bind(&base::DoNothing),
+      base::Bind(&NetworkOperationErrorCallback, "ProposeScan"));
 }
 
 ChooseMobileNetworkHandler::~ChooseMobileNetworkHandler() {
-  if (!device_path_.empty()) {
-    NetworkLibrary* cros = NetworkLibrary::Get();
-    cros->RemoveNetworkDeviceObserver(device_path_, this);
-  }
+  GetNetworkStateHandler()->RemoveObserver(this, FROM_HERE);
 }
 
 void ChooseMobileNetworkHandler::RegisterMessages() {
@@ -130,14 +157,20 @@
                  base::Unretained(this)));
 }
 
-void ChooseMobileNetworkHandler::OnNetworkDeviceFoundNetworks(
-    NetworkLibrary* cros,
-    const NetworkDevice* device) {
+void ChooseMobileNetworkHandler::DeviceListChanged() {
+  const DeviceState* cellular = GetNetworkStateHandler()->GetDeviceState(
+      device_path_);
   networks_list_.Clear();
+  if (!cellular) {
+    LOG(WARNING) << "Cellular device with path '" << device_path_
+                 << "' disappeared.";
+    return;
+  }
+  const DeviceState::CellularScanResults& scan_results =
+      cellular->scan_results();
   std::set<std::string> network_ids;
-  const CellularNetworkList& found_networks = device->found_cellular_networks();
-  for (CellularNetworkList::const_iterator it = found_networks.begin();
-       it != found_networks.end(); ++it) {
+  for (DeviceState::CellularScanResults::const_iterator it =
+      scan_results.begin(); it != scan_results.end(); ++it) {
     // We need to remove duplicates from the list because same network with
     // different technologies are listed multiple times. But ModemManager
     // Register API doesn't allow technology to be specified so just show unique
@@ -173,8 +206,12 @@
   }
 
   // Switch to automatic mode.
-  NetworkLibrary* cros = NetworkLibrary::Get();
-  cros->RequestCellularRegister(std::string());
+  GetNetworkDeviceHandler()->RegisterCellularNetwork(
+      device_path_,
+      "",  // An empty string is for registration with the home network.
+      base::Bind(&base::DoNothing),
+      base::Bind(&NetworkOperationErrorCallback,
+                 "Register in automatic mode."));
 }
 
 void ChooseMobileNetworkHandler::HandleConnect(const ListValue* args) {
@@ -186,8 +223,12 @@
     return;
   }
 
-  NetworkLibrary* cros = NetworkLibrary::Get();
-  cros->RequestCellularRegister(network_id);
+  GetNetworkDeviceHandler()->RegisterCellularNetwork(
+      device_path_,
+      network_id,
+      base::Bind(&base::DoNothing),
+      base::Bind(&NetworkOperationErrorCallback,
+                 std::string("Register to network: ") + network_id));
 }
 
 void ChooseMobileNetworkHandler::HandlePageReady(const ListValue* args) {
diff --git a/chrome/browser/ui/webui/inspect_ui.cc b/chrome/browser/ui/webui/inspect_ui.cc
index f078123..fd30b85 100644
--- a/chrome/browser/ui/webui/inspect_ui.cc
+++ b/chrome/browser/ui/webui/inspect_ui.cc
@@ -69,6 +69,7 @@
 static const char kWorkerTargetType[]  = "worker";
 static const char kAdbTargetType[]  = "adb_page";
 
+static const char kInitUICommand[]  = "init-ui";
 static const char kInspectCommand[]  = "inspect";
 static const char kTerminateCommand[]  = "terminate";
 
@@ -159,66 +160,17 @@
                                rvh->GetRoutingID());
 }
 
-// Appends the inspectable workers to the list of RenderViews, and sends the
-// response back to the webui system.
-void SendDescriptors(
-    ListValue* rvh_list,
-    const content::WebUIDataSource::GotDataCallback& callback) {
-  std::vector<WorkerService::WorkerInfo> worker_info =
-      WorkerService::GetInstance()->GetWorkers();
-  for (size_t i = 0; i < worker_info.size(); ++i) {
-    rvh_list->Append(BuildTargetDescriptor(
-        kWorkerTargetType,
-        false,
-        worker_info[i].url,
-        UTF16ToUTF8(worker_info[i].name),
-        GURL(),
-        worker_info[i].process_id,
-        worker_info[i].route_id,
-        worker_info[i].handle));
-  }
-
-  std::string json_string;
-  base::JSONWriter::Write(rvh_list, &json_string);
-  callback.Run(base::RefCountedString::TakeString(&json_string));
-}
-
-bool HandleDataRequestCallback(
-    const std::string& path,
-    const content::WebUIDataSource::GotDataCallback& callback) {
-  std::set<RenderViewHost*> tab_rvhs;
-  for (TabContentsIterator it; !it.done(); it.Next())
-    tab_rvhs.insert(it->GetRenderViewHost());
-
-  scoped_ptr<ListValue> rvh_list(new ListValue());
-
-  std::vector<RenderViewHost*> rvh_vector =
-      DevToolsAgentHost::GetValidRenderViewHosts();
-
-  for (std::vector<RenderViewHost*>::iterator it(rvh_vector.begin());
-       it != rvh_vector.end(); it++) {
-    bool is_tab = tab_rvhs.find(*it) != tab_rvhs.end();
-    rvh_list->Append(BuildTargetDescriptor(*it, is_tab));
-  }
-
-  BrowserThread::PostTask(
-      BrowserThread::IO,
-      FROM_HERE,
-      base::Bind(&SendDescriptors, base::Owned(rvh_list.release()), callback));
-  return true;
-}
-
 class InspectMessageHandler : public WebUIMessageHandler {
  public:
-  explicit InspectMessageHandler(DevToolsAdbBridge* adb_bridge)
-      : adb_bridge_(adb_bridge) {}
+  explicit InspectMessageHandler(InspectUI* inspect_ui)
+      : inspect_ui_(inspect_ui) {}
   virtual ~InspectMessageHandler() {}
 
  private:
   // WebUIMessageHandler implementation.
   virtual void RegisterMessages() OVERRIDE;
 
-  // Callback for "openDevTools" message.
+  void HandleInitUICommand(const ListValue* args);
   void HandleInspectCommand(const ListValue* args);
   void HandleTerminateCommand(const ListValue* args);
 
@@ -226,12 +178,15 @@
                             int* process_id,
                             int* route_id);
 
-  DevToolsAdbBridge* adb_bridge_;
+  InspectUI* inspect_ui_;
 
   DISALLOW_COPY_AND_ASSIGN(InspectMessageHandler);
 };
 
 void InspectMessageHandler::RegisterMessages() {
+  web_ui()->RegisterMessageCallback(kInitUICommand,
+      base::Bind(&InspectMessageHandler::HandleInitUICommand,
+                 base::Unretained(this)));
   web_ui()->RegisterMessageCallback(kInspectCommand,
       base::Bind(&InspectMessageHandler::HandleInspectCommand,
                  base::Unretained(this)));
@@ -240,7 +195,15 @@
                  base::Unretained(this)));
 }
 
+void InspectMessageHandler::HandleInitUICommand(const ListValue*) {
+  inspect_ui_->InitUI();
+}
+
 void InspectMessageHandler::HandleInspectCommand(const ListValue* args) {
+  Profile* profile = Profile::FromWebUI(web_ui());
+  if (!profile)
+    return;
+
   int process_id;
   int route_id;
   if (!GetProcessAndRouteId(args, &process_id, &route_id) || process_id == 0
@@ -256,7 +219,9 @@
         data->GetString(kAdbSocketField, &socket) &&
         data->GetString(kAdbDebugUrlField, &debug_url) &&
         data->GetString(kAdbFrontendUrlField, &frontend_url)) {
-      adb_bridge_->Attach(serial, socket, debug_url, frontend_url);
+      scoped_refptr<DevToolsAdbBridge> adb_bridge =
+          DevToolsAdbBridge::Factory::GetForProfile(profile);
+      adb_bridge->Attach(serial, socket, debug_url, frontend_url);
     }
     return;
   }
@@ -267,9 +232,6 @@
     return;
   }
 
-  Profile* profile = Profile::FromWebUI(web_ui());
-  if (!profile)
-    return;
   scoped_refptr<DevToolsAgentHost> agent_host(
       DevToolsAgentHost::GetForWorker(process_id, route_id));
   if (!agent_host.get())
@@ -332,6 +294,13 @@
                    this));
   }
 
+  void InitUI() {
+    BrowserThread::PostTask(
+        BrowserThread::IO, FROM_HERE,
+        base::Bind(&WorkerCreationDestructionListener::CollectWorkersData,
+                   this));
+  }
+
  private:
   friend class base::RefCountedThreadSafe<WorkerCreationDestructionListener>;
   virtual ~WorkerCreationDestructionListener() {}
@@ -341,22 +310,34 @@
       const string16& name,
       int process_id,
       int route_id) OVERRIDE {
-    BrowserThread::PostTask(
-        BrowserThread::UI, FROM_HERE,
-        base::Bind(&WorkerCreationDestructionListener::NotifyItemsChanged,
-                   this));
+    CollectWorkersData();
   }
 
   virtual void WorkerDestroyed(int process_id, int route_id) OVERRIDE {
-    BrowserThread::PostTask(
-        BrowserThread::UI, FROM_HERE,
-        base::Bind(&WorkerCreationDestructionListener::NotifyItemsChanged,
-                   this));
+    CollectWorkersData();
   }
 
-  void NotifyItemsChanged() {
-    if (discovery_ui_)
-      discovery_ui_->RefreshUI();
+  void CollectWorkersData() {
+    DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+    scoped_ptr<ListValue> target_list(new ListValue());
+    std::vector<WorkerService::WorkerInfo> worker_info =
+        WorkerService::GetInstance()->GetWorkers();
+    for (size_t i = 0; i < worker_info.size(); ++i) {
+      target_list->Append(BuildTargetDescriptor(
+          kWorkerTargetType,
+          false,
+          worker_info[i].url,
+          UTF16ToUTF8(worker_info[i].name),
+          GURL(),
+          worker_info[i].process_id,
+          worker_info[i].route_id,
+          worker_info[i].handle));
+    }
+
+    BrowserThread::PostTask(
+        BrowserThread::UI, FROM_HERE,
+        base::Bind(&WorkerCreationDestructionListener::PopulateWorkersList,
+                   this, base::Owned(target_list.release())));
   }
 
   void RegisterObserver() {
@@ -367,19 +348,68 @@
     WorkerService::GetInstance()->RemoveObserver(this);
   }
 
+  void PopulateWorkersList(ListValue* target_list) {
+    DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+    if (discovery_ui_) {
+      discovery_ui_->web_ui()->CallJavascriptFunction(
+          "populateWorkersList", *target_list);
+    }
+  }
+
   InspectUI* discovery_ui_;
 };
 
 InspectUI::InspectUI(content::WebUI* web_ui)
-    : WebUIController(web_ui),
-      observer_(new WorkerCreationDestructionListener()),
-      weak_factory_(this) {
-  observer_->Init(this);
+    : WebUIController(web_ui) {
+  web_ui->AddMessageHandler(new InspectMessageHandler(this));
   Profile* profile = Profile::FromWebUI(web_ui);
+  content::WebUIDataSource::Add(profile, CreateInspectUIHTMLSource());
+}
+
+InspectUI::~InspectUI() {
+  StopListeningNotifications();
+}
+
+void InspectUI::InitUI() {
+  StartListeningNotifications();
+  PopulateLists();
+  observer_->InitUI();
+}
+
+void InspectUI::PopulateLists() {
+  std::set<RenderViewHost*> tab_rvhs;
+  for (TabContentsIterator it; !it.done(); it.Next())
+    tab_rvhs.insert(it->GetRenderViewHost());
+
+  scoped_ptr<ListValue> target_list(new ListValue());
+
+  std::vector<RenderViewHost*> rvh_vector =
+      DevToolsAgentHost::GetValidRenderViewHosts();
+
+  for (std::vector<RenderViewHost*>::iterator it(rvh_vector.begin());
+       it != rvh_vector.end(); it++) {
+    bool is_tab = tab_rvhs.find(*it) != tab_rvhs.end();
+    target_list->Append(BuildTargetDescriptor(*it, is_tab));
+  }
+  web_ui()->CallJavascriptFunction("populateLists", *target_list.get());
+}
+
+void InspectUI::Observe(int type,
+    const content::NotificationSource& source,
+    const content::NotificationDetails& details) {
+  if (source != content::Source<WebContents>(web_ui()->GetWebContents()))
+    PopulateLists();
+  else if (type == content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED)
+    StopListeningNotifications();
+}
+
+void InspectUI::StartListeningNotifications() {
+  observer_ = new WorkerCreationDestructionListener();
+  observer_->Init(this);
+
+  Profile* profile = Profile::FromWebUI(web_ui());
   adb_bridge_ = DevToolsAdbBridge::Factory::GetForProfile(profile);
   adb_bridge_->AddListener(this);
-  web_ui->AddMessageHandler(new InspectMessageHandler(adb_bridge_));
-  content::WebUIDataSource::Add(profile, CreateInspectUIHTMLSource());
 
   registrar_.Add(this,
                  content::NOTIFICATION_WEB_CONTENTS_CONNECTED,
@@ -392,33 +422,6 @@
                  content::NotificationService::AllSources());
 }
 
-InspectUI::~InspectUI() {
-  StopListeningNotifications();
-}
-
-void InspectUI::RefreshUI() {
-  web_ui()->CallJavascriptFunction("populateLists");
-}
-
-// static
-bool InspectUI::WeakHandleRequestCallback(
-    const base::WeakPtr<InspectUI>& inspect_ui,
-    const std::string& path,
-    const content::WebUIDataSource::GotDataCallback& callback) {
-  if (!inspect_ui.get())
-    return false;
-  return inspect_ui->HandleRequestCallback(path, callback);
-}
-
-void InspectUI::Observe(int type,
-    const content::NotificationSource& source,
-    const content::NotificationDetails& details) {
-  if (source != content::Source<WebContents>(web_ui()->GetWebContents()))
-    RefreshUI();
-  else if (type == content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED)
-    StopListeningNotifications();
-}
-
 void InspectUI::StopListeningNotifications()
 {
   if (!observer_.get())
@@ -436,19 +439,9 @@
   source->AddResourcePath("inspect.css", IDR_INSPECT_CSS);
   source->AddResourcePath("inspect.js", IDR_INSPECT_JS);
   source->SetDefaultResource(IDR_INSPECT_HTML);
-  source->SetRequestFilter(base::Bind(&InspectUI::WeakHandleRequestCallback,
-                                      weak_factory_.GetWeakPtr()));
   return source;
 }
 
-bool InspectUI::HandleRequestCallback(
-    const std::string& path,
-    const content::WebUIDataSource::GotDataCallback& callback) {
-  if (path == kDataFile)
-    return HandleDataRequestCallback(path, callback);
-  return false;
-}
-
 void InspectUI::RemotePagesChanged(DevToolsAdbBridge::RemotePages* pages) {
   ListValue targets;
   for (DevToolsAdbBridge::RemotePages::iterator it = pages->begin();
diff --git a/chrome/browser/ui/webui/inspect_ui.h b/chrome/browser/ui/webui/inspect_ui.h
index 8220468..e2e6455 100644
--- a/chrome/browser/ui/webui/inspect_ui.h
+++ b/chrome/browser/ui/webui/inspect_ui.h
@@ -22,29 +22,23 @@
   explicit InspectUI(content::WebUI* web_ui);
   virtual ~InspectUI();
 
-  void RefreshUI();
+  void InitUI();
 
  private:
   class WorkerCreationDestructionListener;
 
-  static bool WeakHandleRequestCallback(
-      const base::WeakPtr<InspectUI>& inspect_ui,
-      const std::string& path,
-      const content::WebUIDataSource::GotDataCallback& callback);
+  void PopulateLists();
 
   // content::NotificationObserver overrides.
   virtual void Observe(int type,
                        const content::NotificationSource& source,
                        const content::NotificationDetails& details) OVERRIDE;
 
+  void StartListeningNotifications();
   void StopListeningNotifications();
 
   content::WebUIDataSource* CreateInspectUIHTMLSource();
 
-  bool HandleRequestCallback(
-      const std::string& path,
-      const content::WebUIDataSource::GotDataCallback& callback);
-
   // DevToolsAdbBridge::Listener overrides.
   virtual void RemotePagesChanged(
       DevToolsAdbBridge::RemotePages* pages) OVERRIDE;
@@ -55,7 +49,6 @@
   content::NotificationRegistrar registrar_;
 
   DevToolsAdbBridge* adb_bridge_;
-  base::WeakPtrFactory<InspectUI> weak_factory_;
 
   DISALLOW_COPY_AND_ASSIGN(InspectUI);
 };
diff --git a/chrome/browser/ui/webui/options/advanced_options_utils_x11.cc b/chrome/browser/ui/webui/options/advanced_options_utils_x11.cc
index bbe55c8..211f5b9 100644
--- a/chrome/browser/ui/webui/options/advanced_options_utils_x11.cc
+++ b/chrome/browser/ui/webui/options/advanced_options_utils_x11.cc
@@ -11,7 +11,7 @@
 #include "base/file_util.h"
 #include "base/files/file_path.h"
 #include "base/nix/xdg_util.h"
-#include "base/process_util.h"
+#include "base/process/launch.h"
 #include "base/strings/string_util.h"
 #include "chrome/browser/tab_contents/tab_util.h"
 #include "content/public/browser/browser_thread.h"
diff --git a/chrome/browser/ui/webui/translate_internals/translate_internals_handler.cc b/chrome/browser/ui/webui/translate_internals/translate_internals_handler.cc
index 9b44249..91f9e03 100644
--- a/chrome/browser/ui/webui/translate_internals/translate_internals_handler.cc
+++ b/chrome/browser/ui/webui/translate_internals/translate_internals_handler.cc
@@ -39,6 +39,9 @@
 
 void TranslateInternalsHandler::OnLanguageDetection(
     const LanguageDetectionDetails& details) {
+  if (!TranslateManager::IsTranslatableURL(details.url))
+    return;
+
   base::DictionaryValue dict;
   dict.Set("time",
            new base::FundamentalValue(details.time.ToJsTime()));
diff --git a/chrome/browser/unload_browsertest.cc b/chrome/browser/unload_browsertest.cc
index bc95910..c6f38ad 100644
--- a/chrome/browser/unload_browsertest.cc
+++ b/chrome/browser/unload_browsertest.cc
@@ -8,7 +8,6 @@
 
 #include "base/command_line.h"
 #include "base/logging.h"
-#include "base/process_util.h"
 #include "base/strings/utf_string_conversions.h"
 #include "chrome/browser/chrome_notification_types.h"
 #include "chrome/browser/net/url_request_mock_util.h"
diff --git a/chrome/browser/upgrade_detector_impl.cc b/chrome/browser/upgrade_detector_impl.cc
index 436d05e..15602d4 100644
--- a/chrome/browser/upgrade_detector_impl.cc
+++ b/chrome/browser/upgrade_detector_impl.cc
@@ -34,7 +34,7 @@
 #elif defined(OS_MACOSX)
 #include "chrome/browser/mac/keystone_glue.h"
 #elif defined(OS_POSIX)
-#include "base/process_util.h"
+#include "base/process/launch.h"
 #endif
 
 using content::BrowserThread;
diff --git a/chrome/browser/usb/usb_device_handle.cc b/chrome/browser/usb/usb_device_handle.cc
index 99faad1..b6e54f4 100644
--- a/chrome/browser/usb/usb_device_handle.cc
+++ b/chrome/browser/usb/usb_device_handle.cc
@@ -8,6 +8,7 @@
 #include <vector>
 
 #include "base/stl_util.h"
+#include "base/strings/string16.h"
 #include "base/synchronization/lock.h"
 #include "chrome/browser/usb/usb_interface.h"
 #include "chrome/browser/usb/usb_service.h"
@@ -244,6 +245,41 @@
   return libusb_reset_device(handle_) == 0;
 }
 
+bool UsbDeviceHandle::GetSerial(base::string16* serial) {
+  PlatformUsbDevice device = libusb_get_device(handle_);
+  libusb_device_descriptor desc;
+
+  if (libusb_get_device_descriptor(device, &desc) != LIBUSB_SUCCESS)
+    return false;
+
+  if (desc.iSerialNumber == 0)
+    return false;
+
+  // Getting supported language ID.
+  uint16 langid[128] = { 0 };
+
+  int size = libusb_get_string_descriptor(
+      handle_, 0, 0,
+      reinterpret_cast<unsigned char*>(&langid[0]), sizeof(langid));
+  if (size < 0)
+    return false;
+
+  int language_count = (size - 2) / 2;
+
+  for (int i = 1; i <= language_count; ++i) {
+    // Get the string using language ID.
+    char16 text[256] = { 0 };
+    size = libusb_get_string_descriptor(
+        handle_, desc.iSerialNumber, langid[i],
+        reinterpret_cast<unsigned char*>(&text[0]), sizeof(text));
+    if (size < 0)
+      continue;
+    *serial = base::string16(text, size / 2);
+    return true;
+  }
+  return false;
+}
+
 void UsbDeviceHandle::ControlTransfer(const UsbEndpointDirection direction,
     const TransferRequestType request_type, const TransferRecipient recipient,
     const uint8 request, const uint16 value, const uint16 index,
diff --git a/chrome/browser/usb/usb_device_handle.h b/chrome/browser/usb/usb_device_handle.h
index e46ab19..ef059d7 100644
--- a/chrome/browser/usb/usb_device_handle.h
+++ b/chrome/browser/usb/usb_device_handle.h
@@ -9,6 +9,7 @@
 #include <vector>
 
 #include "base/memory/ref_counted.h"
+#include "base/strings/string16.h"
 #include "base/synchronization/lock.h"
 #include "chrome/browser/usb/usb_interface.h"
 #include "net/base/completion_callback.h"
@@ -70,6 +71,7 @@
       const int interface_number,
       const int alternate_setting);
   virtual bool ResetDevice();
+  bool GetSerial(base::string16* serial);
 
   // Async IO.
   virtual void ControlTransfer(const UsbEndpointDirection direction,
diff --git a/chrome/browser/user_data_dir_extractor_win.cc b/chrome/browser/user_data_dir_extractor_win.cc
index e295885..e48c757 100644
--- a/chrome/browser/user_data_dir_extractor_win.cc
+++ b/chrome/browser/user_data_dir_extractor_win.cc
@@ -8,7 +8,7 @@
 #include "base/file_util.h"
 #include "base/logging.h"
 #include "base/path_service.h"
-#include "base/process_util.h"
+#include "base/process/launch.h"
 #include "chrome/browser/ui/user_data_dir_dialog.h"
 #include "chrome/browser/user_data_dir_extractor.h"
 #include "chrome/common/chrome_paths.h"
diff --git a/chrome/browser/user_data_dir_extractor_win_browsertest.cc b/chrome/browser/user_data_dir_extractor_win_browsertest.cc
index 6987b62..0adc765 100644
--- a/chrome/browser/user_data_dir_extractor_win_browsertest.cc
+++ b/chrome/browser/user_data_dir_extractor_win_browsertest.cc
@@ -6,7 +6,6 @@
 
 #include "base/command_line.h"
 #include "base/path_service.h"
-#include "base/process_util.h"
 #include "chrome/browser/browser_process.h"
 #include "chrome/browser/chrome_notification_types.h"
 #include "chrome/browser/ui/browser.h"
diff --git a/chrome/browser/web_applications/web_app_mac.mm b/chrome/browser/web_applications/web_app_mac.mm
index 0644302..46589ca 100644
--- a/chrome/browser/web_applications/web_app_mac.mm
+++ b/chrome/browser/web_applications/web_app_mac.mm
@@ -185,7 +185,9 @@
 
   CommandLine command_line(CommandLine::NO_PROGRAM);
   command_line.AppendSwitch(app_mode::kNoLaunchApp);
-  base::mac::OpenApplicationWithPath(shim_path, command_line, NULL);
+  // Launch without activating (kLSLaunchDontSwitch).
+  base::mac::OpenApplicationWithPath(
+      shim_path, command_line, kLSLaunchDefaults | kLSLaunchDontSwitch, NULL);
 }
 
 base::FilePath GetLocalizableAppShortcutsSubdirName() {
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 27d7415..194f834 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -773,10 +773,6 @@
         'browser/history/shortcuts_backend_factory.h',
         'browser/history/shortcuts_database.cc',
         'browser/history/shortcuts_database.h',
-        'browser/history/text_database.cc',
-        'browser/history/text_database.h',
-        'browser/history/text_database_manager.cc',
-        'browser/history/text_database_manager.h',
         'browser/history/thumbnail_database.cc',
         'browser/history/thumbnail_database.h',
         'browser/history/top_sites.cc',
@@ -1456,6 +1452,8 @@
         'browser/prefs/incognito_mode_prefs.h',
         'browser/prefs/pref_model_associator.cc',
         'browser/prefs/pref_model_associator.h',
+        'browser/prefs/pref_metrics_service.cc',
+        'browser/prefs/pref_metrics_service.h',
         'browser/prefs/pref_service_syncable.cc',
         'browser/prefs/pref_service_syncable.h',
         'browser/prefs/pref_service_syncable_builder.cc',
diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi
index aa457f2..7ce6ef9 100644
--- a/chrome/chrome_tests_unit.gypi
+++ b/chrome/chrome_tests_unit.gypi
@@ -902,8 +902,6 @@
         'browser/history/shortcuts_backend_unittest.cc',
         'browser/history/shortcuts_database_unittest.cc',
         'browser/history/snippet_unittest.cc',
-        'browser/history/text_database_manager_unittest.cc',
-        'browser/history/text_database_unittest.cc',
         'browser/history/thumbnail_database_unittest.cc',
         'browser/history/top_sites_database_unittest.cc',
         'browser/history/top_sites_impl_unittest.cc',
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index e9c67c5..667c868 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -371,6 +371,10 @@
 // Disables support for the QUIC protocol.
 const char kDisableQuic[]                   = "disable-quic";
 
+// Disables support for the HTTPS over QUIC protocol.  This is a temporary
+// testing flag.  This only has an effect if QUIC protocol is enabled.
+const char kDisableQuicHttps[]              = "disable-quic-https";
+
 // Prevents the URLs of BackgroundContents from being remembered and
 // re-launched when the browser restarts.
 const char kDisableRestoreBackgroundContents[] =
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index 89faf47..5b36cf6 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -111,6 +111,7 @@
 extern const char kDisablePrerenderLocalPredictor[];
 extern const char kDisablePromptOnRepost[];
 extern const char kDisableQuic[];
+extern const char kDisableQuicHttps[];
 extern const char kDisableRestoreBackgroundContents[];
 extern const char kDisableRestoreSessionState[];
 extern const char kDisableScriptedPrintThrottling[];
diff --git a/chrome/common/extensions/api/file_browser_private.json b/chrome/common/extensions/api/file_browser_private.json
index feb610d..003f8a9 100644
--- a/chrome/common/extensions/api/file_browser_private.json
+++ b/chrome/common/extensions/api/file_browser_private.json
@@ -1162,13 +1162,35 @@
             "type": "function",
             "parameters": [
               {
-                "name" : "accessToken",
+                "name": "accessToken",
                 "type": "string",
                 "description": "OAuth2 access token, or an empty string if failed to fetch."
               }
             ]
           }
         ]
+      },
+      {
+        "name": "getShareUrl",
+        "description": "Requests a share dialog url for the specified file.",
+        "parameters": [
+          {
+            "name": "url",
+            "type": "string",
+            "description": "Url for the file."
+          },
+          {
+            "name": "callback",
+            "type": "function",
+            "parameters": [
+              {
+                "name": "shareUrl",
+                "type": "string",
+                "description": "Share Url for the sharing dialog."
+              }
+            ]
+          }
+        ]
       }
     ],
     "events": [
diff --git a/chrome/common/extensions/api/sync_file_system.idl b/chrome/common/extensions/api/sync_file_system.idl
index 1247aa1..72e2479 100644
--- a/chrome/common/extensions/api/sync_file_system.idl
+++ b/chrome/common/extensions/api/sync_file_system.idl
@@ -141,7 +141,7 @@
 
     // Sets the default conflict resolution policy
     // for the <code>'syncable'</code> file storage for the app.
-    // By default it is set to <code>'manual'</code>.
+    // By default it is set to <code>'last_write_win'</code>.
     // When conflict resolution policy is set to <code>'last_write_win'</code>
     // conflicts for existing files are automatically resolved next time
     // the file is updated.
diff --git a/chrome/common/extensions/docs/server2/manifest_data_source.py b/chrome/common/extensions/docs/server2/manifest_data_source.py
index b01d226..d0c2c15 100644
--- a/chrome/common/extensions/docs/server2/manifest_data_source.py
+++ b/chrome/common/extensions/docs/server2/manifest_data_source.py
@@ -2,11 +2,10 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-from collections import OrderedDict
 from copy import deepcopy
 from operator import itemgetter
 
-from third_party.json_schema_compiler.json_parse import Parse
+from third_party.json_schema_compiler.json_parse import OrderedDict, Parse
 
 class ManifestDataSource(object):
   '''Provides a template with access to manifest properties specific to apps or
diff --git a/chrome/common/extensions/extension_constants.cc b/chrome/common/extensions/extension_constants.cc
index 04e2343..a919234 100644
--- a/chrome/common/extensions/extension_constants.cc
+++ b/chrome/common/extensions/extension_constants.cc
@@ -150,7 +150,10 @@
   EXTENSION_ICON_MEDIUM,  // 48
   EXTENSION_ICON_SMALL,  // 32
   EXTENSION_ICON_SMALLISH,  // 24
-  EXTENSION_ICON_BITTY  // 16
+  EXTENSION_ICON_BITTY,  // 16
+  // Additional 2x resources to load.
+  2 * EXTENSION_ICON_MEDIUM,  // 96
+  2 * EXTENSION_ICON_SMALL  // 64
 };
 
 const size_t kNumExtensionIconSizes =
diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_initvalue_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_initvalue_unittest.cc
index 186a576..ed579af 100644
--- a/chrome/common/extensions/manifest_tests/extension_manifests_initvalue_unittest.cc
+++ b/chrome/common/extensions/manifest_tests/extension_manifests_initvalue_unittest.cc
@@ -150,7 +150,7 @@
   // Strong RTL characters in name.
   extension = LoadAndExpectSuccess("init_valid_name_strong_rtl.json");
 
-  localized_name = WideToUTF16(L"Dictionary (\x05D1\x05D2"L" Google)");
+  localized_name = WideToUTF16(L"Dictionary (\x05D1\x05D2" L" Google)");
   base::i18n::AdjustStringForLocaleDirection(&localized_name);
   EXPECT_EQ(localized_name, UTF8ToUTF16(extension->name()));
 
diff --git a/chrome/common/local_discovery/local_discovery_messages.h b/chrome/common/local_discovery/local_discovery_messages.h
index 87f0027..cda9cc8 100644
--- a/chrome/common/local_discovery/local_discovery_messages.h
+++ b/chrome/common/local_discovery/local_discovery_messages.h
@@ -19,6 +19,7 @@
 
 IPC_ENUM_TRAITS(local_discovery::ServiceWatcher::UpdateType)
 IPC_ENUM_TRAITS(local_discovery::ServiceResolver::RequestStatus)
+IPC_ENUM_TRAITS(net::AddressFamily)
 
 //------------------------------------------------------------------------------
 // Utility process messages:
@@ -47,6 +48,16 @@
 IPC_MESSAGE_CONTROL1(LocalDiscoveryMsg_DestroyResolver,
                      uint64 /* id */)
 
+// Creates a local domain resolver and starts resolving in utility process.
+IPC_MESSAGE_CONTROL3(LocalDiscoveryMsg_ResolveLocalDomain,
+                     uint64 /* id */,
+                     std::string /* domain */,
+                     net::AddressFamily /* address_family */)
+
+// Destroys local domain resolver in utility process.
+IPC_MESSAGE_CONTROL1(LocalDiscoveryMsg_DestroyLocalDomainResolver,
+                     uint64 /* id */)
+
 //------------------------------------------------------------------------------
 // Utility process host messages:
 // These are messages from the utility process to the browser.
@@ -63,3 +74,10 @@
     uint64 /* id */,
     local_discovery::ServiceResolver::RequestStatus /* status */,
     local_discovery::ServiceDescription /* description */)
+
+// Notifies browser process about local domain resolution results.
+IPC_MESSAGE_CONTROL3(
+    LocalDiscoveryHostMsg_LocalDomainResolverCallback,
+    uint64 /* id */,
+    bool /* success */,
+    net::IPAddressNumber /* ip_address */)
diff --git a/chrome/common/metrics/variations/variation_ids.h b/chrome/common/metrics/variations/variation_ids.h
index 39b5ae7..299f9c3 100644
--- a/chrome/common/metrics/variations/variation_ids.h
+++ b/chrome/common/metrics/variations/variation_ids.h
@@ -175,7 +175,7 @@
   EXTENDED_INSTANT_RANGE_ID_MIN           = 3310265,
   EXTENDED_INSTANT_RANGE_ID_MAX           = 3310365,
   EXTENDED_INSTANT_RANGE2_ID_MIN          = 3310368,
-  EXTENDED_INSTANT_RANGE2_ID_MAX          = 3310468,
+  EXTENDED_INSTANT_RANGE2_ID_MAX          = 3310868,
 
   // Reserve 100 IDs to be used by autocomplete dynamic field trials.
   // The dynamic field trials are activated by a call to
@@ -230,7 +230,7 @@
   // NEXT ID: When adding new IDs, please add them above this section, starting
   // with the value of NEXT_ID, and updating NEXT_ID to (end of your reserved
   // range) + 1.
-  NEXT_ID = 3310469,
+  NEXT_ID = 3310869,
 
   // USABLE IDs END HERE.
   //
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index 08bbab0..b93e023 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -399,12 +399,6 @@
 // Misc messages
 // These are messages sent from the renderer to the browser process.
 
-// Provides the contents for the given page that was loaded recently.
-IPC_MESSAGE_ROUTED3(ChromeViewHostMsg_PageContents,
-                    GURL         /* URL of the page */,
-                    int32        /* page id */,
-                    string16     /* page contents */)
-
 // Notification that the language for the tab has been determined.
 IPC_MESSAGE_ROUTED2(ChromeViewHostMsg_TranslateLanguageDetermined,
                     LanguageDetectionDetails /* details about lang detection */,
diff --git a/chrome/installer/util/installer_state.cc b/chrome/installer/util/installer_state.cc
index 32d9b5a..6409d44 100644
--- a/chrome/installer/util/installer_state.cc
+++ b/chrome/installer/util/installer_state.cc
@@ -214,8 +214,8 @@
     }
 
     bool keep_binaries = false;
-    // Look for a product that is not the binaries and that is not being
-    // uninstalled. If not found, binaries are uninstalled too.
+    // Look for a multi-install product that is not the binaries and that is not
+    // being uninstalled. If not found, binaries are uninstalled too.
     for (size_t i = 0; i < BrowserDistribution::NUM_TYPES; ++i) {
       BrowserDistribution::Type type =
           static_cast<BrowserDistribution::Type>(i);
@@ -223,11 +223,22 @@
       if (type == BrowserDistribution::CHROME_BINARIES)
         continue;
 
-      if (machine_state.GetProductState(system_install(), type) == NULL) {
+      const ProductState* product_state =
+          machine_state.GetProductState(system_install(), type);
+      if (product_state == NULL) {
         // The product is not installed.
         continue;
       }
 
+      if (!product_state->is_multi_install() &&
+          type != BrowserDistribution::CHROME_BROWSER) {
+        // The product is not sharing the binaries. It is ordinarily impossible
+        // for single-install Chrome to be installed along with any
+        // multi-install product. Treat single-install Chrome the same as any
+        // multi-install product just in case the impossible happens.
+        continue;
+      }
+
       // The product is installed.
 
       if (!FindProduct(type)) {
diff --git a/chrome/renderer/DEPS b/chrome/renderer/DEPS
index 12111d0..d437fb2 100644
--- a/chrome/renderer/DEPS
+++ b/chrome/renderer/DEPS
@@ -20,7 +20,6 @@
   "+webkit/renderer",
 
   # TODO(jam): eliminate all of these. http://crbug.com/263054
-  "!webkit/plugins/ppapi/ppapi_plugin_instance.h",
   "!webkit/plugins/plugin_constants.h",
 
   "+third_party/npapi/bindings",
diff --git a/chrome/renderer/chrome_render_view_observer.cc b/chrome/renderer/chrome_render_view_observer.cc
index 7fe88bb..fa9a76a 100644
--- a/chrome/renderer/chrome_render_view_observer.cc
+++ b/chrome/renderer/chrome_render_view_observer.cc
@@ -741,13 +741,6 @@
 
   TRACE_EVENT0("renderer", "ChromeRenderViewObserver::CapturePageInfo");
 
-  if (contents.size()) {
-    // Send the text to the browser for indexing (the browser might decide not
-    // to index, if the URL is HTTPS for instance).
-    Send(new ChromeViewHostMsg_PageContents(routing_id(), url, page_id,
-                                            contents));
-  }
-
 #if defined(FULL_SAFE_BROWSING)
   // Will swap out the string.
   if (phishing_classifier_)
diff --git a/chrome/renderer/extensions/miscellaneous_bindings.cc b/chrome/renderer/extensions/miscellaneous_bindings.cc
index 8921d77..004aaa3 100644
--- a/chrome/renderer/extensions/miscellaneous_bindings.cc
+++ b/chrome/renderer/extensions/miscellaneous_bindings.cc
@@ -9,7 +9,9 @@
 
 #include "base/basictypes.h"
 #include "base/bind.h"
+#include "base/bind_helpers.h"
 #include "base/lazy_instance.h"
+#include "base/message_loop/message_loop.h"
 #include "base/values.h"
 #include "chrome/common/extensions/extension_messages.h"
 #include "chrome/common/extensions/message_bundle.h"
@@ -160,39 +162,55 @@
     }
   }
 
-  struct GCCallbackArgs {
-    GCCallbackArgs(v8::Handle<v8::Object> object,
-                   v8::Handle<v8::Function> callback)
-        : object(object), callback(callback) {}
-
-    extensions::ScopedPersistent<v8::Object> object;
-    extensions::ScopedPersistent<v8::Function> callback;
+  // Holds a |callback| to run sometime after |object| is GC'ed. |callback| will
+  // not be executed re-entrantly to avoid running JS in an unexpected state.
+  class GCCallback {
+   public:
+    static void Bind(v8::Handle<v8::Object> object,
+                     v8::Handle<v8::Function> callback) {
+      GCCallback* cb = new GCCallback(object, callback);
+      cb->object_.MakeWeak(cb, NearDeathCallback);
+    }
 
    private:
-    DISALLOW_COPY_AND_ASSIGN(GCCallbackArgs);
+    static void NearDeathCallback(v8::Isolate* isolate,
+                                  v8::Persistent<v8::Object>* object,
+                                  GCCallback* self) {
+      // v8 says we need to explicitly reset weak handles from their callbacks.
+      // It's not implicit as one might expect.
+      self->object_.reset();
+      base::MessageLoop::current()->PostTask(FROM_HERE,
+          base::Bind(&GCCallback::RunCallback, base::Owned(self)));
+    }
+
+    GCCallback(v8::Handle<v8::Object> object, v8::Handle<v8::Function> callback)
+        : object_(object), callback_(callback) {
+    }
+
+    void RunCallback() {
+      v8::HandleScope handle_scope;
+      v8::Handle<v8::Context> context = callback_->CreationContext();
+      if (context.IsEmpty())
+        return;
+      v8::Context::Scope context_scope(context);
+      WebKit::WebScopedMicrotaskSuppression suppression;
+      callback_->Call(context->Global(), 0, NULL);
+    }
+
+    extensions::ScopedPersistent<v8::Object> object_;
+    extensions::ScopedPersistent<v8::Function> callback_;
+
+    DISALLOW_COPY_AND_ASSIGN(GCCallback);
   };
 
-  static void GCCallback(v8::Isolate* isolate,
-                         v8::Persistent<v8::Object>* object,
-                         GCCallbackArgs* args) {
-    v8::HandleScope handle_scope;
-    v8::Handle<v8::Context> context = args->callback->CreationContext();
-    v8::Context::Scope context_scope(context);
-    WebKit::WebScopedMicrotaskSuppression suppression;
-    // Wrap in try/catch here so that we don't call into any message/exception
-    // handlers during GC. That is a recipe for pain.
-    v8::TryCatch trycatch;
-    args->callback->Call(context->Global(), 0, NULL);
-    delete args;
-  }
-
-  // Binds a callback to be invoked when the given object is garbage collected.
+  // void BindToGC(object, callback)
+  //
+  // Binds |callback| to be invoked *sometime after* |object| is garbage
+  // collected. We don't call the method re-entrantly so as to avoid executing
+  // JS in some bizarro undefined mid-GC state.
   void BindToGC(const v8::FunctionCallbackInfo<v8::Value>& args) {
     CHECK(args.Length() == 2 && args[0]->IsObject() && args[1]->IsFunction());
-    GCCallbackArgs* context = new GCCallbackArgs(
-        v8::Handle<v8::Object>::Cast(args[0]),
-        v8::Handle<v8::Function>::Cast(args[1]));
-    context->object.MakeWeak(context, GCCallback);
+    GCCallback::Bind(args[0].As<v8::Object>(), args[1].As<v8::Function>());
   }
 };
 
diff --git a/chrome/renderer/pepper/pepper_flash_drm_renderer_host.cc b/chrome/renderer/pepper/pepper_flash_drm_renderer_host.cc
index 85662db..26b6ef4 100644
--- a/chrome/renderer/pepper/pepper_flash_drm_renderer_host.cc
+++ b/chrome/renderer/pepper/pepper_flash_drm_renderer_host.cc
@@ -5,6 +5,7 @@
 #include "chrome/renderer/pepper/pepper_flash_drm_renderer_host.h"
 
 #include "base/files/file_path.h"
+#include "content/public/renderer/ppapi_plugin_instance.h"
 #include "content/public/renderer/renderer_ppapi_host.h"
 #include "ppapi/c/pp_errors.h"
 #include "ppapi/host/dispatch_host_message.h"
@@ -12,7 +13,6 @@
 #include "ppapi/host/ppapi_host.h"
 #include "ppapi/proxy/ppapi_messages.h"
 #include "ppapi/proxy/ppb_file_ref_proxy.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
 
 namespace chrome {
 
diff --git a/chrome/renderer/pepper/pepper_flash_fullscreen_host.cc b/chrome/renderer/pepper/pepper_flash_fullscreen_host.cc
index a14423d..edeb06b 100644
--- a/chrome/renderer/pepper/pepper_flash_fullscreen_host.cc
+++ b/chrome/renderer/pepper/pepper_flash_fullscreen_host.cc
@@ -4,13 +4,13 @@
 
 #include "chrome/renderer/pepper/pepper_flash_fullscreen_host.h"
 
+#include "content/public/renderer/ppapi_plugin_instance.h"
 #include "content/public/renderer/renderer_ppapi_host.h"
 #include "ppapi/c/pp_errors.h"
 #include "ppapi/host/dispatch_host_message.h"
 #include "ppapi/host/host_message_context.h"
 #include "ppapi/host/ppapi_host.h"
 #include "ppapi/proxy/ppapi_messages.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
 
 namespace chrome {
 
diff --git a/chrome/renderer/pepper/pepper_flash_menu_host.cc b/chrome/renderer/pepper/pepper_flash_menu_host.cc
index d8799d2..3d4b905 100644
--- a/chrome/renderer/pepper/pepper_flash_menu_host.cc
+++ b/chrome/renderer/pepper/pepper_flash_menu_host.cc
@@ -14,7 +14,6 @@
 #include "ppapi/proxy/ppapi_messages.h"
 #include "ppapi/proxy/serialized_flash_menu.h"
 #include "ui/gfx/point.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
 
 namespace chrome {
 
diff --git a/chrome/renderer/pepper/pepper_flash_renderer_host.cc b/chrome/renderer/pepper/pepper_flash_renderer_host.cc
index 6bc0c30..37561ae 100644
--- a/chrome/renderer/pepper/pepper_flash_renderer_host.cc
+++ b/chrome/renderer/pepper/pepper_flash_renderer_host.cc
@@ -7,6 +7,7 @@
 #include <vector>
 
 #include "chrome/renderer/pepper/ppb_pdf_impl.h"
+#include "content/public/renderer/ppapi_plugin_instance.h"
 #include "content/public/renderer/render_thread.h"
 #include "content/public/renderer/renderer_ppapi_host.h"
 #include "ipc/ipc_message_macros.h"
@@ -28,7 +29,6 @@
 #include "third_party/skia/include/core/SkTypeface.h"
 #include "ui/gfx/rect.h"
 #include "url/gurl.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
 
 using ppapi::thunk::EnterResourceNoLock;
 using ppapi::thunk::PPB_ImageData_API;
@@ -92,7 +92,7 @@
   webkit::ppapi::PluginInstance* plugin_instance =
       host_->GetPluginInstance(pp_instance());
   if (plugin_instance)
-    plugin_instance->set_always_on_top(on_top);
+    plugin_instance->SetAlwaysOnTop(on_top);
   // Since no reply is sent for this message, it doesn't make sense to return an
   // error.
   return PP_OK;
diff --git a/chrome/renderer/pepper/pepper_pdf_host.cc b/chrome/renderer/pepper/pepper_pdf_host.cc
index afe05a6..debaf9c 100644
--- a/chrome/renderer/pepper/pepper_pdf_host.cc
+++ b/chrome/renderer/pepper/pepper_pdf_host.cc
@@ -8,6 +8,7 @@
 #include "chrome/common/render_messages.h"
 #include "chrome/renderer/printing/print_web_view_helper.h"
 #include "content/public/common/referrer.h"
+#include "content/public/renderer/ppapi_plugin_instance.h"
 #include "content/public/renderer/render_thread.h"
 #include "content/public/renderer/render_view.h"
 #include "content/public/renderer/renderer_ppapi_host.h"
@@ -36,7 +37,6 @@
 #include "ui/gfx/image/image_skia.h"
 #include "ui/gfx/image/image_skia_rep.h"
 #include "ui/gfx/point.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
 
 using webkit::ppapi::PluginInstance;
 
@@ -182,7 +182,7 @@
   PluginInstance* instance = host_->GetPluginInstance(pp_instance());
   if (!instance)
     return PP_ERROR_FAILED;
-  instance->render_view()->DidStartLoading();
+  instance->GetRenderView()->DidStartLoading();
   return PP_OK;
 }
 
@@ -191,7 +191,7 @@
   PluginInstance* instance = host_->GetPluginInstance(pp_instance());
   if (!instance)
     return PP_ERROR_FAILED;
-  instance->render_view()->DidStopLoading();
+  instance->GetRenderView()->DidStopLoading();
   return PP_OK;
 }
 
@@ -200,9 +200,9 @@
   PluginInstance* instance = host_->GetPluginInstance(pp_instance());
   if (!instance)
     return PP_ERROR_FAILED;
-  instance->render_view()->Send(
+  instance->GetRenderView()->Send(
       new ChromeViewHostMsg_PDFUpdateContentRestrictions(
-          instance->render_view()->GetRoutingID(), restrictions));
+          instance->GetRenderView()->GetRoutingID(), restrictions));
   return PP_OK;
 }
 
@@ -235,7 +235,7 @@
     return PP_OK;
 
   WebKit::WebView* view =
-      instance->container()->element().document().frame()->view();
+      instance->GetContainer()->element().document().frame()->view();
   content::RenderView* render_view = content::RenderView::FromWebView(view);
   render_view->Send(new ChromeViewHostMsg_PDFHasUnsupportedFeature(
       render_view->GetRoutingID()));
@@ -249,7 +249,7 @@
   if (!instance)
     return PP_ERROR_FAILED;
 
-  WebKit::WebElement element = instance->container()->element();
+  WebKit::WebElement element = instance->GetContainer()->element();
   WebKit::WebView* view = element.document().frame()->view();
   content::RenderView* render_view = content::RenderView::FromWebView(view);
 
@@ -268,8 +268,8 @@
   PluginInstance* instance = host_->GetPluginInstance(pp_instance());
   if (!instance)
     return PP_ERROR_FAILED;
-  GURL url = instance->plugin_url();
-  content::RenderView* render_view = instance->render_view();
+  GURL url = instance->GetPluginURL();
+  content::RenderView* render_view = instance->GetRenderView();
   WebKit::WebFrame* frame = render_view->GetWebView()->mainFrame();
   content::Referrer referrer(frame->document().url(),
                              frame->document().referrerPolicy());
diff --git a/chrome/renderer/pepper/pepper_shared_memory_message_filter.cc b/chrome/renderer/pepper/pepper_shared_memory_message_filter.cc
index 23f507b..a3af8ea 100644
--- a/chrome/renderer/pepper/pepper_shared_memory_message_filter.cc
+++ b/chrome/renderer/pepper/pepper_shared_memory_message_filter.cc
@@ -8,12 +8,12 @@
 #include "base/memory/shared_memory.h"
 #include "base/process_util.h"
 #include "content/public/common/content_client.h"
+#include "content/public/renderer/ppapi_plugin_instance.h"
 #include "content/public/renderer/render_thread.h"
 #include "content/public/renderer/renderer_ppapi_host.h"
 #include "ppapi/host/ppapi_host.h"
 #include "ppapi/proxy/ppapi_messages.h"
 #include "ppapi/shared_impl/var_tracker.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
 
 namespace chrome {
 
diff --git a/chrome/renderer/pepper/ppb_nacl_private_impl.cc b/chrome/renderer/pepper/ppb_nacl_private_impl.cc
index ecf653a..7ffe277 100644
--- a/chrome/renderer/pepper/ppb_nacl_private_impl.cc
+++ b/chrome/renderer/pepper/ppb_nacl_private_impl.cc
@@ -18,6 +18,7 @@
 #include "content/public/common/content_client.h"
 #include "content/public/common/content_switches.h"
 #include "content/public/common/sandbox_init.h"
+#include "content/public/renderer/ppapi_plugin_instance.h"
 #include "content/public/renderer/renderer_ppapi_host.h"
 #include "content/public/renderer/render_thread.h"
 #include "content/public/renderer/render_view.h"
@@ -33,7 +34,6 @@
 #include "third_party/WebKit/public/web/WebFrame.h"
 #include "third_party/WebKit/public/web/WebPluginContainer.h"
 #include "third_party/WebKit/public/web/WebView.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
 
 namespace {
 
diff --git a/chrome/renderer/pepper/ppb_pdf_impl.cc b/chrome/renderer/pepper/ppb_pdf_impl.cc
index 9148e10..0ac88b2 100644
--- a/chrome/renderer/pepper/ppb_pdf_impl.cc
+++ b/chrome/renderer/pepper/ppb_pdf_impl.cc
@@ -14,12 +14,14 @@
 #include "chrome/renderer/printing/print_web_view_helper.h"
 #include "content/public/common/child_process_sandbox_support_linux.h"
 #include "content/public/common/referrer.h"
+#include "content/public/renderer/ppapi_plugin_instance.h"
 #include "content/public/renderer/render_thread.h"
 #include "content/public/renderer/render_view.h"
 #include "grit/webkit_resources.h"
 #include "grit/webkit_strings.h"
 #include "ppapi/c/pp_resource.h"
 #include "ppapi/c/private/ppb_pdf.h"
+#include "ppapi/c/trusted/ppb_browser_font_trusted.h"
 #include "ppapi/shared_impl/ppapi_globals.h"
 #include "ppapi/shared_impl/resource.h"
 #include "ppapi/shared_impl/resource_tracker.h"
@@ -34,7 +36,6 @@
 #include "ui/base/l10n/l10n_util.h"
 #include "ui/base/layout.h"
 #include "ui/base/resource/resource_bundle.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
 
 using ppapi::PpapiGlobals;
 using webkit::ppapi::PluginInstance;
@@ -136,7 +137,7 @@
   PluginInstance* instance = PluginInstance::Get(instance_id);
   if (!instance)
     return WebKit::WebElement();
-  return instance->container()->element();
+  return instance->GetContainer()->element();
 }
 
 printing::PrintWebViewHelper* GetPrintWebViewHelper(
@@ -289,30 +290,30 @@
   PluginInstance* instance = PluginInstance::Get(instance_id);
   if (!instance)
     return;
-  instance->render_view()->DidStartLoading();
+  instance->GetRenderView()->DidStartLoading();
 }
 
 void DidStopLoading(PP_Instance instance_id) {
   PluginInstance* instance = PluginInstance::Get(instance_id);
   if (!instance)
     return;
-  instance->render_view()->DidStopLoading();
+  instance->GetRenderView()->DidStopLoading();
 }
 
 void SetContentRestriction(PP_Instance instance_id, int restrictions) {
   PluginInstance* instance = PluginInstance::Get(instance_id);
   if (!instance)
     return;
-  instance->render_view()->Send(
+  instance->GetRenderView()->Send(
       new ChromeViewHostMsg_PDFUpdateContentRestrictions(
-          instance->render_view()->GetRoutingID(), restrictions));
+          instance->GetRenderView()->GetRoutingID(), restrictions));
 }
 
-void HistogramPDFPageCount(PP_Instance /*instance*/, int count) {
+void HistogramPDFPageCount(PP_Instance instance, int count) {
   UMA_HISTOGRAM_COUNTS_10000("PDF.PageCount", count);
 }
 
-void UserMetricsRecordAction(PP_Instance /*instance*/, PP_Var action) {
+void UserMetricsRecordAction(PP_Instance instance, PP_Var action) {
   scoped_refptr<ppapi::StringVar> action_str(
       ppapi::StringVar::FromPPVar(action));
   if (action_str.get())
@@ -328,7 +329,7 @@
   if (!instance->IsFullPagePlugin())
     return;
 
-  WebView* view = instance->container()->element().document().frame()->view();
+  WebView* view = instance->GetContainer()->element().document().frame()->view();
   content::RenderView* render_view = content::RenderView::FromWebView(view);
   render_view->Send(new ChromeViewHostMsg_PDFHasUnsupportedFeature(
       render_view->GetRoutingID()));
@@ -338,9 +339,9 @@
   PluginInstance* instance = PluginInstance::Get(instance_id);
   if (!instance)
     return;
-  GURL url = instance->plugin_url();
+  GURL url = instance->GetPluginURL();
 
-  content::RenderView* render_view = instance->render_view();
+  content::RenderView* render_view = instance->GetRenderView();
   WebKit::WebFrame* frame = render_view->GetWebView()->mainFrame();
   content::Referrer referrer(frame->document().url(),
                              frame->document().referrerPolicy());
diff --git a/chrome/renderer/plugins/webview_plugin.cc b/chrome/renderer/plugins/webview_plugin.cc
index 34055d3..eb1fea7 100644
--- a/chrome/renderer/plugins/webview_plugin.cc
+++ b/chrome/renderer/plugins/webview_plugin.cc
@@ -227,22 +227,6 @@
     delegate_->BindWebFrame(frame);
 }
 
-bool WebViewPlugin::canHandleRequest(WebFrame* frame,
-                                     const WebURLRequest& request) {
-  return GURL(request.url()).SchemeIs("chrome");
-}
-
-WebURLError WebViewPlugin::cancelledError(WebFrame* frame,
-                                          const WebURLRequest& request) {
-  // Return an error with a non-zero reason so isNull() on the corresponding
-  // ResourceError is false.
-  WebURLError error;
-  error.domain = "WebViewPlugin";
-  error.reason = -1;
-  error.unreachableURL = request.url();
-  return error;
-}
-
 void WebViewPlugin::didReceiveResponse(WebFrame* frame,
                                        unsigned identifier,
                                        const WebURLResponse& response) {
diff --git a/chrome/renderer/plugins/webview_plugin.h b/chrome/renderer/plugins/webview_plugin.h
index 2a3203c..791539c 100644
--- a/chrome/renderer/plugins/webview_plugin.h
+++ b/chrome/renderer/plugins/webview_plugin.h
@@ -123,12 +123,6 @@
   // WebFrameClient methods:
   virtual void didClearWindowObject(WebKit::WebFrame* frame);
 
-  virtual bool canHandleRequest(WebKit::WebFrame* frame,
-                                const WebKit::WebURLRequest& request);
-
-  virtual WebKit::WebURLError cancelledError(
-      WebKit::WebFrame* frame, const WebKit::WebURLRequest& request);
-
   // This method is defined in WebPlugin as well as in WebFrameClient, but with
   // different parameters. We only care about implementing the WebPlugin
   // version, so we implement this method and call the default in WebFrameClient
diff --git a/chrome/renderer/resources/mobile_youtube_plugin.html b/chrome/renderer/resources/mobile_youtube_plugin.html
index 1147048..69f65cc 100644
--- a/chrome/renderer/resources/mobile_youtube_plugin.html
+++ b/chrome/renderer/resources/mobile_youtube_plugin.html
@@ -8,7 +8,6 @@
 }
 </script>
 <style type="text/css">
-
 body {
   background-color: black;
   background-repeat: no-repeat;
@@ -16,17 +15,10 @@
   overflow: hidden;
 }
 
-#main {
-  position: absolute;
-  width: 100%;
-  height: 100%;
-  padding: 0%;
-}
-
 #inner {
-  position: relative;
-  top: 50%;
+  position: absolute;
   left: 50%;
+  top: 50%;
   margin-left: -33px;
   margin-top: -23px;
 }
@@ -47,9 +39,7 @@
 </style>
 </head>
 <body id="body" onLoad="insertBackground()">
-<div id="main">
 <div id="logo"><img id="youtube" src="youtube.png"/></div>
 <div id="inner"><img id="play" src="play.png" onclick="plugin.openYoutubeURL();"/></div>
-</div>
 </body>
 </html>
diff --git a/chrome/test/automation/automation_proxy.cc b/chrome/test/automation/automation_proxy.cc
index 55cd320..63acdfd 100644
--- a/chrome/test/automation/automation_proxy.cc
+++ b/chrome/test/automation/automation_proxy.cc
@@ -10,7 +10,6 @@
 #include "base/debug/trace_event.h"
 #include "base/logging.h"
 #include "base/memory/ref_counted.h"
-#include "base/process_util.h"
 #include "base/synchronization/waitable_event.h"
 #include "base/threading/platform_thread.h"
 #include "chrome/common/automation_constants.h"
diff --git a/chrome/test/automation/automation_proxy.h b/chrome/test/automation/automation_proxy.h
index 16b2870..9edaefd 100644
--- a/chrome/test/automation/automation_proxy.h
+++ b/chrome/test/automation/automation_proxy.h
@@ -11,7 +11,6 @@
 #include "base/basictypes.h"
 #include "base/compiler_specific.h"
 #include "base/memory/scoped_ptr.h"
-#include "base/process_util.h"
 #include "base/synchronization/waitable_event.h"
 #include "base/threading/platform_thread.h"
 #include "base/threading/thread.h"
diff --git a/chrome/test/automation/proxy_launcher.cc b/chrome/test/automation/proxy_launcher.cc
index 6b15184..3871966 100644
--- a/chrome/test/automation/proxy_launcher.cc
+++ b/chrome/test/automation/proxy_launcher.cc
@@ -9,6 +9,8 @@
 #include "base/environment.h"
 #include "base/file_util.h"
 #include "base/files/file_enumerator.h"
+#include "base/process/kill.h"
+#include "base/process/launch.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_split.h"
 #include "base/strings/stringprintf.h"
diff --git a/chrome/test/automation/proxy_launcher.h b/chrome/test/automation/proxy_launcher.h
index d638461..3720dcd 100644
--- a/chrome/test/automation/proxy_launcher.h
+++ b/chrome/test/automation/proxy_launcher.h
@@ -13,7 +13,7 @@
 #include "base/compiler_specific.h"
 #include "base/files/scoped_temp_dir.h"
 #include "base/memory/scoped_ptr.h"
-#include "base/process.h"
+#include "base/process/process.h"
 #include "base/time/time.h"
 
 class AutomationProxy;
diff --git a/chrome/test/base/chrome_process_util.cc b/chrome/test/base/chrome_process_util.cc
index 26097a6..0d08db0 100644
--- a/chrome/test/base/chrome_process_util.cc
+++ b/chrome/test/base/chrome_process_util.cc
@@ -9,7 +9,8 @@
 #include <vector>
 
 #include "base/command_line.h"
-#include "base/process_util.h"
+#include "base/process/kill.h"
+#include "base/process/process_iterator.h"
 #include "base/time/time.h"
 #include "chrome/common/chrome_constants.h"
 #include "chrome/test/base/test_switches.h"
diff --git a/chrome/test/base/chrome_process_util.h b/chrome/test/base/chrome_process_util.h
index a3f558a..48a8f93 100644
--- a/chrome/test/base/chrome_process_util.h
+++ b/chrome/test/base/chrome_process_util.h
@@ -8,7 +8,8 @@
 #include <vector>
 
 #include "base/memory/scoped_ptr.h"
-#include "base/process_util.h"
+#include "base/process/process_handle.h"
+#include "base/process/process_metrics.h"
 
 typedef std::vector<base::ProcessId> ChromeProcessList;
 
diff --git a/chrome/test/base/chrome_process_util_mac.cc b/chrome/test/base/chrome_process_util_mac.cc
index 347e37a..72747b9 100644
--- a/chrome/test/base/chrome_process_util_mac.cc
+++ b/chrome/test/base/chrome_process_util_mac.cc
@@ -8,7 +8,7 @@
 #include <vector>
 
 #include "base/command_line.h"
-#include "base/process_util.h"
+#include "base/process/launch.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_split.h"
 #include "base/strings/string_util.h"
diff --git a/chrome/test/base/chrome_test_launcher.cc b/chrome/test/base/chrome_test_launcher.cc
index deae8ba..4942a63 100644
--- a/chrome/test/base/chrome_test_launcher.cc
+++ b/chrome/test/base/chrome_test_launcher.cc
@@ -11,7 +11,7 @@
 #include "base/files/file_path.h"
 #include "base/logging.h"
 #include "base/memory/linked_ptr.h"
-#include "base/process_util.h"
+#include "base/process/process_metrics.h"
 #include "base/run_loop.h"
 #include "base/strings/string_util.h"
 #include "base/test/test_file_util.h"
diff --git a/chrome/test/base/chrome_test_suite.cc b/chrome/test/base/chrome_test_suite.cc
index b94a534..01668b4 100644
--- a/chrome/test/base/chrome_test_suite.cc
+++ b/chrome/test/base/chrome_test_suite.cc
@@ -13,7 +13,6 @@
 #include "base/memory/ref_counted.h"
 #include "base/metrics/stats_table.h"
 #include "base/path_service.h"
-#include "base/process_util.h"
 #include "base/strings/stringprintf.h"
 #include "base/strings/utf_string_conversions.h"
 #include "chrome/browser/browser_process.h"
@@ -45,6 +44,7 @@
 #endif
 
 #if defined(OS_CHROMEOS)
+#include "base/process/process_metrics.h"
 #include "chromeos/chromeos_paths.h"
 #endif
 
diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc
index 3a3c019..7611a93 100644
--- a/chrome/test/base/testing_profile.cc
+++ b/chrome/test/base/testing_profile.cc
@@ -366,12 +366,13 @@
   return new HistoryService(static_cast<Profile*>(profile));
 }
 
-void TestingProfile::CreateHistoryService(bool delete_file, bool no_db) {
+bool TestingProfile::CreateHistoryService(bool delete_file, bool no_db) {
   DestroyHistoryService();
   if (delete_file) {
     base::FilePath path = GetPath();
     path = path.Append(chrome::kHistoryFilename);
-    base::DeleteFile(path, false);
+    if (!base::DeleteFile(path, false) || base::PathExists(path))
+      return false;
   }
   // This will create and init the history service.
   HistoryService* history_service = static_cast<HistoryService*>(
@@ -384,6 +385,7 @@
   }
   // Disable WebHistoryService by default, since it makes network requests.
   WebHistoryServiceFactory::GetInstance()->SetTestingFactory(this, NULL);
+  return true;
 }
 
 void TestingProfile::DestroyHistoryService() {
diff --git a/chrome/test/base/testing_profile.h b/chrome/test/base/testing_profile.h
index 939e772..91a2a22 100644
--- a/chrome/test/base/testing_profile.h
+++ b/chrome/test/base/testing_profile.h
@@ -132,8 +132,8 @@
   // deletes the directory containing the files used by HistoryService, this
   // only matters if you're recreating the HistoryService.  If |no_db| is true,
   // the history backend will fail to initialize its database; this is useful
-  // for testing error conditions.
-  void CreateHistoryService(bool delete_file, bool no_db);
+  // for testing error conditions. Returns true on success.
+  bool CreateHistoryService(bool delete_file, bool no_db) WARN_UNUSED_RESULT;
 
   // Shuts down and nulls out the reference to HistoryService.
   void DestroyHistoryService();
diff --git a/chrome/test/chromedriver/chrome/chrome_desktop_impl.cc b/chrome/test/chromedriver/chrome/chrome_desktop_impl.cc
index e339e57..c454917 100644
--- a/chrome/test/chromedriver/chrome/chrome_desktop_impl.cc
+++ b/chrome/test/chromedriver/chrome/chrome_desktop_impl.cc
@@ -7,7 +7,7 @@
 #include "base/files/file_path.h"
 #include "base/logging.h"
 #include "base/posix/eintr_wrapper.h"
-#include "base/process_util.h"
+#include "base/process/kill.h"
 #include "base/sys_info.h"
 #include "base/threading/platform_thread.h"
 #include "base/time/time.h"
diff --git a/chrome/test/chromedriver/chrome/chrome_desktop_impl.h b/chrome/test/chromedriver/chrome/chrome_desktop_impl.h
index ffa9266..bc17620 100644
--- a/chrome/test/chromedriver/chrome/chrome_desktop_impl.h
+++ b/chrome/test/chromedriver/chrome/chrome_desktop_impl.h
@@ -9,7 +9,7 @@
 
 #include "base/compiler_specific.h"
 #include "base/files/scoped_temp_dir.h"
-#include "base/process.h"
+#include "base/process/process.h"
 #include "chrome/test/chromedriver/chrome/chrome_impl.h"
 
 class AutomationExtension;
diff --git a/chrome/test/chromedriver/chrome_launcher.cc b/chrome/test/chromedriver/chrome_launcher.cc
index 6cfccd8..6b09550 100644
--- a/chrome/test/chromedriver/chrome_launcher.cc
+++ b/chrome/test/chromedriver/chrome_launcher.cc
@@ -16,8 +16,8 @@
 #include "base/json/json_reader.h"
 #include "base/json/json_writer.h"
 #include "base/logging.h"
-#include "base/process.h"
-#include "base/process_util.h"
+#include "base/process/kill.h"
+#include "base/process/launch.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_util.h"
 #include "base/strings/stringprintf.h"
diff --git a/chrome/test/chromedriver/server/http_response.cc b/chrome/test/chromedriver/server/http_response.cc
index 8138200..7705b4e 100644
--- a/chrome/test/chromedriver/server/http_response.cc
+++ b/chrome/test/chromedriver/server/http_response.cc
@@ -122,7 +122,7 @@
   std::string length;
   if (!GetHeader(kContentLengthHeader, &length)) {
     *data += base::StringPrintf(
-        "%s:%"PRIuS"\r\n",
+        "%s:%" PRIuS "\r\n",
         kContentLengthHeader, body_.length());
   }
   *data += "\r\n";
diff --git a/chrome/test/functional/ispy/ispy_core/tests/rendering_test_manager/cloud_bucket.py b/chrome/test/functional/ispy/ispy_core/tests/rendering_test_manager/cloud_bucket.py
index 5d93563..a6e4981 100644
--- a/chrome/test/functional/ispy/ispy_core/tests/rendering_test_manager/cloud_bucket.py
+++ b/chrome/test/functional/ispy/ispy_core/tests/rendering_test_manager/cloud_bucket.py
@@ -37,6 +37,25 @@
     """
     raise NotImplementedError
 
+  def RemoveFile(self, path):
+    """Removes a file from GCS.
+
+    Args:
+      path: the location in GCS to download the file from.
+    """
+    raise NotImplementedError
+
+  def FileExists(self, path):
+    """Checks if a file exists in GCS.
+
+    Args:
+      path: the location in GCS of the file.
+
+    Returns:
+      boolean representing whether the file exists in GCS.
+    """
+    raise NotImplementedError
+
   def GetURL(self, path):
     """Gets a URL to an item in GCS from its path.
 
diff --git a/chrome/test/functional/ispy/ispy_core/tests/rendering_test_manager/cloud_bucket_impl.py b/chrome/test/functional/ispy/ispy_core/tests/rendering_test_manager/cloud_bucket_impl.py
index aade092..e28fc7f 100644
--- a/chrome/test/functional/ispy/ispy_core/tests/rendering_test_manager/cloud_bucket_impl.py
+++ b/chrome/test/functional/ispy/ispy_core/tests/rendering_test_manager/cloud_bucket_impl.py
@@ -47,6 +47,18 @@
       raise cloud_bucket.FileNotFoundError
 
   # override
+  def RemoveFile(self, path):
+    key = boto.gs.key.Key(self.bucket)
+    key.key = path
+    key.delete()
+
+  # override
+  def FileExists(self, path):
+    key = boto.gs.key.Key(self.bucket)
+    key.key = path
+    return key.exists()
+
+  # override
   def GetURL(self, path):
     key = boto.gs.key.Key(self.bucket)
     key.key = path
diff --git a/chrome/test/functional/ispy/ispy_core/tests/rendering_test_manager/mock_cloud_bucket.py b/chrome/test/functional/ispy/ispy_core/tests/rendering_test_manager/mock_cloud_bucket.py
index bca05b7..7ae1def 100644
--- a/chrome/test/functional/ispy/ispy_core/tests/rendering_test_manager/mock_cloud_bucket.py
+++ b/chrome/test/functional/ispy/ispy_core/tests/rendering_test_manager/mock_cloud_bucket.py
@@ -34,6 +34,15 @@
       raise cloud_bucket.FileNotFoundError
 
   # override
+  def RemoveFile(self, path):
+    if self.datastore.has_key(path):
+      self.datastore.pop(path)
+
+  # override
+  def FileExists(self, path):
+    return self.datastore.has_key(path)
+
+  # override
   def GetURL(self, path):
     if self.datastore.has_key(path):
       return path
diff --git a/chrome/test/functional/ispy/ispy_core/tools/rendering_test_manager.py b/chrome/test/functional/ispy/ispy_core/tools/rendering_test_manager.py
index 178076a..9fd584c 100644
--- a/chrome/test/functional/ispy/ispy_core/tools/rendering_test_manager.py
+++ b/chrome/test/functional/ispy/ispy_core/tools/rendering_test_manager.py
@@ -7,6 +7,7 @@
 from tools import image_tools
 import collections
 import posixpath
+import itertools
 
 
 class RenderingTestManager(object):
@@ -77,7 +78,7 @@
     """
     path = posixpath.join('failures', test_name, run_name)
     test = self.GetTest(test_name)
-    if not image_tools.SameImage(actual, test['expected']):
+    if not image_tools.SameImage(actual, test.expected):
       self.UploadImage(posixpath.join(path, 'actual.png'), actual)
 
   def GetTest(self, test_name):
@@ -97,6 +98,62 @@
     return Test(self.DownloadImage(posixpath.join(path, 'expected.png')),
                 self.DownloadImage(posixpath.join(path, 'mask.png')))
 
+  def TestExists(self, test_name):
+    """Returns whether the given test exists in GCS.
+
+    Args:
+      test_name: the name of the test to look for.
+
+    Returns:
+      A boolean indicating whether the test exists.
+    """
+    path = posixpath.join('tests', test_name)
+    expected_image_exists = self.cloud_bucket.FileExists(
+        posixpath.join(path, 'expected.png'))
+    mask_image_exists = self.cloud_bucket.FileExists(
+        posixpath.join(path, 'mask.png'))
+    return expected_image_exists and mask_image_exists
+
+  def FailureExists(self, test_name, run_name):
+    """Returns whether the given run exists in GCS.
+
+    Args:
+      test_name: the name of the test that failed.
+      run_name: the name of the run that the given test failed on.
+
+    Returns:
+      A boolean indicating whether the failure exists.
+    """
+    failure_path = posixpath.join('failures', test_name, run_name)
+    actual_image_exists = self.cloud_bucket.FileExists(
+        posixpath.join(failure_path, 'actual.png'))
+    return self.TestExists(test_name) and actual_image_exists
+
+  def RemoveTest(self, test_name):
+    """Removes a Test from GCS, and all associated failures with that test.
+
+    Args:
+      test_name: the name of the test to remove.
+    """
+    test_path = posixpath.join('tests', test_name)
+    failure_path = posixpath.join('failures', test_name)
+    test_paths = self.cloud_bucket.GetAllPaths(test_path)
+    failure_paths = self.cloud_bucket.GetAllPaths(failure_path)
+    for path in itertools.chain(failure_paths, test_paths):
+      self.cloud_bucket.RemoveFile(path)
+
+  def RemoveFailure(self, test_name, run_name):
+    """Removes a failure from GCS.
+
+    Args:
+      test_name: the test on which the failure to be removed occured.
+      run_name: the name of the run on the given test that failed.
+    """
+    failure_path = posixpath.join('failures', test_name, run_name)
+    failure_paths = self.cloud_bucket.GetAllPaths(failure_path)
+    for path in failure_paths:
+      self.cloud_bucket.RemoveFile(path)
+
   def GetFailure(self, test_name, run_name):
     """Returns a given test failure's expected, diff, and actual images.
 
diff --git a/chrome/test/functional/ispy/ispy_core/tools/rendering_test_manager_unittest.py b/chrome/test/functional/ispy/ispy_core/tools/rendering_test_manager_unittest.py
index d3e7b83..843ab38 100644
--- a/chrome/test/functional/ispy/ispy_core/tools/rendering_test_manager_unittest.py
+++ b/chrome/test/functional/ispy/ispy_core/tools/rendering_test_manager_unittest.py
@@ -110,6 +110,47 @@
     self.assertRaises(
         cloud_bucket.FileNotFoundError, self.manager.GetTest, 'test3')
 
+  def testTestExists(self):
+    self.bucket.Reset()
+    self.manager.UploadTest('test1', [self.white, self.black])
+    self.manager.UploadTest('test2', [self.white, self.black])
+    self.assertTrue(self.manager.TestExists('test1'))
+    self.assertTrue(self.manager.TestExists('test2'))
+    self.assertFalse(self.manager.TestExists('test3'))
+
+  def testFailureExists(self):
+    self.bucket.Reset()
+    self.manager.UploadTest('test1', [self.white, self.white])
+    self.manager.RunTest('test1', 'run1', self.black)
+    self.manager.RunTest('test1', 'run2', self.white)
+    self.assertTrue(self.manager.FailureExists('test1', 'run1'))
+    self.assertFalse(self.manager.FailureExists('test1', 'run2'))
+
+  def testRemoveTest(self):
+    self.bucket.Reset()
+    self.manager.UploadTest('test1', [self.white, self.white])
+    self.manager.UploadTest('test2', [self.white, self.white])
+    self.assertTrue(self.manager.TestExists('test1'))
+    self.assertTrue(self.manager.TestExists('test2'))
+    self.manager.RemoveTest('test1')
+    self.assertFalse(self.manager.TestExists('test1'))
+    self.assertTrue(self.manager.TestExists('test2'))
+    self.manager.RemoveTest('test2')
+    self.assertFalse(self.manager.TestExists('test1'))
+    self.assertFalse(self.manager.TestExists('test2'))
+
+  def testRemoveFailure(self):
+    self.bucket.Reset()
+    self.manager.UploadTest('test1', [self.white, self.white])
+    self.manager.UploadTest('test2', [self.white, self.white])
+    self.manager.RunTest('test1', 'run1', self.black)
+    self.manager.RunTest('test1', 'run2', self.black)
+    self.manager.RemoveFailure('test1', 'run1')
+    self.assertFalse(self.manager.FailureExists('test1', 'run1'))
+    self.assertTrue(self.manager.TestExists('test1'))
+    self.assertTrue(self.manager.FailureExists('test1', 'run2'))
+    self.assertTrue(self.manager.TestExists('test2'))
+
   def testGetFailure(self):
     self.bucket.Reset()
     # Upload a result
diff --git a/chrome/test/gpu/webgl_infobar_browsertest.cc b/chrome/test/gpu/webgl_infobar_browsertest.cc
index e39cb14..41807a5 100644
--- a/chrome/test/gpu/webgl_infobar_browsertest.cc
+++ b/chrome/test/gpu/webgl_infobar_browsertest.cc
@@ -120,15 +120,14 @@
   infobar_added.Wait();
   InfoBarService* infobar_service = InfoBarService::FromWebContents(
       browser()->tab_strip_model()->GetActiveWebContents());
-  EXPECT_EQ(1u, infobar_service->infobar_count());
+  ASSERT_EQ(1u, infobar_service->infobar_count());
   InfoBarDelegate* delegate = infobar_service->infobar_at(0);
-  ASSERT_TRUE(delegate);
   ASSERT_TRUE(delegate->AsThreeDAPIInfoBarDelegate());
   delegate->AsConfirmInfoBarDelegate()->Cancel();
 
   // The page should reload and another message sent to the
   // DomAutomationController.
-  m = "";
+  m.clear();
   ASSERT_TRUE(message_queue.WaitForMessage(&m));
   EXPECT_EQ("\"LOADED\"", m);
 }
diff --git a/chrome/test/mini_installer_test/installer_path_provider.cc b/chrome/test/mini_installer_test/installer_path_provider.cc
index 5974661..6602cab 100644
--- a/chrome/test/mini_installer_test/installer_path_provider.cc
+++ b/chrome/test/mini_installer_test/installer_path_provider.cc
@@ -10,7 +10,6 @@
 #include "base/file_util.h"
 #include "base/files/file_enumerator.h"
 #include "base/path_service.h"
-#include "base/process_util.h"
 #include "base/strings/string_util.h"
 #include "base/strings/stringprintf.h"
 #include "chrome/test/mini_installer_test/installer_test_util.h"
diff --git a/chrome/test/mini_installer_test/installer_test_util.cc b/chrome/test/mini_installer_test/installer_test_util.cc
index 9496c88..1001971 100644
--- a/chrome/test/mini_installer_test/installer_test_util.cc
+++ b/chrome/test/mini_installer_test/installer_test_util.cc
@@ -6,8 +6,9 @@
 
 #include "base/file_util.h"
 #include "base/path_service.h"
-#include "base/process.h"
-#include "base/process_util.h"
+#include "base/process/kill.h"
+#include "base/process/launch.h"
+#include "base/process/process.h"
 #include "base/strings/string_util.h"
 #include "base/threading/platform_thread.h"
 #include "chrome/common/chrome_result_codes.h"
diff --git a/chrome/test/mini_installer_test/run_all_unittests.cc b/chrome/test/mini_installer_test/run_all_unittests.cc
index a571a76..c9e930a 100644
--- a/chrome/test/mini_installer_test/run_all_unittests.cc
+++ b/chrome/test/mini_installer_test/run_all_unittests.cc
@@ -4,7 +4,7 @@
 
 #include "base/command_line.h"
 #include "base/file_util.h"
-#include "base/process_util.h"
+#include "base/process/process_iterator.h"
 #include "base/test/test_suite.h"
 #include "base/win/windows_version.h"
 #include "chrome/common/chrome_switches.h"
diff --git a/chrome/test/mini_installer_test/test.cc b/chrome/test/mini_installer_test/test.cc
index 2c693f8..979d3d5 100644
--- a/chrome/test/mini_installer_test/test.cc
+++ b/chrome/test/mini_installer_test/test.cc
@@ -5,7 +5,7 @@
 #include "base/command_line.h"
 #include "base/files/file_path.h"
 #include "base/memory/scoped_ptr.h"
-#include "base/process_util.h"
+#include "base/process/kill.h"
 #include "base/strings/string_util.h"
 #include "chrome/common/chrome_result_codes.h"
 #include "chrome/common/chrome_switches.h"
diff --git a/chrome/test/perf/browser_perf_test.cc b/chrome/test/perf/browser_perf_test.cc
index 30d54a8..bd1ddf7 100644
--- a/chrome/test/perf/browser_perf_test.cc
+++ b/chrome/test/perf/browser_perf_test.cc
@@ -5,7 +5,6 @@
 #include "chrome/test/perf/browser_perf_test.h"
 
 #include "base/command_line.h"
-#include "base/process_util.h"
 #include "chrome/common/chrome_switches.h"
 #include "chrome/test/base/chrome_process_util.h"
 #include "chrome/test/perf/perf_test.h"
diff --git a/chrome/test/perf/generate_profile.cc b/chrome/test/perf/generate_profile.cc
index d37060a..d3484b5 100644
--- a/chrome/test/perf/generate_profile.cc
+++ b/chrome/test/perf/generate_profile.cc
@@ -13,7 +13,6 @@
 #include "base/logging.h"
 #include "base/message_loop/message_loop.h"
 #include "base/path_service.h"
-#include "base/process_util.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/time/time.h"
@@ -192,8 +191,6 @@
                              transition, history::SOURCE_BROWSED, true);
     ThumbnailScore score(0.75, false, false);
     history_service->SetPageTitle(url, ConstructRandomTitle());
-    if (types & FULL_TEXT)
-      history_service->SetPageContents(url, ConstructRandomPage());
     if (types & TOP_SITES && top_sites) {
       top_sites->SetPageThumbnailToJPEGBytes(
           url,
@@ -229,7 +226,10 @@
   content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop);
   content::TestBrowserThread db_thread(BrowserThread::DB, &message_loop);
   TestingProfile profile;
-  profile.CreateHistoryService(false, false);
+  if (!profile.CreateHistoryService(false, false)) {
+      PLOG(ERROR) << "Creating history service failed";
+      return false;
+  }
   if (types & TOP_SITES) {
     profile.CreateTopSites();
     profile.BlockUntilTopSitesLoaded();
diff --git a/chrome/test/perf/generate_profile.h b/chrome/test/perf/generate_profile.h
index 85a2858..fe1cfbf 100644
--- a/chrome/test/perf/generate_profile.h
+++ b/chrome/test/perf/generate_profile.h
@@ -14,8 +14,7 @@
 // Addition types data can be generated for. By default only urls/visits are
 // added.
 enum GenerateProfileTypes {
-  TOP_SITES = 1 << 0,
-  FULL_TEXT = 1 << 1
+  TOP_SITES = 1 << 0
 };
 
 // Generates a user profile and history by psuedo-randomly generating data and
diff --git a/chrome/test/perf/memory_test.cc b/chrome/test/perf/memory_test.cc
index b4a1160..3812044 100644
--- a/chrome/test/perf/memory_test.cc
+++ b/chrome/test/perf/memory_test.cc
@@ -7,7 +7,6 @@
 #include "base/file_util.h"
 #include "base/files/file_path.h"
 #include "base/path_service.h"
-#include "base/process_util.h"
 #include "base/strings/string_util.h"
 #include "base/threading/platform_thread.h"
 #include "base/threading/thread_restrictions.h"
diff --git a/chrome/test/reliability/page_load_test.cc b/chrome/test/reliability/page_load_test.cc
index ddbf6eb..9f32162 100644
--- a/chrome/test/reliability/page_load_test.cc
+++ b/chrome/test/reliability/page_load_test.cc
@@ -49,6 +49,7 @@
 #include "base/prefs/json_pref_store.h"
 #include "base/prefs/pref_registry_simple.h"
 #include "base/prefs/pref_service.h"
+#include "base/process/kill.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_util.h"
 #include "base/test/test_file_util.h"
diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc
index f79307e..6d55efa 100644
--- a/chrome/test/ui/ui_test.cc
+++ b/chrome/test/ui/ui_test.cc
@@ -24,7 +24,6 @@
 #include "base/logging.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/path_service.h"
-#include "base/process_util.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_split.h"
 #include "base/strings/utf_string_conversions.h"
diff --git a/chrome/test/ui/ui_test.h b/chrome/test/ui/ui_test.h
index 6382aec..b364116 100644
--- a/chrome/test/ui/ui_test.h
+++ b/chrome/test/ui/ui_test.h
@@ -22,7 +22,7 @@
 #include "base/command_line.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/message_loop/message_loop.h"
-#include "base/process.h"
+#include "base/process/process.h"
 #include "base/time/time.h"
 #include "chrome/test/automation/proxy_launcher.h"
 #include "testing/platform_test.h"
diff --git a/chrome/test/ui/ui_test_suite.cc b/chrome/test/ui/ui_test_suite.cc
index 164f0d4..690a368 100644
--- a/chrome/test/ui/ui_test_suite.cc
+++ b/chrome/test/ui/ui_test_suite.cc
@@ -11,7 +11,9 @@
 #include "base/logging.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/path_service.h"
-#include "base/process_util.h"
+#include "base/process/kill.h"
+#include "base/process/launch.h"
+#include "base/process/process_iterator.h"
 #include "chrome/common/chrome_switches.h"
 #include "chrome/common/env_vars.h"
 
diff --git a/chrome/test/ui/ui_test_suite.h b/chrome/test/ui/ui_test_suite.h
index 48d6a71..e93de67 100644
--- a/chrome/test/ui/ui_test_suite.h
+++ b/chrome/test/ui/ui_test_suite.h
@@ -5,7 +5,7 @@
 #ifndef CHROME_TEST_UI_UI_TEST_SUITE_H_
 #define CHROME_TEST_UI_UI_TEST_SUITE_H_
 
-#include "base/process.h"
+#include "base/process/process.h"
 #include "chrome/test/base/chrome_test_suite.h"
 
 #if defined(OS_WIN)
diff --git a/chrome/test/webdriver/http_response.cc b/chrome/test/webdriver/http_response.cc
index d89795e..d339368 100644
--- a/chrome/test/webdriver/http_response.cc
+++ b/chrome/test/webdriver/http_response.cc
@@ -124,8 +124,7 @@
   std::string length;
   if (!GetHeader(kContentLengthHeader, &length)) {
     *data += base::StringPrintf(
-        "%s:%"PRIuS"\r\n",
-        kContentLengthHeader, body_.length());
+        "%s:%" PRIuS "\r\n", kContentLengthHeader, body_.length());
   }
   *data += "\r\n";
 
diff --git a/chrome/test/webdriver/webdriver_session.cc b/chrome/test/webdriver/webdriver_session.cc
index 61ddee8..2675259 100644
--- a/chrome/test/webdriver/webdriver_session.cc
+++ b/chrome/test/webdriver/webdriver_session.cc
@@ -16,8 +16,7 @@
 #include "base/json/json_writer.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/message_loop/message_loop_proxy.h"
-#include "base/process.h"
-#include "base/process_util.h"
+#include "base/process/process.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_split.h"
 #include "base/strings/string_util.h"
diff --git a/chrome/utility/local_discovery/service_discovery_message_handler.cc b/chrome/utility/local_discovery/service_discovery_message_handler.cc
index afb39f5..7591864 100644
--- a/chrome/utility/local_discovery/service_discovery_message_handler.cc
+++ b/chrome/utility/local_discovery/service_discovery_message_handler.cc
@@ -4,6 +4,8 @@
 
 #include "chrome/utility/local_discovery/service_discovery_message_handler.h"
 
+#include <algorithm>
+
 #include "base/command_line.h"
 #include "chrome/common/local_discovery/local_discovery_messages.h"
 #include "chrome/utility/local_discovery/service_discovery_client_impl.h"
@@ -72,6 +74,7 @@
   SOCKET socket_v4_;
   SOCKET socket_v6_;
 
+ private:
   DISALLOW_COPY_AND_ASSIGN(SocketFactory);
 };
 
@@ -131,6 +134,12 @@
       new LocalDiscoveryHostMsg_WatcherCallback(id, update, name));
 }
 
+void SendLocalDomainResolved(uint64 id, bool success,
+                             const net::IPAddressNumber& address) {
+  content::UtilityThread::Get()->Send(
+      new LocalDiscoveryHostMsg_LocalDomainResolverCallback(
+          id, success, address));
+}
 
 }  // namespace
 
@@ -187,6 +196,10 @@
     IPC_MESSAGE_HANDLER(LocalDiscoveryMsg_DestroyWatcher, OnDestroyWatcher)
     IPC_MESSAGE_HANDLER(LocalDiscoveryMsg_ResolveService, OnResolveService)
     IPC_MESSAGE_HANDLER(LocalDiscoveryMsg_DestroyResolver, OnDestroyResolver)
+    IPC_MESSAGE_HANDLER(LocalDiscoveryMsg_ResolveLocalDomain,
+                        OnResolveLocalDomain)
+    IPC_MESSAGE_HANDLER(LocalDiscoveryMsg_DestroyLocalDomainResolver,
+                        OnDestroyLocalDomainResolver)
     IPC_MESSAGE_UNHANDLED(handled = false)
   IPC_END_MESSAGE_MAP()
   return handled;
@@ -235,6 +248,21 @@
                       base::Unretained(this), id));
 }
 
+void ServiceDiscoveryMessageHandler::OnResolveLocalDomain(
+    uint64 id, const std::string& domain,
+    net::AddressFamily address_family) {
+    PostTask(FROM_HERE,
+           base::Bind(&ServiceDiscoveryMessageHandler::ResolveLocalDomain,
+                      base::Unretained(this), id, domain, address_family));
+}
+
+void ServiceDiscoveryMessageHandler::OnDestroyLocalDomainResolver(uint64 id) {
+  PostTask(FROM_HERE,
+           base::Bind(
+               &ServiceDiscoveryMessageHandler::DestroyLocalDomainResolver,
+               base::Unretained(this), id));
+}
+
 void ServiceDiscoveryMessageHandler::StartWatcher(
     uint64 id,
     const std::string& service_type) {
@@ -287,6 +315,29 @@
   service_resolvers_.erase(id);
 }
 
+void ServiceDiscoveryMessageHandler::ResolveLocalDomain(
+    uint64 id,
+    const std::string& domain,
+    net::AddressFamily address_family) {
+  if (!service_discovery_client_)
+    return;
+  DCHECK(!ContainsKey(local_domain_resolvers_, id));
+  scoped_ptr<LocalDomainResolver> resolver(
+      service_discovery_client_->CreateLocalDomainResolver(
+          domain, address_family,
+          base::Bind(&ServiceDiscoveryMessageHandler::OnLocalDomainResolved,
+                     base::Unretained(this), id)));
+  resolver->Start();
+  local_domain_resolvers_[id].reset(resolver.release());
+}
+
+void ServiceDiscoveryMessageHandler::DestroyLocalDomainResolver(uint64 id) {
+  if (!service_discovery_client_)
+    return;
+  DCHECK(ContainsKey(local_domain_resolvers_, id));
+  local_domain_resolvers_.erase(id);
+}
+
 void ServiceDiscoveryMessageHandler::OnServiceUpdated(
     uint64 id,
     ServiceWatcher::UpdateType update,
@@ -305,5 +356,14 @@
       base::Bind(&SendServiceResolved, id, status, description));
 }
 
-}  // namespace local_discovery
+void ServiceDiscoveryMessageHandler::OnLocalDomainResolved(
+    uint64 id,
+    bool success,
+    const net::IPAddressNumber& address) {
+  DCHECK(service_discovery_client_);
+  utility_task_runner_->PostTask(FROM_HERE, base::Bind(&SendLocalDomainResolved,
+                                                       id, success, address));
+}
 
+
+}  // namespace local_discovery
diff --git a/chrome/utility/local_discovery/service_discovery_message_handler.h b/chrome/utility/local_discovery/service_discovery_message_handler.h
index 384d1ae..7537f5a 100644
--- a/chrome/utility/local_discovery/service_discovery_message_handler.h
+++ b/chrome/utility/local_discovery/service_discovery_message_handler.h
@@ -6,6 +6,7 @@
 #define CHROME_UTILITY_LOCAL_DISCOVERY_SERVICE_DISCOVERY_MESSAGE_HANDLER_H_
 
 #include <map>
+#include <string>
 
 #include "base/memory/linked_ptr.h"
 #include "chrome/common/local_discovery/service_discovery_client.h"
@@ -42,6 +43,8 @@
  private:
   typedef std::map<uint64, linked_ptr<ServiceWatcher> > ServiceWatchers;
   typedef std::map<uint64, linked_ptr<ServiceResolver> > ServiceResolvers;
+  typedef std::map<uint64, linked_ptr<LocalDomainResolver> >
+      LocalDomainResolvers;
 
   // Lazy initializes ServiceDiscoveryClient.
   bool InitializeThread();
@@ -54,6 +57,9 @@
   void OnDestroyWatcher(uint64 id);
   void OnResolveService(uint64 id, const std::string& service_name);
   void OnDestroyResolver(uint64 id);
+  void OnResolveLocalDomain(uint64 id, const std::string& domain,
+                            net::AddressFamily address_family);
+  void OnDestroyLocalDomainResolver(uint64 id);
 
   void InitializeMdns();
   void StartWatcher(uint64 id, const std::string& service_type);
@@ -61,6 +67,9 @@
   void DestroyWatcher(uint64 id);
   void ResolveService(uint64 id, const std::string& service_name);
   void DestroyResolver(uint64 id);
+  void ResolveLocalDomain(uint64 id, const std::string& domain,
+                          net::AddressFamily address_family);
+  void DestroyLocalDomainResolver(uint64 id);
 
   // Is called by ServiceWatcher as callback.
   void OnServiceUpdated(uint64 id,
@@ -72,8 +81,14 @@
                          ServiceResolver::RequestStatus status,
                          const ServiceDescription& description);
 
+  // Is called by LocalDomainResolver as callback.
+  void OnLocalDomainResolved(uint64 id,
+                             bool success,
+                             const net::IPAddressNumber& address);
+
   ServiceWatchers service_watchers_;
   ServiceResolvers service_resolvers_;
+  LocalDomainResolvers local_domain_resolvers_;
 
   scoped_ptr<net::MDnsClient> mdns_client_;
   scoped_ptr<ServiceDiscoveryClient> service_discovery_client_;
@@ -86,4 +101,3 @@
 }  // namespace local_discovery
 
 #endif  // CHROME_UTILITY_LOCAL_DISCOVERY_SERVICE_DISCOVERY_MESSAGE_HANDLER_H_
-
diff --git a/chrome_frame/resource.h b/chrome_frame/resource.h
index 53f51a5..8b4d686 100644
--- a/chrome_frame/resource.h
+++ b/chrome_frame/resource.h
@@ -8,7 +8,7 @@
 // Used by resources/tlb_resource.rc
 
 // Default values for new objects
-// 
+//
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_NEXT_RESOURCE_VALUE        204
diff --git a/chrome_frame/resources/chrome_frame_resources.grd b/chrome_frame/resources/chrome_frame_resources.grd
index e9e1bc4..8bc5584 100644
--- a/chrome_frame/resources/chrome_frame_resources.grd
+++ b/chrome_frame/resources/chrome_frame_resources.grd
@@ -1,13 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
-<!-- 
+<!--
 Copyright (c) 2010 The Chromium Authors. All rights reserved.  Use of this
 source code is governed by a BSD-style license that can be found in the LICENSE
 file.
 -->
 
 <!--
-Embeded strings, branding resource, etc. See chrome_frame_strings.grd 
+Embeded strings, branding resource, etc. See chrome_frame_strings.grd
 for localizable strings
 -->
 
@@ -39,6 +39,7 @@
       <if expr="not pp_ifdef('_google_chrome')">
         <include name="IDI_CHROME_FRAME_ICON" file="../../chrome/app/theme/chromium/chromium.ico" type="ICON" />
       </if>
+      <include name="IDB_TURNDOWN_PROMPT_CLOSE_BUTTON" file="../../chrome/app/theme/default_100_percent/common/cf_close_strip.bmp" type="BITMAP" />
     </includes>
   </release>
 </grit>
diff --git a/chrome_frame/turndown_prompt/turndown_prompt_window.cc b/chrome_frame/turndown_prompt/turndown_prompt_window.cc
index 851f1c0..17321e0 100644
--- a/chrome_frame/turndown_prompt/turndown_prompt_window.cc
+++ b/chrome_frame/turndown_prompt/turndown_prompt_window.cc
@@ -13,6 +13,7 @@
 #include "chrome_frame/simple_resource_loader.h"
 #include "chrome_frame/utils.h"
 #include "grit/chrome_frame_dialogs.h"
+#include "grit/chrome_frame_resources.h"
 #include "grit/chromium_strings.h"
 
 // atlctrlx.h requires 'min' and 'max' macros, the definition of which conflicts
@@ -22,6 +23,35 @@
 #include <minmax.h>  // NOLINT
 #include <atlctrlx.h>  // NOLINT
 
+namespace {
+const uint32 kBitmapImageSize = 18;
+}  // namespace
+
+// WTL's CBitmapButton's drawing code is horribly broken when using transparent
+// images (specifically, it doesn't clear the background between redraws).
+// Fix it here.
+class CFBitmapButton: public CBitmapButtonImpl<CFBitmapButton>
+{
+ public:
+  DECLARE_WND_SUPERCLASS(_T("WTL_BitmapButton"), GetWndClassName())
+
+  CFBitmapButton()
+      : CBitmapButtonImpl<CFBitmapButton>(BMPBTN_AUTOSIZE | BMPBTN_HOVER,
+                                          NULL) {}
+
+  // "Overridden" from CBitmapButtonImpl via template hackery. See
+  // CBitmapButtonImpl::OnPaint() in atlctrlx.h for details.
+  void DoPaint(CDCHandle dc) {
+    RECT rc = {0};
+    GetClientRect(&rc);
+    dc.FillRect(&rc, reinterpret_cast<HBRUSH>(COLOR_BTNFACE + 1));
+
+    // Call original implementation.
+    CBitmapButtonImpl<CFBitmapButton>::DoPaint(dc);
+  }
+};
+
+// static
 base::WeakPtr<TurndownPromptWindow> TurndownPromptWindow::CreateInstance(
     InfobarContent::Frame* frame,
     UrlLauncher* url_launcher,
@@ -48,6 +78,8 @@
   instance->link_->SetHyperLinkExtendedStyle(HLINK_NOTIFYBUTTON,
                                              HLINK_NOTIFYBUTTON);
 
+  SetupBitmapButton(instance.get());
+
   // Substitute the proper text given the current IE version.
   CWindow text = instance->GetDlgItem(IDC_TD_PROMPT_MESSAGE);
   string16 prompt_text(GetPromptText());
@@ -69,11 +101,62 @@
 
 TurndownPromptWindow::~TurndownPromptWindow() {}
 
+// static
+void TurndownPromptWindow::SetupBitmapButton(TurndownPromptWindow* instance) {
+  DCHECK(instance);
+  CWindow close_window = instance->GetDlgItem(IDDISMISS);
+  instance->close_button_.reset(new CFBitmapButton());
+
+  // Set the resource instance to the current dll which contains the bitmap.
+  HINSTANCE old_res_module = _AtlBaseModule.GetResourceInstance();
+  HINSTANCE this_module = _AtlBaseModule.GetModuleInstance();
+  _AtlBaseModule.SetResourceInstance(this_module);
+
+  HBITMAP close_bitmap = static_cast<HBITMAP>(
+      LoadImage(this_module, MAKEINTRESOURCE(IDB_TURNDOWN_PROMPT_CLOSE_BUTTON),
+                IMAGE_BITMAP, 0, 0, 0));
+
+  // Restore the module's resource instance.
+  _AtlBaseModule.SetResourceInstance(old_res_module);
+
+  // Create the image list with the appropriate size and colour mask.
+  instance->close_button_->m_ImageList.Create(kBitmapImageSize,
+                                              kBitmapImageSize,
+                                              ILC_COLOR8 | ILC_MASK, 4, 0);
+  instance->close_button_->m_ImageList.Add(close_bitmap, RGB(255, 0, 255));
+  instance->close_button_->m_ImageList.SetBkColor(CLR_NONE);
+
+  // Free up the original bitmap.
+  DeleteObject(close_bitmap);
+
+  // Configure the button states and initialize the button.
+  instance->close_button_->SetImages(0, 1, 2, 3);
+  instance->close_button_->SubclassWindow(close_window);
+
+  // The CDialogResize() implementation incorrectly captures the size
+  // of the bitmap image button. Reset it here to ensure that resizing works
+  // as desired.
+
+  // Find the resize data. The parameters here must match the resize map in
+  // turndown_prompt_window.h.
+  _AtlDlgResizeData resize_params = { IDDISMISS, DLSZ_CENTER_Y | DLSZ_MOVE_X };
+  int resize_index = instance->m_arrData.Find(resize_params);
+  DCHECK(resize_index > -1 && resize_index < instance->m_arrData.GetSize());
+
+  // Fiddle CDialogResize's internal data to fix up the size for the image
+  // control.
+  _AtlDlgResizeData& resize_data = instance->m_arrData[resize_index];
+  resize_data.m_rect.right = resize_data.m_rect.left + kBitmapImageSize;
+  resize_data.m_rect.top = 0;
+  resize_data.m_rect.bottom = kBitmapImageSize;
+}
+
 void TurndownPromptWindow::OnFinalMessage(HWND) {
   delete this;
 }
 
 void TurndownPromptWindow::OnDestroy() {
+  close_button_->m_ImageList.Destroy();
   frame_ = NULL;
 }
 
diff --git a/chrome_frame/turndown_prompt/turndown_prompt_window.h b/chrome_frame/turndown_prompt/turndown_prompt_window.h
index 626fca6..342e38a 100644
--- a/chrome_frame/turndown_prompt/turndown_prompt_window.h
+++ b/chrome_frame/turndown_prompt/turndown_prompt_window.h
@@ -28,8 +28,11 @@
 
 namespace WTL {
 class CHyperLink;
+class CBitmapButton;
 }  // namespace WTL
 
+class CFBitmapButton;
+
 // Implements a dialog with text and buttons notifying the user that Chrome
 // Frame is being turned down, offering them a link to learn more about moving
 // to a modern browser.
@@ -68,8 +71,8 @@
   BEGIN_DLGRESIZE_MAP(InfobarWindow)
     DLGRESIZE_CONTROL(IDDISMISS, DLSZ_CENTER_Y | DLSZ_MOVE_X)
     DLGRESIZE_CONTROL(IDUNINSTALL, DLSZ_CENTER_Y | DLSZ_MOVE_X)
-    DLGRESIZE_CONTROL(IDC_TD_PROMPT_MESSAGE, DLSZ_SIZE_Y | DLSZ_SIZE_X)
     DLGRESIZE_CONTROL(IDC_TD_PROMPT_LINK, DLSZ_CENTER_Y | DLSZ_MOVE_X)
+    DLGRESIZE_CONTROL(IDC_TD_PROMPT_MESSAGE, DLSZ_SIZE_Y | DLSZ_SIZE_X)
   END_DLGRESIZE_MAP()
 
   virtual void OnFinalMessage(HWND);
@@ -83,6 +86,9 @@
   // The TurndownPromptWindow manages its own destruction.
   virtual ~TurndownPromptWindow();
 
+  // Performs the necessary configuration to initialize a bitmap button.
+  static void SetupBitmapButton(TurndownPromptWindow* window);
+
   // Event handlers.
   void OnDestroy();
   BOOL OnInitDialog(CWindow wndFocus, LPARAM lInitParam);
@@ -101,6 +107,7 @@
 
   InfobarContent::Frame* frame_;  // Not owned by this instance
   scoped_ptr<WTL::CHyperLink> link_;
+  scoped_ptr<CFBitmapButton> close_button_;
   scoped_ptr<UrlLauncher> url_launcher_;
   base::Closure uninstall_closure_;
 
diff --git a/chromeos/CHROMEOS_LKGM b/chromeos/CHROMEOS_LKGM
index f62c049..d5bc797 100644
--- a/chromeos/CHROMEOS_LKGM
+++ b/chromeos/CHROMEOS_LKGM
@@ -1 +1 @@
-4443.0.0
\ No newline at end of file
+4452.0.0
\ No newline at end of file
diff --git a/chromeos/dbus/cryptohome_client.cc b/chromeos/dbus/cryptohome_client.cc
index 5cf72f8..0a5a7fb 100644
--- a/chromeos/dbus/cryptohome_client.cc
+++ b/chromeos/dbus/cryptohome_client.cc
@@ -152,6 +152,26 @@
   }
 
   // CryptohomeClient override.
+  virtual std::string BlockingGetSanitizedUsername(
+      const std::string& username) OVERRIDE {
+    dbus::MethodCall method_call(cryptohome::kCryptohomeInterface,
+                                 cryptohome::kCryptohomeGetSanitizedUsername);
+    dbus::MessageWriter writer(&method_call);
+    writer.AppendString(username);
+
+    scoped_ptr<dbus::Response> response =
+        blocking_method_caller_.CallMethodAndBlock(&method_call);
+
+    std::string sanitized_username;
+    if (response) {
+      dbus::MessageReader reader(response.get());
+      reader.PopString(&sanitized_username);
+    }
+
+    return sanitized_username;
+  }
+
+  // CryptohomeClient override.
   virtual void AsyncMount(const std::string& username,
                           const std::string& key,
                           int flags,
@@ -882,6 +902,12 @@
   }
 
   // CryptohomeClient override.
+  virtual std::string BlockingGetSanitizedUsername(
+      const std::string& username) OVERRIDE {
+    return GetStubSanitizedUsername(username);
+  }
+
+  // CryptohomeClient override.
   virtual void AsyncMount(const std::string& username,
                           const std::string& key,
                           int flags,
diff --git a/chromeos/dbus/cryptohome_client.h b/chromeos/dbus/cryptohome_client.h
index 3d34ea4..d17c0d7 100644
--- a/chromeos/dbus/cryptohome_client.h
+++ b/chromeos/dbus/cryptohome_client.h
@@ -104,6 +104,15 @@
       const std::string& username,
       const StringDBusMethodCallback& callback) = 0;
 
+  // Same as GetSanitizedUsername() but blocks until a reply is received, and
+  // returns the sanitized username synchronously. Returns an empty string if
+  // the method call fails.
+  // This may only be called in situations where blocking the UI thread is
+  // considered acceptable (e.g. restarting the browser after a crash or after
+  // a flag change).
+  virtual std::string BlockingGetSanitizedUsername(
+      const std::string& username) = 0;
+
   // Calls the AsyncMount method to asynchronously mount the cryptohome for
   // |username|, using |key| to unlock it. For supported |flags|, see the
   // documentation of AsyncMethodCaller::AsyncMount().
diff --git a/chromeos/dbus/fake_cryptohome_client.cc b/chromeos/dbus/fake_cryptohome_client.cc
index 39f0a6f..19bdf36 100644
--- a/chromeos/dbus/fake_cryptohome_client.cc
+++ b/chromeos/dbus/fake_cryptohome_client.cc
@@ -259,6 +259,11 @@
                    username));
 }
 
+std::string FakeCryptohomeClient::BlockingGetSanitizedUsername(
+    const std::string& username) {
+  return username;
+}
+
 void FakeCryptohomeClient::TpmAttestationSignEnterpriseChallenge(
     attestation::AttestationKeyType key_type,
     const std::string& key_name,
diff --git a/chromeos/dbus/fake_cryptohome_client.h b/chromeos/dbus/fake_cryptohome_client.h
index e8ff10c..e840697 100644
--- a/chromeos/dbus/fake_cryptohome_client.h
+++ b/chromeos/dbus/fake_cryptohome_client.h
@@ -38,6 +38,8 @@
   virtual void GetSanitizedUsername(
       const std::string& username,
       const StringDBusMethodCallback& callback) OVERRIDE;
+  virtual std::string BlockingGetSanitizedUsername(
+      const std::string& username) OVERRIDE;
   virtual void AsyncMount(const std::string& username,
                           const std::string& key,
                           int flags,
diff --git a/chromeos/dbus/fake_session_manager_client.cc b/chromeos/dbus/fake_session_manager_client.cc
index ea3d870..37d90da 100644
--- a/chromeos/dbus/fake_session_manager_client.cc
+++ b/chromeos/dbus/fake_session_manager_client.cc
@@ -93,6 +93,11 @@
       FROM_HERE, base::Bind(callback, user_policies_[username]));
 }
 
+std::string FakeSessionManagerClient::BlockingRetrievePolicyForUser(
+    const std::string& username) {
+  return user_policies_[username];
+}
+
 void FakeSessionManagerClient::RetrieveDeviceLocalAccountPolicy(
     const std::string& account_id,
     const RetrievePolicyCallback& callback) {
diff --git a/chromeos/dbus/fake_session_manager_client.h b/chromeos/dbus/fake_session_manager_client.h
index 1acd082..5c8941b 100644
--- a/chromeos/dbus/fake_session_manager_client.h
+++ b/chromeos/dbus/fake_session_manager_client.h
@@ -44,6 +44,8 @@
   virtual void RetrievePolicyForUser(
       const std::string& username,
       const RetrievePolicyCallback& callback) OVERRIDE;
+  virtual std::string BlockingRetrievePolicyForUser(
+      const std::string& username) OVERRIDE;
   virtual void RetrieveDeviceLocalAccountPolicy(
       const std::string& account_id,
       const RetrievePolicyCallback& callback) OVERRIDE;
diff --git a/chromeos/dbus/mock_cryptohome_client.h b/chromeos/dbus/mock_cryptohome_client.h
index d72d3f4..0ba51c2 100644
--- a/chromeos/dbus/mock_cryptohome_client.h
+++ b/chromeos/dbus/mock_cryptohome_client.h
@@ -38,6 +38,8 @@
   MOCK_METHOD2(GetSanitizedUsername,
                void(const std::string& username,
                     const StringDBusMethodCallback& callback));
+  MOCK_METHOD1(BlockingGetSanitizedUsername,
+               std::string(const std::string& username));
   MOCK_METHOD4(AsyncMount, void(const std::string& username,
                                 const std::string& key,
                                 int flags,
diff --git a/chromeos/dbus/mock_session_manager_client.h b/chromeos/dbus/mock_session_manager_client.h
index 1596951..afe8e37 100644
--- a/chromeos/dbus/mock_session_manager_client.h
+++ b/chromeos/dbus/mock_session_manager_client.h
@@ -36,6 +36,7 @@
   MOCK_METHOD2(RetrievePolicyForUser,
                void(const std::string&,
                     const RetrievePolicyCallback&));
+  MOCK_METHOD1(BlockingRetrievePolicyForUser, std::string(const std::string&));
   MOCK_METHOD2(RetrieveDeviceLocalAccountPolicy,
                void(const std::string&,
                     const RetrievePolicyCallback&));
diff --git a/chromeos/dbus/session_manager_client.cc b/chromeos/dbus/session_manager_client.cc
index 39d3773..e842f88 100644
--- a/chromeos/dbus/session_manager_client.cc
+++ b/chromeos/dbus/session_manager_client.cc
@@ -15,6 +15,7 @@
 #include "base/strings/string_util.h"
 #include "base/threading/worker_pool.h"
 #include "chromeos/chromeos_paths.h"
+#include "chromeos/dbus/blocking_method_caller.h"
 #include "chromeos/dbus/cryptohome_client.h"
 #include "dbus/bus.h"
 #include "dbus/message.h"
@@ -28,12 +29,11 @@
 class SessionManagerClientImpl : public SessionManagerClient {
  public:
   explicit SessionManagerClientImpl(dbus::Bus* bus)
-      : session_manager_proxy_(NULL),
+      : session_manager_proxy_(bus->GetObjectProxy(
+            login_manager::kSessionManagerServiceName,
+            dbus::ObjectPath(login_manager::kSessionManagerServicePath))),
+        blocking_method_caller_(bus, session_manager_proxy_),
         weak_ptr_factory_(this) {
-    session_manager_proxy_ = bus->GetObjectProxy(
-        login_manager::kSessionManagerServiceName,
-        dbus::ObjectPath(login_manager::kSessionManagerServicePath));
-
     // Signals emitted on Chromium's interface.  Many of these ought to be
     // method calls instead.
     session_manager_proxy_->ConnectToSignal(
@@ -223,6 +223,22 @@
         callback);
   }
 
+  virtual std::string BlockingRetrievePolicyForUser(
+      const std::string& username) OVERRIDE {
+    dbus::MethodCall method_call(
+        login_manager::kSessionManagerInterface,
+        login_manager::kSessionManagerRetrievePolicyForUser);
+    dbus::MessageWriter writer(&method_call);
+    writer.AppendString(username);
+    scoped_ptr<dbus::Response> response =
+        blocking_method_caller_.CallMethodAndBlock(&method_call);
+    std::string policy;
+    ExtractString(login_manager::kSessionManagerRetrievePolicyForUser,
+                  response.get(),
+                  &policy);
+    return policy;
+  }
+
   virtual void RetrieveDeviceLocalAccountPolicy(
       const std::string& account_name,
       const RetrievePolicyCallback& callback) OVERRIDE {
@@ -400,14 +416,11 @@
     callback.Run(sessions, success);
   }
 
-  // Called when kSessionManagerRetrievePolicy or
-  // kSessionManagerRetrievePolicyForUser method is complete.
-  void OnRetrievePolicy(const std::string& method_name,
-                        const RetrievePolicyCallback& callback,
-                        dbus::Response* response) {
+  void ExtractString(const std::string& method_name,
+                     dbus::Response* response,
+                     std::string* extracted) {
     if (!response) {
       LOG(ERROR) << "Failed to call " << method_name;
-      callback.Run("");
       return;
     }
     dbus::MessageReader reader(response);
@@ -415,11 +428,19 @@
     size_t length = 0;
     if (!reader.PopArrayOfBytes(&values, &length)) {
       LOG(ERROR) << "Invalid response: " << response->ToString();
-      callback.Run("");
       return;
     }
     // static_cast does not work due to signedness.
-    std::string serialized_proto(reinterpret_cast<char*>(values), length);
+    extracted->assign(reinterpret_cast<char*>(values), length);
+  }
+
+  // Called when kSessionManagerRetrievePolicy or
+  // kSessionManagerRetrievePolicyForUser method is complete.
+  void OnRetrievePolicy(const std::string& method_name,
+                        const RetrievePolicyCallback& callback,
+                        dbus::Response* response) {
+    std::string serialized_proto;
+    ExtractString(method_name, response, &serialized_proto);
     callback.Run(serialized_proto);
   }
 
@@ -492,6 +513,7 @@
   }
 
   dbus::ObjectProxy* session_manager_proxy_;
+  BlockingMethodCaller blocking_method_caller_;
   ObserverList<Observer> observers_;
 
   // Note: This should remain the last member so it'll be destroyed and
@@ -559,6 +581,10 @@
       const RetrievePolicyCallback& callback) OVERRIDE {
     callback.Run(user_policies_[username]);
   }
+  virtual std::string BlockingRetrievePolicyForUser(
+      const std::string& username) OVERRIDE {
+    return user_policies_[username];
+  }
   virtual void RetrieveDeviceLocalAccountPolicy(
       const std::string& account_name,
       const RetrievePolicyCallback& callback) OVERRIDE {
diff --git a/chromeos/dbus/session_manager_client.h b/chromeos/dbus/session_manager_client.h
index ca10707..45b9b14 100644
--- a/chromeos/dbus/session_manager_client.h
+++ b/chromeos/dbus/session_manager_client.h
@@ -126,6 +126,15 @@
       const std::string& username,
       const RetrievePolicyCallback& callback) = 0;
 
+  // Same as RetrievePolicyForUser() but blocks until a reply is received, and
+  // returns the policy synchronously. Returns an empty string if the method
+  // call fails.
+  // This may only be called in situations where blocking the UI thread is
+  // considered acceptable (e.g. restarting the browser after a crash or after
+  // a flag change).
+  virtual std::string BlockingRetrievePolicyForUser(
+      const std::string& username) = 0;
+
   // Fetches the policy blob associated with the specified device-local account
   // from session manager.  |callback| is invoked up on completion.
   virtual void RetrieveDeviceLocalAccountPolicy(
diff --git a/chromeos/ime/input_methods.txt b/chromeos/ime/input_methods.txt
index 213ea96..220b322 100644
--- a/chromeos/ime/input_methods.txt
+++ b/chromeos/ime/input_methods.txt
@@ -102,13 +102,6 @@
 xkb:ru::rus	ru	ru
 xkb:ru:phonetic:rus	ru(phonetic)	ru
 
-# Vietnamese
-m17n:vi:vni	us	vi
-# Note: Since Chrome does not support "get surrounding text" feature yet,
-# Vietnames input methods, except 4 input methods above, in m17n-db should
-# not work fine. The 4 input methods in m17n-db (>= 1.6.0) don't require the
-# feature.
-
 # Keyboard layouts.
 xkb:br::por	br	pt-BR
 xkb:bg::bul	bg	bg
diff --git a/chromeos/network/network_device_handler.cc b/chromeos/network/network_device_handler.cc
index 8933003..c480073 100644
--- a/chromeos/network/network_device_handler.cc
+++ b/chromeos/network/network_device_handler.cc
@@ -178,6 +178,18 @@
       base::Bind(&ProposeScanCallback, device_path, callback, error_callback));
 }
 
+void NetworkDeviceHandler::RegisterCellularNetwork(
+    const std::string& device_path,
+    const std::string& network_id,
+    const base::Closure& callback,
+    const network_handler::ErrorCallback& error_callback) {
+  DBusThreadManager::Get()->GetShillDeviceClient()->Register(
+      dbus::ObjectPath(device_path),
+      network_id,
+      callback,
+      base::Bind(&HandleShillCallFailure, device_path, error_callback));
+}
+
 void NetworkDeviceHandler::SetCarrier(
     const std::string& device_path,
     const std::string& carrier,
diff --git a/chromeos/network/network_device_handler.h b/chromeos/network/network_device_handler.h
index 300cbf5..7cb2f52 100644
--- a/chromeos/network/network_device_handler.h
+++ b/chromeos/network/network_device_handler.h
@@ -90,6 +90,18 @@
       const base::Closure& callback,
       const network_handler::ErrorCallback& error_callback);
 
+  // Tells the device specified by |device_path| to register to the cellular
+  // network with id |network_id|. If |network_id| is empty then registration
+  // will proceed in automatic mode, which will cause the modem to register
+  // with the home network.
+  // This call is only available on cellular devices and will fail with
+  // Error.NotSupported on all other technologies.
+  void RegisterCellularNetwork(
+      const std::string& device_path,
+      const std::string& network_id,
+      const base::Closure& callback,
+      const network_handler::ErrorCallback& error_callback);
+
   // Tells the device to set the modem carrier firmware, as specified by
   // |carrier|.
   //
diff --git a/cloud_print/common/win/install_utils.cc b/cloud_print/common/win/install_utils.cc
index ea13714..4190a7b 100644
--- a/cloud_print/common/win/install_utils.cc
+++ b/cloud_print/common/win/install_utils.cc
@@ -11,7 +11,7 @@
 #include "base/file_version_info_win.h"
 #include "base/files/file_path.h"
 #include "base/path_service.h"
-#include "base/process_util.h"
+#include "base/process/launch.h"
 #include "base/win/registry.h"
 
 namespace cloud_print {
diff --git a/cloud_print/gcp20/prototype/cloud_print_requester.cc b/cloud_print/gcp20/prototype/cloud_print_requester.cc
index ded4b47..b0c6169 100644
--- a/cloud_print/gcp20/prototype/cloud_print_requester.cc
+++ b/cloud_print/gcp20/prototype/cloud_print_requester.cc
@@ -18,7 +18,7 @@
 #include "net/url_request/url_request_context_builder.h"
 #include "url/gurl.h"
 
-const char* kCloudPrintUrl = "https://www.google.com/cloudprint";
+const char kCloudPrintUrl[] = "https://www.google.com/cloudprint";
 
 namespace {
 
diff --git a/cloud_print/gcp20/prototype/cloud_print_requester.h b/cloud_print/gcp20/prototype/cloud_print_requester.h
index 369cca7..663ea7b 100644
--- a/cloud_print/gcp20/prototype/cloud_print_requester.h
+++ b/cloud_print/gcp20/prototype/cloud_print_requester.h
@@ -21,7 +21,7 @@
 
 class CloudPrintURLRequestContextGetter;
 
-extern const char* kCloudPrintUrl;
+extern const char kCloudPrintUrl[];
 
 // Class for requesting CloudPrint server and parsing responses.
 class CloudPrintRequester : public base::SupportsWeakPtr<CloudPrintRequester>,
diff --git a/cloud_print/gcp20/prototype/conio_posix.cc b/cloud_print/gcp20/prototype/conio_posix.cc
new file mode 100644
index 0000000..0a955c1
--- /dev/null
+++ b/cloud_print/gcp20/prototype/conio_posix.cc
@@ -0,0 +1,49 @@
+// 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 "cloud_print/gcp20/prototype/conio_posix.h"
+
+#include <stdio.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <termios.h>
+#include <unistd.h>
+
+void SetTemporaryTermiosSettings(bool temporary) {
+  static termios oldt, newt;
+
+  if (temporary) {
+    tcgetattr(STDIN_FILENO, &oldt);
+    newt = oldt;
+    newt.c_lflag &= ~ICANON;  // Disable buffered IO.
+    tcsetattr(STDIN_FILENO, TCSANOW, &newt);
+  } else {
+    tcsetattr(STDIN_FILENO, TCSANOW, &oldt);  // Restore default settings.
+  }
+}
+
+int _kbhit() {
+  SetTemporaryTermiosSettings(true);
+
+  timeval tv;
+  fd_set rdfs;
+
+  tv.tv_sec = 0;
+  tv.tv_usec = 0;
+
+  FD_ZERO(&rdfs);
+  FD_SET(STDIN_FILENO, &rdfs);
+  select(STDIN_FILENO + 1, &rdfs, NULL, NULL, &tv);
+  SetTemporaryTermiosSettings(false);
+
+  return FD_ISSET(STDIN_FILENO, &rdfs);
+}
+
+int _getche() {
+  SetTemporaryTermiosSettings(true);
+  int c = getchar();
+  SetTemporaryTermiosSettings(false);
+  return c;
+}
+
diff --git a/cloud_print/gcp20/prototype/conio_posix.h b/cloud_print/gcp20/prototype/conio_posix.h
new file mode 100644
index 0000000..f8bebea
--- /dev/null
+++ b/cloud_print/gcp20/prototype/conio_posix.h
@@ -0,0 +1,19 @@
+// 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 CLOUD_PRINT_GCP20_PROTOTYPE_CONIO_POSIX_H_
+#define CLOUD_PRINT_GCP20_PROTOTYPE_CONIO_POSIX_H_
+
+// Method for disabling buffered IO.
+// |true| - disable, |false| - restore previous settings.
+void SetTemporaryTermiosSettings(bool temporary);
+
+// Analog from conio.h
+int _kbhit();
+
+// Analog from conio.h
+int _getche();
+
+#endif  // CLOUD_PRINT_GCP20_PROTOTYPE_CONIO_POSIX_H_
+
diff --git a/cloud_print/gcp20/prototype/dns_sd_server.cc b/cloud_print/gcp20/prototype/dns_sd_server.cc
index 38dfb35..8a6653f 100644
--- a/cloud_print/gcp20/prototype/dns_sd_server.cc
+++ b/cloud_print/gcp20/prototype/dns_sd_server.cc
@@ -21,7 +21,7 @@
 
 namespace {
 
-const char* kDefaultIpAddressMulticast = "224.0.0.251";
+const char kDefaultIpAddressMulticast[] = "224.0.0.251";
 const uint16 kDefaultPortMulticast = 5353;
 
 const double kTimeToNextAnnouncement = 0.8;  // relatively to TTL
diff --git a/cloud_print/gcp20/prototype/gcp20_device.gyp b/cloud_print/gcp20/prototype/gcp20_device.gyp
index 795167b..bb83e45 100644
--- a/cloud_print/gcp20/prototype/gcp20_device.gyp
+++ b/cloud_print/gcp20/prototype/gcp20_device.gyp
@@ -30,7 +30,9 @@
         'cloud_print_response_parser.cc',
         'cloud_print_response_parser.h',
         'cloud_print_requester.cc',
-        'cloud_print_requester.h',  
+        'cloud_print_requester.h',
+        'conio_posix.cc',  
+        'conio_posix.h',  
         'command_line_reader.cc',
         'command_line_reader.h',
         'dns_packet_parser.cc',
@@ -45,6 +47,7 @@
         'privet_http_server.h',
         'service_parameters.cc',
         'service_parameters.h',
+        'special_io.h',
         'x_privet_token.cc',
         'x_privet_token.h',
       ],
diff --git a/cloud_print/gcp20/prototype/printer.cc b/cloud_print/gcp20/prototype/printer.cc
index 04d3066..0aaf652 100644
--- a/cloud_print/gcp20/prototype/printer.cc
+++ b/cloud_print/gcp20/prototype/printer.cc
@@ -4,6 +4,7 @@
 
 #include "cloud_print/gcp20/prototype/printer.h"
 
+#include <stdio.h>
 #include <string>
 #include <vector>
 
@@ -15,6 +16,7 @@
 #include "base/strings/string_number_conversions.h"
 #include "cloud_print/gcp20/prototype/command_line_reader.h"
 #include "cloud_print/gcp20/prototype/service_parameters.h"
+#include "cloud_print/gcp20/prototype/special_io.h"
 #include "net/base/net_util.h"
 #include "net/base/url_util.h"
 
@@ -23,14 +25,18 @@
 
 namespace {
 
-const char* kServiceType = "_privet._tcp.local";
-const char* kServiceNamePrefix = "first_gcp20_device";
-const char* kServiceDomainName = "my-privet-device.local";
+const char kServiceType[] = "_privet._tcp.local";
+const char kServiceNamePrefix[] = "first_gcp20_device";
+const char kServiceDomainName[] = "my-privet-device.local";
 
-const char* kPrinterName = "Google GCP2.0 Prototype";
-const char* kPrinterDescription = "Printer emulator";
+const char kPrinterName[] = "Google GCP2.0 Prototype";
+const char kPrinterDescription[] = "Printer emulator";
 
-const char* kCdd =
+const char kUserConfirmationTitle[] = "Confirm registration: type 'y' if you "
+                                      "agree and any other to discard\n";
+const int64 kUserConfirmationTimeout = 30;  // in seconds
+
+const char kCdd[] =
 "{\n"
 " 'version': '1.0',\n"
 "  'printer': {\n"
@@ -86,7 +92,9 @@
 
 }  // namespace
 
-Printer::RegistrationInfo::RegistrationInfo() : state(DEV_REG_UNREGISTERED) {
+Printer::RegistrationInfo::RegistrationInfo()
+    : state(DEV_REG_UNREGISTERED),
+      confirmation_state(CONFIRMATION_PENDING) {
 }
 
 Printer::RegistrationInfo::~RegistrationInfo() {
@@ -165,6 +173,13 @@
   reg_info_.user = user;
   reg_info_.state = RegistrationInfo::DEV_REG_REGISTRATION_STARTED;
 
+  printf(kUserConfirmationTitle);
+  base::Time valid_until = base::Time::Now() +
+      base::TimeDelta::FromSeconds(kUserConfirmationTimeout);
+  base::MessageLoop::current()->PostTask(
+      FROM_HERE,
+      base::Bind(&Printer::WaitUserConfirmation, AsWeakPtr(), valid_until));
+
   requester_->StartRegistration(GenerateProxyId(), kPrinterName, user, kCdd);
 
   return PrivetHttpServer::REG_ERROR_OK;
@@ -186,19 +201,29 @@
   if (status != PrivetHttpServer::REG_ERROR_OK)
     return status;
 
-  // TODO(maksymb): Add user confirmation.
+  // Check if |action=start| was called, but |action=complete| wasn't.
+  if (reg_info_.state != RegistrationInfo::DEV_REG_REGISTRATION_STARTED &&
+      reg_info_.state !=
+          RegistrationInfo::DEV_REG_REGISTRATION_CLAIM_TOKEN_READY)
+    return PrivetHttpServer::REG_ERROR_INVALID_ACTION;
 
+  // If |action=getClaimToken| is valid in this state (was checked above) then
+  // check confirmation status.
+  if (reg_info_.confirmation_state != RegistrationInfo::CONFIRMATION_CONFIRMED)
+    return ConfirmationToRegistrationError(reg_info_.confirmation_state);
+
+  // If reply wasn't received yet, reply with |device_busy| error.
   if (reg_info_.state == RegistrationInfo::DEV_REG_REGISTRATION_STARTED)
     return PrivetHttpServer::REG_ERROR_DEVICE_BUSY;
 
-  if (reg_info_.state ==
-      RegistrationInfo::DEV_REG_REGISTRATION_CLAIM_TOKEN_READY) {
-    *token = reg_info_.registration_token;
-    *claim_url = reg_info_.complete_invite_url;
-    return PrivetHttpServer::REG_ERROR_OK;
-  }
+  DCHECK_EQ(reg_info_.state,
+            RegistrationInfo::DEV_REG_REGISTRATION_CLAIM_TOKEN_READY);
+  DCHECK_EQ(reg_info_.confirmation_state,
+            RegistrationInfo::CONFIRMATION_CONFIRMED);
 
-  return PrivetHttpServer::REG_ERROR_INVALID_ACTION;
+  *token = reg_info_.registration_token;
+  *claim_url = reg_info_.complete_invite_url;
+  return PrivetHttpServer::REG_ERROR_OK;
 }
 
 PrivetHttpServer::RegistrationErrorStatus Printer::RegistrationComplete(
@@ -213,9 +238,11 @@
     return PrivetHttpServer::REG_ERROR_INVALID_ACTION;
   }
 
+  if (reg_info_.confirmation_state != RegistrationInfo::CONFIRMATION_CONFIRMED)
+    return ConfirmationToRegistrationError(reg_info_.confirmation_state);
+
   reg_info_.state = RegistrationInfo::DEV_REG_REGISTRATION_COMPLETING;
   requester_->CompleteRegistration();
-
   *device_id = reg_info_.device_id;
 
   return PrivetHttpServer::REG_ERROR_OK;
@@ -233,6 +260,10 @@
     return PrivetHttpServer::REG_ERROR_INVALID_ACTION;
 
   reg_info_ = RegistrationInfo();
+  requester_.reset(new CloudPrintRequester(
+      base::MessageLoop::current()->message_loop_proxy(),
+      this));  // Forget all old queries.
+
   return PrivetHttpServer::REG_ERROR_OK;
 }
 
@@ -307,6 +338,31 @@
   return PrivetHttpServer::REG_ERROR_OK;
 }
 
+void Printer::WaitUserConfirmation(base::Time valid_until) {
+  if (base::Time::Now() > valid_until) {
+    reg_info_.confirmation_state = RegistrationInfo::CONFIRMATION_TIMEOUT;
+    LOG(INFO) << "Confirmation timeout reached.";
+    return;
+  }
+
+  if (_kbhit()) {
+    int c = _getche();
+    if (c == 'y' || c == 'Y') {
+      reg_info_.confirmation_state = RegistrationInfo::CONFIRMATION_CONFIRMED;
+      LOG(INFO) << "Registration confirmed by user.";
+    } else {
+      reg_info_.confirmation_state = RegistrationInfo::CONFIRMATION_DISCARDED;
+      LOG(INFO) << "Registration discarded by user.";
+    }
+    return;
+  }
+
+  base::MessageLoop::current()->PostDelayedTask(
+      FROM_HERE,
+      base::Bind(&Printer::WaitUserConfirmation, AsWeakPtr(), valid_until),
+      base::TimeDelta::FromMilliseconds(100));
+}
+
 std::string Printer::GenerateProxyId() const {
   return "{" + base::GenerateGUID() +"}";
 }
@@ -405,3 +461,22 @@
   return true;
 }
 
+PrivetHttpServer::RegistrationErrorStatus
+    Printer::ConfirmationToRegistrationError(
+        RegistrationInfo::ConfirmationState state) {
+  switch (state) {
+    case RegistrationInfo::CONFIRMATION_PENDING:
+      return PrivetHttpServer::REG_ERROR_PENDING_USER_ACTION;
+    case RegistrationInfo::CONFIRMATION_DISCARDED:
+      return PrivetHttpServer::REG_ERROR_USER_CANCEL;
+    case RegistrationInfo::CONFIRMATION_CONFIRMED:
+      NOTREACHED();
+      return PrivetHttpServer::REG_ERROR_OK;
+    case RegistrationInfo::CONFIRMATION_TIMEOUT:
+      return PrivetHttpServer::REG_ERROR_CONFIRMATION_TIMEOUT;
+    default:
+      NOTREACHED();
+      return PrivetHttpServer::REG_ERROR_OK;
+  }
+}
+
diff --git a/cloud_print/gcp20/prototype/printer.h b/cloud_print/gcp20/prototype/printer.h
index 246e3df..9dba787 100644
--- a/cloud_print/gcp20/prototype/printer.h
+++ b/cloud_print/gcp20/prototype/printer.h
@@ -8,13 +8,15 @@
 #include <string>
 #include <vector>
 
+#include "base/memory/weak_ptr.h"
 #include "cloud_print/gcp20/prototype/cloud_print_requester.h"
 #include "cloud_print/gcp20/prototype/dns_sd_server.h"
 #include "cloud_print/gcp20/prototype/privet_http_server.h"
 #include "cloud_print/gcp20/prototype/x_privet_token.h"
 
 // This class maintain work of DNS-SD server, HTTP server and others.
-class Printer : public PrivetHttpServer::Delegate,
+class Printer : public base::SupportsWeakPtr<Printer>,
+                public PrivetHttpServer::Delegate,
                 public CloudPrintRequester::Delegate {
  public:
   // Constructs uninitialized object.
@@ -35,14 +37,25 @@
  private:
   struct RegistrationInfo {
     enum RegistrationState {
-      DEV_REG_UNREGISTERED = 0,
-      DEV_REG_REGISTRATION_STARTED,
-      DEV_REG_REGISTRATION_CLAIM_TOKEN_READY,
-      DEV_REG_REGISTRATION_COMPLETING,
-      DEV_REG_REGISTRATION_ERROR,
+      DEV_REG_UNREGISTERED,
+      DEV_REG_REGISTRATION_STARTED,  // |action=start| was called,
+                                     // request to CloudPrint was sent.
+      DEV_REG_REGISTRATION_CLAIM_TOKEN_READY,  // The same as previous,
+                                               // but request reply is already
+                                               // received.
+      DEV_REG_REGISTRATION_COMPLETING,  // |action=complete| was called,
+                                        // |complete| request was sent.
+      DEV_REG_REGISTRATION_ERROR,  // Is set when server error was occurred.
       DEV_REG_REGISTERED,
     };
 
+    enum ConfirmationState {
+      CONFIRMATION_PENDING,
+      CONFIRMATION_CONFIRMED,
+      CONFIRMATION_DISCARDED,
+      CONFIRMATION_TIMEOUT,
+    };
+
     RegistrationInfo();
     ~RegistrationInfo();
 
@@ -50,6 +63,7 @@
     std::string refresh_token;
     std::string device_id;
     RegistrationState state;
+    ConfirmationState confirmation_state;
 
     std::string registration_token;
     std::string complete_invite_url;
@@ -100,15 +114,22 @@
   // Generates ProxyId for this device.
   std::string GenerateProxyId() const;
 
+  // Checks if confirmation was received.
+  void WaitUserConfirmation(base::Time valid_until);
+
   // Creates data for DNS TXT respond.
   std::vector<std::string> CreateTxt() const;
 
-  RegistrationInfo reg_info_;
-
   // Saving and loading registration info from file.
   void SaveToFile(const base::FilePath& file_path) const;
   bool LoadFromFile(const base::FilePath& file_path);
 
+  // Converts errors.
+  PrivetHttpServer::RegistrationErrorStatus ConfirmationToRegistrationError(
+      RegistrationInfo::ConfirmationState state);
+
+  RegistrationInfo reg_info_;
+
   // Contains DNS-SD server.
   DnsSdServer dns_server_;
 
diff --git a/cloud_print/gcp20/prototype/special_io.h b/cloud_print/gcp20/prototype/special_io.h
new file mode 100644
index 0000000..3028fec
--- /dev/null
+++ b/cloud_print/gcp20/prototype/special_io.h
@@ -0,0 +1,15 @@
+// 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 CLOUD_PRINT_GCP20_PROTOTYPE_SPECIAL_H_
+#define CLOUD_PRINT_GCP20_PROTOTYPE_SPECIAL_H_
+
+#if defined(OS_WIN)
+#include <conio.h>
+#elif defined(OS_POSIX)
+#include "cloud_print/gcp20/prototype/conio_posix.h"
+#endif
+
+#endif  // CLOUD_PRINT_GCP20_PROTOTYPE_SPECIAL_H_
+
diff --git a/cloud_print/service/win/chrome_launcher.cc b/cloud_print/service/win/chrome_launcher.cc
index 3f90719..1d7b26d 100644
--- a/cloud_print/service/win/chrome_launcher.cc
+++ b/cloud_print/service/win/chrome_launcher.cc
@@ -10,8 +10,8 @@
 #include "base/files/scoped_temp_dir.h"
 #include "base/json/json_reader.h"
 #include "base/json/json_writer.h"
-#include "base/process.h"
-#include "base/process_util.h"
+#include "base/process/kill.h"
+#include "base/process/process.h"
 #include "base/values.h"
 #include "base/win/registry.h"
 #include "base/win/scoped_handle.h"
diff --git a/cloud_print/virtual_driver/win/install/setup.cc b/cloud_print/virtual_driver/win/install/setup.cc
index 740b2f2..6e0df24 100644
--- a/cloud_print/virtual_driver/win/install/setup.cc
+++ b/cloud_print/virtual_driver/win/install/setup.cc
@@ -15,8 +15,8 @@
 #include "base/files/scoped_temp_dir.h"
 #include "base/logging.h"
 #include "base/path_service.h"
-#include "base/process.h"
-#include "base/process_util.h"
+#include "base/process/process.h"
+#include "base/process/launch.h"
 #include "base/strings/string16.h"
 #include "base/strings/string_util.h"
 #include "base/win/registry.h"
diff --git a/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc b/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc
index f71bb3f..ce146c7 100644
--- a/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc
+++ b/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc
@@ -18,8 +18,8 @@
 #include "base/files/file_enumerator.h"
 #include "base/logging.h"
 #include "base/path_service.h"
-#include "base/process.h"
-#include "base/process_util.h"
+#include "base/process/process.h"
+#include "base/process/launch.h"
 #include "base/strings/string16.h"
 #include "base/win/registry.h"
 #include "base/win/scoped_handle.h"
diff --git a/cloud_print/virtual_driver/win/port_monitor/port_monitor.h b/cloud_print/virtual_driver/win/port_monitor/port_monitor.h
index 45476ec..b836f45 100644
--- a/cloud_print/virtual_driver/win/port_monitor/port_monitor.h
+++ b/cloud_print/virtual_driver/win/port_monitor/port_monitor.h
@@ -8,7 +8,7 @@
 #include <windows.h>
 #include <string>
 #include "base/file_util.h"
-#include "base/process.h"
+#include "base/process/process.h"
 #include "base/strings/string16.h"
 
 namespace cloud_print {
diff --git a/cloud_print/virtual_driver/win/port_monitor/port_monitor_dll.cc b/cloud_print/virtual_driver/win/port_monitor/port_monitor_dll.cc
index 6790a78..43f82c9 100644
--- a/cloud_print/virtual_driver/win/port_monitor/port_monitor_dll.cc
+++ b/cloud_print/virtual_driver/win/port_monitor/port_monitor_dll.cc
@@ -17,8 +17,7 @@
 #include "base/file_util.h"
 #include "base/logging.h"
 #include "base/path_service.h"
-#include "base/process.h"
-#include "base/process_util.h"
+#include "base/process/process.h"
 #include "base/strings/string16.h"
 #include "base/win/registry.h"
 #include "base/win/scoped_handle.h"
diff --git a/components/auto_login_parser.target.darwin-arm.mk b/components/auto_login_parser.target.darwin-arm.mk
index c7476b1..7842b98 100644
--- a/components/auto_login_parser.target.darwin-arm.mk
+++ b/components/auto_login_parser.target.darwin-arm.mk
@@ -88,10 +88,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -172,10 +172,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/components/auto_login_parser.target.darwin-mips.mk b/components/auto_login_parser.target.darwin-mips.mk
index ee40c08..b13b570 100644
--- a/components/auto_login_parser.target.darwin-mips.mk
+++ b/components/auto_login_parser.target.darwin-mips.mk
@@ -87,10 +87,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -170,10 +170,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/components/auto_login_parser.target.darwin-x86.mk b/components/auto_login_parser.target.darwin-x86.mk
index e50ec4a..2908bdb 100644
--- a/components/auto_login_parser.target.darwin-x86.mk
+++ b/components/auto_login_parser.target.darwin-x86.mk
@@ -89,10 +89,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -175,10 +175,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/components/auto_login_parser.target.linux-arm.mk b/components/auto_login_parser.target.linux-arm.mk
index c7476b1..7842b98 100644
--- a/components/auto_login_parser.target.linux-arm.mk
+++ b/components/auto_login_parser.target.linux-arm.mk
@@ -88,10 +88,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -172,10 +172,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/components/auto_login_parser.target.linux-mips.mk b/components/auto_login_parser.target.linux-mips.mk
index ee40c08..b13b570 100644
--- a/components/auto_login_parser.target.linux-mips.mk
+++ b/components/auto_login_parser.target.linux-mips.mk
@@ -87,10 +87,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -170,10 +170,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/components/auto_login_parser.target.linux-x86.mk b/components/auto_login_parser.target.linux-x86.mk
index e50ec4a..2908bdb 100644
--- a/components/auto_login_parser.target.linux-x86.mk
+++ b/components/auto_login_parser.target.linux-x86.mk
@@ -89,10 +89,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -175,10 +175,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/components/autofill/content/browser/autocheckout/whitelist_manager_unittest.cc b/components/autofill/content/browser/autocheckout/whitelist_manager_unittest.cc
index 6420b6d..304d8bf 100644
--- a/components/autofill/content/browser/autocheckout/whitelist_manager_unittest.cc
+++ b/components/autofill/content/browser/autocheckout/whitelist_manager_unittest.cc
@@ -206,9 +206,10 @@
   for (size_t i = 0; i < arraysize(kBackoffDelaysInMs); ++i) {
     DownloadWhitelist(net::HTTP_INTERNAL_SERVER_ERROR,
                       kDownloadWhitelistResponse);
-    SCOPED_TRACE(
-        base::StringPrintf("Testing retry %"PRIuS", expecting delay: %"PRId64,
-                           i, kBackoffDelaysInMs[i]));
+    SCOPED_TRACE(base::StringPrintf("Testing retry %" PRIuS
+                                    ", expecting delay: %" PRId64,
+                                    i,
+                                    kBackoffDelaysInMs[i]));
     EXPECT_EQ(
         kBackoffDelaysInMs[i],
         whitelist_manager_->download_interval().InMillisecondsRoundedUp());
diff --git a/components/autofill_content_browser.target.darwin-arm.mk b/components/autofill_content_browser.target.darwin-arm.mk
index 48f50bb..a29898a 100644
--- a/components/autofill_content_browser.target.darwin-arm.mk
+++ b/components/autofill_content_browser.target.darwin-arm.mk
@@ -132,10 +132,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(gyp_shared_intermediate_dir)/protoc_out \
@@ -268,10 +268,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(gyp_shared_intermediate_dir)/protoc_out \
diff --git a/components/autofill_content_browser.target.darwin-mips.mk b/components/autofill_content_browser.target.darwin-mips.mk
index 9611d77..8e550a8 100644
--- a/components/autofill_content_browser.target.darwin-mips.mk
+++ b/components/autofill_content_browser.target.darwin-mips.mk
@@ -131,10 +131,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(gyp_shared_intermediate_dir)/protoc_out \
@@ -266,10 +266,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(gyp_shared_intermediate_dir)/protoc_out \
diff --git a/components/autofill_content_browser.target.darwin-x86.mk b/components/autofill_content_browser.target.darwin-x86.mk
index 4b0fd58..a2c9ed2 100644
--- a/components/autofill_content_browser.target.darwin-x86.mk
+++ b/components/autofill_content_browser.target.darwin-x86.mk
@@ -133,10 +133,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(gyp_shared_intermediate_dir)/protoc_out \
@@ -271,10 +271,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(gyp_shared_intermediate_dir)/protoc_out \
diff --git a/components/autofill_content_browser.target.linux-arm.mk b/components/autofill_content_browser.target.linux-arm.mk
index 48f50bb..a29898a 100644
--- a/components/autofill_content_browser.target.linux-arm.mk
+++ b/components/autofill_content_browser.target.linux-arm.mk
@@ -132,10 +132,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(gyp_shared_intermediate_dir)/protoc_out \
@@ -268,10 +268,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(gyp_shared_intermediate_dir)/protoc_out \
diff --git a/components/autofill_content_browser.target.linux-mips.mk b/components/autofill_content_browser.target.linux-mips.mk
index 9611d77..8e550a8 100644
--- a/components/autofill_content_browser.target.linux-mips.mk
+++ b/components/autofill_content_browser.target.linux-mips.mk
@@ -131,10 +131,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(gyp_shared_intermediate_dir)/protoc_out \
@@ -266,10 +266,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(gyp_shared_intermediate_dir)/protoc_out \
diff --git a/components/autofill_content_browser.target.linux-x86.mk b/components/autofill_content_browser.target.linux-x86.mk
index 4b0fd58..a2c9ed2 100644
--- a/components/autofill_content_browser.target.linux-x86.mk
+++ b/components/autofill_content_browser.target.linux-x86.mk
@@ -133,10 +133,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(gyp_shared_intermediate_dir)/protoc_out \
@@ -271,10 +271,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(gyp_shared_intermediate_dir)/protoc_out \
diff --git a/components/autofill_content_renderer.target.darwin-arm.mk b/components/autofill_content_renderer.target.darwin-arm.mk
index bfcf758..c3a932b 100644
--- a/components/autofill_content_renderer.target.darwin-arm.mk
+++ b/components/autofill_content_renderer.target.darwin-arm.mk
@@ -101,10 +101,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -207,10 +207,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/components/autofill_content_renderer.target.darwin-mips.mk b/components/autofill_content_renderer.target.darwin-mips.mk
index 6844cd6..e09cdbc 100644
--- a/components/autofill_content_renderer.target.darwin-mips.mk
+++ b/components/autofill_content_renderer.target.darwin-mips.mk
@@ -100,10 +100,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -205,10 +205,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/components/autofill_content_renderer.target.darwin-x86.mk b/components/autofill_content_renderer.target.darwin-x86.mk
index fe4d57e..5fef75e 100644
--- a/components/autofill_content_renderer.target.darwin-x86.mk
+++ b/components/autofill_content_renderer.target.darwin-x86.mk
@@ -103,10 +103,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -212,10 +212,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/components/autofill_content_renderer.target.linux-arm.mk b/components/autofill_content_renderer.target.linux-arm.mk
index bfcf758..c3a932b 100644
--- a/components/autofill_content_renderer.target.linux-arm.mk
+++ b/components/autofill_content_renderer.target.linux-arm.mk
@@ -101,10 +101,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -207,10 +207,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/components/autofill_content_renderer.target.linux-mips.mk b/components/autofill_content_renderer.target.linux-mips.mk
index 6844cd6..e09cdbc 100644
--- a/components/autofill_content_renderer.target.linux-mips.mk
+++ b/components/autofill_content_renderer.target.linux-mips.mk
@@ -100,10 +100,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -205,10 +205,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/components/autofill_content_renderer.target.linux-x86.mk b/components/autofill_content_renderer.target.linux-x86.mk
index fe4d57e..5fef75e 100644
--- a/components/autofill_content_renderer.target.linux-x86.mk
+++ b/components/autofill_content_renderer.target.linux-x86.mk
@@ -103,10 +103,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -212,10 +212,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/components/autofill_core_browser.target.darwin-arm.mk b/components/autofill_core_browser.target.darwin-arm.mk
index 973f381..d69fa71 100644
--- a/components/autofill_core_browser.target.darwin-arm.mk
+++ b/components/autofill_core_browser.target.darwin-arm.mk
@@ -156,10 +156,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -292,10 +292,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/components/autofill_core_browser.target.darwin-mips.mk b/components/autofill_core_browser.target.darwin-mips.mk
index c19dde6..643a018 100644
--- a/components/autofill_core_browser.target.darwin-mips.mk
+++ b/components/autofill_core_browser.target.darwin-mips.mk
@@ -155,10 +155,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -290,10 +290,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/components/autofill_core_browser.target.darwin-x86.mk b/components/autofill_core_browser.target.darwin-x86.mk
index 1b3a919..81fd1d1 100644
--- a/components/autofill_core_browser.target.darwin-x86.mk
+++ b/components/autofill_core_browser.target.darwin-x86.mk
@@ -157,10 +157,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -295,10 +295,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/components/autofill_core_browser.target.linux-arm.mk b/components/autofill_core_browser.target.linux-arm.mk
index 973f381..d69fa71 100644
--- a/components/autofill_core_browser.target.linux-arm.mk
+++ b/components/autofill_core_browser.target.linux-arm.mk
@@ -156,10 +156,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -292,10 +292,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/components/autofill_core_browser.target.linux-mips.mk b/components/autofill_core_browser.target.linux-mips.mk
index c19dde6..643a018 100644
--- a/components/autofill_core_browser.target.linux-mips.mk
+++ b/components/autofill_core_browser.target.linux-mips.mk
@@ -155,10 +155,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -290,10 +290,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/components/autofill_core_browser.target.linux-x86.mk b/components/autofill_core_browser.target.linux-x86.mk
index 1b3a919..81fd1d1 100644
--- a/components/autofill_core_browser.target.linux-x86.mk
+++ b/components/autofill_core_browser.target.linux-x86.mk
@@ -157,10 +157,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -295,10 +295,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/components/autofill_core_common.target.darwin-arm.mk b/components/autofill_core_common.target.darwin-arm.mk
index b8d497d..3f9e9cd 100644
--- a/components/autofill_core_common.target.darwin-arm.mk
+++ b/components/autofill_core_common.target.darwin-arm.mk
@@ -106,11 +106,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/autofill \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
@@ -196,11 +196,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/autofill \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
diff --git a/components/autofill_core_common.target.darwin-mips.mk b/components/autofill_core_common.target.darwin-mips.mk
index 2e71b22..7d35385 100644
--- a/components/autofill_core_common.target.darwin-mips.mk
+++ b/components/autofill_core_common.target.darwin-mips.mk
@@ -105,11 +105,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/autofill \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
@@ -194,11 +194,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/autofill \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
diff --git a/components/autofill_core_common.target.darwin-x86.mk b/components/autofill_core_common.target.darwin-x86.mk
index 3debf78..926e027 100644
--- a/components/autofill_core_common.target.darwin-x86.mk
+++ b/components/autofill_core_common.target.darwin-x86.mk
@@ -107,11 +107,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/autofill \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
@@ -199,11 +199,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/autofill \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
diff --git a/components/autofill_core_common.target.linux-arm.mk b/components/autofill_core_common.target.linux-arm.mk
index b8d497d..3f9e9cd 100644
--- a/components/autofill_core_common.target.linux-arm.mk
+++ b/components/autofill_core_common.target.linux-arm.mk
@@ -106,11 +106,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/autofill \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
@@ -196,11 +196,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/autofill \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
diff --git a/components/autofill_core_common.target.linux-mips.mk b/components/autofill_core_common.target.linux-mips.mk
index 2e71b22..7d35385 100644
--- a/components/autofill_core_common.target.linux-mips.mk
+++ b/components/autofill_core_common.target.linux-mips.mk
@@ -105,11 +105,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/autofill \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
@@ -194,11 +194,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/autofill \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
diff --git a/components/autofill_core_common.target.linux-x86.mk b/components/autofill_core_common.target.linux-x86.mk
index 3debf78..926e027 100644
--- a/components/autofill_core_common.target.linux-x86.mk
+++ b/components/autofill_core_common.target.linux-x86.mk
@@ -107,11 +107,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/autofill \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
@@ -199,11 +199,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/autofill \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
diff --git a/components/encryptor.target.darwin-arm.mk b/components/encryptor.target.darwin-arm.mk
index 16315df..631e6e7 100644
--- a/components/encryptor.target.darwin-arm.mk
+++ b/components/encryptor.target.darwin-arm.mk
@@ -87,8 +87,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -168,8 +168,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/components/encryptor.target.darwin-mips.mk b/components/encryptor.target.darwin-mips.mk
index d9bddbb..f241370 100644
--- a/components/encryptor.target.darwin-mips.mk
+++ b/components/encryptor.target.darwin-mips.mk
@@ -86,8 +86,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -166,8 +166,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/components/encryptor.target.darwin-x86.mk b/components/encryptor.target.darwin-x86.mk
index 4da8243..8a0bb80 100644
--- a/components/encryptor.target.darwin-x86.mk
+++ b/components/encryptor.target.darwin-x86.mk
@@ -89,8 +89,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -173,8 +173,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/components/encryptor.target.linux-arm.mk b/components/encryptor.target.linux-arm.mk
index 16315df..631e6e7 100644
--- a/components/encryptor.target.linux-arm.mk
+++ b/components/encryptor.target.linux-arm.mk
@@ -87,8 +87,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -168,8 +168,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/components/encryptor.target.linux-mips.mk b/components/encryptor.target.linux-mips.mk
index d9bddbb..f241370 100644
--- a/components/encryptor.target.linux-mips.mk
+++ b/components/encryptor.target.linux-mips.mk
@@ -86,8 +86,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -166,8 +166,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/components/encryptor.target.linux-x86.mk b/components/encryptor.target.linux-x86.mk
index 4da8243..8a0bb80 100644
--- a/components/encryptor.target.linux-x86.mk
+++ b/components/encryptor.target.linux-x86.mk
@@ -89,8 +89,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -173,8 +173,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/components/navigation_interception.target.darwin-arm.mk b/components/navigation_interception.target.darwin-arm.mk
index 33ed0dd..aedd0db 100644
--- a/components/navigation_interception.target.darwin-arm.mk
+++ b/components/navigation_interception.target.darwin-arm.mk
@@ -93,12 +93,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/navigation_interception \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
@@ -181,12 +181,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/navigation_interception \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/components/navigation_interception.target.darwin-mips.mk b/components/navigation_interception.target.darwin-mips.mk
index 35a4964..da89757 100644
--- a/components/navigation_interception.target.darwin-mips.mk
+++ b/components/navigation_interception.target.darwin-mips.mk
@@ -92,12 +92,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/navigation_interception \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
@@ -179,12 +179,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/navigation_interception \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/components/navigation_interception.target.darwin-x86.mk b/components/navigation_interception.target.darwin-x86.mk
index 436945f..deef36d 100644
--- a/components/navigation_interception.target.darwin-x86.mk
+++ b/components/navigation_interception.target.darwin-x86.mk
@@ -94,12 +94,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/navigation_interception \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
@@ -184,12 +184,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/navigation_interception \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/components/navigation_interception.target.linux-arm.mk b/components/navigation_interception.target.linux-arm.mk
index 33ed0dd..aedd0db 100644
--- a/components/navigation_interception.target.linux-arm.mk
+++ b/components/navigation_interception.target.linux-arm.mk
@@ -93,12 +93,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/navigation_interception \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
@@ -181,12 +181,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/navigation_interception \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/components/navigation_interception.target.linux-mips.mk b/components/navigation_interception.target.linux-mips.mk
index 35a4964..da89757 100644
--- a/components/navigation_interception.target.linux-mips.mk
+++ b/components/navigation_interception.target.linux-mips.mk
@@ -92,12 +92,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/navigation_interception \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
@@ -179,12 +179,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/navigation_interception \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/components/navigation_interception.target.linux-x86.mk b/components/navigation_interception.target.linux-x86.mk
index 436945f..deef36d 100644
--- a/components/navigation_interception.target.linux-x86.mk
+++ b/components/navigation_interception.target.linux-x86.mk
@@ -94,12 +94,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/navigation_interception \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
@@ -184,12 +184,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/navigation_interception \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/components/tracing.target.darwin-arm.mk b/components/tracing.target.darwin-arm.mk
index de5ddf0..5a5e640 100644
--- a/components/tracing.target.darwin-arm.mk
+++ b/components/tracing.target.darwin-arm.mk
@@ -89,8 +89,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -171,8 +171,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/components/tracing.target.darwin-mips.mk b/components/tracing.target.darwin-mips.mk
index 983d9d5..1ea07eb 100644
--- a/components/tracing.target.darwin-mips.mk
+++ b/components/tracing.target.darwin-mips.mk
@@ -89,8 +89,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -171,8 +171,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/components/tracing.target.darwin-x86.mk b/components/tracing.target.darwin-x86.mk
index c372771..84e5d73 100644
--- a/components/tracing.target.darwin-x86.mk
+++ b/components/tracing.target.darwin-x86.mk
@@ -91,8 +91,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -176,8 +176,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/components/tracing.target.linux-arm.mk b/components/tracing.target.linux-arm.mk
index de5ddf0..5a5e640 100644
--- a/components/tracing.target.linux-arm.mk
+++ b/components/tracing.target.linux-arm.mk
@@ -89,8 +89,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -171,8 +171,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/components/tracing.target.linux-mips.mk b/components/tracing.target.linux-mips.mk
index 983d9d5..1ea07eb 100644
--- a/components/tracing.target.linux-mips.mk
+++ b/components/tracing.target.linux-mips.mk
@@ -89,8 +89,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -171,8 +171,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/components/tracing.target.linux-x86.mk b/components/tracing.target.linux-x86.mk
index c372771..84e5d73 100644
--- a/components/tracing.target.linux-x86.mk
+++ b/components/tracing.target.linux-x86.mk
@@ -91,8 +91,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -176,8 +176,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/components/user_prefs.target.darwin-arm.mk b/components/user_prefs.target.darwin-arm.mk
index a15104a..cfbddb3 100644
--- a/components/user_prefs.target.darwin-arm.mk
+++ b/components/user_prefs.target.darwin-arm.mk
@@ -92,10 +92,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
@@ -182,10 +182,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
diff --git a/components/user_prefs.target.darwin-mips.mk b/components/user_prefs.target.darwin-mips.mk
index 33c81a4..5e58eab 100644
--- a/components/user_prefs.target.darwin-mips.mk
+++ b/components/user_prefs.target.darwin-mips.mk
@@ -91,10 +91,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
@@ -180,10 +180,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
diff --git a/components/user_prefs.target.darwin-x86.mk b/components/user_prefs.target.darwin-x86.mk
index 4c5a8a6..9e322d9 100644
--- a/components/user_prefs.target.darwin-x86.mk
+++ b/components/user_prefs.target.darwin-x86.mk
@@ -93,10 +93,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
@@ -185,10 +185,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
diff --git a/components/user_prefs.target.linux-arm.mk b/components/user_prefs.target.linux-arm.mk
index a15104a..cfbddb3 100644
--- a/components/user_prefs.target.linux-arm.mk
+++ b/components/user_prefs.target.linux-arm.mk
@@ -92,10 +92,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
@@ -182,10 +182,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
diff --git a/components/user_prefs.target.linux-mips.mk b/components/user_prefs.target.linux-mips.mk
index 33c81a4..5e58eab 100644
--- a/components/user_prefs.target.linux-mips.mk
+++ b/components/user_prefs.target.linux-mips.mk
@@ -91,10 +91,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
@@ -180,10 +180,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
diff --git a/components/user_prefs.target.linux-x86.mk b/components/user_prefs.target.linux-x86.mk
index 4c5a8a6..9e322d9 100644
--- a/components/user_prefs.target.linux-x86.mk
+++ b/components/user_prefs.target.linux-x86.mk
@@ -93,10 +93,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
@@ -185,10 +185,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
diff --git a/components/visitedlink_browser.target.darwin-arm.mk b/components/visitedlink_browser.target.darwin-arm.mk
index 1a5198a..ccd5788 100644
--- a/components/visitedlink_browser.target.darwin-arm.mk
+++ b/components/visitedlink_browser.target.darwin-arm.mk
@@ -88,10 +88,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH)/skia/config \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -174,10 +174,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH)/skia/config \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/components/visitedlink_browser.target.darwin-mips.mk b/components/visitedlink_browser.target.darwin-mips.mk
index a993f1a..650a20e 100644
--- a/components/visitedlink_browser.target.darwin-mips.mk
+++ b/components/visitedlink_browser.target.darwin-mips.mk
@@ -87,10 +87,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH)/skia/config \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -172,10 +172,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH)/skia/config \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/components/visitedlink_browser.target.darwin-x86.mk b/components/visitedlink_browser.target.darwin-x86.mk
index 373399e..5aae55d 100644
--- a/components/visitedlink_browser.target.darwin-x86.mk
+++ b/components/visitedlink_browser.target.darwin-x86.mk
@@ -90,10 +90,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH)/skia/config \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -179,10 +179,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH)/skia/config \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/components/visitedlink_browser.target.linux-arm.mk b/components/visitedlink_browser.target.linux-arm.mk
index 1a5198a..ccd5788 100644
--- a/components/visitedlink_browser.target.linux-arm.mk
+++ b/components/visitedlink_browser.target.linux-arm.mk
@@ -88,10 +88,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH)/skia/config \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -174,10 +174,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH)/skia/config \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/components/visitedlink_browser.target.linux-mips.mk b/components/visitedlink_browser.target.linux-mips.mk
index a993f1a..650a20e 100644
--- a/components/visitedlink_browser.target.linux-mips.mk
+++ b/components/visitedlink_browser.target.linux-mips.mk
@@ -87,10 +87,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH)/skia/config \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -172,10 +172,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH)/skia/config \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/components/visitedlink_browser.target.linux-x86.mk b/components/visitedlink_browser.target.linux-x86.mk
index 373399e..5aae55d 100644
--- a/components/visitedlink_browser.target.linux-x86.mk
+++ b/components/visitedlink_browser.target.linux-x86.mk
@@ -90,10 +90,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH)/skia/config \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -179,10 +179,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH)/skia/config \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/components/visitedlink_common.target.darwin-arm.mk b/components/visitedlink_common.target.darwin-arm.mk
index 48a7f56..f7f37a9 100644
--- a/components/visitedlink_common.target.darwin-arm.mk
+++ b/components/visitedlink_common.target.darwin-arm.mk
@@ -88,9 +88,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -173,9 +173,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/components/visitedlink_common.target.darwin-mips.mk b/components/visitedlink_common.target.darwin-mips.mk
index a1b4f4c..984f0bc 100644
--- a/components/visitedlink_common.target.darwin-mips.mk
+++ b/components/visitedlink_common.target.darwin-mips.mk
@@ -87,9 +87,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -171,9 +171,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/components/visitedlink_common.target.darwin-x86.mk b/components/visitedlink_common.target.darwin-x86.mk
index 988efdf..7a4129e 100644
--- a/components/visitedlink_common.target.darwin-x86.mk
+++ b/components/visitedlink_common.target.darwin-x86.mk
@@ -90,9 +90,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -178,9 +178,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/components/visitedlink_common.target.linux-arm.mk b/components/visitedlink_common.target.linux-arm.mk
index 48a7f56..f7f37a9 100644
--- a/components/visitedlink_common.target.linux-arm.mk
+++ b/components/visitedlink_common.target.linux-arm.mk
@@ -88,9 +88,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -173,9 +173,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/components/visitedlink_common.target.linux-mips.mk b/components/visitedlink_common.target.linux-mips.mk
index a1b4f4c..984f0bc 100644
--- a/components/visitedlink_common.target.linux-mips.mk
+++ b/components/visitedlink_common.target.linux-mips.mk
@@ -87,9 +87,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -171,9 +171,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/components/visitedlink_common.target.linux-x86.mk b/components/visitedlink_common.target.linux-x86.mk
index 988efdf..7a4129e 100644
--- a/components/visitedlink_common.target.linux-x86.mk
+++ b/components/visitedlink_common.target.linux-x86.mk
@@ -90,9 +90,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -178,9 +178,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/components/visitedlink_renderer.target.darwin-arm.mk b/components/visitedlink_renderer.target.darwin-arm.mk
index 514048d..ebabeb0 100644
--- a/components/visitedlink_renderer.target.darwin-arm.mk
+++ b/components/visitedlink_renderer.target.darwin-arm.mk
@@ -96,9 +96,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -208,9 +208,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/components/visitedlink_renderer.target.darwin-mips.mk b/components/visitedlink_renderer.target.darwin-mips.mk
index e801739..7ce00dd 100644
--- a/components/visitedlink_renderer.target.darwin-mips.mk
+++ b/components/visitedlink_renderer.target.darwin-mips.mk
@@ -95,9 +95,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -206,9 +206,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/components/visitedlink_renderer.target.darwin-x86.mk b/components/visitedlink_renderer.target.darwin-x86.mk
index aa2599f..b734a55 100644
--- a/components/visitedlink_renderer.target.darwin-x86.mk
+++ b/components/visitedlink_renderer.target.darwin-x86.mk
@@ -98,9 +98,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -213,9 +213,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/components/visitedlink_renderer.target.linux-arm.mk b/components/visitedlink_renderer.target.linux-arm.mk
index 514048d..ebabeb0 100644
--- a/components/visitedlink_renderer.target.linux-arm.mk
+++ b/components/visitedlink_renderer.target.linux-arm.mk
@@ -96,9 +96,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -208,9 +208,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/components/visitedlink_renderer.target.linux-mips.mk b/components/visitedlink_renderer.target.linux-mips.mk
index e801739..7ce00dd 100644
--- a/components/visitedlink_renderer.target.linux-mips.mk
+++ b/components/visitedlink_renderer.target.linux-mips.mk
@@ -95,9 +95,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -206,9 +206,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/components/visitedlink_renderer.target.linux-x86.mk b/components/visitedlink_renderer.target.linux-x86.mk
index aa2599f..b734a55 100644
--- a/components/visitedlink_renderer.target.linux-x86.mk
+++ b/components/visitedlink_renderer.target.linux-x86.mk
@@ -98,9 +98,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -213,9 +213,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/components/web_contents_delegate_android.target.darwin-arm.mk b/components/web_contents_delegate_android.target.darwin-arm.mk
index 720f9e9..1fca453 100644
--- a/components/web_contents_delegate_android.target.darwin-arm.mk
+++ b/components/web_contents_delegate_android.target.darwin-arm.mk
@@ -102,12 +102,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/web_contents_delegate_android \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -212,12 +212,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/web_contents_delegate_android \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/components/web_contents_delegate_android.target.darwin-mips.mk b/components/web_contents_delegate_android.target.darwin-mips.mk
index 1f48e44..2966843 100644
--- a/components/web_contents_delegate_android.target.darwin-mips.mk
+++ b/components/web_contents_delegate_android.target.darwin-mips.mk
@@ -101,12 +101,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/web_contents_delegate_android \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -210,12 +210,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/web_contents_delegate_android \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/components/web_contents_delegate_android.target.darwin-x86.mk b/components/web_contents_delegate_android.target.darwin-x86.mk
index 171d218..e15029a 100644
--- a/components/web_contents_delegate_android.target.darwin-x86.mk
+++ b/components/web_contents_delegate_android.target.darwin-x86.mk
@@ -103,12 +103,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/web_contents_delegate_android \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -215,12 +215,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/web_contents_delegate_android \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/components/web_contents_delegate_android.target.linux-arm.mk b/components/web_contents_delegate_android.target.linux-arm.mk
index 720f9e9..1fca453 100644
--- a/components/web_contents_delegate_android.target.linux-arm.mk
+++ b/components/web_contents_delegate_android.target.linux-arm.mk
@@ -102,12 +102,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/web_contents_delegate_android \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -212,12 +212,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/web_contents_delegate_android \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/components/web_contents_delegate_android.target.linux-mips.mk b/components/web_contents_delegate_android.target.linux-mips.mk
index 1f48e44..2966843 100644
--- a/components/web_contents_delegate_android.target.linux-mips.mk
+++ b/components/web_contents_delegate_android.target.linux-mips.mk
@@ -101,12 +101,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/web_contents_delegate_android \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -210,12 +210,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/web_contents_delegate_android \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/components/web_contents_delegate_android.target.linux-x86.mk b/components/web_contents_delegate_android.target.linux-x86.mk
index 171d218..e15029a 100644
--- a/components/web_contents_delegate_android.target.linux-x86.mk
+++ b/components/web_contents_delegate_android.target.linux-x86.mk
@@ -103,12 +103,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/web_contents_delegate_android \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -215,12 +215,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/skia/config \
 	$(gyp_shared_intermediate_dir)/web_contents_delegate_android \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/components/webdata_common.target.darwin-arm.mk b/components/webdata_common.target.darwin-arm.mk
index aff5f88..21edd70 100644
--- a/components/webdata_common.target.darwin-arm.mk
+++ b/components/webdata_common.target.darwin-arm.mk
@@ -94,10 +94,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
@@ -180,10 +180,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/components/webdata_common.target.darwin-mips.mk b/components/webdata_common.target.darwin-mips.mk
index 93d30d4..bc3b6aa 100644
--- a/components/webdata_common.target.darwin-mips.mk
+++ b/components/webdata_common.target.darwin-mips.mk
@@ -93,10 +93,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
@@ -178,10 +178,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/components/webdata_common.target.darwin-x86.mk b/components/webdata_common.target.darwin-x86.mk
index 270b487..34218d0 100644
--- a/components/webdata_common.target.darwin-x86.mk
+++ b/components/webdata_common.target.darwin-x86.mk
@@ -96,10 +96,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
@@ -185,10 +185,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/components/webdata_common.target.linux-arm.mk b/components/webdata_common.target.linux-arm.mk
index aff5f88..21edd70 100644
--- a/components/webdata_common.target.linux-arm.mk
+++ b/components/webdata_common.target.linux-arm.mk
@@ -94,10 +94,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
@@ -180,10 +180,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/components/webdata_common.target.linux-mips.mk b/components/webdata_common.target.linux-mips.mk
index 93d30d4..bc3b6aa 100644
--- a/components/webdata_common.target.linux-mips.mk
+++ b/components/webdata_common.target.linux-mips.mk
@@ -93,10 +93,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
@@ -178,10 +178,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/components/webdata_common.target.linux-x86.mk b/components/webdata_common.target.linux-x86.mk
index 270b487..34218d0 100644
--- a/components/webdata_common.target.linux-x86.mk
+++ b/components/webdata_common.target.linux-x86.mk
@@ -96,10 +96,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
@@ -185,10 +185,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc
index 4d19514..1b55369 100644
--- a/content/browser/android/content_view_core_impl.cc
+++ b/content/browser/android/content_view_core_impl.cc
@@ -20,6 +20,7 @@
 #include "content/browser/android/load_url_params.h"
 #include "content/browser/android/touch_point.h"
 #include "content/browser/renderer_host/compositor_impl_android.h"
+#include "content/browser/renderer_host/input/web_input_event_builders_android.h"
 #include "content/browser/renderer_host/java/java_bound_object.h"
 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager.h"
 #include "content/browser/renderer_host/render_view_host_impl.h"
@@ -47,7 +48,6 @@
 #include "jni/ContentViewCore_jni.h"
 #include "third_party/WebKit/public/web/WebBindings.h"
 #include "third_party/WebKit/public/web/WebInputEvent.h"
-#include "third_party/WebKit/public/web/android/WebInputEventFactory.h"
 #include "ui/android/view_android.h"
 #include "ui/android/window_android.h"
 #include "ui/gfx/android/java_bitmap.h"
@@ -65,7 +65,6 @@
 using base::android::ScopedJavaLocalRef;
 using WebKit::WebGestureEvent;
 using WebKit::WebInputEvent;
-using WebKit::WebInputEventFactory;
 
 // Describes the type and enabled state of a select popup item.
 // Keep in sync with the value defined in SelectPopupDialog.java
@@ -899,8 +898,8 @@
   if (!rwhv)
     return false;
 
-  WebKit::WebMouseEvent event = WebInputEventFactory::mouseEvent(
-      WebInputEventFactory::MouseEventTypeMove,
+  WebKit::WebMouseEvent event = WebMouseEventBuilder::Build(
+      WebInputEvent::MouseMove,
       WebKit::WebMouseEvent::ButtonNone,
       time_ms / 1000.0, x / GetDpiScale(), y / GetDpiScale(), 0, 1);
 
@@ -918,16 +917,16 @@
   if (!rwhv)
     return false;
 
-  WebKit::WebInputEventFactory::MouseWheelDirectionType type;
+  WebMouseWheelEventBuilder::Direction direction;
   if (vertical_axis > 0) {
-    type = WebInputEventFactory::MouseWheelDirectionTypeUp;
+    direction = WebMouseWheelEventBuilder::DIRECTION_UP;
   } else if (vertical_axis < 0) {
-    type = WebInputEventFactory::MouseWheelDirectionTypeDown;
+    direction = WebMouseWheelEventBuilder::DIRECTION_DOWN;
   } else {
     return false;
   }
-  WebKit::WebMouseWheelEvent event = WebInputEventFactory::mouseWheelEvent(
-      type, time_ms / 1000.0, x / GetDpiScale(), y / GetDpiScale());
+  WebKit::WebMouseWheelEvent event = WebMouseWheelEventBuilder::Build(
+      direction, time_ms / 1000.0, x / GetDpiScale(), y / GetDpiScale());
 
   rwhv->SendMouseWheelEvent(event);
   return true;
@@ -935,13 +934,8 @@
 
 WebGestureEvent ContentViewCoreImpl::MakeGestureEvent(
     WebInputEvent::Type type, long time_ms, float x, float y) const {
-  WebGestureEvent event;
-  event.type = type;
-  event.x = x / GetDpiScale();
-  event.y = y / GetDpiScale();
-  event.timeStampSeconds = time_ms / 1000.0;
-  event.sourceDevice = WebGestureEvent::Touchscreen;
-  return event;
+  return WebGestureEventBuilder::Build(
+      type, time_ms / 1000.0, x / GetDpiScale(), y / GetDpiScale());
 }
 
 void ContentViewCoreImpl::SendGestureEvent(
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc
index 241b7e5..d95dbb5 100644
--- a/content/browser/browser_main_loop.cc
+++ b/content/browser/browser_main_loop.cc
@@ -96,6 +96,10 @@
 #include "content/browser/zygote_host/zygote_host_impl_linux.h"
 #endif
 
+#if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED)
+#include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h"
+#endif
+
 #if defined(USE_X11)
 #include <X11/Xlib.h>
 #endif
@@ -469,6 +473,14 @@
     memory_observer_.reset(new MemoryObserver());
     base::MessageLoop::current()->AddTaskObserver(memory_observer_.get());
   }
+
+#if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED)
+  trace_memory_controller_.reset(new base::debug::TraceMemoryController(
+      base::MessageLoop::current()->message_loop_proxy(),
+      ::HeapProfilerWithPseudoStackStart,
+      ::HeapProfilerStop,
+      ::GetHeapProfile));
+#endif
 }
 
 void BrowserMainLoop::CreateThreads() {
@@ -629,6 +641,8 @@
   if (parts_)
     parts_->PostMainMessageLoopRun();
 
+  trace_memory_controller_.reset();
+
 #if !defined(OS_IOS)
   // Destroying the GpuProcessHostUIShims on the UI thread posts a task to
   // delete related objects on the GPU thread. This must be done before
diff --git a/content/browser/browser_main_loop.h b/content/browser/browser_main_loop.h
index 0f3d3d7..5c3608b 100644
--- a/content/browser/browser_main_loop.h
+++ b/content/browser/browser_main_loop.h
@@ -16,16 +16,19 @@
 class MessageLoop;
 class PowerMonitor;
 class SystemMonitor;
-}
+namespace debug {
+class TraceMemoryController;
+}  // namespace debug
+}  // namespace base
 
 namespace media {
 class AudioManager;
 class MIDIManager;
-}
+}  // namespace media
 
 namespace net {
 class NetworkChangeNotifier;
-}
+}  // namespace net
 
 namespace content {
 class AudioMirroringManager;
@@ -142,6 +145,7 @@
   scoped_ptr<BrowserProcessSubThread> io_thread_;
   scoped_ptr<base::Thread> indexed_db_thread_;
   scoped_ptr<MemoryObserver> memory_observer_;
+  scoped_ptr<base::debug::TraceMemoryController> trace_memory_controller_;
 
   DISALLOW_COPY_AND_ASSIGN(BrowserMainLoop);
 };
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc
index 7542862..ca1ae40 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.cc
+++ b/content/browser/browser_plugin/browser_plugin_guest.cc
@@ -470,6 +470,10 @@
   // be attached.
   embedder_web_contents_ = embedder_web_contents;
 
+  WebContentsViewGuest* new_view =
+      static_cast<WebContentsViewGuest*>(GetWebContents()->GetView());
+  new_view->OnGuestInitialized(embedder_web_contents->GetView());
+
   // |render_view_host| manages the ownership of this BrowserPluginGuestHelper.
   new BrowserPluginGuestHelper(this, GetWebContents()->GetRenderViewHost());
 
diff --git a/content/browser/fileapi/fileapi_message_filter.cc b/content/browser/fileapi/fileapi_message_filter.cc
index 312e04d..1fbb338 100644
--- a/content/browser/fileapi/fileapi_message_filter.cc
+++ b/content/browser/fileapi/fileapi_message_filter.cc
@@ -90,6 +90,7 @@
 }
 
 void FileAPIMessageFilter::OnChannelConnected(int32 peer_pid) {
+  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
   BrowserMessageFilter::OnChannelConnected(peer_pid);
 
   if (request_context_getter_.get()) {
@@ -98,9 +99,12 @@
     request_context_getter_ = NULL;
     DCHECK(request_context_);
   }
+
+  operation_runner_ = context_->CreateFileSystemOperationRunner();
 }
 
 void FileAPIMessageFilter::OnChannelClosing() {
+  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
   BrowserMessageFilter::OnChannelClosing();
 
   // Unregister all the blob URLs that are previously registered in this
@@ -128,7 +132,7 @@
   }
 
   on_close_callbacks_.Clear();
-  operation_runner()->Shutdown();
+  operation_runner_.reset();
   operations_.clear();
 }
 
@@ -738,8 +742,4 @@
                                               permissions, error);
 }
 
-fileapi::FileSystemOperationRunner* FileAPIMessageFilter::operation_runner() {
-  return context_->operation_runner();
-}
-
 }  // namespace content
diff --git a/content/browser/fileapi/fileapi_message_filter.h b/content/browser/fileapi/fileapi_message_filter.h
index 9d7f8bb..ed3b8d8 100644
--- a/content/browser/fileapi/fileapi_message_filter.h
+++ b/content/browser/fileapi/fileapi_message_filter.h
@@ -32,6 +32,7 @@
 namespace fileapi {
 class FileSystemURL;
 class FileSystemContext;
+class FileSystemOperationRunner;
 struct DirectoryEntry;
 }
 
@@ -169,7 +170,9 @@
                              int permissions,
                              base::PlatformFileError* error);
 
-  fileapi::FileSystemOperationRunner* operation_runner();
+  fileapi::FileSystemOperationRunner* operation_runner() {
+    return operation_runner_.get();
+  }
 
   int process_id_;
 
@@ -187,6 +190,8 @@
 
   scoped_refptr<ChromeBlobStorageContext> blob_storage_context_;
 
+  scoped_ptr<fileapi::FileSystemOperationRunner> operation_runner_;
+
   // Keep track of blob URLs registered in this process. Need to unregister
   // all of them when the renderer process dies.
   base::hash_set<std::string> blob_urls_;
diff --git a/content/browser/fileapi/fileapi_message_filter_unittest.cc b/content/browser/fileapi/fileapi_message_filter_unittest.cc
index 4266941..a290454 100644
--- a/content/browser/fileapi/fileapi_message_filter_unittest.cc
+++ b/content/browser/fileapi/fileapi_message_filter_unittest.cc
@@ -9,7 +9,9 @@
 
 #include "base/memory/ref_counted.h"
 #include "base/message_loop/message_loop.h"
+#include "content/browser/child_process_security_policy_impl.h"
 #include "content/browser/fileapi/chrome_blob_storage_context.h"
+#include "content/common/fileapi/file_system_messages.h"
 #include "content/common/fileapi/webblob_messages.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/common/common_param_traits.h"
@@ -34,6 +36,15 @@
   virtual void SetUp() OVERRIDE {
     file_system_context_ =
         fileapi::CreateFileSystemContextForTesting(NULL, base::FilePath());
+
+    std::vector<fileapi::FileSystemType> types;
+    file_system_context_->GetFileSystemTypes(&types);
+    for (size_t i = 0; i < types.size(); ++i) {
+      ChildProcessSecurityPolicyImpl::GetInstance()->
+          RegisterFileSystemPermissionPolicy(
+              types[i],
+              fileapi::FileSystemContext::GetPermissionPolicy(types[i]));
+    }
   }
 
   base::MessageLoop message_loop_;
@@ -88,4 +99,65 @@
   EXPECT_TRUE(controller->GetBlobDataFromUrl(kDifferentUrl) == NULL);
 }
 
+TEST_F(FileAPIMessageFilterTest, CloseChannelWithInflightRequest) {
+  scoped_refptr<FileAPIMessageFilter> filter(
+      new FileAPIMessageFilter(
+          0 /* process_id */,
+          browser_context_.GetRequestContext(),
+          file_system_context_.get(),
+          ChromeBlobStorageContext::GetFor(&browser_context_)));
+  filter->OnChannelConnected(0);
+
+  // Complete initialization.
+  message_loop_.RunUntilIdle();
+
+  IPC::ChannelProxy::MessageFilter* casted_filter =
+      static_cast<IPC::ChannelProxy::MessageFilter*>(filter.get());
+
+  int request_id = 0;
+  const GURL kUrl("filesystem:http://example.com/temporary/foo");
+  FileSystemHostMsg_ReadMetadata read_metadata(request_id++, kUrl);
+  EXPECT_TRUE(casted_filter->OnMessageReceived(read_metadata));
+
+  // Close the filter while it has inflight request.
+  filter->OnChannelClosing();
+
+  // This shouldn't cause DCHECK failure.
+  message_loop_.RunUntilIdle();
+}
+
+TEST_F(FileAPIMessageFilterTest, MultipleFilters) {
+  scoped_refptr<FileAPIMessageFilter> filter1(
+      new FileAPIMessageFilter(
+          0 /* process_id */,
+          browser_context_.GetRequestContext(),
+          file_system_context_.get(),
+          ChromeBlobStorageContext::GetFor(&browser_context_)));
+  scoped_refptr<FileAPIMessageFilter> filter2(
+      new FileAPIMessageFilter(
+          1 /* process_id */,
+          browser_context_.GetRequestContext(),
+          file_system_context_.get(),
+          ChromeBlobStorageContext::GetFor(&browser_context_)));
+  filter1->OnChannelConnected(0);
+  filter2->OnChannelConnected(1);
+
+  // Complete initialization.
+  message_loop_.RunUntilIdle();
+
+  IPC::ChannelProxy::MessageFilter* casted_filter =
+      static_cast<IPC::ChannelProxy::MessageFilter*>(filter1.get());
+
+  int request_id = 0;
+  const GURL kUrl("filesystem:http://example.com/temporary/foo");
+  FileSystemHostMsg_ReadMetadata read_metadata(request_id++, kUrl);
+  EXPECT_TRUE(casted_filter->OnMessageReceived(read_metadata));
+
+  // Close the other filter before the request for filter1 is processed.
+  filter2->OnChannelClosing();
+
+  // This shouldn't cause DCHECK failure.
+  message_loop_.RunUntilIdle();
+}
+
 }  // namespace fileapi
diff --git a/content/browser/indexed_db/indexed_db_callbacks.cc b/content/browser/indexed_db/indexed_db_callbacks.cc
index 1db9747..46270db 100644
--- a/content/browser/indexed_db/indexed_db_callbacks.cc
+++ b/content/browser/indexed_db/indexed_db_callbacks.cc
@@ -118,6 +118,8 @@
   dispatcher_host_->RegisterTransactionId(host_transaction_id_, origin_url_);
   int32 ipc_database_id =
       dispatcher_host_->Add(connection.release(), ipc_thread_id_, origin_url_);
+  if (ipc_database_id < 0)
+    return;
   ipc_database_id_ = ipc_database_id;
   IndexedDBMsg_CallbacksUpgradeNeeded_Params params;
   params.ipc_thread_id = ipc_thread_id_;
diff --git a/content/browser/indexed_db/indexed_db_dispatcher_host.cc b/content/browser/indexed_db/indexed_db_dispatcher_host.cc
index 2b4c64f..e926a90 100644
--- a/content/browser/indexed_db/indexed_db_dispatcher_host.cc
+++ b/content/browser/indexed_db/indexed_db_dispatcher_host.cc
@@ -121,8 +121,9 @@
                                    int32 ipc_thread_id,
                                    const GURL& origin_url) {
   if (!database_dispatcher_host_) {
+    connection->Close();
     delete connection;
-    return 0;
+    return -1;
   }
   int32 ipc_database_id = database_dispatcher_host_->map_.Add(connection);
   Context()->ConnectionOpened(origin_url, connection);
@@ -262,6 +263,8 @@
 void IndexedDBDispatcherHost::FinishTransaction(int64 host_transaction_id,
                                                 bool committed) {
   DCHECK(indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread());
+  if (!database_dispatcher_host_)
+    return;
   TransactionIDToURLMap& transaction_url_map =
       database_dispatcher_host_->transaction_url_map_;
   TransactionIDToSizeMap& transaction_size_map =
diff --git a/content/browser/plugin_service_impl.cc b/content/browser/plugin_service_impl.cc
index 64efebc..f596977 100644
--- a/content/browser/plugin_service_impl.cc
+++ b/content/browser/plugin_service_impl.cc
@@ -19,7 +19,7 @@
 #include "content/browser/ppapi_plugin_process_host.h"
 #include "content/browser/renderer_host/render_process_host_impl.h"
 #include "content/browser/renderer_host/render_view_host_impl.h"
-#include "content/common/pepper_plugin_registry.h"
+#include "content/common/pepper_plugin_list.h"
 #include "content/common/plugin_list.h"
 #include "content/common/view_messages.h"
 #include "content/public/browser/browser_thread.h"
@@ -650,8 +650,7 @@
 }
 
 void PluginServiceImpl::RegisterPepperPlugins() {
-  // TODO(abarth): It seems like the PepperPluginRegistry should do this work.
-  PepperPluginRegistry::ComputeList(&ppapi_plugins_);
+  ComputePepperPluginList(&ppapi_plugins_);
   for (size_t i = 0; i < ppapi_plugins_.size(); ++i) {
     RegisterInternalPlugin(ppapi_plugins_[i].ToWebPluginInfo(), true);
   }
diff --git a/content/browser/plugin_service_impl.h b/content/browser/plugin_service_impl.h
index d71cacc..6d358fd 100644
--- a/content/browser/plugin_service_impl.h
+++ b/content/browser/plugin_service_impl.h
@@ -24,6 +24,7 @@
 #include "content/browser/ppapi_plugin_process_host.h"
 #include "content/common/content_export.h"
 #include "content/public/browser/plugin_service.h"
+#include "content/public/common/pepper_plugin_info.h"
 #include "ipc/ipc_channel_handle.h"
 #include "url/gurl.h"
 
diff --git a/content/browser/renderer_host/quota_dispatcher_host.cc b/content/browser/quota_dispatcher_host.cc
similarity index 98%
rename from content/browser/renderer_host/quota_dispatcher_host.cc
rename to content/browser/quota_dispatcher_host.cc
index b634820..89ee710 100644
--- a/content/browser/renderer_host/quota_dispatcher_host.cc
+++ b/content/browser/quota_dispatcher_host.cc
@@ -1,8 +1,8 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// 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 "content/browser/renderer_host/quota_dispatcher_host.h"
+#include "content/browser/quota_dispatcher_host.h"
 
 #include "base/bind.h"
 #include "base/memory/weak_ptr.h"
diff --git a/content/browser/renderer_host/quota_dispatcher_host.h b/content/browser/quota_dispatcher_host.h
similarity index 85%
rename from content/browser/renderer_host/quota_dispatcher_host.h
rename to content/browser/quota_dispatcher_host.h
index 1e64fce..724b2ad 100644
--- a/content/browser/renderer_host/quota_dispatcher_host.h
+++ b/content/browser/quota_dispatcher_host.h
@@ -1,9 +1,9 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// 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 CONTENT_BROWSER_RENDERER_HOST_QUOTA_DISPATCHER_HOST_H_
-#define CONTENT_BROWSER_RENDERER_HOST_QUOTA_DISPATCHER_HOST_H_
+#ifndef CONTENT_BROWSER_QUOTA_DISPATCHER_HOST_H_
+#define CONTENT_BROWSER_QUOTA_DISPATCHER_HOST_H_
 
 #include "base/basictypes.h"
 #include "base/id_map.h"
@@ -65,4 +65,4 @@
 
 }  // namespace content
 
-#endif  // CONTENT_BROWSER_RENDERER_HOST_QUOTA_DISPATCHER_HOST_H_
+#endif  // CONTENT_BROWSER_QUOTA_DISPATCHER_HOST_H_
diff --git a/content/browser/renderer_host/compositing_iosurface_mac.h b/content/browser/renderer_host/compositing_iosurface_mac.h
index eb50d67..1b3ece3 100644
--- a/content/browser/renderer_host/compositing_iosurface_mac.h
+++ b/content/browser/renderer_host/compositing_iosurface_mac.h
@@ -286,9 +286,11 @@
       const scoped_refptr<media::VideoFrame>& video_frame_output);
 
   // Scan the list of started asynchronous copies and test if each one has
-  // completed.
-  void FinishAllCopies();
-  void FinishAllCopiesWithinContext(
+  // completed. If |block_until_finished| is true, then block until all
+  // pending copies are finished.
+  void CheckIfAllCopiesAreFinished(bool block_until_finished);
+  void CheckIfAllCopiesAreFinishedWithinContext(
+      bool block_until_finished,
       std::vector<base::Closure>* done_callbacks);
 
   void FailAllCopies();
diff --git a/content/browser/renderer_host/compositing_iosurface_mac.mm b/content/browser/renderer_host/compositing_iosurface_mac.mm
index 614f7ed..be99891 100644
--- a/content/browser/renderer_host/compositing_iosurface_mac.mm
+++ b/content/browser/renderer_host/compositing_iosurface_mac.mm
@@ -252,8 +252,9 @@
       finish_copy_timer_(
           FROM_HERE,
           base::TimeDelta::FromMilliseconds(kFinishCopyPollingPeriodMs),
-          base::Bind(&CompositingIOSurfaceMac::FinishAllCopies,
-                     base::Unretained(this)),
+          base::Bind(&CompositingIOSurfaceMac::CheckIfAllCopiesAreFinished,
+                     base::Unretained(this),
+                     false),
           true),
       display_link_(0),
       display_link_stop_timer_(FROM_HERE, base::TimeDelta::FromSeconds(1),
@@ -311,7 +312,7 @@
     return;
 
   // Asynchronous copies must complete in the same context they started in.
-  FinishAllCopies();
+  CheckIfAllCopiesAreFinished(true);
   CGLSetCurrentContext(context_->cgl_context());
   DestroyAllCopyContextsWithinContext();
   CGLSetCurrentContext(0);
@@ -501,7 +502,7 @@
 
   // Try to finish previous copy requests after flush to get better pipelining.
   std::vector<base::Closure> copy_done_callbacks;
-  FinishAllCopiesWithinContext(&copy_done_callbacks);
+  CheckIfAllCopiesAreFinishedWithinContext(false, &copy_done_callbacks);
 
   // Check if any of the drawing calls result in an error.
   GetAndSaveGLError();
@@ -872,37 +873,44 @@
       base::Bind(&MapBufferToVideoFrame, video_frame_output, dst_pixel_rect);
 }
 
-void CompositingIOSurfaceMac::FinishAllCopies() {
+void CompositingIOSurfaceMac::CheckIfAllCopiesAreFinished(
+    bool block_until_finished) {
   std::vector<base::Closure> done_callbacks;
   CGLSetCurrentContext(context_->cgl_context());
-  FinishAllCopiesWithinContext(&done_callbacks);
+  CheckIfAllCopiesAreFinishedWithinContext(
+      block_until_finished, &done_callbacks);
   CGLSetCurrentContext(0);
   for (size_t i = 0; i < done_callbacks.size(); ++i)
     done_callbacks[i].Run();
 }
 
-void CompositingIOSurfaceMac::FinishAllCopiesWithinContext(
+void CompositingIOSurfaceMac::CheckIfAllCopiesAreFinishedWithinContext(
+    bool block_until_finished,
     std::vector<base::Closure>* done_callbacks) {
   while (!copy_requests_.empty()) {
     CopyContext* const copy_context = copy_requests_.front();
 
-    if (copy_context->fence) {
-      const bool copy_completed = glTestFenceAPPLE(copy_context->fence);
+    if (copy_context->fence && !glTestFenceAPPLE(copy_context->fence)) {
       CHECK_AND_SAVE_GL_ERROR();
-
-      if (!copy_completed &&
-        copy_context->cycles_elapsed < kFinishCopyRetryCycles) {
+      // Doing a glFinishFenceAPPLE can cause transparent window flashes when
+      // switching tabs, so only do it when required.
+      if (block_until_finished) {
+        glFinishFenceAPPLE(copy_context->fence);
+        CHECK_AND_SAVE_GL_ERROR();
+      } else if (copy_context->cycles_elapsed < kFinishCopyRetryCycles) {
         ++copy_context->cycles_elapsed;
         // This copy has not completed there is no need to test subsequent
         // requests.
         break;
       }
     }
+    CHECK_AND_SAVE_GL_ERROR();
 
     bool success = true;
     for (int i = 0; success && i < copy_context->num_outputs; ++i) {
       TRACE_EVENT1(
-        "browser", "CompositingIOSurfaceMac::FinishAllCopiesWithinContext",
+        "browser",
+        "CompositingIOSurfaceMac::CheckIfAllCopiesAreFinishedWithinContext",
         "plane", i);
 
       glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, copy_context->pixel_buffers[i]);
@@ -923,6 +931,8 @@
   }
   if (copy_requests_.empty())
     finish_copy_timer_.Stop();
+
+  CHECK(copy_requests_.empty() || !block_until_finished);
 }
 
 bool CompositingIOSurfaceMac::SynchronousReadbackForCopy(
diff --git a/content/browser/renderer_host/input/web_input_event_builders_android.cc b/content/browser/renderer_host/input/web_input_event_builders_android.cc
new file mode 100644
index 0000000..eca820b
--- /dev/null
+++ b/content/browser/renderer_host/input/web_input_event_builders_android.cc
@@ -0,0 +1,133 @@
+// 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 "content/browser/renderer_host/input/web_input_event_builders_android.h"
+
+#include "base/logging.h"
+#include "content/browser/renderer_host/input/web_input_event_util.h"
+#include "content/browser/renderer_host/input/web_input_event_util_posix.h"
+#include "ui/base/keycodes/keyboard_code_conversion_android.h"
+#include "ui/base/keycodes/keyboard_codes_posix.h"
+
+namespace content {
+
+using WebKit::WebInputEvent;
+using WebKit::WebKeyboardEvent;
+using WebKit::WebGestureEvent;
+using WebKit::WebMouseEvent;
+using WebKit::WebMouseWheelEvent;
+
+WebKeyboardEvent WebKeyboardEventBuilder::Build(WebInputEvent::Type type,
+                                                int modifiers,
+                                                double time_sec,
+                                                int keycode,
+                                                int unicode_character,
+                                                bool is_system_key) {
+  DCHECK(WebInputEvent::isKeyboardEventType(type));
+  WebKeyboardEvent result;
+
+  result.type = type;
+  result.modifiers = modifiers;
+  result.timeStampSeconds = time_sec;
+  ui::KeyboardCode windows_key_code =
+      ui::KeyboardCodeFromAndroidKeyCode(keycode);
+  UpdateWindowsKeyCodeAndKeyIdentifier(&result, windows_key_code);
+  result.modifiers |= GetLocationModifiersFromWindowsKeyCode(windows_key_code);
+  result.nativeKeyCode = keycode;
+  result.unmodifiedText[0] = unicode_character;
+  if (result.windowsKeyCode == ui::VKEY_RETURN) {
+    // This is the same behavior as GTK:
+    // We need to treat the enter key as a key press of character \r. This
+    // is apparently just how webkit handles it and what it expects.
+    result.unmodifiedText[0] = '\r';
+  }
+  result.text[0] = result.unmodifiedText[0];
+  result.isSystemKey = is_system_key;
+
+  return result;
+}
+
+WebMouseEvent WebMouseEventBuilder::Build(WebKit::WebInputEvent::Type type,
+                                          WebMouseEvent::Button button,
+                                          double time_sec,
+                                          int window_x,
+                                          int window_y,
+                                          int modifiers,
+                                          int click_count) {
+  DCHECK(WebInputEvent::isMouseEventType(type));
+  WebMouseEvent result;
+
+  result.type = type;
+  result.x = window_x;
+  result.y = window_y;
+  result.windowX = window_x;
+  result.windowY = window_y;
+  result.timeStampSeconds = time_sec;
+  result.clickCount = click_count;
+  result.modifiers = modifiers;
+
+  if (type == WebInputEvent::MouseDown || type == WebInputEvent::MouseUp)
+    result.button = button;
+  else
+    result.button = WebMouseEvent::ButtonNone;
+
+  return result;
+}
+
+WebMouseWheelEvent WebMouseWheelEventBuilder::Build(Direction direction,
+                                                    double time_sec,
+                                                    int window_x,
+                                                    int window_y) {
+  WebMouseWheelEvent result;
+
+  result.type = WebInputEvent::MouseWheel;
+  result.x = window_x;
+  result.y = window_y;
+  result.windowX = window_x;
+  result.windowY = window_y;
+  result.timeStampSeconds = time_sec;
+  result.button = WebMouseEvent::ButtonNone;
+
+  // The below choices are matched from GTK.
+  const float scrollbar_pixels_per_tick = 160.0f / 3.0f;
+
+  switch (direction) {
+    case DIRECTION_UP:
+      result.deltaY = scrollbar_pixels_per_tick;
+      result.wheelTicksY = 1;
+      break;
+    case DIRECTION_DOWN:
+      result.deltaY = -scrollbar_pixels_per_tick;
+      result.wheelTicksY = -1;
+      break;
+    case DIRECTION_LEFT:
+      result.deltaX = scrollbar_pixels_per_tick;
+      result.wheelTicksX = 1;
+      break;
+    case DIRECTION_RIGHT:
+      result.deltaX = -scrollbar_pixels_per_tick;
+      result.wheelTicksX = -1;
+      break;
+  }
+
+  return result;
+}
+
+WebGestureEvent WebGestureEventBuilder::Build(WebInputEvent::Type type,
+                                              double time_sec,
+                                              int x,
+                                              int y) {
+  DCHECK(WebInputEvent::isGestureEventType(type));
+  WebGestureEvent result;
+
+  result.type = type;
+  result.x = x;
+  result.y = y;
+  result.timeStampSeconds = time_sec;
+  result.sourceDevice = WebGestureEvent::Touchscreen;
+
+  return result;
+}
+
+}  // namespace content
diff --git a/content/browser/renderer_host/input/web_input_event_builders_android.h b/content/browser/renderer_host/input/web_input_event_builders_android.h
new file mode 100644
index 0000000..4488375
--- /dev/null
+++ b/content/browser/renderer_host/input/web_input_event_builders_android.h
@@ -0,0 +1,58 @@
+// 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 CONTENT_BROWSER_RENDERER_HOST_INPUT_WEB_INPUT_EVENT_BUILDERS_ANDROID_H_
+#define CONTENT_BROWSER_RENDERER_HOST_INPUT_WEB_INPUT_EVENT_BUILDERS_ANDROID_H_
+
+#include "third_party/WebKit/public/web/WebInputEvent.h"
+
+namespace content {
+
+class WebMouseEventBuilder {
+ public:
+  static WebKit::WebMouseEvent Build(WebKit::WebInputEvent::Type type,
+                                     WebKit::WebMouseEvent::Button button,
+                                     double time_sec,
+                                     int window_x,
+                                     int window_y,
+                                     int modifiers,
+                                     int click_count);
+};
+
+class WebMouseWheelEventBuilder {
+ public:
+  enum Direction {
+    DIRECTION_UP,
+    DIRECTION_DOWN,
+    DIRECTION_LEFT,
+    DIRECTION_RIGHT,
+  };
+
+  static WebKit::WebMouseWheelEvent Build(Direction direction,
+                                          double time_sec,
+                                          int window_x,
+                                          int window_y);
+};
+
+class WebKeyboardEventBuilder {
+ public:
+  static WebKit::WebKeyboardEvent Build(WebKit::WebInputEvent::Type type,
+                                        int modifiers,
+                                        double time_sec,
+                                        int keycode,
+                                        int unicode_character,
+                                        bool is_system_key);
+};
+
+class WebGestureEventBuilder {
+ public:
+  static WebKit::WebGestureEvent Build(WebKit::WebInputEvent::Type type,
+                                       double time_sec,
+                                       int x,
+                                       int y);
+};
+
+}  // namespace content
+
+#endif  // CONTENT_BROWSER_RENDERER_HOST_INPUT_WEB_INPUT_EVENT_BUILDERS_ANDROID_H_
diff --git a/content/browser/renderer_host/input/web_input_event_util.cc b/content/browser/renderer_host/input/web_input_event_util.cc
new file mode 100644
index 0000000..e3c2899
--- /dev/null
+++ b/content/browser/renderer_host/input/web_input_event_util.cc
@@ -0,0 +1,145 @@
+// 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 "content/browser/renderer_host/input/web_input_event_util.h"
+
+#include "base/strings/string_util.h"
+#include "third_party/WebKit/public/web/WebInputEvent.h"
+
+namespace {
+
+const char* GetKeyIdentifier(ui::KeyboardCode key_code) {
+  switch (key_code) {
+    case ui::VKEY_MENU:
+      return "Alt";
+    case ui::VKEY_CONTROL:
+      return "Control";
+    case ui::VKEY_SHIFT:
+      return "Shift";
+    case ui::VKEY_CAPITAL:
+      return "CapsLock";
+    case ui::VKEY_LWIN:
+    case ui::VKEY_RWIN:
+      return "Win";
+    case ui::VKEY_CLEAR:
+      return "Clear";
+    case ui::VKEY_DOWN:
+      return "Down";
+    case ui::VKEY_END:
+      return "End";
+    case ui::VKEY_RETURN:
+      return "Enter";
+    case ui::VKEY_EXECUTE:
+      return "Execute";
+    case ui::VKEY_F1:
+      return "F1";
+    case ui::VKEY_F2:
+      return "F2";
+    case ui::VKEY_F3:
+      return "F3";
+    case ui::VKEY_F4:
+      return "F4";
+    case ui::VKEY_F5:
+      return "F5";
+    case ui::VKEY_F6:
+      return "F6";
+    case ui::VKEY_F7:
+      return "F7";
+    case ui::VKEY_F8:
+      return "F8";
+    case ui::VKEY_F9:
+      return "F9";
+    case ui::VKEY_F10:
+      return "F10";
+    case ui::VKEY_F11:
+      return "F11";
+    case ui::VKEY_F12:
+      return "F12";
+    case ui::VKEY_F13:
+      return "F13";
+    case ui::VKEY_F14:
+      return "F14";
+    case ui::VKEY_F15:
+      return "F15";
+    case ui::VKEY_F16:
+      return "F16";
+    case ui::VKEY_F17:
+      return "F17";
+    case ui::VKEY_F18:
+      return "F18";
+    case ui::VKEY_F19:
+      return "F19";
+    case ui::VKEY_F20:
+      return "F20";
+    case ui::VKEY_F21:
+      return "F21";
+    case ui::VKEY_F22:
+      return "F22";
+    case ui::VKEY_F23:
+      return "F23";
+    case ui::VKEY_F24:
+      return "F24";
+    case ui::VKEY_HELP:
+      return "Help";
+    case ui::VKEY_HOME:
+      return "Home";
+    case ui::VKEY_INSERT:
+      return "Insert";
+    case ui::VKEY_LEFT:
+      return "Left";
+    case ui::VKEY_NEXT:
+      return "PageDown";
+    case ui::VKEY_PRIOR:
+      return "PageUp";
+    case ui::VKEY_PAUSE:
+      return "Pause";
+    case ui::VKEY_SNAPSHOT:
+      return "PrintScreen";
+    case ui::VKEY_RIGHT:
+      return "Right";
+    case ui::VKEY_SCROLL:
+      return "Scroll";
+    case ui::VKEY_SELECT:
+      return "Select";
+    case ui::VKEY_UP:
+      return "Up";
+    case ui::VKEY_DELETE:
+      return "U+007F"; // Standard says that DEL becomes U+007F.
+    case ui::VKEY_MEDIA_NEXT_TRACK:
+      return "MediaNextTrack";
+    case ui::VKEY_MEDIA_PREV_TRACK:
+      return "MediaPreviousTrack";
+    case ui::VKEY_MEDIA_STOP:
+      return "MediaStop";
+    case ui::VKEY_MEDIA_PLAY_PAUSE:
+      return "MediaPlayPause";
+    case ui::VKEY_VOLUME_MUTE:
+      return "VolumeMute";
+    case ui::VKEY_VOLUME_DOWN:
+      return "VolumeDown";
+    case ui::VKEY_VOLUME_UP:
+      return "VolumeUp";
+    default:
+      return NULL;
+  };
+}
+
+}  // namespace
+
+namespace content {
+
+void UpdateWindowsKeyCodeAndKeyIdentifier(WebKit::WebKeyboardEvent* event,
+                                          ui::KeyboardCode windows_key_code) {
+  event->windowsKeyCode = windows_key_code;
+
+  const char* id = GetKeyIdentifier(windows_key_code);
+  if (id) {
+    base::strlcpy(event->keyIdentifier, id, sizeof(event->keyIdentifier) - 1);
+  } else {
+    base::snprintf(event->keyIdentifier, sizeof(event->keyIdentifier), "U+%04X",
+                   base::ToUpperASCII(static_cast<int>(windows_key_code)));
+  }
+}
+
+}  // namespace content
diff --git a/content/browser/renderer_host/input/web_input_event_util.h b/content/browser/renderer_host/input/web_input_event_util.h
new file mode 100644
index 0000000..75870eb
--- /dev/null
+++ b/content/browser/renderer_host/input/web_input_event_util.h
@@ -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.
+
+#ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_WEB_INPUT_EVENT_UTIL_H_
+#define CONTENT_BROWSER_RENDERER_HOST_INPUT_WEB_INPUT_EVENT_UTIL_H_
+
+#include "content/common/content_export.h"
+#include "ui/base/keycodes/keyboard_codes.h"
+
+namespace WebKit {
+class WebKeyboardEvent;
+}
+
+namespace content {
+
+// Update |event|'s windowsKeyCode and keyIdentifer properties using the
+// provided |windows_key_code|.
+CONTENT_EXPORT void UpdateWindowsKeyCodeAndKeyIdentifier(
+    WebKit::WebKeyboardEvent* event,
+    ui::KeyboardCode windows_key_code);
+
+}
+
+#endif  // CONTENT_BROWSER_RENDERER_HOST_INPUT_WEB_INPUT_EVENT_UTIL_H_
diff --git a/content/browser/renderer_host/input/web_input_event_util_posix.cc b/content/browser/renderer_host/input/web_input_event_util_posix.cc
new file mode 100644
index 0000000..72786c8
--- /dev/null
+++ b/content/browser/renderer_host/input/web_input_event_util_posix.cc
@@ -0,0 +1,43 @@
+// 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 "content/browser/renderer_host/input/web_input_event_util_posix.h"
+
+namespace content {
+
+ui::KeyboardCode GetWindowsKeyCodeWithoutLocation(ui::KeyboardCode key_code) {
+  switch (key_code) {
+    case ui::VKEY_LCONTROL:
+    case ui::VKEY_RCONTROL:
+      return ui::VKEY_CONTROL;
+    case ui::VKEY_LSHIFT:
+    case ui::VKEY_RSHIFT:
+    return ui::VKEY_SHIFT;
+    case ui::VKEY_LMENU:
+    case ui::VKEY_RMENU:
+      return ui::VKEY_MENU;
+    default:
+      return key_code;
+  }
+}
+
+WebKit::WebInputEvent::Modifiers GetLocationModifiersFromWindowsKeyCode(
+    ui::KeyboardCode key_code) {
+  switch (key_code) {
+    case ui::VKEY_LCONTROL:
+    case ui::VKEY_LSHIFT:
+    case ui::VKEY_LMENU:
+    case ui::VKEY_LWIN:
+      return WebKit::WebKeyboardEvent::IsLeft;
+    case ui::VKEY_RCONTROL:
+    case ui::VKEY_RSHIFT:
+    case ui::VKEY_RMENU:
+    case ui::VKEY_RWIN:
+      return WebKit::WebKeyboardEvent::IsRight;
+    default:
+      return static_cast<WebKit::WebInputEvent::Modifiers>(0);
+  }
+}
+
+}  // namespace content
diff --git a/content/browser/renderer_host/input/web_input_event_util_posix.h b/content/browser/renderer_host/input/web_input_event_util_posix.h
new file mode 100644
index 0000000..34e4ee9
--- /dev/null
+++ b/content/browser/renderer_host/input/web_input_event_util_posix.h
@@ -0,0 +1,19 @@
+// 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 CONTENT_BROWSER_RENDERER_HOST_INPUT_WEB_INPUT_EVENT_UTIL_POSIX_H_
+#define CONTENT_BROWSER_RENDERER_HOST_INPUT_WEB_INPUT_EVENT_UTIL_POSIX_H_
+
+#include "third_party/WebKit/public/web/WebInputEvent.h"
+#include "ui/base/keycodes/keyboard_codes.h"
+
+namespace content {
+
+ui::KeyboardCode GetWindowsKeyCodeWithoutLocation(ui::KeyboardCode key_code);
+WebKit::WebInputEvent::Modifiers GetLocationModifiersFromWindowsKeyCode(
+    ui::KeyboardCode key_code);
+
+}  // namespace content
+
+#endif  // CONTENT_BROWSER_RENDERER_HOST_INPUT_WEB_INPUT_EVENT_UTIL_POSIX_H_
diff --git a/content/browser/renderer_host/native_web_keyboard_event_android.cc b/content/browser/renderer_host/native_web_keyboard_event_android.cc
index 669ed0c..ad5f1f1 100644
--- a/content/browser/renderer_host/native_web_keyboard_event_android.cc
+++ b/content/browser/renderer_host/native_web_keyboard_event_android.cc
@@ -5,11 +5,9 @@
 #include "content/public/browser/native_web_keyboard_event.h"
 
 #include "base/android/jni_android.h"
-#include "third_party/WebKit/public/web/android/WebInputEventFactory.h"
+#include "content/browser/renderer_host/input/web_input_event_builders_android.h"
 #include "ui/gfx/native_widget_types.h"
 
-using WebKit::WebInputEventFactory;
-
 namespace {
 
 jobject NewGlobalRefForKeyEvent(jobject key_event) {
@@ -35,7 +33,7 @@
     WebKit::WebInputEvent::Type type,
     int modifiers, double time_secs, int keycode, int unicode_character,
     bool is_system_key)
-    : WebKeyboardEvent(WebInputEventFactory::keyboardEvent(
+    : WebKeyboardEvent(WebKeyboardEventBuilder::Build(
         type, modifiers, time_secs, keycode, unicode_character,
         is_system_key)) {
   os_event = NULL;
@@ -46,7 +44,7 @@
     jobject android_key_event, WebKit::WebInputEvent::Type type,
     int modifiers, double time_secs, int keycode, int unicode_character,
     bool is_system_key)
-    : WebKeyboardEvent(WebInputEventFactory::keyboardEvent(
+    : WebKeyboardEvent(WebKeyboardEventBuilder::Build(
         type, modifiers, time_secs, keycode, unicode_character,
         is_system_key)) {
   os_event = NewGlobalRefForKeyEvent(android_key_event);
diff --git a/content/browser/renderer_host/overscroll_controller.cc b/content/browser/renderer_host/overscroll_controller.cc
index 7e9ba4b..37f9e37 100644
--- a/content/browser/renderer_host/overscroll_controller.cc
+++ b/content/browser/renderer_host/overscroll_controller.cc
@@ -299,12 +299,6 @@
   else if (fabs(overscroll_delta_y_) > fabs(overscroll_delta_x_) * kMinRatio)
     new_mode = overscroll_delta_y_ > 0.f ? OVERSCROLL_SOUTH : OVERSCROLL_NORTH;
 
-  // The vertical oversrcoll currently does not have any UX effects, which can
-  // be confusing to users. So disable vertical overscroll for now.
-  // (http://crbug.com/243551 and http://crbug.com/151356).
-  if (new_mode == OVERSCROLL_SOUTH || new_mode == OVERSCROLL_NORTH)
-    new_mode = OVERSCROLL_NONE;
-
   if (overscroll_mode_ == OVERSCROLL_NONE) {
     SetOverscrollMode(new_mode);
   } else if (new_mode != overscroll_mode_) {
diff --git a/content/browser/renderer_host/overscroll_controller.h b/content/browser/renderer_host/overscroll_controller.h
index c9e477b..fc1fc5e 100644
--- a/content/browser/renderer_host/overscroll_controller.h
+++ b/content/browser/renderer_host/overscroll_controller.h
@@ -19,6 +19,8 @@
 class OverscrollControllerDelegate;
 class RenderWidgetHostImpl;
 
+// Indicates the direction that the scroll is heading in relative to the screen,
+// with the top being NORTH.
 enum OverscrollMode {
   OVERSCROLL_NONE,
   OVERSCROLL_NORTH,
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index ef3f0a3..b3ce557 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -63,6 +63,7 @@
 #include "content/browser/mime_registry_message_filter.h"
 #include "content/browser/plugin_service_impl.h"
 #include "content/browser/profiler_message_filter.h"
+#include "content/browser/quota_dispatcher_host.h"
 #include "content/browser/renderer_host/clipboard_message_filter.h"
 #include "content/browser/renderer_host/database_message_filter.h"
 #include "content/browser/renderer_host/device_motion_browser_message_filter.h"
@@ -81,7 +82,6 @@
 #include "content/browser/renderer_host/p2p/socket_dispatcher_host.h"
 #include "content/browser/renderer_host/pepper/pepper_message_filter.h"
 #include "content/browser/renderer_host/pepper/pepper_renderer_connection.h"
-#include "content/browser/renderer_host/quota_dispatcher_host.h"
 #include "content/browser/renderer_host/render_message_filter.h"
 #include "content/browser/renderer_host/render_view_host_delegate.h"
 #include "content/browser/renderer_host/render_view_host_impl.h"
diff --git a/content/browser/renderer_host/render_widget_host_unittest.cc b/content/browser/renderer_host/render_widget_host_unittest.cc
index 46d9e4f..5853786 100644
--- a/content/browser/renderer_host/render_widget_host_unittest.cc
+++ b/content/browser/renderer_host/render_widget_host_unittest.cc
@@ -4019,38 +4019,6 @@
   EXPECT_EQ(view_->unhandled_wheel_event().deltaY, -5);
 }
 
-// Tests that vertical scrolls are never consumed.
-// Should be removed with http://crbug.com/151356.
-TEST_F(RenderWidgetHostTest, VerticalOverscrollIsDisabled) {
-  host_->SetupForOverscrollControllerTest();
-  process_->sink().ClearMessages();
-  view_->set_bounds(gfx::Rect(0, 0, 400, 200));
-  view_->Show();
-
-  // Send some downwards wheel events. ACK them as not scrolling anything. Then
-  // send some upwards wheel events. Make sure these wheel events reach the
-  // renderer.
-  SimulateWheelEvent(0, 200, 0, true);
-  SimulateWheelEvent(0, 100, 0, true);
-  EXPECT_EQ(1U, process_->sink().message_count());
-  process_->sink().ClearMessages();
-
-  SendInputEventACK(WebInputEvent::MouseWheel,
-                    INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
-  EXPECT_EQ(1U, process_->sink().message_count());
-  process_->sink().ClearMessages();
-
-  SendInputEventACK(WebInputEvent::MouseWheel,
-                    INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
-  EXPECT_EQ(0U, process_->sink().message_count());
-  EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode());
-
-  SimulateWheelEvent(0, -20, 0, true);
-  EXPECT_EQ(1U, process_->sink().message_count());
-  SendInputEventACK(WebInputEvent::MouseWheel,
-                    INPUT_EVENT_ACK_STATE_CONSUMED);
-}
-
 // Tests that if a mouse-move event completes the overscroll gesture, future
 // move events do reach the renderer.
 TEST_F(RenderWidgetHostTest, OverscrollMouseMoveCompletion) {
diff --git a/content/browser/renderer_host/render_widget_host_view_guest.cc b/content/browser/renderer_host/render_widget_host_view_guest.cc
index 4709a03..097468f 100644
--- a/content/browser/renderer_host/render_widget_host_view_guest.cc
+++ b/content/browser/renderer_host/render_widget_host_view_guest.cc
@@ -152,9 +152,10 @@
 }
 
 void RenderWidgetHostViewGuest::Destroy() {
-  platform_view_->Destroy();
   // The RenderWidgetHost's destruction led here, so don't call it.
   DestroyGuestView();
+
+  platform_view_->Destroy();
 }
 
 void RenderWidgetHostViewGuest::SetTooltipText(const string16& tooltip_text) {
@@ -501,6 +502,7 @@
 #endif
 
 void RenderWidgetHostViewGuest::DestroyGuestView() {
+  host_->SetView(NULL);
   host_ = NULL;
   base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
 }
diff --git a/content/browser/ssl/ssl_policy.cc b/content/browser/ssl/ssl_policy.cc
index 28c679b..ec55736 100644
--- a/content/browser/ssl/ssl_policy.cc
+++ b/content/browser/ssl/ssl_policy.cc
@@ -24,17 +24,6 @@
 #include "webkit/common/resource_type.h"
 
 
-namespace {
-
-const char kDot = '.';
-
-bool IsIntranetHost(const std::string& host) {
-  const size_t dot = host.find(kDot);
-  return dot == std::string::npos || dot == host.length() - 1;
-}
-
-}  // namespace
-
 namespace content {
 
 SSLPolicy::SSLPolicy(SSLPolicyBackend* backend)
@@ -124,14 +113,6 @@
     return;
   }
 
-  if (!(entry->GetSSL().cert_status & net::CERT_STATUS_COMMON_NAME_INVALID)) {
-    // CAs issue certificates for intranet hosts to everyone.  Therefore, we
-    // mark intranet hosts as being non-unique.
-    if (IsIntranetHost(entry->GetURL().host())) {
-      entry->GetSSL().cert_status |= net::CERT_STATUS_NON_UNIQUE_NAME;
-    }
-  }
-
   if (net::IsCertStatusError(entry->GetSSL().cert_status)) {
     // Minor errors don't lower the security style to
     // SECURITY_STYLE_AUTHENTICATION_BROKEN.
diff --git a/content/browser/storage_partition_impl.cc b/content/browser/storage_partition_impl.cc
index ec092d2..a5e1aa1 100644
--- a/content/browser/storage_partition_impl.cc
+++ b/content/browser/storage_partition_impl.cc
@@ -26,132 +26,233 @@
 
 namespace {
 
-void DoNothingStatusCallback(quota::QuotaStatusCode status) {
-  // Do nothing.
+int GenerateQuotaClientMask(uint32 remove_mask) {
+  int quota_client_mask = 0;
+
+  if (remove_mask & StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS)
+    quota_client_mask |= quota::QuotaClient::kFileSystem;
+  if (remove_mask & StoragePartition::REMOVE_DATA_MASK_WEBSQL)
+    quota_client_mask |= quota::QuotaClient::kDatabase;
+  if (remove_mask & StoragePartition::REMOVE_DATA_MASK_APPCACHE)
+    quota_client_mask |= quota::QuotaClient::kAppcache;
+  if (remove_mask & StoragePartition::REMOVE_DATA_MASK_INDEXEDDB)
+    quota_client_mask |= quota::QuotaClient::kIndexedDatabase;
+
+  return quota_client_mask;
 }
 
-void ClearQuotaManagedOriginsOnIOThread(
-    const scoped_refptr<quota::QuotaManager>& quota_manager,
-    const std::set<GURL>& origins,
-    quota::StorageType quota_storage_type) {
+void OnClearedCookies(const base::Closure& callback, int num_deleted) {
+  // The final callback needs to happen from UI thread.
+  if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
+    BrowserThread::PostTask(
+        BrowserThread::UI, FROM_HERE,
+        base::Bind(&OnClearedCookies, callback, num_deleted));
+    return;
+  }
+
+  callback.Run();
+}
+
+void ClearCookiesOnIOThread(
+    const scoped_refptr<net::URLRequestContextGetter>& rq_context,
+    const base::Time begin,
+    const base::Time end,
+    const base::Closure& callback) {
+  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+  net::CookieStore* cookie_store = rq_context->
+      GetURLRequestContext()->cookie_store();
+  cookie_store->DeleteAllCreatedBetweenAsync(begin, end,
+      base::Bind(&OnClearedCookies, callback));
+}
+
+void OnQuotaManagedOriginDeleted(const GURL& origin,
+                                 quota::StorageType type,
+                                 size_t* origins_to_delete_count,
+                                 const base::Closure& callback,
+                                 quota::QuotaStatusCode status) {
+  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+  DCHECK_GT(*origins_to_delete_count, 0u);
+  if (status != quota::kQuotaStatusOk) {
+    DLOG(ERROR) << "Couldn't remove data of type " << type << " for origin "
+                << origin << ". Status: " << status;
+  }
+
+  (*origins_to_delete_count)--;
+  if (*origins_to_delete_count == 0) {
+    delete origins_to_delete_count;
+    callback.Run();
+  }
+}
+
+void ClearQuotaManagedOriginsOnIOThread(quota::QuotaManager* quota_manager,
+                                        uint32 remove_mask,
+                                        const base::Closure& callback,
+                                        const std::set<GURL>& origins,
+                                        quota::StorageType quota_storage_type) {
   // The QuotaManager manages all storage other than cookies, LocalStorage,
   // and SessionStorage. This loop wipes out most HTML5 storage for the given
   // origins.
   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+
+  if (!origins.size()) {
+    // No origins to clear.
+    callback.Run();
+    return;
+  }
+
   std::set<GURL>::const_iterator origin;
+  size_t* origins_to_delete_count = new size_t(origins.size());
   for (std::set<GURL>::const_iterator origin = origins.begin();
        origin != origins.end(); ++origin) {
-    quota_manager->DeleteOriginData(*origin, quota_storage_type,
-                                    quota::QuotaClient::kAllClientsMask,
-                                    base::Bind(&DoNothingStatusCallback));
+    quota_manager->DeleteOriginData(
+        *origin, quota_storage_type,
+        GenerateQuotaClientMask(remove_mask),
+        base::Bind(&OnQuotaManagedOriginDeleted,
+                   origin->GetOrigin(), quota_storage_type,
+                   origins_to_delete_count, callback));
   }
 }
 
-void ClearOriginOnIOThread(
-    uint32 storage_mask,
-    const GURL& storage_origin,
-    const scoped_refptr<net::URLRequestContextGetter>& request_context,
-    const scoped_refptr<quota::QuotaManager>& quota_manager) {
+void ClearShaderCacheOnIOThread(const base::FilePath& path,
+                                const base::Time begin,
+                                const base::Time end,
+                                const base::Closure& callback) {
   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
-
-  if (storage_mask & StoragePartition::kCookies) {
-    // Handle the cookies.
-    net::CookieMonster* cookie_monster =
-        request_context->GetURLRequestContext()->cookie_store()->
-            GetCookieMonster();
-    if (cookie_monster)
-      cookie_monster->DeleteAllForHostAsync(
-          storage_origin, net::CookieMonster::DeleteCallback());
-  }
-
-  // Handle all HTML5 storage other than DOMStorageContext.
-  std::set<GURL> origins;
-  origins.insert(storage_origin);
-  if (storage_mask & StoragePartition::kQuotaManagedTemporaryStorage) {
-    ClearQuotaManagedOriginsOnIOThread(quota_manager,
-                                       origins,
-                                       quota::kStorageTypeTemporary);
-  }
-  if (storage_mask & StoragePartition::kQuotaManagedPersistentStorage) {
-    ClearQuotaManagedOriginsOnIOThread(quota_manager,
-                                       origins,
-                                       quota::kStorageTypePersistent);
-  }
-  if (storage_mask & StoragePartition::kQuotaManagedSyncableStorage) {
-    ClearQuotaManagedOriginsOnIOThread(quota_manager,
-                                       origins,
-                                       quota::kStorageTypeSyncable);
-  }
-}
-
-void ClearAllDataOnIOThread(
-    uint32 storage_mask,
-    const scoped_refptr<net::URLRequestContextGetter>& request_context,
-    const scoped_refptr<quota::QuotaManager>& quota_manager) {
-  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
-
-  if (storage_mask & StoragePartition::kCookies) {
-    // Handle the cookies.
-    net::CookieMonster* cookie_monster =
-        request_context->GetURLRequestContext()->cookie_store()->
-            GetCookieMonster();
-    if (cookie_monster)
-      cookie_monster->DeleteAllAsync(net::CookieMonster::DeleteCallback());
-  }
-
-  // Handle all HTML5 storage other than DOMStorageContext.
-  if (storage_mask & StoragePartition::kQuotaManagedTemporaryStorage) {
-    quota_manager->GetOriginsModifiedSince(
-        quota::kStorageTypeTemporary, base::Time(),
-        base::Bind(&ClearQuotaManagedOriginsOnIOThread, quota_manager));
-  }
-  if (storage_mask & StoragePartition::kQuotaManagedPersistentStorage) {
-    quota_manager->GetOriginsModifiedSince(
-        quota::kStorageTypePersistent, base::Time(),
-        base::Bind(&ClearQuotaManagedOriginsOnIOThread, quota_manager));
-  }
-  if (storage_mask & StoragePartition::kQuotaManagedSyncableStorage) {
-    quota_manager->GetOriginsModifiedSince(
-        quota::kStorageTypeSyncable, base::Time(),
-        base::Bind(&ClearQuotaManagedOriginsOnIOThread, quota_manager));
-  }
-}
-
-void ClearedShaderCacheOnIOThread(base::Closure callback) {
-  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
-  BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, callback);
-}
-
-void ClearShaderCacheOnIOThread(base::FilePath path,
-    base::Time begin, base::Time end, base::Closure callback) {
-  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
-  ShaderCacheFactory::GetInstance()->ClearByPath(
-      path, begin, end,
-      base::Bind(&ClearedShaderCacheOnIOThread, callback));
+  ShaderCacheFactory::GetInstance()->ClearByPath(path, begin, end, callback);
 }
 
 void OnLocalStorageUsageInfo(
     const scoped_refptr<DOMStorageContextImpl>& dom_storage_context,
+    const base::Time delete_begin,
+    const base::Time delete_end,
+    const base::Closure& callback,
     const std::vector<dom_storage::LocalStorageUsageInfo>& infos) {
   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
 
   for (size_t i = 0; i < infos.size(); ++i) {
-    dom_storage_context->DeleteLocalStorage(infos[i].origin);
+    if (infos[i].last_modified >= delete_begin &&
+        infos[i].last_modified <= delete_end) {
+      dom_storage_context->DeleteLocalStorage(infos[i].origin);
+    }
   }
+  callback.Run();
 }
 
 void OnSessionStorageUsageInfo(
     const scoped_refptr<DOMStorageContextImpl>& dom_storage_context,
+    const base::Closure& callback,
     const std::vector<dom_storage::SessionStorageUsageInfo>& infos) {
   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
 
-  for (size_t i = 0; i < infos.size(); ++i) {
+  for (size_t i = 0; i < infos.size(); ++i)
     dom_storage_context->DeleteSessionStorage(infos[i]);
+
+  callback.Run();
+}
+
+void ClearLocalStorageOnUIThread(
+    const scoped_refptr<DOMStorageContextImpl>& dom_storage_context,
+    const GURL& remove_origin,
+    const base::Time begin,
+    const base::Time end,
+    const base::Closure& callback) {
+  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+  if (!remove_origin.is_empty()) {
+    dom_storage_context->DeleteLocalStorage(remove_origin);
+    callback.Run();
+    return;
   }
+
+  dom_storage_context->GetLocalStorageUsage(
+      base::Bind(&OnLocalStorageUsageInfo,
+                 dom_storage_context, begin, end, callback));
+}
+
+void ClearSessionStorageOnUIThread(
+    const scoped_refptr<DOMStorageContextImpl>& dom_storage_context,
+    const base::Closure& callback) {
+  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+  dom_storage_context->GetSessionStorageUsage(
+      base::Bind(&OnSessionStorageUsageInfo, dom_storage_context, callback));
 }
 
 }  // namespace
 
+// Helper for deleting quota managed data from a partition.
+//
+// Most of the operations in this class are done on IO thread.
+struct StoragePartitionImpl::QuotaManagedDataDeletionHelper {
+  QuotaManagedDataDeletionHelper(const base::Closure& callback)
+      : callback(callback), task_count(0) {
+  }
+
+  void IncrementTaskCountOnIO();
+  void DecrementTaskCountOnIO();
+
+  void ClearDataOnIOThread(
+      const scoped_refptr<quota::QuotaManager>& quota_manager,
+      const base::Time begin,
+      uint32 remove_mask,
+      uint32 quota_storage_remove_mask,
+      const GURL& remove_origin);
+
+  // Accessed on IO thread.
+  const base::Closure callback;
+  // Accessed on IO thread.
+  int task_count;
+};
+
+// Helper for deleting all sorts of data from a partition, keeps track of
+// deletion status.
+//
+// StoragePartitionImpl creates an instance of this class to keep track of
+// data deletion progress. Deletion requires deleting multiple bits of data
+// (e.g. cookies, local storage, session storage etc.) and hopping between UI
+// and IO thread. An instance of this class is created in the beginning of
+// deletion process (StoragePartitionImpl::ClearDataImpl) and the instance is
+// forwarded and updated on each (sub) deletion's callback. The instance is
+// finally destroyed when deletion completes (and |callback| is invoked).
+struct StoragePartitionImpl::DataDeletionHelper {
+  DataDeletionHelper(const base::Closure& callback)
+      : callback(callback), task_count(0) {
+  }
+
+  void IncrementTaskCountOnUI();
+  void DecrementTaskCountOnUI();
+
+  void ClearDataOnUIThread(uint32 remove_mask,
+                           uint32 quota_storage_remove_mask,
+                           const GURL& remove_origin,
+                           const base::FilePath& path,
+                           net::URLRequestContextGetter* rq_context,
+                           DOMStorageContextImpl* dom_storage_context,
+                           quota::QuotaManager* quota_manager,
+                           const base::Time begin,
+                           const base::Time end);
+
+  // Accessed on UI thread.
+  const base::Closure callback;
+  // Accessed on UI thread.
+  int task_count;
+};
+
+void ClearQuotaManagedDataOnIOThread(
+    const scoped_refptr<quota::QuotaManager>& quota_manager,
+    const base::Time begin,
+    uint32 remove_mask,
+    uint32 quota_storage_remove_mask,
+    const GURL& remove_origin,
+    const base::Closure& callback) {
+  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+
+  StoragePartitionImpl::QuotaManagedDataDeletionHelper* helper =
+      new StoragePartitionImpl::QuotaManagedDataDeletionHelper(callback);
+  helper->ClearDataOnIOThread(quota_manager, begin,
+      remove_mask, quota_storage_remove_mask, remove_origin);
+}
+
 StoragePartitionImpl::StoragePartitionImpl(
     const base::FilePath& partition_path,
     quota::QuotaManager* quota_manager,
@@ -293,59 +394,221 @@
   return indexed_db_context_.get();
 }
 
-void StoragePartitionImpl::AsyncClearDataForOrigin(
-    uint32 storage_mask,
+void StoragePartitionImpl::ClearDataImpl(
+    uint32 remove_mask,
+    uint32 quota_storage_remove_mask,
+    const GURL& remove_origin,
+    net::URLRequestContextGetter* rq_context,
+    const base::Time begin,
+    const base::Time end,
+    const base::Closure& callback) {
+  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+  DataDeletionHelper* helper = new DataDeletionHelper(callback);
+  // |helper| deletes itself when done in
+  // DataDeletionHelper::DecrementTaskCountOnUI().
+  helper->ClearDataOnUIThread(
+      remove_mask, quota_storage_remove_mask, remove_origin,
+      GetPath(), rq_context, dom_storage_context_, quota_manager_, begin, end);
+}
+
+void StoragePartitionImpl::
+    QuotaManagedDataDeletionHelper::IncrementTaskCountOnIO() {
+  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+  ++task_count;
+}
+
+void StoragePartitionImpl::
+    QuotaManagedDataDeletionHelper::DecrementTaskCountOnIO() {
+  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+  DCHECK_GT(task_count, 0);
+  --task_count;
+  if (task_count)
+    return;
+
+  callback.Run();
+  delete this;
+}
+
+void StoragePartitionImpl::QuotaManagedDataDeletionHelper::ClearDataOnIOThread(
+    const scoped_refptr<quota::QuotaManager>& quota_manager,
+    const base::Time begin,
+    uint32 remove_mask,
+    uint32 quota_storage_remove_mask,
+    const GURL& remove_origin) {
+  std::set<GURL> origins;
+  if (!remove_origin.is_empty())
+    origins.insert(remove_origin);
+
+  IncrementTaskCountOnIO();
+  base::Closure decrement_callback = base::Bind(
+      &QuotaManagedDataDeletionHelper::DecrementTaskCountOnIO,
+      base::Unretained(this));
+
+  if (quota_storage_remove_mask & kQuotaManagedPersistentStorage) {
+    IncrementTaskCountOnIO();
+    if (origins.empty()) {  // Remove for all origins.
+      // Ask the QuotaManager for all origins with temporary quota modified
+      // within the user-specified timeframe, and deal with the resulting set in
+      // ClearQuotaManagedOriginsOnIOThread().
+      quota_manager->GetOriginsModifiedSince(
+          quota::kStorageTypePersistent, begin,
+          base::Bind(&ClearQuotaManagedOriginsOnIOThread,
+                     quota_manager, remove_mask, decrement_callback));
+    } else {
+      ClearQuotaManagedOriginsOnIOThread(
+          quota_manager, remove_mask, decrement_callback,
+          origins, quota::kStorageTypePersistent);
+    }
+  }
+
+  // Do the same for temporary quota.
+  if (quota_storage_remove_mask & kQuotaManagedTemporaryStorage) {
+    IncrementTaskCountOnIO();
+    if (origins.empty()) {  // Remove for all origins.
+      quota_manager->GetOriginsModifiedSince(
+          quota::kStorageTypeTemporary, begin,
+          base::Bind(&ClearQuotaManagedOriginsOnIOThread,
+                     quota_manager, remove_mask, decrement_callback));
+    } else {
+      ClearQuotaManagedOriginsOnIOThread(
+          quota_manager, remove_mask, decrement_callback,
+          origins, quota::kStorageTypeTemporary);
+    }
+  }
+
+  // Do the same for syncable quota.
+  if (quota_storage_remove_mask & kQuotaManagedSyncableStorage) {
+    IncrementTaskCountOnIO();
+    if (origins.empty()) {  // Remove for all origins.
+      quota_manager->GetOriginsModifiedSince(
+          quota::kStorageTypeSyncable, begin,
+          base::Bind(&ClearQuotaManagedOriginsOnIOThread,
+                     quota_manager, remove_mask, decrement_callback));
+    } else {
+      ClearQuotaManagedOriginsOnIOThread(
+          quota_manager, remove_mask, decrement_callback,
+          origins, quota::kStorageTypeSyncable);
+    }
+  }
+
+  DecrementTaskCountOnIO();
+}
+
+void StoragePartitionImpl::DataDeletionHelper::IncrementTaskCountOnUI() {
+  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+  ++task_count;
+}
+
+void StoragePartitionImpl::DataDeletionHelper::DecrementTaskCountOnUI() {
+  if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
+    BrowserThread::PostTask(
+        BrowserThread::UI, FROM_HERE,
+        base::Bind(&DataDeletionHelper::DecrementTaskCountOnUI,
+                   base::Unretained(this)));
+    return;
+  }
+  DCHECK_GT(task_count, 0);
+  --task_count;
+  if (!task_count) {
+    callback.Run();
+    delete this;
+  }
+}
+
+void StoragePartitionImpl::DataDeletionHelper::ClearDataOnUIThread(
+    uint32 remove_mask,
+    uint32 quota_storage_remove_mask,
+    const GURL& remove_origin,
+    const base::FilePath& path,
+    net::URLRequestContextGetter* rq_context,
+    DOMStorageContextImpl* dom_storage_context,
+    quota::QuotaManager* quota_manager,
+    const base::Time begin,
+    const base::Time end) {
+  DCHECK_NE(remove_mask, 0u);
+  DCHECK(!callback.is_null());
+
+  IncrementTaskCountOnUI();
+  base::Closure decrement_callback = base::Bind(
+      &DataDeletionHelper::DecrementTaskCountOnUI, base::Unretained(this));
+
+  if (remove_mask & REMOVE_DATA_MASK_COOKIES) {
+    // Handle the cookies.
+    IncrementTaskCountOnUI();
+    BrowserThread::PostTask(
+        BrowserThread::IO, FROM_HERE,
+        base::Bind(&ClearCookiesOnIOThread,
+                   make_scoped_refptr(rq_context), begin, end,
+                   decrement_callback));
+  }
+
+  if (remove_mask & REMOVE_DATA_MASK_INDEXEDDB ||
+      remove_mask & REMOVE_DATA_MASK_WEBSQL ||
+      remove_mask & REMOVE_DATA_MASK_APPCACHE ||
+      remove_mask & REMOVE_DATA_MASK_FILE_SYSTEMS) {
+    IncrementTaskCountOnUI();
+    BrowserThread::PostTask(
+        BrowserThread::IO, FROM_HERE,
+        base::Bind(&ClearQuotaManagedDataOnIOThread,
+                   make_scoped_refptr(quota_manager), begin,
+                   remove_mask, quota_storage_remove_mask, remove_origin,
+                   decrement_callback));
+  }
+
+  if (remove_mask & REMOVE_DATA_MASK_LOCAL_STORAGE) {
+    IncrementTaskCountOnUI();
+    ClearLocalStorageOnUIThread(
+        make_scoped_refptr(dom_storage_context),
+        remove_origin, begin, end, decrement_callback);
+
+    // ClearDataImpl cannot clear session storage data when a particular origin
+    // is specified. Therefore we ignore clearing session storage in this case.
+    // TODO(lazyboy): Fix.
+    if (remove_origin.is_empty()) {
+      IncrementTaskCountOnUI();
+      ClearSessionStorageOnUIThread(
+          make_scoped_refptr(dom_storage_context), decrement_callback);
+    }
+  }
+
+  if (remove_mask & REMOVE_DATA_MASK_SHADER_CACHE) {
+    IncrementTaskCountOnUI();
+    BrowserThread::PostTask(
+        BrowserThread::IO, FROM_HERE,
+        base::Bind(&ClearShaderCacheOnIOThread,
+                   path, begin, end, decrement_callback));
+  }
+
+  DecrementTaskCountOnUI();
+}
+
+
+void StoragePartitionImpl::ClearDataForOrigin(
+    uint32 remove_mask,
+    uint32 quota_storage_remove_mask,
     const GURL& storage_origin,
     net::URLRequestContextGetter* request_context_getter) {
   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-
-  BrowserThread::PostTask(
-      BrowserThread::IO, FROM_HERE,
-      base::Bind(&ClearOriginOnIOThread,
-                 storage_mask,
-                 storage_origin,
-                 make_scoped_refptr(request_context_getter),
-                 quota_manager_));
-
-  if (storage_mask & kLocalDomStorage)
-    GetDOMStorageContext()->DeleteLocalStorage(storage_origin);
+  ClearDataImpl(remove_mask, quota_storage_remove_mask, storage_origin,
+                request_context_getter, base::Time(), base::Time::Max(),
+                base::Bind(&base::DoNothing));
 }
 
-void StoragePartitionImpl::AsyncClearData(uint32 storage_mask) {
-  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-
-  // We ignore the media request context because it shares the same cookie store
-  // as the main request context.
-  BrowserThread::PostTask(
-      BrowserThread::IO, FROM_HERE,
-      base::Bind(&ClearAllDataOnIOThread,
-                 storage_mask,
-                 url_request_context_,
-                 quota_manager_));
-
-  if (storage_mask & kLocalDomStorage) {
-    dom_storage_context_->GetLocalStorageUsage(
-        base::Bind(&OnLocalStorageUsageInfo, dom_storage_context_));
-  }
-
-  if (storage_mask & kSessionDomStorage) {
-    dom_storage_context_->GetSessionStorageUsage(
-        base::Bind(&OnSessionStorageUsageInfo, dom_storage_context_));
-  }
+void StoragePartitionImpl::ClearDataForUnboundedRange(
+    uint32 remove_mask,
+    uint32 quota_storage_remove_mask) {
+  ClearDataImpl(remove_mask, quota_storage_remove_mask, GURL(),
+                GetURLRequestContext(), base::Time(), base::Time::Max(),
+                base::Bind(&base::DoNothing));
 }
 
-void StoragePartitionImpl::AsyncClearDataBetween(uint32 storage_mask,
-      const base::Time& begin, const base::Time& end,
-      const base::Closure& callback) {
-  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-  DCHECK(storage_mask == kShaderStorage);
-
-  if (storage_mask & kShaderStorage) {
-    BrowserThread::PostTask(
-        BrowserThread::IO, FROM_HERE,
-        base::Bind(&ClearShaderCacheOnIOThread, GetPath(), begin, end,
-            callback));
-  }
+void StoragePartitionImpl::ClearDataForRange(uint32 remove_mask,
+                                             uint32 quota_storage_remove_mask,
+                                             const base::Time& begin,
+                                             const base::Time& end,
+                                             const base::Closure& callback) {
+  ClearDataImpl(remove_mask, quota_storage_remove_mask, GURL(),
+                GetURLRequestContext(), begin, end, callback);
 }
 
 WebRTCIdentityStore* StoragePartitionImpl::GetWebRTCIdentityStore() {
diff --git a/content/browser/storage_partition_impl.h b/content/browser/storage_partition_impl.h
index 9dcdfec..0410f4d 100644
--- a/content/browser/storage_partition_impl.h
+++ b/content/browser/storage_partition_impl.h
@@ -31,19 +31,26 @@
   virtual webkit_database::DatabaseTracker* GetDatabaseTracker() OVERRIDE;
   virtual DOMStorageContextImpl* GetDOMStorageContext() OVERRIDE;
   virtual IndexedDBContextImpl* GetIndexedDBContext() OVERRIDE;
-  virtual void AsyncClearDataForOrigin(
-      uint32 storage_mask,
+
+  virtual void ClearDataForOrigin(
+      uint32 remove_mask,
+      uint32 quota_storage_remove_mask,
       const GURL& storage_origin,
       net::URLRequestContextGetter* request_context_getter) OVERRIDE;
-  virtual void AsyncClearData(uint32 storage_mask) OVERRIDE;
-  virtual void AsyncClearDataBetween(
-      uint32 storage_mask,
-      const base::Time& begin,
-      const base::Time& end,
-      const base::Closure& callback) OVERRIDE;
+  virtual void ClearDataForUnboundedRange(
+      uint32 remove_mask,
+      uint32 quota_storage_remove_mask) OVERRIDE;
+  virtual void ClearDataForRange(uint32 remove_mask,
+                                 uint32 quota_storage_remove_mask,
+                                 const base::Time& begin,
+                                 const base::Time& end,
+                                 const base::Closure& callback) OVERRIDE;
 
   WebRTCIdentityStore* GetWebRTCIdentityStore();
 
+  struct DataDeletionHelper;
+  struct QuotaManagedDataDeletionHelper;
+
  private:
   friend class StoragePartitionImplMap;
   FRIEND_TEST_ALL_PREFIXES(StoragePartitionShaderClearTest, ClearShaderCache);
@@ -58,6 +65,10 @@
                                       bool in_memory,
                                       const base::FilePath& profile_path);
 
+  // Quota managed data uses a different bitmask for types than
+  // StoragePartition uses. This method generates that mask.
+  static int GenerateQuotaClientMask(uint32 remove_mask);
+
   CONTENT_EXPORT StoragePartitionImpl(
       const base::FilePath& partition_path,
       quota::QuotaManager* quota_manager,
@@ -68,6 +79,14 @@
       IndexedDBContextImpl* indexed_db_context,
       scoped_ptr<WebRTCIdentityStore> webrtc_identity_store);
 
+  void ClearDataImpl(uint32 remove_mask,
+                     uint32 quota_storage_remove_mask,
+                     const GURL& remove_origin,
+                     net::URLRequestContextGetter* rq_context,
+                     const base::Time begin,
+                     const base::Time end,
+                     const base::Closure& callback);
+
   // Used by StoragePartitionImplMap.
   //
   // TODO(ajwong): These should be taken in the constructor and in Create() but
diff --git a/content/browser/storage_partition_impl_map.cc b/content/browser/storage_partition_impl_map.cc
index 8b6556e..da7e88f 100644
--- a/content/browser/storage_partition_impl_map.cc
+++ b/content/browser/storage_partition_impl_map.cc
@@ -496,7 +496,9 @@
        ++it) {
     const StoragePartitionConfig& config = it->first;
     if (config.partition_domain == partition_domain) {
-      it->second->AsyncClearData(StoragePartition::kAllStorage);
+      it->second->ClearDataForUnboundedRange(
+          StoragePartition::REMOVE_DATA_MASK_ALL,
+          StoragePartition::kAllStorage);
       if (!config.in_memory) {
         paths_to_keep.push_back(it->second->GetPath());
       }
diff --git a/content/browser/storage_partition_impl_unittest.cc b/content/browser/storage_partition_impl_unittest.cc
index 36af638..0492335 100644
--- a/content/browser/storage_partition_impl_unittest.cc
+++ b/content/browser/storage_partition_impl_unittest.cc
@@ -98,8 +98,10 @@
 void ClearData(content::StoragePartitionImpl* sp,
                const base::Closure& cb) {
   base::Time time;
-  sp->AsyncClearDataBetween(content::StoragePartition::kShaderStorage,
-                           time, time, cb);
+  sp->ClearDataForRange(
+      StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE,
+      StoragePartition::kAllStorage,
+      time, time, cb);
 }
 
 TEST_F(StoragePartitionShaderClearTest, ClearShaderCache) {
diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc
index 185d483..043efca 100644
--- a/content/browser/web_contents/web_contents_view_aura.cc
+++ b/content/browser/web_contents/web_contents_view_aura.cc
@@ -5,6 +5,7 @@
 #include "content/browser/web_contents/web_contents_view_aura.h"
 
 #include "base/auto_reset.h"
+#include "base/command_line.h"
 #include "base/metrics/histogram.h"
 #include "base/strings/utf_string_conversions.h"
 #include "content/browser/renderer_host/dip_util.h"
@@ -32,6 +33,7 @@
 #include "content/public/browser/web_contents_observer.h"
 #include "content/public/browser/web_contents_view_delegate.h"
 #include "content/public/browser/web_drag_dest_delegate.h"
+#include "content/public/common/content_switches.h"
 #include "content/public/common/drop_data.h"
 #include "third_party/WebKit/public/web/WebInputEvent.h"
 #include "ui/aura/client/aura_constants.h"
@@ -69,6 +71,11 @@
 
 namespace {
 
+bool IsScrollEndEffectEnabled() {
+  return CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+      switches::kScrollEndEffect) == "1";
+}
+
 bool ShouldNavigateForward(const NavigationController& controller,
                            OverscrollMode mode) {
   return mode == (base::i18n::IsRTL() ? OVERSCROLL_EAST : OVERSCROLL_WEST) &&
@@ -959,10 +966,8 @@
                                                                int delta_y) {
   if (current_overscroll_gesture_ == OVERSCROLL_NORTH ||
       current_overscroll_gesture_ == OVERSCROLL_SOUTH) {
-    // Ignore vertical overscroll.
-    return gfx::Vector2d();
+    return gfx::Vector2d(0, delta_y);
   }
-
   // For horizontal overscroll, scroll freely if a navigation is possible. Do a
   // resistive scroll otherwise.
   const NavigationControllerImpl& controller = web_contents_->GetController();
@@ -971,7 +976,6 @@
     return gfx::Vector2d(std::max(-bounds.width(), delta_x), 0);
   else if (ShouldNavigateBack(controller, current_overscroll_gesture_))
     return gfx::Vector2d(std::min(bounds.width(), delta_x), 0);
-
   return gfx::Vector2d();
 }
 
@@ -1016,6 +1020,11 @@
   touch_editable_->AttachToView(rwhva);
 }
 
+void WebContentsViewAura::OverscrollUpdateForWebContentsDelegate(int delta_y) {
+  if (web_contents_->GetDelegate() && IsScrollEndEffectEnabled())
+    web_contents_->GetDelegate()->OverscrollUpdate(delta_y);
+}
+
 ////////////////////////////////////////////////////////////////////////////////
 // WebContentsViewAura, WebContentsView implementation:
 
@@ -1323,15 +1332,21 @@
   settings.SetPreemptionStrategy(ui::LayerAnimator::IMMEDIATELY_SET_NEW_TARGET);
   gfx::Vector2d translate = GetTranslationForOverscroll(delta_x, delta_y);
   gfx::Transform transform;
-  transform.Translate(translate.x(), translate.y());
-  target->SetTransform(transform);
 
-  UpdateOverscrollWindowBrightness(delta_x);
+  // Vertical overscrolls don't participate in the navigation gesture.
+  if (current_overscroll_gesture_ != OVERSCROLL_NORTH &&
+      current_overscroll_gesture_ != OVERSCROLL_SOUTH) {
+    transform.Translate(translate.x(), translate.y());
+    target->SetTransform(transform);
+    UpdateOverscrollWindowBrightness(delta_x);
+  }
+
+  OverscrollUpdateForWebContentsDelegate(translate.y());
 }
 
 void WebContentsViewAura::OnOverscrollComplete(OverscrollMode mode) {
   UMA_HISTOGRAM_ENUMERATION("Overscroll.Completed", mode, OVERSCROLL_COUNT);
-
+  OverscrollUpdateForWebContentsDelegate(0);
   NavigationControllerImpl& controller = web_contents_->GetController();
   if (ShouldNavigateForward(controller, mode) ||
       ShouldNavigateBack(controller, mode)) {
@@ -1349,8 +1364,10 @@
 
   if (new_mode == OVERSCROLL_NONE ||
       !GetContentNativeView() ||
-      (navigation_overlay_.get() && navigation_overlay_->has_window())) {
+      ((new_mode == OVERSCROLL_EAST || new_mode == OVERSCROLL_WEST) &&
+       navigation_overlay_.get() && navigation_overlay_->has_window())) {
     current_overscroll_gesture_ = OVERSCROLL_NONE;
+    OverscrollUpdateForWebContentsDelegate(0);
   } else {
     aura::Window* target = GetWindowToAnimateForOverscroll();
     if (target) {
@@ -1362,7 +1379,9 @@
     PrepareContentWindowForOverscroll();
 
     current_overscroll_gesture_ = new_mode;
-    PrepareOverscrollWindow();
+    if (current_overscroll_gesture_ == OVERSCROLL_EAST ||
+        current_overscroll_gesture_ == OVERSCROLL_WEST)
+      PrepareOverscrollWindow();
 
     UMA_HISTOGRAM_ENUMERATION("Overscroll.Started", new_mode, OVERSCROLL_COUNT);
   }
diff --git a/content/browser/web_contents/web_contents_view_aura.h b/content/browser/web_contents/web_contents_view_aura.h
index e2336dd..ca1f99c 100644
--- a/content/browser/web_contents/web_contents_view_aura.h
+++ b/content/browser/web_contents/web_contents_view_aura.h
@@ -97,6 +97,8 @@
 
   void AttachTouchEditableToRenderView();
 
+  void OverscrollUpdateForWebContentsDelegate(int delta_y);
+
   // Overridden from WebContentsView:
   virtual gfx::NativeView GetNativeView() const OVERRIDE;
   virtual gfx::NativeView GetContentNativeView() const OVERRIDE;
diff --git a/content/browser/web_contents/web_contents_view_guest.cc b/content/browser/web_contents/web_contents_view_guest.cc
index 2143e8a..a9fc40f 100644
--- a/content/browser/web_contents/web_contents_view_guest.cc
+++ b/content/browser/web_contents/web_contents_view_guest.cc
@@ -21,6 +21,10 @@
 #include "ui/gfx/rect.h"
 #include "ui/gfx/size.h"
 
+#if defined(USE_AURA)
+#include "ui/aura/window.h"
+#endif
+
 using WebKit::WebDragOperation;
 using WebKit::WebDragOperationsMask;
 
@@ -55,6 +59,22 @@
   return guest_->embedder_web_contents()->GetView()->GetTopLevelNativeWindow();
 }
 
+void WebContentsViewGuest::OnGuestInitialized(WebContentsView* parent_view) {
+#if defined(USE_AURA) || defined(OS_WIN)
+  // In aura and windows, ScreenPositionClient doesn't work properly if we do
+  // not have the native view associated with this WebContentsViewGuest in the
+  // view hierarchy. We add this view as embedder's child here.
+  // This would go in WebContentsViewGuest::CreateView, but that is too early to
+  // access embedder_web_contents(). Therefore, we do it here.
+#if defined(USE_AURA)
+  // This can be win aura or chromeos.
+  parent_view->GetNativeView()->AddChild(platform_view_->GetNativeView());
+#elif defined(OS_WIN)
+  SetParent(platform_view_->GetNativeView(), parent_view->GetNativeView());
+#endif
+#endif  // defined(USE_AURA) || defined(OS_WIN)
+}
+
 void WebContentsViewGuest::GetContainerBounds(gfx::Rect* out) const {
   // We need embedder container's bounds to calculate our bounds.
   guest_->embedder_web_contents()->GetView()->GetContainerBounds(out);
@@ -189,7 +209,26 @@
 }
 
 void WebContentsViewGuest::ShowContextMenu(const ContextMenuParams& params) {
+#if defined(USE_AURA) || defined(OS_WIN)
+  // Context menu uses ScreenPositionClient::ConvertPointToScreen() in aura and
+  // windows to calculate popup position. Guest's native view
+  // (platform_view_->GetNativeView()) is part of the embedder's view hierarchy,
+  // but is placed at (0, 0) w.r.t. the embedder's position. Therefore, |offset|
+  // is added to |params|.
+  gfx::Rect embedder_bounds;
+  guest_->embedder_web_contents()->GetView()->GetContainerBounds(
+      &embedder_bounds);
+  gfx::Rect guest_bounds;
+  GetContainerBounds(&guest_bounds);
+
+  gfx::Vector2d offset = guest_bounds.origin() - embedder_bounds.origin();
+  ContextMenuParams params_in_embedder = params;
+  params_in_embedder.x += offset.x();
+  params_in_embedder.y += offset.y();
+  platform_view_delegate_view_->ShowContextMenu(params_in_embedder);
+#else
   platform_view_delegate_view_->ShowContextMenu(params);
+#endif  // defined(USE_AURA) || defined(OS_WIN)
 }
 
 void WebContentsViewGuest::ShowPopupMenu(const gfx::Rect& bounds,
diff --git a/content/browser/web_contents/web_contents_view_guest.h b/content/browser/web_contents/web_contents_view_guest.h
index 8d968f4..81bf8d9 100644
--- a/content/browser/web_contents/web_contents_view_guest.h
+++ b/content/browser/web_contents/web_contents_view_guest.h
@@ -36,6 +36,8 @@
 
   WebContents* web_contents();
 
+  void OnGuestInitialized(WebContentsView* parent_view);
+
   // WebContentsView implementation --------------------------------------------
 
   virtual gfx::NativeView GetNativeView() const OVERRIDE;
diff --git a/content/browser/worker_host/worker_process_host.cc b/content/browser/worker_host/worker_process_host.cc
index 9f57bcc..050cfa1 100644
--- a/content/browser/worker_host/worker_process_host.cc
+++ b/content/browser/worker_host/worker_process_host.cc
@@ -25,9 +25,9 @@
 #include "content/browser/fileapi/fileapi_message_filter.h"
 #include "content/browser/indexed_db/indexed_db_dispatcher_host.h"
 #include "content/browser/mime_registry_message_filter.h"
+#include "content/browser/quota_dispatcher_host.h"
 #include "content/browser/renderer_host/database_message_filter.h"
 #include "content/browser/renderer_host/file_utilities_message_filter.h"
-#include "content/browser/renderer_host/quota_dispatcher_host.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/socket_stream_dispatcher_host.h"
diff --git a/content/child/child_thread.cc b/content/child/child_thread.cc
index 05650ad..16bfae2 100644
--- a/content/child/child_thread.cc
+++ b/content/child/child_thread.cc
@@ -35,6 +35,10 @@
 #include "content/common/handle_enumerator_win.h"
 #endif
 
+#if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED)
+#include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h"
+#endif
+
 using tracked_objects::ThreadData;
 
 namespace content {
@@ -173,6 +177,14 @@
 #if defined(OS_ANDROID)
   g_child_thread = this;
 #endif
+
+#if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED)
+  trace_memory_controller_.reset(new base::debug::TraceMemoryController(
+      message_loop_->message_loop_proxy(),
+      ::HeapProfilerWithPseudoStackStart,
+      ::HeapProfilerStop,
+      ::GetHeapProfile));
+#endif
 }
 
 ChildThread::~ChildThread() {
diff --git a/content/child/child_thread.h b/content/child/child_thread.h
index eb060ee..3b37e87 100644
--- a/content/child/child_thread.h
+++ b/content/child/child_thread.h
@@ -17,16 +17,20 @@
 
 namespace base {
 class MessageLoop;
-}
+
+namespace debug {
+class TraceMemoryController;
+}  // namespace debug
+}  // namespace base
 
 namespace IPC {
 class SyncChannel;
 class SyncMessageFilter;
-}
+}  // namespace IPC
 
 namespace WebKit {
 class WebFrame;
-}
+}  // namespace WebKit
 
 namespace content {
 class ChildHistogramMessageFilter;
@@ -186,6 +190,10 @@
 
   base::WeakPtrFactory<ChildThread> channel_connected_factory_;
 
+  // Observes the trace event system. When tracing is enabled, optionally
+  // starts profiling the tcmalloc heap.
+  scoped_ptr<base::debug::TraceMemoryController> trace_memory_controller_;
+
   DISALLOW_COPY_AND_ASSIGN(ChildThread);
 };
 
diff --git a/content/common/content_param_traits.cc b/content/common/content_param_traits.cc
index 9de71c9..bcf7dd5 100644
--- a/content/common/content_param_traits.cc
+++ b/content/common/content_param_traits.cc
@@ -65,7 +65,7 @@
 }
 
 void ParamTraits<ui::Range>::Log(const ui::Range& r, std::string* l) {
-  l->append(base::StringPrintf("(%"PRIuS", %"PRIuS")", r.start(), r.end()));
+  l->append(base::StringPrintf("(%" PRIuS ", %" PRIuS ")", r.start(), r.end()));
 }
 
 void ParamTraits<WebInputEventPointer>::Write(Message* m, const param_type& p) {
diff --git a/content/common/fileapi/file_system_messages.h b/content/common/fileapi/file_system_messages.h
index e6f583e..a2d2500 100644
--- a/content/common/fileapi/file_system_messages.h
+++ b/content/common/fileapi/file_system_messages.h
@@ -12,6 +12,8 @@
 #include "webkit/common/fileapi/file_system_types.h"
 #include "webkit/common/quota/quota_types.h"
 
+#undef IPC_MESSAGE_EXPORT
+#define IPC_MESSAGE_EXPORT CONTENT_EXPORT
 #define IPC_MESSAGE_START FileSystemMsgStart
 
 IPC_STRUCT_TRAITS_BEGIN(fileapi::DirectoryEntry)
diff --git a/content/common/pepper_plugin_list.cc b/content/common/pepper_plugin_list.cc
new file mode 100644
index 0000000..a398ad2
--- /dev/null
+++ b/content/common/pepper_plugin_list.cc
@@ -0,0 +1,112 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/common/pepper_plugin_list.h"
+
+#include "base/command_line.h"
+#include "base/strings/string_split.h"
+#include "base/strings/string_util.h"
+#include "base/strings/utf_string_conversions.h"
+#include "content/public/common/content_client.h"
+#include "content/public/common/content_switches.h"
+#include "content/public/common/pepper_plugin_info.h"
+#include "ppapi/shared_impl/ppapi_permissions.h"
+
+namespace content {
+namespace {
+
+// Appends any plugins from the command line to the given vector.
+void ComputePluginsFromCommandLine(std::vector<PepperPluginInfo>* plugins) {
+  bool out_of_process = true;
+  if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kPpapiInProcess))
+    out_of_process = false;
+
+  const std::string value =
+      CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+          switches::kRegisterPepperPlugins);
+  if (value.empty())
+    return;
+
+  // FORMAT:
+  // command-line = <plugin-entry> + *( LWS + "," + LWS + <plugin-entry> )
+  // plugin-entry =
+  //    <file-path> +
+  //    ["#" + <name> + ["#" + <description> + ["#" + <version>]]] +
+  //    *1( LWS + ";" + LWS + <mime-type> )
+  std::vector<std::string> modules;
+  base::SplitString(value, ',', &modules);
+  for (size_t i = 0; i < modules.size(); ++i) {
+    std::vector<std::string> parts;
+    base::SplitString(modules[i], ';', &parts);
+    if (parts.size() < 2) {
+      DLOG(ERROR) << "Required mime-type not found";
+      continue;
+    }
+
+    std::vector<std::string> name_parts;
+    base::SplitString(parts[0], '#', &name_parts);
+
+    PepperPluginInfo plugin;
+    plugin.is_out_of_process = out_of_process;
+#if defined(OS_WIN)
+    // This means we can't provide plugins from non-ASCII paths, but
+    // since this switch is only for development I don't think that's
+    // too awful.
+    plugin.path = base::FilePath(ASCIIToUTF16(name_parts[0]));
+#else
+    plugin.path = base::FilePath(name_parts[0]);
+#endif
+    if (name_parts.size() > 1)
+      plugin.name = name_parts[1];
+    if (name_parts.size() > 2)
+      plugin.description = name_parts[2];
+    if (name_parts.size() > 3)
+      plugin.version = name_parts[3];
+    for (size_t j = 1; j < parts.size(); ++j) {
+      WebPluginMimeType mime_type(parts[j],
+                                  std::string(),
+                                  plugin.description);
+      plugin.mime_types.push_back(mime_type);
+    }
+
+    // If the plugin name is empty, use the filename.
+    if (plugin.name.empty())
+      plugin.name = UTF16ToUTF8(plugin.path.BaseName().LossyDisplayName());
+
+    // Command-line plugins get full permissions.
+    plugin.permissions = ppapi::PERMISSION_ALL_BITS;
+
+    plugins->push_back(plugin);
+  }
+}
+
+}  // namespace
+
+bool MakePepperPluginInfo(const WebPluginInfo& webplugin_info,
+                          PepperPluginInfo* pepper_info) {
+  if (!webplugin_info.is_pepper_plugin())
+    return false;
+
+  pepper_info->is_out_of_process =
+      webplugin_info.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS ||
+      webplugin_info.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_UNSANDBOXED;
+  pepper_info->is_sandboxed = webplugin_info.type !=
+      WebPluginInfo::PLUGIN_TYPE_PEPPER_UNSANDBOXED;
+
+  pepper_info->path = base::FilePath(webplugin_info.path);
+  pepper_info->name = UTF16ToASCII(webplugin_info.name);
+  pepper_info->description = UTF16ToASCII(webplugin_info.desc);
+  pepper_info->version = UTF16ToASCII(webplugin_info.version);
+  pepper_info->mime_types = webplugin_info.mime_types;
+  pepper_info->permissions = webplugin_info.pepper_permissions;
+
+  return true;
+}
+
+void ComputePepperPluginList(std::vector<PepperPluginInfo>* plugins) {
+  GetContentClient()->AddPepperPlugins(plugins);
+  ComputePluginsFromCommandLine(plugins);
+}
+
+}  // namespace content
diff --git a/content/common/pepper_plugin_list.h b/content/common/pepper_plugin_list.h
new file mode 100644
index 0000000..d460e08
--- /dev/null
+++ b/content/common/pepper_plugin_list.h
@@ -0,0 +1,25 @@
+// 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 CONTENT_COMMON_PEPPER_PLUGIN_LIST_H_
+#define CONTENT_COMMON_PEPPER_PLUGIN_LIST_H_
+
+#include <vector>
+
+namespace content {
+struct PepperPluginInfo;
+struct WebPluginInfo;
+
+// Constructs a PepperPluginInfo from a WebPluginInfo. Returns false if
+// the operation is not possible, in particular the WebPluginInfo::type
+// must be one of the pepper types.
+bool MakePepperPluginInfo(const WebPluginInfo& webplugin_info,
+                          PepperPluginInfo* pepper_info);
+
+// Computes the list of known pepper plugins.
+void ComputePepperPluginList(std::vector<PepperPluginInfo>* plugins);
+
+}  // namespace content
+
+#endif  // CONTENT_COMMON_PEPPER_PLUGIN_LIST_H_
diff --git a/content/common/pepper_plugin_registry.cc b/content/common/pepper_plugin_registry.cc
deleted file mode 100644
index 44bc6a0..0000000
--- a/content/common/pepper_plugin_registry.cc
+++ /dev/null
@@ -1,231 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "content/common/pepper_plugin_registry.h"
-
-#include "base/command_line.h"
-#include "base/native_library.h"
-#include "base/strings/string_split.h"
-#include "base/strings/string_util.h"
-#include "base/strings/utf_string_conversions.h"
-#include "content/public/common/content_client.h"
-#include "content/public/common/content_switches.h"
-#include "ppapi/shared_impl/ppapi_permissions.h"
-
-namespace content {
-namespace {
-
-// Appends any plugins from the command line to the given vector.
-void ComputePluginsFromCommandLine(std::vector<PepperPluginInfo>* plugins) {
-  bool out_of_process = true;
-  if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kPpapiInProcess))
-    out_of_process = false;
-
-  const std::string value =
-      CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
-          switches::kRegisterPepperPlugins);
-  if (value.empty())
-    return;
-
-  // FORMAT:
-  // command-line = <plugin-entry> + *( LWS + "," + LWS + <plugin-entry> )
-  // plugin-entry =
-  //    <file-path> +
-  //    ["#" + <name> + ["#" + <description> + ["#" + <version>]]] +
-  //    *1( LWS + ";" + LWS + <mime-type> )
-  std::vector<std::string> modules;
-  base::SplitString(value, ',', &modules);
-  for (size_t i = 0; i < modules.size(); ++i) {
-    std::vector<std::string> parts;
-    base::SplitString(modules[i], ';', &parts);
-    if (parts.size() < 2) {
-      DLOG(ERROR) << "Required mime-type not found";
-      continue;
-    }
-
-    std::vector<std::string> name_parts;
-    base::SplitString(parts[0], '#', &name_parts);
-
-    PepperPluginInfo plugin;
-    plugin.is_out_of_process = out_of_process;
-#if defined(OS_WIN)
-    // This means we can't provide plugins from non-ASCII paths, but
-    // since this switch is only for development I don't think that's
-    // too awful.
-    plugin.path = base::FilePath(ASCIIToUTF16(name_parts[0]));
-#else
-    plugin.path = base::FilePath(name_parts[0]);
-#endif
-    if (name_parts.size() > 1)
-      plugin.name = name_parts[1];
-    if (name_parts.size() > 2)
-      plugin.description = name_parts[2];
-    if (name_parts.size() > 3)
-      plugin.version = name_parts[3];
-    for (size_t j = 1; j < parts.size(); ++j) {
-      WebPluginMimeType mime_type(parts[j],
-                                  std::string(),
-                                  plugin.description);
-      plugin.mime_types.push_back(mime_type);
-    }
-
-    // If the plugin name is empty, use the filename.
-    if (plugin.name.empty())
-      plugin.name = UTF16ToUTF8(plugin.path.BaseName().LossyDisplayName());
-
-    // Command-line plugins get full permissions.
-    plugin.permissions = ppapi::PERMISSION_ALL_BITS;
-
-    plugins->push_back(plugin);
-  }
-}
-
-}  // namespace
-
-bool MakePepperPluginInfo(const WebPluginInfo& webplugin_info,
-                          PepperPluginInfo* pepper_info) {
-  if (!webplugin_info.is_pepper_plugin())
-    return false;
-
-  pepper_info->is_out_of_process =
-      webplugin_info.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS ||
-      webplugin_info.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_UNSANDBOXED;
-  pepper_info->is_sandboxed = webplugin_info.type !=
-      WebPluginInfo::PLUGIN_TYPE_PEPPER_UNSANDBOXED;
-
-  pepper_info->path = base::FilePath(webplugin_info.path);
-  pepper_info->name = UTF16ToASCII(webplugin_info.name);
-  pepper_info->description = UTF16ToASCII(webplugin_info.desc);
-  pepper_info->version = UTF16ToASCII(webplugin_info.version);
-  pepper_info->mime_types = webplugin_info.mime_types;
-  pepper_info->permissions = webplugin_info.pepper_permissions;
-
-  return true;
-}
-
-// static
-PepperPluginRegistry* PepperPluginRegistry::GetInstance() {
-  static PepperPluginRegistry* registry = NULL;
-  // This object leaks.  It is a temporary hack to work around a crash.
-  // http://code.google.com/p/chromium/issues/detail?id=63234
-  if (!registry)
-    registry = new PepperPluginRegistry;
-  return registry;
-}
-
-// static
-void PepperPluginRegistry::ComputeList(std::vector<PepperPluginInfo>* plugins) {
-  GetContentClient()->AddPepperPlugins(plugins);
-  ComputePluginsFromCommandLine(plugins);
-}
-
-// static
-void PepperPluginRegistry::PreloadModules() {
-  std::vector<PepperPluginInfo> plugins;
-  ComputeList(&plugins);
-  for (size_t i = 0; i < plugins.size(); ++i) {
-    if (!plugins[i].is_internal && plugins[i].is_sandboxed) {
-      std::string error;
-      base::NativeLibrary library = base::LoadNativeLibrary(plugins[i].path,
-                                                            &error);
-      DLOG_IF(WARNING, !library) << "Unable to load plugin "
-                                 << plugins[i].path.value() << " "
-                                 << error;
-      (void)library;  // Prevent release-mode warning.
-    }
-  }
-}
-
-const PepperPluginInfo* PepperPluginRegistry::GetInfoForPlugin(
-    const WebPluginInfo& info) {
-  for (size_t i = 0; i < plugin_list_.size(); ++i) {
-    if (info.path == plugin_list_[i].path)
-      return &plugin_list_[i];
-  }
-  // We did not find the plugin in our list. But wait! the plugin can also
-  // be a latecomer, as it happens with pepper flash. This information
-  // is actually in |info| and we can use it to construct it and add it to
-  // the list. This same deal needs to be done in the browser side in
-  // PluginService.
-  PepperPluginInfo plugin;
-  if (!MakePepperPluginInfo(info, &plugin))
-    return NULL;
-
-  plugin_list_.push_back(plugin);
-  return &plugin_list_[plugin_list_.size() - 1];
-}
-
-webkit::ppapi::PluginModule* PepperPluginRegistry::GetLiveModule(
-    const base::FilePath& path) {
-  NonOwningModuleMap::iterator it = live_modules_.find(path);
-  if (it == live_modules_.end())
-    return NULL;
-  return it->second;
-}
-
-void PepperPluginRegistry::AddLiveModule(const base::FilePath& path,
-                                         webkit::ppapi::PluginModule* module) {
-  DCHECK(live_modules_.find(path) == live_modules_.end());
-  live_modules_[path] = module;
-}
-
-void PepperPluginRegistry::PluginModuleDead(
-    webkit::ppapi::PluginModule* dead_module) {
-  // DANGER: Don't dereference the dead_module pointer! It may be in the
-  // process of being deleted.
-
-  // Modules aren't destroyed very often and there are normally at most a
-  // couple of them. So for now we just do a brute-force search.
-  for (NonOwningModuleMap::iterator i = live_modules_.begin();
-       i != live_modules_.end(); ++i) {
-    if (i->second == dead_module) {
-      live_modules_.erase(i);
-      return;
-    }
-  }
-  NOTREACHED();  // Should have always found the module above.
-}
-
-PepperPluginRegistry::~PepperPluginRegistry() {
-  // Explicitly clear all preloaded modules first. This will cause callbacks
-  // to erase these modules from the live_modules_ list, and we don't want
-  // that to happen implicitly out-of-order.
-  preloaded_modules_.clear();
-
-  DCHECK(live_modules_.empty());
-}
-
-PepperPluginRegistry::PepperPluginRegistry() {
-  ComputeList(&plugin_list_);
-
-  // Note that in each case, AddLiveModule must be called before completing
-  // initialization. If we bail out (in the continue clauses) before saving
-  // the initialized module, it will still try to unregister itself in its
-  // destructor.
-  for (size_t i = 0; i < plugin_list_.size(); i++) {
-    const PepperPluginInfo& current = plugin_list_[i];
-    if (current.is_out_of_process)
-      continue;  // Out of process plugins need no special pre-initialization.
-
-    scoped_refptr<webkit::ppapi::PluginModule> module =
-        new webkit::ppapi::PluginModule(current.name, current.path, this,
-            ppapi::PpapiPermissions(current.permissions));
-    AddLiveModule(current.path, module.get());
-    if (current.is_internal) {
-      if (!module->InitAsInternalPlugin(current.internal_entry_points)) {
-        DLOG(ERROR) << "Failed to load pepper module: " << current.path.value();
-        continue;
-      }
-    } else {
-      // Preload all external plugins we're not running out of process.
-      if (!module->InitAsLibrary(current.path)) {
-        DLOG(ERROR) << "Failed to load pepper module: " << current.path.value();
-        continue;
-      }
-    }
-    preloaded_modules_[current.path] = module;
-  }
-}
-
-}  // namespace content
diff --git a/content/content_app.target.darwin-arm.mk b/content/content_app.target.darwin-arm.mk
index 5625043..01245f6 100644
--- a/content/content_app.target.darwin-arm.mk
+++ b/content/content_app.target.darwin-arm.mk
@@ -105,10 +105,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
@@ -216,10 +216,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
diff --git a/content/content_app.target.darwin-mips.mk b/content/content_app.target.darwin-mips.mk
index ff486ff..be46495 100644
--- a/content/content_app.target.darwin-mips.mk
+++ b/content/content_app.target.darwin-mips.mk
@@ -104,10 +104,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
@@ -214,10 +214,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
diff --git a/content/content_app.target.darwin-x86.mk b/content/content_app.target.darwin-x86.mk
index 058c02a..6d5f7c2 100644
--- a/content/content_app.target.darwin-x86.mk
+++ b/content/content_app.target.darwin-x86.mk
@@ -106,10 +106,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
@@ -219,10 +219,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
diff --git a/content/content_app.target.linux-arm.mk b/content/content_app.target.linux-arm.mk
index 5625043..01245f6 100644
--- a/content/content_app.target.linux-arm.mk
+++ b/content/content_app.target.linux-arm.mk
@@ -105,10 +105,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
@@ -216,10 +216,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
diff --git a/content/content_app.target.linux-mips.mk b/content/content_app.target.linux-mips.mk
index ff486ff..be46495 100644
--- a/content/content_app.target.linux-mips.mk
+++ b/content/content_app.target.linux-mips.mk
@@ -104,10 +104,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
@@ -214,10 +214,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
diff --git a/content/content_app.target.linux-x86.mk b/content/content_app.target.linux-x86.mk
index 058c02a..6d5f7c2 100644
--- a/content/content_app.target.linux-x86.mk
+++ b/content/content_app.target.linux-x86.mk
@@ -106,10 +106,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
@@ -219,10 +219,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
diff --git a/content/content_browser.gypi b/content/content_browser.gypi
index dab1b40..4fc0861 100644
--- a/content/content_browser.gypi
+++ b/content/content_browser.gypi
@@ -633,8 +633,8 @@
     'browser/loader/resource_handler.cc',
     'browser/loader/resource_handler.h',
     'browser/loader/resource_loader.cc',
-    'browser/loader/resource_loader_delegate.h',
     'browser/loader/resource_loader.h',
+    'browser/loader/resource_loader_delegate.h',
     'browser/loader/resource_message_delegate.cc',
     'browser/loader/resource_message_delegate.h',
     'browser/loader/resource_message_filter.cc',
@@ -655,9 +655,8 @@
     'browser/loader/transfer_navigation_resource_throttle.h',
     'browser/loader/upload_data_stream_builder.cc',
     'browser/loader/upload_data_stream_builder.h',
-    'browser/mach_broker_mac.mm',
     'browser/mach_broker_mac.h',
-    'browser/media_devices_monitor.cc',
+    'browser/mach_broker_mac.mm',
     'browser/media/media_internals.cc',
     'browser/media/media_internals.h',
     'browser/media/media_internals_handler.cc',
@@ -675,6 +674,7 @@
     'browser/media/webrtc_internals_ui.cc',
     'browser/media/webrtc_internals_ui.h',
     'browser/media/webrtc_internals_ui_observer.h',
+    'browser/media_devices_monitor.cc',
     'browser/mime_registry_message_filter.cc',
     'browser/mime_registry_message_filter.h',
     'browser/net/browser_online_state_observer.cc',
@@ -713,12 +713,14 @@
     'browser/profiler_controller_impl.h',
     'browser/profiler_message_filter.cc',
     'browser/profiler_message_filter.h',
+    'browser/quota_dispatcher_host.cc',
+    'browser/quota_dispatcher_host.h',
+    'browser/renderer_host/backing_store.cc',
+    'browser/renderer_host/backing_store.h',
     'browser/renderer_host/backing_store_aura.cc',
     'browser/renderer_host/backing_store_aura.h',
-    'browser/renderer_host/backing_store.cc',
     'browser/renderer_host/backing_store_gtk.cc',
     'browser/renderer_host/backing_store_gtk.h',
-    'browser/renderer_host/backing_store.h',
     'browser/renderer_host/backing_store_mac.h',
     'browser/renderer_host/backing_store_mac.mm',
     'browser/renderer_host/backing_store_manager.cc',
@@ -730,10 +732,8 @@
     'browser/renderer_host/clipboard_message_filter.cc',
     'browser/renderer_host/clipboard_message_filter.h',
     'browser/renderer_host/clipboard_message_filter_mac.mm',
-    'browser/renderer_host/compositor_impl_android.cc',
-    'browser/renderer_host/compositor_impl_android.h',
-    'browser/renderer_host/compositing_iosurface_context_mac.mm',
     'browser/renderer_host/compositing_iosurface_context_mac.h',
+    'browser/renderer_host/compositing_iosurface_context_mac.mm',
     'browser/renderer_host/compositing_iosurface_layer_mac.h',
     'browser/renderer_host/compositing_iosurface_layer_mac.mm',
     'browser/renderer_host/compositing_iosurface_mac.h',
@@ -742,6 +742,8 @@
     'browser/renderer_host/compositing_iosurface_shader_programs_mac.h',
     'browser/renderer_host/compositing_iosurface_transformer_mac.cc',
     'browser/renderer_host/compositing_iosurface_transformer_mac.h',
+    'browser/renderer_host/compositor_impl_android.cc',
+    'browser/renderer_host/compositor_impl_android.h',
     'browser/renderer_host/database_message_filter.cc',
     'browser/renderer_host/database_message_filter.h',
     'browser/renderer_host/device_motion_browser_message_filter.cc',
@@ -776,8 +778,14 @@
     'browser/renderer_host/input/immediate_input_router.h',
     'browser/renderer_host/input/input_router.h',
     'browser/renderer_host/input/input_router_client.h',
+    'browser/renderer_host/input/web_input_event_builders_android.cc',
+    'browser/renderer_host/input/web_input_event_builders_android.h',
     'browser/renderer_host/input/web_input_event_builders_win.cc',
     'browser/renderer_host/input/web_input_event_builders_win.h',
+    'browser/renderer_host/input/web_input_event_util.cc',
+    'browser/renderer_host/input/web_input_event_util.h',
+    'browser/renderer_host/input/web_input_event_util_posix.cc',
+    'browser/renderer_host/input/web_input_event_util_posix.h',
     'browser/renderer_host/java/java_bound_object.cc',
     'browser/renderer_host/java/java_bound_object.h',
     'browser/renderer_host/java/java_bridge_channel_host.cc',
@@ -836,9 +844,9 @@
     'browser/renderer_host/media/web_contents_video_capture_device.h',
     'browser/renderer_host/memory_benchmark_message_filter.cc',
     'browser/renderer_host/memory_benchmark_message_filter.h',
+    'browser/renderer_host/native_web_keyboard_event.cc',
     'browser/renderer_host/native_web_keyboard_event_android.cc',
     'browser/renderer_host/native_web_keyboard_event_aura.cc',
-    'browser/renderer_host/native_web_keyboard_event.cc',
     'browser/renderer_host/native_web_keyboard_event_gtk.cc',
     'browser/renderer_host/native_web_keyboard_event_mac.mm',
     'browser/renderer_host/native_web_keyboard_event_win.cc',
@@ -883,19 +891,17 @@
     'browser/renderer_host/pepper/pepper_tcp_server_socket.h',
     'browser/renderer_host/pepper/pepper_tcp_socket.cc',
     'browser/renderer_host/pepper/pepper_tcp_socket.h',
+    'browser/renderer_host/pepper/pepper_truetype_font_list.h',
     'browser/renderer_host/pepper/pepper_truetype_font_list_android.cc',
     'browser/renderer_host/pepper/pepper_truetype_font_list_host.cc',
     'browser/renderer_host/pepper/pepper_truetype_font_list_host.h',
     'browser/renderer_host/pepper/pepper_truetype_font_list_linux.cc',
     'browser/renderer_host/pepper/pepper_truetype_font_list_mac.mm',
     'browser/renderer_host/pepper/pepper_truetype_font_list_win.cc',
-    'browser/renderer_host/pepper/pepper_truetype_font_list.h',
     'browser/renderer_host/pepper/pepper_udp_socket_message_filter.cc',
     'browser/renderer_host/pepper/pepper_udp_socket_message_filter.h',
     'browser/renderer_host/popup_menu_helper_mac.h',
     'browser/renderer_host/popup_menu_helper_mac.mm',
-    'browser/renderer_host/quota_dispatcher_host.cc',
-    'browser/renderer_host/quota_dispatcher_host.h',
     'browser/renderer_host/render_frame_host_impl.cc',
     'browser/renderer_host/render_frame_host_impl.h',
     'browser/renderer_host/render_message_filter.cc',
diff --git a/content/content_browser.target.darwin-arm.mk b/content/content_browser.target.darwin-arm.mk
index b494afe..d355116 100644
--- a/content/content_browser.target.darwin-arm.mk
+++ b/content/content_browser.target.darwin-arm.mk
@@ -258,7 +258,6 @@
 	content/browser/loader/throttling_resource_handler.cc \
 	content/browser/loader/transfer_navigation_resource_throttle.cc \
 	content/browser/loader/upload_data_stream_builder.cc \
-	content/browser/media_devices_monitor.cc \
 	content/browser/media/media_internals.cc \
 	content/browser/media/media_internals_handler.cc \
 	content/browser/media/media_internals_proxy.cc \
@@ -267,6 +266,7 @@
 	content/browser/media/webrtc_internals.cc \
 	content/browser/media/webrtc_internals_message_handler.cc \
 	content/browser/media/webrtc_internals_ui.cc \
+	content/browser/media_devices_monitor.cc \
 	content/browser/mime_registry_message_filter.cc \
 	content/browser/net/browser_online_state_observer.cc \
 	content/browser/net/sqlite_persistent_cookie_store.cc \
@@ -277,6 +277,7 @@
 	content/browser/power_save_blocker_impl.cc \
 	content/browser/profiler_controller_impl.cc \
 	content/browser/profiler_message_filter.cc \
+	content/browser/quota_dispatcher_host.cc \
 	content/browser/renderer_host/backing_store.cc \
 	content/browser/renderer_host/backing_store_manager.cc \
 	content/browser/renderer_host/basic_mouse_wheel_smooth_scroll_gesture.cc \
@@ -292,6 +293,9 @@
 	content/browser/renderer_host/image_transport_factory_android.cc \
 	content/browser/renderer_host/ime_adapter_android.cc \
 	content/browser/renderer_host/input/immediate_input_router.cc \
+	content/browser/renderer_host/input/web_input_event_builders_android.cc \
+	content/browser/renderer_host/input/web_input_event_util.cc \
+	content/browser/renderer_host/input/web_input_event_util_posix.cc \
 	content/browser/renderer_host/java/java_bound_object.cc \
 	content/browser/renderer_host/java/java_bridge_channel_host.cc \
 	content/browser/renderer_host/java/java_bridge_dispatcher_host.cc \
@@ -320,11 +324,10 @@
 	content/browser/renderer_host/media/web_contents_tracker.cc \
 	content/browser/renderer_host/media/web_contents_video_capture_device.cc \
 	content/browser/renderer_host/memory_benchmark_message_filter.cc \
-	content/browser/renderer_host/native_web_keyboard_event_android.cc \
 	content/browser/renderer_host/native_web_keyboard_event.cc \
+	content/browser/renderer_host/native_web_keyboard_event_android.cc \
 	content/browser/renderer_host/overscroll_configuration.cc \
 	content/browser/renderer_host/overscroll_controller.cc \
-	content/browser/renderer_host/quota_dispatcher_host.cc \
 	content/browser/renderer_host/render_frame_host_impl.cc \
 	content/browser/renderer_host/render_message_filter.cc \
 	content/browser/renderer_host/render_process_host_impl.cc \
@@ -476,11 +479,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_intermediate_dir) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(gyp_shared_intermediate_dir)/content \
@@ -606,11 +609,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_intermediate_dir) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(gyp_shared_intermediate_dir)/content \
diff --git a/content/content_browser.target.darwin-mips.mk b/content/content_browser.target.darwin-mips.mk
index 41557ec..89e456e 100644
--- a/content/content_browser.target.darwin-mips.mk
+++ b/content/content_browser.target.darwin-mips.mk
@@ -258,7 +258,6 @@
 	content/browser/loader/throttling_resource_handler.cc \
 	content/browser/loader/transfer_navigation_resource_throttle.cc \
 	content/browser/loader/upload_data_stream_builder.cc \
-	content/browser/media_devices_monitor.cc \
 	content/browser/media/media_internals.cc \
 	content/browser/media/media_internals_handler.cc \
 	content/browser/media/media_internals_proxy.cc \
@@ -267,6 +266,7 @@
 	content/browser/media/webrtc_internals.cc \
 	content/browser/media/webrtc_internals_message_handler.cc \
 	content/browser/media/webrtc_internals_ui.cc \
+	content/browser/media_devices_monitor.cc \
 	content/browser/mime_registry_message_filter.cc \
 	content/browser/net/browser_online_state_observer.cc \
 	content/browser/net/sqlite_persistent_cookie_store.cc \
@@ -277,6 +277,7 @@
 	content/browser/power_save_blocker_impl.cc \
 	content/browser/profiler_controller_impl.cc \
 	content/browser/profiler_message_filter.cc \
+	content/browser/quota_dispatcher_host.cc \
 	content/browser/renderer_host/backing_store.cc \
 	content/browser/renderer_host/backing_store_manager.cc \
 	content/browser/renderer_host/basic_mouse_wheel_smooth_scroll_gesture.cc \
@@ -292,6 +293,9 @@
 	content/browser/renderer_host/image_transport_factory_android.cc \
 	content/browser/renderer_host/ime_adapter_android.cc \
 	content/browser/renderer_host/input/immediate_input_router.cc \
+	content/browser/renderer_host/input/web_input_event_builders_android.cc \
+	content/browser/renderer_host/input/web_input_event_util.cc \
+	content/browser/renderer_host/input/web_input_event_util_posix.cc \
 	content/browser/renderer_host/java/java_bound_object.cc \
 	content/browser/renderer_host/java/java_bridge_channel_host.cc \
 	content/browser/renderer_host/java/java_bridge_dispatcher_host.cc \
@@ -320,11 +324,10 @@
 	content/browser/renderer_host/media/web_contents_tracker.cc \
 	content/browser/renderer_host/media/web_contents_video_capture_device.cc \
 	content/browser/renderer_host/memory_benchmark_message_filter.cc \
-	content/browser/renderer_host/native_web_keyboard_event_android.cc \
 	content/browser/renderer_host/native_web_keyboard_event.cc \
+	content/browser/renderer_host/native_web_keyboard_event_android.cc \
 	content/browser/renderer_host/overscroll_configuration.cc \
 	content/browser/renderer_host/overscroll_controller.cc \
-	content/browser/renderer_host/quota_dispatcher_host.cc \
 	content/browser/renderer_host/render_frame_host_impl.cc \
 	content/browser/renderer_host/render_message_filter.cc \
 	content/browser/renderer_host/render_process_host_impl.cc \
@@ -475,11 +478,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_intermediate_dir) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(gyp_shared_intermediate_dir)/content \
@@ -604,11 +607,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_intermediate_dir) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(gyp_shared_intermediate_dir)/content \
diff --git a/content/content_browser.target.darwin-x86.mk b/content/content_browser.target.darwin-x86.mk
index f8a29d4..4e5e405 100644
--- a/content/content_browser.target.darwin-x86.mk
+++ b/content/content_browser.target.darwin-x86.mk
@@ -258,7 +258,6 @@
 	content/browser/loader/throttling_resource_handler.cc \
 	content/browser/loader/transfer_navigation_resource_throttle.cc \
 	content/browser/loader/upload_data_stream_builder.cc \
-	content/browser/media_devices_monitor.cc \
 	content/browser/media/media_internals.cc \
 	content/browser/media/media_internals_handler.cc \
 	content/browser/media/media_internals_proxy.cc \
@@ -267,6 +266,7 @@
 	content/browser/media/webrtc_internals.cc \
 	content/browser/media/webrtc_internals_message_handler.cc \
 	content/browser/media/webrtc_internals_ui.cc \
+	content/browser/media_devices_monitor.cc \
 	content/browser/mime_registry_message_filter.cc \
 	content/browser/net/browser_online_state_observer.cc \
 	content/browser/net/sqlite_persistent_cookie_store.cc \
@@ -277,6 +277,7 @@
 	content/browser/power_save_blocker_impl.cc \
 	content/browser/profiler_controller_impl.cc \
 	content/browser/profiler_message_filter.cc \
+	content/browser/quota_dispatcher_host.cc \
 	content/browser/renderer_host/backing_store.cc \
 	content/browser/renderer_host/backing_store_manager.cc \
 	content/browser/renderer_host/basic_mouse_wheel_smooth_scroll_gesture.cc \
@@ -292,6 +293,9 @@
 	content/browser/renderer_host/image_transport_factory_android.cc \
 	content/browser/renderer_host/ime_adapter_android.cc \
 	content/browser/renderer_host/input/immediate_input_router.cc \
+	content/browser/renderer_host/input/web_input_event_builders_android.cc \
+	content/browser/renderer_host/input/web_input_event_util.cc \
+	content/browser/renderer_host/input/web_input_event_util_posix.cc \
 	content/browser/renderer_host/java/java_bound_object.cc \
 	content/browser/renderer_host/java/java_bridge_channel_host.cc \
 	content/browser/renderer_host/java/java_bridge_dispatcher_host.cc \
@@ -320,11 +324,10 @@
 	content/browser/renderer_host/media/web_contents_tracker.cc \
 	content/browser/renderer_host/media/web_contents_video_capture_device.cc \
 	content/browser/renderer_host/memory_benchmark_message_filter.cc \
-	content/browser/renderer_host/native_web_keyboard_event_android.cc \
 	content/browser/renderer_host/native_web_keyboard_event.cc \
+	content/browser/renderer_host/native_web_keyboard_event_android.cc \
 	content/browser/renderer_host/overscroll_configuration.cc \
 	content/browser/renderer_host/overscroll_controller.cc \
-	content/browser/renderer_host/quota_dispatcher_host.cc \
 	content/browser/renderer_host/render_frame_host_impl.cc \
 	content/browser/renderer_host/render_message_filter.cc \
 	content/browser/renderer_host/render_process_host_impl.cc \
@@ -477,11 +480,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_intermediate_dir) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(gyp_shared_intermediate_dir)/content \
@@ -609,11 +612,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_intermediate_dir) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(gyp_shared_intermediate_dir)/content \
diff --git a/content/content_browser.target.linux-arm.mk b/content/content_browser.target.linux-arm.mk
index b494afe..d355116 100644
--- a/content/content_browser.target.linux-arm.mk
+++ b/content/content_browser.target.linux-arm.mk
@@ -258,7 +258,6 @@
 	content/browser/loader/throttling_resource_handler.cc \
 	content/browser/loader/transfer_navigation_resource_throttle.cc \
 	content/browser/loader/upload_data_stream_builder.cc \
-	content/browser/media_devices_monitor.cc \
 	content/browser/media/media_internals.cc \
 	content/browser/media/media_internals_handler.cc \
 	content/browser/media/media_internals_proxy.cc \
@@ -267,6 +266,7 @@
 	content/browser/media/webrtc_internals.cc \
 	content/browser/media/webrtc_internals_message_handler.cc \
 	content/browser/media/webrtc_internals_ui.cc \
+	content/browser/media_devices_monitor.cc \
 	content/browser/mime_registry_message_filter.cc \
 	content/browser/net/browser_online_state_observer.cc \
 	content/browser/net/sqlite_persistent_cookie_store.cc \
@@ -277,6 +277,7 @@
 	content/browser/power_save_blocker_impl.cc \
 	content/browser/profiler_controller_impl.cc \
 	content/browser/profiler_message_filter.cc \
+	content/browser/quota_dispatcher_host.cc \
 	content/browser/renderer_host/backing_store.cc \
 	content/browser/renderer_host/backing_store_manager.cc \
 	content/browser/renderer_host/basic_mouse_wheel_smooth_scroll_gesture.cc \
@@ -292,6 +293,9 @@
 	content/browser/renderer_host/image_transport_factory_android.cc \
 	content/browser/renderer_host/ime_adapter_android.cc \
 	content/browser/renderer_host/input/immediate_input_router.cc \
+	content/browser/renderer_host/input/web_input_event_builders_android.cc \
+	content/browser/renderer_host/input/web_input_event_util.cc \
+	content/browser/renderer_host/input/web_input_event_util_posix.cc \
 	content/browser/renderer_host/java/java_bound_object.cc \
 	content/browser/renderer_host/java/java_bridge_channel_host.cc \
 	content/browser/renderer_host/java/java_bridge_dispatcher_host.cc \
@@ -320,11 +324,10 @@
 	content/browser/renderer_host/media/web_contents_tracker.cc \
 	content/browser/renderer_host/media/web_contents_video_capture_device.cc \
 	content/browser/renderer_host/memory_benchmark_message_filter.cc \
-	content/browser/renderer_host/native_web_keyboard_event_android.cc \
 	content/browser/renderer_host/native_web_keyboard_event.cc \
+	content/browser/renderer_host/native_web_keyboard_event_android.cc \
 	content/browser/renderer_host/overscroll_configuration.cc \
 	content/browser/renderer_host/overscroll_controller.cc \
-	content/browser/renderer_host/quota_dispatcher_host.cc \
 	content/browser/renderer_host/render_frame_host_impl.cc \
 	content/browser/renderer_host/render_message_filter.cc \
 	content/browser/renderer_host/render_process_host_impl.cc \
@@ -476,11 +479,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_intermediate_dir) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(gyp_shared_intermediate_dir)/content \
@@ -606,11 +609,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_intermediate_dir) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(gyp_shared_intermediate_dir)/content \
diff --git a/content/content_browser.target.linux-mips.mk b/content/content_browser.target.linux-mips.mk
index 41557ec..89e456e 100644
--- a/content/content_browser.target.linux-mips.mk
+++ b/content/content_browser.target.linux-mips.mk
@@ -258,7 +258,6 @@
 	content/browser/loader/throttling_resource_handler.cc \
 	content/browser/loader/transfer_navigation_resource_throttle.cc \
 	content/browser/loader/upload_data_stream_builder.cc \
-	content/browser/media_devices_monitor.cc \
 	content/browser/media/media_internals.cc \
 	content/browser/media/media_internals_handler.cc \
 	content/browser/media/media_internals_proxy.cc \
@@ -267,6 +266,7 @@
 	content/browser/media/webrtc_internals.cc \
 	content/browser/media/webrtc_internals_message_handler.cc \
 	content/browser/media/webrtc_internals_ui.cc \
+	content/browser/media_devices_monitor.cc \
 	content/browser/mime_registry_message_filter.cc \
 	content/browser/net/browser_online_state_observer.cc \
 	content/browser/net/sqlite_persistent_cookie_store.cc \
@@ -277,6 +277,7 @@
 	content/browser/power_save_blocker_impl.cc \
 	content/browser/profiler_controller_impl.cc \
 	content/browser/profiler_message_filter.cc \
+	content/browser/quota_dispatcher_host.cc \
 	content/browser/renderer_host/backing_store.cc \
 	content/browser/renderer_host/backing_store_manager.cc \
 	content/browser/renderer_host/basic_mouse_wheel_smooth_scroll_gesture.cc \
@@ -292,6 +293,9 @@
 	content/browser/renderer_host/image_transport_factory_android.cc \
 	content/browser/renderer_host/ime_adapter_android.cc \
 	content/browser/renderer_host/input/immediate_input_router.cc \
+	content/browser/renderer_host/input/web_input_event_builders_android.cc \
+	content/browser/renderer_host/input/web_input_event_util.cc \
+	content/browser/renderer_host/input/web_input_event_util_posix.cc \
 	content/browser/renderer_host/java/java_bound_object.cc \
 	content/browser/renderer_host/java/java_bridge_channel_host.cc \
 	content/browser/renderer_host/java/java_bridge_dispatcher_host.cc \
@@ -320,11 +324,10 @@
 	content/browser/renderer_host/media/web_contents_tracker.cc \
 	content/browser/renderer_host/media/web_contents_video_capture_device.cc \
 	content/browser/renderer_host/memory_benchmark_message_filter.cc \
-	content/browser/renderer_host/native_web_keyboard_event_android.cc \
 	content/browser/renderer_host/native_web_keyboard_event.cc \
+	content/browser/renderer_host/native_web_keyboard_event_android.cc \
 	content/browser/renderer_host/overscroll_configuration.cc \
 	content/browser/renderer_host/overscroll_controller.cc \
-	content/browser/renderer_host/quota_dispatcher_host.cc \
 	content/browser/renderer_host/render_frame_host_impl.cc \
 	content/browser/renderer_host/render_message_filter.cc \
 	content/browser/renderer_host/render_process_host_impl.cc \
@@ -475,11 +478,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_intermediate_dir) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(gyp_shared_intermediate_dir)/content \
@@ -604,11 +607,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_intermediate_dir) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(gyp_shared_intermediate_dir)/content \
diff --git a/content/content_browser.target.linux-x86.mk b/content/content_browser.target.linux-x86.mk
index f8a29d4..4e5e405 100644
--- a/content/content_browser.target.linux-x86.mk
+++ b/content/content_browser.target.linux-x86.mk
@@ -258,7 +258,6 @@
 	content/browser/loader/throttling_resource_handler.cc \
 	content/browser/loader/transfer_navigation_resource_throttle.cc \
 	content/browser/loader/upload_data_stream_builder.cc \
-	content/browser/media_devices_monitor.cc \
 	content/browser/media/media_internals.cc \
 	content/browser/media/media_internals_handler.cc \
 	content/browser/media/media_internals_proxy.cc \
@@ -267,6 +266,7 @@
 	content/browser/media/webrtc_internals.cc \
 	content/browser/media/webrtc_internals_message_handler.cc \
 	content/browser/media/webrtc_internals_ui.cc \
+	content/browser/media_devices_monitor.cc \
 	content/browser/mime_registry_message_filter.cc \
 	content/browser/net/browser_online_state_observer.cc \
 	content/browser/net/sqlite_persistent_cookie_store.cc \
@@ -277,6 +277,7 @@
 	content/browser/power_save_blocker_impl.cc \
 	content/browser/profiler_controller_impl.cc \
 	content/browser/profiler_message_filter.cc \
+	content/browser/quota_dispatcher_host.cc \
 	content/browser/renderer_host/backing_store.cc \
 	content/browser/renderer_host/backing_store_manager.cc \
 	content/browser/renderer_host/basic_mouse_wheel_smooth_scroll_gesture.cc \
@@ -292,6 +293,9 @@
 	content/browser/renderer_host/image_transport_factory_android.cc \
 	content/browser/renderer_host/ime_adapter_android.cc \
 	content/browser/renderer_host/input/immediate_input_router.cc \
+	content/browser/renderer_host/input/web_input_event_builders_android.cc \
+	content/browser/renderer_host/input/web_input_event_util.cc \
+	content/browser/renderer_host/input/web_input_event_util_posix.cc \
 	content/browser/renderer_host/java/java_bound_object.cc \
 	content/browser/renderer_host/java/java_bridge_channel_host.cc \
 	content/browser/renderer_host/java/java_bridge_dispatcher_host.cc \
@@ -320,11 +324,10 @@
 	content/browser/renderer_host/media/web_contents_tracker.cc \
 	content/browser/renderer_host/media/web_contents_video_capture_device.cc \
 	content/browser/renderer_host/memory_benchmark_message_filter.cc \
-	content/browser/renderer_host/native_web_keyboard_event_android.cc \
 	content/browser/renderer_host/native_web_keyboard_event.cc \
+	content/browser/renderer_host/native_web_keyboard_event_android.cc \
 	content/browser/renderer_host/overscroll_configuration.cc \
 	content/browser/renderer_host/overscroll_controller.cc \
-	content/browser/renderer_host/quota_dispatcher_host.cc \
 	content/browser/renderer_host/render_frame_host_impl.cc \
 	content/browser/renderer_host/render_message_filter.cc \
 	content/browser/renderer_host/render_process_host_impl.cc \
@@ -477,11 +480,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_intermediate_dir) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(gyp_shared_intermediate_dir)/content \
@@ -609,11 +612,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_intermediate_dir) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(gyp_shared_intermediate_dir)/content \
diff --git a/content/content_child.target.darwin-arm.mk b/content/content_child.target.darwin-arm.mk
index 552c22a..69bbd0c 100644
--- a/content/content_child.target.darwin-arm.mk
+++ b/content/content_child.target.darwin-arm.mk
@@ -147,10 +147,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
@@ -262,10 +262,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
diff --git a/content/content_child.target.darwin-mips.mk b/content/content_child.target.darwin-mips.mk
index 640cfc1..b9f3ece 100644
--- a/content/content_child.target.darwin-mips.mk
+++ b/content/content_child.target.darwin-mips.mk
@@ -146,10 +146,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
@@ -260,10 +260,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
diff --git a/content/content_child.target.darwin-x86.mk b/content/content_child.target.darwin-x86.mk
index d09b00b..33d662e 100644
--- a/content/content_child.target.darwin-x86.mk
+++ b/content/content_child.target.darwin-x86.mk
@@ -148,10 +148,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
@@ -265,10 +265,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
diff --git a/content/content_child.target.linux-arm.mk b/content/content_child.target.linux-arm.mk
index 552c22a..69bbd0c 100644
--- a/content/content_child.target.linux-arm.mk
+++ b/content/content_child.target.linux-arm.mk
@@ -147,10 +147,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
@@ -262,10 +262,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
diff --git a/content/content_child.target.linux-mips.mk b/content/content_child.target.linux-mips.mk
index 640cfc1..b9f3ece 100644
--- a/content/content_child.target.linux-mips.mk
+++ b/content/content_child.target.linux-mips.mk
@@ -146,10 +146,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
@@ -260,10 +260,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
diff --git a/content/content_child.target.linux-x86.mk b/content/content_child.target.linux-x86.mk
index d09b00b..33d662e 100644
--- a/content/content_child.target.linux-x86.mk
+++ b/content/content_child.target.linux-x86.mk
@@ -148,10 +148,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
@@ -265,10 +265,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/external/icu4c/common \
diff --git a/content/content_common.gypi b/content/content_common.gypi
index 900aa36..b9eb787 100644
--- a/content/content_common.gypi
+++ b/content/content_common.gypi
@@ -284,8 +284,8 @@
     'common/page_state_serialization.h',
     'common/page_zoom.cc',
     'common/pepper_messages.h',
-    'common/pepper_plugin_registry.cc',
-    'common/pepper_plugin_registry.h',
+    'common/pepper_plugin_list.cc',
+    'common/pepper_plugin_list.h',
     'common/pepper_renderer_instance_data.cc',
     'common/pepper_renderer_instance_data.h',
     'common/plugin_carbon_interpose_constants_mac.cc',
@@ -455,8 +455,8 @@
       ],
     }, {  # enable_plugins == 0
       'sources!': [
-        'common/pepper_plugin_registry.cc',
-        'common/pepper_plugin_registry.h',
+        'common/pepper_plugin_list.cc',
+        'common/pepper_plugin_list.h',
       ],
     }],
     ['enable_gpu==1', {
diff --git a/content/content_common.target.darwin-arm.mk b/content/content_common.target.darwin-arm.mk
index bca7e4c..e93b795 100644
--- a/content/content_common.target.darwin-arm.mk
+++ b/content/content_common.target.darwin-arm.mk
@@ -207,10 +207,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -322,10 +322,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/content/content_common.target.darwin-mips.mk b/content/content_common.target.darwin-mips.mk
index f728819..0e3f8ec 100644
--- a/content/content_common.target.darwin-mips.mk
+++ b/content/content_common.target.darwin-mips.mk
@@ -206,10 +206,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -320,10 +320,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/content/content_common.target.darwin-x86.mk b/content/content_common.target.darwin-x86.mk
index 349ffa4..ec24faf 100644
--- a/content/content_common.target.darwin-x86.mk
+++ b/content/content_common.target.darwin-x86.mk
@@ -208,10 +208,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -325,10 +325,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/content/content_common.target.linux-arm.mk b/content/content_common.target.linux-arm.mk
index bca7e4c..e93b795 100644
--- a/content/content_common.target.linux-arm.mk
+++ b/content/content_common.target.linux-arm.mk
@@ -207,10 +207,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -322,10 +322,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/content/content_common.target.linux-mips.mk b/content/content_common.target.linux-mips.mk
index f728819..0e3f8ec 100644
--- a/content/content_common.target.linux-mips.mk
+++ b/content/content_common.target.linux-mips.mk
@@ -206,10 +206,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -320,10 +320,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/content/content_common.target.linux-x86.mk b/content/content_common.target.linux-x86.mk
index 349ffa4..ec24faf 100644
--- a/content/content_common.target.linux-x86.mk
+++ b/content/content_common.target.linux-x86.mk
@@ -208,10 +208,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -325,10 +325,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/content/content_gpu.target.darwin-arm.mk b/content/content_gpu.target.darwin-arm.mk
index b27bfa9..ed6002b 100644
--- a/content/content_gpu.target.darwin-arm.mk
+++ b/content/content_gpu.target.darwin-arm.mk
@@ -101,10 +101,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -210,10 +210,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/content/content_gpu.target.darwin-mips.mk b/content/content_gpu.target.darwin-mips.mk
index 87ab604..3a11bb2 100644
--- a/content/content_gpu.target.darwin-mips.mk
+++ b/content/content_gpu.target.darwin-mips.mk
@@ -100,10 +100,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -208,10 +208,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/content/content_gpu.target.darwin-x86.mk b/content/content_gpu.target.darwin-x86.mk
index e4f3a77..1b07528 100644
--- a/content/content_gpu.target.darwin-x86.mk
+++ b/content/content_gpu.target.darwin-x86.mk
@@ -103,10 +103,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -215,10 +215,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/content/content_gpu.target.linux-arm.mk b/content/content_gpu.target.linux-arm.mk
index b27bfa9..ed6002b 100644
--- a/content/content_gpu.target.linux-arm.mk
+++ b/content/content_gpu.target.linux-arm.mk
@@ -101,10 +101,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -210,10 +210,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/content/content_gpu.target.linux-mips.mk b/content/content_gpu.target.linux-mips.mk
index 87ab604..3a11bb2 100644
--- a/content/content_gpu.target.linux-mips.mk
+++ b/content/content_gpu.target.linux-mips.mk
@@ -100,10 +100,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -208,10 +208,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/content/content_gpu.target.linux-x86.mk b/content/content_gpu.target.linux-x86.mk
index e4f3a77..1b07528 100644
--- a/content/content_gpu.target.linux-x86.mk
+++ b/content/content_gpu.target.linux-x86.mk
@@ -103,10 +103,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -215,10 +215,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/content/content_renderer.gypi b/content/content_renderer.gypi
index 01a7048..f60d010 100644
--- a/content/content_renderer.gypi
+++ b/content/content_renderer.gypi
@@ -46,6 +46,7 @@
     'public/renderer/navigation_state.cc',
     'public/renderer/navigation_state.h',
     'public/renderer/password_form_conversion_utils.h',
+    'public/renderer/ppapi_plugin_instance.h',
     'public/renderer/renderer_ppapi_host.h',
     'public/renderer/render_frame.h',
     'public/renderer/render_process_observer.cc',
@@ -258,8 +259,29 @@
     'renderer/paint_aggregator.cc',
     'renderer/paint_aggregator.h',
     'renderer/password_form_conversion_utils.cc',
+    'renderer/pepper/audio_helper.cc',
+    'renderer/pepper/audio_helper.h',
+    'renderer/pepper/common.h',
+    'renderer/pepper/content_decryptor_delegate.cc',
+    'renderer/pepper/content_decryptor_delegate.h',
     'renderer/pepper/content_renderer_pepper_host_factory.cc',
     'renderer/pepper/content_renderer_pepper_host_factory.h',
+    'renderer/pepper/event_conversion.cc',
+    'renderer/pepper/event_conversion.h',
+    'renderer/pepper/fullscreen_container.h',
+    'renderer/pepper/gfx_conversion.h',
+    'renderer/pepper/host_array_buffer_var.cc',
+    'renderer/pepper/host_array_buffer_var.h',
+    'renderer/pepper/host_globals.cc',
+    'renderer/pepper/host_globals.h',
+    'renderer/pepper/host_var_tracker.cc',
+    'renderer/pepper/host_var_tracker.h',
+    'renderer/pepper/message_channel.cc',
+    'renderer/pepper/message_channel.h',
+    'renderer/pepper/npapi_glue.cc',
+    'renderer/pepper/npapi_glue.h',
+    'renderer/pepper/npobject_var.cc',
+    'renderer/pepper/npobject_var.h',
     'renderer/pepper/pepper_audio_input_host.cc',
     'renderer/pepper/pepper_audio_input_host.h',
     'renderer/pepper/pepper_broker_impl.cc',
@@ -296,6 +318,8 @@
     'renderer/pepper/pepper_platform_video_capture_impl.h',
     'renderer/pepper/pepper_plugin_delegate_impl.cc',
     'renderer/pepper/pepper_plugin_delegate_impl.h',
+    'renderer/pepper/pepper_plugin_registry.cc',
+    'renderer/pepper/pepper_plugin_registry.h',
     'renderer/pepper/pepper_proxy_channel_delegate_impl.cc',
     'renderer/pepper/pepper_proxy_channel_delegate_impl.h',
     'renderer/pepper/pepper_truetype_font.h',
@@ -311,10 +335,72 @@
     'renderer/pepper/pepper_video_capture_host.h',
     'renderer/pepper/pepper_websocket_host.cc',
     'renderer/pepper/pepper_websocket_host.h',
+    'renderer/pepper/plugin_delegate.h',
+    'renderer/pepper/plugin_module.cc',
+    'renderer/pepper/plugin_module.h',
+    'renderer/pepper/plugin_object.cc',
+    'renderer/pepper/plugin_object.h',
+    'renderer/pepper/ppapi_interface_factory.cc',
+    'renderer/pepper/ppapi_interface_factory.h',
+    'renderer/pepper/ppapi_plugin_instance_impl.cc',
+    'renderer/pepper/ppapi_plugin_instance_impl.h',
+    'renderer/pepper/ppapi_webplugin_impl.cc',
+    'renderer/pepper/ppapi_webplugin_impl.h',
+    'renderer/pepper/ppb_audio_impl.cc',
+    'renderer/pepper/ppb_audio_impl.h',
+    'renderer/pepper/ppb_broker_impl.cc',
+    'renderer/pepper/ppb_broker_impl.h',
+    'renderer/pepper/ppb_buffer_impl.cc',
+    'renderer/pepper/ppb_buffer_impl.h',
+    'renderer/pepper/ppb_file_ref_impl.cc',
+    'renderer/pepper/ppb_file_ref_impl.h',
+    'renderer/pepper/ppb_flash_message_loop_impl.cc',
+    'renderer/pepper/ppb_flash_message_loop_impl.h',
+    'renderer/pepper/ppb_gpu_blacklist_private_impl.cc',
+    'renderer/pepper/ppb_gpu_blacklist_private_impl.h',
+    'renderer/pepper/ppb_graphics_3d_impl.cc',
+    'renderer/pepper/ppb_graphics_3d_impl.h',
+    'renderer/pepper/ppb_image_data_impl.cc',
+    'renderer/pepper/ppb_image_data_impl.h',
+    'renderer/pepper/ppb_network_monitor_private_impl.cc',
+    'renderer/pepper/ppb_network_monitor_private_impl.h',
+    'renderer/pepper/ppb_proxy_impl.cc',
+    'renderer/pepper/ppb_proxy_impl.h',
+    'renderer/pepper/ppb_scrollbar_impl.cc',
+    'renderer/pepper/ppb_scrollbar_impl.h',
+    'renderer/pepper/ppb_tcp_server_socket_private_impl.cc',
+    'renderer/pepper/ppb_tcp_server_socket_private_impl.h',
+    'renderer/pepper/ppb_tcp_socket_private_impl.cc',
+    'renderer/pepper/ppb_tcp_socket_private_impl.h',
+    'renderer/pepper/ppb_uma_private_impl.cc',
+    'renderer/pepper/ppb_uma_private_impl.h',
+    'renderer/pepper/ppb_var_deprecated_impl.cc',
+    'renderer/pepper/ppb_var_deprecated_impl.h',
+    'renderer/pepper/ppb_video_decoder_impl.cc',
+    'renderer/pepper/ppb_video_decoder_impl.h',
+    'renderer/pepper/ppb_widget_impl.cc',
+    'renderer/pepper/ppb_widget_impl.h',
+    'renderer/pepper/ppb_x509_certificate_private_impl.cc',
+    'renderer/pepper/ppb_x509_certificate_private_impl.h',
+    'renderer/pepper/quota_file_io.cc',
+    'renderer/pepper/quota_file_io.h',
     'renderer/pepper/renderer_ppapi_host_impl.cc',
     'renderer/pepper/renderer_ppapi_host_impl.h',
+    'renderer/pepper/resource_creation_impl.cc',
+    'renderer/pepper/resource_creation_impl.h',
+    'renderer/pepper/resource_helper.cc',
+    'renderer/pepper/resource_helper.h',
+    'renderer/pepper/url_request_info_util.cc',
+    'renderer/pepper/url_request_info_util.h',
     'renderer/pepper/url_response_info_util.cc',
     'renderer/pepper/url_response_info_util.h',
+    'renderer/pepper/usb_key_code_conversion.h',
+    'renderer/pepper/usb_key_code_conversion.cc',
+    'renderer/pepper/usb_key_code_conversion_linux.cc',
+    'renderer/pepper/usb_key_code_conversion_mac.cc',
+    'renderer/pepper/usb_key_code_conversion_win.cc',
+    'renderer/pepper/v8_var_converter.cc',
+    'renderer/pepper/v8_var_converter.h',
     'renderer/plugin_channel_host.cc',
     'renderer/plugin_channel_host.h',
     'renderer/browser_plugin/browser_plugin.cc',
@@ -591,6 +677,8 @@
         ['exclude', '^renderer/pepper/'],
       ],
       'sources!': [
+        'renderer/media/video_destination_handler.cc',
+        'renderer/media/video_destination_handler.h',
         'renderer/render_widget_fullscreen_pepper.cc',
         'renderer/render_widget_fullscreen_pepper.h',
       ],
@@ -601,6 +689,13 @@
         'renderer/media/crypto/ppapi_decryptor.h',
       ],
     }],
+    ['enable_gpu!=1', {
+      'sources!': [
+        'renderer/pepper/ppb_graphics_3d_impl.cc',
+        'renderer/pepper/ppb_graphics_3d_impl.h',
+        'renderer/pepper/ppb_open_gl_es_impl.cc',
+      ],
+    }],
   ],
   'target_conditions': [
     ['OS=="android"', {
diff --git a/content/content_renderer.target.darwin-arm.mk b/content/content_renderer.target.darwin-arm.mk
index 14112f8..ba9df3b 100644
--- a/content/content_renderer.target.darwin-arm.mk
+++ b/content/content_renderer.target.darwin-arm.mk
@@ -270,11 +270,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(gyp_shared_intermediate_dir)/content \
@@ -412,11 +412,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(gyp_shared_intermediate_dir)/content \
diff --git a/content/content_renderer.target.darwin-mips.mk b/content/content_renderer.target.darwin-mips.mk
index c476a1d..f388456 100644
--- a/content/content_renderer.target.darwin-mips.mk
+++ b/content/content_renderer.target.darwin-mips.mk
@@ -269,11 +269,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(gyp_shared_intermediate_dir)/content \
@@ -410,11 +410,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(gyp_shared_intermediate_dir)/content \
diff --git a/content/content_renderer.target.darwin-x86.mk b/content/content_renderer.target.darwin-x86.mk
index 0d0f8fa..5950770 100644
--- a/content/content_renderer.target.darwin-x86.mk
+++ b/content/content_renderer.target.darwin-x86.mk
@@ -271,11 +271,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(gyp_shared_intermediate_dir)/content \
@@ -415,11 +415,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(gyp_shared_intermediate_dir)/content \
diff --git a/content/content_renderer.target.linux-arm.mk b/content/content_renderer.target.linux-arm.mk
index 14112f8..ba9df3b 100644
--- a/content/content_renderer.target.linux-arm.mk
+++ b/content/content_renderer.target.linux-arm.mk
@@ -270,11 +270,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(gyp_shared_intermediate_dir)/content \
@@ -412,11 +412,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(gyp_shared_intermediate_dir)/content \
diff --git a/content/content_renderer.target.linux-mips.mk b/content/content_renderer.target.linux-mips.mk
index c476a1d..f388456 100644
--- a/content/content_renderer.target.linux-mips.mk
+++ b/content/content_renderer.target.linux-mips.mk
@@ -269,11 +269,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(gyp_shared_intermediate_dir)/content \
@@ -410,11 +410,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(gyp_shared_intermediate_dir)/content \
diff --git a/content/content_renderer.target.linux-x86.mk b/content/content_renderer.target.linux-x86.mk
index 0d0f8fa..5950770 100644
--- a/content/content_renderer.target.linux-x86.mk
+++ b/content/content_renderer.target.linux-x86.mk
@@ -271,11 +271,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(gyp_shared_intermediate_dir)/content \
@@ -415,11 +415,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(gyp_shared_intermediate_dir)/content \
diff --git a/content/content_tests.gypi b/content/content_tests.gypi
index 9e2564d..dd31481 100644
--- a/content/content_tests.gypi
+++ b/content/content_tests.gypi
@@ -428,12 +428,24 @@
         'renderer/media/test_response_generator.h',
         'renderer/media/video_capture_impl_unittest.cc',
         'renderer/media/video_capture_message_filter_unittest.cc',
+        'renderer/media/video_destination_handler_unittest.cc',
         'renderer/media/webaudiosourceprovider_impl_unittest.cc',
         'renderer/paint_aggregator_unittest.cc',
-        'renderer/skia_benchmarking_extension_unittest.cc',
+        'renderer/pepper/host_var_tracker_unittest.cc',
+        'renderer/pepper/mock_platform_image_2d.cc',
+        'renderer/pepper/mock_platform_image_2d.h',
+        'renderer/pepper/mock_plugin_delegate.cc',
+        'renderer/pepper/mock_plugin_delegate.h',
+        'renderer/pepper/mock_resource.h',
+        'renderer/pepper/ppapi_plugin_instance_unittest.cc',
+        'renderer/pepper/ppapi_unittest.cc',
+        'renderer/pepper/ppapi_unittest.h',
+        'renderer/pepper/quota_file_io_unittest.cc',
+        'renderer/pepper/v8_var_converter_unittest.cc',
         'renderer/pepper/pepper_broker_impl_unittest.cc',
         'renderer/render_thread_impl_unittest.cc',
         'renderer/render_view_impl_unittest.cc',
+        'renderer/skia_benchmarking_extension_unittest.cc',
         'renderer/v8_value_converter_impl_unittest.cc',
         'renderer/webplugin_impl_unittest.cc',
         'test/image_decoder_test.cc',
@@ -531,17 +543,6 @@
         '../webkit/mocks/mock_weburlloader.cc',
         '../webkit/mocks/mock_weburlloader.h',
         '../webkit/common/user_agent/user_agent_unittest.cc',
-        '../webkit/plugins/ppapi/host_var_tracker_unittest.cc',
-        '../webkit/plugins/ppapi/mock_platform_image_2d.cc',
-        '../webkit/plugins/ppapi/mock_platform_image_2d.h',
-        '../webkit/plugins/ppapi/mock_plugin_delegate.cc',
-        '../webkit/plugins/ppapi/mock_plugin_delegate.h',
-        '../webkit/plugins/ppapi/mock_resource.h',
-        '../webkit/plugins/ppapi/ppapi_plugin_instance_unittest.cc',
-        '../webkit/plugins/ppapi/ppapi_unittest.cc',
-        '../webkit/plugins/ppapi/ppapi_unittest.h',
-        '../webkit/plugins/ppapi/quota_file_io_unittest.cc',
-        '../webkit/plugins/ppapi/v8_var_converter_unittest.cc',
         '../webkit/browser/quota/mock_quota_manager.cc',
         '../webkit/browser/quota/mock_quota_manager.h',
         '../webkit/browser/quota/mock_quota_manager_unittest.cc',
@@ -606,6 +607,7 @@
           ],
           'sources!': [
             'browser/plugin_loader_posix_unittest.cc',
+            'renderer/media/video_destination_handler_unittest.cc',
           ],
         }],
         ['enable_webrtc==1', {
@@ -621,7 +623,6 @@
             'renderer/media/media_stream_impl_unittest.cc',
             'renderer/media/rtc_peer_connection_handler_unittest.cc',
             'renderer/media/rtc_video_decoder_unittest.cc',
-            'renderer/media/video_destination_handler_unittest.cc',
             'renderer/media/video_source_handler_unittest.cc',
             'renderer/media/webrtc_audio_device_unittest.cc',
             'renderer/media/webrtc_identity_service_unittest.cc',
@@ -633,6 +634,10 @@
             '../third_party/webrtc/modules/modules.gyp:video_capture_module',
             '../third_party/webrtc/voice_engine/voice_engine.gyp:voice_engine',
           ]
+        }, {
+          'sources!': [
+            'renderer/media/video_destination_handler_unittest.cc',
+          ],
         }],
         ['enable_webrtc==1 and (OS=="linux" or OS=="mac" or OS=="win")', {
           'sources': [
@@ -848,6 +853,10 @@
             'renderer/dom_serializer_browsertest.cc',
             'renderer/mouse_lock_dispatcher_browsertest.cc',
             'renderer/password_form_conversion_utils_browsertest.cc',
+            'renderer/pepper/mock_platform_image_2d.cc',
+            'renderer/pepper/mock_platform_image_2d.h',
+            'renderer/pepper/mock_plugin_delegate.cc',
+            'renderer/pepper/mock_plugin_delegate.h',
             'renderer/pepper/mock_renderer_ppapi_host.cc',
             'renderer/pepper/pepper_device_enumeration_host_helper_unittest.cc',
             'renderer/pepper/pepper_file_chooser_host_unittest.cc',
@@ -868,10 +877,6 @@
             'test/content_browser_test_utils_mac.mm',
             'test/content_browser_test_test.cc',
             'test/content_test_launcher.cc',
-            '../webkit/plugins/ppapi/mock_platform_image_2d.cc',
-            '../webkit/plugins/ppapi/mock_platform_image_2d.h',
-            '../webkit/plugins/ppapi/mock_plugin_delegate.cc',
-            '../webkit/plugins/ppapi/mock_plugin_delegate.h',
             '../webkit/renderer/cpp_binding_example.cc',
             '../webkit/renderer/cpp_binding_example.h',
           ],
@@ -969,12 +974,12 @@
               ],
             }],
             ['enable_plugins==0', {
+              'sources/': [
+                ['exclude', '^renderer/pepper/'],
+              ],
               'sources!': [
                 'browser/plugin_service_impl_browsertest.cc',
                 'browser/plugin_data_remover_impl_browsertest.cc',
-                'renderer/pepper/pepper_device_enumeration_host_helper_unittest.cc',
-                'renderer/pepper/pepper_file_chooser_host_unittest.cc',
-                'renderer/pepper/pepper_graphics_2d_host_unittest.cc',
               ],
             }],
             ['enable_pepper_cdms==1', {
diff --git a/content/content_utility.target.darwin-arm.mk b/content/content_utility.target.darwin-arm.mk
index e1430ac..beaed0a 100644
--- a/content/content_utility.target.darwin-arm.mk
+++ b/content/content_utility.target.darwin-arm.mk
@@ -91,10 +91,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
@@ -177,10 +177,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/content/content_utility.target.darwin-mips.mk b/content/content_utility.target.darwin-mips.mk
index 7ce4b89..372ff20 100644
--- a/content/content_utility.target.darwin-mips.mk
+++ b/content/content_utility.target.darwin-mips.mk
@@ -90,10 +90,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
@@ -175,10 +175,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/content/content_utility.target.darwin-x86.mk b/content/content_utility.target.darwin-x86.mk
index b722f62..75f3d9e 100644
--- a/content/content_utility.target.darwin-x86.mk
+++ b/content/content_utility.target.darwin-x86.mk
@@ -93,10 +93,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
@@ -182,10 +182,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/content/content_utility.target.linux-arm.mk b/content/content_utility.target.linux-arm.mk
index e1430ac..beaed0a 100644
--- a/content/content_utility.target.linux-arm.mk
+++ b/content/content_utility.target.linux-arm.mk
@@ -91,10 +91,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
@@ -177,10 +177,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/content/content_utility.target.linux-mips.mk b/content/content_utility.target.linux-mips.mk
index 7ce4b89..372ff20 100644
--- a/content/content_utility.target.linux-mips.mk
+++ b/content/content_utility.target.linux-mips.mk
@@ -90,10 +90,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
@@ -175,10 +175,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/content/content_utility.target.linux-x86.mk b/content/content_utility.target.linux-x86.mk
index b722f62..75f3d9e 100644
--- a/content/content_utility.target.linux-x86.mk
+++ b/content/content_utility.target.linux-x86.mk
@@ -93,10 +93,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
@@ -182,10 +182,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/content/content_worker.target.darwin-arm.mk b/content/content_worker.target.darwin-arm.mk
index 71ede02..d749bc1 100644
--- a/content/content_worker.target.darwin-arm.mk
+++ b/content/content_worker.target.darwin-arm.mk
@@ -104,10 +104,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -217,10 +217,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/content/content_worker.target.darwin-mips.mk b/content/content_worker.target.darwin-mips.mk
index 1d0c4e4..fae9da4 100644
--- a/content/content_worker.target.darwin-mips.mk
+++ b/content/content_worker.target.darwin-mips.mk
@@ -103,10 +103,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -215,10 +215,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/content/content_worker.target.darwin-x86.mk b/content/content_worker.target.darwin-x86.mk
index 79514c2..ec500bb 100644
--- a/content/content_worker.target.darwin-x86.mk
+++ b/content/content_worker.target.darwin-x86.mk
@@ -106,10 +106,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -222,10 +222,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/content/content_worker.target.linux-arm.mk b/content/content_worker.target.linux-arm.mk
index 71ede02..d749bc1 100644
--- a/content/content_worker.target.linux-arm.mk
+++ b/content/content_worker.target.linux-arm.mk
@@ -104,10 +104,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -217,10 +217,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/content/content_worker.target.linux-mips.mk b/content/content_worker.target.linux-mips.mk
index 1d0c4e4..fae9da4 100644
--- a/content/content_worker.target.linux-mips.mk
+++ b/content/content_worker.target.linux-mips.mk
@@ -103,10 +103,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -215,10 +215,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/content/content_worker.target.linux-x86.mk b/content/content_worker.target.linux-x86.mk
index 79514c2..ec500bb 100644
--- a/content/content_worker.target.linux-x86.mk
+++ b/content/content_worker.target.linux-x86.mk
@@ -106,10 +106,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -222,10 +222,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/content/ppapi_plugin/ppapi_thread.h b/content/ppapi_plugin/ppapi_thread.h
index 9fb56c1..7726a98 100644
--- a/content/ppapi_plugin/ppapi_thread.h
+++ b/content/ppapi_plugin/ppapi_thread.h
@@ -15,13 +15,13 @@
 #include "base/scoped_native_library.h"
 #include "build/build_config.h"
 #include "content/child/child_thread.h"
+#include "content/public/common/pepper_plugin_info.h"
 #include "ipc/ipc_listener.h"
 #include "ppapi/c/pp_module.h"
 #include "ppapi/c/trusted/ppp_broker.h"
 #include "ppapi/proxy/plugin_dispatcher.h"
 #include "ppapi/proxy/plugin_globals.h"
 #include "ppapi/proxy/plugin_proxy_delegate.h"
-#include "webkit/plugins/ppapi/plugin_module.h"
 
 #if defined(OS_WIN)
 #include "base/win/scoped_handle.h"
@@ -138,7 +138,7 @@
   ppapi::proxy::PluginGlobals plugin_globals_;
 
   // Storage for plugin entry points.
-  webkit::ppapi::PluginModule::EntryPoints plugin_entry_points_;
+  PepperPluginInfo::EntryPoints plugin_entry_points_;
 
   // Callback to call when a new instance connects to the broker.
   // Used only when is_broker_.
diff --git a/content/public/android/java/src/org/chromium/content/browser/ChildProcessConnection.java b/content/public/android/java/src/org/chromium/content/browser/ChildProcessConnection.java
index ddd8879..eb1a5cd 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ChildProcessConnection.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ChildProcessConnection.java
@@ -135,6 +135,10 @@
             }
         }
 
+        boolean isBound() {
+            return mBound;
+        }
+
         @Override
         public void onServiceConnected(ComponentName className, IBinder service) {
             synchronized(mUiThreadLock) {
@@ -355,14 +359,29 @@
         TraceEvent.end();
     }
 
+    private static final long REMOVE_INITIAL_BINDING_DELAY_MILLIS = 1 * 1000;  // One second.
+
     /**
      * Called to remove the strong binding estabilished when the connection was started. It is safe
-     * to call this multiple times.
+     * to call this multiple times. The binding is removed after a fixed delay period so that the
+     * renderer will not be killed immediately after the call.
      */
     void removeInitialBinding() {
         synchronized(mUiThreadLock) {
-            mInitialBinding.unbind();
+            if (!mInitialBinding.isBound()) {
+                // While it is safe to post and execute the unbinding multiple times, we prefer to
+                // avoid spamming the message queue.
+                return;
+            }
         }
+        ThreadUtils.postOnUiThreadDelayed(new Runnable() {
+            @Override
+            public void run() {
+                synchronized(mUiThreadLock) {
+                    mInitialBinding.unbind();
+                }
+            }
+        }, REMOVE_INITIAL_BINDING_DELAY_MILLIS);
     }
 
     /**
@@ -384,24 +403,31 @@
         }
     }
 
+    private static final long DETACH_AS_ACTIVE_DELAY_MILLIS = 5 * 1000;  // Five seconds.
+
     /**
-     * Called when the service is no longer considered active.
+     * Called when the service is no longer considered active. Actual binding is removed after a
+     * fixed delay period so that the renderer will not be killed immediately after the call.
      */
     void detachAsActive() {
-        synchronized(mUiThreadLock) {
-            assert mAttachAsActiveCount > 0;
-            if (mService == null) {
-                Log.w(TAG, "The connection is not bound for " + mPID);
-                return;
+        ThreadUtils.postOnUiThreadDelayed(new Runnable() {
+            @Override
+            public void run() {
+                synchronized(mUiThreadLock) {
+                    if (mService == null) {
+                        Log.w(TAG, "The connection is not bound for " + mPID);
+                        return;
+                    }
+                    assert mAttachAsActiveCount > 0;
+                    mAttachAsActiveCount--;
+                    if (mAttachAsActiveCount == 0) {
+                        mStrongBinding.unbind();
+                    }
+                }
             }
-            mAttachAsActiveCount--;
-            if (mAttachAsActiveCount == 0) {
-                mStrongBinding.unbind();
-            }
-        }
+        }, DETACH_AS_ACTIVE_DELAY_MILLIS);
     }
 
-
     /**
      * @return The connection PID, or 0 if not yet connected.
      */
diff --git a/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java b/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java
index 5c04c88..f1cc5b0 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java
@@ -39,23 +39,24 @@
 
     // The upper limit on the number of simultaneous sandboxed and privileged child service process
     // instances supported. Each limit must not exceed total number of SandboxedProcessServiceX
-    // classes and PrivilegedProcessClassX declared in this package, and defined as services in the
-    // embedding application's manifest file.
+    // classes and PrivilegedProcessServiceX classes declared in this package and defined as
+    // services in the embedding application's manifest file.
     // (See {@link ChildProcessService} for more details on defining the services.)
     /* package */ static final int MAX_REGISTERED_SANDBOXED_SERVICES = 13;
     /* package */ static final int MAX_REGISTERED_PRIVILEGED_SERVICES = 3;
 
     private static class ChildConnectionAllocator {
+        // Connections to services. Indices of the array correspond to the service numbers.
         private ChildProcessConnection[] mChildProcessConnections;
 
-        // The list of free slots in corresponing Connections.  When looking for a free connection,
-        // the first index in that list should be used. When a connection is freed, its index
-        // is added to the end of the list. This is so that we avoid immediately reusing a freed
-        // connection (see bug crbug.com/164069): the framework might keep a service process alive
-        // when it's been unbound for a short time.  If a connection to that same service is bound
-        // at that point, the process is reused and bad things happen (mostly static variables are
-        // set when we don't expect them to).
-        // SHOULD BE ACCESSED WITH THE mConnectionLock.
+        // The list of free (not bound) service indices. When looking for a free service, the first
+        // index in that list should be used. When a service is unbound, its index is added to the
+        // end of the list. This is so that we avoid immediately reusing the freed service (see
+        // http://crbug.com/164069): the framework might keep a service process alive when it's been
+        // unbound for a short time. If a new connection to the same service is bound at that point,
+        // the process is reused and bad things happen (mostly static variables are set when we
+        // don't expect them to).
+        // SHOULD BE ACCESSED WITH mConnectionLock.
         private ArrayList<Integer> mFreeConnectionIndices;
         private final Object mConnectionLock = new Object();
 
@@ -113,7 +114,7 @@
     }
 
     // Service class for child process. As the default value it uses SandboxedProcessService0 and
-    // PrivilegedProcessService0
+    // PrivilegedProcessService0.
     private static final ChildConnectionAllocator mSandboxedChildConnectionAllocator =
             new ChildConnectionAllocator(true);
     private static final ChildConnectionAllocator mPrivilegedChildConnectionAllocator =
@@ -121,7 +122,7 @@
 
     private static boolean mConnectionAllocated = false;
 
-   // Sets service class for sandboxed service and privileged service
+    // Sets service class for sandboxed service and privileged service.
     public static void setChildProcessClass(
             Class<? extends SandboxedProcessService> sandboxedServiceClass,
             Class<? extends PrivilegedProcessService> privilegedServiceClass) {
@@ -193,9 +194,9 @@
     }
 
     /**
-     * Should be called early in startup so the work needed to spawn the child process can
-     * be done in parallel to other startup work. Must not be called on the UI thread.
-     * Spare connection is created in sandboxed child process.
+     * Should be called early in startup so the work needed to spawn the child process can be done
+     * in parallel to other startup work. Must not be called on the UI thread. Spare connection is
+     * created in sandboxed child process.
      * @param context the application context used for the connection.
      */
     public static void warmUp(Context context) {
@@ -222,10 +223,10 @@
     }
 
     /**
-     * Spawns and connects to a child process. May be called on any thread. It will not
-     * block, but will instead callback to {@link #nativeOnChildProcessStarted} when the
-     * connection is established. Note this callback will not necessarily be from the same thread
-     * (currently it always comes from the main thread).
+     * Spawns and connects to a child process. May be called on any thread. It will not block, but
+     * will instead callback to {@link #nativeOnChildProcessStarted} when the connection is
+     * established. Note this callback will not necessarily be from the same thread (currently it
+     * always comes from the main thread).
      *
      * @param context Context used to obtain the application context.
      * @param commandLine The child process command line argv.
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
index e86056e..668904a 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
@@ -821,11 +821,16 @@
         mContentSettings = null;
         mJavaScriptInterfaces.clear();
         mRetainedJavaScriptObjects.clear();
-        if (mAccessibilityScriptInjectionObserver != null) {
-            getContext().getContentResolver().unregisterContentObserver(
-                    mAccessibilityScriptInjectionObserver);
-            mAccessibilityScriptInjectionObserver = null;
+        unregisterAccessibilityContentObserver();
+    }
+
+    private void unregisterAccessibilityContentObserver() {
+        if (mAccessibilityScriptInjectionObserver == null) {
+            return;
         }
+        getContext().getContentResolver().unregisterContentObserver(
+                mAccessibilityScriptInjectionObserver);
+        mAccessibilityScriptInjectionObserver = null;
     }
 
     /**
@@ -1430,6 +1435,7 @@
         setInjectedAccessibility(false);
         hidePopupDialog();
         mZoomControlsDelegate.dismissZoomPicker();
+        unregisterAccessibilityContentObserver();
     }
 
     /**
diff --git a/content/public/android/java/src/org/chromium/content/browser/SelectActionModeCallback.java b/content/public/android/java/src/org/chromium/content/browser/SelectActionModeCallback.java
index 14bea2b..4ff58bd 100644
--- a/content/public/android/java/src/org/chromium/content/browser/SelectActionModeCallback.java
+++ b/content/public/android/java/src/org/chromium/content/browser/SelectActionModeCallback.java
@@ -104,6 +104,7 @@
 
     @Override
     public boolean onCreateActionMode(ActionMode mode, Menu menu) {
+        mode.setTitle(null);
         mode.setSubtitle(null);
         mEditable = mActionHandler.isSelectionEditable();
         createActionMenu(mode, menu);
diff --git a/content/public/browser/storage_partition.h b/content/public/browser/storage_partition.h
index bd7f90c..a8e451c 100644
--- a/content/public/browser/storage_partition.h
+++ b/content/public/browser/storage_partition.h
@@ -56,56 +56,63 @@
   virtual DOMStorageContext* GetDOMStorageContext() = 0;
   virtual IndexedDBContext* GetIndexedDBContext() = 0;
 
-  enum StorageMask {
-    kCookies = 1 << 0,
+  enum RemoveDataMask {
+    REMOVE_DATA_MASK_APPCACHE = 1 << 0,
+    REMOVE_DATA_MASK_COOKIES = 1 << 1,
+    REMOVE_DATA_MASK_FILE_SYSTEMS = 1 << 2,
+    REMOVE_DATA_MASK_INDEXEDDB = 1 << 3,
+    REMOVE_DATA_MASK_LOCAL_STORAGE = 1 << 4,
+    REMOVE_DATA_MASK_SHADER_CACHE = 1 << 5,
+    REMOVE_DATA_MASK_WEBSQL = 1 << 6,
 
+    REMOVE_DATA_MASK_ALL = -1
+  };
+
+  // TODO(lazyboy): Value in the enum should start with the enum prefix
+  // (QUOTA_MANAGED_STORAGE_MASK_*).
+  enum QuotaManagedStorageMask {
     // Corresponds to quota::kStorageTypeTemporary.
-    kQuotaManagedTemporaryStorage = 1 << 1,
+    kQuotaManagedTemporaryStorage = 1 << 0,
 
     // Corresponds to quota::kStorageTypePersistent.
-    kQuotaManagedPersistentStorage = 1 << 2,
-
-    // Local dom storage.
-    kLocalDomStorage = 1 << 3,
-    kSessionDomStorage = 1 << 4,
-
-    // Local shader storage.
-    kShaderStorage = 1 << 5,
+    kQuotaManagedPersistentStorage = 1 << 1,
 
     // Corresponds to quota::kStorageTypeSyncable.
-    kQuotaManagedSyncableStorage = 1 << 6,
+    kQuotaManagedSyncableStorage = 1 << 2,
 
-    kAllStorage = -1,
+    kAllStorage = -1
   };
 
   // Starts an asynchronous task that does a best-effort clear the data
-  // corresonding to the given |storage_mask| inside this StoragePartition for
-  // the given |storage_origin|. Note kSessionDomStorage is not cleared and the
-  // mask is ignored.
+  // corresponding to the given |remove_mask| and |quota_storage_remove_mask|
+  // inside this StoragePartition for the given |storage_origin|.
+  // Note session dom storage is not cleared even if you specify
+  // REMOVE_DATA_MASK_LOCAL_STORAGE.
   //
   // TODO(ajwong): Right now, the embedder may have some
   // URLRequestContextGetter objects that the StoragePartition does not know
   // about.  This will no longer be the case when we resolve
   // http://crbug.com/159193. Remove |request_context_getter| when that bug
   // is fixed.
-  virtual void AsyncClearDataForOrigin(
-      uint32 storage_mask,
-      const GURL& storage_origin,
-      net::URLRequestContextGetter* request_context_getter) = 0;
+  virtual void ClearDataForOrigin(uint32 remove_mask,
+                                  uint32 quota_storage_remove_mask,
+                                  const GURL& storage_origin,
+                                  net::URLRequestContextGetter* rq_context) = 0;
 
-  // Similar to AsyncClearDataForOrigin(), but deletes all data out of the
+  // Similar to ClearDataForOrigin(), but deletes all data out of the
   // StoragePartition rather than just the data related to this origin.
-  virtual void AsyncClearData(uint32 storage_mask) = 0;
+  virtual void ClearDataForUnboundedRange(uint32 remove_mask,
+                                          uint32 quota_storage_remove_mask) = 0;
 
-  // Similar to AsyncClearDataForOrigin(), but deletes all the data out of the
+  // Similar to ClearDataForOrigin(), but deletes all the data out of the
   // StoragePartion from between the given |begin| and |end| dates rather
   // then just the data related to this origin.
-  //
-  // Note: This currently only supports the shader cache.
-  virtual void AsyncClearDataBetween(uint32 storage_mask,
-                                     const base::Time& begin,
-                                     const base::Time& end,
-                                     const base::Closure& callback) = 0;
+  virtual void ClearDataForRange(uint32 remove_mask,
+                                 uint32 quota_storage_remove_mask,
+                                 const base::Time& begin,
+                                 const base::Time& end,
+                                 const base::Closure& callback) = 0;
+
  protected:
   virtual ~StoragePartition() {}
 };
diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h
index 34f6597..23d2336 100644
--- a/content/public/browser/web_contents_delegate.h
+++ b/content/public/browser/web_contents_delegate.h
@@ -158,6 +158,10 @@
   // gestures.
   virtual bool CanOverscrollContent() const;
 
+  // Callback that allows vertical overscroll activies to be communicated to the
+  // delegate.
+  virtual void OverscrollUpdate(int delta_y) {}
+
   // Check whether this contents is permitted to load data URLs in WebUI mode.
   // This is normally disallowed for security.
   virtual bool CanLoadDataURLsInWebUI() const;
diff --git a/content/public/common/content_switches.cc b/content/public/common/content_switches.cc
index 36089c9..50dffe3 100644
--- a/content/public/common/content_switches.cc
+++ b/content/public/common/content_switches.cc
@@ -893,6 +893,11 @@
 const char kOverscrollHistoryNavigation[] =
     "overscroll-history-navigation";
 
+// Enables or disables scroll end effect in response to vertical overscroll.
+// Set the value to '1' to enable the feature, and set to '0' to disable.
+// Defaults to disabled.
+const char kScrollEndEffect[] = "scroll-end-effect";
+
 // Forward overscroll event data from the renderer to the browser.
 const char kEnableOverscrollNotifications[] = "enable-overscroll-notifications";
 
diff --git a/content/public/common/content_switches.h b/content/public/common/content_switches.h
index d0c66bb..e0e2195 100644
--- a/content/public/common/content_switches.h
+++ b/content/public/common/content_switches.h
@@ -281,6 +281,7 @@
 #endif
 
 CONTENT_EXPORT extern const char kOverscrollHistoryNavigation[];
+CONTENT_EXPORT extern const char kScrollEndEffect[];
 CONTENT_EXPORT extern const char kEnableOverscrollNotifications[];
 CONTENT_EXPORT extern const char kEnableWebGLDraftExtensions[];
 
diff --git a/content/public/common/pepper_plugin_info.cc b/content/public/common/pepper_plugin_info.cc
index f8e88b2..21ef4e8 100644
--- a/content/public/common/pepper_plugin_info.cc
+++ b/content/public/common/pepper_plugin_info.cc
@@ -8,6 +8,12 @@
 
 namespace content {
 
+PepperPluginInfo::EntryPoints::EntryPoints()
+    : get_interface(NULL),
+      initialize_module(NULL),
+      shutdown_module(NULL) {
+}
+
 PepperPluginInfo::PepperPluginInfo()
     : is_internal(false),
       is_out_of_process(false),
diff --git a/content/public/common/pepper_plugin_info.h b/content/public/common/pepper_plugin_info.h
index 8106c6e..3cd54bc 100644
--- a/content/public/common/pepper_plugin_info.h
+++ b/content/public/common/pepper_plugin_info.h
@@ -11,11 +11,25 @@
 #include "base/files/file_path.h"
 #include "content/common/content_export.h"
 #include "content/public/common/webplugininfo.h"
-#include "webkit/plugins/ppapi/plugin_module.h"
+#include "ppapi/c/pp_module.h"
+#include "ppapi/c/ppb.h"
 
 namespace content {
 
 struct CONTENT_EXPORT PepperPluginInfo {
+  typedef const void* (*GetInterfaceFunc)(const char*);
+  typedef int (*PPP_InitializeModuleFunc)(PP_Module, PPB_GetInterface);
+  typedef void (*PPP_ShutdownModuleFunc)();
+
+  struct EntryPoints {
+    // This structure is POD, with the constructor initializing to NULL.
+    CONTENT_EXPORT EntryPoints();
+
+    GetInterfaceFunc get_interface;
+    PPP_InitializeModuleFunc initialize_module;
+    PPP_ShutdownModuleFunc shutdown_module;  // Optional, may be NULL.
+  };
+
   PepperPluginInfo();
   ~PepperPluginInfo();
 
@@ -42,7 +56,7 @@
 
   // When is_internal is set, this contains the function pointers to the
   // entry points for the internal plugins.
-  webkit::ppapi::PluginModule::EntryPoints internal_entry_points;
+  EntryPoints internal_entry_points;
 
   // Permission bits from ppapi::Permission.
   uint32 permissions;
diff --git a/content/public/renderer/ppapi_plugin_instance.h b/content/public/renderer/ppapi_plugin_instance.h
new file mode 100644
index 0000000..1e56e4c
--- /dev/null
+++ b/content/public/renderer/ppapi_plugin_instance.h
@@ -0,0 +1,105 @@
+// Copyright (c) 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 CONTENT_PUBLIC_PPAPI_PLUGIN_INSTANCE_H_
+#define CONTENT_PUBLIC_PPAPI_PLUGIN_INSTANCE_H_
+
+#include "base/basictypes.h"
+#include "base/process/process_handle.h"
+#include "content/common/content_export.h"
+#include "ppapi/c/pp_resource.h"
+#include "ppapi/c/private/ppb_instance_private.h"
+
+class GURL;
+
+namespace base {
+class FilePath;
+}
+
+namespace content {
+class RenderView;
+}
+
+namespace gfx {
+class ImageSkia;
+class Rect;
+}
+
+namespace ppapi {
+class PpapiPermissions;
+class VarTracker;
+struct URLRequestInfoData;
+}
+
+namespace IPC {
+struct ChannelHandle;
+}
+
+namespace WebKit {
+class WebPluginContainer;
+}
+
+namespace webkit {
+namespace ppapi {
+
+class PluginInstance {
+ public:
+  static CONTENT_EXPORT PluginInstance* Get(PP_Instance instance_id);
+
+  virtual ~PluginInstance() {}
+
+  virtual content::RenderView* GetRenderView() = 0;
+
+  virtual WebKit::WebPluginContainer* GetContainer() = 0;
+
+  virtual ::ppapi::VarTracker* GetVarTracker() = 0;
+
+  virtual const GURL& GetPluginURL() = 0;
+
+  // Returns the location of this module.
+  virtual base::FilePath GetModulePath() = 0;
+
+  // Returns a reference to a file with the given path.
+  // The returned object will have a refcount of 0 (just like "new").
+  virtual PP_Resource CreateExternalFileReference(
+      const base::FilePath& external_file_path) = 0;
+
+  // Creates a PPB_ImageData given a Skia image.
+  virtual PP_Resource CreateImage(gfx::ImageSkia* source_image,
+                                  float scale) = 0;
+
+  // Switches this instance with one that uses the out of process IPC proxy.
+  virtual PP_ExternalPluginResult SwitchToOutOfProcessProxy(
+      const base::FilePath& file_path,
+      ::ppapi::PpapiPermissions permissions,
+      const IPC::ChannelHandle& channel_handle,
+      base::ProcessId plugin_pid,
+      int plugin_child_id) = 0;
+
+  // Set this to true if plugin thinks it will always be on top. This allows us
+  // to use a more optimized painting path in some cases.
+  virtual void SetAlwaysOnTop(bool on_top) = 0;
+
+  // Returns true iff the plugin is a full-page plugin (i.e. not in an iframe
+  // or embedded in a page).
+  virtual bool IsFullPagePlugin() = 0;
+
+  // Switches between fullscreen and normal mode. If |delay_report| is set to
+  // false, it may report the new state through DidChangeView immediately. If
+  // true, it will delay it. When called from the plugin, delay_report should
+  // be true to avoid re-entrancy.
+  virtual void FlashSetFullscreen(bool fullscreen, bool delay_report) = 0;
+
+  virtual bool IsRectTopmost(const gfx::Rect& rect) = 0;
+
+  virtual int32_t Navigate(const ::ppapi::URLRequestInfoData& request,
+                           const char* target,
+                           bool from_user_action) = 0;
+
+};
+
+}  // namespace ppapi
+}  // namespace webkit
+
+#endif  // CONTENT_PUBLIC_PPAPI_PLUGIN_INSTANCE_H_
diff --git a/content/public/renderer/renderer_ppapi_host.h b/content/public/renderer/renderer_ppapi_host.h
index 5b33f7b..5f3caac 100644
--- a/content/public/renderer/renderer_ppapi_host.h
+++ b/content/public/renderer/renderer_ppapi_host.h
@@ -5,13 +5,13 @@
 #ifndef CONTENT_PUBLIC_RENDERER_RENDERER_PPAPI_HOST_H_
 #define CONTENT_PUBLIC_RENDERER_RENDERER_PPAPI_HOST_H_
 
+#include "base/callback_forward.h"
 #include "base/memory/ref_counted.h"
 #include "base/platform_file.h"
 #include "base/process.h"
 #include "content/common/content_export.h"
 #include "ipc/ipc_platform_file.h"
 #include "ppapi/c/pp_instance.h"
-#include "webkit/plugins/ppapi/plugin_delegate.h"
 
 namespace base {
 class FilePath;
@@ -38,7 +38,6 @@
 namespace webkit {
 namespace ppapi {
 class PluginInstance;
-class PluginModule;
 }
 }
 
diff --git a/content/renderer/browser_plugin/browser_plugin.h b/content/renderer/browser_plugin/browser_plugin.h
index 61f5a98..09b4c0a 100644
--- a/content/renderer/browser_plugin/browser_plugin.h
+++ b/content/renderer/browser_plugin/browser_plugin.h
@@ -9,7 +9,6 @@
 
 #include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
-#include "base/process_util.h"
 #include "base/sequenced_task_runner_helpers.h"
 #if defined(OS_WIN)
 #include "base/memory/shared_memory.h"
diff --git a/content/renderer/devtools/devtools_agent.cc b/content/renderer/devtools/devtools_agent.cc
index 766fd59..635acc1 100644
--- a/content/renderer/devtools/devtools_agent.cc
+++ b/content/renderer/devtools/devtools_agent.cc
@@ -9,7 +9,7 @@
 #include "base/debug/trace_event.h"
 #include "base/lazy_instance.h"
 #include "base/message_loop/message_loop.h"
-#include "base/process.h"
+#include "base/process/process.h"
 #include "base/strings/string_number_conversions.h"
 #include "content/common/devtools_messages.h"
 #include "content/common/view_messages.h"
diff --git a/content/renderer/media/crypto/content_decryption_module_factory.cc b/content/renderer/media/crypto/content_decryption_module_factory.cc
index 85cf3a4..3138be2 100644
--- a/content/renderer/media/crypto/content_decryption_module_factory.cc
+++ b/content/renderer/media/crypto/content_decryption_module_factory.cc
@@ -10,11 +10,11 @@
 
 #if defined(ENABLE_PEPPER_CDMS)
 #include "content/renderer/media/crypto/ppapi_decryptor.h"
+#include "content/renderer/pepper/ppapi_plugin_instance_impl.h"
+#include "content/renderer/pepper/ppapi_webplugin_impl.h"
 #include "third_party/WebKit/public/platform/WebString.h"
 #include "third_party/WebKit/public/web/WebFrame.h"
 #include "third_party/WebKit/public/web/WebMediaPlayerClient.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
-#include "webkit/plugins/ppapi/ppapi_webplugin_impl.h"
 #elif defined(OS_ANDROID)
 #include "content/renderer/media/android/proxy_media_keys.h"
 #include "content/renderer/media/android/webmediaplayer_proxy_android.h"
@@ -23,10 +23,10 @@
 namespace content {
 
 #if defined(ENABLE_PEPPER_CDMS)
-// Returns the PluginInstance associated with the Helper Plugin.
+// Returns the PluginInstanceImpl associated with the Helper Plugin.
 // If a non-NULL pointer is returned, the caller must call closeHelperPlugin()
 // when the Helper Plugin is no longer needed.
-static scoped_refptr<webkit::ppapi::PluginInstance> CreateHelperPlugin(
+static scoped_refptr<webkit::ppapi::PluginInstanceImpl> CreateHelperPlugin(
     const std::string& plugin_type,
     WebKit::WebMediaPlayerClient* web_media_player_client,
     WebKit::WebFrame* web_frame) {
@@ -58,7 +58,7 @@
 
   std::string plugin_type = GetPepperType(key_system);
   DCHECK(!plugin_type.empty());
-  const scoped_refptr<webkit::ppapi::PluginInstance>& plugin_instance =
+  const scoped_refptr<webkit::ppapi::PluginInstanceImpl>& plugin_instance =
       CreateHelperPlugin(plugin_type, web_media_player_client, web_frame);
   if (!plugin_instance.get()) {
     DLOG(ERROR) << "ProxyDecryptor: plugin instance creation failed.";
diff --git a/content/renderer/media/crypto/ppapi_decryptor.cc b/content/renderer/media/crypto/ppapi_decryptor.cc
index 74188fb..7bf2aab 100644
--- a/content/renderer/media/crypto/ppapi_decryptor.cc
+++ b/content/renderer/media/crypto/ppapi_decryptor.cc
@@ -12,19 +12,19 @@
 #include "base/logging.h"
 #include "base/message_loop/message_loop.h"
 #include "base/message_loop/message_loop_proxy.h"
+#include "content/renderer/pepper/content_decryptor_delegate.h"
+#include "content/renderer/pepper/ppapi_plugin_instance_impl.h"
 #include "media/base/audio_decoder_config.h"
 #include "media/base/data_buffer.h"
 #include "media/base/decoder_buffer.h"
 #include "media/base/video_decoder_config.h"
 #include "media/base/video_frame.h"
-#include "webkit/plugins/ppapi/content_decryptor_delegate.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
 
 namespace content {
 
 scoped_ptr<PpapiDecryptor> PpapiDecryptor::Create(
     const std::string& key_system,
-    const scoped_refptr<webkit::ppapi::PluginInstance>& plugin_instance,
+    const scoped_refptr<webkit::ppapi::PluginInstanceImpl>& plugin_instance,
     const media::KeyAddedCB& key_added_cb,
     const media::KeyErrorCB& key_error_cb,
     const media::KeyMessageCB& key_message_cb,
@@ -47,7 +47,7 @@
 }
 
 PpapiDecryptor::PpapiDecryptor(
-    const scoped_refptr<webkit::ppapi::PluginInstance>& plugin_instance,
+    const scoped_refptr<webkit::ppapi::PluginInstanceImpl>& plugin_instance,
     webkit::ppapi::ContentDecryptorDelegate* plugin_cdm_delegate,
     const media::KeyAddedCB& key_added_cb,
     const media::KeyErrorCB& key_error_cb,
diff --git a/content/renderer/media/crypto/ppapi_decryptor.h b/content/renderer/media/crypto/ppapi_decryptor.h
index 914dbba..39c84af 100644
--- a/content/renderer/media/crypto/ppapi_decryptor.h
+++ b/content/renderer/media/crypto/ppapi_decryptor.h
@@ -22,7 +22,7 @@
 namespace webkit {
 namespace ppapi {
 class ContentDecryptorDelegate;
-class PluginInstance;
+class PluginInstanceImpl;
 }
 }
 
@@ -36,7 +36,7 @@
   static scoped_ptr<PpapiDecryptor> Create(
       // TODO(ddorwin): Remove after updating the delegate.
       const std::string& key_system,
-      const scoped_refptr<webkit::ppapi::PluginInstance>& plugin_instance,
+      const scoped_refptr<webkit::ppapi::PluginInstanceImpl>& plugin_instance,
       const media::KeyAddedCB& key_added_cb,
       const media::KeyErrorCB& key_error_cb,
       const media::KeyMessageCB& key_message_cb,
@@ -76,7 +76,7 @@
 
  private:
   PpapiDecryptor(
-      const scoped_refptr<webkit::ppapi::PluginInstance>& plugin_instance,
+      const scoped_refptr<webkit::ppapi::PluginInstanceImpl>& plugin_instance,
       webkit::ppapi::ContentDecryptorDelegate* plugin_cdm_delegate,
       const media::KeyAddedCB& key_added_cb,
       const media::KeyErrorCB& key_error_cb,
@@ -99,7 +99,7 @@
   // Hold a reference of the plugin instance to make sure the plugin outlives
   // the |plugin_cdm_delegate_|. This is needed because |plugin_cdm_delegate_|
   // is owned by the |plugin_instance_|.
-  scoped_refptr<webkit::ppapi::PluginInstance> plugin_instance_;
+  scoped_refptr<webkit::ppapi::PluginInstanceImpl> plugin_instance_;
 
   webkit::ppapi::ContentDecryptorDelegate* plugin_cdm_delegate_;
 
diff --git a/content/renderer/media/media_stream_dependency_factory.cc b/content/renderer/media/media_stream_dependency_factory.cc
index 2b44c5e..a0f25a6 100644
--- a/content/renderer/media/media_stream_dependency_factory.cc
+++ b/content/renderer/media/media_stream_dependency_factory.cc
@@ -162,9 +162,9 @@
                             public base::NonThreadSafe {
  public:
   SourceStateObserver(
-      WebKit::WebMediaStream* description,
+      WebKit::WebMediaStream* web_stream,
       const MediaStreamDependencyFactory::MediaSourcesCreatedCallback& callback)
-     : description_(description),
+     : web_stream_(web_stream),
        ready_callback_(callback),
        live_(true) {
   }
@@ -211,12 +211,12 @@
       }
     }
     if (sources_.empty()) {
-      ready_callback_.Run(description_, live_);
+      ready_callback_.Run(web_stream_, live_);
       delete this;
     }
   }
 
-  WebKit::WebMediaStream* description_;
+  WebKit::WebMediaStream* web_stream_;
   MediaStreamDependencyFactory::MediaSourcesCreatedCallback ready_callback_;
   bool live_;
   typedef std::vector<scoped_refptr<webrtc::MediaSourceInterface> >
@@ -260,23 +260,23 @@
     int render_view_id,
     const WebKit::WebMediaConstraints& audio_constraints,
     const WebKit::WebMediaConstraints& video_constraints,
-    WebKit::WebMediaStream* description,
+    WebKit::WebMediaStream* web_stream,
     const MediaSourcesCreatedCallback& sources_created) {
   DVLOG(1) << "MediaStreamDependencyFactory::CreateNativeMediaSources()";
   if (!EnsurePeerConnectionFactory()) {
-    sources_created.Run(description, false);
+    sources_created.Run(web_stream, false);
     return;
   }
 
   // |source_observer| clean up itself when it has completed
   // source_observer->StartObservering.
   SourceStateObserver* source_observer =
-      new SourceStateObserver(description, sources_created);
+      new SourceStateObserver(web_stream, sources_created);
 
   // Create local video sources.
   RTCMediaConstraints native_video_constraints(video_constraints);
   WebKit::WebVector<WebKit::WebMediaStreamTrack> video_tracks;
-  description->videoSources(video_tracks);
+  web_stream->videoTracks(video_tracks);
   for (size_t i = 0; i < video_tracks.size(); ++i) {
     const WebKit::WebMediaStreamSource& source = video_tracks[i].source();
     MediaStreamSourceExtraData* source_data =
@@ -302,7 +302,7 @@
   // microphone or tab audio.
   RTCMediaConstraints native_audio_constraints(audio_constraints);
   WebKit::WebVector<WebKit::WebMediaStreamTrack> audio_tracks;
-  description->audioSources(audio_tracks);
+  web_stream->audioTracks(audio_tracks);
   for (size_t i = 0; i < audio_tracks.size(); ++i) {
     const WebKit::WebMediaStreamSource& source = audio_tracks[i].source();
     MediaStreamSourceExtraData* source_data =
@@ -317,7 +317,7 @@
     if (IsAudioMediaType(device_info.device.type)) {
       if (!InitializeAudioSource(render_view_id, device_info)) {
         DLOG(WARNING) << "Unsupported audio source";
-        sources_created.Run(description, false);
+        sources_created.Run(web_stream, false);
         return;
       }
     }
@@ -338,42 +338,42 @@
 }
 
 void MediaStreamDependencyFactory::CreateNativeLocalMediaStream(
-    WebKit::WebMediaStream* description) {
+    WebKit::WebMediaStream* web_stream) {
   DVLOG(1) << "MediaStreamDependencyFactory::CreateNativeLocalMediaStream()";
   if (!EnsurePeerConnectionFactory()) {
     DVLOG(1) << "EnsurePeerConnectionFactory() failed!";
     return;
   }
 
-  std::string label = UTF16ToUTF8(description->label());
+  std::string label = UTF16ToUTF8(web_stream->id());
   scoped_refptr<webrtc::MediaStreamInterface> native_stream =
       CreateLocalMediaStream(label);
   MediaStreamExtraData* extra_data =
       new MediaStreamExtraData(native_stream.get(), true);
-  description->setExtraData(extra_data);
+  web_stream->setExtraData(extra_data);
 
   // Add audio tracks.
   WebKit::WebVector<WebKit::WebMediaStreamTrack> audio_tracks;
-  description->audioTracks(audio_tracks);
+  web_stream->audioTracks(audio_tracks);
   for (size_t i = 0; i < audio_tracks.size(); ++i) {
-    AddNativeMediaStreamTrack(*description, audio_tracks[i]);
+    AddNativeMediaStreamTrack(*web_stream, audio_tracks[i]);
   }
 
   // Add video tracks.
   WebKit::WebVector<WebKit::WebMediaStreamTrack> video_tracks;
-  description->videoTracks(video_tracks);
+  web_stream->videoTracks(video_tracks);
   for (size_t i = 0; i < video_tracks.size(); ++i) {
-    AddNativeMediaStreamTrack(*description, video_tracks[i]);
+    AddNativeMediaStreamTrack(*web_stream, video_tracks[i]);
   }
 }
 
 void MediaStreamDependencyFactory::CreateNativeLocalMediaStream(
-    WebKit::WebMediaStream* description,
+    WebKit::WebMediaStream* web_stream,
     const MediaStreamExtraData::StreamStopCallback& stream_stop) {
-  CreateNativeLocalMediaStream(description);
+  CreateNativeLocalMediaStream(web_stream);
 
   MediaStreamExtraData* extra_data =
-     static_cast<MediaStreamExtraData*>(description->extraData());
+     static_cast<MediaStreamExtraData*>(web_stream->extraData());
   extra_data->SetLocalStreamStopCallback(stream_stop);
 }
 
@@ -498,8 +498,10 @@
 
     const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
     if (cmd_line->HasSwitch(switches::kEnableWebRtcHWDecoding)) {
-      scoped_refptr<media::GpuVideoDecoderFactories> gpu_factories =
-          RenderThreadImpl::current()->GetGpuFactories();
+      scoped_refptr<base::MessageLoopProxy> media_loop_proxy =
+          RenderThreadImpl::current()->GetMediaThreadMessageLoopProxy();
+      scoped_refptr<RendererGpuVideoDecoderFactories> gpu_factories =
+          RenderThreadImpl::current()->GetGpuFactories(media_loop_proxy);
       if (gpu_factories.get() != NULL)
         decoder_factory.reset(new RTCVideoDecoderFactory(gpu_factories));
     }
@@ -723,9 +725,9 @@
 }
 
 void MediaStreamDependencyFactory::StopLocalAudioSource(
-    const WebKit::WebMediaStream& description) {
+    const WebKit::WebMediaStream& web_stream) {
   MediaStreamExtraData* extra_data = static_cast<MediaStreamExtraData*>(
-      description.extraData());
+      web_stream.extraData());
   if (extra_data && extra_data->is_local() && extra_data->stream().get() &&
       !extra_data->stream()->GetAudioTracks().empty()) {
     // Stop the audio track. This will unhook the audio track from the capturer
diff --git a/content/renderer/media/media_stream_dependency_factory.h b/content/renderer/media/media_stream_dependency_factory.h
index 7750276..74dceb5 100644
--- a/content/renderer/media/media_stream_dependency_factory.h
+++ b/content/renderer/media/media_stream_dependency_factory.h
@@ -57,7 +57,7 @@
     : NON_EXPORTED_BASE(public base::NonThreadSafe) {
  public:
   // MediaSourcesCreatedCallback is used in CreateNativeMediaSources.
-  typedef base::Callback<void(WebKit::WebMediaStream* description,
+  typedef base::Callback<void(WebKit::WebMediaStream* web_stream,
                               bool live)> MediaSourcesCreatedCallback;
   MediaStreamDependencyFactory(
       VideoCaptureImplManager* vc_manager,
@@ -70,7 +70,7 @@
       WebKit::WebRTCPeerConnectionHandlerClient* client);
 
   // CreateNativeMediaSources creates libjingle representations of
-  // the underlying sources to the tracks in |description|.
+  // the underlying sources to the tracks in |web_stream|.
   // |sources_created| is invoked when the sources have either been created and
   // transitioned to a live state or failed.
   // The libjingle sources is stored in the extra data field of
@@ -80,20 +80,20 @@
       int render_view_id,
       const WebKit::WebMediaConstraints& audio_constraints,
       const WebKit::WebMediaConstraints& video_constraints,
-      WebKit::WebMediaStream* description,
+      WebKit::WebMediaStream* web_stream,
       const MediaSourcesCreatedCallback& sources_created);
 
   // Creates a libjingle representation of a MediaStream and stores
-  // it in the extra data field of |description|.
+  // it in the extra data field of |web_stream|.
   void CreateNativeLocalMediaStream(
-      WebKit::WebMediaStream* description);
+      WebKit::WebMediaStream* web_stream);
 
   // Creates a libjingle representation of a MediaStream and stores
-  // it in the extra data field of |description|.
+  // it in the extra data field of |web_stream|.
   // |stream_stopped| is a callback that is run when a MediaStream have been
   // stopped.
   void CreateNativeLocalMediaStream(
-      WebKit::WebMediaStream* description,
+      WebKit::WebMediaStream* web_stream,
       const MediaStreamExtraData::StreamStopCallback& stream_stop);
 
   // Adds a libjingle representation of a MediaStreamTrack to |stream| based
@@ -138,7 +138,7 @@
   // Stop the audio source for local audio tracks.
   // TODO(xians): Remove this function if each audio track takes care of their
   // own source.
-  void StopLocalAudioSource(const WebKit::WebMediaStream& description);
+  void StopLocalAudioSource(const WebKit::WebMediaStream& web_stream);
 
 #if defined(GOOGLE_TV)
   RTCVideoDecoderFactoryTv* decoder_factory_tv() { return decoder_factory_tv_; }
diff --git a/content/renderer/media/media_stream_dependency_factory_unittest.cc b/content/renderer/media/media_stream_dependency_factory_unittest.cc
index 7f3123e..b257f7e 100644
--- a/content/renderer/media/media_stream_dependency_factory_unittest.cc
+++ b/content/renderer/media/media_stream_dependency_factory_unittest.cc
@@ -92,8 +92,22 @@
       video_sources_.assign(video_sources);
     }
     WebKit::WebMediaStream stream_desc;
-    stream_desc.initialize("media stream", audio_sources, video_sources);
+    WebKit::WebVector<WebKit::WebMediaStreamTrack> audio_track_vector(
+        audio_sources.size());
+    for (size_t i = 0; i < audio_track_vector.size(); ++i) {
+      audio_track_vector[i].initialize(audio_sources[i].id(),
+                                       audio_sources[i]);
+    }
 
+    WebKit::WebVector<WebKit::WebMediaStreamTrack> video_track_vector(
+        video_sources.size());
+    for (size_t i = 0; i < video_track_vector.size(); ++i) {
+      video_track_vector[i].initialize(video_sources[i].id(),
+                                       video_sources[i]);
+    }
+
+    stream_desc.initialize("media stream", audio_track_vector,
+                           video_track_vector);
     return stream_desc;
   }
 
@@ -159,18 +173,24 @@
 // remote tracks.
 TEST_F(MediaStreamDependencyFactoryTest, CreateNativeMediaStreamWithoutSource) {
   // Create a WebKit MediaStream description.
+  WebKit::WebMediaStreamSource audio_source;
+  audio_source.initialize("audio source",
+                          WebKit::WebMediaStreamSource::TypeAudio,
+                          "something");
+  WebKit::WebMediaStreamSource video_source;
+  video_source.initialize("video source",
+                          WebKit::WebMediaStreamSource::TypeVideo,
+                          "something");
+
+  WebKit::WebVector<WebKit::WebMediaStreamTrack> audio_tracks(
+      static_cast<size_t>(1));
+  audio_tracks[0].initialize(audio_source.id(), audio_source);
+  WebKit::WebVector<WebKit::WebMediaStreamTrack> video_tracks(
+      static_cast<size_t>(1));
+  video_tracks[0].initialize(video_source.id(), video_source);
+
   WebKit::WebMediaStream stream_desc;
-  WebKit::WebVector<WebKit::WebMediaStreamSource> audio_sources(
-      static_cast<size_t>(1));
-  audio_sources[0].initialize("audio source",
-                              WebKit::WebMediaStreamSource::TypeAudio,
-                              "something");
-  WebKit::WebVector<WebKit::WebMediaStreamSource> video_sources(
-      static_cast<size_t>(1));
-  video_sources[0].initialize("video source",
-                              WebKit::WebMediaStreamSource::TypeVideo,
-                              "something");
-  stream_desc.initialize("new stream", audio_sources, video_sources);
+  stream_desc.initialize("new stream", audio_tracks, video_tracks);
 
   EXPECT_TRUE(dependency_factory_->EnsurePeerConnectionFactory());
   dependency_factory_->CreateNativeLocalMediaStream(&stream_desc);
diff --git a/content/renderer/media/media_stream_impl.cc b/content/renderer/media/media_stream_impl.cc
index 7cf1887..4b59907 100644
--- a/content/renderer/media/media_stream_impl.cc
+++ b/content/renderer/media/media_stream_impl.cc
@@ -102,9 +102,9 @@
 }
 
 webrtc::MediaStreamInterface* GetNativeMediaStream(
-    const WebKit::WebMediaStream& descriptor) {
+    const WebKit::WebMediaStream& web_stream) {
   content::MediaStreamExtraData* extra_data =
-      static_cast<content::MediaStreamExtraData*>(descriptor.extraData());
+      static_cast<content::MediaStreamExtraData*>(web_stream.extraData());
   if (!extra_data)
     return NULL;
   return extra_data->stream().get();
@@ -130,7 +130,7 @@
 
   UserMediaRequestInfo* user_media_request = FindUserMediaRequestInfo(label);
   if (user_media_request) {
-    dependency_factory_->StopLocalAudioSource(user_media_request->descriptor);
+    dependency_factory_->StopLocalAudioSource(user_media_request->web_stream);
 
     media_stream_dispatcher_->StopStream(label);
     DeleteUserMediaRequestInfo(user_media_request);
@@ -215,13 +215,13 @@
 }
 
 bool MediaStreamImpl::IsMediaStream(const GURL& url) {
-  WebKit::WebMediaStream descriptor(
+  WebKit::WebMediaStream web_stream(
       WebKit::WebMediaStreamRegistry::lookupMediaStreamDescriptor(url));
 
-  if (descriptor.isNull() || !descriptor.extraData())
+  if (web_stream.isNull() || !web_stream.extraData())
     return false;  // This is not a valid stream.
 
-  webrtc::MediaStreamInterface* stream = GetNativeMediaStream(descriptor);
+  webrtc::MediaStreamInterface* stream = GetNativeMediaStream(web_stream);
   return (stream &&
       (!stream->GetVideoTracks().empty() || !stream->GetAudioTracks().empty()));
 }
@@ -232,15 +232,15 @@
     const base::Closure& error_cb,
     const VideoFrameProvider::RepaintCB& repaint_cb) {
   DCHECK(CalledOnValidThread());
-  WebKit::WebMediaStream descriptor(GetMediaStream(url));
+  WebKit::WebMediaStream web_stream(GetMediaStream(url));
 
-  if (descriptor.isNull() || !descriptor.extraData())
+  if (web_stream.isNull() || !web_stream.extraData())
     return NULL;  // This is not a valid stream.
 
   DVLOG(1) << "MediaStreamImpl::GetVideoFrameProvider stream:"
-           << UTF16ToUTF8(descriptor.label());
+           << UTF16ToUTF8(web_stream.id());
 
-  webrtc::MediaStreamInterface* stream = GetNativeMediaStream(descriptor);
+  webrtc::MediaStreamInterface* stream = GetNativeMediaStream(web_stream);
   if (stream)
     return CreateVideoFrameProvider(stream, error_cb, repaint_cb);
   NOTREACHED();
@@ -250,16 +250,16 @@
 scoped_refptr<MediaStreamAudioRenderer>
 MediaStreamImpl::GetAudioRenderer(const GURL& url) {
   DCHECK(CalledOnValidThread());
-  WebKit::WebMediaStream descriptor(GetMediaStream(url));
+  WebKit::WebMediaStream web_stream(GetMediaStream(url));
 
-  if (descriptor.isNull() || !descriptor.extraData())
+  if (web_stream.isNull() || !web_stream.extraData())
     return NULL;  // This is not a valid stream.
 
   DVLOG(1) << "MediaStreamImpl::GetAudioRenderer stream:"
-           << UTF16ToUTF8(descriptor.label());
+           << UTF16ToUTF8(web_stream.id());
 
   MediaStreamExtraData* extra_data =
-      static_cast<MediaStreamExtraData*>(descriptor.extraData());
+      static_cast<MediaStreamExtraData*>(web_stream.extraData());
 
   if (extra_data->is_local()) {
     // Create the local audio renderer if the stream contains audio tracks.
@@ -320,11 +320,25 @@
   request_info->video_sources.assign(video_source_vector);
 
   WebKit::WebUserMediaRequest* request = &(request_info->request);
-  WebKit::WebString webkit_label = UTF8ToUTF16(label);
-  WebKit::WebMediaStream* description = &(request_info->descriptor);
+  WebKit::WebString webkit_id = UTF8ToUTF16(label);
+  WebKit::WebMediaStream* web_stream = &(request_info->web_stream);
 
-  description->initialize(webkit_label, audio_source_vector,
-                          video_source_vector);
+  WebKit::WebVector<WebKit::WebMediaStreamTrack> audio_track_vector(
+      audio_array.size());
+  for (size_t i = 0; i < audio_track_vector.size(); ++i) {
+    audio_track_vector[i].initialize(audio_source_vector[i].id(),
+                                     audio_source_vector[i]);
+  }
+
+  WebKit::WebVector<WebKit::WebMediaStreamTrack> video_track_vector(
+      video_array.size());
+  for (size_t i = 0; i < video_track_vector.size(); ++i) {
+    video_track_vector[i].initialize(video_source_vector[i].id(),
+                                     video_source_vector[i]);
+  }
+
+  web_stream->initialize(webkit_id, audio_track_vector,
+                         video_track_vector);
 
   // WebUserMediaRequest don't have an implementation in unit tests.
   // Therefore we need to check for isNull here.
@@ -335,7 +349,7 @@
 
   dependency_factory_->CreateNativeMediaSources(
       RenderViewObserver::routing_id(),
-      audio_constraints, video_constraints, description,
+      audio_constraints, video_constraints, web_stream,
       base::Bind(&MediaStreamImpl::OnCreateNativeSourcesComplete, AsWeakPtr()));
 }
 
@@ -352,20 +366,20 @@
     DVLOG(1) << "Request ID not found";
     return;
   }
-  CompleteGetUserMediaRequest(request_info->descriptor,
+  CompleteGetUserMediaRequest(request_info->web_stream,
                               &request_info->request,
                               false);
   DeleteUserMediaRequestInfo(request_info);
 }
 
-// Callback from MediaStreamDependencyFactory when the sources in |description|
+// Callback from MediaStreamDependencyFactory when the sources in |web_stream|
 // have been generated.
 void MediaStreamImpl::OnCreateNativeSourcesComplete(
-    WebKit::WebMediaStream* description,
+    WebKit::WebMediaStream* web_stream,
     bool request_succeeded) {
   DVLOG(1) << "MediaStreamImpl::OnCreateNativeSourcesComplete stream:"
-           << UTF16ToUTF8(description->label());
-  UserMediaRequestInfo* request_info = FindUserMediaRequestInfo(description);
+           << UTF16ToUTF8(web_stream->id());
+  UserMediaRequestInfo* request_info = FindUserMediaRequestInfo(web_stream);
   if (!request_info) {
     // This can happen if the request is canceled or the frame reloads while
     // MediaStreamDependencyFactory is creating the sources.
@@ -376,13 +390,13 @@
   // Create a native representation of the stream.
   if (request_succeeded) {
     dependency_factory_->CreateNativeLocalMediaStream(
-        description,
+        web_stream,
         base::Bind(&MediaStreamImpl::OnLocalMediaStreamStop, AsWeakPtr()));
   }
-  CompleteGetUserMediaRequest(request_info->descriptor, &request_info->request,
+  CompleteGetUserMediaRequest(request_info->web_stream, &request_info->request,
                               request_succeeded);
   if (!request_succeeded) {
-    OnLocalMediaStreamStop(UTF16ToUTF8(description->label()));
+    OnLocalMediaStreamStop(UTF16ToUTF8(web_stream->id()));
   }
 }
 
@@ -451,7 +465,7 @@
 MediaStreamImpl::FindUserMediaRequestInfo(const std::string& label) {
   UserMediaRequests::iterator it = user_media_requests_.begin();
   for (; it != user_media_requests_.end(); ++it) {
-    if ((*it)->generated && (*it)->descriptor.label() == UTF8ToUTF16(label))
+    if ((*it)->generated && (*it)->web_stream.id() == UTF8ToUTF16(label))
       return (*it);
   }
   return NULL;
@@ -459,10 +473,10 @@
 
 MediaStreamImpl::UserMediaRequestInfo*
 MediaStreamImpl::FindUserMediaRequestInfo(
-    WebKit::WebMediaStream* descriptor) {
+    WebKit::WebMediaStream* web_stream) {
   UserMediaRequests::iterator it = user_media_requests_.begin();
   for (; it != user_media_requests_.end(); ++it) {
-    if (&((*it)->descriptor) == descriptor)
+    if (&((*it)->web_stream) == web_stream)
       return  (*it);
   }
   return NULL;
@@ -500,10 +514,10 @@
       // If not, we cancel the request and delete the request object.
       if ((*request_it)->generated) {
         // Stop the local audio track before closing the device in the browser.
-        dependency_factory_->StopLocalAudioSource((*request_it)->descriptor);
+        dependency_factory_->StopLocalAudioSource((*request_it)->web_stream);
 
         media_stream_dispatcher_->StopStream(
-            UTF16ToUTF8((*request_it)->descriptor.label()));
+            UTF16ToUTF8((*request_it)->web_stream.id()));
       } else {
         media_stream_dispatcher_->CancelGenerateStream(
             (*request_it)->request_id, AsWeakPtr());
diff --git a/content/renderer/media/media_stream_impl.h b/content/renderer/media/media_stream_impl.h
index 9b98aeb..fb3db97 100644
--- a/content/renderer/media/media_stream_impl.h
+++ b/content/renderer/media/media_stream_impl.h
@@ -94,11 +94,11 @@
 
   // Callback function triggered when all native (libjingle) versions of the
   // underlying media sources have been created and started.
-  // |description| is a raw pointer to the description in
-  // UserMediaRequests::description for which the underlying sources have been
+  // |web_stream| is a raw pointer to the web_stream in
+  // UserMediaRequests::web_stream for which the underlying sources have been
   // created.
   void OnCreateNativeSourcesComplete(
-      WebKit::WebMediaStream* description,
+      WebKit::WebMediaStream* web_stream,
       bool request_succeeded);
 
   // This function is virtual for test purposes. A test can override this to
@@ -127,7 +127,7 @@
     // OnStreamGenerated.
     bool generated;
     WebKit::WebFrame* frame;  // WebFrame that requested the MediaStream.
-    WebKit::WebMediaStream descriptor;
+    WebKit::WebMediaStream web_stream;
     WebKit::WebUserMediaRequest request;
     WebKit::WebVector<WebKit::WebMediaStreamSource> audio_sources;
     WebKit::WebVector<WebKit::WebMediaStreamSource> video_sources;
@@ -136,7 +136,7 @@
 
   UserMediaRequestInfo* FindUserMediaRequestInfo(int request_id);
   UserMediaRequestInfo* FindUserMediaRequestInfo(
-      WebKit::WebMediaStream* descriptor);
+      WebKit::WebMediaStream* web_stream);
   UserMediaRequestInfo* FindUserMediaRequestInfo(
       const WebKit::WebUserMediaRequest& request);
   UserMediaRequestInfo* FindUserMediaRequestInfo(const std::string& label);
diff --git a/content/renderer/media/media_stream_impl_unittest.cc b/content/renderer/media/media_stream_impl_unittest.cc
index 1b778e3..ea0b834 100644
--- a/content/renderer/media/media_stream_impl_unittest.cc
+++ b/content/renderer/media/media_stream_impl_unittest.cc
@@ -147,9 +147,9 @@
   WebKit::WebMediaStream video_desc = RequestLocalMediaStream();
 
   // Stop generated local streams.
-  ms_impl_->OnLocalMediaStreamStop(mixed_desc.label().utf8());
+  ms_impl_->OnLocalMediaStreamStop(mixed_desc.id().utf8());
   EXPECT_EQ(1, ms_dispatcher_->stop_stream_counter());
-  ms_impl_->OnLocalMediaStreamStop(audio_desc.label().utf8());
+  ms_impl_->OnLocalMediaStreamStop(audio_desc.id().utf8());
   EXPECT_EQ(2, ms_dispatcher_->stop_stream_counter());
 
   // Test that the MediaStreams are deleted if the owning WebFrame is deleted.
@@ -219,7 +219,7 @@
   EXPECT_EQ(1, ms_dispatcher_->request_stream_counter());
   ms_impl_->FrameWillClose(NULL);
   EXPECT_EQ(1, ms_dispatcher_->stop_stream_counter());
-  ms_impl_->OnLocalMediaStreamStop(mixed_desc.label().utf8());
+  ms_impl_->OnLocalMediaStreamStop(mixed_desc.id().utf8());
   EXPECT_EQ(1, ms_dispatcher_->stop_stream_counter());
 }
 
diff --git a/content/renderer/media/peer_connection_tracker.cc b/content/renderer/media/peer_connection_tracker.cc
index 9f52e65..44f4445 100644
--- a/content/renderer/media/peer_connection_tracker.cc
+++ b/content/renderer/media/peer_connection_tracker.cc
@@ -70,25 +70,25 @@
 
 static string SerializeMediaDescriptor(
     const WebKit::WebMediaStream& stream) {
-  string label = UTF16ToUTF8(stream.label());
+  string label = UTF16ToUTF8(stream.id());
   string result = "label: " + label;
-  WebKit::WebVector<WebKit::WebMediaStreamTrack> sources;
-  stream.audioSources(sources);
-  if (!sources.isEmpty()) {
+  WebKit::WebVector<WebKit::WebMediaStreamTrack> tracks;
+  stream.audioTracks(tracks);
+  if (!tracks.isEmpty()) {
     result += ", audio: [";
-    for (size_t i = 0; i < sources.size(); ++i) {
-      result += SerializeMediaStreamComponent(sources[i]);
-      if (i != sources.size() - 1)
+    for (size_t i = 0; i < tracks.size(); ++i) {
+      result += SerializeMediaStreamComponent(tracks[i]);
+      if (i != tracks.size() - 1)
         result += ", ";
     }
     result += "]";
   }
-  stream.videoSources(sources);
-  if (!sources.isEmpty()) {
+  stream.videoTracks(tracks);
+  if (!tracks.isEmpty()) {
     result += ", video: [";
-    for (size_t i = 0; i < sources.size(); ++i) {
-      result += SerializeMediaStreamComponent(sources[i]);
-      if (i != sources.size() - 1)
+    for (size_t i = 0; i < tracks.size(); ++i) {
+      result += SerializeMediaStreamComponent(tracks[i]);
+      if (i != tracks.size() - 1)
         result += ", ";
     }
     result += "]";
diff --git a/content/renderer/media/pepper_platform_video_decoder_impl.h b/content/renderer/media/pepper_platform_video_decoder_impl.h
index 686974b..d3fc9a9 100644
--- a/content/renderer/media/pepper_platform_video_decoder_impl.h
+++ b/content/renderer/media/pepper_platform_video_decoder_impl.h
@@ -10,8 +10,8 @@
 #include "base/compiler_specific.h"
 #include "base/memory/ref_counted.h"
 #include "base/message_loop/message_loop.h"
+#include "content/renderer/pepper/plugin_delegate.h"
 #include "media/video/video_decode_accelerator.h"
-#include "webkit/plugins/ppapi/plugin_delegate.h"
 
 namespace content {
 
diff --git a/content/renderer/media/renderer_gpu_video_decoder_factories.cc b/content/renderer/media/renderer_gpu_video_decoder_factories.cc
index e6e6dcf..d33e590 100644
--- a/content/renderer/media/renderer_gpu_video_decoder_factories.cc
+++ b/content/renderer/media/renderer_gpu_video_decoder_factories.cc
@@ -20,21 +20,21 @@
 RendererGpuVideoDecoderFactories::~RendererGpuVideoDecoderFactories() {}
 RendererGpuVideoDecoderFactories::RendererGpuVideoDecoderFactories(
     GpuChannelHost* gpu_channel_host,
-    const scoped_refptr<base::MessageLoopProxy>& compositor_message_loop,
+    const scoped_refptr<base::MessageLoopProxy>& message_loop,
     WebGraphicsContext3DCommandBufferImpl* context)
-    : compositor_message_loop_(compositor_message_loop),
+    : message_loop_(message_loop),
       main_message_loop_(base::MessageLoopProxy::current()),
       gpu_channel_host_(gpu_channel_host),
       aborted_waiter_(true, false),
-      compositor_loop_async_waiter_(false, false),
+      message_loop_async_waiter_(false, false),
       render_thread_async_waiter_(false, false) {
-  if (compositor_message_loop_->BelongsToCurrentThread()) {
+  if (message_loop_->BelongsToCurrentThread()) {
     AsyncGetContext(context);
-    compositor_loop_async_waiter_.Reset();
+    message_loop_async_waiter_.Reset();
     return;
   }
-  // Threaded compositor requires us to wait for the context to be acquired.
-  compositor_message_loop_->PostTask(FROM_HERE, base::Bind(
+  // Wait for the context to be acquired.
+  message_loop_->PostTask(FROM_HERE, base::Bind(
       &RendererGpuVideoDecoderFactories::AsyncGetContext,
       // Unretained to avoid ref/deref'ing |*this|, which is not yet stored in a
       // scoped_refptr.  Safe because the Wait() below keeps us alive until this
@@ -45,9 +45,14 @@
       // which can only happen after this function returns, so our PostTask will
       // run first.
       context));
-  compositor_loop_async_waiter_.Wait();
+  message_loop_async_waiter_.Wait();
 }
 
+RendererGpuVideoDecoderFactories::RendererGpuVideoDecoderFactories()
+    : aborted_waiter_(true, false),
+      message_loop_async_waiter_(false, false),
+      render_thread_async_waiter_(false, false) {}
+
 void RendererGpuVideoDecoderFactories::AsyncGetContext(
     WebGraphicsContext3DCommandBufferImpl* context) {
   context_ = context->AsWeakPtr();
@@ -58,31 +63,31 @@
       context_->insertEventMarkerEXT("GpuVDAContext3D");
     }
   }
-  compositor_loop_async_waiter_.Signal();
+  message_loop_async_waiter_.Signal();
 }
 
 media::VideoDecodeAccelerator*
 RendererGpuVideoDecoderFactories::CreateVideoDecodeAccelerator(
     media::VideoCodecProfile profile,
     media::VideoDecodeAccelerator::Client* client) {
-  if (compositor_message_loop_->BelongsToCurrentThread()) {
+  if (message_loop_->BelongsToCurrentThread()) {
     AsyncCreateVideoDecodeAccelerator(profile, client);
-    compositor_loop_async_waiter_.Reset();
+    message_loop_async_waiter_.Reset();
     return vda_.release();
   }
   // The VDA is returned in the vda_ member variable by the
   // AsyncCreateVideoDecodeAccelerator() function.
-  compositor_message_loop_->PostTask(FROM_HERE, base::Bind(
+  message_loop_->PostTask(FROM_HERE, base::Bind(
       &RendererGpuVideoDecoderFactories::AsyncCreateVideoDecodeAccelerator,
       this, profile, client));
 
   base::WaitableEvent* objects[] = {&aborted_waiter_,
-                                    &compositor_loop_async_waiter_};
+                                    &message_loop_async_waiter_};
   if (base::WaitableEvent::WaitMany(objects, arraysize(objects)) == 0) {
     // If we are aborting and the VDA is created by the
     // AsyncCreateVideoDecodeAccelerator() function later we need to ensure
     // that it is destroyed on the same thread.
-    compositor_message_loop_->PostTask(FROM_HERE, base::Bind(
+    message_loop_->PostTask(FROM_HERE, base::Bind(
         &RendererGpuVideoDecoderFactories::AsyncDestroyVideoDecodeAccelerator,
         this));
     return NULL;
@@ -93,13 +98,13 @@
 void RendererGpuVideoDecoderFactories::AsyncCreateVideoDecodeAccelerator(
       media::VideoCodecProfile profile,
       media::VideoDecodeAccelerator::Client* client) {
-  DCHECK(compositor_message_loop_->BelongsToCurrentThread());
+  DCHECK(message_loop_->BelongsToCurrentThread());
 
   if (context_.get() && context_->GetCommandBufferProxy()) {
     vda_ = gpu_channel_host_->CreateVideoDecoder(
         context_->GetCommandBufferProxy()->GetRouteID(), profile, client);
   }
-  compositor_loop_async_waiter_.Signal();
+  message_loop_async_waiter_.Signal();
 }
 
 uint32 RendererGpuVideoDecoderFactories::CreateTextures(
@@ -109,19 +114,19 @@
     uint32 texture_target) {
   uint32 sync_point = 0;
 
-  if (compositor_message_loop_->BelongsToCurrentThread()) {
+  if (message_loop_->BelongsToCurrentThread()) {
     AsyncCreateTextures(count, size, texture_target, &sync_point);
     texture_ids->swap(created_textures_);
     texture_mailboxes->swap(created_texture_mailboxes_);
-    compositor_loop_async_waiter_.Reset();
+    message_loop_async_waiter_.Reset();
     return sync_point;
   }
-  compositor_message_loop_->PostTask(FROM_HERE, base::Bind(
+  message_loop_->PostTask(FROM_HERE, base::Bind(
       &RendererGpuVideoDecoderFactories::AsyncCreateTextures, this,
       count, size, texture_target, &sync_point));
 
   base::WaitableEvent* objects[] = {&aborted_waiter_,
-                                    &compositor_loop_async_waiter_};
+                                    &message_loop_async_waiter_};
   if (base::WaitableEvent::WaitMany(objects, arraysize(objects)) == 0)
     return 0;
   texture_ids->swap(created_textures_);
@@ -132,11 +137,11 @@
 void RendererGpuVideoDecoderFactories::AsyncCreateTextures(
     int32 count, const gfx::Size& size, uint32 texture_target,
     uint32* sync_point) {
-  DCHECK(compositor_message_loop_->BelongsToCurrentThread());
+  DCHECK(message_loop_->BelongsToCurrentThread());
   DCHECK(texture_target);
 
   if (!context_.get()) {
-    compositor_loop_async_waiter_.Signal();
+    message_loop_async_waiter_.Signal();
     return;
   }
   gpu::gles2::GLES2Implementation* gles2 = context_->GetImplementation();
@@ -167,20 +172,20 @@
   DCHECK_EQ(gles2->GetError(), static_cast<GLenum>(GL_NO_ERROR));
 
   *sync_point = gles2->InsertSyncPointCHROMIUM();
-  compositor_loop_async_waiter_.Signal();
+  message_loop_async_waiter_.Signal();
 }
 
 void RendererGpuVideoDecoderFactories::DeleteTexture(uint32 texture_id) {
-  if (compositor_message_loop_->BelongsToCurrentThread()) {
+  if (message_loop_->BelongsToCurrentThread()) {
     AsyncDeleteTexture(texture_id);
     return;
   }
-  compositor_message_loop_->PostTask(FROM_HERE, base::Bind(
+  message_loop_->PostTask(FROM_HERE, base::Bind(
       &RendererGpuVideoDecoderFactories::AsyncDeleteTexture, this, texture_id));
 }
 
 void RendererGpuVideoDecoderFactories::AsyncDeleteTexture(uint32 texture_id) {
-  DCHECK(compositor_message_loop_->BelongsToCurrentThread());
+  DCHECK(message_loop_->BelongsToCurrentThread());
   if (!context_.get())
     return;
 
@@ -190,30 +195,31 @@
 }
 
 void RendererGpuVideoDecoderFactories::WaitSyncPoint(uint32 sync_point) {
-  if (compositor_message_loop_->BelongsToCurrentThread()) {
+  if (message_loop_->BelongsToCurrentThread()) {
     AsyncWaitSyncPoint(sync_point);
+    message_loop_async_waiter_.Reset();
     return;
   }
 
-  compositor_message_loop_->PostTask(FROM_HERE, base::Bind(
+  message_loop_->PostTask(FROM_HERE, base::Bind(
       &RendererGpuVideoDecoderFactories::AsyncWaitSyncPoint,
       this,
       sync_point));
   base::WaitableEvent* objects[] = {&aborted_waiter_,
-                                    &compositor_loop_async_waiter_};
+                                    &message_loop_async_waiter_};
   base::WaitableEvent::WaitMany(objects, arraysize(objects));
 }
 
 void RendererGpuVideoDecoderFactories::AsyncWaitSyncPoint(uint32 sync_point) {
-  DCHECK(compositor_message_loop_->BelongsToCurrentThread());
+  DCHECK(message_loop_->BelongsToCurrentThread());
   if (!context_) {
-    compositor_loop_async_waiter_.Signal();
+    message_loop_async_waiter_.Signal();
     return;
   }
 
   gpu::gles2::GLES2Implementation* gles2 = context_->GetImplementation();
   gles2->WaitSyncPointCHROMIUM(sync_point);
-  compositor_loop_async_waiter_.Signal();
+  message_loop_async_waiter_.Signal();
 }
 
 void RendererGpuVideoDecoderFactories::ReadPixels(
@@ -225,25 +231,26 @@
   // until the AsyncReadPixels() call completes.
   read_pixels_bitmap_.setPixelRef(pixels.pixelRef());
 
-  if (!compositor_message_loop_->BelongsToCurrentThread()) {
-    compositor_message_loop_->PostTask(FROM_HERE, base::Bind(
+  if (!message_loop_->BelongsToCurrentThread()) {
+    message_loop_->PostTask(FROM_HERE, base::Bind(
         &RendererGpuVideoDecoderFactories::AsyncReadPixels, this,
         texture_id, texture_target, size));
     base::WaitableEvent* objects[] = {&aborted_waiter_,
-                                      &compositor_loop_async_waiter_};
+                                      &message_loop_async_waiter_};
     if (base::WaitableEvent::WaitMany(objects, arraysize(objects)) == 0)
       return;
   } else {
     AsyncReadPixels(texture_id, texture_target, size);
+    message_loop_async_waiter_.Reset();
   }
   read_pixels_bitmap_.setPixelRef(NULL);
 }
 
 void RendererGpuVideoDecoderFactories::AsyncReadPixels(
     uint32 texture_id, uint32 texture_target, const gfx::Size& size) {
-  DCHECK(compositor_message_loop_->BelongsToCurrentThread());
+  DCHECK(message_loop_->BelongsToCurrentThread());
   if (!context_.get()) {
-    compositor_loop_async_waiter_.Signal();
+    message_loop_async_waiter_.Signal();
     return;
   }
 
@@ -270,7 +277,7 @@
   gles2->DeleteFramebuffers(1, &fb);
   gles2->DeleteTextures(1, &tmp_texture);
   DCHECK_EQ(gles2->GetError(), static_cast<GLenum>(GL_NO_ERROR));
-  compositor_loop_async_waiter_.Signal();
+  message_loop_async_waiter_.Signal();
 }
 
 base::SharedMemory* RendererGpuVideoDecoderFactories::CreateSharedMemory(
@@ -300,7 +307,7 @@
 
 scoped_refptr<base::MessageLoopProxy>
 RendererGpuVideoDecoderFactories::GetMessageLoop() {
-  return compositor_message_loop_;
+  return message_loop_;
 }
 
 void RendererGpuVideoDecoderFactories::Abort() {
@@ -311,6 +318,17 @@
   return aborted_waiter_.IsSignaled();
 }
 
+scoped_refptr<media::GpuVideoDecoderFactories>
+RendererGpuVideoDecoderFactories::Clone() {
+  scoped_refptr<RendererGpuVideoDecoderFactories> factories =
+      new RendererGpuVideoDecoderFactories();
+  factories->message_loop_ = message_loop_;
+  factories->main_message_loop_ = main_message_loop_;
+  factories->gpu_channel_host_ = gpu_channel_host_;
+  factories->context_ = context_;
+  return factories;
+}
+
 void RendererGpuVideoDecoderFactories::AsyncDestroyVideoDecodeAccelerator() {
   // OK to release because Destroy() will delete the VDA instance.
   if (vda_)
diff --git a/content/renderer/media/renderer_gpu_video_decoder_factories.h b/content/renderer/media/renderer_gpu_video_decoder_factories.h
index 7f7426b..32f9bcd 100644
--- a/content/renderer/media/renderer_gpu_video_decoder_factories.h
+++ b/content/renderer/media/renderer_gpu_video_decoder_factories.h
@@ -32,9 +32,8 @@
 //
 // The public methods of the class can be called from any thread, and are
 // internally trampolined to the appropriate thread.  GPU/GL-related calls go to
-// the constructor-argument loop (mostly that's the compositor thread, or the
-// renderer thread if threaded compositing is disabled), and shmem-related calls
-// go to the render thread.
+// the constructor-argument loop (the media thread), and shmem-related calls go
+// to the render thread.
 class CONTENT_EXPORT RendererGpuVideoDecoderFactories
     : public media::GpuVideoDecoderFactories {
  public:
@@ -42,7 +41,7 @@
   // use.
   RendererGpuVideoDecoderFactories(
       GpuChannelHost* gpu_channel_host,
-      const scoped_refptr<base::MessageLoopProxy>& compositor_message_loop,
+      const scoped_refptr<base::MessageLoopProxy>& message_loop,
       WebGraphicsContext3DCommandBufferImpl* wgc3dcbi);
 
   // media::GpuVideoDecoderFactories implementation.
@@ -67,20 +66,25 @@
   virtual void Abort() OVERRIDE;
   virtual bool IsAborted() OVERRIDE;
 
+  // Makes a copy of |this|.
+  scoped_refptr<media::GpuVideoDecoderFactories> Clone();
+
  protected:
   friend class base::RefCountedThreadSafe<RendererGpuVideoDecoderFactories>;
   virtual ~RendererGpuVideoDecoderFactories();
 
  private:
-  // Helper for the constructor to acquire the ContentGLContext on the
-  // compositor thread (when it is enabled).
+  RendererGpuVideoDecoderFactories();
+
+  // Helper for the constructor to acquire the ContentGLContext on
+  // |message_loop_|.
   void AsyncGetContext(WebGraphicsContext3DCommandBufferImpl* context);
 
   // Async versions of the public methods.  They use output parameters instead
   // of return values and each takes a WaitableEvent* param to signal completion
   // (except for DeleteTexture, which is fire-and-forget).
   // AsyncCreateSharedMemory runs on the renderer thread and the rest run on
-  // |compositor_message_loop_|.
+  // |message_loop_|.
   // The AsyncCreateVideoDecodeAccelerator returns its output in the vda_
   // member.
   void AsyncCreateVideoDecodeAccelerator(
@@ -95,7 +99,7 @@
   void AsyncCreateSharedMemory(size_t size);
   void AsyncDestroyVideoDecodeAccelerator();
 
-  scoped_refptr<base::MessageLoopProxy> compositor_message_loop_;
+  scoped_refptr<base::MessageLoopProxy> message_loop_;
   scoped_refptr<base::MessageLoopProxy> main_message_loop_;
   scoped_refptr<GpuChannelHost> gpu_channel_host_;
   base::WeakPtr<WebGraphicsContext3DCommandBufferImpl> context_;
@@ -103,10 +107,10 @@
   // This event is signaled if we have been asked to Abort().
   base::WaitableEvent aborted_waiter_;
 
-  // This event is signaled by asynchronous tasks posted to the compositor
-  // message loop to indicate their completion.
+  // This event is signaled by asynchronous tasks posted to |message_loop_| to
+  // indicate their completion.
   // e.g. AsyncCreateVideoDecodeAccelerator()/AsyncCreateTextures() etc.
-  base::WaitableEvent compositor_loop_async_waiter_;
+  base::WaitableEvent message_loop_async_waiter_;
 
   // This event is signaled by asynchronous tasks posted to the renderer thread
   // message loop to indicate their completion. e.g. AsyncCreateSharedMemory.
@@ -126,7 +130,7 @@
   std::vector<uint32> created_textures_;
   std::vector<gpu::Mailbox> created_texture_mailboxes_;
 
-  DISALLOW_IMPLICIT_CONSTRUCTORS(RendererGpuVideoDecoderFactories);
+  DISALLOW_COPY_AND_ASSIGN(RendererGpuVideoDecoderFactories);
 };
 
 }  // namespace content
diff --git a/content/renderer/media/rtc_peer_connection_handler_unittest.cc b/content/renderer/media/rtc_peer_connection_handler_unittest.cc
index 367524b..72e9cfd 100644
--- a/content/renderer/media/rtc_peer_connection_handler_unittest.cc
+++ b/content/renderer/media/rtc_peer_connection_handler_unittest.cc
@@ -223,31 +223,37 @@
     std::string video_track_label("video-label");
     std::string audio_track_label("audio-label");
 
-    WebKit::WebVector<WebKit::WebMediaStreamSource> audio_sources(
+    WebKit::WebMediaStreamSource audio_source;
+    audio_source.initialize(WebKit::WebString::fromUTF8(audio_track_label),
+                            WebKit::WebMediaStreamSource::TypeAudio,
+                            WebKit::WebString::fromUTF8("audio_track"));
+    WebKit::WebMediaStreamSource video_source;
+    video_source.initialize(WebKit::WebString::fromUTF8(video_track_label),
+                            WebKit::WebMediaStreamSource::TypeVideo,
+                            WebKit::WebString::fromUTF8("video_track"));
+
+    WebKit::WebVector<WebKit::WebMediaStreamTrack> audio_tracks(
         static_cast<size_t>(1));
-    audio_sources[0].initialize(WebKit::WebString::fromUTF8(audio_track_label),
-                                WebKit::WebMediaStreamSource::TypeAudio,
-                                WebKit::WebString::fromUTF8("audio_track"));
-    WebKit::WebVector<WebKit::WebMediaStreamSource> video_sources(
+    audio_tracks[0].initialize(audio_source.id(), audio_source);
+    WebKit::WebVector<WebKit::WebMediaStreamTrack> video_tracks(
         static_cast<size_t>(1));
-    video_sources[0].initialize(WebKit::WebString::fromUTF8(video_track_label),
-                                WebKit::WebMediaStreamSource::TypeVideo,
-                                WebKit::WebString::fromUTF8("video_track"));
+    video_tracks[0].initialize(video_source.id(), video_source);
+
     WebKit::WebMediaStream local_stream;
-    local_stream.initialize(UTF8ToUTF16(stream_label), audio_sources,
-                            video_sources);
+    local_stream.initialize(UTF8ToUTF16(stream_label), audio_tracks,
+                            video_tracks);
 
     scoped_refptr<webrtc::MediaStreamInterface> native_stream(
         mock_dependency_factory_->CreateLocalMediaStream(stream_label));
-    WebKit::WebVector<WebKit::WebMediaStreamTrack> audio_tracks;
-    local_stream.audioSources(audio_tracks);
+
+    local_stream.audioTracks(audio_tracks);
     const std::string audio_track_id = UTF16ToUTF8(audio_tracks[0].id());
     scoped_refptr<webrtc::AudioTrackInterface> audio_track(
         mock_dependency_factory_->CreateLocalAudioTrack(audio_track_id,
                                                         NULL));
     native_stream->AddTrack(audio_track.get());
-    WebKit::WebVector<WebKit::WebMediaStreamTrack> video_tracks;
-    local_stream.audioSources(video_tracks);
+
+    local_stream.videoTracks(video_tracks);
     const std::string video_track_id = UTF16ToUTF8(video_tracks[0].id());
     webrtc::VideoSourceInterface* source = NULL;
     scoped_refptr<webrtc::VideoTrackInterface> video_track(
@@ -447,7 +453,7 @@
   WebKit::WebMediaConstraints constraints;
   pc_handler_->addStream(local_stream, constraints);
   WebKit::WebVector<WebKit::WebMediaStreamTrack> tracks;
-  local_stream.audioSources(tracks);
+  local_stream.audioTracks(tracks);
   ASSERT_LE(1ul, tracks.size());
 
   scoped_refptr<MockRTCStatsRequest> request(
@@ -464,7 +470,7 @@
   const WebKit::WebMediaStream& remote_stream = mock_client_->remote_stream();
 
   WebKit::WebVector<WebKit::WebMediaStreamTrack> tracks;
-  remote_stream.audioSources(tracks);
+  remote_stream.audioTracks(tracks);
   ASSERT_LE(1ul, tracks.size());
 
   scoped_refptr<MockRTCStatsRequest> request(
@@ -482,7 +488,7 @@
   WebKit::WebMediaConstraints constraints;
   WebKit::WebVector<WebKit::WebMediaStreamTrack> tracks;
 
-  local_stream.audioSources(tracks);
+  local_stream.audioTracks(tracks);
   WebKit::WebMediaStreamTrack component = tracks[0];
   mock_peer_connection_->SetGetStatsResult(false);
 
@@ -641,20 +647,20 @@
   testing::InSequence sequence;
   EXPECT_CALL(*mock_tracker_.get(), TrackAddStream(
       pc_handler_.get(),
-      testing::Property(&WebKit::WebMediaStream::label,
+      testing::Property(&WebKit::WebMediaStream::id,
                         UTF8ToUTF16(remote_stream_label)),
       PeerConnectionTracker::SOURCE_REMOTE));
   EXPECT_CALL(*mock_client_.get(), didAddRemoteStream(
-      testing::Property(&WebKit::WebMediaStream::label,
+      testing::Property(&WebKit::WebMediaStream::id,
                         UTF8ToUTF16(remote_stream_label))));
 
   EXPECT_CALL(*mock_tracker_.get(), TrackRemoveStream(
       pc_handler_.get(),
-      testing::Property(&WebKit::WebMediaStream::label,
+      testing::Property(&WebKit::WebMediaStream::id,
                         UTF8ToUTF16(remote_stream_label)),
       PeerConnectionTracker::SOURCE_REMOTE));
   EXPECT_CALL(*mock_client_.get(), didRemoveRemoteStream(
-      testing::Property(&WebKit::WebMediaStream::label,
+      testing::Property(&WebKit::WebMediaStream::id,
                         UTF8ToUTF16(remote_stream_label))));
 
   pc_handler_->OnAddStream(remote_stream.get());
@@ -669,7 +675,7 @@
 
   testing::InSequence sequence;
   EXPECT_CALL(*mock_client_.get(), didAddRemoteStream(
-      testing::Property(&WebKit::WebMediaStream::label,
+      testing::Property(&WebKit::WebMediaStream::id,
                         UTF8ToUTF16(remote_stream_label))));
   pc_handler_->OnAddStream(remote_stream.get());
   const WebKit::WebMediaStream& webkit_stream = mock_client_->remote_stream();
@@ -701,7 +707,7 @@
       AddRemoteMockMediaStream(remote_stream_label, "video", "audio"));
 
   EXPECT_CALL(*mock_client_.get(), didAddRemoteStream(
-      testing::Property(&WebKit::WebMediaStream::label,
+      testing::Property(&WebKit::WebMediaStream::id,
                         UTF8ToUTF16(remote_stream_label))));
   pc_handler_->OnAddStream(remote_stream.get());
   const WebKit::WebMediaStream& webkit_stream = mock_client_->remote_stream();
@@ -731,7 +737,7 @@
       AddRemoteMockMediaStream(remote_stream_label, "video", "video"));
 
   EXPECT_CALL(*mock_client_.get(), didAddRemoteStream(
-      testing::Property(&WebKit::WebMediaStream::label,
+      testing::Property(&WebKit::WebMediaStream::id,
                         UTF8ToUTF16(remote_stream_label))));
   pc_handler_->OnAddStream(remote_stream.get());
   const WebKit::WebMediaStream& webkit_stream = mock_client_->remote_stream();
@@ -797,12 +803,12 @@
   pc_handler_->addStream(local_stream, constraints);
 
   WebKit::WebVector<WebKit::WebMediaStreamTrack> tracks;
-  local_stream.videoSources(tracks);
+  local_stream.videoTracks(tracks);
 
   ASSERT_LE(1ul, tracks.size());
   EXPECT_FALSE(pc_handler_->createDTMFSender(tracks[0]));
 
-  local_stream.audioSources(tracks);
+  local_stream.audioTracks(tracks);
   ASSERT_LE(1ul, tracks.size());
 
   EXPECT_CALL(*mock_tracker_.get(),
diff --git a/content/renderer/media/rtc_video_decoder.cc b/content/renderer/media/rtc_video_decoder.cc
index 4d01fbc..e89cad9 100644
--- a/content/renderer/media/rtc_video_decoder.cc
+++ b/content/renderer/media/rtc_video_decoder.cc
@@ -73,8 +73,7 @@
     : weak_factory_(this),
       weak_this_(weak_factory_.GetWeakPtr()),
       factories_(factories),
-      vda_loop_proxy_(factories_->GetMessageLoop()),
-      create_shm_thread_("CreateSHMThread"),
+      vda_loop_proxy_(factories->GetMessageLoop()),
       decoder_texture_target_(0),
       next_picture_buffer_id_(0),
       state_(UNINITIALIZED),
@@ -82,35 +81,25 @@
       num_shm_buffers_(0),
       next_bitstream_buffer_id_(0),
       reset_bitstream_buffer_id_(ID_INVALID) {
-  create_shm_thread_.Start();
-  // Initialize directly if |vda_loop_proxy_| is the renderer thread.
-  base::WaitableEvent compositor_loop_async_waiter(false, false);
-  if (vda_loop_proxy_->BelongsToCurrentThread()) {
-    Initialize(&compositor_loop_async_waiter);
-    return;
-  }
-  // Post the task if |vda_loop_proxy_| is the compositor thread. Waiting here
-  // is safe because the compositor thread will not be stopped until the
-  // renderer thread shuts down.
+  DCHECK(!vda_loop_proxy_->BelongsToCurrentThread());
+  base::WaitableEvent message_loop_async_waiter(false, false);
+  // Waiting here is safe. The media thread is stopped in the child thread and
+  // the child thread is blocked when VideoDecoderFactory::CreateVideoDecoder
+  // runs.
   vda_loop_proxy_->PostTask(FROM_HERE,
                             base::Bind(&RTCVideoDecoder::Initialize,
                                        base::Unretained(this),
-                                       &compositor_loop_async_waiter));
-  compositor_loop_async_waiter.Wait();
+                                       &message_loop_async_waiter));
+  message_loop_async_waiter.Wait();
 }
 
 RTCVideoDecoder::~RTCVideoDecoder() {
   DVLOG(2) << "~RTCVideoDecoder";
-  factories_->Abort();
-  create_shm_thread_.Stop();
-  // Delete vda and remove |this| from the observer if vda thread is alive.
-  if (vda_loop_proxy_->BelongsToCurrentThread()) {
+  // Remove |this| from the observer if vda thread is alive.
+  if (vda_loop_proxy_->BelongsToCurrentThread())
     base::MessageLoop::current()->RemoveDestructionObserver(this);
-    DestroyVDA();
-  } else {
-    // VDA should have been destroyed in WillDestroyCurrentMessageLoop.
-    DCHECK(!vda_);
-  }
+  // VDA should have been destroyed.
+  DCHECK(!vda_);
 
   // Delete all shared memories.
   STLDeleteElements(&available_shm_segments_);
@@ -129,10 +118,23 @@
 }
 
 scoped_ptr<RTCVideoDecoder> RTCVideoDecoder::Create(
+    webrtc::VideoCodecType type,
     const scoped_refptr<media::GpuVideoDecoderFactories>& factories) {
-  scoped_ptr<RTCVideoDecoder> decoder(new RTCVideoDecoder(factories));
-  decoder->vda_.reset(factories->CreateVideoDecodeAccelerator(
-      media::VP8PROFILE_MAIN, decoder.get()));
+  scoped_ptr<RTCVideoDecoder> decoder;
+  // Convert WebRTC codec type to media codec profile.
+  media::VideoCodecProfile profile;
+  switch (type) {
+    case webrtc::kVideoCodecVP8:
+      profile = media::VP8PROFILE_MAIN;
+      break;
+    default:
+      DVLOG(2) << "Video codec not supported:" << type;
+      return decoder.Pass();
+  }
+
+  decoder.reset(new RTCVideoDecoder(factories));
+  decoder->vda_
+      .reset(factories->CreateVideoDecodeAccelerator(profile, decoder.get()));
   // vda can be NULL if VP8 is not supported.
   if (decoder->vda_ != NULL) {
     decoder->state_ = INITIALIZED;
@@ -158,14 +160,11 @@
   }
   // Create some shared memory if the queue is empty.
   if (available_shm_segments_.size() == 0) {
-    // Unretained is safe because the destructor will wait until
-    // |create_shm_thread_| stops.
-    create_shm_thread_.message_loop_proxy()
-        ->PostTask(FROM_HERE,
-                   base::Bind(&RTCVideoDecoder::CreateSHM,
-                              base::Unretained(this),
-                              kMaxInFlightDecodes,
-                              kSharedMemorySegmentBytes));
+    vda_loop_proxy_->PostTask(FROM_HERE,
+                              base::Bind(&RTCVideoDecoder::CreateSHM,
+                                         weak_this_,
+                                         kMaxInFlightDecodes,
+                                         kSharedMemorySegmentBytes));
   }
   return WEBRTC_VIDEO_CODEC_OK;
 }
@@ -232,9 +231,19 @@
 
 int32_t RTCVideoDecoder::Release() {
   DVLOG(2) << "Release";
-  // Do not destroy VDA because the decoder will be recycled by
-  // RTCVideoDecoderFactory. Just reset VDA.
-  return Reset();
+  base::AutoLock auto_lock(lock_);
+  if (state_ == UNINITIALIZED) {
+    LOG(ERROR) << "Decoder not initialized.";
+    return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
+  }
+  if (next_bitstream_buffer_id_ != 0)
+    reset_bitstream_buffer_id_ = next_bitstream_buffer_id_ - 1;
+  else
+    reset_bitstream_buffer_id_ = ID_LAST;
+  factories_->Abort();
+  vda_loop_proxy_->PostTask(
+      FROM_HERE, base::Bind(&RTCVideoDecoder::DestroyVDA, weak_this_));
+  return WEBRTC_VIDEO_CODEC_OK;
 }
 
 int32_t RTCVideoDecoder::Reset() {
@@ -661,16 +670,13 @@
     ret = available_shm_segments_.back();
     available_shm_segments_.pop_back();
   }
-  // Post to the child thread to create shared memory if SHM cannot be reused
-  // or the queue is almost empty.
+  // Post to vda thread to create shared memory if SHM cannot be reused or the
+  // queue is almost empty.
   if (num_shm_buffers_ < kMaxNumSharedMemorySegments &&
       (ret == NULL || available_shm_segments_.size() <= 1)) {
-    create_shm_thread_.message_loop_proxy()->PostTask(
+    vda_loop_proxy_->PostTask(
         FROM_HERE,
-        // Unretained is safe because the destructor will wait until
-        // |create_shm_thread_| stops.
-        base::Bind(
-            &RTCVideoDecoder::CreateSHM, base::Unretained(this), 1, min_size));
+        base::Bind(&RTCVideoDecoder::CreateSHM, weak_this_, 1, min_size));
   }
   return scoped_ptr<SHMBuffer>(ret);
 }
@@ -680,7 +686,7 @@
 }
 
 void RTCVideoDecoder::CreateSHM(int number, size_t min_size) {
-  DCHECK(create_shm_thread_.message_loop_proxy()->BelongsToCurrentThread());
+  DCHECK(vda_loop_proxy_->BelongsToCurrentThread());
   DVLOG(2) << "CreateSHM. size=" << min_size;
   int number_to_allocate;
   {
@@ -696,12 +702,10 @@
       num_shm_buffers_++;
       PutSHM_Locked(
           scoped_ptr<SHMBuffer>(new SHMBuffer(shm, size_to_allocate)));
-      // Kick off the decoding.
-      vda_loop_proxy_->PostTask(
-          FROM_HERE,
-          base::Bind(&RTCVideoDecoder::RequestBufferDecode, weak_this_));
     }
   }
+  // Kick off the decoding.
+  RequestBufferDecode();
 }
 
 void RTCVideoDecoder::RecordBufferData(const BufferData& buffer_data) {
diff --git a/content/renderer/media/rtc_video_decoder.h b/content/renderer/media/rtc_video_decoder.h
index 346cb03..11e5852 100644
--- a/content/renderer/media/rtc_video_decoder.h
+++ b/content/renderer/media/rtc_video_decoder.h
@@ -36,13 +36,11 @@
 namespace content {
 
 // This class uses hardware accelerated video decoder to decode video for
-// WebRTC. The message loop of RendererGpuVideoDecoderFactories is stored as
-// |vda_message_loop_|. It is the compositor thread, or the renderer thread if
-// threaded compositing is disabled. VDA::Client methods run on
-// |vda_message_loop_|. webrtc::VideoDecoder methods run on WebRTC
+// WebRTC. |vda_message_loop_| is the message loop proxy of the media thread,
+// which VDA::Client methods run on. webrtc::VideoDecoder methods run on WebRTC
 // DecodingThread or Chrome_libJingle_WorkerThread, which are trampolined to
 // |vda_message_loop_|. Decode() is non-blocking and queues the buffers. Decoded
-// frames are delivered on |vda_message_loop_|.
+// frames are delivered to WebRTC on |vda_message_loop_|.
 class CONTENT_EXPORT RTCVideoDecoder
     : NON_EXPORTED_BASE(public webrtc::VideoDecoder),
       public media::VideoDecodeAccelerator::Client,
@@ -50,8 +48,10 @@
  public:
   virtual ~RTCVideoDecoder();
 
-  // Creates a RTCVideoDecoder. Returns NULL if failed.
+  // Creates a RTCVideoDecoder. Returns NULL if failed. The video decoder will
+  // run on the message loop of |factories|.
   static scoped_ptr<RTCVideoDecoder> Create(
+      webrtc::VideoCodecType type,
       const scoped_refptr<media::GpuVideoDecoderFactories>& factories);
 
   // webrtc::VideoDecoder implementation.
@@ -111,6 +111,7 @@
 
   FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, IsBufferAfterReset);
 
+  // The meessage loop of |factories| will be saved to |vda_loop_proxy_|.
   RTCVideoDecoder(
       const scoped_refptr<media::GpuVideoDecoderFactories>& factories);
 
@@ -198,18 +199,9 @@
 
   scoped_refptr<media::GpuVideoDecoderFactories> factories_;
 
-  // The message loop to run callbacks on. This is should be the same as the one
-  // of |factories_|.
+  // The message loop to run callbacks on. This is from |factories_|.
   scoped_refptr<base::MessageLoopProxy> vda_loop_proxy_;
 
-  // The thread to create shared memory. CreateSharedMemory is trampolined to
-  // the child thread. When |vda_loop_proxy_| is the compositor thread, blocking
-  // on the child thread will deadlock. During WebRTC hang up, the child thread
-  // waits for Chrome_libJingle_WorkerThread. libJingle thread cannot finish
-  // when DecodingThread holds a WebRTC lock and blocks on the child thread. So
-  // we need to call CreateSharedMemory asynchronously from a different thread.
-  base::Thread create_shm_thread_;
-
   // The texture target used for decoded pictures.
   uint32 decoder_texture_target_;
 
diff --git a/content/renderer/media/rtc_video_decoder_factory.cc b/content/renderer/media/rtc_video_decoder_factory.cc
index 04018b4..e621735 100644
--- a/content/renderer/media/rtc_video_decoder_factory.cc
+++ b/content/renderer/media/rtc_video_decoder_factory.cc
@@ -6,49 +6,38 @@
 
 #include "base/location.h"
 #include "base/memory/scoped_ptr.h"
+#include "content/renderer/media/renderer_gpu_video_decoder_factories.h"
 #include "content/renderer/media/rtc_video_decoder.h"
 #include "media/filters/gpu_video_decoder_factories.h"
 
 namespace content {
 
 RTCVideoDecoderFactory::RTCVideoDecoderFactory(
-    const scoped_refptr<media::GpuVideoDecoderFactories>& gpu_factories)
-    : vda_loop_proxy_(gpu_factories->GetMessageLoop()) {
+    const scoped_refptr<RendererGpuVideoDecoderFactories>& gpu_factories)
+    : gpu_factories_(gpu_factories) {
   DVLOG(2) << "RTCVideoDecoderFactory";
-  // The decoder cannot be created in CreateVideoDecoder because VDA has to be
-  // created on |vda_loop_proxy_|, which can be the child thread. The child
-  // thread is blocked when CreateVideoDecoder runs. This supports only one
-  // VDA-powered <video> tag at a time.
-  // TODO(wuchengli): remove this restriction.
-  // |decoder_| can be null if VDA does not support VP8.
-  decoder_ = RTCVideoDecoder::Create(gpu_factories);
 }
 
 RTCVideoDecoderFactory::~RTCVideoDecoderFactory() {
   DVLOG(2) << "~RTCVideoDecoderFactory";
-  if (decoder_) {
-    webrtc::VideoDecoder* decoder = decoder_.release();
-    if (!vda_loop_proxy_->DeleteSoon(FROM_HERE, decoder))
-      delete decoder;
-  }
 }
 
 webrtc::VideoDecoder* RTCVideoDecoderFactory::CreateVideoDecoder(
     webrtc::VideoCodecType type) {
   DVLOG(2) << "CreateVideoDecoder";
-  // Only VP8 is supported.
-  if (type == webrtc::kVideoCodecVP8)
-    return decoder_.release();
-  return NULL;
+  // RendererGpuVideoDecoderFactories is not thread safe. It cannot be shared
+  // by different decoders. This method runs on Chrome_libJingle_WorkerThread
+  // and the child thread is blocked while this runs. We cannot create new gpu
+  // factories here. Clone one instead.
+  scoped_ptr<RTCVideoDecoder> decoder =
+      RTCVideoDecoder::Create(type, gpu_factories_->Clone());
+  return decoder.release();
 }
 
 void RTCVideoDecoderFactory::DestroyVideoDecoder(
     webrtc::VideoDecoder* decoder) {
   DVLOG(2) << "DestroyVideoDecoder";
-  // Save back the decoder because it is the only one. VideoDecoder::Release
-  // should have been called.
-  decoder->RegisterDecodeCompleteCallback(NULL);
-  decoder_.reset(decoder);
+  gpu_factories_->GetMessageLoop()->DeleteSoon(FROM_HERE, decoder);
 }
 
 }  // namespace content
diff --git a/content/renderer/media/rtc_video_decoder_factory.h b/content/renderer/media/rtc_video_decoder_factory.h
index 7977ac9..1455d7b 100644
--- a/content/renderer/media/rtc_video_decoder_factory.h
+++ b/content/renderer/media/rtc_video_decoder_factory.h
@@ -20,12 +20,14 @@
 }
 
 namespace content {
+class RendererGpuVideoDecoderFactories;
 
+// TODO(wuchengli): add unittest.
 class CONTENT_EXPORT RTCVideoDecoderFactory
     : NON_EXPORTED_BASE(public cricket::WebRtcVideoDecoderFactory) {
  public:
-  RTCVideoDecoderFactory(
-      const scoped_refptr<media::GpuVideoDecoderFactories>& gpu_factories);
+  explicit RTCVideoDecoderFactory(
+      const scoped_refptr<RendererGpuVideoDecoderFactories>& gpu_factories);
   virtual ~RTCVideoDecoderFactory();
 
   // Runs on Chrome_libJingle_WorkerThread. The child thread is blocked while
@@ -38,8 +40,7 @@
   virtual void DestroyVideoDecoder(webrtc::VideoDecoder* decoder) OVERRIDE;
 
  private:
-  scoped_refptr<base::MessageLoopProxy> vda_loop_proxy_;
-  scoped_ptr<webrtc::VideoDecoder> decoder_;
+  scoped_refptr<RendererGpuVideoDecoderFactories> gpu_factories_;
 
   DISALLOW_COPY_AND_ASSIGN(RTCVideoDecoderFactory);
 };
diff --git a/content/renderer/media/rtc_video_decoder_unittest.cc b/content/renderer/media/rtc_video_decoder_unittest.cc
index 457f7b2..e23e91b 100644
--- a/content/renderer/media/rtc_video_decoder_unittest.cc
+++ b/content/renderer/media/rtc_video_decoder_unittest.cc
@@ -36,19 +36,25 @@
     mock_vda_ = new media::MockVideoDecodeAccelerator;
     EXPECT_CALL(*mock_gpu_factories_, GetMessageLoop())
         .WillRepeatedly(Return(vda_loop_proxy_));
+    EXPECT_CALL(*mock_gpu_factories_, CreateVideoDecodeAccelerator(_, _))
+        .WillRepeatedly(
+             Return(static_cast<media::VideoDecodeAccelerator*>(NULL)));
     EXPECT_CALL(*mock_gpu_factories_,
                 CreateVideoDecodeAccelerator(media::VP8PROFILE_MAIN, _))
-        .WillOnce(Return(mock_vda_));
+        .WillRepeatedly(Return(mock_vda_));
     EXPECT_CALL(*mock_gpu_factories_, Abort()).WillRepeatedly(Return());
     EXPECT_CALL(*mock_gpu_factories_, CreateSharedMemory(_))
         .WillRepeatedly(Return(static_cast<base::SharedMemory*>(NULL)));
     EXPECT_CALL(*mock_vda_, Destroy());
-    rtc_decoder_ = RTCVideoDecoder::Create(mock_gpu_factories_);
+    rtc_decoder_ =
+        RTCVideoDecoder::Create(webrtc::kVideoCodecVP8, mock_gpu_factories_);
   }
 
   virtual void TearDown() OVERRIDE {
     VLOG(2) << "TearDown";
     if (vda_thread_.IsRunning()) {
+      if (rtc_decoder_)
+        rtc_decoder_->Release();
       RunUntilIdle();  // Wait until all callbascks complete.
       vda_loop_proxy_->DeleteSoon(FROM_HERE, rtc_decoder_.release());
       // Make sure the decoder is released before stopping the thread.
@@ -102,6 +108,12 @@
   base::WaitableEvent idle_waiter_;
 };
 
+TEST_F(RTCVideoDecoderTest, CreateReturnsNullOnUnsupportedCodec) {
+  scoped_ptr<RTCVideoDecoder> null_rtc_decoder(
+      RTCVideoDecoder::Create(webrtc::kVideoCodecI420, mock_gpu_factories_));
+  EXPECT_EQ(NULL, null_rtc_decoder.get());
+}
+
 TEST_F(RTCVideoDecoderTest, InitDecodeReturnsErrorOnFeedbackMode) {
   codec_.codecType = webrtc::kVideoCodecVP8;
   codec_.codecSpecific.VP8.feedbackModeOn = true;
@@ -140,8 +152,6 @@
 
 TEST_F(RTCVideoDecoderTest, ReleaseReturnsOk) {
   Initialize();
-  EXPECT_CALL(*mock_vda_, Reset())
-      .WillOnce(Invoke(this, &RTCVideoDecoderTest::NotifyResetDone));
   EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, rtc_decoder_->Release());
 }
 
diff --git a/content/renderer/media/video_destination_handler.cc b/content/renderer/media/video_destination_handler.cc
index 6745acc..81ab07f 100644
--- a/content/renderer/media/video_destination_handler.cc
+++ b/content/renderer/media/video_destination_handler.cc
@@ -11,10 +11,10 @@
 #include "base/rand_util.h"
 #include "content/renderer/media/media_stream_dependency_factory.h"
 #include "content/renderer/media/media_stream_registry_interface.h"
+#include "content/renderer/pepper/ppb_image_data_impl.h"
 #include "content/renderer/render_thread_impl.h"
 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
 #include "third_party/WebKit/public/web/WebMediaStreamRegistry.h"
-#include "webkit/plugins/ppapi/ppb_image_data_impl.h"
 
 using cricket::CaptureState;
 using cricket::VideoFormat;
diff --git a/content/renderer/media/video_destination_handler_unittest.cc b/content/renderer/media/video_destination_handler_unittest.cc
index 3cc8066..110e115 100644
--- a/content/renderer/media/video_destination_handler_unittest.cc
+++ b/content/renderer/media/video_destination_handler_unittest.cc
@@ -108,7 +108,7 @@
   // Verify the video track has been added.
   const WebKit::WebMediaStream test_stream = registry_.test_stream();
   WebKit::WebVector<WebKit::WebMediaStreamTrack> video_tracks;
-  test_stream.videoSources(video_tracks);
+  test_stream.videoTracks(video_tracks);
   EXPECT_EQ(1u, video_tracks.size());
 
   // Verify the native video track has been added.
diff --git a/content/renderer/media/webmediaplayer_impl.cc b/content/renderer/media/webmediaplayer_impl.cc
index 32f228f..dac94c6 100644
--- a/content/renderer/media/webmediaplayer_impl.cc
+++ b/content/renderer/media/webmediaplayer_impl.cc
@@ -28,6 +28,7 @@
 #include "content/renderer/media/webmediaplayer_params.h"
 #include "content/renderer/media/webmediaplayer_util.h"
 #include "content/renderer/media/webmediasourceclient_impl.h"
+#include "content/renderer/pepper/ppapi_webplugin_impl.h"
 #include "gpu/GLES2/gl2extchromium.h"
 #include "media/audio/null_audio_sink.h"
 #include "media/base/bind_to_loop.h"
@@ -55,7 +56,6 @@
 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
 #include "third_party/WebKit/public/web/WebView.h"
 #include "v8/include/v8.h"
-#include "webkit/plugins/ppapi/ppapi_webplugin_impl.h"
 #include "webkit/renderer/compositor_bindings/web_layer_impl.h"
 
 using WebKit::WebCanvas;
@@ -1100,10 +1100,8 @@
   // Create our video decoders and renderer.
   ScopedVector<media::VideoDecoder> video_decoders;
 
-  if (gpu_factories_.get()) {
-    video_decoders.push_back(new media::GpuVideoDecoder(
-        media_loop_, gpu_factories_));
-  }
+  if (gpu_factories_.get())
+    video_decoders.push_back(new media::GpuVideoDecoder(gpu_factories_));
 
   // TODO(phajdan.jr): Remove ifdefs when libvpx with vp9 support is released
   // (http://crbug.com/174287) .
diff --git a/content/renderer/media/websourcebuffer_impl.cc b/content/renderer/media/websourcebuffer_impl.cc
index bf5f7c0..559d1ab 100644
--- a/content/renderer/media/websourcebuffer_impl.cc
+++ b/content/renderer/media/websourcebuffer_impl.cc
@@ -4,10 +4,27 @@
 
 #include "content/renderer/media/websourcebuffer_impl.h"
 
+#include "base/float_util.h"
 #include "media/filters/chunk_demuxer.h"
 
 namespace content {
 
+static base::TimeDelta DoubleToTimeDelta(double time) {
+  DCHECK(!base::IsNaN(time));
+  DCHECK_GE(time, 0);
+  if (time == std::numeric_limits<double>::infinity())
+    return media::kInfiniteDuration();
+
+  base::TimeDelta max_time = base::TimeDelta::FromInternalValue(kint64max - 1);
+  double max_time_in_seconds = max_time.InSecondsF();
+
+  if (time >= max_time_in_seconds)
+    return max_time;
+
+  return base::TimeDelta::FromMicroseconds(
+      time * base::Time::kMicrosecondsPerSecond);
+}
+
 WebSourceBufferImpl::WebSourceBufferImpl(
     const std::string& id, media::ChunkDemuxer* demuxer)
     : id_(id),
@@ -37,6 +54,10 @@
   demuxer_->Abort(id_);
 }
 
+void WebSourceBufferImpl::remove(double start, double end) {
+  demuxer_->Remove(id_, DoubleToTimeDelta(start), DoubleToTimeDelta(end));
+}
+
 bool WebSourceBufferImpl::setTimestampOffset(double offset) {
   base::TimeDelta time_offset = base::TimeDelta::FromMicroseconds(
       offset * base::Time::kMicrosecondsPerSecond);
diff --git a/content/renderer/media/websourcebuffer_impl.h b/content/renderer/media/websourcebuffer_impl.h
index 94143b7..533ed68 100644
--- a/content/renderer/media/websourcebuffer_impl.h
+++ b/content/renderer/media/websourcebuffer_impl.h
@@ -26,6 +26,8 @@
   virtual WebKit::WebTimeRanges buffered() OVERRIDE;
   virtual void append(const unsigned char* data, unsigned length) OVERRIDE;
   virtual void abort() OVERRIDE;
+  // TODO(acolwell): Add OVERRIDE when Blink-side changes land.
+  virtual void remove(double start, double end);
   virtual bool setTimestampOffset(double offset) OVERRIDE;
   virtual void removedFromMediaSource() OVERRIDE;
 
diff --git a/webkit/plugins/ppapi/DEPS b/content/renderer/pepper/DEPS
similarity index 100%
rename from webkit/plugins/ppapi/DEPS
rename to content/renderer/pepper/DEPS
diff --git a/content/renderer/pepper/OWNERS b/content/renderer/pepper/OWNERS
index dc19a03..c5db5bd 100644
--- a/content/renderer/pepper/OWNERS
+++ b/content/renderer/pepper/OWNERS
@@ -1,3 +1,6 @@
 dmichael@chromium.org
 raymes@chromium.org
 yzshen@chromium.org
+
+per-file usb_key_code_*=garykac@chromium.org
+per-file usb_key_code_*=wez@chromium.org
diff --git a/webkit/plugins/ppapi/audio_helper.cc b/content/renderer/pepper/audio_helper.cc
similarity index 94%
rename from webkit/plugins/ppapi/audio_helper.cc
rename to content/renderer/pepper/audio_helper.cc
index c2357f3..7eb0d87 100644
--- a/webkit/plugins/ppapi/audio_helper.cc
+++ b/content/renderer/pepper/audio_helper.cc
@@ -2,10 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "content/renderer/pepper/audio_helper.h"
+
+#include "content/renderer/pepper/common.h"
+#include "content/renderer/pepper/resource_helper.h"
 #include "ppapi/c/pp_completion_callback.h"
-#include "webkit/plugins/ppapi/audio_helper.h"
-#include "webkit/plugins/ppapi/common.h"
-#include "webkit/plugins/ppapi/resource_helper.h"
 
 using ppapi::TrackedCallback;
 
diff --git a/webkit/plugins/ppapi/audio_helper.h b/content/renderer/pepper/audio_helper.h
similarity index 89%
rename from webkit/plugins/ppapi/audio_helper.h
rename to content/renderer/pepper/audio_helper.h
index 23db069..854ac9a 100644
--- a/webkit/plugins/ppapi/audio_helper.h
+++ b/content/renderer/pepper/audio_helper.h
@@ -2,19 +2,18 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_AUDIO_HELPER_H_
-#define WEBKIT_PLUGINS_PPAPI_AUDIO_HELPER_H_
+#ifndef CONTENT_RENDERER_PEPPER_AUDIO_HELPER_H_
+#define CONTENT_RENDERER_PEPPER_AUDIO_HELPER_H_
 
 #include "base/basictypes.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/memory/shared_memory.h"
 #include "base/sync_socket.h"
+#include "content/renderer/pepper/plugin_delegate.h"
 #include "ppapi/c/pp_completion_callback.h"
 #include "ppapi/shared_impl/resource.h"
 #include "ppapi/shared_impl/scoped_pp_resource.h"
 #include "ppapi/shared_impl/tracked_callback.h"
-#include "webkit/plugins/ppapi/plugin_delegate.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
 
 namespace webkit {
 namespace ppapi {
@@ -61,4 +60,4 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_AUDIO_HELPER_H_
+#endif  // CONTENT_RENDERER_PEPPER_AUDIO_HELPER_H_
diff --git a/webkit/plugins/ppapi/common.h b/content/renderer/pepper/common.h
similarity index 78%
rename from webkit/plugins/ppapi/common.h
rename to content/renderer/pepper/common.h
index 542bad9..ed51b62 100644
--- a/webkit/plugins/ppapi/common.h
+++ b/content/renderer/pepper/common.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_COMMON_H_
-#define WEBKIT_PLUGINS_PPAPI_COMMON_H_
+#ifndef CONTENT_RENDERER_PEPPER_COMMON_H_
+#define CONTENT_RENDERER_PEPPER_COMMON_H_
 
 #include "ppapi/c/pp_bool.h"
 #include "ppapi/c/pp_var.h"
@@ -22,5 +22,5 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_COMMON_H_
+#endif  // CONTENT_RENDERER_PEPPER_COMMON_H_
 
diff --git a/webkit/plugins/ppapi/content_decryptor_delegate.cc b/content/renderer/pepper/content_decryptor_delegate.cc
similarity index 99%
rename from webkit/plugins/ppapi/content_decryptor_delegate.cc
rename to content/renderer/pepper/content_decryptor_delegate.cc
index 61d85c5..79d9cff 100644
--- a/webkit/plugins/ppapi/content_decryptor_delegate.cc
+++ b/content/renderer/pepper/content_decryptor_delegate.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 "webkit/plugins/ppapi/content_decryptor_delegate.h"
+#include "content/renderer/pepper/content_decryptor_delegate.h"
 
 #include "base/callback_helpers.h"
 #include "base/debug/trace_event.h"
 #include "base/message_loop/message_loop_proxy.h"
 #include "base/safe_numerics.h"
+#include "content/renderer/pepper/ppb_buffer_impl.h"
 #include "media/base/audio_buffer.h"
 #include "media/base/audio_decoder_config.h"
 #include "media/base/bind_to_loop.h"
@@ -24,7 +25,6 @@
 #include "ppapi/thunk/enter.h"
 #include "ppapi/thunk/ppb_buffer_api.h"
 #include "ui/gfx/rect.h"
-#include "webkit/plugins/ppapi/ppb_buffer_impl.h"
 
 using ppapi::ArrayBufferVar;
 using ppapi::PpapiGlobals;
@@ -241,6 +241,9 @@
       audio_bytes_per_frame_(0) {
 }
 
+ContentDecryptorDelegate::~ContentDecryptorDelegate() {
+}
+
 void ContentDecryptorDelegate::Initialize(const std::string& key_system) {
   // TODO(ddorwin): Add an Initialize method to PPP_ContentDecryptor_Private.
   DCHECK(!key_system.empty());
diff --git a/webkit/plugins/ppapi/content_decryptor_delegate.h b/content/renderer/pepper/content_decryptor_delegate.h
similarity index 95%
rename from webkit/plugins/ppapi/content_decryptor_delegate.h
rename to content/renderer/pepper/content_decryptor_delegate.h
index 26b306b..8f7ad31 100644
--- a/webkit/plugins/ppapi/content_decryptor_delegate.h
+++ b/content/renderer/pepper/content_decryptor_delegate.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_CONTENT_DECRYPTOR_DELEGATE_H_
-#define WEBKIT_PLUGINS_PPAPI_CONTENT_DECRYPTOR_DELEGATE_H_
+#ifndef CONTENT_RENDERER_PEPPER_CONTENT_DECRYPTOR_DELEGATE_H_
+#define CONTENT_RENDERER_PEPPER_CONTENT_DECRYPTOR_DELEGATE_H_
 
 #include <queue>
 #include <string>
@@ -18,7 +18,6 @@
 #include "ppapi/c/private/pp_content_decryptor.h"
 #include "ppapi/c/private/ppp_content_decryptor_private.h"
 #include "ui/gfx/size.h"
-#include "webkit/plugins/webkit_plugins_export.h"
 
 namespace media {
 class AudioDecoderConfig;
@@ -31,7 +30,7 @@
 
 class PPB_Buffer_Impl;
 
-class WEBKIT_PLUGINS_EXPORT ContentDecryptorDelegate {
+class ContentDecryptorDelegate {
  public:
   // ContentDecryptorDelegate does not take ownership of
   // |plugin_decryption_interface|. Therefore |plugin_decryption_interface|
@@ -39,6 +38,7 @@
   ContentDecryptorDelegate(
       PP_Instance pp_instance,
       const PPP_ContentDecryptor_Private* plugin_decryption_interface);
+  ~ContentDecryptorDelegate();
 
   void Initialize(const std::string& key_system);
 
@@ -192,4 +192,4 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_CONTENT_DECRYPTOR_DELEGATE_H_
+#endif  // CONTENT_RENDERER_PEPPER_CONTENT_DECRYPTOR_DELEGATE_H_
diff --git a/webkit/plugins/ppapi/event_conversion.cc b/content/renderer/pepper/event_conversion.cc
similarity index 98%
rename from webkit/plugins/ppapi/event_conversion.cc
rename to content/renderer/pepper/event_conversion.cc
index 9c40afd..f912ae5 100644
--- a/webkit/plugins/ppapi/event_conversion.cc
+++ b/content/renderer/pepper/event_conversion.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 <map>
+#include "content/renderer/pepper/event_conversion.h"
 
-#include "webkit/plugins/ppapi/event_conversion.h"
+#include <map>
 
 #include "base/basictypes.h"
 #include "base/i18n/char_iterator.h"
@@ -14,14 +14,14 @@
 #include "base/strings/stringprintf.h"
 #include "base/strings/utf_string_conversion_utils.h"
 #include "base/strings/utf_string_conversions.h"
+#include "content/renderer/pepper/common.h"
+#include "content/renderer/pepper/usb_key_code_conversion.h"
 #include "ppapi/c/pp_input_event.h"
 #include "ppapi/shared_impl/ppb_input_event_shared.h"
 #include "ppapi/shared_impl/time_conversion.h"
 #include "third_party/WebKit/public/platform/WebGamepads.h"
 #include "third_party/WebKit/public/platform/WebString.h"
 #include "third_party/WebKit/public/web/WebInputEvent.h"
-#include "webkit/plugins/ppapi/common.h"
-#include "webkit/plugins/ppapi/usb_key_code_conversion.h"
 
 using ppapi::EventTimeToPPTimeTicks;
 using ppapi::InputEventData;
diff --git a/webkit/plugins/ppapi/event_conversion.h b/content/renderer/pepper/event_conversion.h
similarity index 85%
rename from webkit/plugins/ppapi/event_conversion.h
rename to content/renderer/pepper/event_conversion.h
index 057d911..0fa849c 100644
--- a/webkit/plugins/ppapi/event_conversion.h
+++ b/content/renderer/pepper/event_conversion.h
@@ -2,15 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_EVENT_CONVERSION_H_
-#define WEBKIT_PLUGINS_PPAPI_EVENT_CONVERSION_H_
+#ifndef CONTENT_RENDERER_PEPPER_EVENT_CONVERSION_H_
+#define CONTENT_RENDERER_PEPPER_EVENT_CONVERSION_H_
 
 #include <vector>
 
 #include "base/memory/linked_ptr.h"
 #include "ppapi/c/ppb_input_event.h"
 #include "third_party/WebKit/public/web/WebInputEvent.h"
-#include "webkit/plugins/webkit_plugins_export.h"
 
 struct PP_InputEvent;
 
@@ -34,7 +33,7 @@
 
 // Creates a WebInputEvent from the given PP_InputEvent.  If it fails, returns
 // NULL.  The caller owns the created object on success.
-WEBKIT_PLUGINS_EXPORT WebKit::WebInputEvent* CreateWebInputEvent(
+WebKit::WebInputEvent* CreateWebInputEvent(
     const ::ppapi::InputEventData& event);
 
 // Creates an array of WebInputEvents to make the given event look like a user
@@ -52,4 +51,4 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_EVENT_CONVERSION_H_
+#endif  // CONTENT_RENDERER_PEPPER_EVENT_CONVERSION_H_
diff --git a/webkit/plugins/ppapi/fullscreen_container.h b/content/renderer/pepper/fullscreen_container.h
similarity index 81%
rename from webkit/plugins/ppapi/fullscreen_container.h
rename to content/renderer/pepper/fullscreen_container.h
index f2ee848..805c187 100644
--- a/webkit/plugins/ppapi/fullscreen_container.h
+++ b/content/renderer/pepper/fullscreen_container.h
@@ -2,12 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_PPB_FULLSCREEN_CONTAINER_IMPL_H_
-#define WEBKIT_PLUGINS_PPAPI_PPB_FULLSCREEN_CONTAINER_IMPL_H_
+#ifndef CONTENT_RENDERER_PEPPER_PPB_FULLSCREEN_CONTAINER_IMPL_H_
+#define CONTENT_RENDERER_PEPPER_PPB_FULLSCREEN_CONTAINER_IMPL_H_
 
-#include "webkit/plugins/ppapi/plugin_delegate.h"
+#include "content/renderer/pepper/plugin_delegate.h"
 
 namespace WebKit {
+class WebLayer;
 struct WebCursorInfo;
 struct WebRect;
 }  // namespace WebKit
@@ -44,4 +45,4 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_PPB_FULLSCREEN_CONTAINER_IMPL_H_
+#endif  // CONTENT_RENDERER_PEPPER_PPB_FULLSCREEN_CONTAINER_IMPL_H_
diff --git a/webkit/plugins/ppapi/gfx_conversion.h b/content/renderer/pepper/gfx_conversion.h
similarity index 88%
rename from webkit/plugins/ppapi/gfx_conversion.h
rename to content/renderer/pepper/gfx_conversion.h
index 80df6f5..77e7001 100644
--- a/webkit/plugins/ppapi/gfx_conversion.h
+++ b/content/renderer/pepper/gfx_conversion.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_GFX_CONVERSION_H_
-#define WEBKIT_PLUGINS_PPAPI_GFX_CONVERSION_H_
+#ifndef CONTENT_RENDERER_PEPPER_GFX_CONVERSION_H_
+#define CONTENT_RENDERER_PEPPER_GFX_CONVERSION_H_
 
 #include "ppapi/c/pp_point.h"
 #include "ppapi/c/pp_rect.h"
@@ -45,4 +45,4 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_GFX_CONVERSION_H_
+#endif  // CONTENT_RENDERER_PEPPER_GFX_CONVERSION_H_
diff --git a/webkit/plugins/ppapi/host_array_buffer_var.cc b/content/renderer/pepper/host_array_buffer_var.cc
similarity index 90%
rename from webkit/plugins/ppapi/host_array_buffer_var.cc
rename to content/renderer/pepper/host_array_buffer_var.cc
index b28691b..565db42 100644
--- a/webkit/plugins/ppapi/host_array_buffer_var.cc
+++ b/content/renderer/pepper/host_array_buffer_var.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/host_array_buffer_var.h"
+#include "content/renderer/pepper/host_array_buffer_var.h"
 
 #include <stdio.h>
 #include <string.h>
@@ -10,10 +10,10 @@
 #include "base/logging.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/process_util.h"
+#include "content/renderer/pepper/host_globals.h"
+#include "content/renderer/pepper/plugin_module.h"
+#include "content/renderer/pepper/ppapi_plugin_instance_impl.h"
 #include "ppapi/c/pp_instance.h"
-#include "webkit/plugins/ppapi/host_globals.h"
-#include "webkit/plugins/ppapi/plugin_module.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
 
 using ppapi::ArrayBufferVar;
 using WebKit::WebArrayBuffer;
@@ -63,7 +63,7 @@
     PP_Instance instance,
     int* host_shm_handle_id,
     base::SharedMemoryHandle* plugin_shm_handle) {
-  webkit::ppapi::PluginInstance* i =
+  webkit::ppapi::PluginInstanceImpl* i =
       webkit::ppapi::HostGlobals::Get()->GetInstance(instance);
   scoped_ptr<base::SharedMemory> shm(i->delegate()->CreateAnonymousSharedMemory(
       ByteLength()));
diff --git a/webkit/plugins/ppapi/host_array_buffer_var.h b/content/renderer/pepper/host_array_buffer_var.h
similarity index 87%
rename from webkit/plugins/ppapi/host_array_buffer_var.h
rename to content/renderer/pepper/host_array_buffer_var.h
index 4ced697..b1bd16a 100644
--- a/webkit/plugins/ppapi/host_array_buffer_var.h
+++ b/content/renderer/pepper/host_array_buffer_var.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef PPAPI_WEBKIT_PLUGINS_PPAPI_HOST_ARRAY_BUFFER_VAR_H_
-#define PPAPI_WEBKIT_PLUGINS_PPAPI_HOST_ARRAY_BUFFER_VAR_H_
+#ifndef PPAPI_CONTENT_RENDERER_PEPPER_HOST_ARRAY_BUFFER_VAR_H_
+#define PPAPI_CONTENT_RENDERER_PEPPER_HOST_ARRAY_BUFFER_VAR_H_
 
 #include "base/memory/shared_memory.h"
 #include "ppapi/c/pp_instance.h"
@@ -21,7 +21,6 @@
   explicit HostArrayBufferVar(const WebKit::WebArrayBuffer& buffer);
   explicit HostArrayBufferVar(uint32 size_in_bytes,
                               base::SharedMemoryHandle handle);
-  virtual ~HostArrayBufferVar();
 
   // ArrayBufferVar implementation.
   virtual void* Map() OVERRIDE;
@@ -35,6 +34,8 @@
   WebKit::WebArrayBuffer& webkit_buffer() { return buffer_; }
 
  private:
+  virtual ~HostArrayBufferVar();
+
   WebKit::WebArrayBuffer buffer_;
   // Tracks whether the data in the buffer is valid.
   bool valid_;
@@ -45,4 +46,4 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // PPAPI_WEBKIT_PLUGINS_PPAPI_HOST_ARRAY_BUFFER_VAR_H_
+#endif  // PPAPI_CONTENT_RENDERER_PEPPER_HOST_ARRAY_BUFFER_VAR_H_
diff --git a/webkit/plugins/ppapi/host_globals.cc b/content/renderer/pepper/host_globals.cc
similarity index 93%
rename from webkit/plugins/ppapi/host_globals.cc
rename to content/renderer/pepper/host_globals.cc
index c2b3331..ccc9f84 100644
--- a/webkit/plugins/ppapi/host_globals.cc
+++ b/content/renderer/pepper/host_globals.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/host_globals.h"
+#include "content/renderer/pepper/host_globals.h"
 
 #include <limits>
 
@@ -11,6 +11,8 @@
 #include "base/rand_util.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/task_runner.h"
+#include "content/renderer/pepper/plugin_module.h"
+#include "content/renderer/pepper/ppapi_plugin_instance_impl.h"
 #include "ppapi/shared_impl/api_id.h"
 #include "ppapi/shared_impl/id_assignment.h"
 #include "third_party/WebKit/public/platform/WebString.h"
@@ -20,8 +22,6 @@
 #include "third_party/WebKit/public/web/WebFrame.h"
 #include "third_party/WebKit/public/web/WebPluginContainer.h"
 #include "webkit/plugins/plugin_switches.h"
-#include "webkit/plugins/ppapi/plugin_module.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
 
 using ppapi::CheckIdType;
 using ppapi::MakeTypedId;
@@ -119,14 +119,14 @@
 
 ::ppapi::thunk::ResourceCreationAPI* HostGlobals::GetResourceCreationAPI(
     PP_Instance pp_instance) {
-  PluginInstance* instance = GetInstance(pp_instance);
+  PluginInstanceImpl* instance = GetInstance(pp_instance);
   if (!instance)
     return NULL;
   return &instance->resource_creation();
 }
 
 PP_Module HostGlobals::GetModuleForInstance(PP_Instance instance) {
-  PluginInstance* inst = GetInstance(instance);
+  PluginInstanceImpl* inst = GetInstance(instance);
   if (!inst)
     return 0;
   return inst->module()->pp_module();
@@ -150,7 +150,8 @@
                                 PP_LogLevel level,
                                 const std::string& source,
                                 const std::string& value) {
-  PluginInstance* instance_object = HostGlobals::Get()->GetInstance(instance);
+  PluginInstanceImpl* instance_object =
+      HostGlobals::Get()->GetInstance(instance);
   if (instance_object) {
     instance_object->container()->element().document().frame()->
         addMessageToConsole(MakeLogMessage(level, source, value));
@@ -185,7 +186,7 @@
 }
 
 base::TaskRunner* HostGlobals::GetFileTaskRunner(PP_Instance instance) {
-  scoped_refptr<PluginInstance> plugin_instance = GetInstance(instance);
+  scoped_refptr<PluginInstanceImpl> plugin_instance = GetInstance(instance);
   DCHECK(plugin_instance.get());
   scoped_refptr<base::MessageLoopProxy> message_loop =
       plugin_instance->delegate()->GetFileThreadMessageLoopProxy();
@@ -235,7 +236,7 @@
   return found->second;
 }
 
-PP_Instance HostGlobals::AddInstance(PluginInstance* instance) {
+PP_Instance HostGlobals::AddInstance(PluginInstanceImpl* instance) {
   DCHECK(instance_map_.find(instance->pp_instance()) == instance_map_.end());
 
   // Use a random number for the instance ID. This helps prevent some
@@ -267,7 +268,7 @@
   host_var_tracker_.DidDeleteInstance(instance);
 }
 
-PluginInstance* HostGlobals::GetInstance(PP_Instance instance) {
+PluginInstanceImpl* HostGlobals::GetInstance(PP_Instance instance) {
   DLOG_IF(ERROR, !CheckIdType(instance, ::ppapi::PP_ID_TYPE_INSTANCE))
       << instance << " is not a PP_Instance.";
   InstanceMap::iterator found = instance_map_.find(instance);
diff --git a/webkit/plugins/ppapi/host_globals.h b/content/renderer/pepper/host_globals.h
similarity index 88%
rename from webkit/plugins/ppapi/host_globals.h
rename to content/renderer/pepper/host_globals.h
index 36cbc87..1689259 100644
--- a/webkit/plugins/ppapi/host_globals.h
+++ b/content/renderer/pepper/host_globals.h
@@ -2,21 +2,20 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_HOST_GLOBALS_H_
-#define WEBKIT_PLUGINS_PPAPI_HOST_GLOBALS_H_
+#ifndef CONTENT_RENDERER_PEPPER_HOST_GLOBALS_H_
+#define CONTENT_RENDERER_PEPPER_HOST_GLOBALS_H_
 
 #include "base/compiler_specific.h"
+#include "content/renderer/pepper/host_var_tracker.h"
 #include "ppapi/shared_impl/callback_tracker.h"
 #include "ppapi/shared_impl/ppapi_globals.h"
 #include "ppapi/shared_impl/resource_tracker.h"
 #include "ppapi/shared_impl/var_tracker.h"
-#include "webkit/plugins/ppapi/host_var_tracker.h"
-#include "webkit/plugins/webkit_plugins_export.h"
 
 namespace webkit {
 namespace ppapi {
 
-class PluginInstance;
+class PluginInstanceImpl;
 class PluginModule;
 
 class HostGlobals : public ::ppapi::PpapiGlobals {
@@ -79,7 +78,7 @@
 
   // Adds a new plugin instance to the list of tracked instances, and returns a
   // new instance handle to identify it.
-  PP_Instance AddInstance(PluginInstance* instance);
+  PP_Instance AddInstance(PluginInstanceImpl* instance);
 
   // Called when a plugin instance was deleted and should no longer be tracked.
   // The given handle should be one generated by AddInstance.
@@ -90,19 +89,19 @@
   // Returns a pointer to the plugin instance object associated with the given
   // instance handle. The return value will be NULL if the handle is invalid or
   // if the instance has crashed.
-  WEBKIT_PLUGINS_EXPORT PluginInstance* GetInstance(PP_Instance instance);
+  PluginInstanceImpl* GetInstance(PP_Instance instance);
 
  private:
   // PpapiGlobals overrides.
   virtual bool IsHostGlobals() const OVERRIDE;
 
-  WEBKIT_PLUGINS_EXPORT static HostGlobals* host_globals_;
+  static HostGlobals* host_globals_;
 
   ::ppapi::ResourceTracker resource_tracker_;
   HostVarTracker host_var_tracker_;
 
   // Tracks all live instances and their associated object.
-  typedef std::map<PP_Instance, PluginInstance*> InstanceMap;
+  typedef std::map<PP_Instance, PluginInstanceImpl*> InstanceMap;
   InstanceMap instance_map_;
 
   // Tracks all live modules. The pointers are non-owning, the PluginModule
@@ -116,4 +115,4 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif   // WEBKIT_PLUGINS_PPAPI_HOST_GLOBALS_H_
+#endif   // CONTENT_RENDERER_PEPPER_HOST_GLOBALS_H_
diff --git a/webkit/plugins/ppapi/host_var_tracker.cc b/content/renderer/pepper/host_var_tracker.cc
similarity index 95%
rename from webkit/plugins/ppapi/host_var_tracker.cc
rename to content/renderer/pepper/host_var_tracker.cc
index 99518fd..b61af73 100644
--- a/webkit/plugins/ppapi/host_var_tracker.cc
+++ b/content/renderer/pepper/host_var_tracker.cc
@@ -2,13 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/host_var_tracker.h"
+#include "content/renderer/pepper/host_var_tracker.h"
 
 #include "base/logging.h"
+#include "content/renderer/pepper/host_array_buffer_var.h"
+#include "content/renderer/pepper/npobject_var.h"
+#include "content/renderer/pepper/ppapi_plugin_instance_impl.h"
 #include "ppapi/c/pp_var.h"
-#include "webkit/plugins/ppapi/host_array_buffer_var.h"
-#include "webkit/plugins/ppapi/npobject_var.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
 
 using ppapi::ArrayBufferVar;
 using ppapi::NPObjectVar;
diff --git a/webkit/plugins/ppapi/host_var_tracker.h b/content/renderer/pepper/host_var_tracker.h
similarity index 93%
rename from webkit/plugins/ppapi/host_var_tracker.h
rename to content/renderer/pepper/host_var_tracker.h
index 70d0d5c..9ff0dbd 100644
--- a/webkit/plugins/ppapi/host_var_tracker.h
+++ b/content/renderer/pepper/host_var_tracker.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_HOST_VAR_TRACKER_H_
-#define WEBKIT_PLUGINS_PPAPI_HOST_VAR_TRACKER_H_
+#ifndef CONTENT_RENDERER_PEPPER_HOST_VAR_TRACKER_H_
+#define CONTENT_RENDERER_PEPPER_HOST_VAR_TRACKER_H_
 
 #include <map>
 
@@ -13,11 +13,11 @@
 #include "base/gtest_prod_util.h"
 #include "base/memory/linked_ptr.h"
 #include "base/memory/ref_counted.h"
+#include "content/common/content_export.h"
 #include "ppapi/c/pp_instance.h"
 #include "ppapi/shared_impl/host_resource.h"
 #include "ppapi/shared_impl/resource_tracker.h"
 #include "ppapi/shared_impl/var_tracker.h"
-#include "webkit/plugins/webkit_plugins_export.h"
 
 typedef struct NPObject NPObject;
 
@@ -52,7 +52,7 @@
 
   // Returns the number of NPObjectVar's associated with the given instance.
   // Returns 0 if the instance isn't known.
-  WEBKIT_PLUGINS_EXPORT int GetLiveNPObjectVarsForInstance(
+  CONTENT_EXPORT int GetLiveNPObjectVarsForInstance(
       PP_Instance instance) const;
 
   // VarTracker public implementation.
@@ -107,4 +107,4 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_HOST_VAR_TRACKER_H_
+#endif  // CONTENT_RENDERER_PEPPER_HOST_VAR_TRACKER_H_
diff --git a/webkit/plugins/ppapi/host_var_tracker_unittest.cc b/content/renderer/pepper/host_var_tracker_unittest.cc
similarity index 87%
rename from webkit/plugins/ppapi/host_var_tracker_unittest.cc
rename to content/renderer/pepper/host_var_tracker_unittest.cc
index fce822b..037f059 100644
--- a/webkit/plugins/ppapi/host_var_tracker_unittest.cc
+++ b/content/renderer/pepper/host_var_tracker_unittest.cc
@@ -2,20 +2,20 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/ppapi_unittest.h"
+#include "content/renderer/pepper/ppapi_unittest.h"
 
 #include "base/memory/scoped_ptr.h"
+#include "content/renderer/pepper/host_globals.h"
+#include "content/renderer/pepper/host_var_tracker.h"
+#include "content/renderer/pepper/mock_plugin_delegate.h"
+#include "content/renderer/pepper/mock_resource.h"
+#include "content/renderer/pepper/npapi_glue.h"
+#include "content/renderer/pepper/npobject_var.h"
+#include "content/renderer/pepper/ppapi_plugin_instance_impl.h"
 #include "ppapi/c/pp_var.h"
 #include "ppapi/c/ppp_instance.h"
 #include "third_party/npapi/bindings/npruntime.h"
 #include "third_party/WebKit/public/web/WebBindings.h"
-#include "webkit/plugins/ppapi/host_globals.h"
-#include "webkit/plugins/ppapi/host_var_tracker.h"
-#include "webkit/plugins/ppapi/mock_plugin_delegate.h"
-#include "webkit/plugins/ppapi/mock_resource.h"
-#include "webkit/plugins/ppapi/npapi_glue.h"
-#include "webkit/plugins/ppapi/npobject_var.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
 
 using ppapi::NPObjectVar;
 
@@ -84,8 +84,8 @@
 
 TEST_F(HostVarTrackerTest, DeleteObjectVarWithInstance) {
   // Make a second instance (the test harness already creates & manages one).
-  scoped_refptr<PluginInstance> instance2(
-      PluginInstance::Create(delegate(), NULL, module(), NULL, GURL()));
+  scoped_refptr<PluginInstanceImpl> instance2(
+      PluginInstanceImpl::Create(delegate(), NULL, module(), NULL, GURL()));
   PP_Instance pp_instance2 = instance2->pp_instance();
 
   // Make an object var.
diff --git a/webkit/plugins/ppapi/message_channel.cc b/content/renderer/pepper/message_channel.cc
similarity index 97%
rename from webkit/plugins/ppapi/message_channel.cc
rename to content/renderer/pepper/message_channel.cc
index b492a45..ea3bdf5 100644
--- a/webkit/plugins/ppapi/message_channel.cc
+++ b/content/renderer/pepper/message_channel.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/message_channel.h"
+#include "content/renderer/pepper/message_channel.h"
 
 #include <cstdlib>
 #include <string>
@@ -10,6 +10,11 @@
 #include "base/bind.h"
 #include "base/logging.h"
 #include "base/message_loop/message_loop.h"
+#include "content/renderer/pepper/host_array_buffer_var.h"
+#include "content/renderer/pepper/npapi_glue.h"
+#include "content/renderer/pepper/plugin_module.h"
+#include "content/renderer/pepper/ppapi_plugin_instance_impl.h"
+#include "content/renderer/pepper/v8_var_converter.h"
 #include "ppapi/shared_impl/ppapi_globals.h"
 #include "ppapi/shared_impl/var.h"
 #include "ppapi/shared_impl/var_tracker.h"
@@ -22,11 +27,6 @@
 #include "third_party/WebKit/public/web/WebPluginContainer.h"
 #include "third_party/WebKit/public/web/WebSerializedScriptValue.h"
 #include "v8/include/v8.h"
-#include "webkit/plugins/ppapi/host_array_buffer_var.h"
-#include "webkit/plugins/ppapi/npapi_glue.h"
-#include "webkit/plugins/ppapi/plugin_module.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
-#include "webkit/plugins/ppapi/v8_var_converter.h"
 
 using ppapi::ArrayBufferVar;
 using ppapi::PpapiGlobals;
@@ -328,7 +328,7 @@
 
 MessageChannel::MessageChannelNPObject::~MessageChannelNPObject() {}
 
-MessageChannel::MessageChannel(PluginInstance* instance)
+MessageChannel::MessageChannel(PluginInstanceImpl* instance)
     : instance_(instance),
       passthrough_object_(NULL),
       np_object_(NULL),
@@ -425,7 +425,7 @@
   // Take a reference on the PluginInstance. This is because JavaScript code
   // may delete the plugin, which would destroy the PluginInstance and its
   // corresponding MessageChannel.
-  scoped_refptr<PluginInstance> instance_ref(instance_);
+  scoped_refptr<PluginInstanceImpl> instance_ref(instance_);
 
   if (early_message_queue_state_ == DRAIN_CANCELLED) {
     early_message_queue_state_ = QUEUE_MESSAGES;
diff --git a/webkit/plugins/ppapi/message_channel.h b/content/renderer/pepper/message_channel.h
similarity index 92%
rename from webkit/plugins/ppapi/message_channel.h
rename to content/renderer/pepper/message_channel.h
index c1e128e..322c4b4 100644
--- a/webkit/plugins/ppapi/message_channel.h
+++ b/content/renderer/pepper/message_channel.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_MESSAGE_CHANNEL_H_
-#define WEBKIT_PLUGINS_PPAPI_MESSAGE_CHANNEL_H_
+#ifndef CONTENT_RENDERER_PEPPER_MESSAGE_CHANNEL_H_
+#define CONTENT_RENDERER_PEPPER_MESSAGE_CHANNEL_H_
 
 #include <deque>
 
@@ -17,7 +17,7 @@
 namespace webkit {
 namespace ppapi {
 
-class PluginInstance;
+class PluginInstanceImpl;
 
 // MessageChannel implements bidirectional postMessage functionality, allowing
 // calls from JavaScript to plugins and vice-versa. See
@@ -45,7 +45,7 @@
     base::WeakPtr<MessageChannel> message_channel;
   };
 
-  explicit MessageChannel(PluginInstance* instance);
+  explicit MessageChannel(PluginInstanceImpl* instance);
   ~MessageChannel();
 
   // Post a message to the onmessage handler for this channel's instance
@@ -66,7 +66,7 @@
 
   NPObject* np_object() { return np_object_; }
 
-  PluginInstance* instance() {
+  PluginInstanceImpl* instance() {
     return instance_;
   }
 
@@ -77,7 +77,7 @@
   void StopQueueingJavaScriptMessages();
 
  private:
-  PluginInstance* instance_;
+  PluginInstanceImpl* instance_;
 
   // We pass all non-postMessage calls through to the passthrough_object_.
   // This way, a plugin can use PPB_Class or PPP_Class_Deprecated and also
@@ -120,4 +120,4 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_MESSAGE_CHANNEL_H_
+#endif  // CONTENT_RENDERER_PEPPER_MESSAGE_CHANNEL_H_
diff --git a/webkit/plugins/ppapi/mock_platform_image_2d.cc b/content/renderer/pepper/mock_platform_image_2d.cc
similarity index 92%
rename from webkit/plugins/ppapi/mock_platform_image_2d.cc
rename to content/renderer/pepper/mock_platform_image_2d.cc
index f95f987..2aba190 100644
--- a/webkit/plugins/ppapi/mock_platform_image_2d.cc
+++ b/content/renderer/pepper/mock_platform_image_2d.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/mock_platform_image_2d.h"
+#include "content/renderer/pepper/mock_platform_image_2d.h"
 
 #include "skia/ext/platform_canvas.h"
 
diff --git a/webkit/plugins/ppapi/mock_platform_image_2d.h b/content/renderer/pepper/mock_platform_image_2d.h
similarity index 75%
rename from webkit/plugins/ppapi/mock_platform_image_2d.h
rename to content/renderer/pepper/mock_platform_image_2d.h
index 5185963..eedd4af 100644
--- a/webkit/plugins/ppapi/mock_platform_image_2d.h
+++ b/content/renderer/pepper/mock_platform_image_2d.h
@@ -2,10 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_MOCK_PLATFORM_IMAGE_2D_H_
-#define WEBKIT_PLUGINS_PPAPI_MOCK_PLATFORM_IMAGE_2D_H_
+#ifndef CONTENT_RENDERER_PEPPER_MOCK_PLATFORM_IMAGE_2D_H_
+#define CONTENT_RENDERER_PEPPER_MOCK_PLATFORM_IMAGE_2D_H_
 
-#include "webkit/plugins/ppapi/plugin_delegate.h"
+#include "content/renderer/pepper/plugin_delegate.h"
 #include "skia/ext/platform_canvas.h"
 
 namespace webkit {
@@ -29,4 +29,4 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_MOCK_PLATFORM_IMAGE_2D_H_
+#endif  // CONTENT_RENDERER_PEPPER_MOCK_PLATFORM_IMAGE_2D_H_
diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.cc b/content/renderer/pepper/mock_plugin_delegate.cc
similarity index 85%
rename from webkit/plugins/ppapi/mock_plugin_delegate.cc
rename to content/renderer/pepper/mock_plugin_delegate.cc
index f28f6d2..aae195e 100644
--- a/webkit/plugins/ppapi/mock_plugin_delegate.cc
+++ b/content/renderer/pepper/mock_plugin_delegate.cc
@@ -2,18 +2,18 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/mock_plugin_delegate.h"
+#include "content/renderer/pepper/mock_plugin_delegate.h"
 
 #include "base/logging.h"
 #include "base/message_loop/message_loop_proxy.h"
+#include "content/renderer/pepper/mock_platform_image_2d.h"
+#include "content/renderer/pepper/plugin_delegate.h"
+#include "content/renderer/pepper/plugin_module.h"
+#include "content/renderer/pepper/ppapi_plugin_instance_impl.h"
 #include "ppapi/c/pp_errors.h"
 #include "ppapi/shared_impl/ppapi_permissions.h"
 #include "ppapi/shared_impl/ppapi_preferences.h"
 #include "third_party/WebKit/public/platform/WebGamepads.h"
-#include "webkit/plugins/ppapi/mock_platform_image_2d.h"
-#include "webkit/plugins/ppapi/plugin_delegate.h"
-#include "webkit/plugins/ppapi/plugin_module.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
 
 namespace webkit {
 namespace ppapi {
@@ -24,21 +24,23 @@
 MockPluginDelegate::~MockPluginDelegate() {
 }
 
-void MockPluginDelegate::PluginFocusChanged(PluginInstance* instance,
+void MockPluginDelegate::PluginFocusChanged(PluginInstanceImpl* instance,
                                             bool focused) {
 }
 
-void MockPluginDelegate::PluginTextInputTypeChanged(PluginInstance* instance) {
+void MockPluginDelegate::PluginTextInputTypeChanged(
+    PluginInstanceImpl* instance) {
 }
 
-void MockPluginDelegate::PluginCaretPositionChanged(PluginInstance* instance) {
+void MockPluginDelegate::PluginCaretPositionChanged(
+    PluginInstanceImpl* instance) {
 }
 
 void MockPluginDelegate::PluginRequestedCancelComposition(
-    PluginInstance* instance) {
+    PluginInstanceImpl* instance) {
 }
 
-void MockPluginDelegate::PluginSelectionChanged(PluginInstance* instance) {
+void MockPluginDelegate::PluginSelectionChanged(PluginInstanceImpl* instance) {
 }
 
 void MockPluginDelegate::SimulateImeSetComposition(
@@ -52,17 +54,17 @@
     const base::string16& text) {
 }
 
-void MockPluginDelegate::PluginCrashed(PluginInstance* instance) {
+void MockPluginDelegate::PluginCrashed(PluginInstanceImpl* instance) {
 }
 
-void MockPluginDelegate::InstanceCreated(PluginInstance* instance) {
+void MockPluginDelegate::InstanceCreated(PluginInstanceImpl* instance) {
 }
 
-void MockPluginDelegate::InstanceDeleted(PluginInstance* instance) {
+void MockPluginDelegate::InstanceDeleted(PluginInstanceImpl* instance) {
 }
 
 scoped_ptr< ::ppapi::thunk::ResourceCreationAPI>
-MockPluginDelegate::CreateResourceCreationAPI(PluginInstance* instance) {
+MockPluginDelegate::CreateResourceCreationAPI(PluginInstanceImpl* instance) {
   return scoped_ptr< ::ppapi::thunk::ResourceCreationAPI>();
 }
 
@@ -82,7 +84,7 @@
 }
 
 PluginDelegate::PlatformGraphics2D* MockPluginDelegate::GetGraphics2D(
-    PluginInstance* instance,
+    PluginInstanceImpl* instance,
     PP_Resource graphics_2d) {
   return NULL;
 }
@@ -319,7 +321,7 @@
 }
 
 FullscreenContainer* MockPluginDelegate::CreateFullscreenContainer(
-    PluginInstance* instance) {
+    PluginInstanceImpl* instance) {
   return NULL;
 }
 
@@ -335,18 +337,6 @@
                                            double maximum_factor) {
 }
 
-void MockPluginDelegate::DidStartLoading() {
-}
-
-void MockPluginDelegate::DidStopLoading() {
-}
-
-void MockPluginDelegate::SetContentRestriction(int restrictions) {
-}
-
-void MockPluginDelegate::SaveURLAs(const GURL& url) {
-}
-
 base::SharedMemory* MockPluginDelegate::CreateAnonymousSharedMemory(
     size_t size) {
   return NULL;
@@ -356,22 +346,22 @@
   return ::ppapi::Preferences();
 }
 
-bool MockPluginDelegate::LockMouse(PluginInstance* instance) {
+bool MockPluginDelegate::LockMouse(PluginInstanceImpl* instance) {
   return false;
 }
 
-void MockPluginDelegate::UnlockMouse(PluginInstance* instance) {
+void MockPluginDelegate::UnlockMouse(PluginInstanceImpl* instance) {
 }
 
-bool MockPluginDelegate::IsMouseLocked(PluginInstance* instance) {
+bool MockPluginDelegate::IsMouseLocked(PluginInstanceImpl* instance) {
   return false;
 }
 
-void MockPluginDelegate::DidChangeCursor(PluginInstance* instance,
+void MockPluginDelegate::DidChangeCursor(PluginInstanceImpl* instance,
                                          const WebKit::WebCursorInfo& cursor) {
 }
 
-void MockPluginDelegate::DidReceiveMouseEvent(PluginInstance* instance) {
+void MockPluginDelegate::DidReceiveMouseEvent(PluginInstanceImpl* instance) {
 }
 
 void MockPluginDelegate::SampleGamepads(WebKit::WebGamepads* data) {
@@ -407,7 +397,7 @@
 }
 
 void MockPluginDelegate::HandleDocumentLoad(
-    PluginInstance* instance,
+    PluginInstanceImpl* instance,
     const WebKit::WebURLResponse& response) {
 }
 
diff --git a/content/renderer/pepper/mock_plugin_delegate.h b/content/renderer/pepper/mock_plugin_delegate.h
new file mode 100644
index 0000000..8631dd7
--- /dev/null
+++ b/content/renderer/pepper/mock_plugin_delegate.h
@@ -0,0 +1,205 @@
+// 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 CONTENT_RENDERER_PEPPER_MOCK_PLUGIN_DELEGATE_H_
+#define CONTENT_RENDERER_PEPPER_MOCK_PLUGIN_DELEGATE_H_
+
+#include "content/renderer/pepper/plugin_delegate.h"
+
+struct PP_NetAddress_Private;
+namespace ppapi { class PPB_X509Certificate_Fields; }
+
+namespace webkit {
+namespace ppapi {
+
+class MockPluginDelegate : public PluginDelegate {
+ public:
+  MockPluginDelegate();
+  virtual ~MockPluginDelegate();
+
+  virtual void PluginFocusChanged(PluginInstanceImpl* instance,
+                                  bool focused) OVERRIDE;
+  virtual void PluginTextInputTypeChanged(
+      PluginInstanceImpl* instance) OVERRIDE;
+  virtual void PluginCaretPositionChanged(
+      PluginInstanceImpl* instance) OVERRIDE;
+  virtual void PluginRequestedCancelComposition(
+      PluginInstanceImpl* instance) OVERRIDE;
+  virtual void PluginSelectionChanged(PluginInstanceImpl* instance) OVERRIDE;
+  virtual void SimulateImeSetComposition(
+      const base::string16& text,
+      const std::vector<WebKit::WebCompositionUnderline>& underlines,
+      int selection_start,
+      int selection_end) OVERRIDE;
+  virtual void SimulateImeConfirmComposition(
+      const base::string16& text) OVERRIDE;
+  virtual void PluginCrashed(PluginInstanceImpl* instance) OVERRIDE;
+  virtual void InstanceCreated(PluginInstanceImpl* instance) OVERRIDE;
+  virtual void InstanceDeleted(PluginInstanceImpl* instance) OVERRIDE;
+  virtual scoped_ptr< ::ppapi::thunk::ResourceCreationAPI>
+      CreateResourceCreationAPI(PluginInstanceImpl* instance) OVERRIDE;
+  virtual SkBitmap* GetSadPluginBitmap() OVERRIDE;
+  virtual WebKit::WebPlugin* CreatePluginReplacement(
+      const base::FilePath& file_path) OVERRIDE;
+  virtual PlatformImage2D* CreateImage2D(int width, int height) OVERRIDE;
+  virtual PlatformGraphics2D* GetGraphics2D(PluginInstanceImpl* instance,
+                                            PP_Resource graphics_2d) OVERRIDE;
+  virtual PlatformContext3D* CreateContext3D() OVERRIDE;
+  virtual PlatformVideoDecoder* CreateVideoDecoder(
+      media::VideoDecodeAccelerator::Client* client,
+      int32 command_buffer_route_id) OVERRIDE;
+  virtual PlatformVideoCapture* CreateVideoCapture(
+      const std::string& device_id,
+      const GURL& document_url,
+      PlatformVideoCaptureEventHandler* handler) OVERRIDE;
+  virtual uint32_t GetAudioHardwareOutputSampleRate() OVERRIDE;
+  virtual uint32_t GetAudioHardwareOutputBufferSize() OVERRIDE;
+  virtual PlatformAudioOutput* CreateAudioOutput(
+      uint32_t sample_rate,
+      uint32_t sample_count,
+      PlatformAudioOutputClient* client) OVERRIDE;
+  virtual PlatformAudioInput* CreateAudioInput(
+      const std::string& device_id,
+      const GURL& document_url,
+      uint32_t sample_rate,
+      uint32_t sample_count,
+      PlatformAudioInputClient* client) OVERRIDE;
+  virtual Broker* ConnectToBroker(PPB_Broker_Impl* client) OVERRIDE;
+  virtual void NumberOfFindResultsChanged(int identifier,
+                                          int total,
+                                          bool final_result) OVERRIDE;
+  virtual void SelectedFindResultChanged(int identifier, int index) OVERRIDE;
+  virtual bool AsyncOpenFile(const base::FilePath& path,
+                             int flags,
+                             const AsyncOpenFileCallback& callback) OVERRIDE;
+  virtual void AsyncOpenFileSystemURL(
+      const GURL& path,
+      int flags,
+      const AsyncOpenFileSystemURLCallback& callback) OVERRIDE;
+  virtual bool IsFileSystemOpened(PP_Instance instance,
+                                  PP_Resource resource) const OVERRIDE;
+  virtual PP_FileSystemType GetFileSystemType(
+      PP_Instance instance,
+      PP_Resource resource) const OVERRIDE;
+  virtual GURL GetFileSystemRootUrl(PP_Instance instance,
+                                    PP_Resource resource) const OVERRIDE;
+  virtual void MakeDirectory(
+      const GURL& path,
+      bool recursive,
+      const StatusCallback& callback) OVERRIDE;
+  virtual void Query(const GURL& path,
+                     const MetadataCallback& success_callback,
+                     const StatusCallback& error_callback) OVERRIDE;
+  virtual void ReadDirectoryEntries(
+      const GURL& path,
+      const ReadDirectoryCallback& success_callback,
+      const StatusCallback& error_callback) OVERRIDE;
+  virtual void Touch(const GURL& path,
+                     const base::Time& last_access_time,
+                     const base::Time& last_modified_time,
+                     const StatusCallback& callback) OVERRIDE;
+  virtual void SetLength(const GURL& path,
+                         int64_t length,
+                         const StatusCallback& callback) OVERRIDE;
+  virtual void Delete(const GURL& path,
+                      const StatusCallback& callback) OVERRIDE;
+  virtual void Rename(const GURL& file_path,
+                      const GURL& new_file_path,
+                      const StatusCallback& callback) OVERRIDE;
+  virtual void ReadDirectory(
+      const GURL& directory_path,
+      const ReadDirectoryCallback& success_callback,
+      const StatusCallback& error_callback) OVERRIDE;
+  virtual void QueryAvailableSpace(
+      const GURL& origin,
+      quota::StorageType type,
+      const AvailableSpaceCallback& callback) OVERRIDE;
+  virtual void WillUpdateFile(const GURL& file_path) OVERRIDE;
+  virtual void DidUpdateFile(const GURL& file_path, int64_t delta) OVERRIDE;
+  virtual void SyncGetFileSystemPlatformPath(
+      const GURL& url,
+      base::FilePath* platform_path) OVERRIDE;
+  virtual scoped_refptr<base::MessageLoopProxy>
+      GetFileThreadMessageLoopProxy() OVERRIDE;
+  virtual uint32 TCPSocketCreate() OVERRIDE;
+  virtual void TCPSocketConnect(PPB_TCPSocket_Private_Impl* socket,
+                                uint32 socket_id,
+                                const std::string& host,
+                                uint16_t port) OVERRIDE;
+  virtual void TCPSocketConnectWithNetAddress(
+      PPB_TCPSocket_Private_Impl* socket,
+      uint32 socket_id,
+      const PP_NetAddress_Private& addr) OVERRIDE;
+  virtual void TCPSocketSSLHandshake(
+      uint32 socket_id,
+      const std::string& server_name,
+      uint16_t server_port,
+      const std::vector<std::vector<char> >& trusted_certs,
+      const std::vector<std::vector<char> >& untrusted_certs) OVERRIDE;
+  virtual void TCPSocketRead(uint32 socket_id, int32_t bytes_to_read) OVERRIDE;
+  virtual void TCPSocketWrite(uint32 socket_id,
+                              const std::string& buffer) OVERRIDE;
+  virtual void TCPSocketDisconnect(uint32 socket_id) OVERRIDE;
+  virtual void TCPSocketSetOption(
+      uint32 socket_id,
+      PP_TCPSocket_Option name,
+      const ::ppapi::SocketOptionData& value) OVERRIDE;
+  virtual void RegisterTCPSocket(PPB_TCPSocket_Private_Impl* socket,
+                                 uint32 socket_id) OVERRIDE;
+  virtual void TCPServerSocketListen(PP_Resource socket_resource,
+                                     const PP_NetAddress_Private& addr,
+                                     int32_t backlog) OVERRIDE;
+  virtual void TCPServerSocketAccept(uint32 server_socket_id) OVERRIDE;
+  virtual void TCPServerSocketStopListening(PP_Resource socket_resource,
+                                            uint32 socket_id) OVERRIDE;
+  // Add/remove a network list observer.
+  virtual bool AddNetworkListObserver(
+      webkit_glue::NetworkListObserver* observer) OVERRIDE;
+  virtual void RemoveNetworkListObserver(
+      webkit_glue::NetworkListObserver* observer) OVERRIDE;
+  virtual bool X509CertificateParseDER(
+      const std::vector<char>& der,
+      ::ppapi::PPB_X509Certificate_Fields* fields) OVERRIDE;
+  virtual FullscreenContainer* CreateFullscreenContainer(
+      PluginInstanceImpl* instance) OVERRIDE;
+  virtual gfx::Size GetScreenSize() OVERRIDE;
+  virtual std::string GetDefaultEncoding() OVERRIDE;
+  virtual void ZoomLimitsChanged(double minimum_factor,
+                                 double maximum_factor) OVERRIDE;
+  virtual base::SharedMemory* CreateAnonymousSharedMemory(size_t size) OVERRIDE;
+  virtual ::ppapi::Preferences GetPreferences() OVERRIDE;
+  virtual bool LockMouse(PluginInstanceImpl* instance) OVERRIDE;
+  virtual void UnlockMouse(PluginInstanceImpl* instance) OVERRIDE;
+  virtual bool IsMouseLocked(PluginInstanceImpl* instance) OVERRIDE;
+  virtual void DidChangeCursor(PluginInstanceImpl* instance,
+                               const WebKit::WebCursorInfo& cursor) OVERRIDE;
+  virtual void DidReceiveMouseEvent(PluginInstanceImpl* instance) OVERRIDE;
+  virtual void SampleGamepads(WebKit::WebGamepads* data) OVERRIDE;
+  virtual bool IsInFullscreenMode() OVERRIDE;
+  virtual bool IsPageVisible() const OVERRIDE;
+  virtual int EnumerateDevices(
+      PP_DeviceType_Dev type,
+      const EnumerateDevicesCallback& callback) OVERRIDE;
+  virtual void StopEnumerateDevices(int request_id) OVERRIDE;
+  virtual IPC::PlatformFileForTransit ShareHandleWithRemote(
+      base::PlatformFile handle,
+      base::ProcessId target_process_id,
+      bool should_close_source) const OVERRIDE;
+  virtual bool IsRunningInProcess(PP_Instance instance) const OVERRIDE;
+  virtual void HandleDocumentLoad(
+      PluginInstanceImpl* instance,
+      const WebKit::WebURLResponse& response) OVERRIDE;
+  virtual content::RendererPpapiHost* CreateExternalPluginModule(
+      scoped_refptr<PluginModule> module,
+      const base::FilePath& path,
+      ::ppapi::PpapiPermissions permissions,
+      const IPC::ChannelHandle& channel_handle,
+      base::ProcessId plugin_pid,
+      int plugin_child_id) OVERRIDE;
+};
+
+}  // namespace ppapi
+}  // namespace webkit
+
+#endif  // CONTENT_RENDERER_PEPPER_MOCK_PLUGIN_DELEGATE_H_
diff --git a/webkit/plugins/ppapi/mock_resource.h b/content/renderer/pepper/mock_resource.h
similarity index 80%
rename from webkit/plugins/ppapi/mock_resource.h
rename to content/renderer/pepper/mock_resource.h
index 01f7fb6..60531f0 100644
--- a/webkit/plugins/ppapi/mock_resource.h
+++ b/content/renderer/pepper/mock_resource.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_MOCK_RESOURCE_H_
-#define WEBKIT_PLUGINS_PPAPI_MOCK_RESOURCE_H_
+#ifndef CONTENT_RENDERER_PEPPER_MOCK_RESOURCE_H_
+#define CONTENT_RENDERER_PEPPER_MOCK_RESOURCE_H_
 
 #include "ppapi/shared_impl/resource.h"
 
@@ -17,10 +17,12 @@
  public:
   MockResource(PP_Instance instance)
       : Resource(::ppapi::OBJECT_IS_IMPL, instance) {}
+
+ private:
   virtual ~MockResource() {}
 };
 
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_MOCK_RESOURCE_H_
+#endif  // CONTENT_RENDERER_PEPPER_MOCK_RESOURCE_H_
diff --git a/webkit/plugins/ppapi/npapi_glue.cc b/content/renderer/pepper/npapi_glue.cc
similarity index 91%
rename from webkit/plugins/ppapi/npapi_glue.cc
rename to content/renderer/pepper/npapi_glue.cc
index abc0738..f8b0c52 100644
--- a/webkit/plugins/ppapi/npapi_glue.cc
+++ b/content/renderer/pepper/npapi_glue.cc
@@ -2,19 +2,19 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/npapi_glue.h"
+#include "content/renderer/pepper/npapi_glue.h"
 
 #include "base/logging.h"
 #include "base/memory/ref_counted.h"
 #include "base/strings/string_util.h"
+#include "content/renderer/pepper/host_array_buffer_var.h"
+#include "content/renderer/pepper/host_globals.h"
+#include "content/renderer/pepper/host_var_tracker.h"
+#include "content/renderer/pepper/npobject_var.h"
+#include "content/renderer/pepper/plugin_module.h"
+#include "content/renderer/pepper/plugin_object.h"
+#include "content/renderer/pepper/ppapi_plugin_instance_impl.h"
 #include "ppapi/c/pp_var.h"
-#include "webkit/plugins/ppapi/host_array_buffer_var.h"
-#include "webkit/plugins/ppapi/host_globals.h"
-#include "webkit/plugins/ppapi/host_var_tracker.h"
-#include "webkit/plugins/ppapi/npobject_var.h"
-#include "webkit/plugins/ppapi/plugin_module.h"
-#include "webkit/plugins/ppapi/plugin_object.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
 #include "third_party/npapi/bindings/npapi.h"
 #include "third_party/npapi/bindings/npruntime.h"
 #include "third_party/WebKit/public/web/WebBindings.h"
@@ -39,7 +39,7 @@
 
 const char kInvalidPluginValue[] = "Error: Plugin returned invalid value.";
 
-PP_Var NPObjectToPPVarImpl(PluginInstance* instance,
+PP_Var NPObjectToPPVarImpl(PluginInstanceImpl* instance,
                            NPObject* object,
                            v8::Local<v8::Context> context) {
   DCHECK(object);
@@ -122,7 +122,8 @@
   return true;
 }
 
-PP_Var NPVariantToPPVar(PluginInstance* instance, const NPVariant* variant) {
+PP_Var NPVariantToPPVar(PluginInstanceImpl* instance,
+                        const NPVariant* variant) {
   switch (variant->type) {
     case NPVariantType_Void:
       return PP_MakeUndefined();
@@ -171,7 +172,7 @@
   return PP_MakeInt32(int_value);
 }
 
-PP_Var NPObjectToPPVar(PluginInstance* instance, NPObject* object) {
+PP_Var NPObjectToPPVar(PluginInstanceImpl* instance, NPObject* object) {
   WebPluginContainer* container = instance->container();
   // It's possible that container() is NULL if the plugin has been removed from
   // the DOM (but the PluginInstance is not destroyed yet).
@@ -183,7 +184,7 @@
   return NPObjectToPPVarImpl(instance, object, context);
 }
 
-PP_Var NPObjectToPPVarForTest(PluginInstance* instance, NPObject* object) {
+PP_Var NPObjectToPPVarForTest(PluginInstanceImpl* instance, NPObject* object) {
   v8::Isolate* test_isolate = v8::Isolate::New();
   PP_Var result = PP_MakeUndefined();
   {
@@ -279,7 +280,7 @@
 // PPVarArrayFromNPVariantArray ------------------------------------------------
 
 PPVarArrayFromNPVariantArray::PPVarArrayFromNPVariantArray(
-    PluginInstance* instance,
+    PluginInstanceImpl* instance,
     size_t size,
     const NPVariant* variants)
     : size_(size) {
@@ -298,7 +299,8 @@
 
 // PPVarFromNPObject -----------------------------------------------------------
 
-PPVarFromNPObject::PPVarFromNPObject(PluginInstance* instance, NPObject* object)
+PPVarFromNPObject::PPVarFromNPObject(PluginInstanceImpl* instance,
+                                     NPObject* object)
     : var_(NPObjectToPPVar(instance, object)) {
 }
 
diff --git a/webkit/plugins/ppapi/npapi_glue.h b/content/renderer/pepper/npapi_glue.h
similarity index 93%
rename from webkit/plugins/ppapi/npapi_glue.h
rename to content/renderer/pepper/npapi_glue.h
index f7403bc..5cc745b 100644
--- a/webkit/plugins/ppapi/npapi_glue.h
+++ b/content/renderer/pepper/npapi_glue.h
@@ -2,14 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_NPAPI_GLUE_H_
-#define WEBKIT_PLUGINS_PPAPI_NPAPI_GLUE_H_
+#ifndef CONTENT_RENDERER_PEPPER_NPAPI_GLUE_H_
+#define CONTENT_RENDERER_PEPPER_NPAPI_GLUE_H_
 
 #include "base/basictypes.h"
 #include "base/memory/scoped_ptr.h"
+#include "content/common/content_export.h"
 #include "ppapi/c/pp_module.h"
 #include "ppapi/c/pp_var.h"
-#include "webkit/plugins/webkit_plugins_export.h"
 
 struct NPObject;
 typedef struct _NPVariant NPVariant;
@@ -18,7 +18,7 @@
 namespace webkit {
 namespace ppapi {
 
-class PluginInstance;
+class PluginInstanceImpl;
 class PluginObject;
 
 // Utilities -------------------------------------------------------------------
@@ -38,8 +38,7 @@
 //
 // The returned PP_Var will have a refcount of 1, this passing ownership of
 // the reference to the caller. This is suitable for returning to a plugin.
-WEBKIT_PLUGINS_EXPORT PP_Var NPVariantToPPVar(PluginInstance* instance,
-                                              const NPVariant* variant);
+PP_Var NPVariantToPPVar(PluginInstanceImpl* instance, const NPVariant* variant);
 
 // Returns a NPIdentifier that corresponds to the given PP_Var. The contents
 // of the PP_Var will be copied. Returns 0 if the given PP_Var is not a a
@@ -65,14 +64,14 @@
 // Note: this could easily be changed to take a PP_Instance instead if that
 // makes certain calls in the future easier. Currently all callers have a
 // PluginInstance so that's what we use here.
-WEBKIT_PLUGINS_EXPORT PP_Var NPObjectToPPVar(PluginInstance* instance,
-                                             NPObject* object);
+CONTENT_EXPORT PP_Var NPObjectToPPVar(PluginInstanceImpl* instance,
+                                      NPObject* object);
 
 // This version creates a default v8::Context rather than using the one from
 // the container of |instance|. It is only for use in unit tests, where we don't
 // have a real container for |instance|.
-WEBKIT_PLUGINS_EXPORT PP_Var NPObjectToPPVarForTest(PluginInstance* instance,
-                                                    NPObject* object);
+CONTENT_EXPORT PP_Var NPObjectToPPVarForTest(PluginInstanceImpl* instance,
+                                             NPObject* object);
 
 // PPResultAndExceptionToNPResult ----------------------------------------------
 
@@ -153,7 +152,7 @@
 // WebKit to the plugin.
 class PPVarArrayFromNPVariantArray {
  public:
-  PPVarArrayFromNPVariantArray(PluginInstance* instance,
+  PPVarArrayFromNPVariantArray(PluginInstanceImpl* instance,
                                size_t size,
                                const NPVariant* variants);
   ~PPVarArrayFromNPVariantArray();
@@ -173,7 +172,7 @@
 // is used when converting 'this' pointer from WebKit to the plugin.
 class PPVarFromNPObject {
  public:
-  PPVarFromNPObject(PluginInstance* instance, NPObject* object);
+  PPVarFromNPObject(PluginInstanceImpl* instance, NPObject* object);
   ~PPVarFromNPObject();
 
   PP_Var var() const { return var_; }
@@ -263,4 +262,4 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_NPAPI_GLUE_H_
+#endif  // CONTENT_RENDERER_PEPPER_NPAPI_GLUE_H_
diff --git a/webkit/plugins/ppapi/npobject_var.cc b/content/renderer/pepper/npobject_var.cc
similarity index 90%
rename from webkit/plugins/ppapi/npobject_var.cc
rename to content/renderer/pepper/npobject_var.cc
index 64b5591..0ab1755 100644
--- a/webkit/plugins/ppapi/npobject_var.cc
+++ b/content/renderer/pepper/npobject_var.cc
@@ -2,13 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/npobject_var.h"
+#include "content/renderer/pepper/npobject_var.h"
 
 #include "base/logging.h"
+#include "content/renderer/pepper/host_globals.h"
+#include "content/renderer/pepper/host_var_tracker.h"
 #include "ppapi/c/pp_var.h"
 #include "third_party/WebKit/public/web/WebBindings.h"
-#include "webkit/plugins/ppapi/host_globals.h"
-#include "webkit/plugins/ppapi/host_var_tracker.h"
 
 using webkit::ppapi::HostGlobals;
 using WebKit::WebBindings;
diff --git a/webkit/plugins/ppapi/npobject_var.h b/content/renderer/pepper/npobject_var.h
similarity index 88%
rename from webkit/plugins/ppapi/npobject_var.h
rename to content/renderer/pepper/npobject_var.h
index 6f31e3d..6cafbb4 100644
--- a/webkit/plugins/ppapi/npobject_var.h
+++ b/content/renderer/pepper/npobject_var.h
@@ -2,15 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_NPOBJECT_VAR_H_
-#define WEBKIT_PLUGINS_PPAPI_NPOBJECT_VAR_H_
+#ifndef CONTENT_RENDERER_PEPPER_NPOBJECT_VAR_H_
+#define CONTENT_RENDERER_PEPPER_NPOBJECT_VAR_H_
 
 #include <string>
 
 #include "base/compiler_specific.h"
 #include "ppapi/c/pp_instance.h"
 #include "ppapi/shared_impl/var.h"
-#include "webkit/plugins/webkit_plugins_export.h"
+#include "content/common/content_export.h"
 
 typedef struct NPObject NPObject;
 typedef struct _NPVariant NPVariant;
@@ -34,8 +34,6 @@
   // NPObjectVar.
   NPObjectVar(PP_Instance instance, NPObject* np_object);
 
-  virtual ~NPObjectVar();
-
   // Var overrides.
   virtual NPObjectVar* AsNPObjectVar() OVERRIDE;
   virtual PP_VarType GetType() const OVERRIDE;
@@ -53,9 +51,11 @@
 
   // Helper function that converts a PP_Var to an object. This will return NULL
   // if the PP_Var is not of object type or the object is invalid.
-  WEBKIT_PLUGINS_EXPORT static scoped_refptr<NPObjectVar> FromPPVar(PP_Var var);
+  CONTENT_EXPORT static scoped_refptr<NPObjectVar> FromPPVar(PP_Var var);
 
  private:
+  virtual ~NPObjectVar();
+
   // Possibly 0 if the object has outlived its instance.
   PP_Instance pp_instance_;
 
@@ -68,4 +68,4 @@
 
 }  // namespace
 
-#endif  // WEBKIT_PLUGINS_PPAPI_NPOBJECT_VAR_H_
+#endif  // CONTENT_RENDERER_PEPPER_NPOBJECT_VAR_H_
diff --git a/content/renderer/pepper/pepper_audio_input_host.cc b/content/renderer/pepper/pepper_audio_input_host.cc
index 1c0496e..6e74126 100644
--- a/content/renderer/pepper/pepper_audio_input_host.cc
+++ b/content/renderer/pepper/pepper_audio_input_host.cc
@@ -6,7 +6,8 @@
 
 #include "base/logging.h"
 #include "build/build_config.h"
-#include "content/public/renderer/renderer_ppapi_host.h"
+#include "content/renderer/pepper/ppapi_plugin_instance_impl.h"
+#include "content/renderer/pepper/renderer_ppapi_host_impl.h"
 #include "ipc/ipc_message.h"
 #include "media/audio/shared_memory_util.h"
 #include "ppapi/c/pp_errors.h"
@@ -17,7 +18,6 @@
 #include "third_party/WebKit/public/web/WebDocument.h"
 #include "third_party/WebKit/public/web/WebElement.h"
 #include "third_party/WebKit/public/web/WebPluginContainer.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
 
 namespace content {
 
@@ -41,7 +41,7 @@
 }  // namespace
 
 PepperAudioInputHost::PepperAudioInputHost(
-    RendererPpapiHost* host,
+    RendererPpapiHostImpl* host,
     PP_Instance instance,
     PP_Resource resource)
     : ResourceHost(host->GetPpapiHost(), instance, resource),
@@ -84,8 +84,8 @@
 }
 
 webkit::ppapi::PluginDelegate* PepperAudioInputHost::GetPluginDelegate() {
-  webkit::ppapi::PluginInstance* instance =
-      renderer_ppapi_host_->GetPluginInstance(pp_instance());
+  webkit::ppapi::PluginInstanceImpl* instance =
+      renderer_ppapi_host_->GetPluginInstanceImpl(pp_instance());
   if (instance)
     return instance->delegate();
   return NULL;
@@ -105,8 +105,8 @@
   if (!plugin_delegate)
     return PP_ERROR_FAILED;
 
-  webkit::ppapi::PluginInstance* instance =
-      renderer_ppapi_host_->GetPluginInstance(pp_instance());
+  webkit::ppapi::PluginInstanceImpl* instance =
+      renderer_ppapi_host_->GetPluginInstanceImpl(pp_instance());
   if (!instance)
     return PP_ERROR_FAILED;
 
diff --git a/content/renderer/pepper/pepper_audio_input_host.h b/content/renderer/pepper/pepper_audio_input_host.h
index c0b656c..8316ec8 100644
--- a/content/renderer/pepper/pepper_audio_input_host.h
+++ b/content/renderer/pepper/pepper_audio_input_host.h
@@ -13,22 +13,22 @@
 #include "base/memory/shared_memory.h"
 #include "base/sync_socket.h"
 #include "content/renderer/pepper/pepper_device_enumeration_host_helper.h"
+#include "content/renderer/pepper/plugin_delegate.h"
 #include "ipc/ipc_platform_file.h"
 #include "ppapi/c/ppb_audio_config.h"
 #include "ppapi/host/host_message_context.h"
 #include "ppapi/host/resource_host.h"
-#include "webkit/plugins/ppapi/plugin_delegate.h"
 
 namespace content {
 
-class RendererPpapiHost;
+class RendererPpapiHostImpl;
 
 class PepperAudioInputHost
     : public ppapi::host::ResourceHost,
       public webkit::ppapi::PluginDelegate::PlatformAudioInputClient,
       public PepperDeviceEnumerationHostHelper::Delegate {
  public:
-  PepperAudioInputHost(RendererPpapiHost* host,
+  PepperAudioInputHost(RendererPpapiHostImpl* host,
                        PP_Instance instance,
                        PP_Resource resource);
   virtual ~PepperAudioInputHost();
@@ -69,7 +69,7 @@
   void Close();
 
   // Non-owning pointer.
-  RendererPpapiHost* renderer_ppapi_host_;
+  RendererPpapiHostImpl* renderer_ppapi_host_;
 
   scoped_ptr<ppapi::host::ReplyMessageContext> open_context_;
 
diff --git a/content/renderer/pepper/pepper_broker_impl.cc b/content/renderer/pepper/pepper_broker_impl.cc
index 842c56f..aca9f32 100644
--- a/content/renderer/pepper/pepper_broker_impl.cc
+++ b/content/renderer/pepper/pepper_broker_impl.cc
@@ -8,12 +8,12 @@
 #include "content/public/renderer/renderer_restrict_dispatch_group.h"
 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h"
 #include "content/renderer/pepper/pepper_proxy_channel_delegate_impl.h"
+#include "content/renderer/pepper/plugin_module.h"
+#include "content/renderer/pepper/ppb_broker_impl.h"
 #include "ipc/ipc_channel_handle.h"
 #include "ppapi/proxy/broker_dispatcher.h"
 #include "ppapi/proxy/ppapi_messages.h"
 #include "ppapi/shared_impl/platform_file.h"
-#include "webkit/plugins/ppapi/plugin_module.h"
-#include "webkit/plugins/ppapi/ppb_broker_impl.h"
 
 #if defined(OS_WIN)
 #include <windows.h>
diff --git a/content/renderer/pepper/pepper_broker_impl.h b/content/renderer/pepper/pepper_broker_impl.h
index d3653bb..ce81d96 100644
--- a/content/renderer/pepper/pepper_broker_impl.h
+++ b/content/renderer/pepper/pepper_broker_impl.h
@@ -6,11 +6,11 @@
 #define CONTENT_RENDERER_PEPPER_PEPPER_BROKER_IMPL_H_
 
 #include "base/memory/ref_counted.h"
-#include "base/process.h"
+#include "base/process/process.h"
 #include "content/common/content_export.h"
+#include "content/renderer/pepper/plugin_delegate.h"
+#include "content/renderer/pepper/ppb_broker_impl.h"
 #include "ppapi/proxy/proxy_channel.h"
-#include "webkit/plugins/ppapi/plugin_delegate.h"
-#include "webkit/plugins/ppapi/ppb_broker_impl.h"
 
 namespace IPC {
 struct ChannelHandle;
diff --git a/content/renderer/pepper/pepper_device_enumeration_event_handler.h b/content/renderer/pepper/pepper_device_enumeration_event_handler.h
index b390c80..543bcdb 100644
--- a/content/renderer/pepper/pepper_device_enumeration_event_handler.h
+++ b/content/renderer/pepper/pepper_device_enumeration_event_handler.h
@@ -10,7 +10,7 @@
 #include "base/memory/weak_ptr.h"
 #include "content/renderer/media/media_stream_dispatcher_eventhandler.h"
 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h"
-#include "webkit/plugins/ppapi/plugin_delegate.h"
+#include "content/renderer/pepper/plugin_delegate.h"
 
 namespace content {
 
diff --git a/content/renderer/pepper/pepper_device_enumeration_host_helper.cc b/content/renderer/pepper/pepper_device_enumeration_host_helper.cc
index fca8ac5..136c946 100644
--- a/content/renderer/pepper/pepper_device_enumeration_host_helper.cc
+++ b/content/renderer/pepper/pepper_device_enumeration_host_helper.cc
@@ -8,6 +8,7 @@
 #include "base/logging.h"
 #include "base/memory/weak_ptr.h"
 #include "base/message_loop/message_loop.h"
+#include "content/renderer/pepper/plugin_delegate.h"
 #include "ipc/ipc_message.h"
 #include "ppapi/c/pp_errors.h"
 #include "ppapi/host/dispatch_host_message.h"
@@ -16,7 +17,6 @@
 #include "ppapi/host/resource_host.h"
 #include "ppapi/proxy/ppapi_messages.h"
 #include "ppapi/shared_impl/ppb_device_ref_shared.h"
-#include "webkit/plugins/ppapi/plugin_delegate.h"
 
 using ppapi::host::HostMessageContext;
 using webkit::ppapi::PluginDelegate;
diff --git a/content/renderer/pepper/pepper_device_enumeration_host_helper_unittest.cc b/content/renderer/pepper/pepper_device_enumeration_host_helper_unittest.cc
index c5616f5..f4e5714 100644
--- a/content/renderer/pepper/pepper_device_enumeration_host_helper_unittest.cc
+++ b/content/renderer/pepper/pepper_device_enumeration_host_helper_unittest.cc
@@ -7,6 +7,7 @@
 #include "base/basictypes.h"
 #include "base/compiler_specific.h"
 #include "base/logging.h"
+#include "content/renderer/pepper/mock_plugin_delegate.h"
 #include "content/renderer/pepper/pepper_device_enumeration_host_helper.h"
 #include "ppapi/c/pp_errors.h"
 #include "ppapi/host/host_message_context.h"
@@ -18,7 +19,6 @@
 #include "ppapi/proxy/resource_message_test_sink.h"
 #include "ppapi/shared_impl/ppapi_permissions.h"
 #include "testing/gtest/include/gtest/gtest.h"
-#include "webkit/plugins/ppapi/mock_plugin_delegate.h"
 
 namespace content {
 
diff --git a/content/renderer/pepper/pepper_file_chooser_host.cc b/content/renderer/pepper/pepper_file_chooser_host.cc
index 6f9b453..8eecb07 100644
--- a/content/renderer/pepper/pepper_file_chooser_host.cc
+++ b/content/renderer/pepper/pepper_file_chooser_host.cc
@@ -7,6 +7,7 @@
 #include "base/files/file_path.h"
 #include "base/strings/utf_string_conversions.h"
 #include "content/public/renderer/renderer_ppapi_host.h"
+#include "content/renderer/pepper/ppb_file_ref_impl.h"
 #include "content/renderer/render_view_impl.h"
 #include "ppapi/c/pp_errors.h"
 #include "ppapi/host/dispatch_host_message.h"
@@ -18,7 +19,6 @@
 #include "third_party/WebKit/public/platform/WebVector.h"
 #include "third_party/WebKit/public/web/WebFileChooserCompletion.h"
 #include "third_party/WebKit/public/web/WebFileChooserParams.h"
-#include "webkit/plugins/ppapi/ppb_file_ref_impl.h"
 
 namespace content {
 
diff --git a/content/renderer/pepper/pepper_file_io_host.cc b/content/renderer/pepper/pepper_file_io_host.cc
index 934a336..96f0e82 100644
--- a/content/renderer/pepper/pepper_file_io_host.cc
+++ b/content/renderer/pepper/pepper_file_io_host.cc
@@ -11,6 +11,10 @@
 #include "base/files/file_util_proxy.h"
 #include "content/public/common/content_client.h"
 #include "content/public/renderer/content_renderer_client.h"
+#include "content/renderer/pepper/host_globals.h"
+#include "content/renderer/pepper/ppapi_plugin_instance_impl.h"
+#include "content/renderer/pepper/ppb_file_ref_impl.h"
+#include "content/renderer/pepper/quota_file_io.h"
 #include "ppapi/c/pp_errors.h"
 #include "ppapi/host/dispatch_host_message.h"
 #include "ppapi/host/ppapi_host.h"
@@ -19,10 +23,6 @@
 #include "ppapi/shared_impl/time_conversion.h"
 #include "ppapi/thunk/enter.h"
 #include "third_party/WebKit/public/web/WebPluginContainer.h"
-#include "webkit/plugins/ppapi/host_globals.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
-#include "webkit/plugins/ppapi/ppb_file_ref_impl.h"
-#include "webkit/plugins/ppapi/quota_file_io.h"
 
 namespace content {
 
@@ -58,6 +58,7 @@
                                    PP_Instance instance,
                                    PP_Resource resource)
     : ResourceHost(host->GetPpapiHost(), instance, resource),
+      plugin_delegate_(NULL),
       file_(base::kInvalidPlatformFileValue),
       file_system_type_(PP_FILESYSTEMTYPE_INVALID),
       quota_policy_(quota::kQuotaLimitTypeUnknown),
@@ -65,7 +66,7 @@
       open_flags_(0),
       weak_factory_(this) {
   // TODO(victorhsieh): eliminate plugin_delegate_ as it's no longer needed.
-  webkit::ppapi::PluginInstance* plugin_instance =
+  webkit::ppapi::PluginInstanceImpl* plugin_instance =
       webkit::ppapi::HostGlobals::Get()->GetInstance(instance);
   plugin_delegate_ = plugin_instance ? plugin_instance->delegate() : NULL;
 }
diff --git a/content/renderer/pepper/pepper_file_io_host.h b/content/renderer/pepper/pepper_file_io_host.h
index 62e4356..89e70f7 100644
--- a/content/renderer/pepper/pepper_file_io_host.h
+++ b/content/renderer/pepper/pepper_file_io_host.h
@@ -11,11 +11,11 @@
 #include "base/basictypes.h"
 #include "base/memory/weak_ptr.h"
 #include "content/public/renderer/renderer_ppapi_host.h"
+#include "content/renderer/pepper/plugin_delegate.h"
 #include "ppapi/host/host_message_context.h"
 #include "ppapi/host/resource_host.h"
 #include "ppapi/shared_impl/file_io_state_manager.h"
 #include "ppapi/thunk/ppb_file_ref_api.h"
-#include "webkit/plugins/ppapi/plugin_delegate.h"
 
 using ppapi::host::ReplyMessageContext;
 using webkit::ppapi::PluginDelegate;
diff --git a/content/renderer/pepper/pepper_file_system_host.cc b/content/renderer/pepper/pepper_file_system_host.cc
index 466fe8f..3e60dfe 100644
--- a/content/renderer/pepper/pepper_file_system_host.cc
+++ b/content/renderer/pepper/pepper_file_system_host.cc
@@ -10,6 +10,7 @@
 #include "content/child/fileapi/file_system_dispatcher.h"
 #include "content/public/renderer/render_view.h"
 #include "content/public/renderer/renderer_ppapi_host.h"
+#include "content/renderer/pepper/ppapi_plugin_instance_impl.h"
 #include "ppapi/c/pp_errors.h"
 #include "ppapi/host/dispatch_host_message.h"
 #include "ppapi/host/ppapi_host.h"
@@ -21,7 +22,6 @@
 #include "third_party/WebKit/public/web/WebPluginContainer.h"
 #include "third_party/WebKit/public/web/WebView.h"
 #include "webkit/common/fileapi/file_system_util.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
 
 namespace content {
 
@@ -126,7 +126,7 @@
       ChildThread::current()->file_system_dispatcher();
   reply_context_ = context->MakeReplyMessageContext();
   file_system_dispatcher->OpenFileSystem(
-      GURL(plugin_instance->container()->element().document().url()).
+      GURL(plugin_instance->GetContainer()->element().document().url()).
           GetOrigin(),
       file_system_type, expected_size, true /* create */,
       base::Bind(&PepperFileSystemHost::DidOpenFileSystem,
diff --git a/content/renderer/pepper/pepper_graphics_2d_host.cc b/content/renderer/pepper/pepper_graphics_2d_host.cc
index 6fc44c1..ca4d524 100644
--- a/content/renderer/pepper/pepper_graphics_2d_host.cc
+++ b/content/renderer/pepper/pepper_graphics_2d_host.cc
@@ -9,6 +9,11 @@
 #include "base/logging.h"
 #include "base/message_loop/message_loop.h"
 #include "content/public/renderer/renderer_ppapi_host.h"
+#include "content/renderer/pepper/common.h"
+#include "content/renderer/pepper/gfx_conversion.h"
+#include "content/renderer/pepper/ppapi_plugin_instance_impl.h"
+#include "content/renderer/pepper/ppb_image_data_impl.h"
+#include "content/renderer/pepper/resource_helper.h"
 #include "ppapi/c/pp_bool.h"
 #include "ppapi/c/pp_errors.h"
 #include "ppapi/c/pp_rect.h"
@@ -28,11 +33,6 @@
 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h"
 #include "ui/gfx/size_conversions.h"
 #include "ui/gfx/skia_util.h"
-#include "webkit/plugins/ppapi/common.h"
-#include "webkit/plugins/ppapi/gfx_conversion.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
-#include "webkit/plugins/ppapi/ppb_image_data_impl.h"
-#include "webkit/plugins/ppapi/resource_helper.h"
 
 #if defined(OS_MACOSX)
 #include "base/mac/mac_util.h"
@@ -296,7 +296,7 @@
 }
 
 bool PepperGraphics2DHost::BindToInstance(
-    webkit::ppapi::PluginInstance* new_instance) {
+    webkit::ppapi::PluginInstanceImpl* new_instance) {
   if (new_instance && new_instance->pp_instance() != pp_instance())
     return false;  // Can't bind other instance's contexts.
   if (bound_instance_ == new_instance)
diff --git a/content/renderer/pepper/pepper_graphics_2d_host.h b/content/renderer/pepper/pepper_graphics_2d_host.h
index e168368..a582f2e 100644
--- a/content/renderer/pepper/pepper_graphics_2d_host.h
+++ b/content/renderer/pepper/pepper_graphics_2d_host.h
@@ -11,11 +11,11 @@
 #include "base/compiler_specific.h"
 #include "base/memory/weak_ptr.h"
 #include "content/common/content_export.h"
+#include "content/renderer/pepper/plugin_delegate.h"
 #include "ppapi/c/ppb_graphics_2d.h"
 #include "ppapi/host/host_message_context.h"
 #include "ppapi/host/resource_host.h"
 #include "third_party/WebKit/public/platform/WebCanvas.h"
-#include "webkit/plugins/ppapi/plugin_delegate.h"
 
 namespace gfx {
 class Point;
@@ -25,7 +25,7 @@
 namespace webkit {
 namespace ppapi {
 class PPB_ImageData_Impl;
-class PluginInstance;
+class PluginInstanceImpl;
 }  // namespace ppapi
 }  // namespace webkit
 
@@ -58,7 +58,7 @@
   virtual bool ReadImageData(PP_Resource image,
                              const PP_Point* top_left) OVERRIDE;
   virtual bool BindToInstance(
-      webkit::ppapi::PluginInstance* new_instance) OVERRIDE;
+      webkit::ppapi::PluginInstanceImpl* new_instance) OVERRIDE;
   virtual void Paint(WebKit::WebCanvas* canvas,
                      const gfx::Rect& plugin_rect,
                      const gfx::Rect& paint_rect) OVERRIDE;
@@ -142,7 +142,7 @@
 
   // Non-owning pointer to the plugin instance this context is currently bound
   // to, if any. If the context is currently unbound, this will be NULL.
-  webkit::ppapi::PluginInstance* bound_instance_;
+  webkit::ppapi::PluginInstanceImpl* bound_instance_;
 
   // Keeps track of all drawing commands queued before a Flush call.
   struct QueuedOperation;
diff --git a/content/renderer/pepper/pepper_in_process_resource_creation.cc b/content/renderer/pepper/pepper_in_process_resource_creation.cc
index bcb7eb5..f9713c4 100644
--- a/content/renderer/pepper/pepper_in_process_resource_creation.cc
+++ b/content/renderer/pepper/pepper_in_process_resource_creation.cc
@@ -9,6 +9,7 @@
 #include "base/memory/weak_ptr.h"
 #include "base/message_loop/message_loop.h"
 #include "content/renderer/pepper/pepper_in_process_router.h"
+#include "content/renderer/pepper/ppapi_plugin_instance_impl.h"
 #include "content/renderer/pepper/renderer_ppapi_host_impl.h"
 #include "content/renderer/render_view_impl.h"
 #include "ipc/ipc_message.h"
@@ -30,7 +31,6 @@
 #include "ppapi/shared_impl/ppapi_permissions.h"
 #include "ppapi/shared_impl/resource_tracker.h"
 #include "ppapi/shared_impl/var.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
 
 // Note that the code in the creation functions in this file should generally
 // be the same as that in ppapi/proxy/resource_creation_proxy.cc. See
@@ -42,7 +42,7 @@
 
 PepperInProcessResourceCreation::PepperInProcessResourceCreation(
     RendererPpapiHostImpl* host_impl,
-    webkit::ppapi::PluginInstance* instance)
+    webkit::ppapi::PluginInstanceImpl* instance)
     : ResourceCreationImpl(instance),
       host_impl_(host_impl) {
 }
diff --git a/content/renderer/pepper/pepper_in_process_resource_creation.h b/content/renderer/pepper/pepper_in_process_resource_creation.h
index 330196f..72a5943 100644
--- a/content/renderer/pepper/pepper_in_process_resource_creation.h
+++ b/content/renderer/pepper/pepper_in_process_resource_creation.h
@@ -7,8 +7,8 @@
 
 #include "base/basictypes.h"
 #include "base/memory/scoped_ptr.h"
+#include "content/renderer/pepper/resource_creation_impl.h"
 #include "ppapi/proxy/connection.h"
-#include "webkit/plugins/ppapi/resource_creation_impl.h"
 
 namespace content {
 
@@ -20,7 +20,7 @@
 // (See pepper_in_process_router.h for more information.)
 //
 // This is a bit confusing. The "old-style" resources live in
-// webkit/plugins/ppapi and are created by the ResourceCreationImpl in that
+// content/renderer/pepper and are created by the ResourceCreationImpl in that
 // directory. The "new-style" IPC-only resources are in ppapi/proxy and are
 // created by the RessourceCreationProxy in that directory.
 //
@@ -38,7 +38,7 @@
     : public webkit::ppapi::ResourceCreationImpl {
  public:
   PepperInProcessResourceCreation(RendererPpapiHostImpl* host_impl,
-                                  webkit::ppapi::PluginInstance* instance);
+                                  webkit::ppapi::PluginInstanceImpl* instance);
   virtual ~PepperInProcessResourceCreation();
 
   // ResourceCreation_API implementation.
diff --git a/content/renderer/pepper/pepper_platform_audio_input_impl.h b/content/renderer/pepper/pepper_platform_audio_input_impl.h
index 975d921..c5b3fb0 100644
--- a/content/renderer/pepper/pepper_platform_audio_input_impl.h
+++ b/content/renderer/pepper/pepper_platform_audio_input_impl.h
@@ -12,9 +12,9 @@
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
+#include "content/renderer/pepper/plugin_delegate.h"
 #include "media/audio/audio_input_ipc.h"
 #include "media/audio/audio_parameters.h"
-#include "webkit/plugins/ppapi/plugin_delegate.h"
 
 class GURL;
 
diff --git a/content/renderer/pepper/pepper_platform_audio_output_impl.h b/content/renderer/pepper/pepper_platform_audio_output_impl.h
index 4382bf2..d13aa62 100644
--- a/content/renderer/pepper/pepper_platform_audio_output_impl.h
+++ b/content/renderer/pepper/pepper_platform_audio_output_impl.h
@@ -8,8 +8,8 @@
 #include "base/basictypes.h"
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
+#include "content/renderer/pepper/plugin_delegate.h"
 #include "media/audio/audio_output_ipc.h"
-#include "webkit/plugins/ppapi/plugin_delegate.h"
 
 namespace media {
 class AudioParameters;
diff --git a/content/renderer/pepper/pepper_platform_context_3d_impl.h b/content/renderer/pepper/pepper_platform_context_3d_impl.h
index 88496c2..c975453 100644
--- a/content/renderer/pepper/pepper_platform_context_3d_impl.h
+++ b/content/renderer/pepper/pepper_platform_context_3d_impl.h
@@ -10,8 +10,8 @@
 #include "base/memory/ref_counted.h"
 #include "base/memory/weak_ptr.h"
 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
+#include "content/renderer/pepper/plugin_delegate.h"
 #include "gpu/command_buffer/common/mailbox.h"
-#include "webkit/plugins/ppapi/plugin_delegate.h"
 
 #ifdef ENABLE_GPU
 
diff --git a/content/renderer/pepper/pepper_platform_image_2d_impl.h b/content/renderer/pepper/pepper_platform_image_2d_impl.h
index 099a428..5ad75e1 100644
--- a/content/renderer/pepper/pepper_platform_image_2d_impl.h
+++ b/content/renderer/pepper/pepper_platform_image_2d_impl.h
@@ -6,7 +6,7 @@
 #define CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_IMAGE_2D_IMPL_H_
 
 #include "base/basictypes.h"
-#include "webkit/plugins/ppapi/plugin_delegate.h"
+#include "content/renderer/pepper/plugin_delegate.h"
 
 namespace content {
 
diff --git a/content/renderer/pepper/pepper_platform_video_capture_impl.h b/content/renderer/pepper/pepper_platform_video_capture_impl.h
index 4e9c13b..58101e5 100644
--- a/content/renderer/pepper/pepper_platform_video_capture_impl.h
+++ b/content/renderer/pepper/pepper_platform_video_capture_impl.h
@@ -11,9 +11,9 @@
 #include "base/compiler_specific.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
+#include "content/renderer/pepper/plugin_delegate.h"
 #include "media/video/capture/video_capture.h"
 #include "media/video/capture/video_capture_types.h"
-#include "webkit/plugins/ppapi/plugin_delegate.h"
 
 class GURL;
 
diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.cc b/content/renderer/pepper/pepper_plugin_delegate_impl.cc
index bb9be65..9eaa2ab 100644
--- a/content/renderer/pepper/pepper_plugin_delegate_impl.cc
+++ b/content/renderer/pepper/pepper_plugin_delegate_impl.cc
@@ -28,7 +28,6 @@
 #include "content/common/gpu/client/context_provider_command_buffer.h"
 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
 #include "content/common/pepper_messages.h"
-#include "content/common/pepper_plugin_registry.h"
 #include "content/common/sandbox_util.h"
 #include "content/common/view_messages.h"
 #include "content/public/common/content_switches.h"
@@ -55,9 +54,16 @@
 #include "content/renderer/pepper/pepper_platform_context_3d_impl.h"
 #include "content/renderer/pepper/pepper_platform_image_2d_impl.h"
 #include "content/renderer/pepper/pepper_platform_video_capture_impl.h"
+#include "content/renderer/pepper/pepper_plugin_registry.h"
 #include "content/renderer/pepper/pepper_proxy_channel_delegate_impl.h"
 #include "content/renderer/pepper/pepper_url_loader_host.h"
+#include "content/renderer/pepper/plugin_module.h"
+#include "content/renderer/pepper/ppapi_plugin_instance_impl.h"
+#include "content/renderer/pepper/ppapi_webplugin_impl.h"
+#include "content/renderer/pepper/ppb_tcp_server_socket_private_impl.h"
+#include "content/renderer/pepper/ppb_tcp_socket_private_impl.h"
 #include "content/renderer/pepper/renderer_ppapi_host_impl.h"
+#include "content/renderer/pepper/resource_helper.h"
 #include "content/renderer/pepper/url_response_info_util.h"
 #include "content/renderer/render_thread_impl.h"
 #include "content/renderer/render_view_impl.h"
@@ -95,12 +101,6 @@
 #include "third_party/WebKit/public/web/WebView.h"
 #include "ui/gfx/size.h"
 #include "url/gurl.h"
-#include "webkit/plugins/ppapi/plugin_module.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
-#include "webkit/plugins/ppapi/ppapi_webplugin_impl.h"
-#include "webkit/plugins/ppapi/ppb_tcp_server_socket_private_impl.h"
-#include "webkit/plugins/ppapi/ppb_tcp_socket_private_impl.h"
-#include "webkit/plugins/ppapi/resource_helper.h"
 
 using WebKit::WebView;
 using WebKit::WebFrame;
@@ -182,8 +182,8 @@
           PepperRendererInstanceData(
               0,  // The render process id will be supplied in the browser.
               render_view->GetRoutingID(),
-              plugin_instance->container()->element().document().url(),
-              plugin_instance->plugin_url()),
+              plugin_instance->GetContainer()->element().document().url(),
+              plugin_instance->GetPluginURL()),
           is_external_));
     }
   }
@@ -247,7 +247,7 @@
 
 class PluginInstanceLockTarget : public MouseLockDispatcher::LockTarget {
  public:
-  PluginInstanceLockTarget(webkit::ppapi::PluginInstance* plugin)
+  PluginInstanceLockTarget(webkit::ppapi::PluginInstanceImpl* plugin)
       : plugin_(plugin) {}
 
   virtual void OnLockMouseACK(bool succeeded) OVERRIDE {
@@ -265,7 +265,7 @@
   }
 
  private:
-  webkit::ppapi::PluginInstance* plugin_;
+  webkit::ppapi::PluginInstanceImpl* plugin_;
 };
 
 void DoNotifyCloseFile(int file_open_id, base::PlatformFileError /* unused */) {
@@ -413,7 +413,6 @@
   // module's destructor will remove itself.
   module = new webkit::ppapi::PluginModule(
       info->name, path,
-      PepperPluginRegistry::GetInstance(),
       permissions);
   PepperPluginRegistry::GetInstance()->AddLiveModule(path, module.get());
 
@@ -530,7 +529,7 @@
   // Notify all of our instances that we started painting. This is used for
   // internal bookkeeping only, so we know that the set can not change under
   // us.
-  for (std::set<webkit::ppapi::PluginInstance*>::iterator i =
+  for (std::set<webkit::ppapi::PluginInstanceImpl*>::iterator i =
            active_instances_.begin();
        i != active_instances_.end(); ++i)
     (*i)->ViewWillInitiatePaint();
@@ -540,8 +539,9 @@
   // Notify all instances that we painted.  The same caveats apply as for
   // ViewFlushedPaint regarding instances closing themselves, so we take
   // similar precautions.
-  std::set<webkit::ppapi::PluginInstance*> plugins = active_instances_;
-  for (std::set<webkit::ppapi::PluginInstance*>::iterator i = plugins.begin();
+  std::set<webkit::ppapi::PluginInstanceImpl*> plugins = active_instances_;
+  for (std::set<webkit::ppapi::PluginInstanceImpl*>::iterator i =
+          plugins.begin();
        i != plugins.end(); ++i) {
     if (active_instances_.find(*i) != active_instances_.end())
       (*i)->ViewInitiatedPaint();
@@ -553,8 +553,9 @@
   // we it may ask to close itself as a result. This will, in turn, modify our
   // set, possibly invalidating the iterator. So we iterate on a copy that
   // won't change out from under us.
-  std::set<webkit::ppapi::PluginInstance*> plugins = active_instances_;
-  for (std::set<webkit::ppapi::PluginInstance*>::iterator i = plugins.begin();
+  std::set<webkit::ppapi::PluginInstanceImpl*> plugins = active_instances_;
+  for (std::set<webkit::ppapi::PluginInstanceImpl*>::iterator i =
+           plugins.begin();
        i != plugins.end(); ++i) {
     // The copy above makes sure our iterator is never invalid if some plugins
     // are destroyed. But some plugin may decide to close all of its views in
@@ -577,17 +578,17 @@
   }
 }
 
-webkit::ppapi::PluginInstance*
+webkit::ppapi::PluginInstanceImpl*
 PepperPluginDelegateImpl::GetBitmapForOptimizedPluginPaint(
     const gfx::Rect& paint_bounds,
     TransportDIB** dib,
     gfx::Rect* location,
     gfx::Rect* clip,
     float* scale_factor) {
-  for (std::set<webkit::ppapi::PluginInstance*>::iterator i =
+  for (std::set<webkit::ppapi::PluginInstanceImpl*>::iterator i =
            active_instances_.begin();
        i != active_instances_.end(); ++i) {
-    webkit::ppapi::PluginInstance* instance = *i;
+    webkit::ppapi::PluginInstanceImpl* instance = *i;
     // In Flash fullscreen , the plugin contents should be painted onto the
     // fullscreen widget instead of the web page.
     if (!instance->FlashIsFullscreenOrPending() &&
@@ -599,7 +600,7 @@
 }
 
 void PepperPluginDelegateImpl::PluginFocusChanged(
-    webkit::ppapi::PluginInstance* instance,
+    webkit::ppapi::PluginInstanceImpl* instance,
     bool focused) {
   if (focused)
     focused_plugin_ = instance;
@@ -610,25 +611,25 @@
 }
 
 void PepperPluginDelegateImpl::PluginTextInputTypeChanged(
-    webkit::ppapi::PluginInstance* instance) {
+    webkit::ppapi::PluginInstanceImpl* instance) {
   if (focused_plugin_ == instance && render_view_)
     render_view_->PpapiPluginTextInputTypeChanged();
 }
 
 void PepperPluginDelegateImpl::PluginCaretPositionChanged(
-    webkit::ppapi::PluginInstance* instance) {
+    webkit::ppapi::PluginInstanceImpl* instance) {
   if (focused_plugin_ == instance && render_view_)
     render_view_->PpapiPluginCaretPositionChanged();
 }
 
 void PepperPluginDelegateImpl::PluginRequestedCancelComposition(
-    webkit::ppapi::PluginInstance* instance) {
+    webkit::ppapi::PluginInstanceImpl* instance) {
   if (focused_plugin_ == instance && render_view_)
     render_view_->PpapiPluginCancelComposition();
 }
 
 void PepperPluginDelegateImpl::PluginSelectionChanged(
-    webkit::ppapi::PluginInstance* instance) {
+    webkit::ppapi::PluginInstanceImpl* instance) {
   if (focused_plugin_ == instance && render_view_)
     render_view_->PpapiPluginSelectionChanged();
 }
@@ -739,14 +740,14 @@
 }
 
 void PepperPluginDelegateImpl::PluginCrashed(
-    webkit::ppapi::PluginInstance* instance) {
+    webkit::ppapi::PluginInstanceImpl* instance) {
   render_view_->PluginCrashed(instance->module()->path(),
                               instance->module()->GetPeerProcessId());
   UnSetAndDeleteLockTargetAdapter(instance);
 }
 
 void PepperPluginDelegateImpl::InstanceCreated(
-    webkit::ppapi::PluginInstance* instance) {
+    webkit::ppapi::PluginInstanceImpl* instance) {
   active_instances_.insert(instance);
 
   // Set the initial focus.
@@ -754,7 +755,7 @@
 }
 
 void PepperPluginDelegateImpl::InstanceDeleted(
-    webkit::ppapi::PluginInstance* instance) {
+    webkit::ppapi::PluginInstanceImpl* instance) {
   active_instances_.erase(instance);
   UnSetAndDeleteLockTargetAdapter(instance);
 
@@ -766,7 +767,7 @@
 
 scoped_ptr< ::ppapi::thunk::ResourceCreationAPI>
 PepperPluginDelegateImpl::CreateResourceCreationAPI(
-    webkit::ppapi::PluginInstance* instance) {
+    webkit::ppapi::PluginInstanceImpl* instance) {
   RendererPpapiHostImpl* host_impl = static_cast<RendererPpapiHostImpl*>(
       instance->module()->GetEmbedderState());
   return host_impl->CreateInProcessResourceCreationAPI(instance);
@@ -789,7 +790,7 @@
 
 webkit::ppapi::PluginDelegate::PlatformGraphics2D*
 PepperPluginDelegateImpl::GetGraphics2D(
-    webkit::ppapi::PluginInstance* instance,
+    webkit::ppapi::PluginInstanceImpl* instance,
     PP_Resource resource) {
   ppapi::host::ResourceHost* host =
       GetRendererResourceHost(instance->pp_instance(), resource);
@@ -958,14 +959,14 @@
 }
 
 void PepperPluginDelegateImpl::OnSetFocus(bool has_focus) {
-  for (std::set<webkit::ppapi::PluginInstance*>::iterator i =
+  for (std::set<webkit::ppapi::PluginInstanceImpl*>::iterator i =
            active_instances_.begin();
        i != active_instances_.end(); ++i)
     (*i)->SetContentAreaFocus(has_focus);
 }
 
 void PepperPluginDelegateImpl::PageVisibilityChanged(bool is_visible) {
-  for (std::set<webkit::ppapi::PluginInstance*>::iterator i =
+  for (std::set<webkit::ppapi::PluginInstanceImpl*>::iterator i =
            active_instances_.begin();
        i != active_instances_.end(); ++i)
     (*i)->PageVisibilityChanged(is_visible);
@@ -1266,7 +1267,7 @@
 
 webkit::ppapi::FullscreenContainer*
 PepperPluginDelegateImpl::CreateFullscreenContainer(
-    webkit::ppapi::PluginInstance* instance) {
+    webkit::ppapi::PluginInstanceImpl* instance) {
   return render_view_->CreatePepperFullscreenContainer(instance);
 }
 
@@ -1287,7 +1288,7 @@
 }
 
 void PepperPluginDelegateImpl::HandleDocumentLoad(
-    webkit::ppapi::PluginInstance* instance,
+    webkit::ppapi::PluginInstanceImpl* instance,
     const WebKit::WebURLResponse& response) {
   DCHECK(!instance->document_loader());
 
@@ -1372,25 +1373,25 @@
 }
 
 bool PepperPluginDelegateImpl::LockMouse(
-    webkit::ppapi::PluginInstance* instance) {
+    webkit::ppapi::PluginInstanceImpl* instance) {
   return GetMouseLockDispatcher(instance)->LockMouse(
       GetOrCreateLockTargetAdapter(instance));
 }
 
 void PepperPluginDelegateImpl::UnlockMouse(
-    webkit::ppapi::PluginInstance* instance) {
+    webkit::ppapi::PluginInstanceImpl* instance) {
   GetMouseLockDispatcher(instance)->UnlockMouse(
       GetOrCreateLockTargetAdapter(instance));
 }
 
 bool PepperPluginDelegateImpl::IsMouseLocked(
-    webkit::ppapi::PluginInstance* instance) {
+    webkit::ppapi::PluginInstanceImpl* instance) {
   return GetMouseLockDispatcher(instance)->IsMouseLockedTo(
       GetOrCreateLockTargetAdapter(instance));
 }
 
 void PepperPluginDelegateImpl::DidChangeCursor(
-    webkit::ppapi::PluginInstance* instance,
+    webkit::ppapi::PluginInstanceImpl* instance,
     const WebKit::WebCursorInfo& cursor) {
   // Update the cursor appearance immediately if the requesting plugin is the
   // one which receives the last mouse event. Otherwise, the new cursor won't be
@@ -1402,7 +1403,7 @@
 }
 
 void PepperPluginDelegateImpl::DidReceiveMouseEvent(
-    webkit::ppapi::PluginInstance* instance) {
+    webkit::ppapi::PluginInstanceImpl* instance) {
   last_mouse_event_target_ = instance;
 }
 
@@ -1648,7 +1649,7 @@
 
 MouseLockDispatcher::LockTarget*
     PepperPluginDelegateImpl::GetOrCreateLockTargetAdapter(
-    webkit::ppapi::PluginInstance* instance) {
+    webkit::ppapi::PluginInstanceImpl* instance) {
   MouseLockDispatcher::LockTarget* target = mouse_lock_instances_[instance];
   if (target)
     return target;
@@ -1658,7 +1659,7 @@
 }
 
 void PepperPluginDelegateImpl::UnSetAndDeleteLockTargetAdapter(
-    webkit::ppapi::PluginInstance* instance) {
+    webkit::ppapi::PluginInstanceImpl* instance) {
   LockTargetMap::iterator it = mouse_lock_instances_.find(instance);
   if (it != mouse_lock_instances_.end()) {
     MouseLockDispatcher::LockTarget* target = it->second;
@@ -1669,7 +1670,7 @@
 }
 
 MouseLockDispatcher* PepperPluginDelegateImpl::GetMouseLockDispatcher(
-    webkit::ppapi::PluginInstance* instance) {
+    webkit::ppapi::PluginInstanceImpl* instance) {
   if (instance->flash_fullscreen()) {
     RenderWidgetFullscreenPepper* container =
         static_cast<RenderWidgetFullscreenPepper*>(
diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.h b/content/renderer/pepper/pepper_plugin_delegate_impl.h
index 0489f87..5a0f977 100644
--- a/content/renderer/pepper/pepper_plugin_delegate_impl.h
+++ b/content/renderer/pepper/pepper_plugin_delegate_impl.h
@@ -19,12 +19,12 @@
 #include "content/public/renderer/render_view_observer.h"
 #include "content/renderer/mouse_lock_dispatcher.h"
 #include "content/renderer/pepper/pepper_browser_connection.h"
+#include "content/renderer/pepper/plugin_delegate.h"
 #include "content/renderer/render_view_pepper_helper.h"
 #include "ppapi/c/pp_file_info.h"
 #include "ppapi/shared_impl/private/ppb_tcp_server_socket_shared.h"
 #include "ppapi/shared_impl/private/tcp_socket_private_impl.h"
 #include "ui/base/ime/text_input_type.h"
-#include "webkit/plugins/ppapi/plugin_delegate.h"
 
 namespace base {
 class FilePath;
@@ -37,7 +37,6 @@
 
 namespace webkit {
 namespace ppapi {
-class PluginInstance;
 class PluginModule;
 }
 }
@@ -104,7 +103,7 @@
   virtual void ViewWillInitiatePaint() OVERRIDE;
   virtual void ViewInitiatedPaint() OVERRIDE;
   virtual void ViewFlushedPaint() OVERRIDE;
-  virtual webkit::ppapi::PluginInstance* GetBitmapForOptimizedPluginPaint(
+  virtual webkit::ppapi::PluginInstanceImpl* GetBitmapForOptimizedPluginPaint(
       const gfx::Rect& paint_bounds,
       TransportDIB** dib,
       gfx::Rect* location,
@@ -137,30 +136,31 @@
   virtual void WillHandleMouseEvent() OVERRIDE;
 
   // PluginDelegate implementation.
-  virtual void PluginFocusChanged(webkit::ppapi::PluginInstance* instance,
+  virtual void PluginFocusChanged(webkit::ppapi::PluginInstanceImpl* instance,
                                   bool focused) OVERRIDE;
   virtual void PluginTextInputTypeChanged(
-      webkit::ppapi::PluginInstance* instance) OVERRIDE;
+      webkit::ppapi::PluginInstanceImpl* instance) OVERRIDE;
   virtual void PluginCaretPositionChanged(
-      webkit::ppapi::PluginInstance* instance) OVERRIDE;
+      webkit::ppapi::PluginInstanceImpl* instance) OVERRIDE;
   virtual void PluginRequestedCancelComposition(
-      webkit::ppapi::PluginInstance* instance) OVERRIDE;
+      webkit::ppapi::PluginInstanceImpl* instance) OVERRIDE;
   virtual void PluginSelectionChanged(
-      webkit::ppapi::PluginInstance* instance) OVERRIDE;
+      webkit::ppapi::PluginInstanceImpl* instance) OVERRIDE;
   virtual void SimulateImeSetComposition(
       const string16& text,
       const std::vector<WebKit::WebCompositionUnderline>& underlines,
       int selection_start,
       int selection_end) OVERRIDE;
   virtual void SimulateImeConfirmComposition(const string16& text) OVERRIDE;
-  virtual void PluginCrashed(webkit::ppapi::PluginInstance* instance) OVERRIDE;
+  virtual void PluginCrashed(
+      webkit::ppapi::PluginInstanceImpl* instance) OVERRIDE;
   virtual void InstanceCreated(
-      webkit::ppapi::PluginInstance* instance) OVERRIDE;
+      webkit::ppapi::PluginInstanceImpl* instance) OVERRIDE;
   virtual void InstanceDeleted(
-      webkit::ppapi::PluginInstance* instance) OVERRIDE;
+      webkit::ppapi::PluginInstanceImpl* instance) OVERRIDE;
   virtual scoped_ptr< ::ppapi::thunk::ResourceCreationAPI>
       CreateResourceCreationAPI(
-          webkit::ppapi::PluginInstance* instance) OVERRIDE;
+          webkit::ppapi::PluginInstanceImpl* instance) OVERRIDE;
   virtual SkBitmap* GetSadPluginBitmap() OVERRIDE;
   virtual WebKit::WebPlugin* CreatePluginReplacement(
       const base::FilePath& file_path) OVERRIDE;
@@ -178,7 +178,7 @@
       PlatformAudioInputClient* client) OVERRIDE;
   virtual PlatformImage2D* CreateImage2D(int width, int height) OVERRIDE;
   virtual PlatformGraphics2D* GetGraphics2D(
-      webkit::ppapi::PluginInstance* instance,
+      webkit::ppapi::PluginInstanceImpl* instance,
       PP_Resource resource) OVERRIDE;
   virtual PlatformContext3D* CreateContext3D() OVERRIDE;
   virtual PlatformVideoCapture* CreateVideoCapture(
@@ -295,7 +295,7 @@
       ppapi::PPB_X509Certificate_Fields* fields) OVERRIDE;
   virtual webkit::ppapi::FullscreenContainer*
       CreateFullscreenContainer(
-          webkit::ppapi::PluginInstance* instance) OVERRIDE;
+          webkit::ppapi::PluginInstanceImpl* instance) OVERRIDE;
   virtual gfx::Size GetScreenSize() OVERRIDE;
   virtual std::string GetDefaultEncoding() OVERRIDE;
   virtual void ZoomLimitsChanged(double minimum_factor, double maximum_factor)
@@ -303,13 +303,15 @@
   virtual base::SharedMemory* CreateAnonymousSharedMemory(size_t size)
       OVERRIDE;
   virtual ::ppapi::Preferences GetPreferences() OVERRIDE;
-  virtual bool LockMouse(webkit::ppapi::PluginInstance* instance) OVERRIDE;
-  virtual void UnlockMouse(webkit::ppapi::PluginInstance* instance) OVERRIDE;
-  virtual bool IsMouseLocked(webkit::ppapi::PluginInstance* instance) OVERRIDE;
-  virtual void DidChangeCursor(webkit::ppapi::PluginInstance* instance,
+  virtual bool LockMouse(webkit::ppapi::PluginInstanceImpl* instance) OVERRIDE;
+  virtual void UnlockMouse(
+      webkit::ppapi::PluginInstanceImpl* instance) OVERRIDE;
+  virtual bool IsMouseLocked(
+      webkit::ppapi::PluginInstanceImpl* instance) OVERRIDE;
+  virtual void DidChangeCursor(webkit::ppapi::PluginInstanceImpl* instance,
                                const WebKit::WebCursorInfo& cursor) OVERRIDE;
   virtual void DidReceiveMouseEvent(
-      webkit::ppapi::PluginInstance* instance) OVERRIDE;
+      webkit::ppapi::PluginInstanceImpl* instance) OVERRIDE;
   virtual bool IsInFullscreenMode() OVERRIDE;
   virtual void SampleGamepads(WebKit::WebGamepads* data) OVERRIDE;
   virtual bool IsPageVisible() const OVERRIDE;
@@ -318,7 +320,7 @@
       const EnumerateDevicesCallback& callback) OVERRIDE;
   virtual void StopEnumerateDevices(int request_id) OVERRIDE;
   virtual void HandleDocumentLoad(
-      webkit::ppapi::PluginInstance* instance,
+      webkit::ppapi::PluginInstanceImpl* instance,
       const WebKit::WebURLResponse& response) OVERRIDE;
   virtual content::RendererPpapiHost* CreateExternalPluginModule(
       scoped_refptr<webkit::ppapi::PluginModule> module,
@@ -392,11 +394,12 @@
       bool is_external);
 
   MouseLockDispatcher::LockTarget* GetOrCreateLockTargetAdapter(
-      webkit::ppapi::PluginInstance* instance);
-  void UnSetAndDeleteLockTargetAdapter(webkit::ppapi::PluginInstance* instance);
+      webkit::ppapi::PluginInstanceImpl* instance);
+  void UnSetAndDeleteLockTargetAdapter(
+      webkit::ppapi::PluginInstanceImpl* instance);
 
   MouseLockDispatcher* GetMouseLockDispatcher(
-      webkit::ppapi::PluginInstance* instance);
+      webkit::ppapi::PluginInstanceImpl* instance);
 
   // Share a given handle with the target process.
   virtual IPC::PlatformFileForTransit ShareHandleWithRemote(
@@ -413,8 +416,8 @@
   // the browser.
   PepperBrowserConnection pepper_browser_connection_;
 
-  std::set<webkit::ppapi::PluginInstance*> active_instances_;
-  typedef std::map<webkit::ppapi::PluginInstance*,
+  std::set<webkit::ppapi::PluginInstanceImpl*> active_instances_;
+  typedef std::map<webkit::ppapi::PluginInstanceImpl*,
                    MouseLockDispatcher::LockTarget*> LockTargetMap;
   LockTargetMap mouse_lock_instances_;
 
@@ -432,7 +435,7 @@
   PermissionRequestMap pending_permission_requests_;
 
   // Whether or not the focus is on a PPAPI plugin
-  webkit::ppapi::PluginInstance* focused_plugin_;
+  webkit::ppapi::PluginInstanceImpl* focused_plugin_;
 
   // Current text input composition text. Empty if no composition is in
   // progress.
@@ -442,7 +445,7 @@
   // if the last mouse event went to elements other than Pepper plugins.
   // |last_mouse_event_target_| is not owned by this class. We can know about
   // when it is destroyed via InstanceDeleted().
-  webkit::ppapi::PluginInstance* last_mouse_event_target_;
+  webkit::ppapi::PluginInstanceImpl* last_mouse_event_target_;
 
   scoped_ptr<GamepadSharedMemoryReader> gamepad_shared_memory_reader_;
 
diff --git a/content/renderer/pepper/pepper_plugin_registry.cc b/content/renderer/pepper/pepper_plugin_registry.cc
new file mode 100644
index 0000000..96634d1
--- /dev/null
+++ b/content/renderer/pepper/pepper_plugin_registry.cc
@@ -0,0 +1,115 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/renderer/pepper/pepper_plugin_registry.h"
+
+#include "base/logging.h"
+#include "content/common/pepper_plugin_list.h"
+#include "content/renderer/pepper/plugin_module.h"
+#include "ppapi/shared_impl/ppapi_permissions.h"
+
+namespace content {
+
+// static
+PepperPluginRegistry* PepperPluginRegistry::GetInstance() {
+  static PepperPluginRegistry* registry = NULL;
+  // This object leaks.  It is a temporary hack to work around a crash.
+  // http://code.google.com/p/chromium/issues/detail?id=63234
+  if (!registry)
+    registry = new PepperPluginRegistry;
+  return registry;
+}
+
+const PepperPluginInfo* PepperPluginRegistry::GetInfoForPlugin(
+    const WebPluginInfo& info) {
+  for (size_t i = 0; i < plugin_list_.size(); ++i) {
+    if (info.path == plugin_list_[i].path)
+      return &plugin_list_[i];
+  }
+  // We did not find the plugin in our list. But wait! the plugin can also
+  // be a latecomer, as it happens with pepper flash. This information
+  // is actually in |info| and we can use it to construct it and add it to
+  // the list. This same deal needs to be done in the browser side in
+  // PluginService.
+  PepperPluginInfo plugin;
+  if (!MakePepperPluginInfo(info, &plugin))
+    return NULL;
+
+  plugin_list_.push_back(plugin);
+  return &plugin_list_[plugin_list_.size() - 1];
+}
+
+webkit::ppapi::PluginModule* PepperPluginRegistry::GetLiveModule(
+    const base::FilePath& path) {
+  NonOwningModuleMap::iterator it = live_modules_.find(path);
+  if (it == live_modules_.end())
+    return NULL;
+  return it->second;
+}
+
+void PepperPluginRegistry::AddLiveModule(const base::FilePath& path,
+                                         webkit::ppapi::PluginModule* module) {
+  DCHECK(live_modules_.find(path) == live_modules_.end());
+  live_modules_[path] = module;
+}
+
+void PepperPluginRegistry::PluginModuleDead(
+    webkit::ppapi::PluginModule* dead_module) {
+  // DANGER: Don't dereference the dead_module pointer! It may be in the
+  // process of being deleted.
+
+  // Modules aren't destroyed very often and there are normally at most a
+  // couple of them. So for now we just do a brute-force search.
+  for (NonOwningModuleMap::iterator i = live_modules_.begin();
+       i != live_modules_.end(); ++i) {
+    if (i->second == dead_module) {
+      live_modules_.erase(i);
+      return;
+    }
+  }
+  // Can occur in tests.
+}
+
+PepperPluginRegistry::~PepperPluginRegistry() {
+  // Explicitly clear all preloaded modules first. This will cause callbacks
+  // to erase these modules from the live_modules_ list, and we don't want
+  // that to happen implicitly out-of-order.
+  preloaded_modules_.clear();
+
+  DCHECK(live_modules_.empty());
+}
+
+PepperPluginRegistry::PepperPluginRegistry() {
+  ComputePepperPluginList(&plugin_list_);
+
+  // Note that in each case, AddLiveModule must be called before completing
+  // initialization. If we bail out (in the continue clauses) before saving
+  // the initialized module, it will still try to unregister itself in its
+  // destructor.
+  for (size_t i = 0; i < plugin_list_.size(); i++) {
+    const PepperPluginInfo& current = plugin_list_[i];
+    if (current.is_out_of_process)
+      continue;  // Out of process plugins need no special pre-initialization.
+
+    scoped_refptr<webkit::ppapi::PluginModule> module =
+        new webkit::ppapi::PluginModule(current.name, current.path,
+            ppapi::PpapiPermissions(current.permissions));
+    AddLiveModule(current.path, module.get());
+    if (current.is_internal) {
+      if (!module->InitAsInternalPlugin(current.internal_entry_points)) {
+        DLOG(ERROR) << "Failed to load pepper module: " << current.path.value();
+        continue;
+      }
+    } else {
+      // Preload all external plugins we're not running out of process.
+      if (!module->InitAsLibrary(current.path)) {
+        DLOG(ERROR) << "Failed to load pepper module: " << current.path.value();
+        continue;
+      }
+    }
+    preloaded_modules_[current.path] = module;
+  }
+}
+
+}  // namespace content
diff --git a/content/common/pepper_plugin_registry.h b/content/renderer/pepper/pepper_plugin_registry.h
similarity index 65%
rename from content/common/pepper_plugin_registry.h
rename to content/renderer/pepper/pepper_plugin_registry.h
index b40f00b..ee8fd7c 100644
--- a/content/common/pepper_plugin_registry.h
+++ b/content/renderer/pepper/pepper_plugin_registry.h
@@ -2,49 +2,34 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef CONTENT_COMMON_PEPPER_PLUGIN_REGISTRY_H_
-#define CONTENT_COMMON_PEPPER_PLUGIN_REGISTRY_H_
+#ifndef CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_REGISTRY_H_
+#define CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_REGISTRY_H_
 
 #include <list>
 #include <map>
 
+#include "base/memory/ref_counted.h"
 #include "content/public/common/pepper_plugin_info.h"
-#include "webkit/plugins/ppapi/plugin_delegate.h"
+
+namespace webkit {
+namespace ppapi {
+class PluginModule;
+}
+}
 
 namespace content {
 
-// Constructs a PepperPluginInfo from a WebPluginInfo. Returns false if
-// the operation is not possible, in particular the WebPluginInfo::type
-// must be one of the pepper types.
-bool MakePepperPluginInfo(const WebPluginInfo& webplugin_info,
-                          PepperPluginInfo* pepper_info);
-
 // This class holds references to all of the known pepper plugin modules.
 //
 // It keeps two lists. One list of preloaded in-process modules, and one list
 // is a list of all live modules (some of which may be out-of-process and hence
 // not preloaded).
-class PepperPluginRegistry
-    : public webkit::ppapi::PluginDelegate::ModuleLifetime {
+class PepperPluginRegistry {
  public:
   ~PepperPluginRegistry();
 
   static PepperPluginRegistry* GetInstance();
 
-  // Computes the list of known pepper plugins.
-  //
-  // This method is static so that it can be used by the browser process, which
-  // has no need to load the pepper plugin modules. It will re-compute the
-  // plugin list every time it is called. Generally, code in the registry should
-  // be using the cached plugin_list_ instead.
-  CONTENT_EXPORT static void ComputeList(
-      std::vector<PepperPluginInfo>* plugins);
-
-  // Loads the (native) libraries but does not initialize them (i.e., does not
-  // call PPP_InitializeModule). This is needed by the zygote on Linux to get
-  // access to the plugins before entering the sandbox.
-  static void PreloadModules();
-
   // Retrieves the information associated with the given plugin info. The
   // return value will be NULL if there is no such plugin.
   //
@@ -64,9 +49,7 @@
   void AddLiveModule(const base::FilePath& path,
                      webkit::ppapi::PluginModule* module);
 
-  // ModuleLifetime implementation.
-  virtual void PluginModuleDead(
-      webkit::ppapi::PluginModule* dead_module) OVERRIDE;
+  void PluginModuleDead(webkit::ppapi::PluginModule* dead_module);
 
  private:
   PepperPluginRegistry();
@@ -96,4 +79,4 @@
 
 }  // namespace content
 
-#endif  // CONTENT_COMMON_PEPPER_PLUGIN_REGISTRY_H_
+#endif  // CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_REGISTRY_H_
diff --git a/content/renderer/pepper/pepper_url_loader_host.cc b/content/renderer/pepper/pepper_url_loader_host.cc
index 247e57e..3087ebc 100644
--- a/content/renderer/pepper/pepper_url_loader_host.cc
+++ b/content/renderer/pepper/pepper_url_loader_host.cc
@@ -4,7 +4,9 @@
 
 #include "content/renderer/pepper/pepper_url_loader_host.h"
 
-#include "content/public/renderer/renderer_ppapi_host.h"
+#include "content/renderer/pepper/ppapi_plugin_instance_impl.h"
+#include "content/renderer/pepper/renderer_ppapi_host_impl.h"
+#include "content/renderer/pepper/url_request_info_util.h"
 #include "content/renderer/pepper/url_response_info_util.h"
 #include "net/base/net_errors.h"
 #include "ppapi/c/pp_errors.h"
@@ -24,8 +26,6 @@
 #include "third_party/WebKit/public/web/WebPluginContainer.h"
 #include "third_party/WebKit/public/web/WebSecurityOrigin.h"
 #include "third_party/WebKit/public/web/WebURLLoaderOptions.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
-#include "webkit/plugins/ppapi/url_request_info_util.h"
 
 using WebKit::WebFrame;
 using WebKit::WebString;
@@ -43,7 +43,7 @@
 
 namespace content {
 
-PepperURLLoaderHost::PepperURLLoaderHost(RendererPpapiHost* host,
+PepperURLLoaderHost::PepperURLLoaderHost(RendererPpapiHostImpl* host,
                                          bool main_document_loader,
                                          PP_Instance instance,
                                          PP_Resource resource)
@@ -83,8 +83,8 @@
   // will get queued inside WebKit.
   if (main_document_loader_) {
     // The PluginInstance has a non-owning pointer to us.
-    webkit::ppapi::PluginInstance* instance_object =
-        renderer_ppapi_host_->GetPluginInstance(pp_instance());
+    webkit::ppapi::PluginInstanceImpl* instance_object =
+        renderer_ppapi_host_->GetPluginInstanceImpl(pp_instance());
     if (instance_object) {
       DCHECK(instance_object->document_loader() == this);
       instance_object->set_document_loader(NULL);
@@ -335,7 +335,7 @@
       renderer_ppapi_host_->GetPluginInstance(pp_instance());
   if (!instance_object)
     return NULL;
-  return instance_object->container()->element().document().frame();
+  return instance_object->GetContainer()->element().document().frame();
 }
 
 void PepperURLLoaderHost::SetDefersLoading(bool defers_loading) {
diff --git a/content/renderer/pepper/pepper_url_loader_host.h b/content/renderer/pepper/pepper_url_loader_host.h
index 88a8e26..c97c496 100644
--- a/content/renderer/pepper/pepper_url_loader_host.h
+++ b/content/renderer/pepper/pepper_url_loader_host.h
@@ -21,7 +21,7 @@
 
 namespace content {
 
-class RendererPpapiHost;
+class RendererPpapiHostImpl;
 
 class PepperURLLoaderHost
     : public ppapi::host::ResourceHost,
@@ -29,7 +29,7 @@
  public:
   // If main_document_loader is true, PP_Resource must be 0 since it will be
   // pending until the plugin resource attaches to it.
-  PepperURLLoaderHost(RendererPpapiHost* host,
+  PepperURLLoaderHost(RendererPpapiHostImpl* host,
                       bool main_document_loader,
                       PP_Instance instance,
                       PP_Resource resource);
@@ -99,7 +99,7 @@
   void UpdateProgress();
 
   // Non-owning pointer.
-  RendererPpapiHost* renderer_ppapi_host_;
+  RendererPpapiHostImpl* renderer_ppapi_host_;
 
   // If true, then the plugin instance is a full-frame plugin and we're just
   // wrapping the main document's loader (i.e. loader_ is null).
diff --git a/content/renderer/pepper/pepper_url_request_unittest.cc b/content/renderer/pepper/pepper_url_request_unittest.cc
index a242cee..08cae5a 100644
--- a/content/renderer/pepper/pepper_url_request_unittest.cc
+++ b/content/renderer/pepper/pepper_url_request_unittest.cc
@@ -4,6 +4,7 @@
 
 #include "base/compiler_specific.h"
 #include "content/public/test/render_view_test.h"
+#include "content/renderer/pepper/url_request_info_util.h"
 #include "ppapi/proxy/connection.h"
 #include "ppapi/proxy/url_request_info_resource.h"
 #include "ppapi/shared_impl/test_globals.h"
@@ -16,7 +17,6 @@
 #include "third_party/WebKit/public/web/WebView.h"
 #include "webkit/common/user_agent/user_agent.h"
 #include "webkit/common/user_agent/user_agent_util.h"
-#include "webkit/plugins/ppapi/url_request_info_util.h"
 
 // This test is a end-to-end test from the resource to the WebKit request
 // object. The actual resource implementation is so simple, it makes sense to
@@ -51,9 +51,6 @@
 using ppapi::proxy::URLRequestInfoResource;
 using ppapi::URLRequestInfoData;
 
-// TODO(brettw) move to content namespace when url_request_info_util.h is moved
-// to this directory. This file used to be in webkit/plugins/ppapi and had to
-// be moved in advance of the rest of the files to make things compile.
 namespace webkit {
 namespace ppapi {
 
diff --git a/content/renderer/pepper/pepper_video_capture_host.cc b/content/renderer/pepper/pepper_video_capture_host.cc
index b49721a..cef1e88 100644
--- a/content/renderer/pepper/pepper_video_capture_host.cc
+++ b/content/renderer/pepper/pepper_video_capture_host.cc
@@ -4,6 +4,9 @@
 
 #include "content/renderer/pepper/pepper_video_capture_host.h"
 
+#include "content/renderer/pepper/host_globals.h"
+#include "content/renderer/pepper/ppapi_plugin_instance_impl.h"
+#include "content/renderer/pepper/renderer_ppapi_host_impl.h"
 #include "ppapi/host/dispatch_host_message.h"
 #include "ppapi/host/ppapi_host.h"
 #include "ppapi/proxy/host_dispatcher.h"
@@ -14,8 +17,6 @@
 #include "third_party/WebKit/public/web/WebDocument.h"
 #include "third_party/WebKit/public/web/WebElement.h"
 #include "third_party/WebKit/public/web/WebPluginContainer.h"
-#include "webkit/plugins/ppapi/host_globals.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
 
 using ppapi::HostResource;
 using ppapi::TrackedCallback;
@@ -33,7 +34,7 @@
 
 namespace content {
 
-PepperVideoCaptureHost::PepperVideoCaptureHost(RendererPpapiHost* host,
+PepperVideoCaptureHost::PepperVideoCaptureHost(RendererPpapiHostImpl* host,
                                                PP_Instance instance,
                                                PP_Resource resource)
     : ResourceHost(host->GetPpapiHost(), instance, resource),
@@ -241,8 +242,8 @@
 }
 
 webkit::ppapi::PluginDelegate* PepperVideoCaptureHost::GetPluginDelegate() {
-  webkit::ppapi::PluginInstance* instance =
-      renderer_ppapi_host_->GetPluginInstance(pp_instance());
+  webkit::ppapi::PluginInstanceImpl* instance =
+      renderer_ppapi_host_->GetPluginInstanceImpl(pp_instance());
   if (instance)
     return instance->delegate();
   return NULL;
@@ -269,7 +270,7 @@
 
   platform_video_capture_ =
       plugin_delegate->CreateVideoCapture(device_id,
-          instance->container()->element().document().url(), this);
+          instance->GetContainer()->element().document().url(), this);
 
   open_reply_context_ = context->MakeReplyMessageContext();
 
diff --git a/content/renderer/pepper/pepper_video_capture_host.h b/content/renderer/pepper/pepper_video_capture_host.h
index 03cfd0a..9fdc299 100644
--- a/content/renderer/pepper/pepper_video_capture_host.h
+++ b/content/renderer/pepper/pepper_video_capture_host.h
@@ -9,22 +9,23 @@
 #include "base/memory/ref_counted.h"
 #include "content/public/renderer/renderer_ppapi_host.h"
 #include "content/renderer/pepper/pepper_device_enumeration_host_helper.h"
+#include "content/renderer/pepper/plugin_delegate.h"
+#include "content/renderer/pepper/ppb_buffer_impl.h"
 #include "media/video/capture/video_capture.h"
 #include "media/video/capture/video_capture_types.h"
 #include "ppapi/c/dev/ppp_video_capture_dev.h"
 #include "ppapi/host/host_message_context.h"
 #include "ppapi/host/resource_host.h"
-#include "webkit/plugins/ppapi/plugin_delegate.h"
-#include "webkit/plugins/ppapi/ppb_buffer_impl.h"
 
 namespace content {
+class RendererPpapiHostImpl;
 
 class PepperVideoCaptureHost
   : public ppapi::host::ResourceHost,
     public webkit::ppapi::PluginDelegate::PlatformVideoCaptureEventHandler,
     public PepperDeviceEnumerationHostHelper::Delegate {
  public:
-  PepperVideoCaptureHost(RendererPpapiHost* host,
+  PepperVideoCaptureHost(RendererPpapiHostImpl* host,
                          PP_Instance instance,
                          PP_Resource resource);
 
@@ -90,7 +91,7 @@
     scoped_refptr<webkit::ppapi::PPB_Buffer_Impl> buffer;
   };
 
-  RendererPpapiHost* renderer_ppapi_host_;
+  RendererPpapiHostImpl* renderer_ppapi_host_;
 
   std::vector<BufferInfo> buffers_;
   size_t buffer_count_hint_;
diff --git a/content/renderer/pepper/pepper_video_destination_host.cc b/content/renderer/pepper/pepper_video_destination_host.cc
index 67234d5..2ab0657 100644
--- a/content/renderer/pepper/pepper_video_destination_host.cc
+++ b/content/renderer/pepper/pepper_video_destination_host.cc
@@ -6,6 +6,7 @@
 
 #include "base/time/time.h"
 #include "content/public/renderer/renderer_ppapi_host.h"
+#include "content/renderer/pepper/ppb_image_data_impl.h"
 #include "ppapi/c/pp_errors.h"
 #include "ppapi/host/dispatch_host_message.h"
 #include "ppapi/host/host_message_context.h"
@@ -13,7 +14,6 @@
 #include "ppapi/proxy/ppapi_messages.h"
 #include "ppapi/thunk/enter.h"
 #include "ppapi/thunk/ppb_image_data_api.h"
-#include "webkit/plugins/ppapi/ppb_image_data_impl.h"
 
 using ppapi::host::HostMessageContext;
 using ppapi::host::ReplyMessageContext;
diff --git a/content/renderer/pepper/pepper_video_source_host.cc b/content/renderer/pepper/pepper_video_source_host.cc
index 8183113..165c5c0 100644
--- a/content/renderer/pepper/pepper_video_source_host.cc
+++ b/content/renderer/pepper/pepper_video_source_host.cc
@@ -7,6 +7,7 @@
 #include "base/bind.h"
 #include "base/safe_numerics.h"
 #include "content/public/renderer/renderer_ppapi_host.h"
+#include "content/renderer/pepper/ppb_image_data_impl.h"
 #include "content/renderer/render_thread_impl.h"
 #include "ppapi/c/pp_errors.h"
 #include "ppapi/host/dispatch_host_message.h"
@@ -19,7 +20,6 @@
 #include "third_party/libjingle/source/talk/media/base/videocommon.h"
 #include "third_party/libjingle/source/talk/media/base/videoframe.h"
 #include "third_party/skia/include/core/SkBitmap.h"
-#include "webkit/plugins/ppapi/ppb_image_data_impl.h"
 
 using ppapi::host::HostMessageContext;
 using ppapi::host::ReplyMessageContext;
diff --git a/webkit/plugins/ppapi/plugin_delegate.h b/content/renderer/pepper/plugin_delegate.h
similarity index 91%
rename from webkit/plugins/ppapi/plugin_delegate.h
rename to content/renderer/pepper/plugin_delegate.h
index 59f31f2..e5f2118 100644
--- a/webkit/plugins/ppapi/plugin_delegate.h
+++ b/content/renderer/pepper/plugin_delegate.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_
-#define WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_
+#ifndef CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_H_
+#define CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_H_
 
 #include <string>
 #include <vector>
@@ -16,6 +16,7 @@
 #include "base/process.h"
 #include "base/sync_socket.h"
 #include "base/time/time.h"
+#include "content/common/content_export.h"
 #include "ipc/ipc_platform_file.h"
 #include "media/video/capture/video_capture.h"
 #include "media/video/video_decode_accelerator.h"
@@ -36,7 +37,6 @@
 #include "url/gurl.h"
 #include "webkit/common/fileapi/file_system_types.h"
 #include "webkit/common/quota/quota_types.h"
-#include "webkit/plugins/webkit_plugins_export.h"
 
 class GURL;
 class SkBitmap;
@@ -111,7 +111,7 @@
 
 class FileIO;
 class FullscreenContainer;
-class PluginInstance;
+class PluginInstanceImpl;
 class PluginModule;
 class PPB_Broker_Impl;
 class PPB_Flash_Menu_Impl;
@@ -122,26 +122,6 @@
 // PPAPI plugins.
 class PluginDelegate {
  public:
-  // This interface is used for the PluginModule to tell the code in charge of
-  // re-using modules which modules currently exist.
-  //
-  // It is different than the other interfaces, which are scoped to the
-  // lifetime of the plugin instance. The implementor of this interface must
-  // outlive all plugin modules, and is in practice a singleton
-  // (PepperPluginRegistry). This requirement means we can't do the obvious
-  // thing and just have a PluginDelegate call for this purpose (when the
-  // module is being deleted, we know there are no more PluginInstances that
-  // have PluginDelegates).
-  class ModuleLifetime {
-   public:
-    // Notification that the given plugin object is no longer usable. It either
-    // indicates the module was deleted, or that it has crashed.
-    //
-    // This can be called from the module's destructor, so you should not
-    // dereference the given pointer.
-    virtual void PluginModuleDead(PluginModule* dead_module) = 0;
-  };
-
   // This class is implemented by the PluginDelegate implementation and is
   // designed to manage the lifetime and communication with the proxy's
   // HostDispatcher for out-of-process PPAPI plugins.
@@ -193,7 +173,7 @@
     virtual TransportDIB* GetTransportDIB() const = 0;
   };
 
-  class WEBKIT_PLUGINS_EXPORT PlatformGraphics2D {
+  class CONTENT_EXPORT PlatformGraphics2D {
    public:
     virtual ~PlatformGraphics2D() {}
 
@@ -203,7 +183,7 @@
     // 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
     // is already bound to a different instance, and nothing will happen.
-    virtual bool BindToInstance(PluginInstance* new_instance) = 0;
+    virtual bool BindToInstance(PluginInstanceImpl* new_instance) = 0;
 
     // Paints the current backing store to the web page.
     virtual void Paint(WebKit::WebCanvas* canvas,
@@ -361,20 +341,20 @@
   };
 
   // Notification that the given plugin is focused or unfocused.
-  virtual void PluginFocusChanged(webkit::ppapi::PluginInstance* instance,
+  virtual void PluginFocusChanged(webkit::ppapi::PluginInstanceImpl* instance,
                                   bool focused) = 0;
   // Notification that the text input status of the given plugin is changed.
   virtual void PluginTextInputTypeChanged(
-      webkit::ppapi::PluginInstance* instance) = 0;
+      webkit::ppapi::PluginInstanceImpl* instance) = 0;
   // Notification that the caret position in the given plugin is changed.
   virtual void PluginCaretPositionChanged(
-      webkit::ppapi::PluginInstance* instance) = 0;
+      webkit::ppapi::PluginInstanceImpl* instance) = 0;
   // Notification that the plugin requested to cancel the current composition.
   virtual void PluginRequestedCancelComposition(
-      webkit::ppapi::PluginInstance* instance) = 0;
+      webkit::ppapi::PluginInstanceImpl* instance) = 0;
   // Notification that the text selection in the given plugin is changed.
   virtual void PluginSelectionChanged(
-      webkit::ppapi::PluginInstance* instance) = 0;
+      webkit::ppapi::PluginInstanceImpl* instance) = 0;
   // Requests simulating IME events for testing purpose.
   virtual void SimulateImeSetComposition(
       const base::string16& text,
@@ -386,19 +366,19 @@
   // Notification that the given plugin has crashed. When a plugin crashes, all
   // instances associated with that plugin will notify that they've crashed via
   // this function.
-  virtual void PluginCrashed(PluginInstance* instance) = 0;
+  virtual void PluginCrashed(PluginInstanceImpl* instance) = 0;
 
   // Indicates that the given instance has been created.
-  virtual void InstanceCreated(PluginInstance* instance) = 0;
+  virtual void InstanceCreated(PluginInstanceImpl* instance) = 0;
 
   // Indicates that the given instance is being destroyed. This is called from
   // the destructor, so it's important that the instance is not dereferenced
   // from this call.
-  virtual void InstanceDeleted(PluginInstance* instance) = 0;
+  virtual void InstanceDeleted(PluginInstanceImpl* instance) = 0;
 
   // Creates the resource creation API for the given instance.
   virtual scoped_ptr< ::ppapi::thunk::ResourceCreationAPI>
-      CreateResourceCreationAPI(PluginInstance* instance) = 0;
+      CreateResourceCreationAPI(PluginInstanceImpl* instance) = 0;
 
   // Returns a pointer (ownership not transferred) to the bitmap to paint the
   // sad plugin screen with. Returns NULL on failure.
@@ -413,7 +393,7 @@
   virtual PlatformImage2D* CreateImage2D(int width, int height) = 0;
 
   // Returns the internal PlatformGraphics2D implementation.
-  virtual PlatformGraphics2D* GetGraphics2D(PluginInstance* instance,
+  virtual PlatformGraphics2D* GetGraphics2D(PluginInstanceImpl* instance,
                                             PP_Resource graphics_2d) = 0;
 
   // The caller will own the pointer returned from this.
@@ -609,7 +589,7 @@
   // Create a fullscreen container for a plugin instance. This effectively
   // switches the plugin to fullscreen.
   virtual FullscreenContainer* CreateFullscreenContainer(
-      PluginInstance* instance) = 0;
+      PluginInstanceImpl* instance) = 0;
 
   // Gets the size of the screen. The fullscreen window will be created at that
   // size.
@@ -633,7 +613,7 @@
   // possible. If true is returned then the lock is pending. Success or
   // failure will be delivered asynchronously via
   // PluginInstance::OnLockMouseACK().
-  virtual bool LockMouse(PluginInstance* instance) = 0;
+  virtual bool LockMouse(PluginInstanceImpl* instance) = 0;
 
   // Unlocks the mouse if |instance| currently owns the mouse lock. Whenever an
   // plugin instance has lost the mouse lock, it will be notified by
@@ -641,19 +621,19 @@
   // the only cause of losing mouse lock. For example, a user may press the Esc
   // key to quit the mouse lock mode, which also results in an OnMouseLockLost()
   // call to the current mouse lock owner.
-  virtual void UnlockMouse(PluginInstance* instance) = 0;
+  virtual void UnlockMouse(PluginInstanceImpl* instance) = 0;
 
   // Returns true iff |instance| currently owns the mouse lock.
-  virtual bool IsMouseLocked(PluginInstance* instance) = 0;
+  virtual bool IsMouseLocked(PluginInstanceImpl* instance) = 0;
 
   // Notifies that |instance| has changed the cursor.
   // This will update the cursor appearance if it is currently over the plugin
   // instance.
-  virtual void DidChangeCursor(PluginInstance* instance,
+  virtual void DidChangeCursor(PluginInstanceImpl* instance,
                                const WebKit::WebCursorInfo& cursor) = 0;
 
   // Notifies that |instance| has received a mouse event.
-  virtual void DidReceiveMouseEvent(PluginInstance* instance) = 0;
+  virtual void DidReceiveMouseEvent(PluginInstanceImpl* instance) = 0;
 
   // Determines if the browser entered fullscreen mode.
   virtual bool IsInFullscreenMode() = 0;
@@ -692,7 +672,7 @@
   //
   // The loader object should set itself on the PluginInstance as the document
   // loader using set_document_loader.
-  virtual void HandleDocumentLoad(PluginInstance* instance,
+  virtual void HandleDocumentLoad(PluginInstanceImpl* instance,
                                   const WebKit::WebURLResponse& response) = 0;
 
   // Sets up the renderer host and out-of-process proxy for an external plugin
@@ -709,4 +689,4 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_
+#endif  // CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_H_
diff --git a/webkit/plugins/ppapi/plugin_module.cc b/content/renderer/pepper/plugin_module.cc
similarity index 88%
rename from webkit/plugins/ppapi/plugin_module.cc
rename to content/renderer/pepper/plugin_module.cc
index dddabcc..44253b2 100644
--- a/webkit/plugins/ppapi/plugin_module.cc
+++ b/content/renderer/pepper/plugin_module.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/plugin_module.h"
+#include "content/renderer/pepper/plugin_module.h"
 
 #include <set>
 
@@ -13,6 +13,18 @@
 #include "base/message_loop/message_loop.h"
 #include "base/message_loop/message_loop_proxy.h"
 #include "base/time/time.h"
+#include "content/renderer/pepper/common.h"
+#include "content/renderer/pepper/host_globals.h"
+#include "content/renderer/pepper/pepper_plugin_registry.h"
+#include "content/renderer/pepper/ppapi_interface_factory.h"
+#include "content/renderer/pepper/ppapi_plugin_instance_impl.h"
+#include "content/renderer/pepper/ppb_gpu_blacklist_private_impl.h"
+#include "content/renderer/pepper/ppb_image_data_impl.h"
+#include "content/renderer/pepper/ppb_proxy_impl.h"
+#include "content/renderer/pepper/ppb_scrollbar_impl.h"
+#include "content/renderer/pepper/ppb_uma_private_impl.h"
+#include "content/renderer/pepper/ppb_var_deprecated_impl.h"
+#include "content/renderer/pepper/ppb_video_decoder_impl.h"
 #include "ppapi/c/dev/ppb_audio_input_dev.h"
 #include "ppapi/c/dev/ppb_buffer_dev.h"
 #include "ppapi/c/dev/ppb_char_set_dev.h"
@@ -120,17 +132,6 @@
 #include "ppapi/thunk/ppb_graphics_2d_api.h"
 #include "ppapi/thunk/thunk.h"
 #include "webkit/plugins/plugin_switches.h"
-#include "webkit/plugins/ppapi/common.h"
-#include "webkit/plugins/ppapi/host_globals.h"
-#include "webkit/plugins/ppapi/ppapi_interface_factory.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
-#include "webkit/plugins/ppapi/ppb_gpu_blacklist_private_impl.h"
-#include "webkit/plugins/ppapi/ppb_image_data_impl.h"
-#include "webkit/plugins/ppapi/ppb_proxy_impl.h"
-#include "webkit/plugins/ppapi/ppb_scrollbar_impl.h"
-#include "webkit/plugins/ppapi/ppb_uma_private_impl.h"
-#include "webkit/plugins/ppapi/ppb_var_deprecated_impl.h"
-#include "webkit/plugins/ppapi/ppb_video_decoder_impl.h"
 
 using ppapi::InputEventData;
 using ppapi::PpapiGlobals;
@@ -239,7 +240,7 @@
 }
 
 void SimulateInputEvent(PP_Instance instance, PP_Resource input_event) {
-  PluginInstance* plugin_instance = host_globals->GetInstance(instance);
+  PluginInstanceImpl* plugin_instance = host_globals->GetInstance(instance);
   if (!plugin_instance)
     return;
 
@@ -252,7 +253,7 @@
 }
 
 PP_Var GetDocumentURL(PP_Instance instance, PP_URLComponents_Dev* components) {
-  PluginInstance* plugin_instance = host_globals->GetInstance(instance);
+  PluginInstanceImpl* plugin_instance = host_globals->GetInstance(instance);
   if (!plugin_instance)
     return PP_MakeUndefined();
   return plugin_instance->GetDocumentURL(instance, components);
@@ -340,10 +341,11 @@
 
 // Gets the PPAPI entry points from the given library and places them into the
 // given structure. Returns true on success.
-bool LoadEntryPointsFromLibrary(const base::NativeLibrary& library,
-                                PluginModule::EntryPoints* entry_points) {
+bool LoadEntryPointsFromLibrary(
+    const base::NativeLibrary& library,
+    content::PepperPluginInfo::EntryPoints* entry_points) {
   entry_points->get_interface =
-      reinterpret_cast<PluginModule::GetInterfaceFunc>(
+      reinterpret_cast<content::PepperPluginInfo::GetInterfaceFunc>(
           base::GetFunctionPointerFromNativeLibrary(library,
                                                     "PPP_GetInterface"));
   if (!entry_points->get_interface) {
@@ -352,7 +354,7 @@
   }
 
   entry_points->initialize_module =
-      reinterpret_cast<PluginModule::PPP_InitializeModuleFunc>(
+      reinterpret_cast<content::PepperPluginInfo::PPP_InitializeModuleFunc>(
           base::GetFunctionPointerFromNativeLibrary(library,
                                                     "PPP_InitializeModule"));
   if (!entry_points->initialize_module) {
@@ -363,7 +365,7 @@
   // It's okay for PPP_ShutdownModule to not be defined and shutdown_module to
   // be NULL.
   entry_points->shutdown_module =
-      reinterpret_cast<PluginModule::PPP_ShutdownModuleFunc>(
+      reinterpret_cast<content::PepperPluginInfo::PPP_ShutdownModuleFunc>(
           base::GetFunctionPointerFromNativeLibrary(library,
                                                     "PPP_ShutdownModule"));
 
@@ -372,20 +374,12 @@
 
 }  // namespace
 
-PluginModule::EntryPoints::EntryPoints()
-    : get_interface(NULL),
-      initialize_module(NULL),
-      shutdown_module(NULL) {
-}
-
 // PluginModule ----------------------------------------------------------------
 
 PluginModule::PluginModule(const std::string& name,
                            const base::FilePath& path,
-                           PluginDelegate::ModuleLifetime* lifetime_delegate,
                            const ::ppapi::PpapiPermissions& perms)
-    : lifetime_delegate_(lifetime_delegate),
-      callback_tracker_(new ::ppapi::CallbackTracker),
+    : callback_tracker_(new ::ppapi::CallbackTracker),
       is_in_destructor_(false),
       is_crashed_(false),
       broker_(NULL),
@@ -429,10 +423,10 @@
 
   // Notifications that we've been deleted should be last.
   HostGlobals::Get()->ModuleDeleted(pp_module_);
-  if (!is_crashed_ && lifetime_delegate_) {
+  if (!is_crashed_) {
     // When the plugin crashes, we immediately tell the lifetime delegate that
     // we're gone, so we don't want to tell it again.
-    lifetime_delegate_->PluginModuleDead(this);
+    content::PepperPluginRegistry::GetInstance()->PluginModuleDead(this);
   }
 
   // Don't add stuff here, the two notifications that the module object has
@@ -449,7 +443,8 @@
   return embedder_state_.get();
 }
 
-bool PluginModule::InitAsInternalPlugin(const EntryPoints& entry_points) {
+bool PluginModule::InitAsInternalPlugin(
+    const content::PepperPluginInfo::EntryPoints& entry_points) {
   if (InitializeModule(entry_points)) {
     entry_points_ = entry_points;
     return true;
@@ -462,7 +457,7 @@
   if (!library)
     return false;
 
-  EntryPoints entry_points;
+  content::PepperPluginInfo::EntryPoints entry_points;
 
   if (!LoadEntryPointsFromLibrary(library, &entry_points) ||
       !InitializeModule(entry_points)) {
@@ -487,13 +482,12 @@
   scoped_refptr<PluginModule> external_plugin_module(
       new PluginModule(name_,
                        path_,
-                       NULL,  // no lifetime_delegate
                        permissions_));
   return external_plugin_module;
 }
 
 PP_ExternalPluginResult PluginModule::InitAsProxiedExternalPlugin(
-    PluginInstance* instance) {
+    PluginInstanceImpl* instance) {
   DCHECK(out_of_process_proxy_.get());
   // InitAsProxied (for the trusted/out-of-process case) initializes only the
   // module, and one or more instances are added later. In this case, the
@@ -528,7 +522,8 @@
 }
 
 // static
-PluginModule::GetInterfaceFunc PluginModule::GetLocalGetInterfaceFunc() {
+content::PepperPluginInfo::GetInterfaceFunc
+    PluginModule::GetLocalGetInterfaceFunc() {
   return &GetInterface;
 }
 
@@ -537,13 +532,13 @@
   return !!InternalGetInterface(name);
 }
 
-PluginInstance* PluginModule::CreateInstance(
+PluginInstanceImpl* PluginModule::CreateInstance(
     PluginDelegate* delegate,
     content::RenderView* render_view,
     WebKit::WebPluginContainer* container,
     const GURL& plugin_url) {
-  PluginInstance* instance = PluginInstance::Create(delegate, render_view, this,
-                                                    container, plugin_url);
+  PluginInstanceImpl* instance = PluginInstanceImpl::Create(
+      delegate, render_view, this, container, plugin_url);
   if (!instance) {
     LOG(WARNING) << "Plugin doesn't support instance interface, failing.";
     return NULL;
@@ -553,7 +548,7 @@
   return instance;
 }
 
-PluginInstance* PluginModule::GetSomeInstance() const {
+PluginInstanceImpl* PluginModule::GetSomeInstance() const {
   // This will generally crash later if there is not actually any instance to
   // return, so we force a crash now to make bugs easier to track down.
   CHECK(!instances_.empty());
@@ -570,11 +565,11 @@
   return entry_points_.get_interface(name);
 }
 
-void PluginModule::InstanceCreated(PluginInstance* instance) {
+void PluginModule::InstanceCreated(PluginInstanceImpl* instance) {
   instances_.insert(instance);
 }
 
-void PluginModule::InstanceDeleted(PluginInstance* instance) {
+void PluginModule::InstanceDeleted(PluginInstanceImpl* instance) {
   if (out_of_process_proxy_)
     out_of_process_proxy_->RemoveInstance(instance->pp_instance());
   instances_.erase(instance);
@@ -593,8 +588,7 @@
        i != instances_.end(); ++i)
     (*i)->InstanceCrashed();
 
-  if (lifetime_delegate_)
-    lifetime_delegate_->PluginModuleDead(this);
+  content::PepperPluginRegistry::GetInstance()->PluginModuleDead(this);
 }
 
 void PluginModule::SetReserveInstanceIDCallback(
@@ -624,7 +618,8 @@
   host_globals = NULL;
 }
 
-bool PluginModule::InitializeModule(const EntryPoints& entry_points) {
+bool PluginModule::InitializeModule(
+    const content::PepperPluginInfo::EntryPoints& entry_points) {
   DCHECK(!out_of_process_proxy_.get()) << "Don't call for proxied modules.";
   DCHECK(entry_points.initialize_module != NULL);
   int retval = entry_points.initialize_module(pp_module(), &GetInterface);
diff --git a/webkit/plugins/ppapi/plugin_module.h b/content/renderer/pepper/plugin_module.h
similarity index 83%
rename from webkit/plugins/ppapi/plugin_module.h
rename to content/renderer/pepper/plugin_module.h
index fe8f62e..c4f3527 100644
--- a/webkit/plugins/ppapi/plugin_module.h
+++ b/content/renderer/pepper/plugin_module.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_PLUGIN_MODULE_H_
-#define WEBKIT_PLUGINS_PPAPI_PLUGIN_MODULE_H_
+#ifndef CONTENT_RENDERER_PEPPER_PLUGIN_MODULE_H_
+#define CONTENT_RENDERER_PEPPER_PLUGIN_MODULE_H_
 
 #include <map>
 #include <set>
@@ -16,15 +16,14 @@
 #include "base/memory/weak_ptr.h"
 #include "base/native_library.h"
 #include "base/process.h"
+#include "content/common/content_export.h"
+#include "content/public/common/pepper_plugin_info.h"
+#include "content/renderer/pepper/plugin_delegate.h"
 #include "ppapi/c/pp_bool.h"
 #include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_module.h"
-#include "ppapi/c/ppb.h"
 #include "ppapi/c/ppb_core.h"
 #include "ppapi/c/private/ppb_instance_private.h"
 #include "ppapi/shared_impl/ppapi_permissions.h"
-#include "webkit/plugins/ppapi/plugin_delegate.h"
-#include "webkit/plugins/webkit_plugins_export.h"
 
 typedef void* NPIdentifier;
 
@@ -49,30 +48,17 @@
 namespace ppapi {
 
 class PluginDelegate;
-class PluginInstance;
+class PluginInstanceImpl;
 
 // Represents one plugin library loaded into one renderer. This library may
 // have multiple instances.
 //
 // Note: to get from a PP_Instance to a PluginInstance*, use the
 // ResourceTracker.
-class WEBKIT_PLUGINS_EXPORT PluginModule :
+class CONTENT_EXPORT PluginModule :
     public base::RefCounted<PluginModule>,
     public base::SupportsWeakPtr<PluginModule> {
  public:
-  typedef const void* (*GetInterfaceFunc)(const char*);
-  typedef int (*PPP_InitializeModuleFunc)(PP_Module, PPB_GetInterface);
-  typedef void (*PPP_ShutdownModuleFunc)();
-
-  struct EntryPoints {
-    // This structure is POD, with the constructor initializing to NULL.
-    WEBKIT_PLUGINS_EXPORT EntryPoints();
-
-    GetInterfaceFunc get_interface;
-    PPP_InitializeModuleFunc initialize_module;
-    PPP_ShutdownModuleFunc shutdown_module;  // Optional, may be NULL.
-  };
-
   // Allows the embedder to associate a class with this module. This is opaque
   // from the PluginModule's perspective (see Set/GetEmbedderState below) but
   // the module is in charge of deleting the class.
@@ -81,7 +67,7 @@
     virtual ~EmbedderState() {}
   };
 
-  typedef std::set<PluginInstance*> PluginInstanceSet;
+  typedef std::set<PluginInstanceImpl*> PluginInstanceSet;
 
   // You must call one of the Init functions after the constructor to create a
   // module of the type you desire.
@@ -91,11 +77,8 @@
   // tracks which modules are alive.
   PluginModule(const std::string& name,
                const base::FilePath& path,
-               PluginDelegate::ModuleLifetime* lifetime_delegate,
                const ::ppapi::PpapiPermissions& perms);
 
-  ~PluginModule();
-
   // Sets the given class as being associated with this module. It will be
   // deleted when the module is destroyed. You can only set it once, subsequent
   // sets will assert.
@@ -107,7 +90,8 @@
   // Initializes this module as an internal plugin with the given entrypoints.
   // This is used for "plugins" compiled into Chrome. Returns true on success.
   // False means that the plugin can not be used.
-  bool InitAsInternalPlugin(const EntryPoints& entry_points);
+  bool InitAsInternalPlugin(
+      const content::PepperPluginInfo::EntryPoints& entry_points);
 
   // Initializes this module using the given library path as the plugin.
   // Returns true on success. False means that the plugin can not be used.
@@ -126,7 +110,8 @@
   // InitAsProxied must be called before calling InitAsProxiedExternalPlugin.
   // Returns a result code indicating whether the proxy started successfully or
   // there was an error.
-  PP_ExternalPluginResult InitAsProxiedExternalPlugin(PluginInstance* instance);
+  PP_ExternalPluginResult InitAsProxiedExternalPlugin(
+      PluginInstanceImpl* instance);
 
   bool IsProxied() const;
 
@@ -145,7 +130,7 @@
 
   // Returns a pointer to the local GetInterface function for retrieving
   // PPB interfaces.
-  static GetInterfaceFunc GetLocalGetInterfaceFunc();
+  static content::PepperPluginInfo::GetInterfaceFunc GetLocalGetInterfaceFunc();
 
   // Returns whether an interface is supported. This method can be called from
   // the browser process and used for interface matching before plugin
@@ -162,16 +147,16 @@
   const base::FilePath& path() const { return path_; }
   const ::ppapi::PpapiPermissions& permissions() const { return permissions_; }
 
-  PluginInstance* CreateInstance(PluginDelegate* delegate,
-                                 content::RenderView* render_view,
-                                 WebKit::WebPluginContainer* container,
-                                 const GURL& plugin_url);
+  PluginInstanceImpl* CreateInstance(PluginDelegate* delegate,
+                                     content::RenderView* render_view,
+                                     WebKit::WebPluginContainer* container,
+                                     const GURL& plugin_url);
 
   // Returns "some" plugin instance associated with this module. This is not
   // guaranteed to be any one in particular. This is normally used to execute
   // callbacks up to the browser layer that are not inherently per-instance,
   // but the delegate lives only on the plugin instance so we need one of them.
-  PluginInstance* GetSomeInstance() const;
+  PluginInstanceImpl* GetSomeInstance() const;
 
   const PluginInstanceSet& GetAllInstances() const { return instances_; }
 
@@ -182,8 +167,8 @@
   // This module is associated with a set of instances. The PluginInstance
   // object declares its association with this module in its destructor and
   // releases us in its destructor.
-  void InstanceCreated(PluginInstance* instance);
-  void InstanceDeleted(PluginInstance* instance);
+  void InstanceCreated(PluginInstanceImpl* instance);
+  void InstanceDeleted(PluginInstanceImpl* instance);
 
   scoped_refptr< ::ppapi::CallbackTracker> GetCallbackTracker();
 
@@ -217,13 +202,13 @@
   static void ResetHostGlobalsForTest();
 
  private:
+  friend class base::RefCounted<PluginModule>;
+  ~PluginModule();
   // Calls the InitializeModule entrypoint. The entrypoint must have been
   // set and the plugin must not be out of process (we don't maintain
   // entrypoints in that case).
-  bool InitializeModule(const EntryPoints& entry_points);
-
-  // Note: This may be null.
-  PluginDelegate::ModuleLifetime* lifetime_delegate_;
+  bool InitializeModule(
+      const content::PepperPluginInfo::EntryPoints& entry_points);
 
   // See EmbedderState above.
   scoped_ptr<EmbedderState> embedder_state_;
@@ -259,7 +244,7 @@
   // Contains pointers to the entry points of the actual plugin implementation.
   // These will be NULL for out-of-process plugins, which is indicated by the
   // presence of the out_of_process_proxy_ value.
-  EntryPoints entry_points_;
+  content::PepperPluginInfo::EntryPoints entry_points_;
 
   // The name and file location of the module.
   const std::string name_;
@@ -279,4 +264,4 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_PLUGIN_MODULE_H_
+#endif  // CONTENT_RENDERER_PEPPER_PLUGIN_MODULE_H_
diff --git a/webkit/plugins/ppapi/plugin_object.cc b/content/renderer/pepper/plugin_object.cc
similarity index 97%
rename from webkit/plugins/ppapi/plugin_object.cc
rename to content/renderer/pepper/plugin_object.cc
index 29dd923..9955d0c 100644
--- a/webkit/plugins/ppapi/plugin_object.cc
+++ b/content/renderer/pepper/plugin_object.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 "webkit/plugins/ppapi/plugin_object.h"
+#include "content/renderer/pepper/plugin_object.h"
 
 #include "base/logging.h"
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_util.h"
+#include "content/renderer/pepper/npapi_glue.h"
+#include "content/renderer/pepper/plugin_module.h"
+#include "content/renderer/pepper/ppapi_plugin_instance_impl.h"
 #include "ppapi/c/dev/ppb_var_deprecated.h"
 #include "ppapi/c/dev/ppp_class_deprecated.h"
 #include "ppapi/c/pp_resource.h"
@@ -20,9 +23,6 @@
 #include "third_party/WebKit/public/web/WebBindings.h"
 #include "third_party/npapi/bindings/npapi.h"
 #include "third_party/npapi/bindings/npruntime.h"
-#include "webkit/plugins/ppapi/npapi_glue.h"
-#include "webkit/plugins/ppapi/plugin_module.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
 
 using ppapi::PpapiGlobals;
 using ppapi::StringVar;
@@ -265,7 +265,7 @@
   PluginObject* obj;
 };
 
-PluginObject::PluginObject(PluginInstance* instance,
+PluginObject::PluginObject(PluginInstanceImpl* instance,
                            NPObjectWrapper* object_wrapper,
                            const PPP_Class_Deprecated* ppp_class,
                            void* ppp_class_data)
@@ -290,7 +290,7 @@
   instance_->RemovePluginObject(this);
 }
 
-PP_Var PluginObject::Create(PluginInstance* instance,
+PP_Var PluginObject::Create(PluginInstanceImpl* instance,
                             const PPP_Class_Deprecated* ppp_class,
                             void* ppp_class_data) {
   // This will internally end up calling our AllocateObjectWrapper via the
diff --git a/webkit/plugins/ppapi/plugin_object.h b/content/renderer/pepper/plugin_object.h
similarity index 88%
rename from webkit/plugins/ppapi/plugin_object.h
rename to content/renderer/pepper/plugin_object.h
index 55d054f..c222e50 100644
--- a/webkit/plugins/ppapi/plugin_object.h
+++ b/content/renderer/pepper/plugin_object.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_PLUGIN_OBJECT_H_
-#define WEBKIT_PLUGINS_PPAPI_PLUGIN_OBJECT_H_
+#ifndef CONTENT_RENDERER_PEPPER_PLUGIN_OBJECT_H_
+#define CONTENT_RENDERER_PEPPER_PLUGIN_OBJECT_H_
 
 #include <string>
 
@@ -17,7 +17,7 @@
 namespace webkit {
 namespace ppapi {
 
-class PluginInstance;
+class PluginInstanceImpl;
 
 // A PluginObject is a JS-accessible object implemented by the plugin.
 //
@@ -29,11 +29,11 @@
 
   // Allocates a new PluginObject and returns it as a PP_Var with a
   // refcount of 1.
-  static PP_Var Create(PluginInstance* instance,
+  static PP_Var Create(PluginInstanceImpl* instance,
                        const PPP_Class_Deprecated* ppp_class,
                        void* ppp_class_data);
 
-  PluginInstance* instance() const { return instance_; }
+  PluginInstanceImpl* instance() const { return instance_; }
 
   const PPP_Class_Deprecated* ppp_class() { return ppp_class_; }
   void* ppp_class_data() { return ppp_class_data_; };
@@ -68,12 +68,12 @@
   //
   // The NPObjectWrapper (an NPObject) should already have the reference
   // incremented on it, and this class will take ownership of that reference.
-  PluginObject(PluginInstance* instance,
+  PluginObject(PluginInstanceImpl* instance,
                NPObjectWrapper* object_wrapper,
                const PPP_Class_Deprecated* ppp_class,
                void* ppp_class_data);
 
-  PluginInstance* instance_;
+  PluginInstanceImpl* instance_;
 
   // Holds a pointer to the NPObject wrapper backing the var. This class
   // derives from NPObject and we hold a reference to it, so it must be
@@ -92,4 +92,4 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_PLUGIN_OBJECT_H_
+#endif  // CONTENT_RENDERER_PEPPER_PLUGIN_OBJECT_H_
diff --git a/webkit/plugins/ppapi/ppapi_interface_factory.cc b/content/renderer/pepper/ppapi_interface_factory.cc
similarity index 96%
rename from webkit/plugins/ppapi/ppapi_interface_factory.cc
rename to content/renderer/pepper/ppapi_interface_factory.cc
index 26df97a..acb6858 100644
--- a/webkit/plugins/ppapi/ppapi_interface_factory.cc
+++ b/content/renderer/pepper/ppapi_interface_factory.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/ppapi_interface_factory.h"
+#include "content/renderer/pepper/ppapi_interface_factory.h"
 
 #include <algorithm>
 
diff --git a/webkit/plugins/ppapi/ppapi_interface_factory.h b/content/renderer/pepper/ppapi_interface_factory.h
similarity index 74%
rename from webkit/plugins/ppapi/ppapi_interface_factory.h
rename to content/renderer/pepper/ppapi_interface_factory.h
index 1b574aa..6654f61 100644
--- a/webkit/plugins/ppapi/ppapi_interface_factory.h
+++ b/content/renderer/pepper/ppapi_interface_factory.h
@@ -2,15 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_PLUGIN_INTERFACE_FACTORY_H_
-#define WEBKIT_PLUGINS_PPAPI_PLUGIN_INTERFACE_FACTORY_H_
+#ifndef CONTENT_RENDERER_PEPPER_PLUGIN_INTERFACE_FACTORY_H_
+#define CONTENT_RENDERER_PEPPER_PLUGIN_INTERFACE_FACTORY_H_
 
 #include <string>
 #include <vector>
 
 #include "base/basictypes.h"
 #include "base/lazy_instance.h"
-#include "webkit/plugins/webkit_plugins_export.h"
+#include "content/common/content_export.h"
 
 namespace webkit {
 namespace ppapi {
@@ -22,10 +22,10 @@
   typedef const void* (InterfaceFactory)(const std::string& interface_name);
 
   // Registers a custom PPAPI interface factory.
-  WEBKIT_PLUGINS_EXPORT void RegisterFactory(InterfaceFactory* factory);
+  CONTENT_EXPORT void RegisterFactory(InterfaceFactory* factory);
 
   // Unregisters the custom PPAPI interface factory passed in.
-  WEBKIT_PLUGINS_EXPORT void UnregisterFactory(InterfaceFactory* factory);
+  CONTENT_EXPORT void UnregisterFactory(InterfaceFactory* factory);
 
   // Returns a pointer to the interface identified by the name passed in.
   // Returns NULL if no factory handles this interface.
@@ -33,7 +33,7 @@
 
   // Returns a pointer to the global instance of the
   // PpapiInterfaceFactoryManager class.
-  WEBKIT_PLUGINS_EXPORT static PpapiInterfaceFactoryManager* GetInstance();
+  CONTENT_EXPORT static PpapiInterfaceFactoryManager* GetInstance();
 
  private:
   friend struct base::DefaultLazyInstanceTraits<PpapiInterfaceFactoryManager>;
@@ -52,5 +52,5 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_PLUGIN_INTERFACE_FACTORY_H_
+#endif  // CONTENT_RENDERER_PEPPER_PLUGIN_INTERFACE_FACTORY_H_
 
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/content/renderer/pepper/ppapi_plugin_instance_impl.cc
similarity index 82%
rename from webkit/plugins/ppapi/ppapi_plugin_instance.cc
rename to content/renderer/pepper/ppapi_plugin_instance_impl.cc
index 3cc6b7f..229c31e 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc
+++ b/content/renderer/pepper/ppapi_plugin_instance_impl.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
+#include "content/renderer/pepper/ppapi_plugin_instance_impl.h"
 
 #include "base/bind.h"
 #include "base/callback_helpers.h"
@@ -16,6 +16,22 @@
 #include "base/strings/utf_string_conversions.h"
 #include "base/time/time.h"
 #include "cc/layers/texture_layer.h"
+#include "content/renderer/pepper/common.h"
+#include "content/renderer/pepper/content_decryptor_delegate.h"
+#include "content/renderer/pepper/event_conversion.h"
+#include "content/renderer/pepper/fullscreen_container.h"
+#include "content/renderer/pepper/gfx_conversion.h"
+#include "content/renderer/pepper/host_globals.h"
+#include "content/renderer/pepper/message_channel.h"
+#include "content/renderer/pepper/npapi_glue.h"
+#include "content/renderer/pepper/plugin_module.h"
+#include "content/renderer/pepper/plugin_object.h"
+#include "content/renderer/pepper/ppb_buffer_impl.h"
+#include "content/renderer/pepper/ppb_file_ref_impl.h"
+#include "content/renderer/pepper/ppb_graphics_3d_impl.h"
+#include "content/renderer/pepper/ppb_image_data_impl.h"
+#include "content/renderer/pepper/ppp_pdf.h"
+#include "content/renderer/pepper/url_request_info_util.h"
 #include "ppapi/c/dev/ppb_find_dev.h"
 #include "ppapi/c/dev/ppb_zoom_dev.h"
 #include "ppapi/c/dev/ppp_find_dev.h"
@@ -78,22 +94,6 @@
 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h"
 #include "v8/include/v8.h"
 #include "webkit/plugins/plugin_constants.h"
-#include "webkit/plugins/ppapi/common.h"
-#include "webkit/plugins/ppapi/content_decryptor_delegate.h"
-#include "webkit/plugins/ppapi/event_conversion.h"
-#include "webkit/plugins/ppapi/fullscreen_container.h"
-#include "webkit/plugins/ppapi/gfx_conversion.h"
-#include "webkit/plugins/ppapi/host_globals.h"
-#include "webkit/plugins/ppapi/message_channel.h"
-#include "webkit/plugins/ppapi/npapi_glue.h"
-#include "webkit/plugins/ppapi/plugin_module.h"
-#include "webkit/plugins/ppapi/plugin_object.h"
-#include "webkit/plugins/ppapi/ppb_buffer_impl.h"
-#include "webkit/plugins/ppapi/ppb_file_ref_impl.h"
-#include "webkit/plugins/ppapi/ppb_graphics_3d_impl.h"
-#include "webkit/plugins/ppapi/ppb_image_data_impl.h"
-#include "webkit/plugins/ppapi/ppp_pdf.h"
-#include "webkit/plugins/ppapi/url_request_info_util.h"
 #include "webkit/plugins/sad_plugin.h"
 #include "webkit/renderer/compositor_bindings/web_layer_impl.h"
 
@@ -293,7 +293,7 @@
 // unchanged.
 bool SecurityOriginForInstance(PP_Instance instance_id,
                                WebKit::WebSecurityOrigin* security_origin) {
-  PluginInstance* instance = HostGlobals::Get()->GetInstance(instance_id);
+  PluginInstanceImpl* instance = HostGlobals::Get()->GetInstance(instance_id);
   if (!instance)
     return false;
 
@@ -316,29 +316,29 @@
 }  // namespace
 
 // static
-PluginInstance* PluginInstance::Create(PluginDelegate* delegate,
-                                       content::RenderView* render_view,
-                                       PluginModule* module,
-                                       WebPluginContainer* container,
-                                       const GURL& plugin_url) {
+PluginInstanceImpl* PluginInstanceImpl::Create(PluginDelegate* delegate,
+                                               content::RenderView* render_view,
+                                               PluginModule* module,
+                                               WebPluginContainer* container,
+                                               const GURL& plugin_url) {
   base::Callback<const void*(const char*)> get_plugin_interface_func =
       base::Bind(&PluginModule::GetPluginInterface, module);
   PPP_Instance_Combined* ppp_instance_combined =
       PPP_Instance_Combined::Create(get_plugin_interface_func);
   if (!ppp_instance_combined)
     return NULL;
-  return new PluginInstance(delegate, render_view, module,
-                            ppp_instance_combined, container, plugin_url);
+  return new PluginInstanceImpl(delegate, render_view, module,
+                                ppp_instance_combined, container, plugin_url);
 }
 
-PluginInstance::NaClDocumentLoader::NaClDocumentLoader()
+PluginInstanceImpl::NaClDocumentLoader::NaClDocumentLoader()
     : finished_loading_(false) {
 }
 
-PluginInstance::NaClDocumentLoader::~NaClDocumentLoader(){
+PluginInstanceImpl::NaClDocumentLoader::~NaClDocumentLoader(){
 }
 
-void PluginInstance::NaClDocumentLoader::ReplayReceivedData(
+void PluginInstanceImpl::NaClDocumentLoader::ReplayReceivedData(
     WebURLLoaderClient* document_loader) {
   for (std::list<std::string>::iterator it = data_.begin();
        it != data_.end(); ++it) {
@@ -354,7 +354,7 @@
   }
 }
 
-void PluginInstance::NaClDocumentLoader::didReceiveData(
+void PluginInstanceImpl::NaClDocumentLoader::didReceiveData(
     WebURLLoader* loader,
     const char* data,
     int data_length,
@@ -362,38 +362,41 @@
   data_.push_back(std::string(data, data_length));
 }
 
-void PluginInstance::NaClDocumentLoader::didFinishLoading(
+void PluginInstanceImpl::NaClDocumentLoader::didFinishLoading(
     WebURLLoader* loader,
     double finish_time) {
   DCHECK(!finished_loading_);
   finished_loading_ = true;
 }
 
-void PluginInstance::NaClDocumentLoader::didFail(
+void PluginInstanceImpl::NaClDocumentLoader::didFail(
     WebURLLoader* loader,
     const WebURLError& error) {
   DCHECK(!error_.get());
   error_.reset(new WebURLError(error));
 }
 
-PluginInstance::GamepadImpl::GamepadImpl(PluginDelegate* delegate)
+PluginInstanceImpl::GamepadImpl::GamepadImpl(PluginDelegate* delegate)
     : Resource(::ppapi::Resource::Untracked()),
       delegate_(delegate) {
 }
 
-PPB_Gamepad_API* PluginInstance::GamepadImpl::AsPPB_Gamepad_API() {
+PluginInstanceImpl::GamepadImpl::~GamepadImpl() {
+}
+
+PPB_Gamepad_API* PluginInstanceImpl::GamepadImpl::AsPPB_Gamepad_API() {
   return this;
 }
 
-void PluginInstance::GamepadImpl::Sample(PP_Instance /* instance */,
-                                         PP_GamepadsSampleData* data) {
+void PluginInstanceImpl::GamepadImpl::Sample(PP_Instance instance,
+                                             PP_GamepadsSampleData* data) {
   WebKit::WebGamepads webkit_data;
   delegate_->SampleGamepads(&webkit_data);
   ConvertWebKitGamepadData(
       *reinterpret_cast<const ::ppapi::WebKitGamepads*>(&webkit_data), data);
 }
 
-PluginInstance::PluginInstance(
+PluginInstanceImpl::PluginInstanceImpl(
     PluginDelegate* delegate,
     content::RenderView* render_view,
     PluginModule* module,
@@ -465,7 +468,7 @@
     nacl_document_load_ = true;
 }
 
-PluginInstance::~PluginInstance() {
+PluginInstanceImpl::~PluginInstanceImpl() {
   DCHECK(!fullscreen_container_);
 
   // Force-unbind any Graphics. In the case of Graphics2D, if the plugin
@@ -504,9 +507,9 @@
 // method needs to access a member of the instance after the call has returned,
 // then it needs to keep its own reference on the stack.
 
-void PluginInstance::Delete() {
+void PluginInstanceImpl::Delete() {
   // Keep a reference on the stack. See NOTE above.
-  scoped_refptr<PluginInstance> ref(this);
+  scoped_refptr<PluginInstanceImpl> ref(this);
   // Force the MessageChannel to release its "passthrough object" which should
   // release our last reference to the "InstanceObject" and will probably
   // destroy it. We want to do this prior to calling DidDestroy in case the
@@ -532,9 +535,9 @@
   container_ = NULL;
 }
 
-void PluginInstance::Paint(WebCanvas* canvas,
-                           const gfx::Rect& plugin_rect,
-                           const gfx::Rect& paint_rect) {
+void PluginInstanceImpl::Paint(WebCanvas* canvas,
+                               const gfx::Rect& plugin_rect,
+                               const gfx::Rect& paint_rect) {
   TRACE_EVENT0("ppapi", "PluginInstance::Paint");
   if (module()->is_crashed()) {
     // Crashed plugin painting.
@@ -550,7 +553,7 @@
     bound_graphics_2d->Paint(canvas, plugin_rect, paint_rect);
 }
 
-void PluginInstance::InvalidateRect(const gfx::Rect& rect) {
+void PluginInstanceImpl::InvalidateRect(const gfx::Rect& rect) {
   if (fullscreen_container_) {
     if (rect.IsEmpty())
       fullscreen_container_->Invalidate();
@@ -567,7 +570,7 @@
   }
 }
 
-void PluginInstance::ScrollRect(int dx, int dy, const gfx::Rect& rect) {
+void PluginInstanceImpl::ScrollRect(int dx, int dy, const gfx::Rect& rect) {
   if (fullscreen_container_) {
     fullscreen_container_->ScrollRect(dx, dy, rect);
   } else {
@@ -582,12 +585,12 @@
   }
 }
 
-void PluginInstance::CommitBackingTexture() {
+void PluginInstanceImpl::CommitBackingTexture() {
   if (texture_layer_.get())
     texture_layer_->SetNeedsDisplay();
 }
 
-void PluginInstance::InstanceCrashed() {
+void PluginInstanceImpl::InstanceCrashed() {
   // Force free all resources and vars.
   HostGlobals::Get()->InstanceCrashed(pp_instance());
 
@@ -632,9 +635,9 @@
 #endif
 }
 
-bool PluginInstance::Initialize(const std::vector<std::string>& arg_names,
-                                const std::vector<std::string>& arg_values,
-                                bool full_frame) {
+bool PluginInstanceImpl::Initialize(const std::vector<std::string>& arg_names,
+                                    const std::vector<std::string>& arg_values,
+                                    bool full_frame) {
   message_channel_.reset(new MessageChannel(this));
 
   full_frame_ = full_frame;
@@ -657,7 +660,7 @@
   return success;
 }
 
-bool PluginInstance::HandleDocumentLoad(
+bool PluginInstanceImpl::HandleDocumentLoad(
     const WebKit::WebURLResponse& response) {
   DCHECK(!document_loader_);
   if (!nacl_document_load_) {
@@ -680,22 +683,22 @@
   return true;
 }
 
-bool PluginInstance::SendCompositionEventToPlugin(PP_InputEvent_Type type,
-                                                  const base::string16& text) {
+bool PluginInstanceImpl::SendCompositionEventToPlugin(
+    PP_InputEvent_Type type, const base::string16& text) {
   std::vector<WebKit::WebCompositionUnderline> empty;
   return SendCompositionEventWithUnderlineInformationToPlugin(
       type, text, empty, static_cast<int>(text.size()),
       static_cast<int>(text.size()));
 }
 
-bool PluginInstance::SendCompositionEventWithUnderlineInformationToPlugin(
+bool PluginInstanceImpl::SendCompositionEventWithUnderlineInformationToPlugin(
     PP_InputEvent_Type type,
     const base::string16& text,
     const std::vector<WebKit::WebCompositionUnderline>& underlines,
     int selection_start,
     int selection_end) {
   // Keep a reference on the stack. See NOTE above.
-  scoped_refptr<PluginInstance> ref(this);
+  scoped_refptr<PluginInstanceImpl> ref(this);
 
   if (!LoadInputEventInterface())
     return false;
@@ -764,19 +767,19 @@
   return handled;
 }
 
-void PluginInstance::RequestInputEventsHelper(uint32_t event_classes) {
+void PluginInstanceImpl::RequestInputEventsHelper(uint32_t event_classes) {
   if (event_classes & PP_INPUTEVENT_CLASS_TOUCH)
     UpdateTouchEventRequest();
   if (event_classes & PP_INPUTEVENT_CLASS_WHEEL)
     container_->setWantsWheelEvents(IsAcceptingWheelEvents());
 }
 
-bool PluginInstance::HandleCompositionStart(const base::string16& text) {
+bool PluginInstanceImpl::HandleCompositionStart(const base::string16& text) {
   return SendCompositionEventToPlugin(PP_INPUTEVENT_TYPE_IME_COMPOSITION_START,
                                       text);
 }
 
-bool PluginInstance::HandleCompositionUpdate(
+bool PluginInstanceImpl::HandleCompositionUpdate(
     const base::string16& text,
     const std::vector<WebKit::WebCompositionUnderline>& underlines,
     int selection_start,
@@ -786,18 +789,18 @@
       text, underlines, selection_start, selection_end);
 }
 
-bool PluginInstance::HandleCompositionEnd(const base::string16& text) {
+bool PluginInstanceImpl::HandleCompositionEnd(const base::string16& text) {
   return SendCompositionEventToPlugin(PP_INPUTEVENT_TYPE_IME_COMPOSITION_END,
                                       text);
 }
 
-bool PluginInstance::HandleTextInput(const base::string16& text) {
+bool PluginInstanceImpl::HandleTextInput(const base::string16& text) {
   return SendCompositionEventToPlugin(PP_INPUTEVENT_TYPE_IME_TEXT,
                                       text);
 }
 
-void PluginInstance::GetSurroundingText(base::string16* text,
-                                        ui::Range* range) const {
+void PluginInstanceImpl::GetSurroundingText(base::string16* text,
+                                            ui::Range* range) const {
   std::vector<size_t> offsets;
   offsets.push_back(selection_anchor_);
   offsets.push_back(selection_caret_);
@@ -808,12 +811,12 @@
                                                     : offsets[1]);
 }
 
-bool PluginInstance::IsPluginAcceptingCompositionEvents() const {
+bool PluginInstanceImpl::IsPluginAcceptingCompositionEvents() const {
   return (filtered_input_event_mask_ & PP_INPUTEVENT_CLASS_IME) ||
       (input_event_mask_ & PP_INPUTEVENT_CLASS_IME);
 }
 
-gfx::Rect PluginInstance::GetCaretBounds() const {
+gfx::Rect PluginInstanceImpl::GetCaretBounds() const {
   if (!text_input_caret_set_) {
     // If it is never set by the plugin, use the bottom left corner.
     return gfx::Rect(view_data_.rect.point.x,
@@ -831,9 +834,9 @@
   return caret;
 }
 
-bool PluginInstance::HandleInputEvent(const WebKit::WebInputEvent& event,
-                                      WebCursorInfo* cursor_info) {
-  TRACE_EVENT0("ppapi", "PluginInstance::HandleInputEvent");
+bool PluginInstanceImpl::HandleInputEvent(const WebKit::WebInputEvent& event,
+                                          WebCursorInfo* cursor_info) {
+  TRACE_EVENT0("ppapi", "PluginInstanceImpl::HandleInputEvent");
 
   if (WebInputEvent::isMouseEventType(event.type))
     delegate()->DidReceiveMouseEvent(this);
@@ -843,7 +846,7 @@
     return false;
 
   // Keep a reference on the stack. See NOTE above.
-  scoped_refptr<PluginInstance> ref(this);
+  scoped_refptr<PluginInstanceImpl> ref(this);
 
   bool rv = false;
   if (LoadInputEventInterface()) {
@@ -889,18 +892,18 @@
   return rv;
 }
 
-void PluginInstance::HandleMessage(PP_Var message) {
-  TRACE_EVENT0("ppapi", "PluginInstance::HandleMessage");
+void PluginInstanceImpl::HandleMessage(PP_Var message) {
+  TRACE_EVENT0("ppapi", "PluginInstanceImpl::HandleMessage");
   // Keep a reference on the stack. See NOTE above.
-  scoped_refptr<PluginInstance> ref(this);
+  scoped_refptr<PluginInstanceImpl> ref(this);
   if (!LoadMessagingInterface())
     return;
   plugin_messaging_interface_->HandleMessage(pp_instance(), message);
 }
 
-PP_Var PluginInstance::GetInstanceObject() {
+PP_Var PluginInstanceImpl::GetInstanceObject() {
   // Keep a reference on the stack. See NOTE above.
-  scoped_refptr<PluginInstance> ref(this);
+  scoped_refptr<PluginInstanceImpl> ref(this);
 
   // If the plugin supports the private instance interface, try to retrieve its
   // instance object.
@@ -909,9 +912,10 @@
   return PP_MakeUndefined();
 }
 
-void PluginInstance::ViewChanged(const gfx::Rect& position,
-                                 const gfx::Rect& clip,
-                                 const std::vector<gfx::Rect>& cut_outs_rects) {
+void PluginInstanceImpl::ViewChanged(
+    const gfx::Rect& position,
+    const gfx::Rect& clip,
+    const std::vector<gfx::Rect>& cut_outs_rects) {
   // WebKit can give weird (x,y) positions for empty clip rects (since the
   // position technically doesn't matter). But we want to make these
   // consistent since this is given to the plugin, so force everything to 0
@@ -961,7 +965,7 @@
   SendDidChangeView();
 }
 
-void PluginInstance::SetWebKitFocus(bool has_focus) {
+void PluginInstanceImpl::SetWebKitFocus(bool has_focus) {
   if (has_webkit_focus_ == has_focus)
     return;
 
@@ -971,7 +975,7 @@
     SendFocusChangeNotification();
 }
 
-void PluginInstance::SetContentAreaFocus(bool has_focus) {
+void PluginInstanceImpl::SetContentAreaFocus(bool has_focus) {
   if (has_content_area_focus_ == has_focus)
     return;
 
@@ -981,44 +985,44 @@
     SendFocusChangeNotification();
 }
 
-void PluginInstance::PageVisibilityChanged(bool is_visible) {
+void PluginInstanceImpl::PageVisibilityChanged(bool is_visible) {
   if (is_visible == view_data_.is_page_visible)
     return;  // Nothing to do.
   view_data_.is_page_visible = is_visible;
 
   // If the initial DidChangeView notification hasn't been sent to the plugin,
   // let it pass the visibility state for us, instead of sending a notification
-  // immediately. It is possible that PluginInstance::ViewChanged() hasn't been
-  // called for the first time. In that case, most of the fields in |view_data_|
-  // haven't been properly initialized.
+  // immediately. It is possible that PluginInstanceImpl::ViewChanged() hasn't
+  // been called for the first time. In that case, most of the fields in
+  // |view_data_| haven't been properly initialized.
   if (sent_initial_did_change_view_)
     SendDidChangeView();
 }
 
-void PluginInstance::ViewWillInitiatePaint() {
+void PluginInstanceImpl::ViewWillInitiatePaint() {
   if (GetBoundGraphics2D())
     GetBoundGraphics2D()->ViewWillInitiatePaint();
   else if (bound_graphics_3d_.get())
     bound_graphics_3d_->ViewWillInitiatePaint();
 }
 
-void PluginInstance::ViewInitiatedPaint() {
+void PluginInstanceImpl::ViewInitiatedPaint() {
   if (GetBoundGraphics2D())
     GetBoundGraphics2D()->ViewInitiatedPaint();
   else if (bound_graphics_3d_.get())
     bound_graphics_3d_->ViewInitiatedPaint();
 }
 
-void PluginInstance::ViewFlushedPaint() {
+void PluginInstanceImpl::ViewFlushedPaint() {
   // Keep a reference on the stack. See NOTE above.
-  scoped_refptr<PluginInstance> ref(this);
+  scoped_refptr<PluginInstanceImpl> ref(this);
   if (GetBoundGraphics2D())
     GetBoundGraphics2D()->ViewFlushedPaint();
   else if (bound_graphics_3d_.get())
     bound_graphics_3d_->ViewFlushedPaint();
 }
 
-bool PluginInstance::GetBitmapForOptimizedPluginPaint(
+bool PluginInstanceImpl::GetBitmapForOptimizedPluginPaint(
     const gfx::Rect& paint_bounds,
     TransportDIB** dib,
     gfx::Rect* location,
@@ -1075,9 +1079,9 @@
   return true;
 }
 
-base::string16 PluginInstance::GetSelectedText(bool html) {
+base::string16 PluginInstanceImpl::GetSelectedText(bool html) {
   // Keep a reference on the stack. See NOTE above.
-  scoped_refptr<PluginInstance> ref(this);
+  scoped_refptr<PluginInstanceImpl> ref(this);
   if (!LoadSelectionInterface())
     return base::string16();
 
@@ -1092,9 +1096,9 @@
   return selection;
 }
 
-base::string16 PluginInstance::GetLinkAtPosition(const gfx::Point& point) {
+base::string16 PluginInstanceImpl::GetLinkAtPosition(const gfx::Point& point) {
   // Keep a reference on the stack. See NOTE above.
-  scoped_refptr<PluginInstance> ref(this);
+  scoped_refptr<PluginInstanceImpl> ref(this);
   if (!LoadPdfInterface())
     return base::string16();
 
@@ -1111,29 +1115,29 @@
   return link;
 }
 
-void PluginInstance::RequestSurroundingText(
+void PluginInstanceImpl::RequestSurroundingText(
     size_t desired_number_of_characters) {
   // Keep a reference on the stack. See NOTE above.
-  scoped_refptr<PluginInstance> ref(this);
+  scoped_refptr<PluginInstanceImpl> ref(this);
   if (!LoadTextInputInterface())
     return;
   plugin_textinput_interface_->RequestSurroundingText(
       pp_instance(), desired_number_of_characters);
 }
 
-void PluginInstance::Zoom(double factor, bool text_only) {
+void PluginInstanceImpl::Zoom(double factor, bool text_only) {
   // Keep a reference on the stack. See NOTE above.
-  scoped_refptr<PluginInstance> ref(this);
+  scoped_refptr<PluginInstanceImpl> ref(this);
   if (!LoadZoomInterface())
     return;
   plugin_zoom_interface_->Zoom(pp_instance(), factor, PP_FromBool(text_only));
 }
 
-bool PluginInstance::StartFind(const base::string16& search_text,
-                               bool case_sensitive,
-                               int identifier) {
+bool PluginInstanceImpl::StartFind(const base::string16& search_text,
+                                   bool case_sensitive,
+                                   int identifier) {
   // Keep a reference on the stack. See NOTE above.
-  scoped_refptr<PluginInstance> ref(this);
+  scoped_refptr<PluginInstanceImpl> ref(this);
   if (!LoadFindInterface())
     return false;
   find_identifier_ = identifier;
@@ -1144,24 +1148,24 @@
           PP_FromBool(case_sensitive)));
 }
 
-void PluginInstance::SelectFindResult(bool forward) {
+void PluginInstanceImpl::SelectFindResult(bool forward) {
   // Keep a reference on the stack. See NOTE above.
-  scoped_refptr<PluginInstance> ref(this);
+  scoped_refptr<PluginInstanceImpl> ref(this);
   if (LoadFindInterface())
     plugin_find_interface_->SelectFindResult(pp_instance(),
                                              PP_FromBool(forward));
 }
 
-void PluginInstance::StopFind() {
+void PluginInstanceImpl::StopFind() {
   // Keep a reference on the stack. See NOTE above.
-  scoped_refptr<PluginInstance> ref(this);
+  scoped_refptr<PluginInstanceImpl> ref(this);
   if (!LoadFindInterface())
     return;
   find_identifier_ = -1;
   plugin_find_interface_->StopFind(pp_instance());
 }
 
-bool PluginInstance::LoadFindInterface() {
+bool PluginInstanceImpl::LoadFindInterface() {
   if (!plugin_find_interface_) {
     plugin_find_interface_ =
         static_cast<const PPP_Find_Dev*>(module_->GetPluginInterface(
@@ -1171,7 +1175,7 @@
   return !!plugin_find_interface_;
 }
 
-bool PluginInstance::LoadInputEventInterface() {
+bool PluginInstanceImpl::LoadInputEventInterface() {
   if (!checked_for_plugin_input_event_interface_) {
     checked_for_plugin_input_event_interface_ = true;
     plugin_input_event_interface_ =
@@ -1181,7 +1185,7 @@
   return !!plugin_input_event_interface_;
 }
 
-bool PluginInstance::LoadMessagingInterface() {
+bool PluginInstanceImpl::LoadMessagingInterface() {
   if (!checked_for_plugin_messaging_interface_) {
     checked_for_plugin_messaging_interface_ = true;
     plugin_messaging_interface_ =
@@ -1191,7 +1195,7 @@
   return !!plugin_messaging_interface_;
 }
 
-bool PluginInstance::LoadMouseLockInterface() {
+bool PluginInstanceImpl::LoadMouseLockInterface() {
   if (!plugin_mouse_lock_interface_) {
     plugin_mouse_lock_interface_ =
         static_cast<const PPP_MouseLock*>(module_->GetPluginInterface(
@@ -1201,7 +1205,7 @@
   return !!plugin_mouse_lock_interface_;
 }
 
-bool PluginInstance::LoadPdfInterface() {
+bool PluginInstanceImpl::LoadPdfInterface() {
   if (!checked_for_plugin_pdf_interface_) {
     checked_for_plugin_pdf_interface_ = true;
     plugin_pdf_interface_ =
@@ -1212,7 +1216,7 @@
   return !!plugin_pdf_interface_;
 }
 
-bool PluginInstance::LoadPrintInterface() {
+bool PluginInstanceImpl::LoadPrintInterface() {
   // Only check for the interface if the plugin has dev permission.
   if (!module_->permissions().HasPermission(::ppapi::PERMISSION_DEV))
     return false;
@@ -1223,7 +1227,7 @@
   return !!plugin_print_interface_;
 }
 
-bool PluginInstance::LoadPrivateInterface() {
+bool PluginInstanceImpl::LoadPrivateInterface() {
   // Only check for the interface if the plugin has private permission.
   if (!module_->permissions().HasPermission(::ppapi::PERMISSION_PRIVATE))
     return false;
@@ -1235,7 +1239,7 @@
   return !!plugin_private_interface_;
 }
 
-bool PluginInstance::LoadSelectionInterface() {
+bool PluginInstanceImpl::LoadSelectionInterface() {
   if (!plugin_selection_interface_) {
     plugin_selection_interface_ =
         static_cast<const PPP_Selection_Dev*>(module_->GetPluginInterface(
@@ -1244,7 +1248,7 @@
   return !!plugin_selection_interface_;
 }
 
-bool PluginInstance::LoadTextInputInterface() {
+bool PluginInstanceImpl::LoadTextInputInterface() {
   if (!plugin_textinput_interface_) {
     plugin_textinput_interface_ =
         static_cast<const PPP_TextInput_Dev*>(module_->GetPluginInterface(
@@ -1254,7 +1258,7 @@
   return !!plugin_textinput_interface_;
 }
 
-bool PluginInstance::LoadZoomInterface() {
+bool PluginInstanceImpl::LoadZoomInterface() {
   if (!plugin_zoom_interface_) {
     plugin_zoom_interface_ =
         static_cast<const PPP_Zoom_Dev*>(module_->GetPluginInterface(
@@ -1264,12 +1268,12 @@
   return !!plugin_zoom_interface_;
 }
 
-bool PluginInstance::PluginHasFocus() const {
+bool PluginInstanceImpl::PluginHasFocus() const {
   return flash_fullscreen_ || (has_webkit_focus_ && has_content_area_focus_);
 }
 
-void PluginInstance::SendFocusChangeNotification() {
-  // This call can happen during PluginInstance destruction, because WebKit
+void PluginInstanceImpl::SendFocusChangeNotification() {
+  // This call can happen during PluginInstanceImpl destruction, because WebKit
   // informs the plugin it's losing focus. See crbug.com/236574
   if (!delegate_ || !instance_interface_)
     return;
@@ -1278,7 +1282,7 @@
   instance_interface_->DidChangeFocus(pp_instance(), PP_FromBool(has_focus));
 }
 
-void PluginInstance::UpdateTouchEventRequest() {
+void PluginInstanceImpl::UpdateTouchEventRequest() {
   bool raw_touch = (filtered_input_event_mask_ & PP_INPUTEVENT_CLASS_TOUCH) ||
                    (input_event_mask_ & PP_INPUTEVENT_CLASS_TOUCH);
   container_->requestTouchEventType(raw_touch ?
@@ -1286,21 +1290,21 @@
       WebKit::WebPluginContainer::TouchEventRequestTypeSynthesizedMouse);
 }
 
-bool PluginInstance::IsAcceptingWheelEvents() const {
+bool PluginInstanceImpl::IsAcceptingWheelEvents() const {
   return (filtered_input_event_mask_ & PP_INPUTEVENT_CLASS_WHEEL) ||
       (input_event_mask_ & PP_INPUTEVENT_CLASS_WHEEL);
 }
 
-void PluginInstance::ScheduleAsyncDidChangeView() {
+void PluginInstanceImpl::ScheduleAsyncDidChangeView() {
   if (view_change_weak_ptr_factory_.HasWeakPtrs())
     return;  // Already scheduled.
   base::MessageLoop::current()->PostTask(
       FROM_HERE,
-      base::Bind(&PluginInstance::SendAsyncDidChangeView,
+      base::Bind(&PluginInstanceImpl::SendAsyncDidChangeView,
                  view_change_weak_ptr_factory_.GetWeakPtr()));
 }
 
-void PluginInstance::SendAsyncDidChangeView() {
+void PluginInstanceImpl::SendAsyncDidChangeView() {
   // The bound callback that owns the weak pointer is still valid until after
   // this function returns. SendDidChangeView checks HasWeakPtrs, so we need to
   // invalidate them here.
@@ -1310,7 +1314,7 @@
   SendDidChangeView();
 }
 
-void PluginInstance::SendDidChangeView() {
+void PluginInstanceImpl::SendDidChangeView() {
   // Don't send DidChangeView to crashed plugins.
   if (module()->is_crashed())
     return;
@@ -1342,7 +1346,7 @@
                                      &view_data_.clip_rect);
 }
 
-void PluginInstance::ReportGeometry() {
+void PluginInstanceImpl::ReportGeometry() {
   // If this call was delayed, we may have transitioned back to fullscreen in
   // the mean time, so only report the geometry if we are actually in normal
   // mode.
@@ -1350,10 +1354,10 @@
     container_->reportGeometry();
 }
 
-bool PluginInstance::GetPreferredPrintOutputFormat(
+bool PluginInstanceImpl::GetPreferredPrintOutputFormat(
     PP_PrintOutputFormat_Dev* format) {
   // Keep a reference on the stack. See NOTE above.
-  scoped_refptr<PluginInstance> ref(this);
+  scoped_refptr<PluginInstanceImpl> ref(this);
   if (!LoadPrintInterface())
     return false;
   uint32_t supported_formats =
@@ -1365,21 +1369,21 @@
   return false;
 }
 
-bool PluginInstance::SupportsPrintInterface() {
+bool PluginInstanceImpl::SupportsPrintInterface() {
   PP_PrintOutputFormat_Dev format;
   return GetPreferredPrintOutputFormat(&format);
 }
 
-bool PluginInstance::IsPrintScalingDisabled() {
+bool PluginInstanceImpl::IsPrintScalingDisabled() {
   DCHECK(plugin_print_interface_);
   if (!plugin_print_interface_)
     return false;
   return plugin_print_interface_->IsScalingDisabled(pp_instance()) == PP_TRUE;
 }
 
-int PluginInstance::PrintBegin(const WebPrintParams& print_params) {
+int PluginInstanceImpl::PrintBegin(const WebPrintParams& print_params) {
   // Keep a reference on the stack. See NOTE above.
-  scoped_refptr<PluginInstance> ref(this);
+  scoped_refptr<PluginInstanceImpl> ref(this);
   PP_PrintOutputFormat_Dev format;
   if (!GetPreferredPrintOutputFormat(&format)) {
     // PrintBegin should not have been called since SupportsPrintInterface
@@ -1408,7 +1412,7 @@
   return num_pages;
 }
 
-bool PluginInstance::PrintPage(int page_number, WebKit::WebCanvas* canvas) {
+bool PluginInstanceImpl::PrintPage(int page_number, WebKit::WebCanvas* canvas) {
 #if defined(ENABLE_PRINTING)
   DCHECK(plugin_print_interface_);
   PP_PrintPageNumberRange_Dev page_range;
@@ -1431,11 +1435,12 @@
 #endif
 }
 
-bool PluginInstance::PrintPageHelper(PP_PrintPageNumberRange_Dev* page_ranges,
-                                     int num_ranges,
-                                     WebKit::WebCanvas* canvas) {
+bool PluginInstanceImpl::PrintPageHelper(
+    PP_PrintPageNumberRange_Dev* page_ranges,
+    int num_ranges,
+    WebKit::WebCanvas* canvas) {
   // Keep a reference on the stack. See NOTE above.
-  scoped_refptr<PluginInstance> ref(this);
+  scoped_refptr<PluginInstanceImpl> ref(this);
   DCHECK(plugin_print_interface_);
   if (!plugin_print_interface_)
     return false;
@@ -1455,9 +1460,9 @@
   return ret;
 }
 
-void PluginInstance::PrintEnd() {
+void PluginInstanceImpl::PrintEnd() {
   // Keep a reference on the stack. See NOTE above.
-  scoped_refptr<PluginInstance> ref(this);
+  scoped_refptr<PluginInstanceImpl> ref(this);
   if (!ranges_.empty())
     PrintPageHelper(&(ranges_.front()), ranges_.size(), canvas_.get());
   canvas_.clear();
@@ -1473,14 +1478,14 @@
 #endif  // defined(OS_MACOSX)
 }
 
-bool PluginInstance::CanRotateView() {
+bool PluginInstanceImpl::CanRotateView() {
   if (!LoadPdfInterface())
     return false;
 
   return true;
 }
 
-void PluginInstance::SetBoundGraphics2DForTest(
+void PluginInstanceImpl::SetBoundGraphics2DForTest(
     PluginDelegate::PlatformGraphics2D* graphics) {
   BindGraphics(pp_instance(), 0);  // Unbind any old stuff.
   if (graphics) {
@@ -1489,7 +1494,7 @@
   }
 }
 
-void PluginInstance::RotateView(WebPlugin::RotationType type) {
+void PluginInstanceImpl::RotateView(WebPlugin::RotationType type) {
   if (!LoadPdfInterface())
     return;
   PP_PrivatePageTransformType transform_type =
@@ -1500,17 +1505,17 @@
   // NOTE: plugin instance may have been deleted.
 }
 
-bool PluginInstance::FlashIsFullscreenOrPending() {
+bool PluginInstanceImpl::FlashIsFullscreenOrPending() {
   return fullscreen_container_ != NULL;
 }
 
-bool PluginInstance::IsFullscreenOrPending() {
+bool PluginInstanceImpl::IsFullscreenOrPending() {
   return desired_fullscreen_state_;
 }
 
-bool PluginInstance::SetFullscreen(bool fullscreen) {
+bool PluginInstanceImpl::SetFullscreen(bool fullscreen) {
   // Keep a reference on the stack. See NOTE above.
-  scoped_refptr<PluginInstance> ref(this);
+  scoped_refptr<PluginInstanceImpl> ref(this);
 
   // Check whether we are trying to switch to the state we're already going
   // to (i.e. if we're already switching to fullscreen but the fullscreen
@@ -1544,38 +1549,7 @@
   return true;
 }
 
-void PluginInstance::FlashSetFullscreen(bool fullscreen, bool delay_report) {
-  TRACE_EVENT0("ppapi", "PluginInstance::FlashSetFullscreen");
-  // Keep a reference on the stack. See NOTE above.
-  scoped_refptr<PluginInstance> ref(this);
-
-  // We check whether we are trying to switch to the state we're already going
-  // to (i.e. if we're already switching to fullscreen but the fullscreen
-  // container isn't ready yet, don't do anything more).
-  if (fullscreen == FlashIsFullscreenOrPending())
-    return;
-
-  // Unbind current 2D or 3D graphics context.
-  VLOG(1) << "Setting fullscreen to " << (fullscreen ? "on" : "off");
-  if (fullscreen) {
-    DCHECK(!fullscreen_container_);
-    fullscreen_container_ = delegate_->CreateFullscreenContainer(this);
-    UpdateLayer();
-  } else {
-    DCHECK(fullscreen_container_);
-    fullscreen_container_->Destroy();
-    fullscreen_container_ = NULL;
-    UpdateFlashFullscreenState(false);
-    if (!delay_report) {
-      ReportGeometry();
-    } else {
-      base::MessageLoop::current()->PostTask(
-          FROM_HERE, base::Bind(&PluginInstance::ReportGeometry, this));
-    }
-  }
-}
-
-void PluginInstance::UpdateFlashFullscreenState(bool flash_fullscreen) {
+void PluginInstanceImpl::UpdateFlashFullscreenState(bool flash_fullscreen) {
   bool is_mouselock_pending = TrackedCallback::IsPending(lock_mouse_callback_);
 
   if (flash_fullscreen == flash_fullscreen_) {
@@ -1609,58 +1583,7 @@
     SendFocusChangeNotification();
 }
 
-int32_t PluginInstance::Navigate(const ::ppapi::URLRequestInfoData& request,
-                                 const char* target,
-                                 bool from_user_action) {
-  if (!container_)
-    return PP_ERROR_FAILED;
-
-  WebDocument document = container_->element().document();
-  WebFrame* frame = document.frame();
-  if (!frame)
-    return PP_ERROR_FAILED;
-
-  ::ppapi::URLRequestInfoData completed_request = request;
-
-  WebURLRequest web_request;
-  if (!CreateWebURLRequest(&completed_request, frame, &web_request))
-    return PP_ERROR_FAILED;
-  web_request.setFirstPartyForCookies(document.firstPartyForCookies());
-  web_request.setHasUserGesture(from_user_action);
-
-  GURL gurl(web_request.url());
-  if (gurl.SchemeIs("javascript")) {
-    // In imitation of the NPAPI implementation, only |target_frame == frame| is
-    // allowed for security reasons.
-    WebFrame* target_frame =
-        frame->view()->findFrameByName(WebString::fromUTF8(target), frame);
-    if (target_frame != frame)
-      return PP_ERROR_NOACCESS;
-
-    // TODO(viettrungluu): NPAPI sends the result back to the plugin -- do we
-    // need that?
-    WebString result = container_->executeScriptURL(gurl, from_user_action);
-    return result.isNull() ? PP_ERROR_FAILED : PP_OK;
-  }
-
-  // Only GETs and POSTs are supported.
-  if (web_request.httpMethod() != "GET" &&
-      web_request.httpMethod() != "POST")
-    return PP_ERROR_BADARGUMENT;
-
-  WebString target_str = WebString::fromUTF8(target);
-  container_->loadFrameRequest(web_request, target_str, false, NULL);
-  return PP_OK;
-}
-
-bool PluginInstance::IsRectTopmost(const gfx::Rect& rect) {
-  if (flash_fullscreen_)
-    return true;
-
-  return container_->isRectTopmost(rect);
-}
-
-bool PluginInstance::IsViewAccelerated() {
+bool PluginInstanceImpl::IsViewAccelerated() {
   if (!container_)
     return false;
 
@@ -1675,12 +1598,12 @@
   return view->isAcceleratedCompositingActive();
 }
 
-PluginDelegate::PlatformContext3D* PluginInstance::CreateContext3D() {
+PluginDelegate::PlatformContext3D* PluginInstanceImpl::CreateContext3D() {
   return delegate_->CreateContext3D();
 }
 
-bool PluginInstance::PrintPDFOutput(PP_Resource print_output,
-                                    WebKit::WebCanvas* canvas) {
+bool PluginInstanceImpl::PrintPDFOutput(PP_Resource print_output,
+                                        WebKit::WebCanvas* canvas) {
 #if defined(ENABLE_PRINTING)
   ::ppapi::thunk::EnterResourceNoLock<PPB_Buffer_API> enter(print_output, true);
   if (enter.failed())
@@ -1771,13 +1694,14 @@
 #endif
 }
 
-PluginDelegate::PlatformGraphics2D* PluginInstance::GetBoundGraphics2D() const {
+PluginDelegate::PlatformGraphics2D*
+    PluginInstanceImpl::GetBoundGraphics2D() const {
   return bound_graphics_2d_platform_;
 }
 
 static void IgnoreCallback(unsigned, bool) {}
 
-void PluginInstance::UpdateLayer() {
+void PluginInstanceImpl::UpdateLayer() {
   if (!container_)
     return;
 
@@ -1821,24 +1745,19 @@
   layer_bound_to_fullscreen_ = !!fullscreen_container_;
 }
 
-void PluginInstance::AddPluginObject(PluginObject* plugin_object) {
+void PluginInstanceImpl::AddPluginObject(PluginObject* plugin_object) {
   DCHECK(live_plugin_objects_.find(plugin_object) ==
          live_plugin_objects_.end());
   live_plugin_objects_.insert(plugin_object);
 }
 
-void PluginInstance::RemovePluginObject(PluginObject* plugin_object) {
+void PluginInstanceImpl::RemovePluginObject(PluginObject* plugin_object) {
   // Don't actually verify that the object is in the set since during module
   // deletion we'll be in the process of freeing them.
   live_plugin_objects_.erase(plugin_object);
 }
 
-bool PluginInstance::IsFullPagePlugin() const {
-  WebFrame* frame = container()->element().document().frame();
-  return frame->view()->mainFrame()->document().isPluginDocument();
-}
-
-bool PluginInstance::IsProcessingUserGesture() {
+bool PluginInstanceImpl::IsProcessingUserGesture() {
   PP_TimeTicks now =
       ::ppapi::TimeTicksToPPTimeTicks(base::TimeTicks::Now());
   // Give a lot of slack so tests won't be flaky.
@@ -1847,30 +1766,30 @@
          (now - pending_user_gesture_ < kUserGestureDurationInSeconds);
 }
 
-WebUserGestureToken PluginInstance::CurrentUserGestureToken() {
+WebUserGestureToken PluginInstanceImpl::CurrentUserGestureToken() {
   if (!IsProcessingUserGesture())
     pending_user_gesture_token_ = WebUserGestureToken();
   return pending_user_gesture_token_;
 }
 
-void PluginInstance::OnLockMouseACK(bool succeeded) {
+void PluginInstanceImpl::OnLockMouseACK(bool succeeded) {
   if (TrackedCallback::IsPending(lock_mouse_callback_))
     lock_mouse_callback_->Run(succeeded ? PP_OK : PP_ERROR_FAILED);
 }
 
-void PluginInstance::OnMouseLockLost() {
+void PluginInstanceImpl::OnMouseLockLost() {
   if (LoadMouseLockInterface())
     plugin_mouse_lock_interface_->MouseLockLost(pp_instance());
 }
 
-void PluginInstance::HandleMouseLockedInputEvent(
+void PluginInstanceImpl::HandleMouseLockedInputEvent(
     const WebKit::WebMouseEvent& event) {
   // |cursor_info| is ignored since it is hidden when the mouse is locked.
   WebKit::WebCursorInfo cursor_info;
   HandleInputEvent(event, &cursor_info);
 }
 
-void PluginInstance::SimulateInputEvent(const InputEventData& input_event) {
+void PluginInstanceImpl::SimulateInputEvent(const InputEventData& input_event) {
   WebView* web_view = container()->element().document().frame()->view();
   if (!web_view) {
     NOTREACHED();
@@ -1892,7 +1811,7 @@
   }
 }
 
-bool PluginInstance::SimulateIMEEvent(const InputEventData& input_event) {
+bool PluginInstanceImpl::SimulateIMEEvent(const InputEventData& input_event) {
   switch (input_event.event_type) {
     case PP_INPUTEVENT_TYPE_IME_COMPOSITION_START:
     case PP_INPUTEVENT_TYPE_IME_COMPOSITION_UPDATE:
@@ -1912,7 +1831,7 @@
   return true;
 }
 
-void PluginInstance::SimulateImeSetCompositionEvent(
+void PluginInstanceImpl::SimulateImeSetCompositionEvent(
     const InputEventData& input_event) {
   std::vector<size_t> offsets;
   offsets.push_back(input_event.composition_selection_start);
@@ -1938,7 +1857,7 @@
       utf16_text, underlines, offsets[0], offsets[1]);
 }
 
-ContentDecryptorDelegate* PluginInstance::GetContentDecryptorDelegate() {
+ContentDecryptorDelegate* PluginInstanceImpl::GetContentDecryptorDelegate() {
   if (content_decryptor_delegate_)
     return content_decryptor_delegate_.get();
 
@@ -1954,9 +1873,9 @@
   return content_decryptor_delegate_.get();
 }
 
-PP_Bool PluginInstance::BindGraphics(PP_Instance instance,
-                                     PP_Resource device) {
-  TRACE_EVENT0("ppapi", "PluginInstance::BindGraphics");
+PP_Bool PluginInstanceImpl::BindGraphics(PP_Instance instance,
+                                         PP_Resource device) {
+  TRACE_EVENT0("ppapi", "PluginInstanceImpl::BindGraphics");
   // The Graphics3D instance can't be destroyed until we call
   // UpdateLayer().
   scoped_refptr< ::ppapi::Resource> old_graphics = bound_graphics_3d_.get();
@@ -2009,19 +1928,19 @@
   return PP_FALSE;
 }
 
-PP_Bool PluginInstance::IsFullFrame(PP_Instance instance) {
+PP_Bool PluginInstanceImpl::IsFullFrame(PP_Instance instance) {
   return PP_FromBool(full_frame());
 }
 
-const ViewData* PluginInstance::GetViewData(PP_Instance instance) {
+const ViewData* PluginInstanceImpl::GetViewData(PP_Instance instance) {
   return &view_data_;
 }
 
-PP_Bool PluginInstance::FlashIsFullscreen(PP_Instance instance) {
+PP_Bool PluginInstanceImpl::FlashIsFullscreen(PP_Instance instance) {
   return PP_FromBool(flash_fullscreen_);
 }
 
-PP_Var PluginInstance::GetWindowObject(PP_Instance instance) {
+PP_Var PluginInstanceImpl::GetWindowObject(PP_Instance instance) {
   if (!container_)
     return PP_MakeUndefined();
 
@@ -2032,19 +1951,19 @@
   return NPObjectToPPVar(this, frame->windowObject());
 }
 
-PP_Var PluginInstance::GetOwnerElementObject(PP_Instance instance) {
+PP_Var PluginInstanceImpl::GetOwnerElementObject(PP_Instance instance) {
   if (!container_)
     return PP_MakeUndefined();
   return NPObjectToPPVar(this, container_->scriptableObjectForElement());
 }
 
-PP_Var PluginInstance::ExecuteScript(PP_Instance instance,
-                                     PP_Var script,
-                                     PP_Var* exception) {
+PP_Var PluginInstanceImpl::ExecuteScript(PP_Instance instance,
+                                         PP_Var script,
+                                         PP_Var* exception) {
   // Executing the script may remove the plugin from the DOM, so we need to keep
   // a reference to ourselves so that we can still process the result after the
   // WebBindings::evaluate() below.
-  scoped_refptr<PluginInstance> ref(this);
+  scoped_refptr<PluginInstanceImpl> ref(this);
   TryCatch try_catch(exception);
   if (try_catch.has_exception())
     return PP_MakeUndefined();
@@ -2089,17 +2008,17 @@
   return ret;
 }
 
-uint32_t PluginInstance::GetAudioHardwareOutputSampleRate(
+uint32_t PluginInstanceImpl::GetAudioHardwareOutputSampleRate(
     PP_Instance instance) {
   return delegate()->GetAudioHardwareOutputSampleRate();
 }
 
-uint32_t PluginInstance::GetAudioHardwareOutputBufferSize(
+uint32_t PluginInstanceImpl::GetAudioHardwareOutputBufferSize(
     PP_Instance instance) {
   return delegate()->GetAudioHardwareOutputBufferSize();
 }
 
-PP_Var PluginInstance::GetDefaultCharSet(PP_Instance instance) {
+PP_Var PluginInstanceImpl::GetDefaultCharSet(PP_Instance instance) {
   std::string encoding = delegate()->GetDefaultEncoding();
   return StringVar::StringToPPVar(encoding);
 }
@@ -2108,53 +2027,54 @@
 // PPP_ContentDecryptor_Private calls made on |content_decryptor_delegate_|.
 // Therefore, |content_decryptor_delegate_| must have been initialized when
 // the following methods are called.
-void PluginInstance::NeedKey(PP_Instance instance,
-                             PP_Var key_system_var,
-                             PP_Var session_id_var,
-                             PP_Var init_data_var) {
+void PluginInstanceImpl::NeedKey(PP_Instance instance,
+                                 PP_Var key_system_var,
+                                 PP_Var session_id_var,
+                                 PP_Var init_data_var) {
   content_decryptor_delegate_->NeedKey(
       key_system_var, session_id_var, init_data_var);
 }
 
-void PluginInstance::KeyAdded(PP_Instance instance,
-                              PP_Var key_system_var,
-                              PP_Var session_id_var) {
+void PluginInstanceImpl::KeyAdded(PP_Instance instance,
+                                  PP_Var key_system_var,
+                                  PP_Var session_id_var) {
   content_decryptor_delegate_->KeyAdded(key_system_var, session_id_var);
 }
 
-void PluginInstance::KeyMessage(PP_Instance instance,
-                                PP_Var key_system_var,
-                                PP_Var session_id_var,
-                                PP_Var message_var,
-                                PP_Var default_url_var) {
+void PluginInstanceImpl::KeyMessage(PP_Instance instance,
+                                    PP_Var key_system_var,
+                                    PP_Var session_id_var,
+                                    PP_Var message_var,
+                                    PP_Var default_url_var) {
   content_decryptor_delegate_->KeyMessage(
       key_system_var, session_id_var, message_var, default_url_var);
 }
 
-void PluginInstance::KeyError(PP_Instance instance,
-                              PP_Var key_system_var,
-                              PP_Var session_id_var,
-                              int32_t media_error,
-                              int32_t system_code) {
+void PluginInstanceImpl::KeyError(PP_Instance instance,
+                                  PP_Var key_system_var,
+                                  PP_Var session_id_var,
+                                  int32_t media_error,
+                                  int32_t system_code) {
   content_decryptor_delegate_->KeyError(
       key_system_var, session_id_var, media_error, system_code);
 }
 
-void PluginInstance::DeliverBlock(PP_Instance instance,
-                                  PP_Resource decrypted_block,
-                                  const PP_DecryptedBlockInfo* block_info) {
+void PluginInstanceImpl::DeliverBlock(PP_Instance instance,
+                                      PP_Resource decrypted_block,
+                                      const PP_DecryptedBlockInfo* block_info) {
   content_decryptor_delegate_->DeliverBlock(decrypted_block, block_info);
 }
 
-void PluginInstance::DecoderInitializeDone(PP_Instance instance,
-                                           PP_DecryptorStreamType decoder_type,
-                                           uint32_t request_id,
-                                           PP_Bool success) {
+void PluginInstanceImpl::DecoderInitializeDone(
+    PP_Instance instance,
+    PP_DecryptorStreamType decoder_type,
+    uint32_t request_id,
+    PP_Bool success) {
   content_decryptor_delegate_->DecoderInitializeDone(
       decoder_type, request_id, success);
 }
 
-void PluginInstance::DecoderDeinitializeDone(
+void PluginInstanceImpl::DecoderDeinitializeDone(
     PP_Instance instance,
     PP_DecryptorStreamType decoder_type,
     uint32_t request_id) {
@@ -2162,55 +2082,56 @@
                                                        request_id);
 }
 
-void PluginInstance::DecoderResetDone(PP_Instance instance,
-                                      PP_DecryptorStreamType decoder_type,
-                                      uint32_t request_id) {
+void PluginInstanceImpl::DecoderResetDone(PP_Instance instance,
+                                          PP_DecryptorStreamType decoder_type,
+                                          uint32_t request_id) {
   content_decryptor_delegate_->DecoderResetDone(decoder_type, request_id);
 }
 
 
-void PluginInstance::DeliverFrame(PP_Instance instance,
-                                  PP_Resource decrypted_frame,
-                                  const PP_DecryptedFrameInfo* frame_info) {
+void PluginInstanceImpl::DeliverFrame(PP_Instance instance,
+                                      PP_Resource decrypted_frame,
+                                      const PP_DecryptedFrameInfo* frame_info) {
   content_decryptor_delegate_->DeliverFrame(decrypted_frame, frame_info);
 }
 
-void PluginInstance::DeliverSamples(PP_Instance instance,
-                                    PP_Resource audio_frames,
-                                    const PP_DecryptedBlockInfo* block_info) {
+void PluginInstanceImpl::DeliverSamples(
+    PP_Instance instance,
+    PP_Resource audio_frames,
+    const PP_DecryptedBlockInfo* block_info) {
   content_decryptor_delegate_->DeliverSamples(audio_frames, block_info);
 }
 
-void PluginInstance::NumberOfFindResultsChanged(PP_Instance instance,
-                                                int32_t total,
-                                                PP_Bool final_result) {
+void PluginInstanceImpl::NumberOfFindResultsChanged(PP_Instance instance,
+                                                    int32_t total,
+                                                    PP_Bool final_result) {
   DCHECK_NE(find_identifier_, -1);
   delegate_->NumberOfFindResultsChanged(find_identifier_, total,
                                         PP_ToBool(final_result));
 }
 
-void PluginInstance::SelectedFindResultChanged(PP_Instance instance,
-                                               int32_t index) {
+void PluginInstanceImpl::SelectedFindResultChanged(PP_Instance instance,
+                                                   int32_t index) {
   DCHECK_NE(find_identifier_, -1);
   delegate_->SelectedFindResultChanged(find_identifier_, index);
 }
 
-PP_Bool PluginInstance::IsFullscreen(PP_Instance instance) {
+PP_Bool PluginInstanceImpl::IsFullscreen(PP_Instance instance) {
   return PP_FromBool(view_data_.is_fullscreen);
 }
 
-PP_Bool PluginInstance::SetFullscreen(PP_Instance instance,
-                                      PP_Bool fullscreen) {
+PP_Bool PluginInstanceImpl::SetFullscreen(PP_Instance instance,
+                                          PP_Bool fullscreen) {
   return PP_FromBool(SetFullscreen(PP_ToBool(fullscreen)));
 }
 
-PP_Bool PluginInstance::GetScreenSize(PP_Instance instance, PP_Size* size) {
+PP_Bool PluginInstanceImpl::GetScreenSize(PP_Instance instance, PP_Size* size) {
   gfx::Size screen_size = delegate()->GetScreenSize();
   *size = PP_MakeSize(screen_size.width(), screen_size.height());
   return PP_TRUE;
 }
 
-::ppapi::Resource* PluginInstance::GetSingletonResource(
+::ppapi::Resource* PluginInstanceImpl::GetSingletonResource(
     PP_Instance instance,
     ::ppapi::SingletonResourceID id) {
   // Flash APIs and some others aren't implemented in-process.
@@ -2236,30 +2157,31 @@
   return NULL;
 }
 
-int32_t PluginInstance::RequestInputEvents(PP_Instance instance,
-                                           uint32_t event_classes) {
+int32_t PluginInstanceImpl::RequestInputEvents(PP_Instance instance,
+                                               uint32_t event_classes) {
   input_event_mask_ |= event_classes;
   filtered_input_event_mask_ &= ~(event_classes);
   RequestInputEventsHelper(event_classes);
   return ValidateRequestInputEvents(false, event_classes);
 }
 
-int32_t PluginInstance::RequestFilteringInputEvents(PP_Instance instance,
-                                                    uint32_t event_classes) {
+int32_t PluginInstanceImpl::RequestFilteringInputEvents(
+    PP_Instance instance,
+    uint32_t event_classes) {
   filtered_input_event_mask_ |= event_classes;
   input_event_mask_ &= ~(event_classes);
   RequestInputEventsHelper(event_classes);
   return ValidateRequestInputEvents(true, event_classes);
 }
 
-void PluginInstance::ClearInputEventRequest(PP_Instance instance,
-                                            uint32_t event_classes) {
+void PluginInstanceImpl::ClearInputEventRequest(PP_Instance instance,
+                                                uint32_t event_classes) {
   input_event_mask_ &= ~(event_classes);
   filtered_input_event_mask_ &= ~(event_classes);
   RequestInputEventsHelper(event_classes);
 }
 
-void PluginInstance::ZoomChanged(PP_Instance instance, double factor) {
+void PluginInstanceImpl::ZoomChanged(PP_Instance instance, double factor) {
   // We only want to tell the page to change its zoom if the whole page is the
   // plugin.  If we're in an iframe, then don't do anything.
   if (!IsFullPagePlugin())
@@ -2267,9 +2189,9 @@
   container()->zoomLevelChanged(WebView::zoomFactorToZoomLevel(factor));
 }
 
-void PluginInstance::ZoomLimitsChanged(PP_Instance instance,
-                                       double minimum_factor,
-                                       double maximium_factor) {
+void PluginInstanceImpl::ZoomLimitsChanged(PP_Instance instance,
+                                           double minimum_factor,
+                                           double maximium_factor) {
   if (minimum_factor > maximium_factor) {
     NOTREACHED();
     return;
@@ -2277,14 +2199,14 @@
   delegate()->ZoomLimitsChanged(minimum_factor, maximium_factor);
 }
 
-void PluginInstance::PostMessage(PP_Instance instance, PP_Var message) {
+void PluginInstanceImpl::PostMessage(PP_Instance instance, PP_Var message) {
   message_channel_->PostMessageToJavaScript(message);
 }
 
-PP_Bool PluginInstance::SetCursor(PP_Instance instance,
-                                  PP_MouseCursor_Type type,
-                                  PP_Resource image,
-                                  const PP_Point* hot_spot) {
+PP_Bool PluginInstanceImpl::SetCursor(PP_Instance instance,
+                                      PP_MouseCursor_Type type,
+                                      PP_Resource image,
+                                      const PP_Point* hot_spot) {
   if (!ValidateSetCursorParams(type, image, hot_spot))
     return PP_FALSE;
 
@@ -2320,8 +2242,8 @@
   return PP_TRUE;
 }
 
-int32_t PluginInstance::LockMouse(PP_Instance instance,
-                                  scoped_refptr<TrackedCallback> callback) {
+int32_t PluginInstanceImpl::LockMouse(PP_Instance instance,
+                                      scoped_refptr<TrackedCallback> callback) {
   if (TrackedCallback::IsPending(lock_mouse_callback_))
     return PP_ERROR_INPROGRESS;
 
@@ -2349,12 +2271,12 @@
   return PP_OK_COMPLETIONPENDING;
 }
 
-void PluginInstance::UnlockMouse(PP_Instance instance) {
+void PluginInstanceImpl::UnlockMouse(PP_Instance instance) {
   delegate()->UnlockMouse(this);
 }
 
-void PluginInstance::SetTextInputType(PP_Instance instance,
-                                      PP_TextInput_Type type) {
+void PluginInstanceImpl::SetTextInputType(PP_Instance instance,
+                                          PP_TextInput_Type type) {
   int itype = type;
   if (itype < 0 || itype > ui::TEXT_INPUT_TYPE_URL)
     itype = ui::TEXT_INPUT_TYPE_NONE;
@@ -2362,20 +2284,20 @@
   delegate()->PluginTextInputTypeChanged(this);
 }
 
-void PluginInstance::UpdateCaretPosition(PP_Instance instance,
-                                         const PP_Rect& caret,
-                                         const PP_Rect& bounding_box) {
+void PluginInstanceImpl::UpdateCaretPosition(PP_Instance instance,
+                                             const PP_Rect& caret,
+                                             const PP_Rect& bounding_box) {
   text_input_caret_ = PP_ToGfxRect(caret);
   text_input_caret_bounds_ = PP_ToGfxRect(bounding_box);
   text_input_caret_set_ = true;
   delegate()->PluginCaretPositionChanged(this);
 }
 
-void PluginInstance::CancelCompositionText(PP_Instance instance) {
+void PluginInstanceImpl::CancelCompositionText(PP_Instance instance) {
   delegate()->PluginRequestedCancelComposition(this);
 }
 
-void PluginInstance::SelectionChanged(PP_Instance instance) {
+void PluginInstanceImpl::SelectionChanged(PP_Instance instance) {
   // TODO(kinaba): currently the browser always calls RequestSurroundingText.
   // It can be optimized so that it won't call it back until the information
   // is really needed.
@@ -2386,22 +2308,22 @@
   // lifetime of the instance.
   base::MessageLoop::current()->PostTask(
       FROM_HERE,
-      base::Bind(&PluginInstance::RequestSurroundingText,
+      base::Bind(&PluginInstanceImpl::RequestSurroundingText,
                  AsWeakPtr(),
                  static_cast<size_t>(kExtraCharsForTextInput)));
 }
 
-void PluginInstance::UpdateSurroundingText(PP_Instance instance,
-                                           const char* text,
-                                           uint32_t caret,
-                                           uint32_t anchor) {
+void PluginInstanceImpl::UpdateSurroundingText(PP_Instance instance,
+                                               const char* text,
+                                               uint32_t caret,
+                                               uint32_t anchor) {
   surrounding_text_ = text;
   selection_caret_ = caret;
   selection_anchor_ = anchor;
   delegate()->PluginSelectionChanged(this);
 }
 
-PP_Var PluginInstance::ResolveRelativeToDocument(
+PP_Var PluginInstanceImpl::ResolveRelativeToDocument(
     PP_Instance instance,
     PP_Var relative,
     PP_URLComponents_Dev* components) {
@@ -2416,7 +2338,8 @@
       components);
 }
 
-PP_Bool PluginInstance::DocumentCanRequest(PP_Instance instance, PP_Var url) {
+PP_Bool PluginInstanceImpl::DocumentCanRequest(PP_Instance instance,
+                                               PP_Var url) {
   StringVar* url_string = StringVar::FromPPVar(url);
   if (!url_string)
     return PP_FALSE;
@@ -2432,8 +2355,8 @@
   return BoolToPPBool(security_origin.canRequest(gurl));
 }
 
-PP_Bool PluginInstance::DocumentCanAccessDocument(PP_Instance instance,
-                                                  PP_Instance target) {
+PP_Bool PluginInstanceImpl::DocumentCanAccessDocument(PP_Instance instance,
+                                                      PP_Instance target) {
   WebKit::WebSecurityOrigin our_origin;
   if (!SecurityOriginForInstance(instance, &our_origin))
     return PP_FALSE;
@@ -2445,21 +2368,21 @@
   return BoolToPPBool(our_origin.canAccess(target_origin));
 }
 
-PP_Var PluginInstance::GetDocumentURL(PP_Instance instance,
-                                      PP_URLComponents_Dev* components) {
+PP_Var PluginInstanceImpl::GetDocumentURL(PP_Instance instance,
+                                          PP_URLComponents_Dev* components) {
   WebKit::WebDocument document = container()->element().document();
   return ::ppapi::PPB_URLUtil_Shared::GenerateURLReturn(document.url(),
                                                         components);
 }
 
-PP_Var PluginInstance::GetPluginInstanceURL(
+PP_Var PluginInstanceImpl::GetPluginInstanceURL(
     PP_Instance instance,
     PP_URLComponents_Dev* components) {
   return ::ppapi::PPB_URLUtil_Shared::GenerateURLReturn(plugin_url_,
                                                         components);
 }
 
-PP_ExternalPluginResult PluginInstance::ResetAsProxied(
+PP_ExternalPluginResult PluginInstanceImpl::ResetAsProxied(
     scoped_refptr<PluginModule> module) {
   // Save the original module and switch over to the new one now that this
   // plugin is using the IPC-based proxy.
@@ -2530,17 +2453,17 @@
   return PP_EXTERNAL_PLUGIN_OK;
 }
 
-bool PluginInstance::IsValidInstanceOf(PluginModule* module) {
+bool PluginInstanceImpl::IsValidInstanceOf(PluginModule* module) {
   DCHECK(module);
   return module == module_.get() ||
          module == original_module_.get();
 }
 
-NPP PluginInstance::instanceNPP() {
+NPP PluginInstanceImpl::instanceNPP() {
   return npp_.get();
 }
 
-v8::Isolate* PluginInstance::GetIsolate() const {
+v8::Isolate* PluginInstanceImpl::GetIsolate() const {
   return isolate_;
 }
 
@@ -2548,11 +2471,27 @@
   return HostGlobals::Get()->GetInstance(instance_id);
 }
 
-::ppapi::VarTracker* PluginInstance::GetVarTracker() {
+content::RenderView* PluginInstanceImpl::GetRenderView() {
+  return render_view_;
+}
+
+WebKit::WebPluginContainer* PluginInstanceImpl::GetContainer() {
+  return container_;
+}
+
+::ppapi::VarTracker* PluginInstanceImpl::GetVarTracker() {
   return HostGlobals::Get()->GetVarTracker();
 }
 
-PP_Resource PluginInstance::CreateExternalFileReference(
+const GURL& PluginInstanceImpl::GetPluginURL() {
+  return plugin_url_;
+}
+
+base::FilePath PluginInstanceImpl::GetModulePath() {
+  return module_->path();
+}
+
+PP_Resource PluginInstanceImpl::CreateExternalFileReference(
     const base::FilePath& external_file_path) {
   webkit::ppapi::PPB_FileRef_Impl* ref =
       webkit::ppapi::PPB_FileRef_Impl::CreateExternal(
@@ -2560,8 +2499,8 @@
   return ref->GetReference();
 }
 
-PP_Resource PluginInstance::CreateImage(gfx::ImageSkia* source_image,
-                                        float scale) {
+PP_Resource PluginInstanceImpl::CreateImage(gfx::ImageSkia* source_image,
+                                            float scale) {
   ui::ScaleFactor scale_factor = ui::GetScaleFactorFromScale(scale);
   gfx::ImageSkiaRep image_skia_rep = source_image->GetRepresentation(
       scale_factor);
@@ -2593,11 +2532,7 @@
   return image_data->GetReference();
 }
 
-base::FilePath PluginInstance::GetModulePath() {
-  return module_->path();
-}
-
-PP_ExternalPluginResult PluginInstance::SwitchToOutOfProcessProxy(
+PP_ExternalPluginResult PluginInstanceImpl::SwitchToOutOfProcessProxy(
     const base::FilePath& file_path,
     ::ppapi::PpapiPermissions permissions,
     const IPC::ChannelHandle& channel_handle,
@@ -2627,7 +2562,11 @@
   return external_plugin_module->InitAsProxiedExternalPlugin(this);
 }
 
-void PluginInstance::DoSetCursor(WebCursorInfo* cursor) {
+void PluginInstanceImpl::SetAlwaysOnTop(bool on_top) {
+  always_on_top_ = on_top;
+}
+
+void PluginInstanceImpl::DoSetCursor(WebCursorInfo* cursor) {
   cursor_.reset(cursor);
   if (fullscreen_container_) {
     fullscreen_container_->DidChangeCursor(*cursor);
@@ -2636,7 +2575,95 @@
   }
 }
 
-bool PluginInstance::CanAccessMainFrame() const {
+bool PluginInstanceImpl::IsFullPagePlugin() {
+  WebFrame* frame = container()->element().document().frame();
+  return frame->view()->mainFrame()->document().isPluginDocument();
+}
+
+void PluginInstanceImpl::FlashSetFullscreen(bool fullscreen,
+                                            bool delay_report) {
+  TRACE_EVENT0("ppapi", "PluginInstanceImpl::FlashSetFullscreen");
+  // Keep a reference on the stack. See NOTE above.
+  scoped_refptr<PluginInstanceImpl> ref(this);
+
+  // We check whether we are trying to switch to the state we're already going
+  // to (i.e. if we're already switching to fullscreen but the fullscreen
+  // container isn't ready yet, don't do anything more).
+  if (fullscreen == FlashIsFullscreenOrPending())
+    return;
+
+  // Unbind current 2D or 3D graphics context.
+  VLOG(1) << "Setting fullscreen to " << (fullscreen ? "on" : "off");
+  if (fullscreen) {
+    DCHECK(!fullscreen_container_);
+    fullscreen_container_ = delegate_->CreateFullscreenContainer(this);
+    UpdateLayer();
+  } else {
+    DCHECK(fullscreen_container_);
+    fullscreen_container_->Destroy();
+    fullscreen_container_ = NULL;
+    UpdateFlashFullscreenState(false);
+    if (!delay_report) {
+      ReportGeometry();
+    } else {
+      base::MessageLoop::current()->PostTask(
+          FROM_HERE, base::Bind(&PluginInstanceImpl::ReportGeometry, this));
+    }
+  }
+}
+
+bool PluginInstanceImpl::IsRectTopmost(const gfx::Rect& rect) {
+  if (flash_fullscreen_)
+    return true;
+
+  return container_->isRectTopmost(rect);
+}
+
+int32_t PluginInstanceImpl::Navigate(const ::ppapi::URLRequestInfoData& request,
+                                     const char* target,
+                                     bool from_user_action) {
+  if (!container_)
+    return PP_ERROR_FAILED;
+
+  WebDocument document = container_->element().document();
+  WebFrame* frame = document.frame();
+  if (!frame)
+    return PP_ERROR_FAILED;
+
+  ::ppapi::URLRequestInfoData completed_request = request;
+
+  WebURLRequest web_request;
+  if (!CreateWebURLRequest(&completed_request, frame, &web_request))
+    return PP_ERROR_FAILED;
+  web_request.setFirstPartyForCookies(document.firstPartyForCookies());
+  web_request.setHasUserGesture(from_user_action);
+
+  GURL gurl(web_request.url());
+  if (gurl.SchemeIs("javascript")) {
+    // In imitation of the NPAPI implementation, only |target_frame == frame| is
+    // allowed for security reasons.
+    WebFrame* target_frame =
+        frame->view()->findFrameByName(WebString::fromUTF8(target), frame);
+    if (target_frame != frame)
+      return PP_ERROR_NOACCESS;
+
+    // TODO(viettrungluu): NPAPI sends the result back to the plugin -- do we
+    // need that?
+    WebString result = container_->executeScriptURL(gurl, from_user_action);
+    return result.isNull() ? PP_ERROR_FAILED : PP_OK;
+  }
+
+  // Only GETs and POSTs are supported.
+  if (web_request.httpMethod() != "GET" &&
+      web_request.httpMethod() != "POST")
+    return PP_ERROR_BADARGUMENT;
+
+  WebString target_str = WebString::fromUTF8(target);
+  container_->loadFrameRequest(web_request, target_str, false, NULL);
+  return PP_OK;
+}
+
+bool PluginInstanceImpl::CanAccessMainFrame() const {
   if (!container_)
     return false;
   WebKit::WebDocument containing_document = container_->element().document();
@@ -2653,7 +2680,7 @@
       main_document.securityOrigin());
 }
 
-void PluginInstance::KeepSizeAttributesBeforeFullscreen() {
+void PluginInstanceImpl::KeepSizeAttributesBeforeFullscreen() {
   WebElement element = container_->element();
   width_before_fullscreen_ = element.getAttribute(WebString::fromUTF8(kWidth));
   height_before_fullscreen_ =
@@ -2663,7 +2690,7 @@
   style_before_fullscreen_ = element.getAttribute(WebString::fromUTF8(kStyle));
 }
 
-void PluginInstance::SetSizeAttributesForFullscreen() {
+void PluginInstanceImpl::SetSizeAttributesForFullscreen() {
   screen_size_for_fullscreen_ = delegate()->GetScreenSize();
   std::string width = StringPrintf("%d", screen_size_for_fullscreen_.width());
   std::string height = StringPrintf("%d", screen_size_for_fullscreen_.height());
@@ -2686,7 +2713,7 @@
   container_->element().setAttribute(kStyle, WebString::fromUTF8(style));
 }
 
-void PluginInstance::ResetSizeAttributesAfterFullscreen() {
+void PluginInstanceImpl::ResetSizeAttributesAfterFullscreen() {
   screen_size_for_fullscreen_ = gfx::Size();
   WebElement element = container_->element();
   element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_);
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.h b/content/renderer/pepper/ppapi_plugin_instance_impl.h
similarity index 89%
rename from webkit/plugins/ppapi/ppapi_plugin_instance.h
rename to content/renderer/pepper/ppapi_plugin_instance_impl.h
index 11bde42..c5d22c4 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.h
+++ b/content/renderer/pepper/ppapi_plugin_instance_impl.h
@@ -2,20 +2,23 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_
-#define WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_
+#ifndef CONTENT_RENDERER_PEPPER_PPAPI_PLUGIN_INSTANCE_IMPL_H_
+#define CONTENT_RENDERER_PEPPER_PPAPI_PLUGIN_INSTANCE_IMPL_H_
 
 #include <set>
 #include <string>
 #include <vector>
 
-#include "base/basictypes.h"
 #include "base/compiler_specific.h"
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/strings/string16.h"
 #include "cc/layers/texture_layer_client.h"
+#include "content/common/content_export.h"
+#include "content/public/renderer/ppapi_plugin_instance.h"
+#include "content/renderer/pepper/plugin_delegate.h"
+#include "content/renderer/pepper/ppp_pdf.h"
 #include "ppapi/c/dev/pp_cursor_type_dev.h"
 #include "ppapi/c/dev/ppp_find_dev.h"
 #include "ppapi/c/dev/ppp_printing_dev.h"
@@ -24,7 +27,6 @@
 #include "ppapi/c/dev/ppp_zoom_dev.h"
 #include "ppapi/c/pp_completion_callback.h"
 #include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_resource.h"
 #include "ppapi/c/pp_time.h"
 #include "ppapi/c/pp_var.h"
 #include "ppapi/c/ppb_audio_config.h"
@@ -52,9 +54,6 @@
 #include "ui/base/ime/text_input_type.h"
 #include "ui/gfx/rect.h"
 #include "url/gurl.h"
-#include "webkit/plugins/ppapi/plugin_delegate.h"
-#include "webkit/plugins/ppapi/ppp_pdf.h"
-#include "webkit/plugins/webkit_plugins_export.h"
 
 struct PP_Point;
 struct _NPP;
@@ -62,10 +61,6 @@
 class SkBitmap;
 class TransportDIB;
 
-namespace IPC {
-struct ChannelHandle;
-}
-
 namespace WebKit {
 class WebInputEvent;
 class WebLayer;
@@ -83,21 +78,10 @@
 class TextureLayer;
 }
 
-namespace content {
-class RenderView;
-}
-
-namespace gfx {
-class ImageSkia;
-}
-
 namespace ppapi {
-class PpapiPermissions;
 class Resource;
-class VarTracker;
 struct InputEventData;
 struct PPP_Instance_Combined;
-struct URLRequestInfoData;
 }
 
 namespace ui {
@@ -125,32 +109,28 @@
 //
 // Note: to get from a PP_Instance to a PluginInstance*, use the
 // ResourceTracker.
-class WEBKIT_PLUGINS_EXPORT PluginInstance :
-    public base::RefCounted<PluginInstance>,
-    public base::SupportsWeakPtr<PluginInstance>,
-    public ::ppapi::PPB_Instance_Shared {
+class CONTENT_EXPORT PluginInstanceImpl
+    : public base::RefCounted<PluginInstanceImpl>,
+      public base::SupportsWeakPtr<PluginInstanceImpl>,
+      public NON_EXPORTED_BASE(PluginInstance),
+      public ::ppapi::PPB_Instance_Shared {
  public:
-  // Create and return a PluginInstance object which supports the most recent
-  // version of PPP_Instance possible by querying the given get_plugin_interface
-  // function. If the plugin does not support any valid PPP_Instance interface,
-  // returns NULL.
-  static PluginInstance* Create(PluginDelegate* delegate,
-                                content::RenderView* render_view,
-                                PluginModule* module,
-                                WebKit::WebPluginContainer* container,
-                                const GURL& plugin_url);
-  // Delete should be called by the WebPlugin before this destructor.
-  virtual ~PluginInstance();
-
+  // Create and return a PluginInstanceImpl object which supports the most
+  // recent version of PPP_Instance possible by querying the given
+  // get_plugin_interface function. If the plugin does not support any valid
+  // PPP_Instance interface, returns NULL.
+  static PluginInstanceImpl* Create(
+      PluginDelegate* delegate,
+      content::RenderView* render_view,
+      PluginModule* module,
+      WebKit::WebPluginContainer* container,
+      const GURL& plugin_url);
   PluginDelegate* delegate() const { return delegate_; }
-  content::RenderView* render_view() const {return render_view_; }
   PluginModule* module() const { return module_.get(); }
   MessageChannel& message_channel() { return *message_channel_; }
 
   WebKit::WebPluginContainer* container() const { return container_; }
 
-  void set_always_on_top(bool on_top) { always_on_top_ = on_top; }
-
   // Returns the PP_Instance uniquely identifying this instance. Guaranteed
   // nonzero.
   PP_Instance pp_instance() const { return pp_instance_; }
@@ -193,7 +173,6 @@
   void InstanceCrashed();
 
   // PPB_Instance and PPB_Instance_Private implementation.
-  const GURL& plugin_url() const { return plugin_url_; }
   bool full_frame() const { return full_frame_; }
   const ::ppapi::ViewData& view_data() const { return view_data_; }
 
@@ -301,12 +280,6 @@
   // state.
   bool FlashIsFullscreenOrPending();
 
-  // Switches between fullscreen and normal mode. If |delay_report| is set to
-  // false, it may report the new state through DidChangeView immediately. If
-  // true, it will delay it. When called from the plugin, delay_report should
-  // be true to avoid re-entrancy.
-  void FlashSetFullscreen(bool fullscreen, bool delay_report);
-
   // Updates |flash_fullscreen_| and sends focus change notification if
   // necessary.
   void UpdateFlashFullscreenState(bool flash_fullscreen);
@@ -337,21 +310,11 @@
   // already in fullscreen mode).
   bool SetFullscreen(bool fullscreen);
 
-  // Implementation of PPB_Flash.
-  int32_t Navigate(const ::ppapi::URLRequestInfoData& request,
-                   const char* target,
-                   bool from_user_action);
-  bool IsRectTopmost(const gfx::Rect& rect);
-
   // Implementation of PPP_Messaging.
   void HandleMessage(PP_Var message);
 
   PluginDelegate::PlatformContext3D* CreateContext3D();
 
-  // Returns true iff the plugin is a full-page plugin (i.e. not in an iframe
-  // or embedded in a page).
-  bool IsFullPagePlugin() const;
-
   // Returns true if the plugin is processing a user gesture.
   bool IsProcessingUserGesture();
 
@@ -389,6 +352,30 @@
 
   ContentDecryptorDelegate* GetContentDecryptorDelegate();
 
+  // webkit::ppapi::PluginInstance implementation
+  virtual content::RenderView* GetRenderView() OVERRIDE;
+  virtual WebKit::WebPluginContainer* GetContainer() OVERRIDE;
+  virtual ::ppapi::VarTracker* GetVarTracker() OVERRIDE;
+  virtual const GURL& GetPluginURL() OVERRIDE;
+  virtual base::FilePath GetModulePath() OVERRIDE;
+  virtual PP_Resource CreateExternalFileReference(
+      const base::FilePath& external_file_path) OVERRIDE;
+  virtual PP_Resource CreateImage(gfx::ImageSkia* source_image,
+                                  float scale) OVERRIDE;
+  virtual PP_ExternalPluginResult SwitchToOutOfProcessProxy(
+      const base::FilePath& file_path,
+      ::ppapi::PpapiPermissions permissions,
+      const IPC::ChannelHandle& channel_handle,
+      base::ProcessId plugin_pid,
+      int plugin_child_id) OVERRIDE;
+  virtual void SetAlwaysOnTop(bool on_top) OVERRIDE;
+  virtual bool IsFullPagePlugin() OVERRIDE;
+  virtual void FlashSetFullscreen(bool fullscreen, bool delay_report) OVERRIDE;
+  virtual bool IsRectTopmost(const gfx::Rect& rect) OVERRIDE;
+  virtual int32_t Navigate(const ::ppapi::URLRequestInfoData& request,
+                           const char* target,
+                           bool from_user_action) OVERRIDE;
+
   // PPB_Instance_API implementation.
   virtual PP_Bool BindGraphics(PP_Instance instance,
                                PP_Resource device) OVERRIDE;
@@ -520,32 +507,13 @@
   // This is not inlined so as to avoid an unnecessary header include of v8.h.
   v8::Isolate* GetIsolate() const;
 
-  static PluginInstance* Get(PP_Instance instance_id);
-
-  ::ppapi::VarTracker* GetVarTracker();
-
-  // Returns a reference to a file with the given path.
-  // The returned object will have a refcount of 0 (just like "new").
-  PP_Resource CreateExternalFileReference(
-      const base::FilePath& external_file_path);
-
-  // Creates a PPB_ImageData given a Skia image.
-  PP_Resource CreateImage(gfx::ImageSkia* source_image, float scale);
-
-  // Returns the location of this module.
-  base::FilePath GetModulePath();
-
-  // Switches this instance with one that uses the out of process IPC proxy.
-  PP_ExternalPluginResult SwitchToOutOfProcessProxy(
-      const base::FilePath& file_path,
-      ::ppapi::PpapiPermissions permissions,
-      const IPC::ChannelHandle& channel_handle,
-      base::ProcessId plugin_pid,
-      int plugin_child_id);
-
  private:
+  friend class base::RefCounted<PluginInstanceImpl>;
   friend class PpapiUnittest;
 
+  // Delete should be called by the WebPlugin before this destructor.
+  virtual ~PluginInstanceImpl();
+
   // Class to record document load notifications and play them back once the
   // real document loader becomes available. Used only by NaCl instances.
   class NaClDocumentLoader : public WebKit::WebURLLoaderClient {
@@ -572,7 +540,7 @@
   };
 
   // Implements PPB_Gamepad_API. This is just to avoid having an excessive
-  // number of interfaces implemented by PluginInstance.
+  // number of interfaces implemented by PluginInstanceImpl.
   class GamepadImpl : public ::ppapi::thunk::PPB_Gamepad_API,
                       public ::ppapi::Resource {
    public:
@@ -582,19 +550,20 @@
     virtual void Sample(PP_Instance instance,
                         PP_GamepadsSampleData* data) OVERRIDE;
    private:
+    virtual ~GamepadImpl();
     PluginDelegate* delegate_;
   };
 
-  // See the static Create functions above for creating PluginInstance objects.
-  // This constructor is private so that we can hide the PPP_Instance_Combined
-  // details while still having 1 constructor to maintain for member
-  // initialization.
-  PluginInstance(PluginDelegate* delegate,
-                 content::RenderView* render_view,
-                 PluginModule* module,
-                 ::ppapi::PPP_Instance_Combined* instance_interface,
-                 WebKit::WebPluginContainer* container,
-                 const GURL& plugin_url);
+  // See the static Create functions above for creating PluginInstanceImpl
+  // objects. This constructor is private so that we can hide the
+  // PPP_Instance_Combined details while still having 1 constructor to maintain
+  // for member initialization.
+  PluginInstanceImpl(PluginDelegate* delegate,
+                     content::RenderView* render_view,
+                     PluginModule* module,
+                     ::ppapi::PPP_Instance_Combined* instance_interface,
+                     WebKit::WebPluginContainer* container,
+                     const GURL& plugin_url);
 
   bool LoadFindInterface();
   bool LoadInputEventInterface();
@@ -720,7 +689,7 @@
   // already a weak ptr pending (HasWeakPtrs is true), code should update the
   // view_data_ but not send updates. This also allows us to cancel scheduled
   // view change events.
-  base::WeakPtrFactory<PluginInstance> view_change_weak_ptr_factory_;
+  base::WeakPtrFactory<PluginInstanceImpl> view_change_weak_ptr_factory_;
 
   // The current device context for painting in 2D and 3D.
   scoped_refptr<PPB_Graphics3D_Impl> bound_graphics_3d_;
@@ -886,10 +855,10 @@
   v8::Isolate* isolate_;
 
   friend class PpapiPluginInstanceTest;
-  DISALLOW_COPY_AND_ASSIGN(PluginInstance);
+  DISALLOW_COPY_AND_ASSIGN(PluginInstanceImpl);
 };
 
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_
+#endif  // CONTENT_RENDERER_PEPPER_PPAPI_PLUGIN_INSTANCE_IMPL_H_
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance_unittest.cc b/content/renderer/pepper/ppapi_plugin_instance_unittest.cc
similarity index 90%
rename from webkit/plugins/ppapi/ppapi_plugin_instance_unittest.cc
rename to content/renderer/pepper/ppapi_plugin_instance_unittest.cc
index 7f774a7..ceaac04 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance_unittest.cc
+++ b/content/renderer/pepper/ppapi_plugin_instance_unittest.cc
@@ -2,16 +2,16 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
+#include "content/renderer/pepper/ppapi_plugin_instance_impl.h"
 
 #include "base/basictypes.h"
 #include "base/memory/ref_counted.h"
+#include "content/renderer/pepper/plugin_delegate.h"
+#include "content/renderer/pepper/ppapi_unittest.h"
+#include "content/renderer/pepper/ppb_image_data_impl.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "ui/gfx/rect.h"
 #include "ui/gfx/safe_integer_conversions.h"
-#include "webkit/plugins/ppapi/plugin_delegate.h"
-#include "webkit/plugins/ppapi/ppapi_unittest.h"
-#include "webkit/plugins/ppapi/ppb_image_data_impl.h"
 
 namespace webkit {
 namespace ppapi {
@@ -41,7 +41,7 @@
                              const PP_Point* top_left) OVERRIDE {
     return false;
   }
-  virtual bool BindToInstance(PluginInstance* new_instance) OVERRIDE {
+  virtual bool BindToInstance(PluginInstanceImpl* new_instance) OVERRIDE {
     bound_instance_ = new_instance;
     return true;
   }
@@ -62,7 +62,7 @@
  private:
   PPB_ImageData_Impl* image_data_;
   float scale_;
-  PluginInstance* bound_instance_;
+  PluginInstanceImpl* bound_instance_;
 
   DISALLOW_COPY_AND_ASSIGN(MockPlatformGraphics2D);
 };
@@ -101,7 +101,7 @@
   MockPlatformGraphics2D mock_graphics_2d(image_data.get(), 1.0 / scale);
   instance()->SetBoundGraphics2DForTest(&mock_graphics_2d);
 
-  instance()->set_always_on_top(true);
+  instance()->SetAlwaysOnTop(true);
   SetViewSize(size.width, size.height);
 
   gfx::Rect bounds(0, 0, 1, 1);
diff --git a/webkit/plugins/ppapi/ppapi_unittest.cc b/content/renderer/pepper/ppapi_unittest.cc
similarity index 85%
rename from webkit/plugins/ppapi/ppapi_unittest.cc
rename to content/renderer/pepper/ppapi_unittest.cc
index c029e89..e6edf94 100644
--- a/webkit/plugins/ppapi/ppapi_unittest.cc
+++ b/content/renderer/pepper/ppapi_unittest.cc
@@ -2,19 +2,19 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/ppapi_unittest.h"
+#include "content/renderer/pepper/ppapi_unittest.h"
 
 #include "base/message_loop/message_loop.h"
+#include "content/renderer/pepper/gfx_conversion.h"
+#include "content/renderer/pepper/host_globals.h"
+#include "content/renderer/pepper/mock_plugin_delegate.h"
+#include "content/renderer/pepper/plugin_module.h"
+#include "content/renderer/pepper/ppapi_interface_factory.h"
+#include "content/renderer/pepper/ppapi_plugin_instance_impl.h"
 #include "ppapi/c/pp_var.h"
 #include "ppapi/c/ppp_instance.h"
 #include "ppapi/shared_impl/ppapi_globals.h"
 #include "ppapi/shared_impl/ppapi_permissions.h"
-#include "webkit/plugins/ppapi/gfx_conversion.h"
-#include "webkit/plugins/ppapi/host_globals.h"
-#include "webkit/plugins/ppapi/mock_plugin_delegate.h"
-#include "webkit/plugins/ppapi/plugin_module.h"
-#include "webkit/plugins/ppapi/ppapi_interface_factory.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
 
 namespace webkit {
 namespace ppapi {
@@ -81,17 +81,17 @@
   delegate_.reset(NewPluginDelegate());
 
   // Initialize the mock module.
-  module_ = new PluginModule("Mock plugin", base::FilePath(), this,
+  module_ = new PluginModule("Mock plugin", base::FilePath(),
                              ::ppapi::PpapiPermissions());
   ::ppapi::PpapiGlobals::Get()->ResetMainThreadMessageLoopForTesting();
-  PluginModule::EntryPoints entry_points;
+  content::PepperPluginInfo::EntryPoints entry_points;
   entry_points.get_interface = &MockGetInterface;
   entry_points.initialize_module = &MockInitializeModule;
   ASSERT_TRUE(module_->InitAsInternalPlugin(entry_points));
 
   // Initialize the mock instance.
-  instance_ = PluginInstance::Create(delegate_.get(), NULL, module(), NULL,
-                                     GURL());
+  instance_ = PluginInstanceImpl::Create(
+      delegate_.get(), NULL, module(), NULL, GURL());
 }
 
 void PpapiUnittest::TearDown() {
@@ -123,10 +123,6 @@
   instance_->view_data_.clip_rect = instance_->view_data_.rect;
 }
 
-void PpapiUnittest::PluginModuleDead(PluginModule* /* dead_module */) {
-  // Nothing needed (this is necessary to make the module compile).
-}
-
 // Tests whether custom PPAPI interface factories are called when PPAPI
 // interfaces are requested.
 class PpapiCustomInterfaceFactoryTest : public PpapiUnittest {
diff --git a/webkit/plugins/ppapi/ppapi_unittest.h b/content/renderer/pepper/ppapi_unittest.h
similarity index 72%
rename from webkit/plugins/ppapi/ppapi_unittest.h
rename to content/renderer/pepper/ppapi_unittest.h
index 24decdd..e7fd8f2 100644
--- a/webkit/plugins/ppapi/ppapi_unittest.h
+++ b/content/renderer/pepper/ppapi_unittest.h
@@ -2,14 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_PPAPI_UNITTEST_H_
-#define WEBKIT_PLUGINS_PPAPI_PPAPI_UNITTEST_H_
+#ifndef CONTENT_RENDERER_PEPPER_PPAPI_UNITTEST_H_
+#define CONTENT_RENDERER_PEPPER_PPAPI_UNITTEST_H_
 
 #include "base/basictypes.h"
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
+#include "content/renderer/pepper/plugin_delegate.h"
 #include "testing/gtest/include/gtest/gtest.h"
-#include "webkit/plugins/ppapi/plugin_delegate.h"
 
 namespace base {
 class MessageLoop;
@@ -19,11 +19,10 @@
 namespace ppapi {
 
 class MockPluginDelegate;
-class PluginInstance;
+class PluginInstanceImpl;
 class PluginModule;
 
-class PpapiUnittest : public testing::Test,
-                      public webkit::ppapi::PluginDelegate::ModuleLifetime {
+class PpapiUnittest : public testing::Test {
  public:
   PpapiUnittest();
   virtual ~PpapiUnittest();
@@ -33,7 +32,7 @@
 
   MockPluginDelegate* delegate() { return delegate_.get(); }
   PluginModule* module() const { return module_.get(); }
-  PluginInstance* instance() const { return instance_.get(); }
+  PluginInstanceImpl* instance() const { return instance_.get(); }
 
   // Provides access to the interfaces implemented by the test. The default one
   // implements PPP_INSTANCE.
@@ -53,17 +52,14 @@
 
   // Note: module must be declared first since we want it to get destroyed last.
   scoped_refptr<PluginModule> module_;
-  scoped_refptr<PluginInstance> instance_;
+  scoped_refptr<PluginInstanceImpl> instance_;
 
   scoped_ptr<base::MessageLoop> message_loop_;
 
-  // ModuleLifetime implementation.
-  virtual void PluginModuleDead(PluginModule* dead_module);
-
   DISALLOW_COPY_AND_ASSIGN(PpapiUnittest);
 };
 
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_PPAPI_UNITTEST_H_
+#endif  // CONTENT_RENDERER_PEPPER_PPAPI_UNITTEST_H_
diff --git a/webkit/plugins/ppapi/ppapi_webplugin_impl.cc b/content/renderer/pepper/ppapi_webplugin_impl.cc
similarity index 96%
rename from webkit/plugins/ppapi/ppapi_webplugin_impl.cc
rename to content/renderer/pepper/ppapi_webplugin_impl.cc
index 63036bf..a3bca36 100644
--- a/webkit/plugins/ppapi/ppapi_webplugin_impl.cc
+++ b/content/renderer/pepper/ppapi_webplugin_impl.cc
@@ -2,12 +2,16 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/ppapi_webplugin_impl.h"
+#include "content/renderer/pepper/ppapi_webplugin_impl.h"
 
 #include <cmath>
 
 #include "base/debug/crash_logging.h"
 #include "base/message_loop/message_loop.h"
+#include "content/renderer/pepper/message_channel.h"
+#include "content/renderer/pepper/npobject_var.h"
+#include "content/renderer/pepper/plugin_module.h"
+#include "content/renderer/pepper/ppapi_plugin_instance_impl.h"
 #include "ppapi/shared_impl/ppapi_globals.h"
 #include "ppapi/shared_impl/var_tracker.h"
 #include "third_party/WebKit/public/platform/WebPoint.h"
@@ -24,10 +28,6 @@
 #include "third_party/WebKit/public/web/WebPrintScalingOption.h"
 #include "third_party/WebKit/public/web/WebView.h"
 #include "url/gurl.h"
-#include "webkit/plugins/ppapi/message_channel.h"
-#include "webkit/plugins/ppapi/npobject_var.h"
-#include "webkit/plugins/ppapi/plugin_module.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
 
 using ppapi::NPObjectVar;
 using WebKit::WebCanvas;
diff --git a/webkit/plugins/ppapi/ppapi_webplugin_impl.h b/content/renderer/pepper/ppapi_webplugin_impl.h
similarity index 84%
rename from webkit/plugins/ppapi/ppapi_webplugin_impl.h
rename to content/renderer/pepper/ppapi_webplugin_impl.h
index 4bc057c..ed26b75 100644
--- a/webkit/plugins/ppapi/ppapi_webplugin_impl.h
+++ b/content/renderer/pepper/ppapi_webplugin_impl.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_PPAPI_WEBPLUGIN_IMPL_H_
-#define WEBKIT_PLUGINS_PPAPI_PPAPI_WEBPLUGIN_IMPL_H_
+#ifndef CONTENT_RENDERER_PEPPER_PPAPI_WEBPLUGIN_IMPL_H_
+#define CONTENT_RENDERER_PEPPER_PPAPI_WEBPLUGIN_IMPL_H_
 
 #include <string>
 #include <vector>
@@ -14,7 +14,6 @@
 #include "ppapi/c/pp_var.h"
 #include "third_party/WebKit/public/web/WebPlugin.h"
 #include "ui/gfx/rect.h"
-#include "webkit/plugins/webkit_plugins_export.h"
 
 struct _NPP;
 
@@ -31,19 +30,18 @@
 namespace ppapi {
 
 class PluginDelegate;
-class PluginInstance;
+class PluginInstanceImpl;
 class PluginModule;
 class PPB_URLLoader_Impl;
 
 class WebPluginImpl : public WebKit::WebPlugin {
  public:
-  WEBKIT_PLUGINS_EXPORT WebPluginImpl(
-      PluginModule* module,
-      const WebKit::WebPluginParams& params,
-      const base::WeakPtr<PluginDelegate>& plugin_delegate,
-      const base::WeakPtr<content::RenderView>& render_view);
+  WebPluginImpl(PluginModule* module,
+                const WebKit::WebPluginParams& params,
+                const base::WeakPtr<PluginDelegate>& plugin_delegate,
+                const base::WeakPtr<content::RenderView>& render_view);
 
-  PluginInstance* instance() { return instance_.get(); }
+  PluginInstanceImpl* instance() { return instance_.get(); }
 
   // WebKit::WebPlugin implementation.
   virtual WebKit::WebPluginContainer* container() const;
@@ -96,14 +94,14 @@
  private:
   friend class base::DeleteHelper<WebPluginImpl>;
 
-  WEBKIT_PLUGINS_EXPORT virtual ~WebPluginImpl();
+  virtual ~WebPluginImpl();
   struct InitData;
 
   scoped_ptr<InitData> init_data_;  // Cleared upon successful initialization.
   // True if the instance represents the entire document in a frame instead of
   // being an embedded resource.
   bool full_frame_;
-  scoped_refptr<PluginInstance> instance_;
+  scoped_refptr<PluginInstanceImpl> instance_;
   gfx::Rect plugin_rect_;
   PP_Var instance_object_;
   WebKit::WebPluginContainer* container_;
@@ -114,4 +112,4 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_PPAPI_WEBPLUGIN_IMPL_H_
+#endif  // CONTENT_RENDERER_PEPPER_PPAPI_WEBPLUGIN_IMPL_H_
diff --git a/webkit/plugins/ppapi/ppb_audio_impl.cc b/content/renderer/pepper/ppb_audio_impl.cc
similarity index 96%
rename from webkit/plugins/ppapi/ppb_audio_impl.cc
rename to content/renderer/pepper/ppb_audio_impl.cc
index 4bd4995..5263826 100644
--- a/webkit/plugins/ppapi/ppb_audio_impl.cc
+++ b/content/renderer/pepper/ppb_audio_impl.cc
@@ -2,9 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/ppb_audio_impl.h"
+#include "content/renderer/pepper/ppb_audio_impl.h"
 
 #include "base/logging.h"
+#include "content/renderer/pepper/common.h"
+#include "content/renderer/pepper/resource_helper.h"
 #include "media/audio/audio_output_controller.h"
 #include "ppapi/c/pp_completion_callback.h"
 #include "ppapi/c/ppb_audio.h"
@@ -13,8 +15,6 @@
 #include "ppapi/thunk/enter.h"
 #include "ppapi/thunk/ppb_audio_config_api.h"
 #include "ppapi/thunk/thunk.h"
-#include "webkit/plugins/ppapi/common.h"
-#include "webkit/plugins/ppapi/resource_helper.h"
 
 using ppapi::PpapiGlobals;
 using ppapi::thunk::EnterResourceNoLock;
diff --git a/webkit/plugins/ppapi/ppb_audio_impl.h b/content/renderer/pepper/ppb_audio_impl.h
similarity index 86%
rename from webkit/plugins/ppapi/ppb_audio_impl.h
rename to content/renderer/pepper/ppb_audio_impl.h
index c0c5239..49146cb 100644
--- a/webkit/plugins/ppapi/ppb_audio_impl.h
+++ b/content/renderer/pepper/ppb_audio_impl.h
@@ -2,13 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_PPB_AUDIO_IMPL_H_
-#define WEBKIT_PLUGINS_PPAPI_PPB_AUDIO_IMPL_H_
+#ifndef CONTENT_RENDERER_PEPPER_PPB_AUDIO_IMPL_H_
+#define CONTENT_RENDERER_PEPPER_PPB_AUDIO_IMPL_H_
 
 #include "base/basictypes.h"
 #include "base/memory/ref_counted.h"
 #include "base/memory/shared_memory.h"
 #include "base/sync_socket.h"
+#include "content/renderer/pepper/audio_helper.h"
+#include "content/renderer/pepper/plugin_delegate.h"
 #include "ppapi/c/pp_completion_callback.h"
 #include "ppapi/c/ppb_audio.h"
 #include "ppapi/c/ppb_audio_config.h"
@@ -16,9 +18,6 @@
 #include "ppapi/shared_impl/ppb_audio_shared.h"
 #include "ppapi/shared_impl/resource.h"
 #include "ppapi/shared_impl/scoped_pp_resource.h"
-#include "webkit/plugins/ppapi/audio_helper.h"
-#include "webkit/plugins/ppapi/plugin_delegate.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
 
 namespace webkit {
 namespace ppapi {
@@ -35,8 +34,6 @@
   // to properly create & initialize this class.
   explicit PPB_Audio_Impl(PP_Instance instance);
 
-  virtual ~PPB_Audio_Impl();
-
   // Creation function for untrusted plugins. This handles all initialization
   // and will return 0 on failure.
   static PP_Resource Create(PP_Instance instance,
@@ -50,7 +47,7 @@
             void* user_data);
 
   // Resource overrides.
-  virtual ::ppapi::thunk::PPB_Audio_API* AsPPB_Audio_API();
+  virtual ::ppapi::thunk::PPB_Audio_API* AsPPB_Audio_API() OVERRIDE;
 
   // PPB_Audio_API implementation.
   virtual PP_Resource GetCurrentConfig() OVERRIDE;
@@ -63,10 +60,12 @@
   virtual int32_t GetSharedMemory(int* shm_handle, uint32_t* shm_size) OVERRIDE;
 
  private:
+  virtual ~PPB_Audio_Impl();
+
   // AudioHelper implementation.
   virtual void OnSetStreamInfo(base::SharedMemoryHandle shared_memory_handle,
                                size_t shared_memory_size_,
-                               base::SyncSocket::Handle socket);
+                               base::SyncSocket::Handle socket) OVERRIDE;
 
   // AudioConfig used for creating this Audio object. We own a ref.
   ::ppapi::ScopedPPResource config_;
@@ -84,4 +83,4 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_PPB_AUDIO_IMPL_H_
+#endif  // CONTENT_RENDERER_PEPPER_PPB_AUDIO_IMPL_H_
diff --git a/webkit/plugins/ppapi/ppb_broker_impl.cc b/content/renderer/pepper/ppb_broker_impl.cc
similarity index 86%
rename from webkit/plugins/ppapi/ppb_broker_impl.cc
rename to content/renderer/pepper/ppb_broker_impl.cc
index e760ad7..7401b28 100644
--- a/webkit/plugins/ppapi/ppb_broker_impl.cc
+++ b/content/renderer/pepper/ppb_broker_impl.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 "webkit/plugins/ppapi/ppb_broker_impl.h"
+#include "content/renderer/pepper/ppb_broker_impl.h"
 
 #include "base/logging.h"
+#include "content/renderer/pepper/common.h"
+#include "content/renderer/pepper/plugin_module.h"
+#include "content/renderer/pepper/ppapi_plugin_instance_impl.h"
+#include "content/renderer/pepper/resource_helper.h"
 #include "ppapi/shared_impl/platform_file.h"
 #include "third_party/WebKit/public/web/WebDocument.h"
 #include "third_party/WebKit/public/web/WebElement.h"
 #include "third_party/WebKit/public/web/WebPluginContainer.h"
-#include "webkit/plugins/ppapi/common.h"
-#include "webkit/plugins/ppapi/plugin_module.h"
-#include "webkit/plugins/ppapi/resource_helper.h"
 
 using ppapi::PlatformFileToInt;
 using ppapi::thunk::PPB_Broker_API;
@@ -52,7 +53,7 @@
     return PP_ERROR_FAILED;
   }
 
-  PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this);
+  PluginInstanceImpl* plugin_instance = ResourceHelper::GetPluginInstance(this);
   if (!plugin_instance)
     return PP_ERROR_FAILED;
 
@@ -79,7 +80,7 @@
 }
 
 GURL PPB_Broker_Impl::GetDocumentUrl() {
-  PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this);
+  PluginInstanceImpl* plugin_instance = ResourceHelper::GetPluginInstance(this);
   return plugin_instance->container()->element().document().url();
 }
 
diff --git a/webkit/plugins/ppapi/ppb_broker_impl.h b/content/renderer/pepper/ppb_broker_impl.h
similarity index 76%
rename from webkit/plugins/ppapi/ppb_broker_impl.h
rename to content/renderer/pepper/ppb_broker_impl.h
index ab02ae8..0c7a76f 100644
--- a/webkit/plugins/ppapi/ppb_broker_impl.h
+++ b/content/renderer/pepper/ppb_broker_impl.h
@@ -2,31 +2,27 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_PPB_BROKER_IMPL_H_
-#define WEBKIT_PLUGINS_PPAPI_PPB_BROKER_IMPL_H_
+#ifndef CONTENT_RENDERER_PEPPER_PPB_BROKER_IMPL_H_
+#define CONTENT_RENDERER_PEPPER_PPB_BROKER_IMPL_H_
 
 #include "base/basictypes.h"
 #include "base/compiler_specific.h"
 #include "base/memory/weak_ptr.h"
+#include "content/renderer/pepper/plugin_delegate.h"
 #include "ppapi/c/pp_completion_callback.h"
 #include "ppapi/c/trusted/ppb_broker_trusted.h"
 #include "ppapi/shared_impl/resource.h"
 #include "ppapi/shared_impl/tracked_callback.h"
 #include "ppapi/thunk/ppb_broker_api.h"
-#include "webkit/plugins/ppapi/plugin_delegate.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
-#include "webkit/plugins/webkit_plugins_export.h"
 
 namespace webkit {
 namespace ppapi {
 
-class WEBKIT_PLUGINS_EXPORT PPB_Broker_Impl
-    : public ::ppapi::Resource,
-      NON_EXPORTED_BASE(public ::ppapi::thunk::PPB_Broker_API),
-      public base::SupportsWeakPtr<PPB_Broker_Impl> {
+class PPB_Broker_Impl : public ::ppapi::Resource,
+                        public ::ppapi::thunk::PPB_Broker_API,
+                        public base::SupportsWeakPtr<PPB_Broker_Impl> {
  public:
   explicit PPB_Broker_Impl(PP_Instance instance);
-  virtual ~PPB_Broker_Impl();
 
   // Resource override.
   virtual ::ppapi::thunk::PPB_Broker_API* AsPPB_Broker_API() OVERRIDE;
@@ -43,6 +39,7 @@
   void BrokerConnected(int32_t handle, int32_t result);
 
  private:
+  virtual ~PPB_Broker_Impl();
   // PluginDelegate ppapi broker object.
   // We don't own this pointer but are responsible for calling Disconnect on it.
   PluginDelegate::Broker* broker_;
@@ -60,4 +57,4 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_PPB_BROKER_IMPL_H_
+#endif  // CONTENT_RENDERER_PEPPER_PPB_BROKER_IMPL_H_
diff --git a/webkit/plugins/ppapi/ppb_buffer_impl.cc b/content/renderer/pepper/ppb_buffer_impl.cc
similarity index 92%
rename from webkit/plugins/ppapi/ppb_buffer_impl.cc
rename to content/renderer/pepper/ppb_buffer_impl.cc
index c00a9db..24599e7 100644
--- a/webkit/plugins/ppapi/ppb_buffer_impl.cc
+++ b/content/renderer/pepper/ppb_buffer_impl.cc
@@ -2,18 +2,18 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/ppb_buffer_impl.h"
+#include "content/renderer/pepper/ppb_buffer_impl.h"
 
 #include <algorithm>
 
 #include "base/logging.h"
 #include "base/memory/scoped_ptr.h"
+#include "content/renderer/pepper/common.h"
+#include "content/renderer/pepper/plugin_delegate.h"
+#include "content/renderer/pepper/resource_helper.h"
 #include "ppapi/c/dev/ppb_buffer_dev.h"
 #include "ppapi/c/pp_instance.h"
 #include "ppapi/c/pp_resource.h"
-#include "webkit/plugins/ppapi/common.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
-#include "webkit/plugins/ppapi/resource_helper.h"
 
 using ::ppapi::thunk::PPB_Buffer_API;
 
diff --git a/webkit/plugins/ppapi/ppb_buffer_impl.h b/content/renderer/pepper/ppb_buffer_impl.h
similarity index 85%
rename from webkit/plugins/ppapi/ppb_buffer_impl.h
rename to content/renderer/pepper/ppb_buffer_impl.h
index e26d17f..5da2c72 100644
--- a/webkit/plugins/ppapi/ppb_buffer_impl.h
+++ b/content/renderer/pepper/ppb_buffer_impl.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_PPB_BUFFER_IMPL_H_
-#define WEBKIT_PLUGINS_PPAPI_PPB_BUFFER_IMPL_H_
+#ifndef CONTENT_RENDERER_PEPPER_PPB_BUFFER_IMPL_H_
+#define CONTENT_RENDERER_PEPPER_PPB_BUFFER_IMPL_H_
 
 #include "base/basictypes.h"
 #include "base/memory/ref_counted.h"
@@ -11,17 +11,13 @@
 #include "base/memory/shared_memory.h"
 #include "ppapi/shared_impl/resource.h"
 #include "ppapi/thunk/ppb_buffer_api.h"
-#include "webkit/plugins/webkit_plugins_export.h"
 
 namespace webkit {
 namespace ppapi {
 
-class WEBKIT_PLUGINS_EXPORT PPB_Buffer_Impl :
-    public ::ppapi::Resource,
-    public ::ppapi::thunk::PPB_Buffer_API {
+class PPB_Buffer_Impl : public ::ppapi::Resource,
+                        public ::ppapi::thunk::PPB_Buffer_API {
  public:
-  virtual ~PPB_Buffer_Impl();
-
   static PP_Resource Create(PP_Instance instance, uint32_t size);
   static scoped_refptr<PPB_Buffer_Impl> CreateResource(PP_Instance instance,
                                                        uint32_t size);
@@ -44,6 +40,8 @@
   virtual int32_t GetSharedMemory(int* handle) OVERRIDE;
 
  private:
+  virtual ~PPB_Buffer_Impl();
+
   explicit PPB_Buffer_Impl(PP_Instance instance);
   bool Init(uint32_t size);
 
@@ -79,4 +77,4 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_PPB_BUFFER_IMPL_H_
+#endif  // CONTENT_RENDERER_PEPPER_PPB_BUFFER_IMPL_H_
diff --git a/webkit/plugins/ppapi/ppb_file_ref_impl.cc b/content/renderer/pepper/ppb_file_ref_impl.cc
similarity index 92%
rename from webkit/plugins/ppapi/ppb_file_ref_impl.cc
rename to content/renderer/pepper/ppb_file_ref_impl.cc
index ce57e7d..9a97bed 100644
--- a/webkit/plugins/ppapi/ppb_file_ref_impl.cc
+++ b/content/renderer/pepper/ppb_file_ref_impl.cc
@@ -2,12 +2,17 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/ppb_file_ref_impl.h"
+#include "content/renderer/pepper/ppb_file_ref_impl.h"
 
 #include "base/files/file_util_proxy.h"
 #include "base/platform_file.h"
 #include "base/strings/string_util.h"
 #include "base/strings/utf_string_conversions.h"
+#include "content/renderer/pepper/common.h"
+#include "content/renderer/pepper/plugin_delegate.h"
+#include "content/renderer/pepper/plugin_module.h"
+#include "content/renderer/pepper/ppapi_plugin_instance_impl.h"
+#include "content/renderer/pepper/resource_helper.h"
 #include "net/base/escape.h"
 #include "ppapi/c/pp_errors.h"
 #include "ppapi/shared_impl/file_type_conversion.h"
@@ -18,11 +23,6 @@
 #include "url/gurl.h"
 #include "webkit/common/fileapi/directory_entry.h"
 #include "webkit/common/fileapi/file_system_util.h"
-#include "webkit/plugins/ppapi/common.h"
-#include "webkit/plugins/ppapi/plugin_delegate.h"
-#include "webkit/plugins/ppapi/plugin_module.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
-#include "webkit/plugins/ppapi/resource_helper.h"
 
 using ppapi::HostResource;
 using ppapi::PPB_FileRef_CreateInfo;
@@ -232,7 +232,7 @@
 PPB_FileRef_Impl* PPB_FileRef_Impl::CreateInternal(PP_Instance instance,
                                                    PP_Resource pp_file_system,
                                                    const std::string& path) {
-  PluginInstance* plugin_instance =
+  PluginInstanceImpl* plugin_instance =
       ResourceHelper::PPInstanceToPluginInstance(instance);
   if (!plugin_instance || !plugin_instance->delegate())
     return 0;
@@ -309,7 +309,7 @@
   if (!IsValidNonExternalFileSystem())
     return PP_ERROR_NOACCESS;
 
-  PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this);
+  PluginInstanceImpl* plugin_instance = ResourceHelper::GetPluginInstance(this);
   if (!plugin_instance)
     return PP_ERROR_FAILED;
   plugin_instance->delegate()->MakeDirectory(
@@ -324,7 +324,7 @@
   if (!IsValidNonExternalFileSystem())
     return PP_ERROR_NOACCESS;
 
-  PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this);
+  PluginInstanceImpl* plugin_instance = ResourceHelper::GetPluginInstance(this);
   if (!plugin_instance)
     return PP_ERROR_FAILED;
   plugin_instance->delegate()->Touch(
@@ -339,7 +339,7 @@
   if (!IsValidNonExternalFileSystem())
     return PP_ERROR_NOACCESS;
 
-  PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this);
+  PluginInstanceImpl* plugin_instance = ResourceHelper::GetPluginInstance(this);
   if (!plugin_instance)
     return PP_ERROR_FAILED;
   plugin_instance->delegate()->Delete(
@@ -362,7 +362,7 @@
 
   // TODO(viettrungluu): Also cancel when the new file ref is destroyed?
   // http://crbug.com/67624
-  PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this);
+  PluginInstanceImpl* plugin_instance = ResourceHelper::GetPluginInstance(this);
   if (!plugin_instance)
     return PP_ERROR_FAILED;
   plugin_instance->delegate()->Rename(
@@ -405,7 +405,7 @@
   // We need to trim off the '/' before calling Resolve, as FileSystem URLs
   // start with a storage type identifier that looks like a path segment.
 
-  PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this);
+  PluginInstanceImpl* plugin_instance = ResourceHelper::GetPluginInstance(this);
   PluginDelegate* delegate =
       plugin_instance ? plugin_instance->delegate() : NULL;
   if (!delegate)
@@ -415,7 +415,7 @@
 }
 
 bool PPB_FileRef_Impl::IsValidNonExternalFileSystem() const {
-  PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this);
+  PluginInstanceImpl* plugin_instance = ResourceHelper::GetPluginInstance(this);
   PluginDelegate* delegate =
       plugin_instance ? plugin_instance->delegate() : NULL;
   return delegate &&
@@ -425,7 +425,7 @@
 }
 
 bool PPB_FileRef_Impl::HasValidFileSystem() const {
-  PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this);
+  PluginInstanceImpl* plugin_instance = ResourceHelper::GetPluginInstance(this);
   PluginDelegate* delegate =
       plugin_instance ? plugin_instance->delegate() : NULL;
   return delegate && delegate->IsFileSystemOpened(pp_instance(), file_system_);
@@ -440,7 +440,7 @@
 int32_t PPB_FileRef_Impl::QueryInHost(
     linked_ptr<PP_FileInfo> info,
     scoped_refptr<TrackedCallback> callback) {
-  scoped_refptr<PluginInstance> plugin_instance =
+  scoped_refptr<PluginInstanceImpl> plugin_instance =
       ResourceHelper::GetPluginInstance(this);
   if (!plugin_instance.get())
     return PP_ERROR_FAILED;
@@ -462,7 +462,8 @@
     if (!HasValidFileSystem())
       return PP_ERROR_NOACCESS;
 
-    PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this);
+    PluginInstanceImpl* plugin_instance =
+        ResourceHelper::GetPluginInstance(this);
     PluginDelegate* delegate =
         plugin_instance ? plugin_instance->delegate() : NULL;
     if (!delegate)
@@ -492,7 +493,7 @@
   if (!IsValidNonExternalFileSystem())
     return PP_ERROR_NOACCESS;
 
-  PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this);
+  PluginInstanceImpl* plugin_instance = ResourceHelper::GetPluginInstance(this);
   if (!plugin_instance)
     return PP_ERROR_FAILED;
 
diff --git a/webkit/plugins/ppapi/ppb_file_ref_impl.h b/content/renderer/pepper/ppb_file_ref_impl.h
similarity index 92%
rename from webkit/plugins/ppapi/ppb_file_ref_impl.h
rename to content/renderer/pepper/ppb_file_ref_impl.h
index 9caacf7..30612cd 100644
--- a/webkit/plugins/ppapi/ppb_file_ref_impl.h
+++ b/content/renderer/pepper/ppb_file_ref_impl.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_PPB_FILE_REF_IMPL_H_
-#define WEBKIT_PLUGINS_PPAPI_PPB_FILE_REF_IMPL_H_
+#ifndef CONTENT_RENDERER_PEPPER_PPB_FILE_REF_IMPL_H_
+#define CONTENT_RENDERER_PEPPER_PPB_FILE_REF_IMPL_H_
 
 #include <string>
 #include <vector>
@@ -16,7 +16,6 @@
 #include "ppapi/shared_impl/scoped_pp_resource.h"
 #include "ppapi/shared_impl/var.h"
 #include "url/gurl.h"
-#include "webkit/plugins/webkit_plugins_export.h"
 
 namespace webkit {
 namespace ppapi {
@@ -25,14 +24,12 @@
 
 class PPB_FileSystem_Impl;
 
-class WEBKIT_PLUGINS_EXPORT PPB_FileRef_Impl
-    : public ::ppapi::PPB_FileRef_Shared {
+class PPB_FileRef_Impl : public ::ppapi::PPB_FileRef_Shared {
  public:
   PPB_FileRef_Impl(const ::ppapi::PPB_FileRef_CreateInfo& info,
                    PP_Resource file_system);
   PPB_FileRef_Impl(const ::ppapi::PPB_FileRef_CreateInfo& info,
                    const base::FilePath& external_file_path);
-  virtual ~PPB_FileRef_Impl();
 
   // The returned object will have a refcount of 0 (just like "new").
   static PPB_FileRef_Impl* CreateInternal(PP_Instance instance,
@@ -72,7 +69,7 @@
       linked_ptr<std::vector< ::ppapi::PPB_FileRef_CreateInfo> > files,
       linked_ptr<std::vector<PP_FileType> > file_types,
       scoped_refptr< ::ppapi::TrackedCallback> callback) OVERRIDE;
-  virtual PP_Var GetAbsolutePath();
+  virtual PP_Var GetAbsolutePath() OVERRIDE;
 
   PP_Resource file_system_resource() const { return file_system_; }
 
@@ -91,6 +88,8 @@
   }
 
  private:
+  virtual ~PPB_FileRef_Impl();
+
   // Many mutation functions are allow only to non-external filesystems, This
   // function returns true if the filesystem is opened and isn't external as an
   // access check for these functions.
@@ -124,4 +123,4 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_PPB_FILE_REF_IMPL_H_
+#endif  // CONTENT_RENDERER_PEPPER_PPB_FILE_REF_IMPL_H_
diff --git a/webkit/plugins/ppapi/ppb_flash_message_loop_impl.cc b/content/renderer/pepper/ppb_flash_message_loop_impl.cc
similarity index 95%
rename from webkit/plugins/ppapi/ppb_flash_message_loop_impl.cc
rename to content/renderer/pepper/ppb_flash_message_loop_impl.cc
index e02c6e6..105c5a0 100644
--- a/webkit/plugins/ppapi/ppb_flash_message_loop_impl.cc
+++ b/content/renderer/pepper/ppb_flash_message_loop_impl.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/ppb_flash_message_loop_impl.h"
+#include "content/renderer/pepper/ppb_flash_message_loop_impl.h"
 
 #include "base/callback.h"
 #include "base/message_loop/message_loop.h"
@@ -34,6 +34,9 @@
   }
 
  private:
+  friend class base::RefCounted<State>;
+  virtual ~State() {}
+
   int32_t result_;
   bool run_called_;
   bool quit_called_;
diff --git a/webkit/plugins/ppapi/ppb_flash_message_loop_impl.h b/content/renderer/pepper/ppb_flash_message_loop_impl.h
similarity index 88%
rename from webkit/plugins/ppapi/ppb_flash_message_loop_impl.h
rename to content/renderer/pepper/ppb_flash_message_loop_impl.h
index 1349a52..ef6903c 100644
--- a/webkit/plugins/ppapi/ppb_flash_message_loop_impl.h
+++ b/content/renderer/pepper/ppb_flash_message_loop_impl.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_PPB_FLASH_MESSAGE_LOOP_IMPL_H_
-#define WEBKIT_PLUGINS_PPAPI_PPB_FLASH_MESSAGE_LOOP_IMPL_H_
+#ifndef CONTENT_RENDERER_PEPPER_PPB_FLASH_MESSAGE_LOOP_IMPL_H_
+#define CONTENT_RENDERER_PEPPER_PPB_FLASH_MESSAGE_LOOP_IMPL_H_
 
 #include "base/basictypes.h"
 #include "base/compiler_specific.h"
@@ -18,8 +18,6 @@
     : public ::ppapi::Resource,
       public ::ppapi::thunk::PPB_Flash_MessageLoop_API {
  public:
-  virtual ~PPB_Flash_MessageLoop_Impl();
-
   static PP_Resource Create(PP_Instance instance);
 
   // Resource.
@@ -36,6 +34,7 @@
   class State;
 
   explicit PPB_Flash_MessageLoop_Impl(PP_Instance instance);
+  virtual ~PPB_Flash_MessageLoop_Impl();
 
   // If |callback| is valid, it will be called when the message loop is signaled
   // to quit, and the result passed into it will be the same value as what this
@@ -52,4 +51,4 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_PPB_FLASH_MESSAGE_LOOP_IMPL_H_
+#endif  // CONTENT_RENDERER_PEPPER_PPB_FLASH_MESSAGE_LOOP_IMPL_H_
diff --git a/webkit/plugins/ppapi/ppb_gpu_blacklist_private_impl.cc b/content/renderer/pepper/ppb_gpu_blacklist_private_impl.cc
similarity index 92%
rename from webkit/plugins/ppapi/ppb_gpu_blacklist_private_impl.cc
rename to content/renderer/pepper/ppb_gpu_blacklist_private_impl.cc
index e77107a..81c4292 100644
--- a/webkit/plugins/ppapi/ppb_gpu_blacklist_private_impl.cc
+++ b/content/renderer/pepper/ppb_gpu_blacklist_private_impl.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/ppb_gpu_blacklist_private_impl.h"
+#include "content/renderer/pepper/ppb_gpu_blacklist_private_impl.h"
 
 #include "base/command_line.h"
 #include "base/logging.h"
diff --git a/webkit/plugins/ppapi/ppb_gpu_blacklist_private_impl.h b/content/renderer/pepper/ppb_gpu_blacklist_private_impl.h
similarity index 67%
rename from webkit/plugins/ppapi/ppb_gpu_blacklist_private_impl.h
rename to content/renderer/pepper/ppb_gpu_blacklist_private_impl.h
index 0a74c74..189afe3 100644
--- a/webkit/plugins/ppapi/ppb_gpu_blacklist_private_impl.h
+++ b/content/renderer/pepper/ppb_gpu_blacklist_private_impl.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_PPB_GPU_BLACKLIST_PRIVATE_IMPL_H_
-#define WEBKIT_PLUGINS_PPAPI_PPB_GPU_BLACKLIST_PRIVATE_IMPL_H_
+#ifndef CONTENT_RENDERER_PEPPER_PPB_GPU_BLACKLIST_PRIVATE_IMPL_H_
+#define CONTENT_RENDERER_PEPPER_PPB_GPU_BLACKLIST_PRIVATE_IMPL_H_
 
 #include "ppapi/c/private/ppb_gpu_blacklist_private.h"
 
@@ -18,5 +18,5 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_PPB_GPU_BLACKLIST_PRIVATE_IMPL_H_
+#endif  // CONTENT_RENDERER_PEPPER_PPB_GPU_BLACKLIST_PRIVATE_IMPL_H_
 
diff --git a/webkit/plugins/ppapi/ppb_graphics_3d_impl.cc b/content/renderer/pepper/ppb_graphics_3d_impl.cc
similarity index 96%
rename from webkit/plugins/ppapi/ppb_graphics_3d_impl.cc
rename to content/renderer/pepper/ppb_graphics_3d_impl.cc
index 7e58a11..26a7789 100644
--- a/webkit/plugins/ppapi/ppb_graphics_3d_impl.cc
+++ b/content/renderer/pepper/ppb_graphics_3d_impl.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 "webkit/plugins/ppapi/ppb_graphics_3d_impl.h"
+#include "content/renderer/pepper/ppb_graphics_3d_impl.h"
 
 #include "base/bind.h"
 #include "base/command_line.h"
 #include "base/message_loop/message_loop.h"
 #include "base/strings/utf_string_conversions.h"
+#include "content/renderer/pepper/plugin_module.h"
+#include "content/renderer/pepper/ppapi_plugin_instance_impl.h"
+#include "content/renderer/pepper/resource_helper.h"
 #include "gpu/command_buffer/client/gles2_implementation.h"
 #include "ppapi/c/ppp_graphics_3d.h"
 #include "ppapi/thunk/enter.h"
@@ -18,9 +21,6 @@
 #include "third_party/WebKit/public/web/WebFrame.h"
 #include "third_party/WebKit/public/web/WebPluginContainer.h"
 #include "webkit/plugins/plugin_switches.h"
-#include "webkit/plugins/ppapi/plugin_module.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
-#include "webkit/plugins/ppapi/resource_helper.h"
 
 using ppapi::thunk::EnterResourceNoLock;
 using ppapi::thunk::PPB_Graphics3D_API;
@@ -236,7 +236,7 @@
 
 bool PPB_Graphics3D_Impl::InitRaw(PPB_Graphics3D_API* share_context,
                                   const int32_t* attrib_list) {
-  PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this);
+  PluginInstanceImpl* plugin_instance = ResourceHelper::GetPluginInstance(this);
   if (!plugin_instance)
     return false;
 
@@ -307,7 +307,7 @@
   // By the time we run this, the instance may have been deleted, or in the
   // process of being deleted. Even in the latter case, we don't want to send a
   // callback after DidDestroy.
-  PluginInstance* instance = ResourceHelper::GetPluginInstance(this);
+  PluginInstanceImpl* instance = ResourceHelper::GetPluginInstance(this);
   if (!instance || !instance->container())
     return;
 
diff --git a/webkit/plugins/ppapi/ppb_graphics_3d_impl.h b/content/renderer/pepper/ppb_graphics_3d_impl.h
similarity index 93%
rename from webkit/plugins/ppapi/ppb_graphics_3d_impl.h
rename to content/renderer/pepper/ppb_graphics_3d_impl.h
index ddd85c7..e84a766 100644
--- a/webkit/plugins/ppapi/ppb_graphics_3d_impl.h
+++ b/content/renderer/pepper/ppb_graphics_3d_impl.h
@@ -2,21 +2,19 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_3D_IMPL_H_
-#define WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_3D_IMPL_H_
+#ifndef CONTENT_RENDERER_PEPPER_PPB_GRAPHICS_3D_IMPL_H_
+#define CONTENT_RENDERER_PEPPER_PPB_GRAPHICS_3D_IMPL_H_
 
 #include "base/memory/weak_ptr.h"
+#include "content/renderer/pepper/plugin_delegate.h"
 #include "ppapi/shared_impl/ppb_graphics_3d_shared.h"
 #include "ppapi/shared_impl/resource.h"
-#include "webkit/plugins/ppapi/plugin_delegate.h"
 
 namespace webkit {
 namespace ppapi {
 
 class PPB_Graphics3D_Impl : public ::ppapi::PPB_Graphics3D_Shared {
  public:
-  virtual ~PPB_Graphics3D_Impl();
-
   static PP_Resource Create(PP_Instance instance,
                             PP_Resource share_context,
                             const int32_t* attrib_list);
@@ -57,6 +55,7 @@
   }
 
  protected:
+  virtual ~PPB_Graphics3D_Impl();
   // ppapi::PPB_Graphics3D_Shared overrides.
   virtual gpu::CommandBuffer* GetCommandBuffer() OVERRIDE;
   virtual int32 DoSwapBuffers() OVERRIDE;
@@ -92,4 +91,4 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_3D_IMPL_H_
+#endif  // CONTENT_RENDERER_PEPPER_PPB_GRAPHICS_3D_IMPL_H_
diff --git a/webkit/plugins/ppapi/ppb_image_data_impl.cc b/content/renderer/pepper/ppb_image_data_impl.cc
similarity index 97%
rename from webkit/plugins/ppapi/ppb_image_data_impl.cc
rename to content/renderer/pepper/ppb_image_data_impl.cc
index 631989c..e17b348 100644
--- a/webkit/plugins/ppapi/ppb_image_data_impl.cc
+++ b/content/renderer/pepper/ppb_image_data_impl.cc
@@ -2,22 +2,21 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/ppb_image_data_impl.h"
+#include "content/renderer/pepper/ppb_image_data_impl.h"
 
 #include <algorithm>
 #include <limits>
 
 #include "base/logging.h"
 #include "base/memory/scoped_ptr.h"
+#include "content/renderer/pepper/common.h"
+#include "content/renderer/pepper/resource_helper.h"
 #include "skia/ext/platform_canvas.h"
 #include "ppapi/c/pp_instance.h"
 #include "ppapi/c/pp_resource.h"
 #include "ppapi/c/ppb_image_data.h"
 #include "ppapi/thunk/thunk.h"
 #include "third_party/skia/include/core/SkColorPriv.h"
-#include "webkit/plugins/ppapi/common.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
-#include "webkit/plugins/ppapi/resource_helper.h"
 
 using ::ppapi::thunk::PPB_ImageData_API;
 
diff --git a/webkit/plugins/ppapi/ppb_image_data_impl.h b/content/renderer/pepper/ppb_image_data_impl.h
similarity index 93%
rename from webkit/plugins/ppapi/ppb_image_data_impl.h
rename to content/renderer/pepper/ppb_image_data_impl.h
index 733fcf0..58cba82 100644
--- a/webkit/plugins/ppapi/ppb_image_data_impl.h
+++ b/content/renderer/pepper/ppb_image_data_impl.h
@@ -2,18 +2,18 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_PPB_IMAGE_DATA_IMPL_H_
-#define WEBKIT_PLUGINS_PPAPI_PPB_IMAGE_DATA_IMPL_H_
+#ifndef CONTENT_RENDERER_PEPPER_PPB_IMAGE_DATA_IMPL_H_
+#define CONTENT_RENDERER_PEPPER_PPB_IMAGE_DATA_IMPL_H_
 
 #include "base/basictypes.h"
 #include "base/memory/scoped_ptr.h"
+#include "content/common/content_export.h"
+#include "content/renderer/pepper/plugin_delegate.h"
 #include "ppapi/c/ppb_image_data.h"
 #include "ppapi/shared_impl/ppb_image_data_shared.h"
 #include "ppapi/shared_impl/resource.h"
 #include "ppapi/thunk/ppb_image_data_api.h"
 #include "third_party/skia/include/core/SkCanvas.h"
-#include "webkit/plugins/ppapi/plugin_delegate.h"
-#include "webkit/plugins/webkit_plugins_export.h"
 
 class SkBitmap;
 class SkCanvas;
@@ -21,7 +21,7 @@
 namespace webkit {
 namespace ppapi {
 
-class WEBKIT_PLUGINS_EXPORT PPB_ImageData_Impl
+class CONTENT_EXPORT PPB_ImageData_Impl
     : public ::ppapi::Resource,
       public ::ppapi::PPB_ImageData_Shared,
       public NON_EXPORTED_BASE(::ppapi::thunk::PPB_ImageData_API) {
@@ -50,7 +50,6 @@
   // for some internal uses of ImageData (like Graphics2D).
   PPB_ImageData_Impl(PP_Instance instance,
                      PPB_ImageData_Shared::ImageDataType type);
-  virtual ~PPB_ImageData_Impl();
 
   bool Init(PP_ImageDataFormat format,
             int width, int height,
@@ -88,6 +87,8 @@
   const SkBitmap* GetMappedBitmap() const;
 
  private:
+  virtual ~PPB_ImageData_Impl();
+
   PP_ImageDataFormat format_;
   int width_;
   int height_;
@@ -130,10 +131,10 @@
   virtual ~ImageDataSimpleBackend();
 
   // PPB_ImageData_Impl::Backend implementation.
-  bool Init(PPB_ImageData_Impl* impl, PP_ImageDataFormat format,
+  virtual bool Init(PPB_ImageData_Impl* impl, PP_ImageDataFormat format,
             int width, int height, bool init_to_zero) OVERRIDE;
   virtual bool IsMapped() const OVERRIDE;
-  PluginDelegate::PlatformImage2D* PlatformImage() const OVERRIDE;
+  virtual PluginDelegate::PlatformImage2D* PlatformImage() const OVERRIDE;
   virtual void* Map() OVERRIDE;
   virtual void Unmap() OVERRIDE;
   virtual int32_t GetSharedMemory(int* handle, uint32_t* byte_count) OVERRIDE;
@@ -193,4 +194,4 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_PPB_IMAGE_DATA_IMPL_H_
+#endif  // CONTENT_RENDERER_PEPPER_PPB_IMAGE_DATA_IMPL_H_
diff --git a/webkit/plugins/ppapi/ppb_network_monitor_private_impl.cc b/content/renderer/pepper/ppb_network_monitor_private_impl.cc
similarity index 95%
rename from webkit/plugins/ppapi/ppb_network_monitor_private_impl.cc
rename to content/renderer/pepper/ppb_network_monitor_private_impl.cc
index 64691c8..75a8935 100644
--- a/webkit/plugins/ppapi/ppb_network_monitor_private_impl.cc
+++ b/content/renderer/pepper/ppb_network_monitor_private_impl.cc
@@ -2,14 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/ppb_network_monitor_private_impl.h"
+#include "content/renderer/pepper/ppb_network_monitor_private_impl.h"
 
 #include "base/bind.h"
+#include "content/renderer/pepper/resource_helper.h"
 #include "ppapi/shared_impl/ppb_network_list_private_shared.h"
 #include "ppapi/shared_impl/private/net_address_private_impl.h"
 #include "net/base/ip_endpoint.h"
 #include "net/base/net_util.h"
-#include "webkit/plugins/ppapi/resource_helper.h"
 
 namespace webkit {
 namespace ppapi {
diff --git a/webkit/plugins/ppapi/ppb_network_monitor_private_impl.h b/content/renderer/pepper/ppb_network_monitor_private_impl.h
similarity index 85%
rename from webkit/plugins/ppapi/ppb_network_monitor_private_impl.h
rename to content/renderer/pepper/ppb_network_monitor_private_impl.h
index fc61dfc..c603eb1 100644
--- a/webkit/plugins/ppapi/ppb_network_monitor_private_impl.h
+++ b/content/renderer/pepper/ppb_network_monitor_private_impl.h
@@ -2,16 +2,16 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_PPB_NETWORK_MONITOR_PRIVATE_IMPL_H_
-#define WEBKIT_PLUGINS_PPAPI_PPB_NETWORK_MONITOR_PRIVATE_IMPL_H_
+#ifndef CONTENT_RENDERER_PEPPER_PPB_NETWORK_MONITOR_PRIVATE_IMPL_H_
+#define CONTENT_RENDERER_PEPPER_PPB_NETWORK_MONITOR_PRIVATE_IMPL_H_
 
 #include "base/basictypes.h"
 #include "base/compiler_specific.h"
+#include "content/renderer/pepper/plugin_delegate.h"
 #include "ppapi/c/private/ppb_network_monitor_private.h"
 #include "ppapi/shared_impl/resource.h"
 #include "ppapi/thunk/ppb_network_monitor_private_api.h"
 #include "webkit/glue/network_list_observer.h"
-#include "webkit/plugins/ppapi/plugin_delegate.h"
 
 namespace webkit {
 namespace ppapi {
@@ -25,8 +25,6 @@
                             PPB_NetworkMonitor_Callback callback,
                             void* user_data);
 
-  virtual ~PPB_NetworkMonitor_Private_Impl();
-
   virtual ::ppapi::thunk::PPB_NetworkMonitor_Private_API*
       AsPPB_NetworkMonitor_Private_API() OVERRIDE;
 
@@ -38,6 +36,7 @@
   PPB_NetworkMonitor_Private_Impl(PP_Instance instance,
                                   PPB_NetworkMonitor_Callback callback,
                                   void* user_data);
+  virtual ~PPB_NetworkMonitor_Private_Impl();
 
   bool Start();
 
@@ -51,4 +50,4 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_PPB_NETWORK_MONITOR_PRIVATE_IMPL_H_
+#endif  // CONTENT_RENDERER_PEPPER_PPB_NETWORK_MONITOR_PRIVATE_IMPL_H_
diff --git a/webkit/plugins/ppapi/ppb_proxy_impl.cc b/content/renderer/pepper/ppb_proxy_impl.cc
similarity index 90%
rename from webkit/plugins/ppapi/ppb_proxy_impl.cc
rename to content/renderer/pepper/ppb_proxy_impl.cc
index 2910045..caf63f7 100644
--- a/webkit/plugins/ppapi/ppb_proxy_impl.cc
+++ b/content/renderer/pepper/ppb_proxy_impl.cc
@@ -2,14 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/ppb_proxy_impl.h"
+#include "content/renderer/pepper/ppb_proxy_impl.h"
 
 #include "ppapi/c/private/ppb_proxy_private.h"
 #include "ppapi/thunk/enter.h"
 #include "ppapi/thunk/ppb_image_data_api.h"
-#include "webkit/plugins/ppapi/host_globals.h"
-#include "webkit/plugins/ppapi/plugin_module.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
+#include "content/renderer/pepper/host_globals.h"
+#include "content/renderer/pepper/plugin_module.h"
 
 using ppapi::PpapiGlobals;
 using ppapi::thunk::EnterResource;
diff --git a/webkit/plugins/ppapi/ppb_proxy_impl.h b/content/renderer/pepper/ppb_proxy_impl.h
similarity index 70%
rename from webkit/plugins/ppapi/ppb_proxy_impl.h
rename to content/renderer/pepper/ppb_proxy_impl.h
index 72a333a..04e12fc 100644
--- a/webkit/plugins/ppapi/ppb_proxy_impl.h
+++ b/content/renderer/pepper/ppb_proxy_impl.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_PPB_PROXY_IMPL_H_
-#define WEBKIT_PLUGINS_PPAPI_PPB_PROXY_IMPL_H_
+#ifndef CONTENT_RENDERER_PEPPER_PPB_PROXY_IMPL_H_
+#define CONTENT_RENDERER_PEPPER_PPB_PROXY_IMPL_H_
 
 struct PPB_Proxy_Private;
 
@@ -18,5 +18,5 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_PPB_PROXY_IMPL_H_
+#endif  // CONTENT_RENDERER_PEPPER_PPB_PROXY_IMPL_H_
 
diff --git a/webkit/plugins/ppapi/ppb_scrollbar_impl.cc b/content/renderer/pepper/ppb_scrollbar_impl.cc
similarity index 93%
rename from webkit/plugins/ppapi/ppb_scrollbar_impl.cc
rename to content/renderer/pepper/ppb_scrollbar_impl.cc
index fa63020..a326cad 100644
--- a/webkit/plugins/ppapi/ppb_scrollbar_impl.cc
+++ b/content/renderer/pepper/ppb_scrollbar_impl.cc
@@ -2,11 +2,17 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/ppb_scrollbar_impl.h"
+#include "content/renderer/pepper/ppb_scrollbar_impl.h"
 
 #include "base/bind.h"
 #include "base/logging.h"
 #include "base/message_loop/message_loop.h"
+#include "content/renderer/pepper/common.h"
+#include "content/renderer/pepper/event_conversion.h"
+#include "content/renderer/pepper/plugin_module.h"
+#include "content/renderer/pepper/ppapi_plugin_instance_impl.h"
+#include "content/renderer/pepper/ppb_image_data_impl.h"
+#include "content/renderer/pepper/resource_helper.h"
 #include "ppapi/c/dev/ppp_scrollbar_dev.h"
 #include "ppapi/thunk/thunk.h"
 #include "skia/ext/platform_canvas.h"
@@ -16,12 +22,6 @@
 #include "third_party/WebKit/public/web/WebInputEvent.h"
 #include "third_party/WebKit/public/web/WebPluginScrollbar.h"
 #include "webkit/glue/webkit_glue.h"
-#include "webkit/plugins/ppapi/common.h"
-#include "webkit/plugins/ppapi/event_conversion.h"
-#include "webkit/plugins/ppapi/plugin_module.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
-#include "webkit/plugins/ppapi/ppb_image_data_impl.h"
-#include "webkit/plugins/ppapi/resource_helper.h"
 
 #if defined(OS_WIN)
 #include "base/win/windows_version.h"
@@ -54,7 +54,7 @@
 }
 
 void PPB_Scrollbar_Impl::Init(bool vertical) {
-  PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this);
+  PluginInstanceImpl* plugin_instance = ResourceHelper::GetPluginInstance(this);
   if (!plugin_instance)
     return;
   scrollbar_.reset(WebPluginScrollbar::createForPlugin(
diff --git a/webkit/plugins/ppapi/ppb_scrollbar_impl.h b/content/renderer/pepper/ppb_scrollbar_impl.h
similarity index 90%
rename from webkit/plugins/ppapi/ppb_scrollbar_impl.h
rename to content/renderer/pepper/ppb_scrollbar_impl.h
index b3537fc..eed236f 100644
--- a/webkit/plugins/ppapi/ppb_scrollbar_impl.h
+++ b/content/renderer/pepper/ppb_scrollbar_impl.h
@@ -2,19 +2,19 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_PPB_SCROLLBAR_IMPL_H_
-#define WEBKIT_PLUGINS_PPAPI_PPB_SCROLLBAR_IMPL_H_
+#ifndef CONTENT_RENDERER_PEPPER_PPB_SCROLLBAR_IMPL_H_
+#define CONTENT_RENDERER_PEPPER_PPB_SCROLLBAR_IMPL_H_
 
 #include <vector>
 
 #include "base/compiler_specific.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
+#include "content/renderer/pepper/ppb_widget_impl.h"
 #include "ppapi/thunk/ppb_scrollbar_api.h"
 #include "third_party/WebKit/public/platform/WebRect.h"
 #include "third_party/WebKit/public/web/WebPluginScrollbarClient.h"
 #include "ui/gfx/rect.h"
-#include "webkit/plugins/ppapi/ppb_widget_impl.h"
 
 namespace webkit {
 namespace ppapi {
@@ -25,11 +25,9 @@
  public:
   static PP_Resource Create(PP_Instance instance, bool vertical);
 
-  virtual ~PPB_Scrollbar_Impl();
-
   // Resource overrides.
   virtual PPB_Scrollbar_API* AsPPB_Scrollbar_API() OVERRIDE;
-  virtual void InstanceWasDeleted();
+  virtual void InstanceWasDeleted() OVERRIDE;
 
   // PPB_Scrollbar_API implementation.
   virtual uint32_t GetThickness() OVERRIDE;
@@ -41,6 +39,8 @@
   virtual void ScrollBy(PP_ScrollBy_Dev unit, int32_t multiplier) OVERRIDE;
 
  private:
+  virtual ~PPB_Scrollbar_Impl();
+
   explicit PPB_Scrollbar_Impl(PP_Instance instance);
   void Init(bool vertical);
 
@@ -75,4 +75,4 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_PPB_SCROLLBAR_IMPL_H_
+#endif  // CONTENT_RENDERER_PEPPER_PPB_SCROLLBAR_IMPL_H_
diff --git a/webkit/plugins/ppapi/ppb_tcp_server_socket_private_impl.cc b/content/renderer/pepper/ppb_tcp_server_socket_private_impl.cc
similarity index 86%
rename from webkit/plugins/ppapi/ppb_tcp_server_socket_private_impl.cc
rename to content/renderer/pepper/ppb_tcp_server_socket_private_impl.cc
index d52c6e1..2e8ceda 100644
--- a/webkit/plugins/ppapi/ppb_tcp_server_socket_private_impl.cc
+++ b/content/renderer/pepper/ppb_tcp_server_socket_private_impl.cc
@@ -2,14 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/ppb_tcp_server_socket_private_impl.h"
+#include "content/renderer/pepper/ppb_tcp_server_socket_private_impl.h"
 
 #include "base/logging.h"
-#include "webkit/plugins/ppapi/host_globals.h"
-#include "webkit/plugins/ppapi/plugin_delegate.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
-#include "webkit/plugins/ppapi/ppb_tcp_socket_private_impl.h"
-#include "webkit/plugins/ppapi/resource_helper.h"
+#include "content/renderer/pepper/host_globals.h"
+#include "content/renderer/pepper/plugin_delegate.h"
+#include "content/renderer/pepper/ppb_tcp_socket_private_impl.h"
+#include "content/renderer/pepper/resource_helper.h"
 
 namespace webkit {
 namespace ppapi {
diff --git a/webkit/plugins/ppapi/ppb_tcp_server_socket_private_impl.h b/content/renderer/pepper/ppb_tcp_server_socket_private_impl.h
similarity index 83%
rename from webkit/plugins/ppapi/ppb_tcp_server_socket_private_impl.h
rename to content/renderer/pepper/ppb_tcp_server_socket_private_impl.h
index f621e1c..f048c7b 100644
--- a/webkit/plugins/ppapi/ppb_tcp_server_socket_private_impl.h
+++ b/content/renderer/pepper/ppb_tcp_server_socket_private_impl.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_PPB_TCP_SERVER_SOCKET_PRIVATE_IMPL_H_
-#define WEBKIT_PLUGINS_PPAPI_PPB_TCP_SERVER_SOCKET_PRIVATE_IMPL_H_
+#ifndef CONTENT_RENDERER_PEPPER_PPB_TCP_SERVER_SOCKET_PRIVATE_IMPL_H_
+#define CONTENT_RENDERER_PEPPER_PPB_TCP_SERVER_SOCKET_PRIVATE_IMPL_H_
 
 #include "base/compiler_specific.h"
 #include "ppapi/shared_impl/private/ppb_tcp_server_socket_shared.h"
@@ -37,4 +37,4 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_PPB_TCP_SERVER_SOCKET_PRIVATE_IMPL_H_
+#endif  // CONTENT_RENDERER_PEPPER_PPB_TCP_SERVER_SOCKET_PRIVATE_IMPL_H_
diff --git a/webkit/plugins/ppapi/ppb_tcp_socket_private_impl.cc b/content/renderer/pepper/ppb_tcp_socket_private_impl.cc
similarity index 90%
rename from webkit/plugins/ppapi/ppb_tcp_socket_private_impl.cc
rename to content/renderer/pepper/ppb_tcp_socket_private_impl.cc
index 3b4866a..7ebcc64 100644
--- a/webkit/plugins/ppapi/ppb_tcp_socket_private_impl.cc
+++ b/content/renderer/pepper/ppb_tcp_socket_private_impl.cc
@@ -2,13 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/ppb_tcp_socket_private_impl.h"
+#include "content/renderer/pepper/ppb_tcp_socket_private_impl.h"
 
+#include "content/renderer/pepper/host_globals.h"
+#include "content/renderer/pepper/plugin_delegate.h"
+#include "content/renderer/pepper/ppapi_plugin_instance_impl.h"
+#include "content/renderer/pepper/resource_helper.h"
 #include "ppapi/shared_impl/socket_option_data.h"
-#include "webkit/plugins/ppapi/host_globals.h"
-#include "webkit/plugins/ppapi/plugin_delegate.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
-#include "webkit/plugins/ppapi/resource_helper.h"
 
 namespace webkit {
 namespace ppapi {
@@ -123,7 +123,8 @@
 
 PluginDelegate* PPB_TCPSocket_Private_Impl::GetPluginDelegate(
     PP_Instance instance) {
-  PluginInstance* plugin_instance = HostGlobals::Get()->GetInstance(instance);
+  PluginInstanceImpl* plugin_instance =
+      HostGlobals::Get()->GetInstance(instance);
   if (!plugin_instance)
     return NULL;
   return plugin_instance->delegate();
diff --git a/webkit/plugins/ppapi/ppb_tcp_socket_private_impl.h b/content/renderer/pepper/ppb_tcp_socket_private_impl.h
similarity index 89%
rename from webkit/plugins/ppapi/ppb_tcp_socket_private_impl.h
rename to content/renderer/pepper/ppb_tcp_socket_private_impl.h
index 6f52d22..7295094 100644
--- a/webkit/plugins/ppapi/ppb_tcp_socket_private_impl.h
+++ b/content/renderer/pepper/ppb_tcp_socket_private_impl.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_PPB_TCP_SOCKET_PRIVATE_IMPL_H_
-#define WEBKIT_PLUGINS_PPAPI_PPB_TCP_SOCKET_PRIVATE_IMPL_H_
+#ifndef CONTENT_RENDERER_PEPPER_PPB_TCP_SOCKET_PRIVATE_IMPL_H_
+#define CONTENT_RENDERER_PEPPER_PPB_TCP_SOCKET_PRIVATE_IMPL_H_
 
 #include <vector>
 
@@ -50,4 +50,4 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_PPB_TCP_SOCKET_PRIVATE_IMPL_H_
+#endif  // CONTENT_RENDERER_PEPPER_PPB_TCP_SOCKET_PRIVATE_IMPL_H_
diff --git a/webkit/plugins/ppapi/ppb_uma_private_impl.cc b/content/renderer/pepper/ppb_uma_private_impl.cc
similarity index 97%
rename from webkit/plugins/ppapi/ppb_uma_private_impl.cc
rename to content/renderer/pepper/ppb_uma_private_impl.cc
index fb30a06..8468dd7 100644
--- a/webkit/plugins/ppapi/ppb_uma_private_impl.cc
+++ b/content/renderer/pepper/ppb_uma_private_impl.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/ppb_uma_private_impl.h"
+#include "content/renderer/pepper/ppb_uma_private_impl.h"
 
 #include "base/metrics/histogram.h"
 #include "ppapi/c/pp_var.h"
diff --git a/webkit/plugins/ppapi/ppb_uma_private_impl.h b/content/renderer/pepper/ppb_uma_private_impl.h
similarity index 69%
rename from webkit/plugins/ppapi/ppb_uma_private_impl.h
rename to content/renderer/pepper/ppb_uma_private_impl.h
index c563331..55a94f4 100644
--- a/webkit/plugins/ppapi/ppb_uma_private_impl.h
+++ b/content/renderer/pepper/ppb_uma_private_impl.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_PPB_UMA_PRIVATE_IMPL_H_
-#define WEBKIT_PLUGINS_PPAPI_PPB_UMA_PRIVATE_IMPL_H_
+#ifndef CONTENT_RENDERER_PEPPER_PPB_UMA_PRIVATE_IMPL_H_
+#define CONTENT_RENDERER_PEPPER_PPB_UMA_PRIVATE_IMPL_H_
 
 #include "ppapi/c/private/ppb_uma_private.h"
 
@@ -18,4 +18,4 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_PPB_UMA_PRIVATE_IMPL_H_
+#endif  // CONTENT_RENDERER_PEPPER_PPB_UMA_PRIVATE_IMPL_H_
diff --git a/webkit/plugins/ppapi/ppb_var_deprecated_impl.cc b/content/renderer/pepper/ppb_var_deprecated_impl.cc
similarity index 95%
rename from webkit/plugins/ppapi/ppb_var_deprecated_impl.cc
rename to content/renderer/pepper/ppb_var_deprecated_impl.cc
index 4934ae5..cbfc6f9 100644
--- a/webkit/plugins/ppapi/ppb_var_deprecated_impl.cc
+++ b/content/renderer/pepper/ppb_var_deprecated_impl.cc
@@ -2,23 +2,23 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/ppb_var_deprecated_impl.h"
+#include "content/renderer/pepper/ppb_var_deprecated_impl.h"
 
 #include <limits>
 
+#include "content/renderer/pepper/common.h"
+#include "content/renderer/pepper/host_globals.h"
+#include "content/renderer/pepper/npapi_glue.h"
+#include "content/renderer/pepper/npobject_var.h"
+#include "content/renderer/pepper/plugin_module.h"
+#include "content/renderer/pepper/plugin_object.h"
+#include "content/renderer/pepper/ppapi_plugin_instance_impl.h"
 #include "ppapi/c/dev/ppb_var_deprecated.h"
 #include "ppapi/c/ppb_var.h"
 #include "ppapi/c/pp_var.h"
 #include "ppapi/shared_impl/ppb_var_shared.h"
 #include "third_party/WebKit/public/web/WebBindings.h"
 #include "third_party/WebKit/public/web/WebScopedUserGesture.h"
-#include "webkit/plugins/ppapi/common.h"
-#include "webkit/plugins/ppapi/host_globals.h"
-#include "webkit/plugins/ppapi/npapi_glue.h"
-#include "webkit/plugins/ppapi/npobject_var.h"
-#include "webkit/plugins/ppapi/plugin_module.h"
-#include "webkit/plugins/ppapi/plugin_object.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
 
 using ppapi::NPObjectVar;
 using ppapi::PpapiGlobals;
@@ -119,7 +119,7 @@
 
   NPObjectVar* object() { return object_.get(); }
 
-  PluginInstance* GetPluginInstance() {
+  PluginInstanceImpl* GetPluginInstance() {
     return HostGlobals::Get()->GetInstance(object()->pp_instance());
   }
 
@@ -332,7 +332,7 @@
   ObjectAccessorTryCatch accessor(var, exception);
   if (accessor.has_exception())
     return PP_MakeUndefined();
-  PluginInstance* plugin = accessor.GetPluginInstance();
+  PluginInstanceImpl* plugin = accessor.GetPluginInstance();
   if (plugin && plugin->IsProcessingUserGesture()) {
     WebKit::WebScopedUserGesture user_gesture(
         plugin->CurrentUserGestureToken());
@@ -389,7 +389,7 @@
 PP_Var CreateObjectDeprecated(PP_Instance pp_instance,
                               const PPP_Class_Deprecated* ppp_class,
                               void* ppp_class_data) {
-  PluginInstance* instance = HostGlobals::Get()->GetInstance(pp_instance);
+  PluginInstanceImpl* instance = HostGlobals::Get()->GetInstance(pp_instance);
   if (!instance) {
     DLOG(ERROR) << "Create object passed an invalid instance.";
     return PP_MakeNull();
diff --git a/webkit/plugins/ppapi/ppb_var_deprecated_impl.h b/content/renderer/pepper/ppb_var_deprecated_impl.h
similarity index 68%
rename from webkit/plugins/ppapi/ppb_var_deprecated_impl.h
rename to content/renderer/pepper/ppb_var_deprecated_impl.h
index 5e12400..459acfa 100644
--- a/webkit/plugins/ppapi/ppb_var_deprecated_impl.h
+++ b/content/renderer/pepper/ppb_var_deprecated_impl.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_PPB_VAR_DEPRECATED_IMPL_H_
-#define WEBKIT_PLUGINS_PPAPI_PPB_VAR_DEPRECATED_IMPL_H_
+#ifndef CONTENT_RENDERER_PEPPER_PPB_VAR_DEPRECATED_IMPL_H_
+#define CONTENT_RENDERER_PEPPER_PPB_VAR_DEPRECATED_IMPL_H_
 
 struct PPB_Var_Deprecated;
 
@@ -18,4 +18,4 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_PPB_VAR_DEPRECATED_IMPL_H_
+#endif  // CONTENT_RENDERER_PEPPER_PPB_VAR_DEPRECATED_IMPL_H_
diff --git a/webkit/plugins/ppapi/ppb_video_decoder_impl.cc b/content/renderer/pepper/ppb_video_decoder_impl.cc
similarity index 96%
rename from webkit/plugins/ppapi/ppb_video_decoder_impl.cc
rename to content/renderer/pepper/ppb_video_decoder_impl.cc
index cbcf4da..c71f618 100644
--- a/webkit/plugins/ppapi/ppb_video_decoder_impl.cc
+++ b/content/renderer/pepper/ppb_video_decoder_impl.cc
@@ -2,13 +2,18 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/ppb_video_decoder_impl.h"
+#include "content/renderer/pepper/ppb_video_decoder_impl.h"
 
 #include <string>
 
 #include "base/logging.h"
 #include "base/message_loop/message_loop.h"
 #include "base/metrics/histogram.h"
+#include "content/renderer/pepper/common.h"
+#include "content/renderer/pepper/plugin_module.h"
+#include "content/renderer/pepper/ppb_buffer_impl.h"
+#include "content/renderer/pepper/ppb_graphics_3d_impl.h"
+#include "content/renderer/pepper/resource_helper.h"
 #include "gpu/command_buffer/client/gles2_implementation.h"
 #include "media/video/picture.h"
 #include "media/video/video_decode_accelerator.h"
@@ -19,12 +24,6 @@
 #include "ppapi/c/pp_errors.h"
 #include "ppapi/shared_impl/resource_tracker.h"
 #include "ppapi/thunk/enter.h"
-#include "webkit/plugins/ppapi/common.h"
-#include "webkit/plugins/ppapi/plugin_module.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
-#include "webkit/plugins/ppapi/ppb_buffer_impl.h"
-#include "webkit/plugins/ppapi/ppb_graphics_3d_impl.h"
-#include "webkit/plugins/ppapi/resource_helper.h"
 
 using ppapi::TrackedCallback;
 using ppapi::thunk::EnterResourceNoLock;
diff --git a/webkit/plugins/ppapi/ppb_video_decoder_impl.h b/content/renderer/pepper/ppb_video_decoder_impl.h
similarity index 92%
rename from webkit/plugins/ppapi/ppb_video_decoder_impl.h
rename to content/renderer/pepper/ppb_video_decoder_impl.h
index ea29305..d2d07b8 100644
--- a/webkit/plugins/ppapi/ppb_video_decoder_impl.h
+++ b/content/renderer/pepper/ppb_video_decoder_impl.h
@@ -2,19 +2,19 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_PPB_VIDEO_DECODER_IMPL_H_
-#define WEBKIT_PLUGINS_PPAPI_PPB_VIDEO_DECODER_IMPL_H_
+#ifndef CONTENT_RENDERER_PEPPER_PPB_VIDEO_DECODER_IMPL_H_
+#define CONTENT_RENDERER_PEPPER_PPB_VIDEO_DECODER_IMPL_H_
 
 #include "base/basictypes.h"
 #include "base/compiler_specific.h"
 #include "base/memory/ref_counted.h"
+#include "content/renderer/pepper/plugin_delegate.h"
 #include "ppapi/c/dev/pp_video_dev.h"
 #include "ppapi/c/dev/ppp_video_decoder_dev.h"
 #include "ppapi/c/pp_var.h"
 #include "ppapi/shared_impl/ppb_video_decoder_shared.h"
 #include "ppapi/shared_impl/resource.h"
 #include "ppapi/thunk/ppb_video_decoder_api.h"
-#include "webkit/plugins/ppapi/plugin_delegate.h"
 
 struct PP_PictureBuffer_Dev;
 struct PP_VideoBitstreamBuffer_Dev;
@@ -31,7 +31,6 @@
 class PPB_VideoDecoder_Impl : public ::ppapi::PPB_VideoDecoder_Shared,
                               public media::VideoDecodeAccelerator::Client {
  public:
-  virtual ~PPB_VideoDecoder_Impl();
   // See PPB_VideoDecoder_Dev::Create.  Returns 0 on failure to create &
   // initialize.
   static PP_Resource Create(PP_Instance instance,
@@ -65,6 +64,8 @@
   virtual void NotifyResetDone() OVERRIDE;
 
  private:
+  virtual ~PPB_VideoDecoder_Impl();
+
   explicit PPB_VideoDecoder_Impl(PP_Instance instance);
   bool Init(PP_Resource graphics_context,
             PluginDelegate::PlatformContext3D* context,
@@ -84,4 +85,4 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_PPB_VIDEO_DECODER_IMPL_H_
+#endif  // CONTENT_RENDERER_PEPPER_PPB_VIDEO_DECODER_IMPL_H_
diff --git a/webkit/plugins/ppapi/ppb_widget_impl.cc b/content/renderer/pepper/ppb_widget_impl.cc
similarity index 85%
rename from webkit/plugins/ppapi/ppb_widget_impl.cc
rename to content/renderer/pepper/ppb_widget_impl.cc
index 8fe0386..5854f01 100644
--- a/webkit/plugins/ppapi/ppb_widget_impl.cc
+++ b/content/renderer/pepper/ppb_widget_impl.cc
@@ -2,16 +2,16 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/ppb_widget_impl.h"
+#include "content/renderer/pepper/ppb_widget_impl.h"
 
+#include "content/renderer/pepper/ppapi_plugin_instance_impl.h"
+#include "content/renderer/pepper/ppb_image_data_impl.h"
+#include "content/renderer/pepper/plugin_module.h"
+#include "content/renderer/pepper/resource_helper.h"
 #include "ppapi/c/dev/ppp_widget_dev.h"
 #include "ppapi/thunk/enter.h"
 #include "ppapi/thunk/ppb_input_event_api.h"
 #include "ppapi/thunk/ppb_widget_api.h"
-#include "webkit/plugins/ppapi/ppb_image_data_impl.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
-#include "webkit/plugins/ppapi/plugin_module.h"
-#include "webkit/plugins/ppapi/resource_helper.h"
 
 using ppapi::thunk::EnterResourceNoLock;
 using ppapi::thunk::PPB_ImageData_API;
@@ -65,7 +65,7 @@
 }
 
 void PPB_Widget_Impl::Invalidate(const PP_Rect* dirty) {
-  PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this);
+  PluginInstanceImpl* plugin_instance = ResourceHelper::GetPluginInstance(this);
   if (!plugin_instance)
     return;
   const PPP_Widget_Dev* widget = static_cast<const PPP_Widget_Dev*>(
diff --git a/webkit/plugins/ppapi/ppb_widget_impl.h b/content/renderer/pepper/ppb_widget_impl.h
similarity index 91%
rename from webkit/plugins/ppapi/ppb_widget_impl.h
rename to content/renderer/pepper/ppb_widget_impl.h
index 7fd143e..7b1e950 100644
--- a/webkit/plugins/ppapi/ppb_widget_impl.h
+++ b/content/renderer/pepper/ppb_widget_impl.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_PPB_WIDGET_IMPL_H_
-#define WEBKIT_PLUGINS_PPAPI_PPB_WIDGET_IMPL_H_
+#ifndef CONTENT_RENDERER_PEPPER_PPB_WIDGET_IMPL_H_
+#define CONTENT_RENDERER_PEPPER_PPB_WIDGET_IMPL_H_
 
 #include "base/basictypes.h"
 #include "base/compiler_specific.h"
@@ -27,7 +27,6 @@
                         public ::ppapi::thunk::PPB_Widget_API {
  public:
   explicit PPB_Widget_Impl(PP_Instance instance);
-  virtual ~PPB_Widget_Impl();
 
   // Resource overrides.
   virtual ::ppapi::thunk::PPB_Widget_API* AsPPB_Widget_API() OVERRIDE;
@@ -43,6 +42,8 @@
   void Invalidate(const PP_Rect* dirty);
 
  protected:
+  virtual ~PPB_Widget_Impl();
+
   virtual PP_Bool PaintInternal(const gfx::Rect& rect,
                                 PPB_ImageData_Impl* image) = 0;
   virtual PP_Bool HandleEventInternal(const ::ppapi::InputEventData& data) = 0;
@@ -61,4 +62,4 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_PPB_WIDGET_IMPL_H_
+#endif  // CONTENT_RENDERER_PEPPER_PPB_WIDGET_IMPL_H_
diff --git a/webkit/plugins/ppapi/ppb_x509_certificate_private_impl.cc b/content/renderer/pepper/ppb_x509_certificate_private_impl.cc
similarity index 81%
rename from webkit/plugins/ppapi/ppb_x509_certificate_private_impl.cc
rename to content/renderer/pepper/ppb_x509_certificate_private_impl.cc
index ee08d84..0b848d2 100644
--- a/webkit/plugins/ppapi/ppb_x509_certificate_private_impl.cc
+++ b/content/renderer/pepper/ppb_x509_certificate_private_impl.cc
@@ -2,11 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/ppb_x509_certificate_private_impl.h"
+#include "content/renderer/pepper/ppb_x509_certificate_private_impl.h"
 
-#include "webkit/plugins/ppapi/plugin_delegate.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
-#include "webkit/plugins/ppapi/resource_helper.h"
+#include "content/renderer/pepper/plugin_delegate.h"
+#include "content/renderer/pepper/resource_helper.h"
 
 namespace webkit {
 namespace ppapi {
diff --git a/webkit/plugins/ppapi/ppb_x509_certificate_private_impl.h b/content/renderer/pepper/ppb_x509_certificate_private_impl.h
similarity index 82%
rename from webkit/plugins/ppapi/ppb_x509_certificate_private_impl.h
rename to content/renderer/pepper/ppb_x509_certificate_private_impl.h
index 0c5949c..6b8d856 100644
--- a/webkit/plugins/ppapi/ppb_x509_certificate_private_impl.h
+++ b/content/renderer/pepper/ppb_x509_certificate_private_impl.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_PPB_X509_CERTIFICATE_PRIVATE_IMPL_H_
-#define WEBKIT_PLUGINS_PPAPI_PPB_X509_CERTIFICATE_PRIVATE_IMPL_H_
+#ifndef CONTENT_RENDERER_PEPPER_PPB_X509_CERTIFICATE_PRIVATE_IMPL_H_
+#define CONTENT_RENDERER_PEPPER_PPB_X509_CERTIFICATE_PRIVATE_IMPL_H_
 
 #include "base/basictypes.h"
 #include "base/compiler_specific.h"
@@ -34,4 +34,4 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_PPB_X509_CERTIFICATE_PRIVATE_IMPL_H_
+#endif  // CONTENT_RENDERER_PEPPER_PPB_X509_CERTIFICATE_PRIVATE_IMPL_H_
diff --git a/webkit/plugins/ppapi/ppp_pdf.h b/content/renderer/pepper/ppp_pdf.h
similarity index 88%
rename from webkit/plugins/ppapi/ppp_pdf.h
rename to content/renderer/pepper/ppp_pdf.h
index 9f4cfcd..6ad67bf 100644
--- a/webkit/plugins/ppapi/ppp_pdf.h
+++ b/content/renderer/pepper/ppp_pdf.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_PPP_PDF_H_
-#define WEBKIT_PLUGINS_PPAPI_PPP_PDF_H_
+#ifndef CONTENT_RENDERER_PEPPER_PPP_PDF_H_
+#define CONTENT_RENDERER_PEPPER_PPP_PDF_H_
 
 #include "ppapi/c/pp_instance.h"
 #include "ppapi/c/pp_point.h"
@@ -31,4 +31,4 @@
 
 typedef PPP_Pdf_1 PPP_Pdf;
 
-#endif  // WEBKIT_PLUGINS_PPAPI_PPP_PDF_H_
+#endif  // CONTENT_RENDERER_PEPPER_PPP_PDF_H_
diff --git a/webkit/plugins/ppapi/quota_file_io.cc b/content/renderer/pepper/quota_file_io.cc
similarity index 97%
rename from webkit/plugins/ppapi/quota_file_io.cc
rename to content/renderer/pepper/quota_file_io.cc
index 40fe532..64d26a9 100644
--- a/webkit/plugins/ppapi/quota_file_io.cc
+++ b/content/renderer/pepper/quota_file_io.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/quota_file_io.h"
+#include "content/renderer/pepper/quota_file_io.h"
 
 #include <algorithm>
 
@@ -12,9 +12,9 @@
 #include "base/message_loop/message_loop_proxy.h"
 #include "base/stl_util.h"
 #include "base/task_runner_util.h"
-#include "webkit/plugins/ppapi/host_globals.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
-#include "webkit/plugins/ppapi/resource_helper.h"
+#include "content/renderer/pepper/host_globals.h"
+#include "content/renderer/pepper/ppapi_plugin_instance_impl.h"
+#include "content/renderer/pepper/resource_helper.h"
 
 using base::PlatformFile;
 using base::PlatformFileError;
@@ -288,7 +288,7 @@
 }
 
 PluginDelegate* QuotaFileIO::GetPluginDelegate() const {
-  PluginInstance* instance = HostGlobals::Get()->GetInstance(pp_instance_);
+  PluginInstanceImpl* instance = HostGlobals::Get()->GetInstance(pp_instance_);
   if (instance)
     return instance->delegate();
   return NULL;
diff --git a/webkit/plugins/ppapi/quota_file_io.h b/content/renderer/pepper/quota_file_io.h
similarity index 74%
rename from webkit/plugins/ppapi/quota_file_io.h
rename to content/renderer/pepper/quota_file_io.h
index 8ba5f42..7c95464 100644
--- a/webkit/plugins/ppapi/quota_file_io.h
+++ b/content/renderer/pepper/quota_file_io.h
@@ -2,19 +2,19 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_QUOTA_FILE_IO_H_
-#define WEBKIT_PLUGINS_PPAPI_QUOTA_FILE_IO_H_
+#ifndef CONTENT_RENDERER_PEPPER_QUOTA_FILE_IO_H_
+#define CONTENT_RENDERER_PEPPER_QUOTA_FILE_IO_H_
 
 #include <deque>
 
 #include "base/files/file_util_proxy.h"
 #include "base/memory/weak_ptr.h"
 #include "base/platform_file.h"
+#include "content/common/content_export.h"
 #include "ppapi/c/pp_file_info.h"
 #include "ppapi/c/pp_instance.h"
 #include "url/gurl.h"
 #include "webkit/common/quota/quota_types.h"
-#include "webkit/plugins/webkit_plugins_export.h"
 
 namespace webkit {
 namespace ppapi {
@@ -29,11 +29,11 @@
   typedef base::FileUtilProxy::WriteCallback WriteCallback;
   typedef base::FileUtilProxy::StatusCallback StatusCallback;
 
-  WEBKIT_PLUGINS_EXPORT QuotaFileIO(PP_Instance instance,
-                                    base::PlatformFile file,
-                                    const GURL& path_url,
-                                    PP_FileSystemType type);
-  WEBKIT_PLUGINS_EXPORT ~QuotaFileIO();
+  CONTENT_EXPORT QuotaFileIO(PP_Instance instance,
+                             base::PlatformFile file,
+                             const GURL& path_url,
+                             PP_FileSystemType type);
+  CONTENT_EXPORT ~QuotaFileIO();
 
   // Performs write or setlength operation with quota checks.
   // Returns true when the operation is successfully dispatched.
@@ -45,18 +45,18 @@
   // SetLength/WillSetLength cannot be called while there're any in-flight
   // operations.  For Write/WillWrite it is guaranteed that |callback| are
   // always dispatched in the same order as Write being called.
-  WEBKIT_PLUGINS_EXPORT bool Write(int64_t offset,
-                                   const char* buffer,
-                                   int32_t bytes_to_write,
-                                   const WriteCallback& callback);
-  WEBKIT_PLUGINS_EXPORT bool WillWrite(int64_t offset,
-                                       int32_t bytes_to_write,
-                                       const WriteCallback& callback);
+  CONTENT_EXPORT bool Write(int64_t offset,
+                            const char* buffer,
+                            int32_t bytes_to_write,
+                            const WriteCallback& callback);
+  CONTENT_EXPORT bool WillWrite(int64_t offset,
+                                int32_t bytes_to_write,
+                                const WriteCallback& callback);
 
-  WEBKIT_PLUGINS_EXPORT bool SetLength(int64_t length,
-                                       const StatusCallback& callback);
-  WEBKIT_PLUGINS_EXPORT bool WillSetLength(int64_t length,
-                                           const StatusCallback& callback);
+  CONTENT_EXPORT bool SetLength(int64_t length,
+                                const StatusCallback& callback);
+  CONTENT_EXPORT bool WillSetLength(int64_t length,
+                                    const StatusCallback& callback);
 
   // Returns the plugin delegate or NULL if the resource has outlived the
   // instance.
@@ -114,4 +114,4 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_QUOTA_FILE_IO_H_
+#endif  // CONTENT_RENDERER_PEPPER_QUOTA_FILE_IO_H_
diff --git a/webkit/plugins/ppapi/quota_file_io_unittest.cc b/content/renderer/pepper/quota_file_io_unittest.cc
similarity index 97%
rename from webkit/plugins/ppapi/quota_file_io_unittest.cc
rename to content/renderer/pepper/quota_file_io_unittest.cc
index b092770..ad66e52 100644
--- a/webkit/plugins/ppapi/quota_file_io_unittest.cc
+++ b/content/renderer/pepper/quota_file_io_unittest.cc
@@ -13,10 +13,10 @@
 #include "base/memory/weak_ptr.h"
 #include "base/message_loop/message_loop.h"
 #include "base/platform_file.h"
-#include "webkit/plugins/ppapi/mock_plugin_delegate.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
-#include "webkit/plugins/ppapi/ppapi_unittest.h"
-#include "webkit/plugins/ppapi/quota_file_io.h"
+#include "content/renderer/pepper/mock_plugin_delegate.h"
+#include "content/renderer/pepper/ppapi_plugin_instance_impl.h"
+#include "content/renderer/pepper/ppapi_unittest.h"
+#include "content/renderer/pepper/quota_file_io.h"
 
 using base::MessageLoopProxy;
 using base::PlatformFile;
@@ -38,7 +38,8 @@
   }
   virtual ~QuotaMockPluginDelegate() {}
 
-  virtual scoped_refptr<MessageLoopProxy> GetFileThreadMessageLoopProxy() {
+  virtual scoped_refptr<MessageLoopProxy>
+      GetFileThreadMessageLoopProxy() OVERRIDE {
     return file_thread_;
   }
 
diff --git a/content/renderer/pepper/renderer_ppapi_host_impl.cc b/content/renderer/pepper/renderer_ppapi_host_impl.cc
index fb430b4..0d6768f 100644
--- a/content/renderer/pepper/renderer_ppapi_host_impl.cc
+++ b/content/renderer/pepper/renderer_ppapi_host_impl.cc
@@ -6,13 +6,18 @@
 
 #include "base/files/file_path.h"
 #include "base/logging.h"
-#include "base/process_util.h"
+#include "base/process/process_handle.h"
 #include "content/common/sandbox_util.h"
+#include "content/renderer/pepper/fullscreen_container.h"
+#include "content/renderer/pepper/host_globals.h"
 #include "content/renderer/pepper/pepper_browser_connection.h"
 #include "content/renderer/pepper/pepper_graphics_2d_host.h"
 #include "content/renderer/pepper/pepper_in_process_resource_creation.h"
 #include "content/renderer/pepper/pepper_in_process_router.h"
 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h"
+#include "content/renderer/pepper/plugin_delegate.h"
+#include "content/renderer/pepper/plugin_module.h"
+#include "content/renderer/pepper/ppapi_plugin_instance_impl.h"
 #include "content/renderer/render_view_impl.h"
 #include "content/renderer/render_widget_fullscreen_pepper.h"
 #include "ipc/ipc_message.h"
@@ -23,14 +28,10 @@
 #include "third_party/WebKit/public/web/WebElement.h"
 #include "third_party/WebKit/public/web/WebPluginContainer.h"
 #include "ui/gfx/point.h"
-#include "webkit/plugins/ppapi/fullscreen_container.h"
-#include "webkit/plugins/ppapi/host_globals.h"
-#include "webkit/plugins/ppapi/plugin_delegate.h"
-#include "webkit/plugins/ppapi/plugin_module.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
 
 using webkit::ppapi::HostGlobals;
 using webkit::ppapi::PluginInstance;
+using webkit::ppapi::PluginInstanceImpl;
 using webkit::ppapi::PluginModule;
 
 namespace content {
@@ -112,7 +113,7 @@
 // static
 RendererPpapiHostImpl* RendererPpapiHostImpl::GetForPPInstance(
     PP_Instance pp_instance) {
-  PluginInstance* instance = HostGlobals::Get()->GetInstance(pp_instance);
+  PluginInstanceImpl* instance = HostGlobals::Get()->GetInstance(pp_instance);
   if (!instance)
     return NULL;
 
@@ -124,14 +125,14 @@
 
 scoped_ptr< ::ppapi::thunk::ResourceCreationAPI>
 RendererPpapiHostImpl::CreateInProcessResourceCreationAPI(
-    PluginInstance* instance) {
+    PluginInstanceImpl* instance) {
   return scoped_ptr< ::ppapi::thunk::ResourceCreationAPI>(
       new PepperInProcessResourceCreation(this, instance));
 }
 
 PepperBrowserConnection*
 RendererPpapiHostImpl::GetBrowserConnection(PP_Instance instance) const {
-  PluginInstance* instance_object = GetAndValidateInstance(instance);
+  PluginInstanceImpl* instance_object = GetAndValidateInstance(instance);
   if (!instance_object)
     return NULL;
 
@@ -145,13 +146,18 @@
   return delegate->pepper_browser_connection();
 }
 
+webkit::ppapi::PluginInstanceImpl* RendererPpapiHostImpl::GetPluginInstanceImpl(
+    PP_Instance instance) const {
+  return GetAndValidateInstance(instance);
+}
+
 ppapi::host::PpapiHost* RendererPpapiHostImpl::GetPpapiHost() {
   return ppapi_host_.get();
 }
 
 RenderView* RendererPpapiHostImpl::GetRenderViewForInstance(
     PP_Instance instance) const {
-  PluginInstance* instance_object = GetAndValidateInstance(instance);
+  PluginInstanceImpl* instance_object = GetAndValidateInstance(instance);
   if (!instance_object)
     return NULL;
 
@@ -161,8 +167,7 @@
       instance_object->delegate())->render_view();
 }
 
-bool RendererPpapiHostImpl::IsValidInstance(
-    PP_Instance instance) const {
+bool RendererPpapiHostImpl::IsValidInstance(PP_Instance instance) const {
   return !!GetAndValidateInstance(instance);
 }
 
@@ -173,7 +178,7 @@
 
 WebKit::WebPluginContainer* RendererPpapiHostImpl::GetContainerForInstance(
       PP_Instance instance) const {
-  PluginInstance* instance_object = GetAndValidateInstance(instance);
+  PluginInstanceImpl* instance_object = GetAndValidateInstance(instance);
   if (!instance_object)
     return NULL;
   return instance_object->container();
@@ -186,7 +191,7 @@
 }
 
 bool RendererPpapiHostImpl::HasUserGesture(PP_Instance instance) const {
-  PluginInstance* instance_object = GetAndValidateInstance(instance);
+  PluginInstanceImpl* instance_object = GetAndValidateInstance(instance);
   if (!instance_object)
     return false;
 
@@ -197,7 +202,7 @@
 }
 
 int RendererPpapiHostImpl::GetRoutingIDForWidget(PP_Instance instance) const {
-  webkit::ppapi::PluginInstance* plugin_instance =
+  webkit::ppapi::PluginInstanceImpl* plugin_instance =
       GetAndValidateInstance(instance);
   if (!plugin_instance)
     return 0;
@@ -212,7 +217,7 @@
 gfx::Point RendererPpapiHostImpl::PluginPointToRenderView(
     PP_Instance instance,
     const gfx::Point& pt) const {
-  webkit::ppapi::PluginInstance* plugin_instance =
+  webkit::ppapi::PluginInstanceImpl* plugin_instance =
       GetAndValidateInstance(instance);
   if (!plugin_instance)
     return pt;
@@ -264,9 +269,9 @@
   }
 }
 
-PluginInstance* RendererPpapiHostImpl::GetAndValidateInstance(
+PluginInstanceImpl* RendererPpapiHostImpl::GetAndValidateInstance(
     PP_Instance pp_instance) const {
-  PluginInstance* instance = HostGlobals::Get()->GetInstance(pp_instance);
+  PluginInstanceImpl* instance = HostGlobals::Get()->GetInstance(pp_instance);
   if (!instance)
     return NULL;
   if (!instance->IsValidInstanceOf(module_))
diff --git a/content/renderer/pepper/renderer_ppapi_host_impl.h b/content/renderer/pepper/renderer_ppapi_host_impl.h
index b2dd843..6d576f7 100644
--- a/content/renderer/pepper/renderer_ppapi_host_impl.h
+++ b/content/renderer/pepper/renderer_ppapi_host_impl.h
@@ -9,9 +9,9 @@
 #include "base/memory/scoped_ptr.h"
 #include "content/public/renderer/renderer_ppapi_host.h"
 #include "content/renderer/pepper/content_renderer_pepper_host_factory.h"
+#include "content/renderer/pepper/plugin_delegate.h"
+#include "content/renderer/pepper/plugin_module.h"
 #include "ppapi/host/ppapi_host.h"
-#include "webkit/plugins/ppapi/plugin_delegate.h"
-#include "webkit/plugins/ppapi/plugin_module.h"
 
 namespace IPC {
 class Sender;
@@ -31,7 +31,7 @@
 
 namespace webkit {
 namespace ppapi {
-class PluginInstance;
+class PluginInstanceImpl;
 class PluginModule;
 }
 }
@@ -81,10 +81,13 @@
   // happen automatically.
   scoped_ptr< ::ppapi::thunk::ResourceCreationAPI>
       CreateInProcessResourceCreationAPI(
-          webkit::ppapi::PluginInstance* instance);
+          webkit::ppapi::PluginInstanceImpl* instance);
 
   PepperBrowserConnection* GetBrowserConnection(PP_Instance instance) const;
 
+  webkit::ppapi::PluginInstanceImpl* GetPluginInstanceImpl(
+      PP_Instance instance) const;
+
   // RendererPpapiHost implementation.
   virtual ppapi::host::PpapiHost* GetPpapiHost() OVERRIDE;
   virtual bool IsValidInstance(PP_Instance instance) const OVERRIDE;
@@ -122,7 +125,7 @@
   //
   // We use this to security check the PP_Instance values sent from a plugin to
   // make sure it's not trying to spoof another instance.
-  webkit::ppapi::PluginInstance* GetAndValidateInstance(
+  webkit::ppapi::PluginInstanceImpl* GetAndValidateInstance(
       PP_Instance instance) const;
 
   webkit::ppapi::PluginModule* module_;  // Non-owning pointer.
diff --git a/webkit/plugins/ppapi/resource_creation_impl.cc b/content/renderer/pepper/resource_creation_impl.cc
similarity index 90%
rename from webkit/plugins/ppapi/resource_creation_impl.cc
rename to content/renderer/pepper/resource_creation_impl.cc
index f84e5fe..63fbe35 100644
--- a/webkit/plugins/ppapi/resource_creation_impl.cc
+++ b/content/renderer/pepper/resource_creation_impl.cc
@@ -2,29 +2,29 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/resource_creation_impl.h"
+#include "content/renderer/pepper/resource_creation_impl.h"
 
+#include "content/renderer/pepper/common.h"
+#include "content/renderer/pepper/ppb_audio_impl.h"
+#include "content/renderer/pepper/ppb_broker_impl.h"
+#include "content/renderer/pepper/ppb_buffer_impl.h"
+#include "content/renderer/pepper/ppb_file_ref_impl.h"
+#include "content/renderer/pepper/ppb_flash_message_loop_impl.h"
+#include "content/renderer/pepper/ppb_graphics_3d_impl.h"
+#include "content/renderer/pepper/ppb_image_data_impl.h"
+#include "content/renderer/pepper/ppb_network_monitor_private_impl.h"
+#include "content/renderer/pepper/ppb_scrollbar_impl.h"
+#include "content/renderer/pepper/ppb_tcp_server_socket_private_impl.h"
+#include "content/renderer/pepper/ppb_tcp_socket_private_impl.h"
+#include "content/renderer/pepper/ppb_video_decoder_impl.h"
+#include "content/renderer/pepper/ppb_x509_certificate_private_impl.h"
+#include "content/renderer/pepper/resource_helper.h"
 #include "ppapi/c/pp_size.h"
 #include "ppapi/shared_impl/ppb_audio_config_shared.h"
 #include "ppapi/shared_impl/ppb_image_data_shared.h"
 #include "ppapi/shared_impl/ppb_input_event_shared.h"
 #include "ppapi/shared_impl/ppb_resource_array_shared.h"
 #include "ppapi/shared_impl/var.h"
-#include "webkit/plugins/ppapi/common.h"
-#include "webkit/plugins/ppapi/ppb_audio_impl.h"
-#include "webkit/plugins/ppapi/ppb_broker_impl.h"
-#include "webkit/plugins/ppapi/ppb_buffer_impl.h"
-#include "webkit/plugins/ppapi/ppb_file_ref_impl.h"
-#include "webkit/plugins/ppapi/ppb_flash_message_loop_impl.h"
-#include "webkit/plugins/ppapi/ppb_graphics_3d_impl.h"
-#include "webkit/plugins/ppapi/ppb_image_data_impl.h"
-#include "webkit/plugins/ppapi/ppb_network_monitor_private_impl.h"
-#include "webkit/plugins/ppapi/ppb_scrollbar_impl.h"
-#include "webkit/plugins/ppapi/ppb_tcp_server_socket_private_impl.h"
-#include "webkit/plugins/ppapi/ppb_tcp_socket_private_impl.h"
-#include "webkit/plugins/ppapi/ppb_video_decoder_impl.h"
-#include "webkit/plugins/ppapi/ppb_x509_certificate_private_impl.h"
-#include "webkit/plugins/ppapi/resource_helper.h"
 
 using ppapi::InputEventData;
 using ppapi::PPB_InputEvent_Shared;
@@ -34,7 +34,7 @@
 namespace webkit {
 namespace ppapi {
 
-ResourceCreationImpl::ResourceCreationImpl(PluginInstance* instance) {
+ResourceCreationImpl::ResourceCreationImpl(PluginInstanceImpl* instance) {
 }
 
 ResourceCreationImpl::~ResourceCreationImpl() {
diff --git a/webkit/plugins/ppapi/resource_creation_impl.h b/content/renderer/pepper/resource_creation_impl.h
similarity index 93%
rename from webkit/plugins/ppapi/resource_creation_impl.h
rename to content/renderer/pepper/resource_creation_impl.h
index d3018fc..8ed7ac4 100644
--- a/webkit/plugins/ppapi/resource_creation_impl.h
+++ b/content/renderer/pepper/resource_creation_impl.h
@@ -2,27 +2,25 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_RESOURCE_CREATION_IMPL_H_
-#define WEBKIT_PLUGINS_PPAPI_RESOURCE_CREATION_IMPL_H_
+#ifndef CONTENT_RENDERER_PEPPER_RESOURCE_CREATION_IMPL_H_
+#define CONTENT_RENDERER_PEPPER_RESOURCE_CREATION_IMPL_H_
 
 #include "base/basictypes.h"
 #include "base/compiler_specific.h"
 #include "ppapi/thunk/resource_creation_api.h"
-#include "webkit/plugins/webkit_plugins_export.h"
 
 namespace webkit {
 namespace ppapi {
 
-class PluginInstance;
+class PluginInstanceImpl;
 
 // This is an abstract class.  ResourceCreationAPI functions that implement
 // "old-style" resources are handled here. See
 // content/renderer/pepper/pepper_in_process_resource_creation.h for functions
 // that implement "new-style" resources.
-class WEBKIT_PLUGINS_EXPORT ResourceCreationImpl
-    : public NON_EXPORTED_BASE(::ppapi::thunk::ResourceCreationAPI) {
+class ResourceCreationImpl : public ::ppapi::thunk::ResourceCreationAPI {
  public:
-  explicit ResourceCreationImpl(PluginInstance* instance);
+  explicit ResourceCreationImpl(PluginInstanceImpl* instance);
   virtual ~ResourceCreationImpl();
 
   // ResourceCreationAPI implementation.
@@ -150,4 +148,4 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_RESOURCE_CREATION_IMPL_H_
+#endif  // CONTENT_RENDERER_PEPPER_RESOURCE_CREATION_IMPL_H_
diff --git a/webkit/plugins/ppapi/resource_helper.cc b/content/renderer/pepper/resource_helper.cc
similarity index 62%
rename from webkit/plugins/ppapi/resource_helper.cc
rename to content/renderer/pepper/resource_helper.cc
index 0807e2e..c665223 100644
--- a/webkit/plugins/ppapi/resource_helper.cc
+++ b/content/renderer/pepper/resource_helper.cc
@@ -2,38 +2,37 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/resource_helper.h"
+#include "content/renderer/pepper/resource_helper.h"
 
 #include "base/logging.h"
+#include "content/renderer/pepper/host_globals.h"
+#include "content/renderer/pepper/plugin_module.h"
+#include "content/renderer/pepper/ppapi_plugin_instance_impl.h"
 #include "ppapi/shared_impl/resource.h"
-#include "webkit/plugins/ppapi/host_globals.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
-#include "webkit/plugins/ppapi/plugin_module.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
 
 namespace webkit {
 namespace ppapi {
 
 // static
-PluginInstance* ResourceHelper::GetPluginInstance(
+PluginInstanceImpl* ResourceHelper::GetPluginInstance(
     const ::ppapi::Resource* resource) {
   return PPInstanceToPluginInstance(resource->pp_instance());
 }
 
-PluginInstance* ResourceHelper::PPInstanceToPluginInstance(
+PluginInstanceImpl* ResourceHelper::PPInstanceToPluginInstance(
     PP_Instance instance) {
   return HostGlobals::Get()->GetInstance(instance);
 }
 
 PluginModule* ResourceHelper::GetPluginModule(
     const ::ppapi::Resource* resource) {
-  PluginInstance* instance = GetPluginInstance(resource);
+  PluginInstanceImpl* instance = GetPluginInstance(resource);
   return instance ? instance->module() : NULL;
 }
 
 PluginDelegate* ResourceHelper::GetPluginDelegate(
     const ::ppapi::Resource* resource) {
-  PluginInstance* instance = GetPluginInstance(resource);
+  PluginInstanceImpl* instance = GetPluginInstance(resource);
   return instance ? instance->delegate() : NULL;
 }
 
diff --git a/webkit/plugins/ppapi/resource_helper.h b/content/renderer/pepper/resource_helper.h
similarity index 75%
rename from webkit/plugins/ppapi/resource_helper.h
rename to content/renderer/pepper/resource_helper.h
index cca66f0..fa8483f 100644
--- a/webkit/plugins/ppapi/resource_helper.h
+++ b/content/renderer/pepper/resource_helper.h
@@ -2,13 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_RESOURCE_HELPER_H_
-#define WEBKIT_PLUGINS_PPAPI_RESOURCE_HELPER_H_
+#ifndef CONTENT_RENDERER_PEPPER_RESOURCE_HELPER_H_
+#define CONTENT_RENDERER_PEPPER_RESOURCE_HELPER_H_
 
 #include "base/basictypes.h"
 #include "ppapi/c/pp_instance.h"
 #include "ppapi/c/pp_resource.h"
-#include "webkit/plugins/webkit_plugins_export.h"
 
 namespace ppapi {
 class Resource;
@@ -17,7 +16,7 @@
 namespace webkit {
 namespace ppapi {
 
-class PluginInstance;
+class PluginInstanceImpl;
 class PluginModule;
 class PluginDelegate;
 
@@ -30,19 +29,19 @@
  public:
   // Returns the instance implementation object for the given resource, or NULL
   // if the resource has outlived its instance.
-  static PluginInstance* GetPluginInstance(const ::ppapi::Resource* resource);
+  static PluginInstanceImpl* GetPluginInstance(
+      const ::ppapi::Resource* resource);
 
   // Returns the module for the given resource, or NULL if the resource has
   // outlived its instance.
-  WEBKIT_PLUGINS_EXPORT static PluginModule* GetPluginModule(
-      const ::ppapi::Resource* resource);
+  static PluginModule* GetPluginModule(const ::ppapi::Resource* resource);
 
   // Returns the plugin delegate for the given resource, or NULL if the
   // resource has outlived its instance.
   static PluginDelegate* GetPluginDelegate(const ::ppapi::Resource* resource);
 
   // Returns the instance implementation object for the pp_instance.
-  static PluginInstance* PPInstanceToPluginInstance(PP_Instance instance);
+  static PluginInstanceImpl* PPInstanceToPluginInstance(PP_Instance instance);
 
  private:
   DISALLOW_IMPLICIT_CONSTRUCTORS(ResourceHelper);
@@ -51,4 +50,4 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_RESOURCE_IMPL_HELPER_H_
+#endif  // CONTENT_RENDERER_PEPPER_RESOURCE_IMPL_HELPER_H_
diff --git a/webkit/plugins/ppapi/url_request_info_util.cc b/content/renderer/pepper/url_request_info_util.cc
similarity index 95%
rename from webkit/plugins/ppapi/url_request_info_util.cc
rename to content/renderer/pepper/url_request_info_util.cc
index b9e765a..08fc076 100644
--- a/webkit/plugins/ppapi/url_request_info_util.cc
+++ b/content/renderer/pepper/url_request_info_util.cc
@@ -2,10 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/url_request_info_util.h"
+#include "content/renderer/pepper/url_request_info_util.h"
 
 #include "base/logging.h"
 #include "base/strings/string_util.h"
+#include "content/renderer/pepper/common.h"
+#include "content/renderer/pepper/plugin_module.h"
+#include "content/renderer/pepper/ppb_file_ref_impl.h"
+#include "content/renderer/pepper/resource_helper.h"
 #include "net/http/http_util.h"
 #include "ppapi/shared_impl/url_request_info_data.h"
 #include "ppapi/shared_impl/var.h"
@@ -19,10 +23,6 @@
 #include "url/gurl.h"
 #include "url/url_util.h"
 #include "webkit/child/weburlrequest_extradata_impl.h"
-#include "webkit/plugins/ppapi/common.h"
-#include "webkit/plugins/ppapi/plugin_module.h"
-#include "webkit/plugins/ppapi/ppb_file_ref_impl.h"
-#include "webkit/plugins/ppapi/resource_helper.h"
 
 using ppapi::URLRequestInfoData;
 using ppapi::Resource;
diff --git a/webkit/plugins/ppapi/url_request_info_util.h b/content/renderer/pepper/url_request_info_util.h
similarity index 62%
rename from webkit/plugins/ppapi/url_request_info_util.h
rename to content/renderer/pepper/url_request_info_util.h
index 4c5e110..88cabc8 100644
--- a/webkit/plugins/ppapi/url_request_info_util.h
+++ b/content/renderer/pepper/url_request_info_util.h
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_URL_REQUEST_INFO_UTIL_H_
-#define WEBKIT_PLUGINS_PPAPI_URL_REQUEST_INFO_UTIL_H_
+#ifndef CONTENT_RENDERER_PEPPER_URL_REQUEST_INFO_UTIL_H_
+#define CONTENT_RENDERER_PEPPER_URL_REQUEST_INFO_UTIL_H_
 
 #include "base/memory/ref_counted.h"
-#include "webkit/plugins/webkit_plugins_export.h"
+#include "content/common/content_export.h"
 
 namespace ppapi {
 struct URLRequestInfoData;
@@ -24,16 +24,15 @@
 // on success, false if the request is invalid (in which case *dest may be
 // partially initialized). Any upload files with only resource IDs (no file ref
 // pointers) will be populated by this function on success.
-WEBKIT_PLUGINS_EXPORT bool CreateWebURLRequest(
-    ::ppapi::URLRequestInfoData* data,
-    WebKit::WebFrame* frame,
-    WebKit::WebURLRequest* dest);
+CONTENT_EXPORT bool CreateWebURLRequest(::ppapi::URLRequestInfoData* data,
+                                        WebKit::WebFrame* frame,
+                                        WebKit::WebURLRequest* dest);
 
 // Returns true if universal access is required to use the given request.
-WEBKIT_PLUGINS_EXPORT bool URLRequestRequiresUniversalAccess(
+CONTENT_EXPORT bool URLRequestRequiresUniversalAccess(
     const ::ppapi::URLRequestInfoData& data);
 
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_PPB_URL_REQUEST_INFO_UTIL_H_
+#endif  // CONTENT_RENDERER_PEPPER_PPB_URL_REQUEST_INFO_UTIL_H_
diff --git a/content/renderer/pepper/url_response_info_util.cc b/content/renderer/pepper/url_response_info_util.cc
index ddfa0f2..f07a9b9 100644
--- a/content/renderer/pepper/url_response_info_util.cc
+++ b/content/renderer/pepper/url_response_info_util.cc
@@ -5,13 +5,13 @@
 #include "content/renderer/pepper/url_response_info_util.h"
 
 #include "base/files/file_path.h"
+#include "content/renderer/pepper/ppb_file_ref_impl.h"
 #include "ppapi/shared_impl/url_response_info_data.h"
 #include "third_party/WebKit/public/platform/WebCString.h"
 #include "third_party/WebKit/public/platform/WebHTTPHeaderVisitor.h"
 #include "third_party/WebKit/public/platform/WebString.h"
 #include "third_party/WebKit/public/platform/WebURL.h"
 #include "third_party/WebKit/public/platform/WebURLResponse.h"
-#include "webkit/plugins/ppapi/ppb_file_ref_impl.h"
 
 using webkit::ppapi::PPB_FileRef_Impl;
 using WebKit::WebHTTPHeaderVisitor;
diff --git a/webkit/plugins/ppapi/usb_key_code_conversion.cc b/content/renderer/pepper/usb_key_code_conversion.cc
similarity index 88%
rename from webkit/plugins/ppapi/usb_key_code_conversion.cc
rename to content/renderer/pepper/usb_key_code_conversion.cc
index b63e5c6..2640417 100644
--- a/webkit/plugins/ppapi/usb_key_code_conversion.cc
+++ b/content/renderer/pepper/usb_key_code_conversion.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/usb_key_code_conversion.h"
+#include "content/renderer/pepper/usb_key_code_conversion.h"
 
 #include "build/build_config.h"
 
diff --git a/webkit/plugins/ppapi/usb_key_code_conversion.h b/content/renderer/pepper/usb_key_code_conversion.h
similarity index 80%
rename from webkit/plugins/ppapi/usb_key_code_conversion.h
rename to content/renderer/pepper/usb_key_code_conversion.h
index fc3da16..459e662 100644
--- a/webkit/plugins/ppapi/usb_key_code_conversion.h
+++ b/content/renderer/pepper/usb_key_code_conversion.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEBKIT_PLUGINS_PPAPI_USB_KEY_CODE_CONVERSION_H_
-#define WEBKIT_PLUGINS_PPAPI_USB_KEY_CODE_CONVERSION_H_
+#ifndef CONTENT_RENDERER_PEPPER_USB_KEY_CODE_CONVERSION_H_
+#define CONTENT_RENDERER_PEPPER_USB_KEY_CODE_CONVERSION_H_
 
 #include "ppapi/c/pp_stdint.h"
 
@@ -24,4 +24,4 @@
 }  // namespace ppapi
 }  // namespace webkit
 
-#endif  // WEBKIT_PLUGINS_PPAPI_USB_KEY_CODE_CONVERSION_H_
+#endif  // CONTENT_RENDERER_PEPPER_USB_KEY_CODE_CONVERSION_H_
diff --git a/webkit/plugins/ppapi/usb_key_code_conversion_linux.cc b/content/renderer/pepper/usb_key_code_conversion_linux.cc
similarity index 93%
rename from webkit/plugins/ppapi/usb_key_code_conversion_linux.cc
rename to content/renderer/pepper/usb_key_code_conversion_linux.cc
index 56105a9..fd5e2b1 100644
--- a/webkit/plugins/ppapi/usb_key_code_conversion_linux.cc
+++ b/content/renderer/pepper/usb_key_code_conversion_linux.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/usb_key_code_conversion.h"
+#include "content/renderer/pepper/usb_key_code_conversion.h"
 
 #include "base/basictypes.h"
 #include "third_party/WebKit/public/web/WebInputEvent.h"
diff --git a/webkit/plugins/ppapi/usb_key_code_conversion_mac.cc b/content/renderer/pepper/usb_key_code_conversion_mac.cc
similarity index 91%
rename from webkit/plugins/ppapi/usb_key_code_conversion_mac.cc
rename to content/renderer/pepper/usb_key_code_conversion_mac.cc
index 94a1e71..4f55366 100644
--- a/webkit/plugins/ppapi/usb_key_code_conversion_mac.cc
+++ b/content/renderer/pepper/usb_key_code_conversion_mac.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/usb_key_code_conversion.h"
+#include "content/renderer/pepper/usb_key_code_conversion.h"
 
 #include "base/basictypes.h"
 #include "third_party/WebKit/public/web/WebInputEvent.h"
diff --git a/webkit/plugins/ppapi/usb_key_code_conversion_win.cc b/content/renderer/pepper/usb_key_code_conversion_win.cc
similarity index 93%
rename from webkit/plugins/ppapi/usb_key_code_conversion_win.cc
rename to content/renderer/pepper/usb_key_code_conversion_win.cc
index dfef1eb..5ef1d81 100644
--- a/webkit/plugins/ppapi/usb_key_code_conversion_win.cc
+++ b/content/renderer/pepper/usb_key_code_conversion_win.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/usb_key_code_conversion.h"
+#include "content/renderer/pepper/usb_key_code_conversion.h"
 
 #include "base/basictypes.h"
 #include "third_party/WebKit/public/web/WebInputEvent.h"
diff --git a/webkit/plugins/ppapi/v8_var_converter.cc b/content/renderer/pepper/v8_var_converter.cc
similarity index 98%
rename from webkit/plugins/ppapi/v8_var_converter.cc
rename to content/renderer/pepper/v8_var_converter.cc
index 6a7f62e..202a7cc 100644
--- a/webkit/plugins/ppapi/v8_var_converter.cc
+++ b/content/renderer/pepper/v8_var_converter.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/v8_var_converter.h"
+#include "content/renderer/pepper/v8_var_converter.h"
 
 #include <map>
 #include <stack>
@@ -11,12 +11,12 @@
 #include "base/containers/hash_tables.h"
 #include "base/logging.h"
 #include "base/memory/scoped_ptr.h"
+#include "content/renderer/pepper/host_array_buffer_var.h"
 #include "ppapi/shared_impl/array_var.h"
 #include "ppapi/shared_impl/dictionary_var.h"
 #include "ppapi/shared_impl/var.h"
 #include "ppapi/shared_impl/var_tracker.h"
 #include "third_party/WebKit/public/platform/WebArrayBuffer.h"
-#include "webkit/plugins/ppapi/host_array_buffer_var.h"
 
 using ppapi::ArrayBufferVar;
 using ppapi::ArrayVar;
diff --git a/content/renderer/pepper/v8_var_converter.h b/content/renderer/pepper/v8_var_converter.h
new file mode 100644
index 0000000..2a07bfb
--- /dev/null
+++ b/content/renderer/pepper/v8_var_converter.h
@@ -0,0 +1,35 @@
+// Copyright (c) 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 CONTENT_RENDERER_PEPPER_V8_VAR_CONVERTER_H
+#define CONTENT_RENDERER_PEPPER_V8_VAR_CONVERTER_H
+
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "ppapi/c/pp_var.h"
+#include "v8/include/v8.h"
+#include "content/common/content_export.h"
+
+namespace webkit {
+namespace ppapi {
+namespace V8VarConverter {
+
+// Converts the given PP_Var to a v8::Value. True is returned upon success.
+bool CONTENT_EXPORT ToV8Value(const PP_Var& var,
+                              v8::Handle<v8::Context> context,
+                              v8::Handle<v8::Value>* result);
+// Converts the given v8::Value to a PP_Var. True is returned upon success.
+// Every PP_Var in the reference graph of which |result| is apart will have
+// a refcount equal to the number of references to it in the graph. |result|
+// will have one additional reference.
+bool CONTENT_EXPORT FromV8Value(v8::Handle<v8::Value> val,
+                                v8::Handle<v8::Context> context,
+                                PP_Var* result);
+
+}  // namespace V8VarConverter
+}  // namespace ppapi
+}  // namespace webkit
+
+#endif  // CONTENT_RENDERER_PEPPER_V8_VAR_CONVERTER_H
diff --git a/webkit/plugins/ppapi/v8_var_converter_unittest.cc b/content/renderer/pepper/v8_var_converter_unittest.cc
similarity index 98%
rename from webkit/plugins/ppapi/v8_var_converter_unittest.cc
rename to content/renderer/pepper/v8_var_converter_unittest.cc
index 578c613..794c665 100644
--- a/webkit/plugins/ppapi/v8_var_converter_unittest.cc
+++ b/content/renderer/pepper/v8_var_converter_unittest.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "webkit/plugins/ppapi/v8_var_converter.h"
+#include "content/renderer/pepper/v8_var_converter.h"
 
 #include <cmath>
 
@@ -135,7 +135,7 @@
  public:
   V8VarConverterTest()
       : isolate_(v8::Isolate::GetCurrent()) {}
-  ~V8VarConverterTest() {}
+  virtual ~V8VarConverterTest() {}
 
   // testing::Test implementation.
   virtual void SetUp() {
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 83e86e8..33b167a 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -4,8 +4,74 @@
 
 #include "content/renderer/render_frame_impl.h"
 
+#include "base/strings/utf_string_conversions.h"
+#include "base/time/time.h"
+#include "content/child/appcache_dispatcher.h"
+#include "content/child/fileapi/file_system_dispatcher.h"
+#include "content/child/fileapi/webfilesystem_callback_adapters.h"
+#include "content/child/quota_dispatcher.h"
+#include "content/child/request_extra_data.h"
+#include "content/common/socket_stream_handle_data.h"
+#include "content/common/view_messages.h"
+#include "content/public/common/content_constants.h"
+#include "content/public/common/url_constants.h"
+#include "content/public/renderer/content_renderer_client.h"
+#include "content/public/renderer/document_state.h"
+#include "content/public/renderer/navigation_state.h"
+#include "content/public/renderer/password_form_conversion_utils.h"
+#include "content/renderer/browser_plugin/browser_plugin.h"
+#include "content/renderer/browser_plugin/browser_plugin_manager.h"
+#include "content/renderer/internal_document_state_data.h"
+#include "content/renderer/media/rtc_peer_connection_handler.h"
+#include "content/renderer/render_thread_impl.h"
 #include "content/renderer/render_view_impl.h"
 #include "content/renderer/renderer_webapplicationcachehost_impl.h"
+#include "content/renderer/webplugin_impl.h"
+#include "content/renderer/websharedworker_proxy.h"
+#include "net/base/net_errors.h"
+#include "net/http/http_util.h"
+#include "third_party/WebKit/public/platform/WebString.h"
+#include "third_party/WebKit/public/platform/WebURL.h"
+#include "third_party/WebKit/public/platform/WebURLError.h"
+#include "third_party/WebKit/public/platform/WebURLResponse.h"
+#include "third_party/WebKit/public/platform/WebVector.h"
+#include "third_party/WebKit/public/web/WebDocument.h"
+#include "third_party/WebKit/public/web/WebFileSystemCallbacks.h"
+#include "third_party/WebKit/public/web/WebFrame.h"
+#include "third_party/WebKit/public/web/WebNavigationPolicy.h"
+#include "third_party/WebKit/public/web/WebPlugin.h"
+#include "third_party/WebKit/public/web/WebPluginParams.h"
+#include "third_party/WebKit/public/web/WebSearchableFormData.h"
+#include "third_party/WebKit/public/web/WebSecurityOrigin.h"
+#include "third_party/WebKit/public/web/WebStorageQuotaCallbacks.h"
+#include "third_party/WebKit/public/web/WebUserGestureIndicator.h"
+#include "third_party/WebKit/public/web/WebView.h"
+#include "webkit/child/weburlresponse_extradata_impl.h"
+
+using WebKit::WebDataSource;
+using WebKit::WebDocument;
+using WebKit::WebFileSystemCallbacks;
+using WebKit::WebFrame;
+using WebKit::WebNavigationPolicy;
+using WebKit::WebPluginParams;
+using WebKit::WebReferrerPolicy;
+using WebKit::WebSearchableFormData;
+using WebKit::WebSecurityOrigin;
+using WebKit::WebStorageQuotaCallbacks;
+using WebKit::WebString;
+using WebKit::WebURL;
+using WebKit::WebURLError;
+using WebKit::WebURLRequest;
+using WebKit::WebURLResponse;
+using WebKit::WebUserGestureIndicator;
+using WebKit::WebVector;
+using WebKit::WebView;
+
+using appcache::WebApplicationCacheHostImpl;
+using base::Time;
+using base::TimeDelta;
+
+using webkit_glue::WebURLResponseExtraDataImpl;
 
 namespace content {
 
@@ -34,6 +100,7 @@
   g_create_render_frame_impl = create_render_frame_impl;
 }
 
+// RenderFrameImpl ----------------------------------------------------------
 RenderFrameImpl::RenderFrameImpl(RenderViewImpl* render_view, int routing_id)
     : render_view_(render_view),
       routing_id_(routing_id) {
@@ -42,6 +109,13 @@
 RenderFrameImpl::~RenderFrameImpl() {
 }
 
+int RenderFrameImpl::GetRoutingID() const {
+  // TODO(nasko): Until we register RenderFrameHost in the browser process as
+  // a listener, we must route all messages to the RenderViewHost, so use the
+  // routing id of the RenderView for now.
+  return render_view_->GetRoutingID();
+}
+
 bool RenderFrameImpl::Send(IPC::Message* message) {
   // TODO(nasko): Move away from using the RenderView's Send method once we
   // have enough infrastructure and state to make the right checks here.
@@ -59,7 +133,32 @@
 WebKit::WebPlugin* RenderFrameImpl::createPlugin(
     WebKit::WebFrame* frame,
     const WebKit::WebPluginParams& params) {
-  return render_view_->createPlugin(frame, params);
+  WebKit::WebPlugin* plugin = NULL;
+  if (GetContentClient()->renderer()->OverrideCreatePlugin(
+          render_view_, frame, params, &plugin)) {
+    return plugin;
+  }
+
+#if defined(ENABLE_PLUGINS)
+  if (UTF16ToASCII(params.mimeType) == kBrowserPluginMimeType) {
+    return render_view_->GetBrowserPluginManager()->CreateBrowserPlugin(
+        render_view_, frame, params);
+  }
+
+  WebPluginInfo info;
+  std::string mime_type;
+  bool found = render_view_->GetPluginInfo(
+      params.url, frame->top()->document().url(), params.mimeType.utf8(),
+      &info, &mime_type);
+  if (!found)
+    return NULL;
+
+  WebPluginParams params_to_use = params;
+  params_to_use.mimeType = WebString::fromUTF8(mime_type);
+  return render_view_->CreatePlugin(frame, info, params_to_use);
+#else
+  return NULL;
+#endif  // defined(ENABLE_PLUGINS)
 }
 
 WebKit::WebSharedWorker* RenderFrameImpl::createSharedWorker(
@@ -67,20 +166,47 @@
     const WebKit::WebURL& url,
     const WebKit::WebString& name,
     unsigned long long document_id) {
-  return render_view_->createSharedWorker(frame, url, name, document_id);
+  int route_id = MSG_ROUTING_NONE;
+  bool exists = false;
+  bool url_mismatch = false;
+  ViewHostMsg_CreateWorker_Params params;
+  params.url = url;
+  params.name = name;
+  params.document_id = document_id;
+  params.render_view_route_id = GetRoutingID();
+  params.route_id = MSG_ROUTING_NONE;
+  params.script_resource_appcache_id = 0;
+  Send(new ViewHostMsg_LookupSharedWorker(
+      params, &exists, &route_id, &url_mismatch));
+  if (url_mismatch) {
+    return NULL;
+  } else {
+    return new WebSharedWorkerProxy(RenderThreadImpl::current(),
+                                    document_id,
+                                    exists,
+                                    route_id,
+                                    GetRoutingID());
+  }
 }
 
 WebKit::WebMediaPlayer* RenderFrameImpl::createMediaPlayer(
     WebKit::WebFrame* frame,
     const WebKit::WebURL& url,
     WebKit::WebMediaPlayerClient* client) {
+  // TODO(nasko): Moving the implementation here involves moving a few media
+  // related client objects here or referencing them in the RenderView. Needs
+  // more work to understand where the proper place for those objects is.
   return render_view_->createMediaPlayer(frame, url, client);
 }
 
 WebKit::WebApplicationCacheHost* RenderFrameImpl::createApplicationCacheHost(
     WebKit::WebFrame* frame,
     WebKit::WebApplicationCacheHostClient* client) {
-  return render_view_->createApplicationCacheHost(frame, client);
+  if (!frame || !frame->view())
+    return NULL;
+  return new RendererWebApplicationCacheHostImpl(
+      RenderViewImpl::FromWebView(frame->view()), client,
+      RenderThreadImpl::current()->appcache_dispatcher()->backend_proxy());
 }
 
 WebKit::WebCookieJar* RenderFrameImpl::cookieJar(WebKit::WebFrame* frame) {
@@ -93,7 +219,8 @@
 
 void RenderFrameImpl::didCreateFrame(WebKit::WebFrame* parent,
                                      WebKit::WebFrame* child) {
-  render_view_->didCreateFrame(parent, child);
+  Send(new ViewHostMsg_FrameAttached(GetRoutingID(), parent->identifier(),
+      child->identifier(), UTF16ToUTF8(child->assignedName())));
 }
 
 void RenderFrameImpl::didDisownOpener(WebKit::WebFrame* frame) {
@@ -101,22 +228,39 @@
 }
 
 void RenderFrameImpl::frameDetached(WebKit::WebFrame* frame) {
+  int64 parent_frame_id = -1;
+  if (frame->parent())
+    parent_frame_id = frame->parent()->identifier();
+
+  Send(new ViewHostMsg_FrameDetached(GetRoutingID(), parent_frame_id,
+      frame->identifier()));
+
+  // Call back to RenderViewImpl for observers to be notified.
+  // TODO(nasko): Remove once we have RenderFrameObserver.
   render_view_->frameDetached(frame);
 }
 
 void RenderFrameImpl::willClose(WebKit::WebFrame* frame) {
+  // Call back to RenderViewImpl for observers to be notified.
+  // TODO(nasko): Remove once we have RenderFrameObserver.
   render_view_->willClose(frame);
 }
 
 void RenderFrameImpl::didChangeName(WebKit::WebFrame* frame,
                                     const WebKit::WebString& name) {
-  render_view_->didChangeName(frame, name);
+  if (!render_view_->renderer_preferences_.report_frame_name_changes)
+    return;
+
+  Send(new ViewHostMsg_UpdateFrameName(GetRoutingID(),
+                                       frame->identifier(),
+                                       !frame->parent(),
+                                       UTF16ToUTF8(name)));
 }
 
 void RenderFrameImpl::loadURLExternally(WebKit::WebFrame* frame,
                                         const WebKit::WebURLRequest& request,
                                         WebKit::WebNavigationPolicy policy) {
-  render_view_->loadURLExternally(frame, request, policy);
+  loadURLExternally(frame, request, policy, WebString());
 }
 
 void RenderFrameImpl::loadURLExternally(
@@ -124,7 +268,13 @@
     const WebKit::WebURLRequest& request,
     WebKit::WebNavigationPolicy policy,
     const WebKit::WebString& suggested_name) {
-  render_view_->loadURLExternally(frame, request, policy, suggested_name);
+  Referrer referrer(RenderViewImpl::GetReferrerFromRequest(frame, request));
+  if (policy == WebKit::WebNavigationPolicyDownload) {
+    Send(new ViewHostMsg_DownloadUrl(GetRoutingID(), request.url(), referrer,
+                                     suggested_name));
+  } else {
+    render_view_->OpenURL(frame, request.url(), referrer, policy);
+  }
 }
 
 WebKit::WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
@@ -137,31 +287,57 @@
       frame, request, type, default_policy, is_redirect);
 }
 
-WebKit::WebURLError RenderFrameImpl::cannotHandleRequestError(
-    WebKit::WebFrame* frame,
-    const WebKit::WebURLRequest& request) {
-  return render_view_->cannotHandleRequestError(frame, request);
-}
-
-WebKit::WebURLError RenderFrameImpl::cancelledError(
-    WebKit::WebFrame* frame,
-    const WebKit::WebURLRequest& request) {
-  return render_view_->cancelledError(frame, request);
-}
-
-void RenderFrameImpl::unableToImplementPolicyWithError(
-    WebKit::WebFrame* frame,
-    const WebKit::WebURLError& error) {
-  render_view_->unableToImplementPolicyWithError(frame, error);
-}
-
 void RenderFrameImpl::willSendSubmitEvent(WebKit::WebFrame* frame,
                                           const WebKit::WebFormElement& form) {
-  render_view_->willSendSubmitEvent(frame, form);
+  // Some login forms have onSubmit handlers that put a hash of the password
+  // into a hidden field and then clear the password. (Issue 28910.)
+  // This method gets called before any of those handlers run, so save away
+  // a copy of the password in case it gets lost.
+  DocumentState* document_state =
+      DocumentState::FromDataSource(frame->dataSource());
+  document_state->set_password_form_data(CreatePasswordForm(form));
 }
 
 void RenderFrameImpl::willSubmitForm(WebKit::WebFrame* frame,
                                      const WebKit::WebFormElement& form) {
+  DocumentState* document_state =
+      DocumentState::FromDataSource(frame->provisionalDataSource());
+  NavigationState* navigation_state = document_state->navigation_state();
+  InternalDocumentStateData* internal_data =
+      InternalDocumentStateData::FromDocumentState(document_state);
+
+  if (PageTransitionCoreTypeIs(navigation_state->transition_type(),
+                               PAGE_TRANSITION_LINK)) {
+    navigation_state->set_transition_type(PAGE_TRANSITION_FORM_SUBMIT);
+  }
+
+  // Save these to be processed when the ensuing navigation is committed.
+  WebSearchableFormData web_searchable_form_data(form);
+  internal_data->set_searchable_form_url(web_searchable_form_data.url());
+  internal_data->set_searchable_form_encoding(
+      web_searchable_form_data.encoding().utf8());
+  scoped_ptr<PasswordForm> password_form_data =
+      CreatePasswordForm(form);
+
+  // In order to save the password that the user actually typed and not one
+  // that may have gotten transformed by the site prior to submit, recover it
+  // from the form contents already stored by |willSendSubmitEvent| into the
+  // dataSource's NavigationState (as opposed to the provisionalDataSource's,
+  // which is what we're storing into now.)
+  if (password_form_data) {
+    DocumentState* old_document_state =
+        DocumentState::FromDataSource(frame->dataSource());
+    if (old_document_state) {
+      PasswordForm* old_form_data = old_document_state->password_form_data();
+      if (old_form_data && old_form_data->action == password_form_data->action)
+        password_form_data->password_value = old_form_data->password_value;
+    }
+  }
+
+  document_state->set_password_form_data(password_form_data.Pass());
+
+  // Call back to RenderViewImpl for observers to be notified.
+  // TODO(nasko): Remove once we have RenderFrameObserver.
   render_view_->willSubmitForm(frame, form);
 }
 
@@ -170,85 +346,147 @@
                                                 const WebKit::WebURL& to,
                                                 double interval,
                                                 double fire_time) {
+  // Call back to RenderViewImpl for observers to be notified.
+  // TODO(nasko): Remove once we have RenderFrameObserver.
   render_view_->willPerformClientRedirect(frame, from, to, interval, fire_time);
 }
 
 void RenderFrameImpl::didCancelClientRedirect(WebKit::WebFrame* frame) {
+  // Call back to RenderViewImpl for observers to be notified.
+  // TODO(nasko): Remove once we have RenderFrameObserver.
   render_view_->didCancelClientRedirect(frame);
 }
 
 void RenderFrameImpl::didCompleteClientRedirect(WebKit::WebFrame* frame,
                                                 const WebKit::WebURL& from) {
+  // Call back to RenderViewImpl for observers to be notified.
+  // TODO(nasko): Remove once we have RenderFrameObserver.
   render_view_->didCompleteClientRedirect(frame, from);
 }
 
 void RenderFrameImpl::didCreateDataSource(WebKit::WebFrame* frame,
                                           WebKit::WebDataSource* datasource) {
+  // TODO(nasko): Move implementation here. Needed state:
+  // * pending_navigation_params_
+  // * webview
+  // Needed methods:
+  // * PopulateDocumentStateFromPending
+  // * CreateNavigationStateFromPending
   render_view_->didCreateDataSource(frame, datasource);
 }
 
 void RenderFrameImpl::didStartProvisionalLoad(WebKit::WebFrame* frame) {
+  // TODO(nasko): Move implementation here. Needed state:
+  // * is_swapped_out_
+  // * navigation_gesture_
+  // * completed_client_redirect_src_
   render_view_->didStartProvisionalLoad(frame);
 }
 
 void RenderFrameImpl::didReceiveServerRedirectForProvisionalLoad(
     WebKit::WebFrame* frame) {
+  // TODO(nasko): Move implementation here. Needed state:
+  // * page_id_
   render_view_->didReceiveServerRedirectForProvisionalLoad(frame);
 }
 
 void RenderFrameImpl::didFailProvisionalLoad(
     WebKit::WebFrame* frame,
     const WebKit::WebURLError& error) {
+  // TODO(nasko): Move implementation here. Needed state:
+  // * page_id_
+  // * pending_navigation_params_
+  // Needed methods
+  // * MaybeLoadAlternateErrorPage
+  // * LoadNavigationErrorPage
   render_view_->didFailProvisionalLoad(frame, error);
 }
 
 void RenderFrameImpl::didCommitProvisionalLoad(WebKit::WebFrame* frame,
                                                bool is_new_navigation) {
+  // TODO(nasko): Move implementation here. Needed state:
+  // * page_id_
+  // * next_page_id_
+  // * history_list_offset_
+  // * history_list_length_
+  // * history_page_ids_
+  // Needed methods
+  // * webview
+  // * UpdateSessionHistory
+  // * GetLoadingUrl
   render_view_->didCommitProvisionalLoad(frame, is_new_navigation);
 }
 
 void RenderFrameImpl::didClearWindowObject(WebKit::WebFrame* frame) {
+  // TODO(nasko): Move implementation here. Needed state:
+  // * enabled_bindings_
+  // * dom_automation_controller_
+  // * stats_collection_controller_
   render_view_->didClearWindowObject(frame);
 }
 
 void RenderFrameImpl::didCreateDocumentElement(WebKit::WebFrame* frame) {
+  // Notify the browser about non-blank documents loading in the top frame.
+  GURL url = frame->document().url();
+  if (url.is_valid() && url.spec() != kAboutBlankURL) {
+    // TODO(nasko): Check if webview()->mainFrame() is the same as the
+    // frame->tree()->top().
+    if (frame == render_view_->webview()->mainFrame())
+      Send(new ViewHostMsg_DocumentAvailableInMainFrame(GetRoutingID()));
+  }
+
+  // Call back to RenderViewImpl for observers to be notified.
+  // TODO(nasko): Remove once we have RenderFrameObserver.
   render_view_->didCreateDocumentElement(frame);
 }
 
 void RenderFrameImpl::didReceiveTitle(WebKit::WebFrame* frame,
                                       const WebKit::WebString& title,
                                       WebKit::WebTextDirection direction) {
+  // TODO(nasko): Investigate wheather implementation should move here.
   render_view_->didReceiveTitle(frame, title, direction);
 }
 
 void RenderFrameImpl::didChangeIcon(WebKit::WebFrame* frame,
                                     WebKit::WebIconURL::Type icon_type) {
+  // TODO(nasko): Investigate wheather implementation should move here.
   render_view_->didChangeIcon(frame, icon_type);
 }
 
 void RenderFrameImpl::didFinishDocumentLoad(WebKit::WebFrame* frame) {
+  // TODO(nasko): Move implementation here. No state needed, just observers
+  // notification in before updating encoding.
   render_view_->didFinishDocumentLoad(frame);
 }
 
 void RenderFrameImpl::didHandleOnloadEvents(WebKit::WebFrame* frame) {
+  // TODO(nasko): Move implementation here. Needed state:
+  // * page_id_
   render_view_->didHandleOnloadEvents(frame);
 }
 
 void RenderFrameImpl::didFailLoad(WebKit::WebFrame* frame,
                                   const WebKit::WebURLError& error) {
+  // TODO(nasko): Move implementation here. No state needed.
   render_view_->didFailLoad(frame, error);
 }
 
 void RenderFrameImpl::didFinishLoad(WebKit::WebFrame* frame) {
+  // TODO(nasko): Move implementation here. No state needed, just observers
+  // notification before sending message to the browser process.
   render_view_->didFinishLoad(frame);
 }
 
 void RenderFrameImpl::didNavigateWithinPage(WebKit::WebFrame* frame,
                                             bool is_new_navigation) {
+  // TODO(nasko): Move implementation here. No state needed, just observers
+  // notification before sending message to the browser process.
   render_view_->didNavigateWithinPage(frame, is_new_navigation);
 }
 
 void RenderFrameImpl::didUpdateCurrentHistoryItem(WebKit::WebFrame* frame) {
+  // TODO(nasko): Move implementation here. Needed methods:
+  // * StartNavStateSyncTimerIfNecessary
   render_view_->didUpdateCurrentHistoryItem(frame);
 }
 
@@ -257,62 +495,217 @@
     unsigned identifier,
     WebKit::WebURLRequest& request,
     const WebKit::WebURLResponse& redirect_response) {
-  render_view_->willSendRequest(frame, identifier, request, redirect_response);
+  // The request my be empty during tests.
+  if (request.url().isEmpty())
+    return;
+
+  WebFrame* top_frame = frame->top();
+  if (!top_frame)
+    top_frame = frame;
+  WebDataSource* provisional_data_source = top_frame->provisionalDataSource();
+  WebDataSource* top_data_source = top_frame->dataSource();
+  WebDataSource* data_source =
+      provisional_data_source ? provisional_data_source : top_data_source;
+
+  PageTransition transition_type = PAGE_TRANSITION_LINK;
+  DocumentState* document_state = DocumentState::FromDataSource(data_source);
+  DCHECK(document_state);
+  InternalDocumentStateData* internal_data =
+      InternalDocumentStateData::FromDocumentState(document_state);
+  NavigationState* navigation_state = document_state->navigation_state();
+  transition_type = navigation_state->transition_type();
+
+  GURL request_url(request.url());
+  GURL new_url;
+  if (GetContentClient()->renderer()->WillSendRequest(
+          frame,
+          transition_type,
+          request_url,
+          request.firstPartyForCookies(),
+          &new_url)) {
+    request.setURL(WebURL(new_url));
+  }
+
+  if (internal_data->is_cache_policy_override_set())
+    request.setCachePolicy(internal_data->cache_policy_override());
+
+  WebKit::WebReferrerPolicy referrer_policy;
+  if (internal_data->is_referrer_policy_set()) {
+    referrer_policy = internal_data->referrer_policy();
+    internal_data->clear_referrer_policy();
+  } else {
+    referrer_policy = frame->document().referrerPolicy();
+  }
+
+  // The request's extra data may indicate that we should set a custom user
+  // agent. This needs to be done here, after WebKit is through with setting the
+  // user agent on its own.
+  WebString custom_user_agent;
+  if (request.extraData()) {
+    webkit_glue::WebURLRequestExtraDataImpl* old_extra_data =
+        static_cast<webkit_glue::WebURLRequestExtraDataImpl*>(
+            request.extraData());
+    custom_user_agent = old_extra_data->custom_user_agent();
+
+    if (!custom_user_agent.isNull()) {
+      if (custom_user_agent.isEmpty())
+        request.clearHTTPHeaderField("User-Agent");
+      else
+        request.setHTTPHeaderField("User-Agent", custom_user_agent);
+    }
+  }
+
+  request.setExtraData(
+      new RequestExtraData(referrer_policy,
+                           custom_user_agent,
+                           (frame == top_frame),
+                           frame->identifier(),
+                           frame->parent() == top_frame,
+                           frame->parent() ? frame->parent()->identifier() : -1,
+                           navigation_state->allow_download(),
+                           transition_type,
+                           navigation_state->transferred_request_child_id(),
+                           navigation_state->transferred_request_request_id()));
+
+  DocumentState* top_document_state =
+      DocumentState::FromDataSource(top_data_source);
+  // TODO(gavinp): separate out prefetching and prerender field trials
+  // if the rel=prerender rel type is sticking around.
+  if (top_document_state &&
+      request.targetType() == WebURLRequest::TargetIsPrefetch)
+    top_document_state->set_was_prefetcher(true);
+
+  // This is an instance where we embed a copy of the routing id
+  // into the data portion of the message. This can cause problems if we
+  // don't register this id on the browser side, since the download manager
+  // expects to find a RenderViewHost based off the id.
+  request.setRequestorID(GetRoutingID());
+  request.setHasUserGesture(WebUserGestureIndicator::isProcessingUserGesture());
+
+  if (!navigation_state->extra_headers().empty()) {
+    for (net::HttpUtil::HeadersIterator i(
+        navigation_state->extra_headers().begin(),
+        navigation_state->extra_headers().end(), "\n");
+        i.GetNext(); ) {
+      request.setHTTPHeaderField(WebString::fromUTF8(i.name()),
+                                 WebString::fromUTF8(i.values()));
+    }
+  }
+
+  if (!render_view_->renderer_preferences_.enable_referrers)
+    request.clearHTTPHeaderField("Referer");
 }
 
 void RenderFrameImpl::didReceiveResponse(
     WebKit::WebFrame* frame,
     unsigned identifier,
     const WebKit::WebURLResponse& response) {
-  render_view_->didReceiveResponse(frame, identifier, response);
+  // Only do this for responses that correspond to a provisional data source
+  // of the top-most frame.  If we have a provisional data source, then we
+  // can't have any sub-resources yet, so we know that this response must
+  // correspond to a frame load.
+  if (!frame->provisionalDataSource() || frame->parent())
+    return;
+
+  // If we are in view source mode, then just let the user see the source of
+  // the server's error page.
+  if (frame->isViewSourceModeEnabled())
+    return;
+
+  DocumentState* document_state =
+      DocumentState::FromDataSource(frame->provisionalDataSource());
+  int http_status_code = response.httpStatusCode();
+
+  // Record page load flags.
+  WebURLResponseExtraDataImpl* extra_data =
+      RenderViewImpl::GetExtraDataFromResponse(response);
+  if (extra_data) {
+    document_state->set_was_fetched_via_spdy(
+        extra_data->was_fetched_via_spdy());
+    document_state->set_was_npn_negotiated(
+        extra_data->was_npn_negotiated());
+    document_state->set_npn_negotiated_protocol(
+        extra_data->npn_negotiated_protocol());
+    document_state->set_was_alternate_protocol_available(
+        extra_data->was_alternate_protocol_available());
+    document_state->set_connection_info(
+        extra_data->connection_info());
+    document_state->set_was_fetched_via_proxy(
+        extra_data->was_fetched_via_proxy());
+  }
+  InternalDocumentStateData* internal_data =
+      InternalDocumentStateData::FromDocumentState(document_state);
+  internal_data->set_http_status_code(http_status_code);
+  // Whether or not the http status code actually corresponds to an error is
+  // only checked when the page is done loading, if |use_error_page| is
+  // still true.
+  internal_data->set_use_error_page(true);
 }
 
 void RenderFrameImpl::didFinishResourceLoad(WebKit::WebFrame* frame,
                                             unsigned identifier) {
+  // TODO(nasko): Move implementation here. Needed state:
+  // * devtools_agent_
+  // Needed methods:
+  // * LoadNavigationErrorPage
   render_view_->didFinishResourceLoad(frame, identifier);
 }
 
-void RenderFrameImpl::didFailResourceLoad(WebKit::WebFrame* frame,
-                                          unsigned identifier,
-                                          const WebKit::WebURLError& error) {
-  render_view_->didFailResourceLoad(frame, identifier, error);
-}
-
 void RenderFrameImpl::didLoadResourceFromMemoryCache(
     WebKit::WebFrame* frame,
     const WebKit::WebURLRequest& request,
     const WebKit::WebURLResponse& response) {
-  render_view_->didLoadResourceFromMemoryCache(frame, request, response);
+  // The recipients of this message have no use for data: URLs: they don't
+  // affect the page's insecure content list and are not in the disk cache. To
+  // prevent large (1M+) data: URLs from crashing in the IPC system, we simply
+  // filter them out here.
+  GURL url(request.url());
+  if (url.SchemeIs("data"))
+    return;
+
+  // Let the browser know we loaded a resource from the memory cache.  This
+  // message is needed to display the correct SSL indicators.
+  Send(new ViewHostMsg_DidLoadResourceFromMemoryCache(
+      GetRoutingID(),
+      url,
+      response.securityInfo(),
+      request.httpMethod().utf8(),
+      response.mimeType().utf8(),
+      ResourceType::FromTargetType(request.targetType())));
 }
 
 void RenderFrameImpl::didDisplayInsecureContent(WebKit::WebFrame* frame) {
-  render_view_->didDisplayInsecureContent(frame);
+  Send(new ViewHostMsg_DidDisplayInsecureContent(GetRoutingID()));
 }
 
 void RenderFrameImpl::didRunInsecureContent(
     WebKit::WebFrame* frame,
     const WebKit::WebSecurityOrigin& origin,
     const WebKit::WebURL& target) {
-  render_view_->didRunInsecureContent(frame, origin, target);
+  Send(new ViewHostMsg_DidRunInsecureContent(
+      GetRoutingID(),
+      origin.toString().utf8(),
+      target));
 }
 
 void RenderFrameImpl::didExhaustMemoryAvailableForScript(
     WebKit::WebFrame* frame) {
-  render_view_->didExhaustMemoryAvailableForScript(frame);
+  Send(new ViewHostMsg_JSOutOfMemory(GetRoutingID()));
 }
 
 void RenderFrameImpl::didCreateScriptContext(WebKit::WebFrame* frame,
                                              v8::Handle<v8::Context> context,
                                              int extension_group,
                                              int world_id) {
-  render_view_->didCreateScriptContext(
+  GetContentClient()->renderer()->DidCreateScriptContext(
       frame, context, extension_group, world_id);
 }
 
 void RenderFrameImpl::willReleaseScriptContext(WebKit::WebFrame* frame,
                                                v8::Handle<v8::Context> context,
                                                int world_id) {
-  render_view_->willReleaseScriptContext(frame, context, world_id);
+  GetContentClient()->renderer()->WillReleaseScriptContext(
+      frame, context, world_id);
 }
 
 void RenderFrameImpl::didFirstVisuallyNonEmptyLayout(WebKit::WebFrame* frame) {
@@ -321,28 +714,48 @@
 
 void RenderFrameImpl::didChangeContentsSize(WebKit::WebFrame* frame,
                                             const WebKit::WebSize& size) {
+  // TODO(nasko): Move implementation here. Needed state:
+  // * cached_has_main_frame_horizontal_scrollbar_
+  // * cached_has_main_frame_vertical_scrollbar_
   render_view_->didChangeContentsSize(frame, size);
 }
 
 void RenderFrameImpl::didChangeScrollOffset(WebKit::WebFrame* frame) {
+  // TODO(nasko): Move implementation here. Needed methods:
+  // * StartNavStateSyncTimerIfNecessary
   render_view_->didChangeScrollOffset(frame);
 }
 
 void RenderFrameImpl::willInsertBody(WebKit::WebFrame* frame) {
-  render_view_->willInsertBody(frame);
+  if (!frame->parent())
+    Send(new ViewHostMsg_WillInsertBody(GetRoutingID()));
 }
 
 void RenderFrameImpl::reportFindInPageMatchCount(int request_id,
                                                  int count,
                                                  bool final_update) {
-  render_view_->reportFindInPageMatchCount(request_id, count, final_update);
+  int active_match_ordinal = -1;  // -1 = don't update active match ordinal
+  if (!count)
+    active_match_ordinal = 0;
+
+  Send(new ViewHostMsg_Find_Reply(GetRoutingID(),
+                                  request_id,
+                                  count,
+                                  gfx::Rect(),
+                                  active_match_ordinal,
+                                  final_update));
 }
 
-void RenderFrameImpl::reportFindInPageSelection(int request_id,
-                                                int active_match_ordinal,
-                                                const WebKit::WebRect& sel) {
-  render_view_->reportFindInPageSelection(
-      request_id, active_match_ordinal, sel);
+void RenderFrameImpl::reportFindInPageSelection(
+    int request_id,
+    int active_match_ordinal,
+    const WebKit::WebRect& selection_rect) {
+  Send(new ViewHostMsg_Find_Reply(GetRoutingID(),
+                                  request_id,
+                                  -1,
+                                  selection_rect,
+                                  active_match_ordinal,
+                                  false));
 }
 
 void RenderFrameImpl::openFileSystem(
@@ -351,21 +764,56 @@
     long long size,
     bool create,
     WebKit::WebFileSystemCallbacks* callbacks) {
-  render_view_->openFileSystem(frame, type, size, create, callbacks);
+  DCHECK(callbacks);
+
+  WebSecurityOrigin origin = frame->document().securityOrigin();
+  if (origin.isUnique()) {
+    // Unique origins cannot store persistent state.
+    callbacks->didFail(WebKit::WebFileErrorAbort);
+    return;
+  }
+
+  ChildThread::current()->file_system_dispatcher()->OpenFileSystem(
+      GURL(origin.toString()), static_cast<fileapi::FileSystemType>(type),
+      size, create,
+      base::Bind(&OpenFileSystemCallbackAdapter, callbacks),
+      base::Bind(&FileStatusCallbackAdapter, callbacks));
 }
 
 void RenderFrameImpl::deleteFileSystem(
     WebKit::WebFrame* frame,
     WebKit::WebFileSystemType type,
     WebKit::WebFileSystemCallbacks* callbacks) {
-  render_view_->deleteFileSystem(frame, type, callbacks);
+  DCHECK(callbacks);
+
+  WebSecurityOrigin origin = frame->document().securityOrigin();
+  if (origin.isUnique()) {
+    // Unique origins cannot store persistent state.
+    callbacks->didSucceed();
+    return;
+  }
+
+  ChildThread::current()->file_system_dispatcher()->DeleteFileSystem(
+      GURL(origin.toString()),
+      static_cast<fileapi::FileSystemType>(type),
+      base::Bind(&FileStatusCallbackAdapter, callbacks));
 }
 
 void RenderFrameImpl::queryStorageUsageAndQuota(
     WebKit::WebFrame* frame,
     WebKit::WebStorageQuotaType type,
     WebKit::WebStorageQuotaCallbacks* callbacks) {
-  render_view_->queryStorageUsageAndQuota(frame, type, callbacks);
+  DCHECK(frame);
+  WebSecurityOrigin origin = frame->document().securityOrigin();
+  if (origin.isUnique()) {
+    // Unique origins cannot store persistent state.
+    callbacks->didFail(WebKit::WebStorageQuotaErrorAbort);
+    return;
+  }
+  ChildThread::current()->quota_dispatcher()->QueryStorageUsageAndQuota(
+      GURL(origin.toString()),
+      static_cast<quota::StorageType>(type),
+      QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper(callbacks));
 }
 
 void RenderFrameImpl::requestStorageQuota(
@@ -373,18 +821,30 @@
     WebKit::WebStorageQuotaType type,
     unsigned long long requested_size,
     WebKit::WebStorageQuotaCallbacks* callbacks) {
-  render_view_->requestStorageQuota(frame, type, requested_size, callbacks);
+  DCHECK(frame);
+  WebSecurityOrigin origin = frame->document().securityOrigin();
+  if (origin.isUnique()) {
+    // Unique origins cannot store persistent state.
+    callbacks->didFail(WebKit::WebStorageQuotaErrorAbort);
+    return;
+  }
+  ChildThread::current()->quota_dispatcher()->RequestStorageQuota(
+      GetRoutingID(), GURL(origin.toString()),
+      static_cast<quota::StorageType>(type), requested_size,
+      QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper(callbacks));
 }
 
 void RenderFrameImpl::willOpenSocketStream(
     WebKit::WebSocketStreamHandle* handle) {
-  render_view_->willOpenSocketStream(handle);
+  SocketStreamHandleData::AddToHandle(handle, GetRoutingID());
 }
 
 void RenderFrameImpl::willStartUsingPeerConnectionHandler(
     WebKit::WebFrame* frame,
     WebKit::WebRTCPeerConnectionHandler* handler) {
-  render_view_->willStartUsingPeerConnectionHandler(frame, handler);
+#if defined(ENABLE_WEBRTC)
+  static_cast<RTCPeerConnectionHandler*>(handler)->associateWithFrame(frame);
+#endif
 }
 
 bool RenderFrameImpl::willCheckAndDispatchMessageEvent(
@@ -392,6 +852,8 @@
     WebKit::WebFrame* targetFrame,
     WebKit::WebSecurityOrigin targetOrigin,
     WebKit::WebDOMMessageEvent event) {
+  // TODO(nasko): Move implementation here. Needed state:
+  // * is_swapped_out_
   return render_view_->willCheckAndDispatchMessageEvent(
       sourceFrame, targetFrame, targetOrigin, event);
 }
@@ -399,20 +861,53 @@
 WebKit::WebString RenderFrameImpl::userAgentOverride(
     WebKit::WebFrame* frame,
     const WebKit::WebURL& url) {
-  return render_view_->userAgentOverride(frame, url);
+  if (!render_view_->webview() || !render_view_->webview()->mainFrame() ||
+      render_view_->renderer_preferences_.user_agent_override.empty()) {
+    return WebKit::WebString();
+  }
+
+  // If we're in the middle of committing a load, the data source we need
+  // will still be provisional.
+  WebFrame* main_frame = render_view_->webview()->mainFrame();
+  WebDataSource* data_source = NULL;
+  if (main_frame->provisionalDataSource())
+    data_source = main_frame->provisionalDataSource();
+  else
+    data_source = main_frame->dataSource();
+
+  InternalDocumentStateData* internal_data = data_source ?
+      InternalDocumentStateData::FromDataSource(data_source) : NULL;
+  if (internal_data && internal_data->is_overriding_user_agent())
+    return WebString::fromUTF8(
+        render_view_->renderer_preferences_.user_agent_override);
+  return WebKit::WebString();
 }
 
 WebKit::WebString RenderFrameImpl::doNotTrackValue(WebKit::WebFrame* frame) {
-  return render_view_->doNotTrackValue(frame);
+  if (render_view_->renderer_preferences_.enable_do_not_track)
+    return WebString::fromUTF8("1");
+  return WebString();
 }
 
 bool RenderFrameImpl::allowWebGL(WebKit::WebFrame* frame, bool default_value) {
-  return render_view_->allowWebGL(frame, default_value);
+  if (!default_value)
+    return false;
+
+  bool blocked = true;
+  Send(new ViewHostMsg_Are3DAPIsBlocked(
+      GetRoutingID(),
+      GURL(frame->top()->document().securityOrigin().toString()),
+      THREE_D_API_TYPE_WEBGL,
+      &blocked));
+  return !blocked;
 }
 
 void RenderFrameImpl::didLoseWebGLContext(WebKit::WebFrame* frame,
                                           int arb_robustness_status_code) {
-  render_view_->didLoseWebGLContext(frame, arb_robustness_status_code);
+  Send(new ViewHostMsg_DidLose3DContext(
+      GURL(frame->top()->document().securityOrigin().toString()),
+      THREE_D_API_TYPE_WEBGL,
+      arb_robustness_status_code));
 }
 
 }  // namespace content
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h
index b8e75da..a3daa03 100644
--- a/content/renderer/render_frame_impl.h
+++ b/content/renderer/render_frame_impl.h
@@ -75,15 +75,6 @@
       WebKit::WebNavigationType type,
       WebKit::WebNavigationPolicy default_policy,
       bool is_redirect);
-  virtual WebKit::WebURLError cannotHandleRequestError(
-      WebKit::WebFrame* frame,
-      const WebKit::WebURLRequest& request);
-  virtual WebKit::WebURLError cancelledError(
-      WebKit::WebFrame* frame,
-      const WebKit::WebURLRequest& request);
-  virtual void unableToImplementPolicyWithError(
-      WebKit::WebFrame* frame,
-      const WebKit::WebURLError& error);
   virtual void willSendSubmitEvent(WebKit::WebFrame* frame,
                                    const WebKit::WebFormElement& form);
   virtual void willSubmitForm(WebKit::WebFrame* frame,
@@ -132,9 +123,6 @@
       const WebKit::WebURLResponse& response);
   virtual void didFinishResourceLoad(WebKit::WebFrame* frame,
                                      unsigned identifier);
-  virtual void didFailResourceLoad(WebKit::WebFrame* frame,
-                                   unsigned identifier,
-                                   const WebKit::WebURLError& error);
   virtual void didLoadResourceFromMemoryCache(
       WebKit::WebFrame* frame,
       const WebKit::WebURLRequest& request,
@@ -201,7 +189,7 @@
                                    int arb_robustness_status_code);
 
   // RenderFrameImpl methods
-  int routing_id() { return routing_id_; }
+  int GetRoutingID() const;
 
  protected:
   RenderFrameImpl(RenderViewImpl* render_view, int32 routing_id);
diff --git a/content/renderer/render_process_impl.cc b/content/renderer/render_process_impl.cc
index 29bdba3..79b5b07 100644
--- a/content/renderer/render_process_impl.cc
+++ b/content/renderer/render_process_impl.cc
@@ -27,6 +27,7 @@
 #include "ipc/ipc_channel.h"
 #include "ipc/ipc_message_utils.h"
 #include "skia/ext/platform_canvas.h"
+#include "third_party/WebKit/public/web/WebFrame.h"
 #include "ui/surface/transport_dib.h"
 #include "webkit/glue/webkit_glue.h"
 
@@ -77,10 +78,10 @@
 }
 
 RenderProcessImpl::~RenderProcessImpl() {
-  // TODO(port): Try and limit what we pull in for our non-Win unit test bundle.
 #ifndef NDEBUG
-  // log important leaked objects
-  webkit_glue::CheckForLeaks();
+  int count = WebKit::WebFrame::instanceCount();
+  if (count)
+    DLOG(ERROR) << "WebFrame LEAKED " << count << " TIMES";
 #endif
 
   GetShutDownEvent()->Signal();
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index 1179851..7adc22f 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -21,7 +21,7 @@
 #include "base/metrics/stats_table.h"
 #include "base/path_service.h"
 #include "base/strings/string16.h"
-#include "base/strings/string_number_conversions.h"  // Temporary
+#include "base/strings/string_tokenizer.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/threading/thread_local.h"
 #include "base/threading/thread_restrictions.h"
@@ -69,7 +69,6 @@
 #include "content/renderer/media/media_stream_dependency_factory.h"
 #include "content/renderer/media/midi_message_filter.h"
 #include "content/renderer/media/peer_connection_tracker.h"
-#include "content/renderer/media/renderer_gpu_video_decoder_factories.h"
 #include "content/renderer/media/video_capture_impl_manager.h"
 #include "content/renderer/media/video_capture_message_filter.h"
 #include "content/renderer/media/webrtc_identity_service.h"
@@ -95,6 +94,7 @@
 #include "third_party/WebKit/public/web/WebDatabase.h"
 #include "third_party/WebKit/public/web/WebDocument.h"
 #include "third_party/WebKit/public/web/WebFrame.h"
+#include "third_party/WebKit/public/web/WebImageCache.h"
 #include "third_party/WebKit/public/web/WebKit.h"
 #include "third_party/WebKit/public/web/WebNetworkStateNotifier.h"
 #include "third_party/WebKit/public/web/WebPopupMenu.h"
@@ -225,6 +225,14 @@
   return RenderThreadImpl::Get()->HostAllocateSharedMemoryBuffer(size);
 }
 
+void EnableWebCoreLogChannels(const std::string& channels) {
+  if (channels.empty())
+    return;
+  base::StringTokenizer t(channels, ", ");
+  while (t.GetNext())
+    WebKit::enableLogChannel(t.token().c_str());
+}
+
 }  // namespace
 
 class RenderThreadImpl::GpuVDAContextLostCallback
@@ -722,7 +730,7 @@
 
   RenderThreadImpl::RegisterSchemes();
 
-  webkit_glue::EnableWebCoreLogChannels(
+  EnableWebCoreLogChannels(
       command_line.GetSwitchValueASCII(switches::kWebCoreLogChannels));
 
   web_database_observer_impl_.reset(
@@ -892,20 +900,17 @@
   idle_notifications_to_skip_ = 2;
 }
 
-scoped_refptr<media::GpuVideoDecoderFactories>
-RenderThreadImpl::GetGpuFactories() {
+scoped_refptr<RendererGpuVideoDecoderFactories>
+RenderThreadImpl::GetGpuFactories(
+    const scoped_refptr<base::MessageLoopProxy>& factories_loop) {
   DCHECK(IsMainThread());
 
   const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
-  scoped_refptr<media::GpuVideoDecoderFactories> gpu_factories;
+  scoped_refptr<RendererGpuVideoDecoderFactories> gpu_factories;
   WebGraphicsContext3DCommandBufferImpl* context3d = NULL;
   if (!cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode))
     context3d = GetGpuVDAContext3D();
   if (context3d) {
-    scoped_refptr<base::MessageLoopProxy> factories_loop =
-        compositor_message_loop_proxy();
-    if (!factories_loop.get())
-      factories_loop = base::MessageLoopProxy::current();
     GpuChannelHost* gpu_channel_host = GetGpuChannel();
     if (gpu_channel_host) {
       gpu_factories = new RendererGpuVideoDecoderFactories(
@@ -1279,6 +1284,8 @@
       base::MemoryPressureListener::MEMORY_PRESSURE_CRITICAL) {
     // Trigger full v8 garbage collection on critical memory notification.
     v8::V8::LowMemoryNotification();
+    // Clear the image cache.
+    WebKit::WebImageCache::clear();
   } else {
     // Otherwise trigger a couple of v8 GCs using IdleNotification.
     if (!v8::V8::IdleNotification())
diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h
index cd95d44..5b3dac0 100644
--- a/content/renderer/render_thread_impl.h
+++ b/content/renderer/render_thread_impl.h
@@ -19,6 +19,7 @@
 #include "content/common/gpu/client/gpu_channel_host.h"
 #include "content/common/gpu/gpu_process_launch_causes.h"
 #include "content/public/renderer/render_thread.h"
+#include "content/renderer/media/renderer_gpu_video_decoder_factories.h"
 #include "ipc/ipc_channel_proxy.h"
 #include "ui/gfx/native_widget_types.h"
 
@@ -255,9 +256,10 @@
   // not sent for at least one notification delay.
   void PostponeIdleNotification();
 
-  // Gets gpu factories. Returns NULL if VDA is disabled or a graphics context
-  // cannot be obtained.
-  scoped_refptr<media::GpuVideoDecoderFactories> GetGpuFactories();
+  // Gets gpu factories, which will run on |factories_loop|. Returns NULL if VDA
+  // is disabled or a graphics context cannot be obtained.
+  scoped_refptr<RendererGpuVideoDecoderFactories> GetGpuFactories(
+      const scoped_refptr<base::MessageLoopProxy>& factories_loop);
 
   // Returns a graphics context shared among all
   // RendererGpuVideoDecoderFactories, or NULL on error.  Context remains owned
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 2ebf7aa..f924813 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -21,7 +21,7 @@
 #include "base/message_loop/message_loop_proxy.h"
 #include "base/metrics/histogram.h"
 #include "base/path_service.h"
-#include "base/process_util.h"
+#include "base/process/kill.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_piece.h"
 #include "base/strings/string_split.h"
@@ -44,7 +44,6 @@
 #include "content/common/input_messages.h"
 #include "content/common/java_bridge_messages.h"
 #include "content/common/pepper_messages.h"
-#include "content/common/pepper_plugin_registry.h"
 #include "content/common/socket_stream_handle_data.h"
 #include "content/common/ssl_status_serialization.h"
 #include "content/common/view_messages.h"
@@ -107,6 +106,7 @@
 #include "content/renderer/mhtml_generator.h"
 #include "content/renderer/notification_provider.h"
 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h"
+#include "content/renderer/pepper/pepper_plugin_registry.h"
 #include "content/renderer/render_frame_impl.h"
 #include "content/renderer/render_process.h"
 #include "content/renderer/render_thread_impl.h"
@@ -170,6 +170,7 @@
 #include "third_party/WebKit/public/web/WebFormControlElement.h"
 #include "third_party/WebKit/public/web/WebFormElement.h"
 #include "third_party/WebKit/public/web/WebFrame.h"
+#include "third_party/WebKit/public/web/WebGlyphCache.h"
 #include "third_party/WebKit/public/web/WebHelperPlugin.h"
 #include "third_party/WebKit/public/web/WebHistoryItem.h"
 #include "third_party/WebKit/public/web/WebInputElement.h"
@@ -206,7 +207,6 @@
 #include "v8/include/v8.h"
 #include "webkit/child/weburlresponse_extradata_impl.h"
 #include "webkit/common/dom_storage/dom_storage_types.h"
-#include "webkit/glue/webkit_glue.h"
 #include "webkit/renderer/appcache/web_application_cache_host_impl.h"
 #include "webkit/renderer/webpreferences_renderer.h"
 
@@ -413,7 +413,8 @@
           ViewMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL;
 }
 
-static WebReferrerPolicy GetReferrerPolicyFromRequest(
+// static
+WebReferrerPolicy RenderViewImpl::GetReferrerPolicyFromRequest(
     WebFrame* frame,
     const WebURLRequest& request) {
   return request.extraData() ?
@@ -421,14 +422,16 @@
       frame->document().referrerPolicy();
 }
 
-static Referrer GetReferrerFromRequest(
+// static
+Referrer RenderViewImpl::GetReferrerFromRequest(
     WebFrame* frame,
     const WebURLRequest& request) {
   return Referrer(GURL(request.httpHeaderField(WebString::fromUTF8("Referer"))),
                   GetReferrerPolicyFromRequest(frame, request));
 }
 
-static WebURLResponseExtraDataImpl* GetExtraDataFromResponse(
+// static
+WebURLResponseExtraDataImpl* RenderViewImpl::GetExtraDataFromResponse(
     const WebURLResponse& response) {
   return static_cast<WebURLResponseExtraDataImpl*>(
       response.extraData());
@@ -1933,7 +1936,7 @@
     // Save some histogram data so we can compute the average memory used per
     // page load of the glyphs.
     UMA_HISTOGRAM_COUNTS_10000("Memory.GlyphPagesPerLoad",
-                               webkit_glue::GetGlyphPageCount());
+                               WebKit::WebGlyphCache::pageCount());
 
     // This message needs to be sent before any of allowScripts(),
     // allowImages(), allowPlugins() is called for the new page, so that when
@@ -2036,6 +2039,8 @@
     params.should_replace_current_entry = false;
   }
   params.user_gesture = WebUserGestureIndicator::isProcessingUserGesture();
+  if (GetContentClient()->renderer()->AllowPopup())
+    params.user_gesture = true;
 
   if (policy == WebKit::WebNavigationPolicyNewBackgroundTab ||
       policy == WebKit::WebNavigationPolicyNewForegroundTab ||
@@ -2128,6 +2133,8 @@
   ViewHostMsg_CreateWindow_Params params;
   params.opener_id = routing_id_;
   params.user_gesture = WebUserGestureIndicator::isProcessingUserGesture();
+  if (GetContentClient()->renderer()->AllowPopup())
+    params.user_gesture = true;
   params.window_container_type = WindowFeaturesToContainerType(features);
   params.session_storage_namespace_id = session_storage_namespace_id_;
   if (frame_name != "_blank")
@@ -2227,7 +2234,7 @@
 }
 
 RenderWidgetFullscreenPepper* RenderViewImpl::CreatePepperFullscreenContainer(
-    webkit::ppapi::PluginInstance* plugin) {
+    webkit::ppapi::PluginInstanceImpl* plugin) {
 #if defined(ENABLE_PLUGINS)
   GURL active_url;
   if (webview() && webview()->mainFrame())
@@ -2738,9 +2745,6 @@
 
   DCHECK(opener_id_ != MSG_ROUTING_NONE);
 
-  if (GetContentClient()->renderer()->AllowPopup())
-    opened_by_user_gesture_ = true;
-
   // Force new windows to a popup if they were not opened with a user gesture.
   if (!opened_by_user_gesture_) {
     // We exempt background tabs for compat with older versions of Chrome.
@@ -2833,57 +2837,15 @@
 
 WebKit::WebPlugin* RenderViewImpl::createPlugin(WebFrame* frame,
                                                 const WebPluginParams& params) {
-  WebKit::WebPlugin* plugin = NULL;
-  if (GetContentClient()->renderer()->OverrideCreatePlugin(
-          this, frame, params, &plugin)) {
-    return plugin;
-  }
-
-#if defined(ENABLE_PLUGINS)
-  if (UTF16ToASCII(params.mimeType) == kBrowserPluginMimeType) {
-    return GetBrowserPluginManager()->CreateBrowserPlugin(this, frame, params);
-  }
-
-  WebPluginInfo info;
-  std::string mime_type;
-  bool found = GetPluginInfo(params.url, frame->top()->document().url(),
-                             params.mimeType.utf8(), &info, &mime_type);
-  if (!found)
-    return NULL;
-
-  WebPluginParams params_to_use = params;
-  params_to_use.mimeType = WebString::fromUTF8(mime_type);
-  return CreatePlugin(frame, info, params_to_use);
-#else
+  NOTREACHED();
   return NULL;
-#endif  // defined(ENABLE_PLUGINS)
 }
 
 WebSharedWorker* RenderViewImpl::createSharedWorker(
     WebFrame* frame, const WebURL& url, const WebString& name,
     unsigned long long document_id) {
-
-  int route_id = MSG_ROUTING_NONE;
-  bool exists = false;
-  bool url_mismatch = false;
-  ViewHostMsg_CreateWorker_Params params;
-  params.url = url;
-  params.name = name;
-  params.document_id = document_id;
-  params.render_view_route_id = routing_id_;
-  params.route_id = MSG_ROUTING_NONE;
-  params.script_resource_appcache_id = 0;
-  Send(new ViewHostMsg_LookupSharedWorker(
-      params, &exists, &route_id, &url_mismatch));
-  if (url_mismatch) {
-    return NULL;
-  } else {
-    return new WebSharedWorkerProxy(RenderThreadImpl::current(),
-                                    document_id,
-                                    exists,
-                                    route_id,
-                                    routing_id_);
-  }
+  NOTREACHED();
+  return NULL;
 }
 
 WebMediaPlayer* RenderViewImpl::createMediaPlayer(
@@ -2965,7 +2927,8 @@
   }
 
   scoped_refptr<media::GpuVideoDecoderFactories> gpu_factories =
-      RenderThreadImpl::current()->GetGpuFactories();
+      RenderThreadImpl::current()->GetGpuFactories(
+          RenderThreadImpl::current()->GetMediaThreadMessageLoopProxy());
 
   WebMediaPlayerParams params(
       RenderThreadImpl::current()->GetMediaThreadMessageLoopProxy(),
@@ -2980,11 +2943,8 @@
 
 WebApplicationCacheHost* RenderViewImpl::createApplicationCacheHost(
     WebFrame* frame, WebApplicationCacheHostClient* client) {
-  if (!frame || !frame->view())
-    return NULL;
-  return new RendererWebApplicationCacheHostImpl(
-      FromWebView(frame->view()), client,
-      RenderThreadImpl::current()->appcache_dispatcher()->backend_proxy());
+  NOTREACHED();
+  return NULL;
 }
 
 WebCookieJar* RenderViewImpl::cookieJar(WebFrame* frame) {
@@ -2999,8 +2959,7 @@
 }
 
 void RenderViewImpl::didCreateFrame(WebFrame* parent, WebFrame* child) {
-  Send(new ViewHostMsg_FrameAttached(routing_id_, parent->identifier(),
-      child->identifier(), UTF16ToUTF8(child->assignedName())));
+  NOTREACHED();
 }
 
 void RenderViewImpl::didDisownOpener(WebKit::WebFrame* frame) {
@@ -3016,13 +2975,6 @@
 }
 
 void RenderViewImpl::frameDetached(WebFrame* frame) {
-  int64 parent_frame_id = -1;
-  if (frame->parent())
-    parent_frame_id = frame->parent()->identifier();
-
-  Send(new ViewHostMsg_FrameDetached(routing_id_, parent_frame_id,
-      frame->identifier()));
-
   FOR_EACH_OBSERVER(RenderViewObserver, observers_, FrameDetached(frame));
 }
 
@@ -3032,19 +2984,13 @@
 
 void RenderViewImpl::didChangeName(WebFrame* frame,
                                    const WebString& name)  {
-  if (!renderer_preferences_.report_frame_name_changes)
-    return;
-
-  Send(new ViewHostMsg_UpdateFrameName(routing_id_,
-                                       frame->identifier(),
-                                       !frame->parent(),
-                                       UTF16ToUTF8(name)));
+  NOTREACHED();
 }
 
 void RenderViewImpl::loadURLExternally(
     WebFrame* frame, const WebURLRequest& request,
     WebNavigationPolicy policy) {
-  loadURLExternally(frame, request, policy, WebString());
+  NOTREACHED();
 }
 
 void RenderViewImpl::Repaint(const gfx::Size& size) {
@@ -3080,13 +3026,7 @@
     WebFrame* frame, const WebURLRequest& request,
     WebNavigationPolicy policy,
     const WebString& suggested_name) {
-  Referrer referrer(GetReferrerFromRequest(frame, request));
-  if (policy == WebKit::WebNavigationPolicyDownload) {
-    Send(new ViewHostMsg_DownloadUrl(routing_id_, request.url(), referrer,
-                                     suggested_name));
-  } else {
-    OpenURL(frame, request.url(), referrer, policy);
-  }
+  NOTREACHED();
 }
 
 WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation(
@@ -3298,82 +3238,13 @@
                                    request, type, default_policy, is_redirect);
 }
 
-bool RenderViewImpl::canHandleRequest(
-    WebFrame* frame, const WebURLRequest& request) {
-  // We allow WebKit to think that everything can be handled even though
-  // browser-side we limit what we load.
-  return true;
-}
-
-WebURLError RenderViewImpl::cannotHandleRequestError(
-    WebFrame* frame, const WebURLRequest& request) {
-  NOTREACHED();  // Since we said we can handle all requests.
-  return WebURLError();
-}
-
-WebURLError RenderViewImpl::cancelledError(
-    WebFrame* frame, const WebURLRequest& request) {
-  WebURLError error;
-  error.domain = WebString::fromUTF8(net::kErrorDomain);
-  error.reason = net::ERR_ABORTED;
-  error.unreachableURL = request.url();
-  return error;
-}
-
-void RenderViewImpl::unableToImplementPolicyWithError(
-    WebFrame*, const WebURLError&) {
-  NOTREACHED();  // Since we said we can handle all requests.
-}
-
 void RenderViewImpl::willSendSubmitEvent(WebKit::WebFrame* frame,
     const WebKit::WebFormElement& form) {
-  // Some login forms have onSubmit handlers that put a hash of the password
-  // into a hidden field and then clear the password. (Issue 28910.)
-  // This method gets called before any of those handlers run, so save away
-  // a copy of the password in case it gets lost.
-  DocumentState* document_state =
-      DocumentState::FromDataSource(frame->dataSource());
-  document_state->set_password_form_data(CreatePasswordForm(form));
+  NOTREACHED();
 }
 
 void RenderViewImpl::willSubmitForm(WebFrame* frame,
                                     const WebFormElement& form) {
-  DocumentState* document_state =
-      DocumentState::FromDataSource(frame->provisionalDataSource());
-  NavigationState* navigation_state = document_state->navigation_state();
-  InternalDocumentStateData* internal_data =
-      InternalDocumentStateData::FromDocumentState(document_state);
-
-  if (PageTransitionCoreTypeIs(navigation_state->transition_type(),
-                               PAGE_TRANSITION_LINK)) {
-    navigation_state->set_transition_type(PAGE_TRANSITION_FORM_SUBMIT);
-  }
-
-  // Save these to be processed when the ensuing navigation is committed.
-  WebSearchableFormData web_searchable_form_data(form);
-  internal_data->set_searchable_form_url(web_searchable_form_data.url());
-  internal_data->set_searchable_form_encoding(
-      web_searchable_form_data.encoding().utf8());
-  scoped_ptr<PasswordForm> password_form_data =
-      CreatePasswordForm(form);
-
-  // In order to save the password that the user actually typed and not one
-  // that may have gotten transformed by the site prior to submit, recover it
-  // from the form contents already stored by |willSendSubmitEvent| into the
-  // dataSource's NavigationState (as opposed to the provisionalDataSource's,
-  // which is what we're storing into now.)
-  if (password_form_data) {
-    DocumentState* old_document_state =
-        DocumentState::FromDataSource(frame->dataSource());
-    if (old_document_state) {
-      PasswordForm* old_form_data = old_document_state->password_form_data();
-      if (old_form_data && old_form_data->action == password_form_data->action)
-        password_form_data->password_value = old_form_data->password_value;
-    }
-  }
-
-  document_state->set_password_form_data(password_form_data.Pass());
-
   FOR_EACH_OBSERVER(
       RenderViewObserver, observers_, WillSubmitForm(frame, form));
 }
@@ -3880,13 +3751,6 @@
 }
 
 void RenderViewImpl::didCreateDocumentElement(WebFrame* frame) {
-  // Notify the browser about non-blank documents loading in the top frame.
-  GURL url = frame->document().url();
-  if (url.is_valid() && url.spec() != kAboutBlankURL) {
-    if (frame == webview()->mainFrame())
-      Send(new ViewHostMsg_DocumentAvailableInMainFrame(routing_id_));
-  }
-
   FOR_EACH_OBSERVER(RenderViewObserver, observers_,
                     DidCreateDocumentElement(frame));
 }
@@ -4005,154 +3869,16 @@
   StartNavStateSyncTimerIfNecessary();
 }
 
-void RenderViewImpl::assignIdentifierToRequest(
-    WebFrame* frame, unsigned identifier, const WebURLRequest& request) {
-  // Ignore
-}
-
 void RenderViewImpl::willSendRequest(WebFrame* frame,
                                      unsigned identifier,
                                      WebURLRequest& request,
                                      const WebURLResponse& redirect_response) {
-  // The request my be empty during tests.
-  if (request.url().isEmpty())
-    return;
-
-  WebFrame* top_frame = frame->top();
-  if (!top_frame)
-    top_frame = frame;
-  WebDataSource* provisional_data_source = top_frame->provisionalDataSource();
-  WebDataSource* top_data_source = top_frame->dataSource();
-  WebDataSource* data_source =
-      provisional_data_source ? provisional_data_source : top_data_source;
-
-  PageTransition transition_type = PAGE_TRANSITION_LINK;
-  DocumentState* document_state = DocumentState::FromDataSource(data_source);
-  DCHECK(document_state);
-  InternalDocumentStateData* internal_data =
-      InternalDocumentStateData::FromDocumentState(document_state);
-  NavigationState* navigation_state = document_state->navigation_state();
-  transition_type = navigation_state->transition_type();
-
-  GURL request_url(request.url());
-  GURL new_url;
-  if (GetContentClient()->renderer()->WillSendRequest(
-          frame,
-          transition_type,
-          request_url,
-          request.firstPartyForCookies(),
-          &new_url)) {
-    request.setURL(WebURL(new_url));
-  }
-
-  if (internal_data->is_cache_policy_override_set())
-    request.setCachePolicy(internal_data->cache_policy_override());
-
-  WebKit::WebReferrerPolicy referrer_policy;
-  if (internal_data->is_referrer_policy_set()) {
-    referrer_policy = internal_data->referrer_policy();
-    internal_data->clear_referrer_policy();
-  } else {
-    referrer_policy = frame->document().referrerPolicy();
-  }
-
-  // The request's extra data may indicate that we should set a custom user
-  // agent. This needs to be done here, after WebKit is through with setting the
-  // user agent on its own.
-  WebString custom_user_agent;
-  if (request.extraData()) {
-    webkit_glue::WebURLRequestExtraDataImpl* old_extra_data =
-        static_cast<webkit_glue::WebURLRequestExtraDataImpl*>(
-            request.extraData());
-    custom_user_agent = old_extra_data->custom_user_agent();
-
-    if (!custom_user_agent.isNull()) {
-      if (custom_user_agent.isEmpty())
-        request.clearHTTPHeaderField("User-Agent");
-      else
-        request.setHTTPHeaderField("User-Agent", custom_user_agent);
-    }
-  }
-
-  request.setExtraData(
-      new RequestExtraData(referrer_policy,
-                           custom_user_agent,
-                           (frame == top_frame),
-                           frame->identifier(),
-                           frame->parent() == top_frame,
-                           frame->parent() ? frame->parent()->identifier() : -1,
-                           navigation_state->allow_download(),
-                           transition_type,
-                           navigation_state->transferred_request_child_id(),
-                           navigation_state->transferred_request_request_id()));
-
-  DocumentState* top_document_state =
-      DocumentState::FromDataSource(top_data_source);
-  // TODO(gavinp): separate out prefetching and prerender field trials
-  // if the rel=prerender rel type is sticking around.
-  if (top_document_state &&
-      request.targetType() == WebURLRequest::TargetIsPrefetch)
-    top_document_state->set_was_prefetcher(true);
-
-  request.setRequestorID(routing_id_);
-  request.setHasUserGesture(WebUserGestureIndicator::isProcessingUserGesture());
-
-  if (!navigation_state->extra_headers().empty()) {
-    for (net::HttpUtil::HeadersIterator i(
-        navigation_state->extra_headers().begin(),
-        navigation_state->extra_headers().end(), "\n");
-        i.GetNext(); ) {
-      request.setHTTPHeaderField(WebString::fromUTF8(i.name()),
-                                 WebString::fromUTF8(i.values()));
-    }
-  }
-
-  if (!renderer_preferences_.enable_referrers)
-    request.clearHTTPHeaderField("Referer");
+  NOTREACHED();
 }
 
 void RenderViewImpl::didReceiveResponse(
     WebFrame* frame, unsigned identifier, const WebURLResponse& response) {
-
-  // Only do this for responses that correspond to a provisional data source
-  // of the top-most frame.  If we have a provisional data source, then we
-  // can't have any sub-resources yet, so we know that this response must
-  // correspond to a frame load.
-  if (!frame->provisionalDataSource() || frame->parent())
-    return;
-
-  // If we are in view source mode, then just let the user see the source of
-  // the server's error page.
-  if (frame->isViewSourceModeEnabled())
-    return;
-
-  DocumentState* document_state =
-      DocumentState::FromDataSource(frame->provisionalDataSource());
-  int http_status_code = response.httpStatusCode();
-
-  // Record page load flags.
-  WebURLResponseExtraDataImpl* extra_data = GetExtraDataFromResponse(response);
-  if (extra_data) {
-    document_state->set_was_fetched_via_spdy(
-        extra_data->was_fetched_via_spdy());
-    document_state->set_was_npn_negotiated(
-        extra_data->was_npn_negotiated());
-    document_state->set_npn_negotiated_protocol(
-        extra_data->npn_negotiated_protocol());
-    document_state->set_was_alternate_protocol_available(
-        extra_data->was_alternate_protocol_available());
-    document_state->set_connection_info(
-        extra_data->connection_info());
-    document_state->set_was_fetched_via_proxy(
-        extra_data->was_fetched_via_proxy());
-  }
-  InternalDocumentStateData* internal_data =
-      InternalDocumentStateData::FromDocumentState(document_state);
-  internal_data->set_http_status_code(http_status_code);
-  // Whether or not the http status code actually corresponds to an error is
-  // only checked when the page is done loading, if |use_error_page| is
-  // still true.
-  internal_data->set_use_error_page(true);
+  NOTREACHED();
 }
 
 void RenderViewImpl::didFinishResourceLoad(
@@ -4203,62 +3929,36 @@
   }
 }
 
-void RenderViewImpl::didFailResourceLoad(
-    WebFrame* frame, unsigned identifier, const WebURLError& error) {
-  // Ignore
-}
-
 void RenderViewImpl::didLoadResourceFromMemoryCache(
     WebFrame* frame, const WebURLRequest& request,
     const WebURLResponse& response) {
-  // The recipients of this message have no use for data: URLs: they don't
-  // affect the page's insecure content list and are not in the disk cache. To
-  // prevent large (1M+) data: URLs from crashing in the IPC system, we simply
-  // filter them out here.
-  GURL url(request.url());
-  if (url.SchemeIs("data"))
-    return;
-
-  // Let the browser know we loaded a resource from the memory cache.  This
-  // message is needed to display the correct SSL indicators.
-  Send(new ViewHostMsg_DidLoadResourceFromMemoryCache(
-      routing_id_,
-      url,
-      response.securityInfo(),
-      request.httpMethod().utf8(),
-      response.mimeType().utf8(),
-      ResourceType::FromTargetType(request.targetType())));
+  NOTREACHED();
 }
 
 void RenderViewImpl::didDisplayInsecureContent(WebFrame* frame) {
-  Send(new ViewHostMsg_DidDisplayInsecureContent(routing_id_));
+  NOTREACHED();
 }
 
 void RenderViewImpl::didRunInsecureContent(
     WebFrame* frame, const WebSecurityOrigin& origin, const WebURL& target) {
-  Send(new ViewHostMsg_DidRunInsecureContent(
-      routing_id_,
-      origin.toString().utf8(),
-      target));
+  NOTREACHED();
 }
 
 void RenderViewImpl::didExhaustMemoryAvailableForScript(WebFrame* frame) {
-  Send(new ViewHostMsg_JSOutOfMemory(routing_id_));
+  NOTREACHED();
 }
 
 void RenderViewImpl::didCreateScriptContext(WebFrame* frame,
                                             v8::Handle<v8::Context> context,
                                             int extension_group,
                                             int world_id) {
-  GetContentClient()->renderer()->DidCreateScriptContext(
-      frame, context, extension_group, world_id);
+  NOTREACHED();
 }
 
 void RenderViewImpl::willReleaseScriptContext(WebFrame* frame,
                                               v8::Handle<v8::Context> context,
                                               int world_id) {
-  GetContentClient()->renderer()->WillReleaseScriptContext(
-      frame, context, world_id);
+  NOTREACHED();
 }
 
 void RenderViewImpl::CheckPreferredSize() {
@@ -4360,9 +4060,7 @@
 }
 
 void RenderViewImpl::willInsertBody(WebKit::WebFrame* frame) {
-  if (!frame->parent()) {
-    Send(new ViewHostMsg_WillInsertBody(routing_id()));
-  }
+  NOTREACHED();
 }
 
 void RenderViewImpl::didFirstVisuallyNonEmptyLayout(WebFrame* frame) {
@@ -4384,7 +4082,8 @@
 
   if (bg_color != body_background_color_) {
     body_background_color_ = bg_color;
-    Send(new ViewHostMsg_DidChangeBodyBackgroundColor(routing_id_, bg_color));
+    Send(new ViewHostMsg_DidChangeBodyBackgroundColor(
+        GetRoutingID(), bg_color));
   }
 #endif
 }
@@ -4425,26 +4124,13 @@
 void RenderViewImpl::reportFindInPageMatchCount(int request_id,
                                                 int count,
                                                 bool final_update) {
-  int active_match_ordinal = -1;  // -1 = don't update active match ordinal
-  if (!count)
-    active_match_ordinal = 0;
-
-  // Send the search result over to the browser process.
-  SendFindReply(request_id,
-                count,
-                active_match_ordinal,
-                gfx::Rect(),
-                final_update);
+  NOTREACHED();
 }
 
 void RenderViewImpl::reportFindInPageSelection(int request_id,
                                                int active_match_ordinal,
                                                const WebRect& selection_rect) {
-  SendFindReply(request_id,
-                -1,
-                active_match_ordinal,
-                selection_rect,
-                false);
+  NOTREACHED();
 }
 
 void RenderViewImpl::openFileSystem(
@@ -4453,56 +4139,21 @@
     long long size,
     bool create,
     WebFileSystemCallbacks* callbacks) {
-  DCHECK(callbacks);
-
-  WebSecurityOrigin origin = frame->document().securityOrigin();
-  if (origin.isUnique()) {
-    // Unique origins cannot store persistent state.
-    callbacks->didFail(WebKit::WebFileErrorAbort);
-    return;
-  }
-
-  ChildThread::current()->file_system_dispatcher()->OpenFileSystem(
-      GURL(origin.toString()), static_cast<fileapi::FileSystemType>(type),
-      size, create,
-      base::Bind(&OpenFileSystemCallbackAdapter, callbacks),
-      base::Bind(&FileStatusCallbackAdapter, callbacks));
+  NOTREACHED();
 }
 
 void RenderViewImpl::deleteFileSystem(
     WebFrame* frame,
     WebKit::WebFileSystemType type ,
     WebFileSystemCallbacks* callbacks) {
-  DCHECK(callbacks);
-
-  WebSecurityOrigin origin = frame->document().securityOrigin();
-  if (origin.isUnique()) {
-    // Unique origins cannot store persistent state.
-    callbacks->didSucceed();
-    return;
-  }
-
-  ChildThread::current()->file_system_dispatcher()->DeleteFileSystem(
-      GURL(origin.toString()),
-      static_cast<fileapi::FileSystemType>(type),
-      base::Bind(&FileStatusCallbackAdapter, callbacks));
+  NOTREACHED();
 }
 
 void RenderViewImpl::queryStorageUsageAndQuota(
     WebFrame* frame,
     WebStorageQuotaType type,
     WebStorageQuotaCallbacks* callbacks) {
-  DCHECK(frame);
-  WebSecurityOrigin origin = frame->document().securityOrigin();
-  if (origin.isUnique()) {
-    // Unique origins cannot store persistent state.
-    callbacks->didFail(WebKit::WebStorageQuotaErrorAbort);
-    return;
-  }
-  ChildThread::current()->quota_dispatcher()->QueryStorageUsageAndQuota(
-      GURL(origin.toString()),
-      static_cast<quota::StorageType>(type),
-      QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper(callbacks));
+  NOTREACHED();
 }
 
 void RenderViewImpl::requestStorageQuota(
@@ -4510,17 +4161,7 @@
     WebStorageQuotaType type,
     unsigned long long requested_size,
     WebStorageQuotaCallbacks* callbacks) {
-  DCHECK(frame);
-  WebSecurityOrigin origin = frame->document().securityOrigin();
-  if (origin.isUnique()) {
-    // Unique origins cannot store persistent state.
-    callbacks->didFail(WebKit::WebStorageQuotaErrorAbort);
-    return;
-  }
-  ChildThread::current()->quota_dispatcher()->RequestStorageQuota(
-      routing_id(), GURL(origin.toString()),
-      static_cast<quota::StorageType>(type), requested_size,
-      QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper(callbacks));
+  NOTREACHED();
 }
 
 bool RenderViewImpl::willCheckAndDispatchMessageEvent(
@@ -4551,14 +4192,12 @@
 
 void RenderViewImpl::willOpenSocketStream(
     WebSocketStreamHandle* handle) {
-  SocketStreamHandleData::AddToHandle(handle, routing_id_);
+  NOTREACHED();
 }
 
 void RenderViewImpl::willStartUsingPeerConnectionHandler(
     WebKit::WebFrame* frame, WebKit::WebRTCPeerConnectionHandler* handler) {
-#if defined(ENABLE_WEBRTC)
-  static_cast<RTCPeerConnectionHandler*>(handler)->associateWithFrame(frame);
-#endif
+  NOTREACHED();
 }
 
 WebKit::WebString RenderViewImpl::acceptLanguages() {
@@ -4568,53 +4207,24 @@
 WebKit::WebString RenderViewImpl::userAgentOverride(
     WebKit::WebFrame* frame,
     const WebKit::WebURL& url) {
-  if (!webview() || !webview()->mainFrame() ||
-      renderer_preferences_.user_agent_override.empty()) {
-    return WebKit::WebString();
-  }
-
-  // If we're in the middle of committing a load, the data source we need
-  // will still be provisional.
-  WebFrame* main_frame = webview()->mainFrame();
-  WebDataSource* data_source = NULL;
-  if (main_frame->provisionalDataSource())
-    data_source = main_frame->provisionalDataSource();
-  else
-    data_source = main_frame->dataSource();
-
-  InternalDocumentStateData* internal_data = data_source ?
-      InternalDocumentStateData::FromDataSource(data_source) : NULL;
-  if (internal_data && internal_data->is_overriding_user_agent())
-    return WebString::fromUTF8(renderer_preferences_.user_agent_override);
+  NOTREACHED();
   return WebKit::WebString();
 }
 
 WebString RenderViewImpl::doNotTrackValue(WebFrame* frame) {
-  if (renderer_preferences_.enable_do_not_track)
-    return WebString::fromUTF8("1");
-  return WebString();
+  NOTREACHED();
+  return WebKit::WebString();
 }
 
 bool RenderViewImpl::allowWebGL(WebFrame* frame, bool default_value) {
-  if (!default_value)
-    return false;
-
-  bool blocked = true;
-  Send(new ViewHostMsg_Are3DAPIsBlocked(
-      routing_id_,
-      GURL(frame->top()->document().securityOrigin().toString()),
-      THREE_D_API_TYPE_WEBGL,
-      &blocked));
-  return !blocked;
+  NOTREACHED();
+  return false;
 }
 
 void RenderViewImpl::didLoseWebGLContext(
     WebKit::WebFrame* frame,
     int arb_robustness_status_code) {
-  Send(new ViewHostMsg_DidLose3DContext(
-      GURL(frame->top()->document().securityOrigin().toString()),
-      THREE_D_API_TYPE_WEBGL,
-      arb_robustness_status_code));
+  NOTREACHED();
 }
 
 // WebKit::WebPageSerializerClient implementation ------------------------------
@@ -4786,7 +4396,7 @@
     WebKit::WebFrame* frame,
     const WebKit::WebURLRequest& request,
     WebKit::WebNavigationPolicy policy) {
-  loadURLExternally(frame, request, policy);
+  main_render_frame_->loadURLExternally(frame, request, policy);
 }
 
 void RenderViewImpl::DidStartLoading() {
@@ -5839,12 +5449,13 @@
   }
 }
 
-webkit::ppapi::PluginInstance* RenderViewImpl::GetBitmapForOptimizedPluginPaint(
-    const gfx::Rect& paint_bounds,
-    TransportDIB** dib,
-    gfx::Rect* location,
-    gfx::Rect* clip,
-    float* scale_factor) {
+webkit::ppapi::PluginInstanceImpl*
+    RenderViewImpl::GetBitmapForOptimizedPluginPaint(
+        const gfx::Rect& paint_bounds,
+        TransportDIB** dib,
+        gfx::Rect* location,
+        gfx::Rect* clip,
+        float* scale_factor) {
   return pepper_helper_->GetBitmapForOptimizedPluginPaint(
       paint_bounds, dib, location, clip, scale_factor);
 }
@@ -6679,7 +6290,9 @@
     canvas->translate(-zoom_rect.x() * device_scale_factor_,
                       -zoom_rect.y() * device_scale_factor_);
 
-    webwidget_->paint(webkit_glue::ToWebCanvas(canvas.get()), zoom_rect,
+    webwidget_->paint(
+        canvas.get(),
+        zoom_rect,
         WebWidget::ForceSoftwareRenderingAndIgnoreGPUResidentContent);
   }
 
diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h
index bb62aa4..d728cd4 100644
--- a/content/renderer/render_view_impl.h
+++ b/content/renderer/render_view_impl.h
@@ -17,7 +17,7 @@
 #include "base/memory/linked_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/observer_list.h"
-#include "base/process.h"
+#include "base/process/process.h"
 #include "base/timer/timer.h"
 #include "build/build_config.h"
 #include "cc/input/top_controls_state.h"
@@ -87,7 +87,7 @@
 namespace webkit {
 
 namespace ppapi {
-class PluginInstance;
+class PluginInstanceImpl;
 }  // namespace ppapi
 
 }  // namespace webkit
@@ -132,6 +132,10 @@
 #endif
 }
 
+namespace webkit_glue {
+class WebURLResponseExtraDataImpl;
+}
+
 namespace content {
 class BrowserPluginManager;
 class DeviceOrientationDispatcher;
@@ -296,7 +300,7 @@
 
   // Creates a fullscreen container for a pepper plugin instance.
   RenderWidgetFullscreenPepper* CreatePepperFullscreenContainer(
-      webkit::ppapi::PluginInstance* plugin);
+      webkit::ppapi::PluginInstanceImpl* plugin);
 
   // Informs the render view that a PPAPI plugin has gained or lost focus.
   void PpapiPluginFocusChanged();
@@ -566,17 +570,6 @@
       WebKit::WebNavigationType type,
       WebKit::WebNavigationPolicy default_policy,
       bool is_redirect);
-  virtual bool canHandleRequest(WebKit::WebFrame* frame,
-                                const WebKit::WebURLRequest& request);
-  virtual WebKit::WebURLError cannotHandleRequestError(
-      WebKit::WebFrame* frame,
-      const WebKit::WebURLRequest& request);
-  virtual WebKit::WebURLError cancelledError(
-      WebKit::WebFrame* frame,
-      const WebKit::WebURLRequest& request);
-  virtual void unableToImplementPolicyWithError(
-      WebKit::WebFrame* frame,
-      const WebKit::WebURLError& error);
   virtual void willSendSubmitEvent(WebKit::WebFrame* frame,
                                    const WebKit::WebFormElement& form);
   virtual void willSubmitForm(WebKit::WebFrame* frame,
@@ -613,9 +606,6 @@
   virtual void didNavigateWithinPage(WebKit::WebFrame* frame,
                                      bool is_new_navigation);
   virtual void didUpdateCurrentHistoryItem(WebKit::WebFrame* frame);
-  virtual void assignIdentifierToRequest(WebKit::WebFrame* frame,
-                                         unsigned identifier,
-                                         const WebKit::WebURLRequest& request);
   virtual void willSendRequest(WebKit::WebFrame* frame,
                                unsigned identifier,
                                WebKit::WebURLRequest& request,
@@ -625,9 +615,6 @@
                                   const WebKit::WebURLResponse& response);
   virtual void didFinishResourceLoad(WebKit::WebFrame* frame,
                                      unsigned identifier);
-  virtual void didFailResourceLoad(WebKit::WebFrame* frame,
-                                   unsigned identifier,
-                                   const WebKit::WebURLError& error);
   virtual void didLoadResourceFromMemoryCache(
       WebKit::WebFrame* frame,
       const WebKit::WebURLRequest& request,
@@ -768,7 +755,7 @@
   virtual void WillInitiatePaint() OVERRIDE;
   virtual void DidInitiatePaint() OVERRIDE;
   virtual void DidFlushPaint() OVERRIDE;
-  virtual webkit::ppapi::PluginInstance* GetBitmapForOptimizedPluginPaint(
+  virtual webkit::ppapi::PluginInstanceImpl* GetBitmapForOptimizedPluginPaint(
       const gfx::Rect& paint_bounds,
       TransportDIB** dib,
       gfx::Rect* location,
@@ -829,6 +816,11 @@
   friend class RendererAccessibilityTest;
   friend class RenderViewTest;
 
+  // TODO(nasko): Temporarily friend RenderFrameImpl, so we don't duplicate
+  // utility functions needed in both classes, while we move frame specific
+  // code away from this class.
+  friend class RenderFrameImpl;
+
   FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuRemoveTest, RemoveOnChange);
   FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, NormalCase);
   FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, ShowPopupThenNavigate);
@@ -879,6 +871,17 @@
     CONNECTION_ERROR,
   };
 
+  static WebKit::WebReferrerPolicy GetReferrerPolicyFromRequest(
+      WebKit::WebFrame* frame,
+      const WebKit::WebURLRequest& request);
+
+  static Referrer GetReferrerFromRequest(
+      WebKit::WebFrame* frame,
+      const WebKit::WebURLRequest& request);
+
+  static webkit_glue::WebURLResponseExtraDataImpl* GetExtraDataFromResponse(
+      const WebKit::WebURLResponse& response);
+
   void UpdateURL(WebKit::WebFrame* frame);
   void UpdateTitle(WebKit::WebFrame* frame, const string16& title,
                    WebKit::WebTextDirection title_direction);
diff --git a/content/renderer/render_view_pepper_helper.cc b/content/renderer/render_view_pepper_helper.cc
index c2f701b..de27dfc 100644
--- a/content/renderer/render_view_pepper_helper.cc
+++ b/content/renderer/render_view_pepper_helper.cc
@@ -17,7 +17,7 @@
   return NULL;
 }
 
-webkit::ppapi::PluginInstance*
+webkit::ppapi::PluginInstanceImpl*
 RenderViewPepperHelper::GetBitmapForOptimizedPluginPaint(
     const gfx::Rect& paint_bounds,
     TransportDIB** dib,
diff --git a/content/renderer/render_view_pepper_helper.h b/content/renderer/render_view_pepper_helper.h
index 14e22ef..4d13c3e 100644
--- a/content/renderer/render_view_pepper_helper.h
+++ b/content/renderer/render_view_pepper_helper.h
@@ -12,7 +12,7 @@
 #include "base/basictypes.h"
 #include "base/memory/ref_counted.h"
 #include "base/platform_file.h"
-#include "base/process.h"
+#include "base/process/process.h"
 #include "content/common/content_export.h"
 #include "ui/base/ime/text_input_type.h"
 
@@ -32,7 +32,7 @@
 
 namespace webkit {
 namespace ppapi {
-class PluginInstance;
+class PluginInstanceImpl;
 }
 }
 
@@ -56,7 +56,7 @@
 
   // Called by RenderView to implement the corresponding function in its base
   // class RenderWidget (see that for more).
-  virtual webkit::ppapi::PluginInstance* GetBitmapForOptimizedPluginPaint(
+  virtual webkit::ppapi::PluginInstanceImpl* GetBitmapForOptimizedPluginPaint(
       const gfx::Rect& paint_bounds,
       TransportDIB** dib,
       gfx::Rect* location,
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index cbb196e..fa49316 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -31,6 +31,7 @@
 #include "content/renderer/gpu/mailbox_output_surface.h"
 #include "content/renderer/gpu/render_widget_compositor.h"
 #include "content/renderer/ime_event_guard.h"
+#include "content/renderer/pepper/ppapi_plugin_instance_impl.h"
 #include "content/renderer/render_process.h"
 #include "content/renderer/render_process_visibility_manager.h"
 #include "content/renderer/render_thread_impl.h"
@@ -57,8 +58,6 @@
 #include "ui/gfx/skia_util.h"
 #include "ui/gl/gl_switches.h"
 #include "ui/surface/transport_dib.h"
-#include "webkit/glue/webkit_glue.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
 #include "webkit/renderer/compositor_bindings/web_rendering_stats_impl.h"
 #include "webkit/renderer/cursor_utils.h"
 
@@ -966,12 +965,13 @@
   TransportDIB* optimized_dib = NULL;
   gfx::Rect optimized_copy_rect, optimized_copy_location;
   float dib_scale_factor;
-  webkit::ppapi::PluginInstance* optimized_instance =
+  webkit::ppapi::PluginInstanceImpl* optimized_instance =
       GetBitmapForOptimizedPluginPaint(rect, &optimized_dib,
                                        &optimized_copy_location,
                                        &optimized_copy_rect,
                                        &dib_scale_factor);
   if (optimized_instance) {
+#if defined(ENABLE_PLUGINS)
     // This plugin can be optimize-painted and we can just ask it to paint
     // itself. We don't actually need the TransportDIB in this case.
     //
@@ -998,8 +998,7 @@
 
     SkAutoCanvasRestore auto_restore(canvas, true);
     canvas->scale(device_scale_factor_, device_scale_factor_);
-    optimized_instance->Paint(webkit_glue::ToWebCanvas(canvas),
-                              optimized_copy_location, rect);
+    optimized_instance->Paint(canvas, optimized_copy_location, rect);
     canvas->restore();
     if (kEnableGpuBenchmarking) {
       base::TimeDelta paint_time =
@@ -1007,13 +1006,14 @@
       if (!is_accelerated_compositing_active_)
         software_stats_.total_paint_time += paint_time;
     }
+#endif
   } else {
     // Normal painting case.
     base::TimeTicks paint_begin_ticks;
     if (kEnableGpuBenchmarking)
       paint_begin_ticks = base::TimeTicks::HighResNow();
 
-    webwidget_->paint(webkit_glue::ToWebCanvas(canvas), rect);
+    webwidget_->paint(canvas, rect);
 
     if (kEnableGpuBenchmarking) {
       base::TimeDelta paint_time =
@@ -2021,12 +2021,13 @@
   }
 }
 
-webkit::ppapi::PluginInstance* RenderWidget::GetBitmapForOptimizedPluginPaint(
-    const gfx::Rect& paint_bounds,
-    TransportDIB** dib,
-    gfx::Rect* location,
-    gfx::Rect* clip,
-    float* scale_factor) {
+webkit::ppapi::PluginInstanceImpl*
+    RenderWidget::GetBitmapForOptimizedPluginPaint(
+        const gfx::Rect& paint_bounds,
+        TransportDIB** dib,
+        gfx::Rect* location,
+        gfx::Rect* clip,
+        float* scale_factor) {
   // Bare RenderWidgets don't support optimized plugin painting.
   return NULL;
 }
diff --git a/content/renderer/render_widget.h b/content/renderer/render_widget.h
index 1343cbb..640b82b 100644
--- a/content/renderer/render_widget.h
+++ b/content/renderer/render_widget.h
@@ -66,7 +66,7 @@
 
 namespace webkit {
 namespace ppapi {
-class PluginInstance;
+class PluginInstanceImpl;
 }  // namespace ppapi
 }  // namespace webkit
 
@@ -381,7 +381,7 @@
   //
   // A return value of null means optimized painting can not be used and we
   // should continue with the normal painting code path.
-  virtual webkit::ppapi::PluginInstance* GetBitmapForOptimizedPluginPaint(
+  virtual webkit::ppapi::PluginInstanceImpl* GetBitmapForOptimizedPluginPaint(
       const gfx::Rect& paint_bounds,
       TransportDIB** dib,
       gfx::Rect* location,
diff --git a/content/renderer/render_widget_fullscreen_pepper.cc b/content/renderer/render_widget_fullscreen_pepper.cc
index 587ef38..1eb0ff9 100644
--- a/content/renderer/render_widget_fullscreen_pepper.cc
+++ b/content/renderer/render_widget_fullscreen_pepper.cc
@@ -14,6 +14,8 @@
 #include "content/public/common/content_switches.h"
 #include "content/renderer/gpu/render_widget_compositor.h"
 #include "content/renderer/pepper/pepper_platform_context_3d_impl.h"
+#include "content/renderer/pepper/plugin_delegate.h"
+#include "content/renderer/pepper/ppapi_plugin_instance_impl.h"
 #include "content/renderer/render_thread_impl.h"
 #include "gpu/command_buffer/client/gles2_implementation.h"
 #include "skia/ext/platform_canvas.h"
@@ -25,8 +27,6 @@
 #include "third_party/WebKit/public/web/WebWidget.h"
 #include "ui/gfx/size_conversions.h"
 #include "ui/gl/gpu_preference.h"
-#include "webkit/plugins/ppapi/plugin_delegate.h"
-#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
 
 using WebKit::WebCanvas;
 using WebKit::WebCompositionUnderline;
@@ -348,7 +348,7 @@
 
 // static
 RenderWidgetFullscreenPepper* RenderWidgetFullscreenPepper::Create(
-    int32 opener_id, webkit::ppapi::PluginInstance* plugin,
+    int32 opener_id, webkit::ppapi::PluginInstanceImpl* plugin,
     const GURL& active_url,
     const WebKit::WebScreenInfo& screen_info) {
   DCHECK_NE(MSG_ROUTING_NONE, opener_id);
@@ -360,7 +360,7 @@
 }
 
 RenderWidgetFullscreenPepper::RenderWidgetFullscreenPepper(
-    webkit::ppapi::PluginInstance* plugin,
+    webkit::ppapi::PluginInstanceImpl* plugin,
     const GURL& active_url,
     const WebKit::WebScreenInfo& screen_info)
     : RenderWidgetFullscreen(screen_info),
@@ -467,7 +467,7 @@
   RenderWidget::Close();
 }
 
-webkit::ppapi::PluginInstance*
+webkit::ppapi::PluginInstanceImpl*
 RenderWidgetFullscreenPepper::GetBitmapForOptimizedPluginPaint(
     const gfx::Rect& paint_bounds,
     TransportDIB** dib,
diff --git a/content/renderer/render_widget_fullscreen_pepper.h b/content/renderer/render_widget_fullscreen_pepper.h
index 66df3c7..840a979 100644
--- a/content/renderer/render_widget_fullscreen_pepper.h
+++ b/content/renderer/render_widget_fullscreen_pepper.h
@@ -7,14 +7,14 @@
 
 #include "base/memory/scoped_ptr.h"
 #include "content/renderer/mouse_lock_dispatcher.h"
+#include "content/renderer/pepper/fullscreen_container.h"
 #include "content/renderer/render_widget_fullscreen.h"
 #include "third_party/WebKit/public/web/WebWidget.h"
-#include "webkit/plugins/ppapi/fullscreen_container.h"
 
 namespace webkit {
 namespace ppapi {
 
-class PluginInstance;
+class PluginInstanceImpl;
 
 }  // namespace ppapi
 }  // namespace webkit
@@ -34,7 +34,7 @@
  public:
   static RenderWidgetFullscreenPepper* Create(
       int32 opener_id,
-      webkit::ppapi::PluginInstance* plugin,
+      webkit::ppapi::PluginInstanceImpl* plugin,
       const GURL& active_url,
       const WebKit::WebScreenInfo& screen_info);
 
@@ -51,7 +51,7 @@
   virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
 
   // Could be NULL when this widget is closing.
-  webkit::ppapi::PluginInstance* plugin() const { return plugin_; }
+  webkit::ppapi::PluginInstanceImpl* plugin() const { return plugin_; }
 
   MouseLockDispatcher* mouse_lock_dispatcher() const {
     return mouse_lock_dispatcher_.get();
@@ -60,7 +60,7 @@
   bool is_compositing() const { return !!layer_; }
 
  protected:
-  RenderWidgetFullscreenPepper(webkit::ppapi::PluginInstance* plugin,
+  RenderWidgetFullscreenPepper(webkit::ppapi::PluginInstanceImpl* plugin,
                                const GURL& active_url,
                                const WebKit::WebScreenInfo& screen_info);
   virtual ~RenderWidgetFullscreenPepper();
@@ -70,7 +70,7 @@
   virtual void DidInitiatePaint() OVERRIDE;
   virtual void DidFlushPaint() OVERRIDE;
   virtual void Close() OVERRIDE;
-  virtual webkit::ppapi::PluginInstance* GetBitmapForOptimizedPluginPaint(
+  virtual webkit::ppapi::PluginInstanceImpl* GetBitmapForOptimizedPluginPaint(
       const gfx::Rect& paint_bounds,
       TransportDIB** dib,
       gfx::Rect* location,
@@ -90,7 +90,7 @@
   GURL active_url_;
 
   // The plugin instance this widget wraps.
-  webkit::ppapi::PluginInstance* plugin_;
+  webkit::ppapi::PluginInstanceImpl* plugin_;
 
   WebKit::WebLayer* layer_;
 
diff --git a/content/renderer/renderer_main.cc b/content/renderer/renderer_main.cc
index 8857756..b179545 100644
--- a/content/renderer/renderer_main.cc
+++ b/content/renderer/renderer_main.cc
@@ -17,25 +17,24 @@
 #include "base/path_service.h"
 #include "base/pending_task.h"
 #include "base/power_monitor/power_monitor.h"
-#include "base/process_util.h"
 #include "base/strings/string_util.h"
 #include "base/threading/platform_thread.h"
 #include "base/time/time.h"
 #include "base/timer/hi_res_timer_manager.h"
 #include "content/child/child_process.h"
 #include "content/common/content_constants_internal.h"
-#include "content/common/pepper_plugin_registry.h"
 #include "content/public/common/content_switches.h"
 #include "content/public/common/main_function_params.h"
 #include "content/public/renderer/content_renderer_client.h"
 #include "content/renderer/browser_plugin/browser_plugin_manager_impl.h"
+#include "content/renderer/pepper/pepper_plugin_registry.h"
+#include "content/renderer/pepper/ppapi_interface_factory.h"
 #include "content/renderer/render_process_impl.h"
 #include "content/renderer/render_thread_impl.h"
 #include "content/renderer/renderer_main_platform_delegate.h"
 #include "ui/base/ui_base_switches.h"
 #include "webkit/child/webkit_child_helpers.h"
 #include "webkit/glue/webkit_glue.h"
-#include "webkit/plugins/ppapi/ppapi_interface_factory.h"
 
 #if defined(OS_MACOSX)
 #include <Carbon/Carbon.h>
@@ -149,9 +148,6 @@
 
   RendererMainPlatformDelegate platform(parameters);
 
-  webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager =
-      webkit::ppapi::PpapiInterfaceFactoryManager::GetInstance();
-  factory_manager->RegisterFactory(ContentPPAPIInterfaceFactory);
 
   base::StatsCounterTimer stats_counter_timer("Content.RendererInit");
   base::StatsScope<base::StatsCounterTimer> startup_timer(stats_counter_timer);
@@ -206,6 +202,10 @@
   }
 
 #if defined(ENABLE_PLUGINS)
+  webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager =
+      webkit::ppapi::PpapiInterfaceFactoryManager::GetInstance();
+  factory_manager->RegisterFactory(ContentPPAPIInterfaceFactory);
+
   // Load pepper plugins before engaging the sandbox.
   PepperPluginRegistry::GetInstance();
 #endif
diff --git a/content/renderer/webplugin_delegate_proxy.cc b/content/renderer/webplugin_delegate_proxy.cc
index 687f19e..7ed03fc 100644
--- a/content/renderer/webplugin_delegate_proxy.cc
+++ b/content/renderer/webplugin_delegate_proxy.cc
@@ -19,7 +19,7 @@
 #include "base/logging.h"
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
-#include "base/process.h"
+#include "base/process/process.h"
 #include "base/strings/string_split.h"
 #include "base/strings/string_util.h"
 #include "base/strings/utf_string_conversions.h"
diff --git a/content/test/layouttest_support.cc b/content/test/layouttest_support.cc
index 2698330..3f1a0f6 100644
--- a/content/test/layouttest_support.cc
+++ b/content/test/layouttest_support.cc
@@ -61,6 +61,7 @@
   WebTestProxyBase* base = static_cast<WebTestProxyBase*>(render_view_proxy);
   FrameProxy* render_frame_proxy = new FrameProxy(render_view, routing_id);
   render_frame_proxy->setBaseProxy(base);
+  render_frame_proxy->setVersion(2);
 
   return render_frame_proxy;
 }
diff --git a/content/test/test_media_stream_client.cc b/content/test/test_media_stream_client.cc
index 1aa4385..5e8d946 100644
--- a/content/test/test_media_stream_client.cc
+++ b/content/test/test_media_stream_client.cc
@@ -25,9 +25,9 @@
       WebMediaStreamRegistry::lookupMediaStreamDescriptor(url));
   if (descriptor.isNull())
     return false;
-  WebVector<WebMediaStreamTrack> videoSources;
-  descriptor.videoSources(videoSources);
-  return videoSources.size() > 0;
+  WebVector<WebMediaStreamTrack> video_tracks;
+  descriptor.videoTracks(video_tracks);
+  return video_tracks.size() > 0;
 #else
   return false;
 #endif
diff --git a/content/zygote/zygote_main_linux.cc b/content/zygote/zygote_main_linux.cc
index dcea4c0..0df288f 100644
--- a/content/zygote/zygote_main_linux.cc
+++ b/content/zygote/zygote_main_linux.cc
@@ -20,6 +20,7 @@
 #include "base/files/file_path.h"
 #include "base/linux_util.h"
 #include "base/memory/scoped_ptr.h"
+#include "base/native_library.h"
 #include "base/pickle.h"
 #include "base/posix/eintr_wrapper.h"
 #include "base/posix/unix_domain_socket_linux.h"
@@ -28,11 +29,12 @@
 #include "base/sys_info.h"
 #include "build/build_config.h"
 #include "content/common/font_config_ipc_linux.h"
-#include "content/common/pepper_plugin_registry.h"
+#include "content/common/pepper_plugin_list.h"
 #include "content/common/sandbox_linux.h"
 #include "content/common/zygote_commands_linux.h"
 #include "content/public/common/content_switches.h"
 #include "content/public/common/main_function_params.h"
+#include "content/public/common/pepper_plugin_info.h"
 #include "content/public/common/sandbox_linux.h"
 #include "content/public/common/zygote_fork_delegate_linux.h"
 #include "content/zygote/zygote_linux.h"
@@ -249,6 +251,27 @@
   }
 }
 
+#if defined(ENABLE_PLUGINS)
+// Loads the (native) libraries but does not initialize them (i.e., does not
+// call PPP_InitializeModule). This is needed by the zygote on Linux to get
+// access to the plugins before entering the sandbox.
+void PreloadPepperPlugins() {
+  std::vector<PepperPluginInfo> plugins;
+  ComputePepperPluginList(&plugins);
+  for (size_t i = 0; i < plugins.size(); ++i) {
+    if (!plugins[i].is_internal && plugins[i].is_sandboxed) {
+      std::string error;
+      base::NativeLibrary library = base::LoadNativeLibrary(plugins[i].path,
+                                                            &error);
+      DLOG_IF(WARNING, !library) << "Unable to load plugin "
+                                 << plugins[i].path.value() << " "
+                                 << error;
+      (void)library;  // Prevent release-mode warning.
+    }
+  }
+}
+#endif
+
 // This function triggers the static and lazy construction of objects that need
 // to be created before imposing the sandbox.
 static void PreSandboxInit() {
@@ -277,7 +300,7 @@
 #endif
 #if defined(ENABLE_PLUGINS)
   // Ensure access to the Pepper plugins before the sandbox is turned on.
-  PepperPluginRegistry::PreloadModules();
+  PreloadPepperPlugins();
 #endif
 #if defined(ENABLE_WEBRTC)
   InitializeWebRtcModule();
diff --git a/google_apis/google_apis.target.darwin-arm.mk b/google_apis/google_apis.target.darwin-arm.mk
index 289522d..a63fafe 100644
--- a/google_apis/google_apis.target.darwin-arm.mk
+++ b/google_apis/google_apis.target.darwin-arm.mk
@@ -102,9 +102,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/openssl/openssl/include \
 	$(PWD)/frameworks/wilhelm/include \
@@ -187,9 +187,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/openssl/openssl/include \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/google_apis/google_apis.target.darwin-mips.mk b/google_apis/google_apis.target.darwin-mips.mk
index d0c913b..0ee2c1a 100644
--- a/google_apis/google_apis.target.darwin-mips.mk
+++ b/google_apis/google_apis.target.darwin-mips.mk
@@ -101,9 +101,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/openssl/openssl/include \
 	$(PWD)/frameworks/wilhelm/include \
@@ -185,9 +185,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/openssl/openssl/include \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/google_apis/google_apis.target.darwin-x86.mk b/google_apis/google_apis.target.darwin-x86.mk
index cf5e65e..31f388d 100644
--- a/google_apis/google_apis.target.darwin-x86.mk
+++ b/google_apis/google_apis.target.darwin-x86.mk
@@ -103,9 +103,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/openssl/openssl/include \
 	$(PWD)/frameworks/wilhelm/include \
@@ -190,9 +190,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/openssl/openssl/include \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/google_apis/google_apis.target.linux-arm.mk b/google_apis/google_apis.target.linux-arm.mk
index 289522d..a63fafe 100644
--- a/google_apis/google_apis.target.linux-arm.mk
+++ b/google_apis/google_apis.target.linux-arm.mk
@@ -102,9 +102,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/openssl/openssl/include \
 	$(PWD)/frameworks/wilhelm/include \
@@ -187,9 +187,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/openssl/openssl/include \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/google_apis/google_apis.target.linux-mips.mk b/google_apis/google_apis.target.linux-mips.mk
index d0c913b..0ee2c1a 100644
--- a/google_apis/google_apis.target.linux-mips.mk
+++ b/google_apis/google_apis.target.linux-mips.mk
@@ -101,9 +101,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/openssl/openssl/include \
 	$(PWD)/frameworks/wilhelm/include \
@@ -185,9 +185,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/openssl/openssl/include \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/google_apis/google_apis.target.linux-x86.mk b/google_apis/google_apis.target.linux-x86.mk
index cf5e65e..31f388d 100644
--- a/google_apis/google_apis.target.linux-x86.mk
+++ b/google_apis/google_apis.target.linux-x86.mk
@@ -103,9 +103,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/openssl/openssl/include \
 	$(PWD)/frameworks/wilhelm/include \
@@ -190,9 +190,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/openssl/openssl/include \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 1075b34..cfe1879 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -2828,8 +2828,6 @@
   }
 
   ProcessFinishedAsyncTransfers();
-  if (workarounds().flush_on_context_switch)
-    glFlush();
 
   // Rebind the FBO if it was unbound by the context.
   if (workarounds().unbind_fbo_on_context_switch)
@@ -3156,7 +3154,6 @@
   state_.texture_units.clear();
   state_.bound_array_buffer = NULL;
   state_.current_query = NULL;
-  state_.current_program = NULL;
   state_.bound_read_framebuffer = NULL;
   state_.bound_draw_framebuffer = NULL;
   state_.bound_renderbuffer = NULL;
@@ -3177,7 +3174,6 @@
     if (state_.current_program.get()) {
       program_manager()->UnuseProgram(shader_manager(),
                                       state_.current_program.get());
-      state_.current_program = NULL;
     }
 
     if (attrib_0_buffer_id_) {
@@ -3225,6 +3221,14 @@
     if (offscreen_resolved_color_texture_.get())
       offscreen_resolved_color_texture_->Invalidate();
   }
+
+  // Current program must be cleared after calling ProgramManager::UnuseProgram.
+  // Otherwise, we can leak objects. http://crbug.com/258772.
+  // state_.current_program must be reset before group_ is reset because
+  // the later deletes the ProgramManager object that referred by
+  // state_.current_program object.
+  state_.current_program = NULL;
+
   copy_texture_CHROMIUM_.reset();
 
   if (query_manager_.get()) {
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
index b426286..b8b08c2 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
@@ -292,6 +292,8 @@
   EXPECT_CALL(*gl_, DrawArrays(_, _, _))
       .Times(1)
       .RetiresOnSaturation();
+  EXPECT_CALL(*gl_, DeleteProgram(kServiceProgramId))
+      .Times(1);
   DrawArrays cmd;
   cmd.Init(GL_TRIANGLES, 0, kNumVertices);
   EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
@@ -685,6 +687,8 @@
 
   EXPECT_CALL(*gl_, DrawElements(_, _, _, _))
       .Times(1);
+  EXPECT_CALL(*gl_, DeleteProgram(kServiceProgramId))
+      .Times(1);
   DrawElements cmd;
   cmd.Init(GL_TRIANGLES, kValidIndexRangeCount, GL_UNSIGNED_SHORT,
            kValidIndexRangeStart * 2);
diff --git a/gpu/command_buffer_client.target.darwin-arm.mk b/gpu/command_buffer_client.target.darwin-arm.mk
index 63b9da3..e934538 100644
--- a/gpu/command_buffer_client.target.darwin-arm.mk
+++ b/gpu/command_buffer_client.target.darwin-arm.mk
@@ -93,8 +93,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
@@ -176,8 +176,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/gpu/command_buffer_client.target.darwin-mips.mk b/gpu/command_buffer_client.target.darwin-mips.mk
index dcfe4fe..d5f4993 100644
--- a/gpu/command_buffer_client.target.darwin-mips.mk
+++ b/gpu/command_buffer_client.target.darwin-mips.mk
@@ -92,8 +92,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
@@ -174,8 +174,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/gpu/command_buffer_client.target.darwin-x86.mk b/gpu/command_buffer_client.target.darwin-x86.mk
index cdb170a..1ce8506 100644
--- a/gpu/command_buffer_client.target.darwin-x86.mk
+++ b/gpu/command_buffer_client.target.darwin-x86.mk
@@ -95,8 +95,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
@@ -181,8 +181,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/gpu/command_buffer_client.target.linux-arm.mk b/gpu/command_buffer_client.target.linux-arm.mk
index 63b9da3..e934538 100644
--- a/gpu/command_buffer_client.target.linux-arm.mk
+++ b/gpu/command_buffer_client.target.linux-arm.mk
@@ -93,8 +93,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
@@ -176,8 +176,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/gpu/command_buffer_client.target.linux-mips.mk b/gpu/command_buffer_client.target.linux-mips.mk
index dcfe4fe..d5f4993 100644
--- a/gpu/command_buffer_client.target.linux-mips.mk
+++ b/gpu/command_buffer_client.target.linux-mips.mk
@@ -92,8 +92,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
@@ -174,8 +174,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/gpu/command_buffer_client.target.linux-x86.mk b/gpu/command_buffer_client.target.linux-x86.mk
index cdb170a..1ce8506 100644
--- a/gpu/command_buffer_client.target.linux-x86.mk
+++ b/gpu/command_buffer_client.target.linux-x86.mk
@@ -95,8 +95,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
@@ -181,8 +181,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/gpu/command_buffer_service.target.darwin-arm.mk b/gpu/command_buffer_service.target.darwin-arm.mk
index 43ef0e3..12dcd8e 100644
--- a/gpu/command_buffer_service.target.darwin-arm.mk
+++ b/gpu/command_buffer_service.target.darwin-arm.mk
@@ -139,12 +139,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(gyp_shared_intermediate_dir)/protoc_out \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
@@ -238,12 +238,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(gyp_shared_intermediate_dir)/protoc_out \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
diff --git a/gpu/command_buffer_service.target.darwin-mips.mk b/gpu/command_buffer_service.target.darwin-mips.mk
index 07221a1..6ebf23e 100644
--- a/gpu/command_buffer_service.target.darwin-mips.mk
+++ b/gpu/command_buffer_service.target.darwin-mips.mk
@@ -138,12 +138,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(gyp_shared_intermediate_dir)/protoc_out \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
@@ -236,12 +236,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(gyp_shared_intermediate_dir)/protoc_out \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
diff --git a/gpu/command_buffer_service.target.darwin-x86.mk b/gpu/command_buffer_service.target.darwin-x86.mk
index f22b359..91c97bf 100644
--- a/gpu/command_buffer_service.target.darwin-x86.mk
+++ b/gpu/command_buffer_service.target.darwin-x86.mk
@@ -140,12 +140,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(gyp_shared_intermediate_dir)/protoc_out \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
@@ -241,12 +241,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(gyp_shared_intermediate_dir)/protoc_out \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
diff --git a/gpu/command_buffer_service.target.linux-arm.mk b/gpu/command_buffer_service.target.linux-arm.mk
index 43ef0e3..12dcd8e 100644
--- a/gpu/command_buffer_service.target.linux-arm.mk
+++ b/gpu/command_buffer_service.target.linux-arm.mk
@@ -139,12 +139,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(gyp_shared_intermediate_dir)/protoc_out \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
@@ -238,12 +238,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(gyp_shared_intermediate_dir)/protoc_out \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
diff --git a/gpu/command_buffer_service.target.linux-mips.mk b/gpu/command_buffer_service.target.linux-mips.mk
index 07221a1..6ebf23e 100644
--- a/gpu/command_buffer_service.target.linux-mips.mk
+++ b/gpu/command_buffer_service.target.linux-mips.mk
@@ -138,12 +138,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(gyp_shared_intermediate_dir)/protoc_out \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
@@ -236,12 +236,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(gyp_shared_intermediate_dir)/protoc_out \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
diff --git a/gpu/command_buffer_service.target.linux-x86.mk b/gpu/command_buffer_service.target.linux-x86.mk
index f22b359..91c97bf 100644
--- a/gpu/command_buffer_service.target.linux-x86.mk
+++ b/gpu/command_buffer_service.target.linux-x86.mk
@@ -140,12 +140,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(gyp_shared_intermediate_dir)/protoc_out \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
@@ -241,12 +241,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(gyp_shared_intermediate_dir)/protoc_out \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
diff --git a/gpu/config/gpu_driver_bug_list_json.cc b/gpu/config/gpu_driver_bug_list_json.cc
index 76ea7d2..626c5c1 100644
--- a/gpu/config/gpu_driver_bug_list_json.cc
+++ b/gpu/config/gpu_driver_bug_list_json.cc
@@ -146,7 +146,6 @@
       },
       "features": [
         "restore_scissor_on_fbo_change",
-        "flush_on_context_switch",
         "delete_instead_of_resize_fbo"  // Only need this on the ICS driver.
       ]
     },
diff --git a/gpu/config/gpu_driver_bug_workaround_type.h b/gpu/config/gpu_driver_bug_workaround_type.h
index 990c6ae..8b733ea 100644
--- a/gpu/config/gpu_driver_bug_workaround_type.h
+++ b/gpu/config/gpu_driver_bug_workaround_type.h
@@ -30,8 +30,6 @@
          enable_chromium_fast_npot_mo8_textures)             \
   GPU_OP(EXIT_ON_CONTEXT_LOST,                               \
          exit_on_context_lost)                               \
-  GPU_OP(FLUSH_ON_CONTEXT_SWITCH,                            \
-         flush_on_context_switch)                            \
   GPU_OP(MAX_CUBE_MAP_TEXTURE_SIZE_LIMIT_1024,               \
          max_cube_map_texture_size_limit_1024)               \
   GPU_OP(MAX_CUBE_MAP_TEXTURE_SIZE_LIMIT_4096,               \
diff --git a/gpu/gles2_c_lib.target.darwin-arm.mk b/gpu/gles2_c_lib.target.darwin-arm.mk
index 15f4c60..5e81328 100644
--- a/gpu/gles2_c_lib.target.darwin-arm.mk
+++ b/gpu/gles2_c_lib.target.darwin-arm.mk
@@ -89,12 +89,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -175,12 +175,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/gpu/gles2_c_lib.target.darwin-mips.mk b/gpu/gles2_c_lib.target.darwin-mips.mk
index 4927041..ae23681 100644
--- a/gpu/gles2_c_lib.target.darwin-mips.mk
+++ b/gpu/gles2_c_lib.target.darwin-mips.mk
@@ -88,12 +88,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -173,12 +173,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/gpu/gles2_c_lib.target.darwin-x86.mk b/gpu/gles2_c_lib.target.darwin-x86.mk
index 5b2647d..c028b6f 100644
--- a/gpu/gles2_c_lib.target.darwin-x86.mk
+++ b/gpu/gles2_c_lib.target.darwin-x86.mk
@@ -91,12 +91,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -180,12 +180,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/gpu/gles2_c_lib.target.linux-arm.mk b/gpu/gles2_c_lib.target.linux-arm.mk
index 15f4c60..5e81328 100644
--- a/gpu/gles2_c_lib.target.linux-arm.mk
+++ b/gpu/gles2_c_lib.target.linux-arm.mk
@@ -89,12 +89,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -175,12 +175,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/gpu/gles2_c_lib.target.linux-mips.mk b/gpu/gles2_c_lib.target.linux-mips.mk
index 4927041..ae23681 100644
--- a/gpu/gles2_c_lib.target.linux-mips.mk
+++ b/gpu/gles2_c_lib.target.linux-mips.mk
@@ -88,12 +88,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -173,12 +173,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/gpu/gles2_c_lib.target.linux-x86.mk b/gpu/gles2_c_lib.target.linux-x86.mk
index 5b2647d..c028b6f 100644
--- a/gpu/gles2_c_lib.target.linux-x86.mk
+++ b/gpu/gles2_c_lib.target.linux-x86.mk
@@ -91,12 +91,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -180,12 +180,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/gpu/gles2_cmd_helper.target.darwin-arm.mk b/gpu/gles2_cmd_helper.target.darwin-arm.mk
index 5302dc1..dd5894a 100644
--- a/gpu/gles2_cmd_helper.target.darwin-arm.mk
+++ b/gpu/gles2_cmd_helper.target.darwin-arm.mk
@@ -87,8 +87,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
@@ -170,8 +170,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/gpu/gles2_cmd_helper.target.darwin-mips.mk b/gpu/gles2_cmd_helper.target.darwin-mips.mk
index 2de05d8..dd0afb9 100644
--- a/gpu/gles2_cmd_helper.target.darwin-mips.mk
+++ b/gpu/gles2_cmd_helper.target.darwin-mips.mk
@@ -86,8 +86,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
@@ -168,8 +168,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/gpu/gles2_cmd_helper.target.darwin-x86.mk b/gpu/gles2_cmd_helper.target.darwin-x86.mk
index b92583e..b711435 100644
--- a/gpu/gles2_cmd_helper.target.darwin-x86.mk
+++ b/gpu/gles2_cmd_helper.target.darwin-x86.mk
@@ -89,8 +89,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
@@ -175,8 +175,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/gpu/gles2_cmd_helper.target.linux-arm.mk b/gpu/gles2_cmd_helper.target.linux-arm.mk
index 5302dc1..dd5894a 100644
--- a/gpu/gles2_cmd_helper.target.linux-arm.mk
+++ b/gpu/gles2_cmd_helper.target.linux-arm.mk
@@ -87,8 +87,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
@@ -170,8 +170,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/gpu/gles2_cmd_helper.target.linux-mips.mk b/gpu/gles2_cmd_helper.target.linux-mips.mk
index 2de05d8..dd0afb9 100644
--- a/gpu/gles2_cmd_helper.target.linux-mips.mk
+++ b/gpu/gles2_cmd_helper.target.linux-mips.mk
@@ -86,8 +86,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
@@ -168,8 +168,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/gpu/gles2_cmd_helper.target.linux-x86.mk b/gpu/gles2_cmd_helper.target.linux-x86.mk
index b92583e..b711435 100644
--- a/gpu/gles2_cmd_helper.target.linux-x86.mk
+++ b/gpu/gles2_cmd_helper.target.linux-x86.mk
@@ -89,8 +89,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
@@ -175,8 +175,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/gpu/gles2_implementation.target.darwin-arm.mk b/gpu/gles2_implementation.target.darwin-arm.mk
index bdd8fe3..9cbf3fc 100644
--- a/gpu/gles2_implementation.target.darwin-arm.mk
+++ b/gpu/gles2_implementation.target.darwin-arm.mk
@@ -104,11 +104,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
@@ -197,11 +197,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
diff --git a/gpu/gles2_implementation.target.darwin-mips.mk b/gpu/gles2_implementation.target.darwin-mips.mk
index d932091..35e31e9 100644
--- a/gpu/gles2_implementation.target.darwin-mips.mk
+++ b/gpu/gles2_implementation.target.darwin-mips.mk
@@ -103,11 +103,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
@@ -195,11 +195,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
diff --git a/gpu/gles2_implementation.target.darwin-x86.mk b/gpu/gles2_implementation.target.darwin-x86.mk
index 5d748fd..8bc664f 100644
--- a/gpu/gles2_implementation.target.darwin-x86.mk
+++ b/gpu/gles2_implementation.target.darwin-x86.mk
@@ -105,11 +105,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
@@ -200,11 +200,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
diff --git a/gpu/gles2_implementation.target.linux-arm.mk b/gpu/gles2_implementation.target.linux-arm.mk
index bdd8fe3..9cbf3fc 100644
--- a/gpu/gles2_implementation.target.linux-arm.mk
+++ b/gpu/gles2_implementation.target.linux-arm.mk
@@ -104,11 +104,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
@@ -197,11 +197,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
diff --git a/gpu/gles2_implementation.target.linux-mips.mk b/gpu/gles2_implementation.target.linux-mips.mk
index d932091..35e31e9 100644
--- a/gpu/gles2_implementation.target.linux-mips.mk
+++ b/gpu/gles2_implementation.target.linux-mips.mk
@@ -103,11 +103,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
@@ -195,11 +195,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
diff --git a/gpu/gles2_implementation.target.linux-x86.mk b/gpu/gles2_implementation.target.linux-x86.mk
index 5d748fd..8bc664f 100644
--- a/gpu/gles2_implementation.target.linux-x86.mk
+++ b/gpu/gles2_implementation.target.linux-x86.mk
@@ -105,11 +105,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
@@ -200,11 +200,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
diff --git a/gpu/gpu.target.darwin-arm.mk b/gpu/gpu.target.darwin-arm.mk
index 1f9350b..311100f 100644
--- a/gpu/gpu.target.darwin-arm.mk
+++ b/gpu/gpu.target.darwin-arm.mk
@@ -92,12 +92,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -177,12 +177,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/gpu/gpu.target.darwin-mips.mk b/gpu/gpu.target.darwin-mips.mk
index fc3334c..79643f0 100644
--- a/gpu/gpu.target.darwin-mips.mk
+++ b/gpu/gpu.target.darwin-mips.mk
@@ -91,12 +91,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -175,12 +175,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/gpu/gpu.target.darwin-x86.mk b/gpu/gpu.target.darwin-x86.mk
index fb8df1f..09f229c 100644
--- a/gpu/gpu.target.darwin-x86.mk
+++ b/gpu/gpu.target.darwin-x86.mk
@@ -94,12 +94,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -182,12 +182,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/gpu/gpu.target.linux-arm.mk b/gpu/gpu.target.linux-arm.mk
index 1f9350b..311100f 100644
--- a/gpu/gpu.target.linux-arm.mk
+++ b/gpu/gpu.target.linux-arm.mk
@@ -92,12 +92,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -177,12 +177,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/gpu/gpu.target.linux-mips.mk b/gpu/gpu.target.linux-mips.mk
index fc3334c..79643f0 100644
--- a/gpu/gpu.target.linux-mips.mk
+++ b/gpu/gpu.target.linux-mips.mk
@@ -91,12 +91,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -175,12 +175,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/gpu/gpu.target.linux-x86.mk b/gpu/gpu.target.linux-x86.mk
index fb8df1f..09f229c 100644
--- a/gpu/gpu.target.linux-x86.mk
+++ b/gpu/gpu.target.linux-x86.mk
@@ -94,12 +94,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -182,12 +182,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/gpu/gpu_config.target.darwin-arm.mk b/gpu/gpu_config.target.darwin-arm.mk
index 17d06d6..9be4d62 100644
--- a/gpu/gpu_config.target.darwin-arm.mk
+++ b/gpu/gpu_config.target.darwin-arm.mk
@@ -102,12 +102,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/re2 \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
@@ -191,12 +191,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/re2 \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
diff --git a/gpu/gpu_config.target.darwin-mips.mk b/gpu/gpu_config.target.darwin-mips.mk
index 909b0a2..946b3e0 100644
--- a/gpu/gpu_config.target.darwin-mips.mk
+++ b/gpu/gpu_config.target.darwin-mips.mk
@@ -101,12 +101,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/re2 \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
@@ -189,12 +189,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/re2 \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
diff --git a/gpu/gpu_config.target.darwin-x86.mk b/gpu/gpu_config.target.darwin-x86.mk
index b2abe4c..df9b16a 100644
--- a/gpu/gpu_config.target.darwin-x86.mk
+++ b/gpu/gpu_config.target.darwin-x86.mk
@@ -104,12 +104,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/re2 \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
@@ -196,12 +196,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/re2 \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
diff --git a/gpu/gpu_config.target.linux-arm.mk b/gpu/gpu_config.target.linux-arm.mk
index 17d06d6..9be4d62 100644
--- a/gpu/gpu_config.target.linux-arm.mk
+++ b/gpu/gpu_config.target.linux-arm.mk
@@ -102,12 +102,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/re2 \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
@@ -191,12 +191,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/re2 \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
diff --git a/gpu/gpu_config.target.linux-mips.mk b/gpu/gpu_config.target.linux-mips.mk
index 909b0a2..946b3e0 100644
--- a/gpu/gpu_config.target.linux-mips.mk
+++ b/gpu/gpu_config.target.linux-mips.mk
@@ -101,12 +101,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/re2 \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
@@ -189,12 +189,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/re2 \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
diff --git a/gpu/gpu_config.target.linux-x86.mk b/gpu/gpu_config.target.linux-x86.mk
index b2abe4c..df9b16a 100644
--- a/gpu/gpu_config.target.linux-x86.mk
+++ b/gpu/gpu_config.target.linux-x86.mk
@@ -104,12 +104,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/re2 \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
@@ -196,12 +196,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/re2 \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
diff --git a/gpu/gpu_ipc.target.darwin-arm.mk b/gpu/gpu_ipc.target.darwin-arm.mk
index 0ed2dbf..589a458 100644
--- a/gpu/gpu_ipc.target.darwin-arm.mk
+++ b/gpu/gpu_ipc.target.darwin-arm.mk
@@ -89,8 +89,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
@@ -172,8 +172,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/gpu/gpu_ipc.target.darwin-mips.mk b/gpu/gpu_ipc.target.darwin-mips.mk
index 08880c0..23e2f15 100644
--- a/gpu/gpu_ipc.target.darwin-mips.mk
+++ b/gpu/gpu_ipc.target.darwin-mips.mk
@@ -88,8 +88,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
@@ -170,8 +170,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/gpu/gpu_ipc.target.darwin-x86.mk b/gpu/gpu_ipc.target.darwin-x86.mk
index 8827f57..6d413c8 100644
--- a/gpu/gpu_ipc.target.darwin-x86.mk
+++ b/gpu/gpu_ipc.target.darwin-x86.mk
@@ -91,8 +91,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
@@ -177,8 +177,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/gpu/gpu_ipc.target.linux-arm.mk b/gpu/gpu_ipc.target.linux-arm.mk
index 0ed2dbf..589a458 100644
--- a/gpu/gpu_ipc.target.linux-arm.mk
+++ b/gpu/gpu_ipc.target.linux-arm.mk
@@ -89,8 +89,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
@@ -172,8 +172,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/gpu/gpu_ipc.target.linux-mips.mk b/gpu/gpu_ipc.target.linux-mips.mk
index 08880c0..23e2f15 100644
--- a/gpu/gpu_ipc.target.linux-mips.mk
+++ b/gpu/gpu_ipc.target.linux-mips.mk
@@ -88,8 +88,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
@@ -170,8 +170,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/gpu/gpu_ipc.target.linux-x86.mk b/gpu/gpu_ipc.target.linux-x86.mk
index 8827f57..6d413c8 100644
--- a/gpu/gpu_ipc.target.linux-x86.mk
+++ b/gpu/gpu_ipc.target.linux-x86.mk
@@ -91,8 +91,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
@@ -177,8 +177,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/media/filters/chunk_demuxer.cc b/media/filters/chunk_demuxer.cc
index 670a8b0..29bfc6f 100644
--- a/media/filters/chunk_demuxer.cc
+++ b/media/filters/chunk_demuxer.cc
@@ -144,6 +144,15 @@
   // Returns true if buffers were successfully added.
   bool Append(const StreamParser::BufferQueue& buffers);
 
+  // Removes buffers between |start| and |end| according to the steps
+  // in the "Coded Frame Removal Algorithm" in the Media Source
+  // Extensions Spec.
+  // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#sourcebuffer-coded-frame-removal
+  //
+  // |duration| is the current duration of the presentation. It is
+  // required by the computation outlined in the spec.
+  void Remove(TimeDelta start, TimeDelta end, TimeDelta duration);
+
   // Signal to the stream that duration has changed to |duration|.
   void OnSetDuration(TimeDelta duration);
 
@@ -477,6 +486,12 @@
   return true;
 }
 
+void ChunkDemuxerStream::Remove(TimeDelta start, TimeDelta end,
+                                TimeDelta duration) {
+  base::AutoLock auto_lock(lock_);
+  stream_->Remove(start, end, duration);
+}
+
 void ChunkDemuxerStream::OnSetDuration(TimeDelta duration) {
   base::AutoLock auto_lock(lock_);
   stream_->OnSetDuration(duration);
@@ -943,6 +958,19 @@
   source_state_map_[id]->Abort();
 }
 
+void ChunkDemuxer::Remove(const std::string& id, base::TimeDelta start,
+                          base::TimeDelta end) {
+  DVLOG(1) << "Remove(" << id << ", " << start.InSecondsF()
+           << ", " << end.InSecondsF() << ")";
+  base::AutoLock auto_lock(lock_);
+
+  if (id == source_id_audio_ && audio_)
+    audio_->Remove(start, end, duration_);
+
+  if (id == source_id_video_ && video_)
+    video_->Remove(start, end, duration_);
+}
+
 double ChunkDemuxer::GetDuration() {
   base::AutoLock auto_lock(lock_);
   return GetDuration_Locked();
diff --git a/media/filters/chunk_demuxer.h b/media/filters/chunk_demuxer.h
index 5983199..36177fb 100644
--- a/media/filters/chunk_demuxer.h
+++ b/media/filters/chunk_demuxer.h
@@ -110,6 +110,11 @@
   // it can accept a new segment.
   void Abort(const std::string& id);
 
+  // Remove buffers between |start| and |end| for the source buffer
+  // associated with |id|.
+  void Remove(const std::string& id, base::TimeDelta start,
+              base::TimeDelta end);
+
   // Returns the current presentation duration.
   double GetDuration();
   double GetDuration_Locked();
@@ -119,7 +124,7 @@
   void SetDuration(double duration);
 
   // Sets a time |offset| to be applied to subsequent buffers appended to the
-  // source buffer assicated with |id|. Returns true if the offset is set
+  // source buffer associated with |id|. Returns true if the offset is set
   // properly, false if the offset cannot be applied because we're in the
   // middle of parsing a media segment.
   bool SetTimestampOffset(const std::string& id, base::TimeDelta offset);
diff --git a/media/filters/chunk_demuxer_unittest.cc b/media/filters/chunk_demuxer_unittest.cc
index 9620eff..c83f4bb 100644
--- a/media/filters/chunk_demuxer_unittest.cc
+++ b/media/filters/chunk_demuxer_unittest.cc
@@ -2659,4 +2659,15 @@
   CheckExpectedRanges(kSourceId, "{ [500,592) [792,815) }");
 }
 
+TEST_F(ChunkDemuxerTest, RemoveBeforeInitSegment) {
+    EXPECT_CALL(*this, DemuxerOpened());
+    demuxer_->Initialize(
+        &host_, CreateInitDoneCB(kNoTimestamp(), PIPELINE_OK));
+
+    EXPECT_EQ(ChunkDemuxer::kOk, AddId(kSourceId, true, true));
+
+    demuxer_->Remove(kSourceId, base::TimeDelta::FromMilliseconds(0),
+                     base::TimeDelta::FromMilliseconds(1));
+}
+
 }  // namespace media
diff --git a/media/filters/gpu_video_decoder.cc b/media/filters/gpu_video_decoder.cc
index 82d2b5f..e77f988 100644
--- a/media/filters/gpu_video_decoder.cc
+++ b/media/filters/gpu_video_decoder.cc
@@ -21,112 +21,6 @@
 
 namespace media {
 
-// Proxies calls to a VideoDecodeAccelerator::Client from the calling thread to
-// the client's thread.
-//
-// TODO(scherkus): VDAClientProxy should hold onto GpuVideoDecoderFactories
-// and take care of some of the work that GpuVideoDecoder does to minimize
-// thread hopping. See following for discussion:
-//
-// https://codereview.chromium.org/12989009/diff/27035/media/filters/gpu_video_decoder.cc#newcode23
-class VDAClientProxy
-    : public base::RefCountedThreadSafe<VDAClientProxy>,
-      public VideoDecodeAccelerator::Client {
- public:
-  explicit VDAClientProxy(VideoDecodeAccelerator::Client* client);
-
-  // Detaches the proxy. |weak_client_| will no longer be called and can be
-  // safely deleted. Any pending/future calls will be discarded.
-  //
-  // Must be called on |client_loop_|.
-  void Detach();
-
-  // VideoDecodeAccelerator::Client implementation.
-  virtual void NotifyInitializeDone() OVERRIDE;
-  virtual void ProvidePictureBuffers(uint32 count,
-                                     const gfx::Size& size,
-                                     uint32 texture_target) OVERRIDE;
-  virtual void DismissPictureBuffer(int32 id) OVERRIDE;
-  virtual void PictureReady(const media::Picture& picture) OVERRIDE;
-  virtual void NotifyEndOfBitstreamBuffer(int32 id) OVERRIDE;
-  virtual void NotifyFlushDone() OVERRIDE;
-  virtual void NotifyResetDone() OVERRIDE;
-  virtual void NotifyError(media::VideoDecodeAccelerator::Error error) OVERRIDE;
-
- private:
-  friend class base::RefCountedThreadSafe<VDAClientProxy>;
-  virtual ~VDAClientProxy();
-
-  scoped_refptr<base::MessageLoopProxy> client_loop_;
-
-  // Weak pointers are used to invalidate tasks posted to |client_loop_| after
-  // Detach() has been called.
-  base::WeakPtrFactory<VideoDecodeAccelerator::Client> weak_client_factory_;
-  base::WeakPtr<VideoDecodeAccelerator::Client> weak_client_;
-
-  DISALLOW_COPY_AND_ASSIGN(VDAClientProxy);
-};
-
-VDAClientProxy::VDAClientProxy(VideoDecodeAccelerator::Client* client)
-    : client_loop_(base::MessageLoopProxy::current()),
-      weak_client_factory_(client),
-      weak_client_(weak_client_factory_.GetWeakPtr()) {
-  DCHECK(weak_client_.get());
-}
-
-VDAClientProxy::~VDAClientProxy() {}
-
-void VDAClientProxy::Detach() {
-  DCHECK(client_loop_->BelongsToCurrentThread());
-  DCHECK(weak_client_.get()) << "Detach() already called";
-  weak_client_factory_.InvalidateWeakPtrs();
-}
-
-void VDAClientProxy::NotifyInitializeDone() {
-  client_loop_->PostTask(FROM_HERE, base::Bind(
-      &VideoDecodeAccelerator::Client::NotifyInitializeDone, weak_client_));
-}
-
-void VDAClientProxy::ProvidePictureBuffers(uint32 count,
-                                           const gfx::Size& size,
-                                           uint32 texture_target) {
-  client_loop_->PostTask(FROM_HERE, base::Bind(
-      &VideoDecodeAccelerator::Client::ProvidePictureBuffers, weak_client_,
-      count, size, texture_target));
-}
-
-void VDAClientProxy::DismissPictureBuffer(int32 id) {
-  client_loop_->PostTask(FROM_HERE, base::Bind(
-      &VideoDecodeAccelerator::Client::DismissPictureBuffer, weak_client_, id));
-}
-
-void VDAClientProxy::PictureReady(const media::Picture& picture) {
-  client_loop_->PostTask(FROM_HERE, base::Bind(
-      &VideoDecodeAccelerator::Client::PictureReady, weak_client_, picture));
-}
-
-void VDAClientProxy::NotifyEndOfBitstreamBuffer(int32 id) {
-  client_loop_->PostTask(FROM_HERE, base::Bind(
-      &VideoDecodeAccelerator::Client::NotifyEndOfBitstreamBuffer, weak_client_,
-      id));
-}
-
-void VDAClientProxy::NotifyFlushDone() {
-  client_loop_->PostTask(FROM_HERE, base::Bind(
-      &VideoDecodeAccelerator::Client::NotifyFlushDone, weak_client_));
-}
-
-void VDAClientProxy::NotifyResetDone() {
-  client_loop_->PostTask(FROM_HERE, base::Bind(
-      &VideoDecodeAccelerator::Client::NotifyResetDone, weak_client_));
-}
-
-void VDAClientProxy::NotifyError(media::VideoDecodeAccelerator::Error error) {
-  client_loop_->PostTask(FROM_HERE, base::Bind(
-      &VideoDecodeAccelerator::Client::NotifyError, weak_client_, error));
-}
-
-
 // Maximum number of concurrent VDA::Decode() operations GVD will maintain.
 // Higher values allow better pipelining in the GPU, but also require more
 // resources.
@@ -158,12 +52,10 @@
 GpuVideoDecoder::BufferData::~BufferData() {}
 
 GpuVideoDecoder::GpuVideoDecoder(
-    const scoped_refptr<base::MessageLoopProxy>& message_loop,
     const scoped_refptr<GpuVideoDecoderFactories>& factories)
     : needs_bitstream_conversion_(false),
-      gvd_loop_proxy_(message_loop),
+      gvd_loop_proxy_(factories->GetMessageLoop()),
       weak_factory_(this),
-      vda_loop_proxy_(factories->GetMessageLoop()),
       factories_(factories),
       state_(kNormal),
       decoder_texture_target_(0),
@@ -201,8 +93,7 @@
   DCHECK(pending_reset_cb_.is_null());
   pending_reset_cb_ = BindToCurrentLoop(closure);
 
-  vda_loop_proxy_->PostTask(FROM_HERE, base::Bind(
-      &VideoDecodeAccelerator::Reset, weak_vda_));
+  vda_->Reset();
 }
 
 void GpuVideoDecoder::Stop(const base::Closure& closure) {
@@ -258,10 +149,8 @@
     return;
   }
 
-  client_proxy_ = new VDAClientProxy(this);
-  VideoDecodeAccelerator* vda = factories_->CreateVideoDecodeAccelerator(
-      config.profile(), client_proxy_.get());
-  if (!vda) {
+  vda_.reset(factories_->CreateVideoDecodeAccelerator(config.profile(), this));
+  if (!vda_) {
     status_cb.Run(DECODER_ERROR_NOT_SUPPORTED);
     return;
   }
@@ -270,21 +159,6 @@
   needs_bitstream_conversion_ = (config.codec() == kCodecH264);
 
   DVLOG(3) << "GpuVideoDecoder::Initialize() succeeded.";
-  PostTaskAndReplyWithResult(
-      vda_loop_proxy_.get(),
-      FROM_HERE,
-      base::Bind(&VideoDecodeAccelerator::AsWeakPtr, base::Unretained(vda)),
-      base::Bind(&GpuVideoDecoder::SetVDA, weak_this_, status_cb, vda));
-}
-
-void GpuVideoDecoder::SetVDA(
-    const PipelineStatusCB& status_cb,
-    VideoDecodeAccelerator* vda,
-    base::WeakPtr<VideoDecodeAccelerator> weak_vda) {
-  DCHECK(gvd_loop_proxy_->BelongsToCurrentThread());
-  DCHECK(!vda_.get());
-  vda_.reset(vda);
-  weak_vda_ = weak_vda;
   status_cb.Run(PIPELINE_OK);
 }
 
@@ -304,25 +178,11 @@
   dismissed_picture_buffers_.clear();
 }
 
-static void DestroyVDAWithClientProxy(
-    const scoped_refptr<VDAClientProxy>& client_proxy,
-    base::WeakPtr<VideoDecodeAccelerator> weak_vda) {
-  if (weak_vda.get()) {
-    weak_vda->Destroy();
-    DCHECK(!weak_vda.get());  // Check VDA::Destroy() contract.
-  }
-}
-
 void GpuVideoDecoder::DestroyVDA() {
   DCHECK(gvd_loop_proxy_->BelongsToCurrentThread());
 
-  // |client_proxy| must stay alive until |weak_vda_| has been destroyed.
-  vda_loop_proxy_->PostTask(FROM_HERE, base::Bind(
-      &DestroyVDAWithClientProxy, client_proxy_, weak_vda_));
-
-  VideoDecodeAccelerator* vda ALLOW_UNUSED = vda_.release();
-  client_proxy_->Detach();
-  client_proxy_ = NULL;
+  if (vda_)
+    vda_.release()->Destroy();
 
   DestroyTextures();
 }
@@ -363,8 +223,7 @@
   if (buffer->end_of_stream()) {
     if (state_ == kNormal) {
       state_ = kDrainingDecoder;
-      vda_loop_proxy_->PostTask(FROM_HERE, base::Bind(
-          &VideoDecodeAccelerator::Flush, weak_vda_));
+      vda_->Flush();
     }
     return;
   }
@@ -386,8 +245,7 @@
   DCHECK(inserted);
   RecordBufferData(bitstream_buffer, *buffer.get());
 
-  vda_loop_proxy_->PostTask(FROM_HERE, base::Bind(
-      &VideoDecodeAccelerator::Decode, weak_vda_, bitstream_buffer));
+  vda_->Decode(bitstream_buffer);
 
   if (!ready_video_frames_.empty()) {
     EnqueueFrameAndTriggerFrameDelivery(NULL);
@@ -490,9 +348,7 @@
 
   available_pictures_ += count;
 
-  vda_loop_proxy_->PostTask(FROM_HERE, base::Bind(
-      &VideoDecodeAccelerator::AssignPictureBuffers, weak_vda_,
-      picture_buffers));
+  vda_->AssignPictureBuffers(picture_buffers);
 }
 
 void GpuVideoDecoder::DismissPictureBuffer(int32 id) {
@@ -622,9 +478,7 @@
   factories_->WaitSyncPoint(sync_point);
   ++available_pictures_;
 
-  vda_loop_proxy_->PostTask(FROM_HERE, base::Bind(
-      &VideoDecodeAccelerator::ReusePictureBuffer, weak_vda_,
-      picture_buffer_id));
+  vda_->ReusePictureBuffer(picture_buffer_id);
 }
 
 GpuVideoDecoder::SHMBuffer* GpuVideoDecoder::GetSHM(size_t min_size) {
diff --git a/media/filters/gpu_video_decoder.h b/media/filters/gpu_video_decoder.h
index 01a8842..d155dd6 100644
--- a/media/filters/gpu_video_decoder.h
+++ b/media/filters/gpu_video_decoder.h
@@ -27,17 +27,16 @@
 
 class DecoderBuffer;
 class GpuVideoDecoderFactories;
-class VDAClientProxy;
 
 // GPU-accelerated video decoder implementation.  Relies on
 // AcceleratedVideoDecoderMsg_Decode and friends.
-// All methods internally trampoline to the |message_loop| passed to the ctor.
 class MEDIA_EXPORT GpuVideoDecoder
     : public VideoDecoder,
       public VideoDecodeAccelerator::Client {
  public:
-  GpuVideoDecoder(const scoped_refptr<base::MessageLoopProxy>& message_loop,
-                  const scoped_refptr<GpuVideoDecoderFactories>& factories);
+  // The message loop of |factories| will be saved to |gvd_loop_proxy_|.
+  explicit GpuVideoDecoder(
+      const scoped_refptr<GpuVideoDecoderFactories>& factories);
 
   // VideoDecoder implementation.
   virtual void Initialize(const VideoDecoderConfig& config,
@@ -92,13 +91,6 @@
   void GetBufferData(int32 id, base::TimeDelta* timetamp,
                      gfx::Rect* visible_rect, gfx::Size* natural_size);
 
-  // Sets |vda_| and |weak_vda_| on the GVD thread and runs |status_cb|.
-  void SetVDA(const PipelineStatusCB& status_cb,
-              VideoDecodeAccelerator* vda,
-              base::WeakPtr<VideoDecodeAccelerator> weak_vda);
-
-  // Call VDA::Destroy() on |vda_loop_proxy_| ensuring that |this| outlives the
-  // Destroy() call.
   void DestroyVDA();
 
   // A shared memory segment and its allocated size.
@@ -120,28 +112,16 @@
 
   bool needs_bitstream_conversion_;
 
-  // Message loop on which to fire callbacks and trampoline calls to this class
-  // if they arrive on other loops.
+  // Message loop which this class and |factories_| run on.
   scoped_refptr<base::MessageLoopProxy> gvd_loop_proxy_;
   base::WeakPtrFactory<GpuVideoDecoder> weak_factory_;
   base::WeakPtr<GpuVideoDecoder> weak_this_;
 
-  // Message loop on which to makes all calls to vda_.  (beware this loop may be
-  // paused during the Pause/Flush/Stop dance PipelineImpl::Stop() goes
-  // through).
-  scoped_refptr<base::MessageLoopProxy> vda_loop_proxy_;
-
   scoped_refptr<GpuVideoDecoderFactories> factories_;
 
-  // Proxies calls from |vda_| to |gvd_loop_proxy_| and used to safely detach
-  // during shutdown.
-  scoped_refptr<VDAClientProxy> client_proxy_;
-
-  // Populated during Initialize() via SetVDA() (on success) and unchanged
-  // until an error occurs.
+  // Populated during Initialize() (on success) and unchanged until an error
+  // occurs.
   scoped_ptr<VideoDecodeAccelerator> vda_;
-  // Used to post tasks from the GVD thread to the VDA thread safely.
-  base::WeakPtr<VideoDecodeAccelerator> weak_vda_;
 
   // Callbacks that are !is_null() only during their respective operation being
   // asynchronously executed.
diff --git a/media/filters/source_buffer_stream.cc b/media/filters/source_buffer_stream.cc
index 948ea01..b0038dd 100644
--- a/media/filters/source_buffer_stream.cc
+++ b/media/filters/source_buffer_stream.cc
@@ -469,6 +469,64 @@
   return true;
 }
 
+void SourceBufferStream::Remove(base::TimeDelta start, base::TimeDelta end,
+                                base::TimeDelta duration) {
+  DCHECK(start >= base::TimeDelta()) << start.InSecondsF();
+  DCHECK(start < end) << "start " << start.InSecondsF()
+                      << " end " << end.InSecondsF();
+  DCHECK(duration != kNoTimestamp());
+
+  base::TimeDelta remove_end_timestamp = duration;
+  base::TimeDelta keyframe_timestamp = FindKeyframeAfterTimestamp(end);
+  if (keyframe_timestamp != kNoTimestamp()) {
+    remove_end_timestamp = keyframe_timestamp;
+  } else if (end < remove_end_timestamp) {
+    remove_end_timestamp = end;
+  }
+
+  RangeList::iterator itr = ranges_.begin();
+
+  while (itr != ranges_.end()) {
+    SourceBufferRange* range = *itr;
+    if (range->GetStartTimestamp() >= remove_end_timestamp)
+      break;
+
+    // Split off any remaining end piece and add it to |ranges_|.
+    SourceBufferRange* new_range =
+        range->SplitRange(remove_end_timestamp, false);
+    if (new_range) {
+      itr = ranges_.insert(++itr, new_range);
+      --itr;
+    }
+
+    // If the current range now is completely covered by the removal
+    // range then delete it and move on.
+    if (start <= range->GetStartTimestamp()) {
+      if (selected_range_ == range)
+          SetSelectedRange(NULL);
+
+        delete range;
+        itr = ranges_.erase(itr);
+        continue;
+    }
+
+    // Truncate the current range so that it only contains data before
+    // the removal range.
+    BufferQueue saved_buffers;
+    range->TruncateAt(start, &saved_buffers, false);
+
+    // Check to see if the current playback position was removed and
+    // update the selected range appropriately.
+    if (!saved_buffers.empty()) {
+      SetSelectedRange(NULL);
+      SetSelectedRangeIfNeeded(saved_buffers.front()->GetDecodeTimestamp());
+    }
+
+    // Move on to the next range.
+    ++itr;
+  }
+}
+
 void SourceBufferStream::ResetSeekState() {
   SetSelectedRange(NULL);
   track_buffer_.clear();
diff --git a/media/filters/source_buffer_stream.h b/media/filters/source_buffer_stream.h
index b372e13..6167e51 100644
--- a/media/filters/source_buffer_stream.h
+++ b/media/filters/source_buffer_stream.h
@@ -64,6 +64,16 @@
   // TODO(vrk): Implement garbage collection. (crbug.com/125070)
   bool Append(const BufferQueue& buffers);
 
+  // Removes buffers between |start| and |end| according to the steps
+  // in the "Coded Frame Removal Algorithm" in the Media Source
+  // Extensions Spec.
+  // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#sourcebuffer-coded-frame-removal
+  //
+  // |duration| is the current duration of the presentation. It is
+  // required by the computation outlined in the spec.
+  void Remove(base::TimeDelta start, base::TimeDelta end,
+              base::TimeDelta duration);
+
   // Changes the SourceBufferStream's state so that it will start returning
   // buffers starting from the closest keyframe before |timestamp|.
   void Seek(base::TimeDelta timestamp);
diff --git a/media/filters/source_buffer_stream_unittest.cc b/media/filters/source_buffer_stream_unittest.cc
index f0d2e38..3c12074 100644
--- a/media/filters/source_buffer_stream_unittest.cc
+++ b/media/filters/source_buffer_stream_unittest.cc
@@ -108,6 +108,17 @@
     stream_->Seek(timestamp);
   }
 
+  void RemoveInMs(int start, int end, int duration) {
+    Remove(base::TimeDelta::FromMilliseconds(start),
+           base::TimeDelta::FromMilliseconds(end),
+           base::TimeDelta::FromMilliseconds(duration));
+  }
+
+  void Remove(base::TimeDelta start, base::TimeDelta end,
+              base::TimeDelta duration) {
+    stream_->Remove(start, end, duration);
+  }
+
   void CheckExpectedRanges(const std::string& expected) {
     Ranges<base::TimeDelta> r = stream_->GetBufferedTime();
 
@@ -2825,6 +2836,134 @@
   EXPECT_TRUE(stream_->IsSeekPending());
 }
 
+
+// Removing exact start & end of a range.
+TEST_F(SourceBufferStreamTest, Remove_WholeRange1) {
+  Seek(0);
+  NewSegmentAppend("10K 40 70K 100 130K");
+  CheckExpectedRangesByTimestamp("{ [10,160) }");
+  RemoveInMs(10, 160, 160);
+  CheckExpectedRangesByTimestamp("{ }");
+}
+
+// Removal range starts before range and ends exactly at end.
+TEST_F(SourceBufferStreamTest, Remove_WholeRange2) {
+  Seek(0);
+  NewSegmentAppend("10K 40 70K 100 130K");
+  CheckExpectedRangesByTimestamp("{ [10,160) }");
+  RemoveInMs(0, 160, 160);
+  CheckExpectedRangesByTimestamp("{ }");
+}
+
+// Removal range starts at the start of a range and ends beyond the
+// range end.
+TEST_F(SourceBufferStreamTest, Remove_WholeRange3) {
+  Seek(0);
+  NewSegmentAppend("10K 40 70K 100 130K");
+  CheckExpectedRangesByTimestamp("{ [10,160) }");
+  RemoveInMs(10, 200, 200);
+  CheckExpectedRangesByTimestamp("{ }");
+}
+
+// Removal range starts before range start and ends after the range end.
+TEST_F(SourceBufferStreamTest, Remove_WholeRange4) {
+  Seek(0);
+  NewSegmentAppend("10K 40 70K 100 130K");
+  CheckExpectedRangesByTimestamp("{ [10,160) }");
+  RemoveInMs(0, 200, 200);
+  CheckExpectedRangesByTimestamp("{ }");
+}
+
+// Removes multiple ranges.
+TEST_F(SourceBufferStreamTest, Remove_WholeRange5) {
+  Seek(0);
+  NewSegmentAppend("10K 40 70K 100 130K");
+  NewSegmentAppend("1000K 1030 1060K 1090 1120K");
+  NewSegmentAppend("2000K 2030 2060K 2090 2120K");
+  CheckExpectedRangesByTimestamp("{ [10,160) [1000,1150) [2000,2150) }");
+  RemoveInMs(10, 3000, 3000);
+  CheckExpectedRangesByTimestamp("{ }");
+}
+
+// Verifies a [0-infinity) range removes everything.
+TEST_F(SourceBufferStreamTest, Remove_ZeroToInfinity) {
+  Seek(0);
+  NewSegmentAppend("10K 40 70K 100 130K");
+  NewSegmentAppend("1000K 1030 1060K 1090 1120K");
+  NewSegmentAppend("2000K 2030 2060K 2090 2120K");
+  CheckExpectedRangesByTimestamp("{ [10,160) [1000,1150) [2000,2150) }");
+  Remove(base::TimeDelta(), kInfiniteDuration(), kInfiniteDuration());
+  CheckExpectedRangesByTimestamp("{ }");
+}
+
+// Removal range starts at the beginning of the range and ends in the
+// middle of the range. This test verifies that full GOPs are removed.
+TEST_F(SourceBufferStreamTest, Remove_Partial1) {
+  Seek(0);
+  NewSegmentAppend("10K 40 70K 100 130K");
+  NewSegmentAppend("1000K 1030 1060K 1090 1120K");
+  CheckExpectedRangesByTimestamp("{ [10,160) [1000,1150) }");
+  RemoveInMs(0, 80, 2200);
+  CheckExpectedRangesByTimestamp("{ [130,160) [1000,1150) }");
+}
+
+// Removal range starts in the middle of a range and ends at the exact
+// end of the range.
+TEST_F(SourceBufferStreamTest, Remove_Partial2) {
+  Seek(0);
+  NewSegmentAppend("10K 40 70K 100 130K");
+  NewSegmentAppend("1000K 1030 1060K 1090 1120K");
+  CheckExpectedRangesByTimestamp("{ [10,160) [1000,1150) }");
+  RemoveInMs(40, 160, 2200);
+  CheckExpectedRangesByTimestamp("{ [10,40) [1000,1150) }");
+}
+
+// Removal range starts and ends within a range.
+TEST_F(SourceBufferStreamTest, Remove_Partial3) {
+  Seek(0);
+  NewSegmentAppend("10K 40 70K 100 130K");
+  NewSegmentAppend("1000K 1030 1060K 1090 1120K");
+  CheckExpectedRangesByTimestamp("{ [10,160) [1000,1150) }");
+  RemoveInMs(40, 120, 2200);
+  CheckExpectedRangesByTimestamp("{ [10,40) [130,160) [1000,1150) }");
+}
+
+// Removal range starts in the middle of one range and ends in the
+// middle of another range.
+TEST_F(SourceBufferStreamTest, Remove_Partial4) {
+  Seek(0);
+  NewSegmentAppend("10K 40 70K 100 130K");
+  NewSegmentAppend("1000K 1030 1060K 1090 1120K");
+  NewSegmentAppend("2000K 2030 2060K 2090 2120K");
+  CheckExpectedRangesByTimestamp("{ [10,160) [1000,1150) [2000,2150) }");
+  RemoveInMs(40, 2030, 2200);
+  CheckExpectedRangesByTimestamp("{ [10,40) [2060,2150) }");
+}
+
+// Test behavior when the current positing is removed and new buffers
+// are appended over the removal range.
+TEST_F(SourceBufferStreamTest, Remove_CurrentPosition) {
+  Seek(0);
+  NewSegmentAppend("0K 30 60 90K 120 150 180K 210 240 270K 300 330");
+  CheckExpectedRangesByTimestamp("{ [0,360) }");
+  CheckExpectedBuffers("0K 30 60 90K 120");
+
+  // Remove a range that includes the next buffer (i.e., 150).
+  RemoveInMs(150, 210, 360);
+  CheckExpectedRangesByTimestamp("{ [0,150) [270,360) }");
+
+  // Verify that no next buffer is returned.
+  CheckNoNextBuffer();
+
+  // Append some buffers to fill the gap that was created.
+  NewSegmentAppend("120K 150 180 210K 240");
+  CheckExpectedRangesByTimestamp("{ [0,360) }");
+
+  // Verify that buffers resume at the next keyframe after the
+  // current position.
+  CheckExpectedBuffers("210K 240 270K 300 330");
+}
+
 // TODO(vrk): Add unit tests where keyframes are unaligned between streams.
 // (crbug.com/133557)
 
diff --git a/media/media.target.darwin-arm.mk b/media/media.target.darwin-arm.mk
index 0651b44..f27ae0b 100644
--- a/media/media.target.darwin-arm.mk
+++ b/media/media.target.darwin-arm.mk
@@ -237,11 +237,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/media \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -349,11 +349,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/media \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/media/media.target.darwin-mips.mk b/media/media.target.darwin-mips.mk
index c6e7c1c..236c0f3 100644
--- a/media/media.target.darwin-mips.mk
+++ b/media/media.target.darwin-mips.mk
@@ -236,11 +236,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/media \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -347,11 +347,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/media \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/media/media.target.darwin-x86.mk b/media/media.target.darwin-x86.mk
index 49dd6b3..ec84b75 100644
--- a/media/media.target.darwin-x86.mk
+++ b/media/media.target.darwin-x86.mk
@@ -239,11 +239,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/media \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -353,11 +353,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/media \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/media/media.target.linux-arm.mk b/media/media.target.linux-arm.mk
index 0651b44..f27ae0b 100644
--- a/media/media.target.linux-arm.mk
+++ b/media/media.target.linux-arm.mk
@@ -237,11 +237,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/media \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -349,11 +349,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/media \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/media/media.target.linux-mips.mk b/media/media.target.linux-mips.mk
index c6e7c1c..236c0f3 100644
--- a/media/media.target.linux-mips.mk
+++ b/media/media.target.linux-mips.mk
@@ -236,11 +236,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/media \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -347,11 +347,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/media \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/media/media.target.linux-x86.mk b/media/media.target.linux-x86.mk
index 49dd6b3..ec84b75 100644
--- a/media/media.target.linux-x86.mk
+++ b/media/media.target.linux-x86.mk
@@ -239,11 +239,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/media \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
@@ -353,11 +353,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/media \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH)/third_party/skia/src/core \
diff --git a/media/player_android.target.darwin-arm.mk b/media/player_android.target.darwin-arm.mk
index 5f55bc3..5e38ce7 100644
--- a/media/player_android.target.darwin-arm.mk
+++ b/media/player_android.target.darwin-arm.mk
@@ -98,12 +98,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/media \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/media \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
@@ -188,12 +188,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/media \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/media \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
diff --git a/media/player_android.target.darwin-mips.mk b/media/player_android.target.darwin-mips.mk
index 4fe58d0..cbca452 100644
--- a/media/player_android.target.darwin-mips.mk
+++ b/media/player_android.target.darwin-mips.mk
@@ -97,12 +97,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/media \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/media \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
@@ -186,12 +186,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/media \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/media \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
diff --git a/media/player_android.target.darwin-x86.mk b/media/player_android.target.darwin-x86.mk
index 19893df..60eed5a 100644
--- a/media/player_android.target.darwin-x86.mk
+++ b/media/player_android.target.darwin-x86.mk
@@ -100,12 +100,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/media \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/media \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
@@ -193,12 +193,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/media \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/media \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
diff --git a/media/player_android.target.linux-arm.mk b/media/player_android.target.linux-arm.mk
index 5f55bc3..5e38ce7 100644
--- a/media/player_android.target.linux-arm.mk
+++ b/media/player_android.target.linux-arm.mk
@@ -98,12 +98,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/media \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/media \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
@@ -188,12 +188,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/media \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/media \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
diff --git a/media/player_android.target.linux-mips.mk b/media/player_android.target.linux-mips.mk
index 4fe58d0..cbca452 100644
--- a/media/player_android.target.linux-mips.mk
+++ b/media/player_android.target.linux-mips.mk
@@ -97,12 +97,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/media \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/media \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
@@ -186,12 +186,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/media \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/media \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
diff --git a/media/player_android.target.linux-x86.mk b/media/player_android.target.linux-x86.mk
index 19893df..60eed5a 100644
--- a/media/player_android.target.linux-x86.mk
+++ b/media/player_android.target.linux-x86.mk
@@ -100,12 +100,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/media \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/media \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
@@ -193,12 +193,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/media \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/media \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
diff --git a/media/shared_memory_support.target.darwin-arm.mk b/media/shared_memory_support.target.darwin-arm.mk
index c9d96f2..4ee89e5 100644
--- a/media/shared_memory_support.target.darwin-arm.mk
+++ b/media/shared_memory_support.target.darwin-arm.mk
@@ -92,8 +92,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -174,8 +174,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/media/shared_memory_support.target.darwin-mips.mk b/media/shared_memory_support.target.darwin-mips.mk
index 59f75a9..fa39740 100644
--- a/media/shared_memory_support.target.darwin-mips.mk
+++ b/media/shared_memory_support.target.darwin-mips.mk
@@ -91,8 +91,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -172,8 +172,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/media/shared_memory_support.target.darwin-x86.mk b/media/shared_memory_support.target.darwin-x86.mk
index 97e5fb9..8f72081 100644
--- a/media/shared_memory_support.target.darwin-x86.mk
+++ b/media/shared_memory_support.target.darwin-x86.mk
@@ -94,8 +94,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -179,8 +179,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/media/shared_memory_support.target.linux-arm.mk b/media/shared_memory_support.target.linux-arm.mk
index c9d96f2..4ee89e5 100644
--- a/media/shared_memory_support.target.linux-arm.mk
+++ b/media/shared_memory_support.target.linux-arm.mk
@@ -92,8 +92,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -174,8 +174,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/media/shared_memory_support.target.linux-mips.mk b/media/shared_memory_support.target.linux-mips.mk
index 59f75a9..fa39740 100644
--- a/media/shared_memory_support.target.linux-mips.mk
+++ b/media/shared_memory_support.target.linux-mips.mk
@@ -91,8 +91,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -172,8 +172,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/media/shared_memory_support.target.linux-x86.mk b/media/shared_memory_support.target.linux-x86.mk
index 97e5fb9..8f72081 100644
--- a/media/shared_memory_support.target.linux-x86.mk
+++ b/media/shared_memory_support.target.linux-x86.mk
@@ -94,8 +94,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -179,8 +179,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/native_client_sdk/src/libraries/nacl_io_test/event_test.cc b/native_client_sdk/src/libraries/nacl_io_test/event_test.cc
index 33a3bb2..1a5d9bd 100644
--- a/native_client_sdk/src/libraries/nacl_io_test/event_test.cc
+++ b/native_client_sdk/src/libraries/nacl_io_test/event_test.cc
@@ -73,6 +73,11 @@
 const int TIMEOUT_NEVER = -1;
 const int TIMEOUT_VERY_LONG = 1000;
 
+// We subtract TIMEOUT_SLOP from the expected minimum timed due to rounding
+// and clock drift converting between absolute and relative time.
+// 1 for LT comparison, 1 for rounding, etc...
+const int TIMEOUT_SLOP = 2;
+
 TEST(EventTest, EmitterBasic) {
   ScopedRef<EventEmitterTester> emitter(new EventEmitterTester());
   ScopedRef<EventEmitter> null_emitter;
@@ -300,7 +305,7 @@
   memset(ev, 0, sizeof(ev));
   EXPECT_TRUE(TimedListen(listener, ev, MAX_EVENTS, EXPECT_NO_EVENT,
                           TIMEOUT_LONG, &duration));
-  EXPECT_LT(TIMEOUT_LONG - 1, duration);
+  EXPECT_LT(TIMEOUT_LONG - TIMEOUT_SLOP, duration);
   EXPECT_GT(TIMEOUT_LONG + SCHEDULING_GRANULARITY, duration);
 }
 
@@ -353,7 +358,7 @@
   // Verify the wait duration, and that we only recieved the expected signal.
   duration = Duration(&start, &end);
   EXPECT_GT(TIMEOUT_SHORT + SCHEDULING_GRANULARITY, duration);
-  EXPECT_LT(TIMEOUT_SHORT - 1, duration);
+  EXPECT_LT(TIMEOUT_SHORT - TIMEOUT_SLOP, duration);
   EXPECT_EQ(USER_DATA_A, ev[0].user_data);
   EXPECT_EQ(KE_EXPECTED, ev[0].events);
 }
diff --git a/net/disk_cache/backend_unittest.cc b/net/disk_cache/backend_unittest.cc
index 509f59c..0df770e 100644
--- a/net/disk_cache/backend_unittest.cc
+++ b/net/disk_cache/backend_unittest.cc
@@ -3046,11 +3046,22 @@
   BackendBasics();
 }
 
+TEST_F(DiskCacheBackendTest, SimpleCacheAppCacheBasics) {
+  SetCacheType(net::APP_CACHE);
+  SetSimpleCacheMode();
+  BackendBasics();
+}
+
 TEST_F(DiskCacheBackendTest, SimpleCacheKeying) {
   SetSimpleCacheMode();
   BackendKeying();
 }
 
+TEST_F(DiskCacheBackendTest, SimpleCacheAppCacheKeying) {
+  SetSimpleCacheMode();
+  SetCacheType(net::APP_CACHE);
+  BackendKeying();
+}
 
 TEST_F(DiskCacheBackendTest, DISABLED_SimpleCacheSetSize) {
   SetSimpleCacheMode();
@@ -3060,16 +3071,24 @@
 // MacOS has a default open file limit of 256 files, which is incompatible with
 // this simple cache test.
 #if defined(OS_MACOSX)
-#define MAYBE_SimpleCacheLoad DISABLED_SimpleCacheLoad
+#define SIMPLE_MAYBE_MACOS(TestName) DISABLED_ ## TestName
 #else
-#define MAYBE_SimpleCacheLoad SimpleCacheLoad
+#define SIMPLE_MAYBE_MACOS(TestName) TestName
 #endif
-TEST_F(DiskCacheBackendTest, MAYBE_SimpleCacheLoad) {
+
+TEST_F(DiskCacheBackendTest, SIMPLE_MAYBE_MACOS(SimpleCacheLoad)) {
   SetMaxSize(0x100000);
   SetSimpleCacheMode();
   BackendLoad();
 }
 
+TEST_F(DiskCacheBackendTest, SIMPLE_MAYBE_MACOS(SimpleCacheAppCacheLoad)) {
+  SetCacheType(net::APP_CACHE);
+  SetSimpleCacheMode();
+  SetMaxSize(0x100000);
+  BackendLoad();
+}
+
 TEST_F(DiskCacheBackendTest, SimpleDoomRecent) {
   SetSimpleCacheMode();
   BackendDoomRecent();
@@ -3086,6 +3105,12 @@
   BackendDoomAll();
 }
 
+TEST_F(DiskCacheBackendTest, FLAKY_SimpleCacheAppCacheOnlyDoomAll) {
+  SetCacheType(net::APP_CACHE);
+  SetSimpleCacheMode();
+  BackendDoomAll();
+}
+
 TEST_F(DiskCacheBackendTest, SimpleCacheTracingBackendBasics) {
   SetSimpleCacheMode();
   TracingBackendBasics();
diff --git a/net/disk_cache/disk_cache.h b/net/disk_cache/disk_cache.h
index 33b49b9..d4cb804 100644
--- a/net/disk_cache/disk_cache.h
+++ b/net/disk_cache/disk_cache.h
@@ -307,6 +307,16 @@
   virtual ~Entry() {}
 };
 
+struct EntryDeleter {
+  void operator()(Entry* entry) {
+    // Note that |entry| is ref-counted.
+    entry->Close();
+  }
+};
+
+// Automatically closes an entry when it goes out of scope.
+typedef scoped_ptr<Entry, EntryDeleter> ScopedEntryPtr;
+
 }  // namespace disk_cache
 
 #endif  // NET_DISK_CACHE_DISK_CACHE_H_
diff --git a/net/disk_cache/entry_unittest.cc b/net/disk_cache/entry_unittest.cc
index 9492a9e..f54cec0 100644
--- a/net/disk_cache/entry_unittest.cc
+++ b/net/disk_cache/entry_unittest.cc
@@ -26,6 +26,7 @@
 #include "testing/gtest/include/gtest/gtest.h"
 
 using base::Time;
+using disk_cache::ScopedEntryPtr;
 
 // Tests that can run with different types of caches.
 class DiskCacheEntryTest : public DiskCacheTestWithCache {
@@ -2464,14 +2465,13 @@
 
   // Open the entry.
   ASSERT_EQ(net::OK, OpenEntry(key, &entry));
+  ScopedEntryPtr entry_closer(entry);
 
   const int kReadBufferSize = 200;
   EXPECT_GE(kReadBufferSize, entry->GetDataSize(0));
   scoped_refptr<net::IOBuffer> read_buffer(new net::IOBuffer(kReadBufferSize));
   EXPECT_EQ(net::ERR_CACHE_CHECKSUM_MISMATCH,
             ReadData(entry, 0, 0, read_buffer.get(), kReadBufferSize));
-
-  entry->Close();
 }
 
 // Tests that an entry that has had an IO error occur can still be Doomed().
@@ -2487,6 +2487,7 @@
 
   // Open the entry, forcing an IO error.
   ASSERT_EQ(net::OK, OpenEntry(key, &entry));
+  ScopedEntryPtr entry_closer(entry);
 
   const int kReadBufferSize = 200;
   EXPECT_GE(kReadBufferSize, entry->GetDataSize(0));
@@ -2495,7 +2496,6 @@
             ReadData(entry, 0, 0, read_buffer.get(), kReadBufferSize));
 
   entry->Doom();  // Should not crash.
-  entry->Close();
 }
 
 bool TruncatePath(const base::FilePath& file_path, int64 length)  {
@@ -2541,6 +2541,119 @@
   DisableIntegrityCheck();
 }
 
+TEST_F(DiskCacheEntryTest, SimpleCacheNonOptimisticOperationsBasic) {
+  // Test sequence:
+  // Create, Write, Read, Close.
+  SetCacheType(net::APP_CACHE);  // APP_CACHE doesn't use optimistic operations.
+  SetSimpleCacheMode();
+  InitCache();
+  disk_cache::Entry* const null_entry = NULL;
+
+  disk_cache::Entry* entry = NULL;
+  EXPECT_EQ(net::OK, CreateEntry("my key", &entry));
+  ASSERT_NE(null_entry, entry);
+  ScopedEntryPtr entry_closer(entry);
+
+  const int kBufferSize = 10;
+  scoped_refptr<net::IOBufferWithSize> write_buffer(
+      new net::IOBufferWithSize(kBufferSize));
+  CacheTestFillBuffer(write_buffer->data(), write_buffer->size(), false);
+  EXPECT_EQ(
+      write_buffer->size(),
+      WriteData(entry, 0, 0, write_buffer.get(), write_buffer->size(), false));
+
+  scoped_refptr<net::IOBufferWithSize> read_buffer(
+      new net::IOBufferWithSize(kBufferSize));
+  EXPECT_EQ(
+      read_buffer->size(),
+      ReadData(entry, 0, 0, read_buffer.get(), read_buffer->size()));
+}
+
+TEST_F(DiskCacheEntryTest, SimpleCacheNonOptimisticOperationsDontBlock) {
+  // Test sequence:
+  // Create, Write, Close.
+  SetCacheType(net::APP_CACHE);  // APP_CACHE doesn't use optimistic operations.
+  SetSimpleCacheMode();
+  InitCache();
+  disk_cache::Entry* const null_entry = NULL;
+
+  MessageLoopHelper helper;
+  CallbackTest create_callback(&helper, false);
+
+  int expected_callback_runs = 0;
+  const int kBufferSize = 10;
+  scoped_refptr<net::IOBufferWithSize> write_buffer(
+      new net::IOBufferWithSize(kBufferSize));
+
+  disk_cache::Entry* entry = NULL;
+  EXPECT_EQ(net::OK, CreateEntry("my key", &entry));
+  ASSERT_NE(null_entry, entry);
+  ScopedEntryPtr entry_closer(entry);
+
+  CacheTestFillBuffer(write_buffer->data(), write_buffer->size(), false);
+  CallbackTest write_callback(&helper, false);
+  int ret = entry->WriteData(
+      0,
+      0,
+      write_buffer.get(),
+      write_buffer->size(),
+      base::Bind(&CallbackTest::Run, base::Unretained(&write_callback)),
+      false);
+  ASSERT_EQ(net::ERR_IO_PENDING, ret);
+  helper.WaitUntilCacheIoFinished(++expected_callback_runs);
+}
+
+TEST_F(DiskCacheEntryTest,
+       SimpleCacheNonOptimisticOperationsBasicsWithoutWaiting) {
+  // Test sequence:
+  // Create, Write, Read, Close.
+  SetCacheType(net::APP_CACHE);  // APP_CACHE doesn't use optimistic operations.
+  SetSimpleCacheMode();
+  InitCache();
+  disk_cache::Entry* const null_entry = NULL;
+  MessageLoopHelper helper;
+
+  disk_cache::Entry* entry = NULL;
+  // Note that |entry| is only set once CreateEntry() completed which is why we
+  // have to wait (i.e. use the helper CreateEntry() function).
+  EXPECT_EQ(net::OK, CreateEntry("my key", &entry));
+  ASSERT_NE(null_entry, entry);
+  ScopedEntryPtr entry_closer(entry);
+
+  const int kBufferSize = 10;
+  scoped_refptr<net::IOBufferWithSize> write_buffer(
+      new net::IOBufferWithSize(kBufferSize));
+  CacheTestFillBuffer(write_buffer->data(), write_buffer->size(), false);
+  CallbackTest write_callback(&helper, false);
+  int ret = entry->WriteData(
+      0,
+      0,
+      write_buffer.get(),
+      write_buffer->size(),
+      base::Bind(&CallbackTest::Run, base::Unretained(&write_callback)),
+      false);
+  EXPECT_EQ(net::ERR_IO_PENDING, ret);
+  int expected_callback_runs = 1;
+
+  scoped_refptr<net::IOBufferWithSize> read_buffer(
+      new net::IOBufferWithSize(kBufferSize));
+  CallbackTest read_callback(&helper, false);
+  ret = entry->ReadData(
+      0,
+      0,
+      read_buffer.get(),
+      read_buffer->size(),
+      base::Bind(&CallbackTest::Run, base::Unretained(&read_callback)));
+  EXPECT_EQ(net::ERR_IO_PENDING, ret);
+  ++expected_callback_runs;
+
+  helper.WaitUntilCacheIoFinished(expected_callback_runs);
+  ASSERT_EQ(read_buffer->size(), write_buffer->size());
+  EXPECT_EQ(
+      0,
+      memcmp(read_buffer->data(), write_buffer->data(), read_buffer->size()));
+}
+
 TEST_F(DiskCacheEntryTest, SimpleCacheOptimistic) {
   // Test sequence:
   // Create, Write, Read, Write, Read, Close.
@@ -2573,6 +2686,7 @@
                                 base::Bind(&CallbackTest::Run,
                                            base::Unretained(&callback1))));
   EXPECT_NE(null, entry);
+  ScopedEntryPtr entry_closer(entry);
 
   // This write may or may not be optimistic (it depends if the previous
   // optimistic create already finished by the time we call the write here).
@@ -2628,8 +2742,6 @@
   EXPECT_NE(entry, null);
   EXPECT_TRUE(
       static_cast<disk_cache::SimpleEntryImpl*>(entry)->HasOneRef());
-  entry->Close();
-  entry = NULL;
 }
 
 TEST_F(DiskCacheEntryTest, SimpleCacheOptimistic2) {
@@ -2650,6 +2762,7 @@
                                 base::Bind(&CallbackTest::Run,
                                            base::Unretained(&callback1))));
   EXPECT_NE(null, entry);
+  ScopedEntryPtr entry_closer(entry);
 
   disk_cache::Entry* entry2 = NULL;
   ASSERT_EQ(net::ERR_IO_PENDING,
@@ -2667,8 +2780,6 @@
   // Check that we are not leaking.
   EXPECT_TRUE(
       static_cast<disk_cache::SimpleEntryImpl*>(entry)->HasOneRef());
-  entry->Close();
-  entry = NULL;
 }
 
 TEST_F(DiskCacheEntryTest, SimpleCacheOptimistic3) {
@@ -2690,6 +2801,7 @@
   ASSERT_EQ(net::ERR_IO_PENDING,
             cache_->OpenEntry(key, &entry2, cb.callback()));
   ASSERT_EQ(net::OK, cb.GetResult(net::ERR_IO_PENDING));
+  ScopedEntryPtr entry_closer(entry2);
 
   EXPECT_NE(null, entry2);
   EXPECT_EQ(entry, entry2);
@@ -2697,7 +2809,6 @@
   // Check that we are not leaking.
   EXPECT_TRUE(
       static_cast<disk_cache::SimpleEntryImpl*>(entry2)->HasOneRef());
-  entry2->Close();
 }
 
 TEST_F(DiskCacheEntryTest, SimpleCacheOptimistic4) {
@@ -2785,6 +2896,7 @@
   ASSERT_EQ(net::OK,
             cache_->CreateEntry(key, &entry, net::CompletionCallback()));
   EXPECT_NE(null, entry);
+  ScopedEntryPtr entry_closer(entry);
   entry->Doom();
 
   EXPECT_EQ(
@@ -2799,7 +2911,6 @@
   // Check that we are not leaking.
   EXPECT_TRUE(
       static_cast<disk_cache::SimpleEntryImpl*>(entry)->HasOneRef());
-  entry->Close();
 }
 
 TEST_F(DiskCacheEntryTest, SimpleCacheOptimistic6) {
@@ -2820,6 +2931,7 @@
   ASSERT_EQ(net::OK,
             cache_->CreateEntry(key, &entry, net::CompletionCallback()));
   EXPECT_NE(null, entry);
+  ScopedEntryPtr entry_closer(entry);
 
   EXPECT_EQ(
       net::ERR_IO_PENDING,
@@ -2840,7 +2952,6 @@
   // Check that we are not leaking.
   EXPECT_TRUE(
       static_cast<disk_cache::SimpleEntryImpl*>(entry)->HasOneRef());
-  entry->Close();
 }
 
 // Confirm that IO buffers are not referenced by the Simple Cache after a write
@@ -2855,8 +2966,9 @@
   // First, an optimistic create.
   ASSERT_EQ(net::OK,
             cache_->CreateEntry(key, &entry, net::CompletionCallback()));
-
   ASSERT_TRUE(entry);
+  ScopedEntryPtr entry_closer(entry);
+
   const int kWriteSize = 512;
   scoped_refptr<net::IOBuffer> buffer1(new net::IOBuffer(kWriteSize));
   EXPECT_TRUE(buffer1->HasOneRef());
@@ -2876,7 +2988,6 @@
       entry->WriteData(
           1, 0, buffer1.get(), kWriteSize, net::CompletionCallback(), false));
   EXPECT_TRUE(buffer1->HasOneRef());
-  entry->Close();
 }
 
 TEST_F(DiskCacheEntryTest, DISABLED_SimpleCacheCreateDoomRace) {
@@ -2941,14 +3052,13 @@
       key, cache_path_));
   EXPECT_EQ(net::OK, cache_->CreateEntry(key, &entry, cb.callback()));
   ASSERT_TRUE(entry);
+  ScopedEntryPtr entry_closer(entry);
   ASSERT_NE(net::OK, OpenEntry(key, &entry2));
 
   // Check that we are not leaking.
   EXPECT_TRUE(
       static_cast<disk_cache::SimpleEntryImpl*>(entry)->HasOneRef());
 
-  entry->Close();
-  entry = NULL;
   DisableIntegrityCheck();
 }
 
@@ -2976,9 +3086,9 @@
   std::string key2("the key prefix");
   for (int i = 0; i < kNumExtraEntries; i++) {
     ASSERT_EQ(net::OK, CreateEntry(key2 + base::StringPrintf("%d", i), &entry));
+    ScopedEntryPtr entry_closer(entry);
     EXPECT_EQ(kWriteSize,
               WriteData(entry, 0, 0, buffer.get(), kWriteSize, false));
-    entry->Close();
   }
 
   // TODO(pasko): Find a way to wait for the eviction task(s) to finish by using
@@ -3019,6 +3129,7 @@
   entry = NULL;
 
   ASSERT_EQ(net::OK, OpenEntry(key, &entry));
+  ScopedEntryPtr entry_closer(entry);
 
   MessageLoopHelper helper;
   int expected = 0;
@@ -3058,7 +3169,6 @@
   EXPECT_EQ(kReadBufferSize, truncate_callback.last_result());
   EXPECT_EQ(0,
             memcmp(write_buffer->data(), read_buffer->data(), kReadBufferSize));
-  entry->Close();
 }
 
 // Tests that if a write and a read dependant on it are both in flight
@@ -3072,6 +3182,7 @@
   disk_cache::Entry* entry = NULL;
   ASSERT_EQ(net::OK,
             cache_->CreateEntry(key, &entry, net::CompletionCallback()));
+  ScopedEntryPtr entry_closer(entry);
 
   const int kBufferSize = 1024;
   scoped_refptr<net::IOBuffer> write_buffer(new net::IOBuffer(kBufferSize));
@@ -3106,7 +3217,6 @@
   EXPECT_EQ(kBufferSize, write_callback.last_result());
   EXPECT_EQ(kBufferSize, read_callback.last_result());
   EXPECT_EQ(0, memcmp(write_buffer->data(), read_buffer->data(), kBufferSize));
-  entry->Close();
 }
 
 TEST_F(DiskCacheEntryTest, SimpleCacheOpenCreateRaceWithNoIndex) {
@@ -3178,11 +3288,13 @@
   // Advance the first reader a little.
   disk_cache::Entry* entry = NULL;
   ASSERT_EQ(net::OK, OpenEntry(key, &entry));
+  ScopedEntryPtr entry_closer(entry);
   EXPECT_EQ(1, ReadData(entry, 0, 0, read_buffer1.get(), 1));
 
   // Advance the 2nd reader by the same amount.
   disk_cache::Entry* entry2 = NULL;
   EXPECT_EQ(net::OK, OpenEntry(key, &entry2));
+  ScopedEntryPtr entry2_closer(entry2);
   EXPECT_EQ(1, ReadData(entry2, 0, 0, read_buffer2.get(), 1));
 
   // Continue reading 1st.
@@ -3190,8 +3302,6 @@
 
   // This read should fail as well because we have previous read failures.
   EXPECT_GT(0, ReadData(entry2, 0, 1, read_buffer2.get(), 1));
-  entry2->Close();
-  entry->Close();
   DisableIntegrityCheck();
 }
 
diff --git a/net/disk_cache/simple/simple_backend_impl.cc b/net/disk_cache/simple/simple_backend_impl.cc
index 16e5ebe..f0f92c6 100644
--- a/net/disk_cache/simple/simple_backend_impl.cc
+++ b/net/disk_cache/simple/simple_backend_impl.cc
@@ -177,6 +177,10 @@
     : path_(path),
       cache_thread_(cache_thread),
       orig_max_size_(max_bytes),
+      entry_operations_mode_(
+          type == net::DISK_CACHE ?
+              SimpleEntryImpl::OPTIMISTIC_OPERATIONS :
+              SimpleEntryImpl::NON_OPTIMISTIC_OPERATIONS),
       net_log_(net_log) {
 }
 
@@ -198,17 +202,21 @@
   index_->ExecuteWhenReady(base::Bind(&RecordIndexLoad,
                                       base::TimeTicks::Now()));
 
-  InitializeIndexCallback initialize_index_callback =
-      base::Bind(&SimpleBackendImpl::InitializeIndex,
-                 base::Unretained(this),
-                 completion_callback);
-  cache_thread_->PostTask(
-      FROM_HERE,
+  scoped_ptr<base::Time> cache_dir_mtime(new base::Time());
+  scoped_ptr<uint64> max_size(new uint64());
+  scoped_ptr<int> result(new int());
+  Closure task =
       base::Bind(&SimpleBackendImpl::ProvideDirectorySuggestBetterCacheSize,
-                 MessageLoopProxy::current(),  // io_thread
-                 path_,
-                 initialize_index_callback,
-                 orig_max_size_));
+      path_, orig_max_size_,
+      cache_dir_mtime.get(), max_size.get(),
+      result.get());
+  Closure reply = base::Bind(&SimpleBackendImpl::InitializeIndex,
+                             AsWeakPtr(),
+                             base::Passed(&max_size),
+                             base::Passed(&cache_dir_mtime),
+                             base::Passed(&result),
+                             completion_callback);
+  cache_thread_->PostTaskAndReply(FROM_HERE, task, reply);
   return net::ERR_IO_PENDING;
 }
 
@@ -344,21 +352,24 @@
   index_->UseIfExists(key);
 }
 
-void SimpleBackendImpl::InitializeIndex(
-    const CompletionCallback& callback, uint64 suggested_max_size, int result) {
-  if (result == net::OK) {
-    index_->SetMaxSize(suggested_max_size);
-    index_->Initialize();
+void SimpleBackendImpl::InitializeIndex(scoped_ptr<uint64> suggested_max_size,
+                                        scoped_ptr<base::Time> cache_dir_mtime,
+                                        scoped_ptr<int> dir_sanity_check_result,
+                                        const CompletionCallback& callback) {
+  if (*dir_sanity_check_result == net::OK) {
+    index_->SetMaxSize(*suggested_max_size);
+    index_->Initialize(*cache_dir_mtime);
   }
-  callback.Run(result);
+  callback.Run(*dir_sanity_check_result);
 }
 
 // static
 void SimpleBackendImpl::ProvideDirectorySuggestBetterCacheSize(
-    SingleThreadTaskRunner* io_thread,
     const base::FilePath& path,
-    const InitializeIndexCallback& initialize_index_callback,
-    uint64 suggested_max_size) {
+    uint64 suggested_max_size,
+    base::Time* out_mtime,
+    uint64* out_max_size,
+    int* out_result) {
   int rv = net::OK;
   uint64 max_size = suggested_max_size;
   if (!FileStructureConsistent(path)) {
@@ -366,6 +377,8 @@
                << path.LossyDisplayName();
     rv = net::ERR_FAILED;
   } else {
+    bool mtime_result = simple_util::GetMTime(path, out_mtime);
+    DCHECK(mtime_result);
     if (!max_size) {
       int64 available = base::SysInfo::AmountOfFreeDiskSpace(path);
       if (available < 0)
@@ -377,8 +390,8 @@
     }
     DCHECK(max_size);
   }
-  io_thread->PostTask(FROM_HERE,
-                      base::Bind(initialize_index_callback, max_size, rv));
+  *out_max_size = max_size;
+  *out_result = rv;
 }
 
 scoped_refptr<SimpleEntryImpl> SimpleBackendImpl::CreateOrFindActiveEntry(
@@ -392,8 +405,8 @@
   if (insert_result.second)
     DCHECK(!it->second.get());
   if (!it->second.get()) {
-    SimpleEntryImpl* entry =
-        new SimpleEntryImpl(this, path_, entry_hash, net_log_);
+    SimpleEntryImpl* entry = new SimpleEntryImpl(
+        path_, entry_hash, entry_operations_mode_, this, net_log_);
     entry->set_key(key);
     it->second = entry->AsWeakPtr();
   }
@@ -408,7 +421,6 @@
   return make_scoped_refptr(it->second.get());
 }
 
-
 int SimpleBackendImpl::OpenEntryFromHash(uint64 hash,
                                          Entry** entry,
                                          const CompletionCallback& callback) {
@@ -417,7 +429,7 @@
     return OpenEntry(has_active->second->key(), entry, callback);
 
   scoped_refptr<SimpleEntryImpl> simple_entry =
-      new SimpleEntryImpl(this, path_, hash, net_log_);
+      new SimpleEntryImpl(path_, hash, entry_operations_mode_, this, net_log_);
   CompletionCallback backend_callback =
       base::Bind(&SimpleBackendImpl::OnEntryOpenedFromHash,
                  AsWeakPtr(),
diff --git a/net/disk_cache/simple/simple_backend_impl.h b/net/disk_cache/simple/simple_backend_impl.h
index e2fc8bc..3bf9c30 100644
--- a/net/disk_cache/simple/simple_backend_impl.h
+++ b/net/disk_cache/simple/simple_backend_impl.h
@@ -16,8 +16,10 @@
 #include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/task_runner.h"
+#include "base/time/time.h"
 #include "net/base/cache_type.h"
 #include "net/disk_cache/disk_cache.h"
+#include "net/disk_cache/simple/simple_entry_impl.h"
 
 namespace base {
 class SingleThreadTaskRunner;
@@ -89,13 +91,14 @@
  private:
   typedef base::hash_map<uint64, base::WeakPtr<SimpleEntryImpl> > EntryMap;
 
-  typedef base::Callback<void(uint64 max_size, int result)>
+  typedef base::Callback<void(base::Time mtime, uint64 max_size, int result)>
       InitializeIndexCallback;
 
   // Must run on IO Thread.
-  void InitializeIndex(const CompletionCallback& callback,
-                       uint64 suggested_max_size,
-                       int result);
+  void InitializeIndex(scoped_ptr<uint64> suggested_max_size,
+                       scoped_ptr<base::Time> cache_dir_mtime,
+                       scoped_ptr<int> dir_sanity_check_result,
+                       const CompletionCallback& callback);
 
   // Dooms all entries previously accessed between |initial_time| and
   // |end_time|. Invoked when the index is ready.
@@ -106,11 +109,11 @@
 
   // Try to create the directory if it doesn't exist. Replies with maximum cache
   // size adjustment. Must run on Cache Thread.
-  static void ProvideDirectorySuggestBetterCacheSize(
-      base::SingleThreadTaskRunner* io_thread,
-      const base::FilePath& path,
-      const InitializeIndexCallback& initialize_index_callback,
-      uint64 suggested_max_size);
+  static void ProvideDirectorySuggestBetterCacheSize(const base::FilePath& path,
+                                                     uint64 suggested_max_size,
+                                                     base::Time* out_mtime,
+                                                     uint64* out_max_size,
+                                                     int* out_result);
 
   // Searches |active_entries_| for the entry corresponding to |key|. If found,
   // returns the found entry. Otherwise, creates a new entry and returns that.
@@ -165,12 +168,13 @@
   scoped_refptr<base::TaskRunner> worker_pool_;
 
   int orig_max_size_;
+  const SimpleEntryImpl::OperationsMode entry_operations_mode_;
 
   // TODO(gavinp): Store the entry_hash in SimpleEntryImpl, and index this map
   // by hash. This will save memory, and make IndexReadyForDoom easier.
   EntryMap active_entries_;
 
-  net::NetLog* net_log_;
+  net::NetLog* const net_log_;
 };
 
 }  // namespace disk_cache
diff --git a/net/disk_cache/simple/simple_entry_impl.cc b/net/disk_cache/simple/simple_entry_impl.cc
index d2620d2..62f27f0 100644
--- a/net/disk_cache/simple/simple_entry_impl.cc
+++ b/net/disk_cache/simple/simple_entry_impl.cc
@@ -94,14 +94,16 @@
   SimpleEntryImpl* const entry_;
 };
 
-SimpleEntryImpl::SimpleEntryImpl(SimpleBackendImpl* backend,
-                                 const FilePath& path,
+SimpleEntryImpl::SimpleEntryImpl(const FilePath& path,
                                  const uint64 entry_hash,
+                                 OperationsMode operations_mode,
+                                 SimpleBackendImpl* backend,
                                  net::NetLog* net_log)
     : backend_(backend->AsWeakPtr()),
       worker_pool_(backend->worker_pool()),
       path_(path),
       entry_hash_(entry_hash),
+      use_optimistic_operations_(operations_mode == OPTIMISTIC_OPERATIONS),
       last_used_(Time::Now()),
       last_modified_(last_used_),
       open_count_(0),
@@ -161,10 +163,9 @@
   DCHECK(backend_.get());
   DCHECK_EQ(entry_hash_, simple_util::GetEntryHashKey(key_));
   int ret_value = net::ERR_FAILED;
-  if (state_ == STATE_UNINITIALIZED &&
-      pending_operations_.size() == 0) {
+  if (use_optimistic_operations_ &&
+      state_ == STATE_UNINITIALIZED && pending_operations_.size() == 0) {
     ReturnEntryToCaller(out_entry);
-    // We can do optimistic Create.
     EnqueueOperation(base::Bind(&SimpleEntryImpl::CreateEntryInternal,
                                 this,
                                 CompletionCallback(),
@@ -183,8 +184,7 @@
   // have the entry in the index but we don't have the created files yet, this
   // way we never leak files. CreationOperationComplete will remove the entry
   // from the index if the creation fails.
-  if (backend_.get())
-    backend_->index()->Insert(key_);
+  backend_->index()->Insert(key_);
 
   RunNextOperationIfNeeded();
   return ret_value;
@@ -288,46 +288,36 @@
     RecordWriteResult(WRITE_RESULT_OVER_MAX_SIZE);
     return net::ERR_FAILED;
   }
+  ScopedOperationRunner operation_runner(this);
 
-  int ret_value = net::ERR_FAILED;
-  if (state_ == STATE_READY && pending_operations_.size() == 0) {
-    // We can only do optimistic Write if there is no pending operations, so
-    // that we are sure that the next call to RunNextOperationIfNeeded will
-    // actually run the write operation that sets the stream size. It also
-    // prevents from previous possibly-conflicting writes that could be stacked
-    // in the |pending_operations_|. We could optimize this for when we have
-    // only read operations enqueued.
-    // TODO(gavinp,pasko): For performance, don't use a copy of an IOBuffer
-    // here to avoid paying the price of the RefCountedThreadSafe atomic
-    // operations.
-    IOBuffer* buf_copy = NULL;
-    if (buf) {
-      buf_copy = new IOBuffer(buf_len);
-      memcpy(buf_copy->data(), buf->data(), buf_len);
-    }
-    EnqueueOperation(base::Bind(&SimpleEntryImpl::WriteDataInternal,
-                                this,
-                                stream_index,
-                                offset,
-                                make_scoped_refptr(buf_copy),
-                                buf_len,
-                                CompletionCallback(),
-                                truncate));
-    ret_value = buf_len;
-  } else {
-    EnqueueOperation(base::Bind(&SimpleEntryImpl::WriteDataInternal,
-                                this,
-                                stream_index,
-                                offset,
-                                make_scoped_refptr(buf),
-                                buf_len,
-                                callback,
-                                truncate));
-    ret_value = net::ERR_IO_PENDING;
+  const bool do_optimistic_write = use_optimistic_operations_ &&
+      state_ == STATE_READY && pending_operations_.size() == 0;
+  if (!do_optimistic_write) {
+    pending_operations_.push(
+        base::Bind(&SimpleEntryImpl::WriteDataInternal, this, stream_index,
+                   offset, make_scoped_refptr(buf), buf_len, callback,
+                   truncate));
+    return net::ERR_IO_PENDING;
   }
 
-  RunNextOperationIfNeeded();
-  return ret_value;
+  // We can only do optimistic Write if there is no pending operations, so that
+  // we are sure that the next call to RunNextOperationIfNeeded will actually
+  // run the write operation that sets the stream size. It also prevents from
+  // previous possibly-conflicting writes that could be stacked in the
+  // |pending_operations_|. We could optimize this for when we have only read
+  // operations enqueued.
+  // TODO(gavinp,pasko): For performance, don't use a copy of an IOBuffer here
+  // to avoid paying the price of the RefCountedThreadSafe atomic operations.
+  IOBuffer* buf_copy = NULL;
+  if (buf) {
+    buf_copy = new IOBuffer(buf_len);
+    memcpy(buf_copy->data(), buf->data(), buf_len);
+  }
+  EnqueueOperation(
+      base::Bind(&SimpleEntryImpl::WriteDataInternal, this, stream_index,
+                 offset, make_scoped_refptr(buf_copy), buf_len,
+                 CompletionCallback(), truncate));
+  return buf_len;
 }
 
 int SimpleEntryImpl::ReadSparseData(int64 offset,
diff --git a/net/disk_cache/simple/simple_entry_impl.h b/net/disk_cache/simple/simple_entry_impl.h
index f816f63..a6e69ca 100644
--- a/net/disk_cache/simple/simple_entry_impl.h
+++ b/net/disk_cache/simple/simple_entry_impl.h
@@ -37,9 +37,15 @@
     public base::SupportsWeakPtr<SimpleEntryImpl> {
   friend class base::RefCounted<SimpleEntryImpl>;
  public:
-  SimpleEntryImpl(SimpleBackendImpl* backend,
-                  const base::FilePath& path,
+  enum OperationsMode {
+    NON_OPTIMISTIC_OPERATIONS,
+    OPTIMISTIC_OPERATIONS,
+  };
+
+  SimpleEntryImpl(const base::FilePath& path,
                   uint64 entry_hash,
+                  OperationsMode operations_mode,
+                  SimpleBackendImpl* backend,
                   net::NetLog* net_log);
 
   // Adds another reader/writer to this entry, if possible, returning |this| to
@@ -230,6 +236,7 @@
   const scoped_refptr<base::TaskRunner> worker_pool_;
   const base::FilePath path_;
   const uint64 entry_hash_;
+  const bool use_optimistic_operations_;
   std::string key_;
 
   // |last_used_|, |last_modified_| and |data_size_| are copied from the
diff --git a/net/disk_cache/simple/simple_index.cc b/net/disk_cache/simple/simple_index.cc
index 6d559eb..8dbb88a 100644
--- a/net/disk_cache/simple/simple_index.cc
+++ b/net/disk_cache/simple/simple_index.cc
@@ -126,7 +126,7 @@
   }
 }
 
-void SimpleIndex::Initialize() {
+void SimpleIndex::Initialize(base::Time cache_mtime) {
   DCHECK(io_thread_checker_.CalledOnValidThread());
 
   // Take the foreground and background index flush delays from the experiment
@@ -152,8 +152,10 @@
       base::Bind(&SimpleIndex::OnActivityStateChange, AsWeakPtr())));
 #endif
 
-  index_file_->LoadIndexEntries(
-      io_thread_, base::Bind(&SimpleIndex::MergeInitializingSet, AsWeakPtr()));
+  index_file_->LoadIndexEntries(cache_mtime,
+                                io_thread_,
+                                base::Bind(&SimpleIndex::MergeInitializingSet,
+                                           AsWeakPtr()));
 }
 
 bool SimpleIndex::SetMaxSize(int max_bytes) {
diff --git a/net/disk_cache/simple/simple_index.h b/net/disk_cache/simple/simple_index.h
index d58d267..08a83bb 100644
--- a/net/disk_cache/simple/simple_index.h
+++ b/net/disk_cache/simple/simple_index.h
@@ -77,7 +77,7 @@
 
   virtual ~SimpleIndex();
 
-  void Initialize();
+  void Initialize(base::Time cache_mtime);
 
   bool SetMaxSize(int max_bytes);
   int max_size() const { return max_size_; }
diff --git a/net/disk_cache/simple/simple_index_file.cc b/net/disk_cache/simple/simple_index_file.cc
index ab79407..f25d376 100644
--- a/net/disk_cache/simple/simple_index_file.cc
+++ b/net/disk_cache/simple/simple_index_file.cc
@@ -37,24 +37,23 @@
 }
 
 void WriteToDiskInternal(const base::FilePath& index_filename,
+                         const base::FilePath& temp_index_filename,
                          scoped_ptr<Pickle> pickle,
                          const base::TimeTicks& start_time,
                          bool app_on_background) {
-  const base::FilePath temp_filename =
-      index_filename.DirName().AppendASCII("index_temp");
   int bytes_written = file_util::WriteFile(
-      temp_filename,
+      temp_index_filename,
       reinterpret_cast<const char*>(pickle->data()),
       pickle->size());
   DCHECK_EQ(bytes_written, implicit_cast<int>(pickle->size()));
   if (bytes_written != static_cast<int>(pickle->size())) {
     // TODO(felipeg): Add better error handling.
     LOG(ERROR) << "Could not write Simple Cache index to temporary file: "
-               << temp_filename.value();
-    base::DeleteFile(temp_filename, /* recursive = */ false);
+               << temp_index_filename.value();
+    base::DeleteFile(temp_index_filename, /* recursive = */ false);
   } else {
     // Swap temp and index_file.
-    bool result = base::ReplaceFile(temp_filename, index_filename, NULL);
+    bool result = base::ReplaceFile(temp_index_filename, index_filename, NULL);
     DCHECK(result);
   }
   if (app_on_background) {
@@ -72,6 +71,8 @@
 
 // static
 const char SimpleIndexFile::kIndexFileName[] = "the-real-index";
+// static
+const char SimpleIndexFile::kTempIndexFileName[] = "temp-index";
 
 SimpleIndexFile::IndexMetadata::IndexMetadata() :
     magic_number_(kSimpleIndexMagicNumber),
@@ -111,21 +112,28 @@
 SimpleIndexFile::SimpleIndexFile(
     base::SingleThreadTaskRunner* cache_thread,
     base::TaskRunner* worker_pool,
-    const base::FilePath& index_file_directory)
+    const base::FilePath& cache_directory)
     : cache_thread_(cache_thread),
       worker_pool_(worker_pool),
-      index_file_path_(index_file_directory.AppendASCII(kIndexFileName)) {
+      cache_directory_(cache_directory),
+      index_file_(cache_directory_.AppendASCII(kIndexFileName)),
+      temp_index_file_(cache_directory_.AppendASCII(kTempIndexFileName)) {
 }
 
 SimpleIndexFile::~SimpleIndexFile() {}
 
 void SimpleIndexFile::LoadIndexEntries(
+    base::Time cache_last_modified,
     scoped_refptr<base::SingleThreadTaskRunner> response_thread,
     const IndexCompletionCallback& completion_callback) {
   worker_pool_->PostTask(
       FROM_HERE,
       base::Bind(&SimpleIndexFile::SyncLoadIndexEntries,
-                 index_file_path_, response_thread, completion_callback));
+                 cache_last_modified,
+                 cache_directory_,
+                 index_file_,
+                 response_thread,
+                 completion_callback));
 }
 
 void SimpleIndexFile::WriteToDisk(const SimpleIndex::EntrySet& entry_set,
@@ -136,7 +144,8 @@
   scoped_ptr<Pickle> pickle = Serialize(index_metadata, entry_set);
   cache_thread_->PostTask(FROM_HERE, base::Bind(
       &WriteToDiskInternal,
-      index_file_path_,
+      index_file_,
+      temp_index_file_,
       base::Passed(&pickle),
       base::TimeTicks::Now(),
       app_on_background));
@@ -151,7 +160,7 @@
   worker_pool_->PostTaskAndReply(
       FROM_HERE,
       base::Bind(&SimpleSynchronousEntry::DoomEntrySet,
-                 base::Passed(entry_hashes.Pass()), index_file_path_.DirName(),
+                 base::Passed(entry_hashes.Pass()), cache_directory_,
                  result_p),
       base::Bind(&DoomEntrySetReply, base::Passed(result.Pass()),
                  reply_callback));
@@ -159,31 +168,53 @@
 
 // static
 void SimpleIndexFile::SyncLoadIndexEntries(
+    base::Time cache_last_modified,
+    const base::FilePath& cache_directory,
     const base::FilePath& index_file_path,
     scoped_refptr<base::SingleThreadTaskRunner> response_thread,
     const IndexCompletionCallback& completion_callback) {
-  // TODO(felipeg): probably could load a stale index and use it for something.
   scoped_ptr<SimpleIndex::EntrySet> index_file_entries;
-
   const bool index_file_exists = base::PathExists(index_file_path);
 
+  // Used in histograms. Please only add new values at the end.
+  enum {
+    INDEX_STATE_CORRUPT = 0,
+    INDEX_STATE_STALE = 1,
+    INDEX_STATE_FRESH = 2,
+    INDEX_STATE_FRESH_CONCURRENT_UPDATES = 3,
+    INDEX_STATE_MAX = 4,
+  } index_file_state;
+
   // Only load if the index is not stale.
-  const bool index_stale = IsIndexFileStale(index_file_path);
-  if (!index_stale) {
+  if (IsIndexFileStale(cache_last_modified, index_file_path)) {
+    index_file_state = INDEX_STATE_STALE;
+  } else {
+    index_file_state = INDEX_STATE_FRESH;
+    base::Time latest_dir_mtime;
+    if (simple_util::GetMTime(cache_directory, &latest_dir_mtime) &&
+        IsIndexFileStale(latest_dir_mtime, index_file_path)) {
+      // A file operation has updated the directory since we last looked at it
+      // during backend initialization.
+      index_file_state = INDEX_STATE_FRESH_CONCURRENT_UPDATES;
+    }
+
     const base::TimeTicks start = base::TimeTicks::Now();
     index_file_entries = SyncLoadFromDisk(index_file_path);
     UMA_HISTOGRAM_TIMES("SimpleCache.IndexLoadTime",
                         base::TimeTicks::Now() - start);
     UMA_HISTOGRAM_COUNTS("SimpleCache.IndexEntriesLoaded",
                          index_file_entries ? index_file_entries->size() : 0);
+    if (!index_file_entries)
+      index_file_state = INDEX_STATE_CORRUPT;
   }
-
-  UMA_HISTOGRAM_BOOLEAN("SimpleCache.IndexStale", index_stale);
+  UMA_HISTOGRAM_ENUMERATION("SimpleCache.IndexFileStateOnLoad",
+                            index_file_state,
+                            INDEX_STATE_MAX);
 
   bool force_index_flush = false;
   if (!index_file_entries) {
     const base::TimeTicks start = base::TimeTicks::Now();
-    index_file_entries = SyncRestoreFromDisk(index_file_path);
+    index_file_entries = SyncRestoreFromDisk(cache_directory, index_file_path);
     UMA_HISTOGRAM_MEDIUM_TIMES("SimpleCache.IndexRestoreTime",
                         base::TimeTicks::Now() - start);
     UMA_HISTOGRAM_COUNTS("SimpleCache.IndexEntriesRestored",
@@ -193,8 +224,6 @@
     // away, this might save us from having to restore again next time.
     force_index_flush = true;
   }
-  UMA_HISTOGRAM_BOOLEAN("SimpleCache.IndexCorrupt",
-                        (!index_stale && force_index_flush));
 
   // Used in histograms. Please only add new values at the end.
   enum {
@@ -313,6 +342,7 @@
 
 // static
 scoped_ptr<SimpleIndex::EntrySet> SimpleIndexFile::SyncRestoreFromDisk(
+    const base::FilePath& cache_directory,
     const base::FilePath& index_file_path) {
   LOG(INFO) << "Simple Cache Index is being restored from disk.";
 
@@ -326,7 +356,7 @@
 
   const int kFileSuffixLength = sizeof("_0") - 1;
   const base::FilePath::StringType file_pattern = FILE_PATH_LITERAL("*_[0-2]");
-  base::FileEnumerator enumerator(index_file_path.DirName(),
+  base::FileEnumerator enumerator(cache_directory,
                                   false /* recursive */,
                                   base::FileEnumerator::FILES,
                                   file_pattern);
@@ -372,18 +402,12 @@
 }
 
 // static
-bool SimpleIndexFile::IsIndexFileStale(const base::FilePath& index_filename) {
+bool SimpleIndexFile::IsIndexFileStale(base::Time cache_last_modified,
+                                       const base::FilePath& index_file_path) {
   base::Time index_mtime;
-  base::Time dir_mtime;
-  if (!simple_util::GetMTime(index_filename.DirName(), &dir_mtime))
+  if (!simple_util::GetMTime(index_file_path, &index_mtime))
     return true;
-  if (!simple_util::GetMTime(index_filename, &index_mtime))
-    return true;
-  // Index file last_modified must be equal to the directory last_modified since
-  // the last operation we do is ReplaceFile in the
-  // SimpleIndexFile::WriteToDisk().
-  // If not true, we need to restore the index.
-  return index_mtime < dir_mtime;
+  return index_mtime < cache_last_modified;
 }
 
 }  // namespace disk_cache
diff --git a/net/disk_cache/simple/simple_index_file.h b/net/disk_cache/simple/simple_index_file.h
index 5cb8c7e..e328bc1 100644
--- a/net/disk_cache/simple/simple_index_file.h
+++ b/net/disk_cache/simple/simple_index_file.h
@@ -69,11 +69,12 @@
 
   SimpleIndexFile(base::SingleThreadTaskRunner* cache_thread,
                   base::TaskRunner* worker_pool,
-                  const base::FilePath& index_file_directory);
+                  const base::FilePath& cache_directory);
   virtual ~SimpleIndexFile();
 
   // Get index entries based on current disk context.
   virtual void LoadIndexEntries(
+      base::Time cache_last_modified,
       scoped_refptr<base::SingleThreadTaskRunner> response_thread,
       const SimpleIndexFile::IndexCompletionCallback& completion_callback);
 
@@ -93,6 +94,8 @@
 
   // Synchronous (IO performing) implementation of LoadIndexEntries.
   static void SyncLoadIndexEntries(
+      base::Time cache_last_modified,
+      const base::FilePath& cache_directory,
       const base::FilePath& index_file_path,
       scoped_refptr<base::SingleThreadTaskRunner> response_thread,
       const SimpleIndexFile::IndexCompletionCallback& completion_callback);
@@ -116,10 +119,13 @@
   // Scan the index directory for entries, returning an EntrySet of all entries
   // found.
   static scoped_ptr<SimpleIndex::EntrySet> SyncRestoreFromDisk(
+      const base::FilePath& cache_directory,
       const base::FilePath& index_file_path);
 
-  // Determines if an index file is stale relative to the cache directory.
-  static bool IsIndexFileStale(const base::FilePath& index_filename);
+  // Determines if an index file is stale relative to the time of last
+  // modification of the cache directory.
+  static bool IsIndexFileStale(base::Time cache_last_modified,
+                               const base::FilePath& index_file_path);
 
   struct PickleHeader : public Pickle::Header {
     uint32 crc;
@@ -127,9 +133,12 @@
 
   const scoped_refptr<base::SingleThreadTaskRunner> cache_thread_;
   const scoped_refptr<base::TaskRunner> worker_pool_;
-  const base::FilePath index_file_path_;
+  const base::FilePath cache_directory_;
+  const base::FilePath index_file_;
+  const base::FilePath temp_index_file_;
 
   static const char kIndexFileName[];
+  static const char kTempIndexFileName[];
 
   DISALLOW_COPY_AND_ASSIGN(SimpleIndexFile);
 };
diff --git a/net/disk_cache/simple/simple_index_file_unittest.cc b/net/disk_cache/simple/simple_index_file_unittest.cc
index e2493f9..e1267fa 100644
--- a/net/disk_cache/simple/simple_index_file_unittest.cc
+++ b/net/disk_cache/simple/simple_index_file_unittest.cc
@@ -15,6 +15,7 @@
 #include "net/disk_cache/simple/simple_entry_format.h"
 #include "net/disk_cache/simple/simple_index.h"
 #include "net/disk_cache/simple/simple_index_file.h"
+#include "net/disk_cache/simple/simple_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 using base::Time;
@@ -57,7 +58,6 @@
  public:
   using SimpleIndexFile::Deserialize;
   using SimpleIndexFile::IsIndexFileStale;
-  using SimpleIndexFile::kIndexFileName;
   using SimpleIndexFile::Serialize;
 
   explicit WrappedSimpleIndexFile(const base::FilePath& index_file_directory)
@@ -66,6 +66,10 @@
                         index_file_directory) {}
   virtual ~WrappedSimpleIndexFile() {
   }
+
+  const base::FilePath& GetIndexFilePath() const {
+    return index_file_;
+  }
 };
 
 class SimpleIndexFileTest : public testing::Test {
@@ -143,41 +147,43 @@
 }
 
 TEST_F(SimpleIndexFileTest, IsIndexFileStale) {
-  base::ScopedTempDir temp_dir;
-  ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
+  base::ScopedTempDir cache_dir;
+  ASSERT_TRUE(cache_dir.CreateUniqueTempDir());
+  base::Time cache_mtime;
+  const base::FilePath cache_path = cache_dir.path();
 
-  const std::string kIndexFileName = "simple-index";
-  const base::FilePath index_path =
-      temp_dir.path().AppendASCII(kIndexFileName);
-  EXPECT_TRUE(WrappedSimpleIndexFile::IsIndexFileStale(index_path));
+  ASSERT_TRUE(simple_util::GetMTime(cache_path, &cache_mtime));
+  WrappedSimpleIndexFile simple_index_file(cache_path);
+  const base::FilePath& index_path = simple_index_file.GetIndexFilePath();
+  EXPECT_TRUE(WrappedSimpleIndexFile::IsIndexFileStale(cache_mtime,
+                                                       index_path));
   const std::string kDummyData = "nothing to be seen here";
   EXPECT_EQ(static_cast<int>(kDummyData.size()),
             file_util::WriteFile(index_path,
                                  kDummyData.data(),
                                  kDummyData.size()));
-  EXPECT_FALSE(WrappedSimpleIndexFile::IsIndexFileStale(index_path));
+  ASSERT_TRUE(simple_util::GetMTime(cache_path, &cache_mtime));
+  EXPECT_FALSE(WrappedSimpleIndexFile::IsIndexFileStale(cache_mtime,
+                                                        index_path));
 
   const base::Time past_time = base::Time::Now() -
       base::TimeDelta::FromSeconds(10);
   EXPECT_TRUE(file_util::TouchFile(index_path, past_time, past_time));
-  EXPECT_TRUE(file_util::TouchFile(temp_dir.path(), past_time, past_time));
-  EXPECT_FALSE(WrappedSimpleIndexFile::IsIndexFileStale(index_path));
+  EXPECT_TRUE(file_util::TouchFile(cache_path, past_time, past_time));
+  ASSERT_TRUE(simple_util::GetMTime(cache_path, &cache_mtime));
+  EXPECT_FALSE(WrappedSimpleIndexFile::IsIndexFileStale(cache_mtime,
+                                                        index_path));
+  const base::Time even_older =
+      past_time - base::TimeDelta::FromSeconds(10);
+  EXPECT_TRUE(file_util::TouchFile(index_path, even_older, even_older));
+  EXPECT_TRUE(WrappedSimpleIndexFile::IsIndexFileStale(cache_mtime,
+                                                       index_path));
 
-  EXPECT_EQ(static_cast<int>(kDummyData.size()),
-            file_util::WriteFile(temp_dir.path().AppendASCII("other_file"),
-                                 kDummyData.data(),
-                                 kDummyData.size()));
-
-  EXPECT_TRUE(WrappedSimpleIndexFile::IsIndexFileStale(index_path));
 }
 
 TEST_F(SimpleIndexFileTest, WriteThenLoadIndex) {
-  base::ScopedTempDir temp_dir;
-  ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
-
-  const base::FilePath index_path =
-      temp_dir.path().AppendASCII(WrappedSimpleIndexFile::kIndexFileName);
-  EXPECT_TRUE(WrappedSimpleIndexFile::IsIndexFileStale(index_path));
+  base::ScopedTempDir cache_dir;
+  ASSERT_TRUE(cache_dir.CreateUniqueTempDir());
 
   SimpleIndex::EntrySet entries;
   static const uint64 kHashes[] = { 11, 22, 33 };
@@ -192,19 +198,23 @@
 
   const uint64 kCacheSize = 456U;
   {
-    WrappedSimpleIndexFile simple_index_file(temp_dir.path());
+    WrappedSimpleIndexFile simple_index_file(cache_dir.path());
     simple_index_file.WriteToDisk(entries, kCacheSize,
                                   base::TimeTicks(), false);
     base::RunLoop().RunUntilIdle();
-    EXPECT_TRUE(base::PathExists(index_path));
+    EXPECT_TRUE(base::PathExists(simple_index_file.GetIndexFilePath()));
   }
 
-  WrappedSimpleIndexFile simple_index_file(temp_dir.path());
-  simple_index_file.LoadIndexEntries(base::MessageLoopProxy::current(),
-                                     GetCallback());
+  WrappedSimpleIndexFile simple_index_file2(cache_dir.path());
+  base::Time fake_cache_mtime;
+  ASSERT_TRUE(simple_util::GetMTime(simple_index_file2.GetIndexFilePath(),
+                                    &fake_cache_mtime));
+  simple_index_file2.LoadIndexEntries(fake_cache_mtime,
+                                      base::MessageLoopProxy::current(),
+                                      GetCallback());
   base::RunLoop().RunUntilIdle();
 
-  EXPECT_TRUE(base::PathExists(index_path));
+  EXPECT_TRUE(base::PathExists(simple_index_file2.GetIndexFilePath()));
   ASSERT_TRUE(callback_result());
   EXPECT_FALSE(callback_result()->force_index_flush);
   const SimpleIndex::EntrySet* read_entries =
@@ -217,21 +227,24 @@
 }
 
 TEST_F(SimpleIndexFileTest, LoadCorruptIndex) {
-  base::ScopedTempDir temp_dir;
-  ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
+  base::ScopedTempDir cache_dir;
+  ASSERT_TRUE(cache_dir.CreateUniqueTempDir());
 
-  const base::FilePath index_path =
-      temp_dir.path().AppendASCII(WrappedSimpleIndexFile::kIndexFileName);
-  EXPECT_TRUE(WrappedSimpleIndexFile::IsIndexFileStale(index_path));
+  WrappedSimpleIndexFile simple_index_file(cache_dir.path());
+  const base::FilePath& index_path = simple_index_file.GetIndexFilePath();
   const std::string kDummyData = "nothing to be seen here";
   EXPECT_EQ(static_cast<int>(kDummyData.size()),
             file_util::WriteFile(index_path,
                                  kDummyData.data(),
                                  kDummyData.size()));
-  EXPECT_FALSE(WrappedSimpleIndexFile::IsIndexFileStale(index_path));
+  base::Time fake_cache_mtime;
+  ASSERT_TRUE(simple_util::GetMTime(simple_index_file.GetIndexFilePath(),
+                                    &fake_cache_mtime));
+  EXPECT_FALSE(WrappedSimpleIndexFile::IsIndexFileStale(fake_cache_mtime,
+                                                        index_path));
 
-  WrappedSimpleIndexFile simple_index_file(temp_dir.path());
-  simple_index_file.LoadIndexEntries(base::MessageLoopProxy::current().get(),
+  simple_index_file.LoadIndexEntries(fake_cache_mtime,
+                                     base::MessageLoopProxy::current().get(),
                                      GetCallback());
   base::RunLoop().RunUntilIdle();
 
diff --git a/net/disk_cache/simple/simple_index_unittest.cc b/net/disk_cache/simple/simple_index_unittest.cc
index 24675c5..3c76d5e 100644
--- a/net/disk_cache/simple/simple_index_unittest.cc
+++ b/net/disk_cache/simple/simple_index_unittest.cc
@@ -54,6 +54,7 @@
         disk_writes_(0) {}
 
   virtual void LoadIndexEntries(
+      base::Time cache_last_modified,
       scoped_refptr<base::SingleThreadTaskRunner> response_thread,
       const SimpleIndexFile::IndexCompletionCallback&
           completion_callback) OVERRIDE {
@@ -111,7 +112,7 @@
     index_.reset(new SimpleIndex(NULL, base::FilePath(),
                                  index_file.PassAs<SimpleIndexFile>()));
 
-    index_->Initialize();
+    index_->Initialize(base::Time());
   }
 
   void WaitForTimeChange() {
diff --git a/net/disk_cache/simple/simple_synchronous_entry.cc b/net/disk_cache/simple/simple_synchronous_entry.cc
index 2b9c687..31ea4db 100644
--- a/net/disk_cache/simple/simple_synchronous_entry.cc
+++ b/net/disk_cache/simple/simple_synchronous_entry.cc
@@ -349,6 +349,12 @@
       Doom();
       break;
     }
+    const int64 file_size = file_offset + sizeof(eof_record);
+    UMA_HISTOGRAM_CUSTOM_COUNTS("SimpleCache.LastClusterSize",
+                                file_size % 4096, 0, 4097, 50);
+    const int64 cluster_loss = file_size % 4096 ? 4096 - file_size % 4096 : 0;
+    UMA_HISTOGRAM_PERCENTAGE("SimpleCache.LastClusterLossPercent",
+                             cluster_loss * 100 / (cluster_loss + file_size));
   }
 
   for (int i = 0; i < kSimpleEntryFileCount; ++i) {
diff --git a/net/dns/host_resolver_impl.cc b/net/dns/host_resolver_impl.cc
index 92694af..607386b 100644
--- a/net/dns/host_resolver_impl.cc
+++ b/net/dns/host_resolver_impl.cc
@@ -170,7 +170,7 @@
                         kSuffix, kSuffixLenTrimmed);
 }
 
-// Attempts to connect a UDP socket to |dest|:80.
+// Attempts to connect a UDP socket to |dest|:53.
 bool IsGloballyReachable(const IPAddressNumber& dest,
                          const BoundNetLog& net_log) {
   scoped_ptr<DatagramClientSocket> socket(
@@ -179,7 +179,7 @@
           RandIntCallback(),
           net_log.net_log(),
           net_log.source()));
-  int rv = socket->Connect(IPEndPoint(dest, 80));
+  int rv = socket->Connect(IPEndPoint(dest, 53));
   if (rv != OK)
     return false;
   IPEndPoint endpoint;
diff --git a/net/http_server.target.darwin-arm.mk b/net/http_server.target.darwin-arm.mk
index d6d2413..a4944d0 100644
--- a/net/http_server.target.darwin-arm.mk
+++ b/net/http_server.target.darwin-arm.mk
@@ -92,9 +92,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
@@ -176,9 +176,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
diff --git a/net/http_server.target.darwin-mips.mk b/net/http_server.target.darwin-mips.mk
index e295bb8..36a58b4 100644
--- a/net/http_server.target.darwin-mips.mk
+++ b/net/http_server.target.darwin-mips.mk
@@ -91,9 +91,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
@@ -174,9 +174,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
diff --git a/net/http_server.target.darwin-x86.mk b/net/http_server.target.darwin-x86.mk
index 51152a0..9d25987 100644
--- a/net/http_server.target.darwin-x86.mk
+++ b/net/http_server.target.darwin-x86.mk
@@ -93,9 +93,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
@@ -179,9 +179,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
diff --git a/net/http_server.target.linux-arm.mk b/net/http_server.target.linux-arm.mk
index d6d2413..a4944d0 100644
--- a/net/http_server.target.linux-arm.mk
+++ b/net/http_server.target.linux-arm.mk
@@ -92,9 +92,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
@@ -176,9 +176,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
diff --git a/net/http_server.target.linux-mips.mk b/net/http_server.target.linux-mips.mk
index e295bb8..36a58b4 100644
--- a/net/http_server.target.linux-mips.mk
+++ b/net/http_server.target.linux-mips.mk
@@ -91,9 +91,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
@@ -174,9 +174,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
diff --git a/net/http_server.target.linux-x86.mk b/net/http_server.target.linux-x86.mk
index 51152a0..9d25987 100644
--- a/net/http_server.target.linux-x86.mk
+++ b/net/http_server.target.linux-x86.mk
@@ -93,9 +93,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
@@ -179,9 +179,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
diff --git a/net/net.target.darwin-arm.mk b/net/net.target.darwin-arm.mk
index 80b79cc..e0c12c3 100644
--- a/net/net.target.darwin-arm.mk
+++ b/net/net.target.darwin-arm.mk
@@ -509,10 +509,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH)/third_party/openssl \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/third_party/openssl \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/sdch/open-vcdiff/src \
 	$(PWD)/external/icu4c/common \
@@ -603,10 +603,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH)/third_party/openssl \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/third_party/openssl \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/sdch/open-vcdiff/src \
 	$(PWD)/external/icu4c/common \
diff --git a/net/net.target.darwin-mips.mk b/net/net.target.darwin-mips.mk
index aa3545c..e8e7591 100644
--- a/net/net.target.darwin-mips.mk
+++ b/net/net.target.darwin-mips.mk
@@ -508,10 +508,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH)/third_party/openssl \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/third_party/openssl \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/sdch/open-vcdiff/src \
 	$(PWD)/external/icu4c/common \
@@ -601,10 +601,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH)/third_party/openssl \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/third_party/openssl \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/sdch/open-vcdiff/src \
 	$(PWD)/external/icu4c/common \
diff --git a/net/net.target.darwin-x86.mk b/net/net.target.darwin-x86.mk
index f297af5..a15345c 100644
--- a/net/net.target.darwin-x86.mk
+++ b/net/net.target.darwin-x86.mk
@@ -510,10 +510,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH)/third_party/openssl \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/third_party/openssl \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/sdch/open-vcdiff/src \
 	$(PWD)/external/icu4c/common \
@@ -606,10 +606,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH)/third_party/openssl \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/third_party/openssl \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/sdch/open-vcdiff/src \
 	$(PWD)/external/icu4c/common \
diff --git a/net/net.target.linux-arm.mk b/net/net.target.linux-arm.mk
index 80b79cc..e0c12c3 100644
--- a/net/net.target.linux-arm.mk
+++ b/net/net.target.linux-arm.mk
@@ -509,10 +509,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH)/third_party/openssl \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/third_party/openssl \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/sdch/open-vcdiff/src \
 	$(PWD)/external/icu4c/common \
@@ -603,10 +603,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH)/third_party/openssl \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/third_party/openssl \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/sdch/open-vcdiff/src \
 	$(PWD)/external/icu4c/common \
diff --git a/net/net.target.linux-mips.mk b/net/net.target.linux-mips.mk
index aa3545c..e8e7591 100644
--- a/net/net.target.linux-mips.mk
+++ b/net/net.target.linux-mips.mk
@@ -508,10 +508,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH)/third_party/openssl \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/third_party/openssl \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/sdch/open-vcdiff/src \
 	$(PWD)/external/icu4c/common \
@@ -601,10 +601,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH)/third_party/openssl \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/third_party/openssl \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/sdch/open-vcdiff/src \
 	$(PWD)/external/icu4c/common \
diff --git a/net/net.target.linux-x86.mk b/net/net.target.linux-x86.mk
index f297af5..a15345c 100644
--- a/net/net.target.linux-x86.mk
+++ b/net/net.target.linux-x86.mk
@@ -510,10 +510,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH)/third_party/openssl \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/third_party/openssl \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/sdch/open-vcdiff/src \
 	$(PWD)/external/icu4c/common \
@@ -606,10 +606,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH)/third_party/openssl \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/third_party/openssl \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/sdch/open-vcdiff/src \
 	$(PWD)/external/icu4c/common \
diff --git a/net/quic/quic_received_entropy_manager.cc b/net/quic/quic_received_entropy_manager.cc
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/net/quic/quic_received_entropy_manager.cc
diff --git a/net/quic/quic_received_entropy_manager.h b/net/quic/quic_received_entropy_manager.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/net/quic/quic_received_entropy_manager.h
diff --git a/net/quic/quic_received_entropy_manager_test.cc b/net/quic/quic_received_entropy_manager_test.cc
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/net/quic/quic_received_entropy_manager_test.cc
diff --git a/net/quic/quic_sent_entropy_manager.cc b/net/quic/quic_sent_entropy_manager.cc
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/net/quic/quic_sent_entropy_manager.cc
diff --git a/net/quic/quic_sent_entropy_manager.h b/net/quic/quic_sent_entropy_manager.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/net/quic/quic_sent_entropy_manager.h
diff --git a/net/quic/quic_sent_entropy_manager_test.cc b/net/quic/quic_sent_entropy_manager_test.cc
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/net/quic/quic_sent_entropy_manager_test.cc
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index ce5e0d3..6411313 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -554,8 +554,11 @@
   return OK;
 }
 
+// {,Try}CreateStream() and TryAccessStream() can be called with
+// |in_io_loop_| set if a stream is being created in response to
+// another being closed due to received data.
+
 Error SpdySession::TryAccessStream(const GURL& url) {
-  CHECK(!in_io_loop_);
   DCHECK_NE(availability_state_, STATE_CLOSED);
 
   if (is_secure_ && certificate_error_code_ != OK &&
@@ -575,7 +578,6 @@
 int SpdySession::TryCreateStream(SpdyStreamRequest* request,
                                  base::WeakPtr<SpdyStream>* stream) {
   CHECK(request);
-  CHECK(!in_io_loop_);
 
   if (availability_state_ == STATE_GOING_AWAY)
     return ERR_FAILED;
@@ -602,7 +604,6 @@
 
 int SpdySession::CreateStream(const SpdyStreamRequest& request,
                               base::WeakPtr<SpdyStream>* stream) {
-  CHECK(!in_io_loop_);
   DCHECK_GE(request.priority(), MINIMUM_PRIORITY);
   DCHECK_LT(request.priority(), NUM_PRIORITIES);
 
@@ -1033,21 +1034,22 @@
 void SpdySession::ResetStreamIterator(ActiveStreamMap::iterator it,
                                       SpdyRstStreamStatus status,
                                       const std::string& description) {
+  // Send the RST_STREAM frame first as CloseActiveStreamIterator()
+  // may close us.
   SpdyStreamId stream_id = it->first;
   RequestPriority priority = it->second.stream->priority();
+  EnqueueResetStreamFrame(stream_id, priority, status, description);
+
   // Removes any pending writes for the stream except for possibly an
   // in-flight one.
   CloseActiveStreamIterator(it, ERR_SPDY_PROTOCOL_ERROR);
-
-  SendResetStreamFrame(stream_id, priority, status, description);
 }
 
-void SpdySession::SendResetStreamFrame(SpdyStreamId stream_id,
-                                       RequestPriority priority,
-                                       SpdyRstStreamStatus status,
-                                       const std::string& description) {
+void SpdySession::EnqueueResetStreamFrame(SpdyStreamId stream_id,
+                                          RequestPriority priority,
+                                          SpdyRstStreamStatus status,
+                                          const std::string& description) {
   DCHECK_NE(stream_id, 0u);
-  DCHECK(active_streams_.find(stream_id) == active_streams_.end());
 
   net_log().AddEvent(
       NetLog::TYPE_SPDY_SESSION_SEND_RST_STREAM,
@@ -1394,7 +1396,11 @@
 void SpdySession::StartGoingAway(SpdyStreamId last_good_stream_id,
                                  Error status) {
   DCHECK_GE(availability_state_, STATE_GOING_AWAY);
+
   // The loops below are carefully written to avoid reentrancy problems.
+  //
+  // TODO(akalin): Any of the functions below can cause |this| to be
+  // deleted, so handle that below (and add tests for it).
 
   for (int i = 0; i < NUM_PRIORITIES; ++i) {
     PendingStreamRequestQueue queue;
@@ -1688,8 +1694,14 @@
 
   write_queue_.RemovePendingWritesForStream(stream->GetWeakPtr());
 
+  // |stream->OnClose()| may end up closing |this|, so detect that.
+  base::WeakPtr<SpdySession> weak_this = GetWeakPtr();
+
   stream->OnClose(status);
 
+  if (!weak_this)
+    return;
+
   switch (availability_state_) {
     case STATE_AVAILABLE:
       ProcessPendingStreamRequests();
@@ -1773,7 +1785,7 @@
   if (it == active_streams_.end()) {
     // We still want to send a frame to reset the stream even if we
     // don't know anything about it.
-    SendResetStreamFrame(
+    EnqueueResetStreamFrame(
         stream_id, IDLE, RST_STREAM_PROTOCOL_ERROR, description);
     return;
   }
@@ -1947,9 +1959,9 @@
   if (availability_state_ == STATE_GOING_AWAY) {
     // TODO(akalin): This behavior isn't in the SPDY spec, although it
     // probably should be.
-    SendResetStreamFrame(stream_id, request_priority,
-                         RST_STREAM_REFUSED_STREAM,
-                         "OnSyn received when going away");
+    EnqueueResetStreamFrame(stream_id, request_priority,
+                            RST_STREAM_REFUSED_STREAM,
+                            "OnSyn received when going away");
     return;
   }
 
@@ -1957,8 +1969,8 @@
     std::string description = base::StringPrintf(
         "Received invalid OnSyn associated stream id %d for stream %d",
         associated_stream_id, stream_id);
-    SendResetStreamFrame(stream_id, request_priority,
-                         RST_STREAM_REFUSED_STREAM, description);
+    EnqueueResetStreamFrame(stream_id, request_priority,
+                            RST_STREAM_REFUSED_STREAM, description);
     return;
   }
 
@@ -1969,8 +1981,9 @@
   // Verify that the response had a URL for us.
   GURL gurl = GetUrlFromHeaderBlock(headers, GetProtocolVersion(), true);
   if (!gurl.is_valid()) {
-    SendResetStreamFrame(stream_id, request_priority, RST_STREAM_PROTOCOL_ERROR,
-                         "Pushed stream url was invalid: " + gurl.spec());
+    EnqueueResetStreamFrame(
+        stream_id, request_priority, RST_STREAM_PROTOCOL_ERROR,
+        "Pushed stream url was invalid: " + gurl.spec());
     return;
   }
 
@@ -1978,7 +1991,7 @@
   ActiveStreamMap::iterator associated_it =
       active_streams_.find(associated_stream_id);
   if (associated_it == active_streams_.end()) {
-    SendResetStreamFrame(
+    EnqueueResetStreamFrame(
         stream_id, request_priority, RST_STREAM_INVALID_STREAM,
         base::StringPrintf(
             "Received OnSyn with inactive associated stream %d",
@@ -1992,7 +2005,7 @@
   if (trusted_spdy_proxy_.Equals(host_port_pair())) {
     // Disallow pushing of HTTPS content.
     if (gurl.SchemeIs("https")) {
-      SendResetStreamFrame(
+      EnqueueResetStreamFrame(
           stream_id, request_priority, RST_STREAM_REFUSED_STREAM,
           base::StringPrintf(
               "Rejected push of Cross Origin HTTPS content %d",
@@ -2001,7 +2014,7 @@
   } else {
     GURL associated_url(associated_it->second.stream->GetUrlFromHeaders());
     if (associated_url.GetOrigin() != gurl.GetOrigin()) {
-      SendResetStreamFrame(
+      EnqueueResetStreamFrame(
           stream_id, request_priority, RST_STREAM_REFUSED_STREAM,
           base::StringPrintf(
               "Rejected Cross Origin Push Stream %d",
@@ -2015,9 +2028,10 @@
       unclaimed_pushed_streams_.lower_bound(gurl);
   if (pushed_it != unclaimed_pushed_streams_.end() &&
       pushed_it->first == gurl) {
-    SendResetStreamFrame(stream_id, request_priority, RST_STREAM_PROTOCOL_ERROR,
-                         "Received duplicate pushed stream with url: " +
-                         gurl.spec());
+    EnqueueResetStreamFrame(
+        stream_id, request_priority, RST_STREAM_PROTOCOL_ERROR,
+        "Received duplicate pushed stream with url: " +
+        gurl.spec());
     return;
   }
 
diff --git a/net/spdy/spdy_session.h b/net/spdy/spdy_session.h
index 4965255..fedd701 100644
--- a/net/spdy/spdy_session.h
+++ b/net/spdy/spdy_session.h
@@ -590,17 +590,21 @@
   // stream may hold the last reference to the session.
   void CloseCreatedStreamIterator(CreatedStreamSet::iterator it, int status);
 
-  // Calls CloseActiveStreamIterator() and then SendResetStreamFrame().
+  // Calls EnqueueResetStreamFrame() and then
+  // CloseActiveStreamIterator().
   void ResetStreamIterator(ActiveStreamMap::iterator it,
                            SpdyRstStreamStatus status,
                            const std::string& description);
 
-  // Send a RST_STREAM frame with the given parameters. There must be
-  // no active stream with the given ID.
-  void SendResetStreamFrame(SpdyStreamId stream_id,
-                            RequestPriority priority,
-                            SpdyRstStreamStatus status,
-                            const std::string& description);
+  // Send a RST_STREAM frame with the given parameters. There should
+  // either be no active stream with the given ID, or that active
+  // stream should be closed shortly after this function is called.
+  //
+  // TODO(akalin): Rename this to EnqueueResetStreamFrame().
+  void EnqueueResetStreamFrame(SpdyStreamId stream_id,
+                               RequestPriority priority,
+                               SpdyRstStreamStatus status,
+                               const std::string& description);
 
   // Calls DoReadLoop and then if |availability_state_| is
   // STATE_CLOSED, calls RemoveFromPool().
diff --git a/net/spdy/spdy_session_unittest.cc b/net/spdy/spdy_session_unittest.cc
index 40028e7..f0e10eb 100644
--- a/net/spdy/spdy_session_unittest.cc
+++ b/net/spdy/spdy_session_unittest.cc
@@ -1833,6 +1833,83 @@
   EXPECT_TRUE(session == NULL);
 }
 
+// Delegate that closes a given session when the stream is closed.
+class SessionClosingDelegate : public test::StreamDelegateDoNothing {
+ public:
+  SessionClosingDelegate(const base::WeakPtr<SpdyStream>& stream,
+                         const base::WeakPtr<SpdySession>& session_to_close)
+      : StreamDelegateDoNothing(stream),
+        session_to_close_(session_to_close) {}
+
+  virtual ~SessionClosingDelegate() {}
+
+  virtual void OnClose(int status) OVERRIDE {
+    session_to_close_->CloseSessionOnError(ERR_ABORTED, "Aborted");
+  }
+
+ private:
+  base::WeakPtr<SpdySession> session_to_close_;
+};
+
+// Close an activated stream that closes its session. Nothing should
+// blow up. This is a regression test for http://crbug.com/263691 .
+TEST_P(SpdySessionTest, CloseActivatedStreamThatClosesSession) {
+  session_deps_.host_resolver->set_synchronous_mode(true);
+
+  MockConnect connect_data(SYNCHRONOUS, OK);
+
+  scoped_ptr<SpdyFrame> req(
+      spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, MEDIUM, true));
+  MockWrite writes[] = {
+    CreateMockWrite(*req, 0),
+  };
+
+  MockRead reads[] = {
+    MockRead(ASYNC, 0, 1)  // EOF
+  };
+  DeterministicSocketData data(reads, arraysize(reads),
+                               writes, arraysize(writes));
+  data.set_connect_data(connect_data);
+  session_deps_.deterministic_socket_factory->AddSocketDataProvider(&data);
+
+  SSLSocketDataProvider ssl(SYNCHRONOUS, OK);
+  session_deps_.deterministic_socket_factory->AddSSLSocketDataProvider(&ssl);
+
+  CreateDeterministicNetworkSession();
+
+  base::WeakPtr<SpdySession> session =
+      CreateInsecureSpdySession(http_session_, key_, BoundNetLog());
+
+  GURL url("http://www.google.com");
+  base::WeakPtr<SpdyStream> spdy_stream =
+      CreateStreamSynchronously(SPDY_REQUEST_RESPONSE_STREAM,
+                                session, url, MEDIUM, BoundNetLog());
+  ASSERT_TRUE(spdy_stream.get() != NULL);
+  EXPECT_EQ(0u, spdy_stream->stream_id());
+
+  SessionClosingDelegate delegate(spdy_stream, session);
+  spdy_stream->SetDelegate(&delegate);
+
+  scoped_ptr<SpdyHeaderBlock> headers(
+      spdy_util_.ConstructGetHeaderBlock(url.spec()));
+  spdy_stream->SendRequestHeaders(headers.Pass(), NO_MORE_DATA_TO_SEND);
+  EXPECT_TRUE(spdy_stream->HasUrlFromHeaders());
+
+  EXPECT_EQ(0u, spdy_stream->stream_id());
+
+  data.RunFor(1);
+
+  EXPECT_EQ(1u, spdy_stream->stream_id());
+
+  // Ensure we don't crash while closing the stream (which closes the
+  // session).
+  spdy_stream->Cancel();
+
+  EXPECT_EQ(NULL, spdy_stream.get());
+  EXPECT_TRUE(delegate.StreamIsClosed());
+  EXPECT_TRUE(session == NULL);
+}
+
 TEST_P(SpdySessionTest, VerifyDomainAuthentication) {
   session_deps_.host_resolver->set_synchronous_mode(true);
 
@@ -2829,6 +2906,91 @@
   EXPECT_FALSE(HasSpdySession(spdy_session_pool_, key_privacy_disabled));
 }
 
+// Delegate that creates another stream when its stream is closed.
+class StreamCreatingDelegate : public test::StreamDelegateDoNothing {
+ public:
+  StreamCreatingDelegate(const base::WeakPtr<SpdyStream>& stream,
+                         const base::WeakPtr<SpdySession>& session)
+      : StreamDelegateDoNothing(stream),
+        session_(session) {}
+
+  virtual ~StreamCreatingDelegate() {}
+
+  virtual void OnClose(int status) OVERRIDE {
+    GURL url("http://www.google.com");
+    ignore_result(
+        CreateStreamSynchronously(SPDY_REQUEST_RESPONSE_STREAM,
+                                  session_, url, MEDIUM, BoundNetLog()));
+  }
+
+ private:
+  const base::WeakPtr<SpdySession> session_;
+};
+
+// Create another stream in response to a stream being reset. Nothing
+// should blow up. This is a regression test for
+// http://crbug.com/263690 .
+TEST_P(SpdySessionTest, CreateStreamOnStreamReset) {
+  session_deps_.host_resolver->set_synchronous_mode(true);
+
+  MockConnect connect_data(SYNCHRONOUS, OK);
+
+  scoped_ptr<SpdyFrame> req(
+      spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, MEDIUM, true));
+  MockWrite writes[] = {
+    CreateMockWrite(*req, 0),
+  };
+
+  scoped_ptr<SpdyFrame> rst(
+      spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_REFUSED_STREAM));
+  MockRead reads[] = {
+    CreateMockRead(*rst, 1),
+    MockRead(ASYNC, 0, 2)  // EOF
+  };
+  DeterministicSocketData data(reads, arraysize(reads),
+                               writes, arraysize(writes));
+  data.set_connect_data(connect_data);
+  session_deps_.deterministic_socket_factory->AddSocketDataProvider(&data);
+
+  SSLSocketDataProvider ssl(SYNCHRONOUS, OK);
+  session_deps_.deterministic_socket_factory->AddSSLSocketDataProvider(&ssl);
+
+  CreateDeterministicNetworkSession();
+
+  base::WeakPtr<SpdySession> session =
+      CreateInsecureSpdySession(http_session_, key_, BoundNetLog());
+
+  GURL url("http://www.google.com");
+  base::WeakPtr<SpdyStream> spdy_stream =
+      CreateStreamSynchronously(SPDY_REQUEST_RESPONSE_STREAM,
+                                session, url, MEDIUM, BoundNetLog());
+  ASSERT_TRUE(spdy_stream.get() != NULL);
+  EXPECT_EQ(0u, spdy_stream->stream_id());
+
+  StreamCreatingDelegate delegate(spdy_stream, session);
+  spdy_stream->SetDelegate(&delegate);
+
+  scoped_ptr<SpdyHeaderBlock> headers(
+      spdy_util_.ConstructGetHeaderBlock(url.spec()));
+  spdy_stream->SendRequestHeaders(headers.Pass(), NO_MORE_DATA_TO_SEND);
+  EXPECT_TRUE(spdy_stream->HasUrlFromHeaders());
+
+  EXPECT_EQ(0u, spdy_stream->stream_id());
+
+  data.RunFor(1);
+
+  EXPECT_EQ(1u, spdy_stream->stream_id());
+
+  // Cause the stream to be reset, which should cause another stream
+  // to be created.
+  data.RunFor(1);
+
+  EXPECT_EQ(NULL, spdy_stream.get());
+  EXPECT_TRUE(delegate.StreamIsClosed());
+  EXPECT_EQ(0u, session->num_active_streams());
+  EXPECT_EQ(1u, session->num_created_streams());
+}
+
 // The tests below are only for SPDY/3 and above.
 
 TEST_P(SpdySessionTest, SendCredentials) {
diff --git a/net/spdy/spdy_stream.cc b/net/spdy/spdy_stream.cc
index 5b44fe8..63d6a68 100644
--- a/net/spdy/spdy_stream.cc
+++ b/net/spdy/spdy_stream.cc
@@ -134,10 +134,6 @@
   }
 }
 
-SpdyStream::Delegate* SpdyStream::GetDelegate() {
-  return delegate_;
-}
-
 void SpdyStream::PushedStreamReplayData() {
   DCHECK_EQ(type_, SPDY_PUSH_STREAM);
   DCHECK_NE(stream_id_, 0u);
diff --git a/net/spdy/spdy_stream.h b/net/spdy/spdy_stream.h
index 1db1217..06169d1 100644
--- a/net/spdy/spdy_stream.h
+++ b/net/spdy/spdy_stream.h
@@ -170,7 +170,6 @@
   // than once. For push streams, calling this may cause buffered data
   // to be sent to the delegate (from a posted task).
   void SetDelegate(Delegate* delegate);
-  Delegate* GetDelegate();
 
   // Detach the delegate from the stream, which must not yet be
   // closed, and cancel it.
diff --git a/net/test/embedded_test_server/http_response.cc b/net/test/embedded_test_server/http_response.cc
index 64bf3ec..04155b5 100644
--- a/net/test/embedded_test_server/http_response.cc
+++ b/net/test/embedded_test_server/http_response.cc
@@ -34,7 +34,7 @@
                       http_reason_phrase.c_str());
   base::StringAppendF(&response_builder, "Connection: close\r\n");
   base::StringAppendF(&response_builder,
-                      "Content-Length: %"PRIuS"\r\n",
+                      "Content-Length: %" PRIuS "\r\n",
                       content_.size());
   base::StringAppendF(&response_builder,
                       "Content-Type: %s\r\n",
diff --git a/net/tools/get_server_time/get_server_time.cc b/net/tools/get_server_time/get_server_time.cc
index a729c2f..3fe6129 100644
--- a/net/tools/get_server_time/get_server_time.cc
+++ b/net/tools/get_server_time/get_server_time.cc
@@ -274,7 +274,7 @@
 
   fetcher->Start();
   std::printf(
-      "Request started at %s (ticks = %"PRId64")\n",
+      "Request started at %s (ticks = %" PRId64 ")\n",
       UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime(start_time)).c_str(),
       start_ticks.ToInternalValue());
 
@@ -285,7 +285,7 @@
   const base::TimeTicks end_ticks = base::TimeTicks::Now();
 
   std::printf(
-      "Request ended at %s (ticks = %"PRId64")\n",
+      "Request ended at %s (ticks = %" PRId64 ")\n",
       UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime(end_time)).c_str(),
       end_ticks.ToInternalValue());
 
@@ -294,7 +294,7 @@
   const base::TimeDelta delta_ticks = end_ticks - start_ticks;
 
   std::printf(
-      "Request took %"PRId64" ticks (%.2f ms)\n",
+      "Request took %" PRId64 " ticks (%.2f ms)\n",
       delta_ticks_internal, delta_ticks.InMillisecondsF());
 
   const net::URLRequestStatus status = fetcher->GetStatus();
diff --git a/ppapi/native_client/src/trusted/plugin/file_downloader.cc b/ppapi/native_client/src/trusted/plugin/file_downloader.cc
index d7be3b4..5da04c6 100644
--- a/ppapi/native_client/src/trusted/plugin/file_downloader.cc
+++ b/ppapi/native_client/src/trusted/plugin/file_downloader.cc
@@ -150,7 +150,8 @@
   pp::CompletionCallback onload_callback =
       callback_factory_.NewCallback(start_notify);
   int32_t pp_error = url_loader_.Open(url_request, onload_callback);
-  PLUGIN_PRINTF(("FileDownloader::Open (pp_error=%"NACL_PRId32")\n", pp_error));
+  PLUGIN_PRINTF(("FileDownloader::Open (pp_error=%" NACL_PRId32 ")\n",
+                 pp_error));
   CHECK(pp_error == PP_OK_COMPLETIONPENDING);
   return true;
 }
@@ -250,17 +251,17 @@
   switch (url_scheme_) {
     case SCHEME_CHROME_EXTENSION:
       PLUGIN_PRINTF(("FileDownloader::InitialResponseIsValid (chrome-extension "
-                     "response status_code=%"NACL_PRId32")\n", status_code_));
+                     "response status_code=%" NACL_PRId32 ")\n", status_code_));
       status_ok = (status_code_ == kExtensionUrlRequestStatusOk);
       break;
     case SCHEME_DATA:
       PLUGIN_PRINTF(("FileDownloader::InitialResponseIsValid (data URI "
-                     "response status_code=%"NACL_PRId32")\n", status_code_));
+                     "response status_code=%" NACL_PRId32 ")\n", status_code_));
       status_ok = (status_code_ == kDataUriRequestStatusOk);
       break;
     case SCHEME_OTHER:
       PLUGIN_PRINTF(("FileDownloader::InitialResponseIsValid (HTTP response "
-                     "status_code=%"NACL_PRId32")\n", status_code_));
+                     "status_code=%" NACL_PRId32 ")\n", status_code_));
       status_ok = (status_code_ == NACL_HTTP_STATUS_OK);
       break;
   }
@@ -439,7 +440,7 @@
 
 void FileDownloader::StreamFinishNotify(int32_t pp_error) {
   PLUGIN_PRINTF((
-      "FileDownloader::StreamFinishNotify (pp_error=%"NACL_PRId32")\n",
+      "FileDownloader::StreamFinishNotify (pp_error=%" NACL_PRId32 ")\n",
       pp_error));
   stream_finish_callback_.RunAndClear(pp_error);
 }
diff --git a/ppapi/native_client/src/trusted/plugin/local_temp_file.cc b/ppapi/native_client/src/trusted/plugin/local_temp_file.cc
index bee15ee..15917e7 100644
--- a/ppapi/native_client/src/trusted/plugin/local_temp_file.cc
+++ b/ppapi/native_client/src/trusted/plugin/local_temp_file.cc
@@ -84,7 +84,7 @@
       pp::Module::Get()->GetBrowserInterface(PPB_FILEIOTRUSTED_INTERFACE));
   ++next_identifier;
   SNPRINTF(reinterpret_cast<char *>(identifier_), sizeof identifier_,
-           "%"NACL_PRIu32, next_identifier);
+           "%" NACL_PRIu32, next_identifier);
 }
 
 LocalTempFile::~LocalTempFile() {
@@ -116,7 +116,7 @@
 int32_t LocalTempFile::GetFD(int32_t pp_error,
                              const pp::Resource& resource,
                              bool is_writable) {
-  PLUGIN_PRINTF(("LocalTempFile::GetFD (pp_error=%"NACL_PRId32
+  PLUGIN_PRINTF(("LocalTempFile::GetFD (pp_error=%" NACL_PRId32
                  ", is_writable=%d)\n", pp_error, is_writable));
   if (pp_error != PP_OK) {
     PLUGIN_PRINTF(("LocalTempFile::GetFD pp_error != PP_OK\n"));
diff --git a/ppapi/native_client/src/trusted/plugin/module_ppapi.cc b/ppapi/native_client/src/trusted/plugin/module_ppapi.cc
index 7f26587..90fe0f1 100644
--- a/ppapi/native_client/src/trusted/plugin/module_ppapi.cc
+++ b/ppapi/native_client/src/trusted/plugin/module_ppapi.cc
@@ -70,7 +70,8 @@
   }
 
   virtual pp::Instance* CreateInstance(PP_Instance pp_instance) {
-    MODULE_PRINTF(("ModulePpapi::CreateInstance (pp_instance=%"NACL_PRId32")\n",
+    MODULE_PRINTF(("ModulePpapi::CreateInstance (pp_instance=%" NACL_PRId32
+                   ")\n",
                    pp_instance));
     Plugin* plugin = Plugin::New(pp_instance);
     MODULE_PRINTF(("ModulePpapi::CreateInstance (return %p)\n",
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.cc b/ppapi/native_client/src/trusted/plugin/plugin.cc
index 3c54c26..7146177 100644
--- a/ppapi/native_client/src/trusted/plugin/plugin.cc
+++ b/ppapi/native_client/src/trusted/plugin/plugin.cc
@@ -631,7 +631,7 @@
 
 
 Plugin* Plugin::New(PP_Instance pp_instance) {
-  PLUGIN_PRINTF(("Plugin::New (pp_instance=%"NACL_PRId32")\n", pp_instance));
+  PLUGIN_PRINTF(("Plugin::New (pp_instance=%" NACL_PRId32 ")\n", pp_instance));
   Plugin* plugin = new Plugin(pp_instance);
   PLUGIN_PRINTF(("Plugin::New (plugin=%p)\n", static_cast<void*>(plugin)));
   if (plugin == NULL) {
@@ -645,7 +645,7 @@
 // there is no need to log to JS console that there was an initialization
 // failure. Note that module loading functions will log their own errors.
 bool Plugin::Init(uint32_t argc, const char* argn[], const char* argv[]) {
-  PLUGIN_PRINTF(("Plugin::Init (argc=%"NACL_PRIu32")\n", argc));
+  PLUGIN_PRINTF(("Plugin::Init (argc=%" NACL_PRIu32 ")\n", argc));
   HistogramEnumerateOsArch(GetSandboxISA());
   init_time_ = NaClGetTimeOfDayMicroseconds();
 
@@ -740,7 +740,7 @@
       time_of_last_progress_event_(0),
       nacl_interface_(NULL) {
   PLUGIN_PRINTF(("Plugin::Plugin (this=%p, pp_instance=%"
-                 NACL_PRId32")\n", static_cast<void*>(this), pp_instance));
+                 NACL_PRId32 ")\n", static_cast<void*>(this), pp_instance));
   callback_factory_.Initialize(this);
   nexe_downloader_.Initialize(this);
   nacl_interface_ = GetNaClInterface();
@@ -844,10 +844,10 @@
 }
 
 void Plugin::NexeFileDidOpen(int32_t pp_error) {
-  PLUGIN_PRINTF(("Plugin::NexeFileDidOpen (pp_error=%"NACL_PRId32")\n",
+  PLUGIN_PRINTF(("Plugin::NexeFileDidOpen (pp_error=%" NACL_PRId32 ")\n",
                  pp_error));
   struct NaClFileInfo info = nexe_downloader_.GetFileInfo();
-  PLUGIN_PRINTF(("Plugin::NexeFileDidOpen (file_desc=%"NACL_PRId32")\n",
+  PLUGIN_PRINTF(("Plugin::NexeFileDidOpen (file_desc=%" NACL_PRId32 ")\n",
                  info.desc));
   HistogramHTTPStatusCode(
       is_installed_ ?
@@ -953,7 +953,7 @@
   size_t ix_start = 0;
   size_t ix_end;
 
-  PLUGIN_PRINTF(("Plugin::CopyCrashLogToJsConsole: got %"NACL_PRIuS" bytes\n",
+  PLUGIN_PRINTF(("Plugin::CopyCrashLogToJsConsole: got %" NACL_PRIuS " bytes\n",
                  fatal_msg.size()));
   while (nacl::string::npos != (ix_end = fatal_msg.find('\n', ix_start))) {
     LogLineToConsole(this, fatal_msg.substr(ix_start, ix_end - ix_start));
@@ -965,7 +965,7 @@
 }
 
 void Plugin::NexeDidCrash(int32_t pp_error) {
-  PLUGIN_PRINTF(("Plugin::NexeDidCrash (pp_error=%"NACL_PRId32")\n",
+  PLUGIN_PRINTF(("Plugin::NexeDidCrash (pp_error=%" NACL_PRId32 ")\n",
                  pp_error));
   if (pp_error != PP_OK) {
     PLUGIN_PRINTF(("Plugin::NexeDidCrash: CallOnMainThread callback with"
@@ -1012,7 +1012,7 @@
 }
 
 void Plugin::BitcodeDidTranslate(int32_t pp_error) {
-  PLUGIN_PRINTF(("Plugin::BitcodeDidTranslate (pp_error=%"NACL_PRId32")\n",
+  PLUGIN_PRINTF(("Plugin::BitcodeDidTranslate (pp_error=%" NACL_PRId32 ")\n",
                  pp_error));
   if (pp_error != PP_OK) {
     // Error should have been reported by pnacl. Just return.
@@ -1080,7 +1080,7 @@
 
 void Plugin::NaClManifestBufferReady(int32_t pp_error) {
   PLUGIN_PRINTF(("Plugin::NaClManifestBufferReady (pp_error=%"
-                 NACL_PRId32")\n", pp_error));
+                 NACL_PRId32 ")\n", pp_error));
   ErrorInfo error_info;
   set_manifest_url(nexe_downloader_.url());
   if (pp_error != PP_OK) {
@@ -1117,7 +1117,7 @@
 
 void Plugin::NaClManifestFileDidOpen(int32_t pp_error) {
   PLUGIN_PRINTF(("Plugin::NaClManifestFileDidOpen (pp_error=%"
-                 NACL_PRId32")\n", pp_error));
+                 NACL_PRId32 ")\n", pp_error));
   HistogramTimeSmall("NaCl.Perf.StartupTime.ManifestDownload",
                      nexe_downloader_.TimeSinceOpenMilliseconds());
   HistogramHTTPStatusCode(
@@ -1131,7 +1131,7 @@
   set_manifest_url(nexe_downloader_.url());
   struct NaClFileInfo info = nexe_downloader_.GetFileInfo();
   PLUGIN_PRINTF(("Plugin::NaClManifestFileDidOpen (file_desc=%"
-                 NACL_PRId32")\n", info.desc));
+                 NACL_PRId32 ")\n", info.desc));
   if (pp_error != PP_OK || info.desc == NACL_NO_FILE_DESC) {
     if (pp_error == PP_ERROR_ABORTED) {
       ReportLoadAbort();
@@ -1313,7 +1313,7 @@
 void Plugin::UrlDidOpenForStreamAsFile(int32_t pp_error,
                                        FileDownloader*& url_downloader,
                                        PP_CompletionCallback callback) {
-  PLUGIN_PRINTF(("Plugin::UrlDidOpen (pp_error=%"NACL_PRId32
+  PLUGIN_PRINTF(("Plugin::UrlDidOpen (pp_error=%" NACL_PRId32
                  ", url_downloader=%p)\n", pp_error,
                  static_cast<void*>(url_downloader)));
   url_downloaders_.erase(url_downloader);
@@ -1513,7 +1513,7 @@
                                   uint64_t total_bytes) {
   PLUGIN_PRINTF(("Plugin::EnqueueProgressEvent ("
                  "event_type='%s', url='%s', length_computable=%d, "
-                 "loaded=%"NACL_PRIu64", total=%"NACL_PRIu64")\n",
+                 "loaded=%" NACL_PRIu64 ", total=%" NACL_PRIu64 ")\n",
                  event_type,
                  url.c_str(),
                  static_cast<int>(length_computable),
@@ -1541,7 +1541,7 @@
 
 void Plugin::DispatchProgressEvent(int32_t result) {
   PLUGIN_PRINTF(("Plugin::DispatchProgressEvent (result=%"
-                 NACL_PRId32")\n", result));
+                 NACL_PRId32 ")\n", result));
   if (result < 0) {
     return;
   }
@@ -1553,7 +1553,7 @@
   progress_events_.pop();
   PLUGIN_PRINTF(("Plugin::DispatchProgressEvent ("
                  "event_type='%s', url='%s', length_computable=%d, "
-                 "loaded=%"NACL_PRIu64", total=%"NACL_PRIu64")\n",
+                 "loaded=%" NACL_PRIu64 ", total=%" NACL_PRIu64 ")\n",
                  event->event_type(),
                  event->url(),
                  static_cast<int>(event->length_computable()),
diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc
index f446961..f22cfa4 100644
--- a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc
+++ b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc
@@ -341,7 +341,7 @@
 // Signal that Pnacl translation completed normally.
 void PnaclCoordinator::TranslateFinished(int32_t pp_error) {
   PLUGIN_PRINTF(("PnaclCoordinator::TranslateFinished (pp_error=%"
-                 NACL_PRId32")\n", pp_error));
+                 NACL_PRId32 ")\n", pp_error));
   // Bail out if there was an earlier error (e.g., pexe load failure).
   if (translate_finish_error_ != PP_OK) {
     ExitWithError();
@@ -475,7 +475,7 @@
   }
   if (num_read < 0) {
     PLUGIN_PRINTF(("PnaclCoordinator::CachedNexeOpenedForWrite read failed "
-                   "(error=%"NACL_PRId32")\n", num_read));
+                   "(error=%" NACL_PRId32 ")\n", num_read));
     NexeWasCopiedToCache(PP_ERROR_FAILED);
     return;
   }
@@ -488,8 +488,8 @@
                                                  int32_t num_read_prev,
                                                  int64_t cur_offset) {
   PLUGIN_PRINTF(("PnaclCoordinator::DidCopyNexeToCachePartial "
-                 "(pp_error=%"NACL_PRId32", num_read_prev=%"NACL_PRId32""
-                 ", cur_offset=%"NACL_PRId64").\n",
+                 "(pp_error=%" NACL_PRId32 ", num_read_prev=%" NACL_PRId32
+                 ", cur_offset=%" NACL_PRId64 ").\n",
                  pp_error, num_read_prev, cur_offset));
   // Assume we are done.
   if (pp_error == PP_OK) {
@@ -498,7 +498,7 @@
   }
   if (pp_error < PP_OK) {
     PLUGIN_PRINTF(("PnaclCoordinator::DidCopyNexeToCachePartial failed (err=%"
-                   NACL_PRId32")\n", pp_error));
+                   NACL_PRId32 ")\n", pp_error));
     NexeWasCopiedToCache(pp_error);
     return;
   }
@@ -507,15 +507,15 @@
   nacl::DescWrapper* read_wrapper = temp_nexe_file_->read_wrapper();
   if (pp_error != num_read_prev) {
     PLUGIN_PRINTF(("PnaclCoordinator::DidCopyNexeToCachePartial partial "
-                   "write (bytes_written=%"NACL_PRId32" vs "
-                   "read=%"NACL_PRId32")\n", pp_error, num_read_prev));
+                   "write (bytes_written=%" NACL_PRId32 " vs "
+                   "read=%" NACL_PRId32 ")\n", pp_error, num_read_prev));
     CHECK(pp_error < num_read_prev);
     // Seek back to re-read the bytes that were not written.
     nacl_off64_t seek_result =
         read_wrapper->Seek(pp_error - num_read_prev, SEEK_CUR);
     if (seek_result < 0) {
       PLUGIN_PRINTF(("PnaclCoordinator::DidCopyNexeToCachePartial seek failed "
-                     "(err=%"NACL_PRId64")\n", seek_result));
+                     "(err=%" NACL_PRId64 ")\n", seek_result));
       NexeWasCopiedToCache(PP_ERROR_FAILED);
       return;
     }
@@ -526,7 +526,7 @@
   int32_t num_read =
     nacl::assert_cast<int32_t>(read_wrapper->Read(buf, sizeof buf));
   PLUGIN_PRINTF(("PnaclCoordinator::DidCopyNexeToCachePartial read (bytes=%"
-                 NACL_PRId32")\n", num_read));
+                 NACL_PRId32 ")\n", num_read));
   // Hit EOF or something.
   if (num_read == 0) {
     NexeWasCopiedToCache(PP_OK);
@@ -534,14 +534,14 @@
   }
   if (num_read < 0) {
     PLUGIN_PRINTF(("PnaclCoordinator::DidCopyNexeToCachePartial read failed "
-                   "(error=%"NACL_PRId32")\n", num_read));
+                   "(error=%" NACL_PRId32 ")\n", num_read));
     NexeWasCopiedToCache(PP_ERROR_FAILED);
     return;
   }
   pp::CompletionCallback cb = callback_factory_.NewCallback(
       &PnaclCoordinator::DidCopyNexeToCachePartial, num_read, next_offset);
   PLUGIN_PRINTF(("PnaclCoordinator::CopyNexeToCache Writing ("
-                 "bytes=%"NACL_PRId32", buf=%p, file_io=%p)\n", num_read, buf,
+                 "bytes=%" NACL_PRId32 ", buf=%p, file_io=%p)\n", num_read, buf,
                  cached_nexe_file_->write_file_io()));
   cached_nexe_file_->write_file_io()->Write(next_offset, buf, num_read, cb);
 }
@@ -568,7 +568,7 @@
     // The cache file was certainly already opened by the time we tried
     // to write to it, so it should certainly be deletable.
     PLUGIN_PRINTF(("PnaclCoordinator::CorruptCacheFileWasDeleted "
-                   "delete failed with pp_error=%"NACL_PRId32"\n",
+                   "delete failed with pp_error=%" NACL_PRId32 "\n",
                    delete_pp_error));
     // fall through and report the original error.
   }
@@ -594,7 +594,7 @@
 
 void PnaclCoordinator::NexeFileWasRenamed(int32_t pp_error) {
   PLUGIN_PRINTF(("PnaclCoordinator::NexeFileWasRenamed (pp_error=%"
-                 NACL_PRId32")\n", pp_error));
+                 NACL_PRId32 ")\n", pp_error));
   if (pp_error != PP_OK) {
     if (pp_error == PP_ERROR_NOACCESS) {
       ReportPpapiError(ERROR_PNACL_CACHE_FINALIZE_RENAME_NOACCESS,
@@ -635,7 +635,7 @@
 
 void PnaclCoordinator::NexeReadDidOpen(int32_t pp_error) {
   PLUGIN_PRINTF(("PnaclCoordinator::NexeReadDidOpen (pp_error=%"
-                 NACL_PRId32")\n", pp_error));
+                 NACL_PRId32 ")\n", pp_error));
   if (pp_error != PP_OK) {
     if (pp_error == PP_ERROR_FILENOTFOUND) {
       ReportPpapiError(ERROR_PNACL_CACHE_FETCH_NOTFOUND,
@@ -666,7 +666,7 @@
 
 void PnaclCoordinator::ResourceInfoWasRead(int32_t pp_error) {
   PLUGIN_PRINTF(("PluginCoordinator::ResourceInfoWasRead (pp_error=%"
-                NACL_PRId32")\n", pp_error));
+                NACL_PRId32 ")\n", pp_error));
   // Second step of loading resources: call StartLoad.
   pp::CompletionCallback resources_cb =
       callback_factory_.NewCallback(&PnaclCoordinator::ResourcesDidLoad);
@@ -675,7 +675,7 @@
 
 void PnaclCoordinator::ResourcesDidLoad(int32_t pp_error) {
   PLUGIN_PRINTF(("PnaclCoordinator::ResourcesDidLoad (pp_error=%"
-                 NACL_PRId32")\n", pp_error));
+                 NACL_PRId32 ")\n", pp_error));
   if (pp_error != PP_OK) {
     // Finer-grained error code should have already been reported by
     // the PnaclResources class.
@@ -717,7 +717,7 @@
 
 void PnaclCoordinator::FileSystemDidOpen(int32_t pp_error) {
   PLUGIN_PRINTF(("PnaclCoordinator::FileSystemDidOpen (pp_error=%"
-                 NACL_PRId32")\n", pp_error));
+                 NACL_PRId32 ")\n", pp_error));
   if (pp_error != PP_OK) {
     if (pp_error == PP_ERROR_NOACCESS) {
       ReportPpapiError(
@@ -756,7 +756,7 @@
 
 void PnaclCoordinator::DirectoryWasCreated(int32_t pp_error) {
   PLUGIN_PRINTF(("PnaclCoordinator::DirectoryWasCreated (pp_error=%"
-                 NACL_PRId32")\n", pp_error));
+                 NACL_PRId32 ")\n", pp_error));
   if (pp_error != PP_ERROR_FILEEXISTS && pp_error != PP_OK) {
     // Directory did not exist and could not be created.
     if (pp_error == PP_ERROR_NOACCESS) {
@@ -878,7 +878,7 @@
 
 void PnaclCoordinator::NexeFdDidOpen(int32_t pp_error) {
   PLUGIN_PRINTF(("PnaclCoordinator::NexeFdDidOpen (pp_error=%"
-                 NACL_PRId32", hit=%d, handle=%d)\n", pp_error,
+                 NACL_PRId32 ", hit=%d, handle=%d)\n", pp_error,
                  is_cache_hit_ == PP_TRUE,
                  nexe_handle_));
   if (pp_error < PP_OK) {
@@ -923,7 +923,7 @@
 
 void PnaclCoordinator::CachedFileDidOpen(int32_t pp_error) {
   PLUGIN_PRINTF(("PnaclCoordinator::CachedFileDidOpen (pp_error=%"
-                 NACL_PRId32")\n", pp_error));
+                 NACL_PRId32 ")\n", pp_error));
   if (pp_error == PP_OK) {
     // Cache hit -- no need to stream the rest of the file.
     streaming_downloader_.reset(NULL);
@@ -942,7 +942,7 @@
 
 void PnaclCoordinator::BitcodeStreamDidFinish(int32_t pp_error) {
   PLUGIN_PRINTF(("PnaclCoordinator::BitcodeStreamDidFinish (pp_error=%"
-                 NACL_PRId32")\n", pp_error));
+                 NACL_PRId32 ")\n", pp_error));
   if (pp_error != PP_OK) {
     // Defer reporting the error and cleanup until after the translation
     // thread returns, because it may be accessing the coordinator's
@@ -971,7 +971,7 @@
 void PnaclCoordinator::BitcodeStreamGotData(int32_t pp_error,
                                             FileStreamData data) {
   PLUGIN_PRINTF(("PnaclCoordinator::BitcodeStreamGotData (pp_error=%"
-                 NACL_PRId32", data=%p)\n", pp_error, data ? &(*data)[0] : 0));
+                 NACL_PRId32 ", data=%p)\n", pp_error, data ? &(*data)[0] : 0));
   DCHECK(translate_thread_.get());
 
   translate_thread_->PutBytes(data, pp_error);
@@ -1029,7 +1029,7 @@
 
 void PnaclCoordinator::ObjectFileDidOpen(int32_t pp_error) {
   PLUGIN_PRINTF(("PnaclCoordinator::ObjectFileDidOpen (pp_error=%"
-                 NACL_PRId32")\n", pp_error));
+                 NACL_PRId32 ")\n", pp_error));
   if (pp_error != PP_OK) {
     ReportPpapiError(ERROR_PNACL_CREATE_TEMP,
                      pp_error,
@@ -1049,7 +1049,7 @@
 
 void PnaclCoordinator::RunTranslate(int32_t pp_error) {
   PLUGIN_PRINTF(("PnaclCoordinator::RunTranslate (pp_error=%"
-                 NACL_PRId32")\n", pp_error));
+                 NACL_PRId32 ")\n", pp_error));
   // Invoke llc followed by ld off the main thread.  This allows use of
   // blocking RPCs that would otherwise block the JavaScript main thread.
   pp::CompletionCallback report_translate_finished =
diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc b/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc
index 2df7457..b27bad1 100644
--- a/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc
+++ b/ppapi/native_client/src/trusted/plugin/pnacl_translate_thread.cc
@@ -73,7 +73,8 @@
 // Called from main thread to send bytes to the translator.
 void PnaclTranslateThread::PutBytes(std::vector<char>* bytes,
                                              int count) {
-  PLUGIN_PRINTF(("PutBytes (this=%p, bytes=%p, size=%"NACL_PRIuS", count=%d)\n",
+  PLUGIN_PRINTF(("PutBytes (this=%p, bytes=%p, size=%" NACL_PRIuS
+                 ", count=%d)\n",
                  this, bytes, bytes ? bytes->size() : 0, count));
   size_t buffer_size = 0;
   // If we are done (error or not), Signal the translation thread to stop.
@@ -185,7 +186,8 @@
     while(!done_ && data_buffers_.size() == 0) {
       NaClXCondVarWait(&buffer_cond_, &cond_mu_);
     }
-    PLUGIN_PRINTF(("PnaclTranslateThread awake (done=%d, size=%"NACL_PRIuS")\n",
+    PLUGIN_PRINTF(("PnaclTranslateThread awake (done=%d, size=%" NACL_PRIuS
+                   ")\n",
                    done_, data_buffers_.size()));
     if (data_buffers_.size() > 0) {
       std::vector<char> data;
diff --git a/ppapi/native_client/src/trusted/plugin/scriptable_plugin.cc b/ppapi/native_client/src/trusted/plugin/scriptable_plugin.cc
index 99144b5..5e39567 100644
--- a/ppapi/native_client/src/trusted/plugin/scriptable_plugin.cc
+++ b/ppapi/native_client/src/trusted/plugin/scriptable_plugin.cc
@@ -208,7 +208,7 @@
 pp::Var ScriptablePlugin::Call(const pp::Var& name,
                                const std::vector<pp::Var>& args,
                                pp::Var* exception) {
-  PLUGIN_PRINTF(("ScriptablePlugin::Call (name=%s, %"NACL_PRIuS
+  PLUGIN_PRINTF(("ScriptablePlugin::Call (name=%s, %" NACL_PRIuS
                  " args)\n", name.DebugString().c_str(), args.size()));
   return Error("Call", name.DebugString().c_str(),
                "method invocation is not supported", exception);
@@ -217,7 +217,7 @@
 
 pp::Var ScriptablePlugin::Construct(const std::vector<pp::Var>& args,
                                     pp::Var* exception) {
-  PLUGIN_PRINTF(("ScriptablePlugin::Construct (%"NACL_PRIuS
+  PLUGIN_PRINTF(("ScriptablePlugin::Construct (%" NACL_PRIuS
                  " args)\n", args.size()));
   return Error("constructor", "Construct", "constructor is not supported",
                exception);
diff --git a/ppapi/native_client/src/trusted/plugin/service_runtime.cc b/ppapi/native_client/src/trusted/plugin/service_runtime.cc
index f908f8b..2b43b2e 100644
--- a/ppapi/native_client/src/trusted/plugin/service_runtime.cc
+++ b/ppapi/native_client/src/trusted/plugin/service_runtime.cc
@@ -537,8 +537,8 @@
     int32_t err) {
   NaClLog(4,
           "PluginReverseInterface::QuotaRequest_MainThreadResponse:"
-          " (resource=%"NACL_PRIx32", offset=%"NACL_PRId64", requested=%"
-          NACL_PRId64", err=%"NACL_PRId32")\n",
+          " (resource=%" NACL_PRIx32 ", offset=%" NACL_PRId64 ", requested=%"
+          NACL_PRId64 ", err=%" NACL_PRId32 ")\n",
           request->data.resource,
           request->offset, request->bytes_requested, err);
   nacl::MutexLocker take(&mu_);
@@ -556,8 +556,8 @@
     nacl::string file_id, int64_t offset, int64_t bytes_to_write) {
   NaClLog(4,
           "PluginReverseInterface::RequestQuotaForWrite:"
-          " (file_id='%s', offset=%"NACL_PRId64", bytes_to_write=%"
-          NACL_PRId64")\n", file_id.c_str(), offset, bytes_to_write);
+          " (file_id='%s', offset=%" NACL_PRId64 ", bytes_to_write=%"
+          NACL_PRId64 ")\n", file_id.c_str(), offset, bytes_to_write);
   QuotaData quota_data;
   {
     nacl::MutexLocker take(&mu_);
@@ -605,7 +605,7 @@
   PP_Resource resource = file_io.pp_resource();
   NaClLog(4,
           "PluginReverseInterface::AddQuotaManagedFile: "
-          "(file_id='%s', file_io_ref=%"NACL_PRIx32")\n",
+          "(file_id='%s', file_io_ref=%" NACL_PRIx32 ")\n",
           file_id.c_str(), resource);
   nacl::MutexLocker take(&mu_);
   uint64_t file_key = STRTOULL(file_id.c_str(), NULL, 10);
@@ -670,7 +670,7 @@
   }
   //  Get connection capability to service runtime where the IMC
   //  server/SRPC client is waiting for a rendezvous.
-  NaClLog(4, "ServiceRuntime: got 0x%"NACL_PRIxPTR"\n",
+  NaClLog(4, "ServiceRuntime: got 0x%" NACL_PRIxPTR "\n",
           (uintptr_t) out_conn_cap);
   nacl::DescWrapper* conn_cap = plugin_->wrapper_factory()->MakeGenericCleanup(
       out_conn_cap);
diff --git a/ppapi/native_client/src/trusted/plugin/temporary_file.cc b/ppapi/native_client/src/trusted/plugin/temporary_file.cc
index ac02db2..46167a1 100644
--- a/ppapi/native_client/src/trusted/plugin/temporary_file.cc
+++ b/ppapi/native_client/src/trusted/plugin/temporary_file.cc
@@ -30,7 +30,7 @@
   PLUGIN_PRINTF(("TempFile::TempFile\n"));
   ++next_identifier;
   SNPRINTF(reinterpret_cast<char *>(identifier_), sizeof identifier_,
-           "%"NACL_PRIu32, next_identifier);
+           "%" NACL_PRIu32, next_identifier);
 }
 
 TempFile::~TempFile() {
diff --git a/ppapi/native_client/src/trusted/plugin/utility.h b/ppapi/native_client/src/trusted/plugin/utility.h
index e670d8c..6b9b27e 100644
--- a/ppapi/native_client/src/trusted/plugin/utility.h
+++ b/ppapi/native_client/src/trusted/plugin/utility.h
@@ -44,7 +44,7 @@
 #define PLUGIN_PRINTF(args) do {                                      \
     INIT_PLUGIN_LOGGING();                                            \
     if (0 != ::plugin::gNaClPluginDebugPrintEnabled) {                \
-      ::plugin::NaClPluginPrintLog("PLUGIN %"NACL_PRIu64": ",         \
+      ::plugin::NaClPluginPrintLog("PLUGIN %" NACL_PRIu64 ": ",       \
                                    NaClGetTimeOfDayMicroseconds());   \
       ::plugin::NaClPluginPrintLog args;                              \
     }                                                                 \
diff --git a/ppapi/native_client/src/trusted/weak_ref/call_on_main_thread.h b/ppapi/native_client/src/trusted/weak_ref/call_on_main_thread.h
index 6daeba4..a618795 100644
--- a/ppapi/native_client/src/trusted/weak_ref/call_on_main_thread.h
+++ b/ppapi/native_client/src/trusted/weak_ref/call_on_main_thread.h
@@ -165,8 +165,8 @@
         data_(raw_data) {}
   void Invoke(int32_t err) {
     NaClLog2(kPpWeakRefModuleName, 4,
-             ("WeakRefMemberFuncBinder: Invoke obj 0x%"NACL_PRIxPTR
-              ", err%"NACL_PRId32"\n"),
+             ("WeakRefMemberFuncBinder: Invoke obj 0x%" NACL_PRIxPTR
+              ", err%" NACL_PRId32 "\n"),
              reinterpret_cast<uintptr_t>(object_), err);
     (object_->*raw_callback_fn_)(data_.get(), err);
     NaClLog2(kPpWeakRefModuleName, 4,
@@ -182,7 +182,7 @@
 void WeakRefMemberFuncInvoker(
     WeakRefMemberFuncBinder<R, E> *binder, int32_t err) {
   NaClLog2(kPpWeakRefModuleName, 4,
-           "WeakRefMemberFuncInvoker: %"NACL_PRIxPTR" %"NACL_PRId32"\n",
+           "WeakRefMemberFuncInvoker: %" NACL_PRIxPTR " %" NACL_PRId32 "\n",
            (uintptr_t) binder,
            err);
   binder->Invoke(err);
@@ -210,7 +210,7 @@
   NaClLog2(kPpWeakRefModuleName, 4,
            "Entered WeakRefNewCallback\n");
   NaClLog2(kPpWeakRefModuleName, 4,
-           "object 0x%"NACL_PRIxPTR"\n",
+           "object 0x%" NACL_PRIxPTR "\n",
            reinterpret_cast<uintptr_t>(object));
   WeakRefMemberFuncBinder<R, E>* binder =
       new WeakRefMemberFuncBinder<R, E>(object,
@@ -218,7 +218,7 @@
                                         raw_data);
   CHECK(binder != NULL);
   NaClLog2(kPpWeakRefModuleName, 4,
-           "WeakRefNewCallback: binder %"NACL_PRIxPTR"\n",
+           "WeakRefNewCallback: binder %" NACL_PRIxPTR "\n",
            (uintptr_t) binder);
   void (*weak_ref_member_func_invoker_ptr)(
       WeakRefMemberFuncBinder<R, E>* binder,
diff --git a/ppapi/ppapi_internal.gyp b/ppapi/ppapi_internal.gyp
index 845a84a..08c1579 100644
--- a/ppapi/ppapi_internal.gyp
+++ b/ppapi/ppapi_internal.gyp
@@ -50,8 +50,6 @@
         '../gpu/gpu.gyp:gles2_implementation',
         '../media/media.gyp:shared_memory_support',
         '../skia/skia.gyp:skia',
-        # TODO(ananta) : The WebKit dependency needs to move to a new target for NACL.
-        '../third_party/WebKit/public/blink.gyp:blink',
         '../third_party/icu/icu.gyp:icuuc',
         '../ui/surface/surface.gyp:surface',
         '../url/url.gyp:url_lib',
@@ -59,7 +57,6 @@
       ],
       'export_dependent_settings': [
         '../base/base.gyp:base',
-        '../third_party/WebKit/public/blink.gyp:blink',
       ],
       'conditions': [
         ['OS=="mac"', {
@@ -69,6 +66,21 @@
             ],
           },
         }],
+        ['chrome_multiple_dll==1', {
+          'dependencies': [
+            '../third_party/WebKit/public/blink.gyp:blink_minimal',
+          ],
+          'export_dependent_settings': [
+            '../third_party/WebKit/public/blink.gyp:blink_minimal',
+          ],
+        }, {
+          'dependencies': [
+            '../third_party/WebKit/public/blink.gyp:blink',
+          ],
+          'export_dependent_settings': [
+            '../third_party/WebKit/public/blink.gyp:blink',
+          ],
+        }],
       ],
       # Disable c4267 warnings until we fix size_t to int truncations.
       'msvs_disabled_warnings': [ 4267, ],
@@ -112,8 +124,6 @@
             '../media/media.gyp:shared_memory_support',
             '../ipc/ipc.gyp:ipc',
             '../skia/skia.gyp:skia',
-            # TODO(ananta) : The WebKit dependency needs to move to a new target for NACL.
-            '../third_party/WebKit/public/blink.gyp:blink',
             '../third_party/icu/icu.gyp:icuuc',
             '../third_party/icu/icu.gyp:icui18n',
             '../ui/surface/surface.gyp:surface',
@@ -128,6 +138,17 @@
           },
           # Disable c4267 warnings until we fix size_t to int truncations.
           'msvs_disabled_warnings': [ 4267, ],
+          'conditions': [
+            ['chrome_multiple_dll==1', {
+              'dependencies': [
+                '../third_party/WebKit/public/blink.gyp:blink_minimal',
+              ],
+            }, {
+              'dependencies': [
+                '../third_party/WebKit/public/blink.gyp:blink',
+              ],
+            }],
+          ],
         },
       ],
     },
@@ -151,8 +172,6 @@
             '../media/media.gyp:shared_memory_support',
             '../ipc/ipc.gyp:ipc',
             '../skia/skia.gyp:skia',
-            # TODO(ananta) : The WebKit dependency needs to move to a new target for NACL.
-            '../third_party/WebKit/public/blink.gyp:blink',
             '../third_party/icu/icu.gyp:icuuc',
             '../third_party/icu/icu.gyp:icui18n',
             '../ui/surface/surface.gyp:surface',
@@ -166,6 +185,17 @@
           },
           # Disable c4267 warnings until we fix size_t to int truncations.
           'msvs_disabled_warnings': [ 4267, ],
+          'conditions': [
+            ['chrome_multiple_dll==1', {
+              'dependencies': [
+                '../third_party/WebKit/public/blink.gyp:blink_minimal',
+              ],
+            }, {
+              'dependencies': [
+                '../third_party/WebKit/public/blink.gyp:blink',
+              ],
+            }],
+          ],
         },
         {
           # In component build, this is just a phony target that makes sure
diff --git a/ppapi/ppapi_shared.target.darwin-arm.mk b/ppapi/ppapi_shared.target.darwin-arm.mk
index 782e034..5ab6202 100644
--- a/ppapi/ppapi_shared.target.darwin-arm.mk
+++ b/ppapi/ppapi_shared.target.darwin-arm.mk
@@ -13,9 +13,9 @@
 GYP_TARGET_DEPENDENCIES := \
 	$(call intermediates-dir-for,GYP,skia_skia_gyp)/skia.stamp \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,skia_skia_library_gyp)/skia_skia_library_gyp.a \
-	$(call intermediates-dir-for,GYP,third_party_WebKit_public_blink_gyp)/blink.stamp \
 	$(call intermediates-dir-for,GYP,third_party_icu_icuuc_gyp)/icuuc.stamp \
-	$(call intermediates-dir-for,GYP,ppapi_ppapi_c_gyp)/ppapi_c.stamp
+	$(call intermediates-dir-for,GYP,ppapi_ppapi_c_gyp)/ppapi_c.stamp \
+	$(call intermediates-dir-for,GYP,third_party_WebKit_public_blink_gyp)/blink.stamp
 
 GYP_GENERATED_OUTPUTS :=
 
@@ -241,9 +241,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -261,12 +261,12 @@
 	$(LOCAL_PATH)/third_party/skia/include/ports \
 	$(LOCAL_PATH)/third_party/skia/include/utils \
 	$(LOCAL_PATH)/skia/ext \
+	$(PWD)/external/icu4c/common \
+	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/WebKit \
 	$(LOCAL_PATH)/third_party/npapi \
 	$(LOCAL_PATH)/third_party/npapi/bindings \
 	$(LOCAL_PATH)/v8/include \
-	$(PWD)/external/icu4c/common \
-	$(PWD)/external/icu4c/i18n \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -355,9 +355,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -375,12 +375,12 @@
 	$(LOCAL_PATH)/third_party/skia/include/ports \
 	$(LOCAL_PATH)/third_party/skia/include/utils \
 	$(LOCAL_PATH)/skia/ext \
+	$(PWD)/external/icu4c/common \
+	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/WebKit \
 	$(LOCAL_PATH)/third_party/npapi \
 	$(LOCAL_PATH)/third_party/npapi/bindings \
 	$(LOCAL_PATH)/v8/include \
-	$(PWD)/external/icu4c/common \
-	$(PWD)/external/icu4c/i18n \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/ppapi/ppapi_shared.target.darwin-mips.mk b/ppapi/ppapi_shared.target.darwin-mips.mk
index 1ffb3f0..1f16e6f 100644
--- a/ppapi/ppapi_shared.target.darwin-mips.mk
+++ b/ppapi/ppapi_shared.target.darwin-mips.mk
@@ -13,9 +13,9 @@
 GYP_TARGET_DEPENDENCIES := \
 	$(call intermediates-dir-for,GYP,skia_skia_gyp)/skia.stamp \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,skia_skia_library_gyp)/skia_skia_library_gyp.a \
-	$(call intermediates-dir-for,GYP,third_party_WebKit_public_blink_gyp)/blink.stamp \
 	$(call intermediates-dir-for,GYP,third_party_icu_icuuc_gyp)/icuuc.stamp \
-	$(call intermediates-dir-for,GYP,ppapi_ppapi_c_gyp)/ppapi_c.stamp
+	$(call intermediates-dir-for,GYP,ppapi_ppapi_c_gyp)/ppapi_c.stamp \
+	$(call intermediates-dir-for,GYP,third_party_WebKit_public_blink_gyp)/blink.stamp
 
 GYP_GENERATED_OUTPUTS :=
 
@@ -240,9 +240,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -260,12 +260,12 @@
 	$(LOCAL_PATH)/third_party/skia/include/ports \
 	$(LOCAL_PATH)/third_party/skia/include/utils \
 	$(LOCAL_PATH)/skia/ext \
+	$(PWD)/external/icu4c/common \
+	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/WebKit \
 	$(LOCAL_PATH)/third_party/npapi \
 	$(LOCAL_PATH)/third_party/npapi/bindings \
 	$(LOCAL_PATH)/v8/include \
-	$(PWD)/external/icu4c/common \
-	$(PWD)/external/icu4c/i18n \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -353,9 +353,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -373,12 +373,12 @@
 	$(LOCAL_PATH)/third_party/skia/include/ports \
 	$(LOCAL_PATH)/third_party/skia/include/utils \
 	$(LOCAL_PATH)/skia/ext \
+	$(PWD)/external/icu4c/common \
+	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/WebKit \
 	$(LOCAL_PATH)/third_party/npapi \
 	$(LOCAL_PATH)/third_party/npapi/bindings \
 	$(LOCAL_PATH)/v8/include \
-	$(PWD)/external/icu4c/common \
-	$(PWD)/external/icu4c/i18n \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/ppapi/ppapi_shared.target.darwin-x86.mk b/ppapi/ppapi_shared.target.darwin-x86.mk
index e2b17c3..a576402 100644
--- a/ppapi/ppapi_shared.target.darwin-x86.mk
+++ b/ppapi/ppapi_shared.target.darwin-x86.mk
@@ -13,9 +13,9 @@
 GYP_TARGET_DEPENDENCIES := \
 	$(call intermediates-dir-for,GYP,skia_skia_gyp)/skia.stamp \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,skia_skia_library_gyp)/skia_skia_library_gyp.a \
-	$(call intermediates-dir-for,GYP,third_party_WebKit_public_blink_gyp)/blink.stamp \
 	$(call intermediates-dir-for,GYP,third_party_icu_icuuc_gyp)/icuuc.stamp \
-	$(call intermediates-dir-for,GYP,ppapi_ppapi_c_gyp)/ppapi_c.stamp
+	$(call intermediates-dir-for,GYP,ppapi_ppapi_c_gyp)/ppapi_c.stamp \
+	$(call intermediates-dir-for,GYP,third_party_WebKit_public_blink_gyp)/blink.stamp
 
 GYP_GENERATED_OUTPUTS :=
 
@@ -243,9 +243,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -263,12 +263,12 @@
 	$(LOCAL_PATH)/third_party/skia/include/ports \
 	$(LOCAL_PATH)/third_party/skia/include/utils \
 	$(LOCAL_PATH)/skia/ext \
+	$(PWD)/external/icu4c/common \
+	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/WebKit \
 	$(LOCAL_PATH)/third_party/npapi \
 	$(LOCAL_PATH)/third_party/npapi/bindings \
 	$(LOCAL_PATH)/v8/include \
-	$(PWD)/external/icu4c/common \
-	$(PWD)/external/icu4c/i18n \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -360,9 +360,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -380,12 +380,12 @@
 	$(LOCAL_PATH)/third_party/skia/include/ports \
 	$(LOCAL_PATH)/third_party/skia/include/utils \
 	$(LOCAL_PATH)/skia/ext \
+	$(PWD)/external/icu4c/common \
+	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/WebKit \
 	$(LOCAL_PATH)/third_party/npapi \
 	$(LOCAL_PATH)/third_party/npapi/bindings \
 	$(LOCAL_PATH)/v8/include \
-	$(PWD)/external/icu4c/common \
-	$(PWD)/external/icu4c/i18n \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/ppapi/ppapi_shared.target.linux-arm.mk b/ppapi/ppapi_shared.target.linux-arm.mk
index 782e034..5ab6202 100644
--- a/ppapi/ppapi_shared.target.linux-arm.mk
+++ b/ppapi/ppapi_shared.target.linux-arm.mk
@@ -13,9 +13,9 @@
 GYP_TARGET_DEPENDENCIES := \
 	$(call intermediates-dir-for,GYP,skia_skia_gyp)/skia.stamp \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,skia_skia_library_gyp)/skia_skia_library_gyp.a \
-	$(call intermediates-dir-for,GYP,third_party_WebKit_public_blink_gyp)/blink.stamp \
 	$(call intermediates-dir-for,GYP,third_party_icu_icuuc_gyp)/icuuc.stamp \
-	$(call intermediates-dir-for,GYP,ppapi_ppapi_c_gyp)/ppapi_c.stamp
+	$(call intermediates-dir-for,GYP,ppapi_ppapi_c_gyp)/ppapi_c.stamp \
+	$(call intermediates-dir-for,GYP,third_party_WebKit_public_blink_gyp)/blink.stamp
 
 GYP_GENERATED_OUTPUTS :=
 
@@ -241,9 +241,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -261,12 +261,12 @@
 	$(LOCAL_PATH)/third_party/skia/include/ports \
 	$(LOCAL_PATH)/third_party/skia/include/utils \
 	$(LOCAL_PATH)/skia/ext \
+	$(PWD)/external/icu4c/common \
+	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/WebKit \
 	$(LOCAL_PATH)/third_party/npapi \
 	$(LOCAL_PATH)/third_party/npapi/bindings \
 	$(LOCAL_PATH)/v8/include \
-	$(PWD)/external/icu4c/common \
-	$(PWD)/external/icu4c/i18n \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -355,9 +355,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -375,12 +375,12 @@
 	$(LOCAL_PATH)/third_party/skia/include/ports \
 	$(LOCAL_PATH)/third_party/skia/include/utils \
 	$(LOCAL_PATH)/skia/ext \
+	$(PWD)/external/icu4c/common \
+	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/WebKit \
 	$(LOCAL_PATH)/third_party/npapi \
 	$(LOCAL_PATH)/third_party/npapi/bindings \
 	$(LOCAL_PATH)/v8/include \
-	$(PWD)/external/icu4c/common \
-	$(PWD)/external/icu4c/i18n \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/ppapi/ppapi_shared.target.linux-mips.mk b/ppapi/ppapi_shared.target.linux-mips.mk
index 1ffb3f0..1f16e6f 100644
--- a/ppapi/ppapi_shared.target.linux-mips.mk
+++ b/ppapi/ppapi_shared.target.linux-mips.mk
@@ -13,9 +13,9 @@
 GYP_TARGET_DEPENDENCIES := \
 	$(call intermediates-dir-for,GYP,skia_skia_gyp)/skia.stamp \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,skia_skia_library_gyp)/skia_skia_library_gyp.a \
-	$(call intermediates-dir-for,GYP,third_party_WebKit_public_blink_gyp)/blink.stamp \
 	$(call intermediates-dir-for,GYP,third_party_icu_icuuc_gyp)/icuuc.stamp \
-	$(call intermediates-dir-for,GYP,ppapi_ppapi_c_gyp)/ppapi_c.stamp
+	$(call intermediates-dir-for,GYP,ppapi_ppapi_c_gyp)/ppapi_c.stamp \
+	$(call intermediates-dir-for,GYP,third_party_WebKit_public_blink_gyp)/blink.stamp
 
 GYP_GENERATED_OUTPUTS :=
 
@@ -240,9 +240,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -260,12 +260,12 @@
 	$(LOCAL_PATH)/third_party/skia/include/ports \
 	$(LOCAL_PATH)/third_party/skia/include/utils \
 	$(LOCAL_PATH)/skia/ext \
+	$(PWD)/external/icu4c/common \
+	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/WebKit \
 	$(LOCAL_PATH)/third_party/npapi \
 	$(LOCAL_PATH)/third_party/npapi/bindings \
 	$(LOCAL_PATH)/v8/include \
-	$(PWD)/external/icu4c/common \
-	$(PWD)/external/icu4c/i18n \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -353,9 +353,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -373,12 +373,12 @@
 	$(LOCAL_PATH)/third_party/skia/include/ports \
 	$(LOCAL_PATH)/third_party/skia/include/utils \
 	$(LOCAL_PATH)/skia/ext \
+	$(PWD)/external/icu4c/common \
+	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/WebKit \
 	$(LOCAL_PATH)/third_party/npapi \
 	$(LOCAL_PATH)/third_party/npapi/bindings \
 	$(LOCAL_PATH)/v8/include \
-	$(PWD)/external/icu4c/common \
-	$(PWD)/external/icu4c/i18n \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/ppapi/ppapi_shared.target.linux-x86.mk b/ppapi/ppapi_shared.target.linux-x86.mk
index e2b17c3..a576402 100644
--- a/ppapi/ppapi_shared.target.linux-x86.mk
+++ b/ppapi/ppapi_shared.target.linux-x86.mk
@@ -13,9 +13,9 @@
 GYP_TARGET_DEPENDENCIES := \
 	$(call intermediates-dir-for,GYP,skia_skia_gyp)/skia.stamp \
 	$(call intermediates-dir-for,STATIC_LIBRARIES,skia_skia_library_gyp)/skia_skia_library_gyp.a \
-	$(call intermediates-dir-for,GYP,third_party_WebKit_public_blink_gyp)/blink.stamp \
 	$(call intermediates-dir-for,GYP,third_party_icu_icuuc_gyp)/icuuc.stamp \
-	$(call intermediates-dir-for,GYP,ppapi_ppapi_c_gyp)/ppapi_c.stamp
+	$(call intermediates-dir-for,GYP,ppapi_ppapi_c_gyp)/ppapi_c.stamp \
+	$(call intermediates-dir-for,GYP,third_party_WebKit_public_blink_gyp)/blink.stamp
 
 GYP_GENERATED_OUTPUTS :=
 
@@ -243,9 +243,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -263,12 +263,12 @@
 	$(LOCAL_PATH)/third_party/skia/include/ports \
 	$(LOCAL_PATH)/third_party/skia/include/utils \
 	$(LOCAL_PATH)/skia/ext \
+	$(PWD)/external/icu4c/common \
+	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/WebKit \
 	$(LOCAL_PATH)/third_party/npapi \
 	$(LOCAL_PATH)/third_party/npapi/bindings \
 	$(LOCAL_PATH)/v8/include \
-	$(PWD)/external/icu4c/common \
-	$(PWD)/external/icu4c/i18n \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -360,9 +360,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -380,12 +380,12 @@
 	$(LOCAL_PATH)/third_party/skia/include/ports \
 	$(LOCAL_PATH)/third_party/skia/include/utils \
 	$(LOCAL_PATH)/skia/ext \
+	$(PWD)/external/icu4c/common \
+	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/WebKit \
 	$(LOCAL_PATH)/third_party/npapi \
 	$(LOCAL_PATH)/third_party/npapi/bindings \
 	$(LOCAL_PATH)/v8/include \
-	$(PWD)/external/icu4c/common \
-	$(PWD)/external/icu4c/i18n \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/ppapi/tests/test_case.h b/ppapi/tests/test_case.h
index 2c81774..4491c76 100644
--- a/ppapi/tests/test_case.h
+++ b/ppapi/tests/test_case.h
@@ -187,7 +187,9 @@
 
    private:
     void Run() {
-      PP_DCHECK(PP_OK == loop_.AttachToCurrentThread());
+      int32_t result = loop_.AttachToCurrentThread();
+      static_cast<void>(result); // result is not used in the RELEASE build.
+      PP_DCHECK(PP_OK == result);
       result_ = (test_case_->*test_to_run_)();
       // Now give the loop a chance to clean up.
       loop_.PostQuit(true /* should_destroy */);
diff --git a/remoting/android/java/AndroidManifest.xml b/remoting/android/java/AndroidManifest.xml
index 10bccfd..8753253 100644
--- a/remoting/android/java/AndroidManifest.xml
+++ b/remoting/android/java/AndroidManifest.xml
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
         package="org.chromium.chromoting"
-        android:versionCode="1"
-        android:versionName="0.01">
+        android:versionCode="2"
+        android:versionName="0.02">
     <uses-sdk android:minSdkVersion="14"
             android:targetSdkVersion="14"/>
     <uses-permission android:name="android.permission.GET_ACCOUNTS"/>
@@ -18,6 +18,7 @@
             </intent-filter>
         </activity>
         <activity android:name="Desktop"
-                android:configChanges="orientation|screenSize"/>
+                android:configChanges="orientation|screenSize"
+                android:theme="@android:style/Theme.DeviceDefault.NoActionBar.Fullscreen"/>
     </application>
 </manifest>
diff --git a/remoting/client/jni/chromoting_jni_instance.cc b/remoting/client/jni/chromoting_jni_instance.cc
index fcb4db3..8dc3b17 100644
--- a/remoting/client/jni/chromoting_jni_instance.cc
+++ b/remoting/client/jni/chromoting_jni_instance.cc
@@ -7,7 +7,7 @@
 #include "base/bind.h"
 #include "base/logging.h"
 #include "remoting/client/audio_player.h"
-#include "remoting/client/jni/chromoting_jni.h"
+#include "remoting/client/jni/chromoting_jni_runtime.h"
 #include "remoting/protocol/libjingle_transport_factory.h"
 
 // TODO(solb) Move into location shared with client plugin.
@@ -17,21 +17,21 @@
 
 namespace remoting {
 
-ChromotingJniInstance::ChromotingJniInstance(const char* username,
+ChromotingJniInstance::ChromotingJniInstance(ChromotingJniRuntime* jni_runtime,
+                                             const char* username,
                                              const char* auth_token,
                                              const char* host_jid,
                                              const char* host_id,
-                                             const char* host_pubkey) {
-  DCHECK(ChromotingJni::GetInstance()->
-      ui_task_runner()->BelongsToCurrentThread());
+                                             const char* host_pubkey)
+    : jni_runtime_(jni_runtime),
+      username_(username),
+      auth_token_(auth_token),
+      host_jid_(host_jid),
+      host_id_(host_id),
+      host_pubkey_(host_pubkey) {
+  DCHECK(jni_runtime_->ui_task_runner()->BelongsToCurrentThread());
 
-  username_ = username;
-  auth_token_ = auth_token;
-  host_jid_ = host_jid;
-  host_id_ = host_id;
-  host_pubkey_ = host_pubkey;
-
-  ChromotingJni::GetInstance()->display_task_runner()->PostTask(
+  jni_runtime_->display_task_runner()->PostTask(
       FROM_HERE,
       base::Bind(&ChromotingJniInstance::ConnectToHostOnDisplayThread,
                  this));
@@ -40,9 +40,8 @@
 ChromotingJniInstance::~ChromotingJniInstance() {}
 
 void ChromotingJniInstance::Cleanup() {
-  if (!ChromotingJni::GetInstance()->
-      display_task_runner()->BelongsToCurrentThread()) {
-    ChromotingJni::GetInstance()->display_task_runner()->PostTask(
+  if (!jni_runtime_->display_task_runner()->BelongsToCurrentThread()) {
+    jni_runtime_->display_task_runner()->PostTask(
         FROM_HERE,
         base::Bind(&ChromotingJniInstance::Cleanup, this));
     return;
@@ -54,32 +53,31 @@
   // The weak pointers must be invalidated on the same thread they were used.
   view_weak_factory_->InvalidateWeakPtrs();
 
-  ChromotingJni::GetInstance()->network_task_runner()->PostTask(FROM_HERE,
+  jni_runtime_->network_task_runner()->PostTask(
+      FROM_HERE,
       base::Bind(&ChromotingJniInstance::DisconnectFromHostOnNetworkThread,
                  this));
 }
 
 void ChromotingJniInstance::ProvideSecret(const char* pin) {
-  DCHECK(ChromotingJni::GetInstance()->
-      ui_task_runner()->BelongsToCurrentThread());
+  DCHECK(jni_runtime_->ui_task_runner()->BelongsToCurrentThread());
   DCHECK(!pin_callback_.is_null());
 
   // We invoke the string constructor to ensure |pin| gets copied *before* the
   // asynchronous run, since Java might want it back as soon as we return.
-  ChromotingJni::GetInstance()->network_task_runner()->PostTask(FROM_HERE,
-                                 base::Bind(pin_callback_, pin));
+  jni_runtime_->network_task_runner()->PostTask(FROM_HERE,
+                                                base::Bind(pin_callback_, pin));
 }
 
 void ChromotingJniInstance::RedrawDesktop() {
-  if (!ChromotingJni::GetInstance()->
-      display_task_runner()->BelongsToCurrentThread()) {
-    ChromotingJni::GetInstance()->display_task_runner()->PostTask(
+  if (!jni_runtime_->display_task_runner()->BelongsToCurrentThread()) {
+    jni_runtime_->display_task_runner()->PostTask(
         FROM_HERE,
         base::Bind(&ChromotingJniInstance::RedrawDesktop, this));
     return;
   }
 
-  ChromotingJni::GetInstance()->RedrawCanvas();
+  jni_runtime_->RedrawCanvas();
 }
 
 void ChromotingJniInstance::PerformMouseAction(
@@ -87,9 +85,8 @@
     int y,
     protocol::MouseEvent_MouseButton button,
     bool buttonDown) {
-  if(!ChromotingJni::GetInstance()->
-      network_task_runner()->BelongsToCurrentThread()) {
-    ChromotingJni::GetInstance()->network_task_runner()->PostTask(
+  if (!jni_runtime_->network_task_runner()->BelongsToCurrentThread()) {
+    jni_runtime_->network_task_runner()->PostTask(
         FROM_HERE,
         base::Bind(&ChromotingJniInstance::PerformMouseAction,
                    this,
@@ -113,10 +110,8 @@
 void ChromotingJniInstance::OnConnectionState(
     protocol::ConnectionToHost::State state,
     protocol::ErrorCode error) {
-  if (!ChromotingJni::GetInstance()->
-      ui_task_runner()->BelongsToCurrentThread()) {
-    ChromotingJni::GetInstance()->
-        ui_task_runner()->PostTask(
+  if (!jni_runtime_->ui_task_runner()->BelongsToCurrentThread()) {
+    jni_runtime_->ui_task_runner()->PostTask(
             FROM_HERE,
             base::Bind(&ChromotingJniInstance::OnConnectionState,
                        this,
@@ -125,7 +120,7 @@
     return;
   }
 
-  ChromotingJni::GetInstance()->ReportConnectionStatus(state, error);
+  jni_runtime_->ReportConnectionStatus(state, error);
 }
 
 void ChromotingJniInstance::OnConnectionReady(bool ready) {
@@ -164,25 +159,22 @@
 }
 
 void ChromotingJniInstance::ConnectToHostOnDisplayThread() {
-  DCHECK(ChromotingJni::GetInstance()->
-      display_task_runner()->BelongsToCurrentThread());
+  DCHECK(jni_runtime_->display_task_runner()->BelongsToCurrentThread());
 
-  frame_consumer_ = new FrameConsumerProxy(
-      ChromotingJni::GetInstance()->display_task_runner());
-  view_.reset(new JniFrameConsumer());
+  frame_consumer_ = new FrameConsumerProxy(jni_runtime_->display_task_runner());
+  view_.reset(new JniFrameConsumer(jni_runtime_));
   view_weak_factory_.reset(new base::WeakPtrFactory<JniFrameConsumer>(
       view_.get()));
   frame_consumer_->Attach(view_weak_factory_->GetWeakPtr());
 
-  ChromotingJni::GetInstance()->network_task_runner()->PostTask(
+  jni_runtime_->network_task_runner()->PostTask(
       FROM_HERE,
       base::Bind(&ChromotingJniInstance::ConnectToHostOnNetworkThread,
                  this));
 }
 
 void ChromotingJniInstance::ConnectToHostOnNetworkThread() {
-  DCHECK(ChromotingJni::GetInstance()->
-      network_task_runner()->BelongsToCurrentThread());
+  DCHECK(jni_runtime_->network_task_runner()->BelongsToCurrentThread());
 
   client_config_.reset(new ClientConfig());
   client_config_->host_jid = host_jid_;
@@ -199,7 +191,7 @@
       protocol::AuthenticationMethod::FromString("spake2_plain"));
 
   client_context_.reset(new ClientContext(
-      ChromotingJni::GetInstance()->network_task_runner().get()));
+      jni_runtime_->network_task_runner().get()));
   client_context_->Start();
 
   connection_.reset(new protocol::ConnectionToHost(true));
@@ -218,26 +210,24 @@
   signaling_config_->port = CHAT_PORT;
   signaling_config_->use_tls = CHAT_USE_TLS;
 
-  signaling_.reset(new XmppSignalStrategy(
-      ChromotingJni::GetInstance()->url_requester(),
-      username_,
-      auth_token_,
-      "oauth2",
-      *signaling_config_));
+  signaling_.reset(new XmppSignalStrategy(jni_runtime_->url_requester(),
+                                          username_,
+                                          auth_token_,
+                                          "oauth2",
+                                          *signaling_config_));
 
   network_settings_.reset(new NetworkSettings(
       NetworkSettings::NAT_TRAVERSAL_OUTGOING));
   scoped_ptr<protocol::TransportFactory> fact(
       protocol::LibjingleTransportFactory::Create(
           *network_settings_,
-          ChromotingJni::GetInstance()->url_requester()));
+          jni_runtime_->url_requester()));
 
   client_->Start(signaling_.get(), fact.Pass());
 }
 
 void ChromotingJniInstance::DisconnectFromHostOnNetworkThread() {
-  DCHECK(ChromotingJni::GetInstance()->
-      network_task_runner()->BelongsToCurrentThread());
+  DCHECK(jni_runtime_->network_task_runner()->BelongsToCurrentThread());
 
   username_ = "";
   auth_token_ = "";
@@ -253,9 +243,8 @@
 void ChromotingJniInstance::FetchSecret(
     bool pairable,
     const protocol::SecretFetchedCallback& callback) {
-  if (!ChromotingJni::GetInstance()->
-      ui_task_runner()->BelongsToCurrentThread()) {
-    ChromotingJni::GetInstance()->ui_task_runner()->PostTask(
+  if (!jni_runtime_->ui_task_runner()->BelongsToCurrentThread()) {
+    jni_runtime_->ui_task_runner()->PostTask(
         FROM_HERE,
         base::Bind(&ChromotingJniInstance::FetchSecret,
                    this,
@@ -265,7 +254,7 @@
   }
 
   pin_callback_ = callback;
-  ChromotingJni::GetInstance()->DisplayAuthenticationPrompt();
+  jni_runtime_->DisplayAuthenticationPrompt();
 }
 
 }  // namespace remoting
diff --git a/remoting/client/jni/chromoting_jni_instance.h b/remoting/client/jni/chromoting_jni_instance.h
index 1c113cf..6b332e4 100644
--- a/remoting/client/jni/chromoting_jni_instance.h
+++ b/remoting/client/jni/chromoting_jni_instance.h
@@ -37,12 +37,13 @@
     public base::RefCountedThreadSafe<ChromotingJniInstance> {
  public:
   // Initiates a connection with the specified host. Call from the UI thread.
-  ChromotingJniInstance(
-      const char* username,
-      const char* auth_token,
-      const char* host_jid,
-      const char* host_id,
-      const char* host_pubkey);
+  // The instance does not take ownership of |jni_runtime|.
+  ChromotingJniInstance(ChromotingJniRuntime* jni_runtime,
+                        const char* username,
+                        const char* auth_token,
+                        const char* host_jid,
+                        const char* host_id,
+                        const char* host_pubkey);
 
   // Terminates the current connection (if it hasn't already failed) and cleans
   // up. Must be called before destruction.
@@ -97,6 +98,9 @@
   void FetchSecret(bool pairable,
                    const protocol::SecretFetchedCallback& callback);
 
+  // Used to obtain task runner references and make calls to Java methods.
+  ChromotingJniRuntime* jni_runtime_;
+
   // This group of variables is to be used on the display thread.
   scoped_refptr<FrameConsumerProxy> frame_consumer_;
   scoped_ptr<JniFrameConsumer> view_;
diff --git a/remoting/client/jni/chromoting_jni.cc b/remoting/client/jni/chromoting_jni_runtime.cc
similarity index 85%
rename from remoting/client/jni/chromoting_jni.cc
rename to remoting/client/jni/chromoting_jni_runtime.cc
index 647ac5a..a9751d4 100644
--- a/remoting/client/jni/chromoting_jni.cc
+++ b/remoting/client/jni/chromoting_jni_runtime.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "remoting/client/jni/chromoting_jni.h"
+#include "remoting/client/jni/chromoting_jni_runtime.h"
 
 #include "base/android/base_jni_registrar.h"
 #include "base/android/jni_android.h"
@@ -17,11 +17,11 @@
 namespace remoting {
 
 // static
-ChromotingJni* ChromotingJni::GetInstance() {
-  return Singleton<ChromotingJni>::get();
+ChromotingJniRuntime* ChromotingJniRuntime::GetInstance() {
+  return Singleton<ChromotingJniRuntime>::get();
 }
 
-ChromotingJni::ChromotingJni() {
+ChromotingJniRuntime::ChromotingJniRuntime() {
   // Obtain a reference to the Java environment. (Future calls to this function
   // made from the same thread return the same stored reference instead of
   // repeating the work of attaching to the JVM.)
@@ -58,7 +58,7 @@
   class_ = static_cast<jclass>(env->NewGlobalRef(env->FindClass(JAVA_CLASS)));
 }
 
-ChromotingJni::~ChromotingJni() {
+ChromotingJniRuntime::~ChromotingJniRuntime() {
   // The singleton should only ever be destroyed on the main thread.
   DCHECK(ui_task_runner_->BelongsToCurrentThread());
 
@@ -71,21 +71,22 @@
   // TODO(solb): crbug.com/259594 Detach all threads from JVM here.
 }
 
-void ChromotingJni::ConnectToHost(const char* username,
+void ChromotingJniRuntime::ConnectToHost(const char* username,
                                   const char* auth_token,
                                   const char* host_jid,
                                   const char* host_id,
                                   const char* host_pubkey) {
   DCHECK(ui_task_runner_->BelongsToCurrentThread());
   DCHECK(!session_);
-  session_ = new ChromotingJniInstance(username,
+  session_ = new ChromotingJniInstance(this,
+                                       username,
                                        auth_token,
                                        host_jid,
                                        host_id,
                                        host_pubkey);
 }
 
-void ChromotingJni::DisconnectFromHost() {
+void ChromotingJniRuntime::DisconnectFromHost() {
   DCHECK(ui_task_runner_->BelongsToCurrentThread());
   if (session_) {
     session_->Cleanup();
@@ -93,7 +94,7 @@
   }
 }
 
-void ChromotingJni::ReportConnectionStatus(
+void ChromotingJniRuntime::ReportConnectionStatus(
     protocol::ConnectionToHost::State state,
     protocol::ErrorCode error) {
   DCHECK(ui_task_runner_->BelongsToCurrentThread());
@@ -106,7 +107,7 @@
     error);
 }
 
-void ChromotingJni::DisplayAuthenticationPrompt() {
+void ChromotingJniRuntime::DisplayAuthenticationPrompt() {
   DCHECK(ui_task_runner_->BelongsToCurrentThread());
 
   JNIEnv* env = base::android::AttachCurrentThread();
@@ -115,7 +116,9 @@
       env->GetStaticMethodID(class_, "displayAuthenticationPrompt", "()V"));
 }
 
-void ChromotingJni::UpdateImageBuffer(int width, int height, jobject buffer) {
+void ChromotingJniRuntime::UpdateImageBuffer(int width,
+                                             int height,
+                                             jobject buffer) {
   DCHECK(display_task_runner_->BelongsToCurrentThread());
 
   JNIEnv* env = base::android::AttachCurrentThread();
@@ -133,7 +136,7 @@
       buffer);
 }
 
-void ChromotingJni::RedrawCanvas() {
+void ChromotingJniRuntime::RedrawCanvas() {
   DCHECK(display_task_runner_->BelongsToCurrentThread());
 
   JNIEnv* env = base::android::AttachCurrentThread();
diff --git a/remoting/client/jni/chromoting_jni.h b/remoting/client/jni/chromoting_jni_runtime.h
similarity index 91%
rename from remoting/client/jni/chromoting_jni.h
rename to remoting/client/jni/chromoting_jni_runtime.h
index 197cf39..ec85d7c 100644
--- a/remoting/client/jni/chromoting_jni.h
+++ b/remoting/client/jni/chromoting_jni_runtime.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef REMOTING_CLIENT_JNI_CHROMOTING_JNI_H_
-#define REMOTING_CLIENT_JNI_CHROMOTING_JNI_H_
+#ifndef REMOTING_CLIENT_JNI_CHROMOTING_JNI_RUNTIME_H_
+#define REMOTING_CLIENT_JNI_CHROMOTING_JNI_RUNTIME_H_
 
 #include <jni.h>
 
@@ -21,11 +21,11 @@
 // (e.g. message loops and task runners). Proxies outgoing JNI calls from its
 // ChromotingJniInstance member to Java. All its methods should be invoked
 // exclusively from the UI thread unless otherwise noted.
-class ChromotingJni {
+class ChromotingJniRuntime {
  public:
   // This class is instantiated at process initialization and persists until
   // we close. Its components are reused across |ChromotingJniInstance|s.
-  static ChromotingJni* GetInstance();
+  static ChromotingJniRuntime* GetInstance();
 
   scoped_refptr<AutoThreadTaskRunner> ui_task_runner() {
     return ui_task_runner_;
@@ -77,14 +77,14 @@
   void RedrawCanvas();
 
  private:
-  ChromotingJni();
+  ChromotingJniRuntime();
 
   // Forces a DisconnectFromHost() in case there is any active or failed
   // connection, then proceeds to tear down the Chromium dependencies on which
   // all sessions depended. Because destruction only occurs at application exit
   // after all connections have terminated, it is safe to make unretained
   // cross-thread calls on the class.
-  virtual ~ChromotingJni();
+  virtual ~ChromotingJniRuntime();
 
   // Reference to the Java class into which we make JNI calls.
   jclass class_;
@@ -106,9 +106,9 @@
   // Contains all connection-specific state.
   scoped_refptr<ChromotingJniInstance> session_;
 
-  friend struct DefaultSingletonTraits<ChromotingJni>;
+  friend struct DefaultSingletonTraits<ChromotingJniRuntime>;
 
-  DISALLOW_COPY_AND_ASSIGN(ChromotingJni);
+  DISALLOW_COPY_AND_ASSIGN(ChromotingJniRuntime);
 };
 
 }  // namespace remoting
diff --git a/remoting/client/jni/jni_frame_consumer.cc b/remoting/client/jni/jni_frame_consumer.cc
index ee8ef94..8f8cfc6 100644
--- a/remoting/client/jni/jni_frame_consumer.cc
+++ b/remoting/client/jni/jni_frame_consumer.cc
@@ -8,7 +8,7 @@
 #include "base/logging.h"
 #include "base/synchronization/waitable_event.h"
 #include "remoting/client/frame_producer.h"
-#include "remoting/client/jni/chromoting_jni.h"
+#include "remoting/client/jni/chromoting_jni_runtime.h"
 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
 
 namespace {
@@ -41,14 +41,15 @@
 
 namespace remoting {
 
-JniFrameConsumer::JniFrameConsumer()
-    : provide_buffer_(true),
+JniFrameConsumer::JniFrameConsumer(ChromotingJniRuntime* jni_runtime)
+    : jni_runtime_(jni_runtime),
+      in_dtor_(false),
       frame_producer_(NULL) {
 }
 
 JniFrameConsumer::~JniFrameConsumer() {
   // Stop giving the producer a buffer to work with.
-  provide_buffer_ = false;
+  in_dtor_ = true;
 
   // Don't destroy the object until we've deleted the buffer.
   base::WaitableEvent done_event(true, false);
@@ -65,35 +66,36 @@
                                    const SkIRect& clip_area,
                                    webrtc::DesktopFrame* buffer,
                                    const SkRegion& region) {
-  DCHECK(ChromotingJni::GetInstance()->
-      display_task_runner()->BelongsToCurrentThread());
+  DCHECK(jni_runtime_->display_task_runner()->BelongsToCurrentThread());
 
-  ChromotingJni::GetInstance()->RedrawCanvas();
+  scoped_ptr<webrtc::DesktopFrame> buffer_scoped(buffer);
+  jni_runtime_->RedrawCanvas();
 
   if (view_size.width() > view_size_.width() ||
       view_size.height() > view_size_.height()) {
     LOG(INFO) << "Existing buffer is too small";
     view_size_ = view_size;
-    delete buffer;
+
+    // Manually destroy the old buffer before allocating a new one to prevent
+    // our memory footprint from temporarily ballooning.
+    buffer_scoped.reset();
     AllocateBuffer();
   }
 
   // Supply |frame_producer_| with a buffer to render the next frame into.
-  if (provide_buffer_)
-    frame_producer_->DrawBuffer(buffer);
+  if (!in_dtor_)
+    frame_producer_->DrawBuffer(buffer_scoped.release());
 }
 
 void JniFrameConsumer::ReturnBuffer(webrtc::DesktopFrame* buffer) {
-  DCHECK(ChromotingJni::GetInstance()->
-      display_task_runner()->BelongsToCurrentThread());
+  DCHECK(jni_runtime_->display_task_runner()->BelongsToCurrentThread());
   LOG(INFO) << "Returning image buffer";
   delete buffer;
 }
 
 void JniFrameConsumer::SetSourceSize(const SkISize& source_size,
                                      const SkIPoint& dpi) {
-  DCHECK(ChromotingJni::GetInstance()->
-      display_task_runner()->BelongsToCurrentThread());
+  DCHECK(jni_runtime_->display_task_runner()->BelongsToCurrentThread());
 
   // We currently render the desktop 1:1 and perform pan/zoom scaling
   // and cropping on the managed canvas.
@@ -108,10 +110,9 @@
 
 void JniFrameConsumer::AllocateBuffer() {
   // Only do anything if we're not being destructed.
-  if (provide_buffer_) {
-    if (!ChromotingJni::GetInstance()->
-        display_task_runner()->BelongsToCurrentThread()) {
-      ChromotingJni::GetInstance()->display_task_runner()->PostTask(FROM_HERE,
+  if (!in_dtor_) {
+    if (!jni_runtime_->display_task_runner()->BelongsToCurrentThread()) {
+      jni_runtime_->display_task_runner()->PostTask(FROM_HERE,
           base::Bind(&JniFrameConsumer::AllocateBuffer,
                      base::Unretained(this)));
       return;
@@ -121,10 +122,9 @@
                                                         view_size_.height());
 
     // Update Java's reference to the buffer and record of its dimensions.
-    ChromotingJni::GetInstance()->UpdateImageBuffer(
-        view_size_.width(),
-        view_size_.height(),
-        buffer->buffer());
+    jni_runtime_->UpdateImageBuffer(view_size_.width(),
+                                        view_size_.height(),
+                                        buffer->buffer());
 
     frame_producer_->DrawBuffer(buffer);
   }
diff --git a/remoting/client/jni/jni_frame_consumer.h b/remoting/client/jni/jni_frame_consumer.h
index b74681f..38ff86c 100644
--- a/remoting/client/jni/jni_frame_consumer.h
+++ b/remoting/client/jni/jni_frame_consumer.h
@@ -14,13 +14,15 @@
 }  // namespace webrtc
 
 namespace remoting {
-class ChromotingJni;
+class ChromotingJniRuntime;
 class FrameProducer;
 
 // FrameConsumer implementation that draws onto a JNI direct byte buffer.
 class JniFrameConsumer : public FrameConsumer {
  public:
-  JniFrameConsumer();
+  // The instance does not take ownership of |jni_runtime|.
+  explicit JniFrameConsumer(ChromotingJniRuntime* jni_runtime);
+
   virtual ~JniFrameConsumer();
 
   // This must be called once before the producer's source size is set.
@@ -38,9 +40,12 @@
  private:
   // Variables are to be used from the display thread.
 
-  // Whether to allocate/provide the producer with a buffer when able. This
-  // goes to false during destruction so that we don't leak memory.
-  bool provide_buffer_;
+  // Used to obtain task runner references and make calls to Java methods.
+  ChromotingJniRuntime* jni_runtime_;
+
+  // Whether we're currently in the constructor, and should deallocate the
+  // buffer instead of passing it back to the producer.
+  bool in_dtor_;
 
   FrameProducer* frame_producer_;
   SkISize view_size_;
diff --git a/remoting/client/jni/jni_interface.cc b/remoting/client/jni/jni_interface.cc
index f9859af..5dc462d 100644
--- a/remoting/client/jni/jni_interface.cc
+++ b/remoting/client/jni/jni_interface.cc
@@ -5,8 +5,8 @@
 // This file defines functions that implement the static methods declared in a
 // closely-related Java class in the platform-specific user interface
 // implementation.  In effect, it is the entry point for all JNI calls *into*
-// the C++ codebase from Java.  The separate ChromotingJni class serves as the
-// corresponding exit point, and is responsible for making all JNI calls
+// the C++ codebase from Java.  The separate ChromotingJniRuntime class serves
+// as the corresponding exit point, and is responsible for making all JNI calls
 // *out of* the C++ codebase into Java.
 
 #include <jni.h>
@@ -15,8 +15,8 @@
 #include "base/command_line.h"
 #include "base/memory/ref_counted.h"
 #include "google_apis/google_api_keys.h"
-#include "remoting/client/jni/chromoting_jni.h"
 #include "remoting/client/jni/chromoting_jni_instance.h"
+#include "remoting/client/jni/chromoting_jni_runtime.h"
 
 // Class and package name of the Java class that declares this file's functions.
 #define JNI_IMPLEMENTATION(method) \
@@ -42,7 +42,7 @@
   CommandLine::Init(0, NULL);
 
   // Create the singleton now so that the Chromoting threads will be set up.
-  remoting::ChromotingJni::GetInstance();
+  remoting::ChromotingJniRuntime::GetInstance();
 }
 
 JNIEXPORT jstring JNICALL JNI_IMPLEMENTATION(getApiKey)(JNIEnv* env,
@@ -76,7 +76,7 @@
   const char* host_id_cstr = env->GetStringUTFChars(host_id_jstr, NULL);
   const char* host_pubkey_cstr = env->GetStringUTFChars(host_pubkey_jstr, NULL);
 
-  remoting::ChromotingJni::GetInstance()->ConnectToHost(
+  remoting::ChromotingJniRuntime::GetInstance()->ConnectToHost(
       username_cstr,
       auth_token_cstr,
       host_jid_cstr,
@@ -92,7 +92,7 @@
 
 JNIEXPORT void JNICALL JNI_IMPLEMENTATION(disconnectNative)(JNIEnv* env,
                                                             jobject that) {
-  remoting::ChromotingJni::GetInstance()->DisconnectFromHost();
+  remoting::ChromotingJniRuntime::GetInstance()->DisconnectFromHost();
 }
 
 JNIEXPORT void JNICALL JNI_IMPLEMENTATION(authenticationResponse)(
@@ -101,7 +101,7 @@
     jstring pin_jstr) {
   const char* pin_cstr = env->GetStringUTFChars(pin_jstr, NULL);
 
-  remoting::ChromotingJni::GetInstance()->
+  remoting::ChromotingJniRuntime::GetInstance()->
       session()->ProvideSecret(pin_cstr);
 
   env->ReleaseStringUTFChars(pin_jstr, pin_cstr);
@@ -110,7 +110,7 @@
 JNIEXPORT void JNICALL JNI_IMPLEMENTATION(scheduleRedrawNative)(
     JNIEnv* env,
     jobject that) {
-  remoting::ChromotingJni::GetInstance()->session()->RedrawDesktop();
+  remoting::ChromotingJniRuntime::GetInstance()->session()->RedrawDesktop();
 }
 
 JNIEXPORT void JNICALL JNI_IMPLEMENTATION(mouseActionNative)(
@@ -120,7 +120,7 @@
     jint y,
     jint which_button,
     jboolean button_down) {
-  remoting::ChromotingJni::GetInstance()->session()->PerformMouseAction(
+  remoting::ChromotingJniRuntime::GetInstance()->session()->PerformMouseAction(
       x,
       y,
       static_cast<remoting::protocol::MouseEvent_MouseButton>(which_button),
diff --git a/remoting/host/plugin/host_script_object.cc b/remoting/host/plugin/host_script_object.cc
index 8c03d8f..9b78eb3 100644
--- a/remoting/host/plugin/host_script_object.cc
+++ b/remoting/host/plugin/host_script_object.cc
@@ -1111,9 +1111,13 @@
   }
 
   ScopedRefNPObject callback_obj(ObjectFromNPVariant(args[0]));
-  pairing_registry_->ClearAllPairings(
-      base::Bind(&HostNPScriptObject::InvokeBooleanCallback, weak_ptr_,
-                 callback_obj));
+  if (pairing_registry_) {
+    pairing_registry_->ClearAllPairings(
+        base::Bind(&HostNPScriptObject::InvokeBooleanCallback, weak_ptr_,
+                   callback_obj));
+  } else {
+    InvokeBooleanCallback(callback_obj, false);
+  }
 
   return true;
 }
@@ -1138,10 +1142,14 @@
 
   std::string client_id = StringFromNPVariant(args[0]);
   ScopedRefNPObject callback_obj(ObjectFromNPVariant(args[1]));
-  pairing_registry_->DeletePairing(
-      client_id,
-      base::Bind(&HostNPScriptObject::InvokeBooleanCallback,
-                 weak_ptr_, callback_obj));
+  if (pairing_registry_) {
+    pairing_registry_->DeletePairing(
+        client_id,
+        base::Bind(&HostNPScriptObject::InvokeBooleanCallback,
+                   weak_ptr_, callback_obj));
+  } else {
+    InvokeBooleanCallback(callback_obj, false);
+  }
 
   return true;
 }
@@ -1325,9 +1333,14 @@
     return false;
   }
 
-  pairing_registry_->GetAllPairings(
-      base::Bind(&HostNPScriptObject::InvokeGetPairedClientsCallback,
-                 weak_ptr_, callback_obj));
+  if (pairing_registry_) {
+    pairing_registry_->GetAllPairings(
+        base::Bind(&HostNPScriptObject::InvokeGetPairedClientsCallback,
+                   weak_ptr_, callback_obj));
+  } else {
+    scoped_ptr<base::ListValue> no_paired_clients(new base::ListValue);
+    InvokeGetPairedClientsCallback(callback_obj, no_paired_clients.Pass());
+  }
   return true;
 }
 
diff --git a/remoting/host/setup/native_messaging_host.cc b/remoting/host/setup/native_messaging_host.cc
index 6218667..55d0020 100644
--- a/remoting/host/setup/native_messaging_host.cc
+++ b/remoting/host/setup/native_messaging_host.cc
@@ -150,9 +150,13 @@
 bool NativeMessagingHost::ProcessClearPairedClients(
     const base::DictionaryValue& message,
     scoped_ptr<base::DictionaryValue> response) {
-  pairing_registry_->ClearAllPairings(
-      base::Bind(&NativeMessagingHost::SendBooleanResult, weak_ptr_,
-                 base::Passed(&response)));
+  if (pairing_registry_) {
+    pairing_registry_->ClearAllPairings(
+        base::Bind(&NativeMessagingHost::SendBooleanResult, weak_ptr_,
+                   base::Passed(&response)));
+  } else {
+    SendBooleanResult(response.Pass(), false);
+  }
   return true;
 }
 
@@ -166,9 +170,13 @@
     return false;
   }
 
-  pairing_registry_->DeletePairing(
-      client_id, base::Bind(&NativeMessagingHost::SendBooleanResult, weak_ptr_,
-                            base::Passed(&response)));
+  if (pairing_registry_) {
+    pairing_registry_->DeletePairing(
+        client_id, base::Bind(&NativeMessagingHost::SendBooleanResult,
+                              weak_ptr_, base::Passed(&response)));
+  } else {
+    SendBooleanResult(response.Pass(), false);
+  }
   return true;
 }
 
@@ -237,9 +245,14 @@
 bool NativeMessagingHost::ProcessGetPairedClients(
     const base::DictionaryValue& message,
     scoped_ptr<base::DictionaryValue> response) {
-  pairing_registry_->GetAllPairings(
-      base::Bind(&NativeMessagingHost::SendPairedClientsResponse, weak_ptr_,
-                 base::Passed(&response)));
+  if (pairing_registry_) {
+    pairing_registry_->GetAllPairings(
+        base::Bind(&NativeMessagingHost::SendPairedClientsResponse, weak_ptr_,
+                   base::Passed(&response)));
+  } else {
+    scoped_ptr<base::ListValue> no_paired_clients(new base::ListValue);
+    SendPairedClientsResponse(response.Pass(), no_paired_clients.Pass());
+  }
   return true;
 }
 
diff --git a/remoting/remoting.gyp b/remoting/remoting.gyp
index fb52c13..121002d 100644
--- a/remoting/remoting.gyp
+++ b/remoting/remoting.gyp
@@ -1690,10 +1690,10 @@
             '../google_apis/google_apis.gyp:google_apis',
           ],
           'sources': [
-            'client/jni/chromoting_jni.cc',
-            'client/jni/chromoting_jni.h',
             'client/jni/chromoting_jni_instance.cc',
             'client/jni/chromoting_jni_instance.h',
+            'client/jni/chromoting_jni_runtime.cc',
+            'client/jni/chromoting_jni_runtime.h',
             'client/jni/jni_frame_consumer.cc',
             'client/jni/jni_frame_consumer.h',
             'client/jni/jni_interface.cc',
diff --git a/remoting/resources/strings.xml b/remoting/resources/strings.xml
index 284c2ed..e2efc8e 100644
--- a/remoting/resources/strings.xml
+++ b/remoting/resources/strings.xml
@@ -25,7 +25,7 @@
     <string name="error_auth_failed">Authentication with specified account failed</string>
     <string name="error_cataloging_hosts">Unable to display host list</string>
     <string name="error_displaying_host">Unable to display host entry</string>
-    <string name="error_unexpected_response">Unexpected response from directory server</string>
+    <string name="error_unexpected_response">Account has no remote desktop hosts registered</string>
     <string name="error_reading_host">Unable to read host entry</string>
 
     <!--Protocol states (see remoting/protocol/connection_to_host.h)-->
diff --git a/sandbox/sandbox_services.target.darwin-arm.mk b/sandbox/sandbox_services.target.darwin-arm.mk
index ab80b25..94dcc26 100644
--- a/sandbox/sandbox_services.target.darwin-arm.mk
+++ b/sandbox/sandbox_services.target.darwin-arm.mk
@@ -87,8 +87,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH)/sandbox \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/sandbox \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
@@ -169,8 +169,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH)/sandbox \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/sandbox \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
diff --git a/sandbox/sandbox_services.target.darwin-mips.mk b/sandbox/sandbox_services.target.darwin-mips.mk
index e158efa..70c3000 100644
--- a/sandbox/sandbox_services.target.darwin-mips.mk
+++ b/sandbox/sandbox_services.target.darwin-mips.mk
@@ -86,8 +86,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH)/sandbox \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/sandbox \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
@@ -167,8 +167,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH)/sandbox \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/sandbox \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
diff --git a/sandbox/sandbox_services.target.darwin-x86.mk b/sandbox/sandbox_services.target.darwin-x86.mk
index e91cd06..d559143 100644
--- a/sandbox/sandbox_services.target.darwin-x86.mk
+++ b/sandbox/sandbox_services.target.darwin-x86.mk
@@ -89,8 +89,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH)/sandbox \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/sandbox \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
@@ -174,8 +174,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH)/sandbox \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/sandbox \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
diff --git a/sandbox/sandbox_services.target.linux-arm.mk b/sandbox/sandbox_services.target.linux-arm.mk
index ab80b25..94dcc26 100644
--- a/sandbox/sandbox_services.target.linux-arm.mk
+++ b/sandbox/sandbox_services.target.linux-arm.mk
@@ -87,8 +87,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH)/sandbox \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/sandbox \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
@@ -169,8 +169,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH)/sandbox \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/sandbox \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
diff --git a/sandbox/sandbox_services.target.linux-mips.mk b/sandbox/sandbox_services.target.linux-mips.mk
index e158efa..70c3000 100644
--- a/sandbox/sandbox_services.target.linux-mips.mk
+++ b/sandbox/sandbox_services.target.linux-mips.mk
@@ -86,8 +86,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH)/sandbox \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/sandbox \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
@@ -167,8 +167,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH)/sandbox \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/sandbox \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
diff --git a/sandbox/sandbox_services.target.linux-x86.mk b/sandbox/sandbox_services.target.linux-x86.mk
index e91cd06..d559143 100644
--- a/sandbox/sandbox_services.target.linux-x86.mk
+++ b/sandbox/sandbox_services.target.linux-x86.mk
@@ -89,8 +89,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH)/sandbox \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/sandbox \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
@@ -174,8 +174,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH)/sandbox \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/sandbox \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
diff --git a/sandbox/seccomp_bpf.target.darwin-arm.mk b/sandbox/seccomp_bpf.target.darwin-arm.mk
index 48365a1..b42c858 100644
--- a/sandbox/seccomp_bpf.target.darwin-arm.mk
+++ b/sandbox/seccomp_bpf.target.darwin-arm.mk
@@ -96,8 +96,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -177,8 +177,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/sandbox/seccomp_bpf.target.darwin-x86.mk b/sandbox/seccomp_bpf.target.darwin-x86.mk
index bd3b831..fc0c1b0 100644
--- a/sandbox/seccomp_bpf.target.darwin-x86.mk
+++ b/sandbox/seccomp_bpf.target.darwin-x86.mk
@@ -98,8 +98,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -182,8 +182,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/sandbox/seccomp_bpf.target.linux-arm.mk b/sandbox/seccomp_bpf.target.linux-arm.mk
index 48365a1..b42c858 100644
--- a/sandbox/seccomp_bpf.target.linux-arm.mk
+++ b/sandbox/seccomp_bpf.target.linux-arm.mk
@@ -96,8 +96,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -177,8 +177,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/sandbox/seccomp_bpf.target.linux-x86.mk b/sandbox/seccomp_bpf.target.linux-x86.mk
index bd3b831..fc0c1b0 100644
--- a/sandbox/seccomp_bpf.target.linux-x86.mk
+++ b/sandbox/seccomp_bpf.target.linux-x86.mk
@@ -98,8 +98,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
@@ -182,8 +182,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
 	$(PWD)/external/stlport/stlport
diff --git a/skia/ext/image_operations_bench.cc b/skia/ext/image_operations_bench.cc
index b433615..11263f3 100644
--- a/skia/ext/image_operations_bench.cc
+++ b/skia/ext/image_operations_bench.cc
@@ -249,7 +249,7 @@
   const uint64 num_bytes = static_cast<uint64>(num_iterations_) *
       (GetBitmapSize(&source) + GetBitmapSize(&dest));
 
-  printf("%"PRIu64" MB/s,\telapsed = %"PRIu64" source=%d dest=%d\n",
+  printf("%" PRIu64 " MB/s,\telapsed = %" PRIu64 " source=%d dest=%d\n",
          static_cast<uint64>(elapsed_us == 0 ? 0 : num_bytes / elapsed_us),
          static_cast<uint64>(elapsed_us),
          GetBitmapSize(&source), GetBitmapSize(&dest));
diff --git a/skia/skia_chrome.target.darwin-arm.mk b/skia/skia_chrome.target.darwin-arm.mk
index 642ac3c..6683c6f 100644
--- a/skia/skia_chrome.target.darwin-arm.mk
+++ b/skia/skia_chrome.target.darwin-arm.mk
@@ -112,8 +112,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -213,8 +213,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
diff --git a/skia/skia_chrome.target.darwin-mips.mk b/skia/skia_chrome.target.darwin-mips.mk
index 2d87c8f..2c33eae 100644
--- a/skia/skia_chrome.target.darwin-mips.mk
+++ b/skia/skia_chrome.target.darwin-mips.mk
@@ -112,8 +112,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -213,8 +213,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
diff --git a/skia/skia_chrome.target.darwin-x86.mk b/skia/skia_chrome.target.darwin-x86.mk
index b5e1d39..757ff44 100644
--- a/skia/skia_chrome.target.darwin-x86.mk
+++ b/skia/skia_chrome.target.darwin-x86.mk
@@ -114,8 +114,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -218,8 +218,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
diff --git a/skia/skia_chrome.target.linux-arm.mk b/skia/skia_chrome.target.linux-arm.mk
index 642ac3c..6683c6f 100644
--- a/skia/skia_chrome.target.linux-arm.mk
+++ b/skia/skia_chrome.target.linux-arm.mk
@@ -112,8 +112,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -213,8 +213,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
diff --git a/skia/skia_chrome.target.linux-mips.mk b/skia/skia_chrome.target.linux-mips.mk
index 2d87c8f..2c33eae 100644
--- a/skia/skia_chrome.target.linux-mips.mk
+++ b/skia/skia_chrome.target.linux-mips.mk
@@ -112,8 +112,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -213,8 +213,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
diff --git a/skia/skia_chrome.target.linux-x86.mk b/skia/skia_chrome.target.linux-x86.mk
index b5e1d39..757ff44 100644
--- a/skia/skia_chrome.target.linux-x86.mk
+++ b/skia/skia_chrome.target.linux-x86.mk
@@ -114,8 +114,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -218,8 +218,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
diff --git a/skia/skia_library.gypi b/skia/skia_library.gypi
index 70fbf38..fb8b4e6 100644
--- a/skia/skia_library.gypi
+++ b/skia/skia_library.gypi
@@ -92,6 +92,8 @@
     '../third_party/skia/src/pdf/SkPDFImageStream.h',
     '../third_party/skia/src/pdf/SkPDFPage.cpp',
     '../third_party/skia/src/pdf/SkPDFPage.h',
+    '../third_party/skia/src/pdf/SkPDFResourceDict.cpp',
+    '../third_party/skia/src/pdf/SkPDFResourceDict.h',
     '../third_party/skia/src/pdf/SkPDFShader.cpp',
     '../third_party/skia/src/pdf/SkPDFShader.h',
     '../third_party/skia/src/pdf/SkPDFStream.cpp',
diff --git a/skia/skia_library.target.darwin-arm.mk b/skia/skia_library.target.darwin-arm.mk
index e124ec3..d44615b 100644
--- a/skia/skia_library.target.darwin-arm.mk
+++ b/skia/skia_library.target.darwin-arm.mk
@@ -154,6 +154,7 @@
 	third_party/skia/src/core/SkRegion_path.cpp \
 	third_party/skia/src/core/SkRRect.cpp \
 	third_party/skia/src/core/SkRTree.cpp \
+	third_party/skia/src/core/SkScaledImageCache.cpp \
 	third_party/skia/src/core/SkScalar.cpp \
 	third_party/skia/src/core/SkScalerContext.cpp \
 	third_party/skia/src/core/SkScan.cpp \
diff --git a/skia/skia_library.target.darwin-mips.mk b/skia/skia_library.target.darwin-mips.mk
index cfac58c..83c85bd 100644
--- a/skia/skia_library.target.darwin-mips.mk
+++ b/skia/skia_library.target.darwin-mips.mk
@@ -154,6 +154,7 @@
 	third_party/skia/src/core/SkRegion_path.cpp \
 	third_party/skia/src/core/SkRRect.cpp \
 	third_party/skia/src/core/SkRTree.cpp \
+	third_party/skia/src/core/SkScaledImageCache.cpp \
 	third_party/skia/src/core/SkScalar.cpp \
 	third_party/skia/src/core/SkScalerContext.cpp \
 	third_party/skia/src/core/SkScan.cpp \
diff --git a/skia/skia_library.target.darwin-x86.mk b/skia/skia_library.target.darwin-x86.mk
index 56a28a1..1450f41 100644
--- a/skia/skia_library.target.darwin-x86.mk
+++ b/skia/skia_library.target.darwin-x86.mk
@@ -155,6 +155,7 @@
 	third_party/skia/src/core/SkRegion_path.cpp \
 	third_party/skia/src/core/SkRRect.cpp \
 	third_party/skia/src/core/SkRTree.cpp \
+	third_party/skia/src/core/SkScaledImageCache.cpp \
 	third_party/skia/src/core/SkScalar.cpp \
 	third_party/skia/src/core/SkScalerContext.cpp \
 	third_party/skia/src/core/SkScan.cpp \
diff --git a/skia/skia_library.target.linux-arm.mk b/skia/skia_library.target.linux-arm.mk
index e124ec3..d44615b 100644
--- a/skia/skia_library.target.linux-arm.mk
+++ b/skia/skia_library.target.linux-arm.mk
@@ -154,6 +154,7 @@
 	third_party/skia/src/core/SkRegion_path.cpp \
 	third_party/skia/src/core/SkRRect.cpp \
 	third_party/skia/src/core/SkRTree.cpp \
+	third_party/skia/src/core/SkScaledImageCache.cpp \
 	third_party/skia/src/core/SkScalar.cpp \
 	third_party/skia/src/core/SkScalerContext.cpp \
 	third_party/skia/src/core/SkScan.cpp \
diff --git a/skia/skia_library.target.linux-mips.mk b/skia/skia_library.target.linux-mips.mk
index cfac58c..83c85bd 100644
--- a/skia/skia_library.target.linux-mips.mk
+++ b/skia/skia_library.target.linux-mips.mk
@@ -154,6 +154,7 @@
 	third_party/skia/src/core/SkRegion_path.cpp \
 	third_party/skia/src/core/SkRRect.cpp \
 	third_party/skia/src/core/SkRTree.cpp \
+	third_party/skia/src/core/SkScaledImageCache.cpp \
 	third_party/skia/src/core/SkScalar.cpp \
 	third_party/skia/src/core/SkScalerContext.cpp \
 	third_party/skia/src/core/SkScan.cpp \
diff --git a/skia/skia_library.target.linux-x86.mk b/skia/skia_library.target.linux-x86.mk
index 56a28a1..1450f41 100644
--- a/skia/skia_library.target.linux-x86.mk
+++ b/skia/skia_library.target.linux-x86.mk
@@ -155,6 +155,7 @@
 	third_party/skia/src/core/SkRegion_path.cpp \
 	third_party/skia/src/core/SkRRect.cpp \
 	third_party/skia/src/core/SkRTree.cpp \
+	third_party/skia/src/core/SkScaledImageCache.cpp \
 	third_party/skia/src/core/SkScalar.cpp \
 	third_party/skia/src/core/SkScalerContext.cpp \
 	third_party/skia/src/core/SkScan.cpp \
diff --git a/sql/sql.target.darwin-arm.mk b/sql/sql.target.darwin-arm.mk
index ea9f12e..63f2778 100644
--- a/sql/sql.target.darwin-arm.mk
+++ b/sql/sql.target.darwin-arm.mk
@@ -93,10 +93,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/sqlite \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
@@ -178,10 +178,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/sqlite \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
diff --git a/sql/sql.target.darwin-mips.mk b/sql/sql.target.darwin-mips.mk
index 1de2ede..fac792f 100644
--- a/sql/sql.target.darwin-mips.mk
+++ b/sql/sql.target.darwin-mips.mk
@@ -92,10 +92,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/sqlite \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
@@ -176,10 +176,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/sqlite \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
diff --git a/sql/sql.target.darwin-x86.mk b/sql/sql.target.darwin-x86.mk
index 83970d1..d6bfe36 100644
--- a/sql/sql.target.darwin-x86.mk
+++ b/sql/sql.target.darwin-x86.mk
@@ -95,10 +95,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/sqlite \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
@@ -183,10 +183,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/sqlite \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
diff --git a/sql/sql.target.linux-arm.mk b/sql/sql.target.linux-arm.mk
index ea9f12e..63f2778 100644
--- a/sql/sql.target.linux-arm.mk
+++ b/sql/sql.target.linux-arm.mk
@@ -93,10 +93,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/sqlite \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
@@ -178,10 +178,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/sqlite \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
diff --git a/sql/sql.target.linux-mips.mk b/sql/sql.target.linux-mips.mk
index 1de2ede..fac792f 100644
--- a/sql/sql.target.linux-mips.mk
+++ b/sql/sql.target.linux-mips.mk
@@ -92,10 +92,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/sqlite \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
@@ -176,10 +176,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/sqlite \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
diff --git a/sql/sql.target.linux-x86.mk b/sql/sql.target.linux-x86.mk
index 83970d1..d6bfe36 100644
--- a/sql/sql.target.linux-x86.mk
+++ b/sql/sql.target.linux-x86.mk
@@ -95,10 +95,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/sqlite \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
@@ -183,10 +183,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/sqlite \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
diff --git a/third_party/harfbuzz-ng/harfbuzz-ng.target.darwin-arm.mk b/third_party/harfbuzz-ng/harfbuzz-ng.target.darwin-arm.mk
index 2e745b8..c8d4f2c 100644
--- a/third_party/harfbuzz-ng/harfbuzz-ng.target.darwin-arm.mk
+++ b/third_party/harfbuzz-ng/harfbuzz-ng.target.darwin-arm.mk
@@ -119,8 +119,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH)/third_party/harfbuzz-ng/src \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(LOCAL_PATH)/third_party/harfbuzz-ng/src \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(PWD)/frameworks/wilhelm/include \
@@ -207,8 +207,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH)/third_party/harfbuzz-ng/src \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(LOCAL_PATH)/third_party/harfbuzz-ng/src \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/third_party/harfbuzz-ng/harfbuzz-ng.target.darwin-mips.mk b/third_party/harfbuzz-ng/harfbuzz-ng.target.darwin-mips.mk
index 60f52b5..53b4c7f 100644
--- a/third_party/harfbuzz-ng/harfbuzz-ng.target.darwin-mips.mk
+++ b/third_party/harfbuzz-ng/harfbuzz-ng.target.darwin-mips.mk
@@ -119,8 +119,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH)/third_party/harfbuzz-ng/src \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(LOCAL_PATH)/third_party/harfbuzz-ng/src \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(PWD)/frameworks/wilhelm/include \
@@ -207,8 +207,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH)/third_party/harfbuzz-ng/src \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(LOCAL_PATH)/third_party/harfbuzz-ng/src \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/third_party/harfbuzz-ng/harfbuzz-ng.target.darwin-x86.mk b/third_party/harfbuzz-ng/harfbuzz-ng.target.darwin-x86.mk
index 87fc840..256ef52 100644
--- a/third_party/harfbuzz-ng/harfbuzz-ng.target.darwin-x86.mk
+++ b/third_party/harfbuzz-ng/harfbuzz-ng.target.darwin-x86.mk
@@ -121,8 +121,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH)/third_party/harfbuzz-ng/src \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(LOCAL_PATH)/third_party/harfbuzz-ng/src \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(PWD)/frameworks/wilhelm/include \
@@ -212,8 +212,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH)/third_party/harfbuzz-ng/src \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(LOCAL_PATH)/third_party/harfbuzz-ng/src \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/third_party/harfbuzz-ng/harfbuzz-ng.target.linux-arm.mk b/third_party/harfbuzz-ng/harfbuzz-ng.target.linux-arm.mk
index 2e745b8..c8d4f2c 100644
--- a/third_party/harfbuzz-ng/harfbuzz-ng.target.linux-arm.mk
+++ b/third_party/harfbuzz-ng/harfbuzz-ng.target.linux-arm.mk
@@ -119,8 +119,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH)/third_party/harfbuzz-ng/src \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(LOCAL_PATH)/third_party/harfbuzz-ng/src \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(PWD)/frameworks/wilhelm/include \
@@ -207,8 +207,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH)/third_party/harfbuzz-ng/src \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(LOCAL_PATH)/third_party/harfbuzz-ng/src \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/third_party/harfbuzz-ng/harfbuzz-ng.target.linux-mips.mk b/third_party/harfbuzz-ng/harfbuzz-ng.target.linux-mips.mk
index 60f52b5..53b4c7f 100644
--- a/third_party/harfbuzz-ng/harfbuzz-ng.target.linux-mips.mk
+++ b/third_party/harfbuzz-ng/harfbuzz-ng.target.linux-mips.mk
@@ -119,8 +119,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH)/third_party/harfbuzz-ng/src \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(LOCAL_PATH)/third_party/harfbuzz-ng/src \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(PWD)/frameworks/wilhelm/include \
@@ -207,8 +207,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH)/third_party/harfbuzz-ng/src \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(LOCAL_PATH)/third_party/harfbuzz-ng/src \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/third_party/harfbuzz-ng/harfbuzz-ng.target.linux-x86.mk b/third_party/harfbuzz-ng/harfbuzz-ng.target.linux-x86.mk
index 87fc840..256ef52 100644
--- a/third_party/harfbuzz-ng/harfbuzz-ng.target.linux-x86.mk
+++ b/third_party/harfbuzz-ng/harfbuzz-ng.target.linux-x86.mk
@@ -121,8 +121,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH)/third_party/harfbuzz-ng/src \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(LOCAL_PATH)/third_party/harfbuzz-ng/src \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(PWD)/frameworks/wilhelm/include \
@@ -212,8 +212,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH)/third_party/harfbuzz-ng/src \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(LOCAL_PATH)/third_party/harfbuzz-ng/src \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/third_party/leveldatabase/chromium_logger.h b/third_party/leveldatabase/chromium_logger.h
index 3595d2b..76862c3 100644
--- a/third_party/leveldatabase/chromium_logger.h
+++ b/third_party/leveldatabase/chromium_logger.h
@@ -44,7 +44,7 @@
       ::base::Time::Now().LocalExplode(&t);
 
       p += ::base::snprintf(p, limit - p,
-                    "%04d/%02d/%02d-%02d:%02d:%02d.%03d %"PRIu64" ",
+                    "%04d/%02d/%02d-%02d:%02d:%02d.%03d %" PRIu64 " ",
                     t.year,
                     t.month,
                     t.day_of_month,
diff --git a/third_party/leveldatabase/leveldatabase.target.darwin-arm.mk b/third_party/leveldatabase/leveldatabase.target.darwin-arm.mk
index ae4f9fa..4aa3be9 100644
--- a/third_party/leveldatabase/leveldatabase.target.darwin-arm.mk
+++ b/third_party/leveldatabase/leveldatabase.target.darwin-arm.mk
@@ -125,10 +125,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/leveldatabase \
 	$(LOCAL_PATH)/third_party/leveldatabase/src \
 	$(LOCAL_PATH)/third_party/leveldatabase/src/include \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/re2 \
 	$(PWD)/frameworks/wilhelm/include \
@@ -212,10 +212,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/leveldatabase \
 	$(LOCAL_PATH)/third_party/leveldatabase/src \
 	$(LOCAL_PATH)/third_party/leveldatabase/src/include \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/re2 \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/third_party/leveldatabase/leveldatabase.target.darwin-mips.mk b/third_party/leveldatabase/leveldatabase.target.darwin-mips.mk
index 4a3edc1..2745866 100644
--- a/third_party/leveldatabase/leveldatabase.target.darwin-mips.mk
+++ b/third_party/leveldatabase/leveldatabase.target.darwin-mips.mk
@@ -125,10 +125,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/leveldatabase \
 	$(LOCAL_PATH)/third_party/leveldatabase/src \
 	$(LOCAL_PATH)/third_party/leveldatabase/src/include \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/re2 \
 	$(PWD)/frameworks/wilhelm/include \
@@ -212,10 +212,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/leveldatabase \
 	$(LOCAL_PATH)/third_party/leveldatabase/src \
 	$(LOCAL_PATH)/third_party/leveldatabase/src/include \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/re2 \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/third_party/leveldatabase/leveldatabase.target.darwin-x86.mk b/third_party/leveldatabase/leveldatabase.target.darwin-x86.mk
index 47673f8..7f7bf0f 100644
--- a/third_party/leveldatabase/leveldatabase.target.darwin-x86.mk
+++ b/third_party/leveldatabase/leveldatabase.target.darwin-x86.mk
@@ -127,10 +127,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/leveldatabase \
 	$(LOCAL_PATH)/third_party/leveldatabase/src \
 	$(LOCAL_PATH)/third_party/leveldatabase/src/include \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/re2 \
 	$(PWD)/frameworks/wilhelm/include \
@@ -217,10 +217,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/leveldatabase \
 	$(LOCAL_PATH)/third_party/leveldatabase/src \
 	$(LOCAL_PATH)/third_party/leveldatabase/src/include \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/re2 \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/third_party/leveldatabase/leveldatabase.target.linux-arm.mk b/third_party/leveldatabase/leveldatabase.target.linux-arm.mk
index ae4f9fa..4aa3be9 100644
--- a/third_party/leveldatabase/leveldatabase.target.linux-arm.mk
+++ b/third_party/leveldatabase/leveldatabase.target.linux-arm.mk
@@ -125,10 +125,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/leveldatabase \
 	$(LOCAL_PATH)/third_party/leveldatabase/src \
 	$(LOCAL_PATH)/third_party/leveldatabase/src/include \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/re2 \
 	$(PWD)/frameworks/wilhelm/include \
@@ -212,10 +212,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/leveldatabase \
 	$(LOCAL_PATH)/third_party/leveldatabase/src \
 	$(LOCAL_PATH)/third_party/leveldatabase/src/include \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/re2 \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/third_party/leveldatabase/leveldatabase.target.linux-mips.mk b/third_party/leveldatabase/leveldatabase.target.linux-mips.mk
index 4a3edc1..2745866 100644
--- a/third_party/leveldatabase/leveldatabase.target.linux-mips.mk
+++ b/third_party/leveldatabase/leveldatabase.target.linux-mips.mk
@@ -125,10 +125,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/leveldatabase \
 	$(LOCAL_PATH)/third_party/leveldatabase/src \
 	$(LOCAL_PATH)/third_party/leveldatabase/src/include \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/re2 \
 	$(PWD)/frameworks/wilhelm/include \
@@ -212,10 +212,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/leveldatabase \
 	$(LOCAL_PATH)/third_party/leveldatabase/src \
 	$(LOCAL_PATH)/third_party/leveldatabase/src/include \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/re2 \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/third_party/leveldatabase/leveldatabase.target.linux-x86.mk b/third_party/leveldatabase/leveldatabase.target.linux-x86.mk
index 47673f8..7f7bf0f 100644
--- a/third_party/leveldatabase/leveldatabase.target.linux-x86.mk
+++ b/third_party/leveldatabase/leveldatabase.target.linux-x86.mk
@@ -127,10 +127,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/leveldatabase \
 	$(LOCAL_PATH)/third_party/leveldatabase/src \
 	$(LOCAL_PATH)/third_party/leveldatabase/src/include \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/re2 \
 	$(PWD)/frameworks/wilhelm/include \
@@ -217,10 +217,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/leveldatabase \
 	$(LOCAL_PATH)/third_party/leveldatabase/src \
 	$(LOCAL_PATH)/third_party/leveldatabase/src/include \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/re2 \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/third_party/libjingle/libjingle.target.darwin-arm.mk b/third_party/libjingle/libjingle.target.darwin-arm.mk
index 05a0ee7..93505cf 100644
--- a/third_party/libjingle/libjingle.target.darwin-arm.mk
+++ b/third_party/libjingle/libjingle.target.darwin-arm.mk
@@ -222,6 +222,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/libjingle/overrides \
 	$(LOCAL_PATH)/third_party/libjingle/source \
 	$(LOCAL_PATH)/testing/gtest/include \
@@ -229,9 +232,6 @@
 	$(LOCAL_PATH)/third_party/libyuv/include \
 	$(LOCAL_PATH)/third_party/usrsctp \
 	$(LOCAL_PATH)/third_party/webrtc \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/expat/lib \
 	$(LOCAL_PATH)/third_party/openssl/openssl/include \
@@ -333,6 +333,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/libjingle/overrides \
 	$(LOCAL_PATH)/third_party/libjingle/source \
 	$(LOCAL_PATH)/testing/gtest/include \
@@ -340,9 +343,6 @@
 	$(LOCAL_PATH)/third_party/libyuv/include \
 	$(LOCAL_PATH)/third_party/usrsctp \
 	$(LOCAL_PATH)/third_party/webrtc \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/expat/lib \
 	$(LOCAL_PATH)/third_party/openssl/openssl/include \
diff --git a/third_party/libjingle/libjingle.target.darwin-mips.mk b/third_party/libjingle/libjingle.target.darwin-mips.mk
index 9dee31a..425899f 100644
--- a/third_party/libjingle/libjingle.target.darwin-mips.mk
+++ b/third_party/libjingle/libjingle.target.darwin-mips.mk
@@ -222,6 +222,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/libjingle/overrides \
 	$(LOCAL_PATH)/third_party/libjingle/source \
 	$(LOCAL_PATH)/testing/gtest/include \
@@ -229,9 +232,6 @@
 	$(LOCAL_PATH)/third_party/libyuv/include \
 	$(LOCAL_PATH)/third_party/usrsctp \
 	$(LOCAL_PATH)/third_party/webrtc \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/expat/lib \
 	$(LOCAL_PATH)/third_party/openssl/openssl/include \
@@ -333,6 +333,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/libjingle/overrides \
 	$(LOCAL_PATH)/third_party/libjingle/source \
 	$(LOCAL_PATH)/testing/gtest/include \
@@ -340,9 +343,6 @@
 	$(LOCAL_PATH)/third_party/libyuv/include \
 	$(LOCAL_PATH)/third_party/usrsctp \
 	$(LOCAL_PATH)/third_party/webrtc \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/expat/lib \
 	$(LOCAL_PATH)/third_party/openssl/openssl/include \
diff --git a/third_party/libjingle/libjingle.target.darwin-x86.mk b/third_party/libjingle/libjingle.target.darwin-x86.mk
index a5702d9..5b0762b 100644
--- a/third_party/libjingle/libjingle.target.darwin-x86.mk
+++ b/third_party/libjingle/libjingle.target.darwin-x86.mk
@@ -223,6 +223,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/libjingle/overrides \
 	$(LOCAL_PATH)/third_party/libjingle/source \
 	$(LOCAL_PATH)/testing/gtest/include \
@@ -230,9 +233,6 @@
 	$(LOCAL_PATH)/third_party/libyuv/include \
 	$(LOCAL_PATH)/third_party/usrsctp \
 	$(LOCAL_PATH)/third_party/webrtc \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/expat/lib \
 	$(LOCAL_PATH)/third_party/openssl/openssl/include \
@@ -336,6 +336,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/libjingle/overrides \
 	$(LOCAL_PATH)/third_party/libjingle/source \
 	$(LOCAL_PATH)/testing/gtest/include \
@@ -343,9 +346,6 @@
 	$(LOCAL_PATH)/third_party/libyuv/include \
 	$(LOCAL_PATH)/third_party/usrsctp \
 	$(LOCAL_PATH)/third_party/webrtc \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/expat/lib \
 	$(LOCAL_PATH)/third_party/openssl/openssl/include \
diff --git a/third_party/libjingle/libjingle.target.linux-arm.mk b/third_party/libjingle/libjingle.target.linux-arm.mk
index 05a0ee7..93505cf 100644
--- a/third_party/libjingle/libjingle.target.linux-arm.mk
+++ b/third_party/libjingle/libjingle.target.linux-arm.mk
@@ -222,6 +222,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/libjingle/overrides \
 	$(LOCAL_PATH)/third_party/libjingle/source \
 	$(LOCAL_PATH)/testing/gtest/include \
@@ -229,9 +232,6 @@
 	$(LOCAL_PATH)/third_party/libyuv/include \
 	$(LOCAL_PATH)/third_party/usrsctp \
 	$(LOCAL_PATH)/third_party/webrtc \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/expat/lib \
 	$(LOCAL_PATH)/third_party/openssl/openssl/include \
@@ -333,6 +333,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/libjingle/overrides \
 	$(LOCAL_PATH)/third_party/libjingle/source \
 	$(LOCAL_PATH)/testing/gtest/include \
@@ -340,9 +343,6 @@
 	$(LOCAL_PATH)/third_party/libyuv/include \
 	$(LOCAL_PATH)/third_party/usrsctp \
 	$(LOCAL_PATH)/third_party/webrtc \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/expat/lib \
 	$(LOCAL_PATH)/third_party/openssl/openssl/include \
diff --git a/third_party/libjingle/libjingle.target.linux-mips.mk b/third_party/libjingle/libjingle.target.linux-mips.mk
index 9dee31a..425899f 100644
--- a/third_party/libjingle/libjingle.target.linux-mips.mk
+++ b/third_party/libjingle/libjingle.target.linux-mips.mk
@@ -222,6 +222,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/libjingle/overrides \
 	$(LOCAL_PATH)/third_party/libjingle/source \
 	$(LOCAL_PATH)/testing/gtest/include \
@@ -229,9 +232,6 @@
 	$(LOCAL_PATH)/third_party/libyuv/include \
 	$(LOCAL_PATH)/third_party/usrsctp \
 	$(LOCAL_PATH)/third_party/webrtc \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/expat/lib \
 	$(LOCAL_PATH)/third_party/openssl/openssl/include \
@@ -333,6 +333,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/libjingle/overrides \
 	$(LOCAL_PATH)/third_party/libjingle/source \
 	$(LOCAL_PATH)/testing/gtest/include \
@@ -340,9 +343,6 @@
 	$(LOCAL_PATH)/third_party/libyuv/include \
 	$(LOCAL_PATH)/third_party/usrsctp \
 	$(LOCAL_PATH)/third_party/webrtc \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/expat/lib \
 	$(LOCAL_PATH)/third_party/openssl/openssl/include \
diff --git a/third_party/libjingle/libjingle.target.linux-x86.mk b/third_party/libjingle/libjingle.target.linux-x86.mk
index a5702d9..5b0762b 100644
--- a/third_party/libjingle/libjingle.target.linux-x86.mk
+++ b/third_party/libjingle/libjingle.target.linux-x86.mk
@@ -223,6 +223,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/libjingle/overrides \
 	$(LOCAL_PATH)/third_party/libjingle/source \
 	$(LOCAL_PATH)/testing/gtest/include \
@@ -230,9 +233,6 @@
 	$(LOCAL_PATH)/third_party/libyuv/include \
 	$(LOCAL_PATH)/third_party/usrsctp \
 	$(LOCAL_PATH)/third_party/webrtc \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/expat/lib \
 	$(LOCAL_PATH)/third_party/openssl/openssl/include \
@@ -336,6 +336,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/libjingle/overrides \
 	$(LOCAL_PATH)/third_party/libjingle/source \
 	$(LOCAL_PATH)/testing/gtest/include \
@@ -343,9 +346,6 @@
 	$(LOCAL_PATH)/third_party/libyuv/include \
 	$(LOCAL_PATH)/third_party/usrsctp \
 	$(LOCAL_PATH)/third_party/webrtc \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/expat/lib \
 	$(LOCAL_PATH)/third_party/openssl/openssl/include \
diff --git a/third_party/libjingle/libjingle_p2p_constants.target.darwin-arm.mk b/third_party/libjingle/libjingle_p2p_constants.target.darwin-arm.mk
index 9dc3599..60c520d 100644
--- a/third_party/libjingle/libjingle_p2p_constants.target.darwin-arm.mk
+++ b/third_party/libjingle/libjingle_p2p_constants.target.darwin-arm.mk
@@ -106,6 +106,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/libjingle/overrides \
 	$(LOCAL_PATH)/third_party/libjingle/source \
 	$(LOCAL_PATH)/testing/gtest/include \
@@ -113,9 +116,6 @@
 	$(LOCAL_PATH)/third_party/libyuv/include \
 	$(LOCAL_PATH)/third_party/usrsctp \
 	$(LOCAL_PATH)/third_party/webrtc \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/expat/lib \
 	$(LOCAL_PATH)/third_party/openssl/openssl/include \
@@ -216,6 +216,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/libjingle/overrides \
 	$(LOCAL_PATH)/third_party/libjingle/source \
 	$(LOCAL_PATH)/testing/gtest/include \
@@ -223,9 +226,6 @@
 	$(LOCAL_PATH)/third_party/libyuv/include \
 	$(LOCAL_PATH)/third_party/usrsctp \
 	$(LOCAL_PATH)/third_party/webrtc \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/expat/lib \
 	$(LOCAL_PATH)/third_party/openssl/openssl/include \
diff --git a/third_party/libjingle/libjingle_p2p_constants.target.darwin-mips.mk b/third_party/libjingle/libjingle_p2p_constants.target.darwin-mips.mk
index 22ec86a..058d254 100644
--- a/third_party/libjingle/libjingle_p2p_constants.target.darwin-mips.mk
+++ b/third_party/libjingle/libjingle_p2p_constants.target.darwin-mips.mk
@@ -106,6 +106,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/libjingle/overrides \
 	$(LOCAL_PATH)/third_party/libjingle/source \
 	$(LOCAL_PATH)/testing/gtest/include \
@@ -113,9 +116,6 @@
 	$(LOCAL_PATH)/third_party/libyuv/include \
 	$(LOCAL_PATH)/third_party/usrsctp \
 	$(LOCAL_PATH)/third_party/webrtc \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/expat/lib \
 	$(LOCAL_PATH)/third_party/openssl/openssl/include \
@@ -216,6 +216,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/libjingle/overrides \
 	$(LOCAL_PATH)/third_party/libjingle/source \
 	$(LOCAL_PATH)/testing/gtest/include \
@@ -223,9 +226,6 @@
 	$(LOCAL_PATH)/third_party/libyuv/include \
 	$(LOCAL_PATH)/third_party/usrsctp \
 	$(LOCAL_PATH)/third_party/webrtc \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/expat/lib \
 	$(LOCAL_PATH)/third_party/openssl/openssl/include \
diff --git a/third_party/libjingle/libjingle_p2p_constants.target.darwin-x86.mk b/third_party/libjingle/libjingle_p2p_constants.target.darwin-x86.mk
index bebfda8..ca765b2 100644
--- a/third_party/libjingle/libjingle_p2p_constants.target.darwin-x86.mk
+++ b/third_party/libjingle/libjingle_p2p_constants.target.darwin-x86.mk
@@ -107,6 +107,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/libjingle/overrides \
 	$(LOCAL_PATH)/third_party/libjingle/source \
 	$(LOCAL_PATH)/testing/gtest/include \
@@ -114,9 +117,6 @@
 	$(LOCAL_PATH)/third_party/libyuv/include \
 	$(LOCAL_PATH)/third_party/usrsctp \
 	$(LOCAL_PATH)/third_party/webrtc \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/expat/lib \
 	$(LOCAL_PATH)/third_party/openssl/openssl/include \
@@ -219,6 +219,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/libjingle/overrides \
 	$(LOCAL_PATH)/third_party/libjingle/source \
 	$(LOCAL_PATH)/testing/gtest/include \
@@ -226,9 +229,6 @@
 	$(LOCAL_PATH)/third_party/libyuv/include \
 	$(LOCAL_PATH)/third_party/usrsctp \
 	$(LOCAL_PATH)/third_party/webrtc \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/expat/lib \
 	$(LOCAL_PATH)/third_party/openssl/openssl/include \
diff --git a/third_party/libjingle/libjingle_p2p_constants.target.linux-arm.mk b/third_party/libjingle/libjingle_p2p_constants.target.linux-arm.mk
index 9dc3599..60c520d 100644
--- a/third_party/libjingle/libjingle_p2p_constants.target.linux-arm.mk
+++ b/third_party/libjingle/libjingle_p2p_constants.target.linux-arm.mk
@@ -106,6 +106,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/libjingle/overrides \
 	$(LOCAL_PATH)/third_party/libjingle/source \
 	$(LOCAL_PATH)/testing/gtest/include \
@@ -113,9 +116,6 @@
 	$(LOCAL_PATH)/third_party/libyuv/include \
 	$(LOCAL_PATH)/third_party/usrsctp \
 	$(LOCAL_PATH)/third_party/webrtc \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/expat/lib \
 	$(LOCAL_PATH)/third_party/openssl/openssl/include \
@@ -216,6 +216,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/libjingle/overrides \
 	$(LOCAL_PATH)/third_party/libjingle/source \
 	$(LOCAL_PATH)/testing/gtest/include \
@@ -223,9 +226,6 @@
 	$(LOCAL_PATH)/third_party/libyuv/include \
 	$(LOCAL_PATH)/third_party/usrsctp \
 	$(LOCAL_PATH)/third_party/webrtc \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/expat/lib \
 	$(LOCAL_PATH)/third_party/openssl/openssl/include \
diff --git a/third_party/libjingle/libjingle_p2p_constants.target.linux-mips.mk b/third_party/libjingle/libjingle_p2p_constants.target.linux-mips.mk
index 22ec86a..058d254 100644
--- a/third_party/libjingle/libjingle_p2p_constants.target.linux-mips.mk
+++ b/third_party/libjingle/libjingle_p2p_constants.target.linux-mips.mk
@@ -106,6 +106,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/libjingle/overrides \
 	$(LOCAL_PATH)/third_party/libjingle/source \
 	$(LOCAL_PATH)/testing/gtest/include \
@@ -113,9 +116,6 @@
 	$(LOCAL_PATH)/third_party/libyuv/include \
 	$(LOCAL_PATH)/third_party/usrsctp \
 	$(LOCAL_PATH)/third_party/webrtc \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/expat/lib \
 	$(LOCAL_PATH)/third_party/openssl/openssl/include \
@@ -216,6 +216,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/libjingle/overrides \
 	$(LOCAL_PATH)/third_party/libjingle/source \
 	$(LOCAL_PATH)/testing/gtest/include \
@@ -223,9 +226,6 @@
 	$(LOCAL_PATH)/third_party/libyuv/include \
 	$(LOCAL_PATH)/third_party/usrsctp \
 	$(LOCAL_PATH)/third_party/webrtc \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/expat/lib \
 	$(LOCAL_PATH)/third_party/openssl/openssl/include \
diff --git a/third_party/libjingle/libjingle_p2p_constants.target.linux-x86.mk b/third_party/libjingle/libjingle_p2p_constants.target.linux-x86.mk
index bebfda8..ca765b2 100644
--- a/third_party/libjingle/libjingle_p2p_constants.target.linux-x86.mk
+++ b/third_party/libjingle/libjingle_p2p_constants.target.linux-x86.mk
@@ -107,6 +107,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/libjingle/overrides \
 	$(LOCAL_PATH)/third_party/libjingle/source \
 	$(LOCAL_PATH)/testing/gtest/include \
@@ -114,9 +117,6 @@
 	$(LOCAL_PATH)/third_party/libyuv/include \
 	$(LOCAL_PATH)/third_party/usrsctp \
 	$(LOCAL_PATH)/third_party/webrtc \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/expat/lib \
 	$(LOCAL_PATH)/third_party/openssl/openssl/include \
@@ -219,6 +219,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/libjingle/overrides \
 	$(LOCAL_PATH)/third_party/libjingle/source \
 	$(LOCAL_PATH)/testing/gtest/include \
@@ -226,9 +229,6 @@
 	$(LOCAL_PATH)/third_party/libyuv/include \
 	$(LOCAL_PATH)/third_party/usrsctp \
 	$(LOCAL_PATH)/third_party/webrtc \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/expat/lib \
 	$(LOCAL_PATH)/third_party/openssl/openssl/include \
diff --git a/third_party/libphonenumber/libphonenumber.target.darwin-arm.mk b/third_party/libphonenumber/libphonenumber.target.darwin-arm.mk
index cc12f05..baeb801 100644
--- a/third_party/libphonenumber/libphonenumber.target.darwin-arm.mk
+++ b/third_party/libphonenumber/libphonenumber.target.darwin-arm.mk
@@ -93,11 +93,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(LOCAL_PATH)/third_party/libphonenumber/src \
 	$(LOCAL_PATH)/third_party/libphonenumber/src/test \
 	$(gyp_shared_intermediate_dir)/protoc_out/third_party/libphonenumber \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(gyp_shared_intermediate_dir)/protoc_out \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/protobuf \
@@ -186,11 +186,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(LOCAL_PATH)/third_party/libphonenumber/src \
 	$(LOCAL_PATH)/third_party/libphonenumber/src/test \
 	$(gyp_shared_intermediate_dir)/protoc_out/third_party/libphonenumber \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(gyp_shared_intermediate_dir)/protoc_out \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/protobuf \
diff --git a/third_party/libphonenumber/libphonenumber.target.darwin-mips.mk b/third_party/libphonenumber/libphonenumber.target.darwin-mips.mk
index cbc0269..a2ba599 100644
--- a/third_party/libphonenumber/libphonenumber.target.darwin-mips.mk
+++ b/third_party/libphonenumber/libphonenumber.target.darwin-mips.mk
@@ -93,11 +93,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(LOCAL_PATH)/third_party/libphonenumber/src \
 	$(LOCAL_PATH)/third_party/libphonenumber/src/test \
 	$(gyp_shared_intermediate_dir)/protoc_out/third_party/libphonenumber \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(gyp_shared_intermediate_dir)/protoc_out \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/protobuf \
@@ -186,11 +186,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(LOCAL_PATH)/third_party/libphonenumber/src \
 	$(LOCAL_PATH)/third_party/libphonenumber/src/test \
 	$(gyp_shared_intermediate_dir)/protoc_out/third_party/libphonenumber \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(gyp_shared_intermediate_dir)/protoc_out \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/protobuf \
diff --git a/third_party/libphonenumber/libphonenumber.target.darwin-x86.mk b/third_party/libphonenumber/libphonenumber.target.darwin-x86.mk
index 7892047..6863fa1 100644
--- a/third_party/libphonenumber/libphonenumber.target.darwin-x86.mk
+++ b/third_party/libphonenumber/libphonenumber.target.darwin-x86.mk
@@ -95,11 +95,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(LOCAL_PATH)/third_party/libphonenumber/src \
 	$(LOCAL_PATH)/third_party/libphonenumber/src/test \
 	$(gyp_shared_intermediate_dir)/protoc_out/third_party/libphonenumber \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(gyp_shared_intermediate_dir)/protoc_out \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/protobuf \
@@ -191,11 +191,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(LOCAL_PATH)/third_party/libphonenumber/src \
 	$(LOCAL_PATH)/third_party/libphonenumber/src/test \
 	$(gyp_shared_intermediate_dir)/protoc_out/third_party/libphonenumber \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(gyp_shared_intermediate_dir)/protoc_out \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/protobuf \
diff --git a/third_party/libphonenumber/libphonenumber.target.linux-arm.mk b/third_party/libphonenumber/libphonenumber.target.linux-arm.mk
index cc12f05..baeb801 100644
--- a/third_party/libphonenumber/libphonenumber.target.linux-arm.mk
+++ b/third_party/libphonenumber/libphonenumber.target.linux-arm.mk
@@ -93,11 +93,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(LOCAL_PATH)/third_party/libphonenumber/src \
 	$(LOCAL_PATH)/third_party/libphonenumber/src/test \
 	$(gyp_shared_intermediate_dir)/protoc_out/third_party/libphonenumber \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(gyp_shared_intermediate_dir)/protoc_out \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/protobuf \
@@ -186,11 +186,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(LOCAL_PATH)/third_party/libphonenumber/src \
 	$(LOCAL_PATH)/third_party/libphonenumber/src/test \
 	$(gyp_shared_intermediate_dir)/protoc_out/third_party/libphonenumber \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(gyp_shared_intermediate_dir)/protoc_out \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/protobuf \
diff --git a/third_party/libphonenumber/libphonenumber.target.linux-mips.mk b/third_party/libphonenumber/libphonenumber.target.linux-mips.mk
index cbc0269..a2ba599 100644
--- a/third_party/libphonenumber/libphonenumber.target.linux-mips.mk
+++ b/third_party/libphonenumber/libphonenumber.target.linux-mips.mk
@@ -93,11 +93,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(LOCAL_PATH)/third_party/libphonenumber/src \
 	$(LOCAL_PATH)/third_party/libphonenumber/src/test \
 	$(gyp_shared_intermediate_dir)/protoc_out/third_party/libphonenumber \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(gyp_shared_intermediate_dir)/protoc_out \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/protobuf \
@@ -186,11 +186,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(LOCAL_PATH)/third_party/libphonenumber/src \
 	$(LOCAL_PATH)/third_party/libphonenumber/src/test \
 	$(gyp_shared_intermediate_dir)/protoc_out/third_party/libphonenumber \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(gyp_shared_intermediate_dir)/protoc_out \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/protobuf \
diff --git a/third_party/libphonenumber/libphonenumber.target.linux-x86.mk b/third_party/libphonenumber/libphonenumber.target.linux-x86.mk
index 7892047..6863fa1 100644
--- a/third_party/libphonenumber/libphonenumber.target.linux-x86.mk
+++ b/third_party/libphonenumber/libphonenumber.target.linux-x86.mk
@@ -95,11 +95,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(LOCAL_PATH)/third_party/libphonenumber/src \
 	$(LOCAL_PATH)/third_party/libphonenumber/src/test \
 	$(gyp_shared_intermediate_dir)/protoc_out/third_party/libphonenumber \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(gyp_shared_intermediate_dir)/protoc_out \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/protobuf \
@@ -191,11 +191,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(LOCAL_PATH)/third_party/libphonenumber/src \
 	$(LOCAL_PATH)/third_party/libphonenumber/src/test \
 	$(gyp_shared_intermediate_dir)/protoc_out/third_party/libphonenumber \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(gyp_shared_intermediate_dir)/protoc_out \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/protobuf \
diff --git a/third_party/libphonenumber/libphonenumber_without_metadata.target.darwin-arm.mk b/third_party/libphonenumber/libphonenumber_without_metadata.target.darwin-arm.mk
index 2fbd3a9..1bb0e09 100644
--- a/third_party/libphonenumber/libphonenumber_without_metadata.target.darwin-arm.mk
+++ b/third_party/libphonenumber/libphonenumber_without_metadata.target.darwin-arm.mk
@@ -158,13 +158,13 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(LOCAL_PATH)/third_party/libphonenumber/src \
 	$(LOCAL_PATH)/third_party/libphonenumber/src/test \
 	$(gyp_shared_intermediate_dir)/protoc_out/third_party/libphonenumber \
 	$(gyp_shared_intermediate_dir)/protoc_out \
 	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/protobuf \
@@ -254,13 +254,13 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(LOCAL_PATH)/third_party/libphonenumber/src \
 	$(LOCAL_PATH)/third_party/libphonenumber/src/test \
 	$(gyp_shared_intermediate_dir)/protoc_out/third_party/libphonenumber \
 	$(gyp_shared_intermediate_dir)/protoc_out \
 	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/protobuf \
diff --git a/third_party/libphonenumber/libphonenumber_without_metadata.target.darwin-mips.mk b/third_party/libphonenumber/libphonenumber_without_metadata.target.darwin-mips.mk
index c043544..8dea3b7 100644
--- a/third_party/libphonenumber/libphonenumber_without_metadata.target.darwin-mips.mk
+++ b/third_party/libphonenumber/libphonenumber_without_metadata.target.darwin-mips.mk
@@ -158,13 +158,13 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(LOCAL_PATH)/third_party/libphonenumber/src \
 	$(LOCAL_PATH)/third_party/libphonenumber/src/test \
 	$(gyp_shared_intermediate_dir)/protoc_out/third_party/libphonenumber \
 	$(gyp_shared_intermediate_dir)/protoc_out \
 	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/protobuf \
@@ -254,13 +254,13 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(LOCAL_PATH)/third_party/libphonenumber/src \
 	$(LOCAL_PATH)/third_party/libphonenumber/src/test \
 	$(gyp_shared_intermediate_dir)/protoc_out/third_party/libphonenumber \
 	$(gyp_shared_intermediate_dir)/protoc_out \
 	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/protobuf \
diff --git a/third_party/libphonenumber/libphonenumber_without_metadata.target.darwin-x86.mk b/third_party/libphonenumber/libphonenumber_without_metadata.target.darwin-x86.mk
index 4df2595..ee9217e 100644
--- a/third_party/libphonenumber/libphonenumber_without_metadata.target.darwin-x86.mk
+++ b/third_party/libphonenumber/libphonenumber_without_metadata.target.darwin-x86.mk
@@ -160,13 +160,13 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(LOCAL_PATH)/third_party/libphonenumber/src \
 	$(LOCAL_PATH)/third_party/libphonenumber/src/test \
 	$(gyp_shared_intermediate_dir)/protoc_out/third_party/libphonenumber \
 	$(gyp_shared_intermediate_dir)/protoc_out \
 	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/protobuf \
@@ -259,13 +259,13 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(LOCAL_PATH)/third_party/libphonenumber/src \
 	$(LOCAL_PATH)/third_party/libphonenumber/src/test \
 	$(gyp_shared_intermediate_dir)/protoc_out/third_party/libphonenumber \
 	$(gyp_shared_intermediate_dir)/protoc_out \
 	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/protobuf \
diff --git a/third_party/libphonenumber/libphonenumber_without_metadata.target.linux-arm.mk b/third_party/libphonenumber/libphonenumber_without_metadata.target.linux-arm.mk
index 2fbd3a9..1bb0e09 100644
--- a/third_party/libphonenumber/libphonenumber_without_metadata.target.linux-arm.mk
+++ b/third_party/libphonenumber/libphonenumber_without_metadata.target.linux-arm.mk
@@ -158,13 +158,13 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(LOCAL_PATH)/third_party/libphonenumber/src \
 	$(LOCAL_PATH)/third_party/libphonenumber/src/test \
 	$(gyp_shared_intermediate_dir)/protoc_out/third_party/libphonenumber \
 	$(gyp_shared_intermediate_dir)/protoc_out \
 	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/protobuf \
@@ -254,13 +254,13 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(LOCAL_PATH)/third_party/libphonenumber/src \
 	$(LOCAL_PATH)/third_party/libphonenumber/src/test \
 	$(gyp_shared_intermediate_dir)/protoc_out/third_party/libphonenumber \
 	$(gyp_shared_intermediate_dir)/protoc_out \
 	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/protobuf \
diff --git a/third_party/libphonenumber/libphonenumber_without_metadata.target.linux-mips.mk b/third_party/libphonenumber/libphonenumber_without_metadata.target.linux-mips.mk
index c043544..8dea3b7 100644
--- a/third_party/libphonenumber/libphonenumber_without_metadata.target.linux-mips.mk
+++ b/third_party/libphonenumber/libphonenumber_without_metadata.target.linux-mips.mk
@@ -158,13 +158,13 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(LOCAL_PATH)/third_party/libphonenumber/src \
 	$(LOCAL_PATH)/third_party/libphonenumber/src/test \
 	$(gyp_shared_intermediate_dir)/protoc_out/third_party/libphonenumber \
 	$(gyp_shared_intermediate_dir)/protoc_out \
 	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/protobuf \
@@ -254,13 +254,13 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(LOCAL_PATH)/third_party/libphonenumber/src \
 	$(LOCAL_PATH)/third_party/libphonenumber/src/test \
 	$(gyp_shared_intermediate_dir)/protoc_out/third_party/libphonenumber \
 	$(gyp_shared_intermediate_dir)/protoc_out \
 	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/protobuf \
diff --git a/third_party/libphonenumber/libphonenumber_without_metadata.target.linux-x86.mk b/third_party/libphonenumber/libphonenumber_without_metadata.target.linux-x86.mk
index 4df2595..ee9217e 100644
--- a/third_party/libphonenumber/libphonenumber_without_metadata.target.linux-x86.mk
+++ b/third_party/libphonenumber/libphonenumber_without_metadata.target.linux-x86.mk
@@ -160,13 +160,13 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(LOCAL_PATH)/third_party/libphonenumber/src \
 	$(LOCAL_PATH)/third_party/libphonenumber/src/test \
 	$(gyp_shared_intermediate_dir)/protoc_out/third_party/libphonenumber \
 	$(gyp_shared_intermediate_dir)/protoc_out \
 	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/protobuf \
@@ -259,13 +259,13 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(LOCAL_PATH)/third_party/libphonenumber/src \
 	$(LOCAL_PATH)/third_party/libphonenumber/src/test \
 	$(gyp_shared_intermediate_dir)/protoc_out/third_party/libphonenumber \
 	$(gyp_shared_intermediate_dir)/protoc_out \
 	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/protobuf \
diff --git a/third_party/libxml/libxml.target.darwin-arm.mk b/third_party/libxml/libxml.target.darwin-arm.mk
index 3029ed5..c429465 100644
--- a/third_party/libxml/libxml.target.darwin-arm.mk
+++ b/third_party/libxml/libxml.target.darwin-arm.mk
@@ -135,10 +135,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/libxml/linux \
 	$(LOCAL_PATH)/third_party/libxml/linux/include \
 	$(LOCAL_PATH)/third_party/libxml/src/include \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/zlib \
@@ -225,10 +225,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/libxml/linux \
 	$(LOCAL_PATH)/third_party/libxml/linux/include \
 	$(LOCAL_PATH)/third_party/libxml/src/include \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/zlib \
diff --git a/third_party/libxml/libxml.target.darwin-mips.mk b/third_party/libxml/libxml.target.darwin-mips.mk
index c291035..64addc1 100644
--- a/third_party/libxml/libxml.target.darwin-mips.mk
+++ b/third_party/libxml/libxml.target.darwin-mips.mk
@@ -135,10 +135,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/libxml/linux \
 	$(LOCAL_PATH)/third_party/libxml/linux/include \
 	$(LOCAL_PATH)/third_party/libxml/src/include \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/zlib \
@@ -225,10 +225,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/libxml/linux \
 	$(LOCAL_PATH)/third_party/libxml/linux/include \
 	$(LOCAL_PATH)/third_party/libxml/src/include \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/zlib \
diff --git a/third_party/libxml/libxml.target.darwin-x86.mk b/third_party/libxml/libxml.target.darwin-x86.mk
index 731ac1d..1bf8774 100644
--- a/third_party/libxml/libxml.target.darwin-x86.mk
+++ b/third_party/libxml/libxml.target.darwin-x86.mk
@@ -137,10 +137,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/libxml/linux \
 	$(LOCAL_PATH)/third_party/libxml/linux/include \
 	$(LOCAL_PATH)/third_party/libxml/src/include \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/zlib \
@@ -230,10 +230,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/libxml/linux \
 	$(LOCAL_PATH)/third_party/libxml/linux/include \
 	$(LOCAL_PATH)/third_party/libxml/src/include \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/zlib \
diff --git a/third_party/libxml/libxml.target.linux-arm.mk b/third_party/libxml/libxml.target.linux-arm.mk
index 3029ed5..c429465 100644
--- a/third_party/libxml/libxml.target.linux-arm.mk
+++ b/third_party/libxml/libxml.target.linux-arm.mk
@@ -135,10 +135,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/libxml/linux \
 	$(LOCAL_PATH)/third_party/libxml/linux/include \
 	$(LOCAL_PATH)/third_party/libxml/src/include \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/zlib \
@@ -225,10 +225,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/libxml/linux \
 	$(LOCAL_PATH)/third_party/libxml/linux/include \
 	$(LOCAL_PATH)/third_party/libxml/src/include \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/zlib \
diff --git a/third_party/libxml/libxml.target.linux-mips.mk b/third_party/libxml/libxml.target.linux-mips.mk
index c291035..64addc1 100644
--- a/third_party/libxml/libxml.target.linux-mips.mk
+++ b/third_party/libxml/libxml.target.linux-mips.mk
@@ -135,10 +135,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/libxml/linux \
 	$(LOCAL_PATH)/third_party/libxml/linux/include \
 	$(LOCAL_PATH)/third_party/libxml/src/include \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/zlib \
@@ -225,10 +225,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/libxml/linux \
 	$(LOCAL_PATH)/third_party/libxml/linux/include \
 	$(LOCAL_PATH)/third_party/libxml/src/include \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/zlib \
diff --git a/third_party/libxml/libxml.target.linux-x86.mk b/third_party/libxml/libxml.target.linux-x86.mk
index 731ac1d..1bf8774 100644
--- a/third_party/libxml/libxml.target.linux-x86.mk
+++ b/third_party/libxml/libxml.target.linux-x86.mk
@@ -137,10 +137,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/libxml/linux \
 	$(LOCAL_PATH)/third_party/libxml/linux/include \
 	$(LOCAL_PATH)/third_party/libxml/src/include \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/zlib \
@@ -230,10 +230,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/libxml/linux \
 	$(LOCAL_PATH)/third_party/libxml/linux/include \
 	$(LOCAL_PATH)/third_party/libxml/src/include \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(LOCAL_PATH)/third_party/zlib \
diff --git a/third_party/libxslt/libxslt.target.darwin-arm.mk b/third_party/libxslt/libxslt.target.darwin-arm.mk
index e3a3024..290b30d 100644
--- a/third_party/libxslt/libxslt.target.darwin-arm.mk
+++ b/third_party/libxslt/libxslt.target.darwin-arm.mk
@@ -108,9 +108,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/libxslt/linux \
 	$(LOCAL_PATH)/third_party/libxslt \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/libxml/linux/include \
 	$(LOCAL_PATH)/third_party/libxml/src/include \
 	$(PWD)/external/icu4c/common \
@@ -198,9 +198,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/libxslt/linux \
 	$(LOCAL_PATH)/third_party/libxslt \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/libxml/linux/include \
 	$(LOCAL_PATH)/third_party/libxml/src/include \
 	$(PWD)/external/icu4c/common \
diff --git a/third_party/libxslt/libxslt.target.darwin-mips.mk b/third_party/libxslt/libxslt.target.darwin-mips.mk
index 8e63969..48d60a8 100644
--- a/third_party/libxslt/libxslt.target.darwin-mips.mk
+++ b/third_party/libxslt/libxslt.target.darwin-mips.mk
@@ -108,9 +108,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/libxslt/linux \
 	$(LOCAL_PATH)/third_party/libxslt \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/libxml/linux/include \
 	$(LOCAL_PATH)/third_party/libxml/src/include \
 	$(PWD)/external/icu4c/common \
@@ -198,9 +198,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/libxslt/linux \
 	$(LOCAL_PATH)/third_party/libxslt \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/libxml/linux/include \
 	$(LOCAL_PATH)/third_party/libxml/src/include \
 	$(PWD)/external/icu4c/common \
diff --git a/third_party/libxslt/libxslt.target.darwin-x86.mk b/third_party/libxslt/libxslt.target.darwin-x86.mk
index ff80f8d..4048dbe 100644
--- a/third_party/libxslt/libxslt.target.darwin-x86.mk
+++ b/third_party/libxslt/libxslt.target.darwin-x86.mk
@@ -110,9 +110,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/libxslt/linux \
 	$(LOCAL_PATH)/third_party/libxslt \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/libxml/linux/include \
 	$(LOCAL_PATH)/third_party/libxml/src/include \
 	$(PWD)/external/icu4c/common \
@@ -203,9 +203,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/libxslt/linux \
 	$(LOCAL_PATH)/third_party/libxslt \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/libxml/linux/include \
 	$(LOCAL_PATH)/third_party/libxml/src/include \
 	$(PWD)/external/icu4c/common \
diff --git a/third_party/libxslt/libxslt.target.linux-arm.mk b/third_party/libxslt/libxslt.target.linux-arm.mk
index e3a3024..290b30d 100644
--- a/third_party/libxslt/libxslt.target.linux-arm.mk
+++ b/third_party/libxslt/libxslt.target.linux-arm.mk
@@ -108,9 +108,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/libxslt/linux \
 	$(LOCAL_PATH)/third_party/libxslt \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/libxml/linux/include \
 	$(LOCAL_PATH)/third_party/libxml/src/include \
 	$(PWD)/external/icu4c/common \
@@ -198,9 +198,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/libxslt/linux \
 	$(LOCAL_PATH)/third_party/libxslt \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/libxml/linux/include \
 	$(LOCAL_PATH)/third_party/libxml/src/include \
 	$(PWD)/external/icu4c/common \
diff --git a/third_party/libxslt/libxslt.target.linux-mips.mk b/third_party/libxslt/libxslt.target.linux-mips.mk
index 8e63969..48d60a8 100644
--- a/third_party/libxslt/libxslt.target.linux-mips.mk
+++ b/third_party/libxslt/libxslt.target.linux-mips.mk
@@ -108,9 +108,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/libxslt/linux \
 	$(LOCAL_PATH)/third_party/libxslt \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/libxml/linux/include \
 	$(LOCAL_PATH)/third_party/libxml/src/include \
 	$(PWD)/external/icu4c/common \
@@ -198,9 +198,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/libxslt/linux \
 	$(LOCAL_PATH)/third_party/libxslt \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/libxml/linux/include \
 	$(LOCAL_PATH)/third_party/libxml/src/include \
 	$(PWD)/external/icu4c/common \
diff --git a/third_party/libxslt/libxslt.target.linux-x86.mk b/third_party/libxslt/libxslt.target.linux-x86.mk
index ff80f8d..4048dbe 100644
--- a/third_party/libxslt/libxslt.target.linux-x86.mk
+++ b/third_party/libxslt/libxslt.target.linux-x86.mk
@@ -110,9 +110,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/libxslt/linux \
 	$(LOCAL_PATH)/third_party/libxslt \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/libxml/linux/include \
 	$(LOCAL_PATH)/third_party/libxml/src/include \
 	$(PWD)/external/icu4c/common \
@@ -203,9 +203,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/libxslt/linux \
 	$(LOCAL_PATH)/third_party/libxslt \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/libxml/linux/include \
 	$(LOCAL_PATH)/third_party/libxml/src/include \
 	$(PWD)/external/icu4c/common \
diff --git a/third_party/sqlite/sqlite.target.darwin-arm.mk b/third_party/sqlite/sqlite.target.darwin-arm.mk
index a2ae57c..4a39685 100644
--- a/third_party/sqlite/sqlite.target.darwin-arm.mk
+++ b/third_party/sqlite/sqlite.target.darwin-arm.mk
@@ -112,10 +112,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(LOCAL_PATH)/third_party/sqlite/amalgamation \
 	$(LOCAL_PATH)/third_party/sqlite/src/src \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(PWD)/frameworks/wilhelm/include \
@@ -215,10 +215,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(LOCAL_PATH)/third_party/sqlite/amalgamation \
 	$(LOCAL_PATH)/third_party/sqlite/src/src \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/third_party/sqlite/sqlite.target.darwin-mips.mk b/third_party/sqlite/sqlite.target.darwin-mips.mk
index ea967f8..b123ac5 100644
--- a/third_party/sqlite/sqlite.target.darwin-mips.mk
+++ b/third_party/sqlite/sqlite.target.darwin-mips.mk
@@ -112,10 +112,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(LOCAL_PATH)/third_party/sqlite/amalgamation \
 	$(LOCAL_PATH)/third_party/sqlite/src/src \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(PWD)/frameworks/wilhelm/include \
@@ -215,10 +215,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(LOCAL_PATH)/third_party/sqlite/amalgamation \
 	$(LOCAL_PATH)/third_party/sqlite/src/src \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/third_party/sqlite/sqlite.target.darwin-x86.mk b/third_party/sqlite/sqlite.target.darwin-x86.mk
index e65d1d0..0660cc1 100644
--- a/third_party/sqlite/sqlite.target.darwin-x86.mk
+++ b/third_party/sqlite/sqlite.target.darwin-x86.mk
@@ -114,10 +114,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(LOCAL_PATH)/third_party/sqlite/amalgamation \
 	$(LOCAL_PATH)/third_party/sqlite/src/src \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(PWD)/frameworks/wilhelm/include \
@@ -220,10 +220,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(LOCAL_PATH)/third_party/sqlite/amalgamation \
 	$(LOCAL_PATH)/third_party/sqlite/src/src \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/third_party/sqlite/sqlite.target.linux-arm.mk b/third_party/sqlite/sqlite.target.linux-arm.mk
index a2ae57c..4a39685 100644
--- a/third_party/sqlite/sqlite.target.linux-arm.mk
+++ b/third_party/sqlite/sqlite.target.linux-arm.mk
@@ -112,10 +112,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(LOCAL_PATH)/third_party/sqlite/amalgamation \
 	$(LOCAL_PATH)/third_party/sqlite/src/src \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(PWD)/frameworks/wilhelm/include \
@@ -215,10 +215,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(LOCAL_PATH)/third_party/sqlite/amalgamation \
 	$(LOCAL_PATH)/third_party/sqlite/src/src \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/third_party/sqlite/sqlite.target.linux-mips.mk b/third_party/sqlite/sqlite.target.linux-mips.mk
index ea967f8..b123ac5 100644
--- a/third_party/sqlite/sqlite.target.linux-mips.mk
+++ b/third_party/sqlite/sqlite.target.linux-mips.mk
@@ -112,10 +112,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(LOCAL_PATH)/third_party/sqlite/amalgamation \
 	$(LOCAL_PATH)/third_party/sqlite/src/src \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(PWD)/frameworks/wilhelm/include \
@@ -215,10 +215,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(LOCAL_PATH)/third_party/sqlite/amalgamation \
 	$(LOCAL_PATH)/third_party/sqlite/src/src \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/third_party/sqlite/sqlite.target.linux-x86.mk b/third_party/sqlite/sqlite.target.linux-x86.mk
index e65d1d0..0660cc1 100644
--- a/third_party/sqlite/sqlite.target.linux-x86.mk
+++ b/third_party/sqlite/sqlite.target.linux-x86.mk
@@ -114,10 +114,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(LOCAL_PATH)/third_party/sqlite/amalgamation \
 	$(LOCAL_PATH)/third_party/sqlite/src/src \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(PWD)/frameworks/wilhelm/include \
@@ -220,10 +220,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(LOCAL_PATH)/third_party/sqlite/amalgamation \
 	$(LOCAL_PATH)/third_party/sqlite/src/src \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/third_party/tcmalloc/README.chromium b/third_party/tcmalloc/README.chromium
index 9da19ca..0682e8d 100644
--- a/third_party/tcmalloc/README.chromium
+++ b/third_party/tcmalloc/README.chromium
@@ -89,3 +89,5 @@
 - Added support for android.
 - Use NULL instead of static_cast<uintptr_t>(0) in stack_trace_table.cc,
   for -std=c++11 compatibility.
+- Added support for pseudo-stack heap profiling via a callback to retrieve a
+  simulated stack from the embedding application.
diff --git a/third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h b/third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h
index 8e3ee96..c2f1699 100644
--- a/third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h
+++ b/third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h
@@ -68,9 +68,24 @@
 
 /* Start profiling and arrange to write profile data to file names
  * of the form: "prefix.0000", "prefix.0001", ...
+ *
+ * If |prefix| is NULL then dumps will not be written to disk. Applications
+ * can use GetHeapProfile() to get profile data, but HeapProfilerDump() will do
+ * nothing.
  */
 PERFTOOLS_DLL_DECL void HeapProfilerStart(const char* prefix);
 
+/* Start profiling with a callback function that returns application-generated
+ * stacks. Profiles are not written to disk, but may be obtained via
+ * GetHeapProfile(). The callback:
+ * 1. May optionally skip the first |skip_count| items on the stack.
+ * 2. Must provide a |stack| buffer of at least size 32 * sizeof(void*).
+ * 3. Must return the number of items copied or zero.
+ */
+typedef int (*StackGeneratorFunction)(int skip_count, void** stack);
+PERFTOOLS_DLL_DECL void HeapProfilerWithPseudoStackStart(
+    StackGeneratorFunction callback);
+
 /* Returns non-zero if we are currently profiling the heap.  (Returns
  * an int rather than a bool so it's usable from C.)  This is true
  * between calls to HeapProfilerStart() and HeapProfilerStop(), and
diff --git a/third_party/tcmalloc/chromium/src/heap-profiler.cc b/third_party/tcmalloc/chromium/src/heap-profiler.cc
index eb993a5..8d7bc42 100644
--- a/third_party/tcmalloc/chromium/src/heap-profiler.cc
+++ b/third_party/tcmalloc/chromium/src/heap-profiler.cc
@@ -222,6 +222,11 @@
 static HeapProfileTable* heap_profile = NULL;  // the heap profile table
 static DeepHeapProfile* deep_profile = NULL;  // deep memory profiler
 
+// Callback to generate a stack trace for an allocation. May be overriden
+// by an application to provide its own pseudo-stacks.
+static StackGeneratorFunction stack_generator_function =
+    HeapProfileTable::GetCallerStackTrace;
+
 //----------------------------------------------------------------------
 // Profile generation
 //----------------------------------------------------------------------
@@ -374,7 +379,7 @@
 static void RecordAlloc(const void* ptr, size_t bytes, int skip_count) {
   // Take the stack trace outside the critical section.
   void* stack[HeapProfileTable::kMaxStackDepth];
-  int depth = HeapProfileTable::GetCallerStackTrace(skip_count + 1, stack);
+  int depth = stack_generator_function(skip_count + 1, stack);
   SpinLockHolder l(&heap_lock);
   if (is_on) {
     heap_profile->RecordAlloc(ptr, bytes, depth, stack);
@@ -542,7 +547,9 @@
     RAW_CHECK(MallocHook::AddDeleteHook(&DeleteHook), "");
   }
 
-  // Copy filename prefix
+  // Copy filename prefix only if provided.
+  if (!prefix)
+    return;
   RAW_DCHECK(filename_prefix == NULL, "");
   const int prefix_length = strlen(prefix);
   filename_prefix = reinterpret_cast<char*>(ProfilerMalloc(prefix_length + 1));
@@ -550,6 +557,16 @@
   filename_prefix[prefix_length] = '\0';
 }
 
+extern "C" void HeapProfilerWithPseudoStackStart(
+    StackGeneratorFunction callback) {
+  {
+    // Ensure the callback is set before allocations can be recorded.
+    SpinLockHolder l(&heap_lock);
+    stack_generator_function = callback;
+  }
+  HeapProfilerStart(NULL);
+}
+
 extern "C" void IterateAllocatedObjects(AddressVisitor visitor, void* data) {
   SpinLockHolder l(&heap_lock);
 
diff --git a/third_party/zlib/zip.target.darwin-arm.mk b/third_party/zlib/zip.target.darwin-arm.mk
index e09b30f..bc40f8c 100644
--- a/third_party/zlib/zip.target.darwin-arm.mk
+++ b/third_party/zlib/zip.target.darwin-arm.mk
@@ -90,8 +90,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/zlib \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
@@ -173,8 +173,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/zlib \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
diff --git a/third_party/zlib/zip.target.darwin-mips.mk b/third_party/zlib/zip.target.darwin-mips.mk
index ed582e2..554ba41 100644
--- a/third_party/zlib/zip.target.darwin-mips.mk
+++ b/third_party/zlib/zip.target.darwin-mips.mk
@@ -90,8 +90,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/zlib \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
@@ -173,8 +173,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/zlib \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
diff --git a/third_party/zlib/zip.target.darwin-x86.mk b/third_party/zlib/zip.target.darwin-x86.mk
index 9486a31..101b637 100644
--- a/third_party/zlib/zip.target.darwin-x86.mk
+++ b/third_party/zlib/zip.target.darwin-x86.mk
@@ -92,8 +92,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/zlib \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
@@ -178,8 +178,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/zlib \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
diff --git a/third_party/zlib/zip.target.linux-arm.mk b/third_party/zlib/zip.target.linux-arm.mk
index e09b30f..bc40f8c 100644
--- a/third_party/zlib/zip.target.linux-arm.mk
+++ b/third_party/zlib/zip.target.linux-arm.mk
@@ -90,8 +90,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/zlib \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
@@ -173,8 +173,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/zlib \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
diff --git a/third_party/zlib/zip.target.linux-mips.mk b/third_party/zlib/zip.target.linux-mips.mk
index ed582e2..554ba41 100644
--- a/third_party/zlib/zip.target.linux-mips.mk
+++ b/third_party/zlib/zip.target.linux-mips.mk
@@ -90,8 +90,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/zlib \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
@@ -173,8 +173,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/zlib \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
diff --git a/third_party/zlib/zip.target.linux-x86.mk b/third_party/zlib/zip.target.linux-x86.mk
index 9486a31..101b637 100644
--- a/third_party/zlib/zip.target.linux-x86.mk
+++ b/third_party/zlib/zip.target.linux-x86.mk
@@ -92,8 +92,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/zlib \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
@@ -178,8 +178,8 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/zlib \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
diff --git a/tools/heapcheck/suppressions.txt b/tools/heapcheck/suppressions.txt
index d669fe8..e3b0035 100644
--- a/tools/heapcheck/suppressions.txt
+++ b/tools/heapcheck/suppressions.txt
@@ -530,6 +530,20 @@
    ...
    fun:*CreateLocaleDefaultValue
    ...
+   fun:PermissionQueueControllerTests::SetUp
+}
+{
+   bug_155530_c
+   Heapcheck:Leak
+   ...
+   fun:PermissionQueueControllerTests_OneObservationPerInfoBarCancelled_Test::TestBody
+}
+{
+   bug_155530_d
+   Heapcheck:Leak
+   ...
+   fun:*CreateLocaleDefaultValue
+   ...
    fun:GeolocationInfoBarQueueControllerTests::SetUp
 }
 {
@@ -1071,3 +1085,21 @@
    fun:base::FilePath::AppendASCII
    fun:SetUp
 }
+{
+   bug_263748a
+   Heapcheck:Leak
+   ...
+   fun:DisassemblerElf32X86Test_All_Test::TestBody
+}
+{
+   bug_263748b
+   Heapcheck:Leak
+   ...
+   fun:TypedRVATest_*_Test::TestBody
+}
+{
+   bug_263748c
+   Heapcheck:Leak
+   ...
+   fun:EncodeDecodeTest_Elf_Small_Test::TestBody
+}
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index e428ca6..2e86f1d 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -12730,6 +12730,20 @@
   </summary>
 </histogram>
 
+<histogram name="Settings.HomePageIsNewTabPage" enum="Boolean">
+  <summary>
+    Whether or not the home page user preference is set to the default NTP value
+    when a profile is loaded.
+  </summary>
+</histogram>
+
+<histogram name="Settings.ShowHomeButton" enum="BooleanEnabled">
+  <summary>
+    Whether or not the Home button is enabled in user preferences when a profile
+    is loaded.
+  </summary>
+</histogram>
+
 <histogram name="SimpleCache.CheckCRCResult" enum="CheckCRCResult">
   <summary>
     Whether or not the CRC was checked at the moment when the last reference to
@@ -12840,6 +12854,12 @@
   </summary>
 </histogram>
 
+<histogram name="SimpleCache.IndexFileStateOnLoad" enum="SimpleIndexState">
+  <summary>
+    The state the index file is at when an attempt is made to load from it.
+  </summary>
+</histogram>
+
 <histogram name="SimpleCache.IndexInitializationWaiters">
   <summary>
     At the time of index initialization, the number of enqueued jobs awaiting
@@ -12870,6 +12890,9 @@
 </histogram>
 
 <histogram name="SimpleCache.IndexStale" enum="BooleanStale">
+  <obsolete>
+    Deprecated 07/2013, and replaced by IndexFileStateOnLoad.
+  </obsolete>
   <summary>For each index load, whether the index file was stale.</summary>
 </histogram>
 
@@ -12924,6 +12947,21 @@
   </summary>
 </histogram>
 
+<histogram name="SimpleCache.LastClusterLossPercent" units="percent">
+  <summary>
+    For each file in the Simple Cache, the percentage of disk space used by the
+    cluster loss, the unused disk space in the last 4096 byte cluster of the
+    file.
+  </summary>
+</histogram>
+
+<histogram name="SimpleCache.LastClusterSize" units="bytes">
+  <summary>
+    For each file in the Simple Cache, the number of bytes in the last 4096 byte
+    cluster when the entry is saved to disk.
+  </summary>
+</histogram>
+
 <histogram name="SimpleCache.OpenEntryIndexState"
     enum="SimpleCacheOpenEntryIndexState">
   <summary>
@@ -20424,6 +20462,13 @@
   <int value="4" label="Synchronous Write Failure"/>
 </enum>
 
+<enum name="SimpleIndexState" type="int">
+  <int value="0" label="Corrupt"/>
+  <int value="1" label="Stale"/>
+  <int value="2" label="Fresh"/>
+  <int value="3" label="Fresh index with cache updated since backend start"/>
+</enum>
+
 <enum name="SocketStreamConnectionType" type="int">
   <int value="0" label="none"/>
   <int value="1" label="all connections"/>
diff --git a/tools/perf/measurements/rasterize_and_record.py b/tools/perf/measurements/rasterize_and_record.py
index cedf4bf..ee1ddf9 100644
--- a/tools/perf/measurements/rasterize_and_record.py
+++ b/tools/perf/measurements/rasterize_and_record.py
@@ -39,7 +39,7 @@
     if start_event is None:
       raise LookupError, \
           'no LayterTreeHost::UpdateLayers after measureNextFrame found'
-    return start_event.args["commit_number"]
+    return start_event.args["source_frame_number"]
 
   def GatherRasterizeStats(self, frame_number):
     for event in self.timeline.GetAllEventsOfName(
@@ -60,7 +60,7 @@
 
   def GatherRecordStats(self, frame_number):
     for event in self.timeline.GetAllEventsOfName("PictureLayer::Update"):
-      if event.args["commit_number"] == frame_number:
+      if event.args["source_frame_number"] == frame_number:
         for record_loop_event in event.GetAllSubSlicesOfName("RecordLoop"):
           best_record_time = float('inf')
           for record_event in record_loop_event.GetAllSubSlicesOfName(
diff --git a/tools/telemetry/telemetry/core/browser_finder.py b/tools/telemetry/telemetry/core/browser_finder.py
index b7ae657..781c95d 100644
--- a/tools/telemetry/telemetry/core/browser_finder.py
+++ b/tools/telemetry/telemetry/core/browser_finder.py
@@ -9,10 +9,14 @@
 from telemetry.core.chrome import cros_browser_finder
 from telemetry.core.chrome import desktop_browser_finder
 
-ALL_BROWSER_TYPES = (
-    desktop_browser_finder.ALL_BROWSER_TYPES + ',' +
-    android_browser_finder.ALL_BROWSER_TYPES + ',' +
-    cros_browser_finder.ALL_BROWSER_TYPES)
+BROWSER_FINDERS = [
+  desktop_browser_finder,
+  android_browser_finder,
+  cros_browser_finder
+  ]
+
+ALL_BROWSER_TYPES = ','.join([bf.ALL_BROWSER_TYPES for bf in BROWSER_FINDERS])
+
 
 class BrowserTypeRequiredException(Exception):
   pass
@@ -43,25 +47,23 @@
     raise BrowserFinderException(
         'cros_remote requires browser_type=cros-chrome or cros-chrome-guest.')
 
-  if options.browser_type == None:
-    raise BrowserTypeRequiredException('browser_type must be specified')
-
   browsers = []
-  browsers.extend(desktop_browser_finder.FindAllAvailableBrowsers(options))
-  browsers.extend(android_browser_finder.FindAllAvailableBrowsers(options))
-  browsers.extend(cros_browser_finder.FindAllAvailableBrowsers(options))
+  default_browser = None
+  for finder in BROWSER_FINDERS:
+    curr_browsers = finder.FindAllAvailableBrowsers(options)
+    if not default_browser:
+      default_browser = finder.SelectDefaultBrowser(curr_browsers)
+    browsers.extend(curr_browsers)
 
-  if options.browser_type == 'any':
-    types = ALL_BROWSER_TYPES.split(',')
-    def compare_browsers_on_type_priority(x, y):
-      x_idx = types.index(x.browser_type)
-      y_idx = types.index(y.browser_type)
-      return x_idx - y_idx
-    browsers.sort(compare_browsers_on_type_priority)
-    if len(browsers) >= 1:
-      return browsers[0]
-    else:
-      return None
+  if options.browser_type == None:
+    if default_browser:
+      logging.warning('--browser omitted. Using most recent local build: %s' %
+                      default_browser.browser_type)
+      options.browser_type = default_browser.browser_type
+      return default_browser
+    raise BrowserTypeRequiredException(
+        '--browser must be specified. Available browsers:\n%s' %
+        '\n'.join(sorted(set([b.browser_type for b in browsers]))))
 
   matching_browsers = [b for b in browsers
       if b.browser_type == options.browser_type and b.SupportsOptions(options)]
@@ -81,9 +83,8 @@
   improperly set or if an error occurs when finding a browser.
   """
   browsers = []
-  browsers.extend(desktop_browser_finder.FindAllAvailableBrowsers(options))
-  browsers.extend(android_browser_finder.FindAllAvailableBrowsers(options))
-  browsers.extend(cros_browser_finder.FindAllAvailableBrowsers(options))
+  for finder in BROWSER_FINDERS:
+    browsers.extend(finder.FindAllAvailableBrowsers(options))
 
   type_list = set([browser.browser_type for browser in browsers])
   type_list = list(type_list)
diff --git a/tools/telemetry/telemetry/core/browser_options.py b/tools/telemetry/telemetry/core/browser_options.py
index ef6e03b..7256064 100644
--- a/tools/telemetry/telemetry/core/browser_options.py
+++ b/tools/telemetry/telemetry/core/browser_options.py
@@ -178,10 +178,6 @@
 
       if self.browser_executable and not self.browser_type:
         self.browser_type = 'exact'
-      if not self.browser_executable and not self.browser_type:
-        sys.stderr.write('Must provide --browser=<type>. ' +
-                         'Use --browser=list for valid options.\n')
-        sys.exit(1)
       if self.browser_type == 'list':
         try:
           types = browser_finder.GetAllAvailableBrowserTypes(self)
diff --git a/tools/telemetry/telemetry/core/chrome/android_browser_finder.py b/tools/telemetry/telemetry/core/chrome/android_browser_finder.py
index f1c183a..f78fe84 100644
--- a/tools/telemetry/telemetry/core/chrome/android_browser_finder.py
+++ b/tools/telemetry/telemetry/core/chrome/android_browser_finder.py
@@ -66,6 +66,9 @@
       return False
     return True
 
+def SelectDefaultBrowser(_):
+  return None
+
 def FindAllAvailableBrowsers(options, logging=real_logging):
   """Finds all the desktop browsers available on this machine."""
   if not adb_commands.IsAndroidSupported():
diff --git a/tools/telemetry/telemetry/core/chrome/cros_browser_finder.py b/tools/telemetry/telemetry/core/chrome/cros_browser_finder.py
index 15c50a5..a5ea970 100644
--- a/tools/telemetry/telemetry/core/chrome/cros_browser_finder.py
+++ b/tools/telemetry/telemetry/core/chrome/cros_browser_finder.py
@@ -44,6 +44,13 @@
       return False
     return True
 
+def SelectDefaultBrowser(possible_browsers):
+  if cros_interface.IsRunningOnCrosDevice():
+    for b in possible_browsers:
+      if b.browser_type == 'system':
+        return b
+  return None
+
 def FindAllAvailableBrowsers(options):
   """Finds all available chromeos browsers, locally and remotely."""
   if cros_interface.IsRunningOnCrosDevice():
diff --git a/tools/telemetry/telemetry/core/chrome/desktop_browser_finder.py b/tools/telemetry/telemetry/core/chrome/desktop_browser_finder.py
index 6fd7c0b..1da1040 100644
--- a/tools/telemetry/telemetry/core/chrome/desktop_browser_finder.py
+++ b/tools/telemetry/telemetry/core/chrome/desktop_browser_finder.py
@@ -4,6 +4,7 @@
 """Finds desktop browsers that can be controlled by telemetry."""
 
 import logging
+from operator import attrgetter
 import os
 import platform
 import subprocess
@@ -33,11 +34,12 @@
   """A desktop browser that can be controlled."""
 
   def __init__(self, browser_type, options, executable, flash_path,
-               is_content_shell):
+               is_content_shell, is_local_build=False):
     super(PossibleDesktopBrowser, self).__init__(browser_type, options)
     self._local_executable = executable
     self._flash_path = flash_path
     self._is_content_shell = is_content_shell
+    self.is_local_build = is_local_build
 
   def __repr__(self):
     return 'PossibleDesktopBrowser(browser_type=%s)' % self.browser_type
@@ -93,6 +95,21 @@
       return False
     return True
 
+  @property
+  def last_modification_time(self):
+    if os.path.exists(self._local_executable):
+      return os.path.getmtime(self._local_executable)
+    return -1
+
+def SelectDefaultBrowser(possible_browsers):
+  local_builds_by_date = [
+      b for b in sorted(possible_browsers,
+                        key=attrgetter('last_modification_time'))
+      if b.is_local_build]
+  if local_builds_by_date:
+    return local_builds_by_date[-1]
+  return None
+
 def FindAllAvailableBrowsers(options):
   """Finds all the desktop browsers available on this machine."""
   browsers = []
@@ -163,7 +180,8 @@
       app = os.path.join(chrome_root, build_dir, type_dir, app_name)
       if os.path.exists(app):
         browsers.append(PossibleDesktopBrowser(browser_type, options,
-                                               app, flash_path, content_shell))
+                                               app, flash_path, content_shell,
+                                               is_local_build=True))
         return True
     return False
 
diff --git a/tools/telemetry/telemetry/core/repeat_options.py b/tools/telemetry/telemetry/core/repeat_options.py
index 7eae254..9836dea 100644
--- a/tools/telemetry/telemetry/core/repeat_options.py
+++ b/tools/telemetry/telemetry/core/repeat_options.py
@@ -36,8 +36,8 @@
     parser.add_option_group(group)
 
   def _ParseRepeatOption(self, browser_options, input_str, parser):
-    match = re.match('([0-9]+)([sS]?)$', getattr(browser_options,
-                                                 input_str, ''))
+    match = re.match('([0-9]+)([sS]?)$', str(getattr(browser_options,
+                                                     input_str, '')))
     if match:
       if match.group(2):
         setattr(self, input_str + '_secs', float(match.group(1)))
diff --git a/tools/telemetry/telemetry/page/page_runner.py b/tools/telemetry/telemetry/page/page_runner.py
index 9820a18..bc36a42 100644
--- a/tools/telemetry/telemetry/page/page_runner.py
+++ b/tools/telemetry/telemetry/page/page_runner.py
@@ -206,10 +206,16 @@
 
   # Create a possible_browser with the given options.
   test.CustomizeBrowserOptions(options)
-  possible_browser = browser_finder.FindBrowser(options)
+  try:
+    possible_browser = browser_finder.FindBrowser(options)
+  except browser_finder.BrowserTypeRequiredException, e:
+    sys.stderr.write(str(e) + '\n')
+    sys.exit(1)
   if not possible_browser:
-    raise Exception('No browser found.\n'
-        'Use --browser=list to figure out which are available.')
+    sys.stderr.write(
+        'No browser found. Available browsers:\n' +
+        '\n'.join(browser_finder.GetAllAvailableBrowserTypes(options)) + '\n')
+    sys.exit(1)
 
   # Reorder page set based on options.
   pages = _ShuffleAndFilterPageSet(page_set, options)
diff --git a/tools/telemetry/telemetry/test.py b/tools/telemetry/telemetry/test.py
index aea190c..fed8781 100644
--- a/tools/telemetry/telemetry/test.py
+++ b/tools/telemetry/telemetry/test.py
@@ -13,7 +13,7 @@
 def GetBaseDir():
   main_module = sys.modules['__main__']
   if hasattr(main_module, '__file__'):
-    return os.path.dirname(main_module.__file__)
+    return os.path.dirname(os.path.abspath(main_module.__file__))
   else:
     return os.getcwd()
 
diff --git a/tools/valgrind/memcheck/suppressions.txt b/tools/valgrind/memcheck/suppressions.txt
index cc2d91f..80a0190 100644
--- a/tools/valgrind/memcheck/suppressions.txt
+++ b/tools/valgrind/memcheck/suppressions.txt
@@ -2585,7 +2585,7 @@
    Bug_69934_a
    Memcheck:Leak
    fun:_Znw*
-   fun:_ZN13NPObjectProxy10NPAllocateEP4_NPPP7NPClass
+   fun:_ZN*NPObjectProxy10NPAllocateEP4_NPPP7NPClass
    fun:_NPN_CreateObject
    fun:_ZN6WebKit11WebBindings12createObjectEP4_NPPP7NPClass
 }
@@ -4434,8 +4434,8 @@
    Memcheck:Leak
    fun:malloc
    fun:NPN_MemAlloc
-   fun:_ZL13testEnumerateP8NPObjectPPPvPj
-   fun:_ZN7WebCore26npObjectPropertyEnumeratorERKN2v812AccessorInfoEb
+   fun:*Enumerate*ObjectPPPvPj
+   fun:_ZN7WebCore26npObjectPropertyEnumerator*Info*
    ...
    fun:_ZN2v88internal28Runtime_GetPropertyNamesFast*IsolateE
 }
@@ -4863,11 +4863,10 @@
    bug_124156
    Memcheck:Leak
    fun:_Znw*
-   fun:_ZN26SimpleResourceLoaderBridge6CreateERKN11webkit_glue20ResourceLoaderBridge11RequestInfoE
-   fun:_ZN25TestWebKitPlatformSupport20CreateResourceLoaderERKN11webkit_glue20ResourceLoaderBridge11RequestInfoE
+   ...
+   fun:*WebKitPlatformSupport*20CreateResourceLoaderERKN11webkit_glue20ResourceLoaderBridge11RequestInfoE
    fun:_ZN11webkit_glue16WebURLLoaderImpl7Context5StartERKN6WebKit13WebURLRequestEPNS_20ResourceLoaderBridge16SyncLoadResponseEPNS_25WebKitPlatformSupportImplE
    fun:_ZN11webkit_glue16WebURLLoaderImpl18loadAsynchronouslyERKN6WebKit13WebURLRequestEPNS1_18WebURLLoaderClientE
-   fun:_ZN7WebCore22ResourceHandleInternal5startEv
 }
 {
    bug_124488
@@ -6701,58 +6700,8 @@
    fun:_ZNSt5dequeIN4base11PendingTaskESaIS1_EE16_M_push_back_auxERKS1_
    fun:_ZNSt5dequeIN4base11PendingTaskESaIS1_EE9push_backERKS1_
    fun:_ZNSt5queueIN4base11PendingTaskESt5dequeIS1_SaIS1_EEE4pushERKS1_
-   fun:_ZN4base11MessageLoop18AddToIncomingQueueEPNS_11PendingTaskEb
-   fun:_ZN4base11MessageLoop15PostDelayedTaskERKN15tracked_objects8LocationERKNS_8CallbackIFvvEEENS_9TimeDeltaE
-   fun:_ZN7content17BrowserThreadImpl14PostTaskHelperENS_13BrowserThread2IDERKN15tracked_objects8LocationERKN4base8CallbackIFvvEEENS7_9TimeDeltaEb
-   fun:_ZN7content13BrowserThread15PostDelayedTaskENS0_2IDERKN15tracked_objects8LocationERKN4base8CallbackIFvvEEENS6_9TimeDeltaE
-   fun:_ZN7content29BrowserThreadMessageLoopProxy15PostDelayedTaskERKN15tracked_objects8LocationERKN4base8CallbackIFvvEEENS5_9TimeDeltaE
-   fun:_ZN4base10TaskRunner8PostTaskERKN15tracked_objects8LocationERKNS_8CallbackIFvvEEE
-   fun:_ZN3IPC12ChannelProxy4SendEPNS_7MessageE
-   fun:_ZN7content21RenderProcessHostImpl4SendEPN3IPC7MessageE
-   fun:_ZN7content21RenderProcessHostImpl17OnProcessLaunchedEv
-   fun:_ZN7content20ChildProcessLauncher7Context6NotifyEbi
-}
-{
-   bug_238547_b
-   Memcheck:Leak
-   fun:_Znw*
-   fun:_ZN9__gnu_cxx13new_allocatorIPN4base11PendingTaskEE8allocateEmPKv
-   fun:_ZNSt11_Deque_baseIN4base11PendingTaskESaIS1_EE15_M_allocate_mapEm
-   fun:_ZNSt5dequeIN4base11PendingTaskESaIS1_EE17_M_reallocate_mapEmb
-   fun:_ZNSt5dequeIN4base11PendingTaskESaIS1_EE22_M_reserve_map_at_backEm
-   fun:_ZNSt5dequeIN4base11PendingTaskESaIS1_EE16_M_push_back_auxERKS1_
-   fun:_ZNSt5dequeIN4base11PendingTaskESaIS1_EE9push_backERKS1_
-   fun:_ZNSt5queueIN4base11PendingTaskESt5dequeIS1_SaIS1_EEE4pushERKS1_
-   fun:_ZN4base11MessageLoop18AddToIncomingQueueEPNS_11PendingTaskEb
-   fun:_ZN4base11MessageLoop15PostDelayedTaskERKN15tracked_objects8LocationERKNS_8CallbackIFvvEEENS_9TimeDeltaE
-   fun:_ZN8appcache19AppCacheStorageImpl8InitTask12RunCompletedEv
-   fun:_ZN8appcache19AppCacheStorageImpl12DatabaseTask16CallRunCompletedEN4base9TimeTicksE
-}
-{
-   bug_238547_c
-   Memcheck:Leak
-   fun:_Znw*
-   fun:_ZN9__gnu_cxx13new_allocatorIPN4base11PendingTaskEE8allocateEmPKv
-   fun:_ZNSt11_Deque_baseIN4base11PendingTaskESaIS1_EE15_M_allocate_mapEm
-   fun:_ZNSt5dequeIN4base11PendingTaskESaIS1_EE17_M_reallocate_mapEmb
-   fun:_ZNSt5dequeIN4base11PendingTaskESaIS1_EE22_M_reserve_map_at_backEm
-   fun:_ZNSt5dequeIN4base11PendingTaskESaIS1_EE16_M_push_back_auxERKS1_
-   fun:_ZNSt5dequeIN4base11PendingTaskESaIS1_EE9push_backERKS1_
-   fun:_ZNSt5queueIN4base11PendingTaskESt5dequeIS1_SaIS1_EEE4pushERKS1_
-   fun:_ZN4base11MessageLoop18AddToIncomingQueueEPNS_11PendingTaskEb
-   fun:_ZN4base11MessageLoop15PostDelayedTaskERKN15tracked_objects8LocationERKNS_8CallbackIFvvEEENS_9TimeDeltaE
-   fun:_ZN7content17BrowserThreadImpl14PostTaskHelperENS_13BrowserThread2IDERKN15tracked_objects8LocationERKN4base8CallbackIFvvEEENS7_9TimeDeltaEb
-   fun:_ZN7content13BrowserThread15PostDelayedTaskENS0_2IDERKN15tracked_objects8LocationERKN4base8CallbackIFvvEEENS6_9TimeDeltaE
-   fun:_ZN7content29BrowserThreadMessageLoopProxy15PostDelayedTaskERKN15tracked_objects8LocationERKN4base8CallbackIFvvEEENS5_9TimeDeltaE
-   fun:_ZN4base10TaskRunner8PostTaskERKN15tracked_objects8LocationERKNS_8CallbackIFvvEEE
-   fun:_ZN3IPC12ChannelProxy7Context9AddFilterEPNS0_13MessageFilterE
-   fun:_ZN3IPC12ChannelProxy9AddFilterEPNS0_13MessageFilterE
-   fun:_ZN7content21RenderProcessHostImpl20CreateMessageFiltersEv
-   fun:_ZN7content21RenderProcessHostImpl4InitEv
-   fun:_ZN7content18RenderViewHostImpl16CreateRenderViewERKSbItN4base20string16_char_traitsESaItEEii
-   fun:_ZN7content15WebContentsImpl32CreateRenderViewForRenderManagerEPNS_14RenderViewHostEi
-   fun:_ZN7content21RenderViewHostManager14InitRenderViewEPNS_14RenderViewHostEi
-   fun:_ZN7content21RenderViewHostManager8NavigateERKNS_19NavigationEntryImplE
+   ...
+   fun:_ZN4base*MessageLoop*15PostDelayedTaskERKN15tracked_objects8LocationERKNS_8CallbackIFvvEEENS_9TimeDeltaE
 }
 {
    bug_239141
@@ -7387,18 +7336,9 @@
    fun:_ZN15webkit_database12_GLOBAL__N_120GetOriginsOnDBThreadEPNS_15DatabaseTrackerEPSt3setI4GURLSt4lessIS4_ESaIS4_EE
 }
 {
-   quic_socket_utils_write_packet_msg_name
+   bug_263753
    Memcheck:Param
-   socketcall.sendmsg(msg.msg_name)
-   obj:/lib/x86_64-linux-gnu/libpthread-2.15.so
+   sendmsg(msg.msg_name)
+   obj:*libpthread-*.so
    fun:_ZN3net5tools15QuicSocketUtils11WritePacketEiPKcmRKSt6vectorIhSaIhEERKNS_10IPEndPointEPi
-   ...
-}
-{
-   quic_socket_utils_write_packet_msg_control
-   Memcheck:Param
-   socketcall.sendmsg(msg.msg_control)
-   obj:/lib/x86_64-linux-gnu/libpthread-2.15.so
-   fun:_ZN3net5tools15QuicSocketUtils11WritePacketEiPKcmRKSt6vectorIhSaIhEERKNS_10IPEndPointEPi
-   ...
 }
diff --git a/tools/valgrind/tsan/ignores_win32.txt b/tools/valgrind/tsan/ignores_win32.txt
index 9be6e40..0218dc8 100644
--- a/tools/valgrind/tsan/ignores_win32.txt
+++ b/tools/valgrind/tsan/ignores_win32.txt
@@ -51,3 +51,7 @@
 # unrelated file in another thread. Revealed by DiskCacheBackendTest.DeleteOld.
 # See: https://code.google.com/p/data-race-test/issues/detail?id=114
 fun_r:SHFileOperationW
+
+# Ignore internal fopen synchronization:
+fun_r:_lock_file
+fun_r:_lock
diff --git a/ui/base/keycodes/keyboard_code_conversion_android.cc b/ui/base/keycodes/keyboard_code_conversion_android.cc
new file mode 100644
index 0000000..42f2cc7
--- /dev/null
+++ b/ui/base/keycodes/keyboard_code_conversion_android.cc
@@ -0,0 +1,305 @@
+// 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/base/keycodes/keyboard_code_conversion_android.h"
+
+#include <android/keycodes.h>
+
+namespace ui {
+
+namespace {
+
+// The Android NDK does not provide values for these yet:
+enum {
+  AKEYCODE_ESCAPE          = 111,
+  AKEYCODE_FORWARD_DEL     = 112,
+  AKEYCODE_CTRL_LEFT       = 113,
+  AKEYCODE_CTRL_RIGHT      = 114,
+  AKEYCODE_CAPS_LOCK       = 115,
+  AKEYCODE_SCROLL_LOCK     = 116,
+  AKEYCODE_META_LEFT       = 117,
+  AKEYCODE_META_RIGHT      = 118,
+  AKEYCODE_BREAK           = 121,
+  AKEYCODE_INSERT          = 124,
+  AKEYCODE_MEDIA_PLAY      = 126,
+  AKEYCODE_MEDIA_PAUSE     = 127,
+  AKEYCODE_F1              = 131,
+  AKEYCODE_F2              = 132,
+  AKEYCODE_F3              = 133,
+  AKEYCODE_F4              = 134,
+  AKEYCODE_F5              = 135,
+  AKEYCODE_F6              = 136,
+  AKEYCODE_F7              = 137,
+  AKEYCODE_F8              = 138,
+  AKEYCODE_F9              = 139,
+  AKEYCODE_F10             = 140,
+  AKEYCODE_F11             = 141,
+  AKEYCODE_F12             = 142,
+  AKEYCODE_NUM_LOCK        = 143,
+  AKEYCODE_NUMPAD_0        = 144,
+  AKEYCODE_NUMPAD_1        = 145,
+  AKEYCODE_NUMPAD_2        = 146,
+  AKEYCODE_NUMPAD_3        = 147,
+  AKEYCODE_NUMPAD_4        = 148,
+  AKEYCODE_NUMPAD_5        = 149,
+  AKEYCODE_NUMPAD_6        = 150,
+  AKEYCODE_NUMPAD_7        = 151,
+  AKEYCODE_NUMPAD_8        = 152,
+  AKEYCODE_NUMPAD_9        = 153,
+  AKEYCODE_NUMPAD_DIVIDE   = 154,
+  AKEYCODE_NUMPAD_MULTIPLY = 155,
+  AKEYCODE_NUMPAD_SUBTRACT = 156,
+  AKEYCODE_NUMPAD_ADD      = 157,
+  AKEYCODE_NUMPAD_DOT      = 158,
+  AKEYCODE_VOLUME_MUTE     = 164,
+  AKEYCODE_CHANNEL_UP      = 166,
+  AKEYCODE_CHANNEL_DOWN    = 167,
+};
+
+}  // namespace
+
+KeyboardCode KeyboardCodeFromAndroidKeyCode(int keycode) {
+  // Does not provide all key codes, and does not handle all keys.
+  switch (keycode) {
+    case AKEYCODE_DEL:
+      return VKEY_BACK;
+    case AKEYCODE_TAB:
+      return VKEY_TAB;
+    case AKEYCODE_CLEAR:
+      return VKEY_CLEAR;
+    case AKEYCODE_DPAD_CENTER:
+    case AKEYCODE_ENTER:
+      return VKEY_RETURN;
+    case AKEYCODE_SHIFT_LEFT:
+      return VKEY_LSHIFT;
+    case AKEYCODE_SHIFT_RIGHT:
+      return VKEY_RSHIFT;
+    // Back will serve as escape, although we may not have access to it.
+    case AKEYCODE_BACK:
+      return VKEY_ESCAPE;
+    case AKEYCODE_SPACE:
+      return VKEY_SPACE;
+    case AKEYCODE_HOME:
+      return VKEY_HOME;
+    case AKEYCODE_DPAD_LEFT:
+      return VKEY_LEFT;
+    case AKEYCODE_DPAD_UP:
+      return VKEY_UP;
+    case AKEYCODE_DPAD_RIGHT:
+      return VKEY_RIGHT;
+    case AKEYCODE_DPAD_DOWN:
+      return VKEY_DOWN;
+    case AKEYCODE_0:
+      return VKEY_0;
+    case AKEYCODE_1:
+      return VKEY_1;
+    case AKEYCODE_2:
+      return VKEY_2;
+    case AKEYCODE_3:
+      return VKEY_3;
+    case AKEYCODE_4:
+      return VKEY_4;
+    case AKEYCODE_5:
+      return VKEY_5;
+    case AKEYCODE_6:
+      return VKEY_6;
+    case AKEYCODE_7:
+      return VKEY_7;
+    case AKEYCODE_8:
+      return VKEY_8;
+    case AKEYCODE_9:
+      return VKEY_9;
+    case AKEYCODE_A:
+      return VKEY_A;
+    case AKEYCODE_B:
+      return VKEY_B;
+    case AKEYCODE_C:
+      return VKEY_C;
+    case AKEYCODE_D:
+      return VKEY_D;
+    case AKEYCODE_E:
+      return VKEY_E;
+    case AKEYCODE_F:
+      return VKEY_F;
+    case AKEYCODE_G:
+      return VKEY_G;
+    case AKEYCODE_H:
+      return VKEY_H;
+    case AKEYCODE_I:
+      return VKEY_I;
+    case AKEYCODE_J:
+      return VKEY_J;
+    case AKEYCODE_K:
+      return VKEY_K;
+    case AKEYCODE_L:
+      return VKEY_L;
+    case AKEYCODE_M:
+      return VKEY_M;
+    case AKEYCODE_N:
+      return VKEY_N;
+    case AKEYCODE_O:
+      return VKEY_O;
+    case AKEYCODE_P:
+      return VKEY_P;
+    case AKEYCODE_Q:
+      return VKEY_Q;
+    case AKEYCODE_R:
+      return VKEY_R;
+    case AKEYCODE_S:
+      return VKEY_S;
+    case AKEYCODE_T:
+      return VKEY_T;
+    case AKEYCODE_U:
+      return VKEY_U;
+    case AKEYCODE_V:
+      return VKEY_V;
+    case AKEYCODE_W:
+      return VKEY_W;
+    case AKEYCODE_X:
+      return VKEY_X;
+    case AKEYCODE_Y:
+      return VKEY_Y;
+    case AKEYCODE_Z:
+      return VKEY_Z;
+    case AKEYCODE_VOLUME_DOWN:
+      return VKEY_VOLUME_DOWN;
+    case AKEYCODE_VOLUME_UP:
+      return VKEY_VOLUME_UP;
+    case AKEYCODE_MEDIA_NEXT:
+      return VKEY_MEDIA_NEXT_TRACK;
+    case AKEYCODE_MEDIA_PREVIOUS:
+      return VKEY_MEDIA_PREV_TRACK;
+    case AKEYCODE_MEDIA_STOP:
+      return VKEY_MEDIA_STOP;
+    case AKEYCODE_MEDIA_PAUSE:
+      return VKEY_MEDIA_PLAY_PAUSE;
+    // Colon key.
+    case AKEYCODE_SEMICOLON:
+      return VKEY_OEM_1;
+    case AKEYCODE_COMMA:
+      return VKEY_OEM_COMMA;
+    case AKEYCODE_MINUS:
+      return VKEY_OEM_MINUS;
+    case AKEYCODE_EQUALS:
+      return VKEY_OEM_PLUS;
+    case AKEYCODE_PERIOD:
+      return VKEY_OEM_PERIOD;
+    case AKEYCODE_SLASH:
+      return VKEY_OEM_2;
+    case AKEYCODE_LEFT_BRACKET:
+      return VKEY_OEM_4;
+    case AKEYCODE_BACKSLASH:
+      return VKEY_OEM_5;
+    case AKEYCODE_RIGHT_BRACKET:
+      return VKEY_OEM_6;
+    case AKEYCODE_MUTE:
+    case AKEYCODE_VOLUME_MUTE:
+      return VKEY_VOLUME_MUTE;
+    case AKEYCODE_ESCAPE:
+      return VKEY_ESCAPE;
+    case AKEYCODE_MEDIA_PLAY:
+    case AKEYCODE_MEDIA_PLAY_PAUSE:
+      return VKEY_MEDIA_PLAY_PAUSE;
+    case AKEYCODE_CALL:
+      return VKEY_END;
+    case AKEYCODE_ALT_LEFT:
+      return VKEY_LMENU;
+    case AKEYCODE_ALT_RIGHT:
+      return VKEY_RMENU;
+    case AKEYCODE_GRAVE:
+      return VKEY_OEM_3;
+    case AKEYCODE_APOSTROPHE:
+      return VKEY_OEM_3;
+    case AKEYCODE_MEDIA_REWIND:
+      return VKEY_OEM_103;
+    case AKEYCODE_MEDIA_FAST_FORWARD:
+      return VKEY_OEM_104;
+    case AKEYCODE_PAGE_UP:
+      return VKEY_PRIOR;
+    case AKEYCODE_PAGE_DOWN:
+      return VKEY_NEXT;
+    case AKEYCODE_FORWARD_DEL:
+      return VKEY_DELETE;
+    case AKEYCODE_CTRL_LEFT:
+      return VKEY_LCONTROL;
+    case AKEYCODE_CTRL_RIGHT:
+      return VKEY_RCONTROL;
+    case AKEYCODE_CAPS_LOCK:
+      return VKEY_CAPITAL;
+    case AKEYCODE_SCROLL_LOCK:
+      return VKEY_SCROLL;
+    case AKEYCODE_META_LEFT:
+      return VKEY_LWIN;
+    case AKEYCODE_META_RIGHT:
+      return VKEY_RWIN;
+    case AKEYCODE_BREAK:
+      return VKEY_PAUSE;
+    case AKEYCODE_INSERT:
+      return VKEY_INSERT;
+    case AKEYCODE_F1:
+      return VKEY_F1;
+    case AKEYCODE_F2:
+      return VKEY_F2;
+    case AKEYCODE_F3:
+      return VKEY_F3;
+    case AKEYCODE_F4:
+      return VKEY_F4;
+    case AKEYCODE_F5:
+      return VKEY_F5;
+    case AKEYCODE_F6:
+      return VKEY_F6;
+    case AKEYCODE_F7:
+      return VKEY_F7;
+    case AKEYCODE_F8:
+      return VKEY_F8;
+    case AKEYCODE_F9:
+      return VKEY_F9;
+    case AKEYCODE_F10:
+      return VKEY_F10;
+    case AKEYCODE_F11:
+      return VKEY_F11;
+    case AKEYCODE_F12:
+      return VKEY_F12;
+    case AKEYCODE_NUM_LOCK:
+      return VKEY_NUMLOCK;
+    case AKEYCODE_NUMPAD_0:
+      return VKEY_NUMPAD0;
+    case AKEYCODE_NUMPAD_1:
+      return VKEY_NUMPAD1;
+    case AKEYCODE_NUMPAD_2:
+      return VKEY_NUMPAD2;
+    case AKEYCODE_NUMPAD_3:
+      return VKEY_NUMPAD3;
+    case AKEYCODE_NUMPAD_4:
+      return VKEY_NUMPAD4;
+    case AKEYCODE_NUMPAD_5:
+      return VKEY_NUMPAD5;
+    case AKEYCODE_NUMPAD_6:
+      return VKEY_NUMPAD6;
+    case AKEYCODE_NUMPAD_7:
+      return VKEY_NUMPAD7;
+    case AKEYCODE_NUMPAD_8:
+      return VKEY_NUMPAD8;
+    case AKEYCODE_NUMPAD_9:
+      return VKEY_NUMPAD9;
+    case AKEYCODE_NUMPAD_DIVIDE:
+      return VKEY_DIVIDE;
+    case AKEYCODE_NUMPAD_MULTIPLY:
+      return VKEY_MULTIPLY;
+    case AKEYCODE_NUMPAD_SUBTRACT:
+      return VKEY_SUBTRACT;
+    case AKEYCODE_NUMPAD_ADD:
+      return VKEY_ADD;
+    case AKEYCODE_NUMPAD_DOT:
+      return VKEY_DECIMAL;
+    case AKEYCODE_CHANNEL_UP:
+      return VKEY_PRIOR;
+    case AKEYCODE_CHANNEL_DOWN:
+      return VKEY_NEXT;
+    default:
+      return VKEY_UNKNOWN;
+  }
+}
+
+}  // namespace ui
diff --git a/ui/base/keycodes/keyboard_code_conversion_android.h b/ui/base/keycodes/keyboard_code_conversion_android.h
new file mode 100644
index 0000000..8bf2789
--- /dev/null
+++ b/ui/base/keycodes/keyboard_code_conversion_android.h
@@ -0,0 +1,17 @@
+// 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_BASE_KEYCODES_KEYBOARD_CODE_CONVERSION_ANDROID_H_
+#define UI_BASE_KEYCODES_KEYBOARD_CODE_CONVERSION_ANDROID_H_
+
+#include "ui/base/keycodes/keyboard_codes_posix.h"
+#include "ui/base/ui_export.h"
+
+namespace ui {
+
+UI_EXPORT KeyboardCode KeyboardCodeFromAndroidKeyCode(int keycode);
+
+}  // namespace ui
+
+#endif  // UI_BASE_KEYCODES_KEYBOARD_CODE_CONVERSION_ANDROID_H_
diff --git a/ui/base/keycodes/keyboard_codes_posix.h b/ui/base/keycodes/keyboard_codes_posix.h
index 1d2ab41..acfa565 100644
--- a/ui/base/keycodes/keyboard_codes_posix.h
+++ b/ui/base/keycodes/keyboard_codes_posix.h
@@ -191,6 +191,8 @@
   VKEY_OEM_7 = 0xDE,
   VKEY_OEM_8 = 0xDF,
   VKEY_OEM_102 = 0xE2,
+  VKEY_OEM_103 = 0xE3,  // GTV KEYCODE_MEDIA_REWIND
+  VKEY_OEM_104 = 0xE4,  // GTV KEYCODE_MEDIA_FAST_FORWARD
   VKEY_PROCESSKEY = 0xE5,
   VKEY_PACKET = 0xE7,
   VKEY_DBE_SBCSCHAR = 0xF3,
diff --git a/ui/gfx/render_text_unittest.cc b/ui/gfx/render_text_unittest.cc
index 1af9135..1b7eb18 100644
--- a/ui/gfx/render_text_unittest.cc
+++ b/ui/gfx/render_text_unittest.cc
@@ -29,11 +29,11 @@
 // Various weak, LTR, RTL, and Bidi string cases with three characters each.
 const wchar_t kWeak[] =      L" . ";
 const wchar_t kLtr[] =       L"abc";
-const wchar_t kLtrRtl[] =    L"a"L"\x5d0\x5d1";
-const wchar_t kLtrRtlLtr[] = L"a"L"\x5d1"L"b";
+const wchar_t kLtrRtl[] =    L"a" L"\x5d0\x5d1";
+const wchar_t kLtrRtlLtr[] = L"a" L"\x5d1" L"b";
 const wchar_t kRtl[] =       L"\x5d0\x5d1\x5d2";
-const wchar_t kRtlLtr[] =    L"\x5d0\x5d1"L"a";
-const wchar_t kRtlLtrRtl[] = L"\x5d0"L"a"L"\x5d1";
+const wchar_t kRtlLtr[] =    L"\x5d0\x5d1" L"a";
+const wchar_t kRtlLtrRtl[] = L"\x5d0" L"a" L"\x5d1";
 
 // Checks whether |range| contains |index|. This is not the same as calling
 // |range.Contains(ui::Range(index))| - as that would return true when
diff --git a/ui/gfx/render_text_win.cc b/ui/gfx/render_text_win.cc
index 7870aa0..e6b0b1e 100644
--- a/ui/gfx/render_text_win.cc
+++ b/ui/gfx/render_text_win.cc
@@ -493,8 +493,8 @@
 
 void RenderTextWin::ItemizeLogicalText() {
   runs_.clear();
-  string_size_ = Size(0, GetFont().GetHeight());
-  common_baseline_ = 0;
+  string_size_ = Size(0, font_list().GetHeight());
+  common_baseline_ = font_list().GetBaseline();
 
   // Set Uniscribe's base text direction.
   script_state_.uBidiLevel =
@@ -569,14 +569,15 @@
     cached_hdc_ = CreateCompatibleDC(NULL);
 
   HRESULT hr = E_FAIL;
-  string_size_.set_height(0);
+  int ascent = font_list().GetBaseline();
+  int descent = font_list().GetHeight() - font_list().GetBaseline();
   for (size_t i = 0; i < runs_.size(); ++i) {
     internal::TextRun* run = runs_[i];
     LayoutTextRun(run);
 
-    string_size_.set_height(std::max(string_size_.height(),
-                                     run->font.GetHeight()));
-    common_baseline_ = std::max(common_baseline_, run->font.GetBaseline());
+    ascent = std::max(ascent, run->font.GetBaseline());
+    descent = std::max(descent,
+                       run->font.GetHeight() - run->font.GetBaseline());
 
     if (run->glyph_count > 0) {
       run->advance_widths.reset(new int[run->glyph_count]);
@@ -593,6 +594,8 @@
       DCHECK(SUCCEEDED(hr));
     }
   }
+  string_size_.set_height(ascent + descent);
+  common_baseline_ = ascent;
 
   // Build the array of bidirectional embedding levels.
   scoped_ptr<BYTE[]> levels(new BYTE[runs_.size()]);
diff --git a/ui/gl/gl.target.darwin-arm.mk b/ui/gl/gl.target.darwin-arm.mk
index 2f53a14..69b6956 100644
--- a/ui/gl/gl.target.darwin-arm.mk
+++ b/ui/gl/gl.target.darwin-arm.mk
@@ -210,14 +210,14 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/swiftshader/include \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/khronos \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
@@ -326,14 +326,14 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/swiftshader/include \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/khronos \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
diff --git a/ui/gl/gl.target.darwin-mips.mk b/ui/gl/gl.target.darwin-mips.mk
index 3f1046a..5435005 100644
--- a/ui/gl/gl.target.darwin-mips.mk
+++ b/ui/gl/gl.target.darwin-mips.mk
@@ -209,14 +209,14 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/swiftshader/include \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/khronos \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
@@ -324,14 +324,14 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/swiftshader/include \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/khronos \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
diff --git a/ui/gl/gl.target.darwin-x86.mk b/ui/gl/gl.target.darwin-x86.mk
index aba33a5..ab5bea1 100644
--- a/ui/gl/gl.target.darwin-x86.mk
+++ b/ui/gl/gl.target.darwin-x86.mk
@@ -211,14 +211,14 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/swiftshader/include \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/khronos \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
@@ -329,14 +329,14 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/swiftshader/include \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/khronos \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
diff --git a/ui/gl/gl.target.linux-arm.mk b/ui/gl/gl.target.linux-arm.mk
index 2f53a14..69b6956 100644
--- a/ui/gl/gl.target.linux-arm.mk
+++ b/ui/gl/gl.target.linux-arm.mk
@@ -210,14 +210,14 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/swiftshader/include \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/khronos \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
@@ -326,14 +326,14 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/swiftshader/include \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/khronos \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
diff --git a/ui/gl/gl.target.linux-mips.mk b/ui/gl/gl.target.linux-mips.mk
index 3f1046a..5435005 100644
--- a/ui/gl/gl.target.linux-mips.mk
+++ b/ui/gl/gl.target.linux-mips.mk
@@ -209,14 +209,14 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/swiftshader/include \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/khronos \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
@@ -324,14 +324,14 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/swiftshader/include \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/khronos \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
diff --git a/ui/gl/gl.target.linux-x86.mk b/ui/gl/gl.target.linux-x86.mk
index aba33a5..ab5bea1 100644
--- a/ui/gl/gl.target.linux-x86.mk
+++ b/ui/gl/gl.target.linux-x86.mk
@@ -211,14 +211,14 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/swiftshader/include \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/khronos \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
@@ -329,14 +329,14 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/swiftshader/include \
 	$(LOCAL_PATH)/third_party/mesa/src/include \
 	$(gyp_shared_intermediate_dir)/ui/gl \
 	$(LOCAL_PATH)/third_party/khronos \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
diff --git a/ui/keyboard/keyboard_resources.grd b/ui/keyboard/keyboard_resources.grd
index 22dce1c..2509d68 100644
--- a/ui/keyboard/keyboard_resources.grd
+++ b/ui/keyboard/keyboard_resources.grd
@@ -17,9 +17,10 @@
     <includes>
       <include name="IDR_KEYBOARD_API_ADAPTER_JS" file="resources/api_adapter.js" type="BINDATA" />
       <include name="IDR_KEYBOARD_CONSTANTS_JS" file="resources/constants.js" type="BINDATA" />
-      <include name="IDR_KEYBOARD_ELEMENTS_ACCENT_CONTAINER" file="resources/elements/kb-accent-container.html" type="BINDATA" />
-      <include name="IDR_KEYBOARD_ELEMENTS_ACCENT_KEY" file="resources/elements/kb-accent-key.html" type="BINDATA" />
-      <include name="IDR_KEYBOARD_ELEMENTS_ACCENT_SET" file="resources/elements/kb-accent-set.html" type="BINDATA" />
+      <include name="IDR_KEYBOARD_ELEMENTS_ALTKEY" file="resources/elements/kb-altkey.html" type="BINDATA" />
+      <include name="IDR_KEYBOARD_ELEMENTS_ALTKEY_CONTAINER" file="resources/elements/kb-altkey-container.html" type="BINDATA" />
+      <include name="IDR_KEYBOARD_ELEMENTS_ALTKEY_DATA" file="resources/elements/kb-altkey-data.html" type="BINDATA" />
+      <include name="IDR_KEYBOARD_ELEMENTS_ALTKEY_SET" file="resources/elements/kb-altkey-set.html" type="BINDATA" />
       <include name="IDR_KEYBOARD_ELEMENTS_KEY" file="resources/elements/kb-key.html" type="BINDATA" />
       <include name="IDR_KEYBOARD_ELEMENTS_KEY_BASE" file="resources/elements/kb-key-base.html" type="BINDATA" />
       <include name="IDR_KEYBOARD_ELEMENTS_KEY_IMPORT" file="resources/elements/kb-key-import.html" type="BINDATA" />
@@ -33,7 +34,9 @@
       <!-- Don't flatten html file here. Otherwise, webui keyboard will not load the correct css file. -->
       <include name="IDR_KEYBOARD_INDEX" file="resources/index.html" allowexternalscript="true" type="BINDATA" />
       <include name="IDR_KEYBOARD_LAYOUTS_DVORAK" file="resources/layouts/dvorak.html" type="BINDATA" />
+      <include name="IDR_KEYBOARD_LAYOUTS_LATIN_ACCENTS" file="resources/layouts/latin-accents.js" type="BINDATA" />
       <include name="IDR_KEYBOARD_LAYOUTS_QWERTY" file="resources/layouts/qwerty.html" type="BINDATA" />
+      <include name="IDR_KEYBOARD_LAYOUTS_SYMBOL_ALTKEYS" file="resources/layouts/symbol-altkeys.js" type="BINDATA" />
       <include name="IDR_KEYBOARD_MAIN_JS" file="resources/main.js" type="BINDATA" />
       <include name="IDR_KEYBOARD_MANIFEST" file="resources/manifest.json" type="BINDATA" />
       <include name="IDR_KEYBOARD_MAIN_CSS" file="resources/main.css" type="BINDATA" />
diff --git a/ui/keyboard/keyboard_ui_controller.cc b/ui/keyboard/keyboard_ui_controller.cc
index 8c73f51..1ee8d40 100644
--- a/ui/keyboard/keyboard_ui_controller.cc
+++ b/ui/keyboard/keyboard_ui_controller.cc
@@ -19,13 +19,14 @@
       content::WebUIDataSource::Create(keyboard::kKeyboardWebUIHost);
 
   source->SetDefaultResource(IDR_KEYBOARD_WEBUI_INDEX);
-
-  source->AddResourcePath("elements/kb-accent-container.html",
-                          IDR_KEYBOARD_ELEMENTS_ACCENT_CONTAINER);
-  source->AddResourcePath("elements/kb-accent-key.html",
-                          IDR_KEYBOARD_ELEMENTS_ACCENT_KEY);
-  source->AddResourcePath("elements/kb-accent-set.html",
-                          IDR_KEYBOARD_ELEMENTS_ACCENT_SET);
+  source->AddResourcePath("elements/kb-altkey.html",
+                          IDR_KEYBOARD_ELEMENTS_ALTKEY);
+  source->AddResourcePath("elements/kb-altkey-container.html",
+                          IDR_KEYBOARD_ELEMENTS_ALTKEY_CONTAINER);
+  source->AddResourcePath("elements/kb-altkey-data.html",
+                          IDR_KEYBOARD_ELEMENTS_ALTKEY_DATA);
+  source->AddResourcePath("elements/kb-altkey-set.html",
+                          IDR_KEYBOARD_ELEMENTS_ALTKEY_SET);
   source->AddResourcePath("elements/kb-key.html", IDR_KEYBOARD_ELEMENTS_KEY);
   source->AddResourcePath("elements/kb-key-base.html",
                           IDR_KEYBOARD_ELEMENTS_KEY_BASE);
@@ -38,6 +39,8 @@
                           IDR_KEYBOARD_IMAGES_MICROPHONE);
   source->AddResourcePath("images/microphone-green.svg",
                           IDR_KEYBOARD_IMAGES_MICROPHONE_GREEN);
+  source->AddResourcePath("layouts/latin-accents.js",
+                          IDR_KEYBOARD_LAYOUTS_LATIN_ACCENTS);
   source->AddResourcePath("main.js", IDR_KEYBOARD_MAIN_JS);
   source->AddResourcePath("polymer.min.js", IDR_KEYBOARD_POLYMER);
   source->AddResourcePath("voice_input.js", IDR_KEYBOARD_VOICE_INPUT_JS);
diff --git a/ui/keyboard/keyboard_util.cc b/ui/keyboard/keyboard_util.cc
index b0371d7..076eacf 100644
--- a/ui/keyboard/keyboard_util.cc
+++ b/ui/keyboard/keyboard_util.cc
@@ -71,10 +71,12 @@
   static const GritResourceMap kKeyboardResources[] = {
     {"keyboard/api_adapter.js", IDR_KEYBOARD_API_ADAPTER_JS},
     {"keyboard/constants.js", IDR_KEYBOARD_CONSTANTS_JS},
-    {"keyboard/elements/kb-accent-container.html",
-        IDR_KEYBOARD_ELEMENTS_ACCENT_CONTAINER},
-    {"keyboard/elements/kb-accent-key.html", IDR_KEYBOARD_ELEMENTS_ACCENT_KEY},
-    {"keyboard/elements/kb-accent-set.html", IDR_KEYBOARD_ELEMENTS_ACCENT_SET},
+    {"keyboard/elements/kb-altkey.html", IDR_KEYBOARD_ELEMENTS_ALTKEY},
+    {"keyboard/elements/kb-altkey-container.html",
+        IDR_KEYBOARD_ELEMENTS_ALTKEY_CONTAINER},
+    {"keyboard/elements/kb-altkey-data.html",
+        IDR_KEYBOARD_ELEMENTS_ALTKEY_DATA},
+    {"keyboard/elements/kb-altkey-set.html", IDR_KEYBOARD_ELEMENTS_ALTKEY_SET},
     {"keyboard/elements/kb-key.html", IDR_KEYBOARD_ELEMENTS_KEY},
     {"keyboard/elements/kb-key-base.html", IDR_KEYBOARD_ELEMENTS_KEY_BASE},
     {"keyboard/elements/kb-key-import.html",
@@ -90,7 +92,10 @@
         IDR_KEYBOARD_IMAGES_MICROPHONE_GREEN},
     {"keyboard/index.html", IDR_KEYBOARD_INDEX},
     {"keyboard/layouts/dvorak.html", IDR_KEYBOARD_LAYOUTS_DVORAK},
+    {"keyboard/layouts/latin-accents.js", IDR_KEYBOARD_LAYOUTS_LATIN_ACCENTS},
     {"keyboard/layouts/qwerty.html", IDR_KEYBOARD_LAYOUTS_QWERTY},
+    {"keyboard/layouts/symbol-altkeys.js",
+        IDR_KEYBOARD_LAYOUTS_SYMBOL_ALTKEYS},
     {"keyboard/layouts/spacebar-row.html", IDR_KEYBOARD_SPACEBAR_ROW},
     {"keyboard/main.js", IDR_KEYBOARD_MAIN_JS},
     {"keyboard/manifest.json", IDR_KEYBOARD_MANIFEST},
diff --git a/ui/keyboard/resources/elements/kb-accent-container.html b/ui/keyboard/resources/elements/kb-altkey-container.html
similarity index 91%
rename from ui/keyboard/resources/elements/kb-accent-container.html
rename to ui/keyboard/resources/elements/kb-altkey-container.html
index 45c5df8..8866652 100644
--- a/ui/keyboard/resources/elements/kb-accent-container.html
+++ b/ui/keyboard/resources/elements/kb-altkey-container.html
@@ -4,7 +4,7 @@
   -- found in the LICENSE file.
   -->
 
-<polymer-element name="kb-accent-container" attributes="keyset" on-pointerup="up">
+<polymer-element name="kb-altkey-container" attributes="keyset" on-pointerup="up">
   <template>
     <style>
       @host {
@@ -22,7 +22,7 @@
     <content select="#{{keyset}}"></content>
   </template>
   <script>
-    Polymer('kb-accent-container', {
+    Polymer('kb-altkey-container', {
       resetActiveElement: function() {
         var activeAccentKeySet = this.querySelector('#' + this.keyset);
         var offset = activeAccentKeySet.offset;
diff --git a/ui/keyboard/resources/elements/kb-altkey-data.html b/ui/keyboard/resources/elements/kb-altkey-data.html
new file mode 100644
index 0000000..8f8b9a9
--- /dev/null
+++ b/ui/keyboard/resources/elements/kb-altkey-data.html
@@ -0,0 +1,119 @@
+<!--
+  -- 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.
+  -->
+
+<polymer-element name="kb-altkey-data" attributes="char list">
+<script>
+  (function() {
+    var altKeys = {};
+    var idMap = {};
+
+    function createId(char) {
+      return 'id' + char.charCodeAt(0);
+    }
+
+    Polymer('kb-altkey-data', {
+
+      /**
+       * Retrieves a list of alternative keys to display on a long-press.
+       * @param {string} char The base character.
+       * @param {boolean=} opt_force If true, force the creation of a list
+       *    even if empty. Used when constructing a set of alternates for keys
+       *    with superscripts.
+       * @return {?Object.{id: string, list: string}}
+       */
+      getAltkeys: function(char, opt_force) {
+        var id = idMap[char];
+        if (id) {
+          return {
+            'id': id,
+            'keys': altKeys[id]
+          };
+        }
+        if (opt_force) {
+          return {
+            'id': createId(char),
+            'keys': []
+          };
+        }
+      },
+
+      /**
+       * Registers lists of alternative keys displayed on a long-press.
+       * @param {Object.<string, Array.<string>>} data Mapping of characters to
+       *     lists of alternatives.
+       */
+      registerAltkeys: function(data) {
+        for (var key in data) {
+          var id = idMap[key];
+          if (!id)
+            idMap[key] = id = createId(key);
+          altKeys[id] = data[key];
+        }
+      },
+
+      /**
+       * Creates a list of alternate candidates to display in a popup on a
+       * long-press.
+       * @param {string} char The base character.
+       * @param {number} maxLeftOffset Limits the number of candidates
+       *      displayed to the left of the base character to prevent running
+       *      past the left edge of the keyboard.
+       * @param {number} maxRightOffset Limits the number of candidates
+       *     displayed to the right of the base character to prvent running
+       *     past the right edge of the keyboard.
+       * @param {string=} opt_additionalKeys Optional list of additional keys
+       *     to include in the candidates list.
+       */
+      createAltkeySet: function(char,
+                                maxLeftOffset,
+                                maxRightOffset,
+                                opt_additionalKeys) {
+        var altKeys = this.getAltkeys(char, true /* forced */);
+        if (altKeys) {
+          var list = altKeys.keys;
+          if (opt_additionalKeys)
+            list = opt_additionalKeys.split('').concat(list);
+          list = [char].concat(list);
+
+          var set = document.createElement('kb-altkey-set');
+          // Candiates are approximately in decreasing order of usage, and are
+          // arranged in a single row in the popup display.  To reduce the
+          // expected length of the drag gesture for selecting a candidate,
+          // more likely candidates are placed in the center of the popup,
+          // which is achieved by alternately appending and prepending
+          // candiates in the alternatives popup.
+          var prepend = false;
+          var leftOffset = 0;
+          var rightOffset = 0;
+          for (var i = 0; i < list.length; i++) {
+            var key = document.createElement('kb-altkey');
+            key.textContent = list[i];
+            if (prepend) {
+              set.insertBefore(key, set.firstChild);
+              leftOffset++;
+            } else {
+              set.appendChild(key);
+              rightOffset++;
+            }
+            prepend = !prepend;
+            // Verify that there is room remaining for an additional character.
+            if (leftOffset == maxLeftOffset && rightOffset == maxRightOffset)
+              break;
+            if (leftOffset == maxLeftOffset)
+              prepend = false;
+            else if (rightOffset == maxRightOffset)
+              prepend = true;
+          }
+          set.id = altKeys.id;
+          set.offset = leftOffset;
+          return set;
+        }
+      },
+
+    });
+  })();
+</script>
+</polymer-element>
diff --git a/ui/keyboard/resources/elements/kb-accent-set.html b/ui/keyboard/resources/elements/kb-altkey-set.html
similarity index 84%
rename from ui/keyboard/resources/elements/kb-accent-set.html
rename to ui/keyboard/resources/elements/kb-altkey-set.html
index a5b0a67..65b7b0b 100644
--- a/ui/keyboard/resources/elements/kb-accent-set.html
+++ b/ui/keyboard/resources/elements/kb-altkey-set.html
@@ -4,7 +4,7 @@
   -- found in the LICENSE file.
   -->
 
-<polymer-element name="kb-accent-set" attributes="offset">
+<polymer-element name="kb-altkey-set" attributes="offset char">
   <template>
     <style>
       /* TODO(stevet): Migrate this to main.css using custom pseudo
@@ -33,7 +33,7 @@
         */
       }
 
-      content::-webkit-distributed(kb-accent-key) {
+      content::-webkit-distributed(kb-altkey) {
         -webkit-flex: 1 auto;
         background-color: #3b3b3e;
         border-left: 1px solid rgba(0, 0, 0, 0.15);
@@ -43,12 +43,12 @@
         font-weight: 100;
       }
 
-      content::-webkit-distributed(kb-accent-key:first-child) {
+      content::-webkit-distributed(kb-altkey:first-child) {
         border-top-left-radius: 2px;
         border-bottom-left-radius: 2px;
       }
 
-      content::-webkit-distributed(kb-accent-key:last-child) {
+      content::-webkit-distributed(kb-altkey:last-child) {
         border-top-right-radius: 2px;
         border-bottom-right-radius: 2px;
       }
@@ -56,8 +56,8 @@
     <content select="*"></content>
   </template>
   <script>
-    Polymer('kb-accent-set', {
-      offset: 0
+    Polymer('kb-altkey-set', {
+      offset: 0,
     });
   </script>
 </polymer-element>
diff --git a/ui/keyboard/resources/elements/kb-accent-key.html b/ui/keyboard/resources/elements/kb-altkey.html
similarity index 93%
rename from ui/keyboard/resources/elements/kb-accent-key.html
rename to ui/keyboard/resources/elements/kb-altkey.html
index c889e36..42324cd 100644
--- a/ui/keyboard/resources/elements/kb-accent-key.html
+++ b/ui/keyboard/resources/elements/kb-altkey.html
@@ -4,7 +4,7 @@
   -- found in the LICENSE file.
   -->
 
-<polymer-element name="kb-accent-key" attributes="char" on-pointerover="over"
+<polymer-element name="kb-altkey" attributes="char" on-pointerover="over"
     on-pointerout="out" on-pointerup="up">
   <template>
     <style>
@@ -35,7 +35,7 @@
       return !(node.compareDocumentPosition(event.relatedTarget)
           & Node.DOCUMENT_POSITION_CONTAINED_BY);
     };
-    Polymer('kb-accent-key', {
+    Polymer('kb-altkey', {
       over: function(event) {
         if (isRelevantEvent(this, event)) {
           // Dragging over an accent key is equivalent to pressing on the accent
diff --git a/ui/keyboard/resources/elements/kb-key-base.html b/ui/keyboard/resources/elements/kb-key-base.html
index 6f45acf..497da30 100644
--- a/ui/keyboard/resources/elements/kb-key-base.html
+++ b/ui/keyboard/resources/elements/kb-key-base.html
@@ -122,7 +122,7 @@
         this.longPressTimer = this.asyncMethod(function() {
           var detail = {
             char: this.char || this.textContent,
-            accents: this.accents
+            superscript: this.superscript
           };
           if (this.keysetRules && this.keysetRules.long != undefined) {
             detail.toKeyset = this.keysetRules.long[TO_KEYSET - OFFSET];
diff --git a/ui/keyboard/resources/elements/kb-keyset.html b/ui/keyboard/resources/elements/kb-keyset.html
index 40de2df..365649d 100644
--- a/ui/keyboard/resources/elements/kb-keyset.html
+++ b/ui/keyboard/resources/elements/kb-keyset.html
@@ -1,5 +1,5 @@
 <!--
-  -- Copyright (c) 2013 The Chromium Authors. All rights reserved.
+  -- 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.
   -->
@@ -17,8 +17,9 @@
       }
     </style>
     <content select="kb-row"></content>
-    <content select="kb-accent-container" id="accentContainer"
+    <content select="kb-altkey-container" id="altkeyContainer"
         touch-action="none"></content>
+    <kb-altkey-data id="altkeyMetadata"></kb-altkey-data> 
   </template>
   <script>
     Polymer('kb-keyset', {
@@ -30,23 +31,46 @@
           detail.toKeyset = this.nextKeyset;
       },
       keyLongpress: function(event, detail) {
-        if (detail.accents) {
-          var accentContainer = this.$.accentContainer.getDistributedNodes()[0];
-          var activeAccentKeySet = accentContainer.querySelector('#' +
-              detail.accents);
-          if (!activeAccentKeySet)
-            return;
-          accentContainer.keyset = detail.accents;
-          event.target.classList.remove('active');
-          activeAccentKeySet.style.width = event.target.clientWidth *
-              activeAccentKeySet.childElementCount + 'px';
-          activeAccentKeySet.style.height = event.target.clientHeight + 'px';
-          activeAccentKeySet.style.top = event.target.offsetTop + 'px';
-          var leftOffset = activeAccentKeySet.offset * event.target.clientWidth;
-          activeAccentKeySet.style.left = event.target.offsetLeft - leftOffset +
-              'px';
-          accentContainer.hidden = false;
+        if (!detail.char)
+          return;
+
+        var altkeyContainer = this.$.altkeyContainer.getDistributedNodes()[0];
+        if (!altkeyContainer)
+          return;
+
+        var altkeyMetadata = this.$.altkeyMetadata;
+        var altkeys = altkeyMetadata.getAltkeys(detail.char,
+                                                !!detail.superscript);
+        if (!altkeys)
+          return;
+
+        var id = altkeys.id;
+        var activeAltKeySet = altkeyContainer.querySelector('#' + id);
+        if (!activeAltKeySet) {
+          var keyWidth = event.target.clientWidth;
+          var leftMargin = event.target.offsetLeft;
+          var maxLeftOffset = Math.round(leftMargin / keyWidth);
+          var rightMargin = this.clientWidth - leftMargin - keyWidth;
+          var maxRightOffset = Math.round(rightMargin / keyWidth);
+          activeAltKeySet = altkeyMetadata.createAltkeySet(detail.char,
+                                                           maxLeftOffset,
+                                                           maxRightOffset,
+                                                           detail.superscript);
+          altkeyContainer.appendChild(activeAltKeySet);
         }
+
+        altkeyContainer.keyset = id;
+        event.target.classList.remove('active');
+        activeAltKeySet.style.width = event.target.clientWidth *
+            activeAltKeySet.childElementCount + 'px';
+        activeAltKeySet.style.height = event.target.clientHeight + 'px';
+        activeAltKeySet.style.top = event.target.offsetTop + 'px';
+        var leftOffset = activeAltKeySet.offset * event.target.clientWidth;
+        activeAltKeySet.style.left = event.target.offsetLeft - leftOffset +
+            'px';
+        var nodes = activeAltKeySet.childNodes;
+        nodes[activeAltKeySet.offset].classList.add('active');
+        altkeyContainer.hidden = false;
       }
     });
   </script>
diff --git a/ui/keyboard/resources/index.html b/ui/keyboard/resources/index.html
index 97b147a..ac2982b 100644
--- a/ui/keyboard/resources/index.html
+++ b/ui/keyboard/resources/index.html
@@ -13,9 +13,17 @@
     <script src="polymer.min.js"></script>
     <script src="api_adapter.js"></script>
     <script src="voice_input.js"></script>
-    <link rel="import" href="elements/kb-accent-container.html">
-    <link rel="import" href="elements/kb-accent-set.html">
-    <link rel="import" href="elements/kb-accent-key.html">
+    <script src="main.js"></script>
+
+    <!-- TODO(kevers): Dynamically load alternative keys based on locale. -->
+    <script src="layouts/latin-accents.js"></script>
+    <script src="layouts/symbol-altkeys.js"></script>
+
+    <link rel="import" href="elements/kb-altkey-container.html">
+    <link rel="import" href="elements/kb-altkey.html">
+    <link rel="import" href="elements/kb-altkey-data.html">
+    <link rel="import" href="elements/kb-altkey-set.html">
+
     <link rel="import" href="elements/kb-key-base.html">
     <link rel="import" href="elements/kb-key.html">
     <link rel="import" href="elements/kb-keyboard.html">
@@ -26,7 +34,6 @@
     <link id="dvorak" rel="import" href="layouts/dvorak.html">
     <link id="qwerty" rel="import" href="layouts/qwerty.html">
     <!--TODO(stevet): Import 'Open Sans' font. -->
-    <script src="main.js"></script>
   </head>
   <body>
     <kb-keyboard id="keyboard" touch-action="none" layout="qwerty">
diff --git a/ui/keyboard/resources/layouts/dvorak.html b/ui/keyboard/resources/layouts/dvorak.html
index 89c4b70..2f90470 100644
--- a/ui/keyboard/resources/layouts/dvorak.html
+++ b/ui/keyboard/resources/layouts/dvorak.html
@@ -31,8 +31,8 @@
       <kb-key class="symbol dark" toKeyset="up:symbol" char="Invalid" align="right">#123</kb-key>
       <kb-layout-selector></kb-layout-selector>
     </kb-row>
-    <kb-accent-container hidden>
-    </kb-accent-container>
+    <kb-altkey-container hidden>
+    </kb-altkey-container>
   </kb-keyset>
 
   <kb-keyset id="dvorak-lower" isDefault=true>
@@ -57,8 +57,8 @@
       <kb-key class="symbol dark" toKeyset="up:symbol" char="Invalid" align="right">#123</kb-key>
       <kb-layout-selector></kb-layout-selector>
     </kb-row>
-    <kb-accent-container hidden>
-    </kb-accent-container>
+    <kb-altkey-container hidden>
+    </kb-altkey-container>
   </kb-keyset>
 
   <kb-keyset id="dvorak-symbol">
@@ -83,8 +83,8 @@
       <kb-key class="symbol dark" toKeyset="up:lower" char="Invalid" align="right">abc</kb-key>
       <kb-layout-selector></kb-layout-selector>
     </kb-row>
-    <kb-accent-container hidden>
-    </kb-accent-container>
+    <kb-altkey-container hidden>
+    </kb-altkey-container>
   </kb-keyset>
 
 <kb-keyset id="dvorak-more">
diff --git a/ui/keyboard/resources/layouts/latin-accents.js b/ui/keyboard/resources/layouts/latin-accents.js
new file mode 100644
index 0000000..e395ea8
--- /dev/null
+++ b/ui/keyboard/resources/layouts/latin-accents.js
@@ -0,0 +1,81 @@
+// 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.
+
+var uppercaseAccents = {
+  'A': ['\u00C0', // Capital A grave
+        '\u00C1', // Capital A acute
+        '\u00C2', // Capital A circumflex
+        '\u00C3', // Capital A tilde
+        '\u00C4', // Capital A diaeresis
+        '\u00C5', // Capital A ring
+        '\u00C6', // Capital ligature AE
+        '\u0100'], // Capital A macron
+  'C': ['\u00C7'], // Capital C cedilla
+  'E': ['\u00C8', // Capital E grave
+        '\u00C9', // Capital E acute
+        '\u00CA', // Capital E circumflex
+        '\u00CB', // Capital E diaeresis
+        '\u0112'], // Capital E macron
+  'I': ['\u00CC', // Capital I grave
+        '\u00CD', // Capital I acute
+        '\u00CE', // Capital I circumflex
+        '\u00CF', // Capital I diaeresis
+        '\u012A'], // Capital I macron
+  'N': ['\u00D1'], // Capital N tilde
+  'O': ['\u00D2', // Capital O grave
+        '\u00D3', // Capital O acute
+        '\u00D4', // Capital O circumflex
+        '\u00D5', // Capital O tilde
+        '\u00D6', // Capital O diaeresis
+        '\u014C', // Capital O macron
+        '\u0152'], // Capital ligature OE
+  'S': ['\u1E9E'], // Capital sharp S
+  'U': ['\u00D9', // Capital U grave
+        '\u00DA', // Capital U acute
+        '\u00DB', // Capital U circumflex
+        '\u00DC', // Capital U diaeresis
+        '\u016A'], // Capital U macron
+};
+
+var lowercaseAccents = {
+  'a': ['\u00E0', // Lowercase A grave
+        '\u00E1', // Lowercase A acute
+        '\u00E2', // Lowercase A circumflex
+        '\u00E3', // Lowercase A tilde
+        '\u00E4', // Lowercase A diaeresis
+        '\u00E5', // Lowercase A ring
+        '\u00E6', // Lowercase ligature AE
+        '\u0101'], // Lowercase A macron?
+  'c': ['\u00E7'], // Lowercase C cedilla
+  'e': ['\u00E8', // Lowercase E grave
+        '\u00E9', // Lowercase E acute
+        '\u00EA', // Lowercase E circumflex
+        '\u00EB', // Lowercase E diaeresis
+        '\u0113'], // Lowercase E macron
+  'i': ['\u00EC', // Lowercase I grave
+        '\u00ED', // Lowercase I acute
+        '\u00EE', // Lowercase I circumflex
+        '\u00EF', // Lowercase I diaeresis
+        '\u012B'], // Lowercase I macron
+  'n': ['\u00F1'], // Lowercase N tilde
+  'o': ['\u00F2', // Lowercase O grave
+        '\u00F3', // Lowercase O acute
+        '\u00F4', // Lowercase O circumflex
+        '\u00F5', // Lowercase O tilde
+        '\u00F6', // Lowercase O diaeresis
+        '\u00F8', // Lowercase O stroke
+        '\u0153'], // Lowercase ligature OE
+  's': ['\u00DF'], // Lowercase sharp S
+  'u': ['\u00F9', // Lowercase U grave
+        '\u00FA', // Lowercase U acute
+        '\u00FB', // Lowercase U circumflex
+        '\u00FC', // Lowercase U diaeresis
+        '\u016B'], // Lowercase U macron
+};
+
+document.addEventListener('WebComponentsReady', function() {
+  var altkeyMetadata = document.createElement('kb-altkey-data');
+  altkeyMetadata.registerAltkeys(uppercaseAccents);
+  altkeyMetadata.registerAltkeys(lowercaseAccents);
+});
diff --git a/ui/keyboard/resources/layouts/qwerty.html b/ui/keyboard/resources/layouts/qwerty.html
index 1783565..0f19ebf 100644
--- a/ui/keyboard/resources/layouts/qwerty.html
+++ b/ui/keyboard/resources/layouts/qwerty.html
@@ -33,93 +33,8 @@
       <kb-key class="symbol dark" toKeyset="up:symbol" char="Invalid" align="right">#123</kb-key>
       <kb-layout-selector toLayout="dvorak"></kb-layout-selector>
     </kb-row>
-    <kb-accent-container hidden>
-      <kb-accent-set id="Q" offset=1>
-        <kb-accent-key>1</kb-accent-key>
-        <kb-accent-key class="active">Q</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="W" offset=1>
-        <kb-accent-key>2</kb-accent-key>
-        <kb-accent-key class="active">W</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="E" offset=3>
-        <kb-accent-key>&#x00CB;</kb-accent-key>
-        <kb-accent-key>&#x00C9;</kb-accent-key>
-        <kb-accent-key>3</kb-accent-key>
-        <kb-accent-key class="active">E</kb-accent-key>
-        <kb-accent-key>&#x00C8;</kb-accent-key>
-        <kb-accent-key>&#x00CA;</kb-accent-key>
-        <kb-accent-key>&#x0112;</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="R" offset=1>
-        <kb-accent-key>4</kb-accent-key>
-        <kb-accent-key class="active">R</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="T" offset=1>
-        <kb-accent-key>5</kb-accent-key>
-        <kb-accent-key class="active">T</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="Y" offset=1>
-        <kb-accent-key>6</kb-accent-key>
-        <kb-accent-key class="active">Y</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="U" offset=3>
-        <kb-accent-key>&#x00DB;</kb-accent-key>
-        <kb-accent-key>&#x00DA;</kb-accent-key>
-        <kb-accent-key>7</kb-accent-key>
-        <kb-accent-key class="active">U</kb-accent-key>
-        <kb-accent-key>&#x00D9;</kb-accent-key>
-        <kb-accent-key>&#x00DC;</kb-accent-key>
-        <kb-accent-key>&#x016A;</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="I" offset=3>
-        <kb-accent-key>&#x00CF;</kb-accent-key>
-        <kb-accent-key>&#x00CD;</kb-accent-key>
-        <kb-accent-key>8</kb-accent-key>
-        <kb-accent-key class="active">I</kb-accent-key>
-        <kb-accent-key>&#x00CC;</kb-accent-key>
-        <kb-accent-key>&#x00CE;</kb-accent-key>
-        <kb-accent-key>&#x012A;</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="O" offset=5>
-        <kb-accent-key>&#x014C;</kb-accent-key>
-        <kb-accent-key>&#x00D6;</kb-accent-key>
-        <kb-accent-key>&#x00D4;</kb-accent-key>
-        <kb-accent-key>&#x00D2;</kb-accent-key>
-        <kb-accent-key>9</kb-accent-key>
-        <kb-accent-key class="active">O</kb-accent-key>
-        <kb-accent-key>&#x00D3;</kb-accent-key>
-        <kb-accent-key>&#x00D5;</kb-accent-key>
-        <kb-accent-key>&#x0152;</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="P" offset=1>
-        <kb-accent-key>0</kb-accent-key>
-        <kb-accent-key class="active">P</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="A" offset=2>
-        <kb-accent-key>&#x00C2;</kb-accent-key>
-        <kb-accent-key>&#x00C0;</kb-accent-key>
-        <kb-accent-key class="active">A</kb-accent-key>
-        <kb-accent-key>&#x00C1;</kb-accent-key>
-        <kb-accent-key>&#x00C3;</kb-accent-key>
-        <kb-accent-key>&#x00C4;</kb-accent-key>
-        <kb-accent-key>&#x00C5;</kb-accent-key>
-        <kb-accent-key>&#x00C6;</kb-accent-key>
-        <kb-accent-key>&#x0100;</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="S" offset=1>
-        <kb-accent-key>&#x1E9E;</kb-accent-key>
-        <kb-accent-key class="active">S</kb-accent-key>
-        </kb-accent-set>
-      <kb-accent-set id="C" offset=1>
-        <kb-accent-key>&#x00C7;</kb-accent-key>
-        <kb-accent-key class="active">C</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="N" offset=1>
-        <kb-accent-key>&#x00D1;</kb-accent-key>
-        <kb-accent-key class="active">N</kb-accent-key>
-      </kb-accent-set>
-    </kb-accent-container>
+    <kb-altkey-container hidden>
+    </kb-altkey-container>
   </kb-keyset>
 
   <kb-keyset id="qwerty-lower" isDefault=true>
@@ -136,7 +51,7 @@
     <kb-row>
       <kb-shift-key toKeyset="up:upper:lower; long:upper; dbl:upper" weight="1.8" align="left">shift</kb-shift-key>
       <kb-key-sequence keys="zxcvbnm"></kb-key-sequence>
-      <kb-key superscript="!" accents="comma">,</kb-key><kb-key superscript="?" accents="period">.</kb-key>
+      <kb-key superscript="!">,</kb-key><kb-key superscript="?">.</kb-key>
       <kb-shift-key toKeyset="up:upper:lower; long:upper; dbl:upper" weight="1.8" align="right">shift</kb-shift-key>
     </kb-row>
     <kb-row>
@@ -145,125 +60,32 @@
       <kb-key class="symbol dark" toKeyset="up:symbol" char="Invalid" align="right">#123</kb-key>
       <kb-layout-selector toLayout="dvorak"></kb-layout-selector>
     </kb-row>
-    <kb-accent-container hidden>
-      <kb-accent-set id="q" offset=1>
-        <kb-accent-key>1</kb-accent-key>
-        <kb-accent-key class="active">q</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="w" offset=1>
-        <kb-accent-key>2</kb-accent-key>
-        <kb-accent-key class="active">w</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="e" offset=3>
-        <kb-accent-key>&#x00EB;</kb-accent-key>
-        <kb-accent-key>&#x00E9;</kb-accent-key>
-        <kb-accent-key>3</kb-accent-key>
-        <kb-accent-key class="active">e</kb-accent-key>
-        <kb-accent-key>&#x00E8;</kb-accent-key>
-        <kb-accent-key>&#x00EA;</kb-accent-key>
-        <kb-accent-key>&#x0113;</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="r" offset=1>
-        <kb-accent-key>4</kb-accent-key>
-        <kb-accent-key class="active">r</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="t" offset=1>
-        <kb-accent-key>5</kb-accent-key>
-        <kb-accent-key class="active">t</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="y" offset=1>
-        <kb-accent-key>6</kb-accent-key>
-        <kb-accent-key class="active">y</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="u" offset=3>
-        <kb-accent-key>&#x00FB;</kb-accent-key>
-        <kb-accent-key>&#x00FA;</kb-accent-key>
-        <kb-accent-key>7</kb-accent-key>
-        <kb-accent-key class="active">u</kb-accent-key>
-        <kb-accent-key>&#x00F9;</kb-accent-key>
-        <kb-accent-key>&#x00FC;</kb-accent-key>
-        <kb-accent-key>&#x016B;</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="i" offset=3>
-        <kb-accent-key>&#x00EF;</kb-accent-key>
-        <kb-accent-key>&#x00ED;</kb-accent-key>
-        <kb-accent-key>8</kb-accent-key>
-        <kb-accent-key class="active">i</kb-accent-key>
-        <kb-accent-key>&#x00EE;</kb-accent-key>
-        <kb-accent-key>&#x00EC;</kb-accent-key>
-        <kb-accent-key>&#x012B;</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="o" offset=5>
-        <kb-accent-key>&#x00F8;</kb-accent-key>
-        <kb-accent-key>&#x00F6;</kb-accent-key>
-        <kb-accent-key>&#x00F4;</kb-accent-key>
-        <kb-accent-key>&#x00F2;</kb-accent-key>
-        <kb-accent-key>9</kb-accent-key>
-        <kb-accent-key class="active">o</kb-accent-key>
-        <kb-accent-key>&#x00F3;</kb-accent-key>
-        <kb-accent-key>&#x00F5;</kb-accent-key>
-        <kb-accent-key>&#x0153;</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="p" offset=1>
-        <kb-accent-key>0</kb-accent-key>
-        <kb-accent-key class="active">p</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="a" offset=2>
-        <kb-accent-key>&#x00E2;</kb-accent-key>
-        <kb-accent-key>&#x00E0;</kb-accent-key>
-        <kb-accent-key class="active">a</kb-accent-key>
-        <kb-accent-key>&#x00E1;</kb-accent-key>
-        <kb-accent-key>&#x00E3;</kb-accent-key>
-        <kb-accent-key>&#x00E4;</kb-accent-key>
-        <kb-accent-key>&#x00E5;</kb-accent-key>
-        <kb-accent-key>&#x00E6;</kb-accent-key>
-        <kb-accent-key>&#x0101;</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="s" offset=1>
-        <kb-accent-key>&#x00DF;</kb-accent-key>
-        <kb-accent-key class="active">s</kb-accent-key>
-        </kb-accent-set>
-      <kb-accent-set id="c" offset=1>
-        <kb-accent-key>&#x00E7;</kb-accent-key>
-        <kb-accent-key class="active">c</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="n" offset=1>
-        <kb-accent-key>&#x00F1;</kb-accent-key>
-        <kb-accent-key class="active">n</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="comma" offset=1>
-        <kb-accent-key>!</kb-accent-key>
-        <kb-accent-key class="active">,</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="period" offset=1>
-        <kb-accent-key>?</kb-accent-key>
-        <kb-accent-key class="active">.</kb-accent-key>
-      </kb-accent-set>
-    </kb-accent-container>
+    <kb-altkey-container hidden>
+    </kb-altkey-container>
   </kb-keyset>
 
   <kb-keyset id="qwerty-symbol">
     <kb-row>
       <kb-key class="tab dark" char="&#x0009;" align="left">tab</kb-key>
-      <kb-key accents="one">1</kb-key><kb-key accents="two">2</kb-key>
-      <kb-key accents="three">3</kb-key><kb-key accents="four">4</kb-key>
-      <kb-key accents="five">5</kb-key><kb-key>6</kb-key><kb-key accents="seven">7</kb-key>
-      <kb-key>8</kb-key><kb-key>9</kb-key><kb-key accents="zero">0</kb-key>
+      <kb-key>1</kb-key><kb-key>2</kb-key>
+      <kb-key>3</kb-key><kb-key>4</kb-key>
+      <kb-key>5</kb-key><kb-key>6</kb-key><kb-key>7</kb-key>
+      <kb-key>8</kb-key><kb-key>9</kb-key><kb-key>0</kb-key>
       <kb-key class="backspace dark" char="&#x0008;" repeat align="right">backspace</kb-key>
     </kb-row>
     <kb-row>
       <kb-key class="microphone dark" char="Microphone"></kb-key>
-      <kb-key>@</kb-key><kb-key>#</kb-key><kb-key accents="dollar">$</kb-key>
-      <kb-key accents="percent">%</kb-key><kb-key>&</kb-key>
-      <kb-key accents="star">*</kb-key><kb-key accents="slash">/</kb-key>
-      <kb-key accents="lparen">(</kb-key><kb-key accents="rparen">)</kb-key>
+      <kb-key>@</kb-key><kb-key>#</kb-key><kb-key>$</kb-key>
+      <kb-key>%</kb-key><kb-key>&</kb-key>
+      <kb-key>*</kb-key><kb-key>/</kb-key>
+      <kb-key>(</kb-key><kb-key>)</kb-key>
       <kb-key class='return dark' char="&#x000A;" align="right">enter</kb-key>
     </kb-row>
     <kb-row>
       <kb-key class="left-more dark" toKeyset="up:more" char="Invalid" align="left">more</kb-key>
-      <kb-key>:</kb-key><kb-key>;</kb-key><kb-key accents="dash">-</kb-key><kb-key>'</kb-key>
-      <kb-key accents="doublequote">"</kb-key><kb-key accents="excla">!</kb-key>
-      <kb-key accents="quest">?</kb-key><kb-key>,</kb-key><kb-key>.</kb-key>
+      <kb-key>:</kb-key><kb-key>;</kb-key><kb-key>-</kb-key><kb-key>'</kb-key>
+      <kb-key>"</kb-key><kb-key>!</kb-key>
+      <kb-key>?</kb-key><kb-key>,</kb-key><kb-key>.</kb-key>
       <kb-key class="right-more dark" toKeyset="up:more" char="Invalid" align="right">more</kb-key>
     </kb-row>
     <kb-row>
@@ -272,97 +94,8 @@
       <kb-key class="symbol dark" toKeyset="up:lower" char="Invalid" align="right">abc</kb-key>
       <kb-layout-selector toLayout="dvorak"></kb-layout-selector>
     </kb-row>
-    <kb-accent-container hidden>
-      <kb-accent-set id="one" offset=1>
-        <kb-accent-key>&#x00B9;</kb-accent-key>
-        <kb-accent-key class="active">1</kb-accent-key>
-        <kb-accent-key>&#x00BD;</kb-accent-key>
-        <kb-accent-key>&#x2153;</kb-accent-key>
-        <kb-accent-key>&#x00BC;</kb-accent-key>
-        <kb-accent-key>&#x215B;</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="two" offset=1>
-        <kb-accent-key>&#x00B2;</kb-accent-key>
-        <kb-accent-key class="active">2</kb-accent-key>
-        <kb-accent-key>&#x2154;</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="three" offset=1>
-        <kb-accent-key>&#x00B3;</kb-accent-key>
-        <kb-accent-key class="active">3</kb-accent-key>
-        <kb-accent-key>&#x215C;</kb-accent-key>
-        <kb-accent-key>&#x00BE;</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="four" offset=1>
-        <kb-accent-key>&#x2074;</kb-accent-key>
-        <kb-accent-key class="active">4</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="five" offset=1>
-        <kb-accent-key>&#x215D;</kb-accent-key>
-        <kb-accent-key class="active">5</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="seven" offset=1>
-        <kb-accent-key>&#x215E;</kb-accent-key>
-        <kb-accent-key class="active">7</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="zero" offset=1>
-        <kb-accent-key>&#x00D8;</kb-accent-key>
-        <kb-accent-key class="active">0</kb-accent-key>
-        <kb-accent-key>&#x207F;</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="dollar" offset=2>
-        <kb-accent-key>&#x00A3;</kb-accent-key>
-        <kb-accent-key>&#x00A2;</kb-accent-key>
-        <kb-accent-key class="active">$</kb-accent-key>
-        <kb-accent-key>&#x20AC;</kb-accent-key>
-        <kb-accent-key>&#x00A5;</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="percent" offset=2>
-        <kb-accent-key>&#x2030;</kb-accent-key>
-        <kb-accent-key class="active">%</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="star" offset=1>
-        <kb-accent-key>&#x2605;</kb-accent-key>
-        <kb-accent-key class="active">*</kb-accent-key>
-        <kb-accent-key>&#x2020;</kb-accent-key>
-        <kb-accent-key>&#x2021;</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="slash" offset=1>
-        <kb-accent-key>\</kb-accent-key>
-        <kb-accent-key class="active">/</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="doublequote" offset=2>
-        <kb-accent-key>&#x201E;</kb-accent-key>
-        <kb-accent-key>&#x201C;</kb-accent-key>
-        <kb-accent-key class="active">"</kb-accent-key>
-        <kb-accent-key>&#x00AB;</kb-accent-key>
-        <kb-accent-key>&#x00BB;</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="dash" offset=1>
-        <kb-accent-key>_</kb-accent-key>
-        <kb-accent-key class="active">-</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="excla" offset=1>
-        <kb-accent-key>&#x00A1;</kb-accent-key>
-        <kb-accent-key class="active">!</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="quest" offset=1>
-        <kb-accent-key>&#x00BF;</kb-accent-key>
-        <kb-accent-key class="active">?</kb-accent-key>
-        <kb-accent-key>&#x203D;</kb-accent-key><!-- Interrobang -->
-      </kb-accent-set>
-      <kb-accent-set id="lparen" offset=2>
-        <kb-accent-key>&#x003C;</kb-accent-key>
-        <kb-accent-key>{</kb-accent-key>
-        <kb-accent-key class="active">(</kb-accent-key>
-        <kb-accent-key>[</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="rparen" offset=2>
-        <kb-accent-key>&#x003E;</kb-accent-key>
-        <kb-accent-key>}</kb-accent-key>
-        <kb-accent-key class="active">)</kb-accent-key>
-        <kb-accent-key>]</kb-accent-key>
-      </kb-accent-set>
-    </kb-accent-container>
+    <kb-altkey-container hidden>
+    </kb-altkey-container>
   </kb-keyset>
 
   <kb-keyset id="qwerty-more">
diff --git a/ui/keyboard/resources/layouts/symbol-altkeys.js b/ui/keyboard/resources/layouts/symbol-altkeys.js
new file mode 100644
index 0000000..24dfed8
--- /dev/null
+++ b/ui/keyboard/resources/layouts/symbol-altkeys.js
@@ -0,0 +1,45 @@
+// 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.
+
+var symbolAltKeys = {
+  '1': ['\u00B9', // Superscript 1
+        '\u00BD', // Vulgar fraction 1/2
+        '\u2153', // Vulgar fraction 1/3
+        '\u00BC', // Vulgar fraction 1/4
+        '\u215B'], // Vulgar fraction 1/8
+  '2': ['\u00B2', // Superscript 2
+        '\u2154'], // Vulgar fraction 2/3
+  '3': ['\u00B3', // Superscript 3
+        '\u00BE', // Vulgar fraction 3/4
+        '\u215C'], // Vulgar fraction 3/8
+  '4': ['\u2074'], // Superscript 4
+  '5': ['\u215D'], // Vulgar fraction 5/8
+  '7': ['\u215E'], // Vulgar fraction 7/8
+  '0': ['\u00D8', // Empty set
+        '\u207F'], // Superscript small n
+  '$': ['\u20AC', // Euro sign
+        '\u00A5', // Yen sign
+        '\u00A3', // Pound sign
+        '\u00A2'], // Cent sign
+  '%': ['\u2030'], // Per Mille sign
+  '*': ['\u2605', // Black star
+        '\u2020', // Dagger
+        '\u2021'], // Double dagger
+  '\\': ['/'],
+  '"': ['\u201C', // Left double quote
+        '\u201D', // Right double quote
+        '\u201E', // Double low-9 quotation mark
+        '\u00AB', // Left double angle quote
+        '\u00BB'], // Right double angle quote
+  '-': ['_'],
+  '!': ['\u00A1'], // Inverted exclamation mark
+  '?': ['\u00BF'], // Inverted question mark
+  '(': ['<', '{', '['],
+  ')': ['>', '}', ']']
+};
+
+document.addEventListener('WebComponentsReady', function() {
+  var altkeyMetadata = document.createElement('kb-altkey-data');
+  altkeyMetadata.registerAltkeys(symbolAltKeys);
+});
diff --git a/ui/keyboard/resources/layouts/webui_qwerty.html b/ui/keyboard/resources/layouts/webui_qwerty.html
index 00bbdc5..4b8f32b 100644
--- a/ui/keyboard/resources/layouts/webui_qwerty.html
+++ b/ui/keyboard/resources/layouts/webui_qwerty.html
@@ -7,13 +7,13 @@
 <template>
   <kb-keyset id="qwerty-upper">
     <kb-row class="top">
-      <kb-key>Q</kb-key><kb-key>W</kb-key><kb-key accents="E">E</kb-key><kb-key>R</kb-key>
-      <kb-key>T</kb-key><kb-key>Y</kb-key><kb-key accents="U">U</kb-key>
-      <kb-key accents="I">I</kb-key><kb-key accents="O">O</kb-key><kb-key>P</kb-key>
+      <kb-key>Q</kb-key><kb-key>W</kb-key><kb-key>E</kb-key><kb-key>R</kb-key>
+      <kb-key>T</kb-key><kb-key>Y</kb-key><kb-key>U</kb-key>
+      <kb-key>I</kb-key><kb-key>O</kb-key><kb-key>P</kb-key>
     </kb-row>
     <kb-row>
       <div class="half-key-spacer"></div>
-      <kb-key accents="A">A</kb-key><kb-key>S</kb-key><kb-key>D</kb-key><kb-key>F</kb-key>
+      <kb-key>A</kb-key><kb-key>S</kb-key><kb-key>D</kb-key><kb-key>F</kb-key>
       <kb-key>G</kb-key><kb-key>H</kb-key><kb-key>J</kb-key><kb-key>K</kb-key>
       <kb-key>L</kb-key>
       <div class="half-key-spacer"></div>
@@ -32,68 +32,19 @@
       <kb-key class="dark">.</kb-key>
       <kb-key class="return dark" char="&#000A;">enter</kb-key>
     </kb-row>
-    <kb-accent-container hidden>
-      <kb-accent-set id="E" offset=2>
-        <kb-accent-key>&#x00C9;</kb-accent-key>
-        <kb-accent-key>3</kb-accent-key>
-        <kb-accent-key class="active">E</kb-accent-key>
-        <kb-accent-key>&#x00C8;</kb-accent-key>
-        <kb-accent-key>&#x00CA;</kb-accent-key>
-        <kb-accent-key>&#x00CB;</kb-accent-key>
-        <kb-accent-key>&#x0112;</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="U" offset=3>
-        <kb-accent-key>&#x00DB;</kb-accent-key>
-        <kb-accent-key>&#x00DA;</kb-accent-key>
-        <kb-accent-key>7</kb-accent-key>
-        <kb-accent-key class="active">U</kb-accent-key>
-        <kb-accent-key>&#x00D9;</kb-accent-key>
-        <kb-accent-key>&#x00DC;</kb-accent-key>
-        <kb-accent-key>&#x016A;</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="I" offset=4>
-        <kb-accent-key>&#x00CF;</kb-accent-key>
-        <kb-accent-key>&#x00CD;</kb-accent-key>
-        <kb-accent-key>&#x00CC;</kb-accent-key>
-        <kb-accent-key>8</kb-accent-key>
-        <kb-accent-key class="active">I</kb-accent-key>
-        <kb-accent-key>&#x00CE;</kb-accent-key>
-        <kb-accent-key>&#x012A;</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="O" offset=7>
-        <kb-accent-key>&#x0152;</kb-accent-key>
-        <kb-accent-key>&#x014C;</kb-accent-key>
-        <kb-accent-key>&#x00D4;</kb-accent-key>
-        <kb-accent-key>&#x00D2;</kb-accent-key>
-        <kb-accent-key>&#x00D3;</kb-accent-key>
-        <kb-accent-key>&#x00D5;</kb-accent-key>
-        <kb-accent-key>9</kb-accent-key>
-        <kb-accent-key class="active">O</kb-accent-key>
-        <kb-accent-key>&#x00D6;</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="A" offset=0>
-        <kb-accent-key class="active">A</kb-accent-key>
-        <kb-accent-key>&#x00C1;</kb-accent-key>
-        <kb-accent-key>&#x00C0;</kb-accent-key>
-        <kb-accent-key>&#x00C2;</kb-accent-key>
-        <kb-accent-key>&#x00C3;</kb-accent-key>
-        <kb-accent-key>&#x00C4;</kb-accent-key>
-        <kb-accent-key>&#x00C5;</kb-accent-key>
-        <kb-accent-key>&#x00C6;</kb-accent-key>
-        <kb-accent-key>&#x0100;</kb-accent-key>
-      </kb-accent-set>
-    </kb-accent-container>
+    <kb-altkey-container hidden>
+    </kb-altkey-container>
   </kb-keyset>
 
   <kb-keyset id="qwerty-lower" isDefault=true>
     <kb-row class="top">
-      <kb-key>q</kb-key><kb-key>w</kb-key><kb-key accents="e">e</kb-key><kb-key>r</kb-key>
-      <kb-key>t</kb-key><kb-key>y</kb-key><kb-key accents="u">u</kb-key>
-      <kb-key accents="i">i</kb-key><kb-key accents="o">o</kb-key><kb-key>p</kb-key>
+      <kb-key>q</kb-key><kb-key>w</kb-key><kb-key>e</kb-key><kb-key>r</kb-key>
+      <kb-key>t</kb-key><kb-key>y</kb-key><kb-key>u</kb-key>
+      <kb-key>i</kb-key><kb-key>o</kb-key><kb-key>p</kb-key>
     </kb-row>
     <kb-row>
       <div class="half-key-spacer"></div>
-      <kb-key accents="a">a</kb-key><kb-key>s</kb-key><kb-key>d</kb-key><kb-key>f</kb-key>
+      <kb-key>a</kb-key><kb-key>s</kb-key><kb-key>d</kb-key><kb-key>f</kb-key>
       <kb-key>g</kb-key><kb-key>h</kb-key><kb-key>j</kb-key><kb-key>k</kb-key>
       <kb-key>l</kb-key>
       <div class="half-key-spacer"></div>
@@ -112,57 +63,8 @@
       <kb-key class="dark">.</kb-key>
       <kb-key class='return dark' char="&#x000A;">enter</kb-key>
     </kb-row>
-    <kb-accent-container hidden>
-      <kb-accent-set id="e" offset=2>
-        <kb-accent-key>&#x00E8;</kb-accent-key>
-        <kb-accent-key>&#x00E9;</kb-accent-key>
-        <kb-accent-key class="active">e</kb-accent-key>
-        <kb-accent-key>3</kb-accent-key>
-        <kb-accent-key>&#x00EA;</kb-accent-key>
-        <kb-accent-key>&#x00EB;</kb-accent-key>
-        <kb-accent-key>&#x0113;</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="u" offset=3>
-        <kb-accent-key>&#x00F9;</kb-accent-key>
-        <kb-accent-key>&#x00FA;</kb-accent-key>
-        <kb-accent-key>7</kb-accent-key>
-        <kb-accent-key class="active">u</kb-accent-key>
-        <kb-accent-key>&#x00FB;</kb-accent-key>
-        <kb-accent-key>&#x00FC;</kb-accent-key>
-        <kb-accent-key>&#x016B;</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="i" offset=4>
-        <kb-accent-key>&#x00EE;</kb-accent-key>
-        <kb-accent-key>&#x00ED;</kb-accent-key>
-        <kb-accent-key>&#x00EC;</kb-accent-key>
-        <kb-accent-key>8</kb-accent-key>
-        <kb-accent-key class="active">i</kb-accent-key>
-        <kb-accent-key>&#x00EF;</kb-accent-key>
-        <kb-accent-key>&#x012B;</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="o" offset=7>
-        <kb-accent-key>&#x00F8;</kb-accent-key>
-        <kb-accent-key>&#x0153;</kb-accent-key>
-        <kb-accent-key>&#x00F6;</kb-accent-key>
-        <kb-accent-key>&#x00F4;</kb-accent-key>
-        <kb-accent-key>&#x00F2;</kb-accent-key>
-        <kb-accent-key>&#x00F5;</kb-accent-key>
-        <kb-accent-key>9</kb-accent-key>
-        <kb-accent-key class="active">o</kb-accent-key>
-        <kb-accent-key>&#x00F3;</kb-accent-key>
-      </kb-accent-set>
-      <kb-accent-set id="a" offset=0>
-        <kb-accent-key class="active">a</kb-accent-key>
-        <kb-accent-key>&#x00E0;</kb-accent-key>
-        <kb-accent-key>&#x00E1;</kb-accent-key>
-        <kb-accent-key>&#x00E2;</kb-accent-key>
-        <kb-accent-key>&#x00E3;</kb-accent-key>
-        <kb-accent-key>&#x00E4;</kb-accent-key>
-        <kb-accent-key>&#x00E5;</kb-accent-key>
-        <kb-accent-key>&#x00E6;</kb-accent-key>
-        <kb-accent-key>&#x0101;</kb-accent-key>
-      </kb-accent-set>
-    </kb-accent-container>
+    <kb-altkey-container hidden>
+    </kb-altkey-container>
   </kb-keyset>
 
   <kb-keyset id="qwerty-symbol">
diff --git a/ui/keyboard/resources/main.css b/ui/keyboard/resources/main.css
index f76268c..149384f 100644
--- a/ui/keyboard/resources/main.css
+++ b/ui/keyboard/resources/main.css
@@ -76,7 +76,7 @@
 }
 
 /* TODO(stevet): We can probably share most of this with kb-key::x-key. */
-kb-accent-key::x-key {
+kb-altkey::x-key {
   bottom: 0;
   height: 1.2em;
   left: 0;
diff --git a/ui/keyboard/resources/main.js b/ui/keyboard/resources/main.js
index 9e1f00c..0abc0f1 100644
--- a/ui/keyboard/resources/main.js
+++ b/ui/keyboard/resources/main.js
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// 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.
 
@@ -27,7 +27,7 @@
     });
   }
   return dom;
-};
+}
 
 /**
  * Replace all kb-key-sequence elements with generated kb-key elements.
@@ -41,7 +41,7 @@
       element.parentNode.replaceChild(generatedDom, element);
     });
   }
-};
+}
 
 /**
   * Flatten the keysets which represents a keyboard layout. It has two steps:
@@ -54,7 +54,7 @@
   var importedContent = importHTML(content);
   expandHTML(importedContent);
   return importedContent;
-};
+}
 
 addEventListener('resize', onResize);
 
diff --git a/ui/keyboard/resources/webui/main.css b/ui/keyboard/resources/webui/main.css
index fe674c8..c2faba0 100644
--- a/ui/keyboard/resources/webui/main.css
+++ b/ui/keyboard/resources/webui/main.css
@@ -70,7 +70,7 @@
   border-top: 2px solid #3a3a3c;
 }
 
-kb-accent-key::x-key {
+kb-altkey::x-key {
   bottom: 0;
   height: 1.2em;
   left: 0;
diff --git a/ui/keyboard/resources/webui_index.html b/ui/keyboard/resources/webui_index.html
index 47e1378..cc3566c 100644
--- a/ui/keyboard/resources/webui_index.html
+++ b/ui/keyboard/resources/webui_index.html
@@ -20,9 +20,10 @@
     <script src="polymer.min.js"></script>
     <script src="api_adapter.js"></script>
     <script src="voice_input.js"></script>
-    <link rel="import" href="elements/kb-accent-container.html">
-    <link rel="import" href="elements/kb-accent-set.html">
-    <link rel="import" href="elements/kb-accent-key.html">
+    <link rel="import" href="elements/kb-altkey.html">
+    <link rel="import" href="elements/kb-altkey-container.html">
+    <link rel="import" href="elements/kb-altkey-data.html">
+    <link rel="import" href="elements/kb-altkey-set.html">
     <link rel="import" href="elements/kb-key-base.html">
     <link rel="import" href="elements/kb-key.html">
     <link rel="import" href="elements/kb-keyboard.html">
@@ -31,6 +32,7 @@
     <link id="qwerty" rel="import" href="layouts/qwerty.html">
     <!--TODO(stevet): Import 'Open Sans' font. -->
     <script src="main.js"></script>
+    <script src="layouts/latin-accents.js"></script>
   </head>
   <body>
     <kb-keyboard id="keyboard" touch-action="none" layout="qwerty">
diff --git a/ui/message_center/cocoa/status_item_view.mm b/ui/message_center/cocoa/status_item_view.mm
index 5e1002f..c0efa07 100644
--- a/ui/message_center/cocoa/status_item_view.mm
+++ b/ui/message_center/cocoa/status_item_view.mm
@@ -177,7 +177,7 @@
   if (unreadCount_ > 9)
     count = @"9+";
   else
-    count = [NSString stringWithFormat:@"%"PRIuS, unreadCount_];
+    count = [NSString stringWithFormat:@"%" PRIuS, unreadCount_];
 
   NSColor* fontColor = [self shouldHighlight] ? [NSColor whiteColor]
                                               : [NSColor blackColor];
diff --git a/ui/message_center/views/message_center_bubble.cc b/ui/message_center/views/message_center_bubble.cc
index 4f0c000..3f7d159 100644
--- a/ui/message_center/views/message_center_bubble.cc
+++ b/ui/message_center/views/message_center_bubble.cc
@@ -58,10 +58,12 @@
 // MessageCenterBubble /////////////////////////////////////////////////////////
 
 MessageCenterBubble::MessageCenterBubble(MessageCenter* message_center,
-                                         MessageCenterTray* tray)
+                                         MessageCenterTray* tray,
+                                         bool first_item_has_no_margin)
     : MessageBubbleBase(message_center, tray),
       message_center_view_(NULL),
-      initially_settings_visible_(false) {
+      initially_settings_visible_(false),
+      first_item_has_no_margin_(first_item_has_no_margin) {
 }
 
 MessageCenterBubble::~MessageCenterBubble() {
@@ -82,6 +84,7 @@
   init_params.max_width += kMarginBetweenItems * 2;
   init_params.max_height = max_height();
   init_params.can_activate = true;
+  init_params.first_item_has_no_margin = first_item_has_no_margin_;
   return init_params;
 }
 
diff --git a/ui/message_center/views/message_center_bubble.h b/ui/message_center/views/message_center_bubble.h
index 5b67c21..f68449f 100644
--- a/ui/message_center/views/message_center_bubble.h
+++ b/ui/message_center/views/message_center_bubble.h
@@ -18,7 +18,9 @@
     : public MessageBubbleBase,
       public base::SupportsWeakPtr<MessageCenterBubble> {
  public:
-  MessageCenterBubble(MessageCenter* message_center, MessageCenterTray* tray);
+  MessageCenterBubble(MessageCenter* message_center,
+                      MessageCenterTray* tray,
+                      bool first_item_has_no_margin);
 
   virtual ~MessageCenterBubble();
 
@@ -44,6 +46,10 @@
   // Use settings view as the initially visible content if true.
   bool initially_settings_visible_;
 
+  // True if the first message which gets shown should have no margin against
+  // the used anchor.
+  bool first_item_has_no_margin_;
+
   DISALLOW_COPY_AND_ASSIGN(MessageCenterBubble);
 };
 
diff --git a/ui/message_center/views/message_popup_collection.cc b/ui/message_center/views/message_popup_collection.cc
index 7d24a2f..efe700a 100644
--- a/ui/message_center/views/message_popup_collection.cc
+++ b/ui/message_center/views/message_popup_collection.cc
@@ -38,19 +38,28 @@
 // just closed, the timeout is shorter.
 const int kMouseExitedDeferTimeoutMs = 200;
 
+// The margin between messages (and between the anchor unless
+// first_item_has_no_margin was specified).
 const int kToastMargin = kMarginBetweenItems;
 
+// If there should be no margin for the first item, this value needs to be
+// substracted to flush the message to the shelf (the width of the border +
+// shadow).
+const int kNoToastMarginBorderAndShadowOffset = 2;
+
 }  // namespace.
 
 MessagePopupCollection::MessagePopupCollection(gfx::NativeView parent,
                                                MessageCenter* message_center,
-                                               MessageCenterTray* tray)
+                                               MessageCenterTray* tray,
+                                               bool first_item_has_no_margin)
     : parent_(parent),
       message_center_(message_center),
       tray_(tray),
       defer_counter_(0),
       latest_toast_entered_(NULL),
-      user_is_closing_toasts_by_clicking_(false) {
+      user_is_closing_toasts_by_clicking_(false),
+      first_item_has_no_margin_(first_item_has_no_margin) {
   DCHECK(message_center_);
   defer_timer_.reset(new base::OneShotTimer<MessagePopupCollection>);
   DoUpdateIfPossible();
@@ -101,7 +110,12 @@
 
   int bottom = toasts_.empty() ?
       work_area_.bottom() : toasts_.back()->origin().y();
-  bottom -= kToastMargin;
+
+  if (!first_item_has_no_margin_)
+    bottom -= kToastMargin;
+  else
+    bottom += kNoToastMarginBorderAndShadowOffset;
+
   // Iterate in the reverse order to keep the oldest toasts on screen. Newer
   // items may be ignored if there are no room to place them.
   for (NotificationList::PopupNotifications::const_reverse_iterator iter =
@@ -191,7 +205,12 @@
 }
 
 void MessagePopupCollection::RepositionWidgets() {
-  int bottom = work_area_.bottom() - kToastMargin;
+  int bottom = work_area_.bottom();
+  if (!first_item_has_no_margin_)
+    bottom -= kToastMargin;
+  else
+    bottom += kNoToastMarginBorderAndShadowOffset;
+
   for (Toasts::iterator iter = toasts_.begin(); iter != toasts_.end();) {
     Toasts::iterator curr = iter++;
     gfx::Rect bounds((*curr)->bounds());
diff --git a/ui/message_center/views/message_popup_collection.h b/ui/message_center/views/message_popup_collection.h
index b77257a..3a1b356 100644
--- a/ui/message_center/views/message_popup_collection.h
+++ b/ui/message_center/views/message_popup_collection.h
@@ -53,10 +53,13 @@
       public base::SupportsWeakPtr<MessagePopupCollection> {
  public:
   // |parent| specifies the parent widget of the toast windows. The default
-  // parent will be used for NULL.
+  // parent will be used for NULL. Usually each icon is spacing against its
+  // predecessor. If |first_item_has_no_margin| is set however the first item
+  // does not space against the tray.
   MessagePopupCollection(gfx::NativeView parent,
                          MessageCenter* message_center,
-                         MessageCenterTray* tray);
+                         MessageCenterTray* tray,
+                         bool first_item_has_no_margin);
   virtual ~MessagePopupCollection();
 
   // Called by ToastContentsView when its window is closed.
@@ -167,6 +170,9 @@
   // Weak, only exists temporarily in tests.
   scoped_ptr<base::RunLoop> run_loop_for_test_;
 
+  // True if the first item should not have spacing against the tray.
+  bool first_item_has_no_margin_;
+
   DISALLOW_COPY_AND_ASSIGN(MessagePopupCollection);
 };
 
diff --git a/ui/message_center/views/message_popup_collection_unittest.cc b/ui/message_center/views/message_popup_collection_unittest.cc
index eba01eb..8d0337c 100644
--- a/ui/message_center/views/message_popup_collection_unittest.cc
+++ b/ui/message_center/views/message_popup_collection_unittest.cc
@@ -24,8 +24,8 @@
   virtual void SetUp() OVERRIDE {
     views::ViewsTestBase::SetUp();
     MessageCenter::Initialize();
-    collection_.reset(
-        new MessagePopupCollection(GetContext(), MessageCenter::Get(), NULL));
+    collection_.reset(new MessagePopupCollection(
+        GetContext(), MessageCenter::Get(), NULL, false));
     // This size fits test machines resolution and also can keep a few toasts
     // w/o ill effects of hitting the screen overflow. This allows us to assume
     // and verify normal layout of the toast stack.
diff --git a/ui/native_theme/native_theme.target.darwin-arm.mk b/ui/native_theme/native_theme.target.darwin-arm.mk
index 496e563..167c94e 100644
--- a/ui/native_theme/native_theme.target.darwin-arm.mk
+++ b/ui/native_theme/native_theme.target.darwin-arm.mk
@@ -104,9 +104,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
@@ -213,9 +213,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
diff --git a/ui/native_theme/native_theme.target.darwin-mips.mk b/ui/native_theme/native_theme.target.darwin-mips.mk
index 613be8d..5e7b61c 100644
--- a/ui/native_theme/native_theme.target.darwin-mips.mk
+++ b/ui/native_theme/native_theme.target.darwin-mips.mk
@@ -103,9 +103,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
@@ -211,9 +211,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
diff --git a/ui/native_theme/native_theme.target.darwin-x86.mk b/ui/native_theme/native_theme.target.darwin-x86.mk
index 7e16151..a0fc1ae 100644
--- a/ui/native_theme/native_theme.target.darwin-x86.mk
+++ b/ui/native_theme/native_theme.target.darwin-x86.mk
@@ -105,9 +105,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
@@ -216,9 +216,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
diff --git a/ui/native_theme/native_theme.target.linux-arm.mk b/ui/native_theme/native_theme.target.linux-arm.mk
index 496e563..167c94e 100644
--- a/ui/native_theme/native_theme.target.linux-arm.mk
+++ b/ui/native_theme/native_theme.target.linux-arm.mk
@@ -104,9 +104,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
@@ -213,9 +213,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
diff --git a/ui/native_theme/native_theme.target.linux-mips.mk b/ui/native_theme/native_theme.target.linux-mips.mk
index 613be8d..5e7b61c 100644
--- a/ui/native_theme/native_theme.target.linux-mips.mk
+++ b/ui/native_theme/native_theme.target.linux-mips.mk
@@ -103,9 +103,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
@@ -211,9 +211,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
diff --git a/ui/native_theme/native_theme.target.linux-x86.mk b/ui/native_theme/native_theme.target.linux-x86.mk
index 7e16151..a0fc1ae 100644
--- a/ui/native_theme/native_theme.target.linux-x86.mk
+++ b/ui/native_theme/native_theme.target.linux-x86.mk
@@ -105,9 +105,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
@@ -216,9 +216,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
diff --git a/ui/shell_dialogs.target.darwin-arm.mk b/ui/shell_dialogs.target.darwin-arm.mk
index 6b45420..ba77732 100644
--- a/ui/shell_dialogs.target.darwin-arm.mk
+++ b/ui/shell_dialogs.target.darwin-arm.mk
@@ -108,11 +108,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui/app_locale_settings \
 	$(gyp_shared_intermediate_dir)/ui/ui_strings \
@@ -220,11 +220,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui/app_locale_settings \
 	$(gyp_shared_intermediate_dir)/ui/ui_strings \
diff --git a/ui/shell_dialogs.target.darwin-mips.mk b/ui/shell_dialogs.target.darwin-mips.mk
index 2299db7..9aa7cde 100644
--- a/ui/shell_dialogs.target.darwin-mips.mk
+++ b/ui/shell_dialogs.target.darwin-mips.mk
@@ -107,11 +107,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui/app_locale_settings \
 	$(gyp_shared_intermediate_dir)/ui/ui_strings \
@@ -218,11 +218,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui/app_locale_settings \
 	$(gyp_shared_intermediate_dir)/ui/ui_strings \
diff --git a/ui/shell_dialogs.target.darwin-x86.mk b/ui/shell_dialogs.target.darwin-x86.mk
index 03fba6d..a16792b 100644
--- a/ui/shell_dialogs.target.darwin-x86.mk
+++ b/ui/shell_dialogs.target.darwin-x86.mk
@@ -109,11 +109,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui/app_locale_settings \
 	$(gyp_shared_intermediate_dir)/ui/ui_strings \
@@ -223,11 +223,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui/app_locale_settings \
 	$(gyp_shared_intermediate_dir)/ui/ui_strings \
diff --git a/ui/shell_dialogs.target.linux-arm.mk b/ui/shell_dialogs.target.linux-arm.mk
index 6b45420..ba77732 100644
--- a/ui/shell_dialogs.target.linux-arm.mk
+++ b/ui/shell_dialogs.target.linux-arm.mk
@@ -108,11 +108,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui/app_locale_settings \
 	$(gyp_shared_intermediate_dir)/ui/ui_strings \
@@ -220,11 +220,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui/app_locale_settings \
 	$(gyp_shared_intermediate_dir)/ui/ui_strings \
diff --git a/ui/shell_dialogs.target.linux-mips.mk b/ui/shell_dialogs.target.linux-mips.mk
index 2299db7..9aa7cde 100644
--- a/ui/shell_dialogs.target.linux-mips.mk
+++ b/ui/shell_dialogs.target.linux-mips.mk
@@ -107,11 +107,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui/app_locale_settings \
 	$(gyp_shared_intermediate_dir)/ui/ui_strings \
@@ -218,11 +218,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui/app_locale_settings \
 	$(gyp_shared_intermediate_dir)/ui/ui_strings \
diff --git a/ui/shell_dialogs.target.linux-x86.mk b/ui/shell_dialogs.target.linux-x86.mk
index 03fba6d..a16792b 100644
--- a/ui/shell_dialogs.target.linux-x86.mk
+++ b/ui/shell_dialogs.target.linux-x86.mk
@@ -109,11 +109,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui/app_locale_settings \
 	$(gyp_shared_intermediate_dir)/ui/ui_strings \
@@ -223,11 +223,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir)/ui/app_locale_settings \
 	$(gyp_shared_intermediate_dir)/ui/ui_strings \
diff --git a/ui/snapshot/snapshot.target.darwin-arm.mk b/ui/snapshot/snapshot.target.darwin-arm.mk
index 78fe887..2d904ea 100644
--- a/ui/snapshot/snapshot.target.darwin-arm.mk
+++ b/ui/snapshot/snapshot.target.darwin-arm.mk
@@ -99,10 +99,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/ui \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -208,10 +208,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/ui \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
diff --git a/ui/snapshot/snapshot.target.darwin-mips.mk b/ui/snapshot/snapshot.target.darwin-mips.mk
index 832a782..0b4e165 100644
--- a/ui/snapshot/snapshot.target.darwin-mips.mk
+++ b/ui/snapshot/snapshot.target.darwin-mips.mk
@@ -98,10 +98,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/ui \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -206,10 +206,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/ui \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
diff --git a/ui/snapshot/snapshot.target.darwin-x86.mk b/ui/snapshot/snapshot.target.darwin-x86.mk
index 8c2ff42..cb10e9a 100644
--- a/ui/snapshot/snapshot.target.darwin-x86.mk
+++ b/ui/snapshot/snapshot.target.darwin-x86.mk
@@ -100,10 +100,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/ui \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -211,10 +211,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/ui \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
diff --git a/ui/snapshot/snapshot.target.linux-arm.mk b/ui/snapshot/snapshot.target.linux-arm.mk
index 78fe887..2d904ea 100644
--- a/ui/snapshot/snapshot.target.linux-arm.mk
+++ b/ui/snapshot/snapshot.target.linux-arm.mk
@@ -99,10 +99,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/ui \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -208,10 +208,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/ui \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
diff --git a/ui/snapshot/snapshot.target.linux-mips.mk b/ui/snapshot/snapshot.target.linux-mips.mk
index 832a782..0b4e165 100644
--- a/ui/snapshot/snapshot.target.linux-mips.mk
+++ b/ui/snapshot/snapshot.target.linux-mips.mk
@@ -98,10 +98,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/ui \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -206,10 +206,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/ui \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
diff --git a/ui/snapshot/snapshot.target.linux-x86.mk b/ui/snapshot/snapshot.target.linux-x86.mk
index 8c2ff42..cb10e9a 100644
--- a/ui/snapshot/snapshot.target.linux-x86.mk
+++ b/ui/snapshot/snapshot.target.linux-x86.mk
@@ -100,10 +100,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(LOCAL_PATH)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/ui \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -211,10 +211,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(LOCAL_PATH)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(LOCAL_PATH)/ui \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
diff --git a/ui/surface/surface.target.darwin-arm.mk b/ui/surface/surface.target.darwin-arm.mk
index 5409afb..17ad38d 100644
--- a/ui/surface/surface.target.darwin-arm.mk
+++ b/ui/surface/surface.target.darwin-arm.mk
@@ -104,9 +104,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -218,9 +218,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/ui/surface/surface.target.darwin-mips.mk b/ui/surface/surface.target.darwin-mips.mk
index 700185e..6bff7fd 100644
--- a/ui/surface/surface.target.darwin-mips.mk
+++ b/ui/surface/surface.target.darwin-mips.mk
@@ -103,9 +103,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -216,9 +216,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/ui/surface/surface.target.darwin-x86.mk b/ui/surface/surface.target.darwin-x86.mk
index 0d820db..839c013 100644
--- a/ui/surface/surface.target.darwin-x86.mk
+++ b/ui/surface/surface.target.darwin-x86.mk
@@ -105,9 +105,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -221,9 +221,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/ui/surface/surface.target.linux-arm.mk b/ui/surface/surface.target.linux-arm.mk
index 5409afb..17ad38d 100644
--- a/ui/surface/surface.target.linux-arm.mk
+++ b/ui/surface/surface.target.linux-arm.mk
@@ -104,9 +104,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -218,9 +218,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/ui/surface/surface.target.linux-mips.mk b/ui/surface/surface.target.linux-mips.mk
index 700185e..6bff7fd 100644
--- a/ui/surface/surface.target.linux-mips.mk
+++ b/ui/surface/surface.target.linux-mips.mk
@@ -103,9 +103,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -216,9 +216,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/ui/surface/surface.target.linux-x86.mk b/ui/surface/surface.target.linux-x86.mk
index 0d820db..839c013 100644
--- a/ui/surface/surface.target.linux-x86.mk
+++ b/ui/surface/surface.target.linux-x86.mk
@@ -105,9 +105,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -221,9 +221,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/ui/ui.gyp b/ui/ui.gyp
index a0eff77..8302f46 100644
--- a/ui/ui.gyp
+++ b/ui/ui.gyp
@@ -233,6 +233,8 @@
         'base/hit_test.h',
         'base/keycodes/keyboard_code_conversion.cc',
         'base/keycodes/keyboard_code_conversion.h',
+        'base/keycodes/keyboard_code_conversion_android.cc',
+        'base/keycodes/keyboard_code_conversion_android.h',
         'base/keycodes/keyboard_code_conversion_gtk.cc',
         'base/keycodes/keyboard_code_conversion_gtk.h',
         'base/keycodes/keyboard_code_conversion_mac.h',
diff --git a/ui/ui.target.darwin-arm.mk b/ui/ui.target.darwin-arm.mk
index 76ee97e..acba1b9 100644
--- a/ui/ui.target.darwin-arm.mk
+++ b/ui/ui.target.darwin-arm.mk
@@ -53,6 +53,7 @@
 	ui/base/default_theme_provider.cc \
 	ui/base/events/event_utils.cc \
 	ui/base/keycodes/keyboard_code_conversion.cc \
+	ui/base/keycodes/keyboard_code_conversion_android.cc \
 	ui/base/latency_info.cc \
 	ui/base/l10n/l10n_font_util.cc \
 	ui/base/l10n/l10n_util.cc \
@@ -221,10 +222,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/ui \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
@@ -339,10 +340,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/ui \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
diff --git a/ui/ui.target.darwin-mips.mk b/ui/ui.target.darwin-mips.mk
index 88454bb..a2ca3a9 100644
--- a/ui/ui.target.darwin-mips.mk
+++ b/ui/ui.target.darwin-mips.mk
@@ -53,6 +53,7 @@
 	ui/base/default_theme_provider.cc \
 	ui/base/events/event_utils.cc \
 	ui/base/keycodes/keyboard_code_conversion.cc \
+	ui/base/keycodes/keyboard_code_conversion_android.cc \
 	ui/base/latency_info.cc \
 	ui/base/l10n/l10n_font_util.cc \
 	ui/base/l10n/l10n_util.cc \
@@ -220,10 +221,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/ui \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
@@ -337,10 +338,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/ui \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
diff --git a/ui/ui.target.darwin-x86.mk b/ui/ui.target.darwin-x86.mk
index d46367f..1fddacb 100644
--- a/ui/ui.target.darwin-x86.mk
+++ b/ui/ui.target.darwin-x86.mk
@@ -53,6 +53,7 @@
 	ui/base/default_theme_provider.cc \
 	ui/base/events/event_utils.cc \
 	ui/base/keycodes/keyboard_code_conversion.cc \
+	ui/base/keycodes/keyboard_code_conversion_android.cc \
 	ui/base/latency_info.cc \
 	ui/base/l10n/l10n_font_util.cc \
 	ui/base/l10n/l10n_util.cc \
@@ -222,10 +223,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/ui \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
@@ -342,10 +343,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/ui \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
diff --git a/ui/ui.target.linux-arm.mk b/ui/ui.target.linux-arm.mk
index 76ee97e..acba1b9 100644
--- a/ui/ui.target.linux-arm.mk
+++ b/ui/ui.target.linux-arm.mk
@@ -53,6 +53,7 @@
 	ui/base/default_theme_provider.cc \
 	ui/base/events/event_utils.cc \
 	ui/base/keycodes/keyboard_code_conversion.cc \
+	ui/base/keycodes/keyboard_code_conversion_android.cc \
 	ui/base/latency_info.cc \
 	ui/base/l10n/l10n_font_util.cc \
 	ui/base/l10n/l10n_util.cc \
@@ -221,10 +222,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/ui \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
@@ -339,10 +340,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/ui \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
diff --git a/ui/ui.target.linux-mips.mk b/ui/ui.target.linux-mips.mk
index 88454bb..a2ca3a9 100644
--- a/ui/ui.target.linux-mips.mk
+++ b/ui/ui.target.linux-mips.mk
@@ -53,6 +53,7 @@
 	ui/base/default_theme_provider.cc \
 	ui/base/events/event_utils.cc \
 	ui/base/keycodes/keyboard_code_conversion.cc \
+	ui/base/keycodes/keyboard_code_conversion_android.cc \
 	ui/base/latency_info.cc \
 	ui/base/l10n/l10n_font_util.cc \
 	ui/base/l10n/l10n_util.cc \
@@ -220,10 +221,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/ui \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
@@ -337,10 +338,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/ui \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
diff --git a/ui/ui.target.linux-x86.mk b/ui/ui.target.linux-x86.mk
index d46367f..1fddacb 100644
--- a/ui/ui.target.linux-x86.mk
+++ b/ui/ui.target.linux-x86.mk
@@ -53,6 +53,7 @@
 	ui/base/default_theme_provider.cc \
 	ui/base/events/event_utils.cc \
 	ui/base/keycodes/keyboard_code_conversion.cc \
+	ui/base/keycodes/keyboard_code_conversion_android.cc \
 	ui/base/latency_info.cc \
 	ui/base/l10n/l10n_font_util.cc \
 	ui/base/l10n/l10n_util.cc \
@@ -222,10 +223,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/ui \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
@@ -342,10 +343,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/ui \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
diff --git a/ui/views/bubble/tray_bubble_view.cc b/ui/views/bubble/tray_bubble_view.cc
index 9c4defa..f78cf9a 100644
--- a/ui/views/bubble/tray_bubble_view.cc
+++ b/ui/views/bubble/tray_bubble_view.cc
@@ -31,6 +31,12 @@
 const int kArrowMinOffset = 20;
 const int kBubbleSpacing = 20;
 
+// The new theme adjusts the menus / bubbles to be flush with the shelf when
+// there is no bubble. These are the offsets which need to be applied.
+const int kArrowOffsetTopBottom = 5;
+const int kArrowOffsetLeft = 9;
+const int kArrowOffsetRight = -5;
+
 }  // namespace
 
 namespace views {
@@ -47,7 +53,8 @@
       : BubbleBorder(params.arrow, params.shadow, params.arrow_color),
         owner_(owner),
         anchor_(anchor),
-        tray_arrow_offset_(params.arrow_offset) {
+        tray_arrow_offset_(params.arrow_offset),
+        first_item_has_no_margin_(params.first_item_has_no_margin) {
     set_alignment(params.arrow_alignment);
     set_background_color(params.arrow_color);
     set_paint_arrow(params.arrow_paint_type);
@@ -59,13 +66,27 @@
   // Sets the bubble on top of the anchor when it has no arrow.
   virtual gfx::Rect GetBounds(const gfx::Rect& position_relative_to,
                               const gfx::Size& contents_size) const OVERRIDE {
-    if (has_arrow(arrow()))
-      return BubbleBorder::GetBounds(position_relative_to, contents_size);
+    if (has_arrow(arrow())) {
+      gfx::Rect rect =
+          BubbleBorder::GetBounds(position_relative_to, contents_size);
+      if (first_item_has_no_margin_) {
+        if (arrow() == BubbleBorder::BOTTOM_RIGHT ||
+            arrow() == BubbleBorder::BOTTOM_LEFT) {
+          rect.set_y(rect.y() + kArrowOffsetTopBottom);
+        } else if (arrow() == BubbleBorder::LEFT_BOTTOM) {
+          rect.set_x(rect.x() + kArrowOffsetLeft);
+        } else if (arrow() == BubbleBorder::RIGHT_BOTTOM) {
+          rect.set_x(rect.x() + kArrowOffsetRight);
+        }
+      }
+      return rect;
+    }
 
+    // TODO(skuhne): With shelf LR alignment, arrow-less messages get
+    // automatically offsetted from an open status menu which needs addressing.
     gfx::Size border_size(contents_size);
     gfx::Insets insets = GetInsets();
     border_size.Enlarge(insets.width(), insets.height());
-
     const int x = position_relative_to.x() +
         position_relative_to.width() / 2 - border_size.width() / 2;
     // Position the bubble on top of the anchor.
@@ -112,6 +133,10 @@
   View* anchor_;
   const int tray_arrow_offset_;
 
+  // If true the first item should not get any additional spacing against the
+  // anchor (without the bubble tip the bubble should be flush to the shelf).
+  const bool first_item_has_no_margin_;
+
   DISALLOW_COPY_AND_ASSIGN(TrayBubbleBorder);
 };
 
@@ -225,6 +250,7 @@
       can_activate(false),
       close_on_deactivate(true),
       arrow_color(SK_ColorBLACK),
+      first_item_has_no_margin(false),
       arrow(BubbleBorder::NONE),
       arrow_offset(kArrowDefaultOffset),
       arrow_paint_type(BubbleBorder::PAINT_NORMAL),
diff --git a/ui/views/bubble/tray_bubble_view.h b/ui/views/bubble/tray_bubble_view.h
index c719cd4..9c96c54 100644
--- a/ui/views/bubble/tray_bubble_view.h
+++ b/ui/views/bubble/tray_bubble_view.h
@@ -98,6 +98,7 @@
     bool can_activate;
     bool close_on_deactivate;
     SkColor arrow_color;
+    bool first_item_has_no_margin;
     views::BubbleBorder::Arrow arrow;
     int arrow_offset;
     views::BubbleBorder::ArrowPaintType arrow_paint_type;
diff --git a/url/url_canon_unittest.cc b/url/url_canon_unittest.cc
index b3c129d..f6cd3a2 100644
--- a/url/url_canon_unittest.cc
+++ b/url/url_canon_unittest.cc
@@ -378,7 +378,7 @@
     {NULL, L"GOO\x200b\x2060\xfeffgoo.com", "googoo.com", url_parse::Component(0, 10), CanonHostInfo::NEUTRAL, -1, ""},
       // Ideographic full stop (full-width period for Chinese, etc.) should be
       // treated as a dot.
-    {NULL, L"www.foo\x3002"L"bar.com", "www.foo.bar.com", url_parse::Component(0, 15), CanonHostInfo::NEUTRAL, -1, ""},
+    {NULL, L"www.foo\x3002" L"bar.com", "www.foo.bar.com", url_parse::Component(0, 15), CanonHostInfo::NEUTRAL, -1, ""},
       // Invalid unicode characters should fail...
       // ...In wide input, ICU will barf and we'll end up with the input as
       //    escaped UTF-8 (the invalid character should be replaced with the
diff --git a/url/url_lib.target.darwin-arm.mk b/url/url_lib.target.darwin-arm.mk
index b0ae24e..0f359f5 100644
--- a/url/url_lib.target.darwin-arm.mk
+++ b/url/url_lib.target.darwin-arm.mk
@@ -108,9 +108,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
@@ -195,9 +195,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
diff --git a/url/url_lib.target.darwin-mips.mk b/url/url_lib.target.darwin-mips.mk
index 7b01d41..7801c4f 100644
--- a/url/url_lib.target.darwin-mips.mk
+++ b/url/url_lib.target.darwin-mips.mk
@@ -107,9 +107,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
@@ -193,9 +193,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
diff --git a/url/url_lib.target.darwin-x86.mk b/url/url_lib.target.darwin-x86.mk
index c866bce..b530406 100644
--- a/url/url_lib.target.darwin-x86.mk
+++ b/url/url_lib.target.darwin-x86.mk
@@ -110,9 +110,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
@@ -200,9 +200,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
diff --git a/url/url_lib.target.linux-arm.mk b/url/url_lib.target.linux-arm.mk
index b0ae24e..0f359f5 100644
--- a/url/url_lib.target.linux-arm.mk
+++ b/url/url_lib.target.linux-arm.mk
@@ -108,9 +108,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
@@ -195,9 +195,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
diff --git a/url/url_lib.target.linux-mips.mk b/url/url_lib.target.linux-mips.mk
index 7b01d41..7801c4f 100644
--- a/url/url_lib.target.linux-mips.mk
+++ b/url/url_lib.target.linux-mips.mk
@@ -107,9 +107,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
@@ -193,9 +193,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
diff --git a/url/url_lib.target.linux-x86.mk b/url/url_lib.target.linux-x86.mk
index c866bce..b530406 100644
--- a/url/url_lib.target.linux-x86.mk
+++ b/url/url_lib.target.linux-x86.mk
@@ -110,9 +110,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
@@ -200,9 +200,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
diff --git a/webkit/browser/dom_storage/dom_storage_host.cc b/webkit/browser/dom_storage/dom_storage_host.cc
index 9b6da67..18c480e 100644
--- a/webkit/browser/dom_storage/dom_storage_host.cc
+++ b/webkit/browser/dom_storage/dom_storage_host.cc
@@ -30,12 +30,8 @@
     return false;  // Indicates the renderer gave us very bad data.
   NamespaceAndArea references;
   references.namespace_ = context_->GetStorageNamespace(namespace_id);
-  if (!references.namespace_.get()) {
-    // TODO(michaeln): Fix crbug/134003 and return false here.
-    // Until then return true to avoid crashing the renderer for
-    // sending a bad message.
-    return true;
-  }
+  if (!references.namespace_.get())
+    return false;
   references.area_ = references.namespace_->OpenStorageArea(origin);
   DCHECK(references.area_.get());
   connections_[connection_id] = references;
@@ -54,12 +50,8 @@
     int connection_id, ValuesMap* map) {
   map->clear();
   DomStorageArea* area = GetOpenArea(connection_id);
-  if (!area) {
-    // TODO(michaeln): Fix crbug/134003 and return false here.
-    // Until then return true to avoid crashing the renderer
-    // for sending a bad message.
-    return true;
-  }
+  if (!area)
+    return false;
   if (!area->IsLoadedInMemory()) {
     DomStorageNamespace* ns = GetNamespace(connection_id);
     DCHECK(ns);
@@ -101,12 +93,8 @@
     const base::string16& value, const GURL& page_url,
     base::NullableString16* old_value) {
   DomStorageArea* area = GetOpenArea(connection_id);
-  if (!area) {
-    // TODO(michaeln): Fix crbug/134003 and return false here.
-    // Until then return true to allow the renderer to operate
-    // to a limited degree out of its cache.
-    return true;
-  }
+  if (!area)
+    return false;
   if (!area->SetItem(key, value, old_value))
     return false;
   if (old_value->is_null() || old_value->string() != value)
diff --git a/webkit/browser/fileapi/copy_or_move_file_validator_unittest.cc b/webkit/browser/fileapi/copy_or_move_file_validator_unittest.cc
index 31530e0..1190f7a 100644
--- a/webkit/browser/fileapi/copy_or_move_file_validator_unittest.cc
+++ b/webkit/browser/fileapi/copy_or_move_file_validator_unittest.cc
@@ -64,10 +64,9 @@
     // Sets up source.
     FileSystemBackend* src_file_system_backend =
         file_system_context_->GetFileSystemBackend(src_type_);
-    src_file_system_backend->InitializeFileSystem(
+    src_file_system_backend->OpenFileSystem(
         origin_, src_type_,
         OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
-        NULL /* context */,
         base::Bind(&ExpectOk));
     base::MessageLoop::current()->RunUntilIdle();
     ASSERT_EQ(base::PLATFORM_FILE_OK, CreateDirectory(SourceURL("")));
diff --git a/webkit/browser/fileapi/copy_or_move_operation_delegate_unittest.cc b/webkit/browser/fileapi/copy_or_move_operation_delegate_unittest.cc
index dbddb27..1b7c872 100644
--- a/webkit/browser/fileapi/copy_or_move_operation_delegate_unittest.cc
+++ b/webkit/browser/fileapi/copy_or_move_operation_delegate_unittest.cc
@@ -129,10 +129,9 @@
     // Prepare the origin's root directory.
     FileSystemBackend* mount_point_provider =
         file_system_context_->GetFileSystemBackend(src_type_);
-    mount_point_provider->InitializeFileSystem(
+    mount_point_provider->OpenFileSystem(
         origin_, src_type_,
         OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
-        NULL /* context */,
         base::Bind(&ExpectOk));
     mount_point_provider =
         file_system_context_->GetFileSystemBackend(dest_type_);
@@ -144,10 +143,9 @@
       test_provider->set_require_copy_or_move_validator(true);
       test_provider->InitializeCopyOrMoveFileValidatorFactory(factory.Pass());
     }
-    mount_point_provider->InitializeFileSystem(
+    mount_point_provider->OpenFileSystem(
         origin_, dest_type_,
         OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
-        NULL /* context */,
         base::Bind(&ExpectOk));
     base::MessageLoop::current()->RunUntilIdle();
 
diff --git a/webkit/browser/fileapi/file_system_backend.h b/webkit/browser/fileapi/file_system_backend.h
index 37cb6b0..33b4627 100644
--- a/webkit/browser/fileapi/file_system_backend.h
+++ b/webkit/browser/fileapi/file_system_backend.h
@@ -46,25 +46,29 @@
   typedef base::Callback<void(const GURL& root_url,
                               const std::string& name,
                               base::PlatformFileError error)>
-      InitializeFileSystemCallback;
+      OpenFileSystemCallback;
   virtual ~FileSystemBackend() {}
 
   // Returns true if this mount point provider can handle |type|.
   // One mount point provider may be able to handle multiple filesystem types.
   virtual bool CanHandleType(FileSystemType type) const = 0;
 
-  // Initializes the filesystem for the given |origin_url| and |type|.
+  // This method is called right after the backend is registered in the
+  // FileSystemContext and before any other methods are called. Each backend can
+  // do additional initialization which depends on FileSystemContext here.
+  virtual void Initialize(FileSystemContext* context) = 0;
+
+  // Opens the filesystem for the given |origin_url| and |type|.
   // This verifies if it is allowed to request (or create) the filesystem
   // and if it can access (or create) the root directory of the mount point.
   // If |mode| is CREATE_IF_NONEXISTENT calling this may also create
   // the root directory (and/or related database entries etc) for
   // the filesystem if it doesn't exist.
-  virtual void InitializeFileSystem(
+  virtual void OpenFileSystem(
       const GURL& origin_url,
       FileSystemType type,
       OpenFileSystemMode mode,
-      FileSystemContext* context,
-      const InitializeFileSystemCallback& callback) = 0;
+      const OpenFileSystemCallback& callback) = 0;
 
   // Returns the specialized FileSystemFileUtil for this mount point.
   // It is ok to return NULL if the filesystem doesn't support synchronous
diff --git a/webkit/browser/fileapi/file_system_context.cc b/webkit/browser/fileapi/file_system_context.cc
index 24c505b..ecbb3ea 100644
--- a/webkit/browser/fileapi/file_system_context.cc
+++ b/webkit/browser/fileapi/file_system_context.cc
@@ -138,6 +138,14 @@
     RegisterBackend(*iter);
   }
 
+  sandbox_backend_->Initialize(this);
+  isolated_backend_->Initialize(this);
+  for (ScopedVector<FileSystemBackend>::const_iterator iter =
+          additional_backends_.begin();
+       iter != additional_backends_.end(); ++iter) {
+    (*iter)->Initialize(this);
+  }
+
   // Additional mount points must be added before regular system-wide
   // mount points.
   if (external_mount_points)
@@ -269,8 +277,8 @@
     return;
   }
 
-  backend->InitializeFileSystem(origin_url, type, mode, this,
-                                base::Bind(&DidOpenFileSystem, callback));
+  backend->OpenFileSystem(origin_url, type, mode,
+                          base::Bind(&DidOpenFileSystem, callback));
 }
 
 void FileSystemContext::DeleteFileSystem(
@@ -326,6 +334,11 @@
   return backend->CreateFileStreamWriter(url, offset, this);
 }
 
+scoped_ptr<FileSystemOperationRunner>
+FileSystemContext::CreateFileSystemOperationRunner() {
+  return make_scoped_ptr(new FileSystemOperationRunner(this));
+}
+
 void FileSystemContext::SetLocalFileChangeTracker(
     scoped_ptr<sync_file_system::LocalFileChangeTracker> tracker) {
   DCHECK(!change_tracker_.get());
diff --git a/webkit/browser/fileapi/file_system_context.h b/webkit/browser/fileapi/file_system_context.h
index 3237783..d2ae4ac 100644
--- a/webkit/browser/fileapi/file_system_context.h
+++ b/webkit/browser/fileapi/file_system_context.h
@@ -203,6 +203,9 @@
       const FileSystemURL& url,
       int64 offset);
 
+  // Creates a new FileSystemOperationRunner.
+  scoped_ptr<FileSystemOperationRunner> CreateFileSystemOperationRunner();
+
   FileSystemTaskRunners* task_runners() { return task_runners_.get(); }
 
   FileSystemOperationRunner* operation_runner() {
diff --git a/webkit/browser/fileapi/isolated_file_system_backend.cc b/webkit/browser/fileapi/isolated_file_system_backend.cc
index 97c1962..4f35932 100644
--- a/webkit/browser/fileapi/isolated_file_system_backend.cc
+++ b/webkit/browser/fileapi/isolated_file_system_backend.cc
@@ -56,12 +56,14 @@
   }
 }
 
-void IsolatedFileSystemBackend::InitializeFileSystem(
+void IsolatedFileSystemBackend::Initialize(FileSystemContext* context) {
+}
+
+void IsolatedFileSystemBackend::OpenFileSystem(
     const GURL& origin_url,
     FileSystemType type,
     OpenFileSystemMode mode,
-    FileSystemContext* context,
-    const InitializeFileSystemCallback& callback) {
+    const OpenFileSystemCallback& callback) {
   // We never allow opening a new isolated FileSystem via usual OpenFileSystem.
   base::MessageLoopProxy::current()->PostTask(
       FROM_HERE,
diff --git a/webkit/browser/fileapi/isolated_file_system_backend.h b/webkit/browser/fileapi/isolated_file_system_backend.h
index 63cf4de..cdc7096 100644
--- a/webkit/browser/fileapi/isolated_file_system_backend.h
+++ b/webkit/browser/fileapi/isolated_file_system_backend.h
@@ -19,12 +19,12 @@
 
   // FileSystemBackend implementation.
   virtual bool CanHandleType(FileSystemType type) const OVERRIDE;
-  virtual void InitializeFileSystem(
+  virtual void Initialize(FileSystemContext* context) OVERRIDE;
+  virtual void OpenFileSystem(
       const GURL& origin_url,
       FileSystemType type,
       OpenFileSystemMode mode,
-      FileSystemContext* context,
-      const InitializeFileSystemCallback& callback) OVERRIDE;
+      const OpenFileSystemCallback& callback) OVERRIDE;
   virtual FileSystemFileUtil* GetFileUtil(FileSystemType type) OVERRIDE;
   virtual AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) OVERRIDE;
   virtual CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory(
diff --git a/webkit/browser/fileapi/sandbox_file_system_backend.cc b/webkit/browser/fileapi/sandbox_file_system_backend.cc
index fb8bea9..12f0705 100644
--- a/webkit/browser/fileapi/sandbox_file_system_backend.cc
+++ b/webkit/browser/fileapi/sandbox_file_system_backend.cc
@@ -135,6 +135,19 @@
       sandbox_context_(sandbox_context),
       enable_temporary_file_system_in_incognito_(false),
       weak_factory_(this) {
+}
+
+SandboxFileSystemBackend::~SandboxFileSystemBackend() {
+}
+
+bool SandboxFileSystemBackend::CanHandleType(FileSystemType type) const {
+  return type == kFileSystemTypeTemporary ||
+         type == kFileSystemTypePersistent ||
+         type == kFileSystemTypeSyncable ||
+         type == kFileSystemTypeSyncableForInternalSync;
+}
+
+void SandboxFileSystemBackend::Initialize(FileSystemContext* context) {
   // Set quota observers.
   if (sandbox_context_->is_usage_tracking_enabled()) {
     update_observers_ = update_observers_.AddObserver(
@@ -156,22 +169,11 @@
   }
 }
 
-SandboxFileSystemBackend::~SandboxFileSystemBackend() {
-}
-
-bool SandboxFileSystemBackend::CanHandleType(FileSystemType type) const {
-  return type == kFileSystemTypeTemporary ||
-         type == kFileSystemTypePersistent ||
-         type == kFileSystemTypeSyncable ||
-         type == kFileSystemTypeSyncableForInternalSync;
-}
-
-void SandboxFileSystemBackend::InitializeFileSystem(
+void SandboxFileSystemBackend::OpenFileSystem(
     const GURL& origin_url,
     fileapi::FileSystemType type,
     OpenFileSystemMode mode,
-    FileSystemContext* context,
-    const InitializeFileSystemCallback& callback) {
+    const OpenFileSystemCallback& callback) {
   if (file_system_options_.is_incognito() &&
       !(type == kFileSystemTypeTemporary &&
         enable_temporary_file_system_in_incognito_)) {
diff --git a/webkit/browser/fileapi/sandbox_file_system_backend.h b/webkit/browser/fileapi/sandbox_file_system_backend.h
index 3bf6f29..f1a7a55 100644
--- a/webkit/browser/fileapi/sandbox_file_system_backend.h
+++ b/webkit/browser/fileapi/sandbox_file_system_backend.h
@@ -73,12 +73,12 @@
 
   // FileSystemBackend overrides.
   virtual bool CanHandleType(FileSystemType type) const OVERRIDE;
-  virtual void InitializeFileSystem(
+  virtual void Initialize(FileSystemContext* context) OVERRIDE;
+  virtual void OpenFileSystem(
       const GURL& origin_url,
       FileSystemType type,
       OpenFileSystemMode mode,
-      FileSystemContext* context,
-      const InitializeFileSystemCallback& callback) OVERRIDE;
+      const OpenFileSystemCallback& callback) OVERRIDE;
   virtual FileSystemFileUtil* GetFileUtil(FileSystemType type) OVERRIDE;
   virtual AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) OVERRIDE;
   virtual CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory(
diff --git a/webkit/browser/fileapi/sandbox_file_system_backend_unittest.cc b/webkit/browser/fileapi/sandbox_file_system_backend_unittest.cc
index ee4439c..5b0f8bc 100644
--- a/webkit/browser/fileapi/sandbox_file_system_backend_unittest.cc
+++ b/webkit/browser/fileapi/sandbox_file_system_backend_unittest.cc
@@ -113,8 +113,8 @@
                    OpenFileSystemMode mode,
                    base::FilePath* root_path) {
     base::PlatformFileError error = base::PLATFORM_FILE_OK;
-    backend_->InitializeFileSystem(
-        origin_url, type, mode, NULL /* context */,
+    backend_->OpenFileSystem(
+        origin_url, type, mode,
         base::Bind(&DidOpenFileSystem, &error));
     base::MessageLoop::current()->RunUntilIdle();
     if (error != base::PLATFORM_FILE_OK)
diff --git a/webkit/browser/fileapi/test_file_system_backend.cc b/webkit/browser/fileapi/test_file_system_backend.cc
index 4df22b7..547d6eb 100644
--- a/webkit/browser/fileapi/test_file_system_backend.cc
+++ b/webkit/browser/fileapi/test_file_system_backend.cc
@@ -148,12 +148,14 @@
   return (type == kFileSystemTypeTest);
 }
 
-void TestFileSystemBackend::InitializeFileSystem(
+void TestFileSystemBackend::Initialize(FileSystemContext* context) {
+}
+
+void TestFileSystemBackend::OpenFileSystem(
     const GURL& origin_url,
     FileSystemType type,
     OpenFileSystemMode mode,
-    FileSystemContext* context,
-    const InitializeFileSystemCallback& callback) {
+    const OpenFileSystemCallback& callback) {
   callback.Run(GetFileSystemRootURI(origin_url, type),
                GetFileSystemName(origin_url, type),
                base::PLATFORM_FILE_OK);
diff --git a/webkit/browser/fileapi/test_file_system_backend.h b/webkit/browser/fileapi/test_file_system_backend.h
index 21b4e43..ef252c1 100644
--- a/webkit/browser/fileapi/test_file_system_backend.h
+++ b/webkit/browser/fileapi/test_file_system_backend.h
@@ -35,12 +35,12 @@
 
   // FileSystemBackend implementation.
   virtual bool CanHandleType(FileSystemType type) const OVERRIDE;
-  virtual void InitializeFileSystem(
+  virtual void Initialize(FileSystemContext* context) OVERRIDE;
+  virtual void OpenFileSystem(
       const GURL& origin_url,
       FileSystemType type,
       OpenFileSystemMode mode,
-      FileSystemContext* context,
-      const InitializeFileSystemCallback& callback) OVERRIDE;
+      const OpenFileSystemCallback& callback) OVERRIDE;
   virtual FileSystemFileUtil* GetFileUtil(FileSystemType type) OVERRIDE;
   virtual AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) OVERRIDE;
   virtual CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory(
diff --git a/webkit/common/gpu/webkit_gpu.target.darwin-arm.mk b/webkit/common/gpu/webkit_gpu.target.darwin-arm.mk
index 2592e3a..4644a25 100644
--- a/webkit/common/gpu/webkit_gpu.target.darwin-arm.mk
+++ b/webkit/common/gpu/webkit_gpu.target.darwin-arm.mk
@@ -108,12 +108,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -222,12 +222,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
diff --git a/webkit/common/gpu/webkit_gpu.target.darwin-mips.mk b/webkit/common/gpu/webkit_gpu.target.darwin-mips.mk
index 979ef3b..5fd7d53 100644
--- a/webkit/common/gpu/webkit_gpu.target.darwin-mips.mk
+++ b/webkit/common/gpu/webkit_gpu.target.darwin-mips.mk
@@ -108,12 +108,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -222,12 +222,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
diff --git a/webkit/common/gpu/webkit_gpu.target.darwin-x86.mk b/webkit/common/gpu/webkit_gpu.target.darwin-x86.mk
index fe573d4..6510543 100644
--- a/webkit/common/gpu/webkit_gpu.target.darwin-x86.mk
+++ b/webkit/common/gpu/webkit_gpu.target.darwin-x86.mk
@@ -109,12 +109,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -225,12 +225,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
diff --git a/webkit/common/gpu/webkit_gpu.target.linux-arm.mk b/webkit/common/gpu/webkit_gpu.target.linux-arm.mk
index 2592e3a..4644a25 100644
--- a/webkit/common/gpu/webkit_gpu.target.linux-arm.mk
+++ b/webkit/common/gpu/webkit_gpu.target.linux-arm.mk
@@ -108,12 +108,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -222,12 +222,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
diff --git a/webkit/common/gpu/webkit_gpu.target.linux-mips.mk b/webkit/common/gpu/webkit_gpu.target.linux-mips.mk
index 979ef3b..5fd7d53 100644
--- a/webkit/common/gpu/webkit_gpu.target.linux-mips.mk
+++ b/webkit/common/gpu/webkit_gpu.target.linux-mips.mk
@@ -108,12 +108,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -222,12 +222,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
diff --git a/webkit/common/gpu/webkit_gpu.target.linux-x86.mk b/webkit/common/gpu/webkit_gpu.target.linux-x86.mk
index fe573d4..6510543 100644
--- a/webkit/common/gpu/webkit_gpu.target.linux-x86.mk
+++ b/webkit/common/gpu/webkit_gpu.target.linux-x86.mk
@@ -109,12 +109,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -225,12 +225,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
diff --git a/webkit/common/user_agent/user_agent.target.darwin-arm.mk b/webkit/common/user_agent/user_agent.target.darwin-arm.mk
index 3b820bf..f5a13b2 100644
--- a/webkit/common/user_agent/user_agent.target.darwin-arm.mk
+++ b/webkit/common/user_agent/user_agent.target.darwin-arm.mk
@@ -94,9 +94,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir) \
 	$(PWD)/frameworks/wilhelm/include \
@@ -183,9 +183,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir) \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/webkit/common/user_agent/user_agent.target.darwin-mips.mk b/webkit/common/user_agent/user_agent.target.darwin-mips.mk
index 7135ff5..fc5023a 100644
--- a/webkit/common/user_agent/user_agent.target.darwin-mips.mk
+++ b/webkit/common/user_agent/user_agent.target.darwin-mips.mk
@@ -93,9 +93,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir) \
 	$(PWD)/frameworks/wilhelm/include \
@@ -181,9 +181,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir) \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/webkit/common/user_agent/user_agent.target.darwin-x86.mk b/webkit/common/user_agent/user_agent.target.darwin-x86.mk
index ca0ece3..d917014 100644
--- a/webkit/common/user_agent/user_agent.target.darwin-x86.mk
+++ b/webkit/common/user_agent/user_agent.target.darwin-x86.mk
@@ -96,9 +96,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir) \
 	$(PWD)/frameworks/wilhelm/include \
@@ -188,9 +188,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir) \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/webkit/common/user_agent/user_agent.target.linux-arm.mk b/webkit/common/user_agent/user_agent.target.linux-arm.mk
index 3b820bf..f5a13b2 100644
--- a/webkit/common/user_agent/user_agent.target.linux-arm.mk
+++ b/webkit/common/user_agent/user_agent.target.linux-arm.mk
@@ -94,9 +94,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir) \
 	$(PWD)/frameworks/wilhelm/include \
@@ -183,9 +183,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir) \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/webkit/common/user_agent/user_agent.target.linux-mips.mk b/webkit/common/user_agent/user_agent.target.linux-mips.mk
index 7135ff5..fc5023a 100644
--- a/webkit/common/user_agent/user_agent.target.linux-mips.mk
+++ b/webkit/common/user_agent/user_agent.target.linux-mips.mk
@@ -93,9 +93,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir) \
 	$(PWD)/frameworks/wilhelm/include \
@@ -181,9 +181,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir) \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/webkit/common/user_agent/user_agent.target.linux-x86.mk b/webkit/common/user_agent/user_agent.target.linux-x86.mk
index ca0ece3..d917014 100644
--- a/webkit/common/user_agent/user_agent.target.linux-x86.mk
+++ b/webkit/common/user_agent/user_agent.target.linux-x86.mk
@@ -96,9 +96,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir) \
 	$(PWD)/frameworks/wilhelm/include \
@@ -188,9 +188,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(gyp_shared_intermediate_dir) \
 	$(PWD)/frameworks/wilhelm/include \
diff --git a/webkit/common/webkit_common.target.darwin-arm.mk b/webkit/common/webkit_common.target.darwin-arm.mk
index 002a142..7ceb7ad 100644
--- a/webkit/common/webkit_common.target.darwin-arm.mk
+++ b/webkit/common/webkit_common.target.darwin-arm.mk
@@ -108,12 +108,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/ui \
 	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
@@ -220,12 +220,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/ui \
 	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
diff --git a/webkit/common/webkit_common.target.darwin-mips.mk b/webkit/common/webkit_common.target.darwin-mips.mk
index 2c68f40..46c3b0d 100644
--- a/webkit/common/webkit_common.target.darwin-mips.mk
+++ b/webkit/common/webkit_common.target.darwin-mips.mk
@@ -107,12 +107,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/ui \
 	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
@@ -218,12 +218,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/ui \
 	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
diff --git a/webkit/common/webkit_common.target.darwin-x86.mk b/webkit/common/webkit_common.target.darwin-x86.mk
index 840aaa9..a199c81 100644
--- a/webkit/common/webkit_common.target.darwin-x86.mk
+++ b/webkit/common/webkit_common.target.darwin-x86.mk
@@ -109,12 +109,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/ui \
 	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
@@ -223,12 +223,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/ui \
 	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
diff --git a/webkit/common/webkit_common.target.linux-arm.mk b/webkit/common/webkit_common.target.linux-arm.mk
index 002a142..7ceb7ad 100644
--- a/webkit/common/webkit_common.target.linux-arm.mk
+++ b/webkit/common/webkit_common.target.linux-arm.mk
@@ -108,12 +108,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/ui \
 	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
@@ -220,12 +220,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/ui \
 	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
diff --git a/webkit/common/webkit_common.target.linux-mips.mk b/webkit/common/webkit_common.target.linux-mips.mk
index 2c68f40..46c3b0d 100644
--- a/webkit/common/webkit_common.target.linux-mips.mk
+++ b/webkit/common/webkit_common.target.linux-mips.mk
@@ -107,12 +107,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/ui \
 	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
@@ -218,12 +218,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/ui \
 	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
diff --git a/webkit/common/webkit_common.target.linux-x86.mk b/webkit/common/webkit_common.target.linux-x86.mk
index 840aaa9..a199c81 100644
--- a/webkit/common/webkit_common.target.linux-x86.mk
+++ b/webkit/common/webkit_common.target.linux-x86.mk
@@ -109,12 +109,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/ui \
 	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
@@ -223,12 +223,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/ui \
 	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
diff --git a/webkit/glue/webkit_glue.cc b/webkit/glue/webkit_glue.cc
index 4c832f3..30b03e5 100644
--- a/webkit/glue/webkit_glue.cc
+++ b/webkit/glue/webkit_glue.cc
@@ -4,65 +4,16 @@
 
 #include "webkit/glue/webkit_glue.h"
 
-#if defined(OS_LINUX)
-#include <malloc.h>
-#endif
-
 #include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/process_util.h"
-#include "base/strings/string_tokenizer.h"
-#include "base/strings/string_util.h"
-#include "base/strings/stringprintf.h"
-#include "net/base/escape.h"
-#include "skia/ext/platform_canvas.h"
 #include "third_party/WebKit/public/platform/WebFileInfo.h"
-#include "third_party/WebKit/public/web/WebFrame.h"
-#include "third_party/WebKit/public/web/WebGlyphCache.h"
-#include "third_party/WebKit/public/web/WebKit.h"
-#include "third_party/skia/include/core/SkBitmap.h"
 #include "v8/include/v8.h"
 
-using WebKit::WebCanvas;
-using WebKit::WebFrame;
-using WebKit::WebGlyphCache;
-
-//------------------------------------------------------------------------------
-// webkit_glue impl:
-
 namespace webkit_glue {
 
 void SetJavaScriptFlags(const std::string& str) {
   v8::V8::SetFlagsFromString(str.data(), static_cast<int>(str.size()));
 }
 
-void EnableWebCoreLogChannels(const std::string& channels) {
-  if (channels.empty())
-    return;
-  base::StringTokenizer t(channels, ", ");
-  while (t.GetNext()) {
-    WebKit::enableLogChannel(t.token().c_str());
-  }
-}
-
-#ifndef NDEBUG
-// The log macro was having problems due to collisions with WTF, so we just
-// code here what that would have inlined.
-void DumpLeakedObject(const char* file, int line, const char* object,
-                      int count) {
-  std::string msg = base::StringPrintf("%s LEAKED %d TIMES", object, count);
-  logging::LogMessage(file, line).stream() << msg;
-}
-#endif
-
-void CheckForLeaks() {
-#ifndef NDEBUG
-  int count = WebFrame::instanceCount();
-  if (count)
-    DumpLeakedObject(__FILE__, __LINE__, "WebFrame", count);
-#endif
-}
-
 void PlatformFileInfoToWebFileInfo(
     const base::PlatformFileInfo& file_info,
     WebKit::WebFileInfo* web_file_info) {
@@ -79,14 +30,6 @@
     web_file_info->type = WebKit::WebFileInfo::TypeFile;
 }
 
-WebCanvas* ToWebCanvas(skia::PlatformCanvas* canvas) {
-  return canvas;
-}
-
-int GetGlyphPageCount() {
-  return WebGlyphCache::pageCount();
-}
-
 COMPILE_ASSERT(std::numeric_limits<double>::has_quiet_NaN, has_quiet_NaN);
 
-} // namespace webkit_glue
+}  // namespace webkit_glue
diff --git a/webkit/glue/webkit_glue.h b/webkit/glue/webkit_glue.h
index 33fed9f..c396015 100644
--- a/webkit/glue/webkit_glue.h
+++ b/webkit/glue/webkit_glue.h
@@ -7,14 +7,9 @@
 
 #include <string>
 
-#include "base/basictypes.h"
 #include "base/platform_file.h"
-#include "base/strings/string16.h"
-#include "third_party/WebKit/public/platform/WebCanvas.h"
 #include "webkit/glue/webkit_glue_export.h"
 
-class SkCanvas;
-
 namespace WebKit {
 struct WebFileInfo;
 }
@@ -23,29 +18,11 @@
 
 WEBKIT_GLUE_EXPORT void SetJavaScriptFlags(const std::string& flags);
 
-// Turn on logging for flags in the provided comma delimited list.
-WEBKIT_GLUE_EXPORT void EnableWebCoreLogChannels(const std::string& channels);
-
-#ifndef NDEBUG
-// Checks various important objects to see if there are any in memory, and
-// calls AppendToLog with any leaked objects. Designed to be called on
-// shutdown.
-WEBKIT_GLUE_EXPORT void CheckForLeaks();
-#endif
-
 // File info conversion
 WEBKIT_GLUE_EXPORT void PlatformFileInfoToWebFileInfo(
     const base::PlatformFileInfo& file_info,
     WebKit::WebFileInfo* web_file_info);
 
-// Returns a WebCanvas pointer associated with the given Skia canvas.
-WEBKIT_GLUE_EXPORT WebKit::WebCanvas* ToWebCanvas(SkCanvas*);
-
-// Returns the number of currently-active glyph pages this process is using.
-// There can be many such pages (maps of 256 character -> glyph) so this is
-// used to get memory usage statistics.
-WEBKIT_GLUE_EXPORT int GetGlyphPageCount();
-
 }  // namespace webkit_glue
 
 #endif  // WEBKIT_GLUE_WEBKIT_GLUE_H_
diff --git a/webkit/plugins/plugins_common.target.darwin-arm.mk b/webkit/plugins/plugins_common.target.darwin-arm.mk
index 7c1a825..9b324e9 100644
--- a/webkit/plugins/plugins_common.target.darwin-arm.mk
+++ b/webkit/plugins/plugins_common.target.darwin-arm.mk
@@ -95,11 +95,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
@@ -187,11 +187,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
diff --git a/webkit/plugins/plugins_common.target.darwin-mips.mk b/webkit/plugins/plugins_common.target.darwin-mips.mk
index 32b422c..aee20e4 100644
--- a/webkit/plugins/plugins_common.target.darwin-mips.mk
+++ b/webkit/plugins/plugins_common.target.darwin-mips.mk
@@ -95,11 +95,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
@@ -187,11 +187,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
diff --git a/webkit/plugins/plugins_common.target.darwin-x86.mk b/webkit/plugins/plugins_common.target.darwin-x86.mk
index 2e7ff4e..580ac45 100644
--- a/webkit/plugins/plugins_common.target.darwin-x86.mk
+++ b/webkit/plugins/plugins_common.target.darwin-x86.mk
@@ -96,11 +96,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
@@ -190,11 +190,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
diff --git a/webkit/plugins/plugins_common.target.linux-arm.mk b/webkit/plugins/plugins_common.target.linux-arm.mk
index 7c1a825..9b324e9 100644
--- a/webkit/plugins/plugins_common.target.linux-arm.mk
+++ b/webkit/plugins/plugins_common.target.linux-arm.mk
@@ -95,11 +95,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
@@ -187,11 +187,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
diff --git a/webkit/plugins/plugins_common.target.linux-mips.mk b/webkit/plugins/plugins_common.target.linux-mips.mk
index 32b422c..aee20e4 100644
--- a/webkit/plugins/plugins_common.target.linux-mips.mk
+++ b/webkit/plugins/plugins_common.target.linux-mips.mk
@@ -95,11 +95,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
@@ -187,11 +187,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
diff --git a/webkit/plugins/plugins_common.target.linux-x86.mk b/webkit/plugins/plugins_common.target.linux-x86.mk
index 2e7ff4e..580ac45 100644
--- a/webkit/plugins/plugins_common.target.linux-x86.mk
+++ b/webkit/plugins/plugins_common.target.linux-x86.mk
@@ -96,11 +96,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
@@ -190,11 +190,11 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH) \
 	$(PWD)/external/icu4c/common \
 	$(PWD)/external/icu4c/i18n \
diff --git a/webkit/plugins/ppapi/OWNERS b/webkit/plugins/ppapi/OWNERS
deleted file mode 100644
index fa90d19..0000000
--- a/webkit/plugins/ppapi/OWNERS
+++ /dev/null
@@ -1,7 +0,0 @@
-brettw@chromium.org
-dmichael@chromium.org
-piman@chromium.org
-yzshen@chromium.org
-
-per-file usb_key_code_*=garykac@chromium.org
-per-file usb_key_code_*=wez@chromium.org
diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.h b/webkit/plugins/ppapi/mock_plugin_delegate.h
deleted file mode 100644
index 3a65949..0000000
--- a/webkit/plugins/ppapi/mock_plugin_delegate.h
+++ /dev/null
@@ -1,197 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef WEBKIT_PLUGINS_PPAPI_MOCK_PLUGIN_DELEGATE_H_
-#define WEBKIT_PLUGINS_PPAPI_MOCK_PLUGIN_DELEGATE_H_
-
-#include "webkit/plugins/ppapi/plugin_delegate.h"
-
-struct PP_NetAddress_Private;
-namespace ppapi { class PPB_X509Certificate_Fields; }
-
-namespace webkit {
-namespace ppapi {
-
-class MockPluginDelegate : public PluginDelegate {
- public:
-  MockPluginDelegate();
-  virtual ~MockPluginDelegate();
-
-  virtual void PluginFocusChanged(PluginInstance* instance, bool focused);
-  virtual void PluginTextInputTypeChanged(PluginInstance* instance);
-  virtual void PluginCaretPositionChanged(PluginInstance* instance);
-  virtual void PluginRequestedCancelComposition(PluginInstance* instance);
-  virtual void PluginSelectionChanged(PluginInstance* instance);
-  virtual void SimulateImeSetComposition(
-      const base::string16& text,
-      const std::vector<WebKit::WebCompositionUnderline>& underlines,
-      int selection_start,
-      int selection_end);
-  virtual void SimulateImeConfirmComposition(const base::string16& text);
-  virtual void PluginCrashed(PluginInstance* instance);
-  virtual void InstanceCreated(PluginInstance* instance);
-  virtual void InstanceDeleted(PluginInstance* instance);
-  virtual scoped_ptr< ::ppapi::thunk::ResourceCreationAPI>
-      CreateResourceCreationAPI(PluginInstance* instance);
-  virtual SkBitmap* GetSadPluginBitmap();
-  virtual WebKit::WebPlugin* CreatePluginReplacement(
-      const base::FilePath& file_path);
-  virtual PlatformImage2D* CreateImage2D(int width, int height);
-  virtual PlatformGraphics2D* GetGraphics2D(PluginInstance* instance,
-                                            PP_Resource graphics_2d);
-  virtual PlatformContext3D* CreateContext3D();
-  virtual PlatformVideoDecoder* CreateVideoDecoder(
-      media::VideoDecodeAccelerator::Client* client,
-      int32 command_buffer_route_id);
-  virtual PlatformVideoCapture* CreateVideoCapture(
-      const std::string& device_id,
-      const GURL& document_url,
-      PlatformVideoCaptureEventHandler* handler);
-  virtual uint32_t GetAudioHardwareOutputSampleRate();
-  virtual uint32_t GetAudioHardwareOutputBufferSize();
-  virtual PlatformAudioOutput* CreateAudioOutput(
-      uint32_t sample_rate,
-      uint32_t sample_count,
-      PlatformAudioOutputClient* client);
-  virtual PlatformAudioInput* CreateAudioInput(
-      const std::string& device_id,
-      const GURL& document_url,
-      uint32_t sample_rate,
-      uint32_t sample_count,
-      PlatformAudioInputClient* client);
-  virtual Broker* ConnectToBroker(PPB_Broker_Impl* client);
-  virtual void NumberOfFindResultsChanged(int identifier,
-                                          int total,
-                                          bool final_result);
-  virtual void SelectedFindResultChanged(int identifier, int index);
-  virtual bool AsyncOpenFile(const base::FilePath& path,
-                             int flags,
-                             const AsyncOpenFileCallback& callback);
-  virtual void AsyncOpenFileSystemURL(
-      const GURL& path,
-      int flags,
-      const AsyncOpenFileSystemURLCallback& callback);
-  virtual bool IsFileSystemOpened(PP_Instance instance,
-                                  PP_Resource resource) const;
-  virtual PP_FileSystemType GetFileSystemType(PP_Instance instance,
-                                              PP_Resource resource) const;
-  virtual GURL GetFileSystemRootUrl(PP_Instance instance,
-                                    PP_Resource resource) const;
-  virtual void MakeDirectory(
-      const GURL& path,
-      bool recursive,
-      const StatusCallback& callback);
-  virtual void Query(const GURL& path,
-                     const MetadataCallback& success_callback,
-                     const StatusCallback& error_callback);
-  virtual void ReadDirectoryEntries(
-      const GURL& path,
-      const ReadDirectoryCallback& success_callback,
-      const StatusCallback& error_callback);
-  virtual void Touch(const GURL& path,
-                     const base::Time& last_access_time,
-                     const base::Time& last_modified_time,
-                     const StatusCallback& callback);
-  virtual void SetLength(const GURL& path,
-                         int64_t length,
-                         const StatusCallback& callback);
-  virtual void Delete(const GURL& path,
-                      const StatusCallback& callback);
-  virtual void Rename(const GURL& file_path,
-                      const GURL& new_file_path,
-                      const StatusCallback& callback);
-  virtual void ReadDirectory(
-      const GURL& directory_path,
-      const ReadDirectoryCallback& success_callback,
-      const StatusCallback& error_callback);
-  virtual void QueryAvailableSpace(const GURL& origin,
-                                   quota::StorageType type,
-                                   const AvailableSpaceCallback& callback);
-  virtual void WillUpdateFile(const GURL& file_path);
-  virtual void DidUpdateFile(const GURL& file_path, int64_t delta);
-  virtual void SyncGetFileSystemPlatformPath(const GURL& url,
-                                             base::FilePath* platform_path);
-  virtual scoped_refptr<base::MessageLoopProxy>
-      GetFileThreadMessageLoopProxy();
-  virtual uint32 TCPSocketCreate();
-  virtual void TCPSocketConnect(PPB_TCPSocket_Private_Impl* socket,
-                                uint32 socket_id,
-                                const std::string& host,
-                                uint16_t port);
-  virtual void TCPSocketConnectWithNetAddress(
-      PPB_TCPSocket_Private_Impl* socket,
-      uint32 socket_id,
-      const PP_NetAddress_Private& addr);
-  virtual void TCPSocketSSLHandshake(
-      uint32 socket_id,
-      const std::string& server_name,
-      uint16_t server_port,
-      const std::vector<std::vector<char> >& trusted_certs,
-      const std::vector<std::vector<char> >& untrusted_certs);
-  virtual void TCPSocketRead(uint32 socket_id, int32_t bytes_to_read);
-  virtual void TCPSocketWrite(uint32 socket_id, const std::string& buffer);
-  virtual void TCPSocketDisconnect(uint32 socket_id);
-  virtual void TCPSocketSetOption(uint32 socket_id,
-                                  PP_TCPSocket_Option name,
-                                  const ::ppapi::SocketOptionData& value);
-  virtual void RegisterTCPSocket(PPB_TCPSocket_Private_Impl* socket,
-                                 uint32 socket_id);
-  virtual void TCPServerSocketListen(PP_Resource socket_resource,
-                                     const PP_NetAddress_Private& addr,
-                                     int32_t backlog);
-  virtual void TCPServerSocketAccept(uint32 server_socket_id);
-  virtual void TCPServerSocketStopListening(PP_Resource socket_resource,
-                                            uint32 socket_id);
-  // Add/remove a network list observer.
-  virtual bool AddNetworkListObserver(
-      webkit_glue::NetworkListObserver* observer) OVERRIDE;
-  virtual void RemoveNetworkListObserver(
-      webkit_glue::NetworkListObserver* observer) OVERRIDE;
-  virtual bool X509CertificateParseDER(
-      const std::vector<char>& der,
-      ::ppapi::PPB_X509Certificate_Fields* fields);
-  virtual FullscreenContainer* CreateFullscreenContainer(
-      PluginInstance* instance);
-  virtual gfx::Size GetScreenSize();
-  virtual std::string GetDefaultEncoding();
-  virtual void ZoomLimitsChanged(double minimum_factor,
-                                 double maximum_factor);
-  virtual void DidStartLoading();
-  virtual void DidStopLoading();
-  virtual void SetContentRestriction(int restrictions);
-  virtual void SaveURLAs(const GURL& url);
-  virtual base::SharedMemory* CreateAnonymousSharedMemory(size_t size);
-  virtual ::ppapi::Preferences GetPreferences();
-  virtual bool LockMouse(PluginInstance* instance);
-  virtual void UnlockMouse(PluginInstance* instance);
-  virtual bool IsMouseLocked(PluginInstance* instance);
-  virtual void DidChangeCursor(PluginInstance* instance,
-                               const WebKit::WebCursorInfo& cursor);
-  virtual void DidReceiveMouseEvent(PluginInstance* instance);
-  virtual void SampleGamepads(WebKit::WebGamepads* data) OVERRIDE;
-  virtual bool IsInFullscreenMode();
-  virtual bool IsPageVisible() const;
-  virtual int EnumerateDevices(PP_DeviceType_Dev type,
-                               const EnumerateDevicesCallback& callback);
-  virtual void StopEnumerateDevices(int request_id);
-  virtual IPC::PlatformFileForTransit ShareHandleWithRemote(
-      base::PlatformFile handle,
-      base::ProcessId target_process_id,
-      bool should_close_source) const;
-  virtual bool IsRunningInProcess(PP_Instance instance) const;
-  virtual void HandleDocumentLoad(PluginInstance* instance,
-                                  const WebKit::WebURLResponse& response);
-  virtual content::RendererPpapiHost* CreateExternalPluginModule(
-      scoped_refptr<PluginModule> module,
-      const base::FilePath& path,
-      ::ppapi::PpapiPermissions permissions,
-      const IPC::ChannelHandle& channel_handle,
-      base::ProcessId plugin_pid,
-      int plugin_child_id);
-};
-
-}  // namespace ppapi
-}  // namespace webkit
-
-#endif  // WEBKIT_PLUGINS_PPAPI_MOCK_PLUGIN_DELEGATE_H_
diff --git a/webkit/plugins/ppapi/v8_var_converter.h b/webkit/plugins/ppapi/v8_var_converter.h
deleted file mode 100644
index 9dcae4f..0000000
--- a/webkit/plugins/ppapi/v8_var_converter.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright (c) 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 WEBKIT_PLUGINS_PPAPI_V8_VAR_CONVERTER_H
-#define WEBKIT_PLUGINS_PPAPI_V8_VAR_CONVERTER_H
-
-
-#include "base/basictypes.h"
-#include "base/compiler_specific.h"
-#include "ppapi/c/pp_var.h"
-#include "v8/include/v8.h"
-#include "webkit/plugins/webkit_plugins_export.h"
-
-namespace webkit {
-namespace ppapi {
-namespace V8VarConverter {
-
-// Converts the given PP_Var to a v8::Value. True is returned upon success.
-bool WEBKIT_PLUGINS_EXPORT ToV8Value(const PP_Var& var,
-                                     v8::Handle<v8::Context> context,
-                                     v8::Handle<v8::Value>* result);
-// Converts the given v8::Value to a PP_Var. True is returned upon success.
-// Every PP_Var in the reference graph of which |result| is apart will have
-// a refcount equal to the number of references to it in the graph. |result|
-// will have one additional reference.
-bool WEBKIT_PLUGINS_EXPORT FromV8Value(v8::Handle<v8::Value> val,
-                                       v8::Handle<v8::Context> context,
-                                       PP_Var* result);
-
-}  // namespace V8VarConverter
-}  // namespace ppapi
-}  // namespace webkit
-
-#endif  // WEBKIT_PLUGINS_PPAPI_V8_VAR_CONVERTER_H
diff --git a/webkit/plugins/webkit_plugins.gypi b/webkit/plugins/webkit_plugins.gypi
index b27d304..8cc2648 100644
--- a/webkit/plugins/webkit_plugins.gypi
+++ b/webkit/plugins/webkit_plugins.gypi
@@ -46,112 +46,10 @@
         # This list contains all .h, .cc, and .mm files in glue except for
         # those in the test subdirectory and those with unittest in in their
         # names.
-        '../plugins/ppapi/audio_helper.cc',
-        '../plugins/ppapi/audio_helper.h',
-        '../plugins/ppapi/common.h',
-        '../plugins/ppapi/content_decryptor_delegate.cc',
-        '../plugins/ppapi/content_decryptor_delegate.h',
-        '../plugins/ppapi/event_conversion.cc',
-        '../plugins/ppapi/event_conversion.h',
-        '../plugins/ppapi/fullscreen_container.h',
-        '../plugins/ppapi/gfx_conversion.h',
-        '../plugins/ppapi/host_array_buffer_var.cc',
-        '../plugins/ppapi/host_array_buffer_var.h',
-        '../plugins/ppapi/host_globals.cc',
-        '../plugins/ppapi/host_globals.h',
-        '../plugins/ppapi/host_var_tracker.cc',
-        '../plugins/ppapi/host_var_tracker.h',
-        '../plugins/ppapi/message_channel.cc',
-        '../plugins/ppapi/message_channel.h',
-        '../plugins/ppapi/npapi_glue.cc',
-        '../plugins/ppapi/npapi_glue.h',
-        '../plugins/ppapi/npobject_var.cc',
-        '../plugins/ppapi/npobject_var.h',
-        '../plugins/ppapi/plugin_delegate.h',
-        '../plugins/ppapi/plugin_module.cc',
-        '../plugins/ppapi/plugin_module.h',
-        '../plugins/ppapi/plugin_object.cc',
-        '../plugins/ppapi/plugin_object.h',
-        '../plugins/ppapi/ppapi_interface_factory.cc',
-        '../plugins/ppapi/ppapi_interface_factory.h',
-        '../plugins/ppapi/ppapi_plugin_instance.cc',
-        '../plugins/ppapi/ppapi_plugin_instance.h',
-        '../plugins/ppapi/ppapi_webplugin_impl.cc',
-        '../plugins/ppapi/ppapi_webplugin_impl.h',
-        '../plugins/ppapi/ppb_audio_impl.cc',
-        '../plugins/ppapi/ppb_audio_impl.h',
-        '../plugins/ppapi/ppb_broker_impl.cc',
-        '../plugins/ppapi/ppb_broker_impl.h',
-        '../plugins/ppapi/ppb_buffer_impl.cc',
-        '../plugins/ppapi/ppb_buffer_impl.h',
-        '../plugins/ppapi/ppb_file_ref_impl.cc',
-        '../plugins/ppapi/ppb_file_ref_impl.h',
-        '../plugins/ppapi/ppb_flash_message_loop_impl.cc',
-        '../plugins/ppapi/ppb_flash_message_loop_impl.h',
-        '../plugins/ppapi/ppb_gpu_blacklist_private_impl.cc',
-        '../plugins/ppapi/ppb_gpu_blacklist_private_impl.h',
-        '../plugins/ppapi/ppb_graphics_3d_impl.cc',
-        '../plugins/ppapi/ppb_graphics_3d_impl.h',
-        '../plugins/ppapi/ppb_image_data_impl.cc',
-        '../plugins/ppapi/ppb_image_data_impl.h',
-        '../plugins/ppapi/ppb_network_monitor_private_impl.cc',
-        '../plugins/ppapi/ppb_network_monitor_private_impl.h',
-        '../plugins/ppapi/ppb_proxy_impl.cc',
-        '../plugins/ppapi/ppb_proxy_impl.h',
-        '../plugins/ppapi/ppb_scrollbar_impl.cc',
-        '../plugins/ppapi/ppb_scrollbar_impl.h',
-        '../plugins/ppapi/ppb_tcp_server_socket_private_impl.cc',
-        '../plugins/ppapi/ppb_tcp_server_socket_private_impl.h',
-        '../plugins/ppapi/ppb_tcp_socket_private_impl.cc',
-        '../plugins/ppapi/ppb_tcp_socket_private_impl.h',
-        '../plugins/ppapi/ppb_uma_private_impl.cc',
-        '../plugins/ppapi/ppb_uma_private_impl.h',
-        '../plugins/ppapi/ppb_var_deprecated_impl.cc',
-        '../plugins/ppapi/ppb_var_deprecated_impl.h',
-        '../plugins/ppapi/ppb_video_decoder_impl.cc',
-        '../plugins/ppapi/ppb_video_decoder_impl.h',
-        '../plugins/ppapi/ppb_widget_impl.cc',
-        '../plugins/ppapi/ppb_widget_impl.h',
-        '../plugins/ppapi/ppb_x509_certificate_private_impl.cc',
-        '../plugins/ppapi/ppb_x509_certificate_private_impl.h',
-        '../plugins/ppapi/quota_file_io.cc',
-        '../plugins/ppapi/quota_file_io.h',
-        '../plugins/ppapi/resource_creation_impl.cc',
-        '../plugins/ppapi/resource_creation_impl.h',
-        '../plugins/ppapi/resource_helper.cc',
-        '../plugins/ppapi/resource_helper.h',
-        '../plugins/ppapi/url_request_info_util.cc',
-        '../plugins/ppapi/url_request_info_util.h',
-        '../plugins/ppapi/usb_key_code_conversion.h',
-        '../plugins/ppapi/usb_key_code_conversion.cc',
-        '../plugins/ppapi/usb_key_code_conversion_linux.cc',
-        '../plugins/ppapi/usb_key_code_conversion_mac.cc',
-        '../plugins/ppapi/usb_key_code_conversion_win.cc',
-        '../plugins/ppapi/v8_var_converter.cc',
-        '../plugins/ppapi/v8_var_converter.h',
         '../plugins/sad_plugin.cc',
         '../plugins/sad_plugin.h',
         '../plugins/webkit_plugins_export.h',
       ],
-      'conditions': [
-        ['enable_gpu!=1', {
-          'sources!': [
-            '../plugins/ppapi/ppb_graphics_3d_impl.cc',
-            '../plugins/ppapi/ppb_graphics_3d_impl.h',
-            '../plugins/ppapi/ppb_open_gl_es_impl.cc',
-          ],
-        }],
-        ['OS!="win"', {
-          'sources/': [['exclude', '_win\\.cc$']],
-        }, {  # else: OS=="win"
-          # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
-          'msvs_disabled_warnings': [ 4800, 4267 ],
-          'sources/': [['exclude', '_posix\\.cc$']],
-          'include_dirs': [
-            '<(DEPTH)/third_party/wtl/include',
-          ],
-        }],
-      ],
     },
   ]
 }
diff --git a/webkit/renderer/compositor_bindings/webkit_compositor_bindings.target.darwin-arm.mk b/webkit/renderer/compositor_bindings/webkit_compositor_bindings.target.darwin-arm.mk
index fb0dca7..c4663a0 100644
--- a/webkit/renderer/compositor_bindings/webkit_compositor_bindings.target.darwin-arm.mk
+++ b/webkit/renderer/compositor_bindings/webkit_compositor_bindings.target.darwin-arm.mk
@@ -118,12 +118,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -233,12 +233,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
diff --git a/webkit/renderer/compositor_bindings/webkit_compositor_bindings.target.darwin-mips.mk b/webkit/renderer/compositor_bindings/webkit_compositor_bindings.target.darwin-mips.mk
index 85588a9..2d5eb70 100644
--- a/webkit/renderer/compositor_bindings/webkit_compositor_bindings.target.darwin-mips.mk
+++ b/webkit/renderer/compositor_bindings/webkit_compositor_bindings.target.darwin-mips.mk
@@ -117,12 +117,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -231,12 +231,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
diff --git a/webkit/renderer/compositor_bindings/webkit_compositor_bindings.target.darwin-x86.mk b/webkit/renderer/compositor_bindings/webkit_compositor_bindings.target.darwin-x86.mk
index 7154660..9fe67e9 100644
--- a/webkit/renderer/compositor_bindings/webkit_compositor_bindings.target.darwin-x86.mk
+++ b/webkit/renderer/compositor_bindings/webkit_compositor_bindings.target.darwin-x86.mk
@@ -119,12 +119,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -236,12 +236,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
diff --git a/webkit/renderer/compositor_bindings/webkit_compositor_bindings.target.linux-arm.mk b/webkit/renderer/compositor_bindings/webkit_compositor_bindings.target.linux-arm.mk
index fb0dca7..c4663a0 100644
--- a/webkit/renderer/compositor_bindings/webkit_compositor_bindings.target.linux-arm.mk
+++ b/webkit/renderer/compositor_bindings/webkit_compositor_bindings.target.linux-arm.mk
@@ -118,12 +118,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -233,12 +233,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
diff --git a/webkit/renderer/compositor_bindings/webkit_compositor_bindings.target.linux-mips.mk b/webkit/renderer/compositor_bindings/webkit_compositor_bindings.target.linux-mips.mk
index 85588a9..2d5eb70 100644
--- a/webkit/renderer/compositor_bindings/webkit_compositor_bindings.target.linux-mips.mk
+++ b/webkit/renderer/compositor_bindings/webkit_compositor_bindings.target.linux-mips.mk
@@ -117,12 +117,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -231,12 +231,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
diff --git a/webkit/renderer/compositor_bindings/webkit_compositor_bindings.target.linux-x86.mk b/webkit/renderer/compositor_bindings/webkit_compositor_bindings.target.linux-x86.mk
index 7154660..9fe67e9 100644
--- a/webkit/renderer/compositor_bindings/webkit_compositor_bindings.target.linux-x86.mk
+++ b/webkit/renderer/compositor_bindings/webkit_compositor_bindings.target.linux-x86.mk
@@ -119,12 +119,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -236,12 +236,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
diff --git a/webkit/renderer/compositor_bindings/webkit_compositor_support.target.darwin-arm.mk b/webkit/renderer/compositor_bindings/webkit_compositor_support.target.darwin-arm.mk
index c444477..b031ec9 100644
--- a/webkit/renderer/compositor_bindings/webkit_compositor_support.target.darwin-arm.mk
+++ b/webkit/renderer/compositor_bindings/webkit_compositor_support.target.darwin-arm.mk
@@ -95,14 +95,14 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/webkit \
 	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -202,14 +202,14 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/webkit \
 	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
diff --git a/webkit/renderer/compositor_bindings/webkit_compositor_support.target.darwin-mips.mk b/webkit/renderer/compositor_bindings/webkit_compositor_support.target.darwin-mips.mk
index 929a3cc..1dfda10 100644
--- a/webkit/renderer/compositor_bindings/webkit_compositor_support.target.darwin-mips.mk
+++ b/webkit/renderer/compositor_bindings/webkit_compositor_support.target.darwin-mips.mk
@@ -94,14 +94,14 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/webkit \
 	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -200,14 +200,14 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/webkit \
 	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
diff --git a/webkit/renderer/compositor_bindings/webkit_compositor_support.target.darwin-x86.mk b/webkit/renderer/compositor_bindings/webkit_compositor_support.target.darwin-x86.mk
index 3ff4531..3515dbb 100644
--- a/webkit/renderer/compositor_bindings/webkit_compositor_support.target.darwin-x86.mk
+++ b/webkit/renderer/compositor_bindings/webkit_compositor_support.target.darwin-x86.mk
@@ -97,14 +97,14 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/webkit \
 	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -207,14 +207,14 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/webkit \
 	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
diff --git a/webkit/renderer/compositor_bindings/webkit_compositor_support.target.linux-arm.mk b/webkit/renderer/compositor_bindings/webkit_compositor_support.target.linux-arm.mk
index c444477..b031ec9 100644
--- a/webkit/renderer/compositor_bindings/webkit_compositor_support.target.linux-arm.mk
+++ b/webkit/renderer/compositor_bindings/webkit_compositor_support.target.linux-arm.mk
@@ -95,14 +95,14 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/webkit \
 	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -202,14 +202,14 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/webkit \
 	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
diff --git a/webkit/renderer/compositor_bindings/webkit_compositor_support.target.linux-mips.mk b/webkit/renderer/compositor_bindings/webkit_compositor_support.target.linux-mips.mk
index 929a3cc..1dfda10 100644
--- a/webkit/renderer/compositor_bindings/webkit_compositor_support.target.linux-mips.mk
+++ b/webkit/renderer/compositor_bindings/webkit_compositor_support.target.linux-mips.mk
@@ -94,14 +94,14 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/webkit \
 	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -200,14 +200,14 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/webkit \
 	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
diff --git a/webkit/renderer/compositor_bindings/webkit_compositor_support.target.linux-x86.mk b/webkit/renderer/compositor_bindings/webkit_compositor_support.target.linux-x86.mk
index 3ff4531..3515dbb 100644
--- a/webkit/renderer/compositor_bindings/webkit_compositor_support.target.linux-x86.mk
+++ b/webkit/renderer/compositor_bindings/webkit_compositor_support.target.linux-x86.mk
@@ -97,14 +97,14 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/webkit \
 	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
@@ -207,14 +207,14 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/webkit \
 	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/skia/src/core \
 	$(LOCAL_PATH)/skia/config \
 	$(LOCAL_PATH)/third_party/skia/include/config \
diff --git a/webkit/renderer/webkit_renderer.target.darwin-arm.mk b/webkit/renderer/webkit_renderer.target.darwin-arm.mk
index 0afefea..f7287a7 100644
--- a/webkit/renderer/webkit_renderer.target.darwin-arm.mk
+++ b/webkit/renderer/webkit_renderer.target.darwin-arm.mk
@@ -106,9 +106,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -221,9 +221,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/webkit/renderer/webkit_renderer.target.darwin-mips.mk b/webkit/renderer/webkit_renderer.target.darwin-mips.mk
index 4449c2d..818dd3c 100644
--- a/webkit/renderer/webkit_renderer.target.darwin-mips.mk
+++ b/webkit/renderer/webkit_renderer.target.darwin-mips.mk
@@ -106,9 +106,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -221,9 +221,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/webkit/renderer/webkit_renderer.target.darwin-x86.mk b/webkit/renderer/webkit_renderer.target.darwin-x86.mk
index 162968b..45c4744 100644
--- a/webkit/renderer/webkit_renderer.target.darwin-x86.mk
+++ b/webkit/renderer/webkit_renderer.target.darwin-x86.mk
@@ -107,9 +107,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -224,9 +224,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/webkit/renderer/webkit_renderer.target.linux-arm.mk b/webkit/renderer/webkit_renderer.target.linux-arm.mk
index 0afefea..f7287a7 100644
--- a/webkit/renderer/webkit_renderer.target.linux-arm.mk
+++ b/webkit/renderer/webkit_renderer.target.linux-arm.mk
@@ -106,9 +106,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -221,9 +221,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/webkit/renderer/webkit_renderer.target.linux-mips.mk b/webkit/renderer/webkit_renderer.target.linux-mips.mk
index 4449c2d..818dd3c 100644
--- a/webkit/renderer/webkit_renderer.target.linux-mips.mk
+++ b/webkit/renderer/webkit_renderer.target.linux-mips.mk
@@ -106,9 +106,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -221,9 +221,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/webkit/renderer/webkit_renderer.target.linux-x86.mk b/webkit/renderer/webkit_renderer.target.linux-x86.mk
index 162968b..45c4744 100644
--- a/webkit/renderer/webkit_renderer.target.linux-x86.mk
+++ b/webkit/renderer/webkit_renderer.target.linux-x86.mk
@@ -107,9 +107,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -224,9 +224,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/webkit/support/glue.target.darwin-arm.mk b/webkit/support/glue.target.darwin-arm.mk
index 9debda3..ab52a6a 100644
--- a/webkit/support/glue.target.darwin-arm.mk
+++ b/webkit/support/glue.target.darwin-arm.mk
@@ -117,12 +117,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/webkit \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -246,12 +246,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/webkit \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/webkit/support/glue.target.darwin-mips.mk b/webkit/support/glue.target.darwin-mips.mk
index bc3c5af..f45590a 100644
--- a/webkit/support/glue.target.darwin-mips.mk
+++ b/webkit/support/glue.target.darwin-mips.mk
@@ -116,12 +116,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/webkit \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -244,12 +244,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/webkit \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/webkit/support/glue.target.darwin-x86.mk b/webkit/support/glue.target.darwin-x86.mk
index cdd651c..c62d537 100644
--- a/webkit/support/glue.target.darwin-x86.mk
+++ b/webkit/support/glue.target.darwin-x86.mk
@@ -118,12 +118,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/webkit \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -249,12 +249,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/webkit \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/webkit/support/glue.target.linux-arm.mk b/webkit/support/glue.target.linux-arm.mk
index 9debda3..ab52a6a 100644
--- a/webkit/support/glue.target.linux-arm.mk
+++ b/webkit/support/glue.target.linux-arm.mk
@@ -117,12 +117,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/webkit \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -246,12 +246,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/webkit \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/webkit/support/glue.target.linux-mips.mk b/webkit/support/glue.target.linux-mips.mk
index bc3c5af..f45590a 100644
--- a/webkit/support/glue.target.linux-mips.mk
+++ b/webkit/support/glue.target.linux-mips.mk
@@ -116,12 +116,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/webkit \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -244,12 +244,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/webkit \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/webkit/support/glue.target.linux-x86.mk b/webkit/support/glue.target.linux-x86.mk
index cdd651c..c62d537 100644
--- a/webkit/support/glue.target.linux-x86.mk
+++ b/webkit/support/glue.target.linux-x86.mk
@@ -118,12 +118,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/webkit \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -249,12 +249,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/webkit \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/webkit/support/glue_child.target.darwin-arm.mk b/webkit/support/glue_child.target.darwin-arm.mk
index bdfc392..896b6b8 100644
--- a/webkit/support/glue_child.target.darwin-arm.mk
+++ b/webkit/support/glue_child.target.darwin-arm.mk
@@ -124,10 +124,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/webkit \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -246,10 +246,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/webkit \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/webkit/support/glue_child.target.darwin-mips.mk b/webkit/support/glue_child.target.darwin-mips.mk
index fe80dc4..7fdefb2 100644
--- a/webkit/support/glue_child.target.darwin-mips.mk
+++ b/webkit/support/glue_child.target.darwin-mips.mk
@@ -123,10 +123,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/webkit \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -244,10 +244,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/webkit \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/webkit/support/glue_child.target.darwin-x86.mk b/webkit/support/glue_child.target.darwin-x86.mk
index 4eb37fd..bd57c82 100644
--- a/webkit/support/glue_child.target.darwin-x86.mk
+++ b/webkit/support/glue_child.target.darwin-x86.mk
@@ -125,10 +125,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/webkit \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -249,10 +249,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/webkit \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/webkit/support/glue_child.target.linux-arm.mk b/webkit/support/glue_child.target.linux-arm.mk
index bdfc392..896b6b8 100644
--- a/webkit/support/glue_child.target.linux-arm.mk
+++ b/webkit/support/glue_child.target.linux-arm.mk
@@ -124,10 +124,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/webkit \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -246,10 +246,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/webkit \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/webkit/support/glue_child.target.linux-mips.mk b/webkit/support/glue_child.target.linux-mips.mk
index fe80dc4..7fdefb2 100644
--- a/webkit/support/glue_child.target.linux-mips.mk
+++ b/webkit/support/glue_child.target.linux-mips.mk
@@ -123,10 +123,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/webkit \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -244,10 +244,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/webkit \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/webkit/support/glue_child.target.linux-x86.mk b/webkit/support/glue_child.target.linux-x86.mk
index 4eb37fd..bd57c82 100644
--- a/webkit/support/glue_child.target.linux-x86.mk
+++ b/webkit/support/glue_child.target.linux-x86.mk
@@ -125,10 +125,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/webkit \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -249,10 +249,10 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/webkit \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
+	$(gyp_shared_intermediate_dir)/webkit \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/webkit/support/plugins.target.darwin-arm.mk b/webkit/support/plugins.target.darwin-arm.mk
index 5ca3470..12e6247 100644
--- a/webkit/support/plugins.target.darwin-arm.mk
+++ b/webkit/support/plugins.target.darwin-arm.mk
@@ -32,44 +32,6 @@
 GYP_COPIED_SOURCE_ORIGIN_DIRS :=
 
 LOCAL_SRC_FILES := \
-	webkit/plugins/ppapi/audio_helper.cc \
-	webkit/plugins/ppapi/content_decryptor_delegate.cc \
-	webkit/plugins/ppapi/event_conversion.cc \
-	webkit/plugins/ppapi/host_array_buffer_var.cc \
-	webkit/plugins/ppapi/host_globals.cc \
-	webkit/plugins/ppapi/host_var_tracker.cc \
-	webkit/plugins/ppapi/message_channel.cc \
-	webkit/plugins/ppapi/npapi_glue.cc \
-	webkit/plugins/ppapi/npobject_var.cc \
-	webkit/plugins/ppapi/plugin_module.cc \
-	webkit/plugins/ppapi/plugin_object.cc \
-	webkit/plugins/ppapi/ppapi_interface_factory.cc \
-	webkit/plugins/ppapi/ppapi_plugin_instance.cc \
-	webkit/plugins/ppapi/ppapi_webplugin_impl.cc \
-	webkit/plugins/ppapi/ppb_audio_impl.cc \
-	webkit/plugins/ppapi/ppb_broker_impl.cc \
-	webkit/plugins/ppapi/ppb_buffer_impl.cc \
-	webkit/plugins/ppapi/ppb_file_ref_impl.cc \
-	webkit/plugins/ppapi/ppb_flash_message_loop_impl.cc \
-	webkit/plugins/ppapi/ppb_gpu_blacklist_private_impl.cc \
-	webkit/plugins/ppapi/ppb_graphics_3d_impl.cc \
-	webkit/plugins/ppapi/ppb_image_data_impl.cc \
-	webkit/plugins/ppapi/ppb_network_monitor_private_impl.cc \
-	webkit/plugins/ppapi/ppb_proxy_impl.cc \
-	webkit/plugins/ppapi/ppb_scrollbar_impl.cc \
-	webkit/plugins/ppapi/ppb_tcp_server_socket_private_impl.cc \
-	webkit/plugins/ppapi/ppb_tcp_socket_private_impl.cc \
-	webkit/plugins/ppapi/ppb_uma_private_impl.cc \
-	webkit/plugins/ppapi/ppb_var_deprecated_impl.cc \
-	webkit/plugins/ppapi/ppb_video_decoder_impl.cc \
-	webkit/plugins/ppapi/ppb_widget_impl.cc \
-	webkit/plugins/ppapi/ppb_x509_certificate_private_impl.cc \
-	webkit/plugins/ppapi/quota_file_io.cc \
-	webkit/plugins/ppapi/resource_creation_impl.cc \
-	webkit/plugins/ppapi/resource_helper.cc \
-	webkit/plugins/ppapi/url_request_info_util.cc \
-	webkit/plugins/ppapi/usb_key_code_conversion.cc \
-	webkit/plugins/ppapi/v8_var_converter.cc \
 	webkit/plugins/sad_plugin.cc
 
 
@@ -150,12 +112,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/webkit \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -279,12 +241,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/webkit \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/webkit/support/plugins.target.darwin-mips.mk b/webkit/support/plugins.target.darwin-mips.mk
index 72511a4..7840a17 100644
--- a/webkit/support/plugins.target.darwin-mips.mk
+++ b/webkit/support/plugins.target.darwin-mips.mk
@@ -32,44 +32,6 @@
 GYP_COPIED_SOURCE_ORIGIN_DIRS :=
 
 LOCAL_SRC_FILES := \
-	webkit/plugins/ppapi/audio_helper.cc \
-	webkit/plugins/ppapi/content_decryptor_delegate.cc \
-	webkit/plugins/ppapi/event_conversion.cc \
-	webkit/plugins/ppapi/host_array_buffer_var.cc \
-	webkit/plugins/ppapi/host_globals.cc \
-	webkit/plugins/ppapi/host_var_tracker.cc \
-	webkit/plugins/ppapi/message_channel.cc \
-	webkit/plugins/ppapi/npapi_glue.cc \
-	webkit/plugins/ppapi/npobject_var.cc \
-	webkit/plugins/ppapi/plugin_module.cc \
-	webkit/plugins/ppapi/plugin_object.cc \
-	webkit/plugins/ppapi/ppapi_interface_factory.cc \
-	webkit/plugins/ppapi/ppapi_plugin_instance.cc \
-	webkit/plugins/ppapi/ppapi_webplugin_impl.cc \
-	webkit/plugins/ppapi/ppb_audio_impl.cc \
-	webkit/plugins/ppapi/ppb_broker_impl.cc \
-	webkit/plugins/ppapi/ppb_buffer_impl.cc \
-	webkit/plugins/ppapi/ppb_file_ref_impl.cc \
-	webkit/plugins/ppapi/ppb_flash_message_loop_impl.cc \
-	webkit/plugins/ppapi/ppb_gpu_blacklist_private_impl.cc \
-	webkit/plugins/ppapi/ppb_graphics_3d_impl.cc \
-	webkit/plugins/ppapi/ppb_image_data_impl.cc \
-	webkit/plugins/ppapi/ppb_network_monitor_private_impl.cc \
-	webkit/plugins/ppapi/ppb_proxy_impl.cc \
-	webkit/plugins/ppapi/ppb_scrollbar_impl.cc \
-	webkit/plugins/ppapi/ppb_tcp_server_socket_private_impl.cc \
-	webkit/plugins/ppapi/ppb_tcp_socket_private_impl.cc \
-	webkit/plugins/ppapi/ppb_uma_private_impl.cc \
-	webkit/plugins/ppapi/ppb_var_deprecated_impl.cc \
-	webkit/plugins/ppapi/ppb_video_decoder_impl.cc \
-	webkit/plugins/ppapi/ppb_widget_impl.cc \
-	webkit/plugins/ppapi/ppb_x509_certificate_private_impl.cc \
-	webkit/plugins/ppapi/quota_file_io.cc \
-	webkit/plugins/ppapi/resource_creation_impl.cc \
-	webkit/plugins/ppapi/resource_helper.cc \
-	webkit/plugins/ppapi/url_request_info_util.cc \
-	webkit/plugins/ppapi/usb_key_code_conversion.cc \
-	webkit/plugins/ppapi/v8_var_converter.cc \
 	webkit/plugins/sad_plugin.cc
 
 
@@ -149,12 +111,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/webkit \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -277,12 +239,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/webkit \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/webkit/support/plugins.target.darwin-x86.mk b/webkit/support/plugins.target.darwin-x86.mk
index a47110e..06be8fc 100644
--- a/webkit/support/plugins.target.darwin-x86.mk
+++ b/webkit/support/plugins.target.darwin-x86.mk
@@ -32,44 +32,6 @@
 GYP_COPIED_SOURCE_ORIGIN_DIRS :=
 
 LOCAL_SRC_FILES := \
-	webkit/plugins/ppapi/audio_helper.cc \
-	webkit/plugins/ppapi/content_decryptor_delegate.cc \
-	webkit/plugins/ppapi/event_conversion.cc \
-	webkit/plugins/ppapi/host_array_buffer_var.cc \
-	webkit/plugins/ppapi/host_globals.cc \
-	webkit/plugins/ppapi/host_var_tracker.cc \
-	webkit/plugins/ppapi/message_channel.cc \
-	webkit/plugins/ppapi/npapi_glue.cc \
-	webkit/plugins/ppapi/npobject_var.cc \
-	webkit/plugins/ppapi/plugin_module.cc \
-	webkit/plugins/ppapi/plugin_object.cc \
-	webkit/plugins/ppapi/ppapi_interface_factory.cc \
-	webkit/plugins/ppapi/ppapi_plugin_instance.cc \
-	webkit/plugins/ppapi/ppapi_webplugin_impl.cc \
-	webkit/plugins/ppapi/ppb_audio_impl.cc \
-	webkit/plugins/ppapi/ppb_broker_impl.cc \
-	webkit/plugins/ppapi/ppb_buffer_impl.cc \
-	webkit/plugins/ppapi/ppb_file_ref_impl.cc \
-	webkit/plugins/ppapi/ppb_flash_message_loop_impl.cc \
-	webkit/plugins/ppapi/ppb_gpu_blacklist_private_impl.cc \
-	webkit/plugins/ppapi/ppb_graphics_3d_impl.cc \
-	webkit/plugins/ppapi/ppb_image_data_impl.cc \
-	webkit/plugins/ppapi/ppb_network_monitor_private_impl.cc \
-	webkit/plugins/ppapi/ppb_proxy_impl.cc \
-	webkit/plugins/ppapi/ppb_scrollbar_impl.cc \
-	webkit/plugins/ppapi/ppb_tcp_server_socket_private_impl.cc \
-	webkit/plugins/ppapi/ppb_tcp_socket_private_impl.cc \
-	webkit/plugins/ppapi/ppb_uma_private_impl.cc \
-	webkit/plugins/ppapi/ppb_var_deprecated_impl.cc \
-	webkit/plugins/ppapi/ppb_video_decoder_impl.cc \
-	webkit/plugins/ppapi/ppb_widget_impl.cc \
-	webkit/plugins/ppapi/ppb_x509_certificate_private_impl.cc \
-	webkit/plugins/ppapi/quota_file_io.cc \
-	webkit/plugins/ppapi/resource_creation_impl.cc \
-	webkit/plugins/ppapi/resource_helper.cc \
-	webkit/plugins/ppapi/url_request_info_util.cc \
-	webkit/plugins/ppapi/usb_key_code_conversion.cc \
-	webkit/plugins/ppapi/v8_var_converter.cc \
 	webkit/plugins/sad_plugin.cc
 
 
@@ -151,12 +113,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/webkit \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -282,12 +244,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/webkit \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/webkit/support/plugins.target.linux-arm.mk b/webkit/support/plugins.target.linux-arm.mk
index 5ca3470..12e6247 100644
--- a/webkit/support/plugins.target.linux-arm.mk
+++ b/webkit/support/plugins.target.linux-arm.mk
@@ -32,44 +32,6 @@
 GYP_COPIED_SOURCE_ORIGIN_DIRS :=
 
 LOCAL_SRC_FILES := \
-	webkit/plugins/ppapi/audio_helper.cc \
-	webkit/plugins/ppapi/content_decryptor_delegate.cc \
-	webkit/plugins/ppapi/event_conversion.cc \
-	webkit/plugins/ppapi/host_array_buffer_var.cc \
-	webkit/plugins/ppapi/host_globals.cc \
-	webkit/plugins/ppapi/host_var_tracker.cc \
-	webkit/plugins/ppapi/message_channel.cc \
-	webkit/plugins/ppapi/npapi_glue.cc \
-	webkit/plugins/ppapi/npobject_var.cc \
-	webkit/plugins/ppapi/plugin_module.cc \
-	webkit/plugins/ppapi/plugin_object.cc \
-	webkit/plugins/ppapi/ppapi_interface_factory.cc \
-	webkit/plugins/ppapi/ppapi_plugin_instance.cc \
-	webkit/plugins/ppapi/ppapi_webplugin_impl.cc \
-	webkit/plugins/ppapi/ppb_audio_impl.cc \
-	webkit/plugins/ppapi/ppb_broker_impl.cc \
-	webkit/plugins/ppapi/ppb_buffer_impl.cc \
-	webkit/plugins/ppapi/ppb_file_ref_impl.cc \
-	webkit/plugins/ppapi/ppb_flash_message_loop_impl.cc \
-	webkit/plugins/ppapi/ppb_gpu_blacklist_private_impl.cc \
-	webkit/plugins/ppapi/ppb_graphics_3d_impl.cc \
-	webkit/plugins/ppapi/ppb_image_data_impl.cc \
-	webkit/plugins/ppapi/ppb_network_monitor_private_impl.cc \
-	webkit/plugins/ppapi/ppb_proxy_impl.cc \
-	webkit/plugins/ppapi/ppb_scrollbar_impl.cc \
-	webkit/plugins/ppapi/ppb_tcp_server_socket_private_impl.cc \
-	webkit/plugins/ppapi/ppb_tcp_socket_private_impl.cc \
-	webkit/plugins/ppapi/ppb_uma_private_impl.cc \
-	webkit/plugins/ppapi/ppb_var_deprecated_impl.cc \
-	webkit/plugins/ppapi/ppb_video_decoder_impl.cc \
-	webkit/plugins/ppapi/ppb_widget_impl.cc \
-	webkit/plugins/ppapi/ppb_x509_certificate_private_impl.cc \
-	webkit/plugins/ppapi/quota_file_io.cc \
-	webkit/plugins/ppapi/resource_creation_impl.cc \
-	webkit/plugins/ppapi/resource_helper.cc \
-	webkit/plugins/ppapi/url_request_info_util.cc \
-	webkit/plugins/ppapi/usb_key_code_conversion.cc \
-	webkit/plugins/ppapi/v8_var_converter.cc \
 	webkit/plugins/sad_plugin.cc
 
 
@@ -150,12 +112,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/webkit \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -279,12 +241,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/webkit \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/webkit/support/plugins.target.linux-mips.mk b/webkit/support/plugins.target.linux-mips.mk
index 72511a4..7840a17 100644
--- a/webkit/support/plugins.target.linux-mips.mk
+++ b/webkit/support/plugins.target.linux-mips.mk
@@ -32,44 +32,6 @@
 GYP_COPIED_SOURCE_ORIGIN_DIRS :=
 
 LOCAL_SRC_FILES := \
-	webkit/plugins/ppapi/audio_helper.cc \
-	webkit/plugins/ppapi/content_decryptor_delegate.cc \
-	webkit/plugins/ppapi/event_conversion.cc \
-	webkit/plugins/ppapi/host_array_buffer_var.cc \
-	webkit/plugins/ppapi/host_globals.cc \
-	webkit/plugins/ppapi/host_var_tracker.cc \
-	webkit/plugins/ppapi/message_channel.cc \
-	webkit/plugins/ppapi/npapi_glue.cc \
-	webkit/plugins/ppapi/npobject_var.cc \
-	webkit/plugins/ppapi/plugin_module.cc \
-	webkit/plugins/ppapi/plugin_object.cc \
-	webkit/plugins/ppapi/ppapi_interface_factory.cc \
-	webkit/plugins/ppapi/ppapi_plugin_instance.cc \
-	webkit/plugins/ppapi/ppapi_webplugin_impl.cc \
-	webkit/plugins/ppapi/ppb_audio_impl.cc \
-	webkit/plugins/ppapi/ppb_broker_impl.cc \
-	webkit/plugins/ppapi/ppb_buffer_impl.cc \
-	webkit/plugins/ppapi/ppb_file_ref_impl.cc \
-	webkit/plugins/ppapi/ppb_flash_message_loop_impl.cc \
-	webkit/plugins/ppapi/ppb_gpu_blacklist_private_impl.cc \
-	webkit/plugins/ppapi/ppb_graphics_3d_impl.cc \
-	webkit/plugins/ppapi/ppb_image_data_impl.cc \
-	webkit/plugins/ppapi/ppb_network_monitor_private_impl.cc \
-	webkit/plugins/ppapi/ppb_proxy_impl.cc \
-	webkit/plugins/ppapi/ppb_scrollbar_impl.cc \
-	webkit/plugins/ppapi/ppb_tcp_server_socket_private_impl.cc \
-	webkit/plugins/ppapi/ppb_tcp_socket_private_impl.cc \
-	webkit/plugins/ppapi/ppb_uma_private_impl.cc \
-	webkit/plugins/ppapi/ppb_var_deprecated_impl.cc \
-	webkit/plugins/ppapi/ppb_video_decoder_impl.cc \
-	webkit/plugins/ppapi/ppb_widget_impl.cc \
-	webkit/plugins/ppapi/ppb_x509_certificate_private_impl.cc \
-	webkit/plugins/ppapi/quota_file_io.cc \
-	webkit/plugins/ppapi/resource_creation_impl.cc \
-	webkit/plugins/ppapi/resource_helper.cc \
-	webkit/plugins/ppapi/url_request_info_util.cc \
-	webkit/plugins/ppapi/usb_key_code_conversion.cc \
-	webkit/plugins/ppapi/v8_var_converter.cc \
 	webkit/plugins/sad_plugin.cc
 
 
@@ -149,12 +111,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/webkit \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -277,12 +239,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/webkit \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/webkit/support/plugins.target.linux-x86.mk b/webkit/support/plugins.target.linux-x86.mk
index a47110e..06be8fc 100644
--- a/webkit/support/plugins.target.linux-x86.mk
+++ b/webkit/support/plugins.target.linux-x86.mk
@@ -32,44 +32,6 @@
 GYP_COPIED_SOURCE_ORIGIN_DIRS :=
 
 LOCAL_SRC_FILES := \
-	webkit/plugins/ppapi/audio_helper.cc \
-	webkit/plugins/ppapi/content_decryptor_delegate.cc \
-	webkit/plugins/ppapi/event_conversion.cc \
-	webkit/plugins/ppapi/host_array_buffer_var.cc \
-	webkit/plugins/ppapi/host_globals.cc \
-	webkit/plugins/ppapi/host_var_tracker.cc \
-	webkit/plugins/ppapi/message_channel.cc \
-	webkit/plugins/ppapi/npapi_glue.cc \
-	webkit/plugins/ppapi/npobject_var.cc \
-	webkit/plugins/ppapi/plugin_module.cc \
-	webkit/plugins/ppapi/plugin_object.cc \
-	webkit/plugins/ppapi/ppapi_interface_factory.cc \
-	webkit/plugins/ppapi/ppapi_plugin_instance.cc \
-	webkit/plugins/ppapi/ppapi_webplugin_impl.cc \
-	webkit/plugins/ppapi/ppb_audio_impl.cc \
-	webkit/plugins/ppapi/ppb_broker_impl.cc \
-	webkit/plugins/ppapi/ppb_buffer_impl.cc \
-	webkit/plugins/ppapi/ppb_file_ref_impl.cc \
-	webkit/plugins/ppapi/ppb_flash_message_loop_impl.cc \
-	webkit/plugins/ppapi/ppb_gpu_blacklist_private_impl.cc \
-	webkit/plugins/ppapi/ppb_graphics_3d_impl.cc \
-	webkit/plugins/ppapi/ppb_image_data_impl.cc \
-	webkit/plugins/ppapi/ppb_network_monitor_private_impl.cc \
-	webkit/plugins/ppapi/ppb_proxy_impl.cc \
-	webkit/plugins/ppapi/ppb_scrollbar_impl.cc \
-	webkit/plugins/ppapi/ppb_tcp_server_socket_private_impl.cc \
-	webkit/plugins/ppapi/ppb_tcp_socket_private_impl.cc \
-	webkit/plugins/ppapi/ppb_uma_private_impl.cc \
-	webkit/plugins/ppapi/ppb_var_deprecated_impl.cc \
-	webkit/plugins/ppapi/ppb_video_decoder_impl.cc \
-	webkit/plugins/ppapi/ppb_widget_impl.cc \
-	webkit/plugins/ppapi/ppb_x509_certificate_private_impl.cc \
-	webkit/plugins/ppapi/quota_file_io.cc \
-	webkit/plugins/ppapi/resource_creation_impl.cc \
-	webkit/plugins/ppapi/resource_helper.cc \
-	webkit/plugins/ppapi/url_request_info_util.cc \
-	webkit/plugins/ppapi/usb_key_code_conversion.cc \
-	webkit/plugins/ppapi/v8_var_converter.cc \
 	webkit/plugins/sad_plugin.cc
 
 
@@ -151,12 +113,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/webkit \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -282,12 +244,12 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
+	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(gyp_intermediate_dir) \
 	$(gyp_shared_intermediate_dir)/webkit \
 	$(gyp_shared_intermediate_dir)/ui \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/webkit/webkit_storage_browser.target.darwin-arm.mk b/webkit/webkit_storage_browser.target.darwin-arm.mk
index d101dfc..55a29e1 100644
--- a/webkit/webkit_storage_browser.target.darwin-arm.mk
+++ b/webkit/webkit_storage_browser.target.darwin-arm.mk
@@ -196,9 +196,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -315,9 +315,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/webkit/webkit_storage_browser.target.darwin-mips.mk b/webkit/webkit_storage_browser.target.darwin-mips.mk
index 23a0f59..4aca530 100644
--- a/webkit/webkit_storage_browser.target.darwin-mips.mk
+++ b/webkit/webkit_storage_browser.target.darwin-mips.mk
@@ -196,9 +196,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -315,9 +315,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/webkit/webkit_storage_browser.target.darwin-x86.mk b/webkit/webkit_storage_browser.target.darwin-x86.mk
index 0a068cf..998a78a 100644
--- a/webkit/webkit_storage_browser.target.darwin-x86.mk
+++ b/webkit/webkit_storage_browser.target.darwin-x86.mk
@@ -197,9 +197,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -318,9 +318,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/webkit/webkit_storage_browser.target.linux-arm.mk b/webkit/webkit_storage_browser.target.linux-arm.mk
index d101dfc..55a29e1 100644
--- a/webkit/webkit_storage_browser.target.linux-arm.mk
+++ b/webkit/webkit_storage_browser.target.linux-arm.mk
@@ -196,9 +196,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -315,9 +315,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/webkit/webkit_storage_browser.target.linux-mips.mk b/webkit/webkit_storage_browser.target.linux-mips.mk
index 23a0f59..4aca530 100644
--- a/webkit/webkit_storage_browser.target.linux-mips.mk
+++ b/webkit/webkit_storage_browser.target.linux-mips.mk
@@ -196,9 +196,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -315,9 +315,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/webkit/webkit_storage_browser.target.linux-x86.mk b/webkit/webkit_storage_browser.target.linux-x86.mk
index 0a068cf..998a78a 100644
--- a/webkit/webkit_storage_browser.target.linux-x86.mk
+++ b/webkit/webkit_storage_browser.target.linux-x86.mk
@@ -197,9 +197,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -318,9 +318,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/webkit/webkit_storage_common.target.darwin-arm.mk b/webkit/webkit_storage_common.target.darwin-arm.mk
index 489b2ae..7316d19 100644
--- a/webkit/webkit_storage_common.target.darwin-arm.mk
+++ b/webkit/webkit_storage_common.target.darwin-arm.mk
@@ -100,9 +100,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
@@ -186,9 +186,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
diff --git a/webkit/webkit_storage_common.target.darwin-mips.mk b/webkit/webkit_storage_common.target.darwin-mips.mk
index c9ed7c9..b93512f 100644
--- a/webkit/webkit_storage_common.target.darwin-mips.mk
+++ b/webkit/webkit_storage_common.target.darwin-mips.mk
@@ -100,9 +100,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
@@ -186,9 +186,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
diff --git a/webkit/webkit_storage_common.target.darwin-x86.mk b/webkit/webkit_storage_common.target.darwin-x86.mk
index 796c81d..3c53b09 100644
--- a/webkit/webkit_storage_common.target.darwin-x86.mk
+++ b/webkit/webkit_storage_common.target.darwin-x86.mk
@@ -101,9 +101,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
@@ -189,9 +189,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
diff --git a/webkit/webkit_storage_common.target.linux-arm.mk b/webkit/webkit_storage_common.target.linux-arm.mk
index 489b2ae..7316d19 100644
--- a/webkit/webkit_storage_common.target.linux-arm.mk
+++ b/webkit/webkit_storage_common.target.linux-arm.mk
@@ -100,9 +100,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
@@ -186,9 +186,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
diff --git a/webkit/webkit_storage_common.target.linux-mips.mk b/webkit/webkit_storage_common.target.linux-mips.mk
index c9ed7c9..b93512f 100644
--- a/webkit/webkit_storage_common.target.linux-mips.mk
+++ b/webkit/webkit_storage_common.target.linux-mips.mk
@@ -100,9 +100,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
@@ -186,9 +186,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
diff --git a/webkit/webkit_storage_common.target.linux-x86.mk b/webkit/webkit_storage_common.target.linux-x86.mk
index 796c81d..3c53b09 100644
--- a/webkit/webkit_storage_common.target.linux-x86.mk
+++ b/webkit/webkit_storage_common.target.linux-x86.mk
@@ -101,9 +101,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
@@ -189,9 +189,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH) \
 	$(PWD)/frameworks/wilhelm/include \
 	$(PWD)/bionic \
diff --git a/webkit/webkit_storage_renderer.target.darwin-arm.mk b/webkit/webkit_storage_renderer.target.darwin-arm.mk
index a881f3d..5ce8a32 100644
--- a/webkit/webkit_storage_renderer.target.darwin-arm.mk
+++ b/webkit/webkit_storage_renderer.target.darwin-arm.mk
@@ -101,9 +101,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -215,9 +215,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/webkit/webkit_storage_renderer.target.darwin-mips.mk b/webkit/webkit_storage_renderer.target.darwin-mips.mk
index ea2a42d..6fdccc9 100644
--- a/webkit/webkit_storage_renderer.target.darwin-mips.mk
+++ b/webkit/webkit_storage_renderer.target.darwin-mips.mk
@@ -101,9 +101,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -215,9 +215,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/webkit/webkit_storage_renderer.target.darwin-x86.mk b/webkit/webkit_storage_renderer.target.darwin-x86.mk
index de8e129..ad30157 100644
--- a/webkit/webkit_storage_renderer.target.darwin-x86.mk
+++ b/webkit/webkit_storage_renderer.target.darwin-x86.mk
@@ -103,9 +103,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -220,9 +220,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/webkit/webkit_storage_renderer.target.linux-arm.mk b/webkit/webkit_storage_renderer.target.linux-arm.mk
index a881f3d..5ce8a32 100644
--- a/webkit/webkit_storage_renderer.target.linux-arm.mk
+++ b/webkit/webkit_storage_renderer.target.linux-arm.mk
@@ -101,9 +101,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -215,9 +215,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/webkit/webkit_storage_renderer.target.linux-mips.mk b/webkit/webkit_storage_renderer.target.linux-mips.mk
index ea2a42d..6fdccc9 100644
--- a/webkit/webkit_storage_renderer.target.linux-mips.mk
+++ b/webkit/webkit_storage_renderer.target.linux-mips.mk
@@ -101,9 +101,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -215,9 +215,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/webkit/webkit_storage_renderer.target.linux-x86.mk b/webkit/webkit_storage_renderer.target.linux-x86.mk
index de8e129..ad30157 100644
--- a/webkit/webkit_storage_renderer.target.linux-x86.mk
+++ b/webkit/webkit_storage_renderer.target.linux-x86.mk
@@ -103,9 +103,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Debug := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
@@ -220,9 +220,9 @@
 
 # Include paths placed before CFLAGS/CPPFLAGS
 LOCAL_C_INCLUDES_Release := \
-	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
-	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
 	$(gyp_shared_intermediate_dir)/shim_headers/icuuc/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/icui18n/target \
+	$(gyp_shared_intermediate_dir)/shim_headers/ashmem/target \
 	$(LOCAL_PATH)/third_party/khronos \
 	$(LOCAL_PATH)/gpu \
 	$(LOCAL_PATH) \
diff --git a/win8/delegate_execute/chrome_util.cc b/win8/delegate_execute/chrome_util.cc
index e2b9b07..6157dd3 100644
--- a/win8/delegate_execute/chrome_util.cc
+++ b/win8/delegate_execute/chrome_util.cc
@@ -15,7 +15,9 @@
 #include "base/file_util.h"
 #include "base/files/file_path.h"
 #include "base/md5.h"
-#include "base/process_util.h"
+#include "base/process/kill.h"
+#include "base/process/launch.h"
+#include "base/process/process_handle.h"
 #include "base/strings/string_util.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/win/registry.h"
diff --git a/win8/delegate_execute/command_execute_impl.cc b/win8/delegate_execute/command_execute_impl.cc
index eb1e035..722f38c 100644
--- a/win8/delegate_execute/command_execute_impl.cc
+++ b/win8/delegate_execute/command_execute_impl.cc
@@ -11,6 +11,8 @@
 
 #include "base/file_util.h"
 #include "base/path_service.h"
+#include "base/process/launch.h"
+#include "base/process/process_handle.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/win/message_window.h"
 #include "base/win/registry.h"
diff --git a/win8/delegate_execute/command_execute_impl.h b/win8/delegate_execute/command_execute_impl.h
index b968b60..313f2dd 100644
--- a/win8/delegate_execute/command_execute_impl.h
+++ b/win8/delegate_execute/command_execute_impl.h
@@ -12,7 +12,7 @@
 
 #include "base/command_line.h"
 #include "base/files/file_path.h"
-#include "base/process_util.h"
+#include "base/process/process_handle.h"
 #include "win8/delegate_execute/resource.h"       // main symbols
 
 using namespace ATL;
diff --git a/win8/delegate_execute/delegate_execute.cc b/win8/delegate_execute/delegate_execute.cc
index 9a4e83d..549716a 100644
--- a/win8/delegate_execute/delegate_execute.cc
+++ b/win8/delegate_execute/delegate_execute.cc
@@ -14,7 +14,7 @@
 #include "base/command_line.h"
 #include "base/file_util.h"
 #include "base/memory/scoped_ptr.h"
-#include "base/process_util.h"
+#include "base/process/kill.h"
 #include "base/strings/string16.h"
 #include "base/win/scoped_com_initializer.h"
 #include "base/win/scoped_handle.h"
diff --git a/win8/metro_driver/chrome_app_view_ash.cc b/win8/metro_driver/chrome_app_view_ash.cc
index 0fdd932..b98d7ac 100644
--- a/win8/metro_driver/chrome_app_view_ash.cc
+++ b/win8/metro_driver/chrome_app_view_ash.cc
@@ -13,7 +13,6 @@
 #include "base/command_line.h"
 #include "base/message_loop/message_loop.h"
 #include "base/path_service.h"
-#include "base/process_util.h"
 #include "base/threading/thread.h"
 #include "base/win/metro.h"
 #include "base/win/win_util.h"
diff --git a/win8/test/metro_registration_helper.cc b/win8/test/metro_registration_helper.cc
index 202eb73..bcf5644 100644
--- a/win8/test/metro_registration_helper.cc
+++ b/win8/test/metro_registration_helper.cc
@@ -13,8 +13,9 @@
 #include "base/files/file_path.h"
 #include "base/logging.h"
 #include "base/path_service.h"
-#include "base/process.h"
-#include "base/process_util.h"
+#include "base/process/kill.h"
+#include "base/process/launch.h"
+#include "base/process/process.h"
 #include "base/strings/string16.h"
 #include "base/win/scoped_co_mem.h"
 #include "base/win/scoped_comptr.h"
diff --git a/win8/viewer/metro_viewer_process_host.cc b/win8/viewer/metro_viewer_process_host.cc
index a76a493..9b190b5 100644
--- a/win8/viewer/metro_viewer_process_host.cc
+++ b/win8/viewer/metro_viewer_process_host.cc
@@ -10,7 +10,7 @@
 #include "base/file_util.h"
 #include "base/files/file_path.h"
 #include "base/memory/ref_counted.h"
-#include "base/process.h"
+#include "base/process/process.h"
 #include "base/strings/string16.h"
 #include "base/synchronization/waitable_event.h"
 #include "base/time/time.h"