diff --git a/BUILD.gn b/BUILD.gn
index 881028d..75c24c0 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -538,7 +538,7 @@
     ]
   } else if (!is_android && !is_ios) {
     deps += [
-      "//breakpad:symupload",
+      "//breakpad:symupload($host_toolchain)",
       "//media/cast:cast_unittests",
     ]
   }
diff --git a/DEPS b/DEPS
index 9a98b5e..80e0c586 100644
--- a/DEPS
+++ b/DEPS
@@ -39,11 +39,11 @@
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling Skia
   # and whatever else without interference from each other.
-  'skia_revision': '143fd5547c614704d95ec82ff791ae5211b06f2d',
+  'skia_revision': '6f45c1714786a54adec156f2416a14aa142adf05',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling V8
   # and whatever else without interference from each other.
-  'v8_revision': '6c386573cd88f683113881ba21a06c7bfa48f1a0',
+  'v8_revision': '9b426a63539ab720a0d5d70cb8c9f8334cc19e5b',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling swarming_client
   # and whatever else without interference from each other.
@@ -130,7 +130,7 @@
    Var('chromium_git') + '/crashpad/crashpad.git' + '@' + '6c0d42ce9dee55eaa906865191e28df35b32910d',
 
   'src/third_party/icu':
-   Var('chromium_git') + '/chromium/deps/icu.git' + '@' + '94e4b770ce2f6065d4261d29c32683a6099b9d93',
+   Var('chromium_git') + '/chromium/deps/icu.git' + '@' + '42c58d4e49f2250039f0e98d43e0b76e8f5ca024',
 
   'src/third_party/libexif/sources':
    Var('chromium_git') + '/chromium/deps/libexif/sources.git' + '@' + 'ed98343daabd7b4497f97fda972e132e6877c48a',
@@ -280,7 +280,7 @@
 
   'src/third_party/catapult':
     Var('chromium_git') + '/external/github.com/catapult-project/catapult.git' + '@' +
-    'bcbf96d51ccb1dcab12a5c035bf2226e0ec47a12',
+    'e2c6869c72944a7a7a729c7ccc9fdc1f8f90de8e',
 }
 
 
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java
index dd83333..9dd82b1 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java
@@ -19,6 +19,7 @@
 import org.chromium.android_webview.AwSettings;
 import org.chromium.android_webview.test.util.GraphicsTestUtils;
 import org.chromium.android_webview.test.util.JSUtils;
+import org.chromium.base.ThreadUtils;
 import org.chromium.base.test.BaseActivityInstrumentationTestCase;
 import org.chromium.base.test.util.InMemorySharedPreferences;
 import org.chromium.base.test.util.MinAndroidSdkLevel;
@@ -35,7 +36,6 @@
 import java.util.concurrent.Callable;
 import java.util.concurrent.FutureTask;
 import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicReference;
 
 /**
  * A base class for android_webview tests. WebView only runs on KitKat and later,
@@ -417,16 +417,13 @@
     }
 
     public AwTestContainerView createAwTestContainerViewOnMainSync(
-            final AwContentsClient client, final boolean supportsLegacyQuirks) throws Exception {
-        final AtomicReference<AwTestContainerView> testContainerView =
-                new AtomicReference<AwTestContainerView>();
-        getInstrumentation().runOnMainSync(new Runnable() {
+            final AwContentsClient client, final boolean supportsLegacyQuirks) {
+        return ThreadUtils.runOnUiThreadBlockingNoException(new Callable<AwTestContainerView>() {
             @Override
-            public void run() {
-                testContainerView.set(createAwTestContainerView(client, supportsLegacyQuirks));
+            public AwTestContainerView call() {
+                return createAwTestContainerView(client, supportsLegacyQuirks);
             }
         });
-        return testContainerView.get();
     }
 
     public void destroyAwContentsOnMainSync(final AwContents awContents) {
diff --git a/android_webview/native/BUILD.gn b/android_webview/native/BUILD.gn
index b5bc0fd..3a7b91f 100644
--- a/android_webview/native/BUILD.gn
+++ b/android_webview/native/BUILD.gn
@@ -150,7 +150,4 @@
   sources = [
     "permission/aw_permission_request.h",
   ]
-  outputs = [
-    "org/chromium/android_webview/permission/Resource.java",
-  ]
 }
diff --git a/ash/display/display_info.cc b/ash/display/display_info.cc
index 54380aa..b074803 100644
--- a/ash/display/display_info.cc
+++ b/ash/display/display_info.cc
@@ -305,7 +305,7 @@
     // cleared, or has non empty insts.
     if (native_info.clear_overscan_insets())
       overscan_insets_in_dip_.Set(0, 0, 0, 0);
-    else if (!native_info.overscan_insets_in_dip_.empty())
+    else if (!native_info.overscan_insets_in_dip_.IsEmpty())
       overscan_insets_in_dip_ = native_info.overscan_insets_in_dip_;
 
     rotations_ = native_info.rotations_;
@@ -338,7 +338,7 @@
 
 void DisplayInfo::UpdateDisplaySize() {
   size_in_pixel_ = bounds_in_native_.size();
-  if (!overscan_insets_in_dip_.empty()) {
+  if (!overscan_insets_in_dip_.IsEmpty()) {
     gfx::Insets insets_in_pixel =
         overscan_insets_in_dip_.Scale(device_scale_factor_);
     size_in_pixel_.Enlarge(-insets_in_pixel.width(), -insets_in_pixel.height());
diff --git a/ash/display/display_manager.cc b/ash/display/display_manager.cc
index e4643208..14c7383 100644
--- a/ash/display/display_manager.cc
+++ b/ash/display/display_manager.cc
@@ -313,7 +313,7 @@
   for (const auto& display : active_display_list_) {
     DisplayInfo info = GetDisplayInfo(display.id());
     if (info.id() == display_id) {
-      if (insets_in_dip.empty()) {
+      if (insets_in_dip.IsEmpty()) {
         info.set_clear_overscan_insets(true);
       } else {
         info.set_clear_overscan_insets(false);
diff --git a/ash/system/chromeos/tray_display.cc b/ash/system/chromeos/tray_display.cc
index f8a0157..32714d4 100644
--- a/ash/system/chromeos/tray_display.cc
+++ b/ash/system/chromeos/tray_display.cc
@@ -209,11 +209,11 @@
         display_manager->GetDisplayInfo(external_id);
     if (display_info.GetActiveRotation() != gfx::Display::ROTATE_0 ||
         display_info.configured_ui_scale() != 1.0f ||
-        !display_info.overscan_insets_in_dip().empty()) {
+        !display_info.overscan_insets_in_dip().IsEmpty()) {
       name = l10n_util::GetStringFUTF16(
           IDS_ASH_STATUS_TRAY_DISPLAY_ANNOTATED_NAME,
           name, GetDisplaySize(external_id));
-    } else if (display_info.overscan_insets_in_dip().empty() &&
+    } else if (display_info.overscan_insets_in_dip().IsEmpty() &&
                display_info.has_overscan()) {
       name = l10n_util::GetStringFUTF16(
           IDS_ASH_STATUS_TRAY_DISPLAY_ANNOTATED_NAME,
@@ -268,7 +268,7 @@
         GetDisplayManager()->first_display_id());
     return display_info.GetActiveRotation() != gfx::Display::ROTATE_0 ||
            display_info.configured_ui_scale() != 1.0f ||
-           !display_info.overscan_insets_in_dip().empty() ||
+           !display_info.overscan_insets_in_dip().IsEmpty() ||
            display_info.has_overscan();
   }
 
diff --git a/ash/test/ash_test_helper.cc b/ash/test/ash_test_helper.cc
index 6658576..995b9f50 100644
--- a/ash/test/ash_test_helper.cc
+++ b/ash/test/ash_test_helper.cc
@@ -32,7 +32,6 @@
 #if defined(OS_CHROMEOS)
 #include "chromeos/audio/cras_audio_handler.h"
 #include "chromeos/dbus/dbus_thread_manager.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
 #endif
 
 #if defined(OS_WIN)
@@ -90,13 +89,8 @@
   // Create DBusThreadManager for testing.
   if (!chromeos::DBusThreadManager::IsInitialized()) {
     chromeos::DBusThreadManager::Initialize();
-    bluez::BluezDBusManager::Initialize(
-        chromeos::DBusThreadManager::Get()->GetSystemBus(),
-        chromeos::DBusThreadManager::Get()->IsUsingStub(
-            chromeos::DBusClientBundle::BLUETOOTH));
     dbus_thread_manager_initialized_ = true;
   }
-
   // Create CrasAudioHandler for testing since g_browser_process is not
   // created in AshTestBase tests.
   chromeos::CrasAudioHandler::InitializeForTesting();
@@ -143,7 +137,6 @@
 #if defined(OS_CHROMEOS)
   chromeos::CrasAudioHandler::Shutdown();
   if (dbus_thread_manager_initialized_) {
-    bluez::BluezDBusManager::Shutdown();
     chromeos::DBusThreadManager::Shutdown();
     dbus_thread_manager_initialized_ = false;
   }
diff --git a/ash/wm/resize_handle_window_targeter.cc b/ash/wm/resize_handle_window_targeter.cc
index 8ee6924c..4ef1abc3 100644
--- a/ash/wm/resize_handle_window_targeter.cc
+++ b/ash/wm/resize_handle_window_targeter.cc
@@ -70,7 +70,7 @@
       insets = frame_border_inset_;
     }
 
-    if (!insets.empty()) {
+    if (!insets.IsEmpty()) {
       gfx::Rect bounds = gfx::Rect(window_->bounds().size());
       bounds.Inset(insets);
       if (!bounds.Contains(event->location()))
diff --git a/base/BUILD.gn b/base/BUILD.gn
index 6418ee3..8cbde649e 100644
--- a/base/BUILD.gn
+++ b/base/BUILD.gn
@@ -1722,12 +1722,6 @@
       "android/library_loader/library_loader_hooks.h",
       "memory/memory_pressure_listener.h",
     ]
-    outputs = [
-      "org/chromium/base/ApplicationState.java",
-      "org/chromium/base/library_loader/LibraryLoadFromApkStatusCodes.java",
-      "org/chromium/base/library_loader/LibraryProcessType.java",
-      "org/chromium/base/MemoryPressureLevel.java",
-    ]
   }
 
   # GYP: //base/base.gyp:base_native_libraries_gen
diff --git a/base/debug/stack_trace_posix.cc b/base/debug/stack_trace_posix.cc
index 9d0e6515..d8eb005 100644
--- a/base/debug/stack_trace_posix.cc
+++ b/base/debug/stack_trace_posix.cc
@@ -344,7 +344,7 @@
     { " trp: ", context->uc_mcontext.gregs[REG_TRAPNO] },
     { " msk: ", context->uc_mcontext.gregs[REG_OLDMASK] },
     { " cr2: ", context->uc_mcontext.gregs[REG_CR2] },
-#endif  // ARCH_CPU_32_BITS
+#endif
   };
 
 #if ARCH_CPU_32_BITS
@@ -363,13 +363,52 @@
       PrintToStderr("\n");
   }
   PrintToStderr("\n");
-#endif  // ARCH_CPU_X86_FAMILY
-#endif  // defined(OS_LINUX)
+#endif
+#elif defined(OS_MACOSX)
+  // TODO(shess): Port to 64-bit, and ARM architecture (32 and 64-bit).
+#if ARCH_CPU_X86_FAMILY && ARCH_CPU_32_BITS
+  ucontext_t* context = reinterpret_cast<ucontext_t*>(void_context);
+  size_t len;
+
+  // NOTE: Even |snprintf()| is not on the approved list for signal
+  // handlers, but buffered I/O is definitely not on the list due to
+  // potential for |malloc()|.
+  len = static_cast<size_t>(
+      snprintf(buf, sizeof(buf),
+               "ax: %x, bx: %x, cx: %x, dx: %x\n",
+               context->uc_mcontext->__ss.__eax,
+               context->uc_mcontext->__ss.__ebx,
+               context->uc_mcontext->__ss.__ecx,
+               context->uc_mcontext->__ss.__edx));
+  write(STDERR_FILENO, buf, std::min(len, sizeof(buf) - 1));
+
+  len = static_cast<size_t>(
+      snprintf(buf, sizeof(buf),
+               "di: %x, si: %x, bp: %x, sp: %x, ss: %x, flags: %x\n",
+               context->uc_mcontext->__ss.__edi,
+               context->uc_mcontext->__ss.__esi,
+               context->uc_mcontext->__ss.__ebp,
+               context->uc_mcontext->__ss.__esp,
+               context->uc_mcontext->__ss.__ss,
+               context->uc_mcontext->__ss.__eflags));
+  write(STDERR_FILENO, buf, std::min(len, sizeof(buf) - 1));
+
+  len = static_cast<size_t>(
+      snprintf(buf, sizeof(buf),
+               "ip: %x, cs: %x, ds: %x, es: %x, fs: %x, gs: %x\n",
+               context->uc_mcontext->__ss.__eip,
+               context->uc_mcontext->__ss.__cs,
+               context->uc_mcontext->__ss.__ds,
+               context->uc_mcontext->__ss.__es,
+               context->uc_mcontext->__ss.__fs,
+               context->uc_mcontext->__ss.__gs));
+  write(STDERR_FILENO, buf, std::min(len, sizeof(buf) - 1));
+#endif  // ARCH_CPU_32_BITS
+#endif  // defined(OS_MACOSX)
 
   PrintToStderr("[end of stack trace]\n");
 
-  if (::signal(signal, SIG_DFL) == SIG_ERR)
-    _exit(1);
+  _exit(1);
 }
 
 class PrintBacktraceOutputHandler : public BacktraceOutputHandler {
diff --git a/blimp/engine/Dockerfile b/blimp/engine/Dockerfile
index 21a4d224..65e985a 100644
--- a/blimp/engine/Dockerfile
+++ b/blimp/engine/Dockerfile
@@ -17,6 +17,11 @@
 RUN mv /engine/chrome_sandbox /engine/chrome-sandbox
 RUN chown -R blimp_user /engine
 
+# TODO(sriramsr): Under Docker on GCE, the sandbox fails unless it's setuid
+# (crbug.com/551140).
+RUN chown root /engine/chrome-sandbox
+RUN chmod 4755 /engine/chrome-sandbox
+
 USER blimp_user
 WORKDIR "/engine"
 
diff --git a/build/android/gyp/java_cpp_enum.py b/build/android/gyp/java_cpp_enum.py
index 73c6de88..a0c9a8fa 100755
--- a/build/android/gyp/java_cpp_enum.py
+++ b/build/android/gyp/java_cpp_enum.py
@@ -11,6 +11,7 @@
 import os
 from string import Template
 import sys
+import zipfile
 
 from util import build_utils
 
@@ -233,8 +234,7 @@
   return os.sep.join(script_components[build_index:])
 
 
-def DoGenerate(output_dir, source_paths, print_output_only=False):
-  output_paths = []
+def DoGenerate(source_paths):
   for source_path in source_paths:
     enum_definitions = DoParseHeaderFile(source_path)
     if not enum_definitions:
@@ -245,12 +245,9 @@
     for enum_definition in enum_definitions:
       package_path = enum_definition.enum_package.replace('.', os.path.sep)
       file_name = enum_definition.class_name + '.java'
-      output_path = os.path.join(output_dir, package_path, file_name)
-      output_paths.append(output_path)
-      if not print_output_only:
-        build_utils.MakeDirectory(os.path.dirname(output_path))
-        DoWriteOutput(source_path, output_path, enum_definition)
-  return output_paths
+      output_path = os.path.join(package_path, file_name)
+      output = GenerateOutput(source_path, enum_definition)
+      yield output_path, output
 
 
 def DoParseHeaderFile(path):
@@ -297,10 +294,6 @@
   return template.substitute(values)
 
 
-def DoWriteOutput(source_path, output_path, enum_definition):
-  with open(output_path, 'w') as out_file:
-    out_file.write(GenerateOutput(source_path, enum_definition))
-
 def AssertFilesList(output_paths, assert_files_list):
   actual = set(output_paths)
   expected = set(assert_files_list)
@@ -311,32 +304,57 @@
                     'add %s and remove %s.' % (need_to_add, need_to_remove))
 
 def DoMain(argv):
-  usage = 'usage: %prog [options] output_dir input_file(s)...'
+  usage = 'usage: %prog [options] [output_dir] input_file(s)...'
   parser = optparse.OptionParser(usage=usage)
 
   parser.add_option('--assert_file', action="append", default=[],
                     dest="assert_files_list", help='Assert that the given '
                     'file is an output. There can be multiple occurrences of '
                     'this flag.')
+  parser.add_option('--srcjar',
+                    help='When specified, a .srcjar at the given path is '
+                    'created instead of individual .java files.')
   parser.add_option('--print_output_only', help='Only print output paths.',
                     action='store_true')
   parser.add_option('--verbose', help='Print more information.',
                     action='store_true')
 
   options, args = parser.parse_args(argv)
-  if len(args) < 2:
-    parser.error('Need to specify output directory and at least one input file')
-  output_paths = DoGenerate(args[0], args[1:],
-                            print_output_only=options.print_output_only)
+  if options.srcjar:
+    if options.print_output_only:
+      parser.error('--print_output_only does not work with --srcjar')
+    if options.assert_files_list:
+      parser.error('--assert_file does not work with --srcjar')
 
-  if options.assert_files_list:
-    AssertFilesList(output_paths, options.assert_files_list)
+    with zipfile.ZipFile(options.srcjar, 'w', zipfile.ZIP_STORED) as srcjar:
+      for output_path, data in DoGenerate(args):
+        srcjar.writestr(build_utils.CreateHermeticZipInfo(output_path), data)
+  else:
+    # TODO(agrieve): Delete this non-srcjar branch once GYP is gone.
+    if len(args) < 2:
+      parser.error(
+          'Need to specify output directory and at least one input file')
 
-  if options.verbose:
-    print 'Output paths:'
-    print '\n'.join(output_paths)
+    output_dir = args[0]
+    output_paths = []
+    for output_path, data in DoGenerate(args[1:]):
+      full_path = os.path.join(output_dir, output_path)
+      output_paths.append(full_path)
+      if not options.print_output_only:
+        build_utils.MakeDirectory(os.path.dirname(full_path))
+        with open(full_path, 'w') as out_file:
+          out_file.write(data)
 
-  return ' '.join(output_paths)
+    if options.assert_files_list:
+      AssertFilesList(output_paths, options.assert_files_list)
+
+    if options.verbose:
+      print 'Output paths:'
+      print '\n'.join(output_paths)
+
+    # Used by GYP.
+    return ' '.join(output_paths)
+
 
 if __name__ == '__main__':
   DoMain(sys.argv[1:])
diff --git a/build/android/gyp/java_cpp_enum_tests.py b/build/android/gyp/java_cpp_enum_tests.py
index 94730a50..902bbfa 100755
--- a/build/android/gyp/java_cpp_enum_tests.py
+++ b/build/android/gyp/java_cpp_enum_tests.py
@@ -418,7 +418,8 @@
       original_do_parse = java_cpp_enum.DoParseHeaderFile
       try:
         java_cpp_enum.DoParseHeaderFile = lambda _: []
-        java_cpp_enum.DoGenerate('dir', ['file'])
+        for _ in java_cpp_enum.DoGenerate(['file']):
+          pass
       finally:
         java_cpp_enum.DoParseHeaderFile = original_do_parse
 
diff --git a/build/android/gyp/util/build_utils.py b/build/android/gyp/util/build_utils.py
index dcaa7e9..94935d2d 100644
--- a/build/android/gyp/util/build_utils.py
+++ b/build/android/gyp/util/build_utils.py
@@ -224,6 +224,14 @@
       z.extract(name, path)
 
 
+def CreateHermeticZipInfo(zip_path):
+  """Creates a ZipInfo with a zero'ed out timestamp."""
+  CheckZipPath(zip_path)
+  zipinfo = zipfile.ZipInfo(filename=zip_path, date_time=HERMETIC_TIMESTAMP)
+  zipinfo.external_attr = HERMETIC_FILE_ATTR
+  return zipinfo
+
+
 def DoZip(inputs, output, base_dir=None):
   """Creates a zip file from a list of files.
 
@@ -242,12 +250,9 @@
   input_tuples.sort(key=lambda tup: tup[0])
   with zipfile.ZipFile(output, 'w') as outfile:
     for zip_path, fs_path in input_tuples:
-      CheckZipPath(zip_path)
-      zipinfo = zipfile.ZipInfo(filename=zip_path, date_time=HERMETIC_TIMESTAMP)
-      zipinfo.external_attr = HERMETIC_FILE_ATTR
       with file(fs_path) as f:
         contents = f.read()
-      outfile.writestr(zipinfo, contents)
+      outfile.writestr(CreateHermeticZipInfo(zip_path), contents)
 
 
 def ZipDir(output, base_dir):
@@ -272,13 +277,13 @@
     for in_file in inputs:
       with zipfile.ZipFile(in_file, 'r') as in_zip:
         for name in in_zip.namelist():
+          # Ignore directories.
+          if name[-1] == '/':
+            continue
           dst_name = path_transform(name, in_file)
           already_added = dst_name in added_names
           if not already_added and not MatchesGlob(dst_name, exclude_patterns):
-            zipinfo = zipfile.ZipInfo(filename=dst_name,
-                                      date_time=HERMETIC_TIMESTAMP)
-            zipinfo.external_attr = HERMETIC_FILE_ATTR
-            out_zip.writestr(zipinfo, in_zip.read(name))
+            out_zip.writestr(CreateHermeticZipInfo(dst_name), in_zip.read(name))
             added_names.add(dst_name)
 
 
diff --git a/build/config/BUILD.gn b/build/config/BUILD.gn
index 9e5e776..cd15c48 100644
--- a/build/config/BUILD.gn
+++ b/build/config/BUILD.gn
@@ -173,9 +173,6 @@
   if (enable_webrtc) {
     defines += [ "ENABLE_WEBRTC=1" ]
   }
-  if (disable_ftp_support) {
-    defines += [ "DISABLE_FTP_SUPPORT=1" ]
-  }
   if (!enable_nacl) {
     defines += [ "DISABLE_NACL" ]
   }
diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni
index aa0a426a..8441f9f 100644
--- a/build/config/android/rules.gni
+++ b/build/config/android/rules.gni
@@ -327,72 +327,35 @@
 #     enum contained in the sources files the script will generate a .java
 #     file with the same name as the name of the enum.
 #
-#   outputs: list of outputs, relative to the output_dir. These paths are
-#     verified at build time by the script. To get the list programatically run:
-#       python build/android/gyp/java_cpp_enum.py \
-#         --print_output_only . path/to/header/file.h
-#
 # Example
 #   java_cpp_enum("foo_generated_enum") {
 #     sources = [
 #       "src/native_foo_header.h",
 #     ]
-#     outputs = [
-#       "org/chromium/FooEnum.java",
-#     ]
 #   }
 template("java_cpp_enum") {
-  set_sources_assignment_filter([])
-  forward_variables_from(invoker, [ "testonly" ])
-
-  assert(defined(invoker.sources))
-  assert(defined(invoker.outputs))
-
-  generate_enum_target_name = "${target_name}__generate_enum"
-  zip_srcjar_target_name = "${target_name}__zip_srcjar"
-  final_target_name = target_name
-
-  action(generate_enum_target_name) {
-    visibility = [ ":$zip_srcjar_target_name" ]
-
+  action(target_name) {
     # The sources aren't compiled so don't check their dependencies.
     check_includes = false
+    set_sources_assignment_filter([])
 
-    sources = invoker.sources
+    assert(defined(invoker.sources))
+    forward_variables_from(invoker,
+                           [
+                             "sources",
+                             "testonly",
+                             "visibility",
+                           ])
+
     script = "//build/android/gyp/java_cpp_enum.py"
-    gen_dir = "${target_gen_dir}/${target_name}/enums"
-    outputs =
-        get_path_info(rebase_path(invoker.outputs, ".", gen_dir), "abspath")
 
-    args = []
-    foreach(output, rebase_path(outputs, root_build_dir)) {
-      args += [
-        "--assert_file",
-        output,
-      ]
-    }
-    args += [ rebase_path(gen_dir, root_build_dir) ]
-    args += rebase_path(invoker.sources, root_build_dir)
-  }
+    _srcjar_path = "${target_gen_dir}/${target_name}.srcjar"
+    _rebased_srcjar_path = rebase_path(_srcjar_path, root_build_dir)
+    _rebased_sources = rebase_path(invoker.sources, root_build_dir)
 
-  generate_enum_outputs = get_target_outputs(":$generate_enum_target_name")
-  base_gen_dir = get_label_info(":$generate_enum_target_name", "target_gen_dir")
-
-  srcjar_path = "${target_gen_dir}/${target_name}.srcjar"
-  zip(zip_srcjar_target_name) {
-    visibility = [ ":$final_target_name" ]
-    inputs = generate_enum_outputs
-    output = srcjar_path
-    base_dir = base_gen_dir
-    deps = [
-      ":$generate_enum_target_name",
-    ]
-  }
-
-  group(final_target_name) {
-    forward_variables_from(invoker, [ "visibility" ])
-    public_deps = [
-      ":$zip_srcjar_target_name",
+    args = [ "--srcjar=$_rebased_srcjar_path" ] + _rebased_sources
+    outputs = [
+      _srcjar_path,
     ]
   }
 }
diff --git a/build/config/features.gni b/build/config/features.gni
index 0f639bed..16c4d3f8 100644
--- a/build/config/features.gni
+++ b/build/config/features.gni
@@ -155,9 +155,6 @@
 # Enable notifications everywhere except iOS.
 enable_notifications = !is_ios
 
-# TODO(brettw) this should be moved to net and only dependents get this define.
-disable_ftp_support = is_ios
-
 enable_web_speech = !is_android && !is_ios
 
 use_dbus = is_linux && !is_chromecast
diff --git a/cc/layers/heads_up_display_layer_impl.cc b/cc/layers/heads_up_display_layer_impl.cc
index 6fa7e81d..4624e64c 100644
--- a/cc/layers/heads_up_display_layer_impl.cc
+++ b/cc/layers/heads_up_display_layer_impl.cc
@@ -103,7 +103,8 @@
   scoped_ptr<ScopedResource> resource =
       ScopedResource::Create(resource_provider);
   resource->Allocate(internal_content_bounds_,
-                     ResourceProvider::TEXTURE_HINT_IMMUTABLE, RGBA_8888);
+                     ResourceProvider::TEXTURE_HINT_IMMUTABLE,
+                     resource_provider->best_texture_format());
   resources_.push_back(resource.Pass());
 }
 
diff --git a/cc/output/direct_renderer.cc b/cc/output/direct_renderer.cc
index 0083427..03425cf5 100644
--- a/cc/output/direct_renderer.cc
+++ b/cc/output/direct_renderer.cc
@@ -516,8 +516,9 @@
   size.Enlarge(enlarge_pass_texture_amount_.x(),
                enlarge_pass_texture_amount_.y());
   if (!texture->id()) {
-    texture->Allocate(
-        size, ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, RGBA_8888);
+    texture->Allocate(size,
+                      ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER,
+                      resource_provider_->best_texture_format());
   }
   DCHECK(texture->id());
 
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
index 8d28b2c..22fea9e5 100644
--- a/cc/output/gl_renderer.cc
+++ b/cc/output/gl_renderer.cc
@@ -838,12 +838,12 @@
       ScopedResource::Create(resource_provider_);
   // CopyTexImage2D fails when called on a texture having immutable storage.
   device_background_texture->Allocate(
-      bounding_rect.size(), ResourceProvider::TEXTURE_HINT_DEFAULT, RGBA_8888);
+      bounding_rect.size(), ResourceProvider::TEXTURE_HINT_DEFAULT,
+      resource_provider_->best_texture_format());
   {
     ResourceProvider::ScopedWriteLockGL lock(resource_provider_,
                                              device_background_texture->id());
-    GetFramebufferTexture(
-        lock.texture_id(), device_background_texture->format(), bounding_rect);
+    GetFramebufferTexture(lock.texture_id(), RGBA_8888, bounding_rect);
   }
   return device_background_texture.Pass();
 }
diff --git a/cc/scheduler/scheduler_state_machine.cc b/cc/scheduler/scheduler_state_machine.cc
index 7e91471..d9ce7676 100644
--- a/cc/scheduler/scheduler_state_machine.cc
+++ b/cc/scheduler/scheduler_state_machine.cc
@@ -963,6 +963,7 @@
 }
 
 void SchedulerStateMachine::DidSwapBuffers() {
+  TRACE_EVENT_ASYNC_BEGIN0("cc", "Scheduler:pending_swaps", this);
   pending_swaps_++;
   swaps_with_current_output_surface_++;
 
@@ -973,6 +974,7 @@
 }
 
 void SchedulerStateMachine::DidSwapBuffersComplete() {
+  TRACE_EVENT_ASYNC_END0("cc", "Scheduler:pending_swaps", this);
   pending_swaps_--;
 }
 
diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn
index 9ec7c75..efbcf20 100644
--- a/chrome/BUILD.gn
+++ b/chrome/BUILD.gn
@@ -920,9 +920,6 @@
     sources = [
       "../components/content_settings/core/common/content_settings.h",
     ]
-    outputs = [
-      "org/chromium/chrome/browser/preferences/website/ContentSettingValues.java",
-    ]
   }
 
   # GYP: //chrome/chrome.gyp:content_settings_type_java
@@ -930,9 +927,6 @@
     sources = [
       "../components/content_settings/core/common/content_settings_types.h",
     ]
-    outputs = [
-      "org/chromium/chrome/browser/ContentSettingsType.java",
-    ]
   }
 
   # GYP: //chrome/chrome.gyp:page_info_connection_type_java
@@ -940,9 +934,6 @@
     sources = [
       "browser/ui/android/website_settings_popup_android.h",
     ]
-    outputs = [
-      "org/chromium/chrome/browser/PageInfoConnectionType.java",
-    ]
   }
 
   # GYP: //chrome/chrome_android.gypi:chrome_android_core
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn
index 787582b..f2a91a2 100644
--- a/chrome/android/BUILD.gn
+++ b/chrome/android/BUILD.gn
@@ -208,16 +208,6 @@
     "//chrome/browser/ssl/security_state_model.h",
     "//chrome/browser/ui/android/infobars/infobar_android.h",
   ]
-  outputs = [
-    "org/chromium/chrome/browser/ActivityTypeIds.java",
-    "org/chromium/chrome/browser/feedback/ConnectivityCheckResult.java",
-    "org/chromium/chrome/browser/ntp/MostVisitedTileType.java",
-    "org/chromium/chrome/browser/ShortcutSource.java",
-    "org/chromium/chrome/browser/TabLoadStatus.java",
-    "org/chromium/chrome/browser/profiles/ProfileAccountManagementMetrics.java",
-    "org/chromium/chrome/browser/ssl/ConnectionSecurityLevel.java",
-    "org/chromium/chrome/browser/infobar/ActionType.java",
-  ]
 }
 
 # GYP: //chrome/chrome_browser.gypi:document_tab_model_info_proto_java
@@ -433,6 +423,14 @@
   native_libs = [ "$root_build_dir/lib.stripped/libchrome_public.so" ]
   native_lib_version_rule = "//build/util:chrome_version_json"
 
+  # Only attempt loading the library from the APK for 64 bit devices
+  # until the number of 32 bit devices which don't support this
+  # approach falls to a minimal level -  http://crbug.com/390618.
+  if (chromium_linker_supported &&
+      (target_cpu == "arm64" || target_cpu == "x64")) {
+    load_library_from_apk = true
+  }
+
   deps = [
     ":chrome_java",
     ":chrome_public",
diff --git a/chrome/android/chrome_apk.gyp b/chrome/android/chrome_apk.gyp
index e1cf10c..e92491d2 100644
--- a/chrome/android/chrome_apk.gyp
+++ b/chrome/android/chrome_apk.gyp
@@ -204,9 +204,8 @@
           # Only attempt loading the library from the APK for 64 bit devices
           # until the number of 32 bit devices which don't support this
           # approach falls to a minimal level -  http://crbug.com/390618.
-          ['component != "shared_library" and profiling==0 and (target_arch == "arm64" or target_arch == "x86_64")', {
-            'load_library_from_zip_file': '<(chrome_apk_load_library_from_zip)',
-            'load_library_from_zip': '<(chrome_apk_load_library_from_zip)',
+          ['chrome_apk_use_chromium_linker==1 and profiling==0 and (target_arch == "arm64" or target_arch == "x86_64")', {
+            'load_library_from_zip': 1,
           }],
         ],
       },
@@ -243,9 +242,8 @@
           # Only attempt loading the library from the APK for 64 bit devices
           # until the number of 32 bit devices which don't support this
           # approach falls to a minimal level -  http://crbug.com/390618.
-          ['component != "shared_library" and profiling==0 and (target_arch == "arm64" or target_arch == "x86_64")', {
-            'load_library_from_zip_file': '<(chrome_apk_load_library_from_zip)',
-            'load_library_from_zip': '<(chrome_apk_load_library_from_zip)',
+          ['chrome_apk_use_chromium_linker==1 and profiling==0 and (target_arch == "arm64" or target_arch == "x86_64")', {
+            'load_library_from_zip': 1,
           }],
         ],
       },
diff --git a/chrome/android/chrome_apk.gypi b/chrome/android/chrome_apk.gypi
index feee8a2b..e21863f 100644
--- a/chrome/android/chrome_apk.gypi
+++ b/chrome/android/chrome_apk.gypi
@@ -7,9 +7,10 @@
       'native_lib_placeholders_file%': '',
       'chrome_apk_use_relocation_packer%': 1,
       'conditions': [
-        # Use the chromium linker unless cygprofile instrumentation is active.
+        # Chromium linker crashes on component builds on Android 4.4. See
+        # b/11379966
         # Chromium linker causes instrumentation to return incorrect results.
-        ['order_profiling == 0', {
+        ['android_must_copy_system_libraries == 0 and order_profiling == 0', {
           'chrome_apk_use_chromium_linker%': 1,
           'chrome_apk_load_library_from_zip%': 1,
         }, {
@@ -24,22 +25,16 @@
     'proguard_enabled': 'true',
     'proguard_flags_paths': ['<(DEPTH)/chrome/android/java/proguard.flags'],
     'additional_input_paths' : ['<@(chrome_android_pak_output_resources)'],
+    'use_chromium_linker': '<(chrome_apk_use_chromium_linker)',
     'conditions': [
-      ['android_must_copy_system_libraries == 0', {
-        # Only enable the chromium linker on regular builds, since the
-        # component build crashes on Android 4.4. See b/11379966
-        'use_chromium_linker': '<(chrome_apk_use_chromium_linker)',
-        'conditions': [
-          ['"<(native_lib_placeholders_file)" != ""', {
-            'native_lib_placeholders': ['<!@(cat <(native_lib_placeholders_file))'],
-          }],
-          # Pack relocations where the chromium linker is enabled. Packing is
-          # a no-op if this is not a Release build.
-          # TODO: Enable packed relocations for x64. See: b/20532404
-          ['chrome_apk_use_chromium_linker == 1 and target_arch != "x64"', {
-            'use_relocation_packer': '<(chrome_apk_use_relocation_packer)',
-          }],
-        ],
+      ['android_must_copy_system_libraries == 0 and "<(native_lib_placeholders_file)" != ""', {
+        'native_lib_placeholders': ['<!@(cat <(native_lib_placeholders_file))'],
+      }],
+      # Pack relocations where the chromium linker is enabled. Packing is a
+      # no-op if this is not a Release build.
+      # TODO: Enable packed relocations for x64. See: b/20532404
+      ['chrome_apk_use_chromium_linker == 1 and target_arch != "x64"', {
+        'use_relocation_packer': '<(chrome_apk_use_relocation_packer)',
       }],
     ],
     'run_findbugs': 0,
diff --git a/chrome/android/java/res/drawable-v21/web_notification_small_icon_background.xml b/chrome/android/java/res/drawable-v21/web_notification_small_icon_background.xml
new file mode 100644
index 0000000..c5c00b34
--- /dev/null
+++ b/chrome/android/java/res/drawable-v21/web_notification_small_icon_background.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2015 The Chromium Authors. All rights reserved.
+     Use of this source code is governed by a BSD-style license that can be
+     found in the LICENSE file. -->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+       android:shape="oval">
+    <!-- Material Grey 500 from the non-public Color notification_icon_bg_color -->
+    <solid android:color="#ff9e9e9e"/>
+</shape>
diff --git a/chrome/android/java/res/layout/web_notification.xml b/chrome/android/java/res/layout/web_notification.xml
index 22d7a61..47d4a25 100644
--- a/chrome/android/java/res/layout/web_notification.xml
+++ b/chrome/android/java/res/layout/web_notification.xml
@@ -60,11 +60,21 @@
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_toEndOf="@id/icon_frame"
-        android:layout_alignParentEnd="true"
+        android:layout_toStartOf="@+id/small_icon_footer"
         android:layout_below="@id/body"
         android:layout_marginEnd="8dp"
         android:singleLine="true"
         android:ellipsize="start"
         style="@style/WebNotificationOrigin"/>
 
+    <ViewStub
+        android:id="@id/small_icon_footer"
+        android:inflatedId="@id/small_icon_footer"
+        android:layout="@layout/web_notification_small_icon"
+        android:layout_width="16dp"
+        android:layout_height="16dp"
+        android:layout_marginEnd="8dp"
+        android:layout_alignParentEnd="true"
+        android:layout_below="@id/body"/>
+
 </RelativeLayout>
diff --git a/chrome/android/java/res/layout/web_notification_big.xml b/chrome/android/java/res/layout/web_notification_big.xml
index e062a84..464187b7 100644
--- a/chrome/android/java/res/layout/web_notification_big.xml
+++ b/chrome/android/java/res/layout/web_notification_big.xml
@@ -104,15 +104,34 @@
             android:contentDescription="@null"
             style="@style/WebNotificationDivider"/>
 
-        <TextView
-            android:id="@+id/origin"
+        <RelativeLayout
             android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginBottom="10dp"
-            android:layout_marginEnd="8dp"
-            android:singleLine="true"
-            android:ellipsize="start"
-            style="@style/WebNotificationOrigin"/>
+            android:layout_height="wrap_content">
+
+            <TextView
+                android:id="@+id/origin"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginBottom="10dp"
+                android:layout_marginEnd="8dp"
+                android:layout_alignParentStart="true"
+                android:layout_alignParentTop="true"
+                android:layout_toStartOf="@+id/small_icon_footer"
+                android:singleLine="true"
+                android:ellipsize="start"
+                style="@style/WebNotificationOrigin"/>
+
+            <ViewStub
+                android:id="@id/small_icon_footer"
+                android:inflatedId="@id/small_icon_footer"
+                android:layout="@layout/web_notification_small_icon"
+                android:layout_width="16dp"
+                android:layout_height="16dp"
+                android:layout_marginEnd="8dp"
+                android:layout_alignParentEnd="true"
+                android:layout_alignParentTop="true"/>
+
+        </RelativeLayout>
 
     </LinearLayout>
 
diff --git a/chrome/android/java/res/layout/web_notification_icon_frame.xml b/chrome/android/java/res/layout/web_notification_icon_frame.xml
index fb53bf5..41e90695 100644
--- a/chrome/android/java/res/layout/web_notification_icon_frame.xml
+++ b/chrome/android/java/res/layout/web_notification_icon_frame.xml
@@ -19,15 +19,14 @@
         android:contentDescription="@null"
         style="@style/WebNotificationLargeIcon"/>
 
-    <ImageView
+    <ViewStub
+        android:id="@+id/small_icon_overlay"
+        android:inflatedId="@id/small_icon_overlay"
+        android:layout="@layout/web_notification_small_icon"
         android:layout_width="16dp"
         android:layout_height="16dp"
         android:layout_marginEnd="8dp"
         android:layout_marginBottom="8dp"
-        android:layout_gravity="bottom|end"
-        android:padding="3dp"
-        android:scaleType="centerInside"
-        android:contentDescription="@null"
-        android:src="@drawable/ic_chrome"/>
+        android:layout_gravity="bottom|end"/>
 
 </FrameLayout>
diff --git a/chrome/android/java/res/layout/web_notification_small_icon.xml b/chrome/android/java/res/layout/web_notification_small_icon.xml
new file mode 100644
index 0000000..9ec184e
--- /dev/null
+++ b/chrome/android/java/res/layout/web_notification_small_icon.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2015 The Chromium Authors. All rights reserved.
+     Use of this source code is governed by a BSD-style license that can be
+     found in the LICENSE file. -->
+
+<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="16dp"
+    android:layout_height="16dp"
+    android:scaleType="centerInside"
+    android:contentDescription="@null"
+    android:src="@drawable/ic_chrome"
+    style="@style/WebNotificationSmallIcon"/>
diff --git a/chrome/android/java/res/values-v17/styles.xml b/chrome/android/java/res/values-v17/styles.xml
index 9fa3071..9cd38408 100644
--- a/chrome/android/java/res/values-v17/styles.xml
+++ b/chrome/android/java/res/values-v17/styles.xml
@@ -331,6 +331,9 @@
     <style name="WebNotificationLargeIcon">
         <item name="android:background">@drawable/notification_template_icon_bg</item>
     </style>
+    <style name="WebNotificationSmallIcon">
+        <item name="android:alpha">0.6</item>
+    </style>
 
     <!-- First Run and Bookmark/recent-tabs dialogs -->
     <style name="DialogWhenLarge" parent="Theme.AppCompat.Light.DialogWhenLarge" >
diff --git a/chrome/android/java/res/values-v21/styles.xml b/chrome/android/java/res/values-v21/styles.xml
index 61c848c..4dc93ed 100644
--- a/chrome/android/java/res/values-v21/styles.xml
+++ b/chrome/android/java/res/values-v21/styles.xml
@@ -105,6 +105,11 @@
         <item name="android:padding">12dp</item>
         <item name="android:background">@null</item>
     </style>
+    <style name="WebNotificationSmallIcon">
+        <item name="android:alpha">1.0</item>
+        <item name="android:background">@drawable/web_notification_small_icon_background</item>
+        <item name="android:padding">3dp</item>
+    </style>
 
     <style name="IncognitoTheme" parent="MainTheme">
         <item name="android:colorPrimary">@color/incognito_primary_color</item>
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelContent.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelContent.java
index eff42fc..23e7907b 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelContent.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelContent.java
@@ -156,6 +156,15 @@
     // ============================================================================================
 
     /**
+     * Creates a ContentViewCore. This method will be overridden by tests.
+     * @param activity The ChromeActivity.
+     * @return The newly created ContentViewCore.
+     */
+    protected ContentViewCore createContentViewCore(ChromeActivity activity) {
+        return new ContentViewCore(activity);
+    }
+
+    /**
      * Create a new ContentViewCore that will be managed by this panel.
      */
     private void createNewContentView() {
@@ -167,7 +176,7 @@
             destroyContentView();
         }
 
-        mContentViewCore = new ContentViewCore(mActivity);
+        mContentViewCore = createContentViewCore(mActivity);
 
         if (mContentViewClient == null) {
             mContentViewClient = new ContentViewClient();
@@ -248,14 +257,6 @@
     }
 
     /**
-     * @return Whether the ContentViewCore was created.
-     */
-    @VisibleForTesting
-    public boolean didCreateContentView() {
-        return mContentViewCore != null;
-    }
-
-    /**
      * Load a URL, this will trigger creation of a new ContentViewCore.
      * @param url The URL that should be loaded.
      */
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java
index 390bf36..7af52d2a4 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java
@@ -810,8 +810,6 @@
      * @param reason The reason for a change in the panel's state.
      */
     public void setPanelState(PanelState state, StateChangeReason reason) {
-        mPanelState = state;
-
         if (state == PanelState.CLOSED) {
             mIsShowing = false;
             onClosed(reason);
@@ -819,6 +817,12 @@
                 || (state == PanelState.MAXIMIZED && !isFullscreenSizePanel())) {
             showPromoViewAtYPosition(getPromoYPx());
         }
+
+        // We should only set the state at the end of this method, in oder to make sure that
+        // all callbacks will be fired before changing the state of the Panel. This prevents
+        // some flakiness on tests since they rely on changes of state to determine when a
+        // particular action has been completed.
+        mPanelState = state;
     }
 
     /**
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java
index 72d8813..6a5e21b 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java
@@ -25,6 +25,7 @@
 import android.text.TextUtils;
 import android.view.WindowManager;
 
+import org.chromium.base.CommandLine;
 import org.chromium.base.FieldTrialList;
 import org.chromium.base.Log;
 import org.chromium.base.SysUtils;
@@ -64,6 +65,7 @@
  */
 public class CustomTabsConnection extends ICustomTabsService.Stub {
     private static final String TAG = "cr.ChromeConnection";
+    private static final String LOG_SERVICE_REQUESTS = "custom-tabs-log-service-requests";
     @VisibleForTesting
     static final String NO_PRERENDERING_KEY =
             "android.support.customtabs.maylaunchurl.NO_PRERENDERING";
@@ -89,6 +91,7 @@
     }
 
     protected final Application mApplication;
+    private final boolean mLogRequests;
     private final AtomicBoolean mWarmupHasBeenCalled = new AtomicBoolean();
     private final ClientManager mClientManager;
     private ExternalPrerenderHandler mExternalPrerenderHandler;
@@ -104,6 +107,7 @@
         super();
         mApplication = application;
         mClientManager = new ClientManager(mApplication);
+        mLogRequests = CommandLine.getInstance().hasSwitch(LOG_SERVICE_REQUESTS);
     }
 
     /**
@@ -113,13 +117,34 @@
     public static CustomTabsConnection getInstance(Application application) {
         if (sInstance.get() == null) {
             ChromeApplication chromeApplication = (ChromeApplication) application;
+            chromeApplication.initCommandLine();
             sInstance.compareAndSet(null, chromeApplication.createCustomTabsConnection());
         }
         return sInstance.get();
     }
 
+    /**
+     * If service requests logging is enabled, logs that a call was made.
+     *
+     * No rate-limiting, can be spammy if the app is misbehaved.
+     *
+     * @param name Call name to log.
+     * @param success Whether the call was successful.
+     */
+    void logCall(String name, boolean success) {
+        if (mLogRequests) {
+            Log.w(TAG, "%s = %b, Calling UID = %d", name, success, Binder.getCallingUid());
+        }
+    }
+
     @Override
     public boolean newSession(ICustomTabsCallback callback) {
+        boolean success = newSessionInternal(callback);
+        logCall("newSession()", success);
+        return success;
+    }
+
+    private boolean newSessionInternal(ICustomTabsCallback callback) {
         ClientManager.DisconnectCallback onDisconnect = new ClientManager.DisconnectCallback() {
             @Override
             public void run(IBinder session) {
@@ -156,7 +181,9 @@
 
     @Override
     public boolean warmup(long flags) {
-        return warmup(true);
+        boolean success = warmupInternal(true);
+        logCall("warmup()", success);
+        return success;
     }
 
     /**
@@ -165,7 +192,7 @@
      * @param mayCreatesparewebcontents true if warmup() can create a spare renderer.
      * @return true for success.
      */
-    private boolean warmup(final boolean mayCreateSpareWebContents) {
+    private boolean warmupInternal(final boolean mayCreateSpareWebContents) {
         // Here and in mayLaunchUrl(), don't do expensive work for background applications.
         if (!isCallerForegroundOrSelf()) return false;
         mClientManager.recordUidHasCalledWarmup(Binder.getCallingUid());
@@ -202,7 +229,14 @@
     }
 
     @Override
-    public boolean mayLaunchUrl(ICustomTabsCallback callback, Uri url, final Bundle extras,
+    public boolean mayLaunchUrl(ICustomTabsCallback callback, Uri url, Bundle extras,
+            List<Bundle> otherLikelyBundles) {
+        boolean success = mayLaunchUrlInternal(callback, url, extras, otherLikelyBundles);
+        logCall("mayLaunchUrl()", success);
+        return success;
+    }
+
+    private boolean mayLaunchUrlInternal(ICustomTabsCallback callback, Uri url, final Bundle extras,
             List<Bundle> otherLikelyBundles) {
         // Don't do anything for unknown schemes. Not having a scheme is
         // allowed, as we allow "www.example.com".
@@ -213,7 +247,7 @@
         // Forbids warmup() from creating a spare renderer, as prerendering wouldn't reuse
         // it. Checking whether prerendering is enabled requires the native library to be loaded,
         // which is not necessarily the case yet.
-        if (!warmup(false)) return false; // Also does the foreground check.
+        if (!warmupInternal(false)) return false; // Also does the foreground check.
 
         final IBinder session = callback.asBinder();
         final String urlString = url.toString();
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnectionService.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnectionService.java
index fe9ba418..4df2b5e 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnectionService.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnectionService.java
@@ -26,13 +26,16 @@
                 .checkIfFirstRunIsNecessary(getApplicationContext(), false) != null;
         if (firstRunNecessary) return null;
         if (!ChromePreferenceManager.getInstance(this).getCustomTabsEnabled()) return null;
-
-        return (IBinder) CustomTabsConnection.getInstance(getApplication());
+        CustomTabsConnection connection = CustomTabsConnection.getInstance(getApplication());
+        connection.logCall("Service#onBind()", true);
+        return (IBinder) connection;
     }
 
     @Override
     public boolean onUnbind(Intent intent) {
         super.onUnbind(intent);
+        CustomTabsConnection connection = CustomTabsConnection.getInstance(getApplication());
+        connection.logCall("Service#onUnbind()", true);
         return false; // No support for onRebind().
     }
 }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/notifications/CustomNotificationBuilder.java b/chrome/android/java/src/org/chromium/chrome/browser/notifications/CustomNotificationBuilder.java
index 542cac0..aa29293 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/notifications/CustomNotificationBuilder.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/notifications/CustomNotificationBuilder.java
@@ -8,6 +8,7 @@
 import android.app.PendingIntent;
 import android.content.Context;
 import android.graphics.Bitmap;
+import android.os.Build;
 import android.support.v4.app.NotificationCompat;
 import android.support.v4.app.NotificationCompat.Action;
 import android.text.format.DateFormat;
@@ -75,6 +76,14 @@
             }
         }
 
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+            compactView.setViewVisibility(R.id.small_icon_overlay, View.VISIBLE);
+            bigView.setViewVisibility(R.id.small_icon_overlay, View.VISIBLE);
+        } else {
+            compactView.setViewVisibility(R.id.small_icon_footer, View.VISIBLE);
+            bigView.setViewVisibility(R.id.small_icon_footer, View.VISIBLE);
+        }
+
         NotificationCompat.Builder builder = new NotificationCompat.Builder(mContext);
         builder.setTicker(mTickerText);
         builder.setSmallIcon(mSmallIconId);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/bookmark/ManageBookmarkActivityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/bookmark/ManageBookmarkActivityTest.java
index 5188070f..ad9722d9 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/bookmark/ManageBookmarkActivityTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/bookmark/ManageBookmarkActivityTest.java
@@ -11,6 +11,7 @@
 import android.widget.EditText;
 import android.widget.TextView;
 
+import org.chromium.base.ThreadUtils;
 import org.chromium.base.test.util.CommandLineFlags;
 import org.chromium.base.test.util.DisabledTest;
 import org.chromium.base.test.util.Feature;
@@ -26,7 +27,7 @@
 import org.chromium.components.dom_distiller.core.DomDistillerUrlUtils;
 
 import java.util.Locale;
-import java.util.concurrent.atomic.AtomicReference;
+import java.util.concurrent.Callable;
 
 /**
  * Tests the ManageBookmarkActivity, which allows users to add and edit bookmarks.
@@ -69,16 +70,16 @@
 
     private void assertFolderText(final AddEditBookmarkFragment addEditFragment,
             String expectedText) {
-        final AtomicReference<String> actualTextContainer = new AtomicReference<String>();
-        getInstrumentation().runOnMainSync(new Runnable() {
-            @Override
-            public void run() {
-                Button button = (Button) addEditFragment.getView().findViewById(
-                        R.id.bookmark_folder_select);
-                actualTextContainer.set(button.getText().toString());
-            }
-        });
-        assertEquals(expectedText, actualTextContainer.get());
+        String actualTextContainer = ThreadUtils.runOnUiThreadBlockingNoException(
+                new Callable<String>() {
+                    @Override
+                    public String call() {
+                        Button button = (Button) addEditFragment.getView().findViewById(
+                                R.id.bookmark_folder_select);
+                        return button.getText().toString();
+                    }
+                });
+        assertEquals(expectedText, actualTextContainer);
     }
 
     @SmallTest
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchFakeServer.java b/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchFakeServer.java
index de6f1c71..2cbed01 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchFakeServer.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchFakeServer.java
@@ -10,9 +10,14 @@
 import org.chromium.chrome.browser.compositor.bottombar.OverlayContentProgressObserver;
 import org.chromium.chrome.browser.compositor.bottombar.OverlayPanelContent;
 import org.chromium.chrome.browser.compositor.bottombar.OverlayPanelContentFactory;
+import org.chromium.content.browser.ContentViewCore;
 
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.TimeoutException;
 
 import javax.annotation.Nullable;
 
@@ -26,28 +31,316 @@
 class ContextualSearchFakeServer
         implements ContextualSearchNetworkCommunicator, OverlayPanelContentFactory {
 
+    private final ContextualSearchPolicy mPolicy;
+
+    private final ContextualSearchManagerTest mManagerTest;
     private final ContextualSearchNetworkCommunicator mBaseManager;
 
     private final OverlayContentDelegate mContentDelegate;
     private final OverlayContentProgressObserver mProgressObserver;
     private final ChromeActivity mActivity;
 
-    private OverlayPanelContent mContent;
+    private final ArrayList<String> mRemovedUrls = new ArrayList<String>();
+
+    private final Map<String, FakeTapSearch> mFakeTapSearches = new HashMap<>();
+    private final Map<String, FakeLongPressSearch> mFakeLongPressSearches = new HashMap<>();
+
+    private FakeTapSearch mActiveFakeTapSearch;
 
     private String mLoadedUrl;
     private int mLoadedUrlCount;
+
     private String mSearchTermRequested;
     private boolean mShouldUseHttps;
 
+    private boolean mDidEverCallContentViewCoreOnShow;
+
+    //============================================================================================
+    // FakeSearch
+    //============================================================================================
+
+    /**
+     * Abstract class that represents a fake contextual search.
+     */
+    public abstract class FakeSearch {
+        private final String mNodeId;
+
+        /**
+         * @param nodeId The id of the node where the touch event will be simulated.
+         */
+        FakeSearch(String nodeId) {
+            mNodeId = nodeId;
+        }
+
+        /**
+         * Simulates a fake search.
+         *
+         * @throws InterruptedException
+         * @throws TimeoutException
+         */
+        public abstract void simulate() throws InterruptedException, TimeoutException;
+
+        /**
+         * @return The search term that will be used in the contextual search.
+         */
+        public abstract String getSearchTerm();
+
+        /**
+         * @return The id of the node where the touch event will be simulated.
+         */
+        public String getNodeId() {
+            return mNodeId;
+        }
+    }
+
+    //============================================================================================
+    // FakeLongPressSearch
+    //============================================================================================
+
+    /**
+     * Class that represents a fake long-press triggered contextual search.
+     */
+    public class FakeLongPressSearch extends FakeSearch {
+        private final String mSearchTerm;
+
+        /**
+         * @param nodeId The id of the node where the touch event will be simulated.
+         * @param searchTerm The expected text that the node should contain.
+         */
+        FakeLongPressSearch(String nodeId, String searchTerm) {
+            super(nodeId);
+
+            mSearchTerm = searchTerm;
+        }
+
+        @Override
+        public void simulate() throws InterruptedException, TimeoutException {
+            mManagerTest.longPressNode(getNodeId());
+            mManagerTest.waitForSelectionToBe(mSearchTerm);
+        }
+
+        @Override
+        public String getSearchTerm() {
+            return mSearchTerm;
+        }
+    }
+
+    //============================================================================================
+    // FakeTapSearch
+    //============================================================================================
+
+    /**
+     * Class that represents a fake tap triggered contextual search.
+     */
+    public class FakeTapSearch extends FakeSearch {
+        private final boolean mIsNetworkUnavailable;
+        private final int mResponseCode;
+        private final String mSearchTerm;
+        private final String mDisplayText;
+        private final String mAlternateTerm;
+        private final boolean mDoPreventPreload;
+        private final int mStartAdjust;
+        private final int mEndAdjust;
+
+        boolean mDidStartResolution;
+        boolean mDidFinishResolution;
+
+        /**
+         * @param nodeId                The id of the node where the touch event will be simulated.
+         * @param isNetworkUnavailable  Whether the network is unavailable.
+         * @param responseCode          The HTTP response code of the resolution.
+         * @param searchTerm            The resolved search term.
+         * @param displayText           The display text.
+         * @param alternateTerm         The alternate text.
+         * @param doPreventPreload      Whether search preload should be prevented.
+         * @param startAdjust           The start adjustment of the selection.
+         * @param endAdjudst            The end adjustment of the selection.
+         */
+        FakeTapSearch(String nodeId, boolean isNetworkUnavailable, int responseCode,
+                      String searchTerm, String displayText, String alternateTerm,
+                      boolean doPreventPreload, int startAdjust, int endAdjudst) {
+            super(nodeId);
+
+            mIsNetworkUnavailable = isNetworkUnavailable;
+            mResponseCode = responseCode;
+            mSearchTerm = searchTerm;
+            mDisplayText = displayText;
+            mAlternateTerm = alternateTerm;
+            mDoPreventPreload = doPreventPreload;
+            mStartAdjust = startAdjust;
+            mEndAdjust = endAdjudst;
+        }
+
+        @Override
+        public void simulate() throws InterruptedException, TimeoutException {
+            mActiveFakeTapSearch = this;
+
+            // When a resolution is needed, the simulation does not start until the system
+            // requests one, and it does not finish until the simulated resolution happens.
+            mDidStartResolution = false;
+            mDidFinishResolution = false;
+
+            mManagerTest.clickNode(getNodeId());
+            mManagerTest.waitForSelectionToBe(mSearchTerm);
+
+            if (mPolicy.shouldPreviousTapResolve(getBasePageUrl())) {
+                // Now wait for the Search Term Resolution to start.
+                mManagerTest.waitForSearchTermResolutionToStart(this);
+
+                // Simulate a Search Term Resolution.
+                simulateSearchTermResolution();
+
+                // Now wait for the simulated Search Term Resolution to finish.
+                mManagerTest.waitForSearchTermResolutionToFinish(this);
+            } else {
+                mDidFinishResolution = true;
+            }
+        }
+
+        @Override
+        public String getSearchTerm() {
+            return mSearchTerm;
+        }
+
+        /**
+         * Notifies that a Search Term Resolution has started.
+         */
+        public void notifySearchTermResolutionStarted() {
+            mDidStartResolution = true;
+        }
+
+        /**
+         * @return Whether the Search Term Resolution has started.
+         */
+        public boolean didStartSearchTermResolution() {
+            return mDidStartResolution;
+        }
+
+        /**
+         * @return Whether the Search Term Resolution has finished.
+         */
+        public boolean didFinishSearchTermResolution() {
+            return mDidFinishResolution;
+        }
+
+        /**
+         * Simulates a Search Term Resolution.
+         */
+        private void simulateSearchTermResolution() throws InterruptedException, TimeoutException {
+            mManagerTest.runOnMainSync(getRunnable());
+        }
+
+        /**
+         * @return A Runnable to handle the fake Search Term Resolution.
+         */
+        private Runnable getRunnable() {
+            return new Runnable() {
+                @Override
+                public void run() {
+                    if (!mDidFinishResolution) {
+                        handleSearchTermResolutionResponse(
+                                mIsNetworkUnavailable, mResponseCode, mSearchTerm, mDisplayText,
+                                mAlternateTerm, mDoPreventPreload, mStartAdjust, mEndAdjust);
+
+                        mActiveFakeTapSearch = null;
+                        mDidFinishResolution = true;
+                    }
+                }
+            };
+        }
+    }
+
+    //============================================================================================
+    // OverlayPanelContentWrapper
+    //============================================================================================
+
+    /**
+     * A wrapper around OverlayPanelContent to be used during tests.
+     */
+    public class OverlayPanelContentWrapper extends OverlayPanelContent {
+        OverlayPanelContentWrapper(OverlayContentDelegate contentDelegate,
+                OverlayContentProgressObserver progressObserver, ChromeActivity activity) {
+            super(contentDelegate, progressObserver, activity);
+        }
+
+        @Override
+        public void loadUrl(String url) {
+            mLoadedUrl = url;
+            mLoadedUrlCount++;
+            super.loadUrl(url);
+        }
+
+        @Override
+        public void removeLastHistoryEntry(String url, long timeInMs) {
+            // Override to prevent call to native code.
+            mRemovedUrls.add(url);
+        }
+
+        @Override
+        protected ContentViewCore createContentViewCore(ChromeActivity activity) {
+            return new ContentViewCoreWrapper(activity);
+        }
+    }
+
+    //============================================================================================
+    // ContentViewCoreWrapper
+    //============================================================================================
+
+    /**
+     * A wrapper around ContentViewCore to be used during tests.
+     */
+    public class ContentViewCoreWrapper extends ContentViewCore {
+        private boolean mIsVisible;
+
+        ContentViewCoreWrapper(ChromeActivity activity) {
+            super(activity);
+        }
+
+        @Override
+        public void destroy() {
+            super.destroy();
+            mIsVisible = false;
+        }
+
+        @Override
+        public void onShow() {
+            super.onShow();
+            mIsVisible = true;
+            mDidEverCallContentViewCoreOnShow = true;
+        }
+
+        @Override
+        public void onHide() {
+            super.onHide();
+            mIsVisible = false;
+        }
+
+        /**
+         * @return Whether the ContentViewCore is visible.
+         */
+        public boolean isVisible() {
+            return mIsVisible;
+        }
+    }
+
+    //============================================================================================
+    // ContextualSearchFakeServer
+    //============================================================================================
+
     /**
      * Constructs a fake Contextual Search server that will callback to the given baseManager.
      * @param baseManager The manager to call back to for server responses.
      */
     @VisibleForTesting
-    ContextualSearchFakeServer(ContextualSearchNetworkCommunicator baseManager,
+    ContextualSearchFakeServer(ContextualSearchPolicy policy,
+            ContextualSearchManagerTest managerTest,
+            ContextualSearchNetworkCommunicator baseManager,
             OverlayContentDelegate contentDelegate,
             OverlayContentProgressObserver progressObserver,
             ChromeActivity activity) {
+        mPolicy = policy;
+
+        mManagerTest = managerTest;
         mBaseManager = baseManager;
 
         mContentDelegate = contentDelegate;
@@ -57,32 +350,84 @@
 
     @Override
     public OverlayPanelContent createNewOverlayPanelContent() {
-        mContent =  new OverlayPanelContent(mContentDelegate, mProgressObserver, mActivity) {
-            @Override
-            public void loadUrl(String url) {
-                mLoadedUrl = url;
-                mLoadedUrlCount++;
-                super.loadUrl(url);
-            }
-
-            @Override
-            public void removeLastHistoryEntry(String url, long timeInMs) {
-                // Override to prevent call to native code.
-            }
-        };
-
-        return mContent;
+        return new OverlayPanelContentWrapper(mContentDelegate, mProgressObserver, mActivity);
     }
 
+    /**
+     * @return The search term requested, or {@code null} if no search term was requested.
+     */
     @VisibleForTesting
-    public boolean didCreateContentView() {
-        return mContent != null ? mContent.didCreateContentView() : false;
+    String getSearchTermRequested() {
+        return mSearchTermRequested;
     }
 
+    /**
+     * @return the loaded search result page URL if any was requested.
+     */
+    @VisibleForTesting
+    String getLoadedUrl() {
+        return mLoadedUrl;
+    }
+
+    /**
+     * @return The number of times we loaded a URL in the Content View.
+     */
+    @VisibleForTesting
+    int getLoadedUrlCount() {
+        return mLoadedUrlCount;
+    }
+
+    /**
+     * Sets whether to return an HTTPS URL instead of HTTP, from {@link #getBasePageUrl}.
+     */
+    @VisibleForTesting
+    void setShouldUseHttps(boolean setting) {
+        mShouldUseHttps = setting;
+    }
+
+    /**
+     * @return
+     */
+    @VisibleForTesting
+    boolean didEverCallContentViewCoreOnShow() {
+        return mDidEverCallContentViewCoreOnShow;
+    }
+
+    /**
+     * Resets the fake server's member data.
+     */
+    @VisibleForTesting
+    void reset() {
+        mLoadedUrl = null;
+        mSearchTermRequested = null;
+        mShouldUseHttps = false;
+        mLoadedUrlCount = 0;
+    }
+
+    //============================================================================================
+    // History Removal Helpers
+    //============================================================================================
+
+    /**
+     * @param url The URL to be checked.
+     * @return Whether the given URL was removed from history.
+     */
+    public boolean hasRemovedUrl(String url) {
+        return mRemovedUrls.contains(url);
+    }
+
+    //============================================================================================
+    // ContextualSearchNetworkCommunicator
+    //============================================================================================
+
     @Override
     public void startSearchTermResolutionRequest(String selection) {
         mLoadedUrl = null;
         mSearchTermRequested = selection;
+
+        if (mActiveFakeTapSearch != null) {
+            mActiveFakeTapSearch.notifySearchTermResolutionStarted();
+        }
     }
 
     @Override
@@ -108,47 +453,58 @@
         return baseUrl;
     }
 
+    //============================================================================================
+    // Fake Searches Helpers
+    //============================================================================================
+
     /**
-     * @return The search term requested, or {@code null} if no search term was requested.
+     * Register fake searches that can be used in tests. Each fake search takes a node ID, which
+     * represents the DOM node that will be touched. The node ID is also used as an ID for the
+     * fake search of a given type (LongPress or Tap). This means that if you need different
+     * behaviors you need to add new DOM nodes with different IDs in the test's HTML file.
      */
-    @VisibleForTesting
-    String getSearchTermRequested() {
-        return mSearchTermRequested;
+    public void registerFakeSearches() {
+        registerFakeLongPressSearch(new FakeLongPressSearch("search", "Search"));
+        registerFakeLongPressSearch(new FakeLongPressSearch("term", "Term"));
+        registerFakeLongPressSearch(new FakeLongPressSearch("resolution", "Resolution"));
+
+        registerFakeTapSearch(new FakeTapSearch("search", false, 200,
+                "Search", "Search", "alternate-term", false, 0, 0));
+        registerFakeTapSearch(new FakeTapSearch("term", false, 200,
+                "Term", "Term", "alternate-term", false, 0, 0));
+        registerFakeTapSearch(new FakeTapSearch("resolution", false, 200,
+                "Resolution", "Resolution", "alternate-term", false, 0, 0));
     }
 
     /**
-     * @return the loaded search result page URL if any was requested.
+     * @param id The ID of the FakeLongPressSearch.
+     * @return The FakeLongPressSearch with the given ID.
      */
-    @VisibleForTesting
-    String getLoadedUrl() {
-        return mLoadedUrl;
+    public FakeLongPressSearch getFakeLongPressSearch(String id) {
+        return mFakeLongPressSearches.get(id);
     }
 
     /**
-     * @return The number of times we loaded a URL in the Content View.
+     * @param id The ID of the FakeTapSearch.
+     * @return The FakeTapSearch with the given ID.
      */
-    @VisibleForTesting
-    int loadedUrlCount() {
-        return mLoadedUrlCount;
+    public FakeTapSearch getFakeTapSearch(String id) {
+        return mFakeTapSearches.get(id);
     }
 
     /**
-     * Sets whether to return an HTTPS URL instead of HTTP, from {@link #getBasePageUrl}.
+     * Register the FakeLongPressSearch.
+     * @param fakeSearch The FakeLongPressSearch to be registered.
      */
-    @VisibleForTesting
-    void setShouldUseHttps(boolean setting) {
-        mShouldUseHttps = setting;
+    private void registerFakeLongPressSearch(FakeLongPressSearch fakeSearch) {
+        mFakeLongPressSearches.put(fakeSearch.getNodeId(), fakeSearch);
     }
 
     /**
-     * Resets the fake server's member data.
+     * Register the FakeTapSearch.
+     * @param fakeSearch The FakeTapSearch to be registered.
      */
-    @VisibleForTesting
-    void reset() {
-        mContent = null;
-        mLoadedUrl = null;
-        mSearchTermRequested = null;
-        mShouldUseHttps = false;
-        mLoadedUrlCount = 0;
+    private void registerFakeTapSearch(FakeTapSearch fakeSearch) {
+        mFakeTapSearches.put(fakeSearch.getNodeId(), fakeSearch);
     }
 }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java
index 0dc28a8..9fe7676 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java
@@ -61,7 +61,12 @@
 
 import java.util.concurrent.TimeoutException;
 
-// TODO(pedrosimonetti): add tests for recent regressions crbug.com/543319.
+// TODO(pedrosimonetti): Create class with limited API to encapsulate the internals of simulations.
+// TODO(pedrosimonetti): Separate tests into different classes grouped by type of tests. Examples:
+// Gestures (Tap, LongPress), Search Term Resolution (resolves, expand selection, prevent preload,
+// translation), Panel interaction (tap, fling up/down, close), Content (creation, loading,
+// visibility, history, delayed load), Tab Promotion, Policy (add tests to check if policies
+// affect the behavior correctly), General (remaining tests), etc.
 
 /**
  * Tests the Contextual Search Manager using instrumentation tests.
@@ -98,18 +103,24 @@
 
         if (mManager != null) {
             mPanel = mManager.getContextualSearchPanel();
-            mFakeServer = new ContextualSearchFakeServer(mManager,
+
+            mSelectionController = mManager.getSelectionController();
+            mPolicy = ContextualSearchPolicy.getInstance(getActivity());
+            mPolicy.overrideDecidedStateForTesting(true);
+            resetCounters();
+
+            mFakeServer = new ContextualSearchFakeServer(
+                    mPolicy,
+                    this,
+                    mManager,
                     mManager.getOverlayContentDelegate(),
                     new OverlayContentProgressObserver(),
                     getActivity());
 
             mPanel.setOverlayPanelContentFactory(mFakeServer);
             mManager.setNetworkCommunicator(mFakeServer);
-            mSelectionController = mManager.getSelectionController();
-            mPolicy = ContextualSearchPolicy.getInstance(getActivity());
 
-            mPolicy.overrideDecidedStateForTesting(true);
-            resetCounters();
+            registerFakeSearches();
         }
 
         IntentFilter filter = new IntentFilter(Intent.ACTION_VIEW);
@@ -119,64 +130,132 @@
                 filter, new Instrumentation.ActivityResult(Activity.RESULT_OK, null), true);
     }
 
-    @Override
-    public void startMainActivity() throws InterruptedException {
-        startMainActivityWithURL(TEST_PAGE);
+    //============================================================================================
+    // Public API
+    //============================================================================================
+
+    /**
+     * Simulates a long-press on the given node.
+     * @param nodeId A string containing the node ID.
+     */
+    public void longPressNode(String nodeId) throws InterruptedException, TimeoutException {
+        Tab tab = getActivity().getActivityTab();
+        DOMUtils.longPressNode(this, tab.getContentViewCore(), nodeId);
+        waitForPanelToPeekAndAssert();
     }
 
     /**
      * Simulates a click on the given node.
      * @param nodeId A string containing the node ID.
      */
-    private void clickNode(String nodeId) throws InterruptedException, TimeoutException {
+    public void clickNode(String nodeId) throws InterruptedException, TimeoutException {
         Tab tab = getActivity().getActivityTab();
         DOMUtils.clickNode(this, tab.getContentViewCore(), nodeId);
     }
 
     /**
-     * Simulates a click on the given word node.
-     * Waits for the bar to peek.
-     * @param nodeId A string containing the node ID.
+     * Waits for the selected text string to be the given string, and asserts.
+     * @param text The string to wait for the selection to become.
      */
-    private void clickWordNode(String nodeId) throws InterruptedException, TimeoutException {
-        clickNode(nodeId);
+    public void waitForSelectionToBe(final String text) throws InterruptedException {
+        assertTrue("Bar never showed desired text.",
+                CriteriaHelper.pollForCriteria(new Criteria() {
+                    @Override
+                    public boolean isSatisfied() {
+                        return TextUtils.equals(text, getSelectedText());
+                    }
+                }, TEST_TIMEOUT, DEFAULT_POLLING_INTERVAL));
+    }
+
+    /**
+     * Waits for the FakeTapSearch to become ready.
+     * @param search A given FakeTapSearch.
+     */
+    public void waitForSearchTermResolutionToStart(
+            final ContextualSearchFakeServer.FakeTapSearch search) throws InterruptedException {
+        assertTrue("Fake Search Term Resolution never started.",
+                CriteriaHelper.pollForCriteria(new Criteria() {
+                    @Override
+                    public boolean isSatisfied() {
+                        return search.didStartSearchTermResolution();
+                    }
+                }, TEST_TIMEOUT, DEFAULT_POLLING_INTERVAL));
+    }
+
+    /**
+     * Waits for the FakeTapSearch to become ready.
+     * @param search A given FakeTapSearch.
+     */
+    public void waitForSearchTermResolutionToFinish(
+            final ContextualSearchFakeServer.FakeTapSearch search) throws InterruptedException {
+        assertTrue("Fake Search was never ready.",
+                CriteriaHelper.pollForCriteria(new Criteria() {
+                    @Override
+                    public boolean isSatisfied() {
+                        return search.didFinishSearchTermResolution();
+                    }
+                }, TEST_TIMEOUT, DEFAULT_POLLING_INTERVAL));
+    }
+
+    /**
+     * Runs the given Runnable in the main thread.
+     * @param runnable The Runnable.
+     */
+    public void runOnMainSync(Runnable runnable) {
+        getInstrumentation().runOnMainSync(runnable);
+    }
+
+    @Override
+    public void startMainActivity() throws InterruptedException {
+        startMainActivityWithURL(TEST_PAGE);
+    }
+
+    //============================================================================================
+    // Fake Searches Helpers
+    //============================================================================================
+
+    /**
+     * Simulates a long-press triggered search.
+     *
+     * @param nodeId The id of the node to be long-pressed.
+     * @throws InterruptedException
+     * @throws TimeoutException
+     */
+    private void simulateLongPressSearch(String nodeId)
+            throws InterruptedException, TimeoutException {
+        ContextualSearchFakeServer.FakeLongPressSearch search =
+                mFakeServer.getFakeLongPressSearch(nodeId);
+        search.simulate();
         waitForPanelToPeekAndAssert();
     }
 
     /**
-     * Simulates a key press.
-     * @param keycode The key's code.
+     * Simulates a tap triggered search.
+     *
+     * @param nodeId The id of the node to be tapped.
+     * @throws InterruptedException
+     * @throws TimeoutException
      */
-    private void pressKey(int keycode) {
-        getInstrumentation().sendKeyDownUpSync(keycode);
-        getInstrumentation().waitForIdleSync();
-    }
-
-    /**
-     * Simulates pressing back button.
-     */
-    private void pressBackButton() {
-        pressKey(KeyEvent.KEYCODE_BACK);
-    }
-
-    /**
-     * @return The selected text.
-     */
-    private String getSelectedText() {
-        return mSelectionController.getSelectedText();
-    }
-
-    /**
-     * Simulates a long-press on the given node.
-     * @param nodeId A string containing the node ID.
-     */
-    private void longPressNode(String nodeId) throws InterruptedException, TimeoutException {
-        Tab tab = getActivity().getActivityTab();
-        DOMUtils.longPressNode(this, tab.getContentViewCore(), nodeId);
+    private void simulateTapSearch(String nodeId) throws InterruptedException, TimeoutException {
+        ContextualSearchFakeServer.FakeTapSearch search = mFakeServer.getFakeTapSearch(nodeId);
+        search.simulate();
+        assertLoadedSearchTermMatches(search.getSearchTerm());
         waitForPanelToPeekAndAssert();
     }
 
     /**
+     * Registers all fake searches to be used in tests.
+     */
+    private void registerFakeSearches() {
+        mFakeServer.registerFakeSearches();
+    }
+
+    //============================================================================================
+    // Fake Response
+    // TODO(pedrosimonetti): remove these methods and use the new infrastructure instead.
+    //============================================================================================
+
+    /**
      * Posts a fake response on the Main thread.
      */
     private final class FakeResponseOnMainThread implements Runnable {
@@ -191,8 +270,8 @@
         private final int mEndAdjust;
 
         public FakeResponseOnMainThread(boolean isNetworkUnavailable, int responseCode,
-                String searchTerm, String displayText, String alternateTerm,
-                boolean doPreventPreload, int startAdjust, int endAdjudst) {
+                                        String searchTerm, String displayText, String alternateTerm,
+                                        boolean doPreventPreload, int startAdjust, int endAdjudst) {
             mIsNetworkUnavailable = isNetworkUnavailable;
             mResponseCode = responseCode;
             mSearchTerm = searchTerm;
@@ -235,6 +314,147 @@
         }
     }
 
+    //============================================================================================
+    // Content Helpers
+    //============================================================================================
+
+    /**
+     * @return The Panel's ContentViewCore.
+     */
+    private ContentViewCore getPanelContentViewCore() {
+        return mPanel.getContentViewCore();
+    }
+
+    /**
+     * @return Whether the Panel's ContentViewCore is visible.
+     */
+    private boolean isContentViewCoreVisible() {
+        ContextualSearchFakeServer.ContentViewCoreWrapper contentViewCore =
+                (ContextualSearchFakeServer.ContentViewCoreWrapper) getPanelContentViewCore();
+        return contentViewCore != null ? contentViewCore.isVisible() : false;
+    }
+
+    /**
+     * Asserts that the Panel's ContentViewCore is created.
+     */
+    private void assertContentViewCoreCreated() {
+        assertNotNull(getPanelContentViewCore());
+    }
+
+    /**
+     * Asserts that the Panel's ContentViewCore is not created.
+     */
+    private void assertNoContentViewCore() {
+        assertNull(getPanelContentViewCore());
+    }
+
+    /**
+     * Asserts that the Panel's ContentViewCore is visible.
+     */
+    private void assertContentViewCoreVisible() {
+        assertTrue(isContentViewCoreVisible());
+    }
+
+    /**
+     * Asserts that the Panel's ContentViewCore onShow() method was never called.
+     */
+    private void assertNeverCalledContentViewCoreOnShow() {
+        assertFalse(mFakeServer.didEverCallContentViewCoreOnShow());
+    }
+
+    /**
+     * Asserts that the Panel's ContentViewCore is created
+     */
+    private void assertContentViewCoreCreatedButNeverMadeVisible() {
+        assertContentViewCoreCreated();
+        assertFalse(isContentViewCoreVisible());
+        assertNeverCalledContentViewCoreOnShow();
+    }
+
+    /**
+     * Fakes navigation of the Content View to the URL was previously requested.
+     * @param isFailure whether the request resulted in a failure.
+     */
+    private void fakeContentViewDidNavigate(boolean isFailure) {
+        String url = mFakeServer.getLoadedUrl();
+        mManager.getOverlayContentDelegate().onMainFrameNavigation(url, isFailure);
+    }
+
+    /**
+     * A ContentViewCore that has some methods stubbed out for testing.
+     * TODO(pedrosimonetti): consider using the real ContentViewCore instead.
+     */
+    private static final class StubbedContentViewCore extends ContentViewCore {
+        private boolean mIsFocusedNodeEditable;
+
+        public StubbedContentViewCore(Context context) {
+            super(context);
+        }
+
+        /**
+         * Mocks the result of isFocusedNodeEditable() for testing.
+         * @param isFocusedNodeEditable Whether the focused node is editable.
+         */
+        public void setIsFocusedNodeEditableForTest(boolean isFocusedNodeEditable) {
+            mIsFocusedNodeEditable = isFocusedNodeEditable;
+        }
+
+        @Override
+        public boolean isFocusedNodeEditable() {
+            return mIsFocusedNodeEditable;
+        }
+    }
+
+    //============================================================================================
+    // Other Helpers
+    // TODO(pedrosimonetti): organize into sections.
+    //============================================================================================
+
+    /**
+     * Simulates a click on the given word node.
+     * Waits for the bar to peek.
+     * @param nodeId A string containing the node ID.
+     */
+    private void clickWordNode(String nodeId) throws InterruptedException, TimeoutException {
+        clickNode(nodeId);
+        waitForPanelToPeekAndAssert();
+    }
+
+    /**
+     * Simulates a key press.
+     * @param keycode The key's code.
+     */
+    private void pressKey(int keycode) {
+        getInstrumentation().sendKeyDownUpSync(keycode);
+        getInstrumentation().waitForIdleSync();
+    }
+
+    /**
+     * Simulates pressing back button.
+     */
+    private void pressBackButton() {
+        pressKey(KeyEvent.KEYCODE_BACK);
+    }
+
+    /**
+     * @return The selected text.
+     */
+    private String getSelectedText() {
+        return mSelectionController.getSelectedText();
+    }
+
+    /**
+     * Asserts that the loaded search term matches the provided value.
+     * @param searchTerm The provided search term.
+     */
+    private void assertLoadedSearchTermMatches(String searchTerm) {
+        boolean doesMatch = false;
+        if (mFakeServer != null) {
+            doesMatch = mFakeServer.getLoadedUrl().contains("q=" + searchTerm);
+        }
+        assertTrue(doesMatch);
+    }
+
     private void assertContainsParameters(String searchTerm, String alternateTerm) {
         assertTrue(mFakeServer == null || mFakeServer.getSearchTermRequested() == null
                 || mFakeServer.getLoadedUrl().contains(searchTerm)
@@ -277,7 +497,7 @@
                 && mFakeServer.getLoadedUrl().contains(LOW_PRIORITY_SEARCH_ENDPOINT));
         assertTrue("Low priority request does not have the required prefetch parameter!",
                 mFakeServer.getLoadedUrl() != null
-                && mFakeServer.getLoadedUrl().contains(CONTEXTUAL_SEARCH_PREFETCH_PARAM));
+                        && mFakeServer.getLoadedUrl().contains(CONTEXTUAL_SEARCH_PREFETCH_PARAM));
     }
 
     private void assertLoadedNormalPriorityUrl() {
@@ -288,22 +508,14 @@
                 && mFakeServer.getLoadedUrl().contains(NORMAL_PRIORITY_SEARCH_ENDPOINT));
         assertTrue("Normal priority request should not have the prefetch parameter, but did!",
                 mFakeServer.getLoadedUrl() != null
-                && !mFakeServer.getLoadedUrl().contains(CONTEXTUAL_SEARCH_PREFETCH_PARAM));
+                        && !mFakeServer.getLoadedUrl().contains(CONTEXTUAL_SEARCH_PREFETCH_PARAM));
     }
 
     private void assertNoSearchesLoaded() {
-        assertEquals(0, mFakeServer.loadedUrlCount());
+        assertEquals(0, mFakeServer.getLoadedUrlCount());
         assertLoadedNoUrl();
     }
 
-    private void assertContentViewCoreCreated() {
-        assertTrue(mFakeServer.didCreateContentView());
-    }
-
-    private void assertNoContentViewCore() {
-        assertFalse(mFakeServer.didCreateContentView());
-    }
-
     /**
      * Asserts that the tap triggered promo counter is enabled and at the specified count.
      */
@@ -321,22 +533,12 @@
     }
 
     /**
-     * Fakes navigation of the Content View with the given httpResult code.
-     * The URL of the navigation is the one requested previously.
-     * @param isFailure If the request resulted in a failure.
-     */
-    private void fakeContentViewDidNavigate(boolean isFailure) {
-        String url = mFakeServer.getLoadedUrl();
-        mManager.getOverlayContentDelegate().onMainFrameNavigation(url, isFailure);
-    }
-
-    /**
      * Waits for the Search Panel (the Search Bar) to peek up from the bottom, and asserts that it
      * did peek.
      * @throws InterruptedException
      */
     private void waitForPanelToPeekAndAssert() throws InterruptedException {
-        assertTrue("Search Bar did not peek.", waitForPanelToEnterState(PanelState.PEEKED));
+        waitForPanelToEnterStateAndAssert(PanelState.PEEKED);
     }
 
     /**
@@ -344,7 +546,7 @@
      * @throws InterruptedException
      */
     private void waitForPanelToExpandAndAssert() throws InterruptedException {
-        assertTrue("Search Panel did not expand.", waitForPanelToEnterState(PanelState.EXPANDED));
+        waitForPanelToEnterStateAndAssert(PanelState.EXPANDED);
     }
 
     /**
@@ -352,8 +554,7 @@
      * @throws InterruptedException
      */
     private void waitForPanelToMaximizeAndAssert() throws InterruptedException {
-        assertTrue(
-                "Search Panel did not maximize.", waitForPanelToEnterState(PanelState.MAXIMIZED));
+        waitForPanelToEnterStateAndAssert(PanelState.MAXIMIZED);
     }
 
     /**
@@ -361,7 +562,7 @@
      * @throws InterruptedException
      */
     private void waitForPanelToCloseAndAssert() throws InterruptedException {
-        assertTrue("Search Panel did not close.", waitForPanelToEnterState(PanelState.CLOSED));
+        waitForPanelToEnterStateAndAssert(PanelState.CLOSED);
     }
 
     /**
@@ -388,6 +589,24 @@
     }
 
     /**
+     * Waits for the Search Panel to enter the given {@code PanelState} and assert.
+     * @throws InterruptedException
+     */
+    private void waitForPanelToEnterStateAndAssert(final PanelState state)
+            throws InterruptedException {
+        boolean success =
+                CriteriaHelper.pollForCriteria(new Criteria() {
+                    @Override
+                    public boolean isSatisfied() {
+                        return mPanel != null
+                                && mPanel.getPanelState() == state;
+                    }
+                }, TEST_TIMEOUT, DEFAULT_POLLING_INTERVAL);
+        assertTrue("Panel did not enter " + state + " state. "
+                + "Instead, the current state is " + mPanel.getPanelState(), success);
+    }
+
+    /**
      * Waits for the manager to finish processing a gesture.
      * Tells the manager that a gesture has started, and then waits for it to complete.
      * @throws InterruptedException
@@ -417,20 +636,6 @@
     }
 
     /**
-     * Waits for the selected text string to be the given string, and asserts.
-     * @param text The string to wait for the selection to become.
-     */
-    private void waitForSelectionToBe(final String text) throws InterruptedException {
-        assertTrue("Bar never showed desired text.",
-                CriteriaHelper.pollForCriteria(new Criteria() {
-                    @Override
-                    public boolean isSatisfied() {
-                        return TextUtils.equals(text, getSelectedText());
-                    }
-                }, TEST_TIMEOUT, DEFAULT_POLLING_INTERVAL));
-    }
-
-    /**
      * Waits for the selection to be dissolved.
      * Use this method any time a test repeatedly establishes and dissolves a selection to ensure
      * that the selection has been completely dissolved before simulating the next selection event.
@@ -454,31 +659,20 @@
         waitForSelectionDissolved();
     }
 
-    /**
-     * A ContentViewCore that has some methods stubbed out for testing.
-     */
-    private static final class StubbedContentViewCore extends ContentViewCore {
-        private boolean mIsFocusedNodeEditable;
-
-        public StubbedContentViewCore(Context context) {
-            super(context);
-        }
-
-        public void setIsFocusedNodeEditableForTest(boolean isFocusedNodeEditable) {
-            mIsFocusedNodeEditable = isFocusedNodeEditable;
-        }
-
-        @Override
-        public boolean isFocusedNodeEditable() {
-            return mIsFocusedNodeEditable;
-        }
+    private void waitToPreventDoubleTapRecognition() throws InterruptedException {
+        // Avoid issues with double-tap detection by ensuring sequential taps
+        // aren't treated as such. Double-tapping can also select words much as
+        // longpress, in turn showing the pins and preventing contextual tap
+        // refinement from nearby taps. The double-tap timeout is sufficiently
+        // short that this shouldn't conflict with tap refinement by the user.
+        Thread.sleep(ViewConfiguration.getDoubleTapTimeout());
     }
 
     /**
-     * Generate a swipe sequence from the give start/end X,Y percentages, for the given steps.
+     * Generate a fling sequence from the given start/end X,Y percentages, for the given steps.
      * Works in either landscape or portrait orientation.
      */
-    private void swipe(float startX, float startY, float endX, float endY, int stepCount) {
+    private void fling(float startX, float startY, float endX, float endY, int stepCount) {
         Point size = new Point();
         getActivity().getWindowManager().getDefaultDisplay().getSize(size);
         float dragStartX = size.x * startX;
@@ -492,31 +686,42 @@
     }
 
     /**
-     * Swipes the panel up to it's expanded size.
+     * Swipes the panel up to its expanded state.
      */
-    private void swipePanelUp() {
-        swipe(0.5f, 0.95f, 0.5f, 0.55f, 1000);
+    private void flingPanelUp() {
+        // TODO(pedrosimonetti): Consider using a swipe method instead.
+        fling(0.5f, 0.95f, 0.5f, 0.55f, 1000);
     }
 
     /**
-     * Swipes the panel up to it's maximized size.
+     * Swipes the panel up to its maximized state.
      */
-    private void swipePanelUpToTop() {
-        swipe(0.5f, 0.95f, 0.5f, 0.05f, 1000);
+    private void flingPanelUpToTop() {
+        // TODO(pedrosimonetti): Consider using a swipe method instead.
+        fling(0.5f, 0.95f, 0.5f, 0.05f, 1000);
     }
 
     /**
      * Scrolls the base page.
      */
     private void scrollBasePage() {
-        swipe(0.f, 0.75f, 0.f, 0.7f, 100);
+        // TODO(pedrosimonetti): Consider using a swipe method instead.
+        fling(0.f, 0.75f, 0.f, 0.7f, 100);
     }
 
     /**
      * Taps the base page near the top.
      */
     private void tapBasePageToClosePanel() throws InterruptedException {
-        tapBasePage(0.1f, 0.1f);
+        // TODO(pedrosimonetti): This is not reliable. Find a better approach.
+        // We use the far right side (x == 0.9f) to prevent simulating a tap on top of an
+        // existing long-press selection (the pins are a tap target). This might not work on RTL.
+        // We are using y == 0.2f because otherwise it will fail for long press cases.
+        // It might be better to get the position of the Panel and tap just about outside
+        // the Panel. I suspect some Flaky tests are caused by this problem (ones involving
+        // long press and trying to close with the bar peeking, with a long press selection
+        // established).
+        tapBasePage(0.9f, 0.2f);
         waitForPanelToCloseAndAssert();
     }
 
@@ -639,6 +844,10 @@
         }, TEST_TIMEOUT, DEFAULT_POLLING_INTERVAL);
     }
 
+    //============================================================================================
+    // Test Cases
+    //============================================================================================
+
     /**
      * Tests whether the contextual search panel hides when omnibox is clicked.
      */
@@ -747,13 +956,13 @@
         fakeResponse(false, 200, "Intelligence", "United States Intelligence", "alternate-term",
                 false);
         assertContainsParameters("Intelligence", "alternate-term");
-        assertEquals(1, mFakeServer.loadedUrlCount());
+        assertEquals(1, mFakeServer.getLoadedUrlCount());
         assertLoadedLowPriorityUrl();
 
         waitForPanelToPeekAndAssert();
-        swipePanelUp();
+        flingPanelUp();
         waitForPanelToExpandAndAssert();
-        assertEquals(1, mFakeServer.loadedUrlCount());
+        assertEquals(1, mFakeServer.getLoadedUrlCount());
         assertLoadedLowPriorityUrl();
     }
 
@@ -768,6 +977,10 @@
         longPressNode("intelligence");
         assertNoContentViewCore();
 
+        // TODO(pedrosimonetti): Long press does not resolve so we shouldn't be faking one.
+        // Consider changing the fake server to create a fake response automatically,
+        // when one is requested by the Manager.
+
         // Fake a search term resolution response.
         fakeResponse(false, 200, "Intelligence", "United States Intelligence", "alternate-term",
                 false);
@@ -776,15 +989,15 @@
         waitForPanelToPeekAndAssert();
         assertLoadedNoUrl();
         assertNoContentViewCore();
-        swipePanelUp();
+        flingPanelUp();
         waitForPanelToExpandAndAssert();
         assertContentViewCoreCreated();
         assertLoadedNormalPriorityUrl();
-        assertEquals(1, mFakeServer.loadedUrlCount());
+        assertEquals(1, mFakeServer.getLoadedUrlCount());
 
         // tap the base page to close.
         tapBasePageToClosePanel();
-        assertEquals(1, mFakeServer.loadedUrlCount());
+        assertEquals(1, mFakeServer.getLoadedUrlCount());
         assertNoContentViewCore();
     }
 
@@ -819,16 +1032,16 @@
         // Fake a search term resolution response.
         fakeResponse(false, 200, "states", "United States Intelligence", "alternate-term", false);
         assertContainsParameters("states", "alternate-term");
-        assertEquals(1, mFakeServer.loadedUrlCount());
+        assertEquals(1, mFakeServer.getLoadedUrlCount());
         assertLoadedLowPriorityUrl();
         assertContentViewCoreCreated();
         tapPeekingBarToExpandAndAssert();
         assertLoadedLowPriorityUrl();
-        assertEquals(1, mFakeServer.loadedUrlCount());
+        assertEquals(1, mFakeServer.getLoadedUrlCount());
 
         // tap the base page to close.
         tapBasePageToClosePanel();
-        assertEquals(1, mFakeServer.loadedUrlCount());
+        assertEquals(1, mFakeServer.getLoadedUrlCount());
         assertNoContentViewCore();
     }
 
@@ -844,20 +1057,20 @@
 
         // We should not make a second-request until we get a good response from the first-request.
         assertLoadedNoUrl();
-        assertEquals(0, mFakeServer.loadedUrlCount());
+        assertEquals(0, mFakeServer.getLoadedUrlCount());
         fakeResponse(false, 200, "states", "United States Intelligence", "alternate-term", false);
         assertLoadedLowPriorityUrl();
-        assertEquals(1, mFakeServer.loadedUrlCount());
+        assertEquals(1, mFakeServer.getLoadedUrlCount());
 
         // When the second request succeeds, we should not issue a new request.
         fakeContentViewDidNavigate(false);
         assertLoadedLowPriorityUrl();
-        assertEquals(1, mFakeServer.loadedUrlCount());
+        assertEquals(1, mFakeServer.getLoadedUrlCount());
 
         // When the bar opens, we should not make any additional request.
         tapPeekingBarToExpandAndAssert();
         assertLoadedLowPriorityUrl();
-        assertEquals(1, mFakeServer.loadedUrlCount());
+        assertEquals(1, mFakeServer.getLoadedUrlCount());
         assertLoadedLowPriorityUrl();
     }
 
@@ -874,20 +1087,20 @@
 
         // We should not make a SERP request until we get a good response from the resolve request.
         assertLoadedNoUrl();
-        assertEquals(0, mFakeServer.loadedUrlCount());
+        assertEquals(0, mFakeServer.getLoadedUrlCount());
         fakeResponse(false, 200, "states", "United States Intelligence", "alternate-term", false);
         assertLoadedLowPriorityUrl();
-        assertEquals(1, mFakeServer.loadedUrlCount());
+        assertEquals(1, mFakeServer.getLoadedUrlCount());
 
         // When the second request fails, we should not issue a new request.
         fakeContentViewDidNavigate(true);
         assertLoadedLowPriorityUrl();
-        assertEquals(1, mFakeServer.loadedUrlCount());
+        assertEquals(1, mFakeServer.getLoadedUrlCount());
 
         // Once the bar opens, we make a new request at normal priority.
         tapPeekingBarToExpandAndAssert();
         assertLoadedNormalPriorityUrl();
-        assertEquals(2, mFakeServer.loadedUrlCount());
+        assertEquals(2, mFakeServer.getLoadedUrlCount());
     }
 
     /**
@@ -1182,7 +1395,7 @@
         waitForPanelToPeekAndAssert();
 
         // Swipe Panel up and wait for it to maximize.
-        swipePanelUpToTop();
+        flingPanelUpToTop();
         waitForPanelToMaximizeAndAssert();
 
         // Create an observer to track that a new tab is created.
@@ -1424,7 +1637,7 @@
         assertLoadedNoUrl();
 
         // Expanding the panel should reset the limit.
-        swipePanelUp();
+        flingPanelUp();
         tapBasePageToClosePanel();
         waitForPanelToCloseAndSelectionDissolved();
 
@@ -1454,6 +1667,7 @@
         assertContainsParameters("states", "alternate-term");
         assertLoadedNormalPriorityUrl();
         assertContentViewCoreCreated();
+        assertContentViewCoreVisible();
     }
 
     /**
@@ -1580,7 +1794,7 @@
     @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE)
     public void testAppMenuSuppressedWhenMaximized() throws InterruptedException, TimeoutException {
         clickWordNode("states");
-        swipePanelUpToTop();
+        flingPanelUpToTop();
         waitForPanelToMaximizeAndAssert();
 
         pressAppMenuKey();
@@ -1978,7 +2192,7 @@
         assertTrue(mPanel.isPeekPromoVisible());
 
         // After expanding the Panel the Promo should be invisible.
-        swipePanelUp();
+        flingPanelUp();
         waitForPanelToExpandAndAssert();
         assertFalse(mPanel.isPeekPromoVisible());
 
@@ -1995,4 +2209,205 @@
         waitForPanelToPeekAndAssert();
         assertFalse(mPanel.isPeekPromoVisible());
     }
+
+    //============================================================================================
+    // Content Tests
+    //============================================================================================
+
+    /**
+     * Tests that tap followed by expand makes Content visible.
+     */
+    @SmallTest
+    @Feature({"ContextualSearch"})
+    @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE)
+    public void testTapContentVisibility() throws InterruptedException, TimeoutException {
+        // Simulate a tap and make sure Content is not visible.
+        simulateTapSearch("search");
+        assertContentViewCoreCreatedButNeverMadeVisible();
+
+        // Expanding the Panel should make the Content visible.
+        tapPeekingBarToExpandAndAssert();
+        assertContentViewCoreVisible();
+
+        // Closing the Panel should destroy the Content.
+        tapBasePageToClosePanel();
+        assertNoContentViewCore();
+    }
+
+    /**
+     * Tests that long press followed by expand creates Content and makes it visible.
+     *
+     */
+    @SmallTest
+    @Feature({"ContextualSearch"})
+    @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE)
+    public void testLongPressContentVisibility() throws InterruptedException, TimeoutException {
+        // Simulate a long press and make sure no Content is created.
+        simulateLongPressSearch("search");
+        assertNoContentViewCore();
+        assertNoSearchesLoaded();
+
+        // Expanding the Panel should make the Content visible.
+        tapPeekingBarToExpandAndAssert();
+        assertContentViewCoreCreated();
+        assertContentViewCoreVisible();
+
+        // Closing the Panel should destroy the Content.
+        tapBasePageToClosePanel();
+        assertNoContentViewCore();
+    }
+
+    /**
+     * Tests that chained tap searches create new Content.
+     */
+    @SmallTest
+    @Feature({"ContextualSearch"})
+    @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE)
+    public void testChainedSearchCreatesNewContent()
+            throws InterruptedException, TimeoutException {
+        // Simulate a tap and make sure Content is not visible.
+        simulateTapSearch("search");
+        assertContentViewCoreCreatedButNeverMadeVisible();
+        assertEquals(1, mFakeServer.getLoadedUrlCount());
+        ContentViewCore cvc1 = getPanelContentViewCore();
+
+        waitToPreventDoubleTapRecognition();
+
+        // Simulate a new tap and make sure a new Content is created.
+        simulateTapSearch("term");
+        assertContentViewCoreCreatedButNeverMadeVisible();
+        assertEquals(2, mFakeServer.getLoadedUrlCount());
+        ContentViewCore cvc2 = getPanelContentViewCore();
+        assertNotSame(cvc1, cvc2);
+
+        waitToPreventDoubleTapRecognition();
+
+        // Simulate a new tap and make sure a new Content is created.
+        simulateTapSearch("resolution");
+        assertContentViewCoreCreatedButNeverMadeVisible();
+        assertEquals(3, mFakeServer.getLoadedUrlCount());
+        ContentViewCore cvc3 = getPanelContentViewCore();
+        assertNotSame(cvc2, cvc3);
+
+        // Closing the Panel should destroy the Content.
+        tapBasePageToClosePanel();
+        assertNoContentViewCore();
+        assertEquals(3, mFakeServer.getLoadedUrlCount());
+    }
+
+    /**
+     * Tests that chained searches make Content visible when opening the Panel.
+     */
+    @SmallTest
+    @Feature({"ContextualSearch"})
+    @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE)
+    public void testChainedSearchContentVisibility()
+            throws InterruptedException, TimeoutException {
+        // Simulate a tap and make sure Content is not visible.
+        simulateTapSearch("search");
+        assertContentViewCoreCreatedButNeverMadeVisible();
+        assertEquals(1, mFakeServer.getLoadedUrlCount());
+        ContentViewCore cvc1 = getPanelContentViewCore();
+
+        waitToPreventDoubleTapRecognition();
+
+        // Now simulate a long press, leaving the Panel peeking.
+        simulateLongPressSearch("resolution");
+        assertNeverCalledContentViewCoreOnShow();
+        assertEquals(1, mFakeServer.getLoadedUrlCount());
+
+        // Swiping the Panel up should load and display the new search.
+        flingPanelUp();
+        waitForPanelToExpandAndAssert();
+        assertContentViewCoreCreated();
+        assertContentViewCoreVisible();
+        assertEquals(2, mFakeServer.getLoadedUrlCount());
+        assertLoadedSearchTermMatches("Resolution");
+        ContentViewCore cvc2 = getPanelContentViewCore();
+        assertNotSame(cvc1, cvc2);
+    }
+
+    //============================================================================================
+    // History Removal Tests
+    //============================================================================================
+
+    /**
+     * Tests that a tap followed by closing the Panel removes the loaded URL from history.
+     */
+    @SmallTest
+    @Feature({"ContextualSearch"})
+    @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE)
+    public void testTapCloseRemovedFromHistory()
+            throws InterruptedException, TimeoutException {
+        // Simulate a tap and make sure a URL was loaded.
+        simulateTapSearch("search");
+        assertEquals(1, mFakeServer.getLoadedUrlCount());
+        String url = mFakeServer.getLoadedUrl();
+
+        // Close the Panel without seeing the Content.
+        tapBasePageToClosePanel();
+
+        // Now check that the URL has been removed from history.
+        assertTrue(mFakeServer.hasRemovedUrl(url));
+    }
+
+    /**
+     * Tests that a tap followed by opening the Panel does not remove the loaded URL from history.
+     */
+    @SmallTest
+    @Feature({"ContextualSearch"})
+    @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE)
+    public void testTapExpandNotRemovedFromHistory()
+            throws InterruptedException, TimeoutException {
+        // Simulate a tap and make sure a URL was loaded.
+        simulateTapSearch("search");
+        assertEquals(1, mFakeServer.getLoadedUrlCount());
+        String url = mFakeServer.getLoadedUrl();
+
+        // Expand Panel so that the Content becomes visible.
+        tapPeekingBarToExpandAndAssert();
+
+        // Close the Panel.
+        tapBasePageToClosePanel();
+
+        // Now check that the URL has not been removed from history, since the Content was seen.
+        assertFalse(mFakeServer.hasRemovedUrl(url));
+    }
+
+    /**
+     * Tests that chained searches without opening the Panel removes all loaded URLs from history.
+     */
+    @SmallTest
+    @Feature({"ContextualSearch"})
+    @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE)
+    public void testChainedTapsRemovedFromHistory()
+            throws InterruptedException, TimeoutException {
+        // Simulate a tap and make sure a URL was loaded.
+        simulateTapSearch("search");
+        String url1 = mFakeServer.getLoadedUrl();
+        assertNotNull(url1);
+
+        waitToPreventDoubleTapRecognition();
+
+        // Simulate another tap and make sure another URL was loaded.
+        simulateTapSearch("term");
+        String url2 = mFakeServer.getLoadedUrl();
+        assertNotSame(url1, url2);
+
+        waitToPreventDoubleTapRecognition();
+
+        // Simulate another tap and make sure another URL was loaded.
+        simulateTapSearch("resolution");
+        String url3 = mFakeServer.getLoadedUrl();
+        assertNotSame(url2, url3);
+
+        // Close the Panel without seeing any Content.
+        tapBasePageToClosePanel();
+
+        // Now check that all three URLs have been removed from history.
+        assertEquals(3, mFakeServer.getLoadedUrlCount());
+        assertTrue(mFakeServer.hasRemovedUrl(url1));
+        assertTrue(mFakeServer.hasRemovedUrl(url2));
+        assertTrue(mFakeServer.hasRemovedUrl(url3));
+    }
 }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/search_engines/TemplateUrlServiceTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/search_engines/TemplateUrlServiceTest.java
index 103ec528..9037daa 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/search_engines/TemplateUrlServiceTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/search_engines/TemplateUrlServiceTest.java
@@ -20,7 +20,6 @@
 import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicReference;
 
 /**
  * Tests for Chrome on Android's usage of the TemplateUrlService API.
@@ -150,18 +149,16 @@
                 observerNotified.set(true);
             }
         };
-        final AtomicReference<TemplateUrlService> templateUrlService =
-                new AtomicReference<TemplateUrlService>();
-        ThreadUtils.runOnUiThreadBlocking(new Runnable() {
-            @Override
-            public void run() {
-                TemplateUrlService service = TemplateUrlService.getInstance();
-                templateUrlService.set(service);
-
-                service.registerLoadListener(listener);
-                service.load();
-            }
-        });
+        final TemplateUrlService templateUrlService = ThreadUtils.runOnUiThreadBlockingNoException(
+                new Callable<TemplateUrlService>() {
+                    @Override
+                    public TemplateUrlService call() {
+                        TemplateUrlService service = TemplateUrlService.getInstance();
+                        service.registerLoadListener(listener);
+                        service.load();
+                        return service;
+                    }
+                });
 
         assertTrue("Observer wasn't notified of TemplateUrlService load.",
                 CriteriaHelper.pollForCriteria(new Criteria() {
@@ -170,6 +167,6 @@
                         return observerNotified.get();
                     }
                 }));
-        return templateUrlService.get();
+        return templateUrlService;
     }
 }
diff --git a/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/FirstRunTest.java b/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/FirstRunTest.java
index e36e28e..27cdd85 100644
--- a/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/FirstRunTest.java
+++ b/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/FirstRunTest.java
@@ -30,6 +30,11 @@
         NO;
     }
 
+    @Override
+    public void startMainActivity() throws InterruptedException {
+        startMainActivityFromLauncher();
+    }
+
     // Test that signing in through FirstRun signs in and starts sync.
     @SmallTest
     @Feature({"Sync"})
diff --git a/chrome/app/chromium_strings.grd b/chrome/app/chromium_strings.grd
index c266231..4e2cbfe 100644
--- a/chrome/app/chromium_strings.grd
+++ b/chrome/app/chromium_strings.grd
@@ -373,7 +373,7 @@
       <message name="IDS_PASSWORD_GENERATION_SUGGESTION" desc="Text shown next to a generated password describing it as a suggestion.">
         Use password generated by Chromium
       </message>
-      <message name="IDS_SAVE_PASSWORD_TITLE_BRAND" desc="The product name used in the title of the save password bubble.">
+      <message name="IDS_PASSWORD_MANAGER_TITLE_BRAND" desc="The product name used in the title of the password bubble.">
         Chromium
       </message>
       <if expr="is_macosx">
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 3c0d2fa..4207f44 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -6027,11 +6027,8 @@
       <message name="IDS_FLAGS_PASSWORD_MANAGER_LINK_DESCRIPTION" desc="Description of the flag to enable showing a link to account central on password settings page">
         Show a link in the password manager settings page to manage your synced passwords online.
       </message>
-      <message name="IDS_PASSWORD_MANAGER_ACCOUNT_CHOOSER_TITLE_SMART_LOCK" desc="The title of the account chooser infobar for Smart Lock users.">
-        Choose an account from your <ph name="LINK_TEXT">$1<ex>Google Smart Lock</ex></ph>
-      </message>
-      <message name="IDS_PASSWORD_MANAGER_ACCOUNT_CHOOSER_TITLE" desc="The title of the password bubble when a credential should be chosen.">
-        Choose an account to login
+      <message name="IDS_PASSWORD_MANAGER_ACCOUNT_CHOOSER_TITLE" desc="The title of the account chooser bubble/infobar.">
+        Choose your account from <ph name="PASSWORD_MANAGER_BRAND">$1<ex>Google Chrome</ex></ph> to sign in
       </message>
       <message name="IDS_PASSWORD_MANAGER_SAVE_PROMPT_FIRST_RUN_EXPERIENCE" desc="The message which explains to the user what is Smart Lock, when the user sees the branded title of the Save prompt for the first time.">
         Smart Lock helps you quickly sign in to apps and sites using passwords you have saved with Google.
@@ -13133,9 +13130,6 @@
       <message name="IDS_MANAGE_PASSWORDS_UNDO" desc="The text that is used in the manage passwords bubble when a password is deleted.">
         Undo
       </message>
-      <message name="IDS_MANAGE_PASSWORDS_CHOOSE_TITLE" desc="The title of the password bubble when a credential should be chosen.">
-        Choose an account from your Google Smart Lock
-      </message>
       <message name="IDS_MANAGE_PASSWORDS_AUTO_SIGNIN_TITLE" desc="The title of the auto-signin toast.">
         Signing in as <ph name="username">$1<ex>chef@google.com</ex></ph>
       </message>
diff --git a/chrome/app/google_chrome_strings.grd b/chrome/app/google_chrome_strings.grd
index 7112a271..0e715e5 100644
--- a/chrome/app/google_chrome_strings.grd
+++ b/chrome/app/google_chrome_strings.grd
@@ -375,7 +375,7 @@
       <message name="IDS_PASSWORD_GENERATION_SUGGESTION" desc="Text shown next to a generated password describing it as a suggestion.">
         Use password generated by Chrome
       </message>
-      <message name="IDS_SAVE_PASSWORD_TITLE_BRAND" desc="The product name used in the title of the save password bubble.">
+      <message name="IDS_PASSWORD_MANAGER_TITLE_BRAND" desc="The product name used in the title of the password bubble.">
         Google Chrome
       </message>
       <if expr="is_macosx">
diff --git a/chrome/browser/android/compositor/layer/crushed_sprite_layer.cc b/chrome/browser/android/compositor/layer/crushed_sprite_layer.cc
index 3d42f459..6c6fd5c 100644
--- a/chrome/browser/android/compositor/layer/crushed_sprite_layer.cc
+++ b/chrome/browser/android/compositor/layer/crushed_sprite_layer.cc
@@ -68,6 +68,10 @@
       for (int i = previous_frame_ + 1; i < sprite_frame; ++i) {
         DrawRectanglesForFrame(resource, i, canvas);
       }
+    } else {
+      // The newly allocated pixels for the SkBitmap need to be cleared if this
+      // is the first or last frame. See crbug.com/549453.
+      canvas->clear(SK_ColorTRANSPARENT);
     }
 
     // Draw the current frame.
diff --git a/chrome/browser/apps/app_browsertest.cc b/chrome/browser/apps/app_browsertest.cc
index db3344de..c62cf7b 100644
--- a/chrome/browser/apps/app_browsertest.cc
+++ b/chrome/browser/apps/app_browsertest.cc
@@ -41,8 +41,8 @@
 #include "extensions/browser/app_window/native_app_window.h"
 #include "extensions/browser/event_router.h"
 #include "extensions/browser/extension_prefs.h"
-#include "extensions/browser/extension_system.h"
-#include "extensions/browser/notification_types.h"
+#include "extensions/browser/extension_registry.h"
+#include "extensions/browser/extension_registry_observer.h"
 #include "extensions/browser/pref_names.h"
 #include "extensions/common/api/app_runtime.h"
 #include "extensions/common/constants.h"
@@ -954,33 +954,36 @@
 
 namespace {
 
-// Simple observer to check for
-// NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED events to ensure
-// installation does or does not occur in certain scenarios.
-class CheckExtensionInstalledObserver : public content::NotificationObserver {
+// Utility class to ensure extension installation does or does not occur in
+// certain scenarios.
+class CheckExtensionInstalledObserver
+    : public extensions::ExtensionRegistryObserver {
  public:
-  CheckExtensionInstalledObserver() : seen_(false) {
-    registrar_.Add(
-        this,
-        extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED,
-        content::NotificationService::AllSources());
+  explicit CheckExtensionInstalledObserver(Profile* profile)
+      : seen_(false), registry_(extensions::ExtensionRegistry::Get(profile)) {
+    registry_->AddObserver(this);
+  }
+  ~CheckExtensionInstalledObserver() override {
+    registry_->RemoveObserver(this);
   }
 
   bool seen() const {
     return seen_;
   }
 
-  // NotificationObserver:
-  void Observe(int type,
-               const content::NotificationSource& source,
-               const content::NotificationDetails& details) override {
+  // ExtensionRegistryObserver:
+  void OnExtensionWillBeInstalled(content::BrowserContext* browser_context,
+                                  const extensions::Extension* extension,
+                                  bool is_update,
+                                  bool from_ephemeral,
+                                  const std::string& old_name) override {
     EXPECT_FALSE(seen_);
     seen_ = true;
   }
 
  private:
   bool seen_;
-  content::NotificationRegistrar registrar_;
+  extensions::ExtensionRegistry* registry_;
 };
 
 }  // namespace
@@ -991,7 +994,7 @@
 // the script resource in the opened app window.
 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest,
                        PRE_PRE_ComponentAppBackgroundPage) {
-  CheckExtensionInstalledObserver should_install;
+  CheckExtensionInstalledObserver should_install(browser()->profile());
 
   // Ensure that we wait until the background page is run (to register the
   // OnLaunched listener) before trying to open the application. This is similar
@@ -1025,7 +1028,7 @@
   // in a different observer (which would timeout if not the app was not
   // previously installed properly) and then check this observer to make sure it
   // never saw the NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED event.
-  CheckExtensionInstalledObserver should_not_install;
+  CheckExtensionInstalledObserver should_not_install(browser()->profile());
   const Extension* extension = LoadExtensionAsComponent(
       test_data_dir_.AppendASCII("platform_apps").AppendASCII("component"));
   ASSERT_TRUE(extension);
@@ -1056,7 +1059,7 @@
 // Component App Test 3 of 3: simulate a component extension upgrade that
 // re-adds the OnLaunched event, and allows the app to be launched.
 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, ComponentAppBackgroundPage) {
-  CheckExtensionInstalledObserver should_install;
+  CheckExtensionInstalledObserver should_install(browser()->profile());
   // Since we are forcing an upgrade, we need to wait for the load again.
   content::WindowedNotificationObserver app_loaded_observer(
       content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
diff --git a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
index 0f1fd635..f88e8b82 100644
--- a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
+++ b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
@@ -121,7 +121,6 @@
 #include "content/public/common/content_switches.h"
 #include "content/public/common/main_function_params.h"
 #include "device/bluetooth/bluetooth_adapter_factory.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
 #include "media/audio/sounds/sounds_manager.h"
 #include "net/base/network_change_notifier.h"
 #include "net/socket/ssl_server_socket.h"
@@ -187,12 +186,6 @@
     // Initialize DBusThreadManager for the browser. This must be done after
     // the main message loop is started, as it uses the message loop.
     DBusThreadManager::Initialize();
-
-    bluez::BluezDBusManager::Initialize(
-        DBusThreadManager::Get()->GetSystemBus(),
-        chromeos::DBusThreadManager::Get()->IsUsingStub(
-            chromeos::DBusClientBundle::BLUETOOTH));
-
     PowerPolicyController::Initialize(
         DBusThreadManager::Get()->GetPowerManagerClient());
 
@@ -259,7 +252,6 @@
     PowerDataCollector::Shutdown();
     PowerPolicyController::Shutdown();
     device::BluetoothAdapterFactory::Shutdown();
-    bluez::BluezDBusManager::Shutdown();
 
     // NOTE: This must only be called if Initialize() was called.
     DBusThreadManager::Shutdown();
diff --git a/chrome/browser/chromeos/display/display_preferences.cc b/chrome/browser/chromeos/display/display_preferences.cc
index 069ed6ea..104a89d4 100644
--- a/chrome/browser/chromeos/display/display_preferences.cc
+++ b/chrome/browser/chromeos/display/display_preferences.cc
@@ -274,7 +274,7 @@
           "device-scale-factor",
           static_cast<int>(mode.device_scale_factor * 1000));
     }
-    if (!info.overscan_insets_in_dip().empty())
+    if (!info.overscan_insets_in_dip().IsEmpty())
       InsetsToValue(info.overscan_insets_in_dip(), property_value.get());
     if (info.color_profile() != ui::COLOR_PROFILE_STANDARD) {
       property_value->SetString(
diff --git a/chrome/browser/download/save_page_browsertest.cc b/chrome/browser/download/save_page_browsertest.cc
index 3ceee5d..fcf2787 100644
--- a/chrome/browser/download/save_page_browsertest.cc
+++ b/chrome/browser/download/save_page_browsertest.cc
@@ -161,8 +161,7 @@
     return false;
   }
   if (info.url_chain.size() != 1u) {
-    DVLOG(20) << __FUNCTION__ << " " << info.url_chain.size()
-              << " != 1";
+    DVLOG(20) << __FUNCTION__ << " " << info.url_chain.size() << " != 1";
     return false;
   }
   if (info.url_chain[0] != expected_url) {
@@ -176,8 +175,7 @@
     return false;
   }
   if (info.state != expected_state) {
-    DVLOG(20) << __FUNCTION__ << " " << info.state
-              << " != " << expected_state;
+    DVLOG(20) << __FUNCTION__ << " " << info.state << " != " << expected_state;
     return false;
   }
   return true;
@@ -750,10 +748,12 @@
 
   base::FilePath full_file_name, dir;
   SaveCurrentTab(url, content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML,
-                 "iframe-src-is-a-download", 2, &dir, &full_file_name);
+                 "iframe-src-is-a-download", 3, &dir, &full_file_name);
   ASSERT_FALSE(HasFailure());
 
   EXPECT_TRUE(base::PathExists(full_file_name));
+  EXPECT_TRUE(base::PathExists(dir.AppendASCII("thisdayinhistory.html")));
+  EXPECT_TRUE(base::PathExists(dir.AppendASCII("no-such-file.html")));
 }
 
 // Test suite that allows testing --site-per-process against cross-site frames.
@@ -783,14 +783,7 @@
 };
 
 // Test for crbug.com/526786.
-//
-// Disabled because the test will crash until the bug is fixed (but note that
-// the crash only happens with --site-per-process flag).
-// Currently, the crash would happen under
-// blink::WebLocalFrameImpl::fromFrameOwnerElement called from
-// blink::WebPageSerializerImpl::openTagToString).
-IN_PROC_BROWSER_TEST_F(SavePageSitePerProcessBrowserTest,
-                       DISABLED_SaveAsCompleteHtml) {
+IN_PROC_BROWSER_TEST_F(SavePageSitePerProcessBrowserTest, SaveAsCompleteHtml) {
   GURL url(embedded_test_server()->GetURL("a.com", "/save_page/iframes.htm"));
   ui_test_utils::NavigateToURL(browser(), url);
 
diff --git a/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api_chromeos_unittest.cc b/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api_chromeos_unittest.cc
index fc1c8c8..912bd70 100644
--- a/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api_chromeos_unittest.cc
+++ b/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api_chromeos_unittest.cc
@@ -26,7 +26,6 @@
 #include "chromeos/dbus/fake_easy_unlock_client.h"
 #include "components/proximity_auth/cryptauth/proto/cryptauth_api.pb.h"
 #include "components/proximity_auth/switches.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
 #include "extensions/browser/api_test_utils.h"
 #include "extensions/browser/event_router.h"
 #include "extensions/browser/event_router_factory.h"
@@ -128,10 +127,6 @@
  protected:
   void SetUp() override {
     chromeos::DBusThreadManager::Initialize();
-    bluez::BluezDBusManager::Initialize(
-        chromeos::DBusThreadManager::Get()->GetSystemBus(),
-        chromeos::DBusThreadManager::Get()->IsUsingStub(
-            chromeos::DBusClientBundle::BLUETOOTH));
     client_ = chromeos::DBusThreadManager::Get()->GetEasyUnlockClient();
 
     extensions::ExtensionApiUnittest::SetUp();
@@ -140,7 +135,6 @@
   void TearDown() override {
     extensions::ExtensionApiUnittest::TearDown();
 
-    bluez::BluezDBusManager::Shutdown();
     chromeos::DBusThreadManager::Shutdown();
   }
 
diff --git a/chrome/browser/extensions/extension_icon_manager.cc b/chrome/browser/extensions/extension_icon_manager.cc
index 7485716..2202cd0 100644
--- a/chrome/browser/extensions/extension_icon_manager.cc
+++ b/chrome/browser/extensions/extension_icon_manager.cc
@@ -137,7 +137,7 @@
     result = SkBitmapOperations::CreateHSLShiftedBitmap(result, shift);
   }
 
-  if (!padding_.empty())
+  if (!padding_.IsEmpty())
     result = ApplyPadding(result, padding_);
 
   return result;
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 4753fa0..7390a263 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -1614,12 +1614,15 @@
 
     // Extensions that came to us disabled from sync need a similar inference,
     // except based on the new version's permissions.
+    // TODO(treib,devlin): Since M48, DISABLE_UNKNOWN_FROM_SYNC isn't used
+    // anymore; this code is still here to migrate any existing old state.
+    // Remove it after some grace period.
     if (previously_disabled &&
-        (disable_reasons & Extension::DISABLE_UNKNOWN_FROM_SYNC)) {
+        (disable_reasons & Extension::DEPRECATED_DISABLE_UNKNOWN_FROM_SYNC)) {
       // Remove the DISABLE_UNKNOWN_FROM_SYNC reason.
-      disable_reasons &= ~Extension::DISABLE_UNKNOWN_FROM_SYNC;
+      disable_reasons &= ~Extension::DEPRECATED_DISABLE_UNKNOWN_FROM_SYNC;
       extension_prefs_->RemoveDisableReason(
-          extension->id(), Extension::DISABLE_UNKNOWN_FROM_SYNC);
+          extension->id(), Extension::DEPRECATED_DISABLE_UNKNOWN_FROM_SYNC);
       // If there was no privilege increase, it was likely disabled by the user.
       if (!is_privilege_increase)
         disable_reasons |= Extension::DISABLE_USER_ACTION;
diff --git a/chrome/browser/extensions/extension_service_sync_unittest.cc b/chrome/browser/extensions/extension_service_sync_unittest.cc
index b56d633..c026d79 100644
--- a/chrome/browser/extensions/extension_service_sync_unittest.cc
+++ b/chrome/browser/extensions/extension_service_sync_unittest.cc
@@ -839,8 +839,8 @@
       Extension::DISABLE_USER_ACTION, true },
     // Legacy case (<M45): No disable reasons come in from Sync (see
     // crbug.com/484214). After installation, the reason should be set to
-    // DISABLE_UNKNOWN_FROM_SYNC.
-    { "Legacy", false, -1, Extension::DISABLE_UNKNOWN_FROM_SYNC, true },
+    // DISABLE_USER_ACTION (default assumption).
+    { "Legacy", false, -1, Extension::DISABLE_USER_ACTION, true },
     // If the extension came in disabled due to a permissions increase, then the
     // user has *not* approved the permissions, and they shouldn't be granted.
     // crbug.com/484214
@@ -1084,12 +1084,12 @@
       Extension::DISABLE_USER_ACTION, Extension::DISABLE_USER_ACTION },
     { "Disable", 0, false, Extension::DISABLE_USER_ACTION,
       Extension::DISABLE_USER_ACTION },
-    { "DisableLegacy", 0, false, -1, Extension::DISABLE_UNKNOWN_FROM_SYNC },
+    { "DisableLegacy", 0, false, -1, Extension::DISABLE_USER_ACTION },
     { "AddDisableReason", Extension::DISABLE_REMOTE_INSTALL, false,
       Extension::DISABLE_REMOTE_INSTALL | Extension::DISABLE_USER_ACTION,
       Extension::DISABLE_REMOTE_INSTALL | Extension::DISABLE_USER_ACTION },
     { "AddDisableReasonLegacy", Extension::DISABLE_USER_ACTION, false, -1,
-      Extension::DISABLE_USER_ACTION | Extension::DISABLE_UNKNOWN_FROM_SYNC},
+      Extension::DISABLE_USER_ACTION},
     { "RemoveDisableReason",
       Extension::DISABLE_REMOTE_INSTALL | Extension::DISABLE_USER_ACTION, false,
       Extension::DISABLE_USER_ACTION, Extension::DISABLE_USER_ACTION },
diff --git a/chrome/browser/extensions/extension_sync_service.cc b/chrome/browser/extensions/extension_sync_service.cc
index 09347bdf..8c95c7b 100644
--- a/chrome/browser/extensions/extension_sync_service.cc
+++ b/chrome/browser/extensions/extension_sync_service.cc
@@ -380,15 +380,15 @@
       }
     } else if (!extension_sync_data.supports_disable_reasons()) {
       // Legacy case (<M45), from before we synced disable reasons (see
-      // crbug.com/484214).
-      disable_reasons = Extension::DISABLE_UNKNOWN_FROM_SYNC;
+      // crbug.com/484214). Assume the extension was likely disabled by the
+      // user, so add DISABLE_USER_ACTION to any existing disable reasons.
+      disable_reasons = extension_prefs->GetDisableReasons(id);
+      disable_reasons |= Extension::DISABLE_USER_ACTION;
     }
 
-    // In the non-legacy case (>=M45), clear any existing disable reasons first.
-    // Otherwise sync can't remove just some of them.
-    if (extension_sync_data.supports_disable_reasons())
-      extension_prefs->ClearDisableReasons(id);
-
+    // Clear any existing disable reasons first, otherwise sync can't remove
+    // just some of them.
+    extension_prefs->ClearDisableReasons(id);
     extension_service()->DisableExtension(id, disable_reasons);
   }
 
diff --git a/chrome/browser/extensions/fake_safe_browsing_database_manager.cc b/chrome/browser/extensions/fake_safe_browsing_database_manager.cc
index 3dc42740..0897401 100644
--- a/chrome/browser/extensions/fake_safe_browsing_database_manager.cc
+++ b/chrome/browser/extensions/fake_safe_browsing_database_manager.cc
@@ -100,14 +100,14 @@
   std::vector<SBFullHash> extension_id_hashes;
   std::transform(extension_ids_vector.begin(), extension_ids_vector.end(),
                  std::back_inserter(extension_id_hashes),
-                 safe_browsing::StringToSBFullHash);
+                 safe_browsing_util::StringToSBFullHash);
 
   scoped_ptr<SafeBrowsingCheck> safe_browsing_check(
       new SafeBrowsingCheck(
           std::vector<GURL>(),
           extension_id_hashes,
           client,
-          safe_browsing::EXTENSIONBLACKLIST,
+          safe_browsing_util::EXTENSIONBLACKLIST,
           std::vector<SBThreatType>(1, SB_THREAT_TYPE_EXTENSION)));
 
   for (size_t i = 0; i < extension_ids_vector.size(); ++i) {
diff --git a/chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc b/chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc
index 5ea09ccb..372765f8 100644
--- a/chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc
+++ b/chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc
@@ -20,6 +20,10 @@
 #include "extensions/common/extension.h"
 #include "extensions/common/extension_set.h"
 
+#if defined(OS_CHROMEOS)
+#include "chrome/browser/metrics/chromeos_metrics_provider.h"
+#endif
+
 #if defined(OS_WIN)
 #include "base/win/win_util.h"
 #endif
@@ -30,13 +34,33 @@
 const char kExtensionsListKey[] = "extensions";
 const char kDataReductionProxyKey[] = "data_reduction_proxy";
 const char kChromeVersionTag[] = "CHROME VERSION";
-#if !defined(OS_CHROMEOS)
+#if defined(OS_CHROMEOS)
+const char kChromeEnrollmentTag[] = "ENTERPRISE_ENROLLED";
+#else
 const char kOsVersionTag[] = "OS VERSION";
 #endif
 #if defined(OS_WIN)
 const char kUsbKeyboardDetected[] = "usb_keyboard_detected";
 #endif
 
+#if defined(OS_CHROMEOS)
+std::string GetEnrollmentStatusString() {
+  switch (ChromeOSMetricsProvider::GetEnrollmentStatus()) {
+    case ChromeOSMetricsProvider::NON_MANAGED:
+      return "Not managed";
+    case ChromeOSMetricsProvider::MANAGED:
+      return "Managed";
+    case ChromeOSMetricsProvider::UNUSED:
+    case ChromeOSMetricsProvider::ERROR_GETTING_ENROLLMENT_STATUS:
+    case ChromeOSMetricsProvider::ENROLLMENT_STATUS_MAX:
+      return "Error retrieving status";
+  }
+  // For compilers that don't recognize all cases handled above.
+  NOTREACHED();
+  return std::string();
+}
+#endif
+
 }  // namespace
 
 namespace system_logs {
@@ -56,7 +80,9 @@
 
   response[kChromeVersionTag] = chrome::GetVersionString();
 
-#if !defined(OS_CHROMEOS)
+#if defined(OS_CHROMEOS)
+  response[kChromeEnrollmentTag] = GetEnrollmentStatusString();
+#else
   // On ChromeOS, this will be pulled in from the LSB_RELEASE.
   std::string os_version = base::SysInfo::OperatingSystemName() + ": " +
                            base::SysInfo::OperatingSystemVersion();
diff --git a/chrome/browser/metrics/chromeos_metrics_provider.cc b/chrome/browser/metrics/chromeos_metrics_provider.cc
index f8c21a5..473af30 100644
--- a/chrome/browser/metrics/chromeos_metrics_provider.cc
+++ b/chrome/browser/metrics/chromeos_metrics_provider.cc
@@ -93,25 +93,6 @@
   pref->SetInteger(path, value + 1);
 }
 
-// Possible device enrollment status for a Chrome OS device.
-enum EnrollmentStatus {
-  NON_MANAGED,
-  UNUSED,  // Formerly MANAGED_EDU, see crbug.com/462770.
-  MANAGED,
-  ERROR_GETTING_ENROLLMENT_STATUS,
-  ENROLLMENT_STATUS_MAX,
-};
-
-// Get the enrollment status.
-EnrollmentStatus GetEnrollmentStatus() {
-  policy::BrowserPolicyConnectorChromeOS* connector =
-        g_browser_process->platform_part()->browser_policy_connector_chromeos();
-  if (!connector)
-    return ERROR_GETTING_ENROLLMENT_STATUS;
-
-  return connector->IsEnterpriseManaged() ? MANAGED : NON_MANAGED;
-}
-
 }  // namespace
 
 ChromeOSMetricsProvider::ChromeOSMetricsProvider()
@@ -146,6 +127,16 @@
   g_browser_process->metrics_service()->OnApplicationNotIdle();
 }
 
+ChromeOSMetricsProvider::EnrollmentStatus
+ChromeOSMetricsProvider::GetEnrollmentStatus() {
+  policy::BrowserPolicyConnectorChromeOS* connector =
+      g_browser_process->platform_part()->browser_policy_connector_chromeos();
+  if (!connector)
+    return ERROR_GETTING_ENROLLMENT_STATUS;
+
+  return connector->IsEnterpriseManaged() ? MANAGED : NON_MANAGED;
+}
+
 void ChromeOSMetricsProvider::OnDidCreateMetricsLog() {
   registered_user_count_at_log_initialization_ = false;
   if (user_manager::UserManager::IsInitialized()) {
diff --git a/chrome/browser/metrics/chromeos_metrics_provider.h b/chrome/browser/metrics/chromeos_metrics_provider.h
index cf9d4f5..c4b4576 100644
--- a/chrome/browser/metrics/chromeos_metrics_provider.h
+++ b/chrome/browser/metrics/chromeos_metrics_provider.h
@@ -23,6 +23,16 @@
 // Performs ChromeOS specific metrics logging.
 class ChromeOSMetricsProvider : public metrics::MetricsProvider {
  public:
+  // Possible device enrollment status for a Chrome OS device.
+  // Used by UMA histogram, so entries shouldn't be reordered or removed.
+  enum EnrollmentStatus {
+    NON_MANAGED,
+    UNUSED,  // Formerly MANAGED_EDU, see crbug.com/462770.
+    MANAGED,
+    ERROR_GETTING_ENROLLMENT_STATUS,
+    ENROLLMENT_STATUS_MAX,
+  };
+
   ChromeOSMetricsProvider();
   ~ChromeOSMetricsProvider() override;
 
@@ -31,6 +41,9 @@
   // Records a crash.
   static void LogCrash(const std::string& crash_type);
 
+  // Returns Enterprise Enrollment status.
+  static EnrollmentStatus GetEnrollmentStatus();
+
   // Loads hardware class information. When this task is complete, |callback|
   // is run.
   void InitTaskGetHardwareClass(const base::Closure& callback);
diff --git a/chrome/browser/metrics/chromeos_metrics_provider_unittest.cc b/chrome/browser/metrics/chromeos_metrics_provider_unittest.cc
index 4801accc7..f0fc27d 100644
--- a/chrome/browser/metrics/chromeos_metrics_provider_unittest.cc
+++ b/chrome/browser/metrics/chromeos_metrics_provider_unittest.cc
@@ -11,44 +11,41 @@
 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
 #include "chrome/browser/metrics/chromeos_metrics_provider.h"
 #include "chromeos/dbus/dbus_thread_manager.h"
+#include "chromeos/dbus/fake_bluetooth_adapter_client.h"
+#include "chromeos/dbus/fake_bluetooth_agent_manager_client.h"
+#include "chromeos/dbus/fake_bluetooth_device_client.h"
+#include "chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h"
+#include "chromeos/dbus/fake_bluetooth_gatt_descriptor_client.h"
+#include "chromeos/dbus/fake_bluetooth_gatt_service_client.h"
+#include "chromeos/dbus/fake_bluetooth_input_client.h"
 #include "chromeos/dbus/power_manager_client.h"
 #include "chromeos/login/login_state.h"
 #include "components/metrics/proto/system_profile.pb.h"
 #include "components/user_manager/user_manager.h"
 #include "content/public/test/test_browser_thread_bundle.h"
 #include "content/public/test/test_utils.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
-#include "device/bluetooth/dbus/fake_bluetooth_adapter_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_device_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_gatt_service_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_input_client.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 #if defined(USE_X11)
 #include "ui/events/devices/x11/device_data_manager_x11.h"
 #endif
 
-using bluez::BluetoothAdapterClient;
-using bluez::BluetoothAgentManagerClient;
-using bluez::BluetoothDeviceClient;
-using bluez::BluetoothGattCharacteristicClient;
-using bluez::BluetoothGattDescriptorClient;
-using bluez::BluetoothGattServiceClient;
-using bluez::BluetoothInputClient;
-using bluez::BluezDBusManager;
-using bluez::BluezDBusManagerSetter;
-using bluez::FakeBluetoothAdapterClient;
-using bluez::FakeBluetoothAgentManagerClient;
-using bluez::FakeBluetoothDeviceClient;
-using bluez::FakeBluetoothGattCharacteristicClient;
-using bluez::FakeBluetoothGattDescriptorClient;
-using bluez::FakeBluetoothGattServiceClient;
-using bluez::FakeBluetoothInputClient;
 using chromeos::DBusThreadManager;
 using chromeos::DBusThreadManagerSetter;
+using chromeos::BluetoothAdapterClient;
+using chromeos::BluetoothAgentManagerClient;
+using chromeos::BluetoothDeviceClient;
+using chromeos::BluetoothGattCharacteristicClient;
+using chromeos::BluetoothGattDescriptorClient;
+using chromeos::BluetoothGattServiceClient;
+using chromeos::BluetoothInputClient;
+using chromeos::FakeBluetoothAdapterClient;
+using chromeos::FakeBluetoothAgentManagerClient;
+using chromeos::FakeBluetoothDeviceClient;
+using chromeos::FakeBluetoothGattCharacteristicClient;
+using chromeos::FakeBluetoothGattDescriptorClient;
+using chromeos::FakeBluetoothGattServiceClient;
+using chromeos::FakeBluetoothInputClient;
 using chromeos::PowerManagerClient;
 using chromeos::STUB_DBUS_CLIENT_IMPLEMENTATION;
 
@@ -63,39 +60,37 @@
 #endif
 
     // Set up the fake Bluetooth environment,
-    scoped_ptr<BluezDBusManagerSetter> bluez_dbus_setter =
-        BluezDBusManager::GetSetterForTesting();
-    bluez_dbus_setter->SetBluetoothAdapterClient(
+    scoped_ptr<DBusThreadManagerSetter> dbus_setter =
+        DBusThreadManager::GetSetterForTesting();
+    dbus_setter->SetBluetoothAdapterClient(
         scoped_ptr<BluetoothAdapterClient>(new FakeBluetoothAdapterClient));
-    bluez_dbus_setter->SetBluetoothDeviceClient(
+    dbus_setter->SetBluetoothDeviceClient(
         scoped_ptr<BluetoothDeviceClient>(new FakeBluetoothDeviceClient));
-    bluez_dbus_setter->SetBluetoothGattCharacteristicClient(
+    dbus_setter->SetBluetoothGattCharacteristicClient(
         scoped_ptr<BluetoothGattCharacteristicClient>(
             new FakeBluetoothGattCharacteristicClient));
-    bluez_dbus_setter->SetBluetoothGattDescriptorClient(
+    dbus_setter->SetBluetoothGattDescriptorClient(
         scoped_ptr<BluetoothGattDescriptorClient>(
             new FakeBluetoothGattDescriptorClient));
-    bluez_dbus_setter->SetBluetoothGattServiceClient(
+    dbus_setter->SetBluetoothGattServiceClient(
         scoped_ptr<BluetoothGattServiceClient>(
             new FakeBluetoothGattServiceClient));
-    bluez_dbus_setter->SetBluetoothInputClient(
+    dbus_setter->SetBluetoothInputClient(
         scoped_ptr<BluetoothInputClient>(new FakeBluetoothInputClient));
-    bluez_dbus_setter->SetBluetoothAgentManagerClient(
+    dbus_setter->SetBluetoothAgentManagerClient(
         scoped_ptr<BluetoothAgentManagerClient>(
             new FakeBluetoothAgentManagerClient));
 
     // Set up a PowerManagerClient instance for PerfProvider.
-    scoped_ptr<DBusThreadManagerSetter> dbus_setter =
-        DBusThreadManager::GetSetterForTesting();
     dbus_setter->SetPowerManagerClient(
         scoped_ptr<PowerManagerClient>(
             PowerManagerClient::Create(STUB_DBUS_CLIENT_IMPLEMENTATION)));
 
     // Grab pointers to members of the thread manager for easier testing.
     fake_bluetooth_adapter_client_ = static_cast<FakeBluetoothAdapterClient*>(
-        BluezDBusManager::Get()->GetBluetoothAdapterClient());
+        DBusThreadManager::Get()->GetBluetoothAdapterClient());
     fake_bluetooth_device_client_ = static_cast<FakeBluetoothDeviceClient*>(
-        BluezDBusManager::Get()->GetBluetoothDeviceClient());
+        DBusThreadManager::Get()->GetBluetoothDeviceClient());
 
     // Initialize the login state trackers.
     if (!chromeos::LoginState::IsInitialized())
diff --git a/chrome/browser/prerender/prerender_browsertest.cc b/chrome/browser/prerender/prerender_browsertest.cc
index a9a6c014..82324f08 100644
--- a/chrome/browser/prerender/prerender_browsertest.cc
+++ b/chrome/browser/prerender/prerender_browsertest.cc
@@ -755,7 +755,7 @@
         std::vector<GURL>(1, gurl),
         std::vector<SBFullHash>(),
         client,
-        safe_browsing::MALWARE,
+        safe_browsing_util::MALWARE,
         expected_threats);
     sb_check.url_results[0] = threat_type_;
     sb_check.OnSafeBrowsingResult();
diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc
index 77784e0..ba0e44a 100644
--- a/chrome/browser/profiles/profile_manager.cc
+++ b/chrome/browser/profiles/profile_manager.cc
@@ -66,6 +66,7 @@
 #include "components/invalidation/public/invalidation_service.h"
 #include "components/password_manager/core/browser/password_store.h"
 #include "components/password_manager/sync/browser/password_manager_setting_migrator_service.h"
+#include "components/search_engines/default_search_manager.h"
 #include "components/signin/core/browser/account_fetcher_service.h"
 #include "components/signin/core/browser/account_tracker_service.h"
 #include "components/signin/core/browser/gaia_cookie_manager_service.h"
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.cc b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
index ed28d8f..f10d19e 100644
--- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc
+++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
@@ -130,10 +130,6 @@
 #endif  // defined(ENABLE_PRINT_PREVIEW)
 #endif  // defined(ENABLE_PRINTING)
 
-#if defined(OS_CHROMEOS)
-#include "chrome/browser/chromeos/profiles/profile_helper.h"
-#endif
-
 #if defined(ENABLE_MEDIA_ROUTER)
 #include "chrome/browser/media/router/media_router_dialog_controller.h"
 #include "chrome/browser/media/router/media_router_metrics.h"
@@ -387,6 +383,7 @@
 
 bool g_custom_id_ranges_initialized = false;
 
+#if !defined(OS_CHROMEOS)
 void AddIconToLastMenuItem(gfx::Image icon, ui::SimpleMenuModel* menu) {
   int width = icon.Width();
   int height = icon.Height();
@@ -406,6 +403,7 @@
       height);
   menu->SetIcon(menu->GetItemCount() - 1, sized_icon);
 }
+#endif  // !defined(OS_CHROMEOS)
 
 void OnProfileCreated(chrome::HostDesktopType desktop_type,
                       const GURL& link_url,
@@ -868,6 +866,11 @@
     menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_OPENLINKOFFTHERECORD,
                                     IDS_CONTENT_CONTEXT_OPENLINKOFFTHERECORD);
 
+    // While ChromeOS supports multiple profiles, only one can be open at a
+    // time.
+    // TODO(jochen): Consider adding support for ChromeOS with similar
+    // semantics as the profile switcher in the system tray.
+#if !defined(OS_CHROMEOS)
     // g_browser_process->profile_manager() is null during unit tests.
     if (g_browser_process->profile_manager() &&
         GetProfile()->GetProfileType() == Profile::REGULAR_PROFILE) {
@@ -883,10 +886,6 @@
            ++profile_index) {
         base::FilePath profile_path =
             profile_info_cache.GetPathOfProfileAtIndex(profile_index);
-#if defined(OS_CHROMEOS)
-        if (profile_path == chromeos::ProfileHelper::GetSigninProfileDir())
-          continue;
-#endif
         Profile* profile = profile_manager->GetProfileByPath(profile_path);
         if ((profile != GetProfile()) &&
             !profile_info_cache.IsOmittedProfileAtIndex(profile_index)) {
@@ -925,6 +924,7 @@
             &profile_link_submenu_model_);
       }
     }
+#endif  // !defined(OS_CHROMEOS)
     menu_model_.AddSeparator(ui::NORMAL_SEPARATOR);
     menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_SAVELINKAS,
                                     IDS_CONTENT_CONTEXT_SAVELINKAS);
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc b/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc
index 2036d5c..648911d0 100644
--- a/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc
+++ b/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc
@@ -47,12 +47,6 @@
 #include "third_party/WebKit/public/web/WebContextMenuData.h"
 #include "third_party/WebKit/public/web/WebInputEvent.h"
 
-#if defined(OS_CHROMEOS)
-#include "chrome/browser/chromeos/profiles/profile_helper.h"
-#include "components/signin/core/account_id/account_id.h"
-#include "components/user_manager/user_manager.h"
-#endif
-
 using content::WebContents;
 
 namespace {
@@ -104,21 +98,12 @@
     return menu;
   }
 
+  // Does not work on ChromeOS.
   Profile* CreateSecondaryProfile(int profile_num) {
     ProfileManager* profile_manager = g_browser_process->profile_manager();
     base::FilePath profile_path = profile_manager->user_data_dir();
-#if defined(OS_CHROMEOS)
-    std::string profile_name = base::StringPrintf("NewProfile%d", profile_num);
-    user_manager::UserManager::Get()->UserLoggedIn(
-        AccountId::FromUserEmail(
-            base::StringPrintf("user%d@test.com", profile_num)),
-        profile_name, false);
-    profile_path = profile_path.Append(
-        chromeos::ProfileHelper::GetUserProfileDir(profile_name).BaseName());
-#else
     profile_path = profile_path.AppendASCII(
         base::StringPrintf("New Profile %d", profile_num));
-#endif
     return profile_manager->GetProfile(profile_path);
   }
 };
@@ -430,6 +415,8 @@
   ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENIMAGENEWTAB));
 }
 
+// Functionality is not present on ChromeOS.
+#if !defined(OS_CHROMEOS)
 IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, OpenLinkInProfileEntryPresent) {
   {
     scoped_ptr<TestRenderViewContextMenu> menu(CreateContextMenuMediaTypeNone(
@@ -510,6 +497,7 @@
   ASSERT_EQ(other_profile,
             Profile::FromBrowserContext(tab->GetBrowserContext()));
 }
+#endif  // !defined(OS_CHROMEOS)
 
 class ThumbnailResponseWatcher : public content::NotificationObserver {
  public:
diff --git a/chrome/browser/resources/options/password_manager_list.js b/chrome/browser/resources/options/password_manager_list.js
index 85cf0ae..b6c869aa 100644
--- a/chrome/browser/resources/options/password_manager_list.js
+++ b/chrome/browser/resources/options/password_manager_list.js
@@ -81,6 +81,7 @@
       urlDiv.style.backgroundImage = getFaviconImageSet(
           'origin/' + this.url, 16);
       this.contentElement.appendChild(urlDiv);
+      this.urlLink = urlLink;
 
       // The stored username.
       var usernameDiv = this.ownerDocument.createElement('div');
@@ -173,7 +174,10 @@
      */
     setFocusable_: function(focusable) {
       var tabIndex = focusable ? 0 : -1;
-      this.passwordField.tabIndex = this.closeButtonElement.tabIndex = tabIndex;
+      this.urlLink.tabIndex = tabIndex;
+      this.usernameField.tabIndex = tabIndex;
+      this.passwordField.tabIndex = tabIndex;
+      this.closeButtonElement.tabIndex = tabIndex;
     },
 
     /**
@@ -328,6 +332,7 @@
       urlDiv.appendChild(urlLink);
       urlDiv.style.backgroundImage = getFaviconImageSet(
           'origin/' + this.url, 16);
+      urlLink.tabIndex = -1;
       this.contentElement.appendChild(urlDiv);
     },
 
diff --git a/chrome/browser/safe_browsing/database_manager.h b/chrome/browser/safe_browsing/database_manager.h
index 8a438c7..cc0840b8 100644
--- a/chrome/browser/safe_browsing/database_manager.h
+++ b/chrome/browser/safe_browsing/database_manager.h
@@ -15,7 +15,7 @@
 #include <vector>
 
 #include "base/memory/ref_counted.h"
-#include "components/safe_browsing_db/util.h"
+#include "chrome/browser/safe_browsing/safe_browsing_util.h"
 #include "content/public/common/resource_type.h"
 #include "url/gurl.h"
 
diff --git a/chrome/browser/safe_browsing/download_protection_service_unittest.cc b/chrome/browser/safe_browsing/download_protection_service_unittest.cc
index cbe556e..8e327773 100644
--- a/chrome/browser/safe_browsing/download_protection_service_unittest.cc
+++ b/chrome/browser/safe_browsing/download_protection_service_unittest.cc
@@ -204,7 +204,7 @@
           arg0,
           std::vector<SBFullHash>(),
           arg1,
-          safe_browsing::BINURL,
+          safe_browsing_util::BINURL,
           std::vector<SBThreatType>(1, SB_THREAT_TYPE_BINARY_MALWARE_URL));
   for (size_t i = 0; i < check->url_results.size(); ++i)
     check->url_results[i] = threat_type;
diff --git a/chrome/browser/safe_browsing/local_database_manager.cc b/chrome/browser/safe_browsing/local_database_manager.cc
index 9f23af35..f50e0989 100644
--- a/chrome/browser/safe_browsing/local_database_manager.cc
+++ b/chrome/browser/safe_browsing/local_database_manager.cc
@@ -32,7 +32,6 @@
 #include "chrome/common/chrome_paths.h"
 #include "chrome/common/chrome_switches.h"
 #include "chrome/common/pref_names.h"
-#include "components/safe_browsing_db/util.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/notification_service.h"
 #include "url/url_constants.h"
@@ -48,7 +47,7 @@
 // |true| if there were any prefix hits in |full_hashes|.
 void RecordGetHashCheckStatus(
     bool hit,
-    safe_browsing::ListType check_type,
+    safe_browsing_util::ListType check_type,
     const std::vector<SBFullHashResult>& full_hashes) {
   SafeBrowsingProtocolManager::ResultType result;
   if (full_hashes.empty()) {
@@ -58,7 +57,7 @@
   } else {
     result = SafeBrowsingProtocolManager::GET_HASH_FULL_HASH_MISS;
   }
-  bool is_download = check_type == safe_browsing::BINURL;
+  bool is_download = check_type == safe_browsing_util::BINURL;
   SafeBrowsingProtocolManager::RecordGetHashResult(is_download, result);
 }
 
@@ -72,32 +71,32 @@
 
 // Return the severest list id from the results in |full_hashes| which matches
 // |hash|, or INVALID if none match.
-safe_browsing::ListType GetHashSeverestThreatListType(
+safe_browsing_util::ListType GetHashSeverestThreatListType(
     const SBFullHash& hash,
     const std::vector<SBFullHashResult>& full_hashes,
     size_t* index) {
-  safe_browsing::ListType pending_threat = safe_browsing::INVALID;
+  safe_browsing_util::ListType pending_threat = safe_browsing_util::INVALID;
   for (size_t i = 0; i < full_hashes.size(); ++i) {
-    if (safe_browsing::SBFullHashEqual(hash, full_hashes[i].hash)) {
-      const safe_browsing::ListType threat =
-          static_cast<safe_browsing::ListType>(full_hashes[i].list_id);
+    if (SBFullHashEqual(hash, full_hashes[i].hash)) {
+      const safe_browsing_util::ListType threat =
+          static_cast<safe_browsing_util::ListType>(full_hashes[i].list_id);
       switch (threat) {
-        case safe_browsing::INVALID:
+        case safe_browsing_util::INVALID:
           // |full_hashes| should never contain INVALID as a |list_id|.
           NOTREACHED();
           break;
-        case safe_browsing::MALWARE:                  // Falls through.
-        case safe_browsing::PHISH:                    // Falls through.
-        case safe_browsing::BINURL:                   // Falls through.
-        case safe_browsing::CSDWHITELIST:             // Falls through.
-        case safe_browsing::DOWNLOADWHITELIST:        // Falls through.
-        case safe_browsing::INCLUSIONWHITELIST:       // Falls through.
-        case safe_browsing::EXTENSIONBLACKLIST:       // Falls through.
-        case safe_browsing::IPBLACKLIST:
+        case safe_browsing_util::MALWARE:                  // Falls through.
+        case safe_browsing_util::PHISH:                    // Falls through.
+        case safe_browsing_util::BINURL:                   // Falls through.
+        case safe_browsing_util::CSDWHITELIST:             // Falls through.
+        case safe_browsing_util::DOWNLOADWHITELIST:        // Falls through.
+        case safe_browsing_util::INCLUSIONWHITELIST:       // Falls through.
+        case safe_browsing_util::EXTENSIONBLACKLIST:       // Falls through.
+        case safe_browsing_util::IPBLACKLIST:
           if (index)
             *index = i;
           return threat;
-        case safe_browsing::UNWANTEDURL:
+        case safe_browsing_util::UNWANTEDURL:
           // UNWANTEDURL is considered less severe than other threats, keep
           // looking.
           pending_threat = threat;
@@ -113,34 +112,34 @@
 // Given a URL, compare all the possible host + path full hashes to the set of
 // provided full hashes.  Returns the list id of the severest matching result
 // from |full_hashes|, or INVALID if none match.
-safe_browsing::ListType GetUrlSeverestThreatListType(
+safe_browsing_util::ListType GetUrlSeverestThreatListType(
     const GURL& url,
     const std::vector<SBFullHashResult>& full_hashes,
     size_t* index) {
   if (full_hashes.empty())
-    return safe_browsing::INVALID;
+    return safe_browsing_util::INVALID;
 
   std::vector<std::string> patterns;
-  safe_browsing::GeneratePatternsToCheck(url, &patterns);
+  safe_browsing_util::GeneratePatternsToCheck(url, &patterns);
 
-  safe_browsing::ListType pending_threat = safe_browsing::INVALID;
+  safe_browsing_util::ListType pending_threat = safe_browsing_util::INVALID;
   for (size_t i = 0; i < patterns.size(); ++i) {
-    safe_browsing::ListType threat = GetHashSeverestThreatListType(
-        safe_browsing::SBFullHashForString(patterns[i]), full_hashes, index);
+    safe_browsing_util::ListType threat = GetHashSeverestThreatListType(
+        SBFullHashForString(patterns[i]), full_hashes, index);
     switch (threat) {
-      case safe_browsing::INVALID:
+      case safe_browsing_util::INVALID:
         // Ignore patterns with no matching threat.
         break;
-      case safe_browsing::MALWARE:                  // Falls through.
-      case safe_browsing::PHISH:                    // Falls through.
-      case safe_browsing::BINURL:                   // Falls through.
-      case safe_browsing::CSDWHITELIST:             // Falls through.
-      case safe_browsing::DOWNLOADWHITELIST:        // Falls through.
-      case safe_browsing::INCLUSIONWHITELIST:       // Falls through.
-      case safe_browsing::EXTENSIONBLACKLIST:       // Falls through.
-      case safe_browsing::IPBLACKLIST:
+      case safe_browsing_util::MALWARE:                  // Falls through.
+      case safe_browsing_util::PHISH:                    // Falls through.
+      case safe_browsing_util::BINURL:                   // Falls through.
+      case safe_browsing_util::CSDWHITELIST:             // Falls through.
+      case safe_browsing_util::DOWNLOADWHITELIST:        // Falls through.
+      case safe_browsing_util::INCLUSIONWHITELIST:       // Falls through.
+      case safe_browsing_util::EXTENSIONBLACKLIST:       // Falls through.
+      case safe_browsing_util::IPBLACKLIST:
         return threat;
-      case safe_browsing::UNWANTEDURL:
+      case safe_browsing_util::UNWANTEDURL:
         // UNWANTEDURL is considered less severe than other threats, keep
         // looking.
         pending_threat = threat;
@@ -150,17 +149,17 @@
   return pending_threat;
 }
 
-SBThreatType GetThreatTypeFromListType(safe_browsing::ListType list_type) {
+SBThreatType GetThreatTypeFromListType(safe_browsing_util::ListType list_type) {
   switch (list_type) {
-    case safe_browsing::PHISH:
+    case safe_browsing_util::PHISH:
       return SB_THREAT_TYPE_URL_PHISHING;
-    case safe_browsing::MALWARE:
+    case safe_browsing_util::MALWARE:
       return SB_THREAT_TYPE_URL_MALWARE;
-    case safe_browsing::UNWANTEDURL:
+    case safe_browsing_util::UNWANTEDURL:
       return SB_THREAT_TYPE_URL_UNWANTED;
-    case safe_browsing::BINURL:
+    case safe_browsing_util::BINURL:
       return SB_THREAT_TYPE_BINARY_MALWARE_URL;
-    case safe_browsing::EXTENSIONBLACKLIST:
+    case safe_browsing_util::EXTENSIONBLACKLIST:
       return SB_THREAT_TYPE_EXTENSION;
     default:
       DVLOG(1) << "Unknown safe browsing list id " << list_type;
@@ -191,7 +190,7 @@
     const std::vector<GURL>& urls,
     const std::vector<SBFullHash>& full_hashes,
     Client* client,
-    safe_browsing::ListType check_type,
+    safe_browsing_util::ListType check_type,
     const std::vector<SBThreatType>& expected_threats)
     : urls(urls),
       url_results(urls.size(), SB_THREAT_TYPE_SAFE),
@@ -219,14 +218,14 @@
   if (!urls.empty()) {
     DCHECK(full_hashes.empty());
     switch (check_type) {
-      case safe_browsing::MALWARE:
-      case safe_browsing::PHISH:
-      case safe_browsing::UNWANTEDURL:
+      case safe_browsing_util::MALWARE:
+      case safe_browsing_util::PHISH:
+      case safe_browsing_util::UNWANTEDURL:
         DCHECK_EQ(1u, urls.size());
         client->OnCheckBrowseUrlResult(urls[0], url_results[0],
                                        url_metadata[0]);
         break;
-      case safe_browsing::BINURL:
+      case safe_browsing_util::BINURL:
         DCHECK_EQ(urls.size(), url_results.size());
         client->OnCheckDownloadUrlResult(
             urls, *std::max_element(url_results.begin(), url_results.end()));
@@ -236,11 +235,11 @@
     }
   } else if (!full_hashes.empty()) {
     switch (check_type) {
-      case safe_browsing::EXTENSIONBLACKLIST: {
+      case safe_browsing_util::EXTENSIONBLACKLIST: {
         std::set<std::string> unsafe_extension_ids;
         for (size_t i = 0; i < full_hashes.size(); ++i) {
           std::string extension_id =
-              safe_browsing::SBFullHashToString(full_hashes[i]);
+              safe_browsing_util::SBFullHashToString(full_hashes[i]);
           if (full_hash_results[i] == SB_THREAT_TYPE_EXTENSION)
             unsafe_extension_ids.insert(extension_id);
         }
@@ -339,7 +338,7 @@
       new SafeBrowsingCheck(url_chain,
                             std::vector<SBFullHash>(),
                             client,
-                            safe_browsing::BINURL,
+                            safe_browsing_util::BINURL,
                             std::vector<SBThreatType>(1,
                                 SB_THREAT_TYPE_BINARY_MALWARE_URL));
   std::vector<SBPrefix> prefixes;
@@ -362,7 +361,7 @@
   std::vector<SBFullHash> extension_id_hashes;
   std::transform(extension_ids.begin(), extension_ids.end(),
                  std::back_inserter(extension_id_hashes),
-                 safe_browsing::StringToSBFullHash);
+                 safe_browsing_util::StringToSBFullHash);
   std::vector<SBPrefix> prefixes;
   for (const SBFullHash& hash : extension_id_hashes)
     prefixes.push_back(hash.prefix);
@@ -371,7 +370,7 @@
       std::vector<GURL>(),
       extension_id_hashes,
       client,
-      safe_browsing::EXTENSIONBLACKLIST,
+      safe_browsing_util::EXTENSIONBLACKLIST,
       std::vector<SBThreatType>(1, SB_THREAT_TYPE_EXTENSION));
   StartSafeBrowsingCheck(
       check,
@@ -459,7 +458,7 @@
 
   const base::TimeTicks start = base::TimeTicks::Now();
   if (!MakeDatabaseAvailable()) {
-    QueuedCheck queued_check(safe_browsing::MALWARE,  // or PHISH
+    QueuedCheck queued_check(safe_browsing_util::MALWARE,  // or PHISH
                              client,
                              url,
                              expected_threats,
@@ -510,7 +509,7 @@
   SafeBrowsingCheck* check = new SafeBrowsingCheck(std::vector<GURL>(1, url),
                                                    std::vector<SBFullHash>(),
                                                    client,
-                                                   safe_browsing::MALWARE,
+                                                   safe_browsing_util::MALWARE,
                                                    expected_threats);
   check->need_get_hash = cache_hits.empty();
   check->prefix_hits.swap(prefix_hits);
@@ -672,7 +671,7 @@
 }
 
 LocalSafeBrowsingDatabaseManager::QueuedCheck::QueuedCheck(
-    const safe_browsing::ListType check_type,
+    const safe_browsing_util::ListType check_type,
     Client* client,
     const GURL& url,
     const std::vector<SBThreatType>& expected_threats,
@@ -872,7 +871,7 @@
   if (!enabled_)
     return;
 
-  bool is_download = check->check_type == safe_browsing::BINURL;
+  bool is_download = check->check_type == safe_browsing_util::BINURL;
   sb_service_->protocol_manager()->GetFullHash(
       check->prefix_hits,
       base::Bind(&LocalSafeBrowsingDatabaseManager::HandleGetHashResults,
@@ -1025,7 +1024,7 @@
     SafeBrowsingCheck* check,
     const std::vector<SBFullHashResult>& full_hashes) {
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
-  safe_browsing::ListType check_type = check->check_type;
+  safe_browsing_util::ListType check_type = check->check_type;
   SBPrefix prefix = check->prefix_hits[0];
   GetHashRequests::iterator it = gethash_requests_.find(prefix);
   if (check->prefix_hits.size() > 1 || it == gethash_requests_.end()) {
diff --git a/chrome/browser/safe_browsing/local_database_manager.h b/chrome/browser/safe_browsing/local_database_manager.h
index a848f1a6..509a6041 100644
--- a/chrome/browser/safe_browsing/local_database_manager.h
+++ b/chrome/browser/safe_browsing/local_database_manager.h
@@ -24,7 +24,7 @@
 #include "base/time/time.h"
 #include "chrome/browser/safe_browsing/database_manager.h"
 #include "chrome/browser/safe_browsing/protocol_manager.h"
-#include "components/safe_browsing_db/util.h"
+#include "chrome/browser/safe_browsing/safe_browsing_util.h"
 #include "url/gurl.h"
 
 class SafeBrowsingService;
@@ -57,7 +57,7 @@
     SafeBrowsingCheck(const std::vector<GURL>& urls,
                       const std::vector<SBFullHash>& full_hashes,
                       Client* client,
-                      safe_browsing::ListType check_type,
+                      safe_browsing_util::ListType check_type,
                       const std::vector<SBThreatType>& expected_threats);
     ~SafeBrowsingCheck();
 
@@ -74,7 +74,7 @@
     bool is_extended_reporting;
     bool need_get_hash;
     base::TimeTicks start;  // When check was sent to SB service.
-    safe_browsing::ListType check_type;  // See comment in constructor.
+    safe_browsing_util::ListType check_type;  // See comment in constructor.
     std::vector<SBThreatType> expected_threats;
     std::vector<SBPrefix> prefix_hits;
     std::vector<SBFullHashResult> cache_hits;
@@ -154,13 +154,13 @@
 
   // Clients that we've queued up for checking later once the database is ready.
   struct QueuedCheck {
-    QueuedCheck(const safe_browsing::ListType check_type,
+    QueuedCheck(const safe_browsing_util::ListType check_type,
                 Client* client,
                 const GURL& url,
                 const std::vector<SBThreatType>& expected_threats,
                 const base::TimeTicks& start);
     ~QueuedCheck();
-    safe_browsing::ListType check_type;
+    safe_browsing_util::ListType check_type;
     Client* client;
     GURL url;
     std::vector<SBThreatType> expected_threats;
diff --git a/chrome/browser/safe_browsing/local_database_manager_unittest.cc b/chrome/browser/safe_browsing/local_database_manager_unittest.cc
index b4bbc30..de8dc96 100644
--- a/chrome/browser/safe_browsing/local_database_manager_unittest.cc
+++ b/chrome/browser/safe_browsing/local_database_manager_unittest.cc
@@ -40,7 +40,7 @@
 
 class SafeBrowsingDatabaseManagerTest : public PlatformTest {
  public:
-  bool RunSBHashTest(const safe_browsing::ListType list_type,
+  bool RunSBHashTest(const safe_browsing_util::ListType list_type,
                      const std::vector<SBThreatType>& expected_threats,
                      const std::string& result_list);
 
@@ -49,7 +49,7 @@
 };
 
 bool SafeBrowsingDatabaseManagerTest::RunSBHashTest(
-    const safe_browsing::ListType list_type,
+    const safe_browsing_util::ListType list_type,
     const std::vector<SBThreatType>& expected_threats,
     const std::string& result_list) {
   scoped_refptr<SafeBrowsingService> sb_service_(
@@ -69,7 +69,7 @@
 
   const SBFullHashResult full_hash_result = {
       same_full_hash,
-      safe_browsing::GetListId(result_list)
+      safe_browsing_util::GetListId(result_list)
   };
 
   std::vector<SBFullHashResult> fake_results(1, full_hash_result);
@@ -82,23 +82,23 @@
 TEST_F(SafeBrowsingDatabaseManagerTest, CheckCorrespondsListType) {
   std::vector<SBThreatType> malware_threat(1,
                                            SB_THREAT_TYPE_BINARY_MALWARE_URL);
-  EXPECT_FALSE(RunSBHashTest(safe_browsing::BINURL,
+  EXPECT_FALSE(RunSBHashTest(safe_browsing_util::BINURL,
                              malware_threat,
-                             safe_browsing::kMalwareList));
-  EXPECT_TRUE(RunSBHashTest(safe_browsing::BINURL,
+                             safe_browsing_util::kMalwareList));
+  EXPECT_TRUE(RunSBHashTest(safe_browsing_util::BINURL,
                             malware_threat,
-                            safe_browsing::kBinUrlList));
+                            safe_browsing_util::kBinUrlList));
 
   // Check for multiple threats
   std::vector<SBThreatType> multiple_threats;
   multiple_threats.push_back(SB_THREAT_TYPE_URL_MALWARE);
   multiple_threats.push_back(SB_THREAT_TYPE_URL_PHISHING);
-  EXPECT_FALSE(RunSBHashTest(safe_browsing::MALWARE,
+  EXPECT_FALSE(RunSBHashTest(safe_browsing_util::MALWARE,
                              multiple_threats,
-                             safe_browsing::kBinUrlList));
-  EXPECT_TRUE(RunSBHashTest(safe_browsing::MALWARE,
+                             safe_browsing_util::kBinUrlList));
+  EXPECT_TRUE(RunSBHashTest(safe_browsing_util::MALWARE,
                             multiple_threats,
-                            safe_browsing::kMalwareList));
+                            safe_browsing_util::kMalwareList));
 }
 
 TEST_F(SafeBrowsingDatabaseManagerTest, GetUrlSeverestThreatType) {
@@ -111,35 +111,31 @@
       "http://www.unwantedandmalware.com/page.html");
   const GURL kSafeUrl("http://www.safe.com/page.html");
 
-  const SBFullHash kMalwareHostHash =
-      safe_browsing::SBFullHashForString("malware.com/");
-  const SBFullHash kPhishingHostHash =
-      safe_browsing::SBFullHashForString("phishing.com/");
-  const SBFullHash kUnwantedHostHash =
-      safe_browsing::SBFullHashForString("unwanted.com/");
+  const SBFullHash kMalwareHostHash = SBFullHashForString("malware.com/");
+  const SBFullHash kPhishingHostHash = SBFullHashForString("phishing.com/");
+  const SBFullHash kUnwantedHostHash = SBFullHashForString("unwanted.com/");
   const SBFullHash kUnwantedAndMalwareHostHash =
-      safe_browsing::SBFullHashForString("unwantedandmalware.com/");
-  const SBFullHash kSafeHostHash =
-      safe_browsing::SBFullHashForString("www.safe.com/");
+      SBFullHashForString("unwantedandmalware.com/");
+  const SBFullHash kSafeHostHash = SBFullHashForString("www.safe.com/");
 
   {
     SBFullHashResult full_hash;
     full_hash.hash = kMalwareHostHash;
-    full_hash.list_id = static_cast<int>(safe_browsing::MALWARE);
+    full_hash.list_id = static_cast<int>(safe_browsing_util::MALWARE);
     full_hashes.push_back(full_hash);
   }
 
   {
     SBFullHashResult full_hash;
     full_hash.hash = kPhishingHostHash;
-    full_hash.list_id = static_cast<int>(safe_browsing::PHISH);
+    full_hash.list_id = static_cast<int>(safe_browsing_util::PHISH);
     full_hashes.push_back(full_hash);
   }
 
   {
     SBFullHashResult full_hash;
     full_hash.hash = kUnwantedHostHash;
-    full_hash.list_id = static_cast<int>(safe_browsing::UNWANTEDURL);
+    full_hash.list_id = static_cast<int>(safe_browsing_util::UNWANTEDURL);
     full_hashes.push_back(full_hash);
   }
 
@@ -148,12 +144,13 @@
     // kUnwantedAndMalwareHostHash.
     SBFullHashResult full_hash_malware;
     full_hash_malware.hash = kUnwantedAndMalwareHostHash;
-    full_hash_malware.list_id = static_cast<int>(safe_browsing::MALWARE);
+    full_hash_malware.list_id = static_cast<int>(safe_browsing_util::MALWARE);
     full_hashes.push_back(full_hash_malware);
 
     SBFullHashResult full_hash_unwanted;
     full_hash_unwanted.hash = kUnwantedAndMalwareHostHash;
-    full_hash_unwanted.list_id = static_cast<int>(safe_browsing::UNWANTEDURL);
+    full_hash_unwanted.list_id =
+        static_cast<int>(safe_browsing_util::UNWANTEDURL);
     full_hashes.push_back(full_hash_unwanted);
   }
 
diff --git a/chrome/browser/safe_browsing/protocol_manager.cc b/chrome/browser/safe_browsing/protocol_manager.cc
index 658453b..745a9d7f 100644
--- a/chrome/browser/safe_browsing/protocol_manager.cc
+++ b/chrome/browser/safe_browsing/protocol_manager.cc
@@ -18,7 +18,6 @@
 #include "base/timer/timer.h"
 #include "chrome/browser/safe_browsing/protocol_parser.h"
 #include "chrome/common/env_vars.h"
-#include "components/safe_browsing_db/util.h"
 #include "components/variations/variations_associated_data.h"
 #include "google_apis/google_api_keys.h"
 #include "net/base/escape.h"
@@ -632,10 +631,10 @@
   bool found_phishing = false;
   for (size_t i = 0; i < lists.size(); ++i) {
     update_list_data_.append(safe_browsing::FormatList(lists[i]));
-    if (lists[i].name == safe_browsing::kPhishingList)
+    if (lists[i].name == safe_browsing_util::kPhishingList)
       found_phishing = true;
 
-    if (lists[i].name == safe_browsing::kMalwareList)
+    if (lists[i].name == safe_browsing_util::kMalwareList)
       found_malware = true;
   }
 
@@ -646,11 +645,11 @@
   // removed.
   if (!found_phishing) {
     update_list_data_.append(safe_browsing::FormatList(
-        SBListChunkRanges(safe_browsing::kPhishingList)));
+        SBListChunkRanges(safe_browsing_util::kPhishingList)));
   }
   if (!found_malware) {
     update_list_data_.append(safe_browsing::FormatList(
-        SBListChunkRanges(safe_browsing::kMalwareList)));
+        SBListChunkRanges(safe_browsing_util::kMalwareList)));
   }
 
   // Large requests are (probably) a sign of database corruption.
diff --git a/chrome/browser/safe_browsing/protocol_manager_unittest.cc b/chrome/browser/safe_browsing/protocol_manager_unittest.cc
index d1705df..31b18f9 100644
--- a/chrome/browser/safe_browsing/protocol_manager_unittest.cc
+++ b/chrome/browser/safe_browsing/protocol_manager_unittest.cc
@@ -408,7 +408,7 @@
   net::TestURLFetcherFactory url_fetcher_factory;
 
   std::vector<SBListChunkRanges> ranges;
-  SBListChunkRanges range_phish(safe_browsing::kPhishingList);
+  SBListChunkRanges range_phish(safe_browsing_util::kPhishingList);
   range_phish.adds = "adds_phish";
   range_phish.subs = "subs_phish";
   ranges.push_back(range_phish);
diff --git a/chrome/browser/safe_browsing/protocol_parser.cc b/chrome/browser/safe_browsing/protocol_parser.cc
index 135e76f6..05378c46 100644
--- a/chrome/browser/safe_browsing/protocol_parser.cc
+++ b/chrome/browser/safe_browsing/protocol_parser.cc
@@ -199,7 +199,7 @@
       return false;
 
     SBFullHashResult full_hash;
-    full_hash.list_id = safe_browsing::GetListId(cmd_parts[0]);
+    full_hash.list_id = safe_browsing_util::GetListId(cmd_parts[0]);
 
     size_t hash_len;
     if (!base::StringToSizeT(cmd_parts[1], &hash_len))
diff --git a/chrome/browser/safe_browsing/protocol_parser_unittest.cc b/chrome/browser/safe_browsing/protocol_parser_unittest.cc
index d145b81..70872b3e 100644
--- a/chrome/browser/safe_browsing/protocol_parser_unittest.cc
+++ b/chrome/browser/safe_browsing/protocol_parser_unittest.cc
@@ -88,10 +88,8 @@
   EXPECT_TRUE(chunks[0]->IsFullHash());
 
   ASSERT_EQ(2U, chunks[0]->FullHashCount());
-  EXPECT_TRUE(
-      safe_browsing::SBFullHashEqual(chunks[0]->FullHashAt(0), full_hash1));
-  EXPECT_TRUE(
-      safe_browsing::SBFullHashEqual(chunks[0]->FullHashAt(1), full_hash2));
+  EXPECT_TRUE(SBFullHashEqual(chunks[0]->FullHashAt(0), full_hash1));
+  EXPECT_TRUE(SBFullHashEqual(chunks[0]->FullHashAt(1), full_hash2));
 }
 
 // Test parsing multiple add chunks. We'll use the same chunk as above, and add
@@ -284,11 +282,9 @@
   EXPECT_TRUE(chunks[0]->IsFullHash());
 
   ASSERT_EQ(2U, chunks[0]->FullHashCount());
-  EXPECT_TRUE(
-      safe_browsing::SBFullHashEqual(chunks[0]->FullHashAt(0), full_hash1));
+  EXPECT_TRUE(SBFullHashEqual(chunks[0]->FullHashAt(0), full_hash1));
   EXPECT_EQ(7, chunks[0]->AddChunkNumberAt(0));
-  EXPECT_TRUE(
-      safe_browsing::SBFullHashEqual(chunks[0]->FullHashAt(1), full_hash2));
+  EXPECT_TRUE(SBFullHashEqual(chunks[0]->FullHashAt(1), full_hash2));
   EXPECT_EQ(9, chunks[0]->AddChunkNumberAt(1));
 }
 
@@ -400,15 +396,15 @@
   EXPECT_EQ(memcmp(&full_hashes[0].hash,
                    "00112233445566778899aabbccddeeff",
                    sizeof(SBFullHash)), 0);
-  EXPECT_EQ(safe_browsing::PHISH, full_hashes[0].list_id);
+  EXPECT_EQ(safe_browsing_util::PHISH, full_hashes[0].list_id);
   EXPECT_EQ(memcmp(&full_hashes[1].hash,
                    "00001111222233334444555566667777",
                    sizeof(SBFullHash)), 0);
-  EXPECT_EQ(safe_browsing::PHISH, full_hashes[1].list_id);
+  EXPECT_EQ(safe_browsing_util::PHISH, full_hashes[1].list_id);
   EXPECT_EQ(memcmp(&full_hashes[2].hash,
                    "ffffeeeeddddccccbbbbaaaa99998888",
                    sizeof(SBFullHash)), 0);
-  EXPECT_EQ(safe_browsing::PHISH, full_hashes[2].list_id);
+  EXPECT_EQ(safe_browsing_util::PHISH, full_hashes[2].list_id);
 
   // Test multiple lists in the GetHash results.
   const std::string get_hash2(base::StringPrintf(
@@ -427,15 +423,15 @@
   EXPECT_EQ(memcmp(&full_hashes[0].hash,
                    "00112233445566778899aabbccddeeff",
                    sizeof(SBFullHash)), 0);
-  EXPECT_EQ(safe_browsing::PHISH, full_hashes[0].list_id);
+  EXPECT_EQ(safe_browsing_util::PHISH, full_hashes[0].list_id);
   EXPECT_EQ(memcmp(&full_hashes[1].hash,
                    "cafebeefcafebeefdeaddeaddeaddead",
                    sizeof(SBFullHash)), 0);
-  EXPECT_EQ(safe_browsing::MALWARE, full_hashes[1].list_id);
+  EXPECT_EQ(safe_browsing_util::MALWARE, full_hashes[1].list_id);
   EXPECT_EQ(memcmp(&full_hashes[2].hash,
                    "zzzzyyyyxxxxwwwwvvvvuuuuttttssss",
                    sizeof(SBFullHash)), 0);
-  EXPECT_EQ(safe_browsing::MALWARE, full_hashes[2].list_id);
+  EXPECT_EQ(safe_browsing_util::MALWARE, full_hashes[2].list_id);
 
   // Test metadata parsing.
   const std::string get_hash3(base::StringPrintf(
@@ -455,17 +451,17 @@
   EXPECT_EQ(memcmp(&full_hashes[0].hash,
                    "zzzzyyyyxxxxwwwwvvvvuuuuttttssss",
                    sizeof(SBFullHash)), 0);
-  EXPECT_EQ(safe_browsing::MALWARE, full_hashes[0].list_id);
+  EXPECT_EQ(safe_browsing_util::MALWARE, full_hashes[0].list_id);
   EXPECT_EQ(std::string("ab"), full_hashes[0].metadata);
   EXPECT_EQ(memcmp(&full_hashes[1].hash,
                    "00112233445566778899aabbccddeeff",
                    sizeof(SBFullHash)), 0);
-  EXPECT_EQ(safe_browsing::MALWARE, full_hashes[1].list_id);
+  EXPECT_EQ(safe_browsing_util::MALWARE, full_hashes[1].list_id);
   EXPECT_EQ(std::string("xy"), full_hashes[1].metadata);
   EXPECT_EQ(memcmp(&full_hashes[2].hash,
                    "cafebeefcafebeefdeaddeaddeaddead",
                    sizeof(SBFullHash)), 0);
-  EXPECT_EQ(safe_browsing::PHISH, full_hashes[2].list_id);
+  EXPECT_EQ(safe_browsing_util::PHISH, full_hashes[2].list_id);
   EXPECT_EQ(std::string(), full_hashes[2].metadata);
 }
 
@@ -487,7 +483,7 @@
   ASSERT_EQ(1U, full_hashes.size());
   EXPECT_EQ(memcmp("12345678901234567890123456789012",
                    &full_hashes[0].hash, sizeof(SBFullHash)), 0);
-  EXPECT_EQ(safe_browsing::PHISH, full_hashes[0].list_id);
+  EXPECT_EQ(safe_browsing_util::PHISH, full_hashes[0].list_id);
 
   hash_response += base::StringPrintf(
       "%s:32:1\n"
@@ -502,10 +498,10 @@
   EXPECT_EQ(2U, full_hashes.size());
   EXPECT_EQ(memcmp("12345678901234567890123456789012",
                    &full_hashes[0].hash, sizeof(SBFullHash)), 0);
-  EXPECT_EQ(safe_browsing::PHISH, full_hashes[0].list_id);
+  EXPECT_EQ(safe_browsing_util::PHISH, full_hashes[0].list_id);
   EXPECT_EQ(memcmp("abcdefghijklmnopqrstuvwxyz123457",
                    &full_hashes[1].hash, sizeof(SBFullHash)), 0);
-  EXPECT_EQ(safe_browsing::MALWARE, full_hashes[1].list_id);
+  EXPECT_EQ(safe_browsing_util::MALWARE, full_hashes[1].list_id);
 }
 
 TEST(SafeBrowsingProtocolParsingTest, TestGetHashWithUnknownListAndMetadata) {
@@ -527,7 +523,7 @@
   EXPECT_EQ(memcmp(&full_hashes[0].hash,
                    "0123456789hashhashhashhashhashha",
                    sizeof(SBFullHash)), 0);
-  EXPECT_EQ(safe_browsing::MALWARE, full_hashes[0].list_id);
+  EXPECT_EQ(safe_browsing_util::MALWARE, full_hashes[0].list_id);
   EXPECT_EQ(std::string(), full_hashes[0].metadata);
 }
 
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
index 9decd2a..92c7c85 100644
--- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
@@ -92,7 +92,7 @@
         std::vector<GURL>(1, gurl),
         std::vector<SBFullHash>(),
         client,
-        safe_browsing::MALWARE,
+        safe_browsing_util::MALWARE,
         expected_threats);
     sb_check.url_results[0] = badurls[gurl.spec()];
     sb_check.OnSafeBrowsingResult();
diff --git a/chrome/browser/safe_browsing/safe_browsing_database.cc b/chrome/browser/safe_browsing/safe_browsing_database.cc
index 80c16f7b..81948a6 100644
--- a/chrome/browser/safe_browsing/safe_browsing_database.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_database.cc
@@ -107,7 +107,7 @@
   return encoded_chunk_id >> 1;
 }
 int EncodeChunkId(const int chunk, const int list_id) {
-  DCHECK_NE(list_id, safe_browsing::INVALID);
+  DCHECK_NE(list_id, safe_browsing_util::INVALID);
   return chunk << 1 | list_id % 2;
 }
 
@@ -128,17 +128,16 @@
   if (url.HostIsIPAddress()) {
     hosts.push_back(url.host());
   } else {
-    safe_browsing::GenerateHostsToCheck(url, &hosts);
+    safe_browsing_util::GenerateHostsToCheck(url, &hosts);
   }
 
   std::vector<std::string> paths;
-  safe_browsing::GeneratePathsToCheck(url, &paths);
+  safe_browsing_util::GeneratePathsToCheck(url, &paths);
 
   for (size_t i = 0; i < hosts.size(); ++i) {
     for (size_t j = 0; j < paths.size(); ++j) {
       const std::string& path = paths[j];
-      full_hashes->push_back(safe_browsing::SBFullHashForString(
-          hosts[i] + path));
+      full_hashes->push_back(SBFullHashForString(hosts[i] + path));
 
       // We may have /foo as path-prefix in the whitelist which should
       // also match with /foo/bar and /foo?bar.  Hence, for every path
@@ -147,8 +146,7 @@
           path.size() > 1 &&
           path[path.size() - 1] == '/') {
         full_hashes->push_back(
-            safe_browsing::SBFullHashForString(
-                hosts[i] + path.substr(0, path.size() - 1)));
+            SBFullHashForString(hosts[i] + path.substr(0, path.size() - 1)));
       }
     }
   }
@@ -232,10 +230,10 @@
 
   for (size_t i = 0; i < listnames.size(); ++i) {
     const std::string& listname = listnames[i];
-    DCHECK_EQ(safe_browsing::GetListId(listname) % 2,
+    DCHECK_EQ(safe_browsing_util::GetListId(listname) % 2,
               static_cast<int>(i % 2));
-    DCHECK_NE(safe_browsing::GetListId(listname),
-              safe_browsing::INVALID);
+    DCHECK_NE(safe_browsing_util::GetListId(listname),
+              safe_browsing_util::INVALID);
     lists->push_back(SBListChunkRanges(listname));
     lists->back().adds.swap(adds[i]);
     lists->back().subs.swap(subs[i]);
@@ -291,7 +289,7 @@
   // Find full-hash matches.
   std::vector<SBFullHashResult>& cached_hashes = cached_result.full_hashes;
   for (size_t i = 0; i < cached_hashes.size(); ++i) {
-    if (safe_browsing::SBFullHashEqual(full_hash, cached_hashes[i].hash))
+    if (SBFullHashEqual(full_hash, cached_hashes[i].hash))
       results->push_back(cached_hashes[i]);
   }
 
@@ -447,22 +445,22 @@
   // Stores are not thread safe.
   DCHECK(db_task_runner_->RunsTasksOnCurrentThread());
 
-  if (list_id == safe_browsing::PHISH ||
-      list_id == safe_browsing::MALWARE) {
+  if (list_id == safe_browsing_util::PHISH ||
+      list_id == safe_browsing_util::MALWARE) {
     return browse_store_.get();
-  } else if (list_id == safe_browsing::BINURL) {
+  } else if (list_id == safe_browsing_util::BINURL) {
     return download_store_.get();
-  } else if (list_id == safe_browsing::CSDWHITELIST) {
+  } else if (list_id == safe_browsing_util::CSDWHITELIST) {
     return csd_whitelist_store_.get();
-  } else if (list_id == safe_browsing::DOWNLOADWHITELIST) {
+  } else if (list_id == safe_browsing_util::DOWNLOADWHITELIST) {
     return download_whitelist_store_.get();
-  } else if (list_id == safe_browsing::INCLUSIONWHITELIST) {
+  } else if (list_id == safe_browsing_util::INCLUSIONWHITELIST) {
     return inclusion_whitelist_store_.get();
-  } else if (list_id == safe_browsing::EXTENSIONBLACKLIST) {
+  } else if (list_id == safe_browsing_util::EXTENSIONBLACKLIST) {
     return extension_blacklist_store_.get();
-  } else if (list_id == safe_browsing::IPBLACKLIST) {
+  } else if (list_id == safe_browsing_util::IPBLACKLIST) {
     return ip_blacklist_store_.get();
-  } else if (list_id == safe_browsing::UNWANTEDURL) {
+  } else if (list_id == safe_browsing_util::UNWANTEDURL) {
     return unwanted_software_store_.get();
   }
   return NULL;
@@ -917,7 +915,7 @@
     return false;
 
   return MatchAddPrefixes(download_store_.get(),
-                          safe_browsing::BINURL % 2,
+                          safe_browsing_util::BINURL % 2,
                           prefixes,
                           prefix_hits);
 }
@@ -949,7 +947,7 @@
     return false;
 
   return MatchAddPrefixes(extension_blacklist_store_.get(),
-                          safe_browsing::EXTENSIONBLACKLIST % 2,
+                          safe_browsing_util::EXTENSIONBLACKLIST % 2,
                           prefixes,
                           prefix_hits);
 }
@@ -989,7 +987,7 @@
 bool SafeBrowsingDatabaseNew::ContainsDownloadWhitelistedString(
     const std::string& str) {
   std::vector<SBFullHash> hashes;
-  hashes.push_back(safe_browsing::SBFullHashForString(str));
+  hashes.push_back(SBFullHashForString(str));
   return ContainsWhitelistedHashes(SBWhitelistId::DOWNLOAD, hashes);
 }
 
@@ -1003,7 +1001,7 @@
   for (std::vector<SBFullHash>::const_iterator it = hashes.begin();
        it != hashes.end(); ++it) {
     if (std::binary_search(whitelist->first.begin(), whitelist->first.end(),
-                           *it, safe_browsing::SBFullHashLess)) {
+                           *it, SBFullHashLess)) {
       return true;
     }
   }
@@ -1013,7 +1011,7 @@
 // Helper to insert add-chunk entries.
 void SafeBrowsingDatabaseNew::InsertAddChunk(
     SafeBrowsingStore* store,
-    const safe_browsing::ListType list_id,
+    const safe_browsing_util::ListType list_id,
     const SBChunkData& chunk_data) {
   DCHECK(db_task_runner_->RunsTasksOnCurrentThread());
   DCHECK(store);
@@ -1042,7 +1040,7 @@
 // Helper to insert sub-chunk entries.
 void SafeBrowsingDatabaseNew::InsertSubChunk(
     SafeBrowsingStore* store,
-    const safe_browsing::ListType list_id,
+    const safe_browsing_util::ListType list_id,
     const SBChunkData& chunk_data) {
   DCHECK(db_task_runner_->RunsTasksOnCurrentThread());
   DCHECK(store);
@@ -1085,8 +1083,8 @@
   const base::TimeTicks before = base::TimeTicks::Now();
 
   // TODO(shess): The caller should just pass list_id.
-  const safe_browsing::ListType list_id =
-      safe_browsing::GetListId(list_name);
+  const safe_browsing_util::ListType list_id =
+      safe_browsing_util::GetListId(list_name);
 
   SafeBrowsingStore* store = GetStore(list_id);
   if (!store) return;
@@ -1118,8 +1116,8 @@
     return;
 
   const std::string& list_name = chunk_deletes.front().list_name;
-  const safe_browsing::ListType list_id =
-      safe_browsing::GetListId(list_name);
+  const safe_browsing_util::ListType list_id =
+      safe_browsing_util::GetListId(list_name);
 
   SafeBrowsingStore* store = GetStore(list_id);
   if (!store) return;
@@ -1223,8 +1221,8 @@
   state_manager_.BeginWriteTransaction()->clear_prefix_gethash_cache();
 
   UpdateChunkRangesForLists(browse_store_.get(),
-                            safe_browsing::kMalwareList,
-                            safe_browsing::kPhishingList,
+                            safe_browsing_util::kMalwareList,
+                            safe_browsing_util::kPhishingList,
                             lists);
 
   // NOTE(shess): |download_store_| used to contain kBinHashList, which has been
@@ -1232,25 +1230,25 @@
   // of Feb 2014, so it has been removed.  Everything _should_ be resilient to
   // extra data of that sort.
   UpdateChunkRangesForList(download_store_.get(),
-                           safe_browsing::kBinUrlList, lists);
+                           safe_browsing_util::kBinUrlList, lists);
 
   UpdateChunkRangesForList(csd_whitelist_store_.get(),
-                           safe_browsing::kCsdWhiteList, lists);
+                           safe_browsing_util::kCsdWhiteList, lists);
 
   UpdateChunkRangesForList(download_whitelist_store_.get(),
-                           safe_browsing::kDownloadWhiteList, lists);
+                           safe_browsing_util::kDownloadWhiteList, lists);
 
   UpdateChunkRangesForList(inclusion_whitelist_store_.get(),
-                           safe_browsing::kInclusionWhitelist, lists);
+                           safe_browsing_util::kInclusionWhitelist, lists);
 
   UpdateChunkRangesForList(extension_blacklist_store_.get(),
-                           safe_browsing::kExtensionBlacklist, lists);
+                           safe_browsing_util::kExtensionBlacklist, lists);
 
   UpdateChunkRangesForList(ip_blacklist_store_.get(),
-                           safe_browsing::kIPBlacklist, lists);
+                           safe_browsing_util::kIPBlacklist, lists);
 
   UpdateChunkRangesForList(unwanted_software_store_.get(),
-                           safe_browsing::kUnwantedUrlList,
+                           safe_browsing_util::kUnwantedUrlList,
                            lists);
 
   db_state_manager_.reset_corruption_detected();
@@ -1704,13 +1702,11 @@
        it != full_hashes.end(); ++it) {
     new_whitelist.push_back(it->full_hash);
   }
-  std::sort(new_whitelist.begin(), new_whitelist.end(),
-            safe_browsing::SBFullHashLess);
+  std::sort(new_whitelist.begin(), new_whitelist.end(), SBFullHashLess);
 
-  SBFullHash kill_switch = safe_browsing::SBFullHashForString(
-      kWhitelistKillSwitchUrl);
+  SBFullHash kill_switch = SBFullHashForString(kWhitelistKillSwitchUrl);
   if (std::binary_search(new_whitelist.begin(), new_whitelist.end(),
-                         kill_switch, safe_browsing::SBFullHashLess)) {
+                         kill_switch, SBFullHashLess)) {
     // The kill switch is whitelisted hence we whitelist all URLs.
     state_manager_.BeginWriteTransaction()->WhitelistEverything(whitelist_id);
   } else {
@@ -1760,8 +1756,7 @@
 }
 
 bool SafeBrowsingDatabaseNew::IsMalwareIPMatchKillSwitchOn() {
-  SBFullHash malware_kill_switch = safe_browsing::SBFullHashForString(
-      kMalwareIPKillSwitchUrl);
+  SBFullHash malware_kill_switch = SBFullHashForString(kMalwareIPKillSwitchUrl);
   std::vector<SBFullHash> full_hashes;
   full_hashes.push_back(malware_kill_switch);
   return ContainsWhitelistedHashes(SBWhitelistId::CSD, full_hashes);
diff --git a/chrome/browser/safe_browsing/safe_browsing_database.h b/chrome/browser/safe_browsing/safe_browsing_database.h
index 22642a2..4d57ea3 100644
--- a/chrome/browser/safe_browsing/safe_browsing_database.h
+++ b/chrome/browser/safe_browsing/safe_browsing_database.h
@@ -19,7 +19,6 @@
 #include "base/synchronization/lock.h"
 #include "base/time/time.h"
 #include "chrome/browser/safe_browsing/safe_browsing_store.h"
-#include "components/safe_browsing_db/util.h"
 
 namespace safe_browsing {
 class PrefixSet;
@@ -591,10 +590,10 @@
 
   // Helpers for InsertChunks().
   void InsertAddChunk(SafeBrowsingStore* store,
-                      safe_browsing::ListType list_id,
+                      safe_browsing_util::ListType list_id,
                       const SBChunkData& chunk);
   void InsertSubChunk(SafeBrowsingStore* store,
-                      safe_browsing::ListType list_id,
+                      safe_browsing_util::ListType list_id,
                       const SBChunkData& chunk);
 
   // Updates the |store| and stores the result on disk under |store_filename|.
diff --git a/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc
index 33328129..75e4030b 100644
--- a/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc
@@ -32,7 +32,7 @@
 const TimeDelta kCacheLifetime = TimeDelta::FromMinutes(45);
 
 SBPrefix SBPrefixForString(const std::string& str) {
-  return safe_browsing::SBFullHashForString(str).prefix;
+  return SBFullHashForString(str).prefix;
 }
 
 // Construct a full hash which has the given prefix, with the given
@@ -135,8 +135,7 @@
 // Generate an add chunk with a full hash generated from |value|.
 SBChunkData* AddChunkFullHashValue(int chunk_number,
                                    const std::string& value) {
-  return AddChunkFullHash(chunk_number,
-                          safe_browsing::SBFullHashForString(value));
+  return AddChunkFullHash(chunk_number, SBFullHashForString(value));
 }
 
 // Generate an add chunk with two full hashes.
@@ -144,8 +143,8 @@
                                    const std::string& value1,
                                    const std::string& value2) {
   const SBFullHash full_hashes[2] = {
-    safe_browsing::SBFullHashForString(value1),
-    safe_browsing::SBFullHashForString(value2),
+    SBFullHashForString(value1),
+    SBFullHashForString(value2),
   };
   return BuildChunk(chunk_number, safe_browsing::ChunkData::ADD,
                     safe_browsing::ChunkData::FULL_32B,
@@ -198,7 +197,7 @@
                                    const std::string& value,
                                    int add_chunk_number) {
   return SubChunkFullHash(chunk_number,
-                          safe_browsing::SBFullHashForString(value),
+                          SBFullHashForString(value),
                           add_chunk_number);
 }
 
@@ -352,12 +351,12 @@
   chunks.push_back(AddChunkPrefixValue(3, "www.whatever.com/malware.html"));
 
   ASSERT_TRUE(database_->UpdateStarted(&lists));
-  database_->InsertChunks(safe_browsing::kMalwareList, chunks.get());
+  database_->InsertChunks(safe_browsing_util::kMalwareList, chunks.get());
   database_->UpdateFinished(true);
 
   GetListsInfo(&lists);
   ASSERT_LE(1U, lists.size());
-  EXPECT_EQ(safe_browsing::kMalwareList, lists[0].name);
+  EXPECT_EQ(safe_browsing_util::kMalwareList, lists[0].name);
   EXPECT_EQ("1-3", lists[0].adds);
   EXPECT_TRUE(lists[0].subs.empty());
 
@@ -366,19 +365,19 @@
   chunks.push_back(SubChunkPrefixValue(7, "www.subbed.com/noteveil1.html", 19));
 
   ASSERT_TRUE(database_->UpdateStarted(&lists));
-  database_->InsertChunks(safe_browsing::kMalwareList, chunks.get());
+  database_->InsertChunks(safe_browsing_util::kMalwareList, chunks.get());
   database_->UpdateFinished(true);
 
   GetListsInfo(&lists);
   ASSERT_LE(1U, lists.size());
-  EXPECT_EQ(safe_browsing::kMalwareList, lists[0].name);
+  EXPECT_EQ(safe_browsing_util::kMalwareList, lists[0].name);
   EXPECT_EQ("1-3", lists[0].adds);
   EXPECT_EQ("7", lists[0].subs);
   if (lists.size() == 2) {
     // Old style database won't have the second entry since it creates the lists
     // when it receives an update containing that list. The filter-based
     // database has these values hard coded.
-    EXPECT_EQ(safe_browsing::kPhishingList, lists[1].name);
+    EXPECT_EQ(safe_browsing_util::kPhishingList, lists[1].name);
     EXPECT_TRUE(lists[1].adds.empty());
     EXPECT_TRUE(lists[1].subs.empty());
   }
@@ -392,15 +391,15 @@
       SubChunkPrefixValue(201, "www.phishy2.com/notevil1.html", 1999));
 
   ASSERT_TRUE(database_->UpdateStarted(&lists));
-  database_->InsertChunks(safe_browsing::kPhishingList, chunks.get());
+  database_->InsertChunks(safe_browsing_util::kPhishingList, chunks.get());
   database_->UpdateFinished(true);
 
   GetListsInfo(&lists);
   ASSERT_LE(2U, lists.size());
-  EXPECT_EQ(safe_browsing::kMalwareList, lists[0].name);
+  EXPECT_EQ(safe_browsing_util::kMalwareList, lists[0].name);
   EXPECT_EQ("1-3", lists[0].adds);
   EXPECT_EQ("7", lists[0].subs);
-  EXPECT_EQ(safe_browsing::kPhishingList, lists[1].name);
+  EXPECT_EQ(safe_browsing_util::kPhishingList, lists[1].name);
   EXPECT_EQ("47", lists[1].adds);
   EXPECT_EQ("200-201", lists[1].subs);
 }
@@ -413,73 +412,73 @@
 
   // Insert malware, phish, binurl and bindownload add chunks.
   chunks.push_back(AddChunkPrefixValue(1, "www.evil.com/malware.html"));
-  database_->InsertChunks(safe_browsing::kMalwareList, chunks.get());
+  database_->InsertChunks(safe_browsing_util::kMalwareList, chunks.get());
 
   chunks.clear();
   chunks.push_back(AddChunkPrefixValue(2, "www.foo.com/malware.html"));
-  database_->InsertChunks(safe_browsing::kPhishingList, chunks.get());
+  database_->InsertChunks(safe_browsing_util::kPhishingList, chunks.get());
 
   chunks.clear();
   chunks.push_back(AddChunkPrefixValue(3, "www.whatever.com/download.html"));
-  database_->InsertChunks(safe_browsing::kBinUrlList, chunks.get());
+  database_->InsertChunks(safe_browsing_util::kBinUrlList, chunks.get());
 
   chunks.clear();
   chunks.push_back(AddChunkFullHashValue(5, "www.forwhitelist.com/a.html"));
-  database_->InsertChunks(safe_browsing::kCsdWhiteList, chunks.get());
+  database_->InsertChunks(safe_browsing_util::kCsdWhiteList, chunks.get());
 
   chunks.clear();
   chunks.push_back(AddChunkFullHashValue(6, "www.download.com/"));
-  database_->InsertChunks(safe_browsing::kDownloadWhiteList, chunks.get());
+  database_->InsertChunks(safe_browsing_util::kDownloadWhiteList, chunks.get());
 
   chunks.clear();
   chunks.push_back(AddChunkFullHashValue(7, "www.inclusion.com/"));
-  database_->InsertChunks(safe_browsing::kInclusionWhitelist,
+  database_->InsertChunks(safe_browsing_util::kInclusionWhitelist,
                           chunks.get());
 
   chunks.clear();
   chunks.push_back(AddChunkFullHashValue(8,
                                          "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
                                          "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"));
-  database_->InsertChunks(safe_browsing::kExtensionBlacklist,
+  database_->InsertChunks(safe_browsing_util::kExtensionBlacklist,
                           chunks.get());
 
   chunks.clear();
   chunks.push_back(AddChunkHashedIpValue(10, "::ffff:192.168.1.0", 120));
-  database_->InsertChunks(safe_browsing::kIPBlacklist, chunks.get());
+  database_->InsertChunks(safe_browsing_util::kIPBlacklist, chunks.get());
 
   chunks.clear();
   chunks.push_back(AddChunkPrefixValue(11, "www.unwanted.com/software.html"));
-  database_->InsertChunks(safe_browsing::kUnwantedUrlList, chunks.get());
+  database_->InsertChunks(safe_browsing_util::kUnwantedUrlList, chunks.get());
 
   database_->UpdateFinished(true);
 
   GetListsInfo(&lists);
   ASSERT_EQ(9U, lists.size());
-  EXPECT_EQ(safe_browsing::kMalwareList, lists[0].name);
+  EXPECT_EQ(safe_browsing_util::kMalwareList, lists[0].name);
   EXPECT_EQ("1", lists[0].adds);
   EXPECT_TRUE(lists[0].subs.empty());
-  EXPECT_EQ(safe_browsing::kPhishingList, lists[1].name);
+  EXPECT_EQ(safe_browsing_util::kPhishingList, lists[1].name);
   EXPECT_EQ("2", lists[1].adds);
   EXPECT_TRUE(lists[1].subs.empty());
-  EXPECT_EQ(safe_browsing::kBinUrlList, lists[2].name);
+  EXPECT_EQ(safe_browsing_util::kBinUrlList, lists[2].name);
   EXPECT_EQ("3", lists[2].adds);
   EXPECT_TRUE(lists[2].subs.empty());
-  EXPECT_EQ(safe_browsing::kCsdWhiteList, lists[3].name);
+  EXPECT_EQ(safe_browsing_util::kCsdWhiteList, lists[3].name);
   EXPECT_EQ("5", lists[3].adds);
   EXPECT_TRUE(lists[3].subs.empty());
-  EXPECT_EQ(safe_browsing::kDownloadWhiteList, lists[4].name);
+  EXPECT_EQ(safe_browsing_util::kDownloadWhiteList, lists[4].name);
   EXPECT_EQ("6", lists[4].adds);
   EXPECT_TRUE(lists[4].subs.empty());
-  EXPECT_EQ(safe_browsing::kInclusionWhitelist, lists[5].name);
+  EXPECT_EQ(safe_browsing_util::kInclusionWhitelist, lists[5].name);
   EXPECT_EQ("7", lists[5].adds);
   EXPECT_TRUE(lists[5].subs.empty());
-  EXPECT_EQ(safe_browsing::kExtensionBlacklist, lists[6].name);
+  EXPECT_EQ(safe_browsing_util::kExtensionBlacklist, lists[6].name);
   EXPECT_EQ("8", lists[6].adds);
   EXPECT_TRUE(lists[6].subs.empty());
-  EXPECT_EQ(safe_browsing::kIPBlacklist, lists[7].name);
+  EXPECT_EQ(safe_browsing_util::kIPBlacklist, lists[7].name);
   EXPECT_EQ("10", lists[7].adds);
   EXPECT_TRUE(lists[7].subs.empty());
-  EXPECT_EQ(safe_browsing::kUnwantedUrlList, lists[8].name);
+  EXPECT_EQ(safe_browsing_util::kUnwantedUrlList, lists[8].name);
   EXPECT_EQ("11", lists[8].adds);
   EXPECT_TRUE(lists[8].subs.empty());
 
@@ -498,11 +497,11 @@
     size_t expected_list_index;
     TestListContainsBadUrl test_list_contains_bad_url;
   } const kTestCases[] {
-    { safe_browsing::kMalwareList, 0U,
+    { safe_browsing_util::kMalwareList, 0U,
       &SafeBrowsingDatabase::ContainsBrowseUrl },
-    { safe_browsing::kPhishingList, 1U,
+    { safe_browsing_util::kPhishingList, 1U,
       &SafeBrowsingDatabase::ContainsBrowseUrl },
-    { safe_browsing::kUnwantedUrlList, 8U,
+    { safe_browsing_util::kUnwantedUrlList, 8U,
       &SafeBrowsingDatabase::ContainsUnwantedSoftwareUrl },
   };
 
@@ -758,13 +757,13 @@
                                         "www.random.com/random2.html"));
 
   ASSERT_TRUE(database_->UpdateStarted(&lists));
-  database_->InsertChunks(safe_browsing::kMalwareList, chunks.get());
+  database_->InsertChunks(safe_browsing_util::kMalwareList, chunks.get());
   database_->UpdateFinished(true);
 
   // Add an empty ADD and SUB chunk.
   GetListsInfo(&lists);
   ASSERT_LE(1U, lists.size());
-  EXPECT_EQ(safe_browsing::kMalwareList, lists[0].name);
+  EXPECT_EQ(safe_browsing_util::kMalwareList, lists[0].name);
   EXPECT_EQ("1,10", lists[0].adds);
   EXPECT_TRUE(lists[0].subs.empty());
 
@@ -777,12 +776,12 @@
                               NULL, 0, std::vector<int>()));
 
   ASSERT_TRUE(database_->UpdateStarted(&lists));
-  database_->InsertChunks(safe_browsing::kMalwareList, chunks.get());
+  database_->InsertChunks(safe_browsing_util::kMalwareList, chunks.get());
   database_->UpdateFinished(true);
 
   GetListsInfo(&lists);
   ASSERT_LE(1U, lists.size());
-  EXPECT_EQ(safe_browsing::kMalwareList, lists[0].name);
+  EXPECT_EQ(safe_browsing_util::kMalwareList, lists[0].name);
   EXPECT_EQ("1,10,19", lists[0].adds);
   EXPECT_EQ("7", lists[0].subs);
 
@@ -796,7 +795,7 @@
   chunks.push_back(AddChunkPrefixValue(22, "www.notempty.com/full2.html"));
 
   ASSERT_TRUE(database_->UpdateStarted(&lists));
-  database_->InsertChunks(safe_browsing::kMalwareList, chunks.get());
+  database_->InsertChunks(safe_browsing_util::kMalwareList, chunks.get());
   database_->UpdateFinished(true);
 
   std::vector<SBPrefix> prefix_hits;
@@ -808,28 +807,28 @@
 
   GetListsInfo(&lists);
   ASSERT_LE(1U, lists.size());
-  EXPECT_EQ(safe_browsing::kMalwareList, lists[0].name);
+  EXPECT_EQ(safe_browsing_util::kMalwareList, lists[0].name);
   EXPECT_EQ("1,10,19-22", lists[0].adds);
   EXPECT_EQ("7", lists[0].subs);
 
   // Handle AddDel and SubDel commands for empty chunks.
   ASSERT_TRUE(database_->UpdateStarted(&lists));
-  AddDelChunk(safe_browsing::kMalwareList, 21);
+  AddDelChunk(safe_browsing_util::kMalwareList, 21);
   database_->UpdateFinished(true);
 
   GetListsInfo(&lists);
   ASSERT_LE(1U, lists.size());
-  EXPECT_EQ(safe_browsing::kMalwareList, lists[0].name);
+  EXPECT_EQ(safe_browsing_util::kMalwareList, lists[0].name);
   EXPECT_EQ("1,10,19-20,22", lists[0].adds);
   EXPECT_EQ("7", lists[0].subs);
 
   ASSERT_TRUE(database_->UpdateStarted(&lists));
-  SubDelChunk(safe_browsing::kMalwareList, 7);
+  SubDelChunk(safe_browsing_util::kMalwareList, 7);
   database_->UpdateFinished(true);
 
   GetListsInfo(&lists);
   ASSERT_LE(1U, lists.size());
-  EXPECT_EQ(safe_browsing::kMalwareList, lists[0].name);
+  EXPECT_EQ(safe_browsing_util::kMalwareList, lists[0].name);
   EXPECT_EQ("1,10,19-20,22", lists[0].adds);
   EXPECT_TRUE(lists[0].subs.empty());
 }
@@ -844,7 +843,7 @@
 
   std::vector<SBListChunkRanges> lists;
   ASSERT_TRUE(database_->UpdateStarted(&lists));
-  database_->InsertChunks(safe_browsing::kMalwareList, chunks.get());
+  database_->InsertChunks(safe_browsing_util::kMalwareList, chunks.get());
   database_->UpdateFinished(true);
 
   // Cache should be cleared after updating.
@@ -852,19 +851,17 @@
       database_->GetUnsynchronizedPrefixGetHashCacheForTesting()->empty());
 
   SBFullHashResult full_hash;
-  full_hash.list_id = safe_browsing::MALWARE;
+  full_hash.list_id = safe_browsing_util::MALWARE;
 
   std::vector<SBFullHashResult> results;
   std::vector<SBPrefix> prefixes;
 
   // Add a fullhash result for each prefix.
-  full_hash.hash =
-      safe_browsing::SBFullHashForString("www.evil.com/phishing.html");
+  full_hash.hash = SBFullHashForString("www.evil.com/phishing.html");
   results.push_back(full_hash);
   prefixes.push_back(full_hash.hash.prefix);
 
-  full_hash.hash =
-      safe_browsing::SBFullHashForString("www.evil.com/malware.html");
+  full_hash.hash = SBFullHashForString("www.evil.com/malware.html");
   results.push_back(full_hash);
   prefixes.push_back(full_hash.hash.prefix);
 
@@ -885,9 +882,8 @@
       GURL("http://www.evil.com/phishing.html"), &prefix_hits, &cache_hits));
   EXPECT_TRUE(prefix_hits.empty());
   ASSERT_EQ(1U, cache_hits.size());
-  EXPECT_TRUE(safe_browsing::SBFullHashEqual(
-      cache_hits[0].hash,
-      safe_browsing::SBFullHashForString("www.evil.com/phishing.html")));
+  EXPECT_TRUE(SBFullHashEqual(
+      cache_hits[0].hash, SBFullHashForString("www.evil.com/phishing.html")));
 
   prefix_hits.clear();
   cache_hits.clear();
@@ -897,9 +893,8 @@
       GURL("http://www.evil.com/malware.html"), &prefix_hits, &cache_hits));
   EXPECT_TRUE(prefix_hits.empty());
   ASSERT_EQ(1U, cache_hits.size());
-  EXPECT_TRUE(safe_browsing::SBFullHashEqual(
-      cache_hits[0].hash,
-      safe_browsing::SBFullHashForString("www.evil.com/malware.html")));
+  EXPECT_TRUE(SBFullHashEqual(
+      cache_hits[0].hash, SBFullHashForString("www.evil.com/malware.html")));
 
   prefix_hits.clear();
   cache_hits.clear();
@@ -910,7 +905,7 @@
 
   std::vector<SBListChunkRanges> lists;
   ASSERT_TRUE(database_->UpdateStarted(&lists));
-  database_->InsertChunks(safe_browsing::kMalwareList, chunks.get());
+  database_->InsertChunks(safe_browsing_util::kMalwareList, chunks.get());
   database_->UpdateFinished(true);
 
   // This prefix should still be there, but cached fullhash should be gone.
@@ -930,7 +925,7 @@
 
   // Test that an AddDel for the original chunk removes the last cached entry.
   ASSERT_TRUE(database_->UpdateStarted(&lists));
-  AddDelChunk(safe_browsing::kMalwareList, 1);
+  AddDelChunk(safe_browsing_util::kMalwareList, 1);
   database_->UpdateFinished(true);
   EXPECT_FALSE(database_->ContainsBrowseUrl(
       GURL("http://www.evil.com/malware.html"), &prefix_hits, &cache_hits));
@@ -972,7 +967,7 @@
   // Since PopulateDatabaseForCacheTest() doesn't handle adding duplicate
   // chunks.
   ASSERT_TRUE(database_->UpdateStarted(&lists));
-  AddDelChunk(safe_browsing::kMalwareList, 1);
+  AddDelChunk(safe_browsing_util::kMalwareList, 1);
   database_->UpdateFinished(true);
 
   // Cache should be cleared after updating.
@@ -1021,7 +1016,7 @@
                                           "www.fullevil.com/bad1.html",
                                           "www.fullevil.com/bad2.html"));
   ASSERT_TRUE(database_->UpdateStarted(&lists));
-  database_->InsertChunks(safe_browsing::kMalwareList, chunks.get());
+  database_->InsertChunks(safe_browsing_util::kMalwareList, chunks.get());
   database_->UpdateFinished(true);
 
   EXPECT_TRUE(database_->ContainsBrowseUrl(
@@ -1046,7 +1041,7 @@
                                          "www.fullevil.com/bad1.html",
                                          20));
   ASSERT_TRUE(database_->UpdateStarted(&lists));
-  database_->InsertChunks(safe_browsing::kMalwareList, chunks.get());
+  database_->InsertChunks(safe_browsing_util::kMalwareList, chunks.get());
   database_->UpdateFinished(true);
 
   EXPECT_FALSE(database_->ContainsBrowseUrl(
@@ -1063,7 +1058,7 @@
 
   // Now test an AddDel for the remaining full add.
   ASSERT_TRUE(database_->UpdateStarted(&lists));
-  AddDelChunk(safe_browsing::kMalwareList, 20);
+  AddDelChunk(safe_browsing_util::kMalwareList, 20);
   database_->UpdateFinished(true);
 
   EXPECT_FALSE(database_->ContainsBrowseUrl(
@@ -1081,7 +1076,7 @@
   {
     ScopedVector<SBChunkData> chunks;
     chunks.push_back(AddChunkPrefixValue(21, kExampleCollision));
-    database_->InsertChunks(safe_browsing::kMalwareList, chunks.get());
+    database_->InsertChunks(safe_browsing_util::kMalwareList, chunks.get());
   }
   database_->UpdateFinished(true);
 
@@ -1096,8 +1091,8 @@
   // Cache gethash response for |kExampleCollision|.
   {
     SBFullHashResult result;
-    result.hash = safe_browsing::SBFullHashForString(kExampleCollision);
-    result.list_id = safe_browsing::MALWARE;
+    result.hash = SBFullHashForString(kExampleCollision);
+    result.list_id = safe_browsing_util::MALWARE;
     database_->CacheHashResults(std::vector<SBPrefix>(1, result.hash.prefix),
                                 std::vector<SBFullHashResult>(1, result),
                                 kCacheLifetime);
@@ -1150,7 +1145,7 @@
 
     // Start an update.  The insert will fail due to corruption.
     ASSERT_TRUE(database_->UpdateStarted(&lists));
-    database_->InsertChunks(safe_browsing::kMalwareList, chunks.get());
+    database_->InsertChunks(safe_browsing_util::kMalwareList, chunks.get());
     database_->UpdateFinished(true);
 
     // Database file still exists until the corruption handler has run.
@@ -1166,7 +1161,7 @@
 
   // Run the update again successfully.
   ASSERT_TRUE(database_->UpdateStarted(&lists));
-  database_->InsertChunks(safe_browsing::kMalwareList, chunks.get());
+  database_->InsertChunks(safe_browsing_util::kMalwareList, chunks.get());
   database_->UpdateFinished(true);
   EXPECT_TRUE(base::PathExists(database_filename_));
 
@@ -1184,7 +1179,7 @@
 
   std::vector<SBListChunkRanges> lists;
   ASSERT_TRUE(database_->UpdateStarted(&lists));
-  database_->InsertChunks(safe_browsing::kBinUrlList, chunks.get());
+  database_->InsertChunks(safe_browsing_util::kBinUrlList, chunks.get());
   database_->UpdateFinished(true);
 
   std::vector<SBPrefix> prefix_hits;
@@ -1281,13 +1276,13 @@
     // for strings.
     TestListContainsWhitelistedString test_list_contains_whitelisted_string;
   } const kTestCases[]{
-      {safe_browsing::kCsdWhiteList,
+      {safe_browsing_util::kCsdWhiteList,
        &SafeBrowsingDatabase::ContainsCsdWhitelistedUrl,
        nullptr},
-      {safe_browsing::kDownloadWhiteList,
+      {safe_browsing_util::kDownloadWhiteList,
        &SafeBrowsingDatabase::ContainsDownloadWhitelistedUrl,
        &SafeBrowsingDatabase::ContainsDownloadWhitelistedString},
-      {safe_browsing::kInclusionWhitelist,
+      {safe_browsing_util::kInclusionWhitelist,
        &SafeBrowsingDatabase::ContainsInclusionWhitelistedUrl,
        nullptr},
   };
@@ -1422,7 +1417,7 @@
             GURL(std::string("http://www.google.com/"))));
 
     // The malware kill switch is for the CSD whitelist only.
-    if (test_case.test_list_name == safe_browsing::kCsdWhiteList) {
+    if (test_case.test_list_name == safe_browsing_util::kCsdWhiteList) {
       // The CSD whitelist killswitch is not present.
       EXPECT_FALSE(database_->IsCsdWhitelistKillSwitchOn());
 
@@ -1432,7 +1427,7 @@
           15, "sb-ssl.google.com/safebrowsing/csd/killswitch_malware"));
 
       ASSERT_TRUE(database_->UpdateStarted(&lists));
-      database_->InsertChunks(safe_browsing::kCsdWhiteList, chunks.get());
+      database_->InsertChunks(safe_browsing_util::kCsdWhiteList, chunks.get());
       database_->UpdateFinished(true);
 
       EXPECT_TRUE(database_->IsMalwareIPMatchKillSwitchOn());
@@ -1451,7 +1446,7 @@
     database_->UpdateFinished(true);
 
     // Test CSD whitelist specific methods.
-    if (test_case.test_list_name == safe_browsing::kCsdWhiteList) {
+    if (test_case.test_list_name == safe_browsing_util::kCsdWhiteList) {
       // The CSD whitelist killswitch is present.
       EXPECT_TRUE(database_->IsCsdWhitelistKillSwitchOn());
       EXPECT_TRUE(database_->IsMalwareIPMatchKillSwitchOn());
@@ -1481,7 +1476,7 @@
     lists.clear();
     chunks.push_back(SubChunkFullHashValue(
         1, "sb-ssl.google.com/safebrowsing/csd/killswitch", 5));
-    if (test_case.test_list_name == safe_browsing::kCsdWhiteList) {
+    if (test_case.test_list_name == safe_browsing_util::kCsdWhiteList) {
       chunks.push_back(SubChunkFullHashValue(
           10, "sb-ssl.google.com/safebrowsing/csd/killswitch_malware", 15));
     }
@@ -1490,7 +1485,7 @@
     database_->InsertChunks(test_case.test_list_name, chunks.get());
     database_->UpdateFinished(true);
 
-    if (test_case.test_list_name == safe_browsing::kCsdWhiteList) {
+    if (test_case.test_list_name == safe_browsing_util::kCsdWhiteList) {
       EXPECT_FALSE(database_->IsMalwareIPMatchKillSwitchOn());
       EXPECT_FALSE(database_->IsCsdWhitelistKillSwitchOn());
     }
@@ -1533,12 +1528,12 @@
   // Insert the testing chunks into database.
   std::vector<SBListChunkRanges> lists;
   ASSERT_TRUE(database_->UpdateStarted(&lists));
-  database_->InsertChunks(safe_browsing::kMalwareList, chunks.get());
+  database_->InsertChunks(safe_browsing_util::kMalwareList, chunks.get());
   database_->UpdateFinished(true);
 
   GetListsInfo(&lists);
   ASSERT_LE(1U, lists.size());
-  EXPECT_EQ(safe_browsing::kMalwareList, lists[0].name);
+  EXPECT_EQ(safe_browsing_util::kMalwareList, lists[0].name);
   EXPECT_EQ("1", lists[0].adds);
   EXPECT_TRUE(lists[0].subs.empty());
 
@@ -1549,15 +1544,15 @@
                                         "www.evil.com/phishing2.html"));
 
   ASSERT_TRUE(database_->UpdateStarted(&lists));
-  database_->InsertChunks(safe_browsing::kPhishingList, chunks.get());
+  database_->InsertChunks(safe_browsing_util::kPhishingList, chunks.get());
   database_->UpdateFinished(true);
 
   GetListsInfo(&lists);
   ASSERT_LE(2U, lists.size());
-  EXPECT_EQ(safe_browsing::kMalwareList, lists[0].name);
+  EXPECT_EQ(safe_browsing_util::kMalwareList, lists[0].name);
   EXPECT_EQ("1", lists[0].adds);
   EXPECT_TRUE(lists[0].subs.empty());
-  EXPECT_EQ(safe_browsing::kPhishingList, lists[1].name);
+  EXPECT_EQ(safe_browsing_util::kPhishingList, lists[1].name);
   EXPECT_EQ("47", lists[1].adds);
   EXPECT_TRUE(lists[1].subs.empty());
 
@@ -1578,14 +1573,14 @@
   chunks.clear();
   chunks.push_back(SubChunkPrefixValue(4, "www.evil.com/malware1.html", 1));
   ASSERT_TRUE(database_->UpdateStarted(&lists));
-  database_->InsertChunks(safe_browsing::kMalwareList, chunks.get());
+  database_->InsertChunks(safe_browsing_util::kMalwareList, chunks.get());
   database_->UpdateFinished(true);
 
   // Remove the prefix that added last.
   chunks.clear();
   chunks.push_back(SubChunkPrefixValue(5, "www.evil.com/phishing2.html", 47));
   ASSERT_TRUE(database_->UpdateStarted(&lists));
-  database_->InsertChunks(safe_browsing::kPhishingList, chunks.get());
+  database_->InsertChunks(safe_browsing_util::kPhishingList, chunks.get());
   database_->UpdateFinished(true);
 
   // Verify that the database contains urls expected.
@@ -1611,7 +1606,7 @@
   std::vector<SBListChunkRanges> lists;
   ASSERT_TRUE(database_->UpdateStarted(&lists));
   chunks.push_back(AddChunkPrefixValue(1, "www.evil.com/malware.html"));
-  database_->InsertChunks(safe_browsing::kMalwareList, chunks.get());
+  database_->InsertChunks(safe_browsing_util::kMalwareList, chunks.get());
   database_->UpdateFinished(true);
 
   // Get an older time to reset the lastmod time for detecting whether
@@ -1628,7 +1623,7 @@
   ASSERT_TRUE(base::GetFileInfo(filename, &before_info));
   ASSERT_TRUE(database_->UpdateStarted(&lists));
   chunks.push_back(AddChunkPrefixValue(2, "www.foo.com/malware.html"));
-  database_->InsertChunks(safe_browsing::kMalwareList, chunks.get());
+  database_->InsertChunks(safe_browsing_util::kMalwareList, chunks.get());
   database_->UpdateFinished(true);
   ASSERT_TRUE(base::GetFileInfo(filename, &after_info));
   EXPECT_LT(before_info.last_modified, after_info.last_modified);
@@ -1637,7 +1632,7 @@
   ASSERT_TRUE(base::TouchFile(filename, old_last_modified, old_last_modified));
   ASSERT_TRUE(base::GetFileInfo(filename, &before_info));
   ASSERT_TRUE(database_->UpdateStarted(&lists));
-  AddDelChunk(safe_browsing::kMalwareList, 2);
+  AddDelChunk(safe_browsing_util::kMalwareList, 2);
   database_->UpdateFinished(true);
   ASSERT_TRUE(base::GetFileInfo(filename, &after_info));
   EXPECT_LT(before_info.last_modified, after_info.last_modified);
@@ -1663,7 +1658,7 @@
 
     ScopedVector<SBChunkData> chunks;
     chunks.push_back(AddChunkPrefixValue(1, "www.evil.com/malware.html"));
-    database_->InsertChunks(safe_browsing::kMalwareList, chunks.get());
+    database_->InsertChunks(safe_browsing_util::kMalwareList, chunks.get());
     database_->UpdateFinished(true);
   }
 
@@ -1713,7 +1708,7 @@
 
   std::vector<SBListChunkRanges> lists;
   ASSERT_TRUE(database_->UpdateStarted(&lists));
-  database_->InsertChunks(safe_browsing::kMalwareList, chunks.get());
+  database_->InsertChunks(safe_browsing_util::kMalwareList, chunks.get());
   database_->UpdateFinished(true);
 
   {
@@ -1768,7 +1763,7 @@
 
   std::vector<SBListChunkRanges> lists;
   ASSERT_TRUE(database_->UpdateStarted(&lists));
-  database_->InsertChunks(safe_browsing::kMalwareList, chunks.get());
+  database_->InsertChunks(safe_browsing_util::kMalwareList, chunks.get());
   database_->UpdateFinished(true);
 
   {
@@ -1812,7 +1807,7 @@
     std::vector<SBFullHashResult> cache_results;
 
     SBFullHashResult full_hash_result;
-    full_hash_result.list_id = safe_browsing::MALWARE;
+    full_hash_result.list_id = safe_browsing_util::MALWARE;
 
     full_hash_result.hash = kFullHash1_1;
     cache_results.push_back(full_hash_result);
@@ -1832,8 +1827,7 @@
         full_hashes, &prefix_hits, &cache_hits));
     EXPECT_TRUE(prefix_hits.empty());
     ASSERT_EQ(1U, cache_hits.size());
-    EXPECT_TRUE(safe_browsing::SBFullHashEqual(
-        kFullHash1_1, cache_hits[0].hash));
+    EXPECT_TRUE(SBFullHashEqual(kFullHash1_1, cache_hits[0].hash));
 
     // Adding kFullHash2_1 will see the existing cache hit plus the prefix hit
     // for kPrefix2.
@@ -1845,8 +1839,7 @@
     ASSERT_EQ(1U, prefix_hits.size());
     EXPECT_EQ(kPrefix2, prefix_hits[0]);
     ASSERT_EQ(1U, cache_hits.size());
-    EXPECT_TRUE(safe_browsing::SBFullHashEqual(
-        kFullHash1_1, cache_hits[0].hash));
+    EXPECT_TRUE(SBFullHashEqual(kFullHash1_1, cache_hits[0].hash));
 
     // kFullHash1_3 also gets a cache hit.
     full_hashes.push_back(kFullHash1_3);
@@ -1857,10 +1850,8 @@
     ASSERT_EQ(1U, prefix_hits.size());
     EXPECT_EQ(kPrefix2, prefix_hits[0]);
     ASSERT_EQ(2U, cache_hits.size());
-    EXPECT_TRUE(safe_browsing::SBFullHashEqual(
-        kFullHash1_1, cache_hits[0].hash));
-    EXPECT_TRUE(safe_browsing::SBFullHashEqual(
-        kFullHash1_3, cache_hits[1].hash));
+    EXPECT_TRUE(SBFullHashEqual(kFullHash1_1, cache_hits[0].hash));
+    EXPECT_TRUE(SBFullHashEqual(kFullHash1_3, cache_hits[1].hash));
   }
 
   {
@@ -1872,8 +1863,7 @@
         full_hashes, &prefix_hits, &cache_hits));
     EXPECT_TRUE(prefix_hits.empty());
     ASSERT_EQ(1U, cache_hits.size());
-    EXPECT_TRUE(safe_browsing::SBFullHashEqual(
-        kFullHash1_3, cache_hits[0].hash));
+    EXPECT_TRUE(SBFullHashEqual(kFullHash1_3, cache_hits[0].hash));
   }
 
   {
@@ -1913,7 +1903,7 @@
 
   std::vector<SBListChunkRanges> lists;
   ASSERT_TRUE(database_->UpdateStarted(&lists));
-  database_->InsertChunks(safe_browsing::kMalwareList, chunks.get());
+  database_->InsertChunks(safe_browsing_util::kMalwareList, chunks.get());
   database_->UpdateFinished(true);
 
   {
@@ -1948,7 +1938,7 @@
   {
     // Cache a gethash result for kFullHash1_2.
     SBFullHashResult full_hash_result;
-    full_hash_result.list_id = safe_browsing::MALWARE;
+    full_hash_result.list_id = safe_browsing_util::MALWARE;
     full_hash_result.hash = kFullHash1_2;
 
     std::vector<SBPrefix> prefixes(1, kPrefix1);
@@ -1982,8 +1972,7 @@
         full_hashes, &prefix_hits, &cache_hits));
     EXPECT_TRUE(prefix_hits.empty());
     ASSERT_EQ(1U, cache_hits.size());
-    EXPECT_TRUE(safe_browsing::SBFullHashEqual(
-        kFullHash1_2, cache_hits[0].hash));
+    EXPECT_TRUE(SBFullHashEqual(kFullHash1_2, cache_hits[0].hash));
   }
 
   // Remove kFullHash1_1 from the database.
@@ -1991,7 +1980,7 @@
   chunks.push_back(SubChunkFullHash(11, kFullHash1_1, 1));
 
   ASSERT_TRUE(database_->UpdateStarted(&lists));
-  database_->InsertChunks(safe_browsing::kMalwareList, chunks.get());
+  database_->InsertChunks(safe_browsing_util::kMalwareList, chunks.get());
   database_->UpdateFinished(true);
 
   // Cache should be cleared after updating.
@@ -2029,7 +2018,7 @@
   chunks.push_back(SubChunkFullHash(12, kFullHash1_2, 2));
 
   ASSERT_TRUE(database_->UpdateStarted(&lists));
-  database_->InsertChunks(safe_browsing::kMalwareList, chunks.get());
+  database_->InsertChunks(safe_browsing_util::kMalwareList, chunks.get());
   database_->UpdateFinished(true);
 
   // Cache should be cleared after updating.
@@ -2061,7 +2050,7 @@
 
   std::vector<SBListChunkRanges> lists;
   ASSERT_TRUE(database_->UpdateStarted(&lists));
-  database_->InsertChunks(safe_browsing::kMalwareList, chunks.get());
+  database_->InsertChunks(safe_browsing_util::kMalwareList, chunks.get());
   database_->UpdateFinished(true);
 
   {
@@ -2078,7 +2067,7 @@
   chunks.push_back(AddChunkPrefix(2, kPrefix1));
 
   ASSERT_TRUE(database_->UpdateStarted(&lists));
-  database_->InsertChunks(safe_browsing::kMalwareList, chunks.get());
+  database_->InsertChunks(safe_browsing_util::kMalwareList, chunks.get());
   database_->UpdateFinished(true);
 
   {
@@ -2098,7 +2087,7 @@
   chunks.push_back(SubChunkFullHash(11, kFullHash1_1, 1));
 
   ASSERT_TRUE(database_->UpdateStarted(&lists));
-  database_->InsertChunks(safe_browsing::kMalwareList, chunks.get());
+  database_->InsertChunks(safe_browsing_util::kMalwareList, chunks.get());
   database_->UpdateFinished(true);
 
   {
@@ -2138,7 +2127,7 @@
   // IPv4 prefix match for ::ffff:192.1.128.0/113.
   chunks.push_back(AddChunkHashedIpValue(6, "::ffff:192.1.128.0", 113));
 
-  database_->InsertChunks(safe_browsing::kIPBlacklist, chunks.get());
+  database_->InsertChunks(safe_browsing_util::kIPBlacklist, chunks.get());
   database_->UpdateFinished(true);
 
   EXPECT_FALSE(database_->ContainsMalwareIP("192.168.0.255"));
@@ -2188,7 +2177,7 @@
   {
     ScopedVector<SBChunkData> chunks;
     chunks.push_back(AddChunkPrefixValue(1, "www.evil.com/"));
-    database_->InsertChunks(safe_browsing::kMalwareList, chunks.get());
+    database_->InsertChunks(safe_browsing_util::kMalwareList, chunks.get());
   }
 
   // Add a specific fullhash.
@@ -2196,7 +2185,7 @@
   {
     ScopedVector<SBChunkData> chunks;
     chunks.push_back(AddChunkFullHashValue(2, kWhateverMalware));
-    database_->InsertChunks(safe_browsing::kMalwareList, chunks.get());
+    database_->InsertChunks(safe_browsing_util::kMalwareList, chunks.get());
   }
 
   // Add a fullhash which has a prefix collision for a known url.
@@ -2208,7 +2197,7 @@
   {
     ScopedVector<SBChunkData> chunks;
     chunks.push_back(AddChunkFullHashValue(3, kExampleCollision));
-    database_->InsertChunks(safe_browsing::kMalwareList, chunks.get());
+    database_->InsertChunks(safe_browsing_util::kMalwareList, chunks.get());
   }
 
   database_->UpdateFinished(true);
diff --git a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc
index 222cb7b..f1d3971a 100644
--- a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc
@@ -138,8 +138,8 @@
                          std::vector<SBPrefix>* prefix_hits,
                          std::vector<SBFullHashResult>* cache_hits) override {
     cache_hits->clear();
-    return ContainsUrl(safe_browsing::MALWARE,
-                       safe_browsing::PHISH,
+    return ContainsUrl(safe_browsing_util::MALWARE,
+                       safe_browsing_util::PHISH,
                        std::vector<GURL>(1, url),
                        prefix_hits);
   }
@@ -148,8 +148,8 @@
       std::vector<SBPrefix>* prefix_hits,
       std::vector<SBFullHashResult>* cache_hits) override {
     cache_hits->clear();
-    return ContainsUrl(safe_browsing::UNWANTEDURL,
-                       safe_browsing::UNWANTEDURL,
+    return ContainsUrl(safe_browsing_util::UNWANTEDURL,
+                       safe_browsing_util::UNWANTEDURL,
                        std::vector<GURL>(1, url),
                        prefix_hits);
   }
@@ -157,8 +157,8 @@
       const std::vector<SBPrefix>& prefixes,
       std::vector<SBPrefix>* prefix_hits) override {
     bool found =
-        ContainsUrlPrefixes(safe_browsing::BINURL,
-                            safe_browsing::BINURL, prefixes, prefix_hits);
+        ContainsUrlPrefixes(safe_browsing_util::BINURL,
+                            safe_browsing_util::BINURL, prefixes, prefix_hits);
     if (!found)
       return false;
     DCHECK_LE(1U, prefix_hits->size());
@@ -424,8 +424,8 @@
                                    SBFullHashResult* full_hash) {
     std::string host;
     std::string path;
-    safe_browsing::CanonicalizeUrl(url, &host, &path, NULL);
-    full_hash->hash = safe_browsing::SBFullHashForString(host + path);
+    safe_browsing_util::CanonicalizeUrl(url, &host, &path, NULL);
+    full_hash->hash = SBFullHashForString(host + path);
     full_hash->list_id = list_id;
   }
 
@@ -601,7 +601,7 @@
 
   void GenUrlFullhashResultWithMetadata(const GURL& url,
                                         SBFullHashResult* full_hash) {
-    GenUrlFullhashResult(url, safe_browsing::MALWARE, full_hash);
+    GenUrlFullhashResult(url, safe_browsing_util::MALWARE, full_hash);
 
     safe_browsing::MalwarePatternType proto;
     switch (GetParam()) {
@@ -712,7 +712,7 @@
   // Add the img url as coming from a site serving UwS and then load the parent
   // page.
   SBFullHashResult uws_full_hash;
-  GenUrlFullhashResult(img_url, safe_browsing::UNWANTEDURL,
+  GenUrlFullhashResult(img_url, safe_browsing_util::UNWANTEDURL,
                        &uws_full_hash);
   SetupResponseForUrl(img_url, uws_full_hash);
 
@@ -727,7 +727,7 @@
   // After adding the url to safebrowsing database and getfullhash result,
   // we should see the interstitial page.
   SBFullHashResult malware_full_hash;
-  GenUrlFullhashResult(url, safe_browsing::MALWARE, &malware_full_hash);
+  GenUrlFullhashResult(url, safe_browsing_util::MALWARE, &malware_full_hash);
   EXPECT_CALL(observer_,
               OnSafeBrowsingMatch(IsUnsafeResourceFor(url))).Times(1);
   EXPECT_CALL(observer_, OnSafeBrowsingHit(IsUnsafeResourceFor(url))).Times(1)
@@ -781,7 +781,7 @@
   // getfullhash result, we should not see the interstitial page since the
   // only malware was a prefetch target.
   SBFullHashResult malware_full_hash;
-  GenUrlFullhashResult(malware_url, safe_browsing::MALWARE,
+  GenUrlFullhashResult(malware_url, safe_browsing_util::MALWARE,
                        &malware_full_hash);
   SetupResponseForUrl(malware_url, malware_full_hash);
   ui_test_utils::NavigateToURL(browser(), url);
@@ -896,7 +896,7 @@
   EXPECT_EQ(SB_THREAT_TYPE_SAFE, client->GetThreatType());
 
   SBFullHashResult full_hash_result;
-  GenUrlFullhashResult(badbin_url, safe_browsing::BINURL,
+  GenUrlFullhashResult(badbin_url, safe_browsing_util::BINURL,
                        &full_hash_result);
   SetupResponseForUrl(badbin_url, full_hash_result);
 
@@ -918,7 +918,7 @@
 
     SBFullHashResult full_hash_result;
     GenUrlFullhashResult(
-        bad_url, safe_browsing::UNWANTEDURL, &full_hash_result);
+        bad_url, safe_browsing_util::UNWANTEDURL, &full_hash_result);
     SetupResponseForUrl(bad_url, full_hash_result);
 
     // Now, the bad_url is not safe since it is added to download
@@ -940,7 +940,7 @@
 
     SBFullHashResult full_hash_result;
     GenUrlFullhashResult(
-        bad_url, safe_browsing::MALWARE, &full_hash_result);
+        bad_url, safe_browsing_util::MALWARE, &full_hash_result);
     SetupResponseForUrl(bad_url, full_hash_result);
 
     client->CheckBrowseUrl(bad_url);
@@ -960,7 +960,7 @@
 
     SBFullHashResult full_hash_result;
     GenUrlFullhashResult(
-        bad_url, safe_browsing::MALWARE, &full_hash_result);
+        bad_url, safe_browsing_util::MALWARE, &full_hash_result);
     SetupResponseForUrl(bad_url, full_hash_result);
 
     // Now, the bad_url is not safe since it is added to download
@@ -983,7 +983,7 @@
 
     SBFullHashResult full_hash_result;
     GenUrlFullhashResult(
-        bad_url, safe_browsing::UNWANTEDURL, &full_hash_result);
+        bad_url, safe_browsing_util::UNWANTEDURL, &full_hash_result);
     SetupResponseForUrl(bad_url, full_hash_result);
 
     client->CheckBrowseUrl(bad_url);
@@ -1007,7 +1007,7 @@
   EXPECT_EQ(SB_THREAT_TYPE_SAFE, client->GetThreatType());
 
   SBFullHashResult full_hash_result;
-  GenUrlFullhashResult(badbin_url, safe_browsing::BINURL,
+  GenUrlFullhashResult(badbin_url, safe_browsing_util::BINURL,
                        &full_hash_result);
   SetupResponseForUrl(badbin_url, full_hash_result);
 
@@ -1030,7 +1030,7 @@
 
   scoped_refptr<TestSBClient> client(new TestSBClient);
   SBFullHashResult full_hash_result;
-  GenUrlFullhashResult(badbin_url, safe_browsing::BINURL,
+  GenUrlFullhashResult(badbin_url, safe_browsing_util::BINURL,
                        &full_hash_result);
   SetupResponseForUrl(badbin_url, full_hash_result);
   client->CheckDownloadUrl(badbin_urls);
diff --git a/chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc
index 91e6fb3..768b90b 100644
--- a/chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc
@@ -13,7 +13,6 @@
 #include "base/test/test_simple_task_runner.h"
 #include "chrome/common/chrome_paths.h"
 #include "components/safe_browsing_db/prefix_set.h"
-#include "components/safe_browsing_db/util.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "testing/platform_test.h"
 
@@ -27,12 +26,12 @@
 const int kSubChunk1 = 2;
 const int kSubChunk2 = 4;
 
-const SBFullHash kHash1 = safe_browsing::SBFullHashForString("one");
-const SBFullHash kHash2 = safe_browsing::SBFullHashForString("two");
-const SBFullHash kHash3 = safe_browsing::SBFullHashForString("three");
-const SBFullHash kHash4 = safe_browsing::SBFullHashForString("four");
-const SBFullHash kHash5 = safe_browsing::SBFullHashForString("five");
-const SBFullHash kHash6 = safe_browsing::SBFullHashForString("six");
+const SBFullHash kHash1 = SBFullHashForString("one");
+const SBFullHash kHash2 = SBFullHashForString("two");
+const SBFullHash kHash3 = SBFullHashForString("three");
+const SBFullHash kHash4 = SBFullHashForString("four");
+const SBFullHash kHash5 = SBFullHashForString("five");
+const SBFullHash kHash6 = SBFullHashForString("six");
 
 const SBPrefix kMinSBPrefix = 0u;
 const SBPrefix kMaxSBPrefix = ~kMinSBPrefix;
@@ -195,8 +194,7 @@
 
     ASSERT_EQ(1U, add_full_hashes_result.size());
     EXPECT_EQ(kAddChunk2, add_full_hashes_result[0].chunk_id);
-    EXPECT_TRUE(safe_browsing::SBFullHashEqual(
-        kHash4, add_full_hashes_result[0].full_hash));
+    EXPECT_TRUE(SBFullHashEqual(kHash4, add_full_hashes_result[0].full_hash));
   }
 }
 
@@ -281,8 +279,7 @@
 
     ASSERT_EQ(1U, add_full_hashes_result.size());
     EXPECT_EQ(kAddChunk2, add_full_hashes_result[0].chunk_id);
-    EXPECT_TRUE(safe_browsing::SBFullHashEqual(
-        kHash4, add_full_hashes_result[0].full_hash));
+    EXPECT_TRUE(SBFullHashEqual(kHash4, add_full_hashes_result[0].full_hash));
   }
 
   ASSERT_TRUE(store_->BeginUpdate());
@@ -305,8 +302,7 @@
 
     ASSERT_EQ(1U, add_full_hashes_result.size());
     EXPECT_EQ(kAddChunk2, add_full_hashes_result[0].chunk_id);
-    EXPECT_TRUE(safe_browsing::SBFullHashEqual(
-        kHash4, add_full_hashes_result[0].full_hash));
+    EXPECT_TRUE(SBFullHashEqual(kHash4, add_full_hashes_result[0].full_hash));
   }
 
   ASSERT_TRUE(store_->BeginUpdate());
@@ -330,8 +326,7 @@
 
     ASSERT_EQ(1U, add_full_hashes_result.size());
     EXPECT_EQ(kAddChunk2, add_full_hashes_result[0].chunk_id);
-    EXPECT_TRUE(safe_browsing::SBFullHashEqual(
-        kHash4, add_full_hashes_result[0].full_hash));
+    EXPECT_TRUE(SBFullHashEqual(kHash4, add_full_hashes_result[0].full_hash));
   }
 }
 
@@ -397,8 +392,7 @@
 
     ASSERT_EQ(1U, add_full_hashes_result.size());
     EXPECT_EQ(kAddChunk3, add_full_hashes_result[0].chunk_id);
-    EXPECT_TRUE(safe_browsing::SBFullHashEqual(
-        kHash6, add_full_hashes_result[0].full_hash));
+    EXPECT_TRUE(SBFullHashEqual(kHash6, add_full_hashes_result[0].full_hash));
   }
 
   // Expected chunks are there in another update.
@@ -671,7 +665,7 @@
   EXPECT_TRUE(store_->GetAddFullHashes(&add_hashes));
   ASSERT_EQ(1U, add_hashes.size());
   EXPECT_EQ(kAddChunk2, add_hashes[0].chunk_id);
-  EXPECT_TRUE(safe_browsing::SBFullHashEqual(kHash4, add_hashes[0].full_hash));
+  EXPECT_TRUE(SBFullHashEqual(kHash4, add_hashes[0].full_hash));
 }
 
 // Test that the database handles resharding correctly, both when growing and
@@ -813,7 +807,7 @@
   EXPECT_TRUE(store_->GetAddFullHashes(&add_hashes));
   ASSERT_EQ(1U, add_hashes.size());
   EXPECT_EQ(kAddChunk1, add_hashes[0].chunk_id);
-  EXPECT_TRUE(safe_browsing::SBFullHashEqual(kHash2, add_hashes[0].full_hash));
+  EXPECT_TRUE(SBFullHashEqual(kHash2, add_hashes[0].full_hash));
 
   // Attempt an update to make sure things work end-to-end.
   EXPECT_TRUE(store_->BeginUpdate());
diff --git a/chrome/browser/safe_browsing/safe_browsing_store_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_store_unittest.cc
index fb8ab175..04751057 100644
--- a/chrome/browser/safe_browsing/safe_browsing_store_unittest.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_store_unittest.cc
@@ -3,19 +3,18 @@
 // found in the LICENSE file.
 
 #include "chrome/browser/safe_browsing/safe_browsing_store.h"
-#include "components/safe_browsing_db/util.h"
 
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace {
 
-const SBFullHash kHash1 = safe_browsing::SBFullHashForString("one");
-const SBFullHash kHash2 = safe_browsing::SBFullHashForString("two");
-const SBFullHash kHash3 = safe_browsing::SBFullHashForString("three");
-const SBFullHash kHash4 = safe_browsing::SBFullHashForString("four");
-const SBFullHash kHash5 = safe_browsing::SBFullHashForString("five");
-const SBFullHash kHash6 = safe_browsing::SBFullHashForString("six");
-const SBFullHash kHash7 = safe_browsing::SBFullHashForString("seven");
+const SBFullHash kHash1 = SBFullHashForString("one");
+const SBFullHash kHash2 = SBFullHashForString("two");
+const SBFullHash kHash3 = SBFullHashForString("three");
+const SBFullHash kHash4 = SBFullHashForString("four");
+const SBFullHash kHash5 = SBFullHashForString("five");
+const SBFullHash kHash6 = SBFullHashForString("six");
+const SBFullHash kHash7 = SBFullHashForString("seven");
 
 const int kAddChunk1 = 1;  // Use different chunk numbers just in case.
 const int kSubChunk1 = 2;
@@ -218,9 +217,9 @@
 
   ASSERT_EQ(2U, add_hashes.size());
   EXPECT_EQ(kAddChunk5, add_hashes[0].chunk_id);
-  EXPECT_TRUE(safe_browsing::SBFullHashEqual(kHash4, add_hashes[0].full_hash));
+  EXPECT_TRUE(SBFullHashEqual(kHash4, add_hashes[0].full_hash));
   EXPECT_EQ(kAddChunk6, add_hashes[1].chunk_id);
-  EXPECT_TRUE(safe_browsing::SBFullHashEqual(kHash6, add_hashes[1].full_hash));
+  EXPECT_TRUE(SBFullHashEqual(kHash6, add_hashes[1].full_hash));
 
   ASSERT_EQ(1U, sub_prefixes.size());
   EXPECT_EQ(kSubChunk4, sub_prefixes[0].chunk_id);
@@ -230,7 +229,7 @@
   ASSERT_EQ(1U, sub_hashes.size());
   EXPECT_EQ(kSubChunk3, sub_hashes[0].chunk_id);
   EXPECT_EQ(kAddChunk3, sub_hashes[0].add_chunk_id);
-  EXPECT_TRUE(safe_browsing::SBFullHashEqual(kHash7, sub_hashes[0].full_hash));
+  EXPECT_TRUE(SBFullHashEqual(kHash7, sub_hashes[0].full_hash));
 }
 
 // Test chunk deletions, and ordering of deletions WRT subs knocking
@@ -275,7 +274,7 @@
 
   ASSERT_EQ(1U, add_hashes.size());
   EXPECT_EQ(kAddChunk1, add_hashes[0].chunk_id);
-  EXPECT_TRUE(safe_browsing::SBFullHashEqual(kHash6, add_hashes[0].full_hash));
+  EXPECT_TRUE(SBFullHashEqual(kHash6, add_hashes[0].full_hash));
 
   EXPECT_TRUE(sub_prefixes.empty());
   EXPECT_TRUE(sub_hashes.empty());
diff --git a/chrome/browser/safe_browsing/safe_browsing_util.cc b/chrome/browser/safe_browsing/safe_browsing_util.cc
index 867c1aa..3a5ba424 100644
--- a/chrome/browser/safe_browsing/safe_browsing_util.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_util.cc
@@ -4,10 +4,25 @@
 
 #include "chrome/browser/safe_browsing/safe_browsing_util.h"
 
+#include "base/logging.h"
 #include "base/strings/string_util.h"
 #include "base/strings/stringprintf.h"
 #include "chrome/browser/safe_browsing/chunk.pb.h"
 #include "components/google/core/browser/google_util.h"
+#include "crypto/sha2.h"
+#include "net/base/escape.h"
+#include "url/gurl.h"
+#include "url/url_util.h"
+
+// SBCachedFullHashResult ------------------------------------------------------
+
+SBCachedFullHashResult::SBCachedFullHashResult() {}
+
+SBCachedFullHashResult::SBCachedFullHashResult(
+    const base::Time& in_expire_after)
+    : expire_after(in_expire_after) {}
+
+SBCachedFullHashResult::~SBCachedFullHashResult() {}
 
 // SBChunkData -----------------------------------------------------------------
 
@@ -128,3 +143,343 @@
 SBChunkDelete::SBChunkDelete() : is_sub_del(false) {}
 
 SBChunkDelete::~SBChunkDelete() {}
+
+// Utility functions -----------------------------------------------------------
+
+namespace {
+bool IsKnownList(const std::string& name) {
+  for (size_t i = 0; i < arraysize(safe_browsing_util::kAllLists); ++i) {
+    if (!strcmp(safe_browsing_util::kAllLists[i], name.c_str())) {
+      return true;
+    }
+  }
+  return false;
+}
+}  // namespace
+
+namespace safe_browsing_util {
+
+// Listnames that browser can process.
+const char kMalwareList[] = "goog-malware-shavar";
+const char kPhishingList[] = "goog-phish-shavar";
+const char kBinUrlList[] = "goog-badbinurl-shavar";
+const char kCsdWhiteList[] = "goog-csdwhite-sha256";
+const char kDownloadWhiteList[] = "goog-downloadwhite-digest256";
+const char kExtensionBlacklist[] = "goog-badcrxids-digestvar";
+const char kIPBlacklist[] = "goog-badip-digest256";
+const char kUnwantedUrlList[] = "goog-unwanted-shavar";
+const char kInclusionWhitelist[] = "goog-csdinclusionwhite-sha256";
+
+const char* kAllLists[9] = {
+    kMalwareList,
+    kPhishingList,
+    kBinUrlList,
+    kCsdWhiteList,
+    kDownloadWhiteList,
+    kExtensionBlacklist,
+    kIPBlacklist,
+    kUnwantedUrlList,
+    kInclusionWhitelist,
+};
+
+ListType GetListId(const base::StringPiece& name) {
+  ListType id;
+  if (name == safe_browsing_util::kMalwareList) {
+    id = MALWARE;
+  } else if (name == safe_browsing_util::kPhishingList) {
+    id = PHISH;
+  } else if (name == safe_browsing_util::kBinUrlList) {
+    id = BINURL;
+  } else if (name == safe_browsing_util::kCsdWhiteList) {
+    id = CSDWHITELIST;
+  } else if (name == safe_browsing_util::kDownloadWhiteList) {
+    id = DOWNLOADWHITELIST;
+  } else if (name == safe_browsing_util::kExtensionBlacklist) {
+    id = EXTENSIONBLACKLIST;
+  } else if (name == safe_browsing_util::kIPBlacklist) {
+    id = IPBLACKLIST;
+  } else if (name == safe_browsing_util::kUnwantedUrlList) {
+    id = UNWANTEDURL;
+  } else if (name == safe_browsing_util::kInclusionWhitelist) {
+    id = INCLUSIONWHITELIST;
+  } else {
+    id = INVALID;
+  }
+  return id;
+}
+
+bool GetListName(ListType list_id, std::string* list) {
+  switch (list_id) {
+    case MALWARE:
+      *list = safe_browsing_util::kMalwareList;
+      break;
+    case PHISH:
+      *list = safe_browsing_util::kPhishingList;
+      break;
+    case BINURL:
+      *list = safe_browsing_util::kBinUrlList;
+      break;
+    case CSDWHITELIST:
+      *list = safe_browsing_util::kCsdWhiteList;
+      break;
+    case DOWNLOADWHITELIST:
+      *list = safe_browsing_util::kDownloadWhiteList;
+      break;
+    case EXTENSIONBLACKLIST:
+      *list = safe_browsing_util::kExtensionBlacklist;
+      break;
+    case IPBLACKLIST:
+      *list = safe_browsing_util::kIPBlacklist;
+      break;
+    case UNWANTEDURL:
+      *list = safe_browsing_util::kUnwantedUrlList;
+      break;
+    case INCLUSIONWHITELIST:
+      *list = safe_browsing_util::kInclusionWhitelist;
+      break;
+    default:
+      return false;
+  }
+  DCHECK(IsKnownList(*list));
+  return true;
+}
+
+std::string Unescape(const std::string& url) {
+  std::string unescaped_str(url);
+  std::string old_unescaped_str;
+  const int kMaxLoopIterations = 1024;
+  int loop_var = 0;
+  do {
+    old_unescaped_str = unescaped_str;
+    unescaped_str = net::UnescapeURLComponent(
+        old_unescaped_str, net::UnescapeRule::SPOOFING_AND_CONTROL_CHARS |
+                               net::UnescapeRule::SPACES |
+                               net::UnescapeRule::URL_SPECIAL_CHARS);
+  } while (unescaped_str != old_unescaped_str && ++loop_var <=
+           kMaxLoopIterations);
+
+  return unescaped_str;
+}
+
+std::string Escape(const std::string& url) {
+  std::string escaped_str;
+  const char* kHexString = "0123456789ABCDEF";
+  for (size_t i = 0; i < url.length(); i++) {
+    unsigned char c = static_cast<unsigned char>(url[i]);
+    if (c <= ' ' || c > '~' || c == '#' || c == '%') {
+      escaped_str.push_back('%');
+      escaped_str.push_back(kHexString[c >> 4]);
+      escaped_str.push_back(kHexString[c & 0xf]);
+    } else {
+      escaped_str.push_back(c);
+    }
+  }
+
+  return escaped_str;
+}
+
+std::string RemoveConsecutiveChars(const std::string& str, const char c) {
+  std::string output(str);
+  std::string string_to_find;
+  std::string::size_type loc = 0;
+  string_to_find.append(2, c);
+  while ((loc = output.find(string_to_find, loc)) != std::string::npos) {
+    output.erase(loc, 1);
+  }
+
+  return output;
+}
+
+// Canonicalizes url as per Google Safe Browsing Specification.
+// See section 6.1 in
+// http://code.google.com/p/google-safe-browsing/wiki/Protocolv2Spec.
+void CanonicalizeUrl(const GURL& url,
+                     std::string* canonicalized_hostname,
+                     std::string* canonicalized_path,
+                     std::string* canonicalized_query) {
+  DCHECK(url.is_valid());
+
+  // We only canonicalize "normal" URLs.
+  if (!url.IsStandard())
+    return;
+
+  // Following canonicalization steps are excluded since url parsing takes care
+  // of those :-
+  // 1. Remove any tab (0x09), CR (0x0d), and LF (0x0a) chars from url.
+  //    (Exclude escaped version of these chars).
+  // 2. Normalize hostname to 4 dot-seperated decimal values.
+  // 3. Lowercase hostname.
+  // 4. Resolve path sequences "/../" and "/./".
+
+  // That leaves us with the following :-
+  // 1. Remove fragment in URL.
+  GURL url_without_fragment;
+  GURL::Replacements f_replacements;
+  f_replacements.ClearRef();
+  f_replacements.ClearUsername();
+  f_replacements.ClearPassword();
+  url_without_fragment = url.ReplaceComponents(f_replacements);
+
+  // 2. Do URL unescaping until no more hex encoded characters exist.
+  std::string url_unescaped_str(Unescape(url_without_fragment.spec()));
+  url::Parsed parsed;
+  url::ParseStandardURL(url_unescaped_str.data(), url_unescaped_str.length(),
+                        &parsed);
+
+  // 3. In hostname, remove all leading and trailing dots.
+  const std::string host =
+      (parsed.host.len > 0)
+          ? url_unescaped_str.substr(parsed.host.begin, parsed.host.len)
+          : std::string();
+  std::string host_without_end_dots;
+  base::TrimString(host, ".", &host_without_end_dots);
+
+  // 4. In hostname, replace consecutive dots with a single dot.
+  std::string host_without_consecutive_dots(RemoveConsecutiveChars(
+      host_without_end_dots, '.'));
+
+  // 5. In path, replace runs of consecutive slashes with a single slash.
+  std::string path =
+      (parsed.path.len > 0)
+          ? url_unescaped_str.substr(parsed.path.begin, parsed.path.len)
+          : std::string();
+  std::string path_without_consecutive_slash(RemoveConsecutiveChars(path, '/'));
+
+  url::Replacements<char> hp_replacements;
+  hp_replacements.SetHost(
+      host_without_consecutive_dots.data(),
+      url::Component(0, host_without_consecutive_dots.length()));
+  hp_replacements.SetPath(
+      path_without_consecutive_slash.data(),
+      url::Component(0, path_without_consecutive_slash.length()));
+
+  std::string url_unescaped_with_can_hostpath;
+  url::StdStringCanonOutput output(&url_unescaped_with_can_hostpath);
+  url::Parsed temp_parsed;
+  url::ReplaceComponents(url_unescaped_str.data(),
+                         url_unescaped_str.length(),
+                         parsed,
+                         hp_replacements,
+                         NULL,
+                         &output,
+                         &temp_parsed);
+  output.Complete();
+
+  // 6. Step needed to revert escaping done in url::ReplaceComponents.
+  url_unescaped_with_can_hostpath = Unescape(url_unescaped_with_can_hostpath);
+
+  // 7. After performing all above steps, percent-escape all chars in url which
+  // are <= ASCII 32, >= 127, #, %. Escapes must be uppercase hex characters.
+  std::string escaped_canon_url_str(Escape(url_unescaped_with_can_hostpath));
+  url::Parsed final_parsed;
+  url::ParseStandardURL(escaped_canon_url_str.data(),
+                        escaped_canon_url_str.length(),
+                        &final_parsed);
+
+  if (canonicalized_hostname && final_parsed.host.len > 0) {
+    *canonicalized_hostname =
+        escaped_canon_url_str.substr(final_parsed.host.begin,
+                                     final_parsed.host.len);
+  }
+  if (canonicalized_path && final_parsed.path.len > 0) {
+    *canonicalized_path = escaped_canon_url_str.substr(final_parsed.path.begin,
+                                                       final_parsed.path.len);
+  }
+  if (canonicalized_query && final_parsed.query.len > 0) {
+    *canonicalized_query = escaped_canon_url_str.substr(
+        final_parsed.query.begin, final_parsed.query.len);
+  }
+}
+
+void GenerateHostsToCheck(const GURL& url, std::vector<std::string>* hosts) {
+  hosts->clear();
+
+  std::string canon_host;
+  CanonicalizeUrl(url, &canon_host, NULL, NULL);
+
+  const std::string host = canon_host;  // const sidesteps GCC bugs below!
+  if (host.empty())
+    return;
+
+  // Per the Safe Browsing Protocol v2 spec, we try the host, and also up to 4
+  // hostnames formed by starting with the last 5 components and successively
+  // removing the leading component.  The last component isn't examined alone,
+  // since it's the TLD or a subcomponent thereof.
+  //
+  // Note that we don't need to be clever about stopping at the "real" eTLD --
+  // the data on the server side has been filtered to ensure it will not
+  // blacklist a whole TLD, and it's not significantly slower on our side to
+  // just check too much.
+  //
+  // Also note that because we have a simple blacklist, not some sort of complex
+  // whitelist-in-blacklist or vice versa, it doesn't matter what order we check
+  // these in.
+  const size_t kMaxHostsToCheck = 4;
+  bool skipped_last_component = false;
+  for (std::string::const_reverse_iterator i(host.rbegin());
+       i != host.rend() && hosts->size() < kMaxHostsToCheck; ++i) {
+    if (*i == '.') {
+      if (skipped_last_component)
+        hosts->push_back(std::string(i.base(), host.end()));
+      else
+        skipped_last_component = true;
+    }
+  }
+  hosts->push_back(host);
+}
+
+void GeneratePathsToCheck(const GURL& url, std::vector<std::string>* paths) {
+  paths->clear();
+
+  std::string canon_path;
+  std::string canon_query;
+  CanonicalizeUrl(url, NULL, &canon_path, &canon_query);
+
+  const std::string path = canon_path;   // const sidesteps GCC bugs below!
+  const std::string query = canon_query;
+  if (path.empty())
+    return;
+
+  // Per the Safe Browsing Protocol v2 spec, we try the exact path with/without
+  // the query parameters, and also up to 4 paths formed by starting at the root
+  // and adding more path components.
+  //
+  // As with the hosts above, it doesn't matter what order we check these in.
+  const size_t kMaxPathsToCheck = 4;
+  for (std::string::const_iterator i(path.begin());
+       i != path.end() && paths->size() < kMaxPathsToCheck; ++i) {
+    if (*i == '/')
+      paths->push_back(std::string(path.begin(), i + 1));
+  }
+
+  if (!paths->empty() && paths->back() != path)
+    paths->push_back(path);
+
+  if (!query.empty())
+    paths->push_back(path + "?" + query);
+}
+
+void GeneratePatternsToCheck(const GURL& url, std::vector<std::string>* urls) {
+  std::vector<std::string> hosts, paths;
+  GenerateHostsToCheck(url, &hosts);
+  GeneratePathsToCheck(url, &paths);
+  for (size_t h = 0; h < hosts.size(); ++h) {
+    for (size_t p = 0; p < paths.size(); ++p) {
+      urls->push_back(hosts[h] + paths[p]);
+    }
+  }
+}
+
+SBFullHash StringToSBFullHash(const std::string& hash_in) {
+  DCHECK_EQ(crypto::kSHA256Length, hash_in.size());
+  SBFullHash hash_out;
+  memcpy(hash_out.full_hash, hash_in.data(), crypto::kSHA256Length);
+  return hash_out;
+}
+
+std::string SBFullHashToString(const SBFullHash& hash) {
+  DCHECK_EQ(crypto::kSHA256Length, sizeof(hash.full_hash));
+  return std::string(hash.full_hash, sizeof(hash.full_hash));
+}
+
+}  // namespace safe_browsing_util
diff --git a/chrome/browser/safe_browsing/safe_browsing_util.h b/chrome/browser/safe_browsing/safe_browsing_util.h
index 9cbb3cd..b01f6a3 100644
--- a/chrome/browser/safe_browsing/safe_browsing_util.h
+++ b/chrome/browser/safe_browsing/safe_browsing_util.h
@@ -16,12 +16,14 @@
 #include "base/strings/string_piece.h"
 #include "base/time/time.h"
 #include "chrome/browser/safe_browsing/chunk_range.h"
-#include "components/safe_browsing_db/util.h"
+#include "components/safe_browsing_db/safe_browsing_db_util.h"
 
 namespace safe_browsing {
 class ChunkData;
 };
 
+class GURL;
+
 // Container for holding a chunk URL and the list it belongs to.
 struct ChunkUrl {
   std::string url;
@@ -63,6 +65,24 @@
   DISALLOW_COPY_AND_ASSIGN(SBChunkData);
 };
 
+// Used when we get a gethash response.
+struct SBFullHashResult {
+  SBFullHash hash;
+  // TODO(shess): Refactor to allow ListType here.
+  int list_id;
+  std::string metadata;
+};
+
+// Caches individual response from GETHASH request.
+struct SBCachedFullHashResult {
+  SBCachedFullHashResult();
+  explicit SBCachedFullHashResult(const base::Time& in_expire_after);
+  ~SBCachedFullHashResult();
+
+  base::Time expire_after;
+  std::vector<SBFullHashResult> full_hashes;
+};
+
 // Contains information about a list in the database.
 struct SBListChunkRanges {
   explicit SBListChunkRanges(const std::string& n);
@@ -82,4 +102,81 @@
   std::vector<ChunkRange> chunk_del;
 };
 
+// Utility functions -----------------------------------------------------------
+
+namespace safe_browsing_util {
+
+// SafeBrowsing list names.
+extern const char kMalwareList[];
+extern const char kPhishingList[];
+// Binary Download list name.
+extern const char kBinUrlList[];
+// SafeBrowsing client-side detection whitelist list name.
+extern const char kCsdWhiteList[];
+// SafeBrowsing download whitelist list name.
+extern const char kDownloadWhiteList[];
+// SafeBrowsing extension list name.
+extern const char kExtensionBlacklist[];
+// SafeBrowsing csd malware IP blacklist name.
+extern const char kIPBlacklist[];
+// SafeBrowsing unwanted URL list.
+extern const char kUnwantedUrlList[];
+// SafeBrowsing off-domain inclusion whitelist list name.
+extern const char kInclusionWhitelist[];
+
+// This array must contain all Safe Browsing lists.
+extern const char* kAllLists[9];
+
+enum ListType {
+  INVALID = -1,
+  MALWARE = 0,
+  PHISH = 1,
+  BINURL = 2,
+  // Obsolete BINHASH = 3,
+  CSDWHITELIST = 4,
+  // SafeBrowsing lists are stored in pairs.  Keep ListType 5
+  // available for a potential second list that we would store in the
+  // csd-whitelist store file.
+  DOWNLOADWHITELIST = 6,
+  // See above comment. Leave 7 available.
+  EXTENSIONBLACKLIST = 8,
+  // See above comment. Leave 9 available.
+  // Obsolete SIDEEFFECTFREEWHITELIST = 10,
+  // See above comment. Leave 11 available.
+  IPBLACKLIST = 12,
+  // See above comment.  Leave 13 available.
+  UNWANTEDURL = 14,
+  // See above comment.  Leave 15 available.
+  INCLUSIONWHITELIST = 16,
+  // See above comment.  Leave 17 available.
+};
+
+// Maps a list name to ListType.
+ListType GetListId(const base::StringPiece& name);
+
+// Maps a ListId to list name. Return false if fails.
+bool GetListName(ListType list_id, std::string* list);
+
+// Canonicalizes url as per Google Safe Browsing Specification.
+// See section 6.1 in
+// http://code.google.com/p/google-safe-browsing/wiki/Protocolv2Spec.
+void CanonicalizeUrl(const GURL& url, std::string* canonicalized_hostname,
+                     std::string* canonicalized_path,
+                     std::string* canonicalized_query);
+
+// Given a URL, returns all the hosts we need to check.  They are returned
+// in order of size (i.e. b.c is first, then a.b.c).
+void GenerateHostsToCheck(const GURL& url, std::vector<std::string>* hosts);
+
+// Given a URL, returns all the paths we need to check.
+void GeneratePathsToCheck(const GURL& url, std::vector<std::string>* paths);
+
+// Given a URL, returns all the patterns we need to check.
+void GeneratePatternsToCheck(const GURL& url, std::vector<std::string>* urls);
+
+SBFullHash StringToSBFullHash(const std::string& hash_in);
+std::string SBFullHashToString(const SBFullHash& hash_out);
+
+}  // namespace safe_browsing_util
+
 #endif  // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_
diff --git a/components/safe_browsing_db/util_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_util_unittest.cc
similarity index 74%
rename from components/safe_browsing_db/util_unittest.cc
rename to chrome/browser/safe_browsing/safe_browsing_util_unittest.cc
index d29bd3f..3c875bb 100644
--- a/components/safe_browsing_db/util_unittest.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_util_unittest.cc
@@ -1,11 +1,11 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// 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 <algorithm>
 
 #include "base/strings/stringprintf.h"
-#include "components/safe_browsing_db/util.h"
+#include "chrome/browser/safe_browsing/safe_browsing_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "url/gurl.h"
 
@@ -20,12 +20,12 @@
 // according to the Safe Browsing spec.
 // See section 6.2 in
 // http://code.google.com/p/google-safe-browsing/wiki/Protocolv2Spec.
-TEST(SafeBrowsingDbUtilTest, UrlParsing) {
+TEST(SafeBrowsingUtilTest, UrlParsing) {
   std::vector<std::string> hosts, paths;
 
   GURL url("http://a.b.c/1/2.html?param=1");
-  safe_browsing::GenerateHostsToCheck(url, &hosts);
-  safe_browsing::GeneratePathsToCheck(url, &paths);
+  safe_browsing_util::GenerateHostsToCheck(url, &hosts);
+  safe_browsing_util::GeneratePathsToCheck(url, &paths);
   EXPECT_EQ(hosts.size(), static_cast<size_t>(2));
   EXPECT_EQ(paths.size(), static_cast<size_t>(4));
   EXPECT_EQ(hosts[0], "b.c");
@@ -37,8 +37,8 @@
   EXPECT_TRUE(VectorContains(paths, "/"));
 
   url = GURL("http://a.b.c.d.e.f.g/1.html");
-  safe_browsing::GenerateHostsToCheck(url, &hosts);
-  safe_browsing::GeneratePathsToCheck(url, &paths);
+  safe_browsing_util::GenerateHostsToCheck(url, &hosts);
+  safe_browsing_util::GeneratePathsToCheck(url, &paths);
   EXPECT_EQ(hosts.size(), static_cast<size_t>(5));
   EXPECT_EQ(paths.size(), static_cast<size_t>(2));
   EXPECT_EQ(hosts[0], "f.g");
@@ -50,7 +50,7 @@
   EXPECT_TRUE(VectorContains(paths, "/"));
 
   url = GURL("http://a.b/saw-cgi/eBayISAPI.dll/");
-  safe_browsing::GeneratePathsToCheck(url, &paths);
+  safe_browsing_util::GeneratePathsToCheck(url, &paths);
   EXPECT_EQ(paths.size(), static_cast<size_t>(3));
   EXPECT_TRUE(VectorContains(paths, "/saw-cgi/eBayISAPI.dll/"));
   EXPECT_TRUE(VectorContains(paths, "/saw-cgi/"));
@@ -60,7 +60,7 @@
 // Tests the url canonicalization according to the Safe Browsing spec.
 // See section 6.1 in
 // http://code.google.com/p/google-safe-browsing/wiki/Protocolv2Spec.
-TEST(SafeBrowsingDbUtilTest, CanonicalizeUrl) {
+TEST(SafeBrowsingUtilTest, CanonicalizeUrl) {
   struct {
     const char* input_url;
     const char* expected_canonicalized_hostname;
@@ -265,7 +265,7 @@
     std::string canonicalized_hostname;
     std::string canonicalized_path;
     std::string canonicalized_query;
-    safe_browsing::CanonicalizeUrl(url, &canonicalized_hostname,
+    safe_browsing_util::CanonicalizeUrl(url, &canonicalized_hostname,
         &canonicalized_path, &canonicalized_query);
 
     EXPECT_EQ(tests[i].expected_canonicalized_hostname,
@@ -277,63 +277,47 @@
   }
 }
 
-TEST(SafeBrowsingDbUtilTest, ListIdListNameConversion) {
+TEST(SafeBrowsingUtilTest, ListIdListNameConversion) {
   std::string list_name;
-  EXPECT_FALSE(safe_browsing::GetListName(safe_browsing::INVALID,
+  EXPECT_FALSE(safe_browsing_util::GetListName(safe_browsing_util::INVALID,
                                                &list_name));
-  EXPECT_TRUE(safe_browsing::GetListName(safe_browsing::MALWARE,
+  EXPECT_TRUE(safe_browsing_util::GetListName(safe_browsing_util::MALWARE,
                                               &list_name));
-  EXPECT_EQ(list_name, std::string(safe_browsing::kMalwareList));
-  EXPECT_EQ(safe_browsing::MALWARE,
-            safe_browsing::GetListId(list_name));
+  EXPECT_EQ(list_name, std::string(safe_browsing_util::kMalwareList));
+  EXPECT_EQ(safe_browsing_util::MALWARE,
+            safe_browsing_util::GetListId(list_name));
 
-  EXPECT_TRUE(safe_browsing::GetListName(safe_browsing::PHISH,
+  EXPECT_TRUE(safe_browsing_util::GetListName(safe_browsing_util::PHISH,
                                               &list_name));
-  EXPECT_EQ(list_name, std::string(safe_browsing::kPhishingList));
-  EXPECT_EQ(safe_browsing::PHISH,
-            safe_browsing::GetListId(list_name));
+  EXPECT_EQ(list_name, std::string(safe_browsing_util::kPhishingList));
+  EXPECT_EQ(safe_browsing_util::PHISH,
+            safe_browsing_util::GetListId(list_name));
 
-  EXPECT_TRUE(safe_browsing::GetListName(safe_browsing::BINURL,
+  EXPECT_TRUE(safe_browsing_util::GetListName(safe_browsing_util::BINURL,
                                               &list_name));
-  EXPECT_EQ(list_name, std::string(safe_browsing::kBinUrlList));
-  EXPECT_EQ(safe_browsing::BINURL,
-            safe_browsing::GetListId(list_name));
+  EXPECT_EQ(list_name, std::string(safe_browsing_util::kBinUrlList));
+  EXPECT_EQ(safe_browsing_util::BINURL,
+            safe_browsing_util::GetListId(list_name));
 }
 
 // Since the ids are saved in file, we need to make sure they don't change.
 // Since only the last bit of each id is saved in file together with
 // chunkids, this checks only last bit.
-TEST(SafeBrowsingDbUtilTest, ListIdVerification) {
-  EXPECT_EQ(0, safe_browsing::MALWARE % 2);
-  EXPECT_EQ(1, safe_browsing::PHISH % 2);
-  EXPECT_EQ(0, safe_browsing::BINURL %2);
+TEST(SafeBrowsingUtilTest, ListIdVerification) {
+  EXPECT_EQ(0, safe_browsing_util::MALWARE % 2);
+  EXPECT_EQ(1, safe_browsing_util::PHISH % 2);
+  EXPECT_EQ(0, safe_browsing_util::BINURL %2);
 }
 
-TEST(SafeBrowsingDbUtilTest, StringToSBFullHashAndSBFullHashToString) {
+TEST(SafeBrowsingUtilTest, StringToSBFullHashAndSBFullHashToString) {
   // 31 chars plus the last \0 as full_hash.
   const std::string hash_in = "12345678902234567890323456789012";
-  SBFullHash hash_out = safe_browsing::StringToSBFullHash(hash_in);
+  SBFullHash hash_out = safe_browsing_util::StringToSBFullHash(hash_in);
   EXPECT_EQ(0x34333231U, hash_out.prefix);
   EXPECT_EQ(0, memcmp(hash_in.data(), hash_out.full_hash, sizeof(SBFullHash)));
 
-  std::string hash_final = safe_browsing::SBFullHashToString(hash_out);
+  std::string hash_final = safe_browsing_util::SBFullHashToString(hash_out);
   EXPECT_EQ(hash_in, hash_final);
 }
 
-TEST(SafeBrowsingDbUtilTest, FullHashOperators) {
-  const SBFullHash kHash1 = safe_browsing::SBFullHashForString("one");
-  const SBFullHash kHash2 = safe_browsing::SBFullHashForString("two");
-
-  EXPECT_TRUE(safe_browsing::SBFullHashEqual(kHash1, kHash1));
-  EXPECT_TRUE(safe_browsing::SBFullHashEqual(kHash2, kHash2));
-  EXPECT_FALSE(safe_browsing::SBFullHashEqual(kHash1, kHash2));
-  EXPECT_FALSE(safe_browsing::SBFullHashEqual(kHash2, kHash1));
-
-  EXPECT_FALSE(safe_browsing::SBFullHashLess(kHash1, kHash2));
-  EXPECT_TRUE(safe_browsing::SBFullHashLess(kHash2, kHash1));
-
-  EXPECT_FALSE(safe_browsing::SBFullHashLess(kHash1, kHash1));
-  EXPECT_FALSE(safe_browsing::SBFullHashLess(kHash2, kHash2));
-}
-
 }  // namespace
diff --git a/chrome/browser/sync/chrome_sync_client.cc b/chrome/browser/sync/chrome_sync_client.cc
index d112e92..b88696a 100644
--- a/chrome/browser/sync/chrome_sync_client.cc
+++ b/chrome/browser/sync/chrome_sync_client.cc
@@ -7,6 +7,7 @@
 #include "base/bind.h"
 #include "chrome/browser/autofill/personal_data_manager_factory.h"
 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
+#include "chrome/browser/browsing_data/browsing_data_helper.h"
 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h"
 #include "chrome/browser/favicon/favicon_service_factory.h"
 #include "chrome/browser/history/history_service_factory.h"
@@ -153,7 +154,9 @@
     scoped_ptr<sync_driver::SyncApiComponentFactory> component_factory)
     : profile_(profile),
       component_factory_(component_factory.Pass()),
-      sync_sessions_client_(new SyncSessionsClientImpl(profile)) {}
+      sync_sessions_client_(new SyncSessionsClientImpl(profile)),
+      browsing_data_remover_observer_(NULL) {}
+
 ChromeSyncClient::~ChromeSyncClient() {
 }
 
@@ -206,6 +209,12 @@
       profile_, ServiceAccessType::EXPLICIT_ACCESS);
 }
 
+sync_driver::ClearBrowsingDataCallback
+ChromeSyncClient::GetClearBrowsingDataCallback() {
+  return base::Bind(&ChromeSyncClient::ClearBrowsingData,
+                    base::Unretained(this));
+}
+
 base::Closure ChromeSyncClient::GetPasswordStateChangedCallback() {
   return base::Bind(
       &PasswordStoreFactory::OnPasswordsSyncedStatePotentiallyChanged,
@@ -403,4 +412,23 @@
   return component_factory_.get();
 }
 
+void ChromeSyncClient::ClearBrowsingData(base::Time start, base::Time end) {
+  // BrowsingDataRemover deletes itself when it's done.
+  BrowsingDataRemover* remover =
+      BrowsingDataRemover::CreateForRange(profile_, start, end);
+  if (browsing_data_remover_observer_)
+    remover->AddObserver(browsing_data_remover_observer_);
+  remover->Remove(BrowsingDataRemover::REMOVE_ALL, BrowsingDataHelper::ALL);
+
+  scoped_refptr<password_manager::PasswordStore> password =
+      PasswordStoreFactory::GetForProfile(profile_,
+                                          ServiceAccessType::EXPLICIT_ACCESS);
+  password->RemoveLoginsSyncedBetween(start, end);
+}
+
+void ChromeSyncClient::SetBrowsingDataRemoverObserverForTesting(
+    BrowsingDataRemover::Observer* observer) {
+  browsing_data_remover_observer_ = observer;
+}
+
 }  // namespace browser_sync
diff --git a/chrome/browser/sync/chrome_sync_client.h b/chrome/browser/sync/chrome_sync_client.h
index 3713270a..f867e827 100644
--- a/chrome/browser/sync/chrome_sync_client.h
+++ b/chrome/browser/sync/chrome_sync_client.h
@@ -6,9 +6,9 @@
 #define CHROME_BROWSER_SYNC_CHROME_SYNC_CLIENT_H__
 
 #include "base/macros.h"
-#include "components/sync_driver/sync_client.h"
-
+#include "chrome/browser/browsing_data/browsing_data_remover.h"
 #include "chrome/browser/sync/glue/extensions_activity_monitor.h"
+#include "components/sync_driver/sync_client.h"
 
 class Profile;
 
@@ -34,6 +34,8 @@
   favicon::FaviconService* GetFaviconService() override;
   history::HistoryService* GetHistoryService() override;
   scoped_refptr<password_manager::PasswordStore> GetPasswordStore() override;
+  sync_driver::ClearBrowsingDataCallback GetClearBrowsingDataCallback()
+      override;
   base::Closure GetPasswordStateChangedCallback() override;
   autofill::PersonalDataManager* GetPersonalDataManager() override;
   scoped_refptr<autofill::AutofillWebDataService> GetWebDataService() override;
@@ -47,9 +49,15 @@
       syncer::WorkerLoopDestructionObserver* observer) override;
   sync_driver::SyncApiComponentFactory* GetSyncApiComponentFactory() override;
 
+  // Helper for testing rollback.
+  void SetBrowsingDataRemoverObserverForTesting(
+      BrowsingDataRemover::Observer* observer);
+
  private:
   Profile* const profile_;
 
+  void ClearBrowsingData(base::Time start, base::Time end);
+
   // The sync api component factory in use by this client.
   scoped_ptr<sync_driver::SyncApiComponentFactory> component_factory_;
 
@@ -69,6 +77,9 @@
   // Generates and monitors the ExtensionsActivity object used by sync.
   ExtensionsActivityMonitor extensions_activity_monitor_;
 
+  // Used in integration tests.
+  BrowsingDataRemover::Observer* browsing_data_remover_observer_;
+
   DISALLOW_COPY_AND_ASSIGN(ChromeSyncClient);
 };
 
diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc
index bfe80ae..16bbd5d0 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -26,15 +26,10 @@
 #include "base/threading/thread_restrictions.h"
 #include "base/time/time.h"
 #include "build/build_config.h"
-#include "chrome/browser/browsing_data/browsing_data_helper.h"
 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h"
-#include "chrome/browser/password_manager/password_store_factory.h"
 #include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/signin/chrome_signin_client_factory.h"
-#include "chrome/browser/signin/signin_manager_factory.h"
 #include "chrome/browser/sync/glue/sync_backend_host.h"
 #include "chrome/browser/sync/glue/sync_backend_host_impl.h"
-#include "chrome/browser/sync/supervised_user_signin_manager_wrapper.h"
 #include "chrome/browser/sync/sync_type_preference_provider.h"
 #include "chrome/common/channel_info.h"
 #include "chrome/common/chrome_switches.h"
@@ -44,7 +39,6 @@
 #include "components/invalidation/impl/invalidation_prefs.h"
 #include "components/invalidation/impl/profile_invalidation_provider.h"
 #include "components/invalidation/public/invalidation_service.h"
-#include "components/password_manager/core/browser/password_store.h"
 #include "components/pref_registry/pref_registry_syncable.h"
 #include "components/signin/core/browser/about_signin_internals.h"
 #include "components/signin/core/browser/profile_oauth2_token_service.h"
@@ -56,6 +50,7 @@
 #include "components/sync_driver/device_info.h"
 #include "components/sync_driver/glue/chrome_report_unrecoverable_error.h"
 #include "components/sync_driver/pref_names.h"
+#include "components/sync_driver/signin_manager_wrapper.h"
 #include "components/sync_driver/sync_api_component_factory.h"
 #include "components/sync_driver/sync_client.h"
 #include "components/sync_driver/sync_driver_switches.h"
@@ -154,24 +149,6 @@
 
 namespace {
 
-void ClearBrowsingData(BrowsingDataRemover::Observer* observer,
-                       Profile* profile,
-                       base::Time start,
-                       base::Time end) {
-  // BrowsingDataRemover deletes itself when it's done.
-  BrowsingDataRemover* remover = BrowsingDataRemover::CreateForRange(
-      profile, start, end);
-  if (observer)
-    remover->AddObserver(observer);
-  remover->Remove(BrowsingDataRemover::REMOVE_ALL,
-                  BrowsingDataHelper::ALL);
-
-  scoped_refptr<password_manager::PasswordStore> password =
-      PasswordStoreFactory::GetForProfile(profile,
-                                          ServiceAccessType::EXPLICIT_ACCESS);
-  password->RemoveLoginsSyncedBetween(start, end);
-}
-
 // Perform the actual sync data folder deletion.
 // This should only be called on the sync thread.
 void DeleteSyncDataFolder(const base::FilePath& directory_path) {
@@ -230,8 +207,6 @@
       backend_mode_(IDLE),
       need_backup_(false),
       backup_finished_(false),
-      clear_browsing_data_(base::Bind(&ClearBrowsingData)),
-      browsing_data_remover_observer_(NULL),
       catch_up_configure_in_progress_(false),
       passphrase_prompt_triggered_by_version_(false),
       weak_factory_(this),
@@ -1135,8 +1110,7 @@
   sync_js_controller_.AttachJsBackend(js_backend);
   debug_info_listener_ = debug_info_listener;
 
-  SigninClient* signin_client =
-      ChromeSigninClientFactory::GetForProfile(profile_);
+  SigninClient* signin_client = signin_->GetOriginal()->signin_client();
   DCHECK(signin_client);
   std::string signin_scoped_device_id =
       signin_client->GetSigninScopedDeviceId();
@@ -1390,8 +1364,9 @@
       // On desktop Chrome, sign out the user after a dashboard clear.
       // Skip sign out on ChromeOS/Android.
       if (!startup_controller_->auto_start_enabled()) {
-        SigninManagerFactory::GetForProfile(profile_)->SignOut(
-            signin_metrics::SERVER_FORCED_DISABLE);
+        SigninManager* signin_manager =
+            static_cast<SigninManager*>(signin_->GetOriginal());
+        signin_manager->SignOut(signin_metrics::SERVER_FORCED_DISABLE);
       }
 #endif
       break;
@@ -2591,23 +2566,8 @@
   if (first_sync_time.is_null())
     return;
 
-  clear_browsing_data_.Run(browsing_data_remover_observer_,
-                           profile_,
-                           first_sync_time,
-                           base::Time::Now());
-}
-
-void ProfileSyncService::SetBrowsingDataRemoverObserverForTesting(
-    BrowsingDataRemover::Observer* observer) {
-  browsing_data_remover_observer_ = observer;
-}
-
-void ProfileSyncService::SetClearingBrowseringDataForTesting(
-    base::Callback<void(BrowsingDataRemover::Observer* observer,
-                        Profile*,
-                        base::Time,
-                        base::Time)> c) {
-  clear_browsing_data_ = c;
+  sync_client_->GetClearBrowsingDataCallback().Run(first_sync_time,
+                                                   base::Time::Now());
 }
 
 void ProfileSyncService::CheckSyncBackupIfNeeded() {
diff --git a/chrome/browser/sync/profile_sync_service.h b/chrome/browser/sync/profile_sync_service.h
index b3442d7..11c8120 100644
--- a/chrome/browser/sync/profile_sync_service.h
+++ b/chrome/browser/sync/profile_sync_service.h
@@ -21,7 +21,6 @@
 #include "base/strings/string16.h"
 #include "base/time/time.h"
 #include "base/timer/timer.h"
-#include "chrome/browser/browsing_data/browsing_data_remover.h"
 #include "chrome/browser/sync/glue/sync_backend_host.h"
 #include "components/keyed_service/core/keyed_service.h"
 #include "components/signin/core/browser/signin_manager_base.h"
@@ -34,6 +33,7 @@
 #include "components/sync_driver/local_device_info_provider.h"
 #include "components/sync_driver/protocol_event_observer.h"
 #include "components/sync_driver/startup_controller.h"
+#include "components/sync_driver/sync_client.h"
 #include "components/sync_driver/sync_frontend.h"
 #include "components/sync_driver/sync_prefs.h"
 #include "components/sync_driver/sync_service.h"
@@ -554,13 +554,6 @@
   // Returns the current mode the backend is in.
   BackendMode backend_mode() const;
 
-  // Helpers for testing rollback.
-  void SetBrowsingDataRemoverObserverForTesting(
-      BrowsingDataRemover::Observer* observer);
-  void SetClearingBrowseringDataForTesting(base::Callback<
-      void(BrowsingDataRemover::Observer*, Profile*, base::Time, base::Time)>
-                                               c);
-
   base::Time GetDeviceBackupTimeForTesting() const;
 
   // This triggers a Directory::SaveChanges() call on the sync thread.
@@ -950,16 +943,10 @@
 
   base::Time backup_start_time_;
 
-  base::Callback<
-      void(BrowsingDataRemover::Observer*, Profile*, base::Time, base::Time)>
-      clear_browsing_data_;
-
   // Last time when pre-sync data was saved. NULL pointer means backup data
   // state is unknown. If time value is null, backup data doesn't exist.
   scoped_ptr<base::Time> last_backup_time_;
 
-  BrowsingDataRemover::Observer* browsing_data_remover_observer_;
-
   // The full path to the sync data directory.
   base::FilePath directory_path_;
 
diff --git a/chrome/browser/sync/profile_sync_service_unittest.cc b/chrome/browser/sync/profile_sync_service_unittest.cc
index 463ff0a..904781b 100644
--- a/chrome/browser/sync/profile_sync_service_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_unittest.cc
@@ -101,6 +101,26 @@
 using testing::StrictMock;
 using testing::_;
 
+class TestChromeSyncClient : public ChromeSyncClient {
+ public:
+  TestChromeSyncClient(
+      Profile* profile,
+      scoped_ptr<sync_driver::SyncApiComponentFactory> component_factory,
+      sync_driver::ClearBrowsingDataCallback callback)
+      : ChromeSyncClient(profile, component_factory.Pass()),
+        callback_(callback) {}
+  ~TestChromeSyncClient() override {}
+
+ private:
+  // SyncClient:
+  sync_driver::ClearBrowsingDataCallback GetClearBrowsingDataCallback()
+      override {
+    return callback_;
+  }
+
+  sync_driver::ClearBrowsingDataCallback callback_;
+};
+
 class TestSyncServiceObserver : public sync_driver::SyncServiceObserver {
  public:
   explicit TestSyncServiceObserver(ProfileSyncService* service)
@@ -281,15 +301,14 @@
     scoped_ptr<SyncApiComponentFactoryMock> components_factory(
         new SyncApiComponentFactoryMock());
     components_factory_ = components_factory.get();
-    scoped_ptr<ChromeSyncClient> sync_client(
-        new ChromeSyncClient(profile_, components_factory.Pass()));
+    scoped_ptr<ChromeSyncClient> sync_client(new TestChromeSyncClient(
+        profile_, components_factory.Pass(),
+        base::Bind(&ProfileSyncServiceTest::ClearBrowsingDataCallback,
+                   base::Unretained(this))));
     service_.reset(new ProfileSyncService(
         sync_client.Pass(), profile_,
         make_scoped_ptr(new SigninManagerWrapper(signin)), oauth2_token_service,
         behavior, base::Bind(&EmptyNetworkTimeUpdate)));
-    service_->SetClearingBrowseringDataForTesting(
-        base::Bind(&ProfileSyncServiceTest::ClearBrowsingDataCallback,
-                   base::Unretained(this)));
     service_->RegisterDataTypeController(
         new sync_driver::FakeDataTypeController(syncer::BOOKMARKS));
   }
@@ -400,11 +419,7 @@
     return components_factory_;
   }
 
-  void ClearBrowsingDataCallback(BrowsingDataRemover::Observer* observer,
-                                 Profile* profile,
-                                 base::Time start,
-                                 base::Time end) {
-    EXPECT_EQ(profile_, profile);
+  void ClearBrowsingDataCallback(base::Time start, base::Time end) {
     clear_browsing_date_start_ = start;
   }
 
diff --git a/chrome/browser/sync/test/integration/single_client_backup_rollback_test.cc b/chrome/browser/sync/test/integration/single_client_backup_rollback_test.cc
index ea607e1..437f946 100644
--- a/chrome/browser/sync/test/integration/single_client_backup_rollback_test.cc
+++ b/chrome/browser/sync/test/integration/single_client_backup_rollback_test.cc
@@ -12,6 +12,7 @@
 #include "base/thread_task_runner_handle.h"
 #include "chrome/browser/browsing_data/browsing_data_remover.h"
 #include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/sync/chrome_sync_client.h"
 #include "chrome/browser/sync/profile_sync_service.h"
 #include "chrome/browser/sync/test/integration/bookmarks_helper.h"
 #include "chrome/browser/sync/test/integration/preferences_helper.h"
@@ -139,7 +140,10 @@
 
   bool Wait() {
     pss_->AddObserver(this);
-    pss_->SetBrowsingDataRemoverObserverForTesting(this);
+
+    browser_sync::ChromeSyncClient* sync_client =
+        static_cast<browser_sync::ChromeSyncClient*>(pss_->GetSyncClient());
+    sync_client->SetBrowsingDataRemoverObserverForTesting(this);
     base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
         FROM_HERE, run_loop_.QuitClosure(), timeout_);
     run_loop_.Run();
diff --git a/chrome/browser/sync/test_profile_sync_service.h b/chrome/browser/sync/test_profile_sync_service.h
index 056082e..f6caf97b 100644
--- a/chrome/browser/sync/test_profile_sync_service.h
+++ b/chrome/browser/sync/test_profile_sync_service.h
@@ -16,6 +16,7 @@
 #include "components/sync_driver/data_type_manager_impl.h"
 #include "components/sync_driver/sync_client.h"
 #include "components/sync_driver/sync_prefs.h"
+#include "content/public/browser/browser_context.h"
 #include "sync/test/engine/test_id_factory.h"
 #include "testing/gmock/include/gmock/gmock.h"
 
diff --git a/chrome/browser/ui/cocoa/autofill/autofill_popup_base_view_cocoa.h b/chrome/browser/ui/cocoa/autofill/autofill_popup_base_view_cocoa.h
index 2421272..d9ea64bb 100644
--- a/chrome/browser/ui/cocoa/autofill/autofill_popup_base_view_cocoa.h
+++ b/chrome/browser/ui/cocoa/autofill/autofill_popup_base_view_cocoa.h
@@ -15,7 +15,7 @@
 
 @interface AutofillPopupBaseViewCocoa : BaseView {
  @private
-   __weak autofill::AutofillPopupViewDelegate* delegate_;
+   autofill::AutofillPopupViewDelegate* delegate_;  // weak
 }
 
 - (NSColor*)backgroundColor;
diff --git a/chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.h b/chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.h
index b140d05..6ddc713 100644
--- a/chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.h
+++ b/chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.h
@@ -17,7 +17,7 @@
 @interface AutofillPopupViewCocoa : AutofillPopupBaseViewCocoa {
  @private
   // The cross-platform controller for this view.
-  __weak autofill::AutofillPopupController* controller_;
+  autofill::AutofillPopupController* controller_;  // weak
 }
 
 // Designated initializer.
diff --git a/chrome/browser/ui/cocoa/autofill/password_generation_popup_view_cocoa.h b/chrome/browser/ui/cocoa/autofill/password_generation_popup_view_cocoa.h
index 321666d..a1879ea 100644
--- a/chrome/browser/ui/cocoa/autofill/password_generation_popup_view_cocoa.h
+++ b/chrome/browser/ui/cocoa/autofill/password_generation_popup_view_cocoa.h
@@ -23,7 +23,7 @@
     : AutofillPopupBaseViewCocoa <NSTextViewDelegate> {
  @private
   // The cross-platform controller for this view.
-  __weak autofill::PasswordGenerationPopupController* controller_;
+  autofill::PasswordGenerationPopupController* controller_;  // weak
 
   base::scoped_nsobject<NSView> passwordSection_;
   base::scoped_nsobject<NSTextField> passwordField_;
diff --git a/chrome/browser/ui/cocoa/profiles/avatar_menu_bubble_controller.h b/chrome/browser/ui/cocoa/profiles/avatar_menu_bubble_controller.h
index ed2d3add..ee4ae5e 100644
--- a/chrome/browser/ui/cocoa/profiles/avatar_menu_bubble_controller.h
+++ b/chrome/browser/ui/cocoa/profiles/avatar_menu_bubble_controller.h
@@ -7,6 +7,7 @@
 
 #import <Cocoa/Cocoa.h>
 
+#include "base/mac/objc_property_releaser.h"
 #include "base/mac/scoped_nsobject.h"
 #include "base/memory/scoped_ptr.h"
 #import "chrome/browser/ui/cocoa/base_bubble_controller.h"
@@ -55,7 +56,7 @@
 @interface AvatarMenuItemController : NSViewController<NSAnimationDelegate> {
  @private
   // The parent menu controller; owns this.
-  __weak AvatarMenuBubbleController* controller_;
+  AvatarMenuBubbleController* controller_;  // weak
 
   // The index of the item in the AvatarMenu.
   size_t menuIndex_;
@@ -68,22 +69,24 @@
   base::scoped_nsobject<NSAnimation> linkAnimation_;
 
   // Instance variables that back the outlets.
-  __weak NSImageView* iconView_;
-  __weak NSImageView* activeView_;
-  __weak NSTextField* nameField_;
+  NSImageView* iconView_;
+  NSImageView* activeView_;
+  NSTextField* nameField_;
   // These two views sit on top of each other, and only one is visible at a
   // time. The editButton_ is visible when the mouse is over the item and the
   // emailField_ is visible otherwise.
-  __weak NSTextField* emailField_;
-  __weak NSButton* editButton_;
+  NSTextField* emailField_;
+  NSButton* editButton_;
+
+  base::mac::ObjCPropertyReleaser propertyReleaser_;
 }
 @property(readonly, nonatomic) size_t menuIndex;
 @property(assign, nonatomic) BOOL isHighlighted;
-@property(assign, nonatomic) IBOutlet NSImageView* iconView;
-@property(assign, nonatomic) IBOutlet NSImageView* activeView;
-@property(assign, nonatomic) IBOutlet NSTextField* nameField;
-@property(assign, nonatomic) IBOutlet NSTextField* emailField;
-@property(assign, nonatomic) IBOutlet NSButton* editButton;
+@property(retain, nonatomic) IBOutlet NSImageView* iconView;
+@property(retain, nonatomic) IBOutlet NSImageView* activeView;
+@property(retain, nonatomic) IBOutlet NSTextField* nameField;
+@property(retain, nonatomic) IBOutlet NSTextField* emailField;
+@property(retain, nonatomic) IBOutlet NSButton* editButton;
 
 // Designated initializer.
 - (id)initWithMenuIndex:(size_t)menuIndex
@@ -108,7 +111,8 @@
 @interface AvatarMenuItemView : NSView {
  @private
   // The controller that manages this.
-  __weak AvatarMenuItemController* viewController_;
+  // weak to not form a reference cycle with the controller.
+  __unsafe_unretained AvatarMenuItemController* viewController_;
 
   // Used to highlight the background on hover.
   ui::ScopedCrTrackingArea trackingArea_;
diff --git a/chrome/browser/ui/cocoa/profiles/avatar_menu_bubble_controller.mm b/chrome/browser/ui/cocoa/profiles/avatar_menu_bubble_controller.mm
index 347f2b9..a406337f 100644
--- a/chrome/browser/ui/cocoa/profiles/avatar_menu_bubble_controller.mm
+++ b/chrome/browser/ui/cocoa/profiles/avatar_menu_bubble_controller.mm
@@ -480,6 +480,7 @@
           menuController:(AvatarMenuBubbleController*)controller {
   if ((self = [super initWithNibName:@"AvatarMenuItem"
                               bundle:base::mac::FrameworkBundle()])) {
+    propertyReleaser_.Init(self, [AvatarMenuItemController class]);
     menuIndex_ = menuIndex;
     controller_ = controller;
     [self loadView];
diff --git a/chrome/browser/ui/cocoa/profiles/profile_menu_controller.h b/chrome/browser/ui/cocoa/profiles/profile_menu_controller.h
index 91d74be..42c3b53 100644
--- a/chrome/browser/ui/cocoa/profiles/profile_menu_controller.h
+++ b/chrome/browser/ui/cocoa/profiles/profile_menu_controller.h
@@ -29,7 +29,7 @@
   scoped_ptr<ProfileMenuControllerInternal::Observer> observer_;
 
   // The main menu item to which the profile menu is attached.
-  __weak NSMenuItem* mainMenuItem_;
+  NSMenuItem* mainMenuItem_;  // weak
 }
 
 // Designated initializer.
diff --git a/chrome/browser/ui/cocoa/tabs/media_indicator_button_cocoa.h b/chrome/browser/ui/cocoa/tabs/media_indicator_button_cocoa.h
index 8216bc8..d8bfec8ba 100644
--- a/chrome/browser/ui/cocoa/tabs/media_indicator_button_cocoa.h
+++ b/chrome/browser/ui/cocoa/tabs/media_indicator_button_cocoa.h
@@ -43,14 +43,14 @@
   // Target and action invoked whenever a fade-in/out animation completes.  This
   // is used by TabController to layout the TabView after an indicator has
   // completely faded out.
-  __weak id animationDoneTarget_;
+  id animationDoneTarget_;  // weak
   SEL animationDoneAction_;
 
   // The image to show when the mouse hovers over the button.
   base::scoped_nsobject<NSImage> affordanceImage_;
 
   // Target and action invoked whenever an enabled button is clicked.
-  __weak id clickTarget_;
+  id clickTarget_;  // weak
   SEL clickAction_;
 }
 
diff --git a/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.h b/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.h
index d422faa..ce6138d9 100644
--- a/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.h
+++ b/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.h
@@ -7,6 +7,7 @@
 
 #import <Cocoa/Cocoa.h>
 
+#include "base/mac/objc_property_releaser.h"
 #import "base/mac/scoped_nsobject.h"
 #include "base/memory/scoped_ptr.h"
 #import "chrome/browser/ui/cocoa/has_weak_browser_pointer.h"
@@ -126,20 +127,22 @@
 
   MenuTrackedRootView* toolbarActionsOverflowItem_;
   BrowserActionsContainerView* overflowActionsContainerView_;
+
+  base::mac::ObjCPropertyReleaser propertyReleaser_;
 }
 
-@property(assign, nonatomic) IBOutlet MenuTrackedRootView* editItem;
-@property(assign, nonatomic) IBOutlet NSButton* editCut;
-@property(assign, nonatomic) IBOutlet NSButton* editCopy;
-@property(assign, nonatomic) IBOutlet NSButton* editPaste;
-@property(assign, nonatomic) IBOutlet MenuTrackedRootView* zoomItem;
-@property(assign, nonatomic) IBOutlet NSButton* zoomPlus;
-@property(assign, nonatomic) IBOutlet NSButton* zoomDisplay;
-@property(assign, nonatomic) IBOutlet NSButton* zoomMinus;
-@property(assign, nonatomic) IBOutlet NSButton* zoomFullScreen;
-@property(assign, nonatomic)
+@property(retain, nonatomic) IBOutlet MenuTrackedRootView* editItem;
+@property(retain, nonatomic) IBOutlet NSButton* editCut;
+@property(retain, nonatomic) IBOutlet NSButton* editCopy;
+@property(retain, nonatomic) IBOutlet NSButton* editPaste;
+@property(retain, nonatomic) IBOutlet MenuTrackedRootView* zoomItem;
+@property(retain, nonatomic) IBOutlet NSButton* zoomPlus;
+@property(retain, nonatomic) IBOutlet NSButton* zoomDisplay;
+@property(retain, nonatomic) IBOutlet NSButton* zoomMinus;
+@property(retain, nonatomic) IBOutlet NSButton* zoomFullScreen;
+@property(retain, nonatomic)
     IBOutlet MenuTrackedRootView* toolbarActionsOverflowItem;
-@property(assign, nonatomic)
+@property(retain, nonatomic)
     IBOutlet BrowserActionsContainerView* overflowActionsContainerView;
 
 - (id)initWithController:(WrenchMenuController*)controller;
diff --git a/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm b/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm
index 467be2a..d3ca091 100644
--- a/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm
+++ b/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm
@@ -573,6 +573,7 @@
 - (id)initWithController:(WrenchMenuController*)controller {
   if ((self = [super initWithNibName:@"WrenchMenu"
                               bundle:base::mac::FrameworkBundle()])) {
+    propertyReleaser_.Init(self, [WrenchMenuButtonViewController class]);
     controller_ = controller;
     [[NSNotificationCenter defaultCenter]
         addObserver:self
diff --git a/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc b/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc
index e5764a6..627ff319 100644
--- a/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc
+++ b/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc
@@ -96,7 +96,11 @@
     title_ =
         l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_TITLE);
   } else if (state_ == password_manager::ui::CREDENTIAL_REQUEST_STATE) {
-    title_ = l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_CHOOSE_TITLE);
+    GetAccountChooserDialogTitleTextAndLinkRange(
+        GetSmartLockBrandingState(GetProfile()) ==
+        password_bubble_experiment::SmartLockBranding::FULL,
+        &title_,
+        &title_brand_link_range_);
   } else if (state_ == password_manager::ui::AUTO_SIGNIN_STATE) {
     // There is no title.
   } else if (state_ == password_manager::ui::MANAGE_STATE) {
@@ -123,21 +127,11 @@
     save_confirmation_link_range_ =
         gfx::Range(offset, offset + save_confirmation_link.length());
   } else if (state_ == password_manager::ui::AUTO_SIGNIN_STATE) {
-    if (GetSmartLockBrandingState(GetProfile()) ==
-        password_bubble_experiment::SmartLockBranding::FULL) {
-      size_t offset;
-      base::string16 brand_name =
-          l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SMART_LOCK);
-      autosignin_welcome_text_ = l10n_util::GetStringFUTF16(
-          IDS_MANAGE_PASSWORDS_AUTO_SIGNIN_SMART_LOCK_WELCOME, brand_name,
-          &offset);
-      autosignin_welcome_link_range_ =
-          gfx::Range(offset, offset + brand_name.length());
-    } else {
-      autosignin_welcome_text_ = l10n_util::GetStringFUTF16(
-          IDS_MANAGE_PASSWORDS_AUTO_SIGNIN_DEFAULT_WELCOME,
-          l10n_util::GetStringUTF16(IDS_SAVE_PASSWORD_TITLE_BRAND));
-    }
+    GetAutoSigninPromptFirstRunExperienceExplanation(
+        GetSmartLockBrandingState(GetProfile()) ==
+        password_bubble_experiment::SmartLockBranding::FULL,
+        &autosignin_welcome_text_,
+        &autosignin_welcome_link_range_);
   }
 
   manage_link_ =
diff --git a/chrome/browser/ui/passwords/manage_passwords_state.cc b/chrome/browser/ui/passwords/manage_passwords_state.cc
index c8f70c7..16096d16 100644
--- a/chrome/browser/ui/passwords/manage_passwords_state.cc
+++ b/chrome/browser/ui/passwords/manage_passwords_state.cc
@@ -202,6 +202,45 @@
   }
 }
 
+void ManagePasswordsState::ChooseCredential(
+    const autofill::PasswordForm& form,
+    password_manager::CredentialType credential_type) {
+  DCHECK_EQ(password_manager::ui::CREDENTIAL_REQUEST_STATE, state());
+  DCHECK(!credentials_callback().is_null());
+
+  // Here, |credential_type| refers to whether the credential was originally
+  // passed into ::OnRequestCredentials as part of the |local_credentials| or
+  // |federated_credentials| lists (e.g. whether it is an existing credential
+  // saved for this origin, or whether we should synthesize a new
+  // FederatedCredential).
+  //
+  // If |credential_type| is federated, the credential MUST be returned as
+  // a FederatedCredential in order to prevent password information leaking
+  // cross-origin.
+  //
+  // If |credential_type| is local, the credential MIGHT be a PasswordCredential
+  // or it MIGHT be a FederatedCredential. We inspect the |federation_url|
+  // field to determine which we should return.
+  //
+  // TODO(mkwst): Clean this up. It is confusing.
+  password_manager::CredentialType type_to_return;
+  if (credential_type ==
+          password_manager::CredentialType::CREDENTIAL_TYPE_PASSWORD &&
+      form.federation_url.is_empty()) {
+    type_to_return = password_manager::CredentialType::CREDENTIAL_TYPE_PASSWORD;
+  } else if (credential_type ==
+             password_manager::CredentialType::CREDENTIAL_TYPE_EMPTY) {
+    type_to_return = password_manager::CredentialType::CREDENTIAL_TYPE_EMPTY;
+  } else {
+    type_to_return =
+        password_manager::CredentialType::CREDENTIAL_TYPE_FEDERATED;
+  }
+  password_manager::CredentialInfo info =
+      password_manager::CredentialInfo(form, type_to_return);
+  credentials_callback().Run(info);
+  set_credentials_callback(ManagePasswordsState::CredentialsCallback());
+}
+
 void ManagePasswordsState::ClearData() {
   form_manager_.reset();
   current_forms_weak_.clear();
diff --git a/chrome/browser/ui/passwords/manage_passwords_state.h b/chrome/browser/ui/passwords/manage_passwords_state.h
index 990758c..c1275bf 100644
--- a/chrome/browser/ui/passwords/manage_passwords_state.h
+++ b/chrome/browser/ui/passwords/manage_passwords_state.h
@@ -11,6 +11,7 @@
 #include "base/memory/scoped_vector.h"
 #include "components/autofill/core/common/password_form.h"
 #include "components/password_manager/core/browser/password_store_change.h"
+#include "components/password_manager/core/common/credential_manager_types.h"
 #include "components/password_manager/core/common/password_manager_ui.h"
 #include "url/gurl.h"
 
@@ -78,6 +79,13 @@
   void ProcessLoginsChanged(
       const password_manager::PasswordStoreChangeList& changes);
 
+  // Called when the user chooses a credential. Using data from |form| and
+  // |credential_type| it constructs the object which next is passed to the
+  // credentials callback. Method should be called in the
+  // CREDENTIAL_REQUEST_STATE state.
+  void ChooseCredential(const autofill::PasswordForm& form,
+                        password_manager::CredentialType credential_type);
+
   password_manager::ui::State state() const { return state_; }
   const GURL& origin() const { return origin_; }
   password_manager::PasswordFormManager* form_manager() const {
diff --git a/chrome/browser/ui/passwords/manage_passwords_state_unittest.cc b/chrome/browser/ui/passwords/manage_passwords_state_unittest.cc
index aa84354e..eb67b34 100644
--- a/chrome/browser/ui/passwords/manage_passwords_state_unittest.cc
+++ b/chrome/browser/ui/passwords/manage_passwords_state_unittest.cc
@@ -62,7 +62,7 @@
   // Pushes a blacklisted form and checks that it doesn't affect the state.
   void TestBlacklistedUpdates();
 
-  MOCK_METHOD1(OnChooseCredential,
+  MOCK_METHOD1(CredentialCallback,
                void(const password_manager::CredentialInfo&));
 
  private:
@@ -270,9 +270,8 @@
   const GURL origin = test_local_form().origin;
   passwords_data().OnRequestCredentials(local_credentials.Pass(),
                                         federated_credentials.Pass(), origin);
-  passwords_data().set_credentials_callback(
-      base::Bind(&ManagePasswordsStateTest::OnChooseCredential,
-                 base::Unretained(this)));
+  passwords_data().set_credentials_callback(base::Bind(
+      &ManagePasswordsStateTest::CredentialCallback, base::Unretained(this)));
   EXPECT_THAT(passwords_data().GetCurrentForms(),
               ElementsAre(Pointee(test_local_form())));
   EXPECT_THAT(passwords_data().federated_credentials_forms(),
@@ -285,7 +284,7 @@
   password_manager::CredentialInfo credential_info(
       test_local_form(),
       password_manager::CredentialType::CREDENTIAL_TYPE_PASSWORD);
-  EXPECT_CALL(*this, OnChooseCredential(_))
+  EXPECT_CALL(*this, CredentialCallback(_))
       .WillOnce(testing::SaveArg<0>(&credential_info));
   passwords_data().TransitionToState(password_manager::ui::MANAGE_STATE);
   EXPECT_EQ(password_manager::CredentialType::CREDENTIAL_TYPE_EMPTY,
@@ -421,9 +420,8 @@
   const GURL origin = test_local_form().origin;
   passwords_data().OnRequestCredentials(local_credentials.Pass(),
                                         federated_credentials.Pass(), origin);
-  passwords_data().set_credentials_callback(
-      base::Bind(&ManagePasswordsStateTest::OnChooseCredential,
-                 base::Unretained(this)));
+  passwords_data().set_credentials_callback(base::Bind(
+      &ManagePasswordsStateTest::CredentialCallback, base::Unretained(this)));
   EXPECT_EQ(password_manager::ui::CREDENTIAL_REQUEST_STATE,
             passwords_data().state());
 
@@ -496,4 +494,65 @@
   TestAllUpdates();
 }
 
+TEST_F(ManagePasswordsStateTest, ChooseCredentialLocal) {
+  passwords_data().OnRequestCredentials(ScopedVector<autofill::PasswordForm>(),
+                                        ScopedVector<autofill::PasswordForm>(),
+                                        test_local_form().origin);
+  passwords_data().set_credentials_callback(base::Bind(
+      &ManagePasswordsStateTest::CredentialCallback, base::Unretained(this)));
+  password_manager::CredentialInfo credential_info(
+      test_local_form(),
+      password_manager::CredentialType::CREDENTIAL_TYPE_PASSWORD);
+  EXPECT_CALL(*this, CredentialCallback(credential_info));
+  passwords_data().ChooseCredential(
+      test_local_form(),
+      password_manager::CredentialType::CREDENTIAL_TYPE_PASSWORD);
+}
+
+TEST_F(ManagePasswordsStateTest, ChooseCredentialFederated) {
+  passwords_data().OnRequestCredentials(ScopedVector<autofill::PasswordForm>(),
+                                        ScopedVector<autofill::PasswordForm>(),
+                                        test_local_form().origin);
+  passwords_data().set_credentials_callback(base::Bind(
+      &ManagePasswordsStateTest::CredentialCallback, base::Unretained(this)));
+  password_manager::CredentialInfo credential_info(
+      test_federated_form(),
+      password_manager::CredentialType::CREDENTIAL_TYPE_FEDERATED);
+  EXPECT_CALL(*this, CredentialCallback(credential_info));
+  passwords_data().ChooseCredential(
+      test_federated_form(),
+      password_manager::CredentialType::CREDENTIAL_TYPE_FEDERATED);
+}
+
+TEST_F(ManagePasswordsStateTest, ChooseCredentialEmpty) {
+  passwords_data().OnRequestCredentials(ScopedVector<autofill::PasswordForm>(),
+                                        ScopedVector<autofill::PasswordForm>(),
+                                        test_local_form().origin);
+  autofill::PasswordForm password_form(test_local_form());
+  passwords_data().set_credentials_callback(base::Bind(
+      &ManagePasswordsStateTest::CredentialCallback, base::Unretained(this)));
+  password_manager::CredentialInfo credential_info(
+      test_federated_form(),
+      password_manager::CredentialType::CREDENTIAL_TYPE_EMPTY);
+  EXPECT_CALL(*this, CredentialCallback(credential_info));
+  passwords_data().ChooseCredential(
+      test_federated_form(),
+      password_manager::CredentialType::CREDENTIAL_TYPE_EMPTY);
+}
+
+TEST_F(ManagePasswordsStateTest, ChooseCredentialLocalWithNonEmptyFederation) {
+  passwords_data().OnRequestCredentials(ScopedVector<autofill::PasswordForm>(),
+                                        ScopedVector<autofill::PasswordForm>(),
+                                        test_local_form().origin);
+  autofill::PasswordForm form(test_federated_form());
+  form.federation_url = GURL("https://federation.test/");
+  passwords_data().set_credentials_callback(base::Bind(
+      &ManagePasswordsStateTest::CredentialCallback, base::Unretained(this)));
+  password_manager::CredentialInfo credential_info(
+      form, password_manager::CredentialType::CREDENTIAL_TYPE_FEDERATED);
+  EXPECT_CALL(*this, CredentialCallback(credential_info));
+  passwords_data().ChooseCredential(
+      form, password_manager::CredentialType::CREDENTIAL_TYPE_PASSWORD);
+}
+
 }  // namespace
diff --git a/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc b/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc
index 3a90b29..d6903dde 100644
--- a/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc
+++ b/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc
@@ -246,41 +246,7 @@
 void ManagePasswordsUIController::ChooseCredential(
     const autofill::PasswordForm& form,
     password_manager::CredentialType credential_type) {
-  DCHECK_EQ(password_manager::ui::CREDENTIAL_REQUEST_STATE, state());
-  DCHECK(!passwords_data_.credentials_callback().is_null());
-
-  // Here, |credential_type| refers to whether the credential was originally
-  // passed into ::OnChooseCredentials as part of the |local_credentials| or
-  // |federated_credentials| lists (e.g. whether it is an existing credential
-  // saved for this origin, or whether we should synthesize a new
-  // FederatedCredential).
-  //
-  // If |credential_type| is federated, the credential MUST be returned as
-  // a FederatedCredential in order to prevent password information leaking
-  // cross-origin.
-  //
-  // If |credential_type| is local, the credential MIGHT be a PasswordCredential
-  // or it MIGHT be a FederatedCredential. We inspect the |federation_url|
-  // field to determine which we should return.
-  //
-  // TODO(mkwst): Clean this up. It is confusing.
-  password_manager::CredentialType type_to_return;
-  if (credential_type ==
-          password_manager::CredentialType::CREDENTIAL_TYPE_PASSWORD &&
-      form.federation_url.is_empty()) {
-    type_to_return = password_manager::CredentialType::CREDENTIAL_TYPE_PASSWORD;
-  } else if (credential_type ==
-             password_manager::CredentialType::CREDENTIAL_TYPE_EMPTY) {
-    type_to_return = password_manager::CredentialType::CREDENTIAL_TYPE_EMPTY;
-  } else {
-    type_to_return =
-        password_manager::CredentialType::CREDENTIAL_TYPE_FEDERATED;
-  }
-  password_manager::CredentialInfo info =
-      password_manager::CredentialInfo(form, type_to_return);
-  passwords_data_.credentials_callback().Run(info);
-  passwords_data_.set_credentials_callback(
-      ManagePasswordsState::CredentialsCallback());
+  passwords_data_.ChooseCredential(form, credential_type);
 }
 
 void ManagePasswordsUIController::SavePasswordInternal() {
@@ -388,6 +354,11 @@
 }
 
 void ManagePasswordsUIController::OnNoInteractionOnUpdate() {
+  if (state() != password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) {
+    // Do nothing if the state was changed. It can happen for example when the
+    // update bubble is active and a page navigation happens.
+    return;
+  }
   password_manager::PasswordFormManager* form_manager =
       passwords_data_.form_manager();
   DCHECK(form_manager);
diff --git a/chrome/browser/ui/passwords/manage_passwords_ui_controller_unittest.cc b/chrome/browser/ui/passwords/manage_passwords_ui_controller_unittest.cc
index 4d495418..0be4b106 100644
--- a/chrome/browser/ui/passwords/manage_passwords_ui_controller_unittest.cc
+++ b/chrome/browser/ui/passwords/manage_passwords_ui_controller_unittest.cc
@@ -332,7 +332,7 @@
   controller()->OnPasswordSubmitted(test_form_manager.Pass());
   ExpectIconStateIs(password_manager::ui::PENDING_PASSWORD_STATE);
 
-  // Fake-navigate after a second. We expect the bubble's state to be reset
+  // Fake-navigate after 5 seconds. We expect the bubble's state to be reset
   // if a navigation occurs after this limit.
   controller()->SetElapsed(
       base::TimeDelta::FromMilliseconds(kSlowNavigationDelayInMS));
@@ -571,3 +571,20 @@
   controller()->UpdatePassword(autofill::PasswordForm());
   ExpectIconStateIs(password_manager::ui::MANAGE_STATE);
 }
+
+TEST_F(ManagePasswordsUIControllerTest, NavigationWhenUpdateBubbleActive) {
+  scoped_ptr<password_manager::PasswordFormManager> test_form_manager(
+      CreateFormManager());
+  controller()->OnUpdatePasswordSubmitted(test_form_manager.Pass());
+  EXPECT_EQ(password_manager::ui::PENDING_PASSWORD_UPDATE_STATE,
+            controller()->state());
+  // Fake-navigate after 5 seconds. We expect the bubble's state to be reset
+  // if a navigation occurs after this limit.
+  controller()->SetElapsed(
+      base::TimeDelta::FromMilliseconds(kSlowNavigationDelayInMS));
+  controller()->DidNavigateMainFrame(content::LoadCommittedDetails(),
+                                     content::FrameNavigateParams());
+  EXPECT_EQ(password_manager::ui::INACTIVE_STATE, controller()->state());
+  // The following line shouldn't crash browser.
+  controller()->OnNoInteractionOnUpdate();
+}
diff --git a/chrome/browser/ui/passwords/manage_passwords_view_utils.cc b/chrome/browser/ui/passwords/manage_passwords_view_utils.cc
index ce016fa..34823ba 100644
--- a/chrome/browser/ui/passwords/manage_passwords_view_utils.cc
+++ b/chrome/browser/ui/passwords/manage_passwords_view_utils.cc
@@ -80,7 +80,7 @@
   } else {
     replacements.insert(
         replacements.begin(),
-        l10n_util::GetStringUTF16(IDS_SAVE_PASSWORD_TITLE_BRAND));
+        l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_TITLE_BRAND));
     *title = l10n_util::GetStringFUTF16(title_id, replacements, &offsets);
   }
 }
@@ -106,37 +106,39 @@
     bool is_smartlock_branding_enabled,
     base::string16* title,
     gfx::Range* title_link_range) {
-  if (is_smartlock_branding_enabled) {
-    size_t offset;
-    base::string16 title_link =
-        l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SMART_LOCK);
-    *title = l10n_util::GetStringFUTF16(
-        IDS_PASSWORD_MANAGER_ACCOUNT_CHOOSER_TITLE_SMART_LOCK, title_link,
-        &offset);
-    *title_link_range = gfx::Range(offset, offset + title_link.length());
-  } else {
-    *title =
-        l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_ACCOUNT_CHOOSER_TITLE);
-  }
+  GetBrandedTextAndLinkRange(is_smartlock_branding_enabled,
+                             IDS_PASSWORD_MANAGER_ACCOUNT_CHOOSER_TITLE,
+                             IDS_PASSWORD_MANAGER_ACCOUNT_CHOOSER_TITLE,
+                             title, title_link_range);
 }
 
 void GetAutoSigninPromptFirstRunExperienceExplanation(
     bool is_smartlock_branding_enabled,
     base::string16* explanation,
     gfx::Range* explanation_link_range) {
-  *explanation_link_range = gfx::Range();
+  GetBrandedTextAndLinkRange(
+      is_smartlock_branding_enabled,
+      IDS_MANAGE_PASSWORDS_AUTO_SIGNIN_SMART_LOCK_WELCOME,
+      IDS_MANAGE_PASSWORDS_AUTO_SIGNIN_DEFAULT_WELCOME,
+      explanation, explanation_link_range);
+}
+
+void GetBrandedTextAndLinkRange(bool is_smartlock_branding_enabled,
+                                int smartlock_string_id,
+                                int default_string_id,
+                                base::string16* out_string,
+                                gfx::Range* link_range) {
   if (is_smartlock_branding_enabled) {
     size_t offset;
-    base::string16 explanation_link =
+    base::string16 brand_name =
         l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SMART_LOCK);
-    *explanation = l10n_util::GetStringFUTF16(
-        IDS_MANAGE_PASSWORDS_AUTO_SIGNIN_SMART_LOCK_WELCOME, explanation_link,
-        &offset);
-    *explanation_link_range =
-        gfx::Range(offset, offset + explanation_link.length());
+    *out_string = l10n_util::GetStringFUTF16(smartlock_string_id, brand_name,
+                                             &offset);
+    *link_range = gfx::Range(offset, offset + brand_name.length());
   } else {
-    *explanation = l10n_util::GetStringFUTF16(
-        IDS_MANAGE_PASSWORDS_AUTO_SIGNIN_DEFAULT_WELCOME,
-        l10n_util::GetStringUTF16(IDS_SAVE_PASSWORD_TITLE_BRAND));
+    *out_string = l10n_util::GetStringFUTF16(
+        default_string_id,
+        l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_TITLE_BRAND));
+    *link_range = gfx::Range();
   }
 }
diff --git a/chrome/browser/ui/passwords/manage_passwords_view_utils.h b/chrome/browser/ui/passwords/manage_passwords_view_utils.h
index 21b6af4..b11d5d52 100644
--- a/chrome/browser/ui/passwords/manage_passwords_view_utils.h
+++ b/chrome/browser/ui/passwords/manage_passwords_view_utils.h
@@ -70,4 +70,16 @@
     base::string16* explanation,
     gfx::Range* explanation_link_range);
 
+// Loads |smartlock_string_id| or |default_string_id| string from the resources
+// and substitutes the placeholder with the correct password manager branding
+// (Google Smart Lock, Google Chrome or Chromium) according to
+// |is_smartlock_branding_enabled|. If |is_smartlock_branding_enabled| is true
+// then |link_range| contains the link range for the brand name.
+void GetBrandedTextAndLinkRange(
+    bool is_smartlock_branding_enabled,
+    int smartlock_string_id,
+    int default_string_id,
+    base::string16* out_string,
+    gfx::Range* link_range);
+
 #endif  // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_VIEW_UTILS_H_
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc
index 9d19ce3..c2c44caa 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -219,7 +219,8 @@
 
   // Determine the font for use inside the bubbles.  The bubble background
   // images have 1 px thick edges, which we don't want to overlap.
-  const int kBubbleInteriorVerticalPadding = 1;
+  const int kBubbleInteriorVerticalPadding =
+      ui::MaterialDesignController::IsModeMaterial() ? 2 : 1;
   const int bubble_padding =
       GetVerticalEdgeThickness() +
       GetLayoutConstant(LOCATION_BAR_BUBBLE_VERTICAL_PADDING) +
diff --git a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
index 1a526f06..7239bc6 100644
--- a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
+++ b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
@@ -169,6 +169,12 @@
                         0);
 }
 
+views::StyledLabel::RangeStyleInfo GetLinkStyle() {
+  auto result = views::StyledLabel::RangeStyleInfo::CreateForLink();
+  result.disable_line_wrapping = false;
+  return result;
+}
+
 // Given a layout and a model, add an appropriate title using a
 // SINGLE_VIEW_COLUMN_SET, followed by a spacer row.
 void AddTitleRow(views::GridLayout* layout, ManagePasswordsBubbleModel* model) {
@@ -184,6 +190,23 @@
   layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
 }
 
+// Creates a title row possibly with a link. Adds it to |layout|.
+void AddTitleRowWithLink(views::GridLayout* layout,
+                           ManagePasswordsBubbleModel* model,
+                           views::StyledLabelListener* listener) {
+  views::StyledLabel* title_label =
+      new views::StyledLabel(model->title(), listener);
+  title_label->SetBaseFontList(
+      ui::ResourceBundle::GetSharedInstance().GetFontList(
+          ui::ResourceBundle::MediumFont));
+  if (!model->title_brand_link_range().is_empty()) {
+    title_label->AddStyleRange(model->title_brand_link_range(), GetLinkStyle());
+  }
+  BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET);
+  layout->StartRow(0, SINGLE_VIEW_COLUMN_SET);
+  layout->AddView(title_label);
+}
+
 scoped_ptr<views::LabelButton> GenerateButton(views::ButtonListener* listener,
                                               const base::string16& text) {
   scoped_ptr<views::LabelButton> button(new views::LabelButton(listener, text));
@@ -202,7 +225,8 @@
 // "Cancel" button.
 class ManagePasswordsBubbleView::AccountChooserView
     : public views::View,
-      public views::ButtonListener {
+      public views::ButtonListener,
+      public views::StyledLabelListener {
  public:
   explicit AccountChooserView(ManagePasswordsBubbleView* parent);
   ~AccountChooserView() override;
@@ -211,6 +235,10 @@
   // views::ButtonListener:
   void ButtonPressed(views::Button* sender, const ui::Event& event) override;
 
+  // views::StyledLabelListener:
+  void StyledLabelLinkClicked(const gfx::Range& range,
+                              int event_flags) override;
+
   // Adds |password_forms| to the layout remembering their |type|.
   void AddCredentialItemsWithType(
       views::GridLayout* layout,
@@ -233,8 +261,8 @@
       GenerateButton(this, l10n_util::GetStringUTF16(IDS_CANCEL)).release();
 
   // Title row.
-  BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET);
-  AddTitleRow(layout, parent_->model());
+  AddTitleRowWithLink(layout, parent_->model(), this);
+  layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing);
 
   AddCredentialItemsWithType(
       layout, parent_->model()->local_credentials(),
@@ -247,7 +275,7 @@
   // Button row.
   BuildColumnSet(layout, SINGLE_BUTTON_COLUMN_SET);
   layout->StartRowWithPadding(
-      0, SINGLE_BUTTON_COLUMN_SET, 0, views::kRelatedControlVerticalSpacing);
+      0, SINGLE_BUTTON_COLUMN_SET, 0, views::kUnrelatedControlVerticalSpacing);
   layout->AddView(cancel_button_);
 
   parent_->set_initially_focused_view(cancel_button_);
@@ -294,6 +322,13 @@
   parent_->Close();
 }
 
+void ManagePasswordsBubbleView::AccountChooserView::StyledLabelLinkClicked(
+    const gfx::Range& range,
+    int event_flags) {
+  DCHECK_EQ(range, parent_->model()->title_brand_link_range());
+  parent_->model()->OnBrandLinkClicked();
+}
+
 // ManagePasswordsBubbleView::AutoSigninView ----------------------------------
 
 // A view containing just one credential that was used for for automatic signing
@@ -371,7 +406,7 @@
     if (!parent_->model()->autosignin_welcome_link_range().is_empty()) {
       welcome_label->AddStyleRange(
           parent_->model()->autosignin_welcome_link_range(),
-          views::StyledLabel::RangeStyleInfo::CreateForLink());
+          GetLinkStyle());
     }
     // Add the warm welcome.
     BuildPaddingSingleColumnSet(layout, credential->GetLabelOffset());
@@ -482,19 +517,7 @@
            .release();
 
   // Title row.
-  views::StyledLabel* title_label =
-      new views::StyledLabel(parent_->model()->title(), this);
-  title_label->SetBaseFontList(
-      ui::ResourceBundle::GetSharedInstance().GetFontList(
-          ui::ResourceBundle::MediumFont));
-  if (!parent_->model()->title_brand_link_range().is_empty()) {
-    title_label->AddStyleRange(
-        parent_->model()->title_brand_link_range(),
-        views::StyledLabel::RangeStyleInfo::CreateForLink());
-  }
-  BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET);
-  layout->StartRow(0, SINGLE_VIEW_COLUMN_SET);
-  layout->AddView(title_label);
+  AddTitleRowWithLink(layout, parent_->model(), this);
 
   // Credential row.
   if (item) {
@@ -692,8 +715,7 @@
       ui::ResourceBundle::GetSharedInstance().GetFontList(
           ui::ResourceBundle::SmallFont));
   confirmation->AddStyleRange(
-      parent_->model()->save_confirmation_link_range(),
-      views::StyledLabel::RangeStyleInfo::CreateForLink());
+      parent_->model()->save_confirmation_link_range(), GetLinkStyle());
 
   layout->StartRow(0, SINGLE_VIEW_COLUMN_SET);
   layout->AddView(confirmation);
@@ -839,20 +861,8 @@
           ui::ResourceBundle::SmallFont));
 
   // Title row.
-  views::StyledLabel* title_label =
-      new views::StyledLabel(parent_->model()->title(), this);
-  title_label->SetBaseFontList(
-      ui::ResourceBundle::GetSharedInstance().GetFontList(
-          ui::ResourceBundle::MediumFont));
-  if (!parent_->model()->title_brand_link_range().is_empty()) {
-    title_label->AddStyleRange(
-        parent_->model()->title_brand_link_range(),
-        views::StyledLabel::RangeStyleInfo::CreateForLink());
-  }
-  BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET);
-  layout->StartRow(0, SINGLE_VIEW_COLUMN_SET);
-  layout->AddView(title_label);
-  layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
+  AddTitleRowWithLink(layout, parent_->model(), this);
+  layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing);
 
   // Credential row.
   layout->StartRow(0, SINGLE_VIEW_COLUMN_SET);
diff --git a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
index f049f6d..3e1e4146 100644
--- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
+++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
@@ -24,6 +24,7 @@
 #include "chrome/browser/ui/webui/device_log_ui.h"
 #include "chrome/browser/ui/webui/domain_reliability_internals_ui.h"
 #include "chrome/browser/ui/webui/downloads_ui.h"
+#include "chrome/browser/ui/webui/downloads_util.h"
 #include "chrome/browser/ui/webui/engagement/site_engagement_ui.h"
 #include "chrome/browser/ui/webui/flags_ui.h"
 #include "chrome/browser/ui/webui/flash_ui.h"
@@ -36,6 +37,7 @@
 #include "chrome/browser/ui/webui/invalidations_ui.h"
 #include "chrome/browser/ui/webui/local_state/local_state_ui.h"
 #include "chrome/browser/ui/webui/log_web_ui_url.h"
+#include "chrome/browser/ui/webui/md_downloads/md_downloads_ui.h"
 #include "chrome/browser/ui/webui/memory_internals/memory_internals_ui.h"
 #include "chrome/browser/ui/webui/net_internals/net_internals_ui.h"
 #include "chrome/browser/ui/webui/omnibox/omnibox_ui.h"
@@ -390,8 +392,11 @@
   if (url.host() == chrome::kChromeUIBookmarksHost)
     return &NewWebUI<BookmarksUI>;
   // Downloads list on Android uses the built-in download manager.
-  if (url.host() == chrome::kChromeUIDownloadsHost)
+  if (url.host() == chrome::kChromeUIDownloadsHost) {
+    if (MdDownloadsEnabled())
+      return &NewWebUI<MdDownloadsUI>;
     return &NewWebUI<DownloadsUI>;
+  }
   if (url.host() == chrome::kChromeUIGCMInternalsHost)
     return &NewWebUI<GCMInternalsUI>;
   // Help is implemented with native UI elements on Android.
diff --git a/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.cc b/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.cc
index 932d7a9..260b2f6 100644
--- a/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.cc
@@ -10,13 +10,12 @@
 #include "base/strings/string_number_conversions.h"
 #include "base/values.h"
 #include "chromeos/dbus/dbus_thread_manager.h"
+#include "chromeos/dbus/fake_bluetooth_adapter_client.h"
+#include "chromeos/dbus/fake_bluetooth_device_client.h"
 #include "chromeos/dbus/fake_cras_audio_client.h"
 #include "chromeos/dbus/fake_power_manager_client.h"
 #include "content/public/browser/web_ui.h"
 #include "device/bluetooth/bluetooth_device_chromeos.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
-#include "device/bluetooth/dbus/fake_bluetooth_adapter_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_device_client.h"
 
 namespace {
 
@@ -64,7 +63,7 @@
 namespace chromeos {
 
 class DeviceEmulatorMessageHandler::BluetoothObserver
-    : public bluez::BluetoothDeviceClient::Observer {
+    : public BluetoothDeviceClient::Observer {
  public:
   explicit BluetoothObserver(DeviceEmulatorMessageHandler* owner)
       : owner_(owner) {
@@ -180,8 +179,8 @@
 
 DeviceEmulatorMessageHandler::DeviceEmulatorMessageHandler()
     : fake_bluetooth_device_client_(
-          static_cast<bluez::FakeBluetoothDeviceClient*>(
-              bluez::BluezDBusManager::Get()
+          static_cast<chromeos::FakeBluetoothDeviceClient*>(
+              chromeos::DBusThreadManager::Get()
                   ->GetBluetoothDeviceClient())),
       fake_cras_audio_client_(static_cast<chromeos::FakeCrasAudioClient*>(
           chromeos::DBusThreadManager::Get()
@@ -209,7 +208,7 @@
   std::string path;
   CHECK(args->GetString(0, &path));
   fake_bluetooth_device_client_->RemoveDevice(
-      dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
+      dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
       dbus::ObjectPath(path));
 }
 
@@ -224,7 +223,7 @@
   // the main adapter.
   std::vector<dbus::ObjectPath> paths =
       fake_bluetooth_device_client_->GetDevicesForAdapter(
-          dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath));
+          dbus::ObjectPath(chromeos::FakeBluetoothAdapterClient::kAdapterPath));
 
   base::ListValue devices;
   // Get each device's properties.
@@ -238,21 +237,21 @@
 
   base::ListValue pairing_method_options;
   pairing_method_options.AppendString(
-      bluez::FakeBluetoothDeviceClient::kPairingMethodNone);
+      FakeBluetoothDeviceClient::kPairingMethodNone);
   pairing_method_options.AppendString(
-      bluez::FakeBluetoothDeviceClient::kPairingMethodPinCode);
+      FakeBluetoothDeviceClient::kPairingMethodPinCode);
   pairing_method_options.AppendString(
-      bluez::FakeBluetoothDeviceClient::kPairingMethodPassKey);
+      FakeBluetoothDeviceClient::kPairingMethodPassKey);
 
   base::ListValue pairing_action_options;
   pairing_action_options.AppendString(
-      bluez::FakeBluetoothDeviceClient::kPairingActionDisplay);
+      FakeBluetoothDeviceClient::kPairingActionDisplay);
   pairing_action_options.AppendString(
-      bluez::FakeBluetoothDeviceClient::kPairingActionRequest);
+      FakeBluetoothDeviceClient::kPairingActionRequest);
   pairing_action_options.AppendString(
-      bluez::FakeBluetoothDeviceClient::kPairingActionConfirmation);
+      FakeBluetoothDeviceClient::kPairingActionConfirmation);
   pairing_action_options.AppendString(
-      bluez::FakeBluetoothDeviceClient::kPairingActionFail);
+      FakeBluetoothDeviceClient::kPairingActionFail);
 
   // Send the list of devices to the view.
   web_ui()->CallJavascriptFunction(kUpdateBluetoothInfoJSCallback,
@@ -264,7 +263,7 @@
     const base::ListValue* args) {
   // Create the device if it does not already exist.
   std::string path = CreateBluetoothDeviceFromListValue(args);
-  bluez::FakeBluetoothDeviceClient::Properties* props =
+  chromeos::FakeBluetoothDeviceClient::Properties* props =
       fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(path));
 
   // Try to pair the device with the main adapter. The device is identified
@@ -443,7 +442,7 @@
 std::string DeviceEmulatorMessageHandler::CreateBluetoothDeviceFromListValue(
     const base::ListValue* args) {
   const base::DictionaryValue* device_dict = nullptr;
-  bluez::FakeBluetoothDeviceClient::IncomingDeviceProperties props;
+  FakeBluetoothDeviceClient::IncomingDeviceProperties props;
 
   CHECK(args->GetDictionary(0, &device_dict));
   CHECK(device_dict->GetString("path", &props.device_path));
@@ -460,7 +459,8 @@
   // Create the device and store it in the FakeBluetoothDeviceClient's observed
   // list of devices.
   fake_bluetooth_device_client_->CreateDeviceWithProperties(
-      dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath), props);
+      dbus::ObjectPath(chromeos::FakeBluetoothAdapterClient::kAdapterPath),
+      props);
 
   return props.device_path;
 }
@@ -468,11 +468,11 @@
 scoped_ptr<base::DictionaryValue> DeviceEmulatorMessageHandler::GetDeviceInfo(
     const dbus::ObjectPath& object_path) {
   // Get the device's properties.
-  bluez::FakeBluetoothDeviceClient::Properties* props =
+  chromeos::FakeBluetoothDeviceClient::Properties* props =
       fake_bluetooth_device_client_->GetProperties(object_path);
   scoped_ptr<base::DictionaryValue> device(new base::DictionaryValue());
   scoped_ptr<base::ListValue> uuids(new base::ListValue);
-  bluez::FakeBluetoothDeviceClient::SimulatedPairingOptions* options =
+  chromeos::FakeBluetoothDeviceClient::SimulatedPairingOptions* options =
       fake_bluetooth_device_client_->GetPairingOptions(object_path);
 
   device->SetString("path", object_path.value());
diff --git a/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.h b/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.h
index 882af77..840111bd 100644
--- a/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.h
+++ b/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.h
@@ -17,12 +17,9 @@
 class ObjectPath;
 }  // namespace dbus
 
-namespace bluez {
-class FakeBluetoothDeviceClient;
-}
-
 namespace chromeos {
 
+class FakeBluetoothDeviceClient;
 class FakeCrasAudioClient;
 class FakePowerManagerClient;
 
@@ -102,7 +99,7 @@
   scoped_ptr<base::DictionaryValue> GetDeviceInfo(
       const dbus::ObjectPath& object_path);
 
-  bluez::FakeBluetoothDeviceClient* fake_bluetooth_device_client_;
+  FakeBluetoothDeviceClient* fake_bluetooth_device_client_;
   scoped_ptr<BluetoothObserver> bluetooth_observer_;
 
   FakeCrasAudioClient* fake_cras_audio_client_;
diff --git a/chrome/browser/ui/webui/downloads_dom_handler.cc b/chrome/browser/ui/webui/downloads_dom_handler.cc
index 8e90f86..6ea362e 100644
--- a/chrome/browser/ui/webui/downloads_dom_handler.cc
+++ b/chrome/browser/ui/webui/downloads_dom_handler.cc
@@ -38,7 +38,6 @@
 #include "chrome/browser/extensions/extension_service.h"
 #include "chrome/browser/platform_util.h"
 #include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/webui/downloads_util.h"
 #include "chrome/browser/ui/webui/fileicon_source.h"
 #include "chrome/common/chrome_switches.h"
 #include "chrome/common/pref_names.h"
@@ -113,16 +112,6 @@
   }
 }
 
-// TODO(dbeam): if useful elsewhere, move to base/i18n/time_formatting.h?
-base::string16 TimeFormatLongDate(const base::Time& time) {
-  scoped_ptr<icu::DateFormat> formatter(
-      icu::DateFormat::createDateInstance(icu::DateFormat::kLong));
-  icu::UnicodeString date_string;
-  formatter->format(static_cast<UDate>(time.ToDoubleT() * 1000), date_string);
-  return base::string16(date_string.getBuffer(),
-                        static_cast<size_t>(date_string.length()));
-}
-
 // Returns a JSON dictionary containing some of the attributes of |download|.
 // The JSON dictionary will also have a field "id" set to |id|, and a field
 // "otr" set to |incognito|.
@@ -147,8 +136,7 @@
           download_item->GetStartTime(), NULL));
 
   base::Time start_time = download_item->GetStartTime();
-  base::string16 date_string = MdDownloadsEnabled() ?
-      TimeFormatLongDate(start_time) : base::TimeFormatShortDate(start_time);
+  base::string16 date_string = base::TimeFormatShortDate(start_time);
   file_value->SetString("date_string", date_string);
 
   file_value->SetString("id", base::Uint64ToString(download_item->GetId()));
@@ -225,11 +213,7 @@
         state = "IN_PROGRESS";
       }
       progress_status_text = download_model.GetTabProgressStatusText();
-
-      percent = download_item->PercentComplete();
-      if (!MdDownloadsEnabled())
-        percent = std::max(0, percent);
-
+      percent = std::max(0, download_item->PercentComplete());
       break;
     }
 
diff --git a/chrome/browser/ui/webui/downloads_ui.cc b/chrome/browser/ui/webui/downloads_ui.cc
index b23bf33..3376d6f 100644
--- a/chrome/browser/ui/webui/downloads_ui.cc
+++ b/chrome/browser/ui/webui/downloads_ui.cc
@@ -15,7 +15,6 @@
 #include "chrome/browser/download/download_service_factory.h"
 #include "chrome/browser/profiles/profile.h"
 #include "chrome/browser/ui/webui/downloads_dom_handler.h"
-#include "chrome/browser/ui/webui/downloads_util.h"
 #include "chrome/browser/ui/webui/theme_source.h"
 #include "chrome/common/chrome_switches.h"
 #include "chrome/common/pref_names.h"
@@ -47,8 +46,10 @@
   source->AddLocalizedString("clearAll", IDS_DOWNLOAD_LINK_CLEAR_ALL);
   source->AddLocalizedString("openDownloadsFolder",
                              IDS_DOWNLOAD_LINK_OPEN_DOWNLOADS_FOLDER);
+  source->AddLocalizedString("searchButton", IDS_DOWNLOAD_SEARCH_BUTTON);
 
   // No results message that shows instead of the downloads list.
+  source->AddLocalizedString("noDownloads", IDS_DOWNLOAD_NO_DOWNLOADS);
   source->AddLocalizedString("noSearchResults",
                              IDS_DOWNLOAD_NO_SEARCH_RESULTS);
 
@@ -78,69 +79,27 @@
   source->AddLocalizedString("controlResume", IDS_DOWNLOAD_LINK_RESUME);
   source->AddLocalizedString("controlRemoveFromList",
                              IDS_DOWNLOAD_LINK_REMOVE);
+  source->AddLocalizedString("controlRetry", IDS_DOWNLOAD_LINK_RETRY);
+  source->AddLocalizedString("controlByExtension",
+                             IDS_DOWNLOAD_BY_EXTENSION);
 
   PrefService* prefs = profile->GetPrefs();
   source->AddBoolean("allowDeletingHistory",
                      prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory) &&
                      !profile->IsSupervised());
 
-  source->SetJsonPath("strings.js");
   source->AddResourcePath("constants.html", IDR_DOWNLOADS_CONSTANTS_HTML);
   source->AddResourcePath("constants.js", IDR_DOWNLOADS_CONSTANTS_JS);
+  source->AddResourcePath("item_view.js", IDR_DOWNLOADS_ITEM_VIEW_JS);
+  source->AddResourcePath("focus_row.js", IDR_DOWNLOADS_FOCUS_ROW_JS);
+  source->AddResourcePath("manager.js", IDR_DOWNLOADS_MANAGER_JS);
   source->AddResourcePath("throttled_icon_loader.html",
                           IDR_DOWNLOADS_THROTTLED_ICON_LOADER_HTML);
   source->AddResourcePath("throttled_icon_loader.js",
                           IDR_DOWNLOADS_THROTTLED_ICON_LOADER_JS);
 
-  if (MdDownloadsEnabled()) {
-    source->AddLocalizedString("clearSearch", IDS_DOWNLOAD_CLEAR_SEARCH);
-    source->AddLocalizedString("controlRetry", IDS_MD_DOWNLOAD_LINK_RETRY);
-    source->AddLocalizedString("controlledByUrl",
-                               IDS_DOWNLOAD_BY_EXTENSION_URL);
-    source->AddLocalizedString("inIncognito", IDS_DOWNLOAD_IN_INCOGNITO);
-    source->AddLocalizedString("moreActions", IDS_DOWNLOAD_MORE_ACTIONS);
-    source->AddLocalizedString("noDownloads", IDS_MD_DOWNLOAD_NO_DOWNLOADS);
-    source->AddLocalizedString("search", IDS_MD_DOWNLOAD_SEARCH);
-
-    source->AddResourcePath("1x/incognito_marker.png",
-                            IDR_MD_DOWNLOADS_1X_INCOGNITO_MARKER_PNG);
-    source->AddResourcePath("2x/incognito_marker.png",
-                            IDR_MD_DOWNLOADS_2X_INCOGNITO_MARKER_PNG);
-    source->AddResourcePath("1x/no_downloads.png",
-                            IDR_MD_DOWNLOADS_1X_NO_DOWNLOADS_PNG);
-    source->AddResourcePath("2x/no_downloads.png",
-                            IDR_MD_DOWNLOADS_2X_NO_DOWNLOADS_PNG);
-    source->AddResourcePath("action_service.html",
-                            IDR_MD_DOWNLOADS_ACTION_SERVICE_HTML);
-    source->AddResourcePath("action_service.js",
-                            IDR_MD_DOWNLOADS_ACTION_SERVICE_JS);
-    source->AddResourcePath("crisper.js", IDR_MD_DOWNLOADS_CRISPER_JS);
-    source->AddResourcePath("dev.html", IDR_MD_DOWNLOADS_DOWNLOADS_HTML);
-    source->AddResourcePath("item.css", IDR_MD_DOWNLOADS_ITEM_CSS);
-    source->AddResourcePath("item.html", IDR_MD_DOWNLOADS_ITEM_HTML);
-    source->AddResourcePath("item.js", IDR_MD_DOWNLOADS_ITEM_JS);
-    source->AddResourcePath("manager.css", IDR_MD_DOWNLOADS_MANAGER_CSS);
-    source->AddResourcePath("manager.html", IDR_MD_DOWNLOADS_MANAGER_HTML);
-    source->AddResourcePath("manager.js", IDR_MD_DOWNLOADS_MANAGER_JS);
-    source->AddResourcePath("shared_style.css",
-                            IDR_MD_DOWNLOADS_SHARED_STYLE_CSS);
-    source->AddResourcePath("strings.html", IDR_MD_DOWNLOADS_STRINGS_HTML);
-    source->AddResourcePath("toolbar.css", IDR_MD_DOWNLOADS_TOOLBAR_CSS);
-    source->AddResourcePath("toolbar.html", IDR_MD_DOWNLOADS_TOOLBAR_HTML);
-    source->AddResourcePath("toolbar.js", IDR_MD_DOWNLOADS_TOOLBAR_JS);
-    source->SetDefaultResource(IDR_MD_DOWNLOADS_VULCANIZED_HTML);
-  } else {
-    source->AddLocalizedString("controlRetry", IDS_DOWNLOAD_LINK_RETRY);
-    source->AddLocalizedString("controlByExtension",
-                               IDS_DOWNLOAD_BY_EXTENSION);
-    source->AddLocalizedString("noDownloads", IDS_DOWNLOAD_NO_DOWNLOADS);
-    source->AddLocalizedString("searchButton", IDS_DOWNLOAD_SEARCH_BUTTON);
-
-    source->AddResourcePath("item_view.js", IDR_DOWNLOADS_ITEM_VIEW_JS);
-    source->AddResourcePath("focus_row.js", IDR_DOWNLOADS_FOCUS_ROW_JS);
-    source->AddResourcePath("manager.js", IDR_DOWNLOADS_MANAGER_JS);
-    source->SetDefaultResource(IDR_DOWNLOADS_DOWNLOADS_HTML);
-  }
+  source->SetDefaultResource(IDR_DOWNLOADS_DOWNLOADS_HTML);
+  source->SetJsonPath("strings.js");
 
   return source;
 }
diff --git a/chrome/browser/ui/webui/md_downloads/md_downloads_dom_handler.cc b/chrome/browser/ui/webui/md_downloads/md_downloads_dom_handler.cc
new file mode 100644
index 0000000..97c125d4
--- /dev/null
+++ b/chrome/browser/ui/webui/md_downloads/md_downloads_dom_handler.cc
@@ -0,0 +1,733 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/webui/md_downloads/md_downloads_dom_handler.h"
+
+#include <algorithm>
+#include <functional>
+
+#include "base/basictypes.h"
+#include "base/bind.h"
+#include "base/bind_helpers.h"
+#include "base/i18n/rtl.h"
+#include "base/i18n/time_formatting.h"
+#include "base/logging.h"
+#include "base/memory/singleton.h"
+#include "base/metrics/field_trial.h"
+#include "base/metrics/histogram.h"
+#include "base/prefs/pref_service.h"
+#include "base/strings/string_number_conversions.h"
+#include "base/strings/string_piece.h"
+#include "base/strings/utf_string_conversions.h"
+#include "base/supports_user_data.h"
+#include "base/threading/thread.h"
+#include "base/value_conversions.h"
+#include "base/values.h"
+#include "chrome/browser/browser_process.h"
+#include "chrome/browser/download/download_crx_util.h"
+#include "chrome/browser/download/download_danger_prompt.h"
+#include "chrome/browser/download/download_history.h"
+#include "chrome/browser/download/download_item_model.h"
+#include "chrome/browser/download/download_prefs.h"
+#include "chrome/browser/download/download_query.h"
+#include "chrome/browser/download/download_service.h"
+#include "chrome/browser/download/download_service_factory.h"
+#include "chrome/browser/download/drag_download_item.h"
+#include "chrome/browser/extensions/api/downloads/downloads_api.h"
+#include "chrome/browser/extensions/extension_service.h"
+#include "chrome/browser/platform_util.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/webui/fileicon_source.h"
+#include "chrome/common/chrome_switches.h"
+#include "chrome/common/pref_names.h"
+#include "chrome/common/url_constants.h"
+#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/download_item.h"
+#include "content/public/browser/url_data_source.h"
+#include "content/public/browser/user_metrics.h"
+#include "content/public/browser/web_contents.h"
+#include "content/public/browser/web_ui.h"
+#include "extensions/browser/extension_system.h"
+#include "net/base/filename_util.h"
+#include "third_party/icu/source/i18n/unicode/datefmt.h"
+#include "ui/base/l10n/time_format.h"
+#include "ui/gfx/image/image.h"
+
+using base::UserMetricsAction;
+using content::BrowserContext;
+using content::BrowserThread;
+
+namespace {
+
+// Maximum number of downloads to show. TODO(glen): Remove this and instead
+// stuff the downloads down the pipe slowly.
+size_t kMaxNumberOfDownloads = 150;
+
+enum DownloadsDOMEvent {
+  DOWNLOADS_DOM_EVENT_GET_DOWNLOADS = 0,
+  DOWNLOADS_DOM_EVENT_OPEN_FILE = 1,
+  DOWNLOADS_DOM_EVENT_DRAG = 2,
+  DOWNLOADS_DOM_EVENT_SAVE_DANGEROUS = 3,
+  DOWNLOADS_DOM_EVENT_DISCARD_DANGEROUS = 4,
+  DOWNLOADS_DOM_EVENT_SHOW = 5,
+  DOWNLOADS_DOM_EVENT_PAUSE = 6,
+  DOWNLOADS_DOM_EVENT_REMOVE = 7,
+  DOWNLOADS_DOM_EVENT_CANCEL = 8,
+  DOWNLOADS_DOM_EVENT_CLEAR_ALL = 9,
+  DOWNLOADS_DOM_EVENT_OPEN_FOLDER = 10,
+  DOWNLOADS_DOM_EVENT_RESUME = 11,
+  DOWNLOADS_DOM_EVENT_MAX
+};
+
+void CountDownloadsDOMEvents(DownloadsDOMEvent event) {
+  UMA_HISTOGRAM_ENUMERATION("Download.DOMEvent",
+                            event,
+                            DOWNLOADS_DOM_EVENT_MAX);
+}
+
+// Returns a string constant to be used as the |danger_type| value in
+// CreateDownloadItemValue().  Only return strings for DANGEROUS_FILE,
+// DANGEROUS_URL, DANGEROUS_CONTENT, and UNCOMMON_CONTENT because the
+// |danger_type| value is only defined if the value of |state| is |DANGEROUS|.
+const char* GetDangerTypeString(content::DownloadDangerType danger_type) {
+  switch (danger_type) {
+    case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE:
+      return "DANGEROUS_FILE";
+    case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL:
+      return "DANGEROUS_URL";
+    case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT:
+      return "DANGEROUS_CONTENT";
+    case content::DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT:
+      return "UNCOMMON_CONTENT";
+    case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST:
+      return "DANGEROUS_HOST";
+    case content::DOWNLOAD_DANGER_TYPE_POTENTIALLY_UNWANTED:
+      return "POTENTIALLY_UNWANTED";
+    default:
+      // Don't return a danger type string if it is NOT_DANGEROUS or
+      // MAYBE_DANGEROUS_CONTENT.
+      NOTREACHED();
+      return "";
+  }
+}
+
+// TODO(dbeam): if useful elsewhere, move to base/i18n/time_formatting.h?
+base::string16 TimeFormatLongDate(const base::Time& time) {
+  scoped_ptr<icu::DateFormat> formatter(
+      icu::DateFormat::createDateInstance(icu::DateFormat::kLong));
+  icu::UnicodeString date_string;
+  formatter->format(static_cast<UDate>(time.ToDoubleT() * 1000), date_string);
+  return base::string16(date_string.getBuffer(),
+                        static_cast<size_t>(date_string.length()));
+}
+
+// Returns a JSON dictionary containing some of the attributes of |download|.
+// The JSON dictionary will also have a field "id" set to |id|, and a field
+// "otr" set to |incognito|.
+base::DictionaryValue* CreateDownloadItemValue(
+    content::DownloadItem* download_item,
+    bool incognito) {
+  // TODO(asanka): Move towards using download_model here for getting status and
+  // progress. The difference currently only matters to Drive downloads and
+  // those don't show up on the downloads page, but should.
+  DownloadItemModel download_model(download_item);
+
+  // The items which are to be written into file_value are also described in
+  // chrome/browser/resources/downloads/downloads.js in @typedef for
+  // BackendDownloadObject. Please update it whenever you add or remove
+  // any keys in file_value.
+  base::DictionaryValue* file_value = new base::DictionaryValue();
+
+  file_value->SetInteger(
+      "started", static_cast<int>(download_item->GetStartTime().ToTimeT()));
+  file_value->SetString(
+      "since_string", ui::TimeFormat::RelativeDate(
+          download_item->GetStartTime(), NULL));
+
+  base::Time start_time = download_item->GetStartTime();
+  base::string16 date_string = TimeFormatLongDate(start_time);
+  file_value->SetString("date_string", date_string);
+
+  file_value->SetString("id", base::Uint64ToString(download_item->GetId()));
+
+  base::FilePath download_path(download_item->GetTargetFilePath());
+  file_value->Set("file_path", base::CreateFilePathValue(download_path));
+  file_value->SetString("file_url",
+                        net::FilePathToFileURL(download_path).spec());
+
+  extensions::DownloadedByExtension* by_ext =
+      extensions::DownloadedByExtension::Get(download_item);
+  std::string by_ext_id;
+  std::string by_ext_name;
+  if (by_ext) {
+    by_ext_id = by_ext->id();
+    // TODO(dbeam): why doesn't DownloadsByExtension::name() return a string16?
+    by_ext_name = by_ext->name();
+
+    // Lookup the extension's current name() in case the user changed their
+    // language. This won't work if the extension was uninstalled, so the name
+    // might be the wrong language.
+    bool include_disabled = true;
+    const extensions::Extension* extension = extensions::ExtensionSystem::Get(
+        Profile::FromBrowserContext(download_item->GetBrowserContext()))->
+      extension_service()->GetExtensionById(by_ext->id(), include_disabled);
+    if (extension)
+      file_value->SetString("by_ext_name", extension->name());
+  }
+  file_value->SetString("by_ext_id", by_ext_id);
+  file_value->SetString("by_ext_name", by_ext_name);
+
+  // Keep file names as LTR.
+  base::string16 file_name =
+    download_item->GetFileNameToReportUser().LossyDisplayName();
+  file_name = base::i18n::GetDisplayStringInLTRDirectionality(file_name);
+  file_value->SetString("file_name", file_name);
+  file_value->SetString("url", download_item->GetURL().spec());
+  file_value->SetBoolean("otr", incognito);
+  file_value->SetInteger("total", static_cast<int>(
+      download_item->GetTotalBytes()));
+  file_value->SetBoolean("file_externally_removed",
+                         download_item->GetFileExternallyRemoved());
+  file_value->SetBoolean("resume", download_item->CanResume());
+
+  const char* danger_type = "";
+  base::string16 last_reason_text;
+  // -2 is invalid, -1 means indeterminate, and 0-100 are in-progress.
+  int percent = -2;
+  base::string16 progress_status_text;
+  bool retry = false;
+  const char* state = nullptr;
+
+  switch (download_item->GetState()) {
+    case content::DownloadItem::IN_PROGRESS: {
+      if (download_item->IsDangerous()) {
+        state = "DANGEROUS";
+        // These are the only danger states that the UI is equipped to handle.
+        DCHECK(download_item->GetDangerType() ==
+                   content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE ||
+               download_item->GetDangerType() ==
+                   content::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL ||
+               download_item->GetDangerType() ==
+                   content::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT ||
+               download_item->GetDangerType() ==
+                   content::DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT ||
+               download_item->GetDangerType() ==
+                   content::DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST ||
+               download_item->GetDangerType() ==
+                   content::DOWNLOAD_DANGER_TYPE_POTENTIALLY_UNWANTED);
+        danger_type = GetDangerTypeString(download_item->GetDangerType());
+      } else if (download_item->IsPaused()) {
+        state = "PAUSED";
+      } else {
+        state = "IN_PROGRESS";
+      }
+      progress_status_text = download_model.GetTabProgressStatusText();
+      percent = download_item->PercentComplete();
+      break;
+    }
+
+    case content::DownloadItem::INTERRUPTED:
+      state = "INTERRUPTED";
+      progress_status_text = download_model.GetTabProgressStatusText();
+
+      if (download_item->CanResume())
+        percent = download_item->PercentComplete();
+
+      last_reason_text = download_model.GetInterruptReasonText();
+      if (content::DOWNLOAD_INTERRUPT_REASON_CRASH ==
+          download_item->GetLastReason() && !download_item->CanResume()) {
+        retry = true;
+      }
+      break;
+
+    case content::DownloadItem::CANCELLED:
+      state = "CANCELLED";
+      retry = true;
+      break;
+
+    case content::DownloadItem::COMPLETE:
+      DCHECK(!download_item->IsDangerous());
+      state = "COMPLETE";
+      break;
+
+    case content::DownloadItem::MAX_DOWNLOAD_STATE:
+      NOTREACHED();
+  }
+
+  DCHECK(state);
+
+  file_value->SetString("danger_type", danger_type);
+  file_value->SetString("last_reason_text", last_reason_text);
+  file_value->SetInteger("percent", percent);
+  file_value->SetString("progress_status_text", progress_status_text);
+  file_value->SetBoolean("retry", retry);
+  file_value->SetString("state", state);
+
+  return file_value;
+}
+
+// Filters out extension downloads and downloads that don't have a filename yet.
+bool IsDownloadDisplayable(const content::DownloadItem& item) {
+  return !download_crx_util::IsExtensionDownload(item) &&
+         !item.IsTemporary() &&
+         !item.GetFileNameToReportUser().empty() &&
+         !item.GetTargetFilePath().empty() &&
+         DownloadItemModel(
+             const_cast<content::DownloadItem*>(&item)).ShouldShowInShelf();
+}
+
+}  // namespace
+
+MdDownloadsDOMHandler::MdDownloadsDOMHandler(
+    content::DownloadManager* download_manager)
+    : download_manager_(download_manager),
+      update_scheduled_(false),
+      weak_ptr_factory_(this) {
+  // Create our fileicon data source.
+  Profile* profile = Profile::FromBrowserContext(
+      download_manager->GetBrowserContext());
+  content::URLDataSource::Add(profile, new FileIconSource());
+}
+
+MdDownloadsDOMHandler::~MdDownloadsDOMHandler() {
+  FinalizeRemovals();
+}
+
+// MdDownloadsDOMHandler, public: ---------------------------------------------
+
+void MdDownloadsDOMHandler::RegisterMessages() {
+  web_ui()->RegisterMessageCallback("getDownloads",
+      base::Bind(&MdDownloadsDOMHandler::HandleGetDownloads,
+                 weak_ptr_factory_.GetWeakPtr()));
+  web_ui()->RegisterMessageCallback("openFile",
+      base::Bind(&MdDownloadsDOMHandler::HandleOpenFile,
+                 weak_ptr_factory_.GetWeakPtr()));
+  web_ui()->RegisterMessageCallback("drag",
+      base::Bind(&MdDownloadsDOMHandler::HandleDrag,
+                 weak_ptr_factory_.GetWeakPtr()));
+  web_ui()->RegisterMessageCallback("saveDangerous",
+      base::Bind(&MdDownloadsDOMHandler::HandleSaveDangerous,
+                 weak_ptr_factory_.GetWeakPtr()));
+  web_ui()->RegisterMessageCallback("discardDangerous",
+      base::Bind(&MdDownloadsDOMHandler::HandleDiscardDangerous,
+                 weak_ptr_factory_.GetWeakPtr()));
+  web_ui()->RegisterMessageCallback("show",
+      base::Bind(&MdDownloadsDOMHandler::HandleShow,
+                 weak_ptr_factory_.GetWeakPtr()));
+  web_ui()->RegisterMessageCallback("pause",
+      base::Bind(&MdDownloadsDOMHandler::HandlePause,
+                 weak_ptr_factory_.GetWeakPtr()));
+  web_ui()->RegisterMessageCallback("resume",
+      base::Bind(&MdDownloadsDOMHandler::HandleResume,
+                 weak_ptr_factory_.GetWeakPtr()));
+  web_ui()->RegisterMessageCallback("remove",
+      base::Bind(&MdDownloadsDOMHandler::HandleRemove,
+                 weak_ptr_factory_.GetWeakPtr()));
+  web_ui()->RegisterMessageCallback("undo",
+      base::Bind(&MdDownloadsDOMHandler::HandleUndo,
+                 weak_ptr_factory_.GetWeakPtr()));
+  web_ui()->RegisterMessageCallback("cancel",
+      base::Bind(&MdDownloadsDOMHandler::HandleCancel,
+                 weak_ptr_factory_.GetWeakPtr()));
+  web_ui()->RegisterMessageCallback("clearAll",
+      base::Bind(&MdDownloadsDOMHandler::HandleClearAll,
+                 weak_ptr_factory_.GetWeakPtr()));
+  web_ui()->RegisterMessageCallback("openDownloadsFolder",
+      base::Bind(&MdDownloadsDOMHandler::HandleOpenDownloadsFolder,
+                 weak_ptr_factory_.GetWeakPtr()));
+}
+
+void MdDownloadsDOMHandler::OnDownloadCreated(
+    content::DownloadManager* manager, content::DownloadItem* download_item) {
+  if (IsDownloadDisplayable(*download_item))
+    ScheduleSendCurrentDownloads();
+  else
+    new_downloads_.insert(download_item->GetId());
+}
+
+void MdDownloadsDOMHandler::OnDownloadUpdated(
+    content::DownloadManager* manager,
+    content::DownloadItem* download_item) {
+  if (update_scheduled_)
+    return;
+
+  bool showing_new_item = false;
+
+  if (new_downloads_.count(download_item->GetId())) {
+    // A new download (that the page doesn't know about yet) has been updated.
+    if (!IsDownloadDisplayable(*download_item)) {
+      // Item isn't ready to be displayed yet. Wait until it is.
+      return;
+    }
+
+    new_downloads_.erase(download_item->GetId());
+    showing_new_item = true;
+  }
+
+  if (showing_new_item || DownloadItemModel(download_item).IsBeingRevived() ||
+      !IsDownloadDisplayable(*download_item)) {
+    // A download will be shown or hidden by this update. Resend the list.
+    ScheduleSendCurrentDownloads();
+    return;
+  }
+
+  if (search_terms_ && !search_terms_->empty()) {
+    // Don't CallUpdateItem() if download_item doesn't match
+    // search_terms_.
+    // TODO(benjhayden): Consider splitting MatchesQuery() out to a function.
+    content::DownloadManager::DownloadVector all_items, filtered_items;
+    all_items.push_back(download_item);
+    DownloadQuery query;
+    query.AddFilter(DownloadQuery::FILTER_QUERY, *search_terms_);
+    query.Search(all_items.begin(), all_items.end(), &filtered_items);
+    if (filtered_items.empty())
+      return;
+  }
+
+  DCHECK(manager);
+  scoped_ptr<base::DictionaryValue> item(CreateDownloadItemValue(
+      download_item,
+      original_notifier_ && manager == GetMainNotifierManager()));
+  CallUpdateItem(*item);
+}
+
+void MdDownloadsDOMHandler::OnDownloadRemoved(
+    content::DownloadManager* manager,
+    content::DownloadItem* download_item) {
+  if (!DownloadItemModel(download_item).ShouldShowInShelf())
+    return;
+
+  // This relies on |download_item| being removed from DownloadManager in this
+  // MessageLoop iteration. |download_item| may not have been removed from
+  // DownloadManager when OnDownloadRemoved() is fired, so bounce off the
+  // MessageLoop to give it a chance to be removed. SendCurrentDownloads() looks
+  // at all downloads, and we do not tell it that |download_item| is being
+  // removed. If DownloadManager is ever changed to not immediately remove
+  // |download_item| from its map when OnDownloadRemoved is sent, then
+  // MdDownloadsDOMHandler::OnDownloadRemoved() will need to explicitly tell
+  // SendCurrentDownloads() that |download_item| was removed. A
+  // SupportsUserData::Data would be the correct way to do this.
+  ScheduleSendCurrentDownloads();
+}
+
+void MdDownloadsDOMHandler::HandleGetDownloads(const base::ListValue* args) {
+  CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_GET_DOWNLOADS);
+  search_terms_.reset(args && !args->empty() ? args->DeepCopy() : NULL);
+  ScheduleSendCurrentDownloads();
+
+  if (!main_notifier_) {
+    main_notifier_.reset(new AllDownloadItemNotifier(download_manager_, this));
+
+    Profile* profile = Profile::FromBrowserContext(
+        download_manager_->GetBrowserContext());
+    if (profile->IsOffTheRecord()) {
+      original_notifier_.reset(new AllDownloadItemNotifier(
+          BrowserContext::GetDownloadManager(profile->GetOriginalProfile()),
+          this));
+    }
+  }
+}
+
+void MdDownloadsDOMHandler::HandleOpenFile(const base::ListValue* args) {
+  CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_OPEN_FILE);
+  content::DownloadItem* file = GetDownloadByValue(args);
+  if (file)
+    file->OpenDownload();
+}
+
+void MdDownloadsDOMHandler::HandleDrag(const base::ListValue* args) {
+  CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_DRAG);
+  content::DownloadItem* file = GetDownloadByValue(args);
+  if (!file)
+    return;
+
+  content::WebContents* web_contents = GetWebUIWebContents();
+  // |web_contents| is only NULL in the test.
+  if (!web_contents)
+    return;
+
+  if (file->GetState() != content::DownloadItem::COMPLETE)
+    return;
+
+  gfx::Image* icon = g_browser_process->icon_manager()->LookupIconFromFilepath(
+      file->GetTargetFilePath(), IconLoader::NORMAL);
+  gfx::NativeView view = web_contents->GetNativeView();
+  {
+    // Enable nested tasks during DnD, while |DragDownload()| blocks.
+    base::MessageLoop::ScopedNestableTaskAllower allow(
+        base::MessageLoop::current());
+    DragDownloadItem(file, icon, view);
+  }
+}
+
+void MdDownloadsDOMHandler::HandleSaveDangerous(const base::ListValue* args) {
+  CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_SAVE_DANGEROUS);
+  content::DownloadItem* file = GetDownloadByValue(args);
+  if (file)
+    ShowDangerPrompt(file);
+}
+
+void MdDownloadsDOMHandler::HandleDiscardDangerous(
+    const base::ListValue* args) {
+  CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_DISCARD_DANGEROUS);
+  content::DownloadItem* file = GetDownloadByValue(args);
+  if (file)
+    file->Remove();
+}
+
+void MdDownloadsDOMHandler::HandleShow(const base::ListValue* args) {
+  CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_SHOW);
+  content::DownloadItem* file = GetDownloadByValue(args);
+  if (file)
+    file->ShowDownloadInShell();
+}
+
+void MdDownloadsDOMHandler::HandlePause(const base::ListValue* args) {
+  CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_PAUSE);
+  content::DownloadItem* file = GetDownloadByValue(args);
+  if (file)
+    file->Pause();
+}
+
+void MdDownloadsDOMHandler::HandleResume(const base::ListValue* args) {
+  CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_RESUME);
+  content::DownloadItem* file = GetDownloadByValue(args);
+  if (file)
+    file->Resume();
+}
+
+void MdDownloadsDOMHandler::HandleRemove(const base::ListValue* args) {
+  if (!IsDeletingHistoryAllowed())
+    return;
+
+  CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_REMOVE);
+  content::DownloadItem* file = GetDownloadByValue(args);
+  if (!file)
+    return;
+
+  std::vector<content::DownloadItem*> downloads;
+  downloads.push_back(file);
+  RemoveDownloads(downloads);
+}
+
+void MdDownloadsDOMHandler::HandleUndo(const base::ListValue* args) {
+  // TODO(dbeam): handle more than removed downloads someday?
+  if (removals_.empty())
+    return;
+
+  const std::set<uint32> last_removed_ids = removals_.back();
+  removals_.pop_back();
+
+  for (auto id : last_removed_ids) {
+    content::DownloadItem* download = GetDownloadById(id);
+    if (!download)
+      continue;
+
+    DownloadItemModel model(download);
+    model.SetShouldShowInShelf(true);
+    model.SetIsBeingRevived(true);
+
+    download->UpdateObservers();
+
+    model.SetIsBeingRevived(false);
+  }
+}
+
+void MdDownloadsDOMHandler::HandleCancel(const base::ListValue* args) {
+  CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_CANCEL);
+  content::DownloadItem* file = GetDownloadByValue(args);
+  if (file)
+    file->Cancel(true);
+}
+
+void MdDownloadsDOMHandler::HandleClearAll(const base::ListValue* args) {
+  if (!IsDeletingHistoryAllowed()) {
+    // This should only be reached during tests.
+    return;
+  }
+
+  CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_CLEAR_ALL);
+
+  std::vector<content::DownloadItem*> downloads;
+  if (GetMainNotifierManager())
+    GetMainNotifierManager()->GetAllDownloads(&downloads);
+  if (GetOriginalNotifierManager())
+    GetOriginalNotifierManager()->GetAllDownloads(&downloads);
+  RemoveDownloads(downloads);
+}
+
+void MdDownloadsDOMHandler::RemoveDownloads(
+    const std::vector<content::DownloadItem*>& to_remove) {
+  std::set<uint32> ids;
+
+  for (auto* download : to_remove) {
+    DownloadItemModel item_model(download);
+    if (!item_model.ShouldShowInShelf() ||
+        download->GetState() == content::DownloadItem::IN_PROGRESS) {
+      continue;
+    }
+
+    item_model.SetShouldShowInShelf(false);
+    ids.insert(download->GetId());
+    download->UpdateObservers();
+  }
+
+  if (!ids.empty())
+    removals_.push_back(ids);
+}
+
+void MdDownloadsDOMHandler::HandleOpenDownloadsFolder(
+    const base::ListValue* args) {
+  CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_OPEN_FOLDER);
+  content::DownloadManager* manager = GetMainNotifierManager();
+  if (manager) {
+    platform_util::OpenItem(
+        Profile::FromBrowserContext(manager->GetBrowserContext()),
+        DownloadPrefs::FromDownloadManager(manager)->DownloadPath(),
+        platform_util::OPEN_FOLDER, platform_util::OpenOperationCallback());
+  }
+}
+
+// MdDownloadsDOMHandler, private: --------------------------------------------
+
+void MdDownloadsDOMHandler::ScheduleSendCurrentDownloads() {
+  // Don't call SendCurrentDownloads() every time anything changes. Batch them
+  // together instead. This may handle hundreds of OnDownloadDestroyed() calls
+  // in a single UI message loop iteration when the user Clears All downloads.
+  if (update_scheduled_)
+    return;
+
+  update_scheduled_ = true;
+
+  BrowserThread::PostTask(
+      BrowserThread::UI, FROM_HERE,
+      base::Bind(&MdDownloadsDOMHandler::SendCurrentDownloads,
+                 weak_ptr_factory_.GetWeakPtr()));
+}
+
+content::DownloadManager* MdDownloadsDOMHandler::GetMainNotifierManager()
+    const {
+  return main_notifier_ ? main_notifier_->GetManager() : nullptr;
+}
+
+content::DownloadManager* MdDownloadsDOMHandler::GetOriginalNotifierManager()
+    const {
+  return original_notifier_ ? original_notifier_->GetManager() : nullptr;
+}
+
+void MdDownloadsDOMHandler::FinalizeRemovals() {
+  while (!removals_.empty()) {
+    const std::set<uint32> remove = removals_.back();
+    removals_.pop_back();
+
+    for (const auto id : remove) {
+      content::DownloadItem* download = GetDownloadById(id);
+      if (download)
+        download->Remove();
+    }
+  }
+}
+
+void MdDownloadsDOMHandler::SendCurrentDownloads() {
+  update_scheduled_ = false;
+
+  content::DownloadManager::DownloadVector all_items, filtered_items;
+  if (GetMainNotifierManager()) {
+    GetMainNotifierManager()->GetAllDownloads(&all_items);
+    GetMainNotifierManager()->CheckForHistoryFilesRemoval();
+  }
+  if (GetOriginalNotifierManager()) {
+    GetOriginalNotifierManager()->GetAllDownloads(&all_items);
+    GetOriginalNotifierManager()->CheckForHistoryFilesRemoval();
+  }
+
+  DownloadQuery query;
+  if (search_terms_ && !search_terms_->empty())
+    query.AddFilter(DownloadQuery::FILTER_QUERY, *search_terms_);
+  query.AddFilter(base::Bind(&IsDownloadDisplayable));
+  query.AddSorter(DownloadQuery::SORT_START_TIME, DownloadQuery::DESCENDING);
+  query.Limit(kMaxNumberOfDownloads);
+  query.Search(all_items.begin(), all_items.end(), &filtered_items);
+
+  base::ListValue results_value;
+  for (auto* item : filtered_items) {
+    results_value.Append(CreateDownloadItemValue(
+        item,
+        original_notifier_ && GetMainNotifierManager() &&
+            GetMainNotifierManager()->GetDownload(item->GetId()) == item));
+  }
+  CallUpdateAll(results_value);
+}
+
+void MdDownloadsDOMHandler::ShowDangerPrompt(
+    content::DownloadItem* dangerous_item) {
+  DownloadDangerPrompt* danger_prompt = DownloadDangerPrompt::Create(
+      dangerous_item,
+      GetWebUIWebContents(),
+      false,
+      base::Bind(&MdDownloadsDOMHandler::DangerPromptDone,
+                 weak_ptr_factory_.GetWeakPtr(), dangerous_item->GetId()));
+  // danger_prompt will delete itself.
+  DCHECK(danger_prompt);
+}
+
+void MdDownloadsDOMHandler::DangerPromptDone(
+    int download_id, DownloadDangerPrompt::Action action) {
+  if (action != DownloadDangerPrompt::ACCEPT)
+    return;
+  content::DownloadItem* item = NULL;
+  if (GetMainNotifierManager())
+    item = GetMainNotifierManager()->GetDownload(download_id);
+  if (!item && GetOriginalNotifierManager())
+    item = GetOriginalNotifierManager()->GetDownload(download_id);
+  if (!item || item->IsDone())
+    return;
+  CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_SAVE_DANGEROUS);
+  item->ValidateDangerousDownload();
+}
+
+bool MdDownloadsDOMHandler::IsDeletingHistoryAllowed() {
+  content::DownloadManager* manager = GetMainNotifierManager();
+  return manager &&
+         Profile::FromBrowserContext(manager->GetBrowserContext())->
+             GetPrefs()->GetBoolean(prefs::kAllowDeletingBrowserHistory);
+}
+
+content::DownloadItem* MdDownloadsDOMHandler::GetDownloadByValue(
+    const base::ListValue* args) {
+  std::string download_id;
+  if (!args->GetString(0, &download_id)) {
+    NOTREACHED();
+    return nullptr;
+  }
+
+  uint64 id;
+  if (!base::StringToUint64(download_id, &id)) {
+    NOTREACHED();
+    return nullptr;
+  }
+
+  return GetDownloadById(static_cast<uint32>(id));
+}
+
+content::DownloadItem* MdDownloadsDOMHandler::GetDownloadById(uint32 id) {
+  content::DownloadItem* item = NULL;
+  if (GetMainNotifierManager())
+    item = GetMainNotifierManager()->GetDownload(id);
+  if (!item && GetOriginalNotifierManager())
+    item = GetOriginalNotifierManager()->GetDownload(id);
+  return item;
+}
+
+content::WebContents* MdDownloadsDOMHandler::GetWebUIWebContents() {
+  return web_ui()->GetWebContents();
+}
+
+void MdDownloadsDOMHandler::CallUpdateAll(const base::ListValue& list) {
+  web_ui()->CallJavascriptFunction("downloads.Manager.updateAll", list);
+}
+
+void MdDownloadsDOMHandler::CallUpdateItem(const base::DictionaryValue& item) {
+  web_ui()->CallJavascriptFunction("downloads.Manager.updateItem", item);
+}
diff --git a/chrome/browser/ui/webui/md_downloads/md_downloads_dom_handler.h b/chrome/browser/ui/webui/md_downloads/md_downloads_dom_handler.h
new file mode 100644
index 0000000..c129ba8
--- /dev/null
+++ b/chrome/browser/ui/webui/md_downloads/md_downloads_dom_handler.h
@@ -0,0 +1,179 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_WEBUI_MD_DOWNLOADS_MD_DOWNLOADS_DOM_HANDLER_H_
+#define CHROME_BROWSER_UI_WEBUI_MD_DOWNLOADS_MD_DOWNLOADS_DOM_HANDLER_H_
+
+#include <set>
+#include <vector>
+
+#include "base/compiler_specific.h"
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "chrome/browser/download/all_download_item_notifier.h"
+#include "chrome/browser/download/download_danger_prompt.h"
+#include "content/public/browser/download_item.h"
+#include "content/public/browser/download_manager.h"
+#include "content/public/browser/web_ui_message_handler.h"
+
+namespace base {
+class ListValue;
+}
+
+namespace content {
+class WebContents;
+}
+
+// The handler for Javascript messages related to the "downloads" view,
+// also observes changes to the download manager.
+class MdDownloadsDOMHandler : public content::WebUIMessageHandler,
+                              public AllDownloadItemNotifier::Observer {
+ public:
+  explicit MdDownloadsDOMHandler(content::DownloadManager* download_manager);
+  ~MdDownloadsDOMHandler() override;
+
+  void Init();
+
+  // WebUIMessageHandler implementation.
+  void RegisterMessages() override;
+
+  // AllDownloadItemNotifier::Observer interface
+  void OnDownloadCreated(content::DownloadManager* manager,
+                         content::DownloadItem* download_item) override;
+  void OnDownloadUpdated(content::DownloadManager* manager,
+                         content::DownloadItem* download_item) override;
+  void OnDownloadRemoved(content::DownloadManager* manager,
+                         content::DownloadItem* download_item) override;
+
+  // Callback for the "onPageLoaded" message.
+  void OnPageLoaded(const base::ListValue* args);
+
+  // Callback for the "getDownloads" message.
+  void HandleGetDownloads(const base::ListValue* args);
+
+  // Callback for the "openFile" message - opens the file in the shell.
+  void HandleOpenFile(const base::ListValue* args);
+
+  // Callback for the "drag" message - initiates a file object drag.
+  void HandleDrag(const base::ListValue* args);
+
+  // Callback for the "saveDangerous" message - specifies that the user
+  // wishes to save a dangerous file.
+  void HandleSaveDangerous(const base::ListValue* args);
+
+  // Callback for the "discardDangerous" message - specifies that the user
+  // wishes to discard (remove) a dangerous file.
+  void HandleDiscardDangerous(const base::ListValue* args);
+
+  // Callback for the "show" message - shows the file in explorer.
+  void HandleShow(const base::ListValue* args);
+
+  // Callback for the "pause" message - pauses the file download.
+  void HandlePause(const base::ListValue* args);
+
+  // Callback for the "resume" message - resumes the file download.
+  void HandleResume(const base::ListValue* args);
+
+  // Callback for the "remove" message - removes the file download from shelf
+  // and list.
+  void HandleRemove(const base::ListValue* args);
+
+  // Callback for the "undo" message. Currently only undoes removals.
+  void HandleUndo(const base::ListValue* args);
+
+  // Callback for the "cancel" message - cancels the download.
+  void HandleCancel(const base::ListValue* args);
+
+  // Callback for the "clearAll" message - clears all the downloads.
+  void HandleClearAll(const base::ListValue* args);
+
+  // Callback for the "openDownloadsFolder" message - opens the downloads
+  // folder.
+  void HandleOpenDownloadsFolder(const base::ListValue* args);
+
+ protected:
+  // These methods are for mocking so that most of this class does not actually
+  // depend on WebUI. The other methods that depend on WebUI are
+  // RegisterMessages() and HandleDrag().
+  virtual content::WebContents* GetWebUIWebContents();
+  virtual void CallUpdateAll(const base::ListValue& list);
+  virtual void CallUpdateItem(const base::DictionaryValue& item);
+
+  // Schedules a call to SendCurrentDownloads() in the next message loop
+  // iteration. Protected rather than private for use in tests.
+  void ScheduleSendCurrentDownloads();
+
+  // Actually remove downloads with an ID in |removals_|. This cannot be undone.
+  void FinalizeRemovals();
+
+ private:
+  // Shorthand for |observing_items_|, which tracks all items that this is
+  // observing so that RemoveObserver will be called for all of them.
+  typedef std::set<content::DownloadItem*> DownloadSet;
+
+  // Convenience method to call |main_notifier_->GetManager()| while
+  // null-checking |main_notifier_|.
+  content::DownloadManager* GetMainNotifierManager() const;
+
+  // Convenience method to call |original_notifier_->GetManager()| while
+  // null-checking |original_notifier_|.
+  content::DownloadManager* GetOriginalNotifierManager() const;
+
+  // Sends the current list of downloads to the page.
+  void SendCurrentDownloads();
+
+  // Displays a native prompt asking the user for confirmation after accepting
+  // the dangerous download specified by |dangerous|. The function returns
+  // immediately, and will invoke DangerPromptAccepted() asynchronously if the
+  // user accepts the dangerous download. The native prompt will observe
+  // |dangerous| until either the dialog is dismissed or |dangerous| is no
+  // longer an in-progress dangerous download.
+  void ShowDangerPrompt(content::DownloadItem* dangerous);
+
+  // Conveys danger acceptance from the DownloadDangerPrompt to the
+  // DownloadItem.
+  void DangerPromptDone(int download_id, DownloadDangerPrompt::Action action);
+
+  // Returns true if the records of any downloaded items are allowed (and able)
+  // to be deleted.
+  bool IsDeletingHistoryAllowed();
+
+  // Returns the download that is referred to in a given value.
+  content::DownloadItem* GetDownloadByValue(const base::ListValue* args);
+
+  // Returns the download with |id| or NULL if it doesn't exist.
+  content::DownloadItem* GetDownloadById(uint32 id);
+
+  // Remove all downloads in |to_remove| with the ability to undo removal later.
+  void RemoveDownloads(const std::vector<content::DownloadItem*>& to_remove);
+
+  // Weak reference to the DownloadManager this class was constructed with. You
+  // should probably be using use Get{Main,Original}NotifierManager() instead.
+  content::DownloadManager* download_manager_;
+
+  // Current search terms.
+  scoped_ptr<base::ListValue> search_terms_;
+
+  // Notifies OnDownload*() and provides safe access to the DownloadManager.
+  scoped_ptr<AllDownloadItemNotifier> main_notifier_;
+
+  // If |main_notifier_| observes an incognito profile, then this observes the
+  // DownloadManager for the original profile; otherwise, this is NULL.
+  scoped_ptr<AllDownloadItemNotifier> original_notifier_;
+
+  // IDs of downloads to remove when this handler gets deleted.
+  std::vector<std::set<uint32>> removals_;
+
+  // Whether a call to SendCurrentDownloads() is currently scheduled.
+  bool update_scheduled_;
+
+  // IDs of new downloads that the page doesn't know about yet.
+  std::set<uint32> new_downloads_;
+
+  base::WeakPtrFactory<MdDownloadsDOMHandler> weak_ptr_factory_;
+
+  DISALLOW_COPY_AND_ASSIGN(MdDownloadsDOMHandler);
+};
+
+#endif  // CHROME_BROWSER_UI_WEBUI_MD_DOWNLOADS_MD_DOWNLOADS_DOM_HANDLER_H_
diff --git a/chrome/browser/ui/webui/md_downloads/md_downloads_ui.cc b/chrome/browser/ui/webui/md_downloads/md_downloads_ui.cc
new file mode 100644
index 0000000..bc93a55
--- /dev/null
+++ b/chrome/browser/ui/webui/md_downloads/md_downloads_ui.cc
@@ -0,0 +1,161 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/webui/md_downloads/md_downloads_ui.h"
+
+#include "base/memory/ref_counted_memory.h"
+#include "base/memory/singleton.h"
+#include "base/prefs/pref_service.h"
+#include "base/strings/string_piece.h"
+#include "base/threading/thread.h"
+#include "base/values.h"
+#include "chrome/browser/defaults.h"
+#include "chrome/browser/download/download_service.h"
+#include "chrome/browser/download/download_service_factory.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/webui/md_downloads/md_downloads_dom_handler.h"
+#include "chrome/browser/ui/webui/theme_source.h"
+#include "chrome/common/chrome_switches.h"
+#include "chrome/common/pref_names.h"
+#include "chrome/common/url_constants.h"
+#include "chrome/grit/chromium_strings.h"
+#include "chrome/grit/generated_resources.h"
+#include "content/public/browser/download_manager.h"
+#include "content/public/browser/url_data_source.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 "grit/browser_resources.h"
+#include "grit/theme_resources.h"
+#include "ui/base/resource/resource_bundle.h"
+
+using content::BrowserContext;
+using content::DownloadManager;
+using content::WebContents;
+
+namespace {
+
+content::WebUIDataSource* CreateDownloadsUIHTMLSource(Profile* profile) {
+  content::WebUIDataSource* source =
+      content::WebUIDataSource::Create(chrome::kChromeUIDownloadsHost);
+
+  source->AddLocalizedString("title", IDS_DOWNLOAD_TITLE);
+  source->AddLocalizedString("searchResultsFor", IDS_DOWNLOAD_SEARCHRESULTSFOR);
+  source->AddLocalizedString("downloads", IDS_DOWNLOAD_TITLE);
+
+  source->AddLocalizedString("clearAll", IDS_DOWNLOAD_LINK_CLEAR_ALL);
+  source->AddLocalizedString("clearSearch", IDS_DOWNLOAD_CLEAR_SEARCH);
+  source->AddLocalizedString("openDownloadsFolder",
+                             IDS_DOWNLOAD_LINK_OPEN_DOWNLOADS_FOLDER);
+  source->AddLocalizedString("moreActions", IDS_DOWNLOAD_MORE_ACTIONS);
+  source->AddLocalizedString("search", IDS_MD_DOWNLOAD_SEARCH);
+
+
+  // No results message that shows instead of the downloads list.
+  source->AddLocalizedString("noDownloads", IDS_MD_DOWNLOAD_NO_DOWNLOADS);
+  source->AddLocalizedString("noSearchResults",
+                             IDS_DOWNLOAD_NO_SEARCH_RESULTS);
+
+  // Status.
+  source->AddLocalizedString("statusCancelled", IDS_DOWNLOAD_TAB_CANCELLED);
+  source->AddLocalizedString("statusRemoved", IDS_DOWNLOAD_FILE_REMOVED);
+
+  // Dangerous file.
+  source->AddLocalizedString("dangerFileDesc", IDS_PROMPT_DANGEROUS_DOWNLOAD);
+  source->AddLocalizedString("dangerUrlDesc",
+                             IDS_PROMPT_MALICIOUS_DOWNLOAD_URL);
+  source->AddLocalizedString("dangerContentDesc",
+                             IDS_PROMPT_MALICIOUS_DOWNLOAD_CONTENT);
+  source->AddLocalizedString("dangerUncommonDesc",
+                             IDS_PROMPT_UNCOMMON_DOWNLOAD_CONTENT);
+  source->AddLocalizedString("dangerSettingsDesc",
+                             IDS_PROMPT_DOWNLOAD_CHANGES_SETTINGS);
+  source->AddLocalizedString("dangerSave", IDS_CONFIRM_DOWNLOAD);
+  source->AddLocalizedString("dangerRestore", IDS_CONFIRM_DOWNLOAD_RESTORE);
+  source->AddLocalizedString("dangerDiscard", IDS_DISCARD_DOWNLOAD);
+
+  // Controls.
+  source->AddLocalizedString("controlPause", IDS_DOWNLOAD_LINK_PAUSE);
+  if (browser_defaults::kDownloadPageHasShowInFolder)
+    source->AddLocalizedString("controlShowInFolder", IDS_DOWNLOAD_LINK_SHOW);
+  source->AddLocalizedString("controlCancel", IDS_DOWNLOAD_LINK_CANCEL);
+  source->AddLocalizedString("controlResume", IDS_DOWNLOAD_LINK_RESUME);
+  source->AddLocalizedString("controlRemoveFromList",
+                             IDS_DOWNLOAD_LINK_REMOVE);
+  source->AddLocalizedString("controlRetry", IDS_MD_DOWNLOAD_LINK_RETRY);
+  source->AddLocalizedString("controlledByUrl",
+                             IDS_DOWNLOAD_BY_EXTENSION_URL);
+
+  PrefService* prefs = profile->GetPrefs();
+  source->AddBoolean("allowDeletingHistory",
+                     prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory) &&
+                     !profile->IsSupervised());
+
+  source->AddLocalizedString("inIncognito", IDS_DOWNLOAD_IN_INCOGNITO);
+
+  source->AddResourcePath("1x/incognito_marker.png",
+                          IDR_MD_DOWNLOADS_1X_INCOGNITO_MARKER_PNG);
+  source->AddResourcePath("2x/incognito_marker.png",
+                          IDR_MD_DOWNLOADS_2X_INCOGNITO_MARKER_PNG);
+  source->AddResourcePath("1x/no_downloads.png",
+                          IDR_MD_DOWNLOADS_1X_NO_DOWNLOADS_PNG);
+  source->AddResourcePath("2x/no_downloads.png",
+                          IDR_MD_DOWNLOADS_2X_NO_DOWNLOADS_PNG);
+  source->AddResourcePath("action_service.html",
+                          IDR_MD_DOWNLOADS_ACTION_SERVICE_HTML);
+  source->AddResourcePath("action_service.js",
+                          IDR_MD_DOWNLOADS_ACTION_SERVICE_JS);
+  source->AddResourcePath("constants.html", IDR_MD_DOWNLOADS_CONSTANTS_HTML);
+  source->AddResourcePath("constants.js", IDR_MD_DOWNLOADS_CONSTANTS_JS);
+  source->AddResourcePath("crisper.js", IDR_MD_DOWNLOADS_CRISPER_JS);
+  source->AddResourcePath("dev.html", IDR_MD_DOWNLOADS_DOWNLOADS_HTML);
+  source->AddResourcePath("item.css", IDR_MD_DOWNLOADS_ITEM_CSS);
+  source->AddResourcePath("item.html", IDR_MD_DOWNLOADS_ITEM_HTML);
+  source->AddResourcePath("item.js", IDR_MD_DOWNLOADS_ITEM_JS);
+  source->AddResourcePath("manager.css", IDR_MD_DOWNLOADS_MANAGER_CSS);
+  source->AddResourcePath("manager.html", IDR_MD_DOWNLOADS_MANAGER_HTML);
+  source->AddResourcePath("manager.js", IDR_MD_DOWNLOADS_MANAGER_JS);
+  source->AddResourcePath("shared_style.css",
+                          IDR_MD_DOWNLOADS_SHARED_STYLE_CSS);
+  source->AddResourcePath("strings.html", IDR_MD_DOWNLOADS_STRINGS_HTML);
+  source->AddResourcePath("toolbar.css", IDR_MD_DOWNLOADS_TOOLBAR_CSS);
+  source->AddResourcePath("toolbar.html", IDR_MD_DOWNLOADS_TOOLBAR_HTML);
+  source->AddResourcePath("toolbar.js", IDR_MD_DOWNLOADS_TOOLBAR_JS);
+
+  source->SetDefaultResource(IDR_MD_DOWNLOADS_VULCANIZED_HTML);
+  source->SetJsonPath("strings.js");
+
+  return source;
+}
+
+}  // namespace
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// MdDownloadsUI
+//
+///////////////////////////////////////////////////////////////////////////////
+
+MdDownloadsUI::MdDownloadsUI(content::WebUI* web_ui) : WebUIController(web_ui) {
+  Profile* profile = Profile::FromWebUI(web_ui);
+  DownloadManager* dlm = BrowserContext::GetDownloadManager(profile);
+
+  MdDownloadsDOMHandler* handler = new MdDownloadsDOMHandler(dlm);
+  web_ui->AddMessageHandler(handler);
+
+  // Set up the chrome://downloads/ source.
+  content::WebUIDataSource* source = CreateDownloadsUIHTMLSource(profile);
+  content::WebUIDataSource::Add(profile, source);
+#if defined(ENABLE_THEMES)
+  ThemeSource* theme = new ThemeSource(profile);
+  content::URLDataSource::Add(profile, theme);
+#endif
+}
+
+// static
+base::RefCountedMemory* MdDownloadsUI::GetFaviconResourceBytes(
+    ui::ScaleFactor scale_factor) {
+  return ResourceBundle::GetSharedInstance().
+      LoadDataResourceBytesForScale(IDR_DOWNLOADS_FAVICON, scale_factor);
+}
diff --git a/chrome/browser/ui/webui/md_downloads/md_downloads_ui.h b/chrome/browser/ui/webui/md_downloads/md_downloads_ui.h
new file mode 100644
index 0000000..37ce107
--- /dev/null
+++ b/chrome/browser/ui/webui/md_downloads/md_downloads_ui.h
@@ -0,0 +1,27 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_WEBUI_MD_DOWNLOADS_MD_DOWNLOADS_UI_H_
+#define CHROME_BROWSER_UI_WEBUI_MD_DOWNLOADS_MD_DOWNLOADS_UI_H_
+
+#include "base/macros.h"
+#include "content/public/browser/web_ui_controller.h"
+#include "ui/base/layout.h"
+
+namespace base {
+class RefCountedMemory;
+}
+
+class MdDownloadsUI : public content::WebUIController {
+ public:
+  explicit MdDownloadsUI(content::WebUI* web_ui);
+
+  static base::RefCountedMemory* GetFaviconResourceBytes(
+      ui::ScaleFactor scale_factor);
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(MdDownloadsUI);
+};
+
+#endif  // CHROME_BROWSER_UI_WEBUI_MD_DOWNLOADS_MD_DOWNLOADS_UI_H_
diff --git a/chrome/chrome_browser_ui.gypi b/chrome/chrome_browser_ui.gypi
index 1c4feef..974897d 100644
--- a/chrome/chrome_browser_ui.gypi
+++ b/chrome/chrome_browser_ui.gypi
@@ -1802,6 +1802,10 @@
       'browser/ui/webui/identity_internals_ui.h',
       'browser/ui/webui/inspect_ui.cc',
       'browser/ui/webui/inspect_ui.h',
+      'browser/ui/webui/md_downloads/md_downloads_dom_handler.cc',
+      'browser/ui/webui/md_downloads/md_downloads_dom_handler.h',
+      'browser/ui/webui/md_downloads/md_downloads_ui.cc',
+      'browser/ui/webui/md_downloads/md_downloads_ui.h',
       'browser/ui/webui/ntp/app_launcher_handler.cc',
       'browser/ui/webui/ntp/app_launcher_handler.h',
       'browser/ui/webui/ntp/app_resource_cache_factory.cc',
diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi
index 4a710d0..f006ec80 100644
--- a/chrome/chrome_tests_unit.gypi
+++ b/chrome/chrome_tests_unit.gypi
@@ -995,6 +995,7 @@
       'browser/safe_browsing/safe_browsing_database_unittest.cc',
       'browser/safe_browsing/safe_browsing_store_file_unittest.cc',
       'browser/safe_browsing/safe_browsing_store_unittest.cc',
+      'browser/safe_browsing/safe_browsing_util_unittest.cc',
       'browser/safe_browsing/sandboxed_dmg_analyzer_mac_unittest.cc',
       'browser/safe_browsing/sandboxed_zip_analyzer_unittest.cc',
       'browser/safe_browsing/signature_evaluator_mac_unittest.cc',
diff --git a/chrome/sync_integration_tests.isolate b/chrome/sync_integration_tests.isolate
index 70721f1..295da53 100644
--- a/chrome/sync_integration_tests.isolate
+++ b/chrome/sync_integration_tests.isolate
@@ -37,6 +37,7 @@
       'variables': {
         'files': [
           '<(PRODUCT_DIR)/chrome_100_percent.pak',
+          '<(PRODUCT_DIR)/chrome_200_percent.pak',
           '<(PRODUCT_DIR)/locales/en-US.pak',
         ],
       },
diff --git a/chrome/test/DEPS b/chrome/test/DEPS
index 2167a411..2d596c8 100644
--- a/chrome/test/DEPS
+++ b/chrome/test/DEPS
@@ -6,7 +6,6 @@
   "+chrome/grit",  # For generated headers
   "+chromeos",
   "+components",
-  "+device/bluetooth/dbus",
   "+extensions",
 
   # Tests under chrome/ shouldn't need to access the internals of content/ and
diff --git a/chrome/test/base/testing_io_thread_state.cc b/chrome/test/base/testing_io_thread_state.cc
index 09b07f2..8ebd202b8 100644
--- a/chrome/test/base/testing_io_thread_state.cc
+++ b/chrome/test/base/testing_io_thread_state.cc
@@ -16,7 +16,6 @@
 #if defined(OS_CHROMEOS)
 #include "chromeos/dbus/dbus_thread_manager.h"
 #include "chromeos/network/network_handler.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
 #endif
 
 using content::BrowserThread;
@@ -43,10 +42,6 @@
 #if defined(OS_CHROMEOS)
   // Needed by IOThread constructor.
   chromeos::DBusThreadManager::Initialize();
-  bluez::BluezDBusManager::Initialize(
-      chromeos::DBusThreadManager::Get()->GetSystemBus(),
-      chromeos::DBusThreadManager::Get()->IsUsingStub(
-          chromeos::DBusClientBundle::BLUETOOTH));
   chromeos::NetworkHandler::Initialize();
 #endif
 
@@ -80,7 +75,6 @@
 
 #if defined(OS_CHROMEOS)
   chromeos::NetworkHandler::Shutdown();
-  bluez::BluezDBusManager::Shutdown();
   chromeos::DBusThreadManager::Shutdown();
 #endif
 }
diff --git a/chrome/test/base/view_event_test_platform_part_chromeos.cc b/chrome/test/base/view_event_test_platform_part_chromeos.cc
index 16a678e..2cf14ef 100644
--- a/chrome/test/base/view_event_test_platform_part_chromeos.cc
+++ b/chrome/test/base/view_event_test_platform_part_chromeos.cc
@@ -15,7 +15,6 @@
 #include "chromeos/dbus/dbus_thread_manager.h"
 #include "chromeos/network/network_handler.h"
 #include "content/public/browser/browser_thread.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
 #include "ui/aura/env.h"
 #include "ui/aura/window_tree_host.h"
 #include "ui/message_center/message_center.h"
@@ -47,10 +46,6 @@
   // also create the message center.
   message_center::MessageCenter::Initialize();
   chromeos::DBusThreadManager::Initialize();
-  bluez::BluezDBusManager::Initialize(
-      chromeos::DBusThreadManager::Get()->GetSystemBus(),
-      chromeos::DBusThreadManager::Get()->IsUsingStub(
-          chromeos::DBusClientBundle::BLUETOOTH));
   chromeos::CrasAudioHandler::InitializeForTesting();
   chromeos::NetworkHandler::Initialize();
 
@@ -75,7 +70,6 @@
 
   chromeos::NetworkHandler::Shutdown();
   chromeos::CrasAudioHandler::Shutdown();
-  bluez::BluezDBusManager::Shutdown();
   chromeos::DBusThreadManager::Shutdown();
   // Ash Shell can't just live on its own without a browser process, we need to
   // also shut down the message center.
diff --git a/chrome/test/data/android/contextualsearch/tap_test.html b/chrome/test/data/android/contextualsearch/tap_test.html
index 2f7cd90..4a10e80 100644
--- a/chrome/test/data/android/contextualsearch/tap_test.html
+++ b/chrome/test/data/android/contextualsearch/tap_test.html
@@ -22,6 +22,9 @@
   <div>United States <span id="intelligence">Intelligence</span></div>
   <div>United <span id="states">States</span> Intelligence</div>
   <div>United <span id="states-near">StatesNear</span> Intelligence</div>
+  <!-- These three spans should be close to each other so that taps from one to
+       to the next are within our "near" threshold. -->
+  <div><span id="search">Search</span> <span id="term">Term</span> <span id="resolution">Resolution</span></div>
   <form action="demo_form.asp">
     <label for="male">Male</label>
     <input type="radio" name="sex" id="male" value="male"><br>
diff --git a/chromecast/media/cma/pipeline/audio_pipeline_impl.cc b/chromecast/media/cma/pipeline/audio_pipeline_impl.cc
index 0edd474..39fe92a 100644
--- a/chromecast/media/cma/pipeline/audio_pipeline_impl.cc
+++ b/chromecast/media/cma/pipeline/audio_pipeline_impl.cc
@@ -61,14 +61,19 @@
   return true;
 }
 
-void AudioPipelineImpl::Flush(const ::media::PipelineStatusCB& status_cb) {
+bool AudioPipelineImpl::StartFlush() {
   CMALOG(kLogControl) << __FUNCTION__;
   if (av_pipeline_impl_->GetState() == AvPipelineImpl::kError) {
-    status_cb.Run(::media::PIPELINE_ERROR_ABORT);
-    return;
+    return false;
   }
   DCHECK_EQ(av_pipeline_impl_->GetState(), AvPipelineImpl::kPlaying);
   av_pipeline_impl_->TransitionToState(AvPipelineImpl::kFlushing);
+  return true;
+}
+
+void AudioPipelineImpl::Flush(const ::media::PipelineStatusCB& status_cb) {
+  CMALOG(kLogControl) << __FUNCTION__;
+  DCHECK_EQ(av_pipeline_impl_->GetState(), AvPipelineImpl::kFlushing);
   av_pipeline_impl_->Flush(
       base::Bind(&AudioPipelineImpl::OnFlushDone, weak_this_, status_cb));
 }
diff --git a/chromecast/media/cma/pipeline/audio_pipeline_impl.h b/chromecast/media/cma/pipeline/audio_pipeline_impl.h
index 014b041..4e6193d 100644
--- a/chromecast/media/cma/pipeline/audio_pipeline_impl.h
+++ b/chromecast/media/cma/pipeline/audio_pipeline_impl.h
@@ -45,6 +45,7 @@
       const ::media::PipelineStatusCB& status_cb);
   bool StartPlayingFrom(base::TimeDelta time,
                         const scoped_refptr<BufferingState>& buffering_state);
+  bool StartFlush();
   void Flush(const ::media::PipelineStatusCB& status_cb);
   void BackendStopped();
   void Stop();
diff --git a/chromecast/media/cma/pipeline/av_pipeline_impl.cc b/chromecast/media/cma/pipeline/av_pipeline_impl.cc
index 82ce75f..0d7a5bc0 100644
--- a/chromecast/media/cma/pipeline/av_pipeline_impl.cc
+++ b/chromecast/media/cma/pipeline/av_pipeline_impl.cc
@@ -61,6 +61,14 @@
 void AvPipelineImpl::TransitionToState(State state) {
   DCHECK(thread_checker_.CalledOnValidThread());
   state_ = state;
+
+  if (state_ == kFlushing) {
+    // Break the feeding loop.
+    enable_feeding_ = false;
+
+    // Remove any pending buffer.
+    pending_buffer_ = nullptr;
+  }
 }
 
 void AvPipelineImpl::SetCodedFrameProvider(
@@ -102,13 +110,7 @@
   DCHECK(thread_checker_.CalledOnValidThread());
   DCHECK_EQ(state_, kFlushing);
 
-  // Break the feeding loop.
-  enable_feeding_ = false;
-
-  // Remove any pending buffer.
-  pending_buffer_ = nullptr;
-
-  // Finally, remove any frames left in the frame provider.
+  // Remove any frames left in the frame provider.
   pending_read_ = false;
   buffered_time_ = ::media::kNoTimestamp();
   playable_buffered_time_ = ::media::kNoTimestamp();
@@ -167,6 +169,9 @@
   DCHECK(thread_checker_.CalledOnValidThread());
   pending_read_ = false;
 
+  if (!enable_feeding_)
+    return;
+
   if (audio_config.IsValidConfig() || video_config.IsValidConfig())
     update_config_cb_.Run(buffer->stream_id(), audio_config, video_config);
 
diff --git a/chromecast/media/cma/pipeline/media_pipeline_impl.cc b/chromecast/media/cma/pipeline/media_pipeline_impl.cc
index ce0df27..7e26266 100644
--- a/chromecast/media/cma/pipeline/media_pipeline_impl.cc
+++ b/chromecast/media/cma/pipeline/media_pipeline_impl.cc
@@ -267,7 +267,27 @@
 
   buffering_controller_->Reset();
 
-  // Flush both the audio and video pipeline.
+  // Flush audio/video pipeline in three phases:
+  // 1. Stop pushing data to backend. This guarentees media pipeline doesn't
+  // push buffers to backend after stopping backend. (b/23751784)
+  if (audio_pipeline_ && !audio_pipeline_->StartFlush()) {
+    status_cb.Run(::media::PIPELINE_ERROR_ABORT);
+    return;
+  }
+  if (video_pipeline_ && !video_pipeline_->StartFlush()) {
+    status_cb.Run(::media::PIPELINE_ERROR_ABORT);
+    return;
+  }
+
+  // 2. Stop the backend, so that the backend won't push their pending buffer,
+  // which may be invalidated later, to hardware. (b/25342604)
+  if (!media_pipeline_backend_->Stop()) {
+    status_cb.Run(::media::PIPELINE_ERROR_ABORT);
+    return;
+  }
+
+  // 3. Flush both the audio and video pipeline. This will flush the frame
+  // provider and invalidate all the unreleased buffers.
   ::media::SerialRunner::Queue bound_fns;
   if (audio_pipeline_) {
     bound_fns.Push(base::Bind(
@@ -339,12 +359,6 @@
 void MediaPipelineImpl::OnFlushDone(
     const ::media::PipelineStatusCB& status_cb,
     ::media::PipelineStatus status) {
-  // Stop the backend
-  if (!media_pipeline_backend_->Stop()) {
-    status_cb.Run(::media::PIPELINE_ERROR_ABORT);
-    return;
-  }
-
   // Clear pending buffers.
   if (audio_pipeline_)
     audio_pipeline_->BackendStopped();
diff --git a/chromecast/media/cma/pipeline/video_pipeline_impl.cc b/chromecast/media/cma/pipeline/video_pipeline_impl.cc
index 2d6f803..d94ea52 100644
--- a/chromecast/media/cma/pipeline/video_pipeline_impl.cc
+++ b/chromecast/media/cma/pipeline/video_pipeline_impl.cc
@@ -64,14 +64,19 @@
   return true;
 }
 
-void VideoPipelineImpl::Flush(const ::media::PipelineStatusCB& status_cb) {
+bool VideoPipelineImpl::StartFlush() {
   CMALOG(kLogControl) << __FUNCTION__;
   if (av_pipeline_impl_->GetState() == AvPipelineImpl::kError) {
-    status_cb.Run(::media::PIPELINE_ERROR_ABORT);
-    return;
+    return false;
   }
   DCHECK_EQ(av_pipeline_impl_->GetState(), AvPipelineImpl::kPlaying);
   av_pipeline_impl_->TransitionToState(AvPipelineImpl::kFlushing);
+  return true;
+}
+
+void VideoPipelineImpl::Flush(const ::media::PipelineStatusCB& status_cb) {
+  CMALOG(kLogControl) << __FUNCTION__;
+  DCHECK_EQ(av_pipeline_impl_->GetState(), AvPipelineImpl::kFlushing);
   av_pipeline_impl_->Flush(
       base::Bind(&VideoPipelineImpl::OnFlushDone, weak_this_, status_cb));
 }
diff --git a/chromecast/media/cma/pipeline/video_pipeline_impl.h b/chromecast/media/cma/pipeline/video_pipeline_impl.h
index ff18c28..318b7f0c 100644
--- a/chromecast/media/cma/pipeline/video_pipeline_impl.h
+++ b/chromecast/media/cma/pipeline/video_pipeline_impl.h
@@ -47,6 +47,7 @@
       const ::media::PipelineStatusCB& status_cb);
   bool StartPlayingFrom(base::TimeDelta time,
                         const scoped_refptr<BufferingState>& buffering_state);
+  bool StartFlush();
   void Flush(const ::media::PipelineStatusCB& status_cb);
   void BackendStopped();
   void Stop();
diff --git a/chromeos/chromeos.gyp b/chromeos/chromeos.gyp
index d2f05119..bce686c 100644
--- a/chromeos/chromeos.gyp
+++ b/chromeos/chromeos.gyp
@@ -61,6 +61,44 @@
       'dbus/audio_node.h',
       'dbus/blocking_method_caller.cc',
       'dbus/blocking_method_caller.h',
+      'dbus/bluetooth_adapter_client.cc',
+      'dbus/bluetooth_adapter_client.h',
+      'dbus/bluetooth_le_advertising_manager_client.cc',
+      'dbus/bluetooth_le_advertising_manager_client.h',
+      'dbus/bluetooth_le_advertisement_service_provider.cc',
+      'dbus/bluetooth_le_advertisement_service_provider.h',
+      'dbus/bluetooth_agent_manager_client.cc',
+      'dbus/bluetooth_agent_manager_client.h',
+      'dbus/bluetooth_agent_service_provider.cc',
+      'dbus/bluetooth_agent_service_provider.h',
+      'dbus/bluetooth_device_client.cc',
+      'dbus/bluetooth_device_client.h',
+      'dbus/bluetooth_gatt_characteristic_client.cc',
+      'dbus/bluetooth_gatt_characteristic_client.h',
+      'dbus/bluetooth_gatt_characteristic_service_provider.cc',
+      'dbus/bluetooth_gatt_characteristic_service_provider.h',
+      'dbus/bluetooth_gatt_descriptor_client.cc',
+      'dbus/bluetooth_gatt_descriptor_client.h',
+      'dbus/bluetooth_gatt_descriptor_service_provider.cc',
+      'dbus/bluetooth_gatt_descriptor_service_provider.h',
+      'dbus/bluetooth_gatt_manager_client.cc',
+      'dbus/bluetooth_gatt_manager_client.h',
+      'dbus/bluetooth_gatt_service_client.cc',
+      'dbus/bluetooth_gatt_service_client.h',
+      'dbus/bluetooth_gatt_service_service_provider.cc',
+      'dbus/bluetooth_gatt_service_service_provider.h',
+      'dbus/bluetooth_input_client.cc',
+      'dbus/bluetooth_input_client.h',
+      'dbus/bluetooth_media_client.cc',
+      'dbus/bluetooth_media_client.h',
+      'dbus/bluetooth_media_endpoint_service_provider.cc',
+      'dbus/bluetooth_media_endpoint_service_provider.h',
+      'dbus/bluetooth_media_transport_client.cc',
+      'dbus/bluetooth_media_transport_client.h',
+      'dbus/bluetooth_profile_manager_client.cc',
+      'dbus/bluetooth_profile_manager_client.h',
+      'dbus/bluetooth_profile_service_provider.cc',
+      'dbus/bluetooth_profile_service_provider.h',
       'dbus/cras_audio_client.cc',
       'dbus/cras_audio_client.h',
       'dbus/cros_disks_client.cc',
@@ -86,6 +124,44 @@
       'dbus/fake_arc_bridge_client.h',
       'dbus/fake_audio_dsp_client.cc',
       'dbus/fake_audio_dsp_client.h',
+      'dbus/fake_bluetooth_adapter_client.cc',
+      'dbus/fake_bluetooth_adapter_client.h',
+      'dbus/fake_bluetooth_le_advertising_manager_client.cc',
+      'dbus/fake_bluetooth_le_advertising_manager_client.h',
+      'dbus/fake_bluetooth_le_advertisement_service_provider.cc',
+      'dbus/fake_bluetooth_le_advertisement_service_provider.h',
+      'dbus/fake_bluetooth_agent_manager_client.cc',
+      'dbus/fake_bluetooth_agent_manager_client.h',
+      'dbus/fake_bluetooth_agent_service_provider.cc',
+      'dbus/fake_bluetooth_agent_service_provider.h',
+      'dbus/fake_bluetooth_device_client.cc',
+      'dbus/fake_bluetooth_device_client.h',
+      'dbus/fake_bluetooth_gatt_characteristic_client.cc',
+      'dbus/fake_bluetooth_gatt_characteristic_client.h',
+      'dbus/fake_bluetooth_gatt_characteristic_service_provider.cc',
+      'dbus/fake_bluetooth_gatt_characteristic_service_provider.h',
+      'dbus/fake_bluetooth_gatt_descriptor_client.cc',
+      'dbus/fake_bluetooth_gatt_descriptor_client.h',
+      'dbus/fake_bluetooth_gatt_descriptor_service_provider.cc',
+      'dbus/fake_bluetooth_gatt_descriptor_service_provider.h',
+      'dbus/fake_bluetooth_gatt_manager_client.cc',
+      'dbus/fake_bluetooth_gatt_manager_client.h',
+      'dbus/fake_bluetooth_gatt_service_client.cc',
+      'dbus/fake_bluetooth_gatt_service_client.h',
+      'dbus/fake_bluetooth_gatt_service_service_provider.cc',
+      'dbus/fake_bluetooth_gatt_service_service_provider.h',
+      'dbus/fake_bluetooth_input_client.cc',
+      'dbus/fake_bluetooth_input_client.h',
+      'dbus/fake_bluetooth_media_client.cc',
+      'dbus/fake_bluetooth_media_client.h',
+      'dbus/fake_bluetooth_media_endpoint_service_provider.cc',
+      'dbus/fake_bluetooth_media_endpoint_service_provider.h',
+      'dbus/fake_bluetooth_media_transport_client.cc',
+      'dbus/fake_bluetooth_media_transport_client.h',
+      'dbus/fake_bluetooth_profile_manager_client.cc',
+      'dbus/fake_bluetooth_profile_manager_client.h',
+      'dbus/fake_bluetooth_profile_service_provider.cc',
+      'dbus/fake_bluetooth_profile_service_provider.h',
       'dbus/fake_cras_audio_client.cc',
       'dbus/fake_cras_audio_client.h',
       'dbus/fake_cros_disks_client.cc',
diff --git a/device/bluetooth/dbus/bluetooth_adapter_client.cc b/chromeos/dbus/bluetooth_adapter_client.cc
similarity index 98%
rename from device/bluetooth/dbus/bluetooth_adapter_client.cc
rename to chromeos/dbus/bluetooth_adapter_client.cc
index 26081ea3..064262e8 100644
--- a/device/bluetooth/dbus/bluetooth_adapter_client.cc
+++ b/chromeos/dbus/bluetooth_adapter_client.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 "device/bluetooth/dbus/bluetooth_adapter_client.h"
+#include "chromeos/dbus/bluetooth_adapter_client.h"
 
 #include "base/bind.h"
 #include "base/logging.h"
@@ -12,7 +12,7 @@
 #include "dbus/object_proxy.h"
 #include "third_party/cros_system_api/dbus/service_constants.h"
 
-namespace bluez {
+namespace chromeos {
 
 BluetoothAdapterClient::DiscoveryFilter::DiscoveryFilter() {}
 
@@ -347,4 +347,4 @@
   return new BluetoothAdapterClientImpl;
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/bluetooth_adapter_client.h b/chromeos/dbus/bluetooth_adapter_client.h
similarity index 93%
rename from device/bluetooth/dbus/bluetooth_adapter_client.h
rename to chromeos/dbus/bluetooth_adapter_client.h
index 4af6658..c7237d74c 100644
--- a/device/bluetooth/dbus/bluetooth_adapter_client.h
+++ b/chromeos/dbus/bluetooth_adapter_client.h
@@ -2,26 +2,25 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_ADAPTER_CLIENT_H_
-#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_ADAPTER_CLIENT_H_
+#ifndef CHROMEOS_DBUS_BLUETOOTH_ADAPTER_CLIENT_H_
+#define CHROMEOS_DBUS_BLUETOOTH_ADAPTER_CLIENT_H_
 
 #include <string>
 #include <vector>
 
 #include "base/callback.h"
-#include "base/macros.h"
 #include "base/observer_list.h"
 #include "base/values.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/dbus_client.h"
 #include "dbus/object_path.h"
 #include "dbus/property.h"
-#include "device/bluetooth/bluetooth_export.h"
-#include "device/bluetooth/dbus/bluez_dbus_client.h"
 
-namespace bluez {
+namespace chromeos {
 
 // BluetoothAdapterClient is used to communicate with objects representing
 // local Bluetooth Adapters.
-class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterClient : public BluezDBusClient {
+class CHROMEOS_EXPORT BluetoothAdapterClient : public DBusClient {
  public:
   // A DiscoveryFilter represents a filter passed to the SetDiscoveryFilter
   // method.
@@ -37,7 +36,6 @@
     scoped_ptr<uint16_t> pathloss;
     scoped_ptr<std::string> transport;
 
-   private:
     DISALLOW_COPY_AND_ASSIGN(DiscoveryFilter);
   };
 
@@ -181,6 +179,6 @@
   DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterClient);
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_ADAPTER_CLIENT_H_
+#endif  // CHROMEOS_DBUS_BLUETOOTH_ADAPTER_CLIENT_H_
diff --git a/device/bluetooth/dbus/bluetooth_agent_manager_client.cc b/chromeos/dbus/bluetooth_agent_manager_client.cc
similarity index 97%
rename from device/bluetooth/dbus/bluetooth_agent_manager_client.cc
rename to chromeos/dbus/bluetooth_agent_manager_client.cc
index 6caee9b..a5606a94 100644
--- a/device/bluetooth/dbus/bluetooth_agent_manager_client.cc
+++ b/chromeos/dbus/bluetooth_agent_manager_client.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 "device/bluetooth/dbus/bluetooth_agent_manager_client.h"
+#include "chromeos/dbus/bluetooth_agent_manager_client.h"
 
 #include "base/bind.h"
 #include "base/logging.h"
@@ -11,7 +11,7 @@
 #include "dbus/object_proxy.h"
 #include "third_party/cros_system_api/dbus/service_constants.h"
 
-namespace bluez {
+namespace chromeos {
 
 const char BluetoothAgentManagerClient::kNoResponseError[] =
     "org.chromium.Error.NoResponse";
@@ -134,4 +134,4 @@
   return new BluetoothAgentManagerClientImpl();
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/bluetooth_agent_manager_client.h b/chromeos/dbus/bluetooth_agent_manager_client.h
similarity index 83%
rename from device/bluetooth/dbus/bluetooth_agent_manager_client.h
rename to chromeos/dbus/bluetooth_agent_manager_client.h
index 47402dd..f43f4f8 100644
--- a/device/bluetooth/dbus/bluetooth_agent_manager_client.h
+++ b/chromeos/dbus/bluetooth_agent_manager_client.h
@@ -2,25 +2,23 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_AGENT_MANAGER_CLIENT_H_
-#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_AGENT_MANAGER_CLIENT_H_
+#ifndef CHROMEOS_DBUS_BLUETOOTH_AGENT_MANAGER_CLIENT_H_
+#define CHROMEOS_DBUS_BLUETOOTH_AGENT_MANAGER_CLIENT_H_
 
 #include <string>
 #include <vector>
 
 #include "base/callback.h"
-#include "base/macros.h"
 #include "base/values.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/dbus_client.h"
 #include "dbus/object_path.h"
-#include "device/bluetooth/bluetooth_export.h"
-#include "device/bluetooth/dbus/bluez_dbus_client.h"
 
-namespace bluez {
+namespace chromeos {
 
 // BluetoothAgentManagerClient is used to communicate with the agent manager
 // object of the Bluetooth daemon.
-class DEVICE_BLUETOOTH_EXPORT BluetoothAgentManagerClient
-    : public BluezDBusClient {
+class CHROMEOS_EXPORT BluetoothAgentManagerClient : public DBusClient {
  public:
   ~BluetoothAgentManagerClient() override;
 
@@ -65,6 +63,6 @@
   DISALLOW_COPY_AND_ASSIGN(BluetoothAgentManagerClient);
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_AGENT_MANAGER_CLIENT_H_
+#endif  // CHROMEOS_DBUS_BLUETOOTH_AGENT_MANAGER_CLIENT_H_
diff --git a/device/bluetooth/dbus/bluetooth_agent_service_provider.cc b/chromeos/dbus/bluetooth_agent_service_provider.cc
similarity index 97%
rename from device/bluetooth/dbus/bluetooth_agent_service_provider.cc
rename to chromeos/dbus/bluetooth_agent_service_provider.cc
index 7392f2b..54ebeb3 100644
--- a/device/bluetooth/dbus/bluetooth_agent_service_provider.cc
+++ b/chromeos/dbus/bluetooth_agent_service_provider.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 "device/bluetooth/dbus/bluetooth_agent_service_provider.h"
+#include "chromeos/dbus/bluetooth_agent_service_provider.h"
 
 #include "base/bind.h"
 #include "base/logging.h"
 #include "base/memory/ref_counted.h"
 #include "base/threading/platform_thread.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
+#include "chromeos/dbus/fake_bluetooth_agent_service_provider.h"
 #include "dbus/exported_object.h"
 #include "dbus/message.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
-#include "device/bluetooth/dbus/fake_bluetooth_agent_service_provider.h"
 #include "third_party/cros_system_api/dbus/service_constants.h"
 
-namespace bluez {
+namespace chromeos {
 
 // The BluetoothAgentServiceProvider implementation used in production.
 class BluetoothAgentServiceProviderImpl : public BluetoothAgentServiceProvider {
@@ -434,11 +434,11 @@
     dbus::Bus* bus,
     const dbus::ObjectPath& object_path,
     Delegate* delegate) {
-  if (!bluez::BluezDBusManager::Get()->IsUsingStub()) {
+  if (!DBusThreadManager::Get()->IsUsingStub(DBusClientBundle::BLUETOOTH)) {
     return new BluetoothAgentServiceProviderImpl(bus, object_path, delegate);
   } else {
     return new FakeBluetoothAgentServiceProvider(object_path, delegate);
   }
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/bluetooth_agent_service_provider.h b/chromeos/dbus/bluetooth_agent_service_provider.h
similarity index 95%
rename from device/bluetooth/dbus/bluetooth_agent_service_provider.h
rename to chromeos/dbus/bluetooth_agent_service_provider.h
index e31ef8f9..8e84fa5 100644
--- a/device/bluetooth/dbus/bluetooth_agent_service_provider.h
+++ b/chromeos/dbus/bluetooth_agent_service_provider.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 DEVICE_BLUETOOTH_DBUS_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_
-#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_
+#ifndef CHROMEOS_DBUS_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_
+#define CHROMEOS_DBUS_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_
 
 #include <string>
 
 #include "base/basictypes.h"
 #include "base/callback.h"
+#include "chromeos/chromeos_export.h"
 #include "dbus/bus.h"
 #include "dbus/object_path.h"
-#include "device/bluetooth/bluetooth_export.h"
 
-namespace bluez {
+namespace chromeos {
 
 // BluetoothAgentServiceProvider is used to provide a D-Bus object that
 // the bluetooth daemon can communicate with during a remote device pairing
@@ -28,7 +28,7 @@
 // make calls to this agent object and they will be passed on to your Delegate
 // object for handling. Responses should be returned using the callbacks
 // supplied to those methods.
-class DEVICE_BLUETOOTH_EXPORT BluetoothAgentServiceProvider {
+class CHROMEOS_EXPORT BluetoothAgentServiceProvider {
  public:
   // Interface for reacting to agent requests.
   class Delegate {
@@ -173,6 +173,6 @@
   DISALLOW_COPY_AND_ASSIGN(BluetoothAgentServiceProvider);
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_
+#endif  // CHROMEOS_DBUS_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_
diff --git a/device/bluetooth/dbus/bluetooth_device_client.cc b/chromeos/dbus/bluetooth_device_client.cc
similarity index 98%
rename from device/bluetooth/dbus/bluetooth_device_client.cc
rename to chromeos/dbus/bluetooth_device_client.cc
index 7aaafa2..8fcf74b 100644
--- a/device/bluetooth/dbus/bluetooth_device_client.cc
+++ b/chromeos/dbus/bluetooth_device_client.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 "device/bluetooth/dbus/bluetooth_device_client.h"
+#include "chromeos/dbus/bluetooth_device_client.h"
 
 #include "base/bind.h"
 #include "base/logging.h"
@@ -13,7 +13,7 @@
 #include "dbus/object_proxy.h"
 #include "third_party/cros_system_api/dbus/service_constants.h"
 
-namespace bluez {
+namespace chromeos {
 
 namespace {
 
@@ -376,4 +376,4 @@
   return new BluetoothDeviceClientImpl();
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/bluetooth_device_client.h b/chromeos/dbus/bluetooth_device_client.h
similarity index 94%
rename from device/bluetooth/dbus/bluetooth_device_client.h
rename to chromeos/dbus/bluetooth_device_client.h
index 33b3f5d..e9c2905 100644
--- a/device/bluetooth/dbus/bluetooth_device_client.h
+++ b/chromeos/dbus/bluetooth_device_client.h
@@ -2,26 +2,25 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_DEVICE_CLIENT_H_
-#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_DEVICE_CLIENT_H_
+#ifndef CHROMEOS_DBUS_BLUETOOTH_DEVICE_CLIENT_H_
+#define CHROMEOS_DBUS_BLUETOOTH_DEVICE_CLIENT_H_
 
 #include <string>
 #include <vector>
 
 #include "base/callback.h"
-#include "base/macros.h"
 #include "base/observer_list.h"
 #include "base/values.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/dbus_client.h"
 #include "dbus/object_path.h"
 #include "dbus/property.h"
-#include "device/bluetooth/bluetooth_export.h"
-#include "device/bluetooth/dbus/bluez_dbus_client.h"
 
-namespace bluez {
+namespace chromeos {
 
 // BluetoothDeviceClient is used to communicate with objects representing
 // remote Bluetooth Devices.
-class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceClient : public BluezDBusClient {
+class CHROMEOS_EXPORT BluetoothDeviceClient : public DBusClient {
  public:
   // Structure of properties associated with bluetooth devices.
   struct Properties : public dbus::PropertySet {
@@ -208,6 +207,6 @@
   DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceClient);
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_DEVICE_CLIENT_H_
+#endif  // CHROMEOS_DBUS_BLUETOOTH_DEVICE_CLIENT_H_
diff --git a/device/bluetooth/dbus/bluetooth_gatt_characteristic_client.cc b/chromeos/dbus/bluetooth_gatt_characteristic_client.cc
similarity index 98%
rename from device/bluetooth/dbus/bluetooth_gatt_characteristic_client.cc
rename to chromeos/dbus/bluetooth_gatt_characteristic_client.cc
index 6000a52..8e241e6 100644
--- a/device/bluetooth/dbus/bluetooth_gatt_characteristic_client.cc
+++ b/chromeos/dbus/bluetooth_gatt_characteristic_client.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 "device/bluetooth/dbus/bluetooth_gatt_characteristic_client.h"
+#include "chromeos/dbus/bluetooth_gatt_characteristic_client.h"
 
 #include "base/bind.h"
 #include "base/memory/weak_ptr.h"
@@ -11,7 +11,7 @@
 #include "dbus/object_manager.h"
 #include "third_party/cros_system_api/dbus/service_constants.h"
 
-namespace bluez {
+namespace chromeos {
 
 namespace {
 
@@ -300,4 +300,4 @@
   return new BluetoothGattCharacteristicClientImpl();
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/bluetooth_gatt_characteristic_client.h b/chromeos/dbus/bluetooth_gatt_characteristic_client.h
similarity index 92%
rename from device/bluetooth/dbus/bluetooth_gatt_characteristic_client.h
rename to chromeos/dbus/bluetooth_gatt_characteristic_client.h
index 3c476eb..b040b56 100644
--- a/device/bluetooth/dbus/bluetooth_gatt_characteristic_client.h
+++ b/chromeos/dbus/bluetooth_gatt_characteristic_client.h
@@ -2,25 +2,24 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_CLIENT_H_
-#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_CLIENT_H_
+#ifndef CHROMEOS_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_CLIENT_H_
+#define CHROMEOS_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_CLIENT_H_
 
 #include <string>
 #include <vector>
 
 #include "base/basictypes.h"
 #include "base/callback.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/dbus_client.h"
 #include "dbus/object_path.h"
 #include "dbus/property.h"
-#include "device/bluetooth/bluetooth_export.h"
-#include "device/bluetooth/dbus/bluez_dbus_client.h"
 
-namespace bluez {
+namespace chromeos {
 
 // BluetoothGattCharacteristicClient is used to communicate with remote GATT
 // characteristic objects exposed by the Bluetooth daemon.
-class DEVICE_BLUETOOTH_EXPORT BluetoothGattCharacteristicClient
-    : public BluezDBusClient {
+class CHROMEOS_EXPORT BluetoothGattCharacteristicClient : public DBusClient {
  public:
   // Structure of properties associated with GATT characteristics.
   struct Properties : public dbus::PropertySet {
@@ -139,6 +138,6 @@
   DISALLOW_COPY_AND_ASSIGN(BluetoothGattCharacteristicClient);
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_CLIENT_H_
+#endif  // CHROMEOS_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_CLIENT_H_
diff --git a/device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider.cc b/chromeos/dbus/bluetooth_gatt_characteristic_service_provider.cc
similarity index 97%
rename from device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider.cc
rename to chromeos/dbus/bluetooth_gatt_characteristic_service_provider.cc
index 4decdf0..856e60da 100644
--- a/device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider.cc
+++ b/chromeos/dbus/bluetooth_gatt_characteristic_service_provider.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 "device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider.h"
+#include "chromeos/dbus/bluetooth_gatt_characteristic_service_provider.h"
 
 #include "base/bind.h"
 #include "base/logging.h"
 #include "base/memory/weak_ptr.h"
 #include "base/strings/string_util.h"
 #include "base/threading/platform_thread.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
+#include "chromeos/dbus/fake_bluetooth_gatt_characteristic_service_provider.h"
 #include "dbus/exported_object.h"
 #include "dbus/message.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
-#include "device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.h"
 #include "third_party/cros_system_api/dbus/service_constants.h"
 
-namespace bluez {
+namespace chromeos {
 namespace {
 const char kErrorInvalidArgs[] = "org.freedesktop.DBus.Error.InvalidArgs";
 const char kErrorPropertyReadOnly[] =
@@ -453,7 +453,7 @@
     const std::vector<std::string>& flags,
     const std::vector<std::string>& permissions,
     const dbus::ObjectPath& service_path) {
-  if (!bluez::BluezDBusManager::Get()->IsUsingStub()) {
+  if (!DBusThreadManager::Get()->IsUsingStub(DBusClientBundle::BLUETOOTH)) {
     return new BluetoothGattCharacteristicServiceProviderImpl(
         bus, object_path, delegate, uuid, flags, permissions, service_path);
   }
@@ -461,4 +461,4 @@
       object_path, delegate, uuid, flags, permissions, service_path);
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider.h b/chromeos/dbus/bluetooth_gatt_characteristic_service_provider.h
similarity index 91%
rename from device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider.h
rename to chromeos/dbus/bluetooth_gatt_characteristic_service_provider.h
index ad5d999f..174a908 100644
--- a/device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider.h
+++ b/chromeos/dbus/bluetooth_gatt_characteristic_service_provider.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 DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_
-#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_
+#ifndef CHROMEOS_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_
+#define CHROMEOS_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_
 
 #include <string>
 #include <vector>
 
 #include "base/basictypes.h"
 #include "base/callback.h"
+#include "chromeos/chromeos_export.h"
 #include "dbus/bus.h"
 #include "dbus/object_path.h"
-#include "device/bluetooth/bluetooth_export.h"
 
-namespace bluez {
+namespace chromeos {
 
 // BluetoothGattCharacteristicServiceProvider is used to provide a D-Bus object
 // that represents a local GATT characteristic that the Bluetooth daemon can
@@ -30,7 +30,7 @@
 // mandatory during initialization. In addition, a "SendValueChanged" method is
 // provided, which emits a DBus.Properties.PropertyChanged signal for the
 // "Value" property.
-class DEVICE_BLUETOOTH_EXPORT BluetoothGattCharacteristicServiceProvider {
+class CHROMEOS_EXPORT BluetoothGattCharacteristicServiceProvider {
  public:
   // Interface for reacting to GATT characteristic value requests.
   class Delegate {
@@ -108,6 +108,6 @@
   DISALLOW_COPY_AND_ASSIGN(BluetoothGattCharacteristicServiceProvider);
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_
+#endif  // CHROMEOS_DBUS_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_
diff --git a/device/bluetooth/dbus/bluetooth_gatt_descriptor_client.cc b/chromeos/dbus/bluetooth_gatt_descriptor_client.cc
similarity index 98%
rename from device/bluetooth/dbus/bluetooth_gatt_descriptor_client.cc
rename to chromeos/dbus/bluetooth_gatt_descriptor_client.cc
index f3ba343c..4d974158 100644
--- a/device/bluetooth/dbus/bluetooth_gatt_descriptor_client.cc
+++ b/chromeos/dbus/bluetooth_gatt_descriptor_client.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 "device/bluetooth/dbus/bluetooth_gatt_descriptor_client.h"
+#include "chromeos/dbus/bluetooth_gatt_descriptor_client.h"
 
 #include "base/bind.h"
 #include "base/memory/weak_ptr.h"
@@ -11,7 +11,7 @@
 #include "dbus/object_manager.h"
 #include "third_party/cros_system_api/dbus/service_constants.h"
 
-namespace bluez {
+namespace chromeos {
 
 namespace {
 
@@ -248,4 +248,4 @@
   return new BluetoothGattDescriptorClientImpl();
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/bluetooth_gatt_descriptor_client.h b/chromeos/dbus/bluetooth_gatt_descriptor_client.h
similarity index 90%
rename from device/bluetooth/dbus/bluetooth_gatt_descriptor_client.h
rename to chromeos/dbus/bluetooth_gatt_descriptor_client.h
index 364331e5..15d3d9c34a 100644
--- a/device/bluetooth/dbus/bluetooth_gatt_descriptor_client.h
+++ b/chromeos/dbus/bluetooth_gatt_descriptor_client.h
@@ -2,25 +2,24 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_DESCRIPTOR_CLIENT_H_
-#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_DESCRIPTOR_CLIENT_H_
+#ifndef CHROMEOS_DBUS_BLUETOOTH_GATT_DESCRIPTOR_CLIENT_H_
+#define CHROMEOS_DBUS_BLUETOOTH_GATT_DESCRIPTOR_CLIENT_H_
 
 #include <string>
 #include <vector>
 
 #include "base/basictypes.h"
 #include "base/callback.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/dbus_client.h"
 #include "dbus/object_path.h"
 #include "dbus/property.h"
-#include "device/bluetooth/bluetooth_export.h"
-#include "device/bluetooth/dbus/bluez_dbus_client.h"
 
-namespace bluez {
+namespace chromeos {
 
 // BluetoothGattDescriptorClient is used to communicate with remote GATT
 // characteristic descriptor objects exposed by the Bluetooth daemon.
-class DEVICE_BLUETOOTH_EXPORT BluetoothGattDescriptorClient
-    : public BluezDBusClient {
+class CHROMEOS_EXPORT BluetoothGattDescriptorClient : public DBusClient {
  public:
   // Structure of properties associated with GATT descriptors.
   struct Properties : public dbus::PropertySet {
@@ -111,6 +110,6 @@
   DISALLOW_COPY_AND_ASSIGN(BluetoothGattDescriptorClient);
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_DESCRIPTOR_CLIENT_H_
+#endif  // CHROMEOS_DBUS_BLUETOOTH_GATT_DESCRIPTOR_CLIENT_H_
diff --git a/device/bluetooth/dbus/bluetooth_gatt_descriptor_service_provider.cc b/chromeos/dbus/bluetooth_gatt_descriptor_service_provider.cc
similarity index 97%
rename from device/bluetooth/dbus/bluetooth_gatt_descriptor_service_provider.cc
rename to chromeos/dbus/bluetooth_gatt_descriptor_service_provider.cc
index e4aa2454..1fe1657 100644
--- a/device/bluetooth/dbus/bluetooth_gatt_descriptor_service_provider.cc
+++ b/chromeos/dbus/bluetooth_gatt_descriptor_service_provider.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 "device/bluetooth/dbus/bluetooth_gatt_descriptor_service_provider.h"
+#include "chromeos/dbus/bluetooth_gatt_descriptor_service_provider.h"
 
 #include "base/bind.h"
 #include "base/logging.h"
 #include "base/memory/weak_ptr.h"
 #include "base/strings/string_util.h"
 #include "base/threading/platform_thread.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
+#include "chromeos/dbus/fake_bluetooth_gatt_descriptor_service_provider.h"
 #include "dbus/exported_object.h"
 #include "dbus/message.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
-#include "device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_service_provider.h"
 #include "third_party/cros_system_api/dbus/service_constants.h"
 
-namespace bluez {
+namespace chromeos {
 namespace {
 const char kErrorInvalidArgs[] = "org.freedesktop.DBus.Error.InvalidArgs";
 const char kErrorPropertyReadOnly[] =
@@ -446,7 +446,7 @@
     const std::string& uuid,
     const std::vector<std::string>& permissions,
     const dbus::ObjectPath& characteristic_path) {
-  if (!bluez::BluezDBusManager::Get()->IsUsingStub()) {
+  if (!DBusThreadManager::Get()->IsUsingStub(DBusClientBundle::BLUETOOTH)) {
     return new BluetoothGattDescriptorServiceProviderImpl(
         bus, object_path, delegate, uuid, permissions, characteristic_path);
   }
@@ -454,4 +454,4 @@
       object_path, delegate, uuid, permissions, characteristic_path);
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/bluetooth_gatt_descriptor_service_provider.h b/chromeos/dbus/bluetooth_gatt_descriptor_service_provider.h
similarity index 92%
rename from device/bluetooth/dbus/bluetooth_gatt_descriptor_service_provider.h
rename to chromeos/dbus/bluetooth_gatt_descriptor_service_provider.h
index e4925fff..4b5fef8 100644
--- a/device/bluetooth/dbus/bluetooth_gatt_descriptor_service_provider.h
+++ b/chromeos/dbus/bluetooth_gatt_descriptor_service_provider.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 DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_H_
-#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_H_
+#ifndef CHROMEOS_DBUS_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_H_
+#define CHROMEOS_DBUS_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_H_
 
 #include <string>
 #include <vector>
 
 #include "base/basictypes.h"
 #include "base/callback.h"
+#include "chromeos/chromeos_export.h"
 #include "dbus/bus.h"
 #include "dbus/object_path.h"
-#include "device/bluetooth/bluetooth_export.h"
 
-namespace bluez {
+namespace chromeos {
 
 // BluetoothGattDescriptorServiceProvider is used to provide a D-Bus object that
 // represents a local GATT characteristic descriptor that the Bluetooth daemon
@@ -30,7 +30,7 @@
 // mandatory during initialization. In addition, a "SendValueChanged" method is
 // provided, which emits a DBus.Properties.PropertyChanged signal for the
 // "Value" property.
-class DEVICE_BLUETOOTH_EXPORT BluetoothGattDescriptorServiceProvider {
+class CHROMEOS_EXPORT BluetoothGattDescriptorServiceProvider {
  public:
   // Interface for reacting to GATT characteristic descriptor value requests.
   class Delegate {
@@ -104,6 +104,6 @@
   DISALLOW_COPY_AND_ASSIGN(BluetoothGattDescriptorServiceProvider);
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_H_
+#endif  // CHROMEOS_DBUS_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_H_
diff --git a/device/bluetooth/dbus/bluetooth_gatt_manager_client.cc b/chromeos/dbus/bluetooth_gatt_manager_client.cc
similarity index 97%
rename from device/bluetooth/dbus/bluetooth_gatt_manager_client.cc
rename to chromeos/dbus/bluetooth_gatt_manager_client.cc
index 7e471a5c..b3e98c6a 100644
--- a/device/bluetooth/dbus/bluetooth_gatt_manager_client.cc
+++ b/chromeos/dbus/bluetooth_gatt_manager_client.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 "device/bluetooth/dbus/bluetooth_gatt_manager_client.h"
+#include "chromeos/dbus/bluetooth_gatt_manager_client.h"
 
 #include "base/bind.h"
 #include "base/memory/weak_ptr.h"
@@ -11,7 +11,7 @@
 #include "dbus/object_proxy.h"
 #include "third_party/cros_system_api/dbus/service_constants.h"
 
-namespace bluez {
+namespace chromeos {
 
 const char BluetoothGattManagerClient::kNoResponseError[] =
     "org.chromium.Error.NoResponse";
@@ -126,4 +126,4 @@
   return new BluetoothGattManagerClientImpl();
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/bluetooth_gatt_manager_client.h b/chromeos/dbus/bluetooth_gatt_manager_client.h
similarity index 83%
rename from device/bluetooth/dbus/bluetooth_gatt_manager_client.h
rename to chromeos/dbus/bluetooth_gatt_manager_client.h
index b735f77..7a16a0b4 100644
--- a/device/bluetooth/dbus/bluetooth_gatt_manager_client.h
+++ b/chromeos/dbus/bluetooth_gatt_manager_client.h
@@ -2,26 +2,24 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_MANAGER_CLIENT_H_
-#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_MANAGER_CLIENT_H_
+#ifndef CHROMEOS_DBUS_BLUETOOTH_GATT_MANAGER_CLIENT_H_
+#define CHROMEOS_DBUS_BLUETOOTH_GATT_MANAGER_CLIENT_H_
 
 #include <string>
 
 #include "base/callback.h"
-#include "base/macros.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/dbus_client.h"
 #include "dbus/object_path.h"
-#include "device/bluetooth/bluetooth_export.h"
-#include "device/bluetooth/dbus/bluez_dbus_client.h"
 
-namespace bluez {
+namespace chromeos {
 
 // BluetoothGattManagerClient is used to communicate with the GATT Service
 // manager object of the Bluetooth daemon.
-class DEVICE_BLUETOOTH_EXPORT BluetoothGattManagerClient
-    : public BluezDBusClient {
+class CHROMEOS_EXPORT BluetoothGattManagerClient : public DBusClient {
  public:
   // Options used to register a GATT service hierarchy.
-  struct DEVICE_BLUETOOTH_EXPORT Options {
+  struct CHROMEOS_EXPORT Options {
     // TODO(armansito): This parameter is not yet clearly defined. Add fields
     // later as we know more about how this will be used.
   };
@@ -69,6 +67,6 @@
   DISALLOW_COPY_AND_ASSIGN(BluetoothGattManagerClient);
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_MANAGER_CLIENT_H_
+#endif  // CHROMEOS_DBUS_BLUETOOTH_GATT_MANAGER_CLIENT_H_
diff --git a/device/bluetooth/dbus/bluetooth_gatt_service_client.cc b/chromeos/dbus/bluetooth_gatt_service_client.cc
similarity index 97%
rename from device/bluetooth/dbus/bluetooth_gatt_service_client.cc
rename to chromeos/dbus/bluetooth_gatt_service_client.cc
index dc3ef5a..53572f0 100644
--- a/device/bluetooth/dbus/bluetooth_gatt_service_client.cc
+++ b/chromeos/dbus/bluetooth_gatt_service_client.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 "device/bluetooth/dbus/bluetooth_gatt_service_client.h"
+#include "chromeos/dbus/bluetooth_gatt_service_client.h"
 
 #include "base/bind.h"
 #include "base/memory/weak_ptr.h"
@@ -11,7 +11,7 @@
 #include "dbus/object_manager.h"
 #include "third_party/cros_system_api/dbus/service_constants.h"
 
-namespace bluez {
+namespace chromeos {
 
 BluetoothGattServiceClient::Properties::Properties(
     dbus::ObjectProxy* object_proxy,
@@ -140,4 +140,4 @@
   return new BluetoothGattServiceClientImpl();
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/bluetooth_gatt_service_client.h b/chromeos/dbus/bluetooth_gatt_service_client.h
similarity index 86%
rename from device/bluetooth/dbus/bluetooth_gatt_service_client.h
rename to chromeos/dbus/bluetooth_gatt_service_client.h
index 641f505..9c96bb8 100644
--- a/device/bluetooth/dbus/bluetooth_gatt_service_client.h
+++ b/chromeos/dbus/bluetooth_gatt_service_client.h
@@ -2,24 +2,22 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_SERVICE_CLIENT_H_
-#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_SERVICE_CLIENT_H_
+#ifndef CHROMEOS_DBUS_BLUETOOTH_GATT_SERVICE_CLIENT_H_
+#define CHROMEOS_DBUS_BLUETOOTH_GATT_SERVICE_CLIENT_H_
 
 #include <string>
 #include <vector>
 
-#include "base/macros.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/dbus_client.h"
 #include "dbus/object_path.h"
 #include "dbus/property.h"
-#include "device/bluetooth/bluetooth_export.h"
-#include "device/bluetooth/dbus/bluez_dbus_client.h"
 
-namespace bluez {
+namespace chromeos {
 
 // BluetoothGattServiceClient is used to communicate with remote GATT service
 // objects exposed by the Bluetooth daemon.
-class DEVICE_BLUETOOTH_EXPORT BluetoothGattServiceClient
-    : public BluezDBusClient {
+class CHROMEOS_EXPORT BluetoothGattServiceClient : public DBusClient {
  public:
   // Structure of properties associated with GATT services.
   struct Properties : public dbus::PropertySet {
@@ -90,6 +88,6 @@
   DISALLOW_COPY_AND_ASSIGN(BluetoothGattServiceClient);
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_SERVICE_CLIENT_H_
+#endif  // CHROMEOS_DBUS_BLUETOOTH_GATT_SERVICE_CLIENT_H_
diff --git a/device/bluetooth/dbus/bluetooth_gatt_service_service_provider.cc b/chromeos/dbus/bluetooth_gatt_service_service_provider.cc
similarity index 96%
rename from device/bluetooth/dbus/bluetooth_gatt_service_service_provider.cc
rename to chromeos/dbus/bluetooth_gatt_service_service_provider.cc
index 06b6827f..9de86d41 100644
--- a/device/bluetooth/dbus/bluetooth_gatt_service_service_provider.cc
+++ b/chromeos/dbus/bluetooth_gatt_service_service_provider.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 "device/bluetooth/dbus/bluetooth_gatt_service_service_provider.h"
+#include "chromeos/dbus/bluetooth_gatt_service_service_provider.h"
 
 #include "base/bind.h"
 #include "base/logging.h"
 #include "base/memory/ref_counted.h"
 #include "base/memory/weak_ptr.h"
 #include "base/threading/platform_thread.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
+#include "chromeos/dbus/fake_bluetooth_gatt_service_service_provider.h"
 #include "dbus/exported_object.h"
 #include "dbus/message.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
-#include "device/bluetooth/dbus/fake_bluetooth_gatt_service_service_provider.h"
 #include "third_party/cros_system_api/dbus/service_constants.h"
 
-namespace bluez {
+namespace chromeos {
 namespace {
 const char kErrorInvalidArgs[] = "org.freedesktop.DBus.Error.InvalidArgs";
 const char kErrorPropertyReadOnly[] =
@@ -261,7 +261,7 @@
     const dbus::ObjectPath& object_path,
     const std::string& uuid,
     const std::vector<dbus::ObjectPath>& includes) {
-  if (!bluez::BluezDBusManager::Get()->IsUsingStub()) {
+  if (!DBusThreadManager::Get()->IsUsingStub(DBusClientBundle::BLUETOOTH)) {
     return new BluetoothGattServiceServiceProviderImpl(bus, object_path, uuid,
                                                        includes);
   }
@@ -269,4 +269,4 @@
                                                      includes);
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/bluetooth_gatt_service_service_provider.h b/chromeos/dbus/bluetooth_gatt_service_service_provider.h
similarity index 81%
rename from device/bluetooth/dbus/bluetooth_gatt_service_service_provider.h
rename to chromeos/dbus/bluetooth_gatt_service_service_provider.h
index cedec1e1..258c4b4 100644
--- a/device/bluetooth/dbus/bluetooth_gatt_service_service_provider.h
+++ b/chromeos/dbus/bluetooth_gatt_service_service_provider.h
@@ -2,18 +2,17 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_H_
-#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_H_
+#ifndef CHROMEOS_DBUS_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_H_
+#define CHROMEOS_DBUS_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_H_
 
 #include <string>
 #include <vector>
 
-#include "base/macros.h"
+#include "chromeos/chromeos_export.h"
 #include "dbus/bus.h"
 #include "dbus/object_path.h"
-#include "device/bluetooth/bluetooth_export.h"
 
-namespace bluez {
+namespace chromeos {
 
 // BluetoothGattServiceServiceProvider is used to provide a D-Bus object that
 // the Bluetooth daemon can communicate with to register GATT service
@@ -25,7 +24,7 @@
 // chromeos::BluetoothGattManagerClient::RegisterService method. Make sure to
 // create characteristic and descriptor objects using the appropriate service
 // providers before registering a GATT service with the Bluetooth daemon.
-class DEVICE_BLUETOOTH_EXPORT BluetoothGattServiceServiceProvider {
+class CHROMEOS_EXPORT BluetoothGattServiceServiceProvider {
  public:
   virtual ~BluetoothGattServiceServiceProvider();
 
@@ -48,6 +47,6 @@
   DISALLOW_COPY_AND_ASSIGN(BluetoothGattServiceServiceProvider);
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_H_
+#endif  // CHROMEOS_DBUS_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_H_
diff --git a/device/bluetooth/dbus/bluetooth_input_client.cc b/chromeos/dbus/bluetooth_input_client.cc
similarity index 97%
rename from device/bluetooth/dbus/bluetooth_input_client.cc
rename to chromeos/dbus/bluetooth_input_client.cc
index 42542a8..e8b1c8d 100644
--- a/device/bluetooth/dbus/bluetooth_input_client.cc
+++ b/chromeos/dbus/bluetooth_input_client.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 "device/bluetooth/dbus/bluetooth_input_client.h"
+#include "chromeos/dbus/bluetooth_input_client.h"
 
 #include <map>
 
@@ -14,7 +14,7 @@
 #include "dbus/object_proxy.h"
 #include "third_party/cros_system_api/dbus/service_constants.h"
 
-namespace bluez {
+namespace chromeos {
 
 BluetoothInputClient::Properties::Properties(
     dbus::ObjectProxy* object_proxy,
@@ -125,4 +125,4 @@
   return new BluetoothInputClientImpl();
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/bluetooth_input_client.h b/chromeos/dbus/bluetooth_input_client.h
similarity index 85%
rename from device/bluetooth/dbus/bluetooth_input_client.h
rename to chromeos/dbus/bluetooth_input_client.h
index 829e94ca..02abf99 100644
--- a/device/bluetooth/dbus/bluetooth_input_client.h
+++ b/chromeos/dbus/bluetooth_input_client.h
@@ -2,25 +2,24 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_INPUT_CLIENT_H_
-#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_INPUT_CLIENT_H_
+#ifndef CHROMEOS_DBUS_BLUETOOTH_INPUT_CLIENT_H_
+#define CHROMEOS_DBUS_BLUETOOTH_INPUT_CLIENT_H_
 
 #include <string>
 #include <vector>
 
 #include "base/callback.h"
-#include "base/macros.h"
 #include "base/observer_list.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/dbus_client.h"
 #include "dbus/object_path.h"
 #include "dbus/property.h"
-#include "device/bluetooth/bluetooth_export.h"
-#include "device/bluetooth/dbus/bluez_dbus_client.h"
 
-namespace bluez {
+namespace chromeos {
 
 // BluetoothInputClient is used to communicate with objects representing
 // Bluetooth Input (HID) devices.
-class DEVICE_BLUETOOTH_EXPORT BluetoothInputClient : public BluezDBusClient {
+class CHROMEOS_EXPORT BluetoothInputClient : public DBusClient {
  public:
   // Structure of properties associated with bluetooth input devices.
   struct Properties : public dbus::PropertySet {
@@ -77,6 +76,6 @@
   DISALLOW_COPY_AND_ASSIGN(BluetoothInputClient);
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_INPUT_CLIENT_H_
+#endif  // CHROMEOS_DBUS_BLUETOOTH_INPUT_CLIENT_H_
diff --git a/device/bluetooth/dbus/bluetooth_le_advertisement_service_provider.cc b/chromeos/dbus/bluetooth_le_advertisement_service_provider.cc
similarity index 97%
rename from device/bluetooth/dbus/bluetooth_le_advertisement_service_provider.cc
rename to chromeos/dbus/bluetooth_le_advertisement_service_provider.cc
index e981124..dfaeb5ef 100644
--- a/device/bluetooth/dbus/bluetooth_le_advertisement_service_provider.cc
+++ b/chromeos/dbus/bluetooth_le_advertisement_service_provider.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 "device/bluetooth/dbus/bluetooth_le_advertisement_service_provider.h"
+#include "chromeos/dbus/bluetooth_le_advertisement_service_provider.h"
 
 #include "base/bind.h"
 #include "base/logging.h"
 #include "base/memory/ref_counted.h"
 #include "base/stl_util.h"
 #include "base/threading/platform_thread.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
+#include "chromeos/dbus/fake_bluetooth_le_advertisement_service_provider.h"
 #include "dbus/exported_object.h"
 #include "dbus/message.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
-#include "device/bluetooth/dbus/fake_bluetooth_le_advertisement_service_provider.h"
 #include "third_party/cros_system_api/dbus/service_constants.h"
 
-namespace bluez {
+namespace chromeos {
 
 namespace {
 const char kErrorInvalidArgs[] = "org.freedesktop.DBus.Error.InvalidArgs";
@@ -413,7 +413,7 @@
     scoped_ptr<ManufacturerData> manufacturer_data,
     scoped_ptr<UUIDList> solicit_uuids,
     scoped_ptr<ServiceData> service_data) {
-  if (!bluez::BluezDBusManager::Get()->IsUsingStub()) {
+  if (!DBusThreadManager::Get()->IsUsingStub(DBusClientBundle::BLUETOOTH)) {
     return make_scoped_ptr(new BluetoothAdvertisementServiceProviderImpl(
         bus, object_path, delegate, type, service_uuids.Pass(),
         manufacturer_data.Pass(), solicit_uuids.Pass(), service_data.Pass()));
@@ -423,4 +423,4 @@
   }
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/bluetooth_le_advertisement_service_provider.h b/chromeos/dbus/bluetooth_le_advertisement_service_provider.h
similarity index 85%
rename from device/bluetooth/dbus/bluetooth_le_advertisement_service_provider.h
rename to chromeos/dbus/bluetooth_le_advertisement_service_provider.h
index 8f4692f8..98622a2 100644
--- a/device/bluetooth/dbus/bluetooth_le_advertisement_service_provider.h
+++ b/chromeos/dbus/bluetooth_le_advertisement_service_provider.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 DEVICE_BLUETOOTH_DBUS_BLUETOOTH_LE_ADVERTISEMENT_SERVICE_PROVIDER_H_
-#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_LE_ADVERTISEMENT_SERVICE_PROVIDER_H_
+#ifndef CHROMEOS_DBUS_BLUETOOTH_LE_ADVERTISEMENT_SERVICE_PROVIDER_H_
+#define CHROMEOS_DBUS_BLUETOOTH_LE_ADVERTISEMENT_SERVICE_PROVIDER_H_
 
 #include <stdint.h>
 
@@ -14,16 +14,16 @@
 #include "base/basictypes.h"
 #include "base/callback.h"
 #include "base/memory/scoped_ptr.h"
+#include "chromeos/chromeos_export.h"
 #include "dbus/bus.h"
 #include "dbus/file_descriptor.h"
 #include "dbus/object_path.h"
-#include "device/bluetooth/bluetooth_export.h"
 
-namespace bluez {
+namespace chromeos {
 
 // BluetoothAdvertisementServiceProvider is used to provide a D-Bus object that
 // the Bluetooth daemon can communicate with to advertise data.
-class DEVICE_BLUETOOTH_EXPORT BluetoothLEAdvertisementServiceProvider {
+class CHROMEOS_EXPORT BluetoothLEAdvertisementServiceProvider {
  public:
   using UUIDList = std::vector<std::string>;
   using ManufacturerData = std::map<uint16_t, std::vector<uint8_t>>;
@@ -77,6 +77,6 @@
   DISALLOW_COPY_AND_ASSIGN(BluetoothLEAdvertisementServiceProvider);
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_LE_ADVERTISEMENT_SERVICE_PROVIDER_H_
+#endif  // CHROMEOS_DBUS_BLUETOOTH_LE_ADVERTISEMENT_SERVICE_PROVIDER_H_
diff --git a/device/bluetooth/dbus/bluetooth_le_advertising_manager_client.cc b/chromeos/dbus/bluetooth_le_advertising_manager_client.cc
similarity index 97%
rename from device/bluetooth/dbus/bluetooth_le_advertising_manager_client.cc
rename to chromeos/dbus/bluetooth_le_advertising_manager_client.cc
index 3c934e63..ca2c9e20f 100644
--- a/device/bluetooth/dbus/bluetooth_le_advertising_manager_client.cc
+++ b/chromeos/dbus/bluetooth_le_advertising_manager_client.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 "device/bluetooth/dbus/bluetooth_le_advertising_manager_client.h"
+#include "chromeos/dbus/bluetooth_le_advertising_manager_client.h"
 
 #include "base/bind.h"
 #include "base/logging.h"
@@ -13,7 +13,7 @@
 #include "dbus/object_proxy.h"
 #include "third_party/cros_system_api/dbus/service_constants.h"
 
-namespace bluez {
+namespace chromeos {
 
 const char BluetoothLEAdvertisingManagerClient::kNoResponseError[] =
     "org.chromium.Error.NoResponse";
@@ -184,4 +184,4 @@
   return new BluetoothAdvertisementManagerClientImpl();
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/bluetooth_le_advertising_manager_client.h b/chromeos/dbus/bluetooth_le_advertising_manager_client.h
similarity index 84%
rename from device/bluetooth/dbus/bluetooth_le_advertising_manager_client.h
rename to chromeos/dbus/bluetooth_le_advertising_manager_client.h
index 73aa9ed..5160a9f5 100644
--- a/device/bluetooth/dbus/bluetooth_le_advertising_manager_client.h
+++ b/chromeos/dbus/bluetooth_le_advertising_manager_client.h
@@ -2,26 +2,24 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_
-#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_
+#ifndef CHROMEOS_DBUS_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_
+#define CHROMEOS_DBUS_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_
 
 #include <string>
 #include <vector>
 
 #include "base/callback.h"
-#include "base/macros.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/values.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/dbus_client.h"
 #include "dbus/object_path.h"
-#include "device/bluetooth/bluetooth_export.h"
-#include "device/bluetooth/dbus/bluez_dbus_client.h"
 
-namespace bluez {
+namespace chromeos {
 
 // BluetoothAdvertisingManagerClient is used to communicate with the advertising
 // manager object of the BlueZ daemon.
-class DEVICE_BLUETOOTH_EXPORT BluetoothLEAdvertisingManagerClient
-    : public BluezDBusClient {
+class CHROMEOS_EXPORT BluetoothLEAdvertisingManagerClient : public DBusClient {
  public:
   // Interface for observing changes to advertising managers.
   class Observer {
@@ -80,6 +78,6 @@
   DISALLOW_COPY_AND_ASSIGN(BluetoothLEAdvertisingManagerClient);
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_
+#endif  // CHROMEOS_DBUS_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_
diff --git a/device/bluetooth/dbus/bluetooth_media_client.cc b/chromeos/dbus/bluetooth_media_client.cc
similarity index 98%
rename from device/bluetooth/dbus/bluetooth_media_client.cc
rename to chromeos/dbus/bluetooth_media_client.cc
index 0927d45..301f765 100644
--- a/device/bluetooth/dbus/bluetooth_media_client.cc
+++ b/chromeos/dbus/bluetooth_media_client.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 "device/bluetooth/dbus/bluetooth_media_client.h"
+#include "chromeos/dbus/bluetooth_media_client.h"
 
 #include "base/bind.h"
 #include "base/logging.h"
@@ -35,7 +35,7 @@
 
 }  // namespace
 
-namespace bluez {
+namespace chromeos {
 
 // static
 const char BluetoothMediaClient::kNoResponseError[] =
@@ -224,4 +224,4 @@
   return new BluetoothMediaClientImpl();
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/bluetooth_media_client.h b/chromeos/dbus/bluetooth_media_client.h
similarity index 88%
rename from device/bluetooth/dbus/bluetooth_media_client.h
rename to chromeos/dbus/bluetooth_media_client.h
index 88597c5..1bb55478 100644
--- a/device/bluetooth/dbus/bluetooth_media_client.h
+++ b/chromeos/dbus/bluetooth_media_client.h
@@ -2,29 +2,28 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_MEDIA_CLIENT_H_
-#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_MEDIA_CLIENT_H_
+#ifndef CHROMEOS_DBUS_BLUETOOTH_MEDIA_CLIENT_H_
+#define CHROMEOS_DBUS_BLUETOOTH_MEDIA_CLIENT_H_
 
 #include <memory>
 #include <string>
 #include <vector>
 
 #include "base/callback.h"
-#include "base/macros.h"
 #include "base/values.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/dbus_client.h"
 #include "dbus/object_path.h"
 #include "dbus/property.h"
-#include "device/bluetooth/bluetooth_export.h"
-#include "device/bluetooth/dbus/bluez_dbus_client.h"
 
-namespace bluez {
+namespace chromeos {
 
 // BluetoothMediaClient is used to communicate with the Media interface of a
 // local Bluetooth adapter.
-class DEVICE_BLUETOOTH_EXPORT BluetoothMediaClient : public BluezDBusClient {
+class CHROMEOS_EXPORT BluetoothMediaClient : public DBusClient {
  public:
   // Properties used to register a Media Endpoint.
-  struct DEVICE_BLUETOOTH_EXPORT EndpointProperties {
+  struct CHROMEOS_EXPORT EndpointProperties {
     EndpointProperties();
     ~EndpointProperties();
 
@@ -103,6 +102,6 @@
   DISALLOW_COPY_AND_ASSIGN(BluetoothMediaClient);
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_MEDIA_CLIENT_H_
+#endif  // CHROMEOS_DBUS_BLUETOOTH_MEDIA_CLIENT_H_
diff --git a/device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.cc b/chromeos/dbus/bluetooth_media_endpoint_service_provider.cc
similarity index 95%
rename from device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.cc
rename to chromeos/dbus/bluetooth_media_endpoint_service_provider.cc
index 864a04d..9dd77200 100644
--- a/device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.cc
+++ b/chromeos/dbus/bluetooth_media_endpoint_service_provider.cc
@@ -2,17 +2,17 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.h"
+#include "chromeos/dbus/bluetooth_media_endpoint_service_provider.h"
 
 #include "base/bind.h"
 #include "base/logging.h"
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/threading/platform_thread.h"
+#include "chromeos/dbus/bluetooth_media_transport_client.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
+#include "chromeos/dbus/fake_bluetooth_media_endpoint_service_provider.h"
 #include "dbus/exported_object.h"
-#include "device/bluetooth/dbus/bluetooth_media_transport_client.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
-#include "device/bluetooth/dbus/fake_bluetooth_media_endpoint_service_provider.h"
 
 namespace {
 
@@ -31,10 +31,10 @@
 
 }  // namespace
 
-namespace bluez {
+namespace chromeos {
 
 // The BluetoothMediaEndopintServiceProvider implementation used in production.
-class DEVICE_BLUETOOTH_EXPORT BluetoothMediaEndpointServiceProviderImpl
+class CHROMEOS_EXPORT BluetoothMediaEndpointServiceProviderImpl
     : public BluetoothMediaEndpointServiceProvider {
  public:
   BluetoothMediaEndpointServiceProviderImpl(dbus::Bus* bus,
@@ -302,7 +302,7 @@
     const dbus::ObjectPath& object_path,
     Delegate* delegate) {
   // Returns a real implementation.
-  if (!bluez::BluezDBusManager::Get()->IsUsingStub()) {
+  if (!DBusThreadManager::Get()->IsUsingStub(DBusClientBundle::BLUETOOTH)) {
     return new BluetoothMediaEndpointServiceProviderImpl(bus, object_path,
                                                          delegate);
   }
@@ -310,4 +310,4 @@
   return new FakeBluetoothMediaEndpointServiceProvider(object_path, delegate);
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.h b/chromeos/dbus/bluetooth_media_endpoint_service_provider.h
similarity index 91%
rename from device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.h
rename to chromeos/dbus/bluetooth_media_endpoint_service_provider.h
index d44c065..fffaa533 100644
--- a/device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.h
+++ b/chromeos/dbus/bluetooth_media_endpoint_service_provider.h
@@ -2,20 +2,19 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_MEDIA_ENDPOINT_SERVICE_PROVIDER_H_
-#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_MEDIA_ENDPOINT_SERVICE_PROVIDER_H_
+#ifndef CHROMEOS_DBUS_BLUETOOTH_MEDIA_ENDPOINT_SERVICE_PROVIDER_H_
+#define CHROMEOS_DBUS_BLUETOOTH_MEDIA_ENDPOINT_SERVICE_PROVIDER_H_
 
 #include <string>
 #include <vector>
 
 #include "base/callback.h"
-#include "base/macros.h"
+#include "chromeos/chromeos_export.h"
 #include "dbus/bus.h"
 #include "dbus/message.h"
 #include "dbus/object_path.h"
-#include "device/bluetooth/bluetooth_export.h"
 
-namespace bluez {
+namespace chromeos {
 
 // BluetoothMediaEndpointServiceProvider is used to provide a D-Bus object that
 // the Bluetooth daemon can commuicate with to serve as a media source/sink.
@@ -28,7 +27,7 @@
 // Bluetooth daemon will make calls to this endpoint object and they will be
 // passed to user's Delegate object for handling. For SelectConfiguration method
 // the response is returned using the SelectConfiguration callback.
-class DEVICE_BLUETOOTH_EXPORT BluetoothMediaEndpointServiceProvider {
+class CHROMEOS_EXPORT BluetoothMediaEndpointServiceProvider {
  public:
   // Delegate is the interface for reacting to endpoint requests. User
   // applications will implement this interface to handle either A2DP Sink or
@@ -36,7 +35,7 @@
   class Delegate {
    public:
     // Transport-specific properties.
-    struct DEVICE_BLUETOOTH_EXPORT TransportProperties {
+    struct CHROMEOS_EXPORT TransportProperties {
       TransportProperties();
       ~TransportProperties();
 
@@ -129,6 +128,6 @@
   DISALLOW_COPY_AND_ASSIGN(BluetoothMediaEndpointServiceProvider);
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_MEDIA_ENDPOINT_SERVICE_PROVIDER_H_
+#endif  // CHROMEOS_DBUS_BLUETOOTH_MEDIA_ENDPOINT_SERVICE_PROVIDER_H_
diff --git a/device/bluetooth/dbus/bluetooth_media_transport_client.cc b/chromeos/dbus/bluetooth_media_transport_client.cc
similarity index 98%
rename from device/bluetooth/dbus/bluetooth_media_transport_client.cc
rename to chromeos/dbus/bluetooth_media_transport_client.cc
index 7fc47d7..3117de2 100644
--- a/device/bluetooth/dbus/bluetooth_media_transport_client.cc
+++ b/chromeos/dbus/bluetooth_media_transport_client.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 "device/bluetooth/dbus/bluetooth_media_transport_client.h"
+#include "chromeos/dbus/bluetooth_media_transport_client.h"
 
 #include "base/bind.h"
 #include "base/logging.h"
@@ -31,7 +31,7 @@
 
 }  // namespace
 
-namespace bluez {
+namespace chromeos {
 
 // static
 const char BluetoothMediaTransportClient::kDeviceProperty[] = "Device";
@@ -283,4 +283,4 @@
   return new BluetoothMediaTransportClientImpl();
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/bluetooth_media_transport_client.h b/chromeos/dbus/bluetooth_media_transport_client.h
similarity index 91%
rename from device/bluetooth/dbus/bluetooth_media_transport_client.h
rename to chromeos/dbus/bluetooth_media_transport_client.h
index 09c6ea0..4476ae7a 100644
--- a/device/bluetooth/dbus/bluetooth_media_transport_client.h
+++ b/chromeos/dbus/bluetooth_media_transport_client.h
@@ -2,24 +2,22 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_
-#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_
+#ifndef CHROMEOS_DBUS_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_
+#define CHROMEOS_DBUS_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_
 
 #include <string>
 #include <vector>
 
 #include "base/callback.h"
-#include "base/macros.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/dbus_client.h"
 #include "dbus/file_descriptor.h"
 #include "dbus/object_path.h"
 #include "dbus/property.h"
-#include "device/bluetooth/bluetooth_export.h"
-#include "device/bluetooth/dbus/bluez_dbus_client.h"
 
-namespace bluez {
+namespace chromeos {
 
-class DEVICE_BLUETOOTH_EXPORT BluetoothMediaTransportClient
-    : public BluezDBusClient {
+class CHROMEOS_EXPORT BluetoothMediaTransportClient : public DBusClient {
  public:
   struct Properties : public dbus::PropertySet {
     // The path to the device object which the transport is connected to.
@@ -139,6 +137,6 @@
   DISALLOW_COPY_AND_ASSIGN(BluetoothMediaTransportClient);
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_
+#endif  // CHROMEOS_DBUS_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_
diff --git a/device/bluetooth/dbus/bluetooth_profile_manager_client.cc b/chromeos/dbus/bluetooth_profile_manager_client.cc
similarity index 98%
rename from device/bluetooth/dbus/bluetooth_profile_manager_client.cc
rename to chromeos/dbus/bluetooth_profile_manager_client.cc
index 742988a..01301d4d 100644
--- a/device/bluetooth/dbus/bluetooth_profile_manager_client.cc
+++ b/chromeos/dbus/bluetooth_profile_manager_client.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 "device/bluetooth/dbus/bluetooth_profile_manager_client.h"
+#include "chromeos/dbus/bluetooth_profile_manager_client.h"
 
 #include "base/bind.h"
 #include "base/logging.h"
@@ -11,7 +11,7 @@
 #include "dbus/object_proxy.h"
 #include "third_party/cros_system_api/dbus/service_constants.h"
 
-namespace bluez {
+namespace chromeos {
 
 const char BluetoothProfileManagerClient::kNoResponseError[] =
     "org.chromium.Error.NoResponse";
@@ -231,4 +231,4 @@
   return new BluetoothProfileManagerClientImpl();
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/bluetooth_profile_manager_client.h b/chromeos/dbus/bluetooth_profile_manager_client.h
similarity index 86%
rename from device/bluetooth/dbus/bluetooth_profile_manager_client.h
rename to chromeos/dbus/bluetooth_profile_manager_client.h
index 4b6bd96..8f53412 100644
--- a/device/bluetooth/dbus/bluetooth_profile_manager_client.h
+++ b/chromeos/dbus/bluetooth_profile_manager_client.h
@@ -2,26 +2,24 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_
-#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_
+#ifndef CHROMEOS_DBUS_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_
+#define CHROMEOS_DBUS_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_
 
 #include <string>
 #include <vector>
 
 #include "base/callback.h"
-#include "base/macros.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/values.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/dbus_client.h"
 #include "dbus/object_path.h"
-#include "device/bluetooth/bluetooth_export.h"
-#include "device/bluetooth/dbus/bluez_dbus_client.h"
 
-namespace bluez {
+namespace chromeos {
 
 // BluetoothProfileManagerClient is used to communicate with the profile
 // manager object of the Bluetooth daemon.
-class DEVICE_BLUETOOTH_EXPORT BluetoothProfileManagerClient
-    : public BluezDBusClient {
+class CHROMEOS_EXPORT BluetoothProfileManagerClient : public DBusClient {
  public:
   // Species the role of the object within the profile. SYMMETRIC should be
   // usually used unless the profile requires you specify as a CLIENT or as a
@@ -29,7 +27,7 @@
   enum ProfileRole { SYMMETRIC, CLIENT, SERVER };
 
   // Options used to register a Profile object.
-  struct DEVICE_BLUETOOTH_EXPORT Options {
+  struct CHROMEOS_EXPORT Options {
     Options();
     ~Options();
 
@@ -104,6 +102,6 @@
   DISALLOW_COPY_AND_ASSIGN(BluetoothProfileManagerClient);
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_
+#endif  // CHROMEOS_DBUS_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_
diff --git a/device/bluetooth/dbus/bluetooth_profile_service_provider.cc b/chromeos/dbus/bluetooth_profile_service_provider.cc
similarity index 96%
rename from device/bluetooth/dbus/bluetooth_profile_service_provider.cc
rename to chromeos/dbus/bluetooth_profile_service_provider.cc
index a2a23bb8..f63f5eab 100644
--- a/device/bluetooth/dbus/bluetooth_profile_service_provider.cc
+++ b/chromeos/dbus/bluetooth_profile_service_provider.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 "device/bluetooth/dbus/bluetooth_profile_service_provider.h"
+#include "chromeos/dbus/bluetooth_profile_service_provider.h"
 
 #include "base/bind.h"
 #include "base/logging.h"
 #include "base/memory/ref_counted.h"
 #include "base/threading/platform_thread.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
+#include "chromeos/dbus/fake_bluetooth_profile_service_provider.h"
 #include "dbus/exported_object.h"
 #include "dbus/message.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
-#include "device/bluetooth/dbus/fake_bluetooth_profile_service_provider.h"
 #include "third_party/cros_system_api/dbus/service_constants.h"
 
-namespace bluez {
+namespace chromeos {
 
 // The BluetoothProfileServiceProvider implementation used in production.
 class BluetoothProfileServiceProviderImpl
@@ -238,11 +238,11 @@
     dbus::Bus* bus,
     const dbus::ObjectPath& object_path,
     Delegate* delegate) {
-  if (!bluez::BluezDBusManager::Get()->IsUsingStub()) {
+  if (!DBusThreadManager::Get()->IsUsingStub(DBusClientBundle::BLUETOOTH)) {
     return new BluetoothProfileServiceProviderImpl(bus, object_path, delegate);
   } else {
     return new FakeBluetoothProfileServiceProvider(object_path, delegate);
   }
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/bluetooth_profile_service_provider.h b/chromeos/dbus/bluetooth_profile_service_provider.h
similarity index 91%
rename from device/bluetooth/dbus/bluetooth_profile_service_provider.h
rename to chromeos/dbus/bluetooth_profile_service_provider.h
index f2db22c7..366a354c 100644
--- a/device/bluetooth/dbus/bluetooth_profile_service_provider.h
+++ b/chromeos/dbus/bluetooth_profile_service_provider.h
@@ -2,20 +2,20 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_
-#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_
+#ifndef CHROMEOS_DBUS_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_
+#define CHROMEOS_DBUS_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_
 
 #include <string>
 
 #include "base/basictypes.h"
 #include "base/callback.h"
 #include "base/memory/scoped_ptr.h"
+#include "chromeos/chromeos_export.h"
 #include "dbus/bus.h"
 #include "dbus/file_descriptor.h"
 #include "dbus/object_path.h"
-#include "device/bluetooth/bluetooth_export.h"
 
-namespace bluez {
+namespace chromeos {
 
 // BluetoothProfileServiceProvider is used to provide a D-Bus object that the
 // Bluetooth daemon can communicate with to connect application profiles.
@@ -29,7 +29,7 @@
 // Bluetooth daemon will make calls to this profile object and they will be
 // passed on to your Delegate object for handling. Responses should be returned
 // using the callbacks supplied to those methods.
-class DEVICE_BLUETOOTH_EXPORT BluetoothProfileServiceProvider {
+class CHROMEOS_EXPORT BluetoothProfileServiceProvider {
  public:
   // Interface for reacting to profile requests.
   class Delegate {
@@ -43,7 +43,7 @@
     enum Status { SUCCESS, REJECTED, CANCELLED };
 
     // Connection-specific options.
-    struct DEVICE_BLUETOOTH_EXPORT Options {
+    struct CHROMEOS_EXPORT Options {
       Options() {}
       ~Options() {}
 
@@ -115,6 +115,6 @@
   DISALLOW_COPY_AND_ASSIGN(BluetoothProfileServiceProvider);
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_
+#endif  // CHROMEOS_DBUS_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_
diff --git a/chromeos/dbus/dbus_client_bundle.cc b/chromeos/dbus/dbus_client_bundle.cc
index 0397ff6..941bec6 100644
--- a/chromeos/dbus/dbus_client_bundle.cc
+++ b/chromeos/dbus/dbus_client_bundle.cc
@@ -14,6 +14,18 @@
 #include "chromeos/dbus/ap_manager_client.h"
 #include "chromeos/dbus/arc_bridge_client.h"
 #include "chromeos/dbus/audio_dsp_client.h"
+#include "chromeos/dbus/bluetooth_adapter_client.h"
+#include "chromeos/dbus/bluetooth_agent_manager_client.h"
+#include "chromeos/dbus/bluetooth_device_client.h"
+#include "chromeos/dbus/bluetooth_gatt_characteristic_client.h"
+#include "chromeos/dbus/bluetooth_gatt_descriptor_client.h"
+#include "chromeos/dbus/bluetooth_gatt_manager_client.h"
+#include "chromeos/dbus/bluetooth_gatt_service_client.h"
+#include "chromeos/dbus/bluetooth_input_client.h"
+#include "chromeos/dbus/bluetooth_le_advertising_manager_client.h"
+#include "chromeos/dbus/bluetooth_media_client.h"
+#include "chromeos/dbus/bluetooth_media_transport_client.h"
+#include "chromeos/dbus/bluetooth_profile_manager_client.h"
 #include "chromeos/dbus/cras_audio_client.h"
 #include "chromeos/dbus/cros_disks_client.h"
 #include "chromeos/dbus/cryptohome_client.h"
@@ -23,6 +35,18 @@
 #include "chromeos/dbus/fake_ap_manager_client.h"
 #include "chromeos/dbus/fake_arc_bridge_client.h"
 #include "chromeos/dbus/fake_audio_dsp_client.h"
+#include "chromeos/dbus/fake_bluetooth_adapter_client.h"
+#include "chromeos/dbus/fake_bluetooth_agent_manager_client.h"
+#include "chromeos/dbus/fake_bluetooth_device_client.h"
+#include "chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h"
+#include "chromeos/dbus/fake_bluetooth_gatt_descriptor_client.h"
+#include "chromeos/dbus/fake_bluetooth_gatt_manager_client.h"
+#include "chromeos/dbus/fake_bluetooth_gatt_service_client.h"
+#include "chromeos/dbus/fake_bluetooth_input_client.h"
+#include "chromeos/dbus/fake_bluetooth_le_advertising_manager_client.h"
+#include "chromeos/dbus/fake_bluetooth_media_client.h"
+#include "chromeos/dbus/fake_bluetooth_media_transport_client.h"
+#include "chromeos/dbus/fake_bluetooth_profile_manager_client.h"
 #include "chromeos/dbus/fake_cras_audio_client.h"
 #include "chromeos/dbus/fake_cryptohome_client.h"
 #include "chromeos/dbus/fake_debug_daemon_client.h"
@@ -141,6 +165,45 @@
   else
     audio_dsp_client_.reset(new FakeAudioDspClient);
 
+  if (!IsUsingStub(BLUETOOTH)) {
+    bluetooth_adapter_client_.reset(BluetoothAdapterClient::Create());
+    bluetooth_le_advertising_manager_client_.reset(
+        BluetoothLEAdvertisingManagerClient::Create());
+    bluetooth_agent_manager_client_.reset(
+        BluetoothAgentManagerClient::Create());
+    bluetooth_device_client_.reset(BluetoothDeviceClient::Create());
+    bluetooth_input_client_.reset(BluetoothInputClient::Create());
+    bluetooth_media_client_.reset(BluetoothMediaClient::Create());
+    bluetooth_media_transport_client_.reset(
+        BluetoothMediaTransportClient::Create());
+    bluetooth_profile_manager_client_.reset(
+        BluetoothProfileManagerClient::Create());
+    bluetooth_gatt_characteristic_client_.reset(
+        BluetoothGattCharacteristicClient::Create());
+    bluetooth_gatt_descriptor_client_.reset(
+        BluetoothGattDescriptorClient::Create());
+    bluetooth_gatt_manager_client_.reset(BluetoothGattManagerClient::Create());
+    bluetooth_gatt_service_client_.reset(BluetoothGattServiceClient::Create());
+  } else {
+    bluetooth_adapter_client_.reset(new FakeBluetoothAdapterClient);
+    bluetooth_le_advertising_manager_client_.reset(
+        new FakeBluetoothLEAdvertisingManagerClient);
+    bluetooth_agent_manager_client_.reset(new FakeBluetoothAgentManagerClient);
+    bluetooth_device_client_.reset(new FakeBluetoothDeviceClient);
+    bluetooth_input_client_.reset(new FakeBluetoothInputClient);
+    bluetooth_media_client_.reset(new FakeBluetoothMediaClient);
+    bluetooth_media_transport_client_.reset(
+        new FakeBluetoothMediaTransportClient);
+    bluetooth_profile_manager_client_.reset(
+        new FakeBluetoothProfileManagerClient);
+    bluetooth_gatt_characteristic_client_.reset(
+        new FakeBluetoothGattCharacteristicClient);
+    bluetooth_gatt_descriptor_client_.reset(
+        new FakeBluetoothGattDescriptorClient);
+    bluetooth_gatt_manager_client_.reset(new FakeBluetoothGattManagerClient);
+    bluetooth_gatt_service_client_.reset(new FakeBluetoothGattServiceClient);
+  }
+
   if (!IsUsingStub(CRAS))
     cras_audio_client_.reset(CrasAudioClient::Create());
   else
diff --git a/chromeos/dbus/dbus_client_bundle.h b/chromeos/dbus/dbus_client_bundle.h
index 2fd9e58..536eb4d 100644
--- a/chromeos/dbus/dbus_client_bundle.h
+++ b/chromeos/dbus/dbus_client_bundle.h
@@ -16,6 +16,18 @@
 class ApManagerClient;
 class ArcBridgeClient;
 class AudioDspClient;
+class BluetoothAdapterClient;
+class BluetoothAgentManagerClient;
+class BluetoothDeviceClient;
+class BluetoothGattCharacteristicClient;
+class BluetoothGattDescriptorClient;
+class BluetoothGattManagerClient;
+class BluetoothGattServiceClient;
+class BluetoothInputClient;
+class BluetoothLEAdvertisingManagerClient;
+class BluetoothMediaClient;
+class BluetoothMediaTransportClient;
+class BluetoothProfileManagerClient;
 class CrasAudioClient;
 class CrosDisksClient;
 class CryptohomeClient;
@@ -108,6 +120,55 @@
 
   AudioDspClient* audio_dsp_client() { return audio_dsp_client_.get(); }
 
+  BluetoothAdapterClient* bluetooth_adapter_client() {
+    return bluetooth_adapter_client_.get();
+  }
+
+  BluetoothLEAdvertisingManagerClient*
+  bluetooth_le_advertising_manager_client() {
+    return bluetooth_le_advertising_manager_client_.get();
+  }
+
+  BluetoothAgentManagerClient* bluetooth_agent_manager_client() {
+    return bluetooth_agent_manager_client_.get();
+  }
+
+  BluetoothDeviceClient* bluetooth_device_client() {
+    return bluetooth_device_client_.get();
+  }
+
+  BluetoothGattCharacteristicClient* bluetooth_gatt_characteristic_client() {
+    return bluetooth_gatt_characteristic_client_.get();
+  }
+
+  BluetoothGattDescriptorClient* bluetooth_gatt_descriptor_client() {
+    return bluetooth_gatt_descriptor_client_.get();
+  }
+
+  BluetoothGattManagerClient* bluetooth_gatt_manager_client() {
+    return bluetooth_gatt_manager_client_.get();
+  }
+
+  BluetoothGattServiceClient* bluetooth_gatt_service_client() {
+    return bluetooth_gatt_service_client_.get();
+  }
+
+  BluetoothInputClient* bluetooth_input_client() {
+    return bluetooth_input_client_.get();
+  }
+
+  BluetoothMediaClient* bluetooth_media_client() {
+    return bluetooth_media_client_.get();
+  }
+
+  BluetoothMediaTransportClient* bluetooth_media_transport_client() {
+    return bluetooth_media_transport_client_.get();
+  }
+
+  BluetoothProfileManagerClient* bluetooth_profile_manager_client() {
+    return bluetooth_profile_manager_client_.get();
+  }
+
   CrasAudioClient* cras_audio_client() {
     return cras_audio_client_.get();
   }
@@ -235,6 +296,20 @@
   scoped_ptr<ApManagerClient> ap_manager_client_;
   scoped_ptr<ArcBridgeClient> arc_bridge_client_;
   scoped_ptr<AudioDspClient> audio_dsp_client_;
+  scoped_ptr<BluetoothAdapterClient> bluetooth_adapter_client_;
+  scoped_ptr<BluetoothLEAdvertisingManagerClient>
+      bluetooth_le_advertising_manager_client_;
+  scoped_ptr<BluetoothAgentManagerClient> bluetooth_agent_manager_client_;
+  scoped_ptr<BluetoothDeviceClient> bluetooth_device_client_;
+  scoped_ptr<BluetoothGattCharacteristicClient>
+      bluetooth_gatt_characteristic_client_;
+  scoped_ptr<BluetoothGattDescriptorClient> bluetooth_gatt_descriptor_client_;
+  scoped_ptr<BluetoothGattManagerClient> bluetooth_gatt_manager_client_;
+  scoped_ptr<BluetoothGattServiceClient> bluetooth_gatt_service_client_;
+  scoped_ptr<BluetoothInputClient> bluetooth_input_client_;
+  scoped_ptr<BluetoothMediaClient> bluetooth_media_client_;
+  scoped_ptr<BluetoothMediaTransportClient> bluetooth_media_transport_client_;
+  scoped_ptr<BluetoothProfileManagerClient> bluetooth_profile_manager_client_;
   scoped_ptr<CrasAudioClient> cras_audio_client_;
   scoped_ptr<CrosDisksClient> cros_disks_client_;
   scoped_ptr<CryptohomeClient> cryptohome_client_;
diff --git a/chromeos/dbus/dbus_thread_manager.cc b/chromeos/dbus/dbus_thread_manager.cc
index ab8db4f..af03c1f 100644
--- a/chromeos/dbus/dbus_thread_manager.cc
+++ b/chromeos/dbus/dbus_thread_manager.cc
@@ -12,6 +12,18 @@
 #include "chromeos/dbus/ap_manager_client.h"
 #include "chromeos/dbus/arc_bridge_client.h"
 #include "chromeos/dbus/audio_dsp_client.h"
+#include "chromeos/dbus/bluetooth_adapter_client.h"
+#include "chromeos/dbus/bluetooth_agent_manager_client.h"
+#include "chromeos/dbus/bluetooth_device_client.h"
+#include "chromeos/dbus/bluetooth_gatt_characteristic_client.h"
+#include "chromeos/dbus/bluetooth_gatt_descriptor_client.h"
+#include "chromeos/dbus/bluetooth_gatt_manager_client.h"
+#include "chromeos/dbus/bluetooth_gatt_service_client.h"
+#include "chromeos/dbus/bluetooth_input_client.h"
+#include "chromeos/dbus/bluetooth_le_advertising_manager_client.h"
+#include "chromeos/dbus/bluetooth_media_client.h"
+#include "chromeos/dbus/bluetooth_media_transport_client.h"
+#include "chromeos/dbus/bluetooth_profile_manager_client.h"
 #include "chromeos/dbus/cras_audio_client.h"
 #include "chromeos/dbus/cros_disks_client.h"
 #include "chromeos/dbus/cryptohome_client.h"
@@ -120,6 +132,60 @@
   return client_bundle_->audio_dsp_client();
 }
 
+BluetoothAdapterClient* DBusThreadManager::GetBluetoothAdapterClient() {
+  return client_bundle_->bluetooth_adapter_client();
+}
+
+BluetoothLEAdvertisingManagerClient*
+DBusThreadManager::GetBluetoothLEAdvertisingManagerClient() {
+  return client_bundle_->bluetooth_le_advertising_manager_client();
+}
+
+BluetoothAgentManagerClient*
+DBusThreadManager::GetBluetoothAgentManagerClient() {
+  return client_bundle_->bluetooth_agent_manager_client();
+}
+
+BluetoothDeviceClient* DBusThreadManager::GetBluetoothDeviceClient() {
+  return client_bundle_->bluetooth_device_client();
+}
+
+BluetoothGattCharacteristicClient*
+DBusThreadManager::GetBluetoothGattCharacteristicClient() {
+  return client_bundle_->bluetooth_gatt_characteristic_client();
+}
+
+BluetoothGattDescriptorClient*
+DBusThreadManager::GetBluetoothGattDescriptorClient() {
+  return client_bundle_->bluetooth_gatt_descriptor_client();
+}
+
+BluetoothGattManagerClient* DBusThreadManager::GetBluetoothGattManagerClient() {
+  return client_bundle_->bluetooth_gatt_manager_client();
+}
+
+BluetoothGattServiceClient* DBusThreadManager::GetBluetoothGattServiceClient() {
+  return client_bundle_->bluetooth_gatt_service_client();
+}
+
+BluetoothInputClient* DBusThreadManager::GetBluetoothInputClient() {
+  return client_bundle_->bluetooth_input_client();
+}
+
+BluetoothMediaClient* DBusThreadManager::GetBluetoothMediaClient() {
+  return client_bundle_->bluetooth_media_client();
+}
+
+BluetoothMediaTransportClient*
+DBusThreadManager::GetBluetoothMediaTransportClient() {
+  return client_bundle_->bluetooth_media_transport_client();
+}
+
+BluetoothProfileManagerClient*
+DBusThreadManager::GetBluetoothProfileManagerClient() {
+  return client_bundle_->bluetooth_profile_manager_client();
+}
+
 CrasAudioClient* DBusThreadManager::GetCrasAudioClient() {
   return client_bundle_->cras_audio_client();
 }
@@ -248,6 +314,18 @@
   GetApManagerClient()->Init(GetSystemBus());
   GetArcBridgeClient()->Init(GetSystemBus());
   GetAudioDspClient()->Init(GetSystemBus());
+  GetBluetoothAdapterClient()->Init(GetSystemBus());
+  GetBluetoothAgentManagerClient()->Init(GetSystemBus());
+  GetBluetoothDeviceClient()->Init(GetSystemBus());
+  GetBluetoothGattCharacteristicClient()->Init(GetSystemBus());
+  GetBluetoothGattDescriptorClient()->Init(GetSystemBus());
+  GetBluetoothGattManagerClient()->Init(GetSystemBus());
+  GetBluetoothGattServiceClient()->Init(GetSystemBus());
+  GetBluetoothInputClient()->Init(GetSystemBus());
+  GetBluetoothLEAdvertisingManagerClient()->Init(GetSystemBus());
+  GetBluetoothMediaClient()->Init(GetSystemBus());
+  GetBluetoothMediaTransportClient()->Init(GetSystemBus());
+  GetBluetoothProfileManagerClient()->Init(GetSystemBus());
   GetCrasAudioClient()->Init(GetSystemBus());
   GetCrosDisksClient()->Init(GetSystemBus());
   GetCryptohomeClient()->Init(GetSystemBus());
@@ -407,6 +485,79 @@
   DBusThreadManager::Get()->client_bundle_->audio_dsp_client_ = client.Pass();
 }
 
+void DBusThreadManagerSetter::SetBluetoothAdapterClient(
+    scoped_ptr<BluetoothAdapterClient> client) {
+  DBusThreadManager::Get()->client_bundle_->bluetooth_adapter_client_ =
+      client.Pass();
+}
+
+void DBusThreadManagerSetter::SetBluetoothLEAdvertisingManagerClient(
+    scoped_ptr<BluetoothLEAdvertisingManagerClient> client) {
+  DBusThreadManager::Get()
+      ->client_bundle_->bluetooth_le_advertising_manager_client_ =
+      client.Pass();
+}
+
+void DBusThreadManagerSetter::SetBluetoothAgentManagerClient(
+    scoped_ptr<BluetoothAgentManagerClient> client) {
+  DBusThreadManager::Get()->client_bundle_->bluetooth_agent_manager_client_ =
+      client.Pass();
+}
+
+void DBusThreadManagerSetter::SetBluetoothDeviceClient(
+    scoped_ptr<BluetoothDeviceClient> client) {
+  DBusThreadManager::Get()->client_bundle_->bluetooth_device_client_ =
+      client.Pass();
+}
+
+void DBusThreadManagerSetter::SetBluetoothGattCharacteristicClient(
+    scoped_ptr<BluetoothGattCharacteristicClient> client) {
+  DBusThreadManager::Get()
+      ->client_bundle_->bluetooth_gatt_characteristic_client_ = client.Pass();
+}
+
+void DBusThreadManagerSetter::SetBluetoothGattDescriptorClient(
+    scoped_ptr<BluetoothGattDescriptorClient> client) {
+  DBusThreadManager::Get()->client_bundle_->bluetooth_gatt_descriptor_client_ =
+      client.Pass();
+}
+
+void DBusThreadManagerSetter::SetBluetoothGattManagerClient(
+    scoped_ptr<BluetoothGattManagerClient> client) {
+  DBusThreadManager::Get()->client_bundle_->bluetooth_gatt_manager_client_ =
+      client.Pass();
+}
+
+void DBusThreadManagerSetter::SetBluetoothGattServiceClient(
+    scoped_ptr<BluetoothGattServiceClient> client) {
+  DBusThreadManager::Get()->client_bundle_->bluetooth_gatt_service_client_ =
+      client.Pass();
+}
+
+void DBusThreadManagerSetter::SetBluetoothInputClient(
+    scoped_ptr<BluetoothInputClient> client) {
+  DBusThreadManager::Get()->client_bundle_->bluetooth_input_client_ =
+      client.Pass();
+}
+
+void DBusThreadManagerSetter::SetBluetoothMediaClient(
+    scoped_ptr<BluetoothMediaClient> client) {
+  DBusThreadManager::Get()->client_bundle_->bluetooth_media_client_ =
+      client.Pass();
+}
+
+void DBusThreadManagerSetter::SetBluetoothMediaTransportClient(
+    scoped_ptr<BluetoothMediaTransportClient> client) {
+  DBusThreadManager::Get()->client_bundle_->bluetooth_media_transport_client_ =
+      client.Pass();
+}
+
+void DBusThreadManagerSetter::SetBluetoothProfileManagerClient(
+    scoped_ptr<BluetoothProfileManagerClient> client) {
+  DBusThreadManager::Get()->client_bundle_->bluetooth_profile_manager_client_ =
+      client.Pass();
+}
+
 void DBusThreadManagerSetter::SetCrasAudioClient(
     scoped_ptr<CrasAudioClient> client) {
   DBusThreadManager::Get()->client_bundle_->cras_audio_client_ = client.Pass();
diff --git a/chromeos/dbus/dbus_thread_manager.h b/chromeos/dbus/dbus_thread_manager.h
index eaf9109f..b002c9f 100644
--- a/chromeos/dbus/dbus_thread_manager.h
+++ b/chromeos/dbus/dbus_thread_manager.h
@@ -29,6 +29,18 @@
 class ApManagerClient;
 class ArcBridgeClient;
 class AudioDspClient;
+class BluetoothAdapterClient;
+class BluetoothLEAdvertisingManagerClient;
+class BluetoothAgentManagerClient;
+class BluetoothDeviceClient;
+class BluetoothGattCharacteristicClient;
+class BluetoothGattDescriptorClient;
+class BluetoothGattManagerClient;
+class BluetoothGattServiceClient;
+class BluetoothInputClient;
+class BluetoothMediaClient;
+class BluetoothMediaTransportClient;
+class BluetoothProfileManagerClient;
 class CrasAudioClient;
 class CrosDisksClient;
 class CryptohomeClient;
@@ -114,6 +126,18 @@
   ApManagerClient* GetApManagerClient();
   ArcBridgeClient* GetArcBridgeClient();
   AudioDspClient* GetAudioDspClient();
+  BluetoothAdapterClient* GetBluetoothAdapterClient();
+  BluetoothLEAdvertisingManagerClient* GetBluetoothLEAdvertisingManagerClient();
+  BluetoothAgentManagerClient* GetBluetoothAgentManagerClient();
+  BluetoothDeviceClient* GetBluetoothDeviceClient();
+  BluetoothGattCharacteristicClient* GetBluetoothGattCharacteristicClient();
+  BluetoothGattDescriptorClient* GetBluetoothGattDescriptorClient();
+  BluetoothGattManagerClient* GetBluetoothGattManagerClient();
+  BluetoothGattServiceClient* GetBluetoothGattServiceClient();
+  BluetoothInputClient* GetBluetoothInputClient();
+  BluetoothMediaClient* GetBluetoothMediaClient();
+  BluetoothMediaTransportClient* GetBluetoothMediaTransportClient();
+  BluetoothProfileManagerClient* GetBluetoothProfileManagerClient();
   CrasAudioClient* GetCrasAudioClient();
   CrosDisksClient* GetCrosDisksClient();
   CryptohomeClient* GetCryptohomeClient();
@@ -189,6 +213,26 @@
   void SetAmplifierClient(scoped_ptr<AmplifierClient> client);
   void SetArcBridgeClient(scoped_ptr<ArcBridgeClient> client);
   void SetAudioDspClient(scoped_ptr<AudioDspClient> client);
+  void SetBluetoothAdapterClient(scoped_ptr<BluetoothAdapterClient> client);
+  void SetBluetoothLEAdvertisingManagerClient(
+      scoped_ptr<BluetoothLEAdvertisingManagerClient> client);
+  void SetBluetoothAgentManagerClient(
+      scoped_ptr<BluetoothAgentManagerClient> client);
+  void SetBluetoothDeviceClient(scoped_ptr<BluetoothDeviceClient> client);
+  void SetBluetoothGattCharacteristicClient(
+      scoped_ptr<BluetoothGattCharacteristicClient> client);
+  void SetBluetoothGattDescriptorClient(
+      scoped_ptr<BluetoothGattDescriptorClient> client);
+  void SetBluetoothGattManagerClient(
+      scoped_ptr<BluetoothGattManagerClient> client);
+  void SetBluetoothGattServiceClient(
+      scoped_ptr<BluetoothGattServiceClient> client);
+  void SetBluetoothInputClient(scoped_ptr<BluetoothInputClient> client);
+  void SetBluetoothMediaClient(scoped_ptr<BluetoothMediaClient> client);
+  void SetBluetoothMediaTransportClient(
+      scoped_ptr<BluetoothMediaTransportClient> client);
+  void SetBluetoothProfileManagerClient(
+      scoped_ptr<BluetoothProfileManagerClient> client);
   void SetCrasAudioClient(scoped_ptr<CrasAudioClient> client);
   void SetCrosDisksClient(scoped_ptr<CrosDisksClient> client);
   void SetCryptohomeClient(scoped_ptr<CryptohomeClient> client);
diff --git a/device/bluetooth/dbus/fake_bluetooth_adapter_client.cc b/chromeos/dbus/fake_bluetooth_adapter_client.cc
similarity index 95%
rename from device/bluetooth/dbus/fake_bluetooth_adapter_client.cc
rename to chromeos/dbus/fake_bluetooth_adapter_client.cc
index f928768..1ff4bccf 100644
--- a/device/bluetooth/dbus/fake_bluetooth_adapter_client.cc
+++ b/chromeos/dbus/fake_bluetooth_adapter_client.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 "device/bluetooth/dbus/fake_bluetooth_adapter_client.h"
+#include "chromeos/dbus/fake_bluetooth_adapter_client.h"
 
 #include "base/location.h"
 #include "base/logging.h"
 #include "base/single_thread_task_runner.h"
 #include "base/thread_task_runner_handle.h"
 #include "base/time/time.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
-#include "device/bluetooth/dbus/fake_bluetooth_device_client.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
+#include "chromeos/dbus/fake_bluetooth_device_client.h"
 #include "third_party/cros_system_api/dbus/service_constants.h"
 
-namespace bluez {
+namespace chromeos {
 
 namespace {
 
@@ -139,7 +139,7 @@
 
     FakeBluetoothDeviceClient* device_client =
         static_cast<FakeBluetoothDeviceClient*>(
-            bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient());
+            DBusThreadManager::Get()->GetBluetoothDeviceClient());
     device_client->BeginDiscoverySimulation(dbus::ObjectPath(kAdapterPath));
   }
 }
@@ -167,7 +167,7 @@
   if (discovering_count_ == 0) {
     FakeBluetoothDeviceClient* device_client =
         static_cast<FakeBluetoothDeviceClient*>(
-            bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient());
+            DBusThreadManager::Get()->GetBluetoothDeviceClient());
     device_client->EndDiscoverySimulation(dbus::ObjectPath(kAdapterPath));
 
     if (simulation_interval_ms_ > 100) {
@@ -196,7 +196,7 @@
 
   FakeBluetoothDeviceClient* device_client =
       static_cast<FakeBluetoothDeviceClient*>(
-          bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient());
+          DBusThreadManager::Get()->GetBluetoothDeviceClient());
   device_client->RemoveDevice(dbus::ObjectPath(kAdapterPath), device_path);
 }
 
@@ -293,4 +293,4 @@
       base::TimeDelta::FromMilliseconds(simulation_interval_ms_));
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/fake_bluetooth_adapter_client.h b/chromeos/dbus/fake_bluetooth_adapter_client.h
similarity index 90%
rename from device/bluetooth/dbus/fake_bluetooth_adapter_client.h
rename to chromeos/dbus/fake_bluetooth_adapter_client.h
index 0dced89c..987fc6f 100644
--- a/device/bluetooth/dbus/fake_bluetooth_adapter_client.h
+++ b/chromeos/dbus/fake_bluetooth_adapter_client.h
@@ -2,25 +2,25 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_ADAPTER_CLIENT_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_ADAPTER_CLIENT_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_ADAPTER_CLIENT_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_ADAPTER_CLIENT_H_
 
 #include <vector>
 
 #include "base/bind.h"
 #include "base/callback.h"
 #include "base/observer_list.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/bluetooth_adapter_client.h"
 #include "dbus/object_path.h"
 #include "dbus/property.h"
-#include "device/bluetooth/bluetooth_export.h"
-#include "device/bluetooth/dbus/bluetooth_adapter_client.h"
 
-namespace bluez {
+namespace chromeos {
 
 // FakeBluetoothAdapterClient simulates the behavior of the Bluetooth Daemon
 // adapter objects and is used both in test cases in place of a mock and on
 // the Linux desktop.
-class DEVICE_BLUETOOTH_EXPORT FakeBluetoothAdapterClient
+class CHROMEOS_EXPORT FakeBluetoothAdapterClient
     : public BluetoothAdapterClient {
  public:
   struct Properties : public BluetoothAdapterClient::Properties {
@@ -113,6 +113,6 @@
   int simulation_interval_ms_;
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_ADAPTER_CLIENT_H_
+#endif  // CHROMEOS_DBUS_FAKE_BLUETOOTH_ADAPTER_CLIENT_H_
diff --git a/device/bluetooth/dbus/fake_bluetooth_agent_manager_client.cc b/chromeos/dbus/fake_bluetooth_agent_manager_client.cc
similarity index 92%
rename from device/bluetooth/dbus/fake_bluetooth_agent_manager_client.cc
rename to chromeos/dbus/fake_bluetooth_agent_manager_client.cc
index 59044412..4ced274 100644
--- a/device/bluetooth/dbus/fake_bluetooth_agent_manager_client.cc
+++ b/chromeos/dbus/fake_bluetooth_agent_manager_client.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 "device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h"
+#include "chromeos/dbus/fake_bluetooth_agent_manager_client.h"
 
 #include "base/logging.h"
-#include "device/bluetooth/dbus/fake_bluetooth_agent_service_provider.h"
+#include "chromeos/dbus/fake_bluetooth_agent_service_provider.h"
 #include "third_party/cros_system_api/dbus/service_constants.h"
 
-namespace bluez {
+namespace chromeos {
 
 FakeBluetoothAgentManagerClient::FakeBluetoothAgentManagerClient()
     : service_provider_(NULL) {}
@@ -75,4 +75,4 @@
   return service_provider_;
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h b/chromeos/dbus/fake_bluetooth_agent_manager_client.h
similarity index 81%
rename from device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h
rename to chromeos/dbus/fake_bluetooth_agent_manager_client.h
index d5c83cf..68c91202c3 100644
--- a/device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h
+++ b/chromeos/dbus/fake_bluetooth_agent_manager_client.h
@@ -2,25 +2,25 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_AGENT_MANAGER_CLIENT_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_AGENT_MANAGER_CLIENT_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_AGENT_MANAGER_CLIENT_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_AGENT_MANAGER_CLIENT_H_
 
 #include "base/bind.h"
 #include "base/callback.h"
 #include "base/observer_list.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/bluetooth_agent_manager_client.h"
 #include "dbus/object_path.h"
 #include "dbus/property.h"
-#include "device/bluetooth/bluetooth_export.h"
-#include "device/bluetooth/dbus/bluetooth_agent_manager_client.h"
 
-namespace bluez {
+namespace chromeos {
 
 class FakeBluetoothAgentServiceProvider;
 
 // FakeBluetoothAgentManagerClient simulates the behavior of the Bluetooth
 // Daemon's agent manager object and is used both in test cases in place of a
 // mock and on the Linux desktop.
-class DEVICE_BLUETOOTH_EXPORT FakeBluetoothAgentManagerClient
+class CHROMEOS_EXPORT FakeBluetoothAgentManagerClient
     : public BluetoothAgentManagerClient {
  public:
   FakeBluetoothAgentManagerClient();
@@ -52,6 +52,6 @@
   FakeBluetoothAgentServiceProvider* service_provider_;
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_AGENT_MANAGER_CLIENT_H_
+#endif  // CHROMEOS_DBUS_FAKE_BLUETOOTH_AGENT_MANAGER_CLIENT_H_
diff --git a/device/bluetooth/dbus/fake_bluetooth_agent_service_provider.cc b/chromeos/dbus/fake_bluetooth_agent_service_provider.cc
similarity index 89%
rename from device/bluetooth/dbus/fake_bluetooth_agent_service_provider.cc
rename to chromeos/dbus/fake_bluetooth_agent_service_provider.cc
index 777deb0e0..de2dbd3 100644
--- a/device/bluetooth/dbus/fake_bluetooth_agent_service_provider.cc
+++ b/chromeos/dbus/fake_bluetooth_agent_service_provider.cc
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "device/bluetooth/dbus/fake_bluetooth_agent_service_provider.h"
+#include "chromeos/dbus/fake_bluetooth_agent_service_provider.h"
 
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
-#include "device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
+#include "chromeos/dbus/fake_bluetooth_agent_manager_client.h"
 
-namespace bluez {
+namespace chromeos {
 
 FakeBluetoothAgentServiceProvider::FakeBluetoothAgentServiceProvider(
     const dbus::ObjectPath& object_path,
@@ -17,7 +17,7 @@
 
   FakeBluetoothAgentManagerClient* fake_bluetooth_agent_manager_client =
       static_cast<FakeBluetoothAgentManagerClient*>(
-          bluez::BluezDBusManager::Get()->GetBluetoothAgentManagerClient());
+          DBusThreadManager::Get()->GetBluetoothAgentManagerClient());
   fake_bluetooth_agent_manager_client->RegisterAgentServiceProvider(this);
 }
 
@@ -26,7 +26,7 @@
 
   FakeBluetoothAgentManagerClient* fake_bluetooth_agent_manager_client =
       static_cast<FakeBluetoothAgentManagerClient*>(
-          bluez::BluezDBusManager::Get()->GetBluetoothAgentManagerClient());
+          DBusThreadManager::Get()->GetBluetoothAgentManagerClient());
   fake_bluetooth_agent_manager_client->UnregisterAgentServiceProvider(this);
 }
 
@@ -99,4 +99,4 @@
   delegate_->Cancel();
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/fake_bluetooth_agent_service_provider.h b/chromeos/dbus/fake_bluetooth_agent_service_provider.h
similarity index 84%
rename from device/bluetooth/dbus/fake_bluetooth_agent_service_provider.h
rename to chromeos/dbus/fake_bluetooth_agent_service_provider.h
index e3c8cd4..6d17519a 100644
--- a/device/bluetooth/dbus/fake_bluetooth_agent_service_provider.h
+++ b/chromeos/dbus/fake_bluetooth_agent_service_provider.h
@@ -2,25 +2,25 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_
 
 #include "base/bind.h"
 #include "base/callback.h"
 #include "base/observer_list.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/bluetooth_agent_service_provider.h"
 #include "dbus/object_path.h"
 #include "dbus/property.h"
-#include "device/bluetooth/bluetooth_export.h"
-#include "device/bluetooth/dbus/bluetooth_agent_service_provider.h"
 
-namespace bluez {
+namespace chromeos {
 
 class FakeBluetoothAgentManagerClient;
 
 // FakeBluetoothAgentServiceProvider simulates the behavior of a local
 // Bluetooth agent object and is used both in test cases in place of a
 // mock and on the Linux desktop.
-class DEVICE_BLUETOOTH_EXPORT FakeBluetoothAgentServiceProvider
+class CHROMEOS_EXPORT FakeBluetoothAgentServiceProvider
     : public BluetoothAgentServiceProvider {
  public:
   FakeBluetoothAgentServiceProvider(const dbus::ObjectPath& object_path,
@@ -63,6 +63,6 @@
   Delegate* delegate_;
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_
+#endif  // CHROMEOS_DBUS_FAKE_BLUETOOTH_AGENT_SERVICE_PROVIDER_H_
diff --git a/device/bluetooth/dbus/fake_bluetooth_device_client.cc b/chromeos/dbus/fake_bluetooth_device_client.cc
similarity index 97%
rename from device/bluetooth/dbus/fake_bluetooth_device_client.cc
rename to chromeos/dbus/fake_bluetooth_device_client.cc
index 83d31dd4..1aa01a5 100644
--- a/device/bluetooth/dbus/fake_bluetooth_device_client.cc
+++ b/chromeos/dbus/fake_bluetooth_device_client.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 "device/bluetooth/dbus/fake_bluetooth_device_client.h"
+#include "chromeos/dbus/fake_bluetooth_device_client.h"
 
 #include <fcntl.h>
 #include <sys/socket.h>
@@ -22,15 +22,15 @@
 #include "base/thread_task_runner_handle.h"
 #include "base/threading/worker_pool.h"
 #include "base/time/time.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
+#include "chromeos/dbus/fake_bluetooth_adapter_client.h"
+#include "chromeos/dbus/fake_bluetooth_agent_manager_client.h"
+#include "chromeos/dbus/fake_bluetooth_agent_service_provider.h"
+#include "chromeos/dbus/fake_bluetooth_gatt_service_client.h"
+#include "chromeos/dbus/fake_bluetooth_input_client.h"
+#include "chromeos/dbus/fake_bluetooth_profile_manager_client.h"
+#include "chromeos/dbus/fake_bluetooth_profile_service_provider.h"
 #include "dbus/file_descriptor.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
-#include "device/bluetooth/dbus/fake_bluetooth_adapter_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_agent_service_provider.h"
-#include "device/bluetooth/dbus/fake_bluetooth_gatt_service_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_input_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_profile_manager_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_profile_service_provider.h"
 #include "third_party/cros_system_api/dbus/service_constants.h"
 
 namespace {
@@ -94,7 +94,7 @@
 
 }  // namespace
 
-namespace bluez {
+namespace chromeos {
 
 const char FakeBluetoothDeviceClient::kTestPinCode[] = "123456";
 const int FakeBluetoothDeviceClient::kTestPassKey = 123456;
@@ -387,7 +387,7 @@
   if (object_path == dbus::ObjectPath(kLowEnergyPath)) {
     FakeBluetoothGattServiceClient* gatt_service_client =
         static_cast<FakeBluetoothGattServiceClient*>(
-            bluez::BluezDBusManager::Get()->GetBluetoothGattServiceClient());
+            DBusThreadManager::Get()->GetBluetoothGattServiceClient());
     gatt_service_client->ExposeHeartRateService(
         dbus::ObjectPath(kLowEnergyPath));
     properties->gatt_services.ReplaceValue(gatt_service_client->GetServices());
@@ -412,7 +412,7 @@
   if (object_path == dbus::ObjectPath(kLowEnergyPath)) {
     FakeBluetoothGattServiceClient* gatt_service_client =
         static_cast<FakeBluetoothGattServiceClient*>(
-            bluez::BluezDBusManager::Get()->GetBluetoothGattServiceClient());
+            DBusThreadManager::Get()->GetBluetoothGattServiceClient());
     gatt_service_client->HideHeartRateService();
   }
 
@@ -429,7 +429,7 @@
 
   FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client =
       static_cast<FakeBluetoothProfileManagerClient*>(
-          bluez::BluezDBusManager::Get()->GetBluetoothProfileManagerClient());
+          DBusThreadManager::Get()->GetBluetoothProfileManagerClient());
   FakeBluetoothProfileServiceProvider* profile_service_provider =
       fake_bluetooth_profile_manager_client->GetProfileServiceProvider(uuid);
   if (profile_service_provider == NULL) {
@@ -492,7 +492,7 @@
 
   FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client =
       static_cast<FakeBluetoothProfileManagerClient*>(
-          bluez::BluezDBusManager::Get()->GetBluetoothProfileManagerClient());
+          DBusThreadManager::Get()->GetBluetoothProfileManagerClient());
   FakeBluetoothProfileServiceProvider* profile_service_provider =
       fake_bluetooth_profile_manager_client->GetProfileServiceProvider(uuid);
   if (profile_service_provider == NULL) {
@@ -1003,13 +1003,13 @@
   // BluetoothDeviceChromeOS object, including the device_path referenced here.
   FakeBluetoothInputClient* fake_bluetooth_input_client =
       static_cast<FakeBluetoothInputClient*>(
-          bluez::BluezDBusManager::Get()->GetBluetoothInputClient());
+          DBusThreadManager::Get()->GetBluetoothInputClient());
   fake_bluetooth_input_client->RemoveInputDevice(device_path);
 
   if (device_path == dbus::ObjectPath(kLowEnergyPath)) {
     FakeBluetoothGattServiceClient* gatt_service_client =
         static_cast<FakeBluetoothGattServiceClient*>(
-            bluez::BluezDBusManager::Get()->GetBluetoothGattServiceClient());
+            DBusThreadManager::Get()->GetBluetoothGattServiceClient());
     gatt_service_client->HideHeartRateService();
   }
 
@@ -1173,7 +1173,7 @@
 
   FakeBluetoothAgentManagerClient* fake_bluetooth_agent_manager_client =
       static_cast<FakeBluetoothAgentManagerClient*>(
-          bluez::BluezDBusManager::Get()->GetBluetoothAgentManagerClient());
+          DBusThreadManager::Get()->GetBluetoothAgentManagerClient());
   FakeBluetoothAgentServiceProvider* agent_service_provider =
       fake_bluetooth_agent_manager_client->GetAgentServiceProvider();
   CHECK(agent_service_provider != NULL);
@@ -1426,7 +1426,7 @@
   // simulate the Input interface.
   FakeBluetoothInputClient* fake_bluetooth_input_client =
       static_cast<FakeBluetoothInputClient*>(
-          bluez::BluezDBusManager::Get()->GetBluetoothInputClient());
+          DBusThreadManager::Get()->GetBluetoothInputClient());
 
   if ((properties->bluetooth_class.value() & 0x001f03) == 0x000500)
     fake_bluetooth_input_client->AddInputDevice(object_path);
@@ -1596,7 +1596,7 @@
 
   FakeBluetoothAgentManagerClient* fake_bluetooth_agent_manager_client =
       static_cast<FakeBluetoothAgentManagerClient*>(
-          bluez::BluezDBusManager::Get()->GetBluetoothAgentManagerClient());
+          DBusThreadManager::Get()->GetBluetoothAgentManagerClient());
   FakeBluetoothAgentServiceProvider* agent_service_provider =
       fake_bluetooth_agent_manager_client->GetAgentServiceProvider();
 
@@ -1659,4 +1659,4 @@
   }
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/fake_bluetooth_device_client.h b/chromeos/dbus/fake_bluetooth_device_client.h
similarity index 95%
rename from device/bluetooth/dbus/fake_bluetooth_device_client.h
rename to chromeos/dbus/fake_bluetooth_device_client.h
index f8051b4..03a2cb1 100644
--- a/device/bluetooth/dbus/fake_bluetooth_device_client.h
+++ b/chromeos/dbus/fake_bluetooth_device_client.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 DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_DEVICE_CLIENT_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_DEVICE_CLIENT_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_DEVICE_CLIENT_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_DEVICE_CLIENT_H_
 
 #include <map>
 #include <vector>
@@ -12,20 +12,19 @@
 #include "base/callback.h"
 #include "base/containers/scoped_ptr_map.h"
 #include "base/observer_list.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/bluetooth_agent_service_provider.h"
+#include "chromeos/dbus/bluetooth_device_client.h"
+#include "chromeos/dbus/bluetooth_profile_service_provider.h"
 #include "dbus/object_path.h"
 #include "dbus/property.h"
-#include "device/bluetooth/bluetooth_export.h"
-#include "device/bluetooth/dbus/bluetooth_agent_service_provider.h"
-#include "device/bluetooth/dbus/bluetooth_device_client.h"
-#include "device/bluetooth/dbus/bluetooth_profile_service_provider.h"
 
-namespace bluez {
+namespace chromeos {
 
 // FakeBluetoothDeviceClient simulates the behavior of the Bluetooth Daemon
 // device objects and is used both in test cases in place of a mock and on
 // the Linux desktop.
-class DEVICE_BLUETOOTH_EXPORT FakeBluetoothDeviceClient
-    : public BluetoothDeviceClient {
+class CHROMEOS_EXPORT FakeBluetoothDeviceClient : public BluetoothDeviceClient {
  public:
   struct Properties : public BluetoothDeviceClient::Properties {
     explicit Properties(const PropertyChangedCallback& callback);
@@ -316,6 +315,6 @@
   int16 max_transmit_power_;
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_DEVICE_CLIENT_H_
+#endif  // CHROMEOS_DBUS_FAKE_BLUETOOTH_DEVICE_CLIENT_H_
diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.cc b/chromeos/dbus/fake_bluetooth_gatt_characteristic_client.cc
similarity index 97%
rename from device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.cc
rename to chromeos/dbus/fake_bluetooth_gatt_characteristic_client.cc
index 10f073a..69779ec 100644
--- a/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.cc
+++ b/chromeos/dbus/fake_bluetooth_gatt_characteristic_client.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 "device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.h"
+#include "chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h"
 
 #include "base/bind.h"
 #include "base/location.h"
@@ -10,11 +10,11 @@
 #include "base/single_thread_task_runner.h"
 #include "base/thread_task_runner_handle.h"
 #include "base/time/time.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
-#include "device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
+#include "chromeos/dbus/fake_bluetooth_gatt_descriptor_client.h"
 #include "third_party/cros_system_api/dbus/service_constants.h"
 
-namespace bluez {
+namespace chromeos {
 
 namespace {
 
@@ -377,7 +377,7 @@
   // Expose CCC descriptor for Heart Rate Measurement characteristic.
   FakeBluetoothGattDescriptorClient* descriptor_client =
       static_cast<FakeBluetoothGattDescriptorClient*>(
-          bluez::BluezDBusManager::Get()->GetBluetoothGattDescriptorClient());
+          DBusThreadManager::Get()->GetBluetoothGattDescriptorClient());
   dbus::ObjectPath ccc_path(descriptor_client->ExposeDescriptor(
       dbus::ObjectPath(heart_rate_measurement_path_),
       FakeBluetoothGattDescriptorClient::
@@ -397,7 +397,7 @@
   // Hide the descriptors.
   FakeBluetoothGattDescriptorClient* descriptor_client =
       static_cast<FakeBluetoothGattDescriptorClient*>(
-          bluez::BluezDBusManager::Get()->GetBluetoothGattDescriptorClient());
+          DBusThreadManager::Get()->GetBluetoothGattDescriptorClient());
   descriptor_client->HideDescriptor(
       dbus::ObjectPath(heart_rate_measurement_ccc_desc_path_));
 
@@ -559,4 +559,4 @@
   return heart_rate_visible_;
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.h b/chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h
similarity index 93%
rename from device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.h
rename to chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h
index 89fefcc5..dc1eab3 100644
--- a/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.h
+++ b/chromeos/dbus/fake_bluetooth_gatt_characteristic_client.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 DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_CHARACTERISTIC_CLIENT_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_CHARACTERISTIC_CLIENT_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_CHARACTERISTIC_CLIENT_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_CHARACTERISTIC_CLIENT_H_
 
 #include <string>
 #include <vector>
@@ -12,17 +12,17 @@
 #include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/observer_list.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/bluetooth_gatt_characteristic_client.h"
 #include "dbus/object_path.h"
 #include "dbus/property.h"
-#include "device/bluetooth/bluetooth_export.h"
-#include "device/bluetooth/dbus/bluetooth_gatt_characteristic_client.h"
 
-namespace bluez {
+namespace chromeos {
 
 // FakeBluetoothGattCharacteristicClient simulates the behavior of the
 // Bluetooth Daemon GATT characteristic objects and is used in test cases in
 // place of a mock and on the Linux desktop.
-class DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattCharacteristicClient
+class CHROMEOS_EXPORT FakeBluetoothGattCharacteristicClient
     : public BluetoothGattCharacteristicClient {
  public:
   struct Properties : public BluetoothGattCharacteristicClient::Properties {
@@ -189,6 +189,6 @@
   DISALLOW_COPY_AND_ASSIGN(FakeBluetoothGattCharacteristicClient);
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_CHARACTERISTIC_CLIENT_H_
+#endif  // CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_CHARACTERISTIC_CLIENT_H_
diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.cc b/chromeos/dbus/fake_bluetooth_gatt_characteristic_service_provider.cc
similarity index 85%
rename from device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.cc
rename to chromeos/dbus/fake_bluetooth_gatt_characteristic_service_provider.cc
index 03f06d03..39132d9 100644
--- a/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.cc
+++ b/chromeos/dbus/fake_bluetooth_gatt_characteristic_service_provider.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 "device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.h"
+#include "chromeos/dbus/fake_bluetooth_gatt_characteristic_service_provider.h"
 
 #include "base/logging.h"
 #include "base/strings/string_util.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
-#include "device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
+#include "chromeos/dbus/fake_bluetooth_gatt_manager_client.h"
 
-namespace bluez {
+namespace chromeos {
 
 FakeBluetoothGattCharacteristicServiceProvider::
     FakeBluetoothGattCharacteristicServiceProvider(
@@ -36,7 +36,7 @@
 
   FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client =
       static_cast<FakeBluetoothGattManagerClient*>(
-          bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient());
+          DBusThreadManager::Get()->GetBluetoothGattManagerClient());
   fake_bluetooth_gatt_manager_client->RegisterCharacteristicServiceProvider(
       this);
 }
@@ -48,7 +48,7 @@
 
   FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client =
       static_cast<FakeBluetoothGattManagerClient*>(
-          bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient());
+          DBusThreadManager::Get()->GetBluetoothGattManagerClient());
   fake_bluetooth_gatt_manager_client->UnregisterCharacteristicServiceProvider(
       this);
 }
@@ -68,7 +68,7 @@
   // Check if this characteristic is registered.
   FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client =
       static_cast<FakeBluetoothGattManagerClient*>(
-          bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient());
+          DBusThreadManager::Get()->GetBluetoothGattManagerClient());
   if (!fake_bluetooth_gatt_manager_client->IsServiceRegistered(service_path_)) {
     VLOG(1) << "GATT characteristic not registered.";
     error_callback.Run();
@@ -90,7 +90,7 @@
   // Check if this characteristic is registered.
   FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client =
       static_cast<FakeBluetoothGattManagerClient*>(
-          bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient());
+          DBusThreadManager::Get()->GetBluetoothGattManagerClient());
   if (!fake_bluetooth_gatt_manager_client->IsServiceRegistered(service_path_)) {
     VLOG(1) << "GATT characteristic not registered.";
     error_callback.Run();
@@ -102,4 +102,4 @@
   delegate_->SetCharacteristicValue(value, callback, error_callback);
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.h b/chromeos/dbus/fake_bluetooth_gatt_characteristic_service_provider.h
similarity index 79%
rename from device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.h
rename to chromeos/dbus/fake_bluetooth_gatt_characteristic_service_provider.h
index 675eba9..8a8440b 100644
--- a/device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.h
+++ b/chromeos/dbus/fake_bluetooth_gatt_characteristic_service_provider.h
@@ -2,23 +2,22 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_
 
 #include <string>
 #include <vector>
 
-#include "base/macros.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/bluetooth_gatt_characteristic_service_provider.h"
 #include "dbus/object_path.h"
-#include "device/bluetooth/bluetooth_export.h"
-#include "device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider.h"
 
-namespace bluez {
+namespace chromeos {
 
 // FakeBluetoothGattCharacteristicServiceProvider simulates behavior of a local
 // GATT characteristic object and is used both in test cases in place of a mock
 // and on the Linux desktop.
-class DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattCharacteristicServiceProvider
+class CHROMEOS_EXPORT FakeBluetoothGattCharacteristicServiceProvider
     : public BluetoothGattCharacteristicServiceProvider {
  public:
   FakeBluetoothGattCharacteristicServiceProvider(
@@ -62,6 +61,6 @@
   DISALLOW_COPY_AND_ASSIGN(FakeBluetoothGattCharacteristicServiceProvider);
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_
+#endif  // CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_CHARACTERISTIC_SERVICE_PROVIDER_H_
diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.cc b/chromeos/dbus/fake_bluetooth_gatt_descriptor_client.cc
similarity index 95%
rename from device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.cc
rename to chromeos/dbus/fake_bluetooth_gatt_descriptor_client.cc
index dcaf1ec..2e9cdf0 100644
--- a/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.cc
+++ b/chromeos/dbus/fake_bluetooth_gatt_descriptor_client.cc
@@ -2,15 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.h"
+#include "chromeos/dbus/fake_bluetooth_gatt_descriptor_client.h"
 
 #include "base/bind.h"
 #include "base/logging.h"
-#include "device/bluetooth/dbus/bluetooth_gatt_characteristic_client.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
+#include "chromeos/dbus/bluetooth_gatt_characteristic_client.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
 #include "third_party/cros_system_api/dbus/service_constants.h"
 
-namespace bluez {
+namespace chromeos {
 
 const char FakeBluetoothGattDescriptorClient::
     kClientCharacteristicConfigurationPathComponent[] = "desc0000";
@@ -101,7 +101,7 @@
   Properties* properties = iter->second->properties.get();
   if (properties->uuid.value() == kClientCharacteristicConfigurationUUID) {
     BluetoothGattCharacteristicClient::Properties* chrc_props =
-        bluez::BluezDBusManager::Get()
+        DBusThreadManager::Get()
             ->GetBluetoothGattCharacteristicClient()
             ->GetProperties(properties->characteristic.value());
     DCHECK(chrc_props);
@@ -206,4 +206,4 @@
                     GattDescriptorRemoved(object_path));
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.h b/chromeos/dbus/fake_bluetooth_gatt_descriptor_client.h
similarity index 88%
rename from device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.h
rename to chromeos/dbus/fake_bluetooth_gatt_descriptor_client.h
index 0e8e8565..e6106c1a 100644
--- a/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.h
+++ b/chromeos/dbus/fake_bluetooth_gatt_descriptor_client.h
@@ -2,25 +2,24 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_CLIENT_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_CLIENT_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_CLIENT_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_CLIENT_H_
 
 #include <map>
 #include <string>
 
-#include "base/macros.h"
 #include "base/memory/weak_ptr.h"
 #include "base/observer_list.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/bluetooth_gatt_descriptor_client.h"
 #include "dbus/object_path.h"
-#include "device/bluetooth/bluetooth_export.h"
-#include "device/bluetooth/dbus/bluetooth_gatt_descriptor_client.h"
 
-namespace bluez {
+namespace chromeos {
 
 // FakeBluetoothGattDescriptorClient simulates the behavior of the Bluetooth
 // Daemon GATT characteristic descriptor objects and is used in test cases in
 // place of a mock and on the Linux desktop.
-class DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattDescriptorClient
+class CHROMEOS_EXPORT FakeBluetoothGattDescriptorClient
     : public BluetoothGattDescriptorClient {
  public:
   struct Properties : public BluetoothGattDescriptorClient::Properties {
@@ -99,6 +98,6 @@
   DISALLOW_COPY_AND_ASSIGN(FakeBluetoothGattDescriptorClient);
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_CLIENT_H_
+#endif  // CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_CLIENT_H_
diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_service_provider.cc b/chromeos/dbus/fake_bluetooth_gatt_descriptor_service_provider.cc
similarity index 86%
rename from device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_service_provider.cc
rename to chromeos/dbus/fake_bluetooth_gatt_descriptor_service_provider.cc
index 4376ce98..ad002abb 100644
--- a/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_service_provider.cc
+++ b/chromeos/dbus/fake_bluetooth_gatt_descriptor_service_provider.cc
@@ -2,15 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_service_provider.h"
+#include "chromeos/dbus/fake_bluetooth_gatt_descriptor_service_provider.h"
 
 #include "base/logging.h"
 #include "base/strings/string_util.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
-#include "device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.h"
-#include "device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
+#include "chromeos/dbus/fake_bluetooth_gatt_characteristic_service_provider.h"
+#include "chromeos/dbus/fake_bluetooth_gatt_manager_client.h"
 
-namespace bluez {
+namespace chromeos {
 
 FakeBluetoothGattDescriptorServiceProvider::
     FakeBluetoothGattDescriptorServiceProvider(
@@ -37,7 +37,7 @@
 
   FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client =
       static_cast<FakeBluetoothGattManagerClient*>(
-          bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient());
+          DBusThreadManager::Get()->GetBluetoothGattManagerClient());
   fake_bluetooth_gatt_manager_client->RegisterDescriptorServiceProvider(this);
 }
 
@@ -47,7 +47,7 @@
 
   FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client =
       static_cast<FakeBluetoothGattManagerClient*>(
-          bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient());
+          DBusThreadManager::Get()->GetBluetoothGattManagerClient());
   fake_bluetooth_gatt_manager_client->UnregisterDescriptorServiceProvider(this);
 }
 
@@ -66,7 +66,7 @@
   // Check if this descriptor is registered.
   FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client =
       static_cast<FakeBluetoothGattManagerClient*>(
-          bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient());
+          DBusThreadManager::Get()->GetBluetoothGattManagerClient());
   FakeBluetoothGattCharacteristicServiceProvider* characteristic =
       fake_bluetooth_gatt_manager_client->GetCharacteristicServiceProvider(
           characteristic_path_);
@@ -97,7 +97,7 @@
   // Check if this descriptor is registered.
   FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client =
       static_cast<FakeBluetoothGattManagerClient*>(
-          bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient());
+          DBusThreadManager::Get()->GetBluetoothGattManagerClient());
   FakeBluetoothGattCharacteristicServiceProvider* characteristic =
       fake_bluetooth_gatt_manager_client->GetCharacteristicServiceProvider(
           characteristic_path_);
@@ -118,4 +118,4 @@
   delegate_->SetDescriptorValue(value, callback, error_callback);
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_service_provider.h b/chromeos/dbus/fake_bluetooth_gatt_descriptor_service_provider.h
similarity index 79%
rename from device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_service_provider.h
rename to chromeos/dbus/fake_bluetooth_gatt_descriptor_service_provider.h
index 7640acc5..054c21d 100644
--- a/device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_service_provider.h
+++ b/chromeos/dbus/fake_bluetooth_gatt_descriptor_service_provider.h
@@ -2,23 +2,22 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_H_
 
 #include <string>
 #include <vector>
 
-#include "base/macros.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/bluetooth_gatt_descriptor_service_provider.h"
 #include "dbus/object_path.h"
-#include "device/bluetooth/bluetooth_export.h"
-#include "device/bluetooth/dbus/bluetooth_gatt_descriptor_service_provider.h"
 
-namespace bluez {
+namespace chromeos {
 
 // FakeBluetoothGattDescriptorServiceProvider simulates behavior of a local
 // GATT descriptor object and is used both in test cases in place of a mock
 // and on the Linux desktop.
-class DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattDescriptorServiceProvider
+class CHROMEOS_EXPORT FakeBluetoothGattDescriptorServiceProvider
     : public BluetoothGattDescriptorServiceProvider {
  public:
   FakeBluetoothGattDescriptorServiceProvider(
@@ -63,6 +62,6 @@
   DISALLOW_COPY_AND_ASSIGN(FakeBluetoothGattDescriptorServiceProvider);
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_H_
+#endif  // CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_SERVICE_PROVIDER_H_
diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.cc b/chromeos/dbus/fake_bluetooth_gatt_manager_client.cc
similarity index 93%
rename from device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.cc
rename to chromeos/dbus/fake_bluetooth_gatt_manager_client.cc
index 284a17c7..1127eae 100644
--- a/device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.cc
+++ b/chromeos/dbus/fake_bluetooth_gatt_manager_client.cc
@@ -2,15 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.h"
+#include "chromeos/dbus/fake_bluetooth_gatt_manager_client.h"
 
 #include "base/logging.h"
-#include "device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.h"
-#include "device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_service_provider.h"
-#include "device/bluetooth/dbus/fake_bluetooth_gatt_service_service_provider.h"
+#include "chromeos/dbus/fake_bluetooth_gatt_characteristic_service_provider.h"
+#include "chromeos/dbus/fake_bluetooth_gatt_descriptor_service_provider.h"
+#include "chromeos/dbus/fake_bluetooth_gatt_service_service_provider.h"
 #include "third_party/cros_system_api/dbus/service_constants.h"
 
-namespace bluez {
+namespace chromeos {
 
 FakeBluetoothGattManagerClient::FakeBluetoothGattManagerClient() {}
 
@@ -166,4 +166,4 @@
   return iter->second.first;
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.h b/chromeos/dbus/fake_bluetooth_gatt_manager_client.h
similarity index 89%
rename from device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.h
rename to chromeos/dbus/fake_bluetooth_gatt_manager_client.h
index 65082ae9..cd5d3b0 100644
--- a/device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.h
+++ b/chromeos/dbus/fake_bluetooth_gatt_manager_client.h
@@ -2,20 +2,19 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_MANAGER_CLIENT_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_MANAGER_CLIENT_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_MANAGER_CLIENT_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_MANAGER_CLIENT_H_
 
 #include <map>
 #include <string>
 #include <utility>
 
 #include "base/callback.h"
-#include "base/macros.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/bluetooth_gatt_manager_client.h"
 #include "dbus/object_path.h"
-#include "device/bluetooth/bluetooth_export.h"
-#include "device/bluetooth/dbus/bluetooth_gatt_manager_client.h"
 
-namespace bluez {
+namespace chromeos {
 
 class FakeBluetoothGattCharacteristicServiceProvider;
 class FakeBluetoothGattDescriptorServiceProvider;
@@ -24,7 +23,7 @@
 // FakeBluetoothGattManagerClient simulates the behavior of the Bluetooth
 // daemon's GATT manager object and is used both in test cases in place of a
 // mock and on the Linux desktop.
-class DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattManagerClient
+class CHROMEOS_EXPORT FakeBluetoothGattManagerClient
     : public BluetoothGattManagerClient {
  public:
   FakeBluetoothGattManagerClient();
@@ -96,6 +95,6 @@
   DISALLOW_COPY_AND_ASSIGN(FakeBluetoothGattManagerClient);
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_MANAGER_CLIENT_H_
+#endif  // CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_MANAGER_CLIENT_H_
diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_service_client.cc b/chromeos/dbus/fake_bluetooth_gatt_service_client.cc
similarity index 93%
rename from device/bluetooth/dbus/fake_bluetooth_gatt_service_client.cc
rename to chromeos/dbus/fake_bluetooth_gatt_service_client.cc
index 2e7aa0a..47b39b6 100644
--- a/device/bluetooth/dbus/fake_bluetooth_gatt_service_client.cc
+++ b/chromeos/dbus/fake_bluetooth_gatt_service_client.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 "device/bluetooth/dbus/fake_bluetooth_gatt_service_client.h"
+#include "chromeos/dbus/fake_bluetooth_gatt_service_client.h"
 
 #include "base/bind.h"
 #include "base/location.h"
 #include "base/single_thread_task_runner.h"
 #include "base/thread_task_runner_handle.h"
 #include "base/time/time.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
-#include "device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
+#include "chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h"
 #include "third_party/cros_system_api/dbus/service_constants.h"
 
-namespace bluez {
+namespace chromeos {
 
 namespace {
 
@@ -122,8 +122,7 @@
   VLOG(2) << "Hiding fake Heart Rate Service.";
   FakeBluetoothGattCharacteristicClient* char_client =
       static_cast<FakeBluetoothGattCharacteristicClient*>(
-          bluez::BluezDBusManager::Get()
-              ->GetBluetoothGattCharacteristicClient());
+          DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient());
   char_client->HideHeartRateCharacteristics();
 
   // Notify observers before deleting the properties structure so that it
@@ -173,8 +172,7 @@
   }
   FakeBluetoothGattCharacteristicClient* char_client =
       static_cast<FakeBluetoothGattCharacteristicClient*>(
-          bluez::BluezDBusManager::Get()
-              ->GetBluetoothGattCharacteristicClient());
+          DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient());
   char_client->ExposeHeartRateCharacteristics(
       dbus::ObjectPath(heart_rate_service_path_));
 
@@ -186,4 +184,4 @@
   heart_rate_service_properties_->characteristics.ReplaceValue(char_paths);
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_service_client.h b/chromeos/dbus/fake_bluetooth_gatt_service_client.h
similarity index 89%
rename from device/bluetooth/dbus/fake_bluetooth_gatt_service_client.h
rename to chromeos/dbus/fake_bluetooth_gatt_service_client.h
index faebb423..f719727 100644
--- a/device/bluetooth/dbus/fake_bluetooth_gatt_service_client.h
+++ b/chromeos/dbus/fake_bluetooth_gatt_service_client.h
@@ -2,27 +2,26 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_SERVICE_CLIENT_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_SERVICE_CLIENT_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_SERVICE_CLIENT_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_SERVICE_CLIENT_H_
 
 #include <string>
 #include <vector>
 
-#include "base/macros.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/observer_list.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/bluetooth_gatt_service_client.h"
 #include "dbus/object_path.h"
 #include "dbus/property.h"
-#include "device/bluetooth/bluetooth_export.h"
-#include "device/bluetooth/dbus/bluetooth_gatt_service_client.h"
 
-namespace bluez {
+namespace chromeos {
 
 // FakeBluetoothGattServiceClient simulates the behavior of the Bluetooth Daemon
 // GATT service objects and is used in test cases in place of a mock and on the
 // Linux desktop.
-class DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattServiceClient
+class CHROMEOS_EXPORT FakeBluetoothGattServiceClient
     : public BluetoothGattServiceClient {
  public:
   struct Properties : public BluetoothGattServiceClient::Properties {
@@ -102,6 +101,6 @@
   DISALLOW_COPY_AND_ASSIGN(FakeBluetoothGattServiceClient);
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_SERVICE_CLIENT_H_
+#endif  // CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_SERVICE_CLIENT_H_
diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_service_service_provider.cc b/chromeos/dbus/fake_bluetooth_gatt_service_service_provider.cc
similarity index 73%
rename from device/bluetooth/dbus/fake_bluetooth_gatt_service_service_provider.cc
rename to chromeos/dbus/fake_bluetooth_gatt_service_service_provider.cc
index 8d724058..f59cf98 100644
--- a/device/bluetooth/dbus/fake_bluetooth_gatt_service_service_provider.cc
+++ b/chromeos/dbus/fake_bluetooth_gatt_service_service_provider.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 "device/bluetooth/dbus/fake_bluetooth_gatt_service_service_provider.h"
+#include "chromeos/dbus/fake_bluetooth_gatt_service_service_provider.h"
 
 #include "base/logging.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
-#include "device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
+#include "chromeos/dbus/fake_bluetooth_gatt_manager_client.h"
 
-namespace bluez {
+namespace chromeos {
 
 FakeBluetoothGattServiceServiceProvider::
     FakeBluetoothGattServiceServiceProvider(
@@ -20,7 +20,7 @@
 
   FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client =
       static_cast<FakeBluetoothGattManagerClient*>(
-          bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient());
+          DBusThreadManager::Get()->GetBluetoothGattManagerClient());
   fake_bluetooth_gatt_manager_client->RegisterServiceServiceProvider(this);
 }
 
@@ -30,8 +30,8 @@
 
   FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client =
       static_cast<FakeBluetoothGattManagerClient*>(
-          bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient());
+          DBusThreadManager::Get()->GetBluetoothGattManagerClient());
   fake_bluetooth_gatt_manager_client->UnregisterServiceServiceProvider(this);
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/fake_bluetooth_gatt_service_service_provider.h b/chromeos/dbus/fake_bluetooth_gatt_service_service_provider.h
similarity index 69%
rename from device/bluetooth/dbus/fake_bluetooth_gatt_service_service_provider.h
rename to chromeos/dbus/fake_bluetooth_gatt_service_service_provider.h
index ca8b52e0..6b49d78 100644
--- a/device/bluetooth/dbus/fake_bluetooth_gatt_service_service_provider.h
+++ b/chromeos/dbus/fake_bluetooth_gatt_service_service_provider.h
@@ -2,23 +2,22 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_H_
 
 #include <string>
 #include <vector>
 
-#include "base/macros.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/bluetooth_gatt_service_service_provider.h"
 #include "dbus/object_path.h"
-#include "device/bluetooth/bluetooth_export.h"
-#include "device/bluetooth/dbus/bluetooth_gatt_service_service_provider.h"
 
-namespace bluez {
+namespace chromeos {
 
 // FakeBluetoothGattServiceServiceProvider simulates behavior of a local GATT
 // service object and is used both in test cases in place of a mock and on the
 // Linux desktop.
-class DEVICE_BLUETOOTH_EXPORT FakeBluetoothGattServiceServiceProvider
+class CHROMEOS_EXPORT FakeBluetoothGattServiceServiceProvider
     : public BluetoothGattServiceServiceProvider {
  public:
   FakeBluetoothGattServiceServiceProvider(
@@ -43,6 +42,6 @@
   DISALLOW_COPY_AND_ASSIGN(FakeBluetoothGattServiceServiceProvider);
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_H_
+#endif  // CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_SERVICE_SERVICE_PROVIDER_H_
diff --git a/device/bluetooth/dbus/fake_bluetooth_input_client.cc b/chromeos/dbus/fake_bluetooth_input_client.cc
similarity index 95%
rename from device/bluetooth/dbus/fake_bluetooth_input_client.cc
rename to chromeos/dbus/fake_bluetooth_input_client.cc
index 849c3be..ab2c66b3 100644
--- a/device/bluetooth/dbus/fake_bluetooth_input_client.cc
+++ b/chromeos/dbus/fake_bluetooth_input_client.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 "device/bluetooth/dbus/fake_bluetooth_input_client.h"
+#include "chromeos/dbus/fake_bluetooth_input_client.h"
 
 #include <map>
 
 #include "base/logging.h"
 #include "base/stl_util.h"
+#include "chromeos/dbus/fake_bluetooth_device_client.h"
 #include "dbus/bus.h"
 #include "dbus/message.h"
 #include "dbus/object_manager.h"
 #include "dbus/object_proxy.h"
-#include "device/bluetooth/dbus/fake_bluetooth_device_client.h"
 #include "third_party/cros_system_api/dbus/service_constants.h"
 
-namespace bluez {
+namespace chromeos {
 
 FakeBluetoothInputClient::Properties::Properties(
     const PropertyChangedCallback& callback)
@@ -120,4 +120,4 @@
                     InputPropertyChanged(object_path, property_name));
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/fake_bluetooth_input_client.h b/chromeos/dbus/fake_bluetooth_input_client.h
similarity index 80%
rename from device/bluetooth/dbus/fake_bluetooth_input_client.h
rename to chromeos/dbus/fake_bluetooth_input_client.h
index 81139db..22369eb 100644
--- a/device/bluetooth/dbus/fake_bluetooth_input_client.h
+++ b/chromeos/dbus/fake_bluetooth_input_client.h
@@ -2,24 +2,22 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_INPUT_CLIENT_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_INPUT_CLIENT_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_INPUT_CLIENT_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_INPUT_CLIENT_H_
 
 #include "base/callback.h"
-#include "base/macros.h"
 #include "base/observer_list.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/bluetooth_input_client.h"
 #include "dbus/object_path.h"
 #include "dbus/property.h"
-#include "device/bluetooth/bluetooth_export.h"
-#include "device/bluetooth/dbus/bluetooth_input_client.h"
 
-namespace bluez {
+namespace chromeos {
 
 // FakeBluetoothInputClient simulates the behavior of the Bluetooth Daemon
 // input device objects and is used both in test cases in place of a mock and on
 // the Linux desktop.
-class DEVICE_BLUETOOTH_EXPORT FakeBluetoothInputClient
-    : public BluetoothInputClient {
+class CHROMEOS_EXPORT FakeBluetoothInputClient : public BluetoothInputClient {
  public:
   struct Properties : public BluetoothInputClient::Properties {
     explicit Properties(const PropertyChangedCallback& callback);
@@ -61,6 +59,6 @@
   DISALLOW_COPY_AND_ASSIGN(FakeBluetoothInputClient);
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_INPUT_CLIENT_H_
+#endif  // CHROMEOS_DBUS_FAKE_BLUETOOTH_INPUT_CLIENT_H_
diff --git a/device/bluetooth/dbus/fake_bluetooth_le_advertisement_service_provider.cc b/chromeos/dbus/fake_bluetooth_le_advertisement_service_provider.cc
similarity index 79%
rename from device/bluetooth/dbus/fake_bluetooth_le_advertisement_service_provider.cc
rename to chromeos/dbus/fake_bluetooth_le_advertisement_service_provider.cc
index 043df05c..ce46e3d 100644
--- a/device/bluetooth/dbus/fake_bluetooth_le_advertisement_service_provider.cc
+++ b/chromeos/dbus/fake_bluetooth_le_advertisement_service_provider.cc
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
-#include "device/bluetooth/dbus/fake_bluetooth_le_advertisement_service_provider.h"
-#include "device/bluetooth/dbus/fake_bluetooth_le_advertising_manager_client.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
+#include "chromeos/dbus/fake_bluetooth_le_advertisement_service_provider.h"
+#include "chromeos/dbus/fake_bluetooth_le_advertising_manager_client.h"
 
-namespace bluez {
+namespace chromeos {
 
 FakeBluetoothLEAdvertisementServiceProvider::
     FakeBluetoothLEAdvertisementServiceProvider(
@@ -19,7 +19,7 @@
   FakeBluetoothLEAdvertisingManagerClient*
       fake_bluetooth_profile_manager_client =
           static_cast<FakeBluetoothLEAdvertisingManagerClient*>(
-              bluez::BluezDBusManager::Get()
+              DBusThreadManager::Get()
                   ->GetBluetoothLEAdvertisingManagerClient());
   fake_bluetooth_profile_manager_client->RegisterAdvertisementServiceProvider(
       this);
@@ -32,7 +32,7 @@
   FakeBluetoothLEAdvertisingManagerClient*
       fake_bluetooth_profile_manager_client =
           static_cast<FakeBluetoothLEAdvertisingManagerClient*>(
-              bluez::BluezDBusManager::Get()
+              DBusThreadManager::Get()
                   ->GetBluetoothLEAdvertisingManagerClient());
   fake_bluetooth_profile_manager_client->UnregisterAdvertisementServiceProvider(
       this);
@@ -43,4 +43,4 @@
   delegate_->Released();
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/fake_bluetooth_le_advertisement_service_provider.h b/chromeos/dbus/fake_bluetooth_le_advertisement_service_provider.h
similarity index 72%
rename from device/bluetooth/dbus/fake_bluetooth_le_advertisement_service_provider.h
rename to chromeos/dbus/fake_bluetooth_le_advertisement_service_provider.h
index 29c8133a..5a19aeee 100644
--- a/device/bluetooth/dbus/fake_bluetooth_le_advertisement_service_provider.h
+++ b/chromeos/dbus/fake_bluetooth_le_advertisement_service_provider.h
@@ -2,24 +2,23 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_LE_ADVERTISEMENT_SERVICE_PROVIDER_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_LE_ADVERTISEMENT_SERVICE_PROVIDER_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_LE_ADVERTISEMENT_SERVICE_PROVIDER_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_LE_ADVERTISEMENT_SERVICE_PROVIDER_H_
 
 #include "base/bind.h"
 #include "base/callback.h"
-#include "base/macros.h"
 #include "base/memory/scoped_ptr.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/bluetooth_le_advertisement_service_provider.h"
 #include "dbus/file_descriptor.h"
 #include "dbus/object_path.h"
-#include "device/bluetooth/bluetooth_export.h"
-#include "device/bluetooth/dbus/bluetooth_le_advertisement_service_provider.h"
 
-namespace bluez {
+namespace chromeos {
 
 // FakeBluetoothAdvertisementServiceProvider simulates the behavior of a local
 // Bluetooth agent object and is used both in test cases in place of a
 // mock and on the Linux desktop.
-class DEVICE_BLUETOOTH_EXPORT FakeBluetoothLEAdvertisementServiceProvider
+class CHROMEOS_EXPORT FakeBluetoothLEAdvertisementServiceProvider
     : public BluetoothLEAdvertisementServiceProvider {
  public:
   FakeBluetoothLEAdvertisementServiceProvider(
@@ -45,6 +44,6 @@
   DISALLOW_COPY_AND_ASSIGN(FakeBluetoothLEAdvertisementServiceProvider);
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_LE_ADVERTISEMENT_SERVICE_PROVIDER_H_
+#endif  // CHROMEOS_DBUS_FAKE_BLUETOOTH_LE_ADVERTISEMENT_SERVICE_PROVIDER_H_
diff --git a/device/bluetooth/dbus/fake_bluetooth_le_advertising_manager_client.cc b/chromeos/dbus/fake_bluetooth_le_advertising_manager_client.cc
similarity index 94%
rename from device/bluetooth/dbus/fake_bluetooth_le_advertising_manager_client.cc
rename to chromeos/dbus/fake_bluetooth_le_advertising_manager_client.cc
index 2fcccd1..201fc42 100644
--- a/device/bluetooth/dbus/fake_bluetooth_le_advertising_manager_client.cc
+++ b/chromeos/dbus/fake_bluetooth_le_advertising_manager_client.cc
@@ -9,11 +9,11 @@
 #include "dbus/bus.h"
 #include "dbus/message.h"
 #include "dbus/object_proxy.h"
-#include "device/bluetooth/dbus/fake_bluetooth_le_advertisement_service_provider.h"
-#include "device/bluetooth/dbus/fake_bluetooth_le_advertising_manager_client.h"
+#include "fake_bluetooth_le_advertisement_service_provider.h"
+#include "fake_bluetooth_le_advertising_manager_client.h"
 #include "third_party/cros_system_api/dbus/service_constants.h"
 
-namespace bluez {
+namespace chromeos {
 
 const char FakeBluetoothLEAdvertisingManagerClient::kAdvertisingManagerPath[] =
     "/fake/hci0";
@@ -98,4 +98,4 @@
     service_provider_map_.erase(iter);
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/fake_bluetooth_le_advertising_manager_client.h b/chromeos/dbus/fake_bluetooth_le_advertising_manager_client.h
similarity index 84%
rename from device/bluetooth/dbus/fake_bluetooth_le_advertising_manager_client.h
rename to chromeos/dbus/fake_bluetooth_le_advertising_manager_client.h
index ae0d914..5df129c 100644
--- a/device/bluetooth/dbus/fake_bluetooth_le_advertising_manager_client.h
+++ b/chromeos/dbus/fake_bluetooth_le_advertising_manager_client.h
@@ -2,22 +2,21 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_
 
 #include <map>
 #include <string>
 
 #include "base/bind.h"
 #include "base/callback.h"
-#include "base/macros.h"
 #include "base/observer_list.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/bluetooth_le_advertising_manager_client.h"
 #include "dbus/object_path.h"
 #include "dbus/property.h"
-#include "device/bluetooth/bluetooth_export.h"
-#include "device/bluetooth/dbus/bluetooth_le_advertising_manager_client.h"
 
-namespace bluez {
+namespace chromeos {
 
 class FakeBluetoothLEAdvertisementServiceProvider;
 
@@ -25,7 +24,7 @@
 // Bluetooth
 // Daemon's profile manager object and is used both in test cases in place of a
 // mock and on the Linux desktop.
-class DEVICE_BLUETOOTH_EXPORT FakeBluetoothLEAdvertisingManagerClient
+class CHROMEOS_EXPORT FakeBluetoothLEAdvertisingManagerClient
     : public BluetoothLEAdvertisingManagerClient {
  public:
   FakeBluetoothLEAdvertisingManagerClient();
@@ -75,6 +74,6 @@
   DISALLOW_COPY_AND_ASSIGN(FakeBluetoothLEAdvertisingManagerClient);
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_
+#endif  // CHROMEOS_DBUS_FAKE_BLUETOOTH_LE_ADVERTISING_MANAGER_CLIENT_H_
diff --git a/device/bluetooth/dbus/fake_bluetooth_media_client.cc b/chromeos/dbus/fake_bluetooth_media_client.cc
similarity index 88%
rename from device/bluetooth/dbus/fake_bluetooth_media_client.cc
rename to chromeos/dbus/fake_bluetooth_media_client.cc
index 246a140..f9cfb5aa 100644
--- a/device/bluetooth/dbus/fake_bluetooth_media_client.cc
+++ b/chromeos/dbus/fake_bluetooth_media_client.cc
@@ -2,15 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "device/bluetooth/dbus/fake_bluetooth_media_client.h"
+#include "chromeos/dbus/fake_bluetooth_media_client.h"
 
 #include <string>
 
 #include "base/stl_util.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
-#include "device/bluetooth/dbus/fake_bluetooth_adapter_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_media_endpoint_service_provider.h"
-#include "device/bluetooth/dbus/fake_bluetooth_media_transport_client.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
+#include "chromeos/dbus/fake_bluetooth_adapter_client.h"
+#include "chromeos/dbus/fake_bluetooth_media_endpoint_service_provider.h"
+#include "chromeos/dbus/fake_bluetooth_media_transport_client.h"
 
 using dbus::ObjectPath;
 
@@ -23,7 +23,7 @@
 
 }  // namespace
 
-namespace bluez {
+namespace chromeos {
 
 // static
 const uint8_t FakeBluetoothMediaClient::kDefaultCodec = 0x00;
@@ -119,7 +119,7 @@
   // transport.
   FakeBluetoothMediaTransportClient* transport =
       static_cast<FakeBluetoothMediaTransportClient*>(
-          bluez::BluezDBusManager::Get()->GetBluetoothMediaTransportClient());
+          DBusThreadManager::Get()->GetBluetoothMediaTransportClient());
   transport->SetValid(endpoint, false);
 
   endpoints_.erase(endpoint->object_path());
@@ -131,4 +131,4 @@
   return ContainsKey(endpoints_, endpoint_path);
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/fake_bluetooth_media_client.h b/chromeos/dbus/fake_bluetooth_media_client.h
similarity index 83%
rename from device/bluetooth/dbus/fake_bluetooth_media_client.h
rename to chromeos/dbus/fake_bluetooth_media_client.h
index 2049f43..3b4f4a7 100644
--- a/device/bluetooth/dbus/fake_bluetooth_media_client.h
+++ b/chromeos/dbus/fake_bluetooth_media_client.h
@@ -2,24 +2,22 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_MEDIA_CLIENT_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_MEDIA_CLIENT_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_CLIENT_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_CLIENT_H_
 
 #include <map>
 
 #include "base/callback.h"
-#include "base/macros.h"
 #include "base/observer_list.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/bluetooth_media_client.h"
 #include "dbus/object_path.h"
-#include "device/bluetooth/bluetooth_export.h"
-#include "device/bluetooth/dbus/bluetooth_media_client.h"
 
-namespace bluez {
+namespace chromeos {
 
 class FakeBluetoothMediaEndpointServiceProvider;
 
-class DEVICE_BLUETOOTH_EXPORT FakeBluetoothMediaClient
-    : public BluetoothMediaClient {
+class CHROMEOS_EXPORT FakeBluetoothMediaClient : public BluetoothMediaClient {
  public:
   // The default codec is SBC(0x00).
   static const uint8_t kDefaultCodec;
@@ -73,6 +71,6 @@
   DISALLOW_COPY_AND_ASSIGN(FakeBluetoothMediaClient);
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_MEDIA_CLIENT_H_
+#endif  // CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_CLIENT_H_
diff --git a/device/bluetooth/dbus/fake_bluetooth_media_endpoint_service_provider.cc b/chromeos/dbus/fake_bluetooth_media_endpoint_service_provider.cc
similarity index 83%
rename from device/bluetooth/dbus/fake_bluetooth_media_endpoint_service_provider.cc
rename to chromeos/dbus/fake_bluetooth_media_endpoint_service_provider.cc
index 83a0822e..a275374 100644
--- a/device/bluetooth/dbus/fake_bluetooth_media_endpoint_service_provider.cc
+++ b/chromeos/dbus/fake_bluetooth_media_endpoint_service_provider.cc
@@ -2,15 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "device/bluetooth/dbus/fake_bluetooth_media_endpoint_service_provider.h"
+#include "chromeos/dbus/fake_bluetooth_media_endpoint_service_provider.h"
 
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
-#include "device/bluetooth/dbus/fake_bluetooth_media_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_media_transport_client.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
+#include "chromeos/dbus/fake_bluetooth_media_client.h"
+#include "chromeos/dbus/fake_bluetooth_media_transport_client.h"
 
 using dbus::ObjectPath;
 
-namespace bluez {
+namespace chromeos {
 
 FakeBluetoothMediaEndpointServiceProvider::
     FakeBluetoothMediaEndpointServiceProvider(const ObjectPath& object_path,
@@ -43,7 +43,7 @@
   // Makes the transport object valid for the given endpoint path.
   FakeBluetoothMediaTransportClient* transport =
       static_cast<FakeBluetoothMediaTransportClient*>(
-          bluez::BluezDBusManager::Get()->GetBluetoothMediaTransportClient());
+          DBusThreadManager::Get()->GetBluetoothMediaTransportClient());
   DCHECK(transport);
   transport->SetValid(this, true);
 }
@@ -62,4 +62,4 @@
   delegate_->Released();
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/fake_bluetooth_media_endpoint_service_provider.h b/chromeos/dbus/fake_bluetooth_media_endpoint_service_provider.h
similarity index 77%
rename from device/bluetooth/dbus/fake_bluetooth_media_endpoint_service_provider.h
rename to chromeos/dbus/fake_bluetooth_media_endpoint_service_provider.h
index 2e6b18a..5efe14f 100644
--- a/device/bluetooth/dbus/fake_bluetooth_media_endpoint_service_provider.h
+++ b/chromeos/dbus/fake_bluetooth_media_endpoint_service_provider.h
@@ -2,23 +2,22 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_MEDIA_ENDPOINT_SERVICE_PROVIDER_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_MEDIA_ENDPOINT_SERVICE_PROVIDER_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_ENDPOINT_SERVICE_PROVIDER_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_ENDPOINT_SERVICE_PROVIDER_H_
 
 #include <vector>
 
 #include "base/logging.h"
-#include "base/macros.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/bluetooth_media_endpoint_service_provider.h"
 #include "dbus/object_path.h"
-#include "device/bluetooth/bluetooth_export.h"
-#include "device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.h"
 #include "testing/gtest/include/gtest/gtest_prod.h"
 
-namespace bluez {
+namespace chromeos {
 
 // FakeBluetoothMediaEndpointServiceProvider simulates the behavior of a local
 // Bluetooth Media Endpoint object.
-class DEVICE_BLUETOOTH_EXPORT FakeBluetoothMediaEndpointServiceProvider
+class CHROMEOS_EXPORT FakeBluetoothMediaEndpointServiceProvider
     : public BluetoothMediaEndpointServiceProvider {
  public:
   FakeBluetoothMediaEndpointServiceProvider(const dbus::ObjectPath& object_path,
@@ -53,6 +52,6 @@
   DISALLOW_COPY_AND_ASSIGN(FakeBluetoothMediaEndpointServiceProvider);
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_MEDIA_ENDPOINT_SERVICE_PROVIDER_H_
+#endif  // CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_ENDPOINT_SERVICE_PROVIDER_H_
diff --git a/device/bluetooth/dbus/fake_bluetooth_media_transport_client.cc b/chromeos/dbus/fake_bluetooth_media_transport_client.cc
similarity index 93%
rename from device/bluetooth/dbus/fake_bluetooth_media_transport_client.cc
rename to chromeos/dbus/fake_bluetooth_media_transport_client.cc
index 1a0a106..ae8f89b 100644
--- a/device/bluetooth/dbus/fake_bluetooth_media_transport_client.cc
+++ b/chromeos/dbus/fake_bluetooth_media_transport_client.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 "device/bluetooth/dbus/fake_bluetooth_media_transport_client.h"
+#include "chromeos/dbus/fake_bluetooth_media_transport_client.h"
 
 #include <unistd.h>
 #include <sys/socket.h>
@@ -11,12 +11,12 @@
 
 #include "base/bind.h"
 #include "base/stl_util.h"
+#include "chromeos/dbus/bluetooth_media_client.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
+#include "chromeos/dbus/fake_bluetooth_adapter_client.h"
+#include "chromeos/dbus/fake_bluetooth_media_client.h"
+#include "chromeos/dbus/fake_bluetooth_media_endpoint_service_provider.h"
 #include "dbus/file_descriptor.h"
-#include "device/bluetooth/dbus/bluetooth_media_client.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
-#include "device/bluetooth/dbus/fake_bluetooth_adapter_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_media_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_media_endpoint_service_provider.h"
 
 using dbus::ObjectPath;
 
@@ -35,8 +35,8 @@
   static unsigned int sequence_number = 0;
   ++sequence_number;
   std::stringstream path;
-  path << bluez::FakeBluetoothAdapterClient::kAdapterPath
-       << bluez::FakeBluetoothMediaTransportClient::kTransportDevicePath
+  path << chromeos::FakeBluetoothAdapterClient::kAdapterPath
+       << chromeos::FakeBluetoothMediaTransportClient::kTransportDevicePath
        << "/fd" << sequence_number;
   return ObjectPath(path.str());
 }
@@ -46,7 +46,7 @@
 
 }  // namespace
 
-namespace bluez {
+namespace chromeos {
 
 // static
 const char FakeBluetoothMediaTransportClient::kTransportDevicePath[] =
@@ -153,7 +153,7 @@
     FakeBluetoothMediaEndpointServiceProvider* endpoint,
     bool valid) {
   FakeBluetoothMediaClient* media = static_cast<FakeBluetoothMediaClient*>(
-      bluez::BluezDBusManager::Get()->GetBluetoothMediaClient());
+      DBusThreadManager::Get()->GetBluetoothMediaClient());
   DCHECK(media);
 
   ObjectPath endpoint_path(endpoint->object_path());
@@ -325,4 +325,4 @@
   SetState(endpoint_path, "active");
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/fake_bluetooth_media_transport_client.h b/chromeos/dbus/fake_bluetooth_media_transport_client.h
similarity index 91%
rename from device/bluetooth/dbus/fake_bluetooth_media_transport_client.h
rename to chromeos/dbus/fake_bluetooth_media_transport_client.h
index 8ad3bb9..bbf30a5 100644
--- a/device/bluetooth/dbus/fake_bluetooth_media_transport_client.h
+++ b/chromeos/dbus/fake_bluetooth_media_transport_client.h
@@ -2,26 +2,25 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_
 
 #include <map>
 #include <string>
 #include <vector>
 
 #include "base/files/file.h"
-#include "base/macros.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/observer_list.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/bluetooth_media_transport_client.h"
 #include "dbus/object_path.h"
-#include "device/bluetooth/bluetooth_export.h"
-#include "device/bluetooth/dbus/bluetooth_media_transport_client.h"
 
-namespace bluez {
+namespace chromeos {
 
 class FakeBluetoothMediaEndpointServiceProvider;
 
-class DEVICE_BLUETOOTH_EXPORT FakeBluetoothMediaTransportClient
+class CHROMEOS_EXPORT FakeBluetoothMediaTransportClient
     : public BluetoothMediaTransportClient {
  public:
   struct Properties : public BluetoothMediaTransportClient::Properties {
@@ -144,6 +143,6 @@
   DISALLOW_COPY_AND_ASSIGN(FakeBluetoothMediaTransportClient);
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_
+#endif  // CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_TRANSPORT_CLIENT_H_
diff --git a/device/bluetooth/dbus/fake_bluetooth_profile_manager_client.cc b/chromeos/dbus/fake_bluetooth_profile_manager_client.cc
similarity index 95%
rename from device/bluetooth/dbus/fake_bluetooth_profile_manager_client.cc
rename to chromeos/dbus/fake_bluetooth_profile_manager_client.cc
index 96254a5..1a06d41 100644
--- a/device/bluetooth/dbus/fake_bluetooth_profile_manager_client.cc
+++ b/chromeos/dbus/fake_bluetooth_profile_manager_client.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 "device/bluetooth/dbus/fake_bluetooth_profile_manager_client.h"
+#include "chromeos/dbus/fake_bluetooth_profile_manager_client.h"
 
 #include "base/location.h"
 #include "base/logging.h"
 #include "base/single_thread_task_runner.h"
 #include "base/thread_task_runner_handle.h"
+#include "chromeos/dbus/fake_bluetooth_profile_service_provider.h"
 #include "dbus/bus.h"
 #include "dbus/message.h"
 #include "dbus/object_proxy.h"
-#include "device/bluetooth/dbus/fake_bluetooth_profile_service_provider.h"
 #include "third_party/cros_system_api/dbus/service_constants.h"
 
-namespace bluez {
+namespace chromeos {
 
 const char FakeBluetoothProfileManagerClient::kL2capUuid[] =
     "4d995052-33cc-4fdf-b446-75f32942a076";
@@ -108,4 +108,4 @@
   return service_provider_map_[iter->second];
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/fake_bluetooth_profile_manager_client.h b/chromeos/dbus/fake_bluetooth_profile_manager_client.h
similarity index 85%
rename from device/bluetooth/dbus/fake_bluetooth_profile_manager_client.h
rename to chromeos/dbus/fake_bluetooth_profile_manager_client.h
index 8ed7826d..c142606 100644
--- a/device/bluetooth/dbus/fake_bluetooth_profile_manager_client.h
+++ b/chromeos/dbus/fake_bluetooth_profile_manager_client.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 DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_
 
 #include <map>
 #include <string>
@@ -11,19 +11,19 @@
 #include "base/bind.h"
 #include "base/callback.h"
 #include "base/observer_list.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/bluetooth_profile_manager_client.h"
 #include "dbus/object_path.h"
 #include "dbus/property.h"
-#include "device/bluetooth/bluetooth_export.h"
-#include "device/bluetooth/dbus/bluetooth_profile_manager_client.h"
 
-namespace bluez {
+namespace chromeos {
 
 class FakeBluetoothProfileServiceProvider;
 
 // FakeBluetoothProfileManagerClient simulates the behavior of the Bluetooth
 // Daemon's profile manager object and is used both in test cases in place of a
 // mock and on the Linux desktop.
-class DEVICE_BLUETOOTH_EXPORT FakeBluetoothProfileManagerClient
+class CHROMEOS_EXPORT FakeBluetoothProfileManagerClient
     : public BluetoothProfileManagerClient {
  public:
   FakeBluetoothProfileManagerClient();
@@ -69,6 +69,6 @@
   ProfileMap profile_map_;
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_
+#endif  // CHROMEOS_DBUS_FAKE_BLUETOOTH_PROFILE_MANAGER_CLIENT_H_
diff --git a/device/bluetooth/dbus/fake_bluetooth_profile_service_provider.cc b/chromeos/dbus/fake_bluetooth_profile_service_provider.cc
similarity index 83%
rename from device/bluetooth/dbus/fake_bluetooth_profile_service_provider.cc
rename to chromeos/dbus/fake_bluetooth_profile_service_provider.cc
index 1089501..6f9c345 100644
--- a/device/bluetooth/dbus/fake_bluetooth_profile_service_provider.cc
+++ b/chromeos/dbus/fake_bluetooth_profile_service_provider.cc
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "device/bluetooth/dbus/fake_bluetooth_profile_service_provider.h"
+#include "chromeos/dbus/fake_bluetooth_profile_service_provider.h"
 
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
-#include "device/bluetooth/dbus/fake_bluetooth_profile_manager_client.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
+#include "chromeos/dbus/fake_bluetooth_profile_manager_client.h"
 
-namespace bluez {
+namespace chromeos {
 
 FakeBluetoothProfileServiceProvider::FakeBluetoothProfileServiceProvider(
     const dbus::ObjectPath& object_path,
@@ -17,7 +17,7 @@
 
   FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client =
       static_cast<FakeBluetoothProfileManagerClient*>(
-          bluez::BluezDBusManager::Get()->GetBluetoothProfileManagerClient());
+          DBusThreadManager::Get()->GetBluetoothProfileManagerClient());
   fake_bluetooth_profile_manager_client->RegisterProfileServiceProvider(this);
 }
 
@@ -26,7 +26,7 @@
 
   FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client =
       static_cast<FakeBluetoothProfileManagerClient*>(
-          bluez::BluezDBusManager::Get()->GetBluetoothProfileManagerClient());
+          DBusThreadManager::Get()->GetBluetoothProfileManagerClient());
   fake_bluetooth_profile_manager_client->UnregisterProfileServiceProvider(this);
 }
 
@@ -58,4 +58,4 @@
   delegate_->Cancel();
 }
 
-}  // namespace bluez
+}  // namespace chromeos
diff --git a/device/bluetooth/dbus/fake_bluetooth_profile_service_provider.h b/chromeos/dbus/fake_bluetooth_profile_service_provider.h
similarity index 79%
rename from device/bluetooth/dbus/fake_bluetooth_profile_service_provider.h
rename to chromeos/dbus/fake_bluetooth_profile_service_provider.h
index 5d7af8d17..2c98048 100644
--- a/device/bluetooth/dbus/fake_bluetooth_profile_service_provider.h
+++ b/chromeos/dbus/fake_bluetooth_profile_service_provider.h
@@ -2,26 +2,25 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_
-#define DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_
+#ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_
+#define CHROMEOS_DBUS_FAKE_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_
 
 #include "base/bind.h"
 #include "base/callback.h"
-#include "base/macros.h"
 #include "base/memory/scoped_ptr.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/bluetooth_profile_service_provider.h"
 #include "dbus/file_descriptor.h"
 #include "dbus/object_path.h"
-#include "device/bluetooth/bluetooth_export.h"
-#include "device/bluetooth/dbus/bluetooth_profile_service_provider.h"
 
-namespace bluez {
+namespace chromeos {
 
 // FakeBluetoothProfileServiceProvider simulates the behavior of a local
 // Bluetooth agent object and is used both in test cases in place of a
 // mock and on the Linux desktop.
 //
 // This class is only called from the dbus origin thread and is not thread-safe.
-class DEVICE_BLUETOOTH_EXPORT FakeBluetoothProfileServiceProvider
+class CHROMEOS_EXPORT FakeBluetoothProfileServiceProvider
     : public BluetoothProfileServiceProvider {
  public:
   FakeBluetoothProfileServiceProvider(const dbus::ObjectPath& object_path,
@@ -56,6 +55,6 @@
   DISALLOW_COPY_AND_ASSIGN(FakeBluetoothProfileServiceProvider);
 };
 
-}  // namespace bluez
+}  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_DBUS_FAKE_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_
+#endif  // CHROMEOS_DBUS_FAKE_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_
diff --git a/chromeos/network/onc/onc_translation_tables.cc b/chromeos/network/onc/onc_translation_tables.cc
index a71f441..27feecb 100644
--- a/chromeos/network/onc/onc_translation_tables.cc
+++ b/chromeos/network/onc/onc_translation_tables.cc
@@ -296,6 +296,7 @@
     {::onc::wifi::kWEP_PSK, shill::kSecurityWep},
     {::onc::wifi::kWPA_PSK, shill::kSecurityPsk},
     {::onc::wifi::kWPA_EAP, shill::kSecurity8021x},
+    {::onc::wifi::kWEP_8021X, shill::kSecurityWep},
     {NULL}};
 
 const StringTranslationEntry kEAPOuterTable[] = {
diff --git a/chromeos/network/onc/onc_translator_onc_to_shill.cc b/chromeos/network/onc/onc_translator_onc_to_shill.cc
index f399d8b..0e84300 100644
--- a/chromeos/network/onc/onc_translator_onc_to_shill.cc
+++ b/chromeos/network/onc/onc_translator_onc_to_shill.cc
@@ -29,6 +29,9 @@
 
 namespace {
 
+// TODO(pstew): Remove once crosreview.com/310644 lands and merges to Chrome.
+const char kKeyManagementIEEE8021X[] = "IEEE8021X";
+
 scoped_ptr<base::StringValue> ConvertValueToString(const base::Value& value) {
   std::string str;
   if (!value.GetAsString(&str))
@@ -220,6 +223,10 @@
                                                  &security)) {
     TranslateWithTableAndSet(security, kWiFiSecurityTable,
                              shill::kSecurityClassProperty);
+    if (security == ::onc::wifi::kWEP_8021X) {
+      shill_dictionary_->SetStringWithoutPathExpansion(
+          shill::kEapKeyMgmtProperty, kKeyManagementIEEE8021X);
+    }
   }
 
   // We currently only support managed and no adhoc networks.
diff --git a/chromeos/network/onc/onc_translator_shill_to_onc.cc b/chromeos/network/onc/onc_translator_shill_to_onc.cc
index f91950f..e76f5e6 100644
--- a/chromeos/network/onc/onc_translator_shill_to_onc.cc
+++ b/chromeos/network/onc/onc_translator_shill_to_onc.cc
@@ -27,6 +27,9 @@
 
 namespace {
 
+// TODO(pstew): Remove once crosreview.com/310644 lands and merges to Chrome.
+const char kKeyManagementIEEE8021X[] = "IEEE8021X";
+
 // Converts |str| to a base::Value of the given |type|. If the conversion fails,
 // returns NULL.
 scoped_ptr<base::Value> ConvertStringToValue(const std::string& str,
@@ -329,8 +332,21 @@
 }
 
 void ShillToONCTranslator::TranslateWiFiWithState() {
-  TranslateWithTableAndSet(shill::kSecurityClassProperty, kWiFiSecurityTable,
-                           ::onc::wifi::kSecurity);
+  std::string shill_security;
+  std::string shill_key_mgmt;
+  if (shill_dictionary_->GetStringWithoutPathExpansion(
+          shill::kSecurityClassProperty, &shill_security) &&
+      shill_security == shill::kSecurityWep &&
+      shill_dictionary_->GetStringWithoutPathExpansion(
+          shill::kEapKeyMgmtProperty, &shill_key_mgmt) &&
+      shill_key_mgmt == kKeyManagementIEEE8021X) {
+    onc_object_->SetStringWithoutPathExpansion(::onc::wifi::kSecurity,
+                                               ::onc::wifi::kWEP_8021X);
+  } else {
+    TranslateWithTableAndSet(shill::kSecurityClassProperty, kWiFiSecurityTable,
+                             ::onc::wifi::kSecurity);
+  }
+
   bool unknown_encoding = true;
   std::string ssid = shill_property_util::GetSSIDFromProperties(
       *shill_dictionary_, false /* verbose_logging */, &unknown_encoding);
diff --git a/chromeos/network/onc/onc_translator_unittest.cc b/chromeos/network/onc/onc_translator_unittest.cc
index 72ceae1..7de265a 100644
--- a/chromeos/network/onc/onc_translator_unittest.cc
+++ b/chromeos/network/onc/onc_translator_unittest.cc
@@ -51,6 +51,8 @@
         std::make_pair("valid_wifi_psk.onc", "shill_wifi_psk.json"),
         std::make_pair("wifi_clientcert_with_cert_pems.onc",
                        "shill_wifi_clientcert.json"),
+        std::make_pair("wifi_wep_8021x_clientcert_with_cert_pems.onc",
+                       "shill_wifi_wep_8021x_clientcert.json"),
         std::make_pair("valid_wifi_clientref.onc", "shill_wifi_clientref.json"),
         std::make_pair("valid_l2tpipsec.onc", "shill_l2tpipsec.json"),
         std::make_pair("wifi_dhcp.onc", "shill_wifi_dhcp.json"),
@@ -106,6 +108,8 @@
                        "translation_of_shill_wifi_clientcert.onc"),
         std::make_pair("shill_wifi_non_utf8_ssid.json",
                        "translation_of_shill_wifi_non_utf8_ssid.onc"),
+        std::make_pair("shill_wifi_wep_8021x_clientcert.json",
+                       "translation_of_shill_wifi_wep_8021x_clientcert.onc"),
         std::make_pair("shill_output_l2tpipsec.json",
                        "translation_of_shill_l2tpipsec.onc"),
         std::make_pair("shill_output_openvpn.json",
diff --git a/chromeos/test/data/network/shill_wifi_wep_8021x_clientcert.json b/chromeos/test/data/network/shill_wifi_wep_8021x_clientcert.json
new file mode 100644
index 0000000..e4aadb4
--- /dev/null
+++ b/chromeos/test/data/network/shill_wifi_wep_8021x_clientcert.json
@@ -0,0 +1,14 @@
+{
+   "EAP.EAP": "TLS",
+   "EAP.Identity": "abc ${LOGIN_ID}@my.domain.com",
+   "EAP.UseProactiveKeyCaching": true,
+   "EAP.UseSystemCAs": true,
+   "GUID": "{77db0089-0bc8-4358-929c-123xcv}",
+   "EAP.KeyMgmt": "IEEE8021X",
+   "Mode": "managed",
+   "ProxyConfig": "{\"mode\":\"pac_script\",\"pac_mandatory\":false,\"pac_url\":\"https://proxycfg.my.domain.com/proxy.dat\"}",
+   "SaveCredentials": true,
+   "SecurityClass": "wep",
+   "Type": "wifi",
+   "WiFi.HexSSID": "4F70656E577274" // "OpenWrt"
+}
diff --git a/chromeos/test/data/network/translation_of_shill_wifi_wep_8021x_clientcert.onc b/chromeos/test/data/network/translation_of_shill_wifi_wep_8021x_clientcert.onc
new file mode 100644
index 0000000..ee6c5f4
--- /dev/null
+++ b/chromeos/test/data/network/translation_of_shill_wifi_wep_8021x_clientcert.onc
@@ -0,0 +1,20 @@
+{
+  "GUID":"{77db0089-0bc8-4358-929c-123xcv}",
+  "Name":"",
+  "ProxySettings": {
+      "Type": "PAC",
+      "PAC": "https://proxycfg.my.domain.com/proxy.dat"
+  },
+  "Type":"WiFi",
+  "WiFi":{
+    "EAP": {
+      "Identity": "abc ${LOGIN_ID}@my.domain.com",
+      "SaveCredentials": true,
+      "UseProactiveKeyCaching": true,
+      "UseSystemCAs": true
+    },
+    "HexSSID":"4F70656E577274", // "OpenWrt"
+    "SSID":"OpenWrt",
+    "Security":"WEP-8021X"
+  }
+}
diff --git a/chromeos/test/data/network/wifi_wep_8021x_clientcert_with_cert_pems.onc b/chromeos/test/data/network/wifi_wep_8021x_clientcert_with_cert_pems.onc
new file mode 100644
index 0000000..1bf4a16e
--- /dev/null
+++ b/chromeos/test/data/network/wifi_wep_8021x_clientcert_with_cert_pems.onc
@@ -0,0 +1,30 @@
+{
+    "GUID": "{77db0089-0bc8-4358-929c-123xcv}",
+    "Type": "WiFi",
+    "Name": "SomeWifi-XY",
+    "WiFi": {
+        "HexSSID": "4F70656E577274", // Hex of "OpenWrt"
+        "Security": "WEP-8021X",
+        "Recommended": [ "AutoConnect" ],
+        "EAP": {
+            "Outer": "EAP-TLS",
+            "Identity": "abc ${LOGIN_ID}@my.domain.com",
+            "UseProactiveKeyCaching": true,
+            "UseSystemCAs": true,
+            "ClientCertType": "Pattern",
+            "ClientCertPattern": {
+                "IssuerCAPEMs": [
+                    "pem1",
+                    "pem2"
+                ],
+                "EnrollmentURI": [ "chrome-extension://delkjfjibodjclmdijflfnimdmgdagfk/generate-cert.html" ]
+            },
+            "Recommended": [ "Identity" ],
+            "SaveCredentials": true
+        }
+    },
+    "ProxySettings": {
+        "Type": "PAC",
+        "PAC": "https://proxycfg.my.domain.com/proxy.dat"
+    }
+}
diff --git a/components/OWNERS b/components/OWNERS
index 7de4ca9..2eae610 100644
--- a/components/OWNERS
+++ b/components/OWNERS
@@ -251,6 +251,8 @@
 per-file renderer_context_menu*=avi@chromium.org
 per-file renderer_context_menu*=lazyboy@chromium.org
 
+per-file safe_browsing_db.gypi=nparker@chromium.org
+
 per-file safe_json.gypi=bauerb@chromium.org
 per-file safe_json.gypi=rsesek@chromium.org
 
diff --git a/components/autofill_strings.grdp b/components/autofill_strings.grdp
index 7a5eda75..db016fe 100644
--- a/components/autofill_strings.grdp
+++ b/components/autofill_strings.grdp
@@ -17,15 +17,28 @@
   <message name="IDS_AUTOFILL_WARNING_INSECURE_CONNECTION" desc="Warning text to show when credit card autofill is disabled because the website is not using a secure connection.">
     Automatic credit card filling is disabled because this form does not use a secure connection.
   </message>
-  <message name="IDS_AUTOFILL_DELETE_AUTOCOMPLETE_SUGGESTION_CONFIRMATION_BODY" desc="Text in a dialog to confirm that the user wants to delete an autocomplete form history suggestion.">
-    Remove form suggestion from Chrome?
-  </message>
-  <message name="IDS_AUTOFILL_DELETE_CREDIT_CARD_SUGGESTION_CONFIRMATION_BODY" desc="Text in a dialog to confirm that the user wants to delete a credit card from Chrome Autofill.">
-    Remove credit card from Chrome?
-  </message>
-  <message name="IDS_AUTOFILL_DELETE_PROFILE_SUGGESTION_CONFIRMATION_BODY" desc="Text in a dialog to confirm that the user wants to delete an address from Chrome Autofill.">
-    Remove address from Chrome?
-  </message>
+  <if expr="_google_chrome">
+    <message name="IDS_AUTOFILL_DELETE_AUTOCOMPLETE_SUGGESTION_CONFIRMATION_BODY" desc="Text in a dialog to confirm that the user wants to delete an autocomplete form history suggestion.">
+      Remove form suggestion from Chrome?
+    </message>
+    <message name="IDS_AUTOFILL_DELETE_CREDIT_CARD_SUGGESTION_CONFIRMATION_BODY" desc="Text in a dialog to confirm that the user wants to delete a credit card from Autofill.">
+      Remove credit card from Chrome?
+    </message>
+    <message name="IDS_AUTOFILL_DELETE_PROFILE_SUGGESTION_CONFIRMATION_BODY" desc="Text in a dialog to confirm that the user wants to delete an address from Autofill.">
+      Remove address from Chrome?
+    </message>
+  </if>
+  <if expr="not _google_chrome">
+    <message name="IDS_AUTOFILL_DELETE_AUTOCOMPLETE_SUGGESTION_CONFIRMATION_BODY" desc="Text in a dialog to confirm that the user wants to delete an autocomplete form history suggestion.">
+      Remove form suggestion from Chromium?
+    </message>
+    <message name="IDS_AUTOFILL_DELETE_CREDIT_CARD_SUGGESTION_CONFIRMATION_BODY" desc="Text in a dialog to confirm that the user wants to delete a credit card from Autofill.">
+      Remove credit card from Chromium?
+    </message>
+    <message name="IDS_AUTOFILL_DELETE_PROFILE_SUGGESTION_CONFIRMATION_BODY" desc="Text in a dialog to confirm that the user wants to delete an address from Autofill.">
+      Remove address from Chromium?
+    </message>
+  </if>
   <message name="IDS_AUTOFILL_CC_AMEX" desc="Full American Express credit card name.">
     American Express
   </message>
@@ -159,9 +172,16 @@
   <message name="IDS_AUTOFILL_CC_INFOBAR_DENY" desc="Text to show for the Autofill credit card request infobar deny button.">
     Don't save
   </message>
-  <message name="IDS_AUTOFILL_CC_INFOBAR_TEXT" desc="Text to show in the Autofill credit card request infobar.">
-    Do you want Chrome to save this credit card information for completing web forms?
-  </message>
+  <if expr="_google_chrome">
+    <message name="IDS_AUTOFILL_CC_INFOBAR_TEXT" desc="Text to show in the Autofill credit card request infobar.">
+      Do you want Chrome to save this credit card information for completing web forms?
+    </message>
+  </if>
+  <if expr="not _google_chrome">
+    <message name="IDS_AUTOFILL_CC_INFOBAR_TEXT" desc="Text to show in the Autofill credit card request infobar.">
+      Do you want Chromium to save this credit card information for completing web forms?
+    </message>
+  </if>
 
   <!-- Autofill save credit card bubble -->
   <message name="IDS_AUTOFILL_SAVE_CARD_BUBBLE_ACCEPT" desc="Text to show for the Autofill save credit card bubble accept button.">
@@ -170,9 +190,16 @@
   <message name="IDS_AUTOFILL_SAVE_CARD_BUBBLE_DENY" desc="Text to show for the Autofill save credit card bubble deny button.">
     No thanks
   </message>
-  <message name="IDS_AUTOFILL_SAVE_CARD_BUBBLE_TITLE_LOCAL" desc="Title text for the Autofill save card bubble when the card is to be saved locally.">
-    Do you want to save this card with Chrome?
-  </message>
+  <if expr="_google_chrome">
+    <message name="IDS_AUTOFILL_SAVE_CARD_BUBBLE_TITLE_LOCAL" desc="Title text for the Autofill save card bubble when the card is to be saved locally.">
+      Do you want Chrome to save this card?
+    </message>
+  </if>
+  <if expr="not _google_chrome">
+    <message name="IDS_AUTOFILL_SAVE_CARD_BUBBLE_TITLE_LOCAL" desc="Title text for the Autofill save card bubble when the card is to be saved locally.">
+      Do you want Chromium to save this card?
+    </message>
+  </if>
 
   <!-- Autofill credit card unmask prompt -->
   <message name="IDS_AUTOFILL_CARD_UNMASK_PROMPT_ERROR_TRY_AGAIN" desc="Error message that encourages the user to try to re-enter their credit card CVC after a previous failed attempt.">
@@ -181,9 +208,16 @@
   <message name="IDS_AUTOFILL_CARD_UNMASK_PROMPT_ERROR_TRY_AGAIN_WITH_EXPIRATION" desc="Error message that encourages the user to try to re-enter their credit card expiration date and CVC after a previous failed attempt.">
     Check your expiration date and CVC and try again
   </message>
-  <message name="IDS_AUTOFILL_CARD_UNMASK_PROMPT_ERROR_PERMANENT" desc="Error message to show when a credit card cannot be verified and the user isn't allowed to retry.">
-    Chrome was unable to verify your card at this time. Please try again later.
-  </message>
+  <if expr="_google_chrome">
+    <message name="IDS_AUTOFILL_CARD_UNMASK_PROMPT_ERROR_PERMANENT" desc="Error message to show when a credit card cannot be verified and the user isn't allowed to retry.">
+      Chrome was unable to verify your card at this time. Please try again later.
+    </message>
+  </if>
+  <if expr="not _google_chrome">
+    <message name="IDS_AUTOFILL_CARD_UNMASK_PROMPT_ERROR_PERMANENT" desc="Error message to show when a credit card cannot be verified and the user isn't allowed to retry.">
+      Chromium was unable to verify your card at this time. Please try again later.
+    </message>
+  </if>
   <message name="IDS_AUTOFILL_CARD_UNMASK_PROMPT_ERROR_NETWORK" desc="Error message to show when a credit card cannot be verified because Wallet servers can't be reached.">
     There was a problem verifying your card. Check your internet connection and try again.
   </message>
diff --git a/components/bookmarks/common/android/BUILD.gn b/components/bookmarks/common/android/BUILD.gn
index 11bcef43..7c69e4b 100644
--- a/components/bookmarks/common/android/BUILD.gn
+++ b/components/bookmarks/common/android/BUILD.gn
@@ -41,7 +41,4 @@
   sources = [
     "bookmark_type.h",
   ]
-  outputs = [
-    "org/chromium/components/bookmarks/BookmarkType.java",
-  ]
 }
diff --git a/components/components_tests.gyp b/components/components_tests.gyp
index 82e668e1..c949193 100644
--- a/components/components_tests.gyp
+++ b/components/components_tests.gyp
@@ -578,7 +578,7 @@
     ],
     'safe_browsing_db_unittest_sources': [
       'safe_browsing_db/prefix_set_unittest.cc',
-      'safe_browsing_db/util_unittest.cc',
+      'safe_browsing_db/safe_browsing_db_util_unittest.cc',
     ],
     'safe_json_unittest_sources': [
       'safe_json/json_sanitizer_unittest.cc',
diff --git a/components/enhanced_bookmarks/BUILD.gn b/components/enhanced_bookmarks/BUILD.gn
index eba6781..76fd35af 100644
--- a/components/enhanced_bookmarks/BUILD.gn
+++ b/components/enhanced_bookmarks/BUILD.gn
@@ -73,9 +73,6 @@
     sources = [
       "enhanced_bookmark_utils.h",
     ]
-    outputs = [
-      "org/chromium/chrome/browser/enhancedbookmarks/LaunchLocation.java",
-    ]
   }
 }
 
diff --git a/components/offline_pages/BUILD.gn b/components/offline_pages/BUILD.gn
index 445d948..cffaa7ef 100644
--- a/components/offline_pages/BUILD.gn
+++ b/components/offline_pages/BUILD.gn
@@ -54,9 +54,5 @@
     sources = [
       "offline_page_model.h",
     ]
-    outputs = [
-      "org/chromium/components/offlinepages/DeletePageResult.java",
-      "org/chromium/components/offlinepages/SavePageResult.java",
-    ]
   }
 }
diff --git a/components/omnibox/browser/BUILD.gn b/components/omnibox/browser/BUILD.gn
index 0457a09..b1984fd3 100644
--- a/components/omnibox/browser/BUILD.gn
+++ b/components/omnibox/browser/BUILD.gn
@@ -145,9 +145,6 @@
     sources = [
       "autocomplete_match_type.h",
     ]
-    outputs = [
-      "org/chromium/chrome/browser/omnibox/OmniboxSuggestionType.java",
-    ]
   }
 }
 
diff --git a/components/password_manager/core/common/credential_manager_types.cc b/components/password_manager/core/common/credential_manager_types.cc
index 7896cfc..acdff8d 100644
--- a/components/password_manager/core/common/credential_manager_types.cc
+++ b/components/password_manager/core/common/credential_manager_types.cc
@@ -60,5 +60,10 @@
   form->username_value = info.id;
   return form.Pass();
 }
+bool CredentialInfo::operator==(const CredentialInfo& rhs) const {
+  return (type == rhs.type && id == rhs.id && name == rhs.name &&
+          icon == rhs.icon && password == rhs.password &&
+          federation == rhs.federation);
+}
 
 }  // namespace password_manager
diff --git a/components/password_manager/core/common/credential_manager_types.h b/components/password_manager/core/common/credential_manager_types.h
index 19e2124c..41b4a080 100644
--- a/components/password_manager/core/common/credential_manager_types.h
+++ b/components/password_manager/core/common/credential_manager_types.h
@@ -34,6 +34,8 @@
   CredentialInfo(const autofill::PasswordForm& form, CredentialType form_type);
   ~CredentialInfo();
 
+  bool operator==(const CredentialInfo& rhs) const;
+
   CredentialType type;
 
   // An identifier (username, email address, etc). Corresponds to
diff --git a/components/safe_browsing_db.gypi b/components/safe_browsing_db.gypi
index a874bfa..c5cec12c 100644
--- a/components/safe_browsing_db.gypi
+++ b/components/safe_browsing_db.gypi
@@ -16,8 +16,8 @@
         # Note: sources list duplicated in GN build.
         'safe_browsing_db/prefix_set.h',
         'safe_browsing_db/prefix_set.cc',
-        'safe_browsing_db/util.h',
-        'safe_browsing_db/util.cc',
+        'safe_browsing_db/safe_browsing_db_util.h',
+        'safe_browsing_db/safe_browsing_db_util.cc',
       ],
       'include_dirs': [
         '..',
diff --git a/components/safe_browsing_db/BUILD.gn b/components/safe_browsing_db/BUILD.gn
index bc82f79..4147fe9 100644
--- a/components/safe_browsing_db/BUILD.gn
+++ b/components/safe_browsing_db/BUILD.gn
@@ -5,7 +5,7 @@
 group("safe_browsing_db") {
   deps = [
     ":prefix_set",
-    ":util",
+    ":safe_browsing_db_util",
   ]
 }
 
@@ -19,10 +19,10 @@
   ]
 }
 
-source_set("util") {
+source_set("safe_browsing_db_util") {
   sources = [
-    "util.cc",
-    "util.h",
+    "safe_browsing_db_util.cc",
+    "safe_browsing_db_util.h",
   ]
   deps = [
     "//base",
@@ -34,11 +34,11 @@
   testonly = true
   sources = [
     "prefix_set_unittest.cc",
-    "util_unittest.cc",
+    "safe_browsing_db_util_unittest.cc",
   ]
   deps = [
     ":prefix_set",
-    ":util",
+    ":safe_browsing_db_util",
     "//base",
     "//testing/gtest",
   ]
diff --git a/components/safe_browsing_db/DEPS b/components/safe_browsing_db/DEPS
index 12af900..4ef4138e4 100644
--- a/components/safe_browsing_db/DEPS
+++ b/components/safe_browsing_db/DEPS
@@ -1,4 +1,3 @@
 include_rules = [
   "+crypto",
-  "+net",
 ]
diff --git a/components/safe_browsing_db/prefix_set.h b/components/safe_browsing_db/prefix_set.h
index 5517105c..433da66 100644
--- a/components/safe_browsing_db/prefix_set.h
+++ b/components/safe_browsing_db/prefix_set.h
@@ -55,7 +55,7 @@
 #include "base/gtest_prod_util.h"
 #include "base/macros.h"
 #include "base/memory/scoped_ptr.h"
-#include "components/safe_browsing_db/util.h"
+#include "components/safe_browsing_db/safe_browsing_db_util.h"
 
 namespace base {
 class FilePath;
diff --git a/components/safe_browsing_db/prefix_set_unittest.cc b/components/safe_browsing_db/prefix_set_unittest.cc
index 08f639a9..b980e71 100644
--- a/components/safe_browsing_db/prefix_set_unittest.cc
+++ b/components/safe_browsing_db/prefix_set_unittest.cc
@@ -19,7 +19,7 @@
 #include "base/rand_util.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_util.h"
-#include "components/safe_browsing_db/util.h"
+#include "components/safe_browsing_db/safe_browsing_db_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "testing/platform_test.h"
 
diff --git a/components/safe_browsing_db/util.cc b/components/safe_browsing_db/util.cc
deleted file mode 100644
index 8d95b9c..0000000
--- a/components/safe_browsing_db/util.cc
+++ /dev/null
@@ -1,371 +0,0 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/safe_browsing_db/util.h"
-
-#include "base/strings/string_util.h"
-#include "crypto/sha2.h"
-#include "net/base/escape.h"
-#include "url/gurl.h"
-#include "url/url_util.h"
-
-// Utility functions -----------------------------------------------------------
-
-namespace {
-bool IsKnownList(const std::string& name) {
-  for (size_t i = 0; i < arraysize(safe_browsing::kAllLists); ++i) {
-    if (!strcmp(safe_browsing::kAllLists[i], name.c_str())) {
-      return true;
-    }
-  }
-  return false;
-}
-}  // namespace
-
-
-// SBCachedFullHashResult ------------------------------------------------------
-
-SBCachedFullHashResult::SBCachedFullHashResult() {}
-
-SBCachedFullHashResult::SBCachedFullHashResult(
-    const base::Time& in_expire_after)
-    : expire_after(in_expire_after) {}
-
-SBCachedFullHashResult::~SBCachedFullHashResult() {}
-
-
-namespace safe_browsing {
-
-// Listnames that browser can process.
-const char kMalwareList[] = "goog-malware-shavar";
-const char kPhishingList[] = "goog-phish-shavar";
-const char kBinUrlList[] = "goog-badbinurl-shavar";
-const char kCsdWhiteList[] = "goog-csdwhite-sha256";
-const char kDownloadWhiteList[] = "goog-downloadwhite-digest256";
-const char kExtensionBlacklist[] = "goog-badcrxids-digestvar";
-const char kIPBlacklist[] = "goog-badip-digest256";
-const char kUnwantedUrlList[] = "goog-unwanted-shavar";
-const char kInclusionWhitelist[] = "goog-csdinclusionwhite-sha256";
-
-const char* kAllLists[9] = {
-    kMalwareList,
-    kPhishingList,
-    kBinUrlList,
-    kCsdWhiteList,
-    kDownloadWhiteList,
-    kExtensionBlacklist,
-    kIPBlacklist,
-    kUnwantedUrlList,
-    kInclusionWhitelist,
-};
-
-ListType GetListId(const base::StringPiece& name) {
-  ListType id;
-  if (name == kMalwareList) {
-    id = MALWARE;
-  } else if (name == kPhishingList) {
-    id = PHISH;
-  } else if (name == kBinUrlList) {
-    id = BINURL;
-  } else if (name == kCsdWhiteList) {
-    id = CSDWHITELIST;
-  } else if (name == kDownloadWhiteList) {
-    id = DOWNLOADWHITELIST;
-  } else if (name == kExtensionBlacklist) {
-    id = EXTENSIONBLACKLIST;
-  } else if (name == kIPBlacklist) {
-    id = IPBLACKLIST;
-  } else if (name == kUnwantedUrlList) {
-    id = UNWANTEDURL;
-  } else if (name == kInclusionWhitelist) {
-    id = INCLUSIONWHITELIST;
-  } else {
-    id = INVALID;
-  }
-  return id;
-}
-
-bool GetListName(ListType list_id, std::string* list) {
-  switch (list_id) {
-    case MALWARE:
-      *list = kMalwareList;
-      break;
-    case PHISH:
-      *list = kPhishingList;
-      break;
-    case BINURL:
-      *list = kBinUrlList;
-      break;
-    case CSDWHITELIST:
-      *list = kCsdWhiteList;
-      break;
-    case DOWNLOADWHITELIST:
-      *list = kDownloadWhiteList;
-      break;
-    case EXTENSIONBLACKLIST:
-      *list = kExtensionBlacklist;
-      break;
-    case IPBLACKLIST:
-      *list = kIPBlacklist;
-      break;
-    case UNWANTEDURL:
-      *list = kUnwantedUrlList;
-      break;
-    case INCLUSIONWHITELIST:
-      *list = kInclusionWhitelist;
-      break;
-    default:
-      return false;
-  }
-  DCHECK(IsKnownList(*list));
-  return true;
-}
-
-
-SBFullHash SBFullHashForString(const base::StringPiece& str) {
-  SBFullHash h;
-  crypto::SHA256HashString(str, &h.full_hash, sizeof(h.full_hash));
-  return h;
-}
-
-SBFullHash StringToSBFullHash(const std::string& hash_in) {
-  DCHECK_EQ(crypto::kSHA256Length, hash_in.size());
-  SBFullHash hash_out;
-  memcpy(hash_out.full_hash, hash_in.data(), crypto::kSHA256Length);
-  return hash_out;
-}
-
-std::string SBFullHashToString(const SBFullHash& hash) {
-  DCHECK_EQ(crypto::kSHA256Length, sizeof(hash.full_hash));
-  return std::string(hash.full_hash, sizeof(hash.full_hash));
-}
-
-
-std::string Unescape(const std::string& url) {
-  std::string unescaped_str(url);
-  std::string old_unescaped_str;
-  const int kMaxLoopIterations = 1024;
-  int loop_var = 0;
-  do {
-    old_unescaped_str = unescaped_str;
-    unescaped_str = net::UnescapeURLComponent(
-        old_unescaped_str, net::UnescapeRule::SPOOFING_AND_CONTROL_CHARS |
-                               net::UnescapeRule::SPACES |
-                               net::UnescapeRule::URL_SPECIAL_CHARS);
-  } while (unescaped_str != old_unescaped_str && ++loop_var <=
-           kMaxLoopIterations);
-
-  return unescaped_str;
-}
-
-std::string Escape(const std::string& url) {
-  std::string escaped_str;
-  const char* kHexString = "0123456789ABCDEF";
-  for (size_t i = 0; i < url.length(); i++) {
-    unsigned char c = static_cast<unsigned char>(url[i]);
-    if (c <= ' ' || c > '~' || c == '#' || c == '%') {
-      escaped_str.push_back('%');
-      escaped_str.push_back(kHexString[c >> 4]);
-      escaped_str.push_back(kHexString[c & 0xf]);
-    } else {
-      escaped_str.push_back(c);
-    }
-  }
-
-  return escaped_str;
-}
-
-std::string RemoveConsecutiveChars(const std::string& str, const char c) {
-  std::string output(str);
-  std::string string_to_find;
-  std::string::size_type loc = 0;
-  string_to_find.append(2, c);
-  while ((loc = output.find(string_to_find, loc)) != std::string::npos) {
-    output.erase(loc, 1);
-  }
-
-  return output;
-}
-
-// Canonicalizes url as per Google Safe Browsing Specification.
-// See section 6.1 in
-// http://code.google.com/p/google-safe-browsing/wiki/Protocolv2Spec.
-void CanonicalizeUrl(const GURL& url,
-                     std::string* canonicalized_hostname,
-                     std::string* canonicalized_path,
-                     std::string* canonicalized_query) {
-  DCHECK(url.is_valid());
-
-  // We only canonicalize "normal" URLs.
-  if (!url.IsStandard())
-    return;
-
-  // Following canonicalization steps are excluded since url parsing takes care
-  // of those :-
-  // 1. Remove any tab (0x09), CR (0x0d), and LF (0x0a) chars from url.
-  //    (Exclude escaped version of these chars).
-  // 2. Normalize hostname to 4 dot-seperated decimal values.
-  // 3. Lowercase hostname.
-  // 4. Resolve path sequences "/../" and "/./".
-
-  // That leaves us with the following :-
-  // 1. Remove fragment in URL.
-  GURL url_without_fragment;
-  GURL::Replacements f_replacements;
-  f_replacements.ClearRef();
-  f_replacements.ClearUsername();
-  f_replacements.ClearPassword();
-  url_without_fragment = url.ReplaceComponents(f_replacements);
-
-  // 2. Do URL unescaping until no more hex encoded characters exist.
-  std::string url_unescaped_str(Unescape(url_without_fragment.spec()));
-  url::Parsed parsed;
-  url::ParseStandardURL(url_unescaped_str.data(), url_unescaped_str.length(),
-                        &parsed);
-
-  // 3. In hostname, remove all leading and trailing dots.
-  const std::string host =
-      (parsed.host.len > 0)
-          ? url_unescaped_str.substr(parsed.host.begin, parsed.host.len)
-          : std::string();
-  std::string host_without_end_dots;
-  base::TrimString(host, ".", &host_without_end_dots);
-
-  // 4. In hostname, replace consecutive dots with a single dot.
-  std::string host_without_consecutive_dots(RemoveConsecutiveChars(
-      host_without_end_dots, '.'));
-
-  // 5. In path, replace runs of consecutive slashes with a single slash.
-  std::string path =
-      (parsed.path.len > 0)
-          ? url_unescaped_str.substr(parsed.path.begin, parsed.path.len)
-          : std::string();
-  std::string path_without_consecutive_slash(RemoveConsecutiveChars(path, '/'));
-
-  url::Replacements<char> hp_replacements;
-  hp_replacements.SetHost(
-      host_without_consecutive_dots.data(),
-      url::Component(0, host_without_consecutive_dots.length()));
-  hp_replacements.SetPath(
-      path_without_consecutive_slash.data(),
-      url::Component(0, path_without_consecutive_slash.length()));
-
-  std::string url_unescaped_with_can_hostpath;
-  url::StdStringCanonOutput output(&url_unescaped_with_can_hostpath);
-  url::Parsed temp_parsed;
-  url::ReplaceComponents(url_unescaped_str.data(),
-                         url_unescaped_str.length(),
-                         parsed,
-                         hp_replacements,
-                         NULL,
-                         &output,
-                         &temp_parsed);
-  output.Complete();
-
-  // 6. Step needed to revert escaping done in url::ReplaceComponents.
-  url_unescaped_with_can_hostpath = Unescape(url_unescaped_with_can_hostpath);
-
-  // 7. After performing all above steps, percent-escape all chars in url which
-  // are <= ASCII 32, >= 127, #, %. Escapes must be uppercase hex characters.
-  std::string escaped_canon_url_str(Escape(url_unescaped_with_can_hostpath));
-  url::Parsed final_parsed;
-  url::ParseStandardURL(escaped_canon_url_str.data(),
-                        escaped_canon_url_str.length(),
-                        &final_parsed);
-
-  if (canonicalized_hostname && final_parsed.host.len > 0) {
-    *canonicalized_hostname =
-        escaped_canon_url_str.substr(final_parsed.host.begin,
-                                     final_parsed.host.len);
-  }
-  if (canonicalized_path && final_parsed.path.len > 0) {
-    *canonicalized_path = escaped_canon_url_str.substr(final_parsed.path.begin,
-                                                       final_parsed.path.len);
-  }
-  if (canonicalized_query && final_parsed.query.len > 0) {
-    *canonicalized_query = escaped_canon_url_str.substr(
-        final_parsed.query.begin, final_parsed.query.len);
-  }
-}
-
-void GenerateHostsToCheck(const GURL& url, std::vector<std::string>* hosts) {
-  hosts->clear();
-
-  std::string canon_host;
-  CanonicalizeUrl(url, &canon_host, NULL, NULL);
-
-  const std::string host = canon_host;  // const sidesteps GCC bugs below!
-  if (host.empty())
-    return;
-
-  // Per the Safe Browsing Protocol v2 spec, we try the host, and also up to 4
-  // hostnames formed by starting with the last 5 components and successively
-  // removing the leading component.  The last component isn't examined alone,
-  // since it's the TLD or a subcomponent thereof.
-  //
-  // Note that we don't need to be clever about stopping at the "real" eTLD --
-  // the data on the server side has been filtered to ensure it will not
-  // blacklist a whole TLD, and it's not significantly slower on our side to
-  // just check too much.
-  //
-  // Also note that because we have a simple blacklist, not some sort of complex
-  // whitelist-in-blacklist or vice versa, it doesn't matter what order we check
-  // these in.
-  const size_t kMaxHostsToCheck = 4;
-  bool skipped_last_component = false;
-  for (std::string::const_reverse_iterator i(host.rbegin());
-       i != host.rend() && hosts->size() < kMaxHostsToCheck; ++i) {
-    if (*i == '.') {
-      if (skipped_last_component)
-        hosts->push_back(std::string(i.base(), host.end()));
-      else
-        skipped_last_component = true;
-    }
-  }
-  hosts->push_back(host);
-}
-
-void GeneratePathsToCheck(const GURL& url, std::vector<std::string>* paths) {
-  paths->clear();
-
-  std::string canon_path;
-  std::string canon_query;
-  CanonicalizeUrl(url, NULL, &canon_path, &canon_query);
-
-  const std::string path = canon_path;   // const sidesteps GCC bugs below!
-  const std::string query = canon_query;
-  if (path.empty())
-    return;
-
-  // Per the Safe Browsing Protocol v2 spec, we try the exact path with/without
-  // the query parameters, and also up to 4 paths formed by starting at the root
-  // and adding more path components.
-  //
-  // As with the hosts above, it doesn't matter what order we check these in.
-  const size_t kMaxPathsToCheck = 4;
-  for (std::string::const_iterator i(path.begin());
-       i != path.end() && paths->size() < kMaxPathsToCheck; ++i) {
-    if (*i == '/')
-      paths->push_back(std::string(path.begin(), i + 1));
-  }
-
-  if (!paths->empty() && paths->back() != path)
-    paths->push_back(path);
-
-  if (!query.empty())
-    paths->push_back(path + "?" + query);
-}
-
-void GeneratePatternsToCheck(const GURL& url, std::vector<std::string>* urls) {
-  std::vector<std::string> hosts, paths;
-  GenerateHostsToCheck(url, &hosts);
-  GeneratePathsToCheck(url, &paths);
-  for (size_t h = 0; h < hosts.size(); ++h) {
-    for (size_t p = 0; p < paths.size(); ++p) {
-      urls->push_back(hosts[h] + paths[p]);
-    }
-  }
-}
-
-}  // namespace safe_browsing
diff --git a/components/safe_browsing_db/util.h b/components/safe_browsing_db/util.h
deleted file mode 100644
index 666e081..0000000
--- a/components/safe_browsing_db/util.h
+++ /dev/null
@@ -1,167 +0,0 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// Utilities for the SafeBrowsing DB code.
-
-#ifndef COMPONENTS_SAFE_BROWSING_DB_UTIL_H_
-#define COMPONENTS_SAFE_BROWSING_DB_UTIL_H_
-
-#include <cstring>
-#include <string>
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/strings/string_piece.h"
-#include "base/time/time.h"
-
-
-class GURL;
-
-// Different types of threats that SafeBrowsing protects against.
-enum SBThreatType {
-  // No threat at all.
-  SB_THREAT_TYPE_SAFE,
-
-  // The URL is being used for phishing.
-  SB_THREAT_TYPE_URL_PHISHING,
-
-  // The URL hosts malware.
-  SB_THREAT_TYPE_URL_MALWARE,
-
-  // The URL hosts unwanted programs.
-  SB_THREAT_TYPE_URL_UNWANTED,
-
-  // The download URL is malware.
-  SB_THREAT_TYPE_BINARY_MALWARE_URL,
-
-  // Url detected by the client-side phishing model.  Note that unlike the
-  // above values, this does not correspond to a downloaded list.
-  SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL,
-
-  // The Chrome extension or app (given by its ID) is malware.
-  SB_THREAT_TYPE_EXTENSION,
-
-  // Url detected by the client-side malware IP list. This IP list is part
-  // of the client side detection model.
-  SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL,
-};
-
-
-// TODO(vakh): Move all these declarations under safe_browsing namespace.
-// A truncated hash's type.
-typedef uint32 SBPrefix;
-
-// A full hash.
-union SBFullHash {
-  char full_hash[32];
-  SBPrefix prefix;
-};
-
-// Used when we get a gethash response.
-struct SBFullHashResult {
-  SBFullHash hash;
-  // TODO(shess): Refactor to allow ListType here.
-  int list_id;
-  std::string metadata;
-};
-
-// Caches individual response from GETHASH request.
-struct SBCachedFullHashResult {
-  SBCachedFullHashResult();
-  explicit SBCachedFullHashResult(const base::Time& in_expire_after);
-  ~SBCachedFullHashResult();
-
-  base::Time expire_after;
-  std::vector<SBFullHashResult> full_hashes;
-};
-
-
-namespace safe_browsing {
-
-// SafeBrowsing list names.
-extern const char kMalwareList[];
-extern const char kPhishingList[];
-// Binary Download list name.
-extern const char kBinUrlList[];
-// SafeBrowsing client-side detection whitelist list name.
-extern const char kCsdWhiteList[];
-// SafeBrowsing download whitelist list name.
-extern const char kDownloadWhiteList[];
-// SafeBrowsing extension list name.
-extern const char kExtensionBlacklist[];
-// SafeBrowsing csd malware IP blacklist name.
-extern const char kIPBlacklist[];
-// SafeBrowsing unwanted URL list.
-extern const char kUnwantedUrlList[];
-// SafeBrowsing off-domain inclusion whitelist list name.
-extern const char kInclusionWhitelist[];
-// This array must contain all Safe Browsing lists.
-extern const char* kAllLists[9];
-
-
-enum ListType {
-  INVALID = -1,
-  MALWARE = 0,
-  PHISH = 1,
-  BINURL = 2,
-  // Obsolete BINHASH = 3,
-  CSDWHITELIST = 4,
-  // SafeBrowsing lists are stored in pairs.  Keep ListType 5
-  // available for a potential second list that we would store in the
-  // csd-whitelist store file.
-  DOWNLOADWHITELIST = 6,
-  // See above comment. Leave 7 available.
-  EXTENSIONBLACKLIST = 8,
-  // See above comment. Leave 9 available.
-  // Obsolete SIDEEFFECTFREEWHITELIST = 10,
-  // See above comment. Leave 11 available.
-  IPBLACKLIST = 12,
-  // See above comment.  Leave 13 available.
-  UNWANTEDURL = 14,
-  // See above comment.  Leave 15 available.
-  INCLUSIONWHITELIST = 16,
-  // See above comment.  Leave 17 available.
-};
-
-
-inline bool SBFullHashEqual(const SBFullHash& a, const SBFullHash& b) {
-  return !memcmp(a.full_hash, b.full_hash, sizeof(a.full_hash));
-}
-
-inline bool SBFullHashLess(const SBFullHash& a, const SBFullHash& b) {
-  return memcmp(a.full_hash, b.full_hash, sizeof(a.full_hash)) < 0;
-}
-
-// Generate full hash for the given string.
-SBFullHash SBFullHashForString(const base::StringPiece& str);
-SBFullHash StringToSBFullHash(const std::string& hash_in);
-std::string SBFullHashToString(const SBFullHash& hash_out);
-
-
-// Maps a list name to ListType.
-ListType GetListId(const base::StringPiece& name);
-
-// Maps a ListId to list name. Return false if fails.
-bool GetListName(ListType list_id, std::string* list);
-
-// Canonicalizes url as per Google Safe Browsing Specification.
-// See section 6.1 in
-// http://code.google.com/p/google-safe-browsing/wiki/Protocolv2Spec.
-void CanonicalizeUrl(const GURL& url, std::string* canonicalized_hostname,
-                     std::string* canonicalized_path,
-                     std::string* canonicalized_query);
-
-// Given a URL, returns all the hosts we need to check.  They are returned
-// in order of size (i.e. b.c is first, then a.b.c).
-void GenerateHostsToCheck(const GURL& url, std::vector<std::string>* hosts);
-
-// Given a URL, returns all the paths we need to check.
-void GeneratePathsToCheck(const GURL& url, std::vector<std::string>* paths);
-
-// Given a URL, returns all the patterns we need to check.
-void GeneratePatternsToCheck(const GURL& url, std::vector<std::string>* urls);
-
-}  // namespace safe_browsing
-
-#endif  // COMPONENTS_SAFE_BROWSING_DB_UTIL_H_
diff --git a/components/scheduler/renderer/renderer_scheduler.cc b/components/scheduler/renderer/renderer_scheduler.cc
index 8a32b8b..aedc3c6f 100644
--- a/components/scheduler/renderer/renderer_scheduler.cc
+++ b/components/scheduler/renderer/renderer_scheduler.cc
@@ -54,6 +54,8 @@
       return "compositor_gesture";
     case UseCase::MAIN_THREAD_GESTURE:
       return "main_thread_gesture";
+    case UseCase::SYNCHRONIZED_GESTURE:
+      return "synchronized_gesture";
     case UseCase::TOUCHSTART:
       return "touchstart";
     case UseCase::LOADING:
diff --git a/components/scheduler/renderer/renderer_scheduler.h b/components/scheduler/renderer/renderer_scheduler.h
index 0caaf82..4f7da03 100644
--- a/components/scheduler/renderer/renderer_scheduler.h
+++ b/components/scheduler/renderer/renderer_scheduler.h
@@ -34,6 +34,7 @@
     NONE,
     COMPOSITOR_GESTURE,
     MAIN_THREAD_GESTURE,
+    SYNCHRONIZED_GESTURE,  // Both threads in the critical path.
     TOUCHSTART,
     LOADING,
     // Must be the last entry.
diff --git a/components/scheduler/renderer/renderer_scheduler_impl.cc b/components/scheduler/renderer/renderer_scheduler_impl.cc
index d9aee6d..b1fe02b 100644
--- a/components/scheduler/renderer/renderer_scheduler_impl.cc
+++ b/components/scheduler/renderer/renderer_scheduler_impl.cc
@@ -129,13 +129,15 @@
 RendererSchedulerImpl::AnyThread::AnyThread()
     : awaiting_touch_start_response(false),
       in_idle_period(false),
-      begin_main_frame_on_critical_path(false) {}
+      begin_main_frame_on_critical_path(false),
+      last_gesture_was_compositor_driven(false) {}
+
+RendererSchedulerImpl::AnyThread::~AnyThread() {}
 
 RendererSchedulerImpl::CompositorThreadOnly::CompositorThreadOnly()
     : last_input_type(blink::WebInputEvent::Undefined) {}
 
-RendererSchedulerImpl::CompositorThreadOnly::~CompositorThreadOnly() {
-}
+RendererSchedulerImpl::CompositorThreadOnly::~CompositorThreadOnly() {}
 
 void RendererSchedulerImpl::Shutdown() {
   helper_.Shutdown();
@@ -398,9 +400,10 @@
 void RendererSchedulerImpl::DidAnimateForInputOnCompositorThread() {
   TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"),
                "RendererSchedulerImpl::DidAnimateForInputOnCompositorThread");
-  UpdateForInputEventOnCompositorThread(
-      blink::WebInputEvent::Undefined,
-      InputEventState::EVENT_CONSUMED_BY_COMPOSITOR);
+  base::AutoLock lock(any_thread_lock_);
+  AnyThread().fling_compositor_escalation_deadline =
+      helper_.tick_clock()->NowTicks() +
+      base::TimeDelta::FromMilliseconds(kFlingEscalationLimitMillis);
 }
 
 void RendererSchedulerImpl::UpdateForInputEventOnCompositorThread(
@@ -429,6 +432,10 @@
     switch (type) {
       case blink::WebInputEvent::TouchStart:
         AnyThread().awaiting_touch_start_response = true;
+        // This is just a fail-safe to reset the state of
+        // |last_gesture_was_compositor_driven| to the default. We don't know
+        // yet where the gesture will run.
+        AnyThread().last_gesture_was_compositor_driven = false;
         break;
 
       case blink::WebInputEvent::TouchMove:
@@ -444,10 +451,19 @@
         }
         break;
 
-      case blink::WebInputEvent::Undefined:
+      case blink::WebInputEvent::GesturePinchBegin:
+      case blink::WebInputEvent::GestureScrollBegin:
+        AnyThread().last_gesture_was_compositor_driven =
+            input_event_state == InputEventState::EVENT_CONSUMED_BY_COMPOSITOR;
+        AnyThread().awaiting_touch_start_response = false;
+        break;
+
+      case blink::WebInputEvent::GestureFlingCancel:
+        AnyThread().fling_compositor_escalation_deadline = base::TimeTicks();
+        break;
+
       case blink::WebInputEvent::GestureTapDown:
       case blink::WebInputEvent::GestureShowPress:
-      case blink::WebInputEvent::GestureFlingCancel:
       case blink::WebInputEvent::GestureScrollEnd:
         // With no observable effect, these meta events do not indicate a
         // meaningful touchstart response and should not impact task priority.
@@ -486,12 +502,13 @@
     return false;
 
   MaybeUpdatePolicy();
-  // The touchstart and main-thread gesture use cases indicate a strong
-  // likelihood of high-priority work in the near future.
+  // The touchstart, synchronized gesture and main-thread gesture use cases
+  // indicate a strong likelihood of high-priority work in the near future.
   UseCase use_case = MainThreadOnly().current_use_case;
   return MainThreadOnly().touchstart_expected_soon ||
          use_case == UseCase::TOUCHSTART ||
-         use_case == UseCase::MAIN_THREAD_GESTURE;
+         use_case == UseCase::MAIN_THREAD_GESTURE ||
+         use_case == UseCase::SYNCHRONIZED_GESTURE;
 }
 
 bool RendererSchedulerImpl::ShouldYieldForHighPriorityWork() {
@@ -506,13 +523,12 @@
   // for it since these tasks are not user-provided work and they are only
   // intended to run before the next task, not interrupt the tasks.
   switch (MainThreadOnly().current_use_case) {
+    case UseCase::COMPOSITOR_GESTURE:
     case UseCase::NONE:
       return MainThreadOnly().touchstart_expected_soon;
 
-    case UseCase::COMPOSITOR_GESTURE:
-      return MainThreadOnly().touchstart_expected_soon;
-
     case UseCase::MAIN_THREAD_GESTURE:
+    case UseCase::SYNCHRONIZED_GESTURE:
       return !compositor_task_runner_->IsQueueEmpty() ||
              MainThreadOnly().touchstart_expected_soon;
 
@@ -578,7 +594,7 @@
   bool touchstart_expected_soon = false;
   if (MainThreadOnly().has_visible_render_widget_with_touch_handler) {
     touchstart_expected_soon = AnyThread().user_model.IsGestureExpectedSoon(
-        use_case, now, &touchstart_expected_flag_valid_for_duration);
+        now, &touchstart_expected_flag_valid_for_duration);
   }
   MainThreadOnly().touchstart_expected_soon = touchstart_expected_soon;
 
@@ -620,6 +636,7 @@
   bool block_expensive_timer_tasks = false;
   switch (use_case) {
     case UseCase::COMPOSITOR_GESTURE:
+      // We could be in a fling, so it's possible for another gesture to start.
       if (touchstart_expected_soon) {
         block_expensive_loading_tasks = true;
         block_expensive_timer_tasks = true;
@@ -632,14 +649,25 @@
       }
       break;
 
+    case UseCase::SYNCHRONIZED_GESTURE:
+      new_policy.compositor_queue_priority = TaskQueue::HIGH_PRIORITY;
+      block_expensive_loading_tasks = true;
+      block_expensive_timer_tasks = true;
+      break;
+
     case UseCase::MAIN_THREAD_GESTURE:
       // In main thread gestures we don't have perfect knowledge about which
       // things we should be prioritizing. The following is best guess
       // heuristic which lets us produce frames quickly but does not prevent
       // loading of additional content.
       new_policy.compositor_queue_priority = TaskQueue::HIGH_PRIORITY;
-      block_expensive_loading_tasks = false;
-      block_expensive_timer_tasks = true;
+      if (touchstart_expected_soon) {
+        block_expensive_loading_tasks = true;
+        block_expensive_timer_tasks = true;
+      } else {
+        block_expensive_loading_tasks = false;
+        block_expensive_timer_tasks = true;
+      }
       break;
 
     case UseCase::TOUCHSTART:
@@ -732,6 +760,7 @@
   switch (ComputeCurrentUseCase(now, &unused_policy_duration)) {
     case UseCase::COMPOSITOR_GESTURE:
     case UseCase::MAIN_THREAD_GESTURE:
+    case UseCase::SYNCHRONIZED_GESTURE:
     case UseCase::TOUCHSTART:
       return true;
 
@@ -745,25 +774,40 @@
     base::TimeTicks now,
     base::TimeDelta* expected_use_case_duration) const {
   any_thread_lock_.AssertAcquired();
+  // Special case for flings. This is needed because we don't get notification
+  // of a fling ending (although we do for cancellation).
+  if (AnyThread().fling_compositor_escalation_deadline > now) {
+    *expected_use_case_duration =
+        AnyThread().fling_compositor_escalation_deadline - now;
+    return UseCase::COMPOSITOR_GESTURE;
+  }
   // Above all else we want to be responsive to user input.
   *expected_use_case_duration =
       AnyThread().user_model.TimeLeftInUserGesture(now);
   if (*expected_use_case_duration > base::TimeDelta()) {
-    // Has scrolling been fully established?
+    // Has a gesture been fully established?
     if (AnyThread().awaiting_touch_start_response) {
       // No, so arrange for compositor tasks to be run at the highest priority.
       return UseCase::TOUCHSTART;
     }
-    // Yes scrolling has been established.  If BeginMainFrame is on the critical
-    // path, compositor tasks need to be prioritized, otherwise now might be a
-    // good time to run potentially expensive work.
+
+    // Yes a gesture has been established.  Based on how the gesture is handled
+    // we need to choose between one of three use cases:
+    // 1. COMPOSITOR_GESTURE where the gesture is processed only on the
+    //    compositor thread.
+    // 2. MAIN_THREAD_GESTURE where the gesture is processed only on the main
+    //    thread.
+    // 3. SYNCHRONIZED_GESTURE where the gesture is processed on both threads.
     // TODO(skyostil): Consider removing in_idle_period_ and
     // HadAnIdlePeriodRecently() unless we need them here.
-    if (AnyThread().begin_main_frame_on_critical_path) {
-      return UseCase::MAIN_THREAD_GESTURE;
-    } else {
-      return UseCase::COMPOSITOR_GESTURE;
+    if (AnyThread().last_gesture_was_compositor_driven) {
+      if (AnyThread().begin_main_frame_on_critical_path) {
+        return UseCase::SYNCHRONIZED_GESTURE;
+      } else {
+        return UseCase::COMPOSITOR_GESTURE;
+      }
     }
+    return UseCase::MAIN_THREAD_GESTURE;
   }
 
   // TODO(alexclarke): return UseCase::LOADING if signals suggest the system is
@@ -871,6 +915,10 @@
       "rails_loading_priority_deadline",
       (AnyThread().rails_loading_priority_deadline - base::TimeTicks())
           .InMillisecondsF());
+  state->SetDouble(
+      "fling_compositor_escalation_deadline",
+      (AnyThread().fling_compositor_escalation_deadline - base::TimeTicks())
+          .InMillisecondsF());
   state->SetInteger("navigation_task_expected_count",
                     MainThreadOnly().navigation_task_expected_count);
   state->SetDouble("last_idle_period_end_time",
@@ -880,6 +928,8 @@
                     AnyThread().awaiting_touch_start_response);
   state->SetBoolean("begin_main_frame_on_critical_path",
                     AnyThread().begin_main_frame_on_critical_path);
+  state->SetBoolean("last_gesture_was_compositor_driven",
+                    AnyThread().last_gesture_was_compositor_driven);
   state->SetDouble("expected_loading_task_duration",
                    MainThreadOnly()
                        .loading_task_cost_estimator.expected_task_duration()
diff --git a/components/scheduler/renderer/renderer_scheduler_impl.h b/components/scheduler/renderer/renderer_scheduler_impl.h
index 70f2eaa..5b5f6e9 100644
--- a/components/scheduler/renderer/renderer_scheduler_impl.h
+++ b/components/scheduler/renderer/renderer_scheduler_impl.h
@@ -168,6 +168,10 @@
   // of shared timers is enabled.
   static const int kSuspendTimersWhenBackgroundedDelayMillis = 5 * 60 * 1000;
 
+  // The time we should stay in a priority-escalated mode after a call to
+  // DidAnimateForInputOnCompositorThread().
+  static const int kFlingEscalationLimitMillis = 100;
+
   // Schedules an immediate PolicyUpdate, if there isn't one already pending and
   // sets |policy_may_need_update_|. Note |any_thread_lock_| must be
   // locked.
@@ -273,13 +277,16 @@
 
   struct AnyThread {
     AnyThread();
+    ~AnyThread();
 
     base::TimeTicks last_idle_period_end_time;
     base::TimeTicks rails_loading_priority_deadline;
+    base::TimeTicks fling_compositor_escalation_deadline;
     UserModel user_model;
     bool awaiting_touch_start_response;
     bool in_idle_period;
     bool begin_main_frame_on_critical_path;
+    bool last_gesture_was_compositor_driven;
   };
 
   struct CompositorThreadOnly {
diff --git a/components/scheduler/renderer/renderer_scheduler_impl_unittest.cc b/components/scheduler/renderer/renderer_scheduler_impl_unittest.cc
index 2cff5ac..5e0c90f 100644
--- a/components/scheduler/renderer/renderer_scheduler_impl_unittest.cc
+++ b/components/scheduler/renderer/renderer_scheduler_impl_unittest.cc
@@ -120,7 +120,7 @@
   task_runner->PostTask(FROM_HERE, base::Bind(NullTask));
   if (simulate_input) {
     scheduler->DidHandleInputEventOnCompositorThread(
-        FakeInputEvent(blink::WebInputEvent::GestureFlingStart),
+        FakeInputEvent(blink::WebInputEvent::TouchMove),
         RendererScheduler::InputEventState::EVENT_CONSUMED_BY_COMPOSITOR);
   }
   *should_yield_after = scheduler->ShouldYieldForHighPriorityWork();
@@ -290,7 +290,7 @@
     scheduler_->DidCommitFrameToCompositor();
   }
 
-  void ForceMainThreadScrollingUseCase() {
+  void DoMainFrameOnCriticalPath() {
     cc::BeginFrameArgs begin_frame_args = cc::BeginFrameArgs::Create(
         BEGINFRAME_FROM_HERE, clock_->NowTicks(), base::TimeTicks(),
         base::TimeDelta::FromMilliseconds(16), cc::BeginFrameArgs::NORMAL);
@@ -327,19 +327,63 @@
     mock_task_runner_->SetAutoAdvanceNowToPendingTasks(false);
   }
 
-  void WillBeginMainThreadGestureFrame() {
-    scheduler_->DidAnimateForInputOnCompositorThread();
-    cc::BeginFrameArgs begin_frame_args = cc::BeginFrameArgs::Create(
-        BEGINFRAME_FROM_HERE, clock_->NowTicks(), base::TimeTicks(),
-        base::TimeDelta::FromMilliseconds(16), cc::BeginFrameArgs::NORMAL);
-    begin_frame_args.on_critical_path = true;
-    scheduler_->WillBeginFrame(begin_frame_args);
+  enum class TouchEventPolicy {
+    SEND_TOUCH_START,
+    DONT_SEND_TOUCH_START,
+  };
+
+  void SimulateCompositorGestureStart(TouchEventPolicy touch_event_policy) {
+    if (touch_event_policy == TouchEventPolicy::SEND_TOUCH_START) {
+      scheduler_->DidHandleInputEventOnCompositorThread(
+          FakeInputEvent(blink::WebInputEvent::TouchStart),
+          RendererScheduler::InputEventState::EVENT_CONSUMED_BY_COMPOSITOR);
+      scheduler_->DidHandleInputEventOnCompositorThread(
+          FakeInputEvent(blink::WebInputEvent::TouchMove),
+          RendererScheduler::InputEventState::EVENT_CONSUMED_BY_COMPOSITOR);
+      scheduler_->DidHandleInputEventOnCompositorThread(
+          FakeInputEvent(blink::WebInputEvent::TouchMove),
+          RendererScheduler::InputEventState::EVENT_CONSUMED_BY_COMPOSITOR);
+    }
+    scheduler_->DidHandleInputEventOnCompositorThread(
+        FakeInputEvent(blink::WebInputEvent::GestureScrollBegin),
+        RendererScheduler::InputEventState::EVENT_CONSUMED_BY_COMPOSITOR);
+  }
+
+  void SimulateMainThreadGestureStart(TouchEventPolicy touch_event_policy,
+                                      blink::WebInputEvent::Type gesture_type) {
+    if (touch_event_policy == TouchEventPolicy::SEND_TOUCH_START) {
+      scheduler_->DidHandleInputEventOnCompositorThread(
+          FakeInputEvent(blink::WebInputEvent::TouchStart),
+          RendererScheduler::InputEventState::EVENT_FORWARDED_TO_MAIN_THREAD);
+      scheduler_->DidHandleInputEventOnMainThread(
+          FakeInputEvent(blink::WebInputEvent::TouchStart));
+
+      scheduler_->DidHandleInputEventOnCompositorThread(
+          FakeInputEvent(blink::WebInputEvent::TouchMove),
+          RendererScheduler::InputEventState::EVENT_FORWARDED_TO_MAIN_THREAD);
+      scheduler_->DidHandleInputEventOnMainThread(
+          FakeInputEvent(blink::WebInputEvent::TouchMove));
+
+      scheduler_->DidHandleInputEventOnCompositorThread(
+          FakeInputEvent(blink::WebInputEvent::TouchMove),
+          RendererScheduler::InputEventState::EVENT_FORWARDED_TO_MAIN_THREAD);
+      scheduler_->DidHandleInputEventOnMainThread(
+          FakeInputEvent(blink::WebInputEvent::TouchMove));
+    }
+    scheduler_->DidHandleInputEventOnCompositorThread(
+        FakeInputEvent(gesture_type),
+        RendererScheduler::InputEventState::EVENT_FORWARDED_TO_MAIN_THREAD);
+    scheduler_->DidHandleInputEventOnMainThread(FakeInputEvent(gesture_type));
   }
 
   void SimulateMainThreadGestureCompositorTask(
       base::TimeDelta begin_main_frame_duration) {
-    WillBeginMainThreadGestureFrame();
+    scheduler_->DidHandleInputEventOnCompositorThread(
+        FakeInputEvent(blink::WebInputEvent::TouchMove),
+        RendererScheduler::InputEventState::EVENT_FORWARDED_TO_MAIN_THREAD);
     clock_->Advance(begin_main_frame_duration);
+    scheduler_->DidHandleInputEventOnMainThread(
+        FakeInputEvent(blink::WebInputEvent::TouchMove));
     scheduler_->DidCommitFrameToCompositor();
   }
 
@@ -704,38 +748,70 @@
   EXPECT_EQ(RendererScheduler::UseCase::NONE, CurrentUseCase());
 }
 
-TEST_F(RendererSchedulerImplTest, TestCompositorPolicy_CompositorHandlesInput) {
+TEST_F(RendererSchedulerImplTest,
+       TestCompositorPolicy_CompositorHandlesInput_WithTouchHandler) {
   std::vector<std::string> run_order;
   PostTestTasks(&run_order, "L1 I1 D1 C1 D2 C2");
 
   scheduler_->SetHasVisibleRenderWidgetWithTouchHandler(true);
-  scheduler_->DidHandleInputEventOnCompositorThread(
-      FakeInputEvent(blink::WebInputEvent::GestureFlingStart),
-      RendererScheduler::InputEventState::EVENT_CONSUMED_BY_COMPOSITOR);
   EnableIdleTasks();
+  SimulateCompositorGestureStart(TouchEventPolicy::SEND_TOUCH_START);
   RunUntilIdle();
   EXPECT_THAT(run_order,
               testing::ElementsAre(std::string("L1"), std::string("D1"),
-                                   std::string("C1"), std::string("D2"),
-                                   std::string("C2"), std::string("I1")));
+                                   std::string("D2"), std::string("I1"),
+                                   std::string("C1"), std::string("C2")));
   EXPECT_EQ(RendererScheduler::UseCase::COMPOSITOR_GESTURE, CurrentUseCase());
 }
 
-TEST_F(RendererSchedulerImplTest, TestCompositorPolicy_MainThreadHandlesInput) {
+TEST_F(RendererSchedulerImplTest,
+       TestCompositorPolicy_CompositorHandlesInput_WithoutTouchHandler) {
+  std::vector<std::string> run_order;
+  PostTestTasks(&run_order, "L1 I1 D1 C1 D2 C2");
+
+  EnableIdleTasks();
+  SimulateCompositorGestureStart(TouchEventPolicy::DONT_SEND_TOUCH_START);
+  RunUntilIdle();
+  EXPECT_THAT(run_order,
+              testing::ElementsAre(std::string("L1"), std::string("D1"),
+                                   std::string("D2"), std::string("I1"),
+                                   std::string("C1"), std::string("C2")));
+  EXPECT_EQ(RendererScheduler::UseCase::COMPOSITOR_GESTURE, CurrentUseCase());
+}
+
+TEST_F(RendererSchedulerImplTest,
+       TestCompositorPolicy_MainThreadHandlesInput_WithTouchHandler) {
   std::vector<std::string> run_order;
   PostTestTasks(&run_order, "L1 I1 D1 C1 D2 C2");
 
   scheduler_->SetHasVisibleRenderWidgetWithTouchHandler(true);
-  scheduler_->DidHandleInputEventOnCompositorThread(
-      FakeInputEvent(blink::WebInputEvent::GestureFlingStart),
-      RendererScheduler::InputEventState::EVENT_FORWARDED_TO_MAIN_THREAD);
   EnableIdleTasks();
+  SimulateMainThreadGestureStart(TouchEventPolicy::SEND_TOUCH_START,
+                                 blink::WebInputEvent::GestureScrollBegin);
   RunUntilIdle();
   EXPECT_THAT(run_order,
-              testing::ElementsAre(std::string("L1"), std::string("D1"),
-                                   std::string("C1"), std::string("D2"),
-                                   std::string("C2"), std::string("I1")));
-  EXPECT_EQ(RendererScheduler::UseCase::COMPOSITOR_GESTURE, CurrentUseCase());
+              testing::ElementsAre(std::string("C1"), std::string("C2"),
+                                   std::string("L1"), std::string("D1"),
+                                   std::string("D2"), std::string("I1")));
+  EXPECT_EQ(RendererScheduler::UseCase::MAIN_THREAD_GESTURE, CurrentUseCase());
+  scheduler_->DidHandleInputEventOnMainThread(
+      FakeInputEvent(blink::WebInputEvent::GestureFlingStart));
+}
+
+TEST_F(RendererSchedulerImplTest,
+       TestCompositorPolicy_MainThreadHandlesInput_WithoutTouchHandler) {
+  std::vector<std::string> run_order;
+  PostTestTasks(&run_order, "L1 I1 D1 C1 D2 C2");
+
+  EnableIdleTasks();
+  SimulateMainThreadGestureStart(TouchEventPolicy::DONT_SEND_TOUCH_START,
+                                 blink::WebInputEvent::GestureScrollBegin);
+  RunUntilIdle();
+  EXPECT_THAT(run_order,
+              testing::ElementsAre(std::string("C1"), std::string("C2"),
+                                   std::string("L1"), std::string("D1"),
+                                   std::string("D2"), std::string("I1")));
+  EXPECT_EQ(RendererScheduler::UseCase::MAIN_THREAD_GESTURE, CurrentUseCase());
   scheduler_->DidHandleInputEventOnMainThread(
       FakeInputEvent(blink::WebInputEvent::GestureFlingStart));
 }
@@ -746,27 +822,48 @@
 
   scheduler_->SetHasVisibleRenderWidgetWithTouchHandler(true);
   scheduler_->DidAnimateForInputOnCompositorThread();
+  // Note DidAnimateForInputOnCompositorThread does not by itself trigger a
+  // policy update.
+  EXPECT_EQ(RendererScheduler::UseCase::COMPOSITOR_GESTURE,
+            ForceUpdatePolicyAndGetCurrentUseCase());
   EnableIdleTasks();
   RunUntilIdle();
   EXPECT_THAT(run_order,
-              testing::ElementsAre(std::string("D1"), std::string("C1"),
-                                   std::string("D2"), std::string("C2"),
-                                   std::string("I1")));
+              testing::ElementsAre(std::string("D1"), std::string("D2"),
+                                   std::string("I1"), std::string("C1"),
+                                   std::string("C2")));
   EXPECT_EQ(RendererScheduler::UseCase::COMPOSITOR_GESTURE, CurrentUseCase());
 }
 
-TEST_F(
-    RendererSchedulerImplTest,
-    TestCompositorPolicy_ExpensiveTimersDontRunWhenMainThreadOnCriticalPath) {
+TEST_F(RendererSchedulerImplTest, Navigation_ResetsTaskCostEstimations) {
   std::vector<std::string> run_order;
 
   SimulateExpensiveTasks(timer_task_runner_);
+  scheduler_->OnNavigationStarted();
+  PostTestTasks(&run_order, "C1 T1");
+
+  SimulateMainThreadGestureStart(TouchEventPolicy::DONT_SEND_TOUCH_START,
+                                 blink::WebInputEvent::GestureScrollBegin);
+  scheduler_->DidCommitFrameToCompositor();  // Starts Idle Period
+  RunUntilIdle();
+
+  EXPECT_THAT(run_order,
+              testing::ElementsAre(std::string("C1"), std::string("T1")));
+}
+
+TEST_F(RendererSchedulerImplTest,
+       ExpensiveTimersDontRunWhenMainThreadScrolling) {
+  std::vector<std::string> run_order;
+
+  scheduler_->SetHasVisibleRenderWidgetWithTouchHandler(true);
+  SimulateExpensiveTasks(timer_task_runner_);
+  DoMainFrame();
+  SimulateMainThreadGestureStart(TouchEventPolicy::SEND_TOUCH_START,
+                                 blink::WebInputEvent::GestureScrollBegin);
 
   // Timers should now be disabled during main thread user user interactions.
   PostTestTasks(&run_order, "C1 T1");
 
-  // Trigger main_thread_gesture UseCase
-  WillBeginMainThreadGestureFrame();
   RunUntilIdle();
   EXPECT_EQ(RendererScheduler::UseCase::MAIN_THREAD_GESTURE, CurrentUseCase());
 
@@ -779,54 +876,29 @@
   EXPECT_THAT(run_order, testing::ElementsAre(std::string("T1")));
 }
 
-TEST_F(RendererSchedulerImplTest, Navigation_ResetsTaskCostEstimations) {
-  std::vector<std::string> run_order;
-
-  SimulateExpensiveTasks(timer_task_runner_);
-  scheduler_->OnNavigationStarted();
-  PostTestTasks(&run_order, "C1 T1");
-
-  WillBeginMainThreadGestureFrame();
-  scheduler_->DidCommitFrameToCompositor();  // Starts Idle Period
-  RunUntilIdle();
-
-  EXPECT_THAT(run_order,
-              testing::ElementsAre(std::string("C1"), std::string("T1")));
-}
-
 TEST_F(RendererSchedulerImplTest,
-       TestCompositorPolicy_TimersAlwaysRun_MainThreadNotOnCriticalPath) {
+       ExpensiveTimersDontRunWhenMainThreadScrolling_AndOnCriticalPath) {
   std::vector<std::string> run_order;
-  PostTestTasks(&run_order, "C1 T1");
 
   scheduler_->SetHasVisibleRenderWidgetWithTouchHandler(true);
-  scheduler_->DidAnimateForInputOnCompositorThread();
-  cc::BeginFrameArgs begin_frame_args1 = cc::BeginFrameArgs::Create(
-      BEGINFRAME_FROM_HERE, clock_->NowTicks(), base::TimeTicks(),
-      base::TimeDelta::FromMilliseconds(1000), cc::BeginFrameArgs::NORMAL);
-  begin_frame_args1.on_critical_path = false;
-  scheduler_->WillBeginFrame(begin_frame_args1);
-  scheduler_->DidCommitFrameToCompositor();  // Starts Idle Period
+  SimulateExpensiveTasks(timer_task_runner_);
+  DoMainFrameOnCriticalPath();
+  SimulateMainThreadGestureStart(TouchEventPolicy::SEND_TOUCH_START,
+                                  blink::WebInputEvent::GestureScrollBegin);
+
+  // Timers should now be disabled during main thread user user interactions.
+  PostTestTasks(&run_order, "C1 T1");
+
   RunUntilIdle();
+  EXPECT_EQ(RendererScheduler::UseCase::MAIN_THREAD_GESTURE, CurrentUseCase());
 
-  EXPECT_THAT(run_order,
-              testing::ElementsAre(std::string("C1"), std::string("T1")));
-
-  // End the idle period.
-  clock_->Advance(base::TimeDelta::FromMilliseconds(500));
-  scheduler_->DidAnimateForInputOnCompositorThread();
-  cc::BeginFrameArgs begin_frame_args2 = cc::BeginFrameArgs::Create(
-      BEGINFRAME_FROM_HERE, clock_->NowTicks(), base::TimeTicks(),
-      base::TimeDelta::FromMilliseconds(1000), cc::BeginFrameArgs::NORMAL);
-  begin_frame_args2.on_critical_path = false;
-  scheduler_->WillBeginFrame(begin_frame_args2);
+  EXPECT_THAT(run_order, testing::ElementsAre(std::string("C1")));
+  clock_->Advance(subsequent_input_expected_after_input_duration() * 2);
 
   run_order.clear();
-  PostTestTasks(&run_order, "C1 T1");
   RunUntilIdle();
-
-  EXPECT_THAT(run_order,
-              testing::ElementsAre(std::string("C1"), std::string("T1")));
+  EXPECT_EQ(RendererScheduler::UseCase::NONE, CurrentUseCase());
+  EXPECT_THAT(run_order, testing::ElementsAre(std::string("T1")));
 }
 
 TEST_F(RendererSchedulerImplTest, TestTouchstartPolicy_Compositor) {
@@ -956,8 +1028,7 @@
   std::vector<std::string> run_order;
   PostTestTasks(&run_order, "I1 D1 C1 D2 C2");
 
-  ForceMainThreadScrollingUseCase();
-  scheduler_->DidCommitFrameToCompositor();  // Enable Idle tasks.
+  EnableIdleTasks();
   scheduler_->DidHandleInputEventOnCompositorThread(
       FakeInputEvent(blink::WebInputEvent::MouseMove),
       RendererScheduler::InputEventState::EVENT_CONSUMED_BY_COMPOSITOR);
@@ -975,8 +1046,7 @@
   std::vector<std::string> run_order;
   PostTestTasks(&run_order, "I1 D1 C1 D2 C2");
 
-  ForceMainThreadScrollingUseCase();
-  scheduler_->DidCommitFrameToCompositor();  // Enable Idle tasks.
+  EnableIdleTasks();
   scheduler_->DidHandleInputEventOnCompositorThread(
       FakeInputEvent(blink::WebInputEvent::MouseMove),
       RendererScheduler::InputEventState::EVENT_FORWARDED_TO_MAIN_THREAD);
@@ -994,8 +1064,7 @@
   std::vector<std::string> run_order;
   PostTestTasks(&run_order, "I1 D1 C1 D2 C2");
 
-  ForceMainThreadScrollingUseCase();
-  scheduler_->DidCommitFrameToCompositor();  // Enable Idle tasks.
+  EnableIdleTasks();
   scheduler_->DidHandleInputEventOnCompositorThread(
       FakeInputEvent(blink::WebInputEvent::MouseMove,
                      blink::WebInputEvent::LeftButtonDown),
@@ -1013,8 +1082,7 @@
   std::vector<std::string> run_order;
   PostTestTasks(&run_order, "I1 D1 C1 D2 C2");
 
-  ForceMainThreadScrollingUseCase();
-  scheduler_->DidCommitFrameToCompositor();  // Enable Idle tasks.
+  EnableIdleTasks();
   scheduler_->DidHandleInputEventOnCompositorThread(
       FakeInputEvent(blink::WebInputEvent::MouseMove,
                      blink::WebInputEvent::LeftButtonDown),
@@ -1033,8 +1101,7 @@
   std::vector<std::string> run_order;
   PostTestTasks(&run_order, "I1 D1 C1 D2 C2");
 
-  ForceMainThreadScrollingUseCase();
-  scheduler_->DidCommitFrameToCompositor();  // Enable Idle tasks.
+  EnableIdleTasks();
   scheduler_->DidHandleInputEventOnCompositorThread(
       FakeInputEvent(blink::WebInputEvent::MouseWheel),
       RendererScheduler::InputEventState::EVENT_CONSUMED_BY_COMPOSITOR);
@@ -1050,8 +1117,7 @@
   std::vector<std::string> run_order;
   PostTestTasks(&run_order, "I1 D1 C1 D2 C2");
 
-  ForceMainThreadScrollingUseCase();
-  scheduler_->DidCommitFrameToCompositor();  // Enable Idle tasks.
+  EnableIdleTasks();
   scheduler_->DidHandleInputEventOnCompositorThread(
       FakeInputEvent(blink::WebInputEvent::MouseWheel),
       RendererScheduler::InputEventState::EVENT_FORWARDED_TO_MAIN_THREAD);
@@ -1069,8 +1135,7 @@
   std::vector<std::string> run_order;
   PostTestTasks(&run_order, "I1 D1 C1 D2 C2");
 
-  ForceMainThreadScrollingUseCase();
-  scheduler_->DidCommitFrameToCompositor();  // Enable Idle tasks.
+  EnableIdleTasks();
   scheduler_->DidHandleInputEventOnCompositorThread(
       FakeInputEvent(blink::WebInputEvent::KeyDown),
       RendererScheduler::InputEventState::EVENT_CONSUMED_BY_COMPOSITOR);
@@ -1088,8 +1153,7 @@
   std::vector<std::string> run_order;
   PostTestTasks(&run_order, "I1 D1 C1 D2 C2");
 
-  ForceMainThreadScrollingUseCase();
-  scheduler_->DidCommitFrameToCompositor();  // Enable Idle tasks.
+  EnableIdleTasks();
   scheduler_->DidHandleInputEventOnCompositorThread(
       FakeInputEvent(blink::WebInputEvent::KeyDown),
       RendererScheduler::InputEventState::EVENT_FORWARDED_TO_MAIN_THREAD);
@@ -1107,8 +1171,9 @@
 
 TEST_F(RendererSchedulerImplTest,
        TestMainthreadScrollingUseCaseDoesNotStarveDefaultTasks) {
-  ForceMainThreadScrollingUseCase();
-  scheduler_->DidCommitFrameToCompositor();  // Enable Idle tasks.
+  SimulateMainThreadGestureStart(TouchEventPolicy::DONT_SEND_TOUCH_START,
+                                 blink::WebInputEvent::GestureScrollBegin);
+  EnableIdleTasks();
 
   std::vector<std::string> run_order;
   PostTestTasks(&run_order, "D1 C1");
@@ -1131,9 +1196,7 @@
 
 TEST_F(RendererSchedulerImplTest,
        TestCompositorPolicyEnds_CompositorHandlesInput) {
-  scheduler_->DidHandleInputEventOnCompositorThread(
-      FakeInputEvent(blink::WebInputEvent::GestureFlingStart),
-      RendererScheduler::InputEventState::EVENT_CONSUMED_BY_COMPOSITOR);
+  SimulateCompositorGestureStart(TouchEventPolicy::DONT_SEND_TOUCH_START);
   EXPECT_EQ(UseCase::COMPOSITOR_GESTURE,
             ForceUpdatePolicyAndGetCurrentUseCase());
 
@@ -1143,12 +1206,9 @@
 
 TEST_F(RendererSchedulerImplTest,
        TestCompositorPolicyEnds_MainThreadHandlesInput) {
-  scheduler_->DidHandleInputEventOnCompositorThread(
-      FakeInputEvent(blink::WebInputEvent::GestureFlingStart),
-      RendererScheduler::InputEventState::EVENT_FORWARDED_TO_MAIN_THREAD);
-  scheduler_->DidHandleInputEventOnMainThread(
-      FakeInputEvent(blink::WebInputEvent::GestureFlingStart));
-  EXPECT_EQ(UseCase::COMPOSITOR_GESTURE,
+  SimulateMainThreadGestureStart(TouchEventPolicy::DONT_SEND_TOUCH_START,
+                                 blink::WebInputEvent::GestureScrollBegin);
+  EXPECT_EQ(UseCase::MAIN_THREAD_GESTURE,
             ForceUpdatePolicyAndGetCurrentUseCase());
 
   clock_->Advance(base::TimeDelta::FromMilliseconds(1000));
@@ -1282,8 +1342,6 @@
   bool should_yield_before = false;
   bool should_yield_after = false;
 
-  ForceMainThreadScrollingUseCase();
-
   default_task_runner_->PostTask(
       FROM_HERE, base::Bind(&PostingYieldingTestTask, scheduler_.get(),
                             default_task_runner_, false, &should_yield_before,
@@ -1331,7 +1389,7 @@
       FakeInputEvent(blink::WebInputEvent::GestureFlingStart),
       RendererScheduler::InputEventState::EVENT_FORWARDED_TO_MAIN_THREAD);
   RunUntilIdle();
-  EXPECT_EQ(UseCase::COMPOSITOR_GESTURE, CurrentUseCase());
+  EXPECT_EQ(UseCase::MAIN_THREAD_GESTURE, CurrentUseCase());
 
   // Simulate the input event being queued for a very long time. The compositor
   // task we post here represents the enqueued input task.
@@ -1341,8 +1399,8 @@
   RunUntilIdle();
 
   // Even though we exceeded the input priority escalation period, we should
-  // still be in compositor priority since the input remains queued.
-  EXPECT_EQ(UseCase::COMPOSITOR_GESTURE, CurrentUseCase());
+  // still be in main thread gesture since the input remains queued.
+  EXPECT_EQ(UseCase::MAIN_THREAD_GESTURE, CurrentUseCase());
 
   // After the escalation period ends we should go back into normal mode.
   clock_->Advance(priority_escalation_after_input_duration() * 2);
@@ -1525,12 +1583,7 @@
   scheduler_->SetHasVisibleRenderWidgetWithTouchHandler(true);
   EXPECT_EQ(1, mock_scheduler_->update_policy_count_);
 
-  scheduler_->DidHandleInputEventOnCompositorThread(
-      FakeInputEvent(blink::WebInputEvent::TouchStart),
-      RendererScheduler::InputEventState::EVENT_FORWARDED_TO_MAIN_THREAD);
-  scheduler_->DidHandleInputEventOnCompositorThread(
-      FakeInputEvent(blink::WebInputEvent::GestureScrollBegin),
-      RendererScheduler::InputEventState::EVENT_FORWARDED_TO_MAIN_THREAD);
+  SimulateCompositorGestureStart(TouchEventPolicy::SEND_TOUCH_START);
 
   // We expect the first call to IsHighPriorityWorkAnticipated to be called
   // after recieving an input event (but before the UpdateTask was processed) to
@@ -1547,10 +1600,9 @@
   scheduler_->ShouldYieldForHighPriorityWork();
   scheduler_->ShouldYieldForHighPriorityWork();
 
-  scheduler_->DidHandleInputEventOnMainThread(
-      FakeInputEvent(blink::WebInputEvent::TouchStart));
-  scheduler_->DidHandleInputEventOnMainThread(
-      FakeInputEvent(blink::WebInputEvent::GestureScrollBegin));
+  scheduler_->DidHandleInputEventOnCompositorThread(
+      FakeInputEvent(blink::WebInputEvent::GestureScrollEnd),
+      RendererScheduler::InputEventState::EVENT_CONSUMED_BY_COMPOSITOR);
 
   EXPECT_EQ(2, mock_scheduler_->update_policy_count_);
 
@@ -1561,7 +1613,7 @@
   EXPECT_THAT(mock_scheduler_->use_cases_,
               testing::ElementsAre(
                   std::string("none"), std::string("compositor_gesture"),
-                  std::string("compositor_gesture"),
+                  std::string("compositor_gesture scroll expected"),
                   std::string("none scroll expected"), std::string("none")));
 }
 
@@ -2149,7 +2201,8 @@
   PostTestTasks(&run_order, "C1 L1");
 
   // Trigger main_thread_gesture UseCase
-  WillBeginMainThreadGestureFrame();
+  SimulateMainThreadGestureStart(TouchEventPolicy::DONT_SEND_TOUCH_START,
+                                 blink::WebInputEvent::GestureScrollBegin);
   RunUntilIdle();
   EXPECT_EQ(RendererScheduler::UseCase::MAIN_THREAD_GESTURE, CurrentUseCase());
 
@@ -2161,24 +2214,34 @@
 
 TEST_F(RendererSchedulerImplTest, ModeratelyExpensiveTimer_NotBlocked) {
   scheduler_->SetHasVisibleRenderWidgetWithTouchHandler(true);
+  SimulateMainThreadGestureStart(TouchEventPolicy::SEND_TOUCH_START,
+                                 blink::WebInputEvent::TouchMove);
+  RunUntilIdle();
   for (int i = 0; i < 20; i++) {
     simulate_timer_task_ran_ = false;
+
+    cc::BeginFrameArgs begin_frame_args = cc::BeginFrameArgs::Create(
+        BEGINFRAME_FROM_HERE, clock_->NowTicks(), base::TimeTicks(),
+        base::TimeDelta::FromMilliseconds(16), cc::BeginFrameArgs::NORMAL);
+    begin_frame_args.on_critical_path = false;
+    scheduler_->WillBeginFrame(begin_frame_args);
+
     compositor_task_runner_->PostTask(
         FROM_HERE,
         base::Bind(
             &RendererSchedulerImplTest::SimulateMainThreadGestureCompositorTask,
-            base::Unretained(this), base::TimeDelta::FromMilliseconds(4)));
+            base::Unretained(this), base::TimeDelta::FromMilliseconds(8)));
     timer_task_runner_->PostTask(
         FROM_HERE, base::Bind(&RendererSchedulerImplTest::SimulateTimerTask,
                               base::Unretained(this),
-                              base::TimeDelta::FromMilliseconds(10)));
+                              base::TimeDelta::FromMilliseconds(4)));
 
     RunUntilIdle();
-    EXPECT_TRUE(simulate_timer_task_ran_);
-    EXPECT_EQ(RendererScheduler::UseCase::MAIN_THREAD_GESTURE,
-              CurrentUseCase());
-    EXPECT_FALSE(LoadingTasksSeemExpensive());
-    EXPECT_FALSE(TimerTasksSeemExpensive());
+    EXPECT_TRUE(simulate_timer_task_ran_) << " i = " << i;
+    EXPECT_EQ(RendererScheduler::UseCase::MAIN_THREAD_GESTURE, CurrentUseCase())
+        << " i = " << i;
+    EXPECT_FALSE(LoadingTasksSeemExpensive()) << " i = " << i;
+    EXPECT_FALSE(TimerTasksSeemExpensive()) << " i = " << i;
 
     base::TimeDelta time_till_next_frame =
         EstimatedNextFrameBegin() - clock_->NowTicks();
@@ -2189,8 +2252,18 @@
 
 TEST_F(RendererSchedulerImplTest, ExpensiveTimer_Blocked) {
   scheduler_->SetHasVisibleRenderWidgetWithTouchHandler(true);
+  SimulateMainThreadGestureStart(TouchEventPolicy::SEND_TOUCH_START,
+                                 blink::WebInputEvent::TouchMove);
+  RunUntilIdle();
   for (int i = 0; i < 20; i++) {
     simulate_timer_task_ran_ = false;
+
+    cc::BeginFrameArgs begin_frame_args = cc::BeginFrameArgs::Create(
+        BEGINFRAME_FROM_HERE, clock_->NowTicks(), base::TimeTicks(),
+        base::TimeDelta::FromMilliseconds(16), cc::BeginFrameArgs::NORMAL);
+    begin_frame_args.on_critical_path = false;
+    scheduler_->WillBeginFrame(begin_frame_args);
+
     compositor_task_runner_->PostTask(
         FROM_HERE,
         base::Bind(
@@ -2202,15 +2275,15 @@
                               base::TimeDelta::FromMilliseconds(10)));
 
     RunUntilIdle();
-    EXPECT_EQ(RendererScheduler::UseCase::MAIN_THREAD_GESTURE,
-              CurrentUseCase());
-    EXPECT_FALSE(LoadingTasksSeemExpensive());
+    EXPECT_EQ(RendererScheduler::UseCase::MAIN_THREAD_GESTURE, CurrentUseCase())
+        << " i = " << i;
+    EXPECT_FALSE(LoadingTasksSeemExpensive()) << " i = " << i;
     if (i == 0) {
-      EXPECT_FALSE(TimerTasksSeemExpensive());
-      EXPECT_TRUE(simulate_timer_task_ran_);
+      EXPECT_FALSE(TimerTasksSeemExpensive()) << " i = " << i;
+      EXPECT_TRUE(simulate_timer_task_ran_) << " i = " << i;
     } else {
-      EXPECT_TRUE(TimerTasksSeemExpensive());
-      EXPECT_FALSE(simulate_timer_task_ran_);
+      EXPECT_TRUE(TimerTasksSeemExpensive()) << " i = " << i;
+      EXPECT_FALSE(simulate_timer_task_ran_) << " i = " << i;
     }
 
     base::TimeDelta time_till_next_frame =
diff --git a/components/scheduler/renderer/user_model.cc b/components/scheduler/renderer/user_model.cc
index 596ae05..33d64bf 100644
--- a/components/scheduler/renderer/user_model.cc
+++ b/components/scheduler/renderer/user_model.cc
@@ -27,7 +27,9 @@
 }  // namespace
 
 UserModel::UserModel()
-    : pending_input_event_count_(0), is_gesture_expected_(false) {}
+    : pending_input_event_count_(0),
+      is_gesture_active_(false),
+      is_gesture_expected_(false) {}
 UserModel::~UserModel() {}
 
 void UserModel::DidStartProcessingInputEvent(blink::WebInputEvent::Type type,
@@ -36,31 +38,33 @@
   if (type == blink::WebInputEvent::TouchStart ||
       type == blink::WebInputEvent::GestureScrollBegin ||
       type == blink::WebInputEvent::GesturePinchBegin) {
-    last_gesture_start_time_ = now;
+    // Only update stats once per gesture.
+    if (!is_gesture_active_) {
+      last_gesture_start_time_ = now;
 
-    RecordGesturePrediction(is_gesture_expected_
-                                ? GESTURE_OCCURED_WAS_PREDICTED
-                                : GESTURE_OCCURED_BUT_NOT_PREDICTED);
+      RecordGesturePrediction(is_gesture_expected_
+                                  ? GESTURE_OCCURED_WAS_PREDICTED
+                                  : GESTURE_OCCURED_BUT_NOT_PREDICTED);
 
-    if (!last_reset_time_.is_null()) {
-      base::TimeDelta time_since_reset = now - last_reset_time_;
-      UMA_HISTOGRAM_MEDIUM_TIMES(
-          "RendererScheduler.UserModel.GestureStartTimeSinceModelReset",
-          time_since_reset);
+      if (!last_reset_time_.is_null()) {
+        base::TimeDelta time_since_reset = now - last_reset_time_;
+        UMA_HISTOGRAM_MEDIUM_TIMES(
+            "RendererScheduler.UserModel.GestureStartTimeSinceModelReset",
+            time_since_reset);
+      }
+
+      // If there has been a previous gesture, record a UMA metric for the time
+      // interval between then and now.
+      if (!last_continuous_gesture_time_.is_null()) {
+        base::TimeDelta time_since_last_gesture =
+            now - last_continuous_gesture_time_;
+        UMA_HISTOGRAM_MEDIUM_TIMES(
+            "RendererScheduler.UserModel.TimeBetweenGestures",
+            time_since_last_gesture);
+      }
     }
 
-    // If there has been a previous gesture, record a UMA metric for the time
-    // interval between then and now.  We ignore TouchStart because a
-    // GestureScrollBegin or GesturePinchBegin can follow immediatly after.
-    if (!last_continuous_gesture_time_.is_null() &&
-        (type == blink::WebInputEvent::GestureScrollBegin ||
-         type == blink::WebInputEvent::GesturePinchBegin)) {
-      base::TimeDelta time_since_last_gesture =
-          now - last_continuous_gesture_time_;
-      UMA_HISTOGRAM_MEDIUM_TIMES(
-          "RendererScheduler.UserModel.TimeBetweenGestures",
-          time_since_last_gesture);
-    }
+    is_gesture_active_ = true;
   }
 
   // We need to track continuous gestures seperatly for scroll detection
@@ -76,14 +80,24 @@
     last_continuous_gesture_time_ = now;
   }
 
-  // If the gesture has ended, record a UMA metric that tracks its duration.
+  // If the gesture has ended, clear |is_gesture_active_| and record a UMA
+  // metric that tracks its duration.
   if (type == blink::WebInputEvent::GestureScrollEnd ||
-      type == blink::WebInputEvent::GesturePinchEnd) {
-    base::TimeDelta duration = now - last_gesture_start_time_;
-    UMA_HISTOGRAM_TIMES("RendererScheduler.UserModel.GestureDuration",
-                        duration);
+      type == blink::WebInputEvent::GesturePinchEnd ||
+      type == blink::WebInputEvent::GestureFlingStart ||
+      type == blink::WebInputEvent::TouchEnd) {
+    // Only update stats once per gesture.
+    if (is_gesture_active_) {
+      base::TimeDelta duration = now - last_gesture_start_time_;
+      UMA_HISTOGRAM_TIMES("RendererScheduler.UserModel.GestureDuration",
+                          duration);
+    }
+    is_gesture_active_ = false;
   }
 
+  TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"),
+                 "is_gesture_active", is_gesture_active_);
+
   pending_input_event_count_++;
 }
 
@@ -109,12 +123,11 @@
 }
 
 bool UserModel::IsGestureExpectedSoon(
-    RendererScheduler::UseCase use_case,
     const base::TimeTicks now,
     base::TimeDelta* prediction_valid_duration) {
   bool was_gesture_expected = is_gesture_expected_;
   is_gesture_expected_ =
-      IsGestureExpectedSoonImpl(use_case, now, prediction_valid_duration);
+      IsGestureExpectedSoonImpl(now, prediction_valid_duration);
 
   // Track when we start expecting a gesture so we can work out later if a
   // gesture actually happened.
@@ -129,11 +142,11 @@
 }
 
 bool UserModel::IsGestureExpectedSoonImpl(
-    RendererScheduler::UseCase use_case,
     const base::TimeTicks now,
     base::TimeDelta* prediction_valid_duration) const {
-  if (use_case == RendererScheduler::UseCase::NONE) {
-    // If we've scrolled recently then future scrolling is likely.
+  // If we've have a finished a gesture then a subsequent gesture is deemed
+  // likely.
+  if (!is_gesture_active_) {
     base::TimeDelta expect_subsequent_gesture_for =
         base::TimeDelta::FromMilliseconds(kExpectSubsequentGestureMillis);
     if (last_continuous_gesture_time_.is_null() ||
@@ -144,21 +157,6 @@
         last_continuous_gesture_time_ + expect_subsequent_gesture_for - now;
     return true;
   }
-
-  if (use_case == RendererScheduler::UseCase::COMPOSITOR_GESTURE ||
-      use_case == RendererScheduler::UseCase::MAIN_THREAD_GESTURE) {
-    // If we've only just started scrolling then, then initiating a subsequent
-    // gesture is unlikely.
-    base::TimeDelta minimum_typical_scroll_duration =
-        base::TimeDelta::FromMilliseconds(kMinimumTypicalScrollDurationMillis);
-    if (last_gesture_start_time_.is_null() ||
-        last_gesture_start_time_ + minimum_typical_scroll_duration <= now) {
-      return true;
-    }
-    *prediction_valid_duration =
-        last_gesture_start_time_ + minimum_typical_scroll_duration - now;
-    return false;
-  }
   return false;
 }
 
@@ -168,6 +166,7 @@
   last_continuous_gesture_time_ = base::TimeTicks();
   last_gesture_expected_start_time_ = base::TimeTicks();
   last_reset_time_ = now;
+  is_gesture_active_ = false;
   is_gesture_expected_ = false;
 }
 
@@ -178,12 +177,18 @@
       "last_input_signal_time",
       (last_input_signal_time_ - base::TimeTicks()).InMillisecondsF());
   state->SetDouble(
-      "last_touchstart_time",
+      "last_gesture_start_time",
       (last_gesture_start_time_ - base::TimeTicks()).InMillisecondsF());
+  state->SetDouble(
+      "last_continuous_gesture_time",
+      (last_continuous_gesture_time_ - base::TimeTicks()).InMillisecondsF());
   state->SetDouble("last_gesture_expected_start_time",
                    (last_gesture_expected_start_time_ - base::TimeTicks())
                        .InMillisecondsF());
+  state->SetDouble("last_reset_time",
+                   (last_reset_time_ - base::TimeTicks()).InMillisecondsF());
   state->SetBoolean("is_gesture_expected", is_gesture_expected_);
+  state->SetBoolean("is_gesture_active", is_gesture_active_);
   state->EndDictionary();
 }
 
diff --git a/components/scheduler/renderer/user_model.h b/components/scheduler/renderer/user_model.h
index f5f358a0..a482e8d 100644
--- a/components/scheduler/renderer/user_model.h
+++ b/components/scheduler/renderer/user_model.h
@@ -35,8 +35,7 @@
   // Tries to guess if a user gesture is expected soon. Currently this is
   // very simple, but one day I hope to do something more sophisticated here.
   // The prediction may change after |prediction_valid_duration| has elapsed.
-  bool IsGestureExpectedSoon(RendererScheduler::UseCase use_case,
-                             const base::TimeTicks now,
+  bool IsGestureExpectedSoon(const base::TimeTicks now,
                              base::TimeDelta* prediction_valid_duration);
 
   void AsValueInto(base::trace_event::TracedValue* state) const;
@@ -44,9 +43,6 @@
   // The time we should stay in a priority-escalated mode after an input event.
   static const int kGestureEstimationLimitMillis = 100;
 
-  // This is based on two weeks of Android usage data.
-  static const int kMinimumTypicalScrollDurationMillis = 300;
-
   // We consider further gesture start events to be likely if the user has
   // interacted with the device in the past two seconds.
   // Based on Android usage data, 2000ms between gestures is the 75th percentile
@@ -58,7 +54,6 @@
 
  private:
   bool IsGestureExpectedSoonImpl(
-      RendererScheduler::UseCase use_case,
       const base::TimeTicks now,
       base::TimeDelta* prediction_valid_duration) const;
 
@@ -68,6 +63,7 @@
   base::TimeTicks last_continuous_gesture_time_;  // Doesn't include Taps.
   base::TimeTicks last_gesture_expected_start_time_;
   base::TimeTicks last_reset_time_;
+  bool is_gesture_active_;  // This typically means the user's finger is down.
   bool is_gesture_expected_;
 
   DISALLOW_COPY_AND_ASSIGN(UserModel);
diff --git a/components/scheduler/renderer/user_model_unittest.cc b/components/scheduler/renderer/user_model_unittest.cc
index 18d2a464..c4e396d 100644
--- a/components/scheduler/renderer/user_model_unittest.cc
+++ b/components/scheduler/renderer/user_model_unittest.cc
@@ -33,11 +33,6 @@
         UserModel::kExpectSubsequentGestureMillis);
   }
 
-  static base::TimeDelta minimum_typical_scroll_duration_millis() {
-    return base::TimeDelta::FromMilliseconds(
-        UserModel::kMinimumTypicalScrollDurationMillis);
-  }
-
   scoped_ptr<base::SimpleTestTickClock> clock_;
   scoped_ptr<UserModel> user_model_;
 };
@@ -90,28 +85,40 @@
             user_model_->TimeLeftInUserGesture(clock_->NowTicks()));
 }
 
-TEST_F(UserModelTest, GestureExpectedSoon_UseCase_NONE_NoRecentInput) {
+TEST_F(UserModelTest, GestureExpectedSoon_NoRecentInput) {
   base::TimeDelta prediction_valid_duration;
-  EXPECT_FALSE(user_model_->IsGestureExpectedSoon(
-      RendererScheduler::UseCase::NONE, clock_->NowTicks(),
-      &prediction_valid_duration));
+  EXPECT_FALSE(user_model_->IsGestureExpectedSoon(clock_->NowTicks(),
+                                                  &prediction_valid_duration));
   EXPECT_EQ(base::TimeDelta(), prediction_valid_duration);
 }
 
-TEST_F(UserModelTest, GestureExpectedSoon_UseCase_NONE_ImmediatelyAfterInput) {
+TEST_F(UserModelTest, GestureExpectedSoon_ShortlyAfter_GestureScrollBegin) {
+  user_model_->DidStartProcessingInputEvent(
+      blink::WebInputEvent::Type::GestureScrollBegin, clock_->NowTicks());
+  user_model_->DidFinishProcessingInputEvent(clock_->NowTicks());
+
+  base::TimeDelta delta(base::TimeDelta::FromMilliseconds(10));
+  clock_->Advance(delta);
+
+  base::TimeDelta prediction_valid_duration;
+  EXPECT_FALSE(user_model_->IsGestureExpectedSoon(clock_->NowTicks(),
+                                                  &prediction_valid_duration));
+  EXPECT_EQ(base::TimeDelta(), prediction_valid_duration);
+}
+
+TEST_F(UserModelTest, GestureExpectedSoon_ImmediatelyAfter_GestureScrollEnd) {
   user_model_->DidStartProcessingInputEvent(
       blink::WebInputEvent::Type::GestureScrollEnd, clock_->NowTicks());
   user_model_->DidFinishProcessingInputEvent(clock_->NowTicks());
 
   base::TimeDelta prediction_valid_duration;
-  EXPECT_TRUE(user_model_->IsGestureExpectedSoon(
-      RendererScheduler::UseCase::NONE, clock_->NowTicks(),
-      &prediction_valid_duration));
+  EXPECT_TRUE(user_model_->IsGestureExpectedSoon(clock_->NowTicks(),
+                                                 &prediction_valid_duration));
   EXPECT_EQ(subsequent_input_expected_after_input_duration(),
             prediction_valid_duration);
 }
 
-TEST_F(UserModelTest, GestureExpectedSoon_UseCase_NONE_ShortlyAfterInput) {
+TEST_F(UserModelTest, GestureExpectedSoon_ShortlyAfter_GestureScrollEnd) {
   user_model_->DidStartProcessingInputEvent(
       blink::WebInputEvent::Type::GestureScrollEnd, clock_->NowTicks());
   user_model_->DidFinishProcessingInputEvent(clock_->NowTicks());
@@ -120,167 +127,40 @@
   clock_->Advance(delta);
 
   base::TimeDelta prediction_valid_duration;
-  EXPECT_TRUE(user_model_->IsGestureExpectedSoon(
-      RendererScheduler::UseCase::NONE, clock_->NowTicks(),
-      &prediction_valid_duration));
+  EXPECT_TRUE(user_model_->IsGestureExpectedSoon(clock_->NowTicks(),
+                                                 &prediction_valid_duration));
   EXPECT_EQ(subsequent_input_expected_after_input_duration() - delta,
             prediction_valid_duration);
 }
 
-TEST_F(UserModelTest, GestureExpectedSoon_UseCase_NONE_LongAfterInput) {
+TEST_F(UserModelTest, GestureExpectedSoon_LongAfter_GestureScrollEnd) {
   user_model_->DidStartProcessingInputEvent(
       blink::WebInputEvent::Type::GestureScrollEnd, clock_->NowTicks());
   user_model_->DidFinishProcessingInputEvent(clock_->NowTicks());
   clock_->Advance(subsequent_input_expected_after_input_duration() * 2);
 
   base::TimeDelta prediction_valid_duration;
-  EXPECT_FALSE(user_model_->IsGestureExpectedSoon(
-      RendererScheduler::UseCase::NONE, clock_->NowTicks(),
-      &prediction_valid_duration));
+  EXPECT_FALSE(user_model_->IsGestureExpectedSoon(clock_->NowTicks(),
+                                                  &prediction_valid_duration));
   EXPECT_EQ(base::TimeDelta(), prediction_valid_duration);
 }
 
-TEST_F(UserModelTest,
-       GestureExpectedSoon_COMPOSITOR_GESTURE_ImmediatelyAfterInput) {
+TEST_F(UserModelTest, GestureExpectedSoon_ShortlyAfter_GesturePinchEnd) {
   user_model_->DidStartProcessingInputEvent(
-      blink::WebInputEvent::Type::TouchStart, clock_->NowTicks());
-  user_model_->DidFinishProcessingInputEvent(clock_->NowTicks());
-
-  base::TimeDelta prediction_valid_duration;
-  EXPECT_FALSE(user_model_->IsGestureExpectedSoon(
-      RendererScheduler::UseCase::COMPOSITOR_GESTURE, clock_->NowTicks(),
-      &prediction_valid_duration));
-  EXPECT_EQ(minimum_typical_scroll_duration_millis(),
-            prediction_valid_duration);
-}
-
-TEST_F(UserModelTest,
-       GestureExpectedSoon_COMPOSITOR_GESTURE_ShortlyAfterInput) {
-  user_model_->DidStartProcessingInputEvent(
-      blink::WebInputEvent::Type::TouchStart, clock_->NowTicks());
+      blink::WebInputEvent::Type::GesturePinchEnd, clock_->NowTicks());
   user_model_->DidFinishProcessingInputEvent(clock_->NowTicks());
 
   base::TimeDelta delta(base::TimeDelta::FromMilliseconds(10));
   clock_->Advance(delta);
 
   base::TimeDelta prediction_valid_duration;
-  EXPECT_FALSE(user_model_->IsGestureExpectedSoon(
-      RendererScheduler::UseCase::COMPOSITOR_GESTURE, clock_->NowTicks(),
-      &prediction_valid_duration));
-  EXPECT_EQ(minimum_typical_scroll_duration_millis() - delta,
-            prediction_valid_duration);
-}
-
-TEST_F(UserModelTest, GestureExpectedSoon_COMPOSITOR_GESTURE_LongAfterInput) {
-  user_model_->DidStartProcessingInputEvent(
-      blink::WebInputEvent::Type::TouchStart, clock_->NowTicks());
-  user_model_->DidFinishProcessingInputEvent(clock_->NowTicks());
-
-  clock_->Advance(minimum_typical_scroll_duration_millis() * 2);
-
-  base::TimeDelta prediction_valid_duration;
-  // Note this isn't a bug, the UseCase will change to NONE eventually so it's
-  // OK for this to always be true after minimum_typical_scroll_duration_millis
-  EXPECT_TRUE(user_model_->IsGestureExpectedSoon(
-      RendererScheduler::UseCase::COMPOSITOR_GESTURE, clock_->NowTicks(),
-      &prediction_valid_duration));
-  EXPECT_EQ(base::TimeDelta(), prediction_valid_duration);
-}
-
-TEST_F(UserModelTest,
-       GestureExpectedSoon_MAIN_THREAD_GESTURE_ImmediatelyAfterInput) {
-  user_model_->DidStartProcessingInputEvent(
-      blink::WebInputEvent::Type::TouchStart, clock_->NowTicks());
-
-  // DidFinishProcessingInputEvent is always a little bit delayed.
-  base::TimeDelta delay(base::TimeDelta::FromMilliseconds(5));
-  clock_->Advance(delay);
-  user_model_->DidFinishProcessingInputEvent(clock_->NowTicks());
-
-  base::TimeDelta prediction_valid_duration;
-  EXPECT_FALSE(user_model_->IsGestureExpectedSoon(
-      RendererScheduler::UseCase::MAIN_THREAD_GESTURE, clock_->NowTicks(),
-      &prediction_valid_duration));
-  EXPECT_EQ(minimum_typical_scroll_duration_millis() - delay,
-            prediction_valid_duration);
-}
-
-TEST_F(UserModelTest,
-       GestureExpectedSoon_MAIN_THREAD_GESTURE_ShortlyAfterInput) {
-  user_model_->DidStartProcessingInputEvent(
-      blink::WebInputEvent::Type::TouchStart, clock_->NowTicks());
-  // DidFinishProcessingInputEvent is always a little bit delayed.
-  base::TimeDelta delay(base::TimeDelta::FromMilliseconds(5));
-  clock_->Advance(delay);
-  user_model_->DidFinishProcessingInputEvent(clock_->NowTicks());
-
-  base::TimeDelta delta(base::TimeDelta::FromMilliseconds(10));
-  clock_->Advance(delta);
-
-  base::TimeDelta prediction_valid_duration;
-  EXPECT_FALSE(user_model_->IsGestureExpectedSoon(
-      RendererScheduler::UseCase::MAIN_THREAD_GESTURE, clock_->NowTicks(),
-      &prediction_valid_duration));
-  EXPECT_EQ(minimum_typical_scroll_duration_millis() - delta - delay,
-            prediction_valid_duration);
-}
-
-TEST_F(UserModelTest, GestureExpectedSoon_MAIN_THREAD_GESTURE_LongAfterInput) {
-  user_model_->DidStartProcessingInputEvent(
-      blink::WebInputEvent::Type::TouchStart, clock_->NowTicks());
-
-  // DidFinishProcessingInputEvent is always a little bit delayed.
-  base::TimeDelta delay(base::TimeDelta::FromMilliseconds(5));
-  clock_->Advance(delay);
-  user_model_->DidFinishProcessingInputEvent(clock_->NowTicks());
-
-  clock_->Advance(minimum_typical_scroll_duration_millis() * 2);
-
-  base::TimeDelta prediction_valid_duration;
-  // Note this isn't a bug, the UseCase will change to NONE eventually so it's
-  // OK for this to always be true after minimum_typical_scroll_duration_millis
-  EXPECT_TRUE(user_model_->IsGestureExpectedSoon(
-      RendererScheduler::UseCase::MAIN_THREAD_GESTURE, clock_->NowTicks(),
-      &prediction_valid_duration));
-  EXPECT_EQ(base::TimeDelta(), prediction_valid_duration);
-}
-
-TEST_F(UserModelTest,
-       GestureExpectedSoon_UseCase_NONE_ShortlyAfterInput_GestureScrollBegin) {
-  user_model_->DidStartProcessingInputEvent(
-      blink::WebInputEvent::Type::GestureScrollBegin, clock_->NowTicks());
-  user_model_->DidFinishProcessingInputEvent(clock_->NowTicks());
-
-  base::TimeDelta delta(base::TimeDelta::FromMilliseconds(10));
-  clock_->Advance(delta);
-
-  base::TimeDelta prediction_valid_duration;
-  EXPECT_TRUE(user_model_->IsGestureExpectedSoon(
-      RendererScheduler::UseCase::NONE, clock_->NowTicks(),
-      &prediction_valid_duration));
+  EXPECT_TRUE(user_model_->IsGestureExpectedSoon(clock_->NowTicks(),
+                                                 &prediction_valid_duration));
   EXPECT_EQ(subsequent_input_expected_after_input_duration() - delta,
             prediction_valid_duration);
 }
 
-TEST_F(UserModelTest,
-       GestureExpectedSoon_UseCase_NONE_ShortlyAfterInput_GesturePinchBegin) {
-  user_model_->DidStartProcessingInputEvent(
-      blink::WebInputEvent::Type::GestureScrollBegin, clock_->NowTicks());
-  user_model_->DidFinishProcessingInputEvent(clock_->NowTicks());
-
-  base::TimeDelta delta(base::TimeDelta::FromMilliseconds(10));
-  clock_->Advance(delta);
-
-  base::TimeDelta prediction_valid_duration;
-  EXPECT_TRUE(user_model_->IsGestureExpectedSoon(
-      RendererScheduler::UseCase::NONE, clock_->NowTicks(),
-      &prediction_valid_duration));
-  EXPECT_EQ(subsequent_input_expected_after_input_duration() - delta,
-            prediction_valid_duration);
-}
-
-TEST_F(UserModelTest,
-       GestureExpectedSoon_UseCase_NONE_ShortlyAfterInput_GestureTap) {
+TEST_F(UserModelTest, GestureExpectedSoon_ShortlyAfterInput_GestureTap) {
   user_model_->DidStartProcessingInputEvent(
       blink::WebInputEvent::Type::GestureTap, clock_->NowTicks());
   user_model_->DidFinishProcessingInputEvent(clock_->NowTicks());
@@ -289,9 +169,8 @@
   clock_->Advance(delta);
 
   base::TimeDelta prediction_valid_duration;
-  EXPECT_FALSE(user_model_->IsGestureExpectedSoon(
-      RendererScheduler::UseCase::NONE, clock_->NowTicks(),
-      &prediction_valid_duration));
+  EXPECT_FALSE(user_model_->IsGestureExpectedSoon(clock_->NowTicks(),
+                                                  &prediction_valid_duration));
   EXPECT_EQ(base::TimeDelta(), prediction_valid_duration);
 }
 
diff --git a/components/signin/core/browser/signin_manager_base.h b/components/signin/core/browser/signin_manager_base.h
index c852101..27ea190 100644
--- a/components/signin/core/browser/signin_manager_base.h
+++ b/components/signin/core/browser/signin_manager_base.h
@@ -132,13 +132,14 @@
   void RemoveSigninDiagnosticsObserver(
       signin_internals_util::SigninDiagnosticsObserver* observer);
 
+  // Gives access to the SigninClient instance associated with this instance.
+  SigninClient* signin_client() const { return client_; }
+
  protected:
   AccountTrackerService* account_tracker_service() const {
     return account_tracker_service_;
   }
 
-  SigninClient* signin_client() const { return client_; }
-
   // Sets the authenticated user's account id.
   void SetAuthenticatedAccountId(const std::string& account_id);
 
diff --git a/components/sync_driver/fake_sync_client.cc b/components/sync_driver/fake_sync_client.cc
index 4e4acda..1d45b44c 100644
--- a/components/sync_driver/fake_sync_client.cc
+++ b/components/sync_driver/fake_sync_client.cc
@@ -12,6 +12,12 @@
 
 namespace sync_driver {
 
+namespace {
+
+void DummyClearBrowsingDataCallback(base::Time start, base::Time end) {}
+
+}  // namespace
+
 FakeSyncClient::FakeSyncClient()
     : factory_(nullptr),
       sync_service_(make_scoped_ptr(new FakeSyncService())) {}
@@ -49,6 +55,10 @@
   return scoped_refptr<password_manager::PasswordStore>();
 }
 
+ClearBrowsingDataCallback FakeSyncClient::GetClearBrowsingDataCallback() {
+  return base::Bind(&DummyClearBrowsingDataCallback);
+}
+
 base::Closure FakeSyncClient::GetPasswordStateChangedCallback() {
   return base::Bind(&base::DoNothing);
 }
diff --git a/components/sync_driver/fake_sync_client.h b/components/sync_driver/fake_sync_client.h
index 4b78a76..79113a4 100644
--- a/components/sync_driver/fake_sync_client.h
+++ b/components/sync_driver/fake_sync_client.h
@@ -25,6 +25,7 @@
   favicon::FaviconService* GetFaviconService() override;
   history::HistoryService* GetHistoryService() override;
   scoped_refptr<password_manager::PasswordStore> GetPasswordStore() override;
+  ClearBrowsingDataCallback GetClearBrowsingDataCallback() override;
   base::Closure GetPasswordStateChangedCallback() override;
   autofill::PersonalDataManager* GetPersonalDataManager() override;
   scoped_refptr<autofill::AutofillWebDataService> GetWebDataService() override;
diff --git a/components/sync_driver/sync_client.h b/components/sync_driver/sync_client.h
index 7bc10f3..d32b2ff2 100644
--- a/components/sync_driver/sync_client.h
+++ b/components/sync_driver/sync_client.h
@@ -9,6 +9,7 @@
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
 #include "base/memory/weak_ptr.h"
+#include "base/time/time.h"
 #include "sync/internal_api/public/base/model_type.h"
 #include "sync/internal_api/public/engine/model_safe_worker.h"
 #include "sync/util/extensions_activity.h"
@@ -51,6 +52,8 @@
 class SyncApiComponentFactory;
 class SyncService;
 
+typedef base::Callback<void(base::Time, base::Time)> ClearBrowsingDataCallback;
+
 // Interface for clients of the Sync API to plumb through necessary dependent
 // components. This interface is purely for abstracting dependencies, and
 // should not contain any non-trivial functional logic.
@@ -79,6 +82,10 @@
   virtual history::HistoryService* GetHistoryService() = 0;
   virtual scoped_refptr<password_manager::PasswordStore> GetPasswordStore() = 0;
 
+  // Returns a callback that will be invoked when the sync service wishes to
+  // have browsing data cleared.
+  virtual ClearBrowsingDataCallback GetClearBrowsingDataCallback() = 0;
+
   // Returns a callback that will be invoked when password sync state has
   // potentially been changed.
   virtual base::Closure GetPasswordStateChangedCallback() = 0;
diff --git a/components/translate/core/browser/translate_ui_delegate.cc b/components/translate/core/browser/translate_ui_delegate.cc
index fb33f7a..d1912dc 100644
--- a/components/translate/core/browser/translate_ui_delegate.cc
+++ b/components/translate/core/browser/translate_ui_delegate.cc
@@ -29,6 +29,20 @@
 const char kDeclineTranslateDismissUI[] = "Translate.DeclineTranslateDismissUI";
 const char kShowErrorUI[] = "Translate.ShowErrorUI";
 
+// Returns a Collator object which helps to sort strings in a given locale or
+// null if unable to find the right collator.
+//
+// TODO(hajimehoshi): Write a test for icu::Collator::createInstance.
+scoped_ptr<icu::Collator> CreateCollator(const std::string& locale) {
+  UErrorCode error = U_ZERO_ERROR;
+  icu::Locale loc(locale.c_str());
+  scoped_ptr<icu::Collator> collator(icu::Collator::createInstance(loc, error));
+  if (!collator || !U_SUCCESS(error))
+    return nullptr;
+  collator->setStrength(icu::Collator::PRIMARY);
+  return collator.Pass();
+}
+
 }  // namespace
 
 namespace translate {
@@ -50,12 +64,9 @@
   TranslateDownloadManager::GetSupportedLanguages(&language_codes);
 
   // Preparing for the alphabetical order in the locale.
-  UErrorCode error = U_ZERO_ERROR;
   std::string locale =
       TranslateDownloadManager::GetInstance()->application_locale();
-  icu::Locale loc(locale.c_str());
-  scoped_ptr<icu::Collator> collator(icu::Collator::createInstance(loc, error));
-  collator->setStrength(icu::Collator::PRIMARY);
+  scoped_ptr<icu::Collator> collator = CreateCollator(locale);
 
   languages_.reserve(language_codes.size());
   for (std::vector<std::string>::const_iterator iter = language_codes.begin();
@@ -67,10 +78,20 @@
         l10n_util::GetDisplayNameForLocale(language_code, locale, true);
     // Insert the language in languages_ in alphabetical order.
     std::vector<LanguageNamePair>::iterator iter2;
-    for (iter2 = languages_.begin(); iter2 != languages_.end(); ++iter2) {
-      if (base::i18n::CompareString16WithCollator(*collator, language_name,
-                                                  iter2->second) == UCOL_LESS) {
-        break;
+    if (collator) {
+      for (iter2 = languages_.begin(); iter2 != languages_.end(); ++iter2) {
+        int result = base::i18n::CompareString16WithCollator(*collator,
+                                                             language_name,
+                                                             iter2->second);
+        if (result == UCOL_LESS)
+          break;
+      }
+    } else {
+      // |locale| may not be supported by ICU collator (crbug/54833). In this
+      // case, let's order the languages in UTF-8.
+      for (iter2 = languages_.begin(); iter2 != languages_.end(); ++iter2) {
+        if (language_name.compare(iter2->second) < 0)
+          break;
       }
     }
     languages_.insert(iter2, LanguageNamePair(language_code, language_name));
diff --git a/content/browser/accessibility/BUILD.gn b/content/browser/accessibility/BUILD.gn
index f76c0e34..1f3d939 100644
--- a/content/browser/accessibility/BUILD.gn
+++ b/content/browser/accessibility/BUILD.gn
@@ -1,5 +1,5 @@
-# Copyright 2015 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
+# Copyright 2015 The Chromium Authors. All rights reserved.
 # found in the LICENSE file.
 
 import("//build/config/android/config.gni")
@@ -9,7 +9,4 @@
   sources = [
     "//content/browser/accessibility/browser_accessibility_manager_android.h",
   ]
-  outputs = [
-    "org/chromium/content/browser/accessibility/ScrollDirection.java",
-  ]
 }
diff --git a/content/browser/accessibility/browser_accessibility.cc b/content/browser/accessibility/browser_accessibility.cc
index 19e4b4b4..3e15a385 100644
--- a/content/browser/accessibility/browser_accessibility.cc
+++ b/content/browser/accessibility/browser_accessibility.cc
@@ -717,6 +717,19 @@
   }
 }
 
+bool BrowserAccessibility::IsTextControl() const {
+  // Time fields, color wells and spinner buttons might also use text fields as
+  // constituent parts, but they are not considered text fields as a whole.
+  switch (GetRole()) {
+    case ui::AX_ROLE_COMBO_BOX:
+    case ui::AX_ROLE_SEARCH_BOX:
+    case ui::AX_ROLE_TEXT_FIELD:
+      return true;
+    default:
+      return false;
+  }
+}
+
 int BrowserAccessibility::GetStaticTextLenRecursive() const {
   if (GetRole() == ui::AX_ROLE_STATIC_TEXT ||
       GetRole() == ui::AX_ROLE_LINE_BREAK) {
diff --git a/content/browser/accessibility/browser_accessibility.h b/content/browser/accessibility/browser_accessibility.h
index 10bde83..fd4d679 100644
--- a/content/browser/accessibility/browser_accessibility.h
+++ b/content/browser/accessibility/browser_accessibility.h
@@ -274,8 +274,8 @@
   // True if this is a web area, and its grandparent is a presentational iframe.
   bool IsWebAreaForPresentationalIframe() const;
 
-  // Is any control, like a button, text field, etc.
   bool IsControl() const;
+  bool IsTextControl() const;
 
  protected:
   BrowserAccessibility();
diff --git a/content/browser/accessibility/browser_accessibility_win.cc b/content/browser/accessibility/browser_accessibility_win.cc
index ed68784..175ddfa6 100644
--- a/content/browser/accessibility/browser_accessibility_win.cc
+++ b/content/browser/accessibility/browser_accessibility_win.cc
@@ -2002,7 +2002,7 @@
   if (!n_characters)
     return E_INVALIDARG;
 
-  *n_characters = TextForIAccessibleText().length();
+  *n_characters = hypertext().length();
   return S_OK;
 }
 
@@ -2039,7 +2039,7 @@
   if (!out_x || !out_y || !out_width || !out_height)
     return E_INVALIDARG;
 
-  const base::string16& text_str = TextForIAccessibleText();
+  const base::string16& text_str = hypertext();
   HandleSpecialTextOffset(text_str, &offset);
 
   if (offset < 0 || offset > static_cast<LONG>(text_str.size()))
@@ -2122,7 +2122,7 @@
   if (!text)
     return E_INVALIDARG;
 
-  const base::string16& text_str = TextForIAccessibleText();
+  const base::string16& text_str = hypertext();
 
   // Handle special text offsets.
   HandleSpecialTextOffset(text_str, &start_offset);
@@ -2165,7 +2165,7 @@
   if (!start_offset || !end_offset || !text)
     return E_INVALIDARG;
 
-  const base::string16& text_str = TextForIAccessibleText();
+  const base::string16& text_str = hypertext();
   HandleSpecialTextOffset(text_str, &offset);
   if (offset < 0)
     return E_INVALIDARG;
@@ -2220,7 +2220,7 @@
     return S_FALSE;
   }
 
-  const base::string16& text_str = TextForIAccessibleText();
+  const base::string16& text_str = hypertext();
 
   *start_offset = FindBoundary(
       text_str, boundary_type, offset, ui::BACKWARDS_DIRECTION);
@@ -2249,7 +2249,7 @@
     return S_FALSE;
   }
 
-  const base::string16& text_str = TextForIAccessibleText();
+  const base::string16& text_str = hypertext();
 
   *start_offset = offset;
   *end_offset = FindBoundary(
@@ -2342,7 +2342,7 @@
   if (!instance_active())
     return E_FAIL;
 
-  const base::string16& text_str = TextForIAccessibleText();
+  const base::string16& text_str = hypertext();
   HandleSpecialTextOffset(text_str, &start_offset);
   HandleSpecialTextOffset(text_str, &end_offset);
 
@@ -2365,7 +2365,7 @@
   if (!instance_active())
     return E_FAIL;
 
-  const base::string16& text_str = TextForIAccessibleText();
+  const base::string16& text_str = hypertext();
   HandleSpecialTextOffset(text_str, &offset);
   manager()->SetTextSelection(*this, offset, offset);
   return S_OK;
@@ -2380,7 +2380,7 @@
   if (selection_index != 0)
     return E_INVALIDARG;
 
-  const base::string16& text_str = TextForIAccessibleText();
+  const base::string16& text_str = hypertext();
   HandleSpecialTextOffset(text_str, &start_offset);
   HandleSpecialTextOffset(text_str, &end_offset);
 
@@ -2446,8 +2446,6 @@
   if (!hyperlink_index)
     return E_INVALIDARG;
 
-  *hyperlink_index = -1;
-
   if (char_index < 0 ||
       char_index >= static_cast<long>(hypertext().size())) {
     return E_INVALIDARG;
@@ -2455,8 +2453,10 @@
 
   std::map<int32, int32>::iterator it =
       hyperlink_offset_to_index().find(char_index);
-  if (it == hyperlink_offset_to_index().end())
-    return E_FAIL;
+  if (it == hyperlink_offset_to_index().end()) {
+    *hyperlink_index = -1;
+    return S_FALSE;
+  }
 
   *hyperlink_index = it->second;
   return S_OK;
@@ -2475,14 +2475,14 @@
   if (index != 0 || !anchor)
     return E_INVALIDARG;
 
-  BSTR hypertext = SysAllocString(TextForIAccessibleText().c_str());
-  DCHECK(hypertext);
+  BSTR ia2_hypertext = SysAllocString(hypertext().c_str());
+  DCHECK(ia2_hypertext);
   anchor->vt = VT_BSTR;
-  anchor->bstrVal = hypertext;
+  anchor->bstrVal = ia2_hypertext;
 
   // Returning S_FALSE is not mentioned in the IA2 Spec, but it might have been
   // an oversight.
-  if (!SysStringLen(hypertext))
+  if (!SysStringLen(ia2_hypertext))
     return S_FALSE;
 
   return S_OK;
@@ -3057,7 +3057,7 @@
   if (!out_x || !out_y || !out_width || !out_height)
     return E_INVALIDARG;
 
-  const base::string16& text_str = TextForIAccessibleText();
+  const base::string16& text_str = hypertext();
   if (start_index > text_str.size() ||
       end_index > text_str.size() ||
       start_index > end_index) {
@@ -3079,7 +3079,7 @@
   if (!instance_active())
     return E_FAIL;
 
-  const base::string16& text_str = TextForIAccessibleText();
+  const base::string16& text_str = hypertext();
   if (start_index > text_str.size() ||
       end_index > text_str.size() ||
       start_index > end_index) {
@@ -3528,7 +3528,11 @@
 
 void BrowserAccessibilityWin::UpdateStep2ComputeHypertext() {
   if (!PlatformChildCount()) {
-    win_attributes_->hypertext += name();
+    if (IsTextControl())
+      win_attributes_->hypertext += value();
+    else
+      win_attributes_->hypertext += name();
+
     return;
   }
 
@@ -3541,6 +3545,7 @@
     BrowserAccessibilityWin* child =
         PlatformGetChild(i)->ToBrowserAccessibilityWin();
     DCHECK(child);
+    // Similar to Firefox, we don't expose text-only objects in IA2 hypertext.
     if (child->IsTextOnlyObject()) {
       win_attributes_->hypertext += child->name();
     } else {
@@ -3815,7 +3820,7 @@
           PlatformGetChild(i)->ToBrowserAccessibilityWin();
       DCHECK(sibling);
       if (sibling->IsTextOnlyObject())
-        hypertextOffset += sibling->TextForIAccessibleText().length();
+        hypertextOffset += sibling->hypertext().length();
       else
         ++hypertextOffset;
     }
@@ -3907,7 +3912,7 @@
   if (endpoint_index_in_common_parent < index_in_common_parent)
     return 0;
   if (endpoint_index_in_common_parent > index_in_common_parent)
-    return TextForIAccessibleText().length();
+    return hypertext().length();
 
   NOTREACHED();
   return -1;
@@ -4021,16 +4026,6 @@
   return value;
 }
 
-base::string16 BrowserAccessibilityWin::TextForIAccessibleText() const {
-  switch (GetRole()) {
-    case ui::AX_ROLE_TEXT_FIELD:
-    case ui::AX_ROLE_MENU_LIST_OPTION:
-      return value();
-    default:
-      return hypertext();
-  }
-}
-
 bool BrowserAccessibilityWin::IsSameHypertextCharacter(size_t old_char_index,
                                                        size_t new_char_index) {
   CHECK(old_win_attributes_);
diff --git a/content/browser/accessibility/browser_accessibility_win.h b/content/browser/accessibility/browser_accessibility_win.h
index 094fea7..efcb42e 100644
--- a/content/browser/accessibility/browser_accessibility_win.h
+++ b/content/browser/accessibility/browser_accessibility_win.h
@@ -828,10 +828,6 @@
   // value for some roles.
   base::string16 GetValueText();
 
-  // Get the text of this node for the purposes of IAccessibleText - it may
-  // be the name, it may be the value, etc. depending on the role.
-  base::string16 TextForIAccessibleText() const;
-
   bool IsSameHypertextCharacter(size_t old_char_index, size_t new_char_index);
   void ComputeHypertextRemovedAndInserted(
       int* start, int* old_len, int* new_len);
diff --git a/content/browser/accessibility/browser_accessibility_win_unittest.cc b/content/browser/accessibility/browser_accessibility_win_unittest.cc
index b81dc57..5049c14 100644
--- a/content/browser/accessibility/browser_accessibility_win_unittest.cc
+++ b/content/browser/accessibility/browser_accessibility_win_unittest.cc
@@ -484,6 +484,7 @@
 TEST_F(BrowserAccessibilityTest, TestSimpleHypertext) {
   const std::string text1_name = "One two three.";
   const std::string text2_name = " Four five six.";
+  const size_t text_name_len = text1_name.length() + text2_name.length();
 
   ui::AXNodeData text1;
   text1.id = 11;
@@ -501,164 +502,216 @@
   root.id = 1;
   root.role = ui::AX_ROLE_ROOT_WEB_AREA;
   root.state = 1 << ui::AX_STATE_READ_ONLY;
-  root.child_ids.push_back(11);
-  root.child_ids.push_back(12);
+  root.child_ids.push_back(text1.id);
+  root.child_ids.push_back(text2.id);
 
   CountedBrowserAccessibility::reset();
   scoped_ptr<BrowserAccessibilityManager> manager(
       BrowserAccessibilityManager::Create(
-          MakeAXTreeUpdate(root, text1, text2),
-          NULL, new CountedBrowserAccessibilityFactory()));
+          MakeAXTreeUpdate(root, text1, text2), nullptr,
+          new CountedBrowserAccessibilityFactory()));
   ASSERT_EQ(3, CountedBrowserAccessibility::num_instances());
 
   BrowserAccessibilityWin* root_obj =
       manager->GetRoot()->ToBrowserAccessibilityWin();
 
   long text_len;
-  ASSERT_EQ(S_OK, root_obj->get_nCharacters(&text_len));
+  EXPECT_EQ(S_OK, root_obj->get_nCharacters(&text_len));
+  EXPECT_EQ(text_name_len, text_len);
 
   base::win::ScopedBstr text;
-  ASSERT_EQ(S_OK, root_obj->get_text(0, text_len, text.Receive()));
+  EXPECT_EQ(S_OK, root_obj->get_text(0, text_name_len, text.Receive()));
   EXPECT_EQ(text1_name + text2_name, base::UTF16ToUTF8(base::string16(text)));
 
   long hyperlink_count;
-  ASSERT_EQ(S_OK, root_obj->get_nHyperlinks(&hyperlink_count));
+  EXPECT_EQ(S_OK, root_obj->get_nHyperlinks(&hyperlink_count));
   EXPECT_EQ(0, hyperlink_count);
 
   base::win::ScopedComPtr<IAccessibleHyperlink> hyperlink;
   EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(-1, hyperlink.Receive()));
   EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(0, hyperlink.Receive()));
-  EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(28, hyperlink.Receive()));
-  EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(29, hyperlink.Receive()));
+  EXPECT_EQ(E_INVALIDARG,
+            root_obj->get_hyperlink(text_name_len, hyperlink.Receive()));
+  EXPECT_EQ(E_INVALIDARG,
+            root_obj->get_hyperlink(text_name_len + 1, hyperlink.Receive()));
 
   long hyperlink_index;
-  EXPECT_EQ(E_FAIL, root_obj->get_hyperlinkIndex(0, &hyperlink_index));
+  EXPECT_EQ(S_FALSE, root_obj->get_hyperlinkIndex(0, &hyperlink_index));
   EXPECT_EQ(-1, hyperlink_index);
-  EXPECT_EQ(E_FAIL, root_obj->get_hyperlinkIndex(28, &hyperlink_index));
-  EXPECT_EQ(-1, hyperlink_index);
+  // Invalid arguments should not be modified.
+  hyperlink_index = -2;
+  EXPECT_EQ(E_INVALIDARG,
+            root_obj->get_hyperlinkIndex(text_name_len, &hyperlink_index));
+  EXPECT_EQ(-2, hyperlink_index);
   EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlinkIndex(-1, &hyperlink_index));
-  EXPECT_EQ(-1, hyperlink_index);
-  EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlinkIndex(29, &hyperlink_index));
-  EXPECT_EQ(-1, hyperlink_index);
+  EXPECT_EQ(-2, hyperlink_index);
+  EXPECT_EQ(E_INVALIDARG,
+            root_obj->get_hyperlinkIndex(text_name_len + 1, &hyperlink_index));
+  EXPECT_EQ(-2, hyperlink_index);
 
-  // Delete the manager and test that all BrowserAccessibility instances are
-  // deleted.
   manager.reset();
   ASSERT_EQ(0, CountedBrowserAccessibility::num_instances());
 }
 
 TEST_F(BrowserAccessibilityTest, TestComplexHypertext) {
-  const std::string text1_name = "One two three.";
-  const std::string text2_name = " Four five six.";
-  const std::string button1_text_name = "red";
-  const std::string link1_text_name = "blue";
+  const base::string16 text1_name = L"One two three.";
+  const base::string16 combo_box_name = L"City:";
+  const base::string16 combo_box_value = L"Happyland";
+  const base::string16 text2_name = L" Four five six.";
+  const base::string16 check_box_name = L"I agree";
+  const base::string16 check_box_value = L"Checked";
+  const base::string16 button_text_name = L"Red";
+  const base::string16 link_text_name = L"Blue";
+  // Each control (combo / check box, button and link) will be represented by an
+  // embedded object character.
+  const base::string16 embed(1, BrowserAccessibilityWin::kEmbeddedCharacter);
+  const base::string16 root_hypertext =
+      text1_name + embed + text2_name + embed + embed + embed;
+  const size_t root_hypertext_len = root_hypertext.length();
 
   ui::AXNodeData text1;
   text1.id = 11;
   text1.role = ui::AX_ROLE_STATIC_TEXT;
   text1.state = 1 << ui::AX_STATE_READ_ONLY;
-  text1.SetName(text1_name);
+  text1.SetName(base::UTF16ToUTF8(text1_name));
+
+  ui::AXNodeData combo_box;
+  combo_box.id = 12;
+  combo_box.role = ui::AX_ROLE_COMBO_BOX;
+  combo_box.SetName(base::UTF16ToUTF8(combo_box_name));
+  combo_box.SetValue(base::UTF16ToUTF8(combo_box_value));
 
   ui::AXNodeData text2;
-  text2.id = 12;
+  text2.id = 13;
   text2.role = ui::AX_ROLE_STATIC_TEXT;
   text2.state = 1 << ui::AX_STATE_READ_ONLY;
-  text2.SetName(text2_name);
+  text2.SetName(base::UTF16ToUTF8(text2_name));
 
-  ui::AXNodeData button1, button1_text;
-  button1.id = 13;
-  button1_text.id = 15;
-  button1_text.SetName(button1_text_name);
-  button1.role = ui::AX_ROLE_BUTTON;
-  button1_text.role = ui::AX_ROLE_STATIC_TEXT;
-  button1.state = 1 << ui::AX_STATE_READ_ONLY;
-  button1_text.state = 1 << ui::AX_STATE_READ_ONLY;
-  button1.child_ids.push_back(15);
+  ui::AXNodeData check_box;
+  check_box.id = 14;
+  check_box.role = ui::AX_ROLE_CHECK_BOX;
+  check_box.state = 1 << ui::AX_STATE_CHECKED;
+  check_box.SetName(base::UTF16ToUTF8(check_box_name));
+  check_box.SetValue(base::UTF16ToUTF8(check_box_value));
 
-  ui::AXNodeData link1, link1_text;
-  link1.id = 14;
-  link1_text.id = 16;
-  link1_text.SetName(link1_text_name);
-  link1.role = ui::AX_ROLE_LINK;
-  link1_text.role = ui::AX_ROLE_STATIC_TEXT;
-  link1.state = 1 << ui::AX_STATE_READ_ONLY;
-  link1_text.state = 1 << ui::AX_STATE_READ_ONLY;
-  link1.child_ids.push_back(16);
+  ui::AXNodeData button, button_text;
+  button.id = 15;
+  button_text.id = 17;
+  button_text.SetName(base::UTF16ToUTF8(button_text_name));
+  button.role = ui::AX_ROLE_BUTTON;
+  button_text.role = ui::AX_ROLE_STATIC_TEXT;
+  button.state = 1 << ui::AX_STATE_READ_ONLY;
+  button_text.state = 1 << ui::AX_STATE_READ_ONLY;
+  button.child_ids.push_back(button_text.id);
+
+  ui::AXNodeData link, link_text;
+  link.id = 16;
+  link_text.id = 18;
+  link_text.SetName(base::UTF16ToUTF8(link_text_name));
+  link.role = ui::AX_ROLE_LINK;
+  link_text.role = ui::AX_ROLE_STATIC_TEXT;
+  link.state = 1 << ui::AX_STATE_READ_ONLY;
+  link_text.state = 1 << ui::AX_STATE_READ_ONLY;
+  link.child_ids.push_back(link_text.id);
 
   ui::AXNodeData root;
   root.id = 1;
   root.role = ui::AX_ROLE_ROOT_WEB_AREA;
   root.state = 1 << ui::AX_STATE_READ_ONLY;
-  root.child_ids.push_back(11);
-  root.child_ids.push_back(13);
-  root.child_ids.push_back(12);
-  root.child_ids.push_back(14);
+  root.child_ids.push_back(text1.id);
+  root.child_ids.push_back(combo_box.id);
+  root.child_ids.push_back(text2.id);
+  root.child_ids.push_back(check_box.id);
+  root.child_ids.push_back(button.id);
+  root.child_ids.push_back(link.id);
 
   CountedBrowserAccessibility::reset();
   scoped_ptr<BrowserAccessibilityManager> manager(
       BrowserAccessibilityManager::Create(
-          MakeAXTreeUpdate(root,
-                           text1, button1, button1_text,
-                           text2, link1, link1_text),
-          NULL, new CountedBrowserAccessibilityFactory()));
-  ASSERT_EQ(7, CountedBrowserAccessibility::num_instances());
+          MakeAXTreeUpdate(root, text1, combo_box, text2, check_box, button,
+                           button_text, link, link_text),
+          nullptr, new CountedBrowserAccessibilityFactory()));
+  ASSERT_EQ(9, CountedBrowserAccessibility::num_instances());
 
   BrowserAccessibilityWin* root_obj =
       manager->GetRoot()->ToBrowserAccessibilityWin();
 
   long text_len;
-  ASSERT_EQ(S_OK, root_obj->get_nCharacters(&text_len));
+  EXPECT_EQ(S_OK, root_obj->get_nCharacters(&text_len));
+  EXPECT_EQ(root_hypertext_len, text_len);
 
   base::win::ScopedBstr text;
-  ASSERT_EQ(S_OK, root_obj->get_text(0, text_len, text.Receive()));
-  const std::string embed = base::UTF16ToUTF8(
-      base::string16(1, BrowserAccessibilityWin::kEmbeddedCharacter));
-  EXPECT_EQ(text1_name + embed + text2_name + embed,
-            base::UTF16ToUTF8(base::string16(text)));
+  EXPECT_EQ(S_OK, root_obj->get_text(0, root_hypertext_len, text.Receive()));
+  EXPECT_STREQ(root_hypertext.c_str(), text);
   text.Reset();
 
   long hyperlink_count;
-  ASSERT_EQ(S_OK, root_obj->get_nHyperlinks(&hyperlink_count));
-  EXPECT_EQ(2, hyperlink_count);
+  EXPECT_EQ(S_OK, root_obj->get_nHyperlinks(&hyperlink_count));
+  EXPECT_EQ(4, hyperlink_count);
 
   base::win::ScopedComPtr<IAccessibleHyperlink> hyperlink;
   base::win::ScopedComPtr<IAccessibleText> hypertext;
   EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(-1, hyperlink.Receive()));
-  EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(2, hyperlink.Receive()));
-  EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(28, hyperlink.Receive()));
+  EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(4, hyperlink.Receive()));
 
+  // Get the text of the combo box.
+  // It should be its value.
   EXPECT_EQ(S_OK, root_obj->get_hyperlink(0, hyperlink.Receive()));
+  EXPECT_EQ(S_OK, hyperlink.QueryInterface(hypertext.Receive()));
   EXPECT_EQ(S_OK,
-            hyperlink.QueryInterface<IAccessibleText>(hypertext.Receive()));
-  EXPECT_EQ(S_OK, hypertext->get_text(0, 3, text.Receive()));
-  EXPECT_STREQ(button1_text_name.c_str(),
-               base::UTF16ToUTF8(base::string16(text)).c_str());
+            hypertext->get_text(0, IA2_TEXT_OFFSET_LENGTH, text.Receive()));
+  EXPECT_STREQ(combo_box_value.c_str(), text);
   text.Reset();
   hyperlink.Release();
   hypertext.Release();
 
+  // Get the text of the check box.
+  // It should be its name.
   EXPECT_EQ(S_OK, root_obj->get_hyperlink(1, hyperlink.Receive()));
+  EXPECT_EQ(S_OK, hyperlink.QueryInterface(hypertext.Receive()));
   EXPECT_EQ(S_OK,
-            hyperlink.QueryInterface<IAccessibleText>(hypertext.Receive()));
+            hypertext->get_text(0, IA2_TEXT_OFFSET_LENGTH, text.Receive()));
+  EXPECT_STREQ(check_box_name.c_str(), text);
+  text.Reset();
+  hyperlink.Release();
+  hypertext.Release();
+
+  // Get the text of the button.
+  EXPECT_EQ(S_OK, root_obj->get_hyperlink(2, hyperlink.Receive()));
+  EXPECT_EQ(S_OK, hyperlink.QueryInterface(hypertext.Receive()));
+  EXPECT_EQ(S_OK,
+            hypertext->get_text(0, IA2_TEXT_OFFSET_LENGTH, text.Receive()));
+  EXPECT_STREQ(button_text_name.c_str(), text);
+  text.Reset();
+  hyperlink.Release();
+  hypertext.Release();
+
+  // Get the text of the link.
+  EXPECT_EQ(S_OK, root_obj->get_hyperlink(3, hyperlink.Receive()));
+  EXPECT_EQ(S_OK, hyperlink.QueryInterface(hypertext.Receive()));
   EXPECT_EQ(S_OK, hypertext->get_text(0, 4, text.Receive()));
-  EXPECT_STREQ(link1_text_name.c_str(),
-               base::UTF16ToUTF8(base::string16(text)).c_str());
+  EXPECT_STREQ(link_text_name.c_str(), text);
   text.Reset();
   hyperlink.Release();
   hypertext.Release();
 
   long hyperlink_index;
-  EXPECT_EQ(E_FAIL, root_obj->get_hyperlinkIndex(0, &hyperlink_index));
+  EXPECT_EQ(S_FALSE, root_obj->get_hyperlinkIndex(0, &hyperlink_index));
   EXPECT_EQ(-1, hyperlink_index);
-  EXPECT_EQ(E_FAIL, root_obj->get_hyperlinkIndex(28, &hyperlink_index));
-  EXPECT_EQ(-1, hyperlink_index);
+  // Invalid arguments should not be modified.
+  hyperlink_index = -2;
+  EXPECT_EQ(E_INVALIDARG,
+            root_obj->get_hyperlinkIndex(root_hypertext_len, &hyperlink_index));
+  EXPECT_EQ(-2, hyperlink_index);
   EXPECT_EQ(S_OK, root_obj->get_hyperlinkIndex(14, &hyperlink_index));
   EXPECT_EQ(0, hyperlink_index);
   EXPECT_EQ(S_OK, root_obj->get_hyperlinkIndex(30, &hyperlink_index));
   EXPECT_EQ(1, hyperlink_index);
+  EXPECT_EQ(S_OK, root_obj->get_hyperlinkIndex(31, &hyperlink_index));
+  EXPECT_EQ(2, hyperlink_index);
+  EXPECT_EQ(S_OK, root_obj->get_hyperlinkIndex(32, &hyperlink_index));
+  EXPECT_EQ(3, hyperlink_index);
 
-  // Delete the manager and test that all BrowserAccessibility instances are
-  // deleted.
   manager.reset();
   ASSERT_EQ(0, CountedBrowserAccessibility::num_instances());
 }
diff --git a/content/browser/download/save_package.cc b/content/browser/download/save_package.cc
index d335e50..5da4e00 100644
--- a/content/browser/download/save_package.cc
+++ b/content/browser/download/save_package.cc
@@ -25,6 +25,9 @@
 #include "content/browser/download/save_file.h"
 #include "content/browser/download/save_file_manager.h"
 #include "content/browser/download/save_item.h"
+#include "content/browser/frame_host/frame_tree.h"
+#include "content/browser/frame_host/frame_tree_node.h"
+#include "content/browser/frame_host/render_frame_host_impl.h"
 #include "content/browser/loader/resource_dispatcher_host_impl.h"
 #include "content/browser/renderer_host/render_process_host_impl.h"
 #include "content/browser/renderer_host/render_view_host_delegate.h"
@@ -163,7 +166,8 @@
   DCHECK(page_url_.is_valid());
   DCHECK((save_type_ == SAVE_PAGE_TYPE_AS_ONLY_HTML) ||
          (save_type_ == SAVE_PAGE_TYPE_AS_MHTML) ||
-         (save_type_ == SAVE_PAGE_TYPE_AS_COMPLETE_HTML));
+         (save_type_ == SAVE_PAGE_TYPE_AS_COMPLETE_HTML))
+      << save_type_;
   DCHECK(!saved_main_file_path_.empty() &&
          saved_main_file_path_.value().length() <= kMaxFilePathLength);
   DCHECK(!saved_main_directory_path_.empty() &&
@@ -233,20 +237,20 @@
   // We should no longer be observing the DownloadItem at this point.
   CHECK(!download_);
 
-  DCHECK(all_save_items_count_ == (waiting_item_queue_.size() +
-                                   completed_count() +
-                                   in_process_count()));
-  // Free all SaveItems.
-  while (!waiting_item_queue_.empty()) {
-    // We still have some items which are waiting for start to save.
-    SaveItem* save_item = waiting_item_queue_.front();
-    waiting_item_queue_.pop();
-    delete save_item;
-  }
+  DCHECK_EQ(all_save_items_count_, waiting_item_queue_.size() +
+                                       completed_count() + in_process_count());
 
-  STLDeleteValues(&saved_success_items_);
+  // Free all SaveItems.
+  STLDeleteElements(&waiting_item_queue_);
   STLDeleteValues(&in_progress_items_);
+  STLDeleteValues(&saved_success_items_);
   STLDeleteValues(&saved_failed_items_);
+  // Clear containers that contain (now dangling/invalid) pointers to the
+  // save items freed above.  This is not strictly required (as the containers
+  // will be destructed soon by ~SavePackage), but seems like good code hygiene.
+  frame_tree_node_id_to_contained_save_items_.clear();
+  frame_tree_node_id_to_save_item_.clear();
+  url_to_save_item_.clear();
 
   file_manager_ = NULL;
 }
@@ -342,7 +346,7 @@
     web_contents()->GenerateMHTML(saved_main_file_path_, base::Bind(
         &SavePackage::OnMHTMLGenerated, this));
   } else {
-    DCHECK_EQ(SAVE_PAGE_TYPE_AS_ONLY_HTML, save_type_) << save_type_;
+    DCHECK_EQ(SAVE_PAGE_TYPE_AS_ONLY_HTML, save_type_);
     wait_state_ = NET_FILES;
     SaveFileCreateInfo::SaveFileSource save_source = page_url_.SchemeIsFile() ?
         SaveFileCreateInfo::SAVE_FILE_FROM_FILE :
@@ -352,7 +356,7 @@
                                        this,
                                        save_source);
     // Add this item to waiting list.
-    waiting_item_queue_.push(save_item);
+    waiting_item_queue_.push_back(save_item);
     all_save_items_count_ = 1;
     download_->SetTotalBytes(1);
 
@@ -593,7 +597,7 @@
 
     // When saving page as only-HTML, we only have a SaveItem whose url
     // must be page_url_.
-    DCHECK(save_type_ == SAVE_PAGE_TYPE_AS_COMPLETE_HTML);
+    DCHECK_EQ(SAVE_PAGE_TYPE_AS_COMPLETE_HTML, save_type_);
     DCHECK(!saved_main_directory_path_.empty());
 
     // Now we get final name retrieved from GenerateFileName, we will use it
@@ -633,7 +637,7 @@
     for (SaveUrlItemMap::iterator it = in_progress_items_.begin();
         it != in_progress_items_.end(); ++it) {
       SaveItem* save_item = it->second;
-      DCHECK(save_item->state() == SaveItem::IN_PROGRESS);
+      DCHECK_EQ(SaveItem::IN_PROGRESS, save_item->state());
       if (save_item->save_id() == save_id)
         return save_item;
     }
@@ -695,7 +699,7 @@
     SaveUrlItemMap::iterator it = in_progress_items_.begin();
     for (; it != in_progress_items_.end(); ++it) {
       SaveItem* save_item = it->second;
-      DCHECK(save_item->state() == SaveItem::IN_PROGRESS);
+      DCHECK_EQ(SaveItem::IN_PROGRESS, save_item->state());
       save_item->Cancel();
     }
     // Remove all in progress item to saved map. For failed items, they will
@@ -923,7 +927,7 @@
   do {
     // Pop SaveItem from waiting list.
     SaveItem* save_item = waiting_item_queue_.front();
-    waiting_item_queue_.pop();
+    waiting_item_queue_.pop_front();
 
     // Add the item to in_progress_items_.
     SaveUrlItemMap::iterator it = in_progress_items_.find(
@@ -972,7 +976,7 @@
 
     // Start a new SaveItem job if we still have job in waiting queue.
     if (waiting_item_queue_.size()) {
-      DCHECK(wait_state_ == NET_FILES);
+      DCHECK_EQ(NET_FILES, wait_state_);
       SaveItem* save_item = waiting_item_queue_.front();
       if (save_item->save_source() != SaveFileCreateInfo::SAVE_FILE_FROM_DOM) {
         SaveNextFile(false);
@@ -987,15 +991,16 @@
       }
     } else if (in_process_count()) {
       // Continue asking for HTML data.
-      DCHECK(wait_state_ == HTML_DATA);
+      DCHECK_EQ(HTML_DATA, wait_state_);
     }
   } else {
     // Save as HTML only or MHTML.
-    DCHECK(wait_state_ == NET_FILES);
+    DCHECK_EQ(NET_FILES, wait_state_);
     DCHECK((save_type_ == SAVE_PAGE_TYPE_AS_ONLY_HTML) ||
-           (save_type_ == SAVE_PAGE_TYPE_AS_MHTML));
+           (save_type_ == SAVE_PAGE_TYPE_AS_MHTML))
+        << save_type_;
     if (waiting_item_queue_.size()) {
-      DCHECK(all_save_items_count_ == waiting_item_queue_.size());
+      DCHECK_EQ(all_save_items_count_, waiting_item_queue_.size());
       SaveNextFile(false);
     }
   }
@@ -1004,7 +1009,8 @@
 bool SavePackage::OnMessageReceived(const IPC::Message& message,
                                     RenderFrameHost* render_frame_host) {
   bool handled = true;
-  IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(SavePackage, message, render_frame_host)
+  auto* rfhi = static_cast<RenderFrameHostImpl*>(render_frame_host);
+  IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(SavePackage, message, rfhi)
     IPC_MESSAGE_HANDLER(FrameHostMsg_SavableResourceLinksResponse,
                         OnSavableResourceLinksResponse)
     IPC_MESSAGE_HANDLER(FrameHostMsg_SavableResourceLinksError,
@@ -1023,65 +1029,73 @@
 void SavePackage::GetSerializedHtmlWithLocalLinks() {
   if (wait_state_ != HTML_DATA)
     return;
-  std::vector<GURL> saved_links;
-  std::vector<base::FilePath> saved_file_paths;
-  int successful_started_items_count = 0;
 
-  // Collect all saved items which have local storage.
   // First collect the status of all the resource files and check whether they
-  // have created local files although they have not been completely saved.
-  // If yes, the file can be saved. Otherwise, there is a disk error, so we
-  // need to cancel the page saving job.
-  for (SaveUrlItemMap::iterator it = in_progress_items_.begin();
-       it != in_progress_items_.end(); ++it) {
-    DCHECK(it->second->save_source() ==
-           SaveFileCreateInfo::SAVE_FILE_FROM_DOM);
-    if (it->second->has_final_name())
+  // have created local files (although they have not been completely saved).
+  int successful_started_items_count = 0;
+  for (const auto& item : in_progress_items_) {
+    DCHECK_EQ(SaveFileCreateInfo::SAVE_FILE_FROM_DOM,
+              item.second->save_source());
+    if (item.second->has_final_name())
       successful_started_items_count++;
-    saved_links.push_back(it->second->url());
-    saved_file_paths.push_back(it->second->file_name());
   }
-
   // If not all file of HTML resource have been started, then wait.
   if (successful_started_items_count != in_process_count())
     return;
 
-  // Collect all saved success items.
-  for (SavedItemMap::iterator it = saved_success_items_.begin();
-       it != saved_success_items_.end(); ++it) {
-    DCHECK(it->second->has_final_name());
-    saved_links.push_back(it->second->url());
-    saved_file_paths.push_back(it->second->file_name());
-  }
-
-  // Get the relative directory name.
-  base::FilePath relative_dir_name = saved_main_directory_path_.BaseName();
-
   // Ask all frames for their serialized data.
   DCHECK_EQ(0, number_of_frames_pending_response_);
-  web_contents()->ForEachFrame(base::Bind(
-      &SavePackage::GetSerializedHtmlWithLocalLinksForFrame,
-      base::Unretained(this),  // Safe, because ForEachFrame is synchronous.
-      saved_links, saved_file_paths, relative_dir_name));
-  DCHECK_LT(0, number_of_frames_pending_response_);
+  FrameTree* frame_tree =
+      static_cast<RenderFrameHostImpl*>(web_contents()->GetMainFrame())
+          ->frame_tree_node()->frame_tree();
+  for (const auto& item : frame_tree_node_id_to_save_item_) {
+    DCHECK(item.second);  // SaveItem* != nullptr.
+    int frame_tree_node_id = item.first;
+    FrameTreeNode* frame_tree_node = frame_tree->FindByID(frame_tree_node_id);
+    if (frame_tree_node) {
+      GetSerializedHtmlWithLocalLinksForFrame(frame_tree_node);
+      number_of_frames_pending_response_++;
+    }
+  }
+  if (number_of_frames_pending_response_ == 0) {
+    // All frames disappeared since gathering of savable resources?
+    // Treat this as cancellation.
+    Cancel(false);
+  }
 }
 
 void SavePackage::GetSerializedHtmlWithLocalLinksForFrame(
-    const std::vector<GURL>& saved_links,
-    const std::vector<base::FilePath>& saved_file_paths,
-    const base::FilePath& relative_dir_name,
-    RenderFrameHost* target) {
-  number_of_frames_pending_response_++;
+    FrameTreeNode* target_tree_node) {
+  DCHECK(target_tree_node);
+  int target_frame_tree_node_id = target_tree_node->frame_tree_node_id();
+
+  // Collect all saved success items.
+  // SECURITY NOTE: We don't send *all* urls / local paths, but only
+  // those that the given frame had access to already (because it contained
+  // the savable resources / subframes associated with save items).
+  std::vector<GURL> saved_links;
+  std::vector<base::FilePath> saved_file_paths;
+  auto it = frame_tree_node_id_to_contained_save_items_.find(
+      target_frame_tree_node_id);
+  if (it != frame_tree_node_id_to_contained_save_items_.end()) {
+    for (SaveItem* save_item : it->second) {
+      DCHECK(save_item->has_final_name());
+      saved_links.push_back(save_item->url());
+      saved_file_paths.push_back(save_item->file_name());
+    }
+  }
+
+  // Ask target frame to serialize itself.
+  RenderFrameHostImpl* target = target_tree_node->current_frame_host();
   target->Send(new FrameMsg_GetSerializedHtmlWithLocalLinks(
       target->GetRoutingID(), saved_links, saved_file_paths,
-      relative_dir_name));
+      saved_main_directory_path_.BaseName()));
 }
 
 // Process the serialized HTML content data of a specified frame
 // retrieved from the renderer process.
 void SavePackage::OnSerializedHtmlWithLocalLinksResponse(
-    RenderFrameHost* sender,
-    const GURL& frame_url,
+    RenderFrameHostImpl* sender,
     const std::string& data,
     bool end_of_data) {
   // Check current state.
@@ -1090,26 +1104,33 @@
 
   int id = contents_id();
 
-  SaveUrlItemMap::iterator it = in_progress_items_.find(frame_url.spec());
-  if (it == in_progress_items_.end()) {
+  int frame_tree_node_id = sender->frame_tree_node()->frame_tree_node_id();
+  auto it = frame_tree_node_id_to_save_item_.find(frame_tree_node_id);
+  if (it == frame_tree_node_id_to_save_item_.end()) {
+    // Sanitization of renderer IPC - we will have no save item only if
+    // the renderer misbehaves and sends OnSerializedHtmlFragment IPC without
+    // being asked to.
+    NOTREACHED();
+    return;
+  }
+  SaveItem* save_item = it->second;
+  DCHECK_EQ(SaveFileCreateInfo::SAVE_FILE_FROM_DOM, save_item->save_source());
+  if (save_item->state() != SaveItem::IN_PROGRESS) {
     for (SavedItemMap::iterator saved_it = saved_success_items_.begin();
       saved_it != saved_success_items_.end(); ++saved_it) {
-      if (saved_it->second->url() == frame_url) {
+      if (saved_it->second->url() == save_item->url()) {
         wrote_to_completed_file_ = true;
         break;
       }
     }
 
-    it = saved_failed_items_.find(frame_url.spec());
-    if (it != saved_failed_items_.end())
+    auto it2 = saved_failed_items_.find(save_item->url().spec());
+    if (it2 != saved_failed_items_.end())
       wrote_to_failed_file_ = true;
 
     return;
   }
 
-  SaveItem* save_item = it->second;
-  DCHECK(save_item->save_source() == SaveFileCreateInfo::SAVE_FILE_FROM_DOM);
-
   if (!data.empty()) {
     // Prepare buffer for saving HTML data.
     scoped_refptr<net::IOBuffer> new_data(new net::IOBuffer(data.size()));
@@ -1171,6 +1192,15 @@
       &SavePackage::GetSavableResourceLinksForFrame,
       base::Unretained(this)));  // Safe, because ForEachFrame is synchronous.
   DCHECK_LT(0, number_of_frames_pending_response_);
+
+  // Enqueue the main frame separately (because this frame won't show up in any
+  // of OnSavableResourceLinksResponse callbacks).
+  FrameTreeNode* main_frame_tree_node =
+      static_cast<RenderFrameHostImpl*>(web_contents()->GetMainFrame())
+          ->frame_tree_node();
+  EnqueueFrame(FrameTreeNode::kFrameTreeNodeInvalidID,  // No container.
+               main_frame_tree_node->frame_tree_node_id(),
+               main_frame_tree_node->current_url());
 }
 
 void SavePackage::GetSavableResourceLinksForFrame(RenderFrameHost* target) {
@@ -1179,36 +1209,88 @@
 }
 
 void SavePackage::OnSavableResourceLinksResponse(
-    RenderFrameHost* sender,
-    const GURL& frame_url,
+    RenderFrameHostImpl* sender,
     const std::vector<GURL>& resources_list,
-    const Referrer& referrer) {
+    const Referrer& referrer,
+    const std::vector<SavableSubframe>& subframes) {
   if (wait_state_ != RESOURCES_LIST)
     return;
 
   // Add all sub-resources to wait list.
+  int container_frame_tree_node_id =
+      sender->frame_tree_node()->frame_tree_node_id();
   for (const GURL& u : resources_list) {
-    if (!u.is_valid())
-      continue;
-    if (unique_urls_to_save_.count(u))
-      continue;
-    unique_urls_to_save_.insert(u);
-
-    SaveFileCreateInfo::SaveFileSource save_source =
-        u.SchemeIsFile() ? SaveFileCreateInfo::SAVE_FILE_FROM_FILE
-                         : SaveFileCreateInfo::SAVE_FILE_FROM_NET;
-    SaveItem* save_item = new SaveItem(u, referrer, this, save_source);
-    waiting_item_queue_.push(save_item);
+    EnqueueSavableResource(container_frame_tree_node_id, u, referrer);
   }
+  for (const SavableSubframe& subframe : subframes) {
+    FrameTreeNode* subframe_tree_node =
+        sender->frame_tree_node()->frame_tree()->FindByRoutingID(
+            sender->GetProcess()->GetID(), subframe.routing_id);
 
-  // Store savable frame_url for later processing.
-  if (frame_url.is_valid())
-    frame_urls_to_save_.push_back(frame_url);
+    if (!subframe_tree_node ||
+        subframe_tree_node->parent() != sender->frame_tree_node()) {
+      // Only reachable if the renderer has a bug or has been compromised.
+      NOTREACHED();
+      continue;
+    }
+
+    EnqueueFrame(container_frame_tree_node_id,
+                 subframe_tree_node->frame_tree_node_id(),
+                 subframe.original_url);
+  }
 
   CompleteSavableResourceLinksResponse();
 }
 
-void SavePackage::OnSavableResourceLinksError(RenderFrameHost* sender) {
+SaveItem* SavePackage::FindOrCreatePendingSaveItem(
+    int container_frame_tree_node_id,
+    const GURL& url,
+    const Referrer& referrer,
+    SaveFileCreateInfo::SaveFileSource save_source) {
+  DCHECK(url.is_valid());  // |url| should be validated by the callers.
+
+  SaveItem* save_item;
+  auto it = url_to_save_item_.find(url);
+  if (it != url_to_save_item_.end()) {
+    save_item = it->second;
+  } else {
+    save_item = new SaveItem(url, referrer, this, save_source);
+    waiting_item_queue_.push_back(save_item);
+    url_to_save_item_[url] = save_item;
+  }
+
+  frame_tree_node_id_to_contained_save_items_[container_frame_tree_node_id]
+      .push_back(save_item);
+  return save_item;
+}
+
+void SavePackage::EnqueueSavableResource(int container_frame_tree_node_id,
+                                         const GURL& url,
+                                         const Referrer& referrer) {
+  if (!url.is_valid())
+    return;
+
+  SaveFileCreateInfo::SaveFileSource save_source =
+      url.SchemeIsFile() ? SaveFileCreateInfo::SAVE_FILE_FROM_FILE
+                         : SaveFileCreateInfo::SAVE_FILE_FROM_NET;
+  FindOrCreatePendingSaveItem(container_frame_tree_node_id, url, referrer,
+                              save_source);
+}
+
+void SavePackage::EnqueueFrame(int container_frame_tree_node_id,
+                               int frame_tree_node_id,
+                               const GURL& frame_original_url) {
+  if (!frame_original_url.is_valid())
+    return;
+
+  SaveItem* save_item = FindOrCreatePendingSaveItem(
+      container_frame_tree_node_id, frame_original_url, Referrer(),
+      SaveFileCreateInfo::SAVE_FILE_FROM_DOM);
+  DCHECK(save_item);
+  frame_tree_node_id_to_save_item_[frame_tree_node_id] = save_item;
+}
+
+void SavePackage::OnSavableResourceLinksError(RenderFrameHostImpl* sender) {
   CompleteSavableResourceLinksResponse();
 }
 
@@ -1218,19 +1300,16 @@
   if (number_of_frames_pending_response_ != 0)
     return;  // Need to wait for more responses from RenderFrames.
 
-  // Add frame urls to the waiting_item_queue_.  This is done *after* processing
-  // all savable resource links (i.e. in OnSavableResourceLinksResponse), to
-  // prefer their referrers in cases where the frame url has already been
-  // covered by savable resource links.
-  for (auto& frame_url : frame_urls_to_save_) {
-    DCHECK(frame_url.is_valid());
-    if (0 == unique_urls_to_save_.count(frame_url)) {
-      unique_urls_to_save_.insert(frame_url);
-      SaveItem* save_item = new SaveItem(
-          frame_url, Referrer(), this, SaveFileCreateInfo::SAVE_FILE_FROM_DOM);
-      waiting_item_queue_.push(save_item);
-    }
-  }
+  // Sort |waiting_item_queue_| so that frames go last (frames are identified by
+  // SAVE_FILE_FROM_DOM in the comparison function below).
+  std::stable_sort(
+      waiting_item_queue_.begin(), waiting_item_queue_.end(),
+      [](SaveItem* x, SaveItem* y) {
+        DCHECK(x);
+        DCHECK(y);
+        return (x->save_source() != SaveFileCreateInfo::SAVE_FILE_FROM_DOM) &&
+               (y->save_source() == SaveFileCreateInfo::SAVE_FILE_FROM_DOM);
+      });
 
   all_save_items_count_ = static_cast<int>(waiting_item_queue_.size());
 
diff --git a/content/browser/download/save_package.h b/content/browser/download/save_package.h
index 405f088..4f5eac84 100644
--- a/content/browser/download/save_package.h
+++ b/content/browser/download/save_package.h
@@ -5,7 +5,8 @@
 #ifndef CONTENT_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_
 #define CONTENT_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_
 
-#include <queue>
+#include <deque>
+#include <map>
 #include <set>
 #include <string>
 #include <vector>
@@ -17,6 +18,7 @@
 #include "base/memory/ref_counted.h"
 #include "base/memory/weak_ptr.h"
 #include "base/time/time.h"
+#include "content/browser/download/save_types.h"
 #include "content/common/content_export.h"
 #include "content/public/browser/download_item.h"
 #include "content/public/browser/download_manager_delegate.h"
@@ -31,11 +33,13 @@
 namespace content {
 class DownloadItemImpl;
 class DownloadManagerImpl;
-class WebContents;
+class FrameTreeNode;
+class RenderFrameHostImpl;
+struct SavableSubframe;
 class SaveFileManager;
 class SaveItem;
 class SavePackage;
-struct SaveFileCreateInfo;
+class WebContents;
 
 // The SavePackage object manages the process of saving a page as only-html or
 // complete-html or MHTML and providing the information for displaying saving
@@ -176,42 +180,67 @@
                         bool need_html_ext,
                         base::FilePath::StringType* generated_name);
 
-  // Set of methods to get all savable resource links from current web page,
-  // including main frame and sub-frames.
+  // Main routine that initiates asking all frames for their savable resources,
+  // using GetSavableResourceLinksForFrame to send IPC to individual frames.
+  //
+  // Responses are received asynchronously by OnSavableResourceLinks... methods
+  // and pending responses are counted/tracked by
+  // CompleteSavableResourceLinksResponse.
+  //
+  // OnSavableResourceLinksResponse creates of SaveItems for each savable
+  // resource and each subframe which get enqueued into |waiting_item_queue_|
+  // with the help of FindOrCreatePendingSaveItem, EnqueueSavableResource,
+  // EnqueueFrame.
   void GetSavableResourceLinks();
+
+  // Asks a given frame for its savable resources.
   void GetSavableResourceLinksForFrame(RenderFrameHost* target);
-  void OnSavableResourceLinksResponse(RenderFrameHost* sender,
-                                      const GURL& frame_url,
-                                      const std::vector<GURL>& resources_list,
-                                      const Referrer& referrer);
-  void OnSavableResourceLinksError(RenderFrameHost* sender);
+
+  // Response from |sender| frame to GetSavableResourceLinksForFrame request.
+  void OnSavableResourceLinksResponse(
+      RenderFrameHostImpl* sender,
+      const std::vector<GURL>& resources_list,
+      const Referrer& referrer,
+      const std::vector<SavableSubframe>& subframes);
+
+  // Helper for finding or creating a SaveItem with the given parameters.
+  SaveItem* FindOrCreatePendingSaveItem(
+      int container_frame_tree_node_id,
+      const GURL& url,
+      const Referrer& referrer,
+      SaveFileCreateInfo::SaveFileSource save_source);
+
+  // Helper to enqueue a savable resource reported by
+  // GetSavableResourceLinksForFrame.
+  void EnqueueSavableResource(int container_frame_tree_node_id,
+                              const GURL& url,
+                              const Referrer& referrer);
+  // Helper to enqueue a subframe reported by GetSavableResourceLinksForFrame.
+  void EnqueueFrame(int container_frame_tree_node_id,
+                    int frame_tree_node_id,
+                    const GURL& frame_original_url);
+
+  // Response to GetSavableResourceLinksForFrame that indicates an error
+  // when processing the frame associated with |sender|.
+  void OnSavableResourceLinksError(RenderFrameHostImpl* sender);
+
+  // Helper tracking how many |number_of_frames_pending_response_| we have
+  // left and kicking off the next phase after we got all the
+  // OnSavableResourceLinksResponse messages we were waiting for.
   void CompleteSavableResourceLinksResponse();
 
   // For each frame in the current page, ask the renderer process associated
   // with that frame to serialize that frame into html.
   void GetSerializedHtmlWithLocalLinks();
 
-  // Ask renderer process to serialize |target| frame into html data
-  // with lists which contain all resource links that have a local copy.
-  // - The parameter |saved_links| contains original URLs of all saved links
-  //   (which may include URLs referred to from the whole page (not just from
-  //   the |target| frame).
-  // - The parameter |saved_file_paths| contains corresponding local file paths
-  //   of all saved links, which is matched with |saved_links| vector one by
-  //   one.
-  // - The parameter |relative_dir_name| is relative path of directory which
-  //   contain all saved auxiliary files included all sub frames and resouces.
-  void GetSerializedHtmlWithLocalLinksForFrame(
-      const std::vector<GURL>& saved_links,
-      const std::vector<base::FilePath>& saved_file_paths,
-      const base::FilePath& relative_dir_name,
-      RenderFrameHost* target);
+  // Ask renderer process to serialize |target_tree_node| into html data
+  // with resource links replaced with a link to a locally saved copy.
+  void GetSerializedHtmlWithLocalLinksForFrame(FrameTreeNode* target_tree_node);
 
   // Routes html data (sent by renderer process in response to
   // GetSerializedHtmlWithLocalLinksForFrame above) to the associated local file
   // (and also keeps track of when all frames have been completed).
-  void OnSerializedHtmlWithLocalLinksResponse(RenderFrameHost* sender,
-                                              const GURL& frame_url,
+  void OnSerializedHtmlWithLocalLinksResponse(RenderFrameHostImpl* sender,
                                               const std::string& data,
                                               bool end_of_data);
 
@@ -282,15 +311,29 @@
   static const base::FilePath::CharType* ExtensionForMimeType(
       const std::string& contents_mime_type);
 
-  typedef std::queue<SaveItem*> SaveItemQueue;
+  typedef std::deque<SaveItem*> SaveItemQueue;
   // A queue for items we are about to start saving.
   SaveItemQueue waiting_item_queue_;
 
-  // Used to de-dupe urls that are being gathered into |waiting_item_queue_|.
-  std::set<GURL> unique_urls_to_save_;
+  // Used to de-dupe urls that are being gathered into |waiting_item_queue_|
+  // and also to find SaveItems to associate with a containing frame.
+  // Note that |url_to_save_item_| does NOT own SaveItems - they
+  // remain owned by waiting_item_queue_, in_progress_items_, etc.
+  std::map<GURL, SaveItem*> url_to_save_item_;
 
-  // Temporarily stores urls of savable frames, until we can process them.
-  std::vector<GURL> frame_urls_to_save_;
+  // Map used to route responses from a given a subframe (i.e.
+  // OnSerializedHtmlWithLocalLinksResponse) to the right SaveItem.
+  // Note that |frame_tree_node_id_to_save_item_| does NOT own SaveItems - they
+  // remain owned by waiting_item_queue_, in_progress_items_, etc.
+  base::hash_map<int, SaveItem*> frame_tree_node_id_to_save_item_;
+
+  // Used to limit which local paths get exposed to which frames
+  // (i.e. to prevent information disclosure to oop frames).
+  // Note that |frame_tree_node_id_to_contained_save_items_| does NOT own
+  // SaveItems - they remain owned by waiting_item_queue_, in_progress_items_,
+  // etc.
+  base::hash_map<int, std::vector<SaveItem*>>
+      frame_tree_node_id_to_contained_save_items_;
 
   // Number of frames that we still need to get a response from.
   int number_of_frames_pending_response_;
diff --git a/content/child/BUILD.gn b/content/child/BUILD.gn
index 0d13f5d..687bbd3 100644
--- a/content/child/BUILD.gn
+++ b/content/child/BUILD.gn
@@ -33,6 +33,7 @@
     "//mojo/common",
     "//mojo/environment:chromium",
     "//mojo/message_pump",
+    "//net",
     "//skia",
     "//third_party/icu",
     "//ui/base",
diff --git a/content/common/frame_messages.h b/content/common/frame_messages.h
index 9126ffef..f9f231da 100644
--- a/content/common/frame_messages.h
+++ b/content/common/frame_messages.h
@@ -15,6 +15,7 @@
 #include "content/common/navigation_gesture.h"
 #include "content/common/navigation_params.h"
 #include "content/common/resource_request_body.h"
+#include "content/common/savable_subframe.h"
 #include "content/public/common/color_suggestion.h"
 #include "content/public/common/common_param_traits.h"
 #include "content/public/common/console_message_level.h"
@@ -414,6 +415,11 @@
   IPC_STRUCT_MEMBER(std::string, text_track_text_size)
 IPC_STRUCT_END()
 
+IPC_STRUCT_TRAITS_BEGIN(content::SavableSubframe)
+  IPC_STRUCT_TRAITS_MEMBER(original_url)
+  IPC_STRUCT_TRAITS_MEMBER(routing_id)
+IPC_STRUCT_TRAITS_END()
+
 #if defined(OS_MACOSX) || defined(OS_ANDROID)
 // This message is used for supporting popup menus on Mac OS X and Android using
 // native controls. See the FrameHostMsg_ShowPopup message.
@@ -1202,9 +1208,9 @@
 
 // Response to FrameMsg_GetSavableResourceLinks.
 IPC_MESSAGE_ROUTED3(FrameHostMsg_SavableResourceLinksResponse,
-                    GURL /* frame URL */,
                     std::vector<GURL> /* savable resource links */,
-                    content::Referrer /* referrer for all the links above */)
+                    content::Referrer /* referrer for all the links above */,
+                    std::vector<content::SavableSubframe> /* subframes */);
 
 // Response to FrameMsg_GetSavableResourceLinks in case the frame contains
 // non-savable content (i.e. from a non-savable scheme) or if there were
@@ -1212,8 +1218,7 @@
 IPC_MESSAGE_ROUTED0(FrameHostMsg_SavableResourceLinksError)
 
 // Response to FrameMsg_GetSerializedHtmlWithLocalLinks.
-IPC_MESSAGE_ROUTED3(FrameHostMsg_SerializedHtmlWithLocalLinksResponse,
-                    GURL /* frame URL */,
+IPC_MESSAGE_ROUTED2(FrameHostMsg_SerializedHtmlWithLocalLinksResponse,
                     std::string /* data buffer */,
                     bool /* end of data? */)
 
diff --git a/content/common/savable_subframe.h b/content/common/savable_subframe.h
new file mode 100644
index 0000000..ec7f572
--- /dev/null
+++ b/content/common/savable_subframe.h
@@ -0,0 +1,23 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_COMMON_SAVABLE_SUBFRAME_H_
+#define CONTENT_COMMON_SAVABLE_SUBFRAME_H_
+
+#include "url/gurl.h"
+
+namespace content {
+
+// Information about a subframe being saved as "complete html".
+struct SavableSubframe {
+  // Original url of the subframe (i.e. based the parent's html sources).
+  GURL original_url;
+
+  // Routing ID of the RenderFrame or RenderFrameProxy for the subframe.
+  int routing_id;
+};
+
+}  // namespace content
+
+#endif  // CONTENT_COMMON_SAVABLE_SUBFRAME_H_
diff --git a/content/content_common.gypi b/content/content_common.gypi
index c4afaf2..595ce47 100644
--- a/content/content_common.gypi
+++ b/content/content_common.gypi
@@ -513,6 +513,7 @@
       'common/sandbox_util.h',
       'common/sandbox_win.cc',
       'common/sandbox_win.h',
+      'common/savable_subframe.h',
       'common/savable_url_schemes.cc',
       'common/savable_url_schemes.h',
       'common/screen_orientation_messages.h',
diff --git a/content/content_renderer.gypi b/content/content_renderer.gypi
index 5e0f001..40f26ed6 100644
--- a/content/content_renderer.gypi
+++ b/content/content_renderer.gypi
@@ -458,6 +458,8 @@
       'renderer/webgraphicscontext3d_provider_impl.h',
       'renderer/webpublicsuffixlist_impl.cc',
       'renderer/webpublicsuffixlist_impl.h',
+      'renderer/web_frame_utils.cc',
+      'renderer/web_frame_utils.h',
       'renderer/webscrollbarbehavior_impl_gtkoraura.cc',
       'renderer/webscrollbarbehavior_impl_gtkoraura.h',
       'renderer/webscrollbarbehavior_impl_mac.h',
diff --git a/content/public/android/BUILD.gn b/content/public/android/BUILD.gn
index 5d07f815..31ea238 100644
--- a/content/public/android/BUILD.gn
+++ b/content/public/android/BUILD.gn
@@ -133,23 +133,6 @@
     "//content/public/common/speech_recognition_error.h",
     "//content/public/common/top_controls_state.h",
   ]
-  outputs = [
-    "org/chromium/content/browser/ConsumerType.java",
-    "org/chromium/content/browser/GestureEventType.java",
-    "org/chromium/content/browser/OrientationSensorType.java",
-    "org/chromium/content/browser/input/CanonicalAxisIndex.java",
-    "org/chromium/content/browser/input/CanonicalButtonIndex.java",
-    "org/chromium/content/browser/input/PopupItemType.java",
-    "org/chromium/content_public/browser/InvalidateTypes.java",
-    "org/chromium/content_public/browser/navigation_controller/LoadURLType.java",
-    "org/chromium/content_public/browser/navigation_controller/UserAgentOverrideOption.java",
-    "org/chromium/content_public/browser/readback_types/ReadbackResponse.java",
-    "org/chromium/content_public/common/ConsoleMessageLevel.java",
-    "org/chromium/content_public/common/ResultCode.java",
-    "org/chromium/content_public/common/ScreenOrientationValues.java",
-    "org/chromium/content_public/common/SpeechRecognitionErrorCode.java",
-    "org/chromium/content_public/common/TopControlsState.java",
-  ]
 }
 
 generate_jar_jni("jar_jni") {
diff --git a/content/renderer/dom_serializer_browsertest.cc b/content/renderer/dom_serializer_browsertest.cc
index 734866e..a53c705d 100644
--- a/content/renderer/dom_serializer_browsertest.cc
+++ b/content/renderer/dom_serializer_browsertest.cc
@@ -159,7 +159,8 @@
                            public WebPageSerializerClient {
  public:
   DomSerializerTests()
-      : local_directory_name_(FILE_PATH_LITERAL("./dummy_files/")) {}
+      : serialization_reported_end_of_data_(false),
+        local_directory_name_(FILE_PATH_LITERAL("./dummy_files/")) {}
 
   void SetUpCommandLine(base::CommandLine* command_line) override {
     command_line->AppendSwitch(switches::kSingleProcess);
@@ -175,39 +176,17 @@
   }
 
   // DomSerializerDelegate.
-  void didSerializeDataForFrame(const WebURL& frame_web_url,
-                                const WebCString& data,
+  void didSerializeDataForFrame(const WebCString& data,
                                 PageSerializationStatus status) override {
-    GURL frame_url(frame_web_url);
-
     // Check finish status of current frame.
-    SerializationFinishStatusMap::iterator it =
-        serialization_finish_status_.find(frame_url.spec());
-    // New frame, set initial status as false.
-    if (it == serialization_finish_status_.end())
-      serialization_finish_status_[frame_url.spec()] = false;
-
-    it = serialization_finish_status_.find(frame_url.spec());
-    ASSERT_TRUE(it != serialization_finish_status_.end());
-    // In process frame, finish status should be false.
-    ASSERT_FALSE(it->second);
+    ASSERT_FALSE(serialization_reported_end_of_data_);
 
     // Add data to corresponding frame's content.
-    serialized_frame_map_[frame_url.spec()] += data;
+    serialized_contents_ += data;
 
     // Current frame is completed saving, change the finish status.
     if (status == WebPageSerializerClient::CurrentFrameIsFinished)
-      it->second = true;
-  }
-
-  bool HasSerializedFrame(const GURL& frame_url) {
-    return serialized_frame_map_.find(frame_url.spec()) !=
-           serialized_frame_map_.end();
-  }
-
-  const std::string& GetSerializedContentForFrame(
-      const GURL& frame_url) {
-    return serialized_frame_map_[frame_url.spec()];
+      serialization_reported_end_of_data_ = true;
   }
 
   RenderView* GetRenderView() {
@@ -278,10 +257,8 @@
     // Do serialization.
     SerializeDomForURL(file_url);
     // Load the serialized contents.
-    ASSERT_TRUE(HasSerializedFrame(file_url));
-    const std::string& serialized_contents =
-        GetSerializedContentForFrame(file_url);
-    LoadContents(serialized_contents, file_url,
+    ASSERT_TRUE(serialization_reported_end_of_data_);
+    LoadContents(serialized_contents_, file_url,
                  web_frame->document().encoding());
     // Make sure serialized contents still have document type.
     web_frame = GetMainFrame();
@@ -298,10 +275,8 @@
     // Do serialization.
     SerializeDomForURL(file_url);
     // Load the serialized contents.
-    ASSERT_TRUE(HasSerializedFrame(file_url));
-    const std::string& serialized_contents =
-        GetSerializedContentForFrame(file_url);
-    LoadContents(serialized_contents, file_url,
+    ASSERT_TRUE(serialization_reported_end_of_data_);
+    LoadContents(serialized_contents_, file_url,
                  web_frame->document().encoding());
     // Make sure serialized contents do not have document type.
     web_frame = GetMainFrame();
@@ -314,10 +289,8 @@
     // Do serialization.
     SerializeDomForURL(xml_file_url);
     // Compare the serialized contents with original contents.
-    ASSERT_TRUE(HasSerializedFrame(xml_file_url));
-    const std::string& serialized_contents =
-        GetSerializedContentForFrame(xml_file_url);
-    ASSERT_EQ(original_contents, serialized_contents);
+    ASSERT_TRUE(serialization_reported_end_of_data_);
+    ASSERT_EQ(original_contents, serialized_contents_);
   }
 
   void SerializeHTMLDOMWithAddingMOTWOnRenderer(
@@ -333,11 +306,9 @@
     // Do serialization.
     SerializeDomForURL(file_url);
     // Make sure the serialized contents have MOTW ;
-    ASSERT_TRUE(HasSerializedFrame(file_url));
-    const std::string& serialized_contents =
-        GetSerializedContentForFrame(file_url);
+    ASSERT_TRUE(serialization_reported_end_of_data_);
     ASSERT_FALSE(std::string::npos ==
-        serialized_contents.find(motw_declaration));
+                 serialized_contents_.find(motw_declaration));
   }
 
   void SerializeHTMLDOMWithNoMetaCharsetInOriginalDocOnRenderer(
@@ -360,10 +331,8 @@
     SerializeDomForURL(file_url);
 
     // Load the serialized contents.
-    ASSERT_TRUE(HasSerializedFrame(file_url));
-    const std::string& serialized_contents =
-        GetSerializedContentForFrame(file_url);
-    LoadContents(serialized_contents, file_url,
+    ASSERT_TRUE(serialization_reported_end_of_data_);
+    LoadContents(serialized_contents_, file_url,
                  web_frame->document().encoding());
     // Make sure the first child of HEAD element is META which has charset
     // declaration in serialized contents.
@@ -416,10 +385,8 @@
     SerializeDomForURL(file_url);
 
     // Load the serialized contents.
-    ASSERT_TRUE(HasSerializedFrame(file_url));
-    const std::string& serialized_contents =
-        GetSerializedContentForFrame(file_url);
-    LoadContents(serialized_contents, file_url,
+    ASSERT_TRUE(serialization_reported_end_of_data_);
+    LoadContents(serialized_contents_, file_url,
                  web_frame->document().encoding());
     // Make sure only first child of HEAD element is META which has charset
     // declaration in serialized contents.
@@ -473,9 +440,7 @@
     // Do serialization.
     SerializeDomForURL(file_url);
     // Compare the serialized contents with original contents.
-    ASSERT_TRUE(HasSerializedFrame(file_url));
-    const std::string& serialized_contents =
-        GetSerializedContentForFrame(file_url);
+    ASSERT_TRUE(serialization_reported_end_of_data_);
     // Compare the serialized contents with original contents to make sure
     // they are same.
     // Because we add MOTW when serializing DOM, so before comparison, we also
@@ -499,7 +464,7 @@
       head_part += "</head>";
       original_str.insert(pos, head_part);
     }
-    ASSERT_EQ(original_str, serialized_contents);
+    ASSERT_EQ(original_str, serialized_contents_);
   }
 
   void SerializeHTMLDOMWithEntitiesInAttributeValueOnRenderer() {
@@ -526,9 +491,7 @@
     // Do serialization.
     SerializeDomForURL(file_url);
     // Compare the serialized contents with original contents.
-    ASSERT_TRUE(HasSerializedFrame(file_url));
-    const std::string& serialized_contents =
-        GetSerializedContentForFrame(file_url);
+    ASSERT_TRUE(serialization_reported_end_of_data_);
     // Compare the serialized contents with original contents to make sure
     // they are same.
     std::string original_str =
@@ -546,7 +509,7 @@
       head_part += "</head>";
       original_str.insert(pos, head_part);
     }
-    ASSERT_EQ(original_str, serialized_contents);
+    ASSERT_EQ(original_str, serialized_contents_);
   }
 
   void SerializeHTMLDOMWithNonStandardEntitiesOnRenderer(const GURL& file_url) {
@@ -567,14 +530,12 @@
     // Do serialization.
     SerializeDomForURL(file_url);
     // Check the serialized string.
-    ASSERT_TRUE(HasSerializedFrame(file_url));
-    const std::string& serialized_contents =
-        GetSerializedContentForFrame(file_url);
+    ASSERT_TRUE(serialization_reported_end_of_data_);
     // Confirm that the serialized string has no non-standard HTML entities.
-    ASSERT_EQ(std::string::npos, serialized_contents.find("&percnt;"));
-    ASSERT_EQ(std::string::npos, serialized_contents.find("&nsup;"));
-    ASSERT_EQ(std::string::npos, serialized_contents.find("&sup1;"));
-    ASSERT_EQ(std::string::npos, serialized_contents.find("&apos;"));
+    ASSERT_EQ(std::string::npos, serialized_contents_.find("&percnt;"));
+    ASSERT_EQ(std::string::npos, serialized_contents_.find("&nsup;"));
+    ASSERT_EQ(std::string::npos, serialized_contents_.find("&sup1;"));
+    ASSERT_EQ(std::string::npos, serialized_contents_.find("&apos;"));
   }
 
   void SerializeHTMLDOMWithBaseTagOnRenderer(const GURL& file_url,
@@ -621,10 +582,8 @@
     SerializeDomForURL(file_url);
 
     // Load the serialized contents.
-    ASSERT_TRUE(HasSerializedFrame(file_url));
-    const std::string& serialized_contents =
-        GetSerializedContentForFrame(file_url);
-    LoadContents(serialized_contents, file_url,
+    ASSERT_TRUE(serialization_reported_end_of_data_);
+    LoadContents(serialized_contents_, file_url,
                  web_frame->document().encoding());
 
     // Make sure all links are absolute URLs and doc there are some number of
@@ -689,13 +648,10 @@
 
     // Do serialization.
     SerializeDomForURL(file_url);
-    // Make sure the serialized contents have META ;
-    ASSERT_TRUE(HasSerializedFrame(file_url));
-    const std::string& serialized_contents =
-        GetSerializedContentForFrame(file_url);
+    ASSERT_TRUE(serialization_reported_end_of_data_);
 
     // Reload serialized contents and make sure there is only one META tag.
-    LoadContents(serialized_contents, file_url,
+    LoadContents(serialized_contents_, file_url,
                  web_frame->document().encoding());
     web_frame = GetMainFrame();
     ASSERT_TRUE(web_frame != NULL);
@@ -738,12 +694,8 @@
 
  private:
   int32 render_view_routing_id_;
-  // Map frame_url to corresponding serialized_content.
-  typedef base::hash_map<std::string, std::string> SerializedFrameContentMap;
-  SerializedFrameContentMap serialized_frame_map_;
-  // Map frame_url to corresponding status of serialization finish.
-  typedef base::hash_map<std::string, bool> SerializationFinishStatusMap;
-  SerializationFinishStatusMap serialization_finish_status_;
+  std::string serialized_contents_;
+  bool serialization_reported_end_of_data_;
   // The local_directory_name_ is dummy relative path of directory which
   // contain all saved auxiliary files included all sub frames and resources.
   const base::FilePath local_directory_name_;
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index c000e4b1..e797e44 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -41,6 +41,7 @@
 #include "content/common/frame_replication_state.h"
 #include "content/common/input_messages.h"
 #include "content/common/navigation_params.h"
+#include "content/common/savable_subframe.h"
 #include "content/common/service_worker/service_worker_types.h"
 #include "content/common/site_isolation_policy.h"
 #include "content/common/swapped_out_messages.h"
@@ -109,6 +110,7 @@
 #include "content/renderer/skia_benchmarking_extension.h"
 #include "content/renderer/stats_collection_controller.h"
 #include "content/renderer/wake_lock/wake_lock_dispatcher.h"
+#include "content/renderer/web_frame_utils.h"
 #include "content/renderer/web_ui_extension.h"
 #include "content/renderer/websharedworker_proxy.h"
 #include "gin/modules/module_registry.h"
@@ -527,16 +529,6 @@
          navigation_type == FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL;
 }
 
-// Returns the routing ID of the RenderFrameImpl or RenderFrameProxy
-// associated with |web_frame|.
-int GetRoutingIdForFrameOrProxy(WebFrame* web_frame) {
-  if (!web_frame)
-    return MSG_ROUTING_NONE;
-  if (web_frame->isWebRemoteFrame())
-    return RenderFrameProxy::FromWebFrame(web_frame)->routing_id();
-  return RenderFrameImpl::FromWebFrame(web_frame)->GetRoutingID();
-}
-
 RenderFrameImpl::CreateRenderFrameImplFunction g_create_render_frame_impl =
     nullptr;
 
@@ -4004,12 +3996,11 @@
 }
 
 void RenderFrameImpl::didSerializeDataForFrame(
-    const WebURL& frame_url,
     const WebCString& data,
     WebPageSerializerClient::PageSerializationStatus status) {
   bool end_of_data = status == WebPageSerializerClient::CurrentFrameIsFinished;
   Send(new FrameHostMsg_SerializedHtmlWithLocalLinksResponse(
-      routing_id_, frame_url, data, end_of_data));
+      routing_id_, data, end_of_data));
 }
 
 void RenderFrameImpl::AddObserver(RenderFrameObserver* observer) {
@@ -4566,7 +4557,8 @@
 
 void RenderFrameImpl::OnGetSavableResourceLinks() {
   std::vector<GURL> resources_list;
-  SavableResourcesResult result(&resources_list);
+  std::vector<SavableSubframe> subframes;
+  SavableResourcesResult result(&resources_list, &subframes);
 
   if (!GetSavableResourceLinksForFrame(
           frame_, &result, const_cast<const char**>(GetSavableSchemes()))) {
@@ -4578,7 +4570,7 @@
       Referrer(frame_->document().url(), frame_->document().referrerPolicy());
 
   Send(new FrameHostMsg_SavableResourceLinksResponse(
-      routing_id_, frame_->document().url(), resources_list, referrer));
+      routing_id_, resources_list, referrer, subframes));
 }
 
 void RenderFrameImpl::OnGetSerializedHtmlWithLocalLinks(
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h
index b9feffa5..7d8ee49 100644
--- a/content/renderer/render_frame_impl.h
+++ b/content/renderer/render_frame_impl.h
@@ -596,7 +596,6 @@
 
   // WebPageSerializerClient implementation:
   void didSerializeDataForFrame(
-      const blink::WebURL& frame_url,
       const blink::WebCString& data,
       blink::WebPageSerializerClient::PageSerializationStatus status) override;
 
diff --git a/content/renderer/savable_resources.cc b/content/renderer/savable_resources.cc
index 40fafd8e..d2d28f96 100644
--- a/content/renderer/savable_resources.cc
+++ b/content/renderer/savable_resources.cc
@@ -9,6 +9,7 @@
 #include "base/compiler_specific.h"
 #include "base/logging.h"
 #include "base/strings/string_util.h"
+#include "content/renderer/web_frame_utils.h"
 #include "third_party/WebKit/public/platform/WebString.h"
 #include "third_party/WebKit/public/platform/WebVector.h"
 #include "third_party/WebKit/public/web/WebDocument.h"
@@ -42,9 +43,17 @@
     const WebElement& element,
     const WebDocument& current_doc,
     SavableResourcesResult* result) {
-  // Skipping frame and iframe tag.
-  if (element.hasHTMLTagName("iframe") || element.hasHTMLTagName("frame"))
+  if (element.hasHTMLTagName("iframe") || element.hasHTMLTagName("frame")) {
+    GURL complete_url = current_doc.completeURL(element.getAttribute("src"));
+    WebFrame* web_frame = WebFrame::fromFrameOwnerElement(element);
+
+    SavableSubframe subframe;
+    subframe.original_url = complete_url;
+    subframe.routing_id = GetRoutingIdForFrameOrProxy(web_frame);
+
+    result->subframes->push_back(subframe);
     return;
+  }
 
   // Check whether the node has sub resource URL or not.
   WebString value = GetSubResourceLinkFromElement(element);
diff --git a/content/renderer/savable_resources.h b/content/renderer/savable_resources.h
index bdf434fc..eb989609 100644
--- a/content/renderer/savable_resources.h
+++ b/content/renderer/savable_resources.h
@@ -9,6 +9,7 @@
 #include <vector>
 
 #include "content/common/content_export.h"
+#include "content/common/savable_subframe.h"
 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h"
 #include "url/gurl.h"
 
@@ -27,12 +28,18 @@
 // for keeping these pointers valid for the lifetime of the
 // SavableResourcesResult instance.
 struct SavableResourcesResult {
-  // vector which contains all savable links of sub resource.
+  // Links of all savable resources.
   std::vector<GURL>* resources_list;
 
+  // Subframes.
+  std::vector<SavableSubframe>* subframes;
+
   // Constructor.
-  SavableResourcesResult(std::vector<GURL>* resources_list)
-      : resources_list(resources_list) {}
+  SavableResourcesResult(
+      std::vector<GURL>* resources_list,
+      std::vector<SavableSubframe>* subframes)
+      : resources_list(resources_list),
+        subframes(subframes) {}
 
  private:
   DISALLOW_COPY_AND_ASSIGN(SavableResourcesResult);
diff --git a/content/renderer/savable_resources_browsertest.cc b/content/renderer/savable_resources_browsertest.cc
index ccbc6fe..dfccd8d 100644
--- a/content/renderer/savable_resources_browsertest.cc
+++ b/content/renderer/savable_resources_browsertest.cc
@@ -16,6 +16,7 @@
 #include "net/base/filename_util.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/WebKit/public/web/WebFrame.h"
 #include "third_party/WebKit/public/web/WebLocalFrame.h"
 
 namespace content {
@@ -37,7 +38,8 @@
   // matches expected_resources_set.
   void GetSavableResourceLinksForPage(
       const base::FilePath& page_file_path,
-      const UrlVectorMatcher& expected_resources_matcher) {
+      const UrlVectorMatcher& expected_resources_matcher,
+      const UrlVectorMatcher& expected_subframe_urls_matcher) {
     // Convert local file path to file URL.
     GURL file_url = net::FilePathToFileURL(page_file_path);
     // Load the test file.
@@ -45,17 +47,20 @@
 
     PostTaskToInProcessRendererAndWait(base::Bind(
         &SavableResourcesTest::CheckResources, base::Unretained(this),
-        page_file_path, expected_resources_matcher, file_url,
+        page_file_path, expected_resources_matcher,
+        expected_subframe_urls_matcher, file_url,
         shell()->web_contents()->GetMainFrame()->GetRoutingID()));
   }
 
   void CheckResources(const base::FilePath& page_file_path,
                       const UrlVectorMatcher& expected_resources_matcher,
+                      const UrlVectorMatcher& expected_subframe_urls_matcher,
                       const GURL& file_url,
                       int render_frame_routing_id) {
     // Get all savable resource links for the page.
     std::vector<GURL> resources_list;
-    SavableResourcesResult result(&resources_list);
+    std::vector<SavableSubframe> subframes;
+    SavableResourcesResult result(&resources_list, &subframes);
 
     const char* savable_schemes[] = {
       "http",
@@ -72,6 +77,12 @@
         &result, savable_schemes));
 
     EXPECT_THAT(resources_list, expected_resources_matcher);
+
+    std::vector<GURL> subframe_original_urls;
+    for (const SavableSubframe& subframe : subframes) {
+      subframe_original_urls.push_back(subframe.original_url);
+    }
+    EXPECT_THAT(subframe_original_urls, expected_subframe_urls_matcher);
   }
 };
 
@@ -83,7 +94,10 @@
   auto expected_subresources_matcher = testing::UnorderedElementsAre(
       net::FilePathToFileURL(GetTestFilePath("dom_serializer", "style.css")));
 
-  GetSavableResourceLinksForPage(page_file_path, expected_subresources_matcher);
+  auto expected_subframe_urls_matcher = testing::IsEmpty();
+
+  GetSavableResourceLinksForPage(page_file_path, expected_subresources_matcher,
+                                 expected_subframe_urls_matcher);
 }
 
 // Test function GetAllSavableResourceLinksForCurrentPage with a web page
@@ -98,7 +112,12 @@
       GURL("file:///c:/yt/js/base_all_with_bidi-vfl36451.js"),
       GURL("file:///c:/yt/img/pixel-vfl73.gif"));
 
-  GetSavableResourceLinksForPage(page_file_path, expected_subresources_matcher);
+  auto expected_subframe_urls_matcher =
+      testing::UnorderedElementsAre(net::FilePathToFileURL(
+          GetTestFilePath("dom_serializer", "youtube_2.htm")));
+
+  GetSavableResourceLinksForPage(page_file_path, expected_subresources_matcher,
+                                 expected_subframe_urls_matcher);
 }
 
 // Test function GetAllSavableResourceLinksForCurrentPage with a web page
@@ -109,7 +128,11 @@
       GetTestFilePath("dom_serializer", "youtube_2.htm");
 
   auto expected_subresources_matcher = testing::IsEmpty();
-  GetSavableResourceLinksForPage(page_file_path, expected_subresources_matcher);
+
+  auto expected_subframe_urls_matcher = testing::IsEmpty();
+
+  GetSavableResourceLinksForPage(page_file_path, expected_subresources_matcher,
+                                 expected_subframe_urls_matcher);
 }
 
 }  // namespace content
diff --git a/content/renderer/web_frame_utils.cc b/content/renderer/web_frame_utils.cc
new file mode 100644
index 0000000..6cc52aac
--- /dev/null
+++ b/content/renderer/web_frame_utils.cc
@@ -0,0 +1,22 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/renderer/web_frame_utils.h"
+
+#include "content/renderer/render_frame_impl.h"
+#include "content/renderer/render_frame_proxy.h"
+#include "ipc/ipc_message.h"
+#include "third_party/WebKit/public/web/WebFrame.h"
+
+namespace content {
+
+int GetRoutingIdForFrameOrProxy(blink::WebFrame* web_frame) {
+  if (!web_frame)
+    return MSG_ROUTING_NONE;
+  if (web_frame->isWebRemoteFrame())
+    return RenderFrameProxy::FromWebFrame(web_frame)->routing_id();
+  return RenderFrameImpl::FromWebFrame(web_frame)->GetRoutingID();
+}
+
+}  // namespace content
diff --git a/content/renderer/web_frame_utils.h b/content/renderer/web_frame_utils.h
new file mode 100644
index 0000000..73d188a
--- /dev/null
+++ b/content/renderer/web_frame_utils.h
@@ -0,0 +1,20 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_RENDERER_WEB_FRAME_UTILS_H_
+#define CONTENT_RENDERER_WEB_FRAME_UTILS_H_
+
+namespace blink {
+class WebFrame;
+}
+
+namespace content {
+
+// Returns the routing ID of the RenderFrameImpl or RenderFrameProxy
+// associated with |web_frame|.
+int GetRoutingIdForFrameOrProxy(blink::WebFrame* web_frame);
+
+}  // namespace content
+
+#endif  // CONTENT_RENDERER_WEB_FRAME_UTILS_H_
diff --git a/content/test/data/accessibility/aria/aria-button-expected-android.txt b/content/test/data/accessibility/aria/aria-button-expected-android.txt
index 57ba5d9..ce9252f 100644
--- a/content/test/data/accessibility/aria/aria-button-expected-android.txt
+++ b/content/test/data/accessibility/aria/aria-button-expected-android.txt
@@ -1,6 +1,6 @@
 android.webkit.WebView focusable focused scrollable
-++android.widget.Button clickable focusable
-++android.widget.ToggleButton checkable checked clickable focusable
-++android.widget.ToggleButton checkable clickable focusable
-++android.widget.Spinner clickable focusable
-++android.widget.Button clickable focusable
\ No newline at end of file
+++android.widget.Button clickable focusable name='Button1'
+++android.widget.ToggleButton checkable checked clickable focusable name='Button2'
+++android.widget.ToggleButton checkable clickable focusable name='Button3'
+++android.widget.Spinner clickable focusable name='Button4'
+++android.widget.Button clickable focusable name='Button5'
diff --git a/content/test/data/accessibility/aria/aria-button-expected-mac.txt b/content/test/data/accessibility/aria/aria-button-expected-mac.txt
index 8a34f76..939e653 100644
--- a/content/test/data/accessibility/aria/aria-button-expected-mac.txt
+++ b/content/test/data/accessibility/aria/aria-button-expected-mac.txt
@@ -1,6 +1,6 @@
 AXWebArea AXRoleDescription='HTML content'
-++AXButton AXRoleDescription='button'
-++AXCheckBox AXSubrole=AXToggleButton AXRoleDescription='toggle button' AXValue='1'
-++AXCheckBox AXSubrole=AXToggleButton AXRoleDescription='toggle button' AXValue='0'
-++AXPopUpButton AXRoleDescription='pop up button'
-++AXButton AXRoleDescription='button'
+++AXButton AXRoleDescription='button' AXTitle='Button1'
+++AXCheckBox AXSubrole=AXToggleButton AXRoleDescription='toggle button' AXTitle='Button2' AXValue='1'
+++AXCheckBox AXSubrole=AXToggleButton AXRoleDescription='toggle button' AXTitle='Button3' AXValue='0'
+++AXPopUpButton AXRoleDescription='pop up button' AXTitle='Button4'
+++AXButton AXRoleDescription='button' AXTitle='Button5'
diff --git a/content/test/data/accessibility/aria/aria-button-expected-win.txt b/content/test/data/accessibility/aria/aria-button-expected-win.txt
index d2bbe1c..f4aa415 100644
--- a/content/test/data/accessibility/aria/aria-button-expected-win.txt
+++ b/content/test/data/accessibility/aria/aria-button-expected-win.txt
@@ -1,6 +1,6 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
-++ROLE_SYSTEM_PUSHBUTTON FOCUSABLE xml-roles:button
-++IA2_ROLE_TOGGLE_BUTTON PRESSED FOCUSABLE xml-roles:button checkable:true
-++IA2_ROLE_TOGGLE_BUTTON FOCUSABLE xml-roles:button checkable:true
-++ROLE_SYSTEM_BUTTONMENU FOCUSABLE HASPOPUP xml-roles:button
-++ROLE_SYSTEM_PUSHBUTTON FOCUSABLE xml-roles:button
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0><obj1><obj2><obj3><obj4>'
+++ROLE_SYSTEM_PUSHBUTTON name='Button1' FOCUSABLE xml-roles:button ia2_hypertext='Button1'
+++IA2_ROLE_TOGGLE_BUTTON name='Button2' PRESSED FOCUSABLE xml-roles:button checkable:true ia2_hypertext='Button2'
+++IA2_ROLE_TOGGLE_BUTTON name='Button3' FOCUSABLE xml-roles:button checkable:true ia2_hypertext='Button3'
+++ROLE_SYSTEM_BUTTONMENU name='Button4' FOCUSABLE HASPOPUP xml-roles:button ia2_hypertext='Button4'
+++ROLE_SYSTEM_PUSHBUTTON name='Button5' FOCUSABLE xml-roles:button ia2_hypertext='Button5'
diff --git a/content/test/data/accessibility/aria/aria-button.html b/content/test/data/accessibility/aria/aria-button.html
index cd40c4e..8e81db8 100644
--- a/content/test/data/accessibility/aria/aria-button.html
+++ b/content/test/data/accessibility/aria/aria-button.html
@@ -1,18 +1,19 @@
 <!--
 @MAC-ALLOW:AXRole*
 @MAC-ALLOW:AXSubrole*
-@WIN-ALLOW:xml-roles:*
 @WIN-ALLOW:checkable*
 @WIN-ALLOW:HASPOPUP
+@WIN-ALLOW:ia2_hypertext=*
 @WIN-ALLOW:PRESSED
+@WIN-ALLOW:xml-roles:*
 -->
 <!DOCTYPE html>
 <html>
 <body>
-  <div tabindex=0 role="button"></div>
-  <div tabindex=1 role="button" aria-pressed="true"></div>
-  <div tabindex=2 role="button" aria-pressed="false"></div>
-  <div tabindex=3 role="button" aria-haspopup="true"></div>
-  <div tabindex=4 role="button" aria-haspopup="false"></div>
+  <div tabindex=0 role="button">Button1</div>
+  <div tabindex=1 role="button" aria-pressed="true">Button2</div>
+  <div tabindex=2 role="button" aria-pressed="false">Button3</div>
+  <div tabindex=3 role="button" aria-haspopup="true">Button4</div>
+  <div tabindex=4 role="button" aria-haspopup="false">Button5</div>
 </body>
 </html>
diff --git a/content/test/data/accessibility/aria/aria-checkbox-expected-android.txt b/content/test/data/accessibility/aria/aria-checkbox-expected-android.txt
index 3de6909..2ff69b7 100644
--- a/content/test/data/accessibility/aria/aria-checkbox-expected-android.txt
+++ b/content/test/data/accessibility/aria/aria-checkbox-expected-android.txt
@@ -1,5 +1,5 @@
 android.webkit.WebView focusable focused scrollable
-++android.widget.CheckBox checkable checked clickable focusable
-++android.widget.CheckBox checkable clickable focusable
-++android.widget.CheckBox checkable clickable focusable
-++android.widget.CheckBox checkable clickable focusable
\ No newline at end of file
+++android.widget.CheckBox checkable checked clickable focusable name='CheckBox1'
+++android.widget.CheckBox checkable clickable focusable name='CheckBox2'
+++android.widget.CheckBox checkable clickable focusable name='CheckBox3'
+++android.widget.CheckBox checkable clickable focusable name='CheckBox4'
diff --git a/content/test/data/accessibility/aria/aria-checkbox-expected-mac.txt b/content/test/data/accessibility/aria/aria-checkbox-expected-mac.txt
index 768c6ce..5b85c6a 100644
--- a/content/test/data/accessibility/aria/aria-checkbox-expected-mac.txt
+++ b/content/test/data/accessibility/aria/aria-checkbox-expected-mac.txt
@@ -1,5 +1,5 @@
 AXWebArea AXRoleDescription='HTML content'
-++AXCheckBox AXRoleDescription='checkbox' AXValue='1'
-++AXCheckBox AXRoleDescription='checkbox' AXValue='0'
-++AXCheckBox AXRoleDescription='checkbox' AXValue='2'
-++AXCheckBox AXRoleDescription='checkbox' AXValue='0'
+++AXCheckBox AXRoleDescription='checkbox' AXTitle='CheckBox1' AXValue='1'
+++AXCheckBox AXRoleDescription='checkbox' AXTitle='CheckBox2' AXValue='0'
+++AXCheckBox AXRoleDescription='checkbox' AXTitle='CheckBox3' AXValue='2'
+++AXCheckBox AXRoleDescription='checkbox' AXTitle='CheckBox4' AXValue='0'
diff --git a/content/test/data/accessibility/aria/aria-checkbox-expected-win.txt b/content/test/data/accessibility/aria/aria-checkbox-expected-win.txt
index 26103ccd..8a34bc1 100644
--- a/content/test/data/accessibility/aria/aria-checkbox-expected-win.txt
+++ b/content/test/data/accessibility/aria/aria-checkbox-expected-win.txt
@@ -1,5 +1,5 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
-++ROLE_SYSTEM_CHECKBUTTON CHECKED FOCUSABLE IA2_STATE_CHECKABLE xml-roles:checkbox checkable:true
-++ROLE_SYSTEM_CHECKBUTTON FOCUSABLE IA2_STATE_CHECKABLE xml-roles:checkbox checkable:true
-++ROLE_SYSTEM_CHECKBUTTON MIXED FOCUSABLE IA2_STATE_CHECKABLE xml-roles:checkbox checkable:true
-++ROLE_SYSTEM_CHECKBUTTON FOCUSABLE IA2_STATE_CHECKABLE xml-roles:checkbox checkable:true
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0><obj1><obj2><obj3>'
+++ROLE_SYSTEM_CHECKBUTTON name='CheckBox1' CHECKED FOCUSABLE IA2_STATE_CHECKABLE xml-roles:checkbox checkable:true ia2_hypertext='CheckBox1'
+++ROLE_SYSTEM_CHECKBUTTON name='CheckBox2' FOCUSABLE IA2_STATE_CHECKABLE xml-roles:checkbox checkable:true ia2_hypertext='CheckBox2'
+++ROLE_SYSTEM_CHECKBUTTON name='CheckBox3' MIXED FOCUSABLE IA2_STATE_CHECKABLE xml-roles:checkbox checkable:true ia2_hypertext='CheckBox3'
+++ROLE_SYSTEM_CHECKBUTTON name='CheckBox4' FOCUSABLE IA2_STATE_CHECKABLE xml-roles:checkbox checkable:true ia2_hypertext='CheckBox4'
diff --git a/content/test/data/accessibility/aria/aria-checkbox.html b/content/test/data/accessibility/aria/aria-checkbox.html
index 13552cc..99f05f0 100644
--- a/content/test/data/accessibility/aria/aria-checkbox.html
+++ b/content/test/data/accessibility/aria/aria-checkbox.html
@@ -1,16 +1,17 @@
 <!--
 @MAC-ALLOW:AXRole*
-@WIN-ALLOW:IA2_STATE_*
-@WIN-ALLOW:xml-roles:*
 @WIN-ALLOW:checkable:*
 @WIN-ALLOW:CHECKED*
+@WIN-ALLOW:ia2_hypertext=*
+@WIN-ALLOW:IA2_STATE_*
 @WIN-ALLOW:MIXED*
+@WIN-ALLOW:xml-roles:*
 -->
 <html>
 <body>
-  <div role="checkbox" tabindex=0 aria-checked="true"></div>
-  <div role="checkbox" tabindex=1 aria-checked="false"></div>
-  <div role="checkbox" tabindex=2 aria-checked="mixed"></div>
-  <div role="checkbox" tabindex=3 aria-checked="undefined"></div>
+  <div role="checkbox" tabindex=0 aria-checked="true">CheckBox1</div>
+  <div role="checkbox" tabindex=1 aria-checked="false">CheckBox2</div>
+  <div role="checkbox" tabindex=2 aria-checked="mixed">CheckBox3</div>
+  <div role="checkbox" tabindex=3 aria-checked="undefined">CheckBox4</div>
 </body>
 </html>
diff --git a/content/test/data/accessibility/aria/aria-combobox.html b/content/test/data/accessibility/aria/aria-combobox.html
index b4da1b7..569d0ef 100644
--- a/content/test/data/accessibility/aria/aria-combobox.html
+++ b/content/test/data/accessibility/aria/aria-combobox.html
@@ -1,8 +1,9 @@
 <!--
-@WIN-DENY:description*
 @MAC-ALLOW:AXFocused='1'
 @MAC-ALLOW:AXLinkedUIElements*
 @MAC-ALLOW:AXTitleUIElement*
+@WIN-DENY:description*
+@WIN-ALLOW:ia2_hypertext=*
 -->
 <html>
   <body>
diff --git a/content/test/data/accessibility/aria/aria-listbox-aria-selected.html b/content/test/data/accessibility/aria/aria-listbox-aria-selected.html
index 50c8037..9fa3c55 100644
--- a/content/test/data/accessibility/aria/aria-listbox-aria-selected.html
+++ b/content/test/data/accessibility/aria/aria-listbox-aria-selected.html
@@ -3,6 +3,7 @@
 @MAC-ALLOW:AXOrientation*
 @MAC-ALLOW:AXSelectedChildren*
 @MAC-ALLOW:AXVisibleChildren*
+@WIN-ALLOW:ia2_hypertext=*
 -->
 <html>
 <body>
diff --git a/content/test/data/accessibility/aria/aria-listbox-expected-win.txt b/content/test/data/accessibility/aria/aria-listbox-expected-win.txt
index f55c86e..2794a76 100644
--- a/content/test/data/accessibility/aria/aria-listbox-expected-win.txt
+++ b/content/test/data/accessibility/aria/aria-listbox-expected-win.txt
@@ -1,4 +1,4 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
-++ROLE_SYSTEM_LIST xml-roles:listbox
-++++ROLE_SYSTEM_LISTITEM name='Item 1' FOCUSABLE xml-roles:option
-++++ROLE_SYSTEM_LISTITEM name='Item 2' FOCUSABLE xml-roles:option
\ No newline at end of file
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>'
+++ROLE_SYSTEM_LIST xml-roles:listbox ia2_hypertext='<obj0><obj1>'
+++++ROLE_SYSTEM_LISTITEM name='Item 1' FOCUSABLE xml-roles:option ia2_hypertext='Item 1'
+++++ROLE_SYSTEM_LISTITEM name='Item 2' FOCUSABLE xml-roles:option ia2_hypertext='Item 2'
diff --git a/content/test/data/accessibility/aria/aria-listbox.html b/content/test/data/accessibility/aria/aria-listbox.html
index ad073aa..ecaa9b557 100644
--- a/content/test/data/accessibility/aria/aria-listbox.html
+++ b/content/test/data/accessibility/aria/aria-listbox.html
@@ -1,5 +1,6 @@
 <!--
 @MAC-ALLOW:AXRole*
+@WIN-ALLOW:ia2_hypertext=*
 @WIN-ALLOW:xml-roles*
 -->
 <html>
diff --git a/content/test/data/accessibility/aria/aria-menuitemcheckbox.html b/content/test/data/accessibility/aria/aria-menuitemcheckbox.html
index 24dd901..a2e2783 100644
--- a/content/test/data/accessibility/aria/aria-menuitemcheckbox.html
+++ b/content/test/data/accessibility/aria/aria-menuitemcheckbox.html
@@ -1,9 +1,10 @@
 <!--
 @MAC-ALLOW:AXRole*
 @WIN-ALLOW:checkable:*
-@WIN-ALLOW:xml-roles:*
 @WIN-ALLOW:CHECKED*
+@WIN-ALLOW:ia2_hypertext=*
 @WIN-ALLOW:MIXED*
+@WIN-ALLOW:xml-roles:*
 -->
 <html>
 <body>
diff --git a/content/test/data/accessibility/aria/aria-menuitemradio.html b/content/test/data/accessibility/aria/aria-menuitemradio.html
index c018665..6afedf35 100644
--- a/content/test/data/accessibility/aria/aria-menuitemradio.html
+++ b/content/test/data/accessibility/aria/aria-menuitemradio.html
@@ -1,9 +1,10 @@
 <!--
 @MAC-ALLOW:AXRole*
 @WIN-ALLOW:checkable:*
-@WIN-ALLOW:xml-roles:*
 @WIN-ALLOW:CHECKED*
+@WIN-ALLOW:ia2_hypertext=*
 @WIN-ALLOW:MIXED*
+@WIN-ALLOW:xml-roles:*
 -->
 <html>
 <body>
diff --git a/content/test/data/accessibility/aria/aria-radio-expected-android.txt b/content/test/data/accessibility/aria/aria-radio-expected-android.txt
index 2861334..8a67439 100644
--- a/content/test/data/accessibility/aria/aria-radio-expected-android.txt
+++ b/content/test/data/accessibility/aria/aria-radio-expected-android.txt
@@ -1,2 +1,2 @@
 android.webkit.WebView focusable focused scrollable
-++android.widget.RadioButton checkable
\ No newline at end of file
+++android.widget.RadioButton checkable clickable name='Radio1'
diff --git a/content/test/data/accessibility/aria/aria-radio-expected-mac.txt b/content/test/data/accessibility/aria/aria-radio-expected-mac.txt
index 7861b02..d706f751 100644
--- a/content/test/data/accessibility/aria/aria-radio-expected-mac.txt
+++ b/content/test/data/accessibility/aria/aria-radio-expected-mac.txt
@@ -1,2 +1,2 @@
 AXWebArea AXRoleDescription='HTML content'
-++AXRadioButton AXRoleDescription='radio' AXValue='0'
\ No newline at end of file
+++AXRadioButton AXRoleDescription='radio' AXTitle='Radio1' AXValue='0'
diff --git a/content/test/data/accessibility/aria/aria-radio-expected-win.txt b/content/test/data/accessibility/aria/aria-radio-expected-win.txt
index 0710055..9211c38 100644
--- a/content/test/data/accessibility/aria/aria-radio-expected-win.txt
+++ b/content/test/data/accessibility/aria/aria-radio-expected-win.txt
@@ -1,2 +1,2 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
-++ROLE_SYSTEM_RADIOBUTTON xml-roles:radio checkable:true
\ No newline at end of file
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>'
+++ROLE_SYSTEM_RADIOBUTTON name='Radio1' xml-roles:radio checkable:true ia2_hypertext='Radio1'
diff --git a/content/test/data/accessibility/aria/aria-radio.html b/content/test/data/accessibility/aria/aria-radio.html
index 45af6a7..043ef75 100644
--- a/content/test/data/accessibility/aria/aria-radio.html
+++ b/content/test/data/accessibility/aria/aria-radio.html
@@ -1,11 +1,12 @@
 <!--
 @MAC-ALLOW:AXRole*
-@WIN-ALLOW:xml-roles:*
 @WIN-ALLOW:checkable*
+@WIN-ALLOW:ia2_hypertext=*
+@WIN-ALLOW:xml-roles:*
 -->
 <!DOCTYPE html>
 <html>
 <body>
-  <div role="radio"></div>
+  <div role="radio">Radio1</div>
 </body>
 </html>
diff --git a/content/test/data/accessibility/aria/aria-scrollbar-expected-win.txt b/content/test/data/accessibility/aria/aria-scrollbar-expected-win.txt
index c30c41831..20c3360 100644
--- a/content/test/data/accessibility/aria/aria-scrollbar-expected-win.txt
+++ b/content/test/data/accessibility/aria/aria-scrollbar-expected-win.txt
@@ -1,3 +1,3 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0><obj1>'
 ++ROLE_SYSTEM_SCROLLBAR FOCUSABLE IA2_STATE_VERTICAL xml-roles:scrollbar currentValue=55.00
 ++ROLE_SYSTEM_SCROLLBAR FOCUSABLE IA2_STATE_HORIZONTAL xml-roles:scrollbar currentValue=55.00
diff --git a/content/test/data/accessibility/aria/aria-scrollbar.html b/content/test/data/accessibility/aria/aria-scrollbar.html
index ccb4e90f..16e71a8 100644
--- a/content/test/data/accessibility/aria/aria-scrollbar.html
+++ b/content/test/data/accessibility/aria/aria-scrollbar.html
@@ -1,13 +1,14 @@
 <!--
 @MAC-ALLOW:AXRole*
-@WIN-ALLOW:xml-roles*
 @WIN-ALLOW:currentValue*
+@WIN-ALLOW:ia2_hypertext=*
 @WIN-ALLOW:IA2_STATE*
+@WIN-ALLOW:xml-roles:*
 -->
 <!DOCTYPE html>
 <html>
 <body>
-    <div tabindex=0 aria-valuenow="55" role="scrollbar">scrollbar</div>
-    <div tabindex=0 aria-valuenow="55" role="scrollbar" aria-orientation="horizontal">scrollbar</div>
+    <div tabindex=0 aria-valuenow="55" role="scrollbar">ScrollBar1</div>
+    <div tabindex=0 aria-valuenow="55" role="scrollbar" aria-orientation="horizontal">ScrollBar2</div>
 </body>
 </html>
diff --git a/content/test/data/accessibility/aria/aria-searchbox-expected-win.txt b/content/test/data/accessibility/aria/aria-searchbox-expected-win.txt
index f35530d..49831153 100644
--- a/content/test/data/accessibility/aria/aria-searchbox-expected-win.txt
+++ b/content/test/data/accessibility/aria/aria-searchbox-expected-win.txt
@@ -1,3 +1,3 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE n_selections=0
-++ROLE_SYSTEM_TEXT FOCUSABLE xml-roles:searchbox caret_offset=0 n_selections=0
-++++ROLE_SYSTEM_STATICTEXT name='ARIA role searchbox.' n_selections=0
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>' n_selections=0
+++ROLE_SYSTEM_TEXT FOCUSABLE xml-roles:searchbox ia2_hypertext='ARIA role searchbox.' caret_offset=0 n_selections=0
+++++ROLE_SYSTEM_STATICTEXT name='ARIA role searchbox.' ia2_hypertext='ARIA role searchbox.' n_selections=0
diff --git a/content/test/data/accessibility/aria/aria-searchbox-with-selection-expected-win.txt b/content/test/data/accessibility/aria/aria-searchbox-with-selection-expected-win.txt
index 7ccc5639..6d9618b 100644
--- a/content/test/data/accessibility/aria/aria-searchbox-with-selection-expected-win.txt
+++ b/content/test/data/accessibility/aria/aria-searchbox-with-selection-expected-win.txt
@@ -1,3 +1,3 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE caret_offset=1 n_selections=1 selection_start=0 selection_end=1
-++ROLE_SYSTEM_TEXT FOCUSABLE xml-roles:searchbox caret_offset=20 n_selections=1 selection_start=0 selection_end=20
-++++ROLE_SYSTEM_STATICTEXT name='ARIA role searchbox.' caret_offset=20 n_selections=1 selection_start=0 selection_end=20
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>' caret_offset=1 n_selections=1 selection_start=0 selection_end=1
+++ROLE_SYSTEM_TEXT FOCUSABLE xml-roles:searchbox ia2_hypertext='ARIA role searchbox.' caret_offset=20 n_selections=1 selection_start=0 selection_end=20
+++++ROLE_SYSTEM_STATICTEXT name='ARIA role searchbox.' ia2_hypertext='ARIA role searchbox.' caret_offset=20 n_selections=1 selection_start=0 selection_end=20
diff --git a/content/test/data/accessibility/aria/aria-searchbox-with-selection.html b/content/test/data/accessibility/aria/aria-searchbox-with-selection.html
index 7fde0f5..5244ebd 100644
--- a/content/test/data/accessibility/aria/aria-searchbox-with-selection.html
+++ b/content/test/data/accessibility/aria/aria-searchbox-with-selection.html
@@ -1,11 +1,12 @@
 <!--
 @MAC-ALLOW:AXRole*
 @MAC-ALLOW:AXSubrole*
-@WIN-ALLOW:xml-roles*
 @WIN-ALLOW:caret_offset*
+@WIN-ALLOW:ia2_hypertext=*
 @WIN-ALLOW:n_selections*
 @WIN-ALLOW:selection_start*
 @WIN-ALLOW:selection_end*
+@WIN-ALLOW:xml-roles*
 -->
 <!DOCTYPE html>
 <html>
diff --git a/content/test/data/accessibility/aria/aria-searchbox.html b/content/test/data/accessibility/aria/aria-searchbox.html
index c0d99fe8..447fa07 100644
--- a/content/test/data/accessibility/aria/aria-searchbox.html
+++ b/content/test/data/accessibility/aria/aria-searchbox.html
@@ -1,11 +1,13 @@
 <!--
 @MAC-ALLOW:AXRole*
 @MAC-ALLOW:AXSubrole*
-@WIN-ALLOW:xml-roles*
+@WIN-DENY:description*
 @WIN-ALLOW:caret_offset*
+@WIN-ALLOW:ia2_hypertext=*
 @WIN-ALLOW:n_selections*
 @WIN-ALLOW:selection_start*
 @WIN-ALLOW:selection_end*
+@WIN-ALLOW:xml-roles*
 -->
 <!DOCTYPE html>
 <html>
diff --git a/content/test/data/accessibility/aria/aria-slider-expected-win.txt b/content/test/data/accessibility/aria/aria-slider-expected-win.txt
index 580c093..01cdc33c4 100644
--- a/content/test/data/accessibility/aria/aria-slider-expected-win.txt
+++ b/content/test/data/accessibility/aria/aria-slider-expected-win.txt
@@ -1,2 +1,2 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>'
 ++ROLE_SYSTEM_SLIDER xml-roles:slider currentValue=5.00 minimumValue=1.00 maximumValue=10.00
diff --git a/content/test/data/accessibility/aria/aria-slider.html b/content/test/data/accessibility/aria/aria-slider.html
index 0bed2405..40c76b2 100644
--- a/content/test/data/accessibility/aria/aria-slider.html
+++ b/content/test/data/accessibility/aria/aria-slider.html
@@ -1,10 +1,11 @@
 <!--
 @MAC-ALLOW:AXRole*
-@WIN-ALLOW:xml-roles:*
-@WIN-ALLOW:currentValue*
-@WIN-ALLOW:minimumValue*
-@WIN-ALLOW:maximumValue*
 @WIN-DENY:name*
+@WIN-ALLOW:currentValue*
+@WIN-ALLOW:ia2_hypertext=*
+@WIN-ALLOW:maximumValue*
+@WIN-ALLOW:minimumValue*
+@WIN-ALLOW:xml-roles:*
 -->
 <!DOCTYPE html>
 <html>
diff --git a/content/test/data/accessibility/aria/aria-spinbutton.html b/content/test/data/accessibility/aria/aria-spinbutton.html
index 329176e..bd99ced 100644
--- a/content/test/data/accessibility/aria/aria-spinbutton.html
+++ b/content/test/data/accessibility/aria/aria-spinbutton.html
@@ -1,5 +1,6 @@
 <!--
 @MAC-ALLOW:AXRole*
+@WIN-ALLOW:ia2_hypertext=*
 -->
 <html>
 <body>
diff --git a/content/test/data/accessibility/aria/aria-switch-expected-android.txt b/content/test/data/accessibility/aria/aria-switch-expected-android.txt
index c748c31..d4e59be 100644
--- a/content/test/data/accessibility/aria/aria-switch-expected-android.txt
+++ b/content/test/data/accessibility/aria/aria-switch-expected-android.txt
@@ -1,4 +1,4 @@
 android.webkit.WebView focusable focused scrollable
-++android.widget.CheckBox
-++android.widget.CheckBox checkable checked
-++android.widget.CheckBox
+++android.widget.CheckBox clickable name='Switch1'
+++android.widget.CheckBox checkable checked clickable name='Switch2'
+++android.widget.CheckBox clickable name='Switch3'
diff --git a/content/test/data/accessibility/aria/aria-switch-expected-mac.txt b/content/test/data/accessibility/aria/aria-switch-expected-mac.txt
index 87230d7..7347e4b 100644
--- a/content/test/data/accessibility/aria/aria-switch-expected-mac.txt
+++ b/content/test/data/accessibility/aria/aria-switch-expected-mac.txt
@@ -1,4 +1,4 @@
 AXWebArea AXRoleDescription='HTML content'
-++AXCheckBox AXSubrole=AXSwitch AXRoleDescription='switch' AXValue='0'
-++AXCheckBox AXSubrole=AXSwitch AXRoleDescription='switch' AXValue='1'
-++AXCheckBox AXSubrole=AXSwitch AXRoleDescription='switch' AXValue='0'
+++AXCheckBox AXSubrole=AXSwitch AXRoleDescription='switch' AXTitle='Switch1' AXValue='0'
+++AXCheckBox AXSubrole=AXSwitch AXRoleDescription='switch' AXTitle='Switch2' AXValue='1'
+++AXCheckBox AXSubrole=AXSwitch AXRoleDescription='switch' AXTitle='Switch3' AXValue='0'
diff --git a/content/test/data/accessibility/aria/aria-switch-expected-win.txt b/content/test/data/accessibility/aria/aria-switch-expected-win.txt
index 79e88a6..2edd2e7 100644
--- a/content/test/data/accessibility/aria/aria-switch-expected-win.txt
+++ b/content/test/data/accessibility/aria/aria-switch-expected-win.txt
@@ -1,4 +1,4 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
-++IA2_ROLE_TOGGLE_BUTTON xml-roles:switch checkable:true
-++IA2_ROLE_TOGGLE_BUTTON CHECKED xml-roles:switch checkable:true
-++IA2_ROLE_TOGGLE_BUTTON xml-roles:switch checkable:true
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0><obj1><obj2>'
+++IA2_ROLE_TOGGLE_BUTTON name='Switch1' xml-roles:switch checkable:true ia2_hypertext='Switch1'
+++IA2_ROLE_TOGGLE_BUTTON name='Switch2' CHECKED xml-roles:switch checkable:true ia2_hypertext='Switch2'
+++IA2_ROLE_TOGGLE_BUTTON name='Switch3' xml-roles:switch checkable:true ia2_hypertext='Switch3'
diff --git a/content/test/data/accessibility/aria/aria-switch.html b/content/test/data/accessibility/aria/aria-switch.html
index 064c87f..948cbe7 100644
--- a/content/test/data/accessibility/aria/aria-switch.html
+++ b/content/test/data/accessibility/aria/aria-switch.html
@@ -1,15 +1,16 @@
 <!--
 @MAC-ALLOW:AXRole*
 @MAC-ALLOW:AXSubrole*
-@WIN-ALLOW:xml-roles*
 @WIN-ALLOW:checkable:*
 @WIN-ALLOW:CHECKED*
+@WIN-ALLOW:ia2_hypertext=*
+@WIN-ALLOW:xml-roles*
 -->
 <!DOCTYPE html>
 <html>
 <body>
-  <div role="switch"></div>
-  <div role="switch" aria-checked="true"></div>
-  <div role="switch" aria-checked="mixed"></div>
+  <div role="switch">Switch1</div>
+  <div role="switch" aria-checked="true">Switch2</div>
+  <div role="switch" aria-checked="mixed">Switch3</div>
 </body>
 </html>
diff --git a/content/test/data/accessibility/aria/aria-textbox-expected-android.txt b/content/test/data/accessibility/aria/aria-textbox-expected-android.txt
index e354c0da..6cc3f7a2 100644
--- a/content/test/data/accessibility/aria/aria-textbox-expected-android.txt
+++ b/content/test/data/accessibility/aria/aria-textbox-expected-android.txt
@@ -1,3 +1,3 @@
 android.webkit.WebView focusable focused scrollable
-++android.widget.EditText editable_text
-++android.widget.EditText editable_text multiline
+++android.widget.EditText clickable editable_text name='TextBox1' text_change_added_count=8
+++android.widget.EditText clickable editable_text multiline name='TextBox2' text_change_added_count=8
diff --git a/content/test/data/accessibility/aria/aria-textbox-expected-mac.txt b/content/test/data/accessibility/aria/aria-textbox-expected-mac.txt
index 11a3525..0b404ce 100644
--- a/content/test/data/accessibility/aria/aria-textbox-expected-mac.txt
+++ b/content/test/data/accessibility/aria/aria-textbox-expected-mac.txt
@@ -1,3 +1,3 @@
 AXWebArea AXRoleDescription='HTML content'
-++AXTextField AXRoleDescription='text field'
-++AXTextArea AXRoleDescription='text entry area'
+++AXTextField AXRoleDescription='text field' AXValue='TextBox1'
+++AXTextArea AXRoleDescription='text entry area' AXValue='TextBox2'
diff --git a/content/test/data/accessibility/aria/aria-textbox-expected-win.txt b/content/test/data/accessibility/aria/aria-textbox-expected-win.txt
index 8c47ab71..a8ac67d 100644
--- a/content/test/data/accessibility/aria/aria-textbox-expected-win.txt
+++ b/content/test/data/accessibility/aria/aria-textbox-expected-win.txt
@@ -1,3 +1,3 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE n_selections=0
-++ROLE_SYSTEM_TEXT IA2_STATE_SINGLE_LINE xml-roles:textbox caret_offset=0 n_selections=0
-++ROLE_SYSTEM_TEXT IA2_STATE_MULTI_LINE xml-roles:textbox caret_offset=0 n_selections=0
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0><obj1>' n_selections=0
+++ROLE_SYSTEM_TEXT IA2_STATE_SINGLE_LINE xml-roles:textbox ia2_hypertext='TextBox1' caret_offset=0 n_selections=0
+++ROLE_SYSTEM_TEXT IA2_STATE_MULTI_LINE xml-roles:textbox ia2_hypertext='TextBox2' caret_offset=0 n_selections=0
diff --git a/content/test/data/accessibility/aria/aria-textbox-with-selection-expected-win.txt b/content/test/data/accessibility/aria/aria-textbox-with-selection-expected-win.txt
index 60e2ceef..e3bd7d98 100644
--- a/content/test/data/accessibility/aria/aria-textbox-with-selection-expected-win.txt
+++ b/content/test/data/accessibility/aria/aria-textbox-with-selection-expected-win.txt
@@ -1,3 +1,4 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE caret_offset=1 n_selections=1 selection_start=0 selection_end=1
-++ROLE_SYSTEM_TEXT IA2_STATE_SINGLE_LINE xml-roles:textbox caret_offset=0 n_selections=0
-++ROLE_SYSTEM_TEXT IA2_STATE_MULTI_LINE xml-roles:textbox caret_offset=0 n_selections=0
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0><obj1>' caret_offset=1 n_selections=1 selection_start=0 selection_end=1
+++ROLE_SYSTEM_TEXT IA2_STATE_SINGLE_LINE xml-roles:textbox ia2_hypertext='Single line.' caret_offset=0 n_selections=0
+++ROLE_SYSTEM_TEXT IA2_STATE_MULTI_LINE xml-roles:textbox ia2_hypertext='Multiple
+lines.' caret_offset=0 n_selections=0
diff --git a/content/test/data/accessibility/aria/aria-textbox-with-selection.html b/content/test/data/accessibility/aria/aria-textbox-with-selection.html
index 5d62874..8333775 100644
--- a/content/test/data/accessibility/aria/aria-textbox-with-selection.html
+++ b/content/test/data/accessibility/aria/aria-textbox-with-selection.html
@@ -1,12 +1,13 @@
 <!--
 @MAC-ALLOW:AXRole*
-@WIN-ALLOW:IA2_STATE_SINGLE_LINE
-@WIN-ALLOW:IA2_STATE_MULTI_LINE
-@WIN-ALLOW:xml-roles*
 @WIN-ALLOW:caret_offset*
+@WIN-ALLOW:ia2_hypertext=*
+@WIN-ALLOW:IA2_STATE_MULTI_LINE
+@WIN-ALLOW:IA2_STATE_SINGLE_LINE
 @WIN-ALLOW:n_selections*
 @WIN-ALLOW:selection_start*
 @WIN-ALLOW:selection_end*
+@WIN-ALLOW:xml-roles*
 -->
 <!DOCTYPE html>
 <html>
diff --git a/content/test/data/accessibility/aria/aria-textbox.html b/content/test/data/accessibility/aria/aria-textbox.html
index d3dff29..d3f1e85f 100644
--- a/content/test/data/accessibility/aria/aria-textbox.html
+++ b/content/test/data/accessibility/aria/aria-textbox.html
@@ -1,17 +1,18 @@
 <!--
 @MAC-ALLOW:AXRole*
-@WIN-ALLOW:IA2_STATE_SINGLE_LINE
-@WIN-ALLOW:IA2_STATE_MULTI_LINE
-@WIN-ALLOW:xml-roles*
 @WIN-ALLOW:caret_offset*
+@WIN-ALLOW:ia2_hypertext=*
+@WIN-ALLOW:IA2_STATE_MULTI_LINE
+@WIN-ALLOW:IA2_STATE_SINGLE_LINE
 @WIN-ALLOW:n_selections*
 @WIN-ALLOW:selection_start*
 @WIN-ALLOW:selection_end*
+@WIN-ALLOW:xml-roles*
 -->
 <!DOCTYPE html>
 <html>
 <body>
-  <div role="textbox"></div>
-  <div role="textbox" aria-multiline="true"></div>
+  <div role="textbox">TextBox1</div>
+  <div role="textbox" aria-multiline="true">TextBox2</div>
 </body>
 </html>
diff --git a/content/test/data/accessibility/html/button-expected-win.txt b/content/test/data/accessibility/html/button-expected-win.txt
index f5b5473..bfdb4631 100644
--- a/content/test/data/accessibility/html/button-expected-win.txt
+++ b/content/test/data/accessibility/html/button-expected-win.txt
@@ -1,3 +1,3 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
-++IA2_ROLE_SECTION
-++++ROLE_SYSTEM_PUSHBUTTON name='Click me!' FOCUSABLE
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>'
+++IA2_ROLE_SECTION ia2_hypertext='<obj0>'
+++++ROLE_SYSTEM_PUSHBUTTON name='Click me!' FOCUSABLE ia2_hypertext='Click me!'
diff --git a/content/test/data/accessibility/html/button.html b/content/test/data/accessibility/html/button.html
index 7a90d14..1010208 100644
--- a/content/test/data/accessibility/html/button.html
+++ b/content/test/data/accessibility/html/button.html
@@ -1,5 +1,6 @@
 <!--
 @MAC-ALLOW:AXRoleDescription=*
+@WIN-ALLOW:ia2_hypertext=*
 -->
 <!DOCTYPE html>
 <html>
diff --git a/content/test/data/accessibility/html/contenteditable-descendants.html b/content/test/data/accessibility/html/contenteditable-descendants.html
index 95de2ce..5c1557d 100644
--- a/content/test/data/accessibility/html/contenteditable-descendants.html
+++ b/content/test/data/accessibility/html/contenteditable-descendants.html
@@ -1,8 +1,8 @@
 <!--
-@WIN-ALLOW:IA2_STATE_EDITABLE
-@WIN-ALLOW:LINKED
-@WIN-ALLOW:ia2_hypertext=*
 @WIN-ALLOW:caret_offset*
+@WIN-ALLOW:IA2_STATE_EDITABLE
+@WIN-ALLOW:ia2_hypertext=*
+@WIN-ALLOW:LINKED
 @WIN-ALLOW:n_selections*
 @WIN-ALLOW:selection_start*
 @WIN-ALLOW:selection_end*
diff --git a/content/test/data/accessibility/html/input-button-expected-win.txt b/content/test/data/accessibility/html/input-button-expected-win.txt
index 9c8dc9796..24500778 100644
--- a/content/test/data/accessibility/html/input-button-expected-win.txt
+++ b/content/test/data/accessibility/html/input-button-expected-win.txt
@@ -1,3 +1,3 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
-++IA2_ROLE_SECTION
-++++ROLE_SYSTEM_PUSHBUTTON name='Button' FOCUSABLE xml-roles:button
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>'
+++IA2_ROLE_SECTION ia2_hypertext='<obj0>'
+++++ROLE_SYSTEM_PUSHBUTTON name='Button' FOCUSABLE xml-roles:button ia2_hypertext='Button'
diff --git a/content/test/data/accessibility/html/input-button.html b/content/test/data/accessibility/html/input-button.html
index f15ebd4..1bad566 100644
--- a/content/test/data/accessibility/html/input-button.html
+++ b/content/test/data/accessibility/html/input-button.html
@@ -1,5 +1,6 @@
 <!--
 @MAC-DENY:AXValue*
+@WIN-ALLOW:ia2_hypertext=*
 @WIN-ALLOW:xml-roles:*
 -->
 <!DOCTYPE html>
diff --git a/content/test/data/accessibility/html/input-checkbox-expected-android.txt b/content/test/data/accessibility/html/input-checkbox-expected-android.txt
index 303ed00..d235802 100644
--- a/content/test/data/accessibility/html/input-checkbox-expected-android.txt
+++ b/content/test/data/accessibility/html/input-checkbox-expected-android.txt
@@ -1,5 +1,5 @@
 android.webkit.WebView focusable focused scrollable
 ++android.view.View
-++++android.widget.CheckBox checkable checked clickable focusable
-++++android.widget.CheckBox checkable clickable focusable
-++++android.widget.CheckBox checkable clickable focusable
\ No newline at end of file
+++++android.widget.CheckBox checkable checked clickable focusable name='CheckBox1'
+++++android.widget.CheckBox checkable clickable focusable name='CheckBox2'
+++++android.widget.CheckBox checkable clickable focusable name='CheckBox3'
diff --git a/content/test/data/accessibility/html/input-checkbox-expected-mac.txt b/content/test/data/accessibility/html/input-checkbox-expected-mac.txt
index e1a0832..e40c2a4 100644
--- a/content/test/data/accessibility/html/input-checkbox-expected-mac.txt
+++ b/content/test/data/accessibility/html/input-checkbox-expected-mac.txt
@@ -1,5 +1,5 @@
 AXWebArea AXRoleDescription='HTML content'
 ++AXGroup AXRoleDescription='group'
-++++AXCheckBox AXRoleDescription='checkbox' AXValue='1'
-++++AXCheckBox AXRoleDescription='checkbox' AXValue='0'
-++++AXCheckBox AXRoleDescription='checkbox' AXValue='0'
+++++AXCheckBox AXRoleDescription='checkbox' AXTitle='CheckBox1' AXValue='1'
+++++AXCheckBox AXRoleDescription='checkbox' AXTitle='CheckBox2' AXValue='0'
+++++AXCheckBox AXRoleDescription='checkbox' AXTitle='CheckBox3' AXValue='0'
diff --git a/content/test/data/accessibility/html/input-checkbox-expected-win.txt b/content/test/data/accessibility/html/input-checkbox-expected-win.txt
index 82f3112ee8..f9cb2b02 100644
--- a/content/test/data/accessibility/html/input-checkbox-expected-win.txt
+++ b/content/test/data/accessibility/html/input-checkbox-expected-win.txt
@@ -1,5 +1,5 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
-++IA2_ROLE_SECTION
-++++ROLE_SYSTEM_CHECKBUTTON CHECKED FOCUSABLE IA2_STATE_CHECKABLE checkable:true
-++++ROLE_SYSTEM_CHECKBUTTON FOCUSABLE IA2_STATE_CHECKABLE checkable:true
-++++ROLE_SYSTEM_CHECKBUTTON FOCUSABLE IA2_STATE_CHECKABLE xml-roles:checkbox checkable:true
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>'
+++IA2_ROLE_SECTION ia2_hypertext='<obj0><obj1><obj2>'
+++++ROLE_SYSTEM_CHECKBUTTON name='CheckBox1' CHECKED FOCUSABLE IA2_STATE_CHECKABLE checkable:true ia2_hypertext='CheckBox1'
+++++ROLE_SYSTEM_CHECKBUTTON name='CheckBox2' FOCUSABLE IA2_STATE_CHECKABLE checkable:true ia2_hypertext='CheckBox2'
+++++ROLE_SYSTEM_CHECKBUTTON name='CheckBox3' FOCUSABLE IA2_STATE_CHECKABLE xml-roles:checkbox checkable:true ia2_hypertext='CheckBox3'
diff --git a/content/test/data/accessibility/html/input-checkbox-in-menu-expected-android.txt b/content/test/data/accessibility/html/input-checkbox-in-menu-expected-android.txt
index 3001775..57f5a32 100644
--- a/content/test/data/accessibility/html/input-checkbox-in-menu-expected-android.txt
+++ b/content/test/data/accessibility/html/input-checkbox-in-menu-expected-android.txt
@@ -1,5 +1,5 @@
 android.webkit.WebView focusable focused scrollable
 ++android.view.View
-++++android.view.MenuItem checkable clickable focusable
+++++android.widget.CheckBox checkable clickable focusable name='CheckBox1'
 ++android.view.View
-++++android.view.MenuItem checkable clickable focusable
\ No newline at end of file
+++++android.widget.CheckBox checkable clickable focusable name='CheckBox2'
diff --git a/content/test/data/accessibility/html/input-checkbox-in-menu-expected-mac.txt b/content/test/data/accessibility/html/input-checkbox-in-menu-expected-mac.txt
index a9d07e76..ae41a2ec 100644
--- a/content/test/data/accessibility/html/input-checkbox-in-menu-expected-mac.txt
+++ b/content/test/data/accessibility/html/input-checkbox-in-menu-expected-mac.txt
@@ -1,5 +1,5 @@
 AXWebArea
 ++AXGroup
-++++AXMenuItem
+++++AXCheckBox AXTitle='CheckBox1' AXValue='0'
 ++AXMenu
-++++AXMenuItem
+++++AXCheckBox AXTitle='CheckBox2' AXValue='0'
diff --git a/content/test/data/accessibility/html/input-checkbox-in-menu-expected-win.txt b/content/test/data/accessibility/html/input-checkbox-in-menu-expected-win.txt
index d437674..39ed5da 100644
--- a/content/test/data/accessibility/html/input-checkbox-in-menu-expected-win.txt
+++ b/content/test/data/accessibility/html/input-checkbox-in-menu-expected-win.txt
@@ -1,5 +1,5 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
-++IA2_ROLE_SECTION
-++++IA2_ROLE_CHECK_MENU_ITEM FOCUSABLE IA2_STATE_CHECKABLE checkable:true
-++ROLE_SYSTEM_MENUPOPUP xml-roles:menu
-++++IA2_ROLE_CHECK_MENU_ITEM FOCUSABLE IA2_STATE_CHECKABLE checkable:true
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0><obj1>'
+++IA2_ROLE_SECTION ia2_hypertext='<obj0>'
+++++ROLE_SYSTEM_CHECKBUTTON name='CheckBox1' FOCUSABLE IA2_STATE_CHECKABLE checkable:true ia2_hypertext='CheckBox1'
+++ROLE_SYSTEM_MENUPOPUP xml-roles:menu ia2_hypertext='<obj0>'
+++++ROLE_SYSTEM_CHECKBUTTON name='CheckBox2' FOCUSABLE IA2_STATE_CHECKABLE checkable:true ia2_hypertext='CheckBox2'
diff --git a/content/test/data/accessibility/html/input-checkbox-in-menu.html b/content/test/data/accessibility/html/input-checkbox-in-menu.html
index 9ddec6b..436e1339 100644
--- a/content/test/data/accessibility/html/input-checkbox-in-menu.html
+++ b/content/test/data/accessibility/html/input-checkbox-in-menu.html
@@ -1,15 +1,16 @@
 <!--
-@WIN-ALLOW:xml-roles:*
-@WIN-ALLOW:IA2_STATE_CHECKABLE*
 @WIN-ALLOW:checkable*
+@WIN-ALLOW:ia2_hypertext=*
+@WIN-ALLOW:IA2_STATE_CHECKABLE*
+@WIN-ALLOW:xml-roles:*
 -->
 <html>
 <body>
 <menu type="list">
-  <input type="checkbox">
+  <label><input type="checkbox" value="checked1">CheckBox1</label>
 </menu>
 <div role="menu">
-  <input type="checkbox">
+  <label><input type="checkbox" value="checked2">CheckBox2</label>
 </div>
 </body>
 </html>
diff --git a/content/test/data/accessibility/html/input-checkbox.html b/content/test/data/accessibility/html/input-checkbox.html
index eda11af..fffb8f4 100644
--- a/content/test/data/accessibility/html/input-checkbox.html
+++ b/content/test/data/accessibility/html/input-checkbox.html
@@ -1,14 +1,15 @@
 <!--
 @MAC-ALLOW:AXRole*
-@WIN-ALLOW:IA2_STATE_*
-@WIN-ALLOW:xml-roles:*
 @WIN-ALLOW:checkable:*
 @WIN-ALLOW:CHECKED*
+@WIN-ALLOW:ia2_hypertext=*
+@WIN-ALLOW:IA2_STATE_*
+@WIN-ALLOW:xml-roles:*
 -->
 <html>
 <body>
-  <input type="checkbox" checked>
-  <input type="checkbox" aria-checked="true">
-  <input type="checkbox" role="checkbox" aria-checked="true">
+  <label><input type="checkbox" checked value="checked1">CheckBox1</label>
+  <label><input type="checkbox" aria-checked="true" value="checked2">CheckBox2</label>
+  <label><input type="checkbox" role="checkbox" aria-checked="true" value="checked3">CheckBox3</label>
 </body>
 </html>
diff --git a/content/test/data/accessibility/html/input-color-expected-win.txt b/content/test/data/accessibility/html/input-color-expected-win.txt
index 88e8474a..2b1be88 100644
--- a/content/test/data/accessibility/html/input-color-expected-win.txt
+++ b/content/test/data/accessibility/html/input-color-expected-win.txt
@@ -1,3 +1,3 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
-++IA2_ROLE_SECTION
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>'
+++IA2_ROLE_SECTION ia2_hypertext='<obj0>'
 ++++IA2_ROLE_COLOR_CHOOSER value='100% red 60% green 0% blue' FOCUSABLE
diff --git a/content/test/data/accessibility/html/input-color.html b/content/test/data/accessibility/html/input-color.html
index 88bb6a1b..1254352 100644
--- a/content/test/data/accessibility/html/input-color.html
+++ b/content/test/data/accessibility/html/input-color.html
@@ -1,6 +1,7 @@
 <!--
 @MAC-ALLOW:AXRole*
 @MAC-DENY:AXTitle*
+@WIN-ALLOW:ia2_hypertext=*
 @WIN-ALLOW:value*
 @WIN-DENY:value='file://*
 -->
diff --git a/content/test/data/accessibility/html/input-date-expected-win.txt b/content/test/data/accessibility/html/input-date-expected-win.txt
index f8879c9..e7ae70b 100644
--- a/content/test/data/accessibility/html/input-date-expected-win.txt
+++ b/content/test/data/accessibility/html/input-date-expected-win.txt
@@ -1,3 +1,3 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
-++IA2_ROLE_SECTION
-++++IA2_ROLE_DATE_EDITOR name='@NO_CHILDREN_DUMP' FOCUSABLE
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>'
+++IA2_ROLE_SECTION ia2_hypertext='<obj0>'
+++++IA2_ROLE_DATE_EDITOR name='@NO_CHILDREN_DUMP' FOCUSABLE ia2_hypertext='<obj0><obj1><obj2>'
diff --git a/content/test/data/accessibility/html/input-date.html b/content/test/data/accessibility/html/input-date.html
index ca24acb..5cdfb133 100644
--- a/content/test/data/accessibility/html/input-date.html
+++ b/content/test/data/accessibility/html/input-date.html
@@ -1,11 +1,10 @@
 <!--
 @MAC-ALLOW:AXRole*
+@WIN-ALLOW:ia2_hypertext=*
 -->
 <!DOCTYPE html>
 <html>
 <body>
-
   <input aria-label="@NO_CHILDREN_DUMP" type="date" value="2008-09-01">
-
 </body>
 </html>
diff --git a/content/test/data/accessibility/html/input-datetime-expected-android.txt b/content/test/data/accessibility/html/input-datetime-expected-android.txt
index 43aea6d..9fa5b0bf 100644
--- a/content/test/data/accessibility/html/input-datetime-expected-android.txt
+++ b/content/test/data/accessibility/html/input-datetime-expected-android.txt
@@ -1,3 +1,3 @@
 android.webkit.WebView focusable focused scrollable
 ++android.view.View
-++++android.widget.EditText clickable editable_text focusable input_type=4
\ No newline at end of file
+++++android.widget.EditText clickable editable_text focusable name='1/1/2015 1:00AM' input_type=4 text_change_added_count=15
diff --git a/content/test/data/accessibility/html/input-datetime-expected-mac.txt b/content/test/data/accessibility/html/input-datetime-expected-mac.txt
index 03f809dc4e..aaa4951 100644
--- a/content/test/data/accessibility/html/input-datetime-expected-mac.txt
+++ b/content/test/data/accessibility/html/input-datetime-expected-mac.txt
@@ -1,3 +1,3 @@
 AXWebArea AXRoleDescription='HTML content'
 ++AXGroup AXRoleDescription='group'
-++++AXTextField AXRoleDescription='text field'
+++++AXTextField AXRoleDescription='text field' AXValue='1/1/2015 1:00AM'
diff --git a/content/test/data/accessibility/html/input-datetime-expected-win.txt b/content/test/data/accessibility/html/input-datetime-expected-win.txt
index b5e9ff5..2a6c4d6e 100644
--- a/content/test/data/accessibility/html/input-datetime-expected-win.txt
+++ b/content/test/data/accessibility/html/input-datetime-expected-win.txt
@@ -1,3 +1,3 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
-++IA2_ROLE_SECTION
-++++ROLE_SYSTEM_TEXT FOCUSABLE
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>'
+++IA2_ROLE_SECTION ia2_hypertext='<obj0>'
+++++ROLE_SYSTEM_TEXT FOCUSABLE ia2_hypertext='1/1/2015 1:00AM'
diff --git a/content/test/data/accessibility/html/input-datetime-local-expected-win.txt b/content/test/data/accessibility/html/input-datetime-local-expected-win.txt
index 7da0941..39b01a49 100644
--- a/content/test/data/accessibility/html/input-datetime-local-expected-win.txt
+++ b/content/test/data/accessibility/html/input-datetime-local-expected-win.txt
@@ -1,18 +1,18 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
-++IA2_ROLE_SECTION
-++++IA2_ROLE_DATE_EDITOR FOCUSABLE
-++++++IA2_ROLE_SECTION
-++++++++IA2_ROLE_SECTION
-++++++++++ROLE_SYSTEM_SPINBUTTON name='Month' FOCUSABLE
-++++++++++ROLE_SYSTEM_STATICTEXT name='/'
-++++++++++ROLE_SYSTEM_SPINBUTTON name='Day' FOCUSABLE
-++++++++++ROLE_SYSTEM_STATICTEXT name='/'
-++++++++++ROLE_SYSTEM_SPINBUTTON name='Year' FOCUSABLE
-++++++++++ROLE_SYSTEM_SPINBUTTON name='Hours' FOCUSABLE
-++++++++++ROLE_SYSTEM_STATICTEXT name=':'
-++++++++++ROLE_SYSTEM_SPINBUTTON name='Minutes' FOCUSABLE
-++++++++++ROLE_SYSTEM_SPINBUTTON name='AM/PM' FOCUSABLE
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>'
+++IA2_ROLE_SECTION ia2_hypertext='<obj0>'
+++++IA2_ROLE_DATE_EDITOR FOCUSABLE ia2_hypertext='<obj0><obj1><obj2>'
+++++++IA2_ROLE_SECTION ia2_hypertext='<obj0>'
+++++++++IA2_ROLE_SECTION ia2_hypertext='<obj0>/<obj2>/<obj4><obj5>:<obj7><obj8>'
+++++++++++ROLE_SYSTEM_SPINBUTTON name='Month' FOCUSABLE ia2_hypertext='Month'
+++++++++++ROLE_SYSTEM_STATICTEXT name='/' ia2_hypertext='/'
+++++++++++ROLE_SYSTEM_SPINBUTTON name='Day' FOCUSABLE ia2_hypertext='Day'
+++++++++++ROLE_SYSTEM_STATICTEXT name='/' ia2_hypertext='/'
+++++++++++ROLE_SYSTEM_SPINBUTTON name='Year' FOCUSABLE ia2_hypertext='Year'
+++++++++++ROLE_SYSTEM_SPINBUTTON name='Hours' FOCUSABLE ia2_hypertext='Hours'
+++++++++++ROLE_SYSTEM_STATICTEXT name=':' ia2_hypertext=':'
+++++++++++ROLE_SYSTEM_SPINBUTTON name='Minutes' FOCUSABLE ia2_hypertext='Minutes'
+++++++++++ROLE_SYSTEM_SPINBUTTON name='AM/PM' FOCUSABLE ia2_hypertext='AM/PM'
 ++++++ROLE_SYSTEM_BUTTONMENU FOCUSABLE
-++++++ROLE_SYSTEM_SPINBUTTON
+++++++ROLE_SYSTEM_SPINBUTTON ia2_hypertext='<obj0><obj1>'
 ++++++++ROLE_SYSTEM_PUSHBUTTON
 ++++++++ROLE_SYSTEM_PUSHBUTTON
diff --git a/content/test/data/accessibility/html/input-datetime-local.html b/content/test/data/accessibility/html/input-datetime-local.html
index e2fdc414..53ba67b 100644
--- a/content/test/data/accessibility/html/input-datetime-local.html
+++ b/content/test/data/accessibility/html/input-datetime-local.html
@@ -1,5 +1,6 @@
 <!--
 @MAC-ALLOW:AXRole*
+@WIN-ALLOW:ia2_hypertext=*
 -->
 <!DOCTYPE html>
 <html>
diff --git a/content/test/data/accessibility/html/input-datetime.html b/content/test/data/accessibility/html/input-datetime.html
index 6235ac40..8ba14ff 100644
--- a/content/test/data/accessibility/html/input-datetime.html
+++ b/content/test/data/accessibility/html/input-datetime.html
@@ -1,11 +1,10 @@
 <!--
 @MAC-ALLOW:AXRole*
+@WIN-ALLOW:ia2_hypertext=*
 -->
 <!DOCTYPE html>
 <html>
 <body>
-
-  <input type="datetime">
-
+  <input type="datetime" value="1/1/2015 1:00AM">
 </body>
 </html>
diff --git a/content/test/data/accessibility/html/input-email-expected-android.txt b/content/test/data/accessibility/html/input-email-expected-android.txt
index 47a6338..9faf9a68 100644
--- a/content/test/data/accessibility/html/input-email-expected-android.txt
+++ b/content/test/data/accessibility/html/input-email-expected-android.txt
@@ -1,3 +1,3 @@
 android.webkit.WebView focusable focused scrollable
 ++android.view.View
-++++android.widget.EditText clickable editable_text focusable input_type=209
+++++android.widget.EditText clickable editable_text focusable name='someone@example.com' input_type=209 text_change_added_count=19
diff --git a/content/test/data/accessibility/html/input-email-expected-mac.txt b/content/test/data/accessibility/html/input-email-expected-mac.txt
index 03f809dc4e..932b856 100644
--- a/content/test/data/accessibility/html/input-email-expected-mac.txt
+++ b/content/test/data/accessibility/html/input-email-expected-mac.txt
@@ -1,3 +1,3 @@
 AXWebArea AXRoleDescription='HTML content'
 ++AXGroup AXRoleDescription='group'
-++++AXTextField AXRoleDescription='text field'
+++++AXTextField AXRoleDescription='text field' AXValue='someone@example.com'
diff --git a/content/test/data/accessibility/html/input-email-expected-win.txt b/content/test/data/accessibility/html/input-email-expected-win.txt
index 56a2d55e4..e0a9555 100644
--- a/content/test/data/accessibility/html/input-email-expected-win.txt
+++ b/content/test/data/accessibility/html/input-email-expected-win.txt
@@ -1,3 +1,3 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE n_selections=0
-++IA2_ROLE_SECTION n_selections=0
-++++ROLE_SYSTEM_TEXT FOCUSABLE text-input-type:email caret_offset=0 n_selections=0
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>' n_selections=0
+++IA2_ROLE_SECTION ia2_hypertext='<obj0>' n_selections=0
+++++ROLE_SYSTEM_TEXT FOCUSABLE text-input-type:email ia2_hypertext='someone@example.com' caret_offset=0 n_selections=0
diff --git a/content/test/data/accessibility/html/input-email.html b/content/test/data/accessibility/html/input-email.html
index ba32ce55..e4dd522f 100644
--- a/content/test/data/accessibility/html/input-email.html
+++ b/content/test/data/accessibility/html/input-email.html
@@ -1,14 +1,15 @@
 <!--
 @MAC-ALLOW:AXRole*
-@WIN-ALLOW:text-input-type*
 @WIN-ALLOW:caret_offset*
+@WIN-ALLOW:ia2_hypertext=*
 @WIN-ALLOW:n_selections*
 @WIN-ALLOW:selection_start*
 @WIN-ALLOW:selection_end*
+@WIN-ALLOW:text-input-type*
 -->
 <!DOCTYPE html>
 <html>
   <body>
-    <input type="email">
+    <input type="email" value="someone@example.com">
   </body>
 </html>
diff --git a/content/test/data/accessibility/html/input-file-expected-win.txt b/content/test/data/accessibility/html/input-file-expected-win.txt
index 6def2ff..0001423 100644
--- a/content/test/data/accessibility/html/input-file-expected-win.txt
+++ b/content/test/data/accessibility/html/input-file-expected-win.txt
@@ -1,3 +1,3 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
-++IA2_ROLE_SECTION
-++++ROLE_SYSTEM_PUSHBUTTON name='Choose File' FOCUSABLE
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>'
+++IA2_ROLE_SECTION ia2_hypertext='<obj0>'
+++++ROLE_SYSTEM_PUSHBUTTON name='Choose File' FOCUSABLE ia2_hypertext='Choose File'
diff --git a/content/test/data/accessibility/html/input-file.html b/content/test/data/accessibility/html/input-file.html
index 2c4ef059..c14a3e9 100644
--- a/content/test/data/accessibility/html/input-file.html
+++ b/content/test/data/accessibility/html/input-file.html
@@ -1,4 +1,7 @@
 <!DOCTYPE html>
+<!--
+@WIN-ALLOW:ia2_hypertext=*
+-->
 <html>
   <body>
     <input type="file">
diff --git a/content/test/data/accessibility/html/input-month.html b/content/test/data/accessibility/html/input-month.html
index f98756e..fd74d66 100644
--- a/content/test/data/accessibility/html/input-month.html
+++ b/content/test/data/accessibility/html/input-month.html
@@ -1,7 +1,8 @@
+<!DOCTYPE html>
 <!--
 @MAC-ALLOW:AXRole*
+@WIN-ALLOW:ia2_hypertext=*
 -->
-<!DOCTYPE html>
 <html>
   <body>
     <input type="month">
diff --git a/content/test/data/accessibility/html/input-password-expected-win.txt b/content/test/data/accessibility/html/input-password-expected-win.txt
index 49ca3b0..d98b0a7 100644
--- a/content/test/data/accessibility/html/input-password-expected-win.txt
+++ b/content/test/data/accessibility/html/input-password-expected-win.txt
@@ -1,3 +1,3 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE caret_offset=0 n_selections=0
-++IA2_ROLE_SECTION caret_offset=0 n_selections=0
-++++ROLE_SYSTEM_TEXT value='••••••' FOCUSABLE PROTECTED IA2_STATE_EDITABLE IA2_STATE_SELECTABLE_TEXT IA2_STATE_SINGLE_LINE text-input-type:password caret_offset=6 n_selections=0
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>' caret_offset=0 n_selections=0
+++IA2_ROLE_SECTION ia2_hypertext='<obj0>' caret_offset=0 n_selections=0
+++++ROLE_SYSTEM_TEXT value='••••••' FOCUSABLE PROTECTED IA2_STATE_EDITABLE IA2_STATE_SELECTABLE_TEXT IA2_STATE_SINGLE_LINE text-input-type:password ia2_hypertext='••••••' caret_offset=6 n_selections=0
diff --git a/content/test/data/accessibility/html/input-password.html b/content/test/data/accessibility/html/input-password.html
index 7693a11..c8be7bf 100644
--- a/content/test/data/accessibility/html/input-password.html
+++ b/content/test/data/accessibility/html/input-password.html
@@ -6,6 +6,7 @@
 @WIN-ALLOW:text-input-type*
 @WIN-ALLOW:value='•*
 @WIN-ALLOW:caret_offset*
+@WIN-ALLOW:ia2_hypertext=*
 @WIN-ALLOW:n_selections*
 @WIN-ALLOW:selection_start*
 @WIN-ALLOW:selection_end*
diff --git a/content/test/data/accessibility/html/input-radio-expected-android.txt b/content/test/data/accessibility/html/input-radio-expected-android.txt
index 6a2cd30..f018c95 100644
--- a/content/test/data/accessibility/html/input-radio-expected-android.txt
+++ b/content/test/data/accessibility/html/input-radio-expected-android.txt
@@ -1,7 +1,11 @@
 android.webkit.WebView focusable focused scrollable
 ++android.view.View
 ++++android.widget.RadioButton checkable clickable focusable
+++++android.view.View clickable name='Radio1'
+++++android.view.View clickable name='
+'
 ++++android.widget.RadioButton checkable clickable focusable
+++++android.view.View clickable name='Radio2'
 ++android.view.View
-++++android.widget.RadioButton checkable clickable focusable
-++++android.widget.RadioButton checkable checked clickable focusable
+++++android.widget.RadioButton checkable clickable focusable name='Radio3'
+++++android.widget.RadioButton checkable checked clickable focusable name='Radio4'
diff --git a/content/test/data/accessibility/html/input-radio-expected-mac.txt b/content/test/data/accessibility/html/input-radio-expected-mac.txt
index 6e757c6..e54e00f8 100644
--- a/content/test/data/accessibility/html/input-radio-expected-mac.txt
+++ b/content/test/data/accessibility/html/input-radio-expected-mac.txt
@@ -1,7 +1,12 @@
 AXWebArea
 ++AXGroup
 ++++AXRadioButton AXValue='0'
+++++AXStaticText AXValue='Radio1'
+++++AXUnknown AXTitle='
+' AXValue='
+'
 ++++AXRadioButton AXValue='0'
+++++AXStaticText AXValue='Radio2'
 ++AXGroup
-++++AXRadioButton AXValue='0'
-++++AXRadioButton AXValue='1'
+++++AXRadioButton AXTitle='Radio3' AXValue='0'
+++++AXRadioButton AXTitle='Radio4' AXValue='1'
diff --git a/content/test/data/accessibility/html/input-radio-expected-win.txt b/content/test/data/accessibility/html/input-radio-expected-win.txt
index faa6bc2..20db39a 100644
--- a/content/test/data/accessibility/html/input-radio-expected-win.txt
+++ b/content/test/data/accessibility/html/input-radio-expected-win.txt
@@ -1,7 +1,13 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
-++IA2_ROLE_FORM
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0><obj1>'
+++IA2_ROLE_FORM ia2_hypertext='<obj0>Radio1
+<obj3>Radio2'
 ++++ROLE_SYSTEM_RADIOBUTTON MIXED FOCUSABLE IA2_STATE_CHECKABLE checkable:true
+++++ROLE_SYSTEM_STATICTEXT name='Radio1' ia2_hypertext='Radio1'
+++++ROLE_SYSTEM_WHITESPACE name='
+' ia2_hypertext='
+'
 ++++ROLE_SYSTEM_RADIOBUTTON MIXED FOCUSABLE IA2_STATE_CHECKABLE checkable:true
-++IA2_ROLE_FORM
-++++ROLE_SYSTEM_RADIOBUTTON FOCUSABLE IA2_STATE_CHECKABLE checkable:true
-++++ROLE_SYSTEM_RADIOBUTTON CHECKED FOCUSABLE IA2_STATE_CHECKABLE checkable:true
+++++ROLE_SYSTEM_STATICTEXT name='Radio2' ia2_hypertext='Radio2'
+++IA2_ROLE_FORM ia2_hypertext='<obj0><obj1>'
+++++ROLE_SYSTEM_RADIOBUTTON name='Radio3' MIXED FOCUSABLE IA2_STATE_CHECKABLE checkable:true ia2_hypertext='Radio3'
+++++ROLE_SYSTEM_RADIOBUTTON name='Radio4' CHECKED FOCUSABLE IA2_STATE_CHECKABLE checkable:true ia2_hypertext='Radio4'
diff --git a/content/test/data/accessibility/html/input-radio-in-menu-expected-android.txt b/content/test/data/accessibility/html/input-radio-in-menu-expected-android.txt
index 07da1df..bff928d0 100644
--- a/content/test/data/accessibility/html/input-radio-in-menu-expected-android.txt
+++ b/content/test/data/accessibility/html/input-radio-in-menu-expected-android.txt
@@ -1,5 +1,8 @@
 android.webkit.WebView focusable focused scrollable
 ++android.view.View
 ++++android.view.MenuItem checkable clickable focusable
+++++android.view.View clickable name='Radio1 '
+++++android.widget.RadioButton checkable clickable focusable name='Radio2'
 ++android.view.View
+++++android.widget.RadioButton checkable clickable focusable name='Radio3'
 ++++android.view.MenuItem checkable clickable focusable
diff --git a/content/test/data/accessibility/html/input-radio-in-menu-expected-mac.txt b/content/test/data/accessibility/html/input-radio-in-menu-expected-mac.txt
index 89d5526e..ed99ff4 100644
--- a/content/test/data/accessibility/html/input-radio-in-menu-expected-mac.txt
+++ b/content/test/data/accessibility/html/input-radio-in-menu-expected-mac.txt
@@ -2,5 +2,7 @@
 AXWebArea
 ++AXGroup
 ++++AXMenuItem
+++++AXMenuItem
 ++AXMenu
 ++++AXMenuItem
+++++AXMenuItem
diff --git a/content/test/data/accessibility/html/input-radio-in-menu-expected-win.txt b/content/test/data/accessibility/html/input-radio-in-menu-expected-win.txt
index c892239..21e0e69 100644
--- a/content/test/data/accessibility/html/input-radio-in-menu-expected-win.txt
+++ b/content/test/data/accessibility/html/input-radio-in-menu-expected-win.txt
@@ -1,5 +1,8 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
-++IA2_ROLE_SECTION
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0><obj1>'
+++IA2_ROLE_SECTION ia2_hypertext='<obj0>Radio1 <obj2>'
 ++++IA2_ROLE_RADIO_MENU_ITEM MIXED FOCUSABLE checkable:true
-++ROLE_SYSTEM_MENUPOPUP
+++++ROLE_SYSTEM_STATICTEXT name='Radio1 ' ia2_hypertext='Radio1 '
+++++ROLE_SYSTEM_RADIOBUTTON name='Radio2' MIXED FOCUSABLE checkable:true ia2_hypertext='Radio2'
+++ROLE_SYSTEM_MENUPOPUP ia2_hypertext='<obj0><obj1>'
+++++ROLE_SYSTEM_RADIOBUTTON name='Radio3' MIXED FOCUSABLE checkable:true ia2_hypertext='Radio3'
 ++++IA2_ROLE_RADIO_MENU_ITEM MIXED FOCUSABLE checkable:true
diff --git a/content/test/data/accessibility/html/input-radio-in-menu.html b/content/test/data/accessibility/html/input-radio-in-menu.html
index f41eae3..ae6103c 100644
--- a/content/test/data/accessibility/html/input-radio-in-menu.html
+++ b/content/test/data/accessibility/html/input-radio-in-menu.html
@@ -1,14 +1,17 @@
 <!--
 @WIN-ALLOW:MIXED*
 @WIN-ALLOW:checkable*
+@WIN-ALLOW:ia2_hypertext=*
 -->
 <html>
   <body>
     <menu type="list">
-      <input type="radio">
+      <input type="radio" value="r1">Radio1
+      <label><input type="radio" value="r2">Radio2</label>
     </menu>
     <div role="menu">
-      <input type="radio">
+      <label><input type="radio" value="r3">Radio3</label>
+      <input type="radio" value="r4">
     </div>
   </body>
 </html>
diff --git a/content/test/data/accessibility/html/input-radio.html b/content/test/data/accessibility/html/input-radio.html
index ca8199d..65c5275 100644
--- a/content/test/data/accessibility/html/input-radio.html
+++ b/content/test/data/accessibility/html/input-radio.html
@@ -2,17 +2,18 @@
 @WIN-ALLOW:MIXED*
 @WIN-ALLOW:CHECKED*
 @WIN-ALLOW:checkable:*
+@WIN-ALLOW:ia2_hypertext=*
 @WIN-ALLOW:IA2_STATE_CHECKABLE*
 -->
 <html>
   <body>
     <form>
-      <input type="radio" name="r">
-      <input type="radio" name="r">
+      <input type="radio" name="r1" value="r1">Radio1<br>
+      <input type="radio" name="r2" value="r2">Radio2
     </form>
     <form>
-      <input type="radio" name="r">
-      <input type="radio" name="r" checked>
+      <label><input type="radio" name="r1" value="r3">Radio3</label>
+      <label><input type="radio" name="r2" checked value="r4">Radio4</label>
     </form>
   </body>
 </html>
diff --git a/content/test/data/accessibility/html/input-range-expected-win.txt b/content/test/data/accessibility/html/input-range-expected-win.txt
index f85ddc4f..cc58753 100644
--- a/content/test/data/accessibility/html/input-range-expected-win.txt
+++ b/content/test/data/accessibility/html/input-range-expected-win.txt
@@ -1,3 +1,3 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
-++IA2_ROLE_SECTION
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>'
+++IA2_ROLE_SECTION ia2_hypertext='<obj0>'
 ++++ROLE_SYSTEM_SLIDER FOCUSABLE xml-roles:slider valuetext:5 currentValue=5.00
diff --git a/content/test/data/accessibility/html/input-range.html b/content/test/data/accessibility/html/input-range.html
index 9ec2a7c..b3c522c 100644
--- a/content/test/data/accessibility/html/input-range.html
+++ b/content/test/data/accessibility/html/input-range.html
@@ -1,8 +1,9 @@
 <!--
-@WIN-ALLOW:currentValue*
-@WIN-ALLOW:valuetext*
 @WIN-DENY:description*
 @WIN-DENY:name*
+@WIN-ALLOW:currentValue*
+@WIN-ALLOW:ia2_hypertext=*
+@WIN-ALLOW:valuetext*
 @WIN-ALLOW:xml-roles:*
 -->
 <html>
diff --git a/content/test/data/accessibility/html/input-search-expected-android.txt b/content/test/data/accessibility/html/input-search-expected-android.txt
index ebdc4fe..d2f4bed 100644
--- a/content/test/data/accessibility/html/input-search-expected-android.txt
+++ b/content/test/data/accessibility/html/input-search-expected-android.txt
@@ -1,3 +1,3 @@
 android.webkit.WebView focusable focused scrollable
 ++android.view.View
-++++android.widget.EditText clickable editable_text focusable input_type=1
+++++android.widget.EditText clickable editable_text focusable name='Search terms' input_type=1 text_change_added_count=12
diff --git a/content/test/data/accessibility/html/input-search-expected-mac.txt b/content/test/data/accessibility/html/input-search-expected-mac.txt
index 03f809dc4e..7784eff 100644
--- a/content/test/data/accessibility/html/input-search-expected-mac.txt
+++ b/content/test/data/accessibility/html/input-search-expected-mac.txt
@@ -1,3 +1,3 @@
 AXWebArea AXRoleDescription='HTML content'
 ++AXGroup AXRoleDescription='group'
-++++AXTextField AXRoleDescription='text field'
+++++AXTextField AXRoleDescription='text field' AXValue='Search terms'
diff --git a/content/test/data/accessibility/html/input-search-expected-win.txt b/content/test/data/accessibility/html/input-search-expected-win.txt
index 0e9a417..5e2545e 100644
--- a/content/test/data/accessibility/html/input-search-expected-win.txt
+++ b/content/test/data/accessibility/html/input-search-expected-win.txt
@@ -1,3 +1,3 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE n_selections=0
-++IA2_ROLE_SECTION n_selections=0
-++++ROLE_SYSTEM_TEXT FOCUSABLE caret_offset=0 n_selections=0
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>' n_selections=0
+++IA2_ROLE_SECTION ia2_hypertext='<obj0>' n_selections=0
+++++ROLE_SYSTEM_TEXT FOCUSABLE ia2_hypertext='Search terms' caret_offset=0 n_selections=0
diff --git a/content/test/data/accessibility/html/input-search.html b/content/test/data/accessibility/html/input-search.html
index 4cfbbcd..0f3019b 100644
--- a/content/test/data/accessibility/html/input-search.html
+++ b/content/test/data/accessibility/html/input-search.html
@@ -2,6 +2,7 @@
 @MAC-ALLOW:AXRole*
 @MAC-ALLOW:AXSubrole*
 @WIN-ALLOW:caret_offset*
+@WIN-ALLOW:ia2_hypertext=*
 @WIN-ALLOW:n_selections*
 @WIN-ALLOW:selection_start*
 @WIN-ALLOW:selection_end*
@@ -9,6 +10,6 @@
 <!DOCTYPE html>
 <html>
   <body>
-     <input type="search" name="googlesearch">
+     <input type="search" name="googlesearch" value="Search terms">
   </body>
 </html>
diff --git a/content/test/data/accessibility/html/input-tel-expected-android.txt b/content/test/data/accessibility/html/input-tel-expected-android.txt
index 9731cde..e1976c97f3 100644
--- a/content/test/data/accessibility/html/input-tel-expected-android.txt
+++ b/content/test/data/accessibility/html/input-tel-expected-android.txt
@@ -1,3 +1,3 @@
 android.webkit.WebView focusable focused scrollable
 ++android.view.View
-++++android.widget.EditText clickable editable_text focusable input_type=3
\ No newline at end of file
+++++android.widget.EditText clickable editable_text focusable name='123-456-7890' input_type=3 text_change_added_count=12
diff --git a/content/test/data/accessibility/html/input-tel-expected-mac.txt b/content/test/data/accessibility/html/input-tel-expected-mac.txt
index f94a58e..2a515a2 100644
--- a/content/test/data/accessibility/html/input-tel-expected-mac.txt
+++ b/content/test/data/accessibility/html/input-tel-expected-mac.txt
@@ -1,3 +1,3 @@
 AXWebArea
 ++AXGroup
-++++AXTextField
+++++AXTextField AXValue='123-456-7890'
diff --git a/content/test/data/accessibility/html/input-tel-expected-win.txt b/content/test/data/accessibility/html/input-tel-expected-win.txt
index 011cc9a5d..daab4eb 100644
--- a/content/test/data/accessibility/html/input-tel-expected-win.txt
+++ b/content/test/data/accessibility/html/input-tel-expected-win.txt
@@ -1,3 +1,3 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE n_selections=0
-++IA2_ROLE_SECTION n_selections=0
-++++ROLE_SYSTEM_TEXT FOCUSABLE text-input-type:tel caret_offset=0 n_selections=0
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>' n_selections=0
+++IA2_ROLE_SECTION ia2_hypertext='<obj0>' n_selections=0
+++++ROLE_SYSTEM_TEXT FOCUSABLE text-input-type:tel ia2_hypertext='123-456-7890' caret_offset=0 n_selections=0
diff --git a/content/test/data/accessibility/html/input-tel.html b/content/test/data/accessibility/html/input-tel.html
index 7790cca6..3cba879 100644
--- a/content/test/data/accessibility/html/input-tel.html
+++ b/content/test/data/accessibility/html/input-tel.html
@@ -1,13 +1,14 @@
 <!--
-@WIN-ALLOW:text-input-type*
 @WIN-ALLOW:caret_offset*
+@WIN-ALLOW:ia2_hypertext=*
 @WIN-ALLOW:n_selections*
 @WIN-ALLOW:selection_start*
 @WIN-ALLOW:selection_end*
+@WIN-ALLOW:text-input-type*
 -->
 <!DOCTYPE html>
 <html>
 <body>
-  <input type="tel">
+  <input type="tel" value='123-456-7890'>
 </body>
 </html>
diff --git a/content/test/data/accessibility/html/input-text-expected-win.txt b/content/test/data/accessibility/html/input-text-expected-win.txt
index 76873be..291a11f 100644
--- a/content/test/data/accessibility/html/input-text-expected-win.txt
+++ b/content/test/data/accessibility/html/input-text-expected-win.txt
@@ -1,3 +1,3 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE caret_offset=0 n_selections=0
-++IA2_ROLE_SECTION caret_offset=0 n_selections=0
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>' caret_offset=0 n_selections=0
+++IA2_ROLE_SECTION ia2_hypertext='<obj0>' caret_offset=0 n_selections=0
 ++++ROLE_SYSTEM_TEXT name='Name' FOCUSABLE IA2_STATE_EDITABLE IA2_STATE_SELECTABLE_TEXT IA2_STATE_SINGLE_LINE text-input-type:text caret_offset=0 n_selections=0
diff --git a/content/test/data/accessibility/html/input-text-with-selection-expected-win.txt b/content/test/data/accessibility/html/input-text-with-selection-expected-win.txt
index b8258b9..26f5d48e 100644
--- a/content/test/data/accessibility/html/input-text-with-selection-expected-win.txt
+++ b/content/test/data/accessibility/html/input-text-with-selection-expected-win.txt
@@ -1,3 +1,3 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE caret_offset=1 n_selections=1 selection_start=0 selection_end=1
-++IA2_ROLE_SECTION caret_offset=1 n_selections=1 selection_start=0 selection_end=1
-++++ROLE_SYSTEM_TEXT FOCUSABLE IA2_STATE_EDITABLE IA2_STATE_SELECTABLE_TEXT IA2_STATE_SINGLE_LINE text-input-type:text caret_offset=5 n_selections=1 selection_start=3 selection_end=5
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>' caret_offset=1 n_selections=1 selection_start=0 selection_end=1
+++IA2_ROLE_SECTION ia2_hypertext='<obj0>' caret_offset=1 n_selections=1 selection_start=0 selection_end=1
+++++ROLE_SYSTEM_TEXT FOCUSABLE IA2_STATE_EDITABLE IA2_STATE_SELECTABLE_TEXT IA2_STATE_SINGLE_LINE text-input-type:text ia2_hypertext='Selection' caret_offset=5 n_selections=1 selection_start=3 selection_end=5
diff --git a/content/test/data/accessibility/html/input-text-with-selection.html b/content/test/data/accessibility/html/input-text-with-selection.html
index 3c45d0c..b458a07 100644
--- a/content/test/data/accessibility/html/input-text-with-selection.html
+++ b/content/test/data/accessibility/html/input-text-with-selection.html
@@ -1,12 +1,13 @@
 <!--
 @MAC-ALLOW:AXRole*
 @MAC-ALLOW:AXPlaceholder*
-@WIN-ALLOW:text-input-type*
-@WIN-ALLOW:IA2_STATE*
 @WIN-ALLOW:caret_offset*
+@WIN-ALLOW:ia2_hypertext=*
+@WIN-ALLOW:IA2_STATE*
 @WIN-ALLOW:n_selections*
 @WIN-ALLOW:selection_start*
 @WIN-ALLOW:selection_end*
+@WIN-ALLOW:text-input-type*
 -->
 <!DOCTYPE html>
 <html>
diff --git a/content/test/data/accessibility/html/input-text.html b/content/test/data/accessibility/html/input-text.html
index ea795a3..fa30bf54 100644
--- a/content/test/data/accessibility/html/input-text.html
+++ b/content/test/data/accessibility/html/input-text.html
@@ -1,12 +1,13 @@
 <!--
 @MAC-ALLOW:AXRole*
 @MAC-ALLOW:AXPlaceholder*
-@WIN-ALLOW:text-input-type*
-@WIN-ALLOW:IA2_STATE*
 @WIN-ALLOW:caret_offset*
+@WIN-ALLOW:ia2_hypertext=*
+@WIN-ALLOW:IA2_STATE*
 @WIN-ALLOW:n_selections*
 @WIN-ALLOW:selection_start*
 @WIN-ALLOW:selection_end*
+@WIN-ALLOW:text-input-type*
 -->
 <!DOCTYPE html>
 <html>
diff --git a/content/test/data/accessibility/html/input-time-expected-win.txt b/content/test/data/accessibility/html/input-time-expected-win.txt
index 82e118d..f34e41a1 100644
--- a/content/test/data/accessibility/html/input-time-expected-win.txt
+++ b/content/test/data/accessibility/html/input-time-expected-win.txt
@@ -1,12 +1,12 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
-++IA2_ROLE_SECTION
-++++ROLE_SYSTEM_GROUPING FOCUSABLE
-++++++IA2_ROLE_SECTION
-++++++++IA2_ROLE_SECTION
-++++++++++ROLE_SYSTEM_SPINBUTTON name='Hours' FOCUSABLE
-++++++++++ROLE_SYSTEM_STATICTEXT name=':'
-++++++++++ROLE_SYSTEM_SPINBUTTON name='Minutes' FOCUSABLE
-++++++++++ROLE_SYSTEM_SPINBUTTON name='AM/PM' FOCUSABLE
-++++++ROLE_SYSTEM_SPINBUTTON
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>'
+++IA2_ROLE_SECTION ia2_hypertext='<obj0>'
+++++ROLE_SYSTEM_GROUPING FOCUSABLE ia2_hypertext='<obj0><obj1>'
+++++++IA2_ROLE_SECTION ia2_hypertext='<obj0>'
+++++++++IA2_ROLE_SECTION ia2_hypertext='<obj0>:<obj2><obj3>'
+++++++++++ROLE_SYSTEM_SPINBUTTON name='Hours' FOCUSABLE xml-roles:spinbutton ia2_hypertext='Hours'
+++++++++++ROLE_SYSTEM_STATICTEXT name=':' ia2_hypertext=':'
+++++++++++ROLE_SYSTEM_SPINBUTTON name='Minutes' FOCUSABLE xml-roles:spinbutton ia2_hypertext='Minutes'
+++++++++++ROLE_SYSTEM_SPINBUTTON name='AM/PM' FOCUSABLE xml-roles:spinbutton ia2_hypertext='AM/PM'
+++++++ROLE_SYSTEM_SPINBUTTON ia2_hypertext='<obj0><obj1>'
 ++++++++ROLE_SYSTEM_PUSHBUTTON
 ++++++++ROLE_SYSTEM_PUSHBUTTON
diff --git a/content/test/data/accessibility/html/input-time.html b/content/test/data/accessibility/html/input-time.html
index 111a142..d422cbe 100644
--- a/content/test/data/accessibility/html/input-time.html
+++ b/content/test/data/accessibility/html/input-time.html
@@ -1,5 +1,7 @@
 <!--
 @MAC-ALLOW:AXRole*
+@WIN-ALLOW:ia2_hypertext=*
+@WIN-ALLOW:xml-roles*
 -->
 <!DOCTYPE html>
 <html>
diff --git a/content/test/data/accessibility/html/input-url-expected-android.txt b/content/test/data/accessibility/html/input-url-expected-android.txt
index 8d9f664..7bc4863 100644
--- a/content/test/data/accessibility/html/input-url-expected-android.txt
+++ b/content/test/data/accessibility/html/input-url-expected-android.txt
@@ -1,3 +1,3 @@
 android.webkit.WebView focusable focused scrollable
 ++android.view.View
-++++android.widget.EditText clickable editable_text focusable input_type=17
\ No newline at end of file
+++++android.widget.EditText clickable editable_text focusable name='example.com' input_type=17 text_change_added_count=11
diff --git a/content/test/data/accessibility/html/input-url-expected-mac.txt b/content/test/data/accessibility/html/input-url-expected-mac.txt
index 03f809dc4e..0d7e5c1 100644
--- a/content/test/data/accessibility/html/input-url-expected-mac.txt
+++ b/content/test/data/accessibility/html/input-url-expected-mac.txt
@@ -1,3 +1,3 @@
 AXWebArea AXRoleDescription='HTML content'
 ++AXGroup AXRoleDescription='group'
-++++AXTextField AXRoleDescription='text field'
+++++AXTextField AXRoleDescription='text field' AXValue='example.com'
diff --git a/content/test/data/accessibility/html/input-url-expected-win.txt b/content/test/data/accessibility/html/input-url-expected-win.txt
index e4a61d96..ec1b9f2 100644
--- a/content/test/data/accessibility/html/input-url-expected-win.txt
+++ b/content/test/data/accessibility/html/input-url-expected-win.txt
@@ -1,3 +1,3 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE n_selections=0
-++IA2_ROLE_SECTION n_selections=0
-++++ROLE_SYSTEM_TEXT FOCUSABLE text-input-type:url caret_offset=0 n_selections=0
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>' n_selections=0
+++IA2_ROLE_SECTION ia2_hypertext='<obj0>' n_selections=0
+++++ROLE_SYSTEM_TEXT FOCUSABLE text-input-type:url ia2_hypertext='example.com' caret_offset=0 n_selections=0
diff --git a/content/test/data/accessibility/html/input-url.html b/content/test/data/accessibility/html/input-url.html
index 8b52df19..54fe565c 100644
--- a/content/test/data/accessibility/html/input-url.html
+++ b/content/test/data/accessibility/html/input-url.html
@@ -1,14 +1,15 @@
 <!--
 @MAC-ALLOW:AXRole*
-@WIN-ALLOW:text-input-type*
 @WIN-ALLOW:caret_offset*
+@WIN-ALLOW:ia2_hypertext=*
 @WIN-ALLOW:n_selections*
 @WIN-ALLOW:selection_start*
 @WIN-ALLOW:selection_end*
+@WIN-ALLOW:text-input-type*
 -->
 <!DOCTYPE html>
 <html>
   <body>
-    <input type="url">
+    <input type="url" value="example.com">
   </body>
 </html>
diff --git a/content/test/data/accessibility/html/input-week-expected-win.txt b/content/test/data/accessibility/html/input-week-expected-win.txt
index d2424a9..d9afbea 100644
--- a/content/test/data/accessibility/html/input-week-expected-win.txt
+++ b/content/test/data/accessibility/html/input-week-expected-win.txt
@@ -1,13 +1,13 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
-++IA2_ROLE_SECTION
-++++IA2_ROLE_DATE_EDITOR FOCUSABLE
-++++++IA2_ROLE_SECTION
-++++++++IA2_ROLE_SECTION
-++++++++++ROLE_SYSTEM_STATICTEXT name='Week '
-++++++++++ROLE_SYSTEM_SPINBUTTON name='Week' FOCUSABLE
-++++++++++ROLE_SYSTEM_STATICTEXT name=', '
-++++++++++ROLE_SYSTEM_SPINBUTTON name='Year' FOCUSABLE
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>'
+++IA2_ROLE_SECTION ia2_hypertext='<obj0>'
+++++IA2_ROLE_DATE_EDITOR FOCUSABLE ia2_hypertext='<obj0><obj1><obj2>'
+++++++IA2_ROLE_SECTION ia2_hypertext='<obj0>'
+++++++++IA2_ROLE_SECTION ia2_hypertext='Week <obj1>, <obj3>'
+++++++++++ROLE_SYSTEM_STATICTEXT name='Week ' ia2_hypertext='Week '
+++++++++++ROLE_SYSTEM_SPINBUTTON name='Week' FOCUSABLE ia2_hypertext='Week'
+++++++++++ROLE_SYSTEM_STATICTEXT name=', ' ia2_hypertext=', '
+++++++++++ROLE_SYSTEM_SPINBUTTON name='Year' FOCUSABLE ia2_hypertext='Year'
 ++++++ROLE_SYSTEM_BUTTONMENU FOCUSABLE
-++++++ROLE_SYSTEM_SPINBUTTON
+++++++ROLE_SYSTEM_SPINBUTTON ia2_hypertext='<obj0><obj1>'
 ++++++++ROLE_SYSTEM_PUSHBUTTON
 ++++++++ROLE_SYSTEM_PUSHBUTTON
diff --git a/content/test/data/accessibility/html/input-week.html b/content/test/data/accessibility/html/input-week.html
index eb7c5d50..3ef38b31 100644
--- a/content/test/data/accessibility/html/input-week.html
+++ b/content/test/data/accessibility/html/input-week.html
@@ -1,5 +1,6 @@
 <!--
 @MAC-ALLOW:AXRole*
+@WIN-ALLOW:ia2_hypertext=*
 -->
 <!DOCTYPE html>
 <html>
diff --git a/content/test/data/accessibility/html/select-expected-win.txt b/content/test/data/accessibility/html/select-expected-win.txt
index 1baabf2..d7225004 100644
--- a/content/test/data/accessibility/html/select-expected-win.txt
+++ b/content/test/data/accessibility/html/select-expected-win.txt
@@ -1,25 +1,25 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
-++IA2_ROLE_SECTION
-++++ROLE_SYSTEM_COMBOBOX FOCUSABLE HASPOPUP
-++++++ROLE_SYSTEM_LIST
-++++++++ROLE_SYSTEM_LISTITEM name='Placeholder option' SELECTED FOCUSABLE SELECTABLE
-++++++++ROLE_SYSTEM_LISTITEM name='Option 1' FOCUSABLE SELECTABLE
-++++++++ROLE_SYSTEM_LISTITEM name='Option 2' FOCUSABLE SELECTABLE
-++++ROLE_SYSTEM_COMBOBOX FOCUSABLE HASPOPUP
-++++++ROLE_SYSTEM_LIST
-++++++++ROLE_SYSTEM_LISTITEM name='Option 1' FOCUSABLE SELECTABLE
-++++++++ROLE_SYSTEM_LISTITEM name='Option 2' SELECTED FOCUSABLE SELECTABLE
-++++++++ROLE_SYSTEM_LISTITEM name='Option 3' FOCUSABLE SELECTABLE
-++++ROLE_SYSTEM_COMBOBOX FOCUSABLE HASPOPUP
-++++++ROLE_SYSTEM_LIST
-++++++++ROLE_SYSTEM_LISTITEM name='Option 1' SELECTED FOCUSABLE SELECTABLE
-++++++++ROLE_SYSTEM_LISTITEM name='Option 2' FOCUSABLE SELECTABLE
-++++++++ROLE_SYSTEM_LISTITEM name='Option 3' FOCUSABLE SELECTABLE
-++++ROLE_SYSTEM_LIST FOCUSABLE MULTISELECTABLE EXTSELECTABLE
-++++++ROLE_SYSTEM_LISTITEM name='Option 1' FOCUSABLE SELECTABLE
-++++++ROLE_SYSTEM_LISTITEM name='Option 2' FOCUSABLE SELECTABLE
-++++++ROLE_SYSTEM_LISTITEM name='Option 3' FOCUSABLE SELECTABLE
-++++ROLE_SYSTEM_LIST FOCUSABLE
-++++++ROLE_SYSTEM_LISTITEM name='Option 1' FOCUSABLE SELECTABLE
-++++++ROLE_SYSTEM_LISTITEM name='Option 2' FOCUSABLE SELECTABLE
-++++++ROLE_SYSTEM_LISTITEM name='Option 3' FOCUSABLE SELECTABLE
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>'
+++IA2_ROLE_SECTION ia2_hypertext='<obj0><obj1><obj2><obj3><obj4>'
+++++ROLE_SYSTEM_COMBOBOX FOCUSABLE HASPOPUP ia2_hypertext='<obj0>'
+++++++ROLE_SYSTEM_LIST ia2_hypertext='<obj0><obj1><obj2>'
+++++++++ROLE_SYSTEM_LISTITEM name='Placeholder option' SELECTED FOCUSABLE SELECTABLE ia2_hypertext='Placeholder option'
+++++++++ROLE_SYSTEM_LISTITEM name='Option 1' FOCUSABLE SELECTABLE ia2_hypertext='Option 1'
+++++++++ROLE_SYSTEM_LISTITEM name='Option 2' FOCUSABLE SELECTABLE ia2_hypertext='Option 2'
+++++ROLE_SYSTEM_COMBOBOX FOCUSABLE HASPOPUP ia2_hypertext='<obj0>'
+++++++ROLE_SYSTEM_LIST ia2_hypertext='<obj0><obj1><obj2>'
+++++++++ROLE_SYSTEM_LISTITEM name='Option 1' FOCUSABLE SELECTABLE ia2_hypertext='Option 1'
+++++++++ROLE_SYSTEM_LISTITEM name='Option 2' SELECTED FOCUSABLE SELECTABLE ia2_hypertext='Option 2'
+++++++++ROLE_SYSTEM_LISTITEM name='Option 3' FOCUSABLE SELECTABLE ia2_hypertext='Option 3'
+++++ROLE_SYSTEM_COMBOBOX FOCUSABLE HASPOPUP ia2_hypertext='<obj0>'
+++++++ROLE_SYSTEM_LIST ia2_hypertext='<obj0><obj1><obj2>'
+++++++++ROLE_SYSTEM_LISTITEM name='Option 1' SELECTED FOCUSABLE SELECTABLE ia2_hypertext='Option 1'
+++++++++ROLE_SYSTEM_LISTITEM name='Option 2' FOCUSABLE SELECTABLE ia2_hypertext='Option 2'
+++++++++ROLE_SYSTEM_LISTITEM name='Option 3' FOCUSABLE SELECTABLE ia2_hypertext='Option 3'
+++++ROLE_SYSTEM_LIST FOCUSABLE MULTISELECTABLE EXTSELECTABLE ia2_hypertext='<obj0><obj1><obj2>'
+++++++ROLE_SYSTEM_LISTITEM name='Option 1' FOCUSABLE SELECTABLE ia2_hypertext='Option 1'
+++++++ROLE_SYSTEM_LISTITEM name='Option 2' FOCUSABLE SELECTABLE ia2_hypertext='Option 2'
+++++++ROLE_SYSTEM_LISTITEM name='Option 3' FOCUSABLE SELECTABLE ia2_hypertext='Option 3'
+++++ROLE_SYSTEM_LIST FOCUSABLE ia2_hypertext='<obj0><obj1><obj2>'
+++++++ROLE_SYSTEM_LISTITEM name='Option 1' FOCUSABLE SELECTABLE ia2_hypertext='Option 1'
+++++++ROLE_SYSTEM_LISTITEM name='Option 2' FOCUSABLE SELECTABLE ia2_hypertext='Option 2'
+++++++ROLE_SYSTEM_LISTITEM name='Option 3' FOCUSABLE SELECTABLE ia2_hypertext='Option 3'
diff --git a/content/test/data/accessibility/html/select.html b/content/test/data/accessibility/html/select.html
index 821831d5..eb53fb7 100644
--- a/content/test/data/accessibility/html/select.html
+++ b/content/test/data/accessibility/html/select.html
@@ -1,9 +1,10 @@
 <!--
 @MAC-ALLOW:AXRoleDescription=*
+@WIN-ALLOW:HASPOPUP
+@WIN-ALLOW:ia2_hypertext=*
 @WIN-ALLOW:MULTISELECTABLE
 @WIN-ALLOW:EXTSELECTABLE
 @WIN-ALLOW:SELECT*
-@WIN-ALLOW:HASPOPUP
 -->
 <html>
 <body>
diff --git a/content/test/data/accessibility/html/textarea-expected-win.txt b/content/test/data/accessibility/html/textarea-expected-win.txt
index 8cf0e8e5..5d07a2c 100644
--- a/content/test/data/accessibility/html/textarea-expected-win.txt
+++ b/content/test/data/accessibility/html/textarea-expected-win.txt
@@ -1,3 +1,4 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE n_selections=0
-++IA2_ROLE_SECTION n_selections=0
-++++ROLE_SYSTEM_TEXT FOCUSABLE IA2_STATE_EDITABLE IA2_STATE_MULTI_LINE IA2_STATE_SELECTABLE_TEXT caret_offset=0 n_selections=0
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>' n_selections=0
+++IA2_ROLE_SECTION ia2_hypertext='<obj0>' n_selections=0
+++++ROLE_SYSTEM_TEXT FOCUSABLE IA2_STATE_EDITABLE IA2_STATE_MULTI_LINE IA2_STATE_SELECTABLE_TEXT ia2_hypertext='The textarea tag defines a multi-line text input control.
+' caret_offset=0 n_selections=0
diff --git a/content/test/data/accessibility/html/textarea-with-selection-expected-win.txt b/content/test/data/accessibility/html/textarea-with-selection-expected-win.txt
index 207596f..f5011064 100644
--- a/content/test/data/accessibility/html/textarea-with-selection-expected-win.txt
+++ b/content/test/data/accessibility/html/textarea-with-selection-expected-win.txt
@@ -1,3 +1,4 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE caret_offset=1 n_selections=1 selection_start=0 selection_end=1
-++IA2_ROLE_SECTION caret_offset=1 n_selections=1 selection_start=0 selection_end=1
-++++ROLE_SYSTEM_TEXT FOCUSABLE IA2_STATE_EDITABLE IA2_STATE_MULTI_LINE IA2_STATE_SELECTABLE_TEXT caret_offset=58 n_selections=1 selection_start=0 selection_end=58
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>' caret_offset=1 n_selections=1 selection_start=0 selection_end=1
+++IA2_ROLE_SECTION ia2_hypertext='<obj0>' caret_offset=1 n_selections=1 selection_start=0 selection_end=1
+++++ROLE_SYSTEM_TEXT FOCUSABLE IA2_STATE_EDITABLE IA2_STATE_MULTI_LINE IA2_STATE_SELECTABLE_TEXT ia2_hypertext='The textarea tag defines a multi-line text input control.
+' caret_offset=58 n_selections=1 selection_start=0 selection_end=58
diff --git a/content/test/data/accessibility/html/textarea-with-selection.html b/content/test/data/accessibility/html/textarea-with-selection.html
index fc29809..a35707e 100644
--- a/content/test/data/accessibility/html/textarea-with-selection.html
+++ b/content/test/data/accessibility/html/textarea-with-selection.html
@@ -1,7 +1,8 @@
 <!--
 @MAC-ALLOW:AXRole*
-@WIN-ALLOW:IA2_STATE*
 @WIN-ALLOW:caret_offset*
+@WIN-ALLOW:ia2_hypertext=*
+@WIN-ALLOW:IA2_STATE*
 @WIN-ALLOW:n_selections*
 @WIN-ALLOW:selection_start*
 @WIN-ALLOW:selection_end*
diff --git a/content/test/data/accessibility/html/textarea.html b/content/test/data/accessibility/html/textarea.html
index 89db71a..195890a6 100644
--- a/content/test/data/accessibility/html/textarea.html
+++ b/content/test/data/accessibility/html/textarea.html
@@ -1,7 +1,8 @@
 <!--
 @MAC-ALLOW:AXRole*
-@WIN-ALLOW:IA2_STATE*
 @WIN-ALLOW:caret_offset*
+@WIN-ALLOW:ia2_hypertext=*
+@WIN-ALLOW:IA2_STATE*
 @WIN-ALLOW:n_selections*
 @WIN-ALLOW:selection_start*
 @WIN-ALLOW:selection_end*
diff --git a/device/bluetooth/BUILD.gn b/device/bluetooth/BUILD.gn
index 5edb17c..25dfc44b 100644
--- a/device/bluetooth/BUILD.gn
+++ b/device/bluetooth/BUILD.gn
@@ -161,95 +161,6 @@
   if (is_win) {
     libs = [ "setupapi.lib" ]
   }
-
-  # This block will also build for Linux once we write the linux
-  # implementation of BluezDbusManager.
-  if (is_chromeos) {
-    defines += [ "DEVICE_BLUETOOTH_IMPLEMENTATION" ]
-    sources += [
-      "dbus/bluetooth_adapter_client.cc",
-      "dbus/bluetooth_adapter_client.h",
-      "dbus/bluetooth_agent_manager_client.cc",
-      "dbus/bluetooth_agent_manager_client.h",
-      "dbus/bluetooth_agent_service_provider.cc",
-      "dbus/bluetooth_agent_service_provider.h",
-      "dbus/bluetooth_dbus_client_bundle.cc",
-      "dbus/bluetooth_dbus_client_bundle.h",
-      "dbus/bluetooth_device_client.cc",
-      "dbus/bluetooth_device_client.h",
-      "dbus/bluetooth_gatt_characteristic_client.cc",
-      "dbus/bluetooth_gatt_characteristic_client.h",
-      "dbus/bluetooth_gatt_characteristic_service_provider.cc",
-      "dbus/bluetooth_gatt_characteristic_service_provider.h",
-      "dbus/bluetooth_gatt_descriptor_client.cc",
-      "dbus/bluetooth_gatt_descriptor_client.h",
-      "dbus/bluetooth_gatt_descriptor_service_provider.cc",
-      "dbus/bluetooth_gatt_descriptor_service_provider.h",
-      "dbus/bluetooth_gatt_manager_client.cc",
-      "dbus/bluetooth_gatt_manager_client.h",
-      "dbus/bluetooth_gatt_service_client.cc",
-      "dbus/bluetooth_gatt_service_client.h",
-      "dbus/bluetooth_gatt_service_service_provider.cc",
-      "dbus/bluetooth_gatt_service_service_provider.h",
-      "dbus/bluetooth_input_client.cc",
-      "dbus/bluetooth_input_client.h",
-      "dbus/bluetooth_le_advertisement_service_provider.cc",
-      "dbus/bluetooth_le_advertisement_service_provider.h",
-      "dbus/bluetooth_le_advertising_manager_client.cc",
-      "dbus/bluetooth_le_advertising_manager_client.h",
-      "dbus/bluetooth_media_client.cc",
-      "dbus/bluetooth_media_client.h",
-      "dbus/bluetooth_media_endpoint_service_provider.cc",
-      "dbus/bluetooth_media_endpoint_service_provider.h",
-      "dbus/bluetooth_media_transport_client.cc",
-      "dbus/bluetooth_media_transport_client.h",
-      "dbus/bluetooth_profile_manager_client.cc",
-      "dbus/bluetooth_profile_manager_client.h",
-      "dbus/bluetooth_profile_service_provider.cc",
-      "dbus/bluetooth_profile_service_provider.h",
-      "dbus/bluez_dbus_client.h",
-      "dbus/bluez_dbus_manager.cc",
-      "dbus/bluez_dbus_manager.h",
-      "dbus/fake_bluetooth_adapter_client.cc",
-      "dbus/fake_bluetooth_adapter_client.h",
-      "dbus/fake_bluetooth_agent_manager_client.cc",
-      "dbus/fake_bluetooth_agent_manager_client.h",
-      "dbus/fake_bluetooth_agent_service_provider.cc",
-      "dbus/fake_bluetooth_agent_service_provider.h",
-      "dbus/fake_bluetooth_device_client.cc",
-      "dbus/fake_bluetooth_device_client.h",
-      "dbus/fake_bluetooth_gatt_characteristic_client.cc",
-      "dbus/fake_bluetooth_gatt_characteristic_client.h",
-      "dbus/fake_bluetooth_gatt_characteristic_service_provider.cc",
-      "dbus/fake_bluetooth_gatt_characteristic_service_provider.h",
-      "dbus/fake_bluetooth_gatt_descriptor_client.cc",
-      "dbus/fake_bluetooth_gatt_descriptor_client.h",
-      "dbus/fake_bluetooth_gatt_descriptor_service_provider.cc",
-      "dbus/fake_bluetooth_gatt_descriptor_service_provider.h",
-      "dbus/fake_bluetooth_gatt_manager_client.cc",
-      "dbus/fake_bluetooth_gatt_manager_client.h",
-      "dbus/fake_bluetooth_gatt_service_client.cc",
-      "dbus/fake_bluetooth_gatt_service_client.h",
-      "dbus/fake_bluetooth_gatt_service_service_provider.cc",
-      "dbus/fake_bluetooth_gatt_service_service_provider.h",
-      "dbus/fake_bluetooth_input_client.cc",
-      "dbus/fake_bluetooth_input_client.h",
-      "dbus/fake_bluetooth_le_advertisement_service_provider.cc",
-      "dbus/fake_bluetooth_le_advertisement_service_provider.h",
-      "dbus/fake_bluetooth_le_advertising_manager_client.cc",
-      "dbus/fake_bluetooth_le_advertising_manager_client.h",
-      "dbus/fake_bluetooth_media_client.cc",
-      "dbus/fake_bluetooth_media_client.h",
-      "dbus/fake_bluetooth_media_endpoint_service_provider.cc",
-      "dbus/fake_bluetooth_media_endpoint_service_provider.h",
-      "dbus/fake_bluetooth_media_transport_client.cc",
-      "dbus/fake_bluetooth_media_transport_client.h",
-      "dbus/fake_bluetooth_profile_manager_client.cc",
-      "dbus/fake_bluetooth_profile_manager_client.h",
-      "dbus/fake_bluetooth_profile_service_provider.cc",
-      "dbus/fake_bluetooth_profile_service_provider.h",
-    ]
-  }
 }
 
 static_library("mocks") {
diff --git a/device/bluetooth/bluetooth.gyp b/device/bluetooth/bluetooth.gyp
index 90306d10..f862660 100644
--- a/device/bluetooth/bluetooth.gyp
+++ b/device/bluetooth/bluetooth.gyp
@@ -133,96 +133,6 @@
         'bluetooth_uuid.h',
       ],
       'conditions': [
-        # This block will also build for Linux once we write the linux
-        # implementation of BluezDbusManager.
-        ['chromeos==1', {
-         'defines': [
-            'DEVICE_BLUETOOTH_IMPLEMENTATION',
-          ],
-          'sources': [
-            'dbus/bluetooth_adapter_client.cc',
-            'dbus/bluetooth_adapter_client.h',
-            'dbus/bluetooth_le_advertising_manager_client.cc',
-            'dbus/bluetooth_le_advertising_manager_client.h',
-            'dbus/bluetooth_le_advertisement_service_provider.cc',
-            'dbus/bluetooth_le_advertisement_service_provider.h',
-            'dbus/bluetooth_agent_manager_client.cc',
-            'dbus/bluetooth_agent_manager_client.h',
-            'dbus/bluetooth_agent_service_provider.cc',
-            'dbus/bluetooth_agent_service_provider.h',
-            'dbus/bluetooth_dbus_client_bundle.cc',
-            'dbus/bluetooth_dbus_client_bundle.h',
-            'dbus/bluetooth_device_client.cc',
-            'dbus/bluetooth_device_client.h',
-            'dbus/bluetooth_gatt_characteristic_client.cc',
-            'dbus/bluetooth_gatt_characteristic_client.h',
-            'dbus/bluetooth_gatt_characteristic_service_provider.cc',
-            'dbus/bluetooth_gatt_characteristic_service_provider.h',
-            'dbus/bluetooth_gatt_descriptor_client.cc',
-            'dbus/bluetooth_gatt_descriptor_client.h',
-            'dbus/bluetooth_gatt_descriptor_service_provider.cc',
-            'dbus/bluetooth_gatt_descriptor_service_provider.h',
-            'dbus/bluetooth_gatt_manager_client.cc',
-            'dbus/bluetooth_gatt_manager_client.h',
-            'dbus/bluetooth_gatt_service_client.cc',
-            'dbus/bluetooth_gatt_service_client.h',
-            'dbus/bluetooth_gatt_service_service_provider.cc',
-            'dbus/bluetooth_gatt_service_service_provider.h',
-            'dbus/bluetooth_input_client.cc',
-            'dbus/bluetooth_input_client.h',
-            'dbus/bluetooth_media_client.cc',
-            'dbus/bluetooth_media_client.h',
-            'dbus/bluetooth_media_endpoint_service_provider.cc',
-            'dbus/bluetooth_media_endpoint_service_provider.h',
-            'dbus/bluetooth_media_transport_client.cc',
-            'dbus/bluetooth_media_transport_client.h',
-            'dbus/bluetooth_profile_manager_client.cc',
-            'dbus/bluetooth_profile_manager_client.h',
-            'dbus/bluetooth_profile_service_provider.cc',
-            'dbus/bluetooth_profile_service_provider.h',
-            'dbus/bluez_dbus_client.h',
-            'dbus/bluez_dbus_manager.cc',
-            'dbus/bluez_dbus_manager.h',
-            'dbus/fake_bluetooth_adapter_client.cc',
-            'dbus/fake_bluetooth_adapter_client.h',
-            'dbus/fake_bluetooth_le_advertising_manager_client.cc',
-            'dbus/fake_bluetooth_le_advertising_manager_client.h',
-            'dbus/fake_bluetooth_le_advertisement_service_provider.cc',
-            'dbus/fake_bluetooth_le_advertisement_service_provider.h',
-            'dbus/fake_bluetooth_agent_manager_client.cc',
-            'dbus/fake_bluetooth_agent_manager_client.h',
-            'dbus/fake_bluetooth_agent_service_provider.cc',
-            'dbus/fake_bluetooth_agent_service_provider.h',
-            'dbus/fake_bluetooth_device_client.cc',
-            'dbus/fake_bluetooth_device_client.h',
-            'dbus/fake_bluetooth_gatt_characteristic_client.cc',
-            'dbus/fake_bluetooth_gatt_characteristic_client.h',
-            'dbus/fake_bluetooth_gatt_characteristic_service_provider.cc',
-            'dbus/fake_bluetooth_gatt_characteristic_service_provider.h',
-            'dbus/fake_bluetooth_gatt_descriptor_client.cc',
-            'dbus/fake_bluetooth_gatt_descriptor_client.h',
-            'dbus/fake_bluetooth_gatt_descriptor_service_provider.cc',
-            'dbus/fake_bluetooth_gatt_descriptor_service_provider.h',
-            'dbus/fake_bluetooth_gatt_manager_client.cc',
-            'dbus/fake_bluetooth_gatt_manager_client.h',
-            'dbus/fake_bluetooth_gatt_service_client.cc',
-            'dbus/fake_bluetooth_gatt_service_client.h',
-            'dbus/fake_bluetooth_gatt_service_service_provider.cc',
-            'dbus/fake_bluetooth_gatt_service_service_provider.h',
-            'dbus/fake_bluetooth_input_client.cc',
-            'dbus/fake_bluetooth_input_client.h',
-            'dbus/fake_bluetooth_media_client.cc',
-            'dbus/fake_bluetooth_media_client.h',
-            'dbus/fake_bluetooth_media_endpoint_service_provider.cc',
-            'dbus/fake_bluetooth_media_endpoint_service_provider.h',
-            'dbus/fake_bluetooth_media_transport_client.cc',
-            'dbus/fake_bluetooth_media_transport_client.h',
-            'dbus/fake_bluetooth_profile_manager_client.cc',
-            'dbus/fake_bluetooth_profile_manager_client.h',
-            'dbus/fake_bluetooth_profile_service_provider.cc',
-            'dbus/fake_bluetooth_profile_service_provider.h',
-          ],
-        }],
         ['chromeos==1', {
           'dependencies': [
             '../../build/linux/system.gyp:dbus',
diff --git a/device/bluetooth/bluetooth_adapter_chromeos.cc b/device/bluetooth/bluetooth_adapter_chromeos.cc
index 55d0bef..70ec7fb 100644
--- a/device/bluetooth/bluetooth_adapter_chromeos.cc
+++ b/device/bluetooth/bluetooth_adapter_chromeos.cc
@@ -13,6 +13,12 @@
 #include "base/sequenced_task_runner.h"
 #include "base/single_thread_task_runner.h"
 #include "base/thread_task_runner_handle.h"
+#include "chromeos/dbus/bluetooth_adapter_client.h"
+#include "chromeos/dbus/bluetooth_agent_manager_client.h"
+#include "chromeos/dbus/bluetooth_agent_service_provider.h"
+#include "chromeos/dbus/bluetooth_device_client.h"
+#include "chromeos/dbus/bluetooth_input_client.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
 #include "chromeos/system/devicetype.h"
 #include "device/bluetooth/bluetooth_adapter_profile_chromeos.h"
 #include "device/bluetooth/bluetooth_advertisement_chromeos.h"
@@ -27,12 +33,6 @@
 #include "device/bluetooth/bluetooth_socket_chromeos.h"
 #include "device/bluetooth/bluetooth_socket_thread.h"
 #include "device/bluetooth/bluetooth_uuid.h"
-#include "device/bluetooth/dbus/bluetooth_adapter_client.h"
-#include "device/bluetooth/dbus/bluetooth_agent_manager_client.h"
-#include "device/bluetooth/dbus/bluetooth_agent_service_provider.h"
-#include "device/bluetooth/dbus/bluetooth_device_client.h"
-#include "device/bluetooth/dbus/bluetooth_input_client.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
 #include "third_party/cros_system_api/dbus/service_constants.h"
 
 using device::BluetoothAdapter;
@@ -61,9 +61,9 @@
 
 UMABluetoothDiscoverySessionOutcome TranslateDiscoveryErrorToUMA(
     const std::string& error_name) {
-  if (error_name == bluez::BluetoothAdapterClient::kUnknownAdapterError) {
+  if (error_name == chromeos::BluetoothAdapterClient::kUnknownAdapterError) {
     return UMABluetoothDiscoverySessionOutcome::CHROMEOS_DBUS_UNKNOWN_ADAPTER;
-  } else if (error_name == bluez::BluetoothAdapterClient::kNoResponseError) {
+  } else if (error_name == chromeos::BluetoothAdapterClient::kNoResponseError) {
     return UMABluetoothDiscoverySessionOutcome::CHROMEOS_DBUS_NO_RESPONSE;
   } else if (error_name == bluetooth_device::kErrorInProgress) {
     return UMABluetoothDiscoverySessionOutcome::CHROMEOS_DBUS_IN_PROGRESS;
@@ -100,9 +100,9 @@
 void BluetoothAdapterChromeOS::Shutdown() {
   if (dbus_is_shutdown_)
     return;
-  DCHECK(bluez::BluezDBusManager::IsInitialized())
+  DCHECK(DBusThreadManager::IsInitialized())
       << "Call BluetoothAdapterFactory::Shutdown() before "
-         "BluezDBusManager::Shutdown().";
+         "DBusThreadManager::Shutdown().";
 
   if (IsPresent())
     RemoveAdapter();  // Also deletes devices_.
@@ -115,19 +115,14 @@
     delete it.second;
   profile_queues_.clear();
 
-  bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()->RemoveObserver(
-      this);
-  bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->RemoveObserver(
-      this);
-  bluez::BluezDBusManager::Get()->GetBluetoothInputClient()->RemoveObserver(
-      this);
+  DBusThreadManager::Get()->GetBluetoothAdapterClient()->RemoveObserver(this);
+  DBusThreadManager::Get()->GetBluetoothDeviceClient()->RemoveObserver(this);
+  DBusThreadManager::Get()->GetBluetoothInputClient()->RemoveObserver(this);
 
   VLOG(1) << "Unregistering pairing agent";
-  bluez::BluezDBusManager::Get()
-      ->GetBluetoothAgentManagerClient()
-      ->UnregisterAgent(dbus::ObjectPath(kAgentPath),
-                        base::Bind(&base::DoNothing),
-                        base::Bind(&OnUnregisterAgentError));
+  DBusThreadManager::Get()->GetBluetoothAgentManagerClient()->UnregisterAgent(
+      dbus::ObjectPath(kAgentPath), base::Bind(&base::DoNothing),
+      base::Bind(&OnUnregisterAgentError));
 
   agent_.reset();
   dbus_is_shutdown_ = true;
@@ -141,20 +136,18 @@
   ui_task_runner_ = base::ThreadTaskRunnerHandle::Get();
   socket_thread_ = device::BluetoothSocketThread::Get();
 
-  bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()->AddObserver(
-      this);
-  bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->AddObserver(this);
-  bluez::BluezDBusManager::Get()->GetBluetoothInputClient()->AddObserver(this);
+  DBusThreadManager::Get()->GetBluetoothAdapterClient()->AddObserver(this);
+  DBusThreadManager::Get()->GetBluetoothDeviceClient()->AddObserver(this);
+  DBusThreadManager::Get()->GetBluetoothInputClient()->AddObserver(this);
 
   // Register the pairing agent.
-  dbus::Bus* system_bus = bluez::BluezDBusManager::Get()->GetSystemBus();
-  agent_.reset(bluez::BluetoothAgentServiceProvider::Create(
+  dbus::Bus* system_bus = DBusThreadManager::Get()->GetSystemBus();
+  agent_.reset(BluetoothAgentServiceProvider::Create(
       system_bus, dbus::ObjectPath(kAgentPath), this));
   DCHECK(agent_.get());
 
-  std::vector<dbus::ObjectPath> object_paths = bluez::BluezDBusManager::Get()
-                                                   ->GetBluetoothAdapterClient()
-                                                   ->GetAdapters();
+  std::vector<dbus::ObjectPath> object_paths =
+      DBusThreadManager::Get()->GetBluetoothAdapterClient()->GetAdapters();
 
   if (!object_paths.empty()) {
     VLOG(1) << object_paths.size() << " Bluetooth adapter(s) available.";
@@ -170,10 +163,9 @@
   if (!IsPresent())
     return std::string();
 
-  bluez::BluetoothAdapterClient::Properties* properties =
-      bluez::BluezDBusManager::Get()
-          ->GetBluetoothAdapterClient()
-          ->GetProperties(object_path_);
+  BluetoothAdapterClient::Properties* properties =
+      DBusThreadManager::Get()->GetBluetoothAdapterClient()->GetProperties(
+          object_path_);
   DCHECK(properties);
 
   return BluetoothDevice::CanonicalizeAddress(properties->address.value());
@@ -183,10 +175,9 @@
   if (!IsPresent())
     return std::string();
 
-  bluez::BluetoothAdapterClient::Properties* properties =
-      bluez::BluezDBusManager::Get()
-          ->GetBluetoothAdapterClient()
-          ->GetProperties(object_path_);
+  BluetoothAdapterClient::Properties* properties =
+      DBusThreadManager::Get()->GetBluetoothAdapterClient()->GetProperties(
+          object_path_);
   DCHECK(properties);
 
   return properties->alias.value();
@@ -200,7 +191,7 @@
     return;
   }
 
-  bluez::BluezDBusManager::Get()
+  DBusThreadManager::Get()
       ->GetBluetoothAdapterClient()
       ->GetProperties(object_path_)
       ->alias.Set(
@@ -221,10 +212,9 @@
   if (!IsPresent())
     return false;
 
-  bluez::BluetoothAdapterClient::Properties* properties =
-      bluez::BluezDBusManager::Get()
-          ->GetBluetoothAdapterClient()
-          ->GetProperties(object_path_);
+  BluetoothAdapterClient::Properties* properties =
+      DBusThreadManager::Get()->GetBluetoothAdapterClient()->GetProperties(
+          object_path_);
 
   return properties->powered.value();
 }
@@ -238,7 +228,7 @@
     return;
   }
 
-  bluez::BluezDBusManager::Get()
+  DBusThreadManager::Get()
       ->GetBluetoothAdapterClient()
       ->GetProperties(object_path_)
       ->powered.Set(
@@ -251,10 +241,9 @@
   if (!IsPresent())
     return false;
 
-  bluez::BluetoothAdapterClient::Properties* properties =
-      bluez::BluezDBusManager::Get()
-          ->GetBluetoothAdapterClient()
-          ->GetProperties(object_path_);
+  BluetoothAdapterClient::Properties* properties =
+      DBusThreadManager::Get()->GetBluetoothAdapterClient()->GetProperties(
+          object_path_);
 
   return properties->discoverable.value();
 }
@@ -268,7 +257,7 @@
     return;
   }
 
-  bluez::BluezDBusManager::Get()
+  DBusThreadManager::Get()
       ->GetBluetoothAdapterClient()
       ->GetProperties(object_path_)
       ->discoverable.Set(
@@ -281,10 +270,9 @@
   if (!IsPresent())
     return false;
 
-  bluez::BluetoothAdapterClient::Properties* properties =
-      bluez::BluezDBusManager::Get()
-          ->GetBluetoothAdapterClient()
-          ->GetProperties(object_path_);
+  BluetoothAdapterClient::Properties* properties =
+      DBusThreadManager::Get()->GetBluetoothAdapterClient()->GetProperties(
+          object_path_);
 
   return properties->discovering.value();
 }
@@ -389,10 +377,9 @@
     return;
   DCHECK(IsPresent());
 
-  bluez::BluetoothAdapterClient::Properties* properties =
-      bluez::BluezDBusManager::Get()
-          ->GetBluetoothAdapterClient()
-          ->GetProperties(object_path_);
+  BluetoothAdapterClient::Properties* properties =
+      DBusThreadManager::Get()->GetBluetoothAdapterClient()->GetProperties(
+          object_path_);
 
   if (property_name == properties->powered.name()) {
     PoweredChanged(properties->powered.value());
@@ -405,9 +392,9 @@
 
 void BluetoothAdapterChromeOS::DeviceAdded(
   const dbus::ObjectPath& object_path) {
-  DCHECK(bluez::BluezDBusManager::Get());
-  bluez::BluetoothDeviceClient::Properties* properties =
-      bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
+  DCHECK(DBusThreadManager::Get());
+  BluetoothDeviceClient::Properties* properties =
+      DBusThreadManager::Get()->GetBluetoothDeviceClient()->GetProperties(
           object_path);
   if (!properties || properties->adapter.value() != object_path_)
     return;
@@ -451,8 +438,8 @@
   if (!device_chromeos)
     return;
 
-  bluez::BluetoothDeviceClient::Properties* properties =
-      bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
+  BluetoothDeviceClient::Properties* properties =
+      DBusThreadManager::Get()->GetBluetoothDeviceClient()->GetProperties(
           object_path);
 
   if (property_name == properties->address.name()) {
@@ -526,8 +513,8 @@
   if (!device_chromeos)
     return;
 
-  bluez::BluetoothInputClient::Properties* properties =
-      bluez::BluezDBusManager::Get()->GetBluetoothInputClient()->GetProperties(
+  BluetoothInputClient::Properties* properties =
+      DBusThreadManager::Get()->GetBluetoothInputClient()->GetProperties(
           object_path);
 
   // Properties structure can be removed, which triggers a change in the
@@ -685,7 +672,7 @@
 void BluetoothAdapterChromeOS::OnRegisterAgent() {
   VLOG(1) << "Pairing agent registered, requesting to be made default";
 
-  bluez::BluezDBusManager::Get()
+  DBusThreadManager::Get()
       ->GetBluetoothAgentManagerClient()
       ->RequestDefaultAgent(
           dbus::ObjectPath(kAgentPath),
@@ -778,22 +765,19 @@
   VLOG(1) << object_path_.value() << ": using adapter.";
 
   VLOG(1) << "Registering pairing agent";
-  bluez::BluezDBusManager::Get()
-      ->GetBluetoothAgentManagerClient()
-      ->RegisterAgent(
-          dbus::ObjectPath(kAgentPath),
-          bluetooth_agent_manager::kKeyboardDisplayCapability,
-          base::Bind(&BluetoothAdapterChromeOS::OnRegisterAgent,
-                     weak_ptr_factory_.GetWeakPtr()),
-          base::Bind(&BluetoothAdapterChromeOS::OnRegisterAgentError,
-                     weak_ptr_factory_.GetWeakPtr()));
+  DBusThreadManager::Get()->GetBluetoothAgentManagerClient()->RegisterAgent(
+      dbus::ObjectPath(kAgentPath),
+      bluetooth_agent_manager::kKeyboardDisplayCapability,
+      base::Bind(&BluetoothAdapterChromeOS::OnRegisterAgent,
+                 weak_ptr_factory_.GetWeakPtr()),
+      base::Bind(&BluetoothAdapterChromeOS::OnRegisterAgentError,
+                 weak_ptr_factory_.GetWeakPtr()));
 
   SetDefaultAdapterName();
 
-  bluez::BluetoothAdapterClient::Properties* properties =
-      bluez::BluezDBusManager::Get()
-          ->GetBluetoothAdapterClient()
-          ->GetProperties(object_path_);
+  BluetoothAdapterClient::Properties* properties =
+      DBusThreadManager::Get()->GetBluetoothAdapterClient()->GetProperties(
+          object_path_);
 
   PresentChanged(true);
 
@@ -805,7 +789,7 @@
     DiscoveringChanged(true);
 
   std::vector<dbus::ObjectPath> device_paths =
-      bluez::BluezDBusManager::Get()
+      DBusThreadManager::Get()
           ->GetBluetoothDeviceClient()
           ->GetDevicesForAdapter(object_path_);
 
@@ -844,10 +828,9 @@
   DCHECK(IsPresent());
   VLOG(1) << object_path_.value() << ": adapter removed.";
 
-  bluez::BluetoothAdapterClient::Properties* properties =
-      bluez::BluezDBusManager::Get()
-          ->GetBluetoothAdapterClient()
-          ->GetProperties(object_path_);
+  BluetoothAdapterClient::Properties* properties =
+      DBusThreadManager::Get()->GetBluetoothAdapterClient()->GetProperties(
+          object_path_);
 
   object_path_ = dbus::ObjectPath("");
 
@@ -1042,8 +1025,8 @@
 void BluetoothAdapterChromeOS::UseProfile(
     const BluetoothUUID& uuid,
     const dbus::ObjectPath& device_path,
-    const bluez::BluetoothProfileManagerClient::Options& options,
-    bluez::BluetoothProfileServiceProvider::Delegate* delegate,
+    const BluetoothProfileManagerClient::Options& options,
+    BluetoothProfileServiceProvider::Delegate* delegate,
     const ProfileRegisteredCallback& success_callback,
     const ErrorCompletionCallback& error_callback) {
   DCHECK(delegate);
@@ -1114,7 +1097,7 @@
 void BluetoothAdapterChromeOS::SetProfileDelegate(
     const BluetoothUUID& uuid,
     const dbus::ObjectPath& device_path,
-    bluez::BluetoothProfileServiceProvider::Delegate* delegate,
+    BluetoothProfileServiceProvider::Delegate* delegate,
     const ProfileRegisteredCallback& success_callback,
     const ErrorCompletionCallback& error_callback) {
   if (profiles_.find(uuid) == profiles_.end()) {
@@ -1157,7 +1140,7 @@
 
   // Set the discoverable_timeout property to zero so the adapter remains
   // discoverable forever.
-  bluez::BluezDBusManager::Get()
+  DBusThreadManager::Get()
       ->GetBluetoothAdapterClient()
       ->GetProperties(object_path_)
       ->discoverable_timeout.Set(
@@ -1231,7 +1214,7 @@
 
   // This is the first request to start device discovery.
   discovery_request_pending_ = true;
-  bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()->StartDiscovery(
+  DBusThreadManager::Get()->GetBluetoothAdapterClient()->StartDiscovery(
       object_path_,
       base::Bind(&BluetoothAdapterChromeOS::OnStartDiscovery,
                  weak_ptr_factory_.GetWeakPtr(), callback, error_callback),
@@ -1285,7 +1268,7 @@
   // discovery.
   DCHECK_EQ(num_discovery_sessions_, 1);
   discovery_request_pending_ = true;
-  bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()->StopDiscovery(
+  DBusThreadManager::Get()->GetBluetoothAdapterClient()->StopDiscovery(
       object_path_, base::Bind(&BluetoothAdapterChromeOS::OnStopDiscovery,
                                weak_ptr_factory_.GetWeakPtr(), callback),
       base::Bind(&BluetoothAdapterChromeOS::OnStopDiscoveryError,
@@ -1318,7 +1301,7 @@
 
   current_filter_.reset(discovery_filter.release());
 
-  bluez::BluetoothAdapterClient::DiscoveryFilter dbus_discovery_filter;
+  chromeos::BluetoothAdapterClient::DiscoveryFilter dbus_discovery_filter;
 
   if (current_filter_.get()) {
     uint16_t pathloss;
@@ -1353,14 +1336,12 @@
     }
   }
 
-  bluez::BluezDBusManager::Get()
-      ->GetBluetoothAdapterClient()
-      ->SetDiscoveryFilter(
-          object_path_, dbus_discovery_filter,
-          base::Bind(&BluetoothAdapterChromeOS::OnSetDiscoveryFilter,
-                     weak_ptr_factory_.GetWeakPtr(), callback, error_callback),
-          base::Bind(&BluetoothAdapterChromeOS::OnSetDiscoveryFilterError,
-                     weak_ptr_factory_.GetWeakPtr(), callback, error_callback));
+  DBusThreadManager::Get()->GetBluetoothAdapterClient()->SetDiscoveryFilter(
+      object_path_, dbus_discovery_filter,
+      base::Bind(&BluetoothAdapterChromeOS::OnSetDiscoveryFilter,
+                 weak_ptr_factory_.GetWeakPtr(), callback, error_callback),
+      base::Bind(&BluetoothAdapterChromeOS::OnSetDiscoveryFilterError,
+                 weak_ptr_factory_.GetWeakPtr(), callback, error_callback));
 }
 
 void BluetoothAdapterChromeOS::OnStartDiscovery(
@@ -1450,7 +1431,7 @@
   DCHECK(discovery_request_pending_);
   DCHECK_EQ(num_discovery_sessions_, 0);
 
-  bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()->StartDiscovery(
+  DBusThreadManager::Get()->GetBluetoothAdapterClient()->StartDiscovery(
       object_path_,
       base::Bind(&BluetoothAdapterChromeOS::OnStartDiscovery,
                  weak_ptr_factory_.GetWeakPtr(), callback, error_callback),
diff --git a/device/bluetooth/bluetooth_adapter_chromeos.h b/device/bluetooth/bluetooth_adapter_chromeos.h
index 53b271f6..46c634f 100644
--- a/device/bluetooth/bluetooth_adapter_chromeos.h
+++ b/device/bluetooth/bluetooth_adapter_chromeos.h
@@ -12,18 +12,18 @@
 #include <vector>
 
 #include "base/memory/weak_ptr.h"
+#include "chromeos/dbus/bluetooth_adapter_client.h"
+#include "chromeos/dbus/bluetooth_agent_service_provider.h"
+#include "chromeos/dbus/bluetooth_device_client.h"
+#include "chromeos/dbus/bluetooth_input_client.h"
+#include "chromeos/dbus/bluetooth_profile_manager_client.h"
+#include "chromeos/dbus/bluetooth_profile_service_provider.h"
 #include "dbus/object_path.h"
 #include "device/bluetooth/bluetooth_adapter.h"
 #include "device/bluetooth/bluetooth_audio_sink.h"
 #include "device/bluetooth/bluetooth_device.h"
 #include "device/bluetooth/bluetooth_discovery_session.h"
 #include "device/bluetooth/bluetooth_export.h"
-#include "device/bluetooth/dbus/bluetooth_adapter_client.h"
-#include "device/bluetooth/dbus/bluetooth_agent_service_provider.h"
-#include "device/bluetooth/dbus/bluetooth_device_client.h"
-#include "device/bluetooth/dbus/bluetooth_input_client.h"
-#include "device/bluetooth/dbus/bluetooth_profile_manager_client.h"
-#include "device/bluetooth/dbus/bluetooth_profile_service_provider.h"
 
 namespace base {
 class SequencedTaskRunner;
@@ -60,10 +60,10 @@
 // BluetoothChromeOSTest, Shutdown.
 class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS
     : public device::BluetoothAdapter,
-      public bluez::BluetoothAdapterClient::Observer,
-      public bluez::BluetoothDeviceClient::Observer,
-      public bluez::BluetoothInputClient::Observer,
-      public bluez::BluetoothAgentServiceProvider::Delegate {
+      public chromeos::BluetoothAdapterClient::Observer,
+      public chromeos::BluetoothDeviceClient::Observer,
+      public chromeos::BluetoothInputClient::Observer,
+      public chromeos::BluetoothAgentServiceProvider::Delegate {
  public:
   typedef base::Callback<void(const std::string& error_message)>
       ErrorCompletionCallback;
@@ -157,8 +157,8 @@
   // |error_callback| will be called.
   void UseProfile(const device::BluetoothUUID& uuid,
                   const dbus::ObjectPath& device_path,
-                  const bluez::BluetoothProfileManagerClient::Options& options,
-                  bluez::BluetoothProfileServiceProvider::Delegate* delegate,
+                  const BluetoothProfileManagerClient::Options& options,
+                  BluetoothProfileServiceProvider::Delegate* delegate,
                   const ProfileRegisteredCallback& success_callback,
                   const ErrorCompletionCallback& error_callback);
 
@@ -194,23 +194,23 @@
   BluetoothAdapterChromeOS();
   ~BluetoothAdapterChromeOS() override;
 
-  // bluez::BluetoothAdapterClient::Observer override.
+  // BluetoothAdapterClient::Observer override.
   void AdapterAdded(const dbus::ObjectPath& object_path) override;
   void AdapterRemoved(const dbus::ObjectPath& object_path) override;
   void AdapterPropertyChanged(const dbus::ObjectPath& object_path,
                               const std::string& property_name) override;
 
-  // bluez::BluetoothDeviceClient::Observer override.
+  // BluetoothDeviceClient::Observer override.
   void DeviceAdded(const dbus::ObjectPath& object_path) override;
   void DeviceRemoved(const dbus::ObjectPath& object_path) override;
   void DevicePropertyChanged(const dbus::ObjectPath& object_path,
                              const std::string& property_name) override;
 
-  // bluez::BluetoothInputClient::Observer override.
+  // BluetoothInputClient::Observer override.
   void InputPropertyChanged(const dbus::ObjectPath& object_path,
                             const std::string& property_name) override;
 
-  // bluez::BluetoothAgentServiceProvider::Delegate override.
+  // BluetoothAgentServiceProvider::Delegate override.
   void Released() override;
   void RequestPinCode(const dbus::ObjectPath& device_path,
                       const PinCodeCallback& callback) override;
@@ -333,12 +333,11 @@
   void OnRegisterProfile(const device::BluetoothUUID& uuid,
                          scoped_ptr<BluetoothAdapterProfileChromeOS> profile);
 
-  void SetProfileDelegate(
-      const device::BluetoothUUID& uuid,
-      const dbus::ObjectPath& device_path,
-      bluez::BluetoothProfileServiceProvider::Delegate* delegate,
-      const ProfileRegisteredCallback& success_callback,
-      const ErrorCompletionCallback& error_callback);
+  void SetProfileDelegate(const device::BluetoothUUID& uuid,
+                          const dbus::ObjectPath& device_path,
+                          BluetoothProfileServiceProvider::Delegate* delegate,
+                          const ProfileRegisteredCallback& success_callback,
+                          const ErrorCompletionCallback& error_callback);
   void OnRegisterProfileError(const device::BluetoothUUID& uuid,
                               const std::string& error_name,
                               const std::string& error_message);
@@ -378,7 +377,7 @@
 
   // Instance of the D-Bus agent object used for pairing, initialized with
   // our own class as its delegate.
-  scoped_ptr<bluez::BluetoothAgentServiceProvider> agent_;
+  scoped_ptr<BluetoothAgentServiceProvider> agent_;
 
   // UI thread task runner and socket thread object used to create sockets.
   scoped_refptr<base::SequencedTaskRunner> ui_task_runner_;
diff --git a/device/bluetooth/bluetooth_adapter_profile_chromeos.cc b/device/bluetooth/bluetooth_adapter_profile_chromeos.cc
index 27779f28..aeab2aef 100644
--- a/device/bluetooth/bluetooth_adapter_profile_chromeos.cc
+++ b/device/bluetooth/bluetooth_adapter_profile_chromeos.cc
@@ -9,31 +9,29 @@
 #include "base/bind.h"
 #include "base/logging.h"
 #include "base/strings/string_util.h"
+#include "chromeos/dbus/bluetooth_profile_service_provider.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
 #include "dbus/bus.h"
 #include "dbus/object_path.h"
 #include "device/bluetooth/bluetooth_adapter_chromeos.h"
 #include "device/bluetooth/bluetooth_uuid.h"
-#include "device/bluetooth/dbus/bluetooth_profile_service_provider.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
 
 namespace chromeos {
 
 // static
 void BluetoothAdapterProfileChromeOS::Register(
     const device::BluetoothUUID& uuid,
-    const bluez::BluetoothProfileManagerClient::Options& options,
+    const BluetoothProfileManagerClient::Options& options,
     const ProfileRegisteredCallback& success_callback,
-    const bluez::BluetoothProfileManagerClient::ErrorCallback& error_callback) {
+    const BluetoothProfileManagerClient::ErrorCallback& error_callback) {
   scoped_ptr<BluetoothAdapterProfileChromeOS> profile(
       new BluetoothAdapterProfileChromeOS(uuid));
 
   VLOG(1) << "Registering profile: " << profile->object_path().value();
   const dbus::ObjectPath& object_path = profile->object_path();
-  bluez::BluezDBusManager::Get()
-      ->GetBluetoothProfileManagerClient()
-      ->RegisterProfile(object_path, uuid.canonical_value(), options,
-                        base::Bind(success_callback, base::Passed(&profile)),
-                        error_callback);
+  DBusThreadManager::Get()->GetBluetoothProfileManagerClient()->RegisterProfile(
+      object_path, uuid.canonical_value(), options,
+      base::Bind(success_callback, base::Passed(&profile)), error_callback);
 }
 
 BluetoothAdapterProfileChromeOS::BluetoothAdapterProfileChromeOS(
@@ -44,9 +42,9 @@
   object_path_ =
       dbus::ObjectPath("/org/chromium/bluetooth_profile/" + uuid_path);
 
-  dbus::Bus* system_bus = bluez::BluezDBusManager::Get()->GetSystemBus();
-  profile_.reset(bluez::BluetoothProfileServiceProvider::Create(
-      system_bus, object_path_, this));
+  dbus::Bus* system_bus = DBusThreadManager::Get()->GetSystemBus();
+  profile_.reset(
+      BluetoothProfileServiceProvider::Create(system_bus, object_path_, this));
   DCHECK(profile_.get());
 }
 
@@ -55,7 +53,7 @@
 
 bool BluetoothAdapterProfileChromeOS::SetDelegate(
     const dbus::ObjectPath& device_path,
-    bluez::BluetoothProfileServiceProvider::Delegate* delegate) {
+    BluetoothProfileServiceProvider::Delegate* delegate) {
   DCHECK(delegate);
   VLOG(1) << "SetDelegate: " << object_path_.value() << " dev "
           << device_path.value();
@@ -85,7 +83,7 @@
   VLOG(1) << device_path.value() << " No delegates left, unregistering.";
 
   // No users left, release the profile.
-  bluez::BluezDBusManager::Get()
+  DBusThreadManager::Get()
       ->GetBluetoothProfileManagerClient()
       ->UnregisterProfile(
           object_path_, unregistered_callback,
@@ -104,7 +102,7 @@
   unregistered_callback.Run();
 }
 
-// bluez::BluetoothProfileServiceProvider::Delegate:
+// BluetoothProfileServiceProvider::Delegate:
 void BluetoothAdapterProfileChromeOS::Released() {
   VLOG(1) << object_path_.value() << ": Release";
 }
@@ -112,7 +110,7 @@
 void BluetoothAdapterProfileChromeOS::NewConnection(
     const dbus::ObjectPath& device_path,
     scoped_ptr<dbus::FileDescriptor> fd,
-    const bluez::BluetoothProfileServiceProvider::Delegate::Options& options,
+    const BluetoothProfileServiceProvider::Delegate::Options& options,
     const ConfirmationCallback& callback) {
   dbus::ObjectPath delegate_path = device_path;
 
diff --git a/device/bluetooth/bluetooth_adapter_profile_chromeos.h b/device/bluetooth/bluetooth_adapter_profile_chromeos.h
index 35971e8..85e2ffe 100644
--- a/device/bluetooth/bluetooth_adapter_profile_chromeos.h
+++ b/device/bluetooth/bluetooth_adapter_profile_chromeos.h
@@ -6,10 +6,10 @@
 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_PROFILE_CHROMEOS_H_
 
 #include "base/memory/weak_ptr.h"
+#include "chromeos/dbus/bluetooth_profile_manager_client.h"
+#include "chromeos/dbus/bluetooth_profile_service_provider.h"
 #include "device/bluetooth/bluetooth_adapter_chromeos.h"
 #include "device/bluetooth/bluetooth_export.h"
-#include "device/bluetooth/dbus/bluetooth_profile_manager_client.h"
-#include "device/bluetooth/dbus/bluetooth_profile_service_provider.h"
 
 namespace device {
 class BluetoothUUID;
@@ -28,7 +28,7 @@
 // BluetoothAdapterProfileChromeOS objects are owned by the
 // BluetoothAdapterChromeOS and allocated through Register()
 class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterProfileChromeOS
-    : public bluez::BluetoothProfileServiceProvider::Delegate {
+    : public chromeos::BluetoothProfileServiceProvider::Delegate {
  public:
   typedef base::Callback<void(scoped_ptr<BluetoothAdapterProfileChromeOS>
                                   profile)> ProfileRegisteredCallback;
@@ -39,10 +39,9 @@
   // will be called.
   static void Register(
       const device::BluetoothUUID& uuid,
-      const bluez::BluetoothProfileManagerClient::Options& options,
+      const BluetoothProfileManagerClient::Options& options,
       const ProfileRegisteredCallback& success_callback,
-      const bluez::BluetoothProfileManagerClient::ErrorCallback&
-          error_callback);
+      const BluetoothProfileManagerClient::ErrorCallback& error_callback);
 
   ~BluetoothAdapterProfileChromeOS() override;
 
@@ -57,7 +56,7 @@
   // Returns true if the delegate was set, and false if the |device_path|
   // already had a delegate set.
   bool SetDelegate(const dbus::ObjectPath& device_path,
-                   bluez::BluetoothProfileServiceProvider::Delegate* delegate);
+                   BluetoothProfileServiceProvider::Delegate* delegate);
 
   // Remove the delegate for a device. |unregistered_callback| will be called
   // if this unregisters the profile.
@@ -70,12 +69,12 @@
  private:
   BluetoothAdapterProfileChromeOS(const device::BluetoothUUID& uuid);
 
-  // bluez::BluetoothProfileServiceProvider::Delegate:
+  // BluetoothProfileServiceProvider::Delegate:
   void Released() override;
   void NewConnection(
       const dbus::ObjectPath& device_path,
       scoped_ptr<dbus::FileDescriptor> fd,
-      const bluez::BluetoothProfileServiceProvider::Delegate::Options& options,
+      const BluetoothProfileServiceProvider::Delegate::Options& options,
       const ConfirmationCallback& callback) override;
   void RequestDisconnection(const dbus::ObjectPath& device_path,
                             const ConfirmationCallback& callback) override;
@@ -87,8 +86,7 @@
                                 const std::string& error_message);
 
   // List of delegates which this profile is multiplexing to.
-  std::map<std::string, bluez::BluetoothProfileServiceProvider::Delegate*>
-      delegates_;
+  std::map<std::string, BluetoothProfileServiceProvider::Delegate*> delegates_;
 
   // The UUID that this profile represents.
   const device::BluetoothUUID& uuid_;
@@ -97,7 +95,7 @@
   dbus::ObjectPath object_path_;
 
   // Profile dbus object for receiving profile method calls from BlueZ
-  scoped_ptr<bluez::BluetoothProfileServiceProvider> profile_;
+  scoped_ptr<BluetoothProfileServiceProvider> profile_;
 
   // Note: This should remain the last member so it'll be destroyed and
   // invalidate its weak pointers before any other members are destroyed.
diff --git a/device/bluetooth/bluetooth_adapter_profile_chromeos_unittest.cc b/device/bluetooth/bluetooth_adapter_profile_chromeos_unittest.cc
index be999019..1b9c0b3 100644
--- a/device/bluetooth/bluetooth_adapter_profile_chromeos_unittest.cc
+++ b/device/bluetooth/bluetooth_adapter_profile_chromeos_unittest.cc
@@ -4,17 +4,17 @@
 
 #include "base/bind.h"
 #include "base/message_loop/message_loop.h"
+#include "chromeos/dbus/bluetooth_profile_service_provider.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
+#include "chromeos/dbus/fake_bluetooth_adapter_client.h"
+#include "chromeos/dbus/fake_bluetooth_agent_manager_client.h"
+#include "chromeos/dbus/fake_bluetooth_device_client.h"
+#include "chromeos/dbus/fake_bluetooth_profile_manager_client.h"
 #include "device/bluetooth/bluetooth_adapter.h"
 #include "device/bluetooth/bluetooth_adapter_chromeos.h"
 #include "device/bluetooth/bluetooth_adapter_factory.h"
 #include "device/bluetooth/bluetooth_adapter_profile_chromeos.h"
 #include "device/bluetooth/bluetooth_uuid.h"
-#include "device/bluetooth/dbus/bluetooth_profile_service_provider.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
-#include "device/bluetooth/dbus/fake_bluetooth_adapter_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_device_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_profile_manager_client.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 using device::BluetoothAdapter;
@@ -27,29 +27,25 @@
   BluetoothAdapterProfileChromeOSTest()
       : success_callback_count_(0),
         error_callback_count_(0),
-        fake_delegate_paired_(
-            bluez::FakeBluetoothDeviceClient::kPairedDevicePath),
-        fake_delegate_autopair_(
-            bluez::FakeBluetoothDeviceClient::kLegacyAutopairPath),
+        fake_delegate_paired_(FakeBluetoothDeviceClient::kPairedDevicePath),
+        fake_delegate_autopair_(FakeBluetoothDeviceClient::kLegacyAutopairPath),
         fake_delegate_listen_(""),
         profile_user_ptr_(nullptr) {}
 
   void SetUp() override {
-    scoped_ptr<bluez::BluezDBusManagerSetter> dbus_setter =
-        bluez::BluezDBusManager::GetSetterForTesting();
+    scoped_ptr<DBusThreadManagerSetter> dbus_setter =
+        DBusThreadManager::GetSetterForTesting();
 
     dbus_setter->SetBluetoothAdapterClient(
-        scoped_ptr<bluez::BluetoothAdapterClient>(
-            new bluez::FakeBluetoothAdapterClient));
+        scoped_ptr<BluetoothAdapterClient>(new FakeBluetoothAdapterClient));
     dbus_setter->SetBluetoothAgentManagerClient(
-        scoped_ptr<bluez::BluetoothAgentManagerClient>(
-            new bluez::FakeBluetoothAgentManagerClient));
+        scoped_ptr<BluetoothAgentManagerClient>(
+            new FakeBluetoothAgentManagerClient));
     dbus_setter->SetBluetoothDeviceClient(
-        scoped_ptr<bluez::BluetoothDeviceClient>(
-            new bluez::FakeBluetoothDeviceClient));
+        scoped_ptr<BluetoothDeviceClient>(new FakeBluetoothDeviceClient));
     dbus_setter->SetBluetoothProfileManagerClient(
-        scoped_ptr<bluez::BluetoothProfileManagerClient>(
-            new bluez::FakeBluetoothProfileManagerClient));
+        scoped_ptr<BluetoothProfileManagerClient>(
+            new FakeBluetoothProfileManagerClient));
 
     // Grab a pointer to the adapter.
     device::BluetoothAdapterFactory::GetAdapter(
@@ -68,20 +64,21 @@
   void TearDown() override {
     profile_.reset();
     adapter_ = nullptr;
-    bluez::BluezDBusManager::Shutdown();
+    DBusThreadManager::Shutdown();
   }
 
   void AdapterCallback(scoped_refptr<BluetoothAdapter> adapter) {
     adapter_ = adapter;
   }
 
-  class FakeDelegate : public bluez::BluetoothProfileServiceProvider::Delegate {
+  class FakeDelegate
+      : public chromeos::BluetoothProfileServiceProvider::Delegate {
    public:
     FakeDelegate(const std::string& device_path) : connections_(0) {
       device_path_ = dbus::ObjectPath(device_path);
     }
 
-    // bluez::BluetoothProfileServiceProvider::Delegate:
+    // BluetoothProfileServiceProvider::Delegate:
     void Released() override {
       // noop
     }
@@ -89,8 +86,7 @@
     void NewConnection(
         const dbus::ObjectPath& device_path,
         scoped_ptr<dbus::FileDescriptor> fd,
-        const bluez::BluetoothProfileServiceProvider::Delegate::Options&
-            options,
+        const BluetoothProfileServiceProvider::Delegate::Options& options,
         const ConfirmationCallback& callback) override {
       ++connections_;
       fd->CheckValidity();
@@ -161,8 +157,8 @@
 };
 
 TEST_F(BluetoothAdapterProfileChromeOSTest, DelegateCount) {
-  BluetoothUUID uuid(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid);
-  bluez::BluetoothProfileManagerClient::Options options;
+  BluetoothUUID uuid(FakeBluetoothProfileManagerClient::kRfcommUuid);
+  BluetoothProfileManagerClient::Options options;
 
   options.require_authentication.reset(new bool(false));
 
@@ -198,8 +194,8 @@
 }
 
 TEST_F(BluetoothAdapterProfileChromeOSTest, BlackHole) {
-  BluetoothUUID uuid(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid);
-  bluez::BluetoothProfileManagerClient::Options options;
+  BluetoothUUID uuid(FakeBluetoothProfileManagerClient::kRfcommUuid);
+  BluetoothProfileManagerClient::Options options;
 
   options.require_authentication.reset(new bool(false));
 
@@ -216,9 +212,9 @@
   EXPECT_EQ(1U, success_callback_count_);
   EXPECT_EQ(0U, error_callback_count_);
 
-  bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kPairedDevicePath),
-      bluez::FakeBluetoothProfileManagerClient::kRfcommUuid,
+  DBusThreadManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath),
+      FakeBluetoothProfileManagerClient::kRfcommUuid,
       base::Bind(
           &BluetoothAdapterProfileChromeOSTest::DBusConnectSuccessCallback,
           base::Unretained(this)),
@@ -234,8 +230,8 @@
 }
 
 TEST_F(BluetoothAdapterProfileChromeOSTest, Routing) {
-  BluetoothUUID uuid(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid);
-  bluez::BluetoothProfileManagerClient::Options options;
+  BluetoothUUID uuid(FakeBluetoothProfileManagerClient::kRfcommUuid);
+  BluetoothProfileManagerClient::Options options;
 
   options.require_authentication.reset(new bool(false));
 
@@ -259,9 +255,9 @@
   profile_->SetDelegate(fake_delegate_listen_.device_path_,
                         &fake_delegate_listen_);
 
-  bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kPairedDevicePath),
-      bluez::FakeBluetoothProfileManagerClient::kRfcommUuid,
+  DBusThreadManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath),
+      FakeBluetoothProfileManagerClient::kRfcommUuid,
       base::Bind(
           &BluetoothAdapterProfileChromeOSTest::DBusConnectSuccessCallback,
           base::Unretained(this)),
@@ -275,9 +271,9 @@
 
   EXPECT_EQ(1U, fake_delegate_paired_.connections_);
 
-  bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLegacyAutopairPath),
-      bluez::FakeBluetoothProfileManagerClient::kRfcommUuid,
+  DBusThreadManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kLegacyAutopairPath),
+      FakeBluetoothProfileManagerClient::kRfcommUuid,
       base::Bind(
           &BluetoothAdapterProfileChromeOSTest::DBusConnectSuccessCallback,
           base::Unretained(this)),
@@ -292,9 +288,9 @@
   EXPECT_EQ(1U, fake_delegate_autopair_.connections_);
 
   // Incoming connections look the same from BlueZ.
-  bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kDisplayPinCodePath),
-      bluez::FakeBluetoothProfileManagerClient::kRfcommUuid,
+  DBusThreadManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kDisplayPinCodePath),
+      FakeBluetoothProfileManagerClient::kRfcommUuid,
       base::Bind(
           &BluetoothAdapterProfileChromeOSTest::DBusConnectSuccessCallback,
           base::Unretained(this)),
@@ -310,8 +306,8 @@
 }
 
 TEST_F(BluetoothAdapterProfileChromeOSTest, SimultaneousRegister) {
-  BluetoothUUID uuid(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid);
-  bluez::BluetoothProfileManagerClient::Options options;
+  BluetoothUUID uuid(FakeBluetoothProfileManagerClient::kRfcommUuid);
+  BluetoothProfileManagerClient::Options options;
   BluetoothAdapterChromeOS* adapter =
       static_cast<BluetoothAdapterChromeOS*>(adapter_.get());
 
@@ -351,9 +347,8 @@
 }
 
 TEST_F(BluetoothAdapterProfileChromeOSTest, SimultaneousRegisterFail) {
-  BluetoothUUID uuid(
-      bluez::FakeBluetoothProfileManagerClient::kUnregisterableUuid);
-  bluez::BluetoothProfileManagerClient::Options options;
+  BluetoothUUID uuid(FakeBluetoothProfileManagerClient::kUnregisterableUuid);
+  BluetoothProfileManagerClient::Options options;
   BluetoothAdapterChromeOS* adapter =
       static_cast<BluetoothAdapterChromeOS*>(adapter_.get());
 
diff --git a/device/bluetooth/bluetooth_advertisement_chromeos.cc b/device/bluetooth/bluetooth_advertisement_chromeos.cc
index 671977dc..8cdfe90e 100644
--- a/device/bluetooth/bluetooth_advertisement_chromeos.cc
+++ b/device/bluetooth/bluetooth_advertisement_chromeos.cc
@@ -12,11 +12,11 @@
 #include "base/logging.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/strings/string_util.h"
+#include "chromeos/dbus/bluetooth_le_advertising_manager_client.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
 #include "dbus/bus.h"
 #include "dbus/object_path.h"
 #include "device/bluetooth/bluetooth_adapter_chromeos.h"
-#include "device/bluetooth/dbus/bluetooth_le_advertising_manager_client.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
 #include "third_party/cros_system_api/dbus/service_constants.h"
 
 namespace {
@@ -82,12 +82,10 @@
   dbus::ObjectPath advertisement_object_path =
       dbus::ObjectPath("/org/chromium/bluetooth_advertisement/" + GuidString);
 
-  DCHECK(bluez::BluezDBusManager::Get());
-  provider_ = bluez::BluetoothLEAdvertisementServiceProvider::Create(
-      bluez::BluezDBusManager::Get()->GetSystemBus(), advertisement_object_path,
-      this,
-      static_cast<
-          bluez::BluetoothLEAdvertisementServiceProvider::AdvertisementType>(
+  DCHECK(DBusThreadManager::Get());
+  provider_ = BluetoothLEAdvertisementServiceProvider::Create(
+      DBusThreadManager::Get()->GetSystemBus(), advertisement_object_path, this,
+      static_cast<BluetoothLEAdvertisementServiceProvider::AdvertisementType>(
           data->type()),
       data->service_uuids().Pass(), data->manufacturer_data().Pass(),
       data->solicit_uuids().Pass(), data->service_data().Pass());
@@ -97,8 +95,8 @@
     const base::Closure& success_callback,
     const device::BluetoothAdapter::CreateAdvertisementErrorCallback&
         error_callback) {
-  DCHECK(bluez::BluezDBusManager::Get());
-  bluez::BluezDBusManager::Get()
+  DCHECK(DBusThreadManager::Get());
+  DBusThreadManager::Get()
       ->GetBluetoothLEAdvertisingManagerClient()
       ->RegisterAdvertisement(
           adapter_->object_path(), provider_->object_path(), success_callback,
@@ -120,8 +118,8 @@
     return;
   }
 
-  DCHECK(bluez::BluezDBusManager::Get());
-  bluez::BluezDBusManager::Get()
+  DCHECK(DBusThreadManager::Get());
+  DBusThreadManager::Get()
       ->GetBluetoothLEAdvertisingManagerClient()
       ->UnregisterAdvertisement(
           adapter_->object_path(), provider_->object_path(), success_callback,
diff --git a/device/bluetooth/bluetooth_advertisement_chromeos.h b/device/bluetooth/bluetooth_advertisement_chromeos.h
index 44abec2..aeb59b7c 100644
--- a/device/bluetooth/bluetooth_advertisement_chromeos.h
+++ b/device/bluetooth/bluetooth_advertisement_chromeos.h
@@ -6,24 +6,21 @@
 #define DEVICE_BLUETOOTH_BLUETOOTH_ADVERTISEMENT_CHROMEOS_H_
 
 #include "base/macros.h"
+#include "chromeos/dbus/bluetooth_le_advertisement_service_provider.h"
 #include "device/bluetooth/bluetooth_adapter.h"
 #include "device/bluetooth/bluetooth_advertisement.h"
 #include "device/bluetooth/bluetooth_export.h"
-#include "device/bluetooth/dbus/bluetooth_le_advertisement_service_provider.h"
-
-namespace bluez {
-class BluetoothLEAdvertisementServiceProvider;
-}
 
 namespace chromeos {
 
+class BluetoothLEAdvertisementServiceProvider;
 class BluetoothAdapterChromeOS;
 
 // The BluetoothAdvertisementChromeOS class implements BluetoothAdvertisement
 // for the Chrome OS platform.
 class DEVICE_BLUETOOTH_EXPORT BluetoothAdvertisementChromeOS
     : public device::BluetoothAdvertisement,
-      public bluez::BluetoothLEAdvertisementServiceProvider::Delegate {
+      public BluetoothLEAdvertisementServiceProvider::Delegate {
  public:
   BluetoothAdvertisementChromeOS(
       scoped_ptr<device::BluetoothAdvertisement::Data> data,
@@ -33,7 +30,7 @@
   void Unregister(const SuccessCallback& success_callback,
                   const ErrorCallback& error_callback) override;
 
-  // bluez::BluetoothLEAdvertisementServiceProvider::Delegate overrides:
+  // BluetoothLEAdvertisementServiceProvider::Delegate overrides:
   void Released() override;
 
   void Register(
@@ -43,7 +40,7 @@
 
   // Used from tests to be able to trigger events on the fake advertisement
   // provider.
-  bluez::BluetoothLEAdvertisementServiceProvider* provider() {
+  BluetoothLEAdvertisementServiceProvider* provider() {
     return provider_.get();
   }
 
@@ -52,7 +49,7 @@
 
   // Adapter this advertisement is advertising on.
   scoped_refptr<BluetoothAdapterChromeOS> adapter_;
-  scoped_ptr<bluez::BluetoothLEAdvertisementServiceProvider> provider_;
+  scoped_ptr<BluetoothLEAdvertisementServiceProvider> provider_;
 
   DISALLOW_COPY_AND_ASSIGN(BluetoothAdvertisementChromeOS);
 };
diff --git a/device/bluetooth/bluetooth_advertisement_chromeos_unittest.cc b/device/bluetooth/bluetooth_advertisement_chromeos_unittest.cc
index 165dc8d9..02fe1e4a 100644
--- a/device/bluetooth/bluetooth_advertisement_chromeos_unittest.cc
+++ b/device/bluetooth/bluetooth_advertisement_chromeos_unittest.cc
@@ -9,12 +9,12 @@
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/message_loop/message_loop.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
+#include "chromeos/dbus/fake_bluetooth_le_advertisement_service_provider.h"
 #include "device/bluetooth/bluetooth_adapter.h"
 #include "device/bluetooth/bluetooth_adapter_factory.h"
 #include "device/bluetooth/bluetooth_advertisement.h"
 #include "device/bluetooth/bluetooth_advertisement_chromeos.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
-#include "device/bluetooth/dbus/fake_bluetooth_le_advertisement_service_provider.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 using device::BluetoothAdapter;
@@ -52,7 +52,7 @@
 class BluetoothAdvertisementChromeOSTest : public testing::Test {
  public:
   void SetUp() override {
-    bluez::BluezDBusManager::Initialize(NULL, true);
+    DBusThreadManager::Initialize();
 
     callback_count_ = 0;
     error_callback_count_ = 0;
@@ -70,7 +70,7 @@
     // The adapter should outlive the advertisement.
     advertisement_ = nullptr;
     adapter_ = nullptr;
-    bluez::BluezDBusManager::Shutdown();
+    DBusThreadManager::Shutdown();
   }
 
   // Gets the existing Bluetooth adapter.
@@ -134,8 +134,8 @@
   void TriggerReleased(scoped_refptr<BluetoothAdvertisement> advertisement) {
     BluetoothAdvertisementChromeOS* adv =
         static_cast<BluetoothAdvertisementChromeOS*>(advertisement.get());
-    bluez::FakeBluetoothLEAdvertisementServiceProvider* provider =
-        static_cast<bluez::FakeBluetoothLEAdvertisementServiceProvider*>(
+    FakeBluetoothLEAdvertisementServiceProvider* provider =
+        static_cast<FakeBluetoothLEAdvertisementServiceProvider*>(
             adv->provider());
     provider->Release();
   }
diff --git a/device/bluetooth/bluetooth_audio_sink_chromeos.cc b/device/bluetooth/bluetooth_audio_sink_chromeos.cc
index 9bb4b60..18ab219 100644
--- a/device/bluetooth/bluetooth_audio_sink_chromeos.cc
+++ b/device/bluetooth/bluetooth_audio_sink_chromeos.cc
@@ -14,9 +14,9 @@
 #include "base/debug/stack_trace.h"
 #include "base/files/file_util.h"
 #include "base/logging.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
 #include "dbus/message.h"
 #include "device/bluetooth/bluetooth_adapter_chromeos.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
 
 using dbus::ObjectPath;
 using device::BluetoothAudioSink;
@@ -94,17 +94,17 @@
 
   CHECK(adapter_.get());
   CHECK(adapter_->IsPresent());
-  CHECK(bluez::BluezDBusManager::IsInitialized());
+  CHECK(DBusThreadManager::IsInitialized());
 
   adapter_->AddObserver(this);
 
-  bluez::BluetoothMediaClient* media =
-      bluez::BluezDBusManager::Get()->GetBluetoothMediaClient();
+  BluetoothMediaClient* media =
+      DBusThreadManager::Get()->GetBluetoothMediaClient();
   CHECK(media);
   media->AddObserver(this);
 
-  bluez::BluetoothMediaTransportClient* transport =
-      bluez::BluezDBusManager::Get()->GetBluetoothMediaTransportClient();
+  BluetoothMediaTransportClient* transport =
+      DBusThreadManager::Get()->GetBluetoothMediaTransportClient();
   CHECK(transport);
   transport->AddObserver(this);
 
@@ -123,13 +123,13 @@
 
   adapter_->RemoveObserver(this);
 
-  bluez::BluetoothMediaClient* media =
-      bluez::BluezDBusManager::Get()->GetBluetoothMediaClient();
+  BluetoothMediaClient* media =
+      DBusThreadManager::Get()->GetBluetoothMediaClient();
   CHECK(media);
   media->RemoveObserver(this);
 
-  bluez::BluetoothMediaTransportClient* transport =
-      bluez::BluezDBusManager::Get()->GetBluetoothMediaTransportClient();
+  BluetoothMediaTransportClient* transport =
+      DBusThreadManager::Get()->GetBluetoothMediaTransportClient();
   CHECK(transport);
   transport->RemoveObserver(this);
 }
@@ -139,11 +139,11 @@
     const device::BluetoothAudioSink::ErrorCallback& error_callback) {
   VLOG(1) << "Unregister";
 
-  if (!bluez::BluezDBusManager::IsInitialized())
+  if (!DBusThreadManager::IsInitialized())
     error_callback.Run(BluetoothAudioSink::ERROR_NOT_UNREGISTERED);
 
-  bluez::BluetoothMediaClient* media =
-      bluez::BluezDBusManager::Get()->GetBluetoothMediaClient();
+  BluetoothMediaClient* media =
+      DBusThreadManager::Get()->GetBluetoothMediaClient();
   CHECK(media);
 
   media->UnregisterEndpoint(
@@ -185,28 +185,27 @@
   DCHECK_EQ(state_, BluetoothAudioSink::STATE_DISCONNECTED);
 
   // Gets system bus.
-  dbus::Bus* system_bus = bluez::BluezDBusManager::Get()->GetSystemBus();
+  dbus::Bus* system_bus = DBusThreadManager::Get()->GetSystemBus();
 
   // Creates a Media Endpoint with newly-generated path.
   endpoint_path_ = GenerateEndpointPath();
-  media_endpoint_.reset(bluez::BluetoothMediaEndpointServiceProvider::Create(
+  media_endpoint_.reset(BluetoothMediaEndpointServiceProvider::Create(
       system_bus, endpoint_path_, this));
 
   DCHECK(media_endpoint_.get());
 
   // Creates endpoint properties with |options|.
   options_ = options;
-  bluez::BluetoothMediaClient::EndpointProperties endpoint_properties;
-  endpoint_properties.uuid =
-      bluez::BluetoothMediaClient::kBluetoothAudioSinkUUID;
+  chromeos::BluetoothMediaClient::EndpointProperties endpoint_properties;
+  endpoint_properties.uuid = BluetoothMediaClient::kBluetoothAudioSinkUUID;
   endpoint_properties.codec = options_.codec;
   endpoint_properties.capabilities = options_.capabilities;
 
   media_path_ = static_cast<BluetoothAdapterChromeOS*>(
       adapter_.get())->object_path();
 
-  bluez::BluetoothMediaClient* media =
-      bluez::BluezDBusManager::Get()->GetBluetoothMediaClient();
+  BluetoothMediaClient* media =
+      DBusThreadManager::Get()->GetBluetoothMediaClient();
   CHECK(media);
   media->RegisterEndpoint(
       media_path_,
@@ -218,7 +217,7 @@
                  weak_ptr_factory_.GetWeakPtr(), error_callback));
 }
 
-bluez::BluetoothMediaEndpointServiceProvider*
+BluetoothMediaEndpointServiceProvider*
 BluetoothAudioSinkChromeOS::GetEndpointServiceProvider() {
   return media_endpoint_.get();
 }
@@ -280,21 +279,21 @@
   VLOG(1) << "MediaTransportPropertyChanged: " << property_name;
 
   // Retrieves the property set of the transport object with |object_path|.
-  bluez::BluetoothMediaTransportClient::Properties* properties =
-      bluez::BluezDBusManager::Get()
+  BluetoothMediaTransportClient::Properties* properties =
+      DBusThreadManager::Get()
           ->GetBluetoothMediaTransportClient()
           ->GetProperties(object_path);
 
   // Dispatches a property changed event to the corresponding handler.
   if (property_name == properties->state.name()) {
     if (properties->state.value() ==
-        bluez::BluetoothMediaTransportClient::kStateIdle) {
+        BluetoothMediaTransportClient::kStateIdle) {
       StateChanged(BluetoothAudioSink::STATE_IDLE);
     } else if (properties->state.value() ==
-               bluez::BluetoothMediaTransportClient::kStatePending) {
+               BluetoothMediaTransportClient::kStatePending) {
       StateChanged(BluetoothAudioSink::STATE_PENDING);
     } else if (properties->state.value() ==
-               bluez::BluetoothMediaTransportClient::kStateActive) {
+               BluetoothMediaTransportClient::kStateActive) {
       StateChanged(BluetoothAudioSink::STATE_ACTIVE);
     }
   } else if (property_name == properties->volume.name()) {
@@ -309,7 +308,7 @@
   transport_path_ = transport_path;
 
   // The initial state for a connection should be "idle".
-  if (properties.state != bluez::BluetoothMediaTransportClient::kStateIdle) {
+  if (properties.state != BluetoothMediaTransportClient::kStateIdle) {
     VLOG(1) << "SetConfiugration - unexpected state :" << properties.state;
     return;
   }
@@ -356,7 +355,7 @@
 
   read_has_failed_ = false;
 
-  bluez::BluezDBusManager::Get()->GetBluetoothMediaTransportClient()->Acquire(
+  DBusThreadManager::Get()->GetBluetoothMediaTransportClient()->Acquire(
       transport_path_,
       base::Bind(&BluetoothAudioSinkChromeOS::OnAcquireSucceeded,
                  weak_ptr_factory_.GetWeakPtr()),
diff --git a/device/bluetooth/bluetooth_audio_sink_chromeos.h b/device/bluetooth/bluetooth_audio_sink_chromeos.h
index 750b31d..6261ace2 100644
--- a/device/bluetooth/bluetooth_audio_sink_chromeos.h
+++ b/device/bluetooth/bluetooth_audio_sink_chromeos.h
@@ -14,14 +14,14 @@
 #include "base/memory/weak_ptr.h"
 #include "base/message_loop/message_loop.h"
 #include "base/observer_list.h"
+#include "chromeos/dbus/bluetooth_media_client.h"
+#include "chromeos/dbus/bluetooth_media_endpoint_service_provider.h"
+#include "chromeos/dbus/bluetooth_media_transport_client.h"
 #include "dbus/file_descriptor.h"
 #include "dbus/object_path.h"
 #include "device/bluetooth/bluetooth_adapter.h"
 #include "device/bluetooth/bluetooth_audio_sink.h"
 #include "device/bluetooth/bluetooth_export.h"
-#include "device/bluetooth/dbus/bluetooth_media_client.h"
-#include "device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.h"
-#include "device/bluetooth/dbus/bluetooth_media_transport_client.h"
 
 namespace chromeos {
 
@@ -30,9 +30,9 @@
 class DEVICE_BLUETOOTH_EXPORT BluetoothAudioSinkChromeOS
     : public device::BluetoothAudioSink,
       public device::BluetoothAdapter::Observer,
-      public bluez::BluetoothMediaClient::Observer,
-      public bluez::BluetoothMediaTransportClient::Observer,
-      public bluez::BluetoothMediaEndpointServiceProvider::Delegate,
+      public BluetoothMediaClient::Observer,
+      public BluetoothMediaTransportClient::Observer,
+      public BluetoothMediaEndpointServiceProvider::Delegate,
       public base::MessageLoopForIO::Watcher {
  public:
   explicit BluetoothAudioSinkChromeOS(
@@ -61,7 +61,7 @@
 
   // Returns a pointer to the media endpoint object. This function should be
   // used for testing purpose only.
-  bluez::BluetoothMediaEndpointServiceProvider* GetEndpointServiceProvider();
+  BluetoothMediaEndpointServiceProvider* GetEndpointServiceProvider();
 
  private:
   ~BluetoothAudioSinkChromeOS() override;
@@ -72,15 +72,15 @@
   void AdapterPoweredChanged(device::BluetoothAdapter* adapter,
                              bool powered) override;
 
-  // bluez::BluetoothMediaClient::Observer overrides.
+  // BluetoothMediaClient::Observer overrides.
   void MediaRemoved(const dbus::ObjectPath& object_path) override;
 
-  // bluez::BluetoothMediaTransportClient::Observer overrides.
+  // BluetoothMediaTransportClient::Observer overrides.
   void MediaTransportRemoved(const dbus::ObjectPath& object_path) override;
   void MediaTransportPropertyChanged(const dbus::ObjectPath& object_path,
                                      const std::string& property_name) override;
 
-  // bluez::BluetoothMediaEndpointServiceProvider::Delegate overrides.
+  // BluetoothMediaEndpointServiceProvider::Delegate overrides.
   void SetConfiguration(const dbus::ObjectPath& transport_path,
                         const TransportProperties& properties) override;
   void SelectConfiguration(
@@ -204,7 +204,7 @@
   device::BluetoothAudioSink::Options options_;
 
   // Media Endpoint object owned by the audio sink object.
-  scoped_ptr<bluez::BluetoothMediaEndpointServiceProvider> media_endpoint_;
+  scoped_ptr<BluetoothMediaEndpointServiceProvider> media_endpoint_;
 
   // List of observers interested in event notifications from us. Objects in
   // |observers_| are expected to outlive a BluetoothAudioSinkChromeOS object.
diff --git a/device/bluetooth/bluetooth_audio_sink_chromeos_unittest.cc b/device/bluetooth/bluetooth_audio_sink_chromeos_unittest.cc
index 5f51cb8a0..a585f3d4 100644
--- a/device/bluetooth/bluetooth_audio_sink_chromeos_unittest.cc
+++ b/device/bluetooth/bluetooth_audio_sink_chromeos_unittest.cc
@@ -8,21 +8,20 @@
 #include "base/logging.h"
 #include "base/memory/ref_counted.h"
 #include "base/message_loop/message_loop.h"
+#include "chromeos/dbus/bluetooth_media_client.h"
+#include "chromeos/dbus/bluetooth_media_endpoint_service_provider.h"
+#include "chromeos/dbus/bluetooth_media_transport_client.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
+#include "chromeos/dbus/fake_bluetooth_media_client.h"
+#include "chromeos/dbus/fake_bluetooth_media_endpoint_service_provider.h"
+#include "chromeos/dbus/fake_bluetooth_media_transport_client.h"
 #include "dbus/object_path.h"
 #include "device/bluetooth/bluetooth_adapter.h"
 #include "device/bluetooth/bluetooth_adapter_factory.h"
 #include "device/bluetooth/bluetooth_audio_sink.h"
 #include "device/bluetooth/bluetooth_audio_sink_chromeos.h"
-#include "device/bluetooth/dbus/bluetooth_media_client.h"
-#include "device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.h"
-#include "device/bluetooth/dbus/bluetooth_media_transport_client.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
-#include "device/bluetooth/dbus/fake_bluetooth_media_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_media_endpoint_service_provider.h"
-#include "device/bluetooth/dbus/fake_bluetooth_media_transport_client.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
-using bluez::FakeBluetoothMediaTransportClient;
 using dbus::ObjectPath;
 using device::BluetoothAdapter;
 using device::BluetoothAdapterFactory;
@@ -82,26 +81,26 @@
 class BluetoothAudioSinkChromeOSTest : public testing::Test {
  public:
   void SetUp() override {
-    bluez::BluezDBusManager::Initialize(NULL, true);
+    DBusThreadManager::Initialize();
 
     callback_count_ = 0;
     error_callback_count_ = 0;
 
-    fake_media_ = static_cast<bluez::FakeBluetoothMediaClient*>(
-        bluez::BluezDBusManager::Get()->GetBluetoothMediaClient());
+    fake_media_ = static_cast<FakeBluetoothMediaClient*>(
+        DBusThreadManager::Get()->GetBluetoothMediaClient());
     fake_transport_ = static_cast<FakeBluetoothMediaTransportClient*>(
-        bluez::BluezDBusManager::Get()->GetBluetoothMediaTransportClient());
+        DBusThreadManager::Get()->GetBluetoothMediaTransportClient());
 
     // Initiates Delegate::TransportProperties with default values.
     properties_.device =
         ObjectPath(FakeBluetoothMediaTransportClient::kTransportDevicePath);
-    properties_.uuid = bluez::BluetoothMediaClient::kBluetoothAudioSinkUUID;
+    properties_.uuid = BluetoothMediaClient::kBluetoothAudioSinkUUID;
     properties_.codec = FakeBluetoothMediaTransportClient::kTransportCodec;
     properties_.configuration = std::vector<uint8_t>(
         FakeBluetoothMediaTransportClient::kTransportConfiguration,
         FakeBluetoothMediaTransportClient::kTransportConfiguration +
             FakeBluetoothMediaTransportClient::kTransportConfigurationLength);
-    properties_.state = bluez::BluetoothMediaTransportClient::kStateIdle;
+    properties_.state = BluetoothMediaTransportClient::kStateIdle;
     properties_.delay.reset(
         new uint16_t(FakeBluetoothMediaTransportClient::kTransportDelay));
     properties_.volume.reset(
@@ -120,7 +119,7 @@
     // The adapter should outlive audio sink.
     audio_sink_ = nullptr;
     adapter_ = nullptr;
-    bluez::BluezDBusManager::Shutdown();
+    DBusThreadManager::Shutdown();
   }
 
   // Gets the existing Bluetooth adapter.
@@ -181,9 +180,8 @@
         static_cast<BluetoothAudioSinkChromeOS*>(audio_sink_.get());
     ASSERT_NE(audio_sink_chromeos, nullptr);
 
-    media_endpoint_ =
-        static_cast<bluez::FakeBluetoothMediaEndpointServiceProvider*>(
-            audio_sink_chromeos->GetEndpointServiceProvider());
+    media_endpoint_ = static_cast<FakeBluetoothMediaEndpointServiceProvider*>(
+        audio_sink_chromeos->GetEndpointServiceProvider());
   }
 
   // Called whenever RegisterAudioSink is completed successfully.
@@ -235,16 +233,16 @@
 
   base::MessageLoopForIO message_loop_;
 
-  bluez::FakeBluetoothMediaClient* fake_media_;
+  FakeBluetoothMediaClient* fake_media_;
   FakeBluetoothMediaTransportClient* fake_transport_;
-  bluez::FakeBluetoothMediaEndpointServiceProvider* media_endpoint_;
+  FakeBluetoothMediaEndpointServiceProvider* media_endpoint_;
   scoped_ptr<TestAudioSinkObserver> observer_;
   scoped_refptr<BluetoothAdapter> adapter_;
   scoped_refptr<BluetoothAudioSink> audio_sink_;
 
   // The default property set used while calling SetConfiguration on a media
   // endpoint object.
-  bluez::BluetoothMediaEndpointServiceProvider::Delegate::TransportProperties
+  BluetoothMediaEndpointServiceProvider::Delegate::TransportProperties
       properties_;
 };
 
diff --git a/device/bluetooth/bluetooth_chromeos_unittest.cc b/device/bluetooth/bluetooth_chromeos_unittest.cc
index cea92d9..49b5b59 100644
--- a/device/bluetooth/bluetooth_chromeos_unittest.cc
+++ b/device/bluetooth/bluetooth_chromeos_unittest.cc
@@ -6,6 +6,12 @@
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
 #include "base/strings/utf_string_conversions.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
+#include "chromeos/dbus/fake_bluetooth_adapter_client.h"
+#include "chromeos/dbus/fake_bluetooth_agent_manager_client.h"
+#include "chromeos/dbus/fake_bluetooth_device_client.h"
+#include "chromeos/dbus/fake_bluetooth_gatt_service_client.h"
+#include "chromeos/dbus/fake_bluetooth_input_client.h"
 #include "dbus/object_path.h"
 #include "device/bluetooth/bluetooth_adapter.h"
 #include "device/bluetooth/bluetooth_adapter_chromeos.h"
@@ -14,12 +20,6 @@
 #include "device/bluetooth/bluetooth_device_chromeos.h"
 #include "device/bluetooth/bluetooth_discovery_session.h"
 #include "device/bluetooth/bluetooth_pairing_chromeos.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
-#include "device/bluetooth/dbus/fake_bluetooth_adapter_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_device_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_gatt_service_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_input_client.h"
 #include "device/bluetooth/test/test_bluetooth_adapter_observer.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/cros_system_api/dbus/service_constants.h"
@@ -57,18 +57,17 @@
 }
 
 class FakeBluetoothProfileServiceProviderDelegate
-    : public bluez::BluetoothProfileServiceProvider::Delegate {
+    : public chromeos::BluetoothProfileServiceProvider::Delegate {
  public:
   FakeBluetoothProfileServiceProviderDelegate() {}
 
-  // bluez::BluetoothProfileServiceProvider::Delegate:
+  // BluetoothProfileServiceProvider::Delegate:
   void Released() override {}
 
-  void NewConnection(
-      const dbus::ObjectPath&,
-      scoped_ptr<dbus::FileDescriptor>,
-      const bluez::BluetoothProfileServiceProvider::Delegate::Options&,
-      const ConfirmationCallback&) override {}
+  void NewConnection(const dbus::ObjectPath&,
+                     scoped_ptr<dbus::FileDescriptor>,
+                     const BluetoothProfileServiceProvider::Delegate::Options&,
+                     const ConfirmationCallback&) override {}
 
   void RequestDisconnection(const dbus::ObjectPath&,
                             const ConfirmationCallback&) override {}
@@ -166,28 +165,25 @@
 class BluetoothChromeOSTest : public testing::Test {
  public:
   void SetUp() override {
-    scoped_ptr<bluez::BluezDBusManagerSetter> dbus_setter =
-        bluez::BluezDBusManager::GetSetterForTesting();
-    // We need to initialize BluezDBusManager early to prevent
+    scoped_ptr<DBusThreadManagerSetter> dbus_setter =
+        chromeos::DBusThreadManager::GetSetterForTesting();
+    // We need to initialize DBusThreadManager early to prevent
     // Bluetooth*::Create() methods from picking the real instead of fake
     // implementations.
-    fake_bluetooth_adapter_client_ = new bluez::FakeBluetoothAdapterClient;
+    fake_bluetooth_adapter_client_ = new FakeBluetoothAdapterClient;
     dbus_setter->SetBluetoothAdapterClient(
-        scoped_ptr<bluez::BluetoothAdapterClient>(
-            fake_bluetooth_adapter_client_));
-    fake_bluetooth_device_client_ = new bluez::FakeBluetoothDeviceClient;
+        scoped_ptr<BluetoothAdapterClient>(fake_bluetooth_adapter_client_));
+    fake_bluetooth_device_client_ = new FakeBluetoothDeviceClient;
     dbus_setter->SetBluetoothDeviceClient(
-        scoped_ptr<bluez::BluetoothDeviceClient>(
-            fake_bluetooth_device_client_));
+        scoped_ptr<BluetoothDeviceClient>(fake_bluetooth_device_client_));
     dbus_setter->SetBluetoothInputClient(
-        scoped_ptr<bluez::BluetoothInputClient>(
-            new bluez::FakeBluetoothInputClient));
+        scoped_ptr<BluetoothInputClient>(new FakeBluetoothInputClient));
     dbus_setter->SetBluetoothAgentManagerClient(
-        scoped_ptr<bluez::BluetoothAgentManagerClient>(
-            new bluez::FakeBluetoothAgentManagerClient));
+        scoped_ptr<BluetoothAgentManagerClient>(
+            new FakeBluetoothAgentManagerClient));
     dbus_setter->SetBluetoothGattServiceClient(
-        scoped_ptr<bluez::BluetoothGattServiceClient>(
-            new bluez::FakeBluetoothGattServiceClient));
+        scoped_ptr<BluetoothGattServiceClient>(
+            new FakeBluetoothGattServiceClient));
 
     fake_bluetooth_adapter_client_->SetSimulationIntervalMs(10);
 
@@ -212,7 +208,7 @@
     }
     discovery_sessions_.clear();
     adapter_ = nullptr;
-    bluez::BluezDBusManager::Shutdown();
+    DBusThreadManager::Shutdown();
   }
 
   // Generic callbacks
@@ -341,8 +337,8 @@
 
  protected:
   base::MessageLoop message_loop_;
-  bluez::FakeBluetoothAdapterClient* fake_bluetooth_adapter_client_;
-  bluez::FakeBluetoothDeviceClient* fake_bluetooth_device_client_;
+  FakeBluetoothAdapterClient* fake_bluetooth_adapter_client_;
+  FakeBluetoothDeviceClient* fake_bluetooth_device_client_;
   scoped_refptr<BluetoothAdapter> adapter_;
 
   int callback_count_;
@@ -370,7 +366,7 @@
   // and initializes with an existing adapter if there is one.
   EXPECT_TRUE(adapter_->IsPresent());
   EXPECT_FALSE(adapter_->IsPowered());
-  EXPECT_EQ(bluez::FakeBluetoothAdapterClient::kAdapterAddress,
+  EXPECT_EQ(FakeBluetoothAdapterClient::kAdapterAddress,
             adapter_->GetAddress());
   EXPECT_FALSE(adapter_->IsDiscovering());
 
@@ -379,14 +375,12 @@
   EXPECT_EQ(2U, devices.size());
 
   // |devices| are not ordered, verify it contains the 2 device addresses.
-  EXPECT_NE(
-      -1, GetDeviceIndexByAddress(
-              devices, bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress));
-  EXPECT_NE(
-      -1,
-      GetDeviceIndexByAddress(
-          devices,
-          bluez::FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress));
+  EXPECT_NE(-1, GetDeviceIndexByAddress(
+                    devices, FakeBluetoothDeviceClient::kPairedDeviceAddress));
+  EXPECT_NE(-1,
+            GetDeviceIndexByAddress(
+                devices,
+                FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress));
 }
 
 TEST_F(BluetoothChromeOSTest, BecomePresent) {
@@ -407,7 +401,7 @@
 
   // We should have had a device announced.
   EXPECT_EQ(2, observer.device_added_count());
-  EXPECT_EQ(bluez::FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress,
+  EXPECT_EQ(FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress,
             observer.last_device_address());
 
   // Other callbacks shouldn't be called if the values are false.
@@ -436,10 +430,10 @@
   EXPECT_EQ(2, observer.device_removed_count());
   // 2 possibilities for the last device here.
   std::string address = observer.last_device_address();
-  EXPECT_TRUE(address.compare(bluez::FakeBluetoothDeviceClient::
-                                  kPairedUnconnectableDeviceAddress) == 0 ||
-              address.compare(
-                  bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress) == 0);
+  EXPECT_TRUE(
+      address.compare(
+          FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress) == 0 ||
+      address.compare(FakeBluetoothDeviceClient::kPairedDeviceAddress) == 0);
 
   // Other callbacks shouldn't be called since the values are false.
   EXPECT_EQ(0, observer.powered_changed_count());
@@ -461,7 +455,7 @@
   EXPECT_EQ(0, observer.present_changed_count());
 
   EXPECT_TRUE(adapter_->IsPresent());
-  EXPECT_EQ(bluez::FakeBluetoothAdapterClient::kAdapterAddress,
+  EXPECT_EQ(FakeBluetoothAdapterClient::kAdapterAddress,
             adapter_->GetAddress());
 
   // Try removing the first adapter, we should now act as if the adapter
@@ -478,10 +472,10 @@
   // As BluetoothAdapter devices removal does not keep the order of adding them,
   // 2 possibilities for the last device here.
   std::string address = observer.last_device_address();
-  EXPECT_TRUE(address.compare(bluez::FakeBluetoothDeviceClient::
-                                  kPairedUnconnectableDeviceAddress) == 0 ||
-              address.compare(
-                  bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress) == 0);
+  EXPECT_TRUE(
+      address.compare(
+          FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress) == 0 ||
+      address.compare(FakeBluetoothDeviceClient::kPairedDeviceAddress) == 0);
 
   // Other callbacks shouldn't be called since the values are false.
   EXPECT_EQ(0, observer.powered_changed_count());
@@ -751,7 +745,7 @@
   message_loop_.Run();
 
   EXPECT_EQ(2, observer.device_added_count());
-  EXPECT_EQ(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress,
+  EXPECT_EQ(FakeBluetoothDeviceClient::kLowEnergyAddress,
             observer.last_device_address());
 
   // Next we should get another two devices...
@@ -763,7 +757,7 @@
     message_loop_.Run();
 
   EXPECT_EQ(1, observer.device_removed_count());
-  EXPECT_EQ(bluez::FakeBluetoothDeviceClient::kVanishingDeviceAddress,
+  EXPECT_EQ(FakeBluetoothDeviceClient::kVanishingDeviceAddress,
             observer.last_device_address());
 }
 
@@ -783,7 +777,7 @@
 
   // Stop the timers that the simulation uses
   fake_bluetooth_device_client_->EndDiscoverySimulation(
-      dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath));
+      dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath));
 
   ASSERT_TRUE(adapter_->IsPowered());
   ASSERT_TRUE(adapter_->IsDiscovering());
@@ -977,23 +971,21 @@
 
   // Stop the timers that the simulation uses
   fake_bluetooth_device_client_->EndDiscoverySimulation(
-      dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath));
+      dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath));
 
   ASSERT_TRUE(adapter_->IsPowered());
   ASSERT_TRUE(adapter_->IsDiscovering());
 
   // Stop device discovery behind the adapter. The adapter and the observer
   // should be notified of the change and the reference count should be reset.
-  // Even though bluez::FakeBluetoothAdapterClient does its own reference
-  // counting and
+  // Even though FakeBluetoothAdapterClient does its own reference counting and
   // we called 3 BluetoothAdapter::StartDiscoverySession 3 times, the
-  // bluez::FakeBluetoothAdapterClient's count should be only 1 and a single
-  // call to
-  // bluez::FakeBluetoothAdapterClient::StopDiscovery should work.
+  // FakeBluetoothAdapterClient's count should be only 1 and a single call to
+  // FakeBluetoothAdapterClient::StopDiscovery should work.
   fake_bluetooth_adapter_client_->StopDiscovery(
-      dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
-      GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
-                                base::Unretained(this)));
+      dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), GetCallback(),
+      base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
+                 base::Unretained(this)));
   message_loop_.Run();
   EXPECT_EQ(2, observer.discovering_changed_count());
   EXPECT_EQ(4, callback_count_);
@@ -1026,7 +1018,7 @@
     EXPECT_TRUE(discovery_sessions_[i]->IsActive());
 
   fake_bluetooth_device_client_->EndDiscoverySimulation(
-      dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath));
+      dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath));
 
   // Make the adapter disappear and appear. This will make it come back as
   // discovering. When this happens, the reference count should become and
@@ -1051,8 +1043,7 @@
   EXPECT_TRUE(observer.last_discovering());
   EXPECT_TRUE(adapter_->IsDiscovering());
 
-  // Start and stop discovery. At this point, bluez::FakeBluetoothAdapterClient
-  // has
+  // Start and stop discovery. At this point, FakeBluetoothAdapterClient has
   // a reference count that is equal to 1. Pretend that this was done by an
   // application other than us. Starting and stopping discovery will succeed
   // but it won't cause the discovery state to change.
@@ -1097,9 +1088,9 @@
   // the discovery state won't change since our BluetoothAdapter also just
   // requested it via D-Bus.
   fake_bluetooth_adapter_client_->StopDiscovery(
-      dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
-      GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
-                                base::Unretained(this)));
+      dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), GetCallback(),
+      base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
+                 base::Unretained(this)));
   message_loop_.Run();
   EXPECT_EQ(5, observer.discovering_changed_count());
   EXPECT_EQ(10, callback_count_);
@@ -1158,7 +1149,7 @@
 
   // Stop the timers that the simulation uses
   fake_bluetooth_device_client_->EndDiscoverySimulation(
-      dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath));
+      dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath));
 
   ASSERT_TRUE(adapter_->IsPowered());
   ASSERT_TRUE(adapter_->IsDiscovering());
@@ -1175,9 +1166,9 @@
   // memory errors as the sessions that we explicitly deleted should get
   // cleaned up.
   fake_bluetooth_adapter_client_->StopDiscovery(
-      dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
-      GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
-                                base::Unretained(this)));
+      dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), GetCallback(),
+      base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
+                 base::Unretained(this)));
   message_loop_.Run();
   EXPECT_EQ(2, observer.discovering_changed_count());
   EXPECT_EQ(4, callback_count_);
@@ -1210,7 +1201,7 @@
   EXPECT_EQ(0, callback_count_);
 
   fake_bluetooth_device_client_->EndDiscoverySimulation(
-      dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath));
+      dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath));
 
   // The underlying adapter has started discovery, but our call hasn't returned
   // yet.
@@ -2128,15 +2119,14 @@
   ASSERT_EQ(2U, devices.size());
 
   int idx = GetDeviceIndexByAddress(
-      devices, bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
+      devices, FakeBluetoothDeviceClient::kPairedDeviceAddress);
   ASSERT_NE(-1, idx);
-  ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress,
+  ASSERT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress,
             devices[idx]->GetAddress());
 
   // Verify the other device properties.
-  EXPECT_EQ(
-      base::UTF8ToUTF16(bluez::FakeBluetoothDeviceClient::kPairedDeviceName),
-      devices[idx]->GetName());
+  EXPECT_EQ(base::UTF8ToUTF16(FakeBluetoothDeviceClient::kPairedDeviceName),
+            devices[idx]->GetName());
   EXPECT_EQ(BluetoothDevice::DEVICE_COMPUTER, devices[idx]->GetDeviceType());
   EXPECT_TRUE(devices[idx]->IsPaired());
   EXPECT_FALSE(devices[idx]->IsConnected());
@@ -2165,7 +2155,7 @@
   ASSERT_EQ(2U, devices.size());
 
   int idx = GetDeviceIndexByAddress(
-      devices, bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
+      devices, FakeBluetoothDeviceClient::kPairedDeviceAddress);
   ASSERT_NE(-1, idx);
   ASSERT_EQ(BluetoothDevice::DEVICE_COMPUTER, devices[idx]->GetDeviceType());
 
@@ -2173,9 +2163,9 @@
   // we change the class of the device.
   TestBluetoothAdapterObserver observer(adapter_);
 
-  bluez::FakeBluetoothDeviceClient::Properties* properties =
-      fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
-          bluez::FakeBluetoothDeviceClient::kPairedDevicePath));
+  FakeBluetoothDeviceClient::Properties* properties =
+      fake_bluetooth_device_client_->GetProperties(
+          dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath));
 
   properties->bluetooth_class.ReplaceValue(0x002580);
 
@@ -2193,21 +2183,20 @@
   ASSERT_EQ(2U, devices.size());
 
   int idx = GetDeviceIndexByAddress(
-      devices, bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
+      devices, FakeBluetoothDeviceClient::kPairedDeviceAddress);
   ASSERT_NE(-1, idx);
-  ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress,
+  ASSERT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress,
             devices[idx]->GetAddress());
-  ASSERT_EQ(
-      base::UTF8ToUTF16(bluez::FakeBluetoothDeviceClient::kPairedDeviceName),
-      devices[idx]->GetName());
+  ASSERT_EQ(base::UTF8ToUTF16(FakeBluetoothDeviceClient::kPairedDeviceName),
+            devices[idx]->GetName());
 
   // Install an observer; expect the DeviceChanged method to be called when
   // we change the alias of the device.
   TestBluetoothAdapterObserver observer(adapter_);
 
-  bluez::FakeBluetoothDeviceClient::Properties* properties =
-      fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
-          bluez::FakeBluetoothDeviceClient::kPairedDevicePath));
+  FakeBluetoothDeviceClient::Properties* properties =
+      fake_bluetooth_device_client_->GetProperties(
+          dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath));
 
   static const std::string new_name("New Device Name");
   properties->alias.ReplaceValue(new_name);
@@ -2226,21 +2215,20 @@
   ASSERT_EQ(2U, devices.size());
 
   int idx = GetDeviceIndexByAddress(
-      devices, bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
+      devices, FakeBluetoothDeviceClient::kPairedDeviceAddress);
   ASSERT_NE(-1, idx);
-  ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress,
+  ASSERT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress,
             devices[idx]->GetAddress());
-  ASSERT_EQ(
-      base::UTF8ToUTF16(bluez::FakeBluetoothDeviceClient::kPairedDeviceName),
-      devices[idx]->GetName());
+  ASSERT_EQ(base::UTF8ToUTF16(FakeBluetoothDeviceClient::kPairedDeviceName),
+            devices[idx]->GetName());
 
   // Install an observer; expect the DeviceAddressChanged method to be called
   // when we change the alias of the device.
   TestBluetoothAdapterObserver observer(adapter_);
 
-  bluez::FakeBluetoothDeviceClient::Properties* properties =
-      fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
-          bluez::FakeBluetoothDeviceClient::kPairedDevicePath));
+  FakeBluetoothDeviceClient::Properties* properties =
+      fake_bluetooth_device_client_->GetProperties(
+          dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath));
 
   static const char* kNewAddress = "D9:1F:FC:11:22:33";
   properties->address.ReplaceValue(kNewAddress);
@@ -2260,9 +2248,9 @@
   ASSERT_EQ(2U, devices.size());
 
   int idx = GetDeviceIndexByAddress(
-      devices, bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
+      devices, FakeBluetoothDeviceClient::kPairedDeviceAddress);
   ASSERT_NE(-1, idx);
-  ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress,
+  ASSERT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress,
             devices[idx]->GetAddress());
 
   BluetoothDevice::UUIDList uuids = devices[idx]->GetUUIDs();
@@ -2274,9 +2262,9 @@
   // we change the class of the device.
   TestBluetoothAdapterObserver observer(adapter_);
 
-  bluez::FakeBluetoothDeviceClient::Properties* properties =
-      fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
-          bluez::FakeBluetoothDeviceClient::kPairedDevicePath));
+  FakeBluetoothDeviceClient::Properties* properties =
+      fake_bluetooth_device_client_->GetProperties(
+          dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath));
 
   std::vector<std::string> new_uuids;
   new_uuids.push_back(uuids[0].canonical_value());
@@ -2309,12 +2297,12 @@
   ASSERT_EQ(2U, devices.size());
 
   int idx = GetDeviceIndexByAddress(
-      devices, bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
+      devices, FakeBluetoothDeviceClient::kPairedDeviceAddress);
   ASSERT_NE(-1, idx);
 
-  bluez::FakeBluetoothDeviceClient::Properties* properties =
-      fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
-          bluez::FakeBluetoothDeviceClient::kPairedDevicePath));
+  FakeBluetoothDeviceClient::Properties* properties =
+      fake_bluetooth_device_client_->GetProperties(
+          dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath));
 
   // During discovery, rssi is a valid value (-75)
   properties->rssi.ReplaceValue(-75);
@@ -2346,12 +2334,12 @@
   ASSERT_EQ(2U, devices.size());
 
   int idx = GetDeviceIndexByAddress(
-      devices, bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
+      devices, FakeBluetoothDeviceClient::kPairedDeviceAddress);
   ASSERT_NE(-1, idx);
 
-  bluez::FakeBluetoothDeviceClient::Properties* properties =
-      fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
-          bluez::FakeBluetoothDeviceClient::kPairedDevicePath));
+  FakeBluetoothDeviceClient::Properties* properties =
+      fake_bluetooth_device_client_->GetProperties(
+          dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath));
 
   // During discovery, tx_power is a valid value (0)
   properties->tx_power.ReplaceValue(0);
@@ -2381,9 +2369,9 @@
   ASSERT_EQ(2U, devices.size());
 
   int idx = GetDeviceIndexByAddress(
-      devices, bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
+      devices, FakeBluetoothDeviceClient::kPairedDeviceAddress);
   ASSERT_NE(-1, idx);
-  ASSERT_EQ(bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress,
+  ASSERT_EQ(FakeBluetoothDeviceClient::kPairedDeviceAddress,
             devices[idx]->GetAddress());
 
   std::string address = devices[idx]->GetAddress();
@@ -2407,8 +2395,8 @@
   GetAdapter();
   DiscoverDevices();
 
-  BluetoothDevice* device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kConnectUnpairableAddress);
+  BluetoothDevice* device =
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kConnectUnpairableAddress);
   ASSERT_TRUE(device != nullptr);
   ASSERT_FALSE(device->IsPaired());
 
@@ -2425,9 +2413,9 @@
   ASSERT_FALSE(device->IsConnecting());
 
   // Make sure the trusted property has been set to true.
-  bluez::FakeBluetoothDeviceClient::Properties* properties =
-      fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
-          bluez::FakeBluetoothDeviceClient::kConnectUnpairablePath));
+  FakeBluetoothDeviceClient::Properties* properties =
+      fake_bluetooth_device_client_->GetProperties(
+          dbus::ObjectPath(FakeBluetoothDeviceClient::kConnectUnpairablePath));
   ASSERT_TRUE(properties->trusted.value());
 
   // Install an observer; expect the DeviceRemoved method to be called
@@ -2438,20 +2426,20 @@
   EXPECT_EQ(0, error_callback_count_);
 
   EXPECT_EQ(1, observer.device_removed_count());
-  EXPECT_EQ(bluez::FakeBluetoothDeviceClient::kConnectUnpairableAddress,
+  EXPECT_EQ(FakeBluetoothDeviceClient::kConnectUnpairableAddress,
             observer.last_device_address());
 
   // GetDevices shouldn't return the device either.
-  device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kConnectUnpairableAddress);
+  device =
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kConnectUnpairableAddress);
   EXPECT_FALSE(device != nullptr);
 }
 
 TEST_F(BluetoothChromeOSTest, ConnectPairedDevice) {
   GetAdapter();
 
-  BluetoothDevice* device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
+  BluetoothDevice* device =
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kPairedDeviceAddress);
   ASSERT_TRUE(device != nullptr);
   ASSERT_TRUE(device->IsPaired());
 
@@ -2479,8 +2467,8 @@
   GetAdapter();
   DiscoverDevices();
 
-  BluetoothDevice* device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kConnectUnpairableAddress);
+  BluetoothDevice* device =
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kConnectUnpairableAddress);
   ASSERT_TRUE(device != nullptr);
   ASSERT_FALSE(device->IsPaired());
 
@@ -2504,9 +2492,9 @@
   EXPECT_FALSE(device->IsConnecting());
 
   // Make sure the trusted property has been set to true.
-  bluez::FakeBluetoothDeviceClient::Properties* properties =
-      fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
-          bluez::FakeBluetoothDeviceClient::kConnectUnpairablePath));
+  FakeBluetoothDeviceClient::Properties* properties =
+      fake_bluetooth_device_client_->GetProperties(
+          dbus::ObjectPath(FakeBluetoothDeviceClient::kConnectUnpairablePath));
   EXPECT_TRUE(properties->trusted.value());
 
   // Verify is a HID device and is not connectable.
@@ -2519,8 +2507,8 @@
 TEST_F(BluetoothChromeOSTest, ConnectConnectedDevice) {
   GetAdapter();
 
-  BluetoothDevice* device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
+  BluetoothDevice* device =
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kPairedDeviceAddress);
   ASSERT_TRUE(device != nullptr);
   ASSERT_TRUE(device->IsPaired());
 
@@ -2557,8 +2545,8 @@
   GetAdapter();
   DiscoverDevices();
 
-  BluetoothDevice* device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kLegacyAutopairAddress);
+  BluetoothDevice* device =
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kLegacyAutopairAddress);
   ASSERT_TRUE(device != nullptr);
   ASSERT_FALSE(device->IsPaired());
 
@@ -2583,8 +2571,8 @@
 TEST_F(BluetoothChromeOSTest, DisconnectDevice) {
   GetAdapter();
 
-  BluetoothDevice* device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
+  BluetoothDevice* device =
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kPairedDeviceAddress);
   ASSERT_TRUE(device != nullptr);
   ASSERT_TRUE(device->IsPaired());
 
@@ -2617,8 +2605,8 @@
 TEST_F(BluetoothChromeOSTest, DisconnectUnconnectedDevice) {
   GetAdapter();
 
-  BluetoothDevice* device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
+  BluetoothDevice* device =
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kPairedDeviceAddress);
   ASSERT_TRUE(device != nullptr);
   ASSERT_TRUE(device->IsPaired());
   ASSERT_FALSE(device->IsConnected());
@@ -2642,20 +2630,18 @@
   GetAdapter();
 
   fake_bluetooth_device_client_->CreateDevice(
-      dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::
-                           kConnectedTrustedNotPairedDevicePath));
-  BluetoothDevice* device =
-      adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::
-                              kConnectedTrustedNotPairedDeviceAddress);
+      dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
+      dbus::ObjectPath(
+          FakeBluetoothDeviceClient::kConnectedTrustedNotPairedDevicePath));
+  BluetoothDevice* device = adapter_->GetDevice(
+      FakeBluetoothDeviceClient::kConnectedTrustedNotPairedDeviceAddress);
   ASSERT_TRUE(device != nullptr);
 
   // On the DBus level the device is trusted but not paired. But the current
   // implementation of |BluetoothDevice::IsPaired()| returns true in this case.
-  bluez::FakeBluetoothDeviceClient::Properties* properties =
-      fake_bluetooth_device_client_->GetProperties(
-          dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::
-                               kConnectedTrustedNotPairedDevicePath));
+  FakeBluetoothDeviceClient::Properties* properties =
+      fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
+          FakeBluetoothDeviceClient::kConnectedTrustedNotPairedDevicePath));
   EXPECT_FALSE(properties->paired.value());
   EXPECT_TRUE(properties->trusted.value());
   ASSERT_TRUE(device->IsPaired());
@@ -2681,7 +2667,7 @@
 
   // Make sure the paired property has been set to true.
   properties = fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
-      bluez::FakeBluetoothDeviceClient::kConnectedTrustedNotPairedDevicePath));
+      FakeBluetoothDeviceClient::kConnectedTrustedNotPairedDevicePath));
   EXPECT_TRUE(properties->paired.value());
 }
 
@@ -2689,16 +2675,16 @@
   GetAdapter();
 
   fake_bluetooth_device_client_->CreateDevice(
-      dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kPairedDevicePath));
-  BluetoothDevice* device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
+      dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath));
+  BluetoothDevice* device =
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kPairedDeviceAddress);
   ASSERT_TRUE(device != nullptr);
 
   // On the DBus level a device can be trusted but not paired.
-  bluez::FakeBluetoothDeviceClient::Properties* properties =
-      fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
-          bluez::FakeBluetoothDeviceClient::kPairedDevicePath));
+  FakeBluetoothDeviceClient::Properties* properties =
+      fake_bluetooth_device_client_->GetProperties(
+          dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath));
   EXPECT_TRUE(properties->paired.value());
   EXPECT_TRUE(properties->trusted.value());
   ASSERT_TRUE(device->IsPaired());
@@ -2726,8 +2712,8 @@
 
   // The Legacy Autopair device requires no PIN or Passkey to pair because
   // the daemon provides 0000 to the device for us.
-  BluetoothDevice* device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kLegacyAutopairAddress);
+  BluetoothDevice* device =
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kLegacyAutopairAddress);
   ASSERT_TRUE(device != nullptr);
   ASSERT_FALSE(device->IsPaired());
 
@@ -2764,9 +2750,9 @@
   EXPECT_TRUE(device->IsConnectable());
 
   // Make sure the trusted property has been set to true.
-  bluez::FakeBluetoothDeviceClient::Properties* properties =
-      fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
-          bluez::FakeBluetoothDeviceClient::kLegacyAutopairPath));
+  FakeBluetoothDeviceClient::Properties* properties =
+      fake_bluetooth_device_client_->GetProperties(
+          dbus::ObjectPath(FakeBluetoothDeviceClient::kLegacyAutopairPath));
   EXPECT_TRUE(properties->trusted.value());
 }
 
@@ -2777,8 +2763,8 @@
   DiscoverDevices();
 
   // Requires that we display a randomly generated PIN on the screen.
-  BluetoothDevice* device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kDisplayPinCodeAddress);
+  BluetoothDevice* device =
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kDisplayPinCodeAddress);
   ASSERT_TRUE(device != nullptr);
   ASSERT_FALSE(device->IsPaired());
 
@@ -2817,9 +2803,9 @@
   EXPECT_TRUE(device->IsConnectable());
 
   // Make sure the trusted property has been set to true.
-  bluez::FakeBluetoothDeviceClient::Properties* properties =
-      fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
-          bluez::FakeBluetoothDeviceClient::kDisplayPinCodePath));
+  FakeBluetoothDeviceClient::Properties* properties =
+      fake_bluetooth_device_client_->GetProperties(
+          dbus::ObjectPath(FakeBluetoothDeviceClient::kDisplayPinCodePath));
   EXPECT_TRUE(properties->trusted.value());
 }
 
@@ -2831,8 +2817,8 @@
 
   // Requires that we display a randomly generated Passkey on the screen,
   // and notifies us as it's typed in.
-  BluetoothDevice* device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kDisplayPasskeyAddress);
+  BluetoothDevice* device =
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kDisplayPasskeyAddress);
   ASSERT_TRUE(device != nullptr);
   ASSERT_FALSE(device->IsPaired());
 
@@ -2892,9 +2878,9 @@
   EXPECT_FALSE(device->IsConnectable());
 
   // Make sure the trusted property has been set to true.
-  bluez::FakeBluetoothDeviceClient::Properties* properties =
-      fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
-          bluez::FakeBluetoothDeviceClient::kDisplayPasskeyPath));
+  FakeBluetoothDeviceClient::Properties* properties =
+      fake_bluetooth_device_client_->GetProperties(
+          dbus::ObjectPath(FakeBluetoothDeviceClient::kDisplayPasskeyPath));
   EXPECT_TRUE(properties->trusted.value());
 }
 
@@ -2905,8 +2891,8 @@
   DiscoverDevices();
 
   // Requires that the user enters a PIN for them.
-  BluetoothDevice* device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kRequestPinCodeAddress);
+  BluetoothDevice* device =
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kRequestPinCodeAddress);
   ASSERT_TRUE(device != nullptr);
   ASSERT_FALSE(device->IsPaired());
 
@@ -2946,9 +2932,9 @@
   EXPECT_TRUE(device->IsConnectable());
 
   // Make sure the trusted property has been set to true.
-  bluez::FakeBluetoothDeviceClient::Properties* properties =
-      fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
-          bluez::FakeBluetoothDeviceClient::kRequestPinCodePath));
+  FakeBluetoothDeviceClient::Properties* properties =
+      fake_bluetooth_device_client_->GetProperties(
+          dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPinCodePath));
   EXPECT_TRUE(properties->trusted.value());
 }
 
@@ -2959,8 +2945,8 @@
   DiscoverDevices();
 
   // Requests that we confirm a displayed passkey.
-  BluetoothDevice* device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kConfirmPasskeyAddress);
+  BluetoothDevice* device =
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kConfirmPasskeyAddress);
   ASSERT_TRUE(device != nullptr);
   ASSERT_FALSE(device->IsPaired());
 
@@ -2997,9 +2983,9 @@
   EXPECT_TRUE(device->IsConnectable());
 
   // Make sure the trusted property has been set to true.
-  bluez::FakeBluetoothDeviceClient::Properties* properties =
-      fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
-          bluez::FakeBluetoothDeviceClient::kConfirmPasskeyPath));
+  FakeBluetoothDeviceClient::Properties* properties =
+      fake_bluetooth_device_client_->GetProperties(
+          dbus::ObjectPath(FakeBluetoothDeviceClient::kConfirmPasskeyPath));
   EXPECT_TRUE(properties->trusted.value());
 }
 
@@ -3011,8 +2997,8 @@
 
   // Requires that the user enters a Passkey, this would be some kind of
   // device that has a display, but doesn't use "just works" - maybe a car?
-  BluetoothDevice* device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kRequestPasskeyAddress);
+  BluetoothDevice* device =
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kRequestPasskeyAddress);
   ASSERT_TRUE(device != nullptr);
   ASSERT_FALSE(device->IsPaired());
 
@@ -3048,9 +3034,9 @@
   EXPECT_TRUE(device->IsConnectable());
 
   // Make sure the trusted property has been set to true.
-  bluez::FakeBluetoothDeviceClient::Properties* properties =
-      fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
-          bluez::FakeBluetoothDeviceClient::kRequestPasskeyPath));
+  FakeBluetoothDeviceClient::Properties* properties =
+      fake_bluetooth_device_client_->GetProperties(
+          dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPasskeyPath));
   EXPECT_TRUE(properties->trusted.value());
 }
 
@@ -3063,7 +3049,7 @@
   // Uses just-works pairing, since this is an outgoing pairing, no delegate
   // interaction is required.
   BluetoothDevice* device =
-      adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kJustWorksAddress);
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kJustWorksAddress);
   ASSERT_TRUE(device != nullptr);
   ASSERT_FALSE(device->IsPaired());
 
@@ -3095,9 +3081,9 @@
   EXPECT_TRUE(device->IsConnectable());
 
   // Make sure the trusted property has been set to true.
-  bluez::FakeBluetoothDeviceClient::Properties* properties =
+  FakeBluetoothDeviceClient::Properties* properties =
       fake_bluetooth_device_client_->GetProperties(
-          dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kJustWorksPath));
+          dbus::ObjectPath(FakeBluetoothDeviceClient::kJustWorksPath));
   EXPECT_TRUE(properties->trusted.value());
 }
 
@@ -3105,10 +3091,10 @@
   fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
 
   GetAdapter();
-  DiscoverDevice(bluez::FakeBluetoothDeviceClient::kUnconnectableDeviceAddress);
+  DiscoverDevice(FakeBluetoothDeviceClient::kUnconnectableDeviceAddress);
 
-  BluetoothDevice* device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kUnpairableDeviceAddress);
+  BluetoothDevice* device =
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kUnpairableDeviceAddress);
   ASSERT_TRUE(device != nullptr);
   ASSERT_FALSE(device->IsPaired());
 
@@ -3139,11 +3125,11 @@
   fake_bluetooth_device_client_->SetSimulationIntervalMs(10);
 
   GetAdapter();
-  DiscoverDevice(bluez::FakeBluetoothDeviceClient::kVanishingDeviceAddress);
+  DiscoverDevice(FakeBluetoothDeviceClient::kVanishingDeviceAddress);
 
   // The vanishing device times out during pairing
-  BluetoothDevice* device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kVanishingDeviceAddress);
+  BluetoothDevice* device =
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kVanishingDeviceAddress);
   ASSERT_TRUE(device != nullptr);
   ASSERT_FALSE(device->IsPaired());
 
@@ -3179,7 +3165,7 @@
   // Everything seems to go according to plan with the unconnectable device;
   // it pairs, but then you can't make connections to it after.
   BluetoothDevice* device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kUnconnectableDeviceAddress);
+      FakeBluetoothDeviceClient::kUnconnectableDeviceAddress);
   ASSERT_TRUE(device != nullptr);
   ASSERT_FALSE(device->IsPaired());
 
@@ -3211,9 +3197,9 @@
 
   // Make sure the trusted property has been set to true still (since pairing
   // worked).
-  bluez::FakeBluetoothDeviceClient::Properties* properties =
+  FakeBluetoothDeviceClient::Properties* properties =
       fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
-          bluez::FakeBluetoothDeviceClient::kUnconnectableDevicePath));
+          FakeBluetoothDeviceClient::kUnconnectableDevicePath));
   EXPECT_TRUE(properties->trusted.value());
 }
 
@@ -3224,8 +3210,8 @@
   DiscoverDevices();
 
   // Reject the pairing after we receive a request for the PIN code.
-  BluetoothDevice* device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kRequestPinCodeAddress);
+  BluetoothDevice* device =
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kRequestPinCodeAddress);
   ASSERT_TRUE(device != nullptr);
   ASSERT_FALSE(device->IsPaired());
 
@@ -3262,8 +3248,8 @@
   DiscoverDevices();
 
   // Cancel the pairing after we receive a request for the PIN code.
-  BluetoothDevice* device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kRequestPinCodeAddress);
+  BluetoothDevice* device =
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kRequestPinCodeAddress);
   ASSERT_TRUE(device != nullptr);
   ASSERT_FALSE(device->IsPaired());
 
@@ -3300,8 +3286,8 @@
   DiscoverDevices();
 
   // Reject the pairing after we receive a request for the passkey.
-  BluetoothDevice* device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kRequestPasskeyAddress);
+  BluetoothDevice* device =
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kRequestPasskeyAddress);
   ASSERT_TRUE(device != nullptr);
   ASSERT_FALSE(device->IsPaired());
 
@@ -3338,8 +3324,8 @@
   DiscoverDevices();
 
   // Cancel the pairing after we receive a request for the passkey.
-  BluetoothDevice* device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kRequestPasskeyAddress);
+  BluetoothDevice* device =
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kRequestPasskeyAddress);
   ASSERT_TRUE(device != nullptr);
   ASSERT_FALSE(device->IsPaired());
 
@@ -3376,8 +3362,8 @@
   DiscoverDevices();
 
   // Reject the pairing after we receive a request for passkey confirmation.
-  BluetoothDevice* device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kConfirmPasskeyAddress);
+  BluetoothDevice* device =
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kConfirmPasskeyAddress);
   ASSERT_TRUE(device != nullptr);
   ASSERT_FALSE(device->IsPaired());
 
@@ -3414,8 +3400,8 @@
   DiscoverDevices();
 
   // Cancel the pairing after we receive a request for the passkey.
-  BluetoothDevice* device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kConfirmPasskeyAddress);
+  BluetoothDevice* device =
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kConfirmPasskeyAddress);
   ASSERT_TRUE(device != nullptr);
   ASSERT_FALSE(device->IsPaired());
 
@@ -3452,8 +3438,8 @@
   DiscoverDevices();
 
   // Cancel the pairing while we're waiting for the remote host.
-  BluetoothDevice* device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kLegacyAutopairAddress);
+  BluetoothDevice* device =
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kLegacyAutopairAddress);
   ASSERT_TRUE(device != nullptr);
   ASSERT_FALSE(device->IsPaired());
 
@@ -3494,19 +3480,19 @@
 
   // Requires that we provide a PIN code.
   fake_bluetooth_device_client_->CreateDevice(
-      dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPinCodePath));
-  BluetoothDevice* device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kRequestPinCodeAddress);
+      dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPinCodePath));
+  BluetoothDevice* device =
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kRequestPinCodeAddress);
   ASSERT_TRUE(device != nullptr);
   ASSERT_FALSE(device->IsPaired());
 
   TestBluetoothAdapterObserver observer(adapter_);
 
   fake_bluetooth_device_client_->SimulatePairing(
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPinCodePath),
-      true, GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
-                                      base::Unretained(this)));
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPinCodePath), true,
+      GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
+                                base::Unretained(this)));
 
   EXPECT_EQ(1, pairing_delegate.call_count_);
   EXPECT_EQ(1, pairing_delegate.request_pincode_count_);
@@ -3525,9 +3511,9 @@
   EXPECT_TRUE(device->IsPaired());
 
   // Make sure the trusted property has been set to true.
-  bluez::FakeBluetoothDeviceClient::Properties* properties =
-      fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
-          bluez::FakeBluetoothDeviceClient::kRequestPinCodePath));
+  FakeBluetoothDeviceClient::Properties* properties =
+      fake_bluetooth_device_client_->GetProperties(
+          dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPinCodePath));
   ASSERT_TRUE(properties->trusted.value());
 
   // No pairing context should remain on the device.
@@ -3548,19 +3534,19 @@
 
   // Requests that we confirm a displayed passkey.
   fake_bluetooth_device_client_->CreateDevice(
-      dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kConfirmPasskeyPath));
-  BluetoothDevice* device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kConfirmPasskeyAddress);
+      dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kConfirmPasskeyPath));
+  BluetoothDevice* device =
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kConfirmPasskeyAddress);
   ASSERT_TRUE(device != nullptr);
   ASSERT_FALSE(device->IsPaired());
 
   TestBluetoothAdapterObserver observer(adapter_);
 
   fake_bluetooth_device_client_->SimulatePairing(
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kConfirmPasskeyPath),
-      true, GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
-                                      base::Unretained(this)));
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kConfirmPasskeyPath), true,
+      GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
+                                base::Unretained(this)));
 
   EXPECT_EQ(1, pairing_delegate.call_count_);
   EXPECT_EQ(1, pairing_delegate.confirm_passkey_count_);
@@ -3580,9 +3566,9 @@
   EXPECT_TRUE(device->IsPaired());
 
   // Make sure the trusted property has been set to true.
-  bluez::FakeBluetoothDeviceClient::Properties* properties =
-      fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
-          bluez::FakeBluetoothDeviceClient::kConfirmPasskeyPath));
+  FakeBluetoothDeviceClient::Properties* properties =
+      fake_bluetooth_device_client_->GetProperties(
+          dbus::ObjectPath(FakeBluetoothDeviceClient::kConfirmPasskeyPath));
   ASSERT_TRUE(properties->trusted.value());
 
   // No pairing context should remain on the device.
@@ -3603,19 +3589,19 @@
 
   // Requests that we provide a Passkey.
   fake_bluetooth_device_client_->CreateDevice(
-      dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPasskeyPath));
-  BluetoothDevice* device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kRequestPasskeyAddress);
+      dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPasskeyPath));
+  BluetoothDevice* device =
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kRequestPasskeyAddress);
   ASSERT_TRUE(device != nullptr);
   ASSERT_FALSE(device->IsPaired());
 
   TestBluetoothAdapterObserver observer(adapter_);
 
   fake_bluetooth_device_client_->SimulatePairing(
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPasskeyPath),
-      true, GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
-                                      base::Unretained(this)));
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPasskeyPath), true,
+      GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
+                                base::Unretained(this)));
 
   EXPECT_EQ(1, pairing_delegate.call_count_);
   EXPECT_EQ(1, pairing_delegate.request_passkey_count_);
@@ -3634,9 +3620,9 @@
   EXPECT_TRUE(device->IsPaired());
 
   // Make sure the trusted property has been set to true.
-  bluez::FakeBluetoothDeviceClient::Properties* properties =
-      fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
-          bluez::FakeBluetoothDeviceClient::kRequestPasskeyPath));
+  FakeBluetoothDeviceClient::Properties* properties =
+      fake_bluetooth_device_client_->GetProperties(
+          dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPasskeyPath));
   ASSERT_TRUE(properties->trusted.value());
 
   // No pairing context should remain on the device.
@@ -3658,17 +3644,17 @@
   // Uses just-works pairing so, sinec this an incoming pairing, require
   // authorization from the user.
   fake_bluetooth_device_client_->CreateDevice(
-      dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kJustWorksPath));
+      dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kJustWorksPath));
   BluetoothDevice* device =
-      adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kJustWorksAddress);
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kJustWorksAddress);
   ASSERT_TRUE(device != nullptr);
   ASSERT_FALSE(device->IsPaired());
 
   TestBluetoothAdapterObserver observer(adapter_);
 
   fake_bluetooth_device_client_->SimulatePairing(
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kJustWorksPath), true,
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kJustWorksPath), true,
       GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
                                 base::Unretained(this)));
 
@@ -3689,9 +3675,9 @@
   EXPECT_TRUE(device->IsPaired());
 
   // Make sure the trusted property has been set to true.
-  bluez::FakeBluetoothDeviceClient::Properties* properties =
+  FakeBluetoothDeviceClient::Properties* properties =
       fake_bluetooth_device_client_->GetProperties(
-          dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kJustWorksPath));
+          dbus::ObjectPath(FakeBluetoothDeviceClient::kJustWorksPath));
   ASSERT_TRUE(properties->trusted.value());
 
   // No pairing context should remain on the device.
@@ -3708,19 +3694,19 @@
   // Requires that we provide a PIN Code, without a pairing delegate,
   // that will be rejected.
   fake_bluetooth_device_client_->CreateDevice(
-      dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPinCodePath));
-  BluetoothDevice* device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kRequestPinCodeAddress);
+      dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPinCodePath));
+  BluetoothDevice* device =
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kRequestPinCodeAddress);
   ASSERT_TRUE(device != nullptr);
   ASSERT_FALSE(device->IsPaired());
 
   TestBluetoothAdapterObserver observer(adapter_);
 
   fake_bluetooth_device_client_->SimulatePairing(
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPinCodePath),
-      true, GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
-                                      base::Unretained(this)));
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPinCodePath), true,
+      GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
+                                base::Unretained(this)));
 
   message_loop_.Run();
 
@@ -3747,19 +3733,19 @@
   // Requests that we confirm a displayed passkey, without a pairing delegate,
   // that will be rejected.
   fake_bluetooth_device_client_->CreateDevice(
-      dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kConfirmPasskeyPath));
-  BluetoothDevice* device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kConfirmPasskeyAddress);
+      dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kConfirmPasskeyPath));
+  BluetoothDevice* device =
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kConfirmPasskeyAddress);
   ASSERT_TRUE(device != nullptr);
   ASSERT_FALSE(device->IsPaired());
 
   TestBluetoothAdapterObserver observer(adapter_);
 
   fake_bluetooth_device_client_->SimulatePairing(
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kConfirmPasskeyPath),
-      true, GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
-                                      base::Unretained(this)));
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kConfirmPasskeyPath), true,
+      GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
+                                base::Unretained(this)));
 
   message_loop_.Run();
 
@@ -3786,19 +3772,19 @@
   // Requests that we provide a displayed passkey, without a pairing delegate,
   // that will be rejected.
   fake_bluetooth_device_client_->CreateDevice(
-      dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPasskeyPath));
-  BluetoothDevice* device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kRequestPasskeyAddress);
+      dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPasskeyPath));
+  BluetoothDevice* device =
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kRequestPasskeyAddress);
   ASSERT_TRUE(device != nullptr);
   ASSERT_FALSE(device->IsPaired());
 
   TestBluetoothAdapterObserver observer(adapter_);
 
   fake_bluetooth_device_client_->SimulatePairing(
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPasskeyPath),
-      true, GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
-                                      base::Unretained(this)));
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPasskeyPath), true,
+      GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
+                                base::Unretained(this)));
 
   message_loop_.Run();
 
@@ -3825,17 +3811,17 @@
   // Uses just-works pairing and thus requires authorization for incoming
   // pairings, without a pairing delegate, that will be rejected.
   fake_bluetooth_device_client_->CreateDevice(
-      dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kJustWorksPath));
+      dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kJustWorksPath));
   BluetoothDevice* device =
-      adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kJustWorksAddress);
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kJustWorksAddress);
   ASSERT_TRUE(device != nullptr);
   ASSERT_FALSE(device->IsPaired());
 
   TestBluetoothAdapterObserver observer(adapter_);
 
   fake_bluetooth_device_client_->SimulatePairing(
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kJustWorksPath), true,
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kJustWorksPath), true,
       GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
                                 base::Unretained(this)));
 
@@ -3868,19 +3854,19 @@
 
   // Requests that we provide a Passkey.
   fake_bluetooth_device_client_->CreateDevice(
-      dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPasskeyPath));
-  BluetoothDevice* device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kRequestPasskeyAddress);
+      dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPasskeyPath));
+  BluetoothDevice* device =
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kRequestPasskeyAddress);
   ASSERT_TRUE(device != nullptr);
   ASSERT_FALSE(device->IsPaired());
 
   TestBluetoothAdapterObserver observer(adapter_);
 
   fake_bluetooth_device_client_->SimulatePairing(
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kRequestPasskeyPath),
-      true, GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
-                                      base::Unretained(this)));
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kRequestPasskeyPath), true,
+      GetCallback(), base::Bind(&BluetoothChromeOSTest::DBusErrorCallback,
+                                base::Unretained(this)));
 
   EXPECT_EQ(1, pairing_delegate.call_count_);
   EXPECT_EQ(1, pairing_delegate.request_passkey_count_);
@@ -3911,11 +3897,11 @@
 
   // Use the built-in paired device for this test, grab its Properties
   // structure so we can adjust the underlying modalias property.
-  BluetoothDevice* device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
-  bluez::FakeBluetoothDeviceClient::Properties* properties =
-      fake_bluetooth_device_client_->GetProperties(dbus::ObjectPath(
-          bluez::FakeBluetoothDeviceClient::kPairedDevicePath));
+  BluetoothDevice* device =
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kPairedDeviceAddress);
+  FakeBluetoothDeviceClient::Properties* properties =
+      fake_bluetooth_device_client_->GetProperties(
+          dbus::ObjectPath(FakeBluetoothDeviceClient::kPairedDevicePath));
 
   ASSERT_TRUE(device != nullptr);
   ASSERT_TRUE(properties != nullptr);
@@ -3963,8 +3949,8 @@
 
 TEST_F(BluetoothChromeOSTest, GetConnectionInfoForDisconnectedDevice) {
   GetAdapter();
-  BluetoothDevice* device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
+  BluetoothDevice* device =
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kPairedDeviceAddress);
 
   // Calling GetConnectionInfo for an unconnected device should return a result
   // in which all fields are filled with BluetoothDevice::kUnknownPower.
@@ -3979,8 +3965,8 @@
 
 TEST_F(BluetoothChromeOSTest, GetConnectionInfoForConnectedDevice) {
   GetAdapter();
-  BluetoothDevice* device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
+  BluetoothDevice* device =
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kPairedDeviceAddress);
 
   device->Connect(nullptr, GetCallback(),
                   base::Bind(&BluetoothChromeOSTest::ConnectErrorCallback,
@@ -4025,9 +4011,8 @@
   EXPECT_TRUE(adapter_->IsDiscoverable());
   EXPECT_TRUE(adapter_->IsDiscovering());
   EXPECT_EQ(2U, adapter_->GetDevices().size());
-  EXPECT_NE(nullptr,
-            adapter_->GetDevice(
-                bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress));
+  EXPECT_NE(nullptr, adapter_->GetDevice(
+                         FakeBluetoothDeviceClient::kPairedDeviceAddress));
   EXPECT_NE(dbus::ObjectPath(""), static_cast<BluetoothAdapterChromeOS*>(
                                       adapter_.get())->object_path());
 
@@ -4104,7 +4089,7 @@
   FakeBluetoothProfileServiceProviderDelegate profile_delegate;
   adapter_chrome_os->UseProfile(
       BluetoothUUID(), dbus::ObjectPath(""),
-      bluez::BluetoothProfileManagerClient::Options(), &profile_delegate,
+      BluetoothProfileManagerClient::Options(), &profile_delegate,
       base::Bind(&BluetoothChromeOSTest::ProfileRegisteredCallback,
                  base::Unretained(this)),
       base::Bind(&BluetoothChromeOSTest::ErrorCompletionCallback,
@@ -4124,8 +4109,7 @@
   adapter_chrome_os->DeviceRemoved(dbus::ObjectPath(""));
   adapter_chrome_os->DevicePropertyChanged(dbus::ObjectPath(""), "");
   adapter_chrome_os->InputPropertyChanged(dbus::ObjectPath(""), "");
-  // bluez::BluetoothAgentServiceProvider::Delegate omitted, dbus will be
-  // shutdown,
+  // BluetoothAgentServiceProvider::Delegate omitted, dbus will be shutdown,
   //   with the exception of Released.
   adapter_chrome_os->Released();
 
@@ -4182,7 +4166,7 @@
   // UseProfile to be set first, do so again here just before calling them.
   adapter_chrome_os->UseProfile(
       BluetoothUUID(), dbus::ObjectPath(""),
-      bluez::BluetoothProfileManagerClient::Options(), &profile_delegate,
+      BluetoothProfileManagerClient::Options(), &profile_delegate,
       base::Bind(&BluetoothChromeOSTest::ProfileRegisteredCallback,
                  base::Unretained(this)),
       base::Bind(&BluetoothChromeOSTest::ErrorCompletionCallback,
@@ -4217,9 +4201,8 @@
   EXPECT_EQ(1, error_callback_count_--) << "StartDiscoverySession error";
 
   EXPECT_EQ(0U, adapter_->GetDevices().size());
-  EXPECT_EQ(nullptr,
-            adapter_->GetDevice(
-                bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress));
+  EXPECT_EQ(nullptr, adapter_->GetDevice(
+                         FakeBluetoothDeviceClient::kPairedDeviceAddress));
   TestPairingDelegate pairing_delegate2;
   adapter_->AddPairingDelegate(
       &pairing_delegate2, BluetoothAdapter::PAIRING_DELEGATE_PRIORITY_HIGH);
diff --git a/device/bluetooth/bluetooth_device_chromeos.cc b/device/bluetooth/bluetooth_device_chromeos.cc
index ea4a168c..898fd512 100644
--- a/device/bluetooth/bluetooth_device_chromeos.cc
+++ b/device/bluetooth/bluetooth_device_chromeos.cc
@@ -11,6 +11,11 @@
 #include "base/metrics/histogram.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_util.h"
+#include "chromeos/dbus/bluetooth_adapter_client.h"
+#include "chromeos/dbus/bluetooth_device_client.h"
+#include "chromeos/dbus/bluetooth_gatt_service_client.h"
+#include "chromeos/dbus/bluetooth_input_client.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
 #include "dbus/bus.h"
 #include "device/bluetooth/bluetooth_adapter_chromeos.h"
 #include "device/bluetooth/bluetooth_gatt_connection_chromeos.h"
@@ -20,11 +25,6 @@
 #include "device/bluetooth/bluetooth_socket_chromeos.h"
 #include "device/bluetooth/bluetooth_socket_thread.h"
 #include "device/bluetooth/bluetooth_uuid.h"
-#include "device/bluetooth/dbus/bluetooth_adapter_client.h"
-#include "device/bluetooth/dbus/bluetooth_device_client.h"
-#include "device/bluetooth/dbus/bluetooth_gatt_service_client.h"
-#include "device/bluetooth/dbus/bluetooth_input_client.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
 #include "third_party/cros_system_api/dbus/service_constants.h"
 
 using device::BluetoothDevice;
@@ -55,9 +55,10 @@
                    uint16* vendor_id,
                    uint16* product_id,
                    uint16* device_id) {
-  bluez::BluetoothDeviceClient::Properties* properties =
-      bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
-          object_path);
+  chromeos::BluetoothDeviceClient::Properties* properties =
+      chromeos::DBusThreadManager::Get()
+          ->GetBluetoothDeviceClient()
+          ->GetProperties(object_path);
   DCHECK(properties);
 
   std::string modalias = properties->modalias.value();
@@ -152,14 +153,11 @@
       ui_task_runner_(ui_task_runner),
       socket_thread_(socket_thread),
       weak_ptr_factory_(this) {
-  bluez::BluezDBusManager::Get()->GetBluetoothGattServiceClient()->AddObserver(
-      this);
+  DBusThreadManager::Get()->GetBluetoothGattServiceClient()->AddObserver(this);
 
   // Add all known GATT services.
   const std::vector<dbus::ObjectPath> gatt_services =
-      bluez::BluezDBusManager::Get()
-          ->GetBluetoothGattServiceClient()
-          ->GetServices();
+      DBusThreadManager::Get()->GetBluetoothGattServiceClient()->GetServices();
   for (std::vector<dbus::ObjectPath>::const_iterator it = gatt_services.begin();
        it != gatt_services.end(); ++it) {
     GattServiceAdded(*it);
@@ -167,9 +165,8 @@
 }
 
 BluetoothDeviceChromeOS::~BluetoothDeviceChromeOS() {
-  bluez::BluezDBusManager::Get()
-      ->GetBluetoothGattServiceClient()
-      ->RemoveObserver(this);
+  DBusThreadManager::Get()->GetBluetoothGattServiceClient()->RemoveObserver(
+      this);
 
   // Copy the GATT services list here and clear the original so that when we
   // send GattServiceRemoved(), GetGattServices() returns no services.
@@ -183,8 +180,8 @@
 }
 
 uint32 BluetoothDeviceChromeOS::GetBluetoothClass() const {
-  bluez::BluetoothDeviceClient::Properties* properties =
-      bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
+  BluetoothDeviceClient::Properties* properties =
+      DBusThreadManager::Get()->GetBluetoothDeviceClient()->GetProperties(
           object_path_);
   DCHECK(properties);
 
@@ -192,8 +189,8 @@
 }
 
 std::string BluetoothDeviceChromeOS::GetDeviceName() const {
-  bluez::BluetoothDeviceClient::Properties* properties =
-      bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
+  BluetoothDeviceClient::Properties* properties =
+      DBusThreadManager::Get()->GetBluetoothDeviceClient()->GetProperties(
           object_path_);
   DCHECK(properties);
 
@@ -213,8 +210,8 @@
 }
 
 std::string BluetoothDeviceChromeOS::GetAddress() const {
-  bluez::BluetoothDeviceClient::Properties* properties =
-      bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
+  BluetoothDeviceClient::Properties* properties =
+      DBusThreadManager::Get()->GetBluetoothDeviceClient()->GetProperties(
           object_path_);
   DCHECK(properties);
 
@@ -247,8 +244,8 @@
 }
 
 bool BluetoothDeviceChromeOS::IsPaired() const {
-  bluez::BluetoothDeviceClient::Properties* properties =
-      bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
+  BluetoothDeviceClient::Properties* properties =
+      DBusThreadManager::Get()->GetBluetoothDeviceClient()->GetProperties(
           object_path_);
   DCHECK(properties);
 
@@ -259,8 +256,8 @@
 }
 
 bool BluetoothDeviceChromeOS::IsConnected() const {
-  bluez::BluetoothDeviceClient::Properties* properties =
-      bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
+  BluetoothDeviceClient::Properties* properties =
+      DBusThreadManager::Get()->GetBluetoothDeviceClient()->GetProperties(
           object_path_);
   DCHECK(properties);
 
@@ -273,8 +270,8 @@
 }
 
 bool BluetoothDeviceChromeOS::IsConnectable() const {
-  bluez::BluetoothInputClient::Properties* input_properties =
-      bluez::BluezDBusManager::Get()->GetBluetoothInputClient()->GetProperties(
+  BluetoothInputClient::Properties* input_properties =
+      DBusThreadManager::Get()->GetBluetoothInputClient()->GetProperties(
           object_path_);
   // GetProperties returns NULL when the device does not implement the given
   // interface. Non HID devices are normally connectable.
@@ -289,8 +286,8 @@
 }
 
 BluetoothDeviceChromeOS::UUIDList BluetoothDeviceChromeOS::GetUUIDs() const {
-  bluez::BluetoothDeviceClient::Properties* properties =
-      bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
+  BluetoothDeviceClient::Properties* properties =
+      DBusThreadManager::Get()->GetBluetoothDeviceClient()->GetProperties(
           object_path_);
   DCHECK(properties);
 
@@ -306,8 +303,8 @@
 }
 
 int16 BluetoothDeviceChromeOS::GetInquiryRSSI() const {
-  bluez::BluetoothDeviceClient::Properties* properties =
-      bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
+  BluetoothDeviceClient::Properties* properties =
+      DBusThreadManager::Get()->GetBluetoothDeviceClient()->GetProperties(
           object_path_);
   DCHECK(properties);
 
@@ -318,8 +315,8 @@
 }
 
 int16 BluetoothDeviceChromeOS::GetInquiryTxPower() const {
-  bluez::BluetoothDeviceClient::Properties* properties =
-      bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
+  BluetoothDeviceClient::Properties* properties =
+      DBusThreadManager::Get()->GetBluetoothDeviceClient()->GetProperties(
           object_path_);
   DCHECK(properties);
 
@@ -345,7 +342,7 @@
     const ConnectionInfoCallback& callback) {
   // DBus method call should gracefully return an error if the device is not
   // currently connected.
-  bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetConnInfo(
+  DBusThreadManager::Get()->GetBluetoothDeviceClient()->GetConnInfo(
       object_path_, base::Bind(&BluetoothDeviceChromeOS::OnGetConnInfo,
                                weak_ptr_factory_.GetWeakPtr(), callback),
       base::Bind(&BluetoothDeviceChromeOS::OnGetConnInfoError,
@@ -369,7 +366,7 @@
     // Initiate high-security connection with pairing.
     BeginPairing(pairing_delegate);
 
-    bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->Pair(
+    DBusThreadManager::Get()->GetBluetoothDeviceClient()->Pair(
         object_path_,
         base::Bind(&BluetoothDeviceChromeOS::OnPairDuringConnect,
                    weak_ptr_factory_.GetWeakPtr(), callback, error_callback),
@@ -385,7 +382,7 @@
   DCHECK(pairing_delegate);
   BeginPairing(pairing_delegate);
 
-  bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->Pair(
+  DBusThreadManager::Get()->GetBluetoothDeviceClient()->Pair(
       object_path_, base::Bind(&BluetoothDeviceChromeOS::OnPair,
                                weak_ptr_factory_.GetWeakPtr(), callback),
       base::Bind(&BluetoothDeviceChromeOS::OnPairError,
@@ -432,7 +429,7 @@
   if (!canceled) {
     VLOG(1) << object_path_.value() << ": No pairing context or callback. "
             << "Sending explicit cancel";
-    bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->CancelPairing(
+    DBusThreadManager::Get()->GetBluetoothDeviceClient()->CancelPairing(
         object_path_, base::Bind(&base::DoNothing),
         base::Bind(&BluetoothDeviceChromeOS::OnCancelPairingError,
                    weak_ptr_factory_.GetWeakPtr()));
@@ -448,7 +445,7 @@
 void BluetoothDeviceChromeOS::Disconnect(const base::Closure& callback,
                                          const ErrorCallback& error_callback) {
   VLOG(1) << object_path_.value() << ": Disconnecting";
-  bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->Disconnect(
+  DBusThreadManager::Get()->GetBluetoothDeviceClient()->Disconnect(
       object_path_, base::Bind(&BluetoothDeviceChromeOS::OnDisconnect,
                                weak_ptr_factory_.GetWeakPtr(), callback),
       base::Bind(&BluetoothDeviceChromeOS::OnDisconnectError,
@@ -457,7 +454,7 @@
 
 void BluetoothDeviceChromeOS::Forget(const ErrorCallback& error_callback) {
   VLOG(1) << object_path_.value() << ": Removing device";
-  bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()->RemoveDevice(
+  DBusThreadManager::Get()->GetBluetoothAdapterClient()->RemoveDevice(
       adapter()->object_path(), object_path_, base::Bind(&base::DoNothing),
       base::Bind(&BluetoothDeviceChromeOS::OnForgetError,
                  weak_ptr_factory_.GetWeakPtr(), error_callback));
@@ -536,10 +533,9 @@
     return;
   }
 
-  bluez::BluetoothGattServiceClient::Properties* properties =
-      bluez::BluezDBusManager::Get()
-          ->GetBluetoothGattServiceClient()
-          ->GetProperties(object_path);
+  BluetoothGattServiceClient::Properties* properties =
+      DBusThreadManager::Get()->GetBluetoothGattServiceClient()->GetProperties(
+          object_path);
   DCHECK(properties);
   if (properties->device.value() != object_path_) {
     VLOG(2) << "Remote GATT service does not belong to this device.";
@@ -607,7 +603,7 @@
     const base::Closure& callback,
     const ConnectErrorCallback& error_callback) {
   VLOG(1) << object_path_.value() << ": Connecting";
-  bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->Connect(
+  DBusThreadManager::Get()->GetBluetoothDeviceClient()->Connect(
       object_path_,
       base::Bind(&BluetoothDeviceChromeOS::OnConnect,
                  weak_ptr_factory_.GetWeakPtr(), after_pairing, callback),
@@ -735,7 +731,7 @@
   // first; there's no harm in doing this and it solves any race conditions
   // with the property becoming true or false and this call happening before
   // we get the D-Bus signal about the earlier change.
-  bluez::BluezDBusManager::Get()
+  DBusThreadManager::Get()
       ->GetBluetoothDeviceClient()
       ->GetProperties(object_path_)
       ->trusted.Set(true, base::Bind(&BluetoothDeviceChromeOS::OnSetTrusted,
diff --git a/device/bluetooth/bluetooth_device_chromeos.h b/device/bluetooth/bluetooth_device_chromeos.h
index 544fdafe..7f66a43 100644
--- a/device/bluetooth/bluetooth_device_chromeos.h
+++ b/device/bluetooth/bluetooth_device_chromeos.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 DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H_
-#define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H_
+#ifndef DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H
+#define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H
 
 #include <string>
 
@@ -11,11 +11,11 @@
 #include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
 #include "base/sequenced_task_runner.h"
+#include "chromeos/dbus/bluetooth_device_client.h"
+#include "chromeos/dbus/bluetooth_gatt_service_client.h"
 #include "dbus/object_path.h"
 #include "device/bluetooth/bluetooth_device.h"
 #include "device/bluetooth/bluetooth_export.h"
-#include "device/bluetooth/dbus/bluetooth_device_client.h"
-#include "device/bluetooth/dbus/bluetooth_gatt_service_client.h"
 
 namespace device {
 class BluetoothSocketThread;
@@ -35,7 +35,7 @@
 // thread.
 class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceChromeOS
     : public device::BluetoothDevice,
-      public bluez::BluetoothGattServiceClient::Observer {
+      public BluetoothGattServiceClient::Observer {
  public:
   // BluetoothDevice override
   uint32 GetBluetoothClass() const override;
@@ -118,7 +118,7 @@
       scoped_refptr<device::BluetoothSocketThread> socket_thread);
   ~BluetoothDeviceChromeOS() override;
 
-  // bluez::BluetoothGattServiceClient::Observer overrides.
+  // BluetoothGattServiceClient::Observer overrides.
   void GattServiceAdded(const dbus::ObjectPath& object_path) override;
   void GattServiceRemoved(const dbus::ObjectPath& object_path) override;
 
@@ -215,4 +215,4 @@
 
 }  // namespace chromeos
 
-#endif  // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H_
+#endif  // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H
diff --git a/device/bluetooth/bluetooth_gatt_chromeos_unittest.cc b/device/bluetooth/bluetooth_gatt_chromeos_unittest.cc
index cf9e441f..5cf067c 100644
--- a/device/bluetooth/bluetooth_gatt_chromeos_unittest.cc
+++ b/device/bluetooth/bluetooth_gatt_chromeos_unittest.cc
@@ -5,6 +5,14 @@
 #include "base/memory/scoped_vector.h"
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
+#include "chromeos/dbus/fake_bluetooth_adapter_client.h"
+#include "chromeos/dbus/fake_bluetooth_agent_manager_client.h"
+#include "chromeos/dbus/fake_bluetooth_device_client.h"
+#include "chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h"
+#include "chromeos/dbus/fake_bluetooth_gatt_descriptor_client.h"
+#include "chromeos/dbus/fake_bluetooth_gatt_service_client.h"
+#include "chromeos/dbus/fake_bluetooth_input_client.h"
 #include "dbus/object_path.h"
 #include "device/bluetooth/bluetooth_adapter.h"
 #include "device/bluetooth/bluetooth_adapter_factory.h"
@@ -15,14 +23,6 @@
 #include "device/bluetooth/bluetooth_gatt_notify_session.h"
 #include "device/bluetooth/bluetooth_gatt_service.h"
 #include "device/bluetooth/bluetooth_uuid.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
-#include "device/bluetooth/dbus/fake_bluetooth_adapter_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_device_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_gatt_service_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_input_client.h"
 #include "device/bluetooth/test/test_bluetooth_adapter_observer.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
@@ -41,11 +41,11 @@
 namespace {
 
 const BluetoothUUID kHeartRateMeasurementUUID(
-    bluez::FakeBluetoothGattCharacteristicClient::kHeartRateMeasurementUUID);
+    FakeBluetoothGattCharacteristicClient::kHeartRateMeasurementUUID);
 const BluetoothUUID kBodySensorLocationUUID(
-    bluez::FakeBluetoothGattCharacteristicClient::kBodySensorLocationUUID);
+    FakeBluetoothGattCharacteristicClient::kBodySensorLocationUUID);
 const BluetoothUUID kHeartRateControlPointUUID(
-    bluez::FakeBluetoothGattCharacteristicClient::kHeartRateControlPointUUID);
+    FakeBluetoothGattCharacteristicClient::kHeartRateControlPointUUID);
 
 // Compares GATT characteristic/descriptor values. Returns true, if the values
 // are equal.
@@ -70,36 +70,32 @@
   }
 
   void SetUp() override {
-    scoped_ptr<bluez::BluezDBusManagerSetter> dbus_setter =
-        bluez::BluezDBusManager::GetSetterForTesting();
-    fake_bluetooth_device_client_ = new bluez::FakeBluetoothDeviceClient;
-    fake_bluetooth_gatt_service_client_ =
-        new bluez::FakeBluetoothGattServiceClient;
+    scoped_ptr<DBusThreadManagerSetter> dbus_setter =
+        chromeos::DBusThreadManager::GetSetterForTesting();
+    fake_bluetooth_device_client_ = new FakeBluetoothDeviceClient;
+    fake_bluetooth_gatt_service_client_ = new FakeBluetoothGattServiceClient;
     fake_bluetooth_gatt_characteristic_client_ =
-        new bluez::FakeBluetoothGattCharacteristicClient;
+        new FakeBluetoothGattCharacteristicClient;
     fake_bluetooth_gatt_descriptor_client_ =
-        new bluez::FakeBluetoothGattDescriptorClient;
+        new FakeBluetoothGattDescriptorClient;
     dbus_setter->SetBluetoothDeviceClient(
-        scoped_ptr<bluez::BluetoothDeviceClient>(
-            fake_bluetooth_device_client_));
+        scoped_ptr<BluetoothDeviceClient>(fake_bluetooth_device_client_));
     dbus_setter->SetBluetoothGattServiceClient(
-        scoped_ptr<bluez::BluetoothGattServiceClient>(
+        scoped_ptr<BluetoothGattServiceClient>(
             fake_bluetooth_gatt_service_client_));
     dbus_setter->SetBluetoothGattCharacteristicClient(
-        scoped_ptr<bluez::BluetoothGattCharacteristicClient>(
+        scoped_ptr<BluetoothGattCharacteristicClient>(
             fake_bluetooth_gatt_characteristic_client_));
     dbus_setter->SetBluetoothGattDescriptorClient(
-        scoped_ptr<bluez::BluetoothGattDescriptorClient>(
+        scoped_ptr<BluetoothGattDescriptorClient>(
             fake_bluetooth_gatt_descriptor_client_));
     dbus_setter->SetBluetoothAdapterClient(
-        scoped_ptr<bluez::BluetoothAdapterClient>(
-            new bluez::FakeBluetoothAdapterClient));
+        scoped_ptr<BluetoothAdapterClient>(new FakeBluetoothAdapterClient));
     dbus_setter->SetBluetoothInputClient(
-        scoped_ptr<bluez::BluetoothInputClient>(
-            new bluez::FakeBluetoothInputClient));
+        scoped_ptr<BluetoothInputClient>(new FakeBluetoothInputClient));
     dbus_setter->SetBluetoothAgentManagerClient(
-        scoped_ptr<bluez::BluetoothAgentManagerClient>(
-            new bluez::FakeBluetoothAgentManagerClient));
+        scoped_ptr<BluetoothAgentManagerClient>(
+            new FakeBluetoothAgentManagerClient));
 
     GetAdapter();
 
@@ -114,7 +110,7 @@
     adapter_ = NULL;
     update_sessions_.clear();
     gatt_conn_.reset();
-    bluez::BluezDBusManager::Shutdown();
+    DBusThreadManager::Shutdown();
   }
 
   void GetAdapter() {
@@ -177,12 +173,11 @@
 
   base::MessageLoop message_loop_;
 
-  bluez::FakeBluetoothDeviceClient* fake_bluetooth_device_client_;
-  bluez::FakeBluetoothGattServiceClient* fake_bluetooth_gatt_service_client_;
-  bluez::FakeBluetoothGattCharacteristicClient*
+  FakeBluetoothDeviceClient* fake_bluetooth_device_client_;
+  FakeBluetoothGattServiceClient* fake_bluetooth_gatt_service_client_;
+  FakeBluetoothGattCharacteristicClient*
       fake_bluetooth_gatt_characteristic_client_;
-  bluez::FakeBluetoothGattDescriptorClient*
-      fake_bluetooth_gatt_descriptor_client_;
+  FakeBluetoothGattDescriptorClient* fake_bluetooth_gatt_descriptor_client_;
   scoped_ptr<device::BluetoothGattConnection> gatt_conn_;
   ScopedVector<BluetoothGattNotifySession> update_sessions_;
   scoped_refptr<BluetoothAdapter> adapter_;
@@ -195,10 +190,10 @@
 
 TEST_F(BluetoothGattChromeOSTest, GattConnection) {
   fake_bluetooth_device_client_->CreateDevice(
-      dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
+      dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
   BluetoothDevice* device =
-      adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress);
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kLowEnergyAddress);
   ASSERT_TRUE(device);
   ASSERT_FALSE(device->IsConnected());
   ASSERT_FALSE(gatt_conn_.get());
@@ -216,7 +211,7 @@
   EXPECT_TRUE(device->IsConnected());
   ASSERT_TRUE(gatt_conn_.get());
   EXPECT_TRUE(gatt_conn_->IsConnected());
-  EXPECT_EQ(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress,
+  EXPECT_EQ(FakeBluetoothDeviceClient::kLowEnergyAddress,
             gatt_conn_->GetDeviceAddress());
 
   gatt_conn_->Disconnect();
@@ -258,8 +253,8 @@
   EXPECT_TRUE(gatt_conn_->IsConnected());
 
   fake_bluetooth_device_client_->RemoveDevice(
-      dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
+      dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
   ASSERT_TRUE(gatt_conn_.get());
   EXPECT_FALSE(gatt_conn_->IsConnected());
 }
@@ -268,10 +263,10 @@
   // Create a fake LE device. We store the device pointer here because this is a
   // test. It's unsafe to do this in production as the device might get deleted.
   fake_bluetooth_device_client_->CreateDevice(
-      dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
+      dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
   BluetoothDevice* device =
-      adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress);
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kLowEnergyAddress);
   ASSERT_TRUE(device);
 
   TestBluetoothAdapterObserver observer(adapter_);
@@ -284,14 +279,14 @@
 
   // Expose the fake Heart Rate Service.
   fake_bluetooth_gatt_service_client_->ExposeHeartRateService(
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
   EXPECT_EQ(1, observer.gatt_service_added_count());
   EXPECT_EQ(0, observer.gatt_service_removed_count());
   EXPECT_FALSE(observer.last_gatt_service_id().empty());
   EXPECT_EQ(1U, device->GetGattServices().size());
-  EXPECT_EQ(BluetoothUUID(
-                bluez::FakeBluetoothGattServiceClient::kHeartRateServiceUUID),
-            observer.last_gatt_service_uuid());
+  EXPECT_EQ(
+      BluetoothUUID(FakeBluetoothGattServiceClient::kHeartRateServiceUUID),
+      observer.last_gatt_service_uuid());
 
   BluetoothGattService* service =
       device->GetGattService(observer.last_gatt_service_id());
@@ -311,9 +306,9 @@
   EXPECT_EQ(1, observer.gatt_service_removed_count());
   EXPECT_FALSE(observer.last_gatt_service_id().empty());
   EXPECT_TRUE(device->GetGattServices().empty());
-  EXPECT_EQ(BluetoothUUID(
-                bluez::FakeBluetoothGattServiceClient::kHeartRateServiceUUID),
-            observer.last_gatt_service_uuid());
+  EXPECT_EQ(
+      BluetoothUUID(FakeBluetoothGattServiceClient::kHeartRateServiceUUID),
+      observer.last_gatt_service_uuid());
 
   EXPECT_EQ(NULL, device->GetGattService(observer.last_gatt_service_id()));
 
@@ -321,14 +316,14 @@
   observer.last_gatt_service_uuid() = BluetoothUUID();
   observer.last_gatt_service_id().clear();
   fake_bluetooth_gatt_service_client_->ExposeHeartRateService(
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
   EXPECT_EQ(2, observer.gatt_service_added_count());
   EXPECT_EQ(1, observer.gatt_service_removed_count());
   EXPECT_FALSE(observer.last_gatt_service_id().empty());
   EXPECT_EQ(1U, device->GetGattServices().size());
-  EXPECT_EQ(BluetoothUUID(
-                bluez::FakeBluetoothGattServiceClient::kHeartRateServiceUUID),
-            observer.last_gatt_service_uuid());
+  EXPECT_EQ(
+      BluetoothUUID(FakeBluetoothGattServiceClient::kHeartRateServiceUUID),
+      observer.last_gatt_service_uuid());
 
   // The object |service| points to should have been deallocated. |device|
   // should contain a brand new instance.
@@ -344,30 +339,30 @@
   observer.last_gatt_service_uuid() = BluetoothUUID();
   observer.last_gatt_service_id().clear();
   fake_bluetooth_device_client_->RemoveDevice(
-      dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
+      dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
 
   EXPECT_EQ(2, observer.gatt_service_added_count());
   EXPECT_EQ(2, observer.gatt_service_removed_count());
   EXPECT_FALSE(observer.last_gatt_service_id().empty());
-  EXPECT_EQ(BluetoothUUID(
-                bluez::FakeBluetoothGattServiceClient::kHeartRateServiceUUID),
-            observer.last_gatt_service_uuid());
-  EXPECT_EQ(NULL, adapter_->GetDevice(
-                      bluez::FakeBluetoothDeviceClient::kLowEnergyAddress));
+  EXPECT_EQ(
+      BluetoothUUID(FakeBluetoothGattServiceClient::kHeartRateServiceUUID),
+      observer.last_gatt_service_uuid());
+  EXPECT_EQ(NULL,
+            adapter_->GetDevice(FakeBluetoothDeviceClient::kLowEnergyAddress));
 }
 
 TEST_F(BluetoothGattChromeOSTest, ServicesDiscovered) {
   // Create a fake LE device. We store the device pointer here because this is a
   // test. It's unsafe to do this in production as the device might get deleted.
   fake_bluetooth_device_client_->CreateDevice(
-      dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
+      dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
   BluetoothDevice* device =
-      adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress);
-  bluez::FakeBluetoothDeviceClient::Properties* properties =
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kLowEnergyAddress);
+  FakeBluetoothDeviceClient::Properties* properties =
       fake_bluetooth_device_client_->GetProperties(
-          dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
+          dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
 
   ASSERT_TRUE(device);
 
@@ -377,23 +372,23 @@
 
   // Expose the fake Heart Rate Service.
   fake_bluetooth_gatt_service_client_->ExposeHeartRateService(
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
   // Notify that all services have been discovered.
   properties->gatt_services.ReplaceValue(
       fake_bluetooth_gatt_service_client_->GetServices());
 
   EXPECT_EQ(1, observer.gatt_services_discovered_count());
   EXPECT_EQ(device, observer.last_device());
-  EXPECT_EQ(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress,
+  EXPECT_EQ(FakeBluetoothDeviceClient::kLowEnergyAddress,
             observer.last_device_address());
 }
 
 TEST_F(BluetoothGattChromeOSTest, GattCharacteristicAddedAndRemoved) {
   fake_bluetooth_device_client_->CreateDevice(
-      dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
+      dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
   BluetoothDevice* device =
-      adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress);
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kLowEnergyAddress);
   ASSERT_TRUE(device);
 
   TestBluetoothAdapterObserver observer(adapter_);
@@ -401,7 +396,7 @@
   // Expose the fake Heart Rate service. This will asynchronously expose
   // characteristics.
   fake_bluetooth_gatt_service_client_->ExposeHeartRateService(
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
   ASSERT_EQ(1, observer.gatt_service_added_count());
 
   BluetoothGattService* service =
@@ -458,10 +453,10 @@
 
 TEST_F(BluetoothGattChromeOSTest, GattDescriptorAddedAndRemoved) {
   fake_bluetooth_device_client_->CreateDevice(
-      dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
+      dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
   BluetoothDevice* device =
-      adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress);
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kLowEnergyAddress);
   ASSERT_TRUE(device);
 
   TestBluetoothAdapterObserver observer(adapter_);
@@ -469,7 +464,7 @@
   // Expose the fake Heart Rate service. This will asynchronously expose
   // characteristics.
   fake_bluetooth_gatt_service_client_->ExposeHeartRateService(
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
   ASSERT_EQ(1, observer.gatt_service_added_count());
 
   BluetoothGattService* service =
@@ -530,7 +525,7 @@
   observer.last_gatt_descriptor_uuid() = BluetoothUUID();
   fake_bluetooth_gatt_descriptor_client_->ExposeDescriptor(
       dbus::ObjectPath(characteristic->GetIdentifier()),
-      bluez::FakeBluetoothGattDescriptorClient::
+      FakeBluetoothGattDescriptorClient::
           kClientCharacteristicConfigurationUUID);
   EXPECT_EQ(0, observer.gatt_service_changed_count());
   EXPECT_EQ(1U, characteristic->GetDescriptors().size());
@@ -554,10 +549,10 @@
 
   // Create the fake D-Bus objects.
   fake_bluetooth_device_client_->CreateDevice(
-      dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
+      dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
   fake_bluetooth_gatt_service_client_->ExposeHeartRateService(
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
   while (!fake_bluetooth_gatt_characteristic_client_->IsHeartRateVisible())
     base::RunLoop().RunUntilIdle();
   ASSERT_TRUE(fake_bluetooth_gatt_service_client_->IsHeartRateVisible());
@@ -566,7 +561,7 @@
   // Create the adapter. This should create all the GATT objects.
   GetAdapter();
   BluetoothDevice* device =
-      adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress);
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kLowEnergyAddress);
   ASSERT_TRUE(device);
   EXPECT_EQ(1U, device->GetGattServices().size());
 
@@ -574,9 +569,9 @@
   ASSERT_TRUE(service);
   EXPECT_FALSE(service->IsLocal());
   EXPECT_TRUE(service->IsPrimary());
-  EXPECT_EQ(BluetoothUUID(
-                bluez::FakeBluetoothGattServiceClient::kHeartRateServiceUUID),
-            service->GetUUID());
+  EXPECT_EQ(
+      BluetoothUUID(FakeBluetoothGattServiceClient::kHeartRateServiceUUID),
+      service->GetUUID());
   EXPECT_EQ(service, device->GetGattServices()[0]);
   EXPECT_EQ(service, device->GetGattService(service->GetIdentifier()));
   EXPECT_FALSE(service->IsLocal());
@@ -586,8 +581,8 @@
       fake_bluetooth_gatt_characteristic_client_->
           GetBodySensorLocationPath().value());
   ASSERT_TRUE(characteristic);
-  EXPECT_EQ(BluetoothUUID(bluez::FakeBluetoothGattCharacteristicClient::
-                              kBodySensorLocationUUID),
+  EXPECT_EQ(BluetoothUUID(
+                FakeBluetoothGattCharacteristicClient::kBodySensorLocationUUID),
             characteristic->GetUUID());
   EXPECT_FALSE(characteristic->IsLocal());
   EXPECT_TRUE(characteristic->GetDescriptors().empty());
@@ -596,9 +591,10 @@
       fake_bluetooth_gatt_characteristic_client_->
           GetHeartRateControlPointPath().value());
   ASSERT_TRUE(characteristic);
-  EXPECT_EQ(BluetoothUUID(bluez::FakeBluetoothGattCharacteristicClient::
-                              kHeartRateControlPointUUID),
-            characteristic->GetUUID());
+  EXPECT_EQ(
+      BluetoothUUID(
+          FakeBluetoothGattCharacteristicClient::kHeartRateControlPointUUID),
+      characteristic->GetUUID());
   EXPECT_FALSE(characteristic->IsLocal());
   EXPECT_TRUE(characteristic->GetDescriptors().empty());
 
@@ -606,9 +602,10 @@
       fake_bluetooth_gatt_characteristic_client_->
           GetHeartRateMeasurementPath().value());
   ASSERT_TRUE(characteristic);
-  EXPECT_EQ(BluetoothUUID(bluez::FakeBluetoothGattCharacteristicClient::
-                              kHeartRateMeasurementUUID),
-            characteristic->GetUUID());
+  EXPECT_EQ(
+      BluetoothUUID(
+          FakeBluetoothGattCharacteristicClient::kHeartRateMeasurementUUID),
+      characteristic->GetUUID());
   EXPECT_FALSE(characteristic->IsLocal());
   EXPECT_EQ(1U, characteristic->GetDescriptors().size());
 
@@ -621,10 +618,10 @@
 
 TEST_F(BluetoothGattChromeOSTest, GattCharacteristicValue) {
   fake_bluetooth_device_client_->CreateDevice(
-      dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
+      dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
   BluetoothDevice* device =
-      adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress);
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kLowEnergyAddress);
   ASSERT_TRUE(device);
 
   TestBluetoothAdapterObserver observer(adapter_);
@@ -632,7 +629,7 @@
   // Expose the fake Heart Rate service. This will asynchronously expose
   // characteristics.
   fake_bluetooth_gatt_service_client_->ExposeHeartRateService(
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
   ASSERT_EQ(1, observer.gatt_service_added_count());
 
   BluetoothGattService* service =
@@ -836,10 +833,10 @@
 
 TEST_F(BluetoothGattChromeOSTest, GattCharacteristicProperties) {
   fake_bluetooth_device_client_->CreateDevice(
-      dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
+      dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
   BluetoothDevice* device =
-      adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress);
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kLowEnergyAddress);
   ASSERT_TRUE(device);
 
   TestBluetoothAdapterObserver observer(adapter_);
@@ -847,7 +844,7 @@
   // Expose the fake Heart Rate service. This will asynchronously expose
   // characteristics.
   fake_bluetooth_gatt_service_client_->ExposeHeartRateService(
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
 
   BluetoothGattService* service =
       device->GetGattService(observer.last_gatt_service_id());
@@ -878,10 +875,10 @@
 
 TEST_F(BluetoothGattChromeOSTest, GattDescriptorValue) {
   fake_bluetooth_device_client_->CreateDevice(
-      dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
+      dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
   BluetoothDevice* device =
-      adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress);
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kLowEnergyAddress);
   ASSERT_TRUE(device);
 
   TestBluetoothAdapterObserver observer(adapter_);
@@ -889,7 +886,7 @@
   // Expose the fake Heart Rate service. This will asynchronously expose
   // characteristics.
   fake_bluetooth_gatt_service_client_->ExposeHeartRateService(
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
   ASSERT_EQ(1, observer.gatt_service_added_count());
 
   BluetoothGattService* service =
@@ -1001,10 +998,10 @@
 
 TEST_F(BluetoothGattChromeOSTest, NotifySessions) {
   fake_bluetooth_device_client_->CreateDevice(
-      dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
+      dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
   BluetoothDevice* device =
-      adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress);
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kLowEnergyAddress);
   ASSERT_TRUE(device);
 
   TestBluetoothAdapterObserver observer(adapter_);
@@ -1012,7 +1009,7 @@
   // Expose the fake Heart Rate service. This will asynchronously expose
   // characteristics.
   fake_bluetooth_gatt_service_client_->ExposeHeartRateService(
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
   ASSERT_EQ(1, observer.gatt_service_added_count());
 
   BluetoothGattService* service =
@@ -1150,10 +1147,10 @@
 
 TEST_F(BluetoothGattChromeOSTest, NotifySessionsMadeInactive) {
   fake_bluetooth_device_client_->CreateDevice(
-      dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath),
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
+      dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath),
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
   BluetoothDevice* device =
-      adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress);
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kLowEnergyAddress);
   ASSERT_TRUE(device);
 
   TestBluetoothAdapterObserver observer(adapter_);
@@ -1161,7 +1158,7 @@
   // Expose the fake Heart Rate service. This will asynchronously expose
   // characteristics.
   fake_bluetooth_gatt_service_client_->ExposeHeartRateService(
-      dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath));
+      dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath));
   ASSERT_EQ(1, observer.gatt_service_added_count());
 
   BluetoothGattService* service =
diff --git a/device/bluetooth/bluetooth_gatt_connection_chromeos.cc b/device/bluetooth/bluetooth_gatt_connection_chromeos.cc
index 57aaa4d3..6c16db8 100644
--- a/device/bluetooth/bluetooth_gatt_connection_chromeos.cc
+++ b/device/bluetooth/bluetooth_gatt_connection_chromeos.cc
@@ -6,9 +6,9 @@
 
 #include "base/bind.h"
 #include "base/logging.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
 #include "device/bluetooth/bluetooth_adapter.h"
 #include "device/bluetooth/bluetooth_device.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
 
 namespace chromeos {
 
@@ -23,12 +23,11 @@
   DCHECK(!device_address_.empty());
   DCHECK(object_path_.IsValid());
 
-  bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->AddObserver(this);
+  DBusThreadManager::Get()->GetBluetoothDeviceClient()->AddObserver(this);
 }
 
 BluetoothGattConnectionChromeOS::~BluetoothGattConnectionChromeOS() {
-  bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->RemoveObserver(
-      this);
+  DBusThreadManager::Get()->GetBluetoothDeviceClient()->RemoveObserver(this);
   Disconnect();
 }
 
@@ -41,8 +40,8 @@
   if (!connected_)
     return false;
 
-  bluez::BluetoothDeviceClient::Properties* properties =
-      bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
+  BluetoothDeviceClient::Properties* properties =
+      DBusThreadManager::Get()->GetBluetoothDeviceClient()->GetProperties(
           object_path_);
   if (!properties || !properties->connected.value())
     connected_ = false;
@@ -83,8 +82,8 @@
   if (!connected_)
     return;
 
-  bluez::BluetoothDeviceClient::Properties* properties =
-      bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties(
+  BluetoothDeviceClient::Properties* properties =
+      DBusThreadManager::Get()->GetBluetoothDeviceClient()->GetProperties(
           object_path_);
 
   if (!properties) {
diff --git a/device/bluetooth/bluetooth_gatt_connection_chromeos.h b/device/bluetooth/bluetooth_gatt_connection_chromeos.h
index 6e40283b..66c1a1a04 100644
--- a/device/bluetooth/bluetooth_gatt_connection_chromeos.h
+++ b/device/bluetooth/bluetooth_gatt_connection_chromeos.h
@@ -9,9 +9,9 @@
 
 #include "base/callback.h"
 #include "base/memory/weak_ptr.h"
+#include "chromeos/dbus/bluetooth_device_client.h"
 #include "dbus/object_path.h"
 #include "device/bluetooth/bluetooth_gatt_connection.h"
-#include "device/bluetooth/dbus/bluetooth_device_client.h"
 
 namespace device {
 
@@ -23,9 +23,8 @@
 
 // BluetoothGattConnectionChromeOS implements BluetoothGattConnection for the
 // Chrome OS platform.
-class BluetoothGattConnectionChromeOS
-    : public device::BluetoothGattConnection,
-      public bluez::BluetoothDeviceClient::Observer {
+class BluetoothGattConnectionChromeOS : public device::BluetoothGattConnection,
+                                        public BluetoothDeviceClient::Observer {
  public:
   explicit BluetoothGattConnectionChromeOS(
       scoped_refptr<device::BluetoothAdapter> adapter,
@@ -38,7 +37,7 @@
   void Disconnect() override;
 
  private:
-  // bluez::Bluetooth$1Client::Observer overrides.
+  // chromeos::BluetoothDeviceClient::Observer overrides.
   void DeviceRemoved(const dbus::ObjectPath& object_path) override;
   void DevicePropertyChanged(const dbus::ObjectPath& object_path,
                              const std::string& property_name) override;
diff --git a/device/bluetooth/bluetooth_gatt_notify_session_chromeos.cc b/device/bluetooth/bluetooth_gatt_notify_session_chromeos.cc
index 02f7ed8b..ba7b843 100644
--- a/device/bluetooth/bluetooth_gatt_notify_session_chromeos.cc
+++ b/device/bluetooth/bluetooth_gatt_notify_session_chromeos.cc
@@ -6,11 +6,11 @@
 
 #include "base/bind.h"
 #include "base/logging.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
 #include "device/bluetooth/bluetooth_adapter.h"
 #include "device/bluetooth/bluetooth_device.h"
 #include "device/bluetooth/bluetooth_gatt_service.h"
 #include "device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
 
 namespace chromeos {
 
@@ -32,13 +32,12 @@
   DCHECK(!characteristic_id_.empty());
   DCHECK(object_path_.IsValid());
 
-  bluez::BluezDBusManager::Get()
-      ->GetBluetoothGattCharacteristicClient()
-      ->AddObserver(this);
+  DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()->AddObserver(
+      this);
 }
 
 BluetoothGattNotifySessionChromeOS::~BluetoothGattNotifySessionChromeOS() {
-  bluez::BluezDBusManager::Get()
+  DBusThreadManager::Get()
       ->GetBluetoothGattCharacteristicClient()
       ->RemoveObserver(this);
   Stop(base::Bind(&base::DoNothing));
@@ -59,12 +58,11 @@
   // actually active, since the characteristic might have stopped sending
   // notifications yet this method was called before we processed the
   // observer event (e.g. because somebody else called this method in their
-  // bluez::BluetoothGattCharacteristicClient::Observer implementation, which
-  // was
+  // BluetoothGattCharacteristicClient::Observer implementation, which was
   // called before ours). Check the client to see if notifications are still
   // being sent.
-  bluez::BluetoothGattCharacteristicClient::Properties* properties =
-      bluez::BluezDBusManager::Get()
+  BluetoothGattCharacteristicClient::Properties* properties =
+      DBusThreadManager::Get()
           ->GetBluetoothGattCharacteristicClient()
           ->GetProperties(object_path_);
   if (!properties || !properties->notifying.value())
@@ -117,8 +115,8 @@
   if (!active_)
     return;
 
-  bluez::BluetoothGattCharacteristicClient::Properties* properties =
-      bluez::BluezDBusManager::Get()
+  BluetoothGattCharacteristicClient::Properties* properties =
+      DBusThreadManager::Get()
           ->GetBluetoothGattCharacteristicClient()
           ->GetProperties(object_path_);
   if (!properties) {
diff --git a/device/bluetooth/bluetooth_gatt_notify_session_chromeos.h b/device/bluetooth/bluetooth_gatt_notify_session_chromeos.h
index ef6e8da4..245a72f 100644
--- a/device/bluetooth/bluetooth_gatt_notify_session_chromeos.h
+++ b/device/bluetooth/bluetooth_gatt_notify_session_chromeos.h
@@ -8,8 +8,8 @@
 #include <string>
 
 #include "base/callback.h"
+#include "chromeos/dbus/bluetooth_gatt_characteristic_client.h"
 #include "device/bluetooth/bluetooth_gatt_notify_session.h"
-#include "device/bluetooth/dbus/bluetooth_gatt_characteristic_client.h"
 
 namespace device {
 
@@ -25,7 +25,7 @@
 // BluetoothGattNotifySession for the Chrome OS platform.
 class BluetoothGattNotifySessionChromeOS
     : public device::BluetoothGattNotifySession,
-      public bluez::BluetoothGattCharacteristicClient::Observer {
+      public BluetoothGattCharacteristicClient::Observer {
  public:
   ~BluetoothGattNotifySessionChromeOS() override;
 
@@ -44,7 +44,7 @@
       const std::string& characteristic_identifier,
       const dbus::ObjectPath& characteristic_path);
 
-  // bluez::BluetoothGattCharacteristicClient::Observer overrides.
+  // BluetoothGattCharacteristicClient::Observer overrides.
   void GattCharacteristicRemoved(const dbus::ObjectPath& object_path) override;
   void GattCharacteristicPropertyChanged(
       const dbus::ObjectPath& object_path,
diff --git a/device/bluetooth/bluetooth_pairing_chromeos.cc b/device/bluetooth/bluetooth_pairing_chromeos.cc
index 4541fb38..2bc67cb 100644
--- a/device/bluetooth/bluetooth_pairing_chromeos.cc
+++ b/device/bluetooth/bluetooth_pairing_chromeos.cc
@@ -55,26 +55,25 @@
   }
 
   if (!pincode_callback_.is_null()) {
-    pincode_callback_.Run(
-        bluez::BluetoothAgentServiceProvider::Delegate::CANCELLED, "");
+    pincode_callback_.Run(BluetoothAgentServiceProvider::Delegate::CANCELLED,
+                          "");
   }
 
   if (!passkey_callback_.is_null()) {
-    passkey_callback_.Run(
-        bluez::BluetoothAgentServiceProvider::Delegate::CANCELLED, 0);
+    passkey_callback_.Run(BluetoothAgentServiceProvider::Delegate::CANCELLED,
+                          0);
   }
 
   if (!confirmation_callback_.is_null()) {
     confirmation_callback_.Run(
-        bluez::BluetoothAgentServiceProvider::Delegate::CANCELLED);
+        BluetoothAgentServiceProvider::Delegate::CANCELLED);
   }
 
   pairing_delegate_ = NULL;
 }
 
 void BluetoothPairingChromeOS::RequestPinCode(
-    const bluez::BluetoothAgentServiceProvider::Delegate::PinCodeCallback&
-        callback) {
+    const BluetoothAgentServiceProvider::Delegate::PinCodeCallback& callback) {
   UMA_HISTOGRAM_ENUMERATION("Bluetooth.PairingMethod",
                             UMA_PAIRING_METHOD_REQUEST_PINCODE,
                             UMA_PAIRING_METHOD_COUNT);
@@ -93,7 +92,7 @@
   if (pincode_callback_.is_null())
     return;
 
-  pincode_callback_.Run(bluez::BluetoothAgentServiceProvider::Delegate::SUCCESS,
+  pincode_callback_.Run(BluetoothAgentServiceProvider::Delegate::SUCCESS,
                         pincode);
   pincode_callback_.Reset();
 
@@ -121,8 +120,7 @@
 }
 
 void BluetoothPairingChromeOS::RequestPasskey(
-    const bluez::BluetoothAgentServiceProvider::Delegate::PasskeyCallback&
-        callback) {
+    const BluetoothAgentServiceProvider::Delegate::PasskeyCallback& callback) {
   UMA_HISTOGRAM_ENUMERATION("Bluetooth.PairingMethod",
                             UMA_PAIRING_METHOD_REQUEST_PASSKEY,
                             UMA_PAIRING_METHOD_COUNT);
@@ -141,7 +139,7 @@
   if (passkey_callback_.is_null())
     return;
 
-  passkey_callback_.Run(bluez::BluetoothAgentServiceProvider::Delegate::SUCCESS,
+  passkey_callback_.Run(BluetoothAgentServiceProvider::Delegate::SUCCESS,
                         passkey);
   passkey_callback_.Reset();
 
@@ -160,6 +158,7 @@
   ResetCallbacks();
   pairing_delegate_used_ = true;
   pairing_delegate_->DisplayPasskey(device_, passkey);
+
 }
 
 void BluetoothPairingChromeOS::KeysEntered(uint16 entered) {
@@ -175,7 +174,7 @@
 
 void BluetoothPairingChromeOS::RequestConfirmation(
     uint32 passkey,
-    const bluez::BluetoothAgentServiceProvider::Delegate::ConfirmationCallback&
+    const BluetoothAgentServiceProvider::Delegate::ConfirmationCallback&
         callback) {
   UMA_HISTOGRAM_ENUMERATION("Bluetooth.PairingMethod",
                             UMA_PAIRING_METHOD_CONFIRM_PASSKEY,
@@ -188,7 +187,7 @@
 }
 
 void BluetoothPairingChromeOS::RequestAuthorization(
-    const bluez::BluetoothAgentServiceProvider::Delegate::ConfirmationCallback&
+    const BluetoothAgentServiceProvider::Delegate::ConfirmationCallback&
         callback) {
   UMA_HISTOGRAM_ENUMERATION("Bluetooth.PairingMethod",
                             UMA_PAIRING_METHOD_NONE,
@@ -208,8 +207,7 @@
   if (confirmation_callback_.is_null())
     return;
 
-  confirmation_callback_.Run(
-      bluez::BluetoothAgentServiceProvider::Delegate::SUCCESS);
+  confirmation_callback_.Run(BluetoothAgentServiceProvider::Delegate::SUCCESS);
   confirmation_callback_.Reset();
 
   // If this is not an outgoing connection to the device, clean up the pairing
@@ -220,13 +218,12 @@
 }
 
 bool BluetoothPairingChromeOS::RejectPairing() {
-  return RunPairingCallbacks(
-      bluez::BluetoothAgentServiceProvider::Delegate::REJECTED);
+  return RunPairingCallbacks(BluetoothAgentServiceProvider::Delegate::REJECTED);
 }
 
 bool BluetoothPairingChromeOS::CancelPairing() {
   return RunPairingCallbacks(
-      bluez::BluetoothAgentServiceProvider::Delegate::CANCELLED);
+      BluetoothAgentServiceProvider::Delegate::CANCELLED);
 }
 
 BluetoothDevice::PairingDelegate*
@@ -241,7 +238,7 @@
 }
 
 bool BluetoothPairingChromeOS::RunPairingCallbacks(
-    bluez::BluetoothAgentServiceProvider::Delegate::Status status) {
+    BluetoothAgentServiceProvider::Delegate::Status status) {
   pairing_delegate_used_ = true;
 
   bool callback_run = false;
diff --git a/device/bluetooth/bluetooth_pairing_chromeos.h b/device/bluetooth/bluetooth_pairing_chromeos.h
index 0a4ddb6..b50a328e 100644
--- a/device/bluetooth/bluetooth_pairing_chromeos.h
+++ b/device/bluetooth/bluetooth_pairing_chromeos.h
@@ -5,8 +5,8 @@
 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_PAIRING_CHROMEOS_H_
 #define DEVICE_BLUETOOTH_BLUETOOTH_PAIRING_CHROMEOS_H_
 
+#include "chromeos/dbus/bluetooth_agent_service_provider.h"
 #include "device/bluetooth/bluetooth_device.h"
-#include "device/bluetooth/dbus/bluetooth_agent_service_provider.h"
 
 namespace chromeos {
 
@@ -36,8 +36,7 @@
   // calls on this object are translated into the appropriate response to
   // |callback|.
   void RequestPinCode(
-      const bluez::BluetoothAgentServiceProvider::Delegate::PinCodeCallback&
-          callback);
+      const BluetoothAgentServiceProvider::Delegate::PinCodeCallback& callback);
 
   // Indicates whether the device is currently pairing and expecting a
   // PIN Code to be returned.
@@ -58,8 +57,7 @@
   // calls on this object are translated into the appropriate response to
   // |callback|.
   void RequestPasskey(
-      const bluez::BluetoothAgentServiceProvider::Delegate::PasskeyCallback&
-          callback);
+      const BluetoothAgentServiceProvider::Delegate::PasskeyCallback& callback);
 
   // Sends the Passkey |passkey| to the remote device during pairing.
   //
@@ -81,16 +79,18 @@
   // from the current pairing delegate. The ConfirmPairing(), RejectPairing()
   // and CancelPairing() method calls on this object are translated into the
   // appropriate response to |callback|.
-  void RequestConfirmation(uint32 passkey,
-                           const bluez::BluetoothAgentServiceProvider::
-                               Delegate::ConfirmationCallback& callback);
+  void RequestConfirmation(
+      uint32 passkey,
+      const BluetoothAgentServiceProvider::Delegate::ConfirmationCallback&
+          callback);
 
   // Requests authorization that the current device be allowed to pair with
   // this device from the current pairing delegate. The ConfirmPairing(),
   // RejectPairing() and CancelPairing() method calls on this object are
   // translated into the appropriate response to |callback|.
-  void RequestAuthorization(const bluez::BluetoothAgentServiceProvider::
-                                Delegate::ConfirmationCallback& callback);
+  void RequestAuthorization(
+      const BluetoothAgentServiceProvider::Delegate::ConfirmationCallback&
+          callback);
 
   // Confirms to the remote device during pairing that a passkey provided by
   // the ConfirmPasskey() delegate call is displayed on both devices.
@@ -115,7 +115,7 @@
   // Internal method to respond to the relevant callback for a RejectPairing
   // or CancelPairing call.
   bool RunPairingCallbacks(
-      bluez::BluetoothAgentServiceProvider::Delegate::Status status);
+      BluetoothAgentServiceProvider::Delegate::Status status);
 
   // The underlying BluetoothDeviceChromeOS that owns this pairing context.
   BluetoothDeviceChromeOS* device_;
@@ -131,13 +131,11 @@
 
   // During pairing these callbacks are set to those provided by method calls
   // made on the BluetoothAdapterChromeOS instance by its respective
-  // bluez::BluetoothAgentServiceProvider instance, and are called by our own
+  // BluetoothAgentServiceProvider instance, and are called by our own
   // method calls such as SetPinCode() and SetPasskey().
-  bluez::BluetoothAgentServiceProvider::Delegate::PinCodeCallback
-      pincode_callback_;
-  bluez::BluetoothAgentServiceProvider::Delegate::PasskeyCallback
-      passkey_callback_;
-  bluez::BluetoothAgentServiceProvider::Delegate::ConfirmationCallback
+  BluetoothAgentServiceProvider::Delegate::PinCodeCallback pincode_callback_;
+  BluetoothAgentServiceProvider::Delegate::PasskeyCallback passkey_callback_;
+  BluetoothAgentServiceProvider::Delegate::ConfirmationCallback
       confirmation_callback_;
 
   DISALLOW_COPY_AND_ASSIGN(BluetoothPairingChromeOS);
diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.cc b/device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.cc
index 7374f160..7a0f5e3 100644
--- a/device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.cc
@@ -8,13 +8,13 @@
 
 #include "base/logging.h"
 #include "base/strings/stringprintf.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
 #include "device/bluetooth/bluetooth_adapter_chromeos.h"
 #include "device/bluetooth/bluetooth_device.h"
 #include "device/bluetooth/bluetooth_gatt_notify_session_chromeos.h"
 #include "device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h"
 #include "device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.h"
 #include "device/bluetooth/bluetooth_remote_gatt_service_chromeos.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
 #include "third_party/cros_system_api/dbus/service_constants.h"
 
 namespace chromeos {
@@ -44,13 +44,12 @@
       weak_ptr_factory_(this) {
   VLOG(1) << "Creating remote GATT characteristic with identifier: "
           << GetIdentifier() << ", UUID: " << GetUUID().canonical_value();
-  bluez::BluezDBusManager::Get()
-      ->GetBluetoothGattDescriptorClient()
-      ->AddObserver(this);
+  DBusThreadManager::Get()->GetBluetoothGattDescriptorClient()->AddObserver(
+      this);
 
   // Add all known GATT characteristic descriptors.
   const std::vector<dbus::ObjectPath>& gatt_descs =
-      bluez::BluezDBusManager::Get()
+      DBusThreadManager::Get()
           ->GetBluetoothGattDescriptorClient()
           ->GetDescriptors();
   for (std::vector<dbus::ObjectPath>::const_iterator iter = gatt_descs.begin();
@@ -60,9 +59,8 @@
 
 BluetoothRemoteGattCharacteristicChromeOS::
     ~BluetoothRemoteGattCharacteristicChromeOS() {
-  bluez::BluezDBusManager::Get()
-      ->GetBluetoothGattDescriptorClient()
-      ->RemoveObserver(this);
+  DBusThreadManager::Get()->GetBluetoothGattDescriptorClient()->RemoveObserver(
+      this);
 
   // Clean up all the descriptors. There isn't much point in notifying service
   // observers for each descriptor that gets removed, so just delete them.
@@ -84,8 +82,8 @@
 
 device::BluetoothUUID
 BluetoothRemoteGattCharacteristicChromeOS::GetUUID() const {
-  bluez::BluetoothGattCharacteristicClient::Properties* properties =
-      bluez::BluezDBusManager::Get()
+  BluetoothGattCharacteristicClient::Properties* properties =
+      DBusThreadManager::Get()
           ->GetBluetoothGattCharacteristicClient()
           ->GetProperties(object_path_);
   DCHECK(properties);
@@ -98,8 +96,8 @@
 
 const std::vector<uint8>&
 BluetoothRemoteGattCharacteristicChromeOS::GetValue() const {
-  bluez::BluetoothGattCharacteristicClient::Properties* properties =
-      bluez::BluezDBusManager::Get()
+  BluetoothGattCharacteristicClient::Properties* properties =
+      DBusThreadManager::Get()
           ->GetBluetoothGattCharacteristicClient()
           ->GetProperties(object_path_);
 
@@ -115,8 +113,8 @@
 
 device::BluetoothGattCharacteristic::Properties
 BluetoothRemoteGattCharacteristicChromeOS::GetProperties() const {
-  bluez::BluetoothGattCharacteristicClient::Properties* properties =
-      bluez::BluezDBusManager::Get()
+  BluetoothGattCharacteristicClient::Properties* properties =
+      DBusThreadManager::Get()
           ->GetBluetoothGattCharacteristicClient()
           ->GetProperties(object_path_);
   DCHECK(properties);
@@ -159,8 +157,8 @@
 }
 
 bool BluetoothRemoteGattCharacteristicChromeOS::IsNotifying() const {
-  bluez::BluetoothGattCharacteristicClient::Properties* properties =
-      bluez::BluezDBusManager::Get()
+  BluetoothGattCharacteristicClient::Properties* properties =
+      DBusThreadManager::Get()
           ->GetBluetoothGattCharacteristicClient()
           ->GetProperties(object_path_);
   DCHECK(properties);
@@ -206,12 +204,10 @@
           << GetIdentifier() << ", UUID: " << GetUUID().canonical_value()
           << ".";
 
-  bluez::BluezDBusManager::Get()
-      ->GetBluetoothGattCharacteristicClient()
-      ->ReadValue(
-          object_path_, callback,
-          base::Bind(&BluetoothRemoteGattCharacteristicChromeOS::OnError,
-                     weak_ptr_factory_.GetWeakPtr(), error_callback));
+  DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()->ReadValue(
+      object_path_, callback,
+      base::Bind(&BluetoothRemoteGattCharacteristicChromeOS::OnError,
+                 weak_ptr_factory_.GetWeakPtr(), error_callback));
 }
 
 void BluetoothRemoteGattCharacteristicChromeOS::WriteRemoteCharacteristic(
@@ -222,12 +218,10 @@
           << GetIdentifier() << ", UUID: " << GetUUID().canonical_value()
           << ", with value: " << new_value << ".";
 
-  bluez::BluezDBusManager::Get()
-      ->GetBluetoothGattCharacteristicClient()
-      ->WriteValue(
-          object_path_, new_value, callback,
-          base::Bind(&BluetoothRemoteGattCharacteristicChromeOS::OnError,
-                     weak_ptr_factory_.GetWeakPtr(), error_callback));
+  DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()->WriteValue(
+      object_path_, new_value, callback,
+      base::Bind(&BluetoothRemoteGattCharacteristicChromeOS::OnError,
+                 weak_ptr_factory_.GetWeakPtr(), error_callback));
 }
 
 void BluetoothRemoteGattCharacteristicChromeOS::StartNotifySession(
@@ -273,16 +267,13 @@
   }
 
   notify_call_pending_ = true;
-  bluez::BluezDBusManager::Get()
-      ->GetBluetoothGattCharacteristicClient()
-      ->StartNotify(
-          object_path_,
-          base::Bind(
-              &BluetoothRemoteGattCharacteristicChromeOS::OnStartNotifySuccess,
-              weak_ptr_factory_.GetWeakPtr(), callback),
-          base::Bind(
-              &BluetoothRemoteGattCharacteristicChromeOS::OnStartNotifyError,
-              weak_ptr_factory_.GetWeakPtr(), error_callback));
+  DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()->StartNotify(
+      object_path_,
+      base::Bind(
+          &BluetoothRemoteGattCharacteristicChromeOS::OnStartNotifySuccess,
+          weak_ptr_factory_.GetWeakPtr(), callback),
+      base::Bind(&BluetoothRemoteGattCharacteristicChromeOS::OnStartNotifyError,
+                 weak_ptr_factory_.GetWeakPtr(), error_callback));
 }
 
 void BluetoothRemoteGattCharacteristicChromeOS::RemoveNotifySession(
@@ -311,16 +302,13 @@
 
   DCHECK(num_notify_sessions_ == 1);
   notify_call_pending_ = true;
-  bluez::BluezDBusManager::Get()
-      ->GetBluetoothGattCharacteristicClient()
-      ->StopNotify(
-          object_path_,
-          base::Bind(
-              &BluetoothRemoteGattCharacteristicChromeOS::OnStopNotifySuccess,
-              weak_ptr_factory_.GetWeakPtr(), callback),
-          base::Bind(
-              &BluetoothRemoteGattCharacteristicChromeOS::OnStopNotifyError,
-              weak_ptr_factory_.GetWeakPtr(), callback));
+  DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()->StopNotify(
+      object_path_,
+      base::Bind(
+          &BluetoothRemoteGattCharacteristicChromeOS::OnStopNotifySuccess,
+          weak_ptr_factory_.GetWeakPtr(), callback),
+      base::Bind(&BluetoothRemoteGattCharacteristicChromeOS::OnStopNotifyError,
+                 weak_ptr_factory_.GetWeakPtr(), callback));
 }
 
 void BluetoothRemoteGattCharacteristicChromeOS::GattDescriptorAdded(
@@ -331,8 +319,8 @@
     return;
   }
 
-  bluez::BluetoothGattDescriptorClient::Properties* properties =
-      bluez::BluezDBusManager::Get()
+  BluetoothGattDescriptorClient::Properties* properties =
+      DBusThreadManager::Get()
           ->GetBluetoothGattDescriptorClient()
           ->GetProperties(object_path);
   DCHECK(properties);
@@ -384,8 +372,8 @@
     return;
   }
 
-  bluez::BluetoothGattDescriptorClient::Properties* properties =
-      bluez::BluezDBusManager::Get()
+  BluetoothGattDescriptorClient::Properties* properties =
+      DBusThreadManager::Get()
           ->GetBluetoothGattDescriptorClient()
           ->GetProperties(object_path);
 
diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h b/device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h
index 361b3197..a23a1178 100644
--- a/device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h
+++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h
@@ -12,10 +12,10 @@
 #include <vector>
 
 #include "base/memory/weak_ptr.h"
+#include "chromeos/dbus/bluetooth_gatt_descriptor_client.h"
 #include "dbus/object_path.h"
 #include "device/bluetooth/bluetooth_gatt_characteristic.h"
 #include "device/bluetooth/bluetooth_uuid.h"
-#include "device/bluetooth/dbus/bluetooth_gatt_descriptor_client.h"
 
 namespace device {
 
@@ -34,7 +34,7 @@
 // platform.
 class BluetoothRemoteGattCharacteristicChromeOS
     : public device::BluetoothGattCharacteristic,
-      public bluez::BluetoothGattDescriptorClient::Observer {
+      public BluetoothGattDescriptorClient::Observer {
  public:
   // device::BluetoothGattCharacteristic overrides.
   std::string GetIdentifier() const override;
@@ -78,7 +78,7 @@
       const dbus::ObjectPath& object_path);
   ~BluetoothRemoteGattCharacteristicChromeOS() override;
 
-  // bluez::BluetoothGattDescriptorClient::Observer overrides.
+  // BluetoothGattDescriptorClient::Observer overrides.
   void GattDescriptorAdded(const dbus::ObjectPath& object_path) override;
   void GattDescriptorRemoved(const dbus::ObjectPath& object_path) override;
   void GattDescriptorPropertyChanged(const dbus::ObjectPath& object_path,
diff --git a/device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.cc b/device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.cc
index f864c3b..ab1074f8 100644
--- a/device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.cc
@@ -7,10 +7,10 @@
 #include "base/bind.h"
 #include "base/logging.h"
 #include "base/strings/stringprintf.h"
+#include "chromeos/dbus/bluetooth_gatt_descriptor_client.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
 #include "device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h"
 #include "device/bluetooth/bluetooth_remote_gatt_service_chromeos.h"
-#include "device/bluetooth/dbus/bluetooth_gatt_descriptor_client.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
 
 namespace chromeos {
 
@@ -47,8 +47,8 @@
 }
 
 device::BluetoothUUID BluetoothRemoteGattDescriptorChromeOS::GetUUID() const {
-  bluez::BluetoothGattDescriptorClient::Properties* properties =
-      bluez::BluezDBusManager::Get()
+  BluetoothGattDescriptorClient::Properties* properties =
+      DBusThreadManager::Get()
           ->GetBluetoothGattDescriptorClient()
           ->GetProperties(object_path_);
   DCHECK(properties);
@@ -61,8 +61,8 @@
 
 const std::vector<uint8>&
 BluetoothRemoteGattDescriptorChromeOS::GetValue() const {
-  bluez::BluetoothGattDescriptorClient::Properties* properties =
-      bluez::BluezDBusManager::Get()
+  BluetoothGattDescriptorClient::Properties* properties =
+      DBusThreadManager::Get()
           ->GetBluetoothGattDescriptorClient()
           ->GetProperties(object_path_);
 
@@ -90,7 +90,7 @@
           << "descriptor: " << GetIdentifier() << ", UUID: "
           << GetUUID().canonical_value();
 
-  bluez::BluezDBusManager::Get()->GetBluetoothGattDescriptorClient()->ReadValue(
+  DBusThreadManager::Get()->GetBluetoothGattDescriptorClient()->ReadValue(
       object_path_, callback,
       base::Bind(&BluetoothRemoteGattDescriptorChromeOS::OnError,
                  weak_ptr_factory_.GetWeakPtr(), error_callback));
@@ -105,11 +105,10 @@
           << GetUUID().canonical_value() << ", with value: "
           << new_value << ".";
 
-  bluez::BluezDBusManager::Get()
-      ->GetBluetoothGattDescriptorClient()
-      ->WriteValue(object_path_, new_value, callback,
-                   base::Bind(&BluetoothRemoteGattDescriptorChromeOS::OnError,
-                              weak_ptr_factory_.GetWeakPtr(), error_callback));
+  DBusThreadManager::Get()->GetBluetoothGattDescriptorClient()->WriteValue(
+      object_path_, new_value, callback,
+      base::Bind(&BluetoothRemoteGattDescriptorChromeOS::OnError,
+                 weak_ptr_factory_.GetWeakPtr(), error_callback));
 }
 
 void BluetoothRemoteGattDescriptorChromeOS::OnError(
diff --git a/device/bluetooth/bluetooth_remote_gatt_service_chromeos.cc b/device/bluetooth/bluetooth_remote_gatt_service_chromeos.cc
index 8a57fa2..e8176bd 100644
--- a/device/bluetooth/bluetooth_remote_gatt_service_chromeos.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_service_chromeos.cc
@@ -6,12 +6,12 @@
 
 #include "base/logging.h"
 #include "base/strings/stringprintf.h"
+#include "chromeos/dbus/bluetooth_gatt_service_client.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
 #include "device/bluetooth/bluetooth_adapter_chromeos.h"
 #include "device/bluetooth/bluetooth_device_chromeos.h"
 #include "device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h"
 #include "device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.h"
-#include "device/bluetooth/dbus/bluetooth_gatt_service_client.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
 
 namespace chromeos {
 
@@ -41,15 +41,13 @@
           << object_path.value() << ", UUID: " << GetUUID().canonical_value();
   DCHECK(adapter_);
 
-  bluez::BluezDBusManager::Get()->GetBluetoothGattServiceClient()->AddObserver(
+  DBusThreadManager::Get()->GetBluetoothGattServiceClient()->AddObserver(this);
+  DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()->AddObserver(
       this);
-  bluez::BluezDBusManager::Get()
-      ->GetBluetoothGattCharacteristicClient()
-      ->AddObserver(this);
 
   // Add all known GATT characteristics.
   const std::vector<dbus::ObjectPath>& gatt_chars =
-      bluez::BluezDBusManager::Get()
+      DBusThreadManager::Get()
           ->GetBluetoothGattCharacteristicClient()
           ->GetCharacteristics();
   for (std::vector<dbus::ObjectPath>::const_iterator iter = gatt_chars.begin();
@@ -58,10 +56,9 @@
 }
 
 BluetoothRemoteGattServiceChromeOS::~BluetoothRemoteGattServiceChromeOS() {
-  bluez::BluezDBusManager::Get()
-      ->GetBluetoothGattServiceClient()
-      ->RemoveObserver(this);
-  bluez::BluezDBusManager::Get()
+  DBusThreadManager::Get()->GetBluetoothGattServiceClient()->RemoveObserver(
+      this);
+  DBusThreadManager::Get()
       ->GetBluetoothGattCharacteristicClient()
       ->RemoveObserver(this);
 
@@ -84,10 +81,9 @@
 }
 
 device::BluetoothUUID BluetoothRemoteGattServiceChromeOS::GetUUID() const {
-  bluez::BluetoothGattServiceClient::Properties* properties =
-      bluez::BluezDBusManager::Get()
-          ->GetBluetoothGattServiceClient()
-          ->GetProperties(object_path_);
+  BluetoothGattServiceClient::Properties* properties =
+      DBusThreadManager::Get()->GetBluetoothGattServiceClient()->GetProperties(
+          object_path_);
   DCHECK(properties);
   return device::BluetoothUUID(properties->uuid.value());
 }
@@ -97,10 +93,9 @@
 }
 
 bool BluetoothRemoteGattServiceChromeOS::IsPrimary() const {
-  bluez::BluetoothGattServiceClient::Properties* properties =
-      bluez::BluezDBusManager::Get()
-          ->GetBluetoothGattServiceClient()
-          ->GetProperties(object_path_);
+  BluetoothGattServiceClient::Properties* properties =
+      DBusThreadManager::Get()->GetBluetoothGattServiceClient()->GetProperties(
+          object_path_);
   DCHECK(properties);
   return properties->primary.value();
 }
@@ -234,10 +229,9 @@
 
   VLOG(1) << "Service property changed: \"" << property_name << "\", "
           << object_path.value();
-  bluez::BluetoothGattServiceClient::Properties* properties =
-      bluez::BluezDBusManager::Get()
-          ->GetBluetoothGattServiceClient()
-          ->GetProperties(object_path);
+  BluetoothGattServiceClient::Properties* properties =
+      DBusThreadManager::Get()->GetBluetoothGattServiceClient()->GetProperties(
+          object_path);
   DCHECK(properties);
 
   if (property_name != properties->characteristics.name()) {
@@ -263,8 +257,8 @@
     return;
   }
 
-  bluez::BluetoothGattCharacteristicClient::Properties* properties =
-      bluez::BluezDBusManager::Get()
+  BluetoothGattCharacteristicClient::Properties* properties =
+      DBusThreadManager::Get()
           ->GetBluetoothGattCharacteristicClient()
           ->GetProperties(object_path);
   DCHECK(properties);
@@ -321,8 +315,8 @@
   // "Characteristic Extended Properties" descriptor. In this case, kick off
   // a service changed observer event to let observers refresh the
   // characteristics.
-  bluez::BluetoothGattCharacteristicClient::Properties* properties =
-      bluez::BluezDBusManager::Get()
+  BluetoothGattCharacteristicClient::Properties* properties =
+      DBusThreadManager::Get()
           ->GetBluetoothGattCharacteristicClient()
           ->GetProperties(object_path);
 
diff --git a/device/bluetooth/bluetooth_remote_gatt_service_chromeos.h b/device/bluetooth/bluetooth_remote_gatt_service_chromeos.h
index bc35cb7..9aa8fdd 100644
--- a/device/bluetooth/bluetooth_remote_gatt_service_chromeos.h
+++ b/device/bluetooth/bluetooth_remote_gatt_service_chromeos.h
@@ -12,11 +12,11 @@
 #include "base/memory/ref_counted.h"
 #include "base/memory/weak_ptr.h"
 #include "base/observer_list.h"
+#include "chromeos/dbus/bluetooth_gatt_characteristic_client.h"
+#include "chromeos/dbus/bluetooth_gatt_service_client.h"
 #include "dbus/object_path.h"
 #include "device/bluetooth/bluetooth_gatt_service.h"
 #include "device/bluetooth/bluetooth_uuid.h"
-#include "device/bluetooth/dbus/bluetooth_gatt_characteristic_client.h"
-#include "device/bluetooth/dbus/bluetooth_gatt_service_client.h"
 
 namespace device {
 
@@ -36,8 +36,8 @@
 // for remote GATT services on the Chrome OS platform.
 class BluetoothRemoteGattServiceChromeOS
     : public device::BluetoothGattService,
-      public bluez::BluetoothGattServiceClient::Observer,
-      public bluez::BluetoothGattCharacteristicClient::Observer {
+      public BluetoothGattServiceClient::Observer,
+      public BluetoothGattCharacteristicClient::Observer {
  public:
   // device::BluetoothGattService overrides.
   std::string GetIdentifier() const override;
@@ -104,11 +104,11 @@
                                      const dbus::ObjectPath& object_path);
   ~BluetoothRemoteGattServiceChromeOS() override;
 
-  // bluez::BluetoothGattServiceClient::Observer override.
+  // BluetoothGattServiceClient::Observer override.
   void GattServicePropertyChanged(const dbus::ObjectPath& object_path,
                                   const std::string& property_name) override;
 
-  // bluez::BluetoothGattCharacteristicClient::Observer override.
+  // BluetoothGattCharacteristicClient::Observer override.
   void GattCharacteristicAdded(const dbus::ObjectPath& object_path) override;
   void GattCharacteristicRemoved(const dbus::ObjectPath& object_path) override;
   void GattCharacteristicPropertyChanged(
diff --git a/device/bluetooth/bluetooth_socket_chromeos.cc b/device/bluetooth/bluetooth_socket_chromeos.cc
index b3e357d0..da15484 100644
--- a/device/bluetooth/bluetooth_socket_chromeos.cc
+++ b/device/bluetooth/bluetooth_socket_chromeos.cc
@@ -20,6 +20,10 @@
 #include "base/task_runner_util.h"
 #include "base/threading/thread_restrictions.h"
 #include "base/threading/worker_pool.h"
+#include "chromeos/dbus/bluetooth_device_client.h"
+#include "chromeos/dbus/bluetooth_profile_manager_client.h"
+#include "chromeos/dbus/bluetooth_profile_service_provider.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
 #include "dbus/bus.h"
 #include "dbus/file_descriptor.h"
 #include "dbus/object_path.h"
@@ -31,10 +35,6 @@
 #include "device/bluetooth/bluetooth_socket.h"
 #include "device/bluetooth/bluetooth_socket_net.h"
 #include "device/bluetooth/bluetooth_socket_thread.h"
-#include "device/bluetooth/dbus/bluetooth_device_client.h"
-#include "device/bluetooth/dbus/bluetooth_profile_manager_client.h"
-#include "device/bluetooth/dbus/bluetooth_profile_service_provider.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
 #include "net/base/ip_endpoint.h"
 #include "net/base/net_errors.h"
 #include "third_party/cros_system_api/dbus/service_constants.h"
@@ -107,7 +107,7 @@
   device_address_ = device->GetAddress();
   device_path_ = device->object_path();
   uuid_ = uuid;
-  options_.reset(new bluez::BluetoothProfileManagerClient::Options());
+  options_.reset(new BluetoothProfileManagerClient::Options());
   if (security_level == SECURITY_LEVEL_LOW)
     options_->require_authentication.reset(new bool(false));
 
@@ -135,7 +135,7 @@
   adapter_->AddObserver(this);
 
   uuid_ = uuid;
-  options_.reset(new bluez::BluetoothProfileManagerClient::Options());
+  options_.reset(new BluetoothProfileManagerClient::Options());
   if (service_options.name)
     options_->name.reset(new std::string(*service_options.name));
 
@@ -165,7 +165,7 @@
   // In the case below, where an asynchronous task gets posted on the socket
   // thread in BluetoothSocketNet::Close, a reference will be held to this
   // socket by the callback. This may cause the BluetoothAdapter to outlive
-  // BluezDBusManager during shutdown if that callback executes too late.
+  // DBusThreadManager during shutdown if that callback executes too late.
   if (adapter_.get()) {
     adapter_->RemoveObserver(this);
     adapter_ = nullptr;
@@ -264,7 +264,7 @@
   VLOG(1) << uuid_.canonical_value() << ": Got profile, connecting to "
           << device_path_.value();
 
-  bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
+  DBusThreadManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
       device_path_, uuid_.canonical_value(),
       base::Bind(&BluetoothSocketChromeOS::OnConnectProfile, this,
                  success_callback),
@@ -355,7 +355,7 @@
 void BluetoothSocketChromeOS::NewConnection(
     const dbus::ObjectPath& device_path,
     scoped_ptr<dbus::FileDescriptor> fd,
-    const bluez::BluetoothProfileServiceProvider::Delegate::Options& options,
+    const BluetoothProfileServiceProvider::Delegate::Options& options,
     const ConfirmationCallback& callback) {
   DCHECK(ui_task_runner()->RunsTasksOnCurrentThread());
 
@@ -460,7 +460,7 @@
 void BluetoothSocketChromeOS::DoNewConnection(
     const dbus::ObjectPath& device_path,
     scoped_ptr<dbus::FileDescriptor> fd,
-    const bluez::BluetoothProfileServiceProvider::Delegate::Options& options,
+    const BluetoothProfileServiceProvider::Delegate::Options& options,
     const ConfirmationCallback& callback) {
   DCHECK(socket_thread()->task_runner()->RunsTasksOnCurrentThread());
   base::ThreadRestrictions::AssertIOAllowed();
diff --git a/device/bluetooth/bluetooth_socket_chromeos.h b/device/bluetooth/bluetooth_socket_chromeos.h
index a1c76ee2..98d4d02 100644
--- a/device/bluetooth/bluetooth_socket_chromeos.h
+++ b/device/bluetooth/bluetooth_socket_chromeos.h
@@ -10,14 +10,14 @@
 
 #include "base/memory/linked_ptr.h"
 #include "base/memory/scoped_ptr.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/bluetooth_profile_manager_client.h"
+#include "chromeos/dbus/bluetooth_profile_service_provider.h"
 #include "dbus/object_path.h"
 #include "device/bluetooth/bluetooth_adapter.h"
-#include "device/bluetooth/bluetooth_export.h"
 #include "device/bluetooth/bluetooth_socket.h"
 #include "device/bluetooth/bluetooth_socket_net.h"
 #include "device/bluetooth/bluetooth_uuid.h"
-#include "device/bluetooth/dbus/bluetooth_profile_manager_client.h"
-#include "device/bluetooth/dbus/bluetooth_profile_service_provider.h"
 
 namespace dbus {
 class FileDescriptor;
@@ -33,10 +33,10 @@
 // Chrome OS platform.
 //
 // This class is not thread-safe, but is only called from the UI thread.
-class DEVICE_BLUETOOTH_EXPORT BluetoothSocketChromeOS
+class CHROMEOS_EXPORT BluetoothSocketChromeOS
     : public device::BluetoothSocketNet,
       public device::BluetoothAdapter::Observer,
-      public bluez::BluetoothProfileServiceProvider::Delegate {
+      public BluetoothProfileServiceProvider::Delegate {
  public:
   enum SecurityLevel {
     SECURITY_LEVEL_LOW,
@@ -112,12 +112,12 @@
   void OnInternalRegisterProfile(BluetoothAdapterProfileChromeOS* profile);
   void OnInternalRegisterProfileError(const std::string& error_message);
 
-  // bluez::BluetoothProfileServiceProvider::Delegate:
+  // BluetoothProfileServiceProvider::Delegate:
   void Released() override;
   void NewConnection(
       const dbus::ObjectPath& device_path,
       scoped_ptr<dbus::FileDescriptor> fd,
-      const bluez::BluetoothProfileServiceProvider::Delegate::Options& options,
+      const BluetoothProfileServiceProvider::Delegate::Options& options,
       const ConfirmationCallback& callback) override;
   void RequestDisconnection(const dbus::ObjectPath& device_path,
                             const ConfirmationCallback& callback) override;
@@ -131,7 +131,7 @@
   void DoNewConnection(
       const dbus::ObjectPath& device_path,
       scoped_ptr<dbus::FileDescriptor> fd,
-      const bluez::BluetoothProfileServiceProvider::Delegate::Options& options,
+      const BluetoothProfileServiceProvider::Delegate::Options& options,
       const ConfirmationCallback& callback);
 
   // Method run on the UI thread after a new connection has been accepted and
@@ -166,7 +166,7 @@
   device::BluetoothUUID uuid_;
 
   // Copy of the profile options used for registering the profile.
-  scoped_ptr<bluez::BluetoothProfileManagerClient::Options> options_;
+  scoped_ptr<BluetoothProfileManagerClient::Options> options_;
 
   // The profile registered with the adapter for this socket.
   BluetoothAdapterProfileChromeOS* profile_;
@@ -188,7 +188,7 @@
 
     dbus::ObjectPath device_path;
     scoped_ptr<dbus::FileDescriptor> fd;
-    bluez::BluetoothProfileServiceProvider::Delegate::Options options;
+    BluetoothProfileServiceProvider::Delegate::Options options;
     ConfirmationCallback callback;
     bool accepting;
     bool cancelled;
diff --git a/device/bluetooth/bluetooth_socket_chromeos_unittest.cc b/device/bluetooth/bluetooth_socket_chromeos_unittest.cc
index b306008b..477f3a7 100644
--- a/device/bluetooth/bluetooth_socket_chromeos_unittest.cc
+++ b/device/bluetooth/bluetooth_socket_chromeos_unittest.cc
@@ -5,6 +5,14 @@
 #include "base/bind.h"
 #include "base/memory/ref_counted.h"
 #include "base/message_loop/message_loop.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
+#include "chromeos/dbus/fake_bluetooth_adapter_client.h"
+#include "chromeos/dbus/fake_bluetooth_agent_manager_client.h"
+#include "chromeos/dbus/fake_bluetooth_device_client.h"
+#include "chromeos/dbus/fake_bluetooth_gatt_service_client.h"
+#include "chromeos/dbus/fake_bluetooth_input_client.h"
+#include "chromeos/dbus/fake_bluetooth_profile_manager_client.h"
+#include "chromeos/dbus/fake_bluetooth_profile_service_provider.h"
 #include "device/bluetooth/bluetooth_adapter.h"
 #include "device/bluetooth/bluetooth_adapter_chromeos.h"
 #include "device/bluetooth/bluetooth_adapter_factory.h"
@@ -14,14 +22,6 @@
 #include "device/bluetooth/bluetooth_socket_chromeos.h"
 #include "device/bluetooth/bluetooth_socket_thread.h"
 #include "device/bluetooth/bluetooth_uuid.h"
-#include "device/bluetooth/dbus/bluez_dbus_manager.h"
-#include "device/bluetooth/dbus/fake_bluetooth_adapter_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_device_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_gatt_service_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_input_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_profile_manager_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_profile_service_provider.h"
 #include "net/base/io_buffer.h"
 #include "net/base/net_errors.h"
 #include "testing/gtest/include/gtest/gtest.h"
@@ -51,27 +51,24 @@
         last_reason_(BluetoothSocket::kSystemError) {}
 
   void SetUp() override {
-    scoped_ptr<bluez::BluezDBusManagerSetter> dbus_setter =
-        bluez::BluezDBusManager::GetSetterForTesting();
+    scoped_ptr<DBusThreadManagerSetter> dbus_setter =
+        DBusThreadManager::GetSetterForTesting();
 
     dbus_setter->SetBluetoothAdapterClient(
-        scoped_ptr<bluez::BluetoothAdapterClient>(
-            new bluez::FakeBluetoothAdapterClient));
+        scoped_ptr<BluetoothAdapterClient>(new FakeBluetoothAdapterClient));
     dbus_setter->SetBluetoothAgentManagerClient(
-        scoped_ptr<bluez::BluetoothAgentManagerClient>(
-            new bluez::FakeBluetoothAgentManagerClient));
+        scoped_ptr<BluetoothAgentManagerClient>(
+            new FakeBluetoothAgentManagerClient));
     dbus_setter->SetBluetoothDeviceClient(
-        scoped_ptr<bluez::BluetoothDeviceClient>(
-            new bluez::FakeBluetoothDeviceClient));
+        scoped_ptr<BluetoothDeviceClient>(new FakeBluetoothDeviceClient));
     dbus_setter->SetBluetoothGattServiceClient(
-        scoped_ptr<bluez::BluetoothGattServiceClient>(
-            new bluez::FakeBluetoothGattServiceClient));
+        scoped_ptr<BluetoothGattServiceClient>(
+            new FakeBluetoothGattServiceClient));
     dbus_setter->SetBluetoothInputClient(
-        scoped_ptr<bluez::BluetoothInputClient>(
-            new bluez::FakeBluetoothInputClient));
+        scoped_ptr<BluetoothInputClient>(new FakeBluetoothInputClient));
     dbus_setter->SetBluetoothProfileManagerClient(
-        scoped_ptr<bluez::BluetoothProfileManagerClient>(
-            new bluez::FakeBluetoothProfileManagerClient));
+        scoped_ptr<BluetoothProfileManagerClient>(
+            new FakeBluetoothProfileManagerClient));
 
     BluetoothSocketThread::Get();
 
@@ -94,7 +91,7 @@
   void TearDown() override {
     adapter_ = nullptr;
     BluetoothSocketThread::CleanupForTesting();
-    bluez::BluezDBusManager::Shutdown();
+    DBusThreadManager::Shutdown();
   }
 
   void AdapterCallback(scoped_refptr<BluetoothAdapter> adapter) {
@@ -185,12 +182,12 @@
 };
 
 TEST_F(BluetoothSocketChromeOSTest, Connect) {
-  BluetoothDevice* device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
+  BluetoothDevice* device =
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kPairedDeviceAddress);
   ASSERT_TRUE(device != nullptr);
 
   device->ConnectToService(
-      BluetoothUUID(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid),
+      BluetoothUUID(FakeBluetoothProfileManagerClient::kRfcommUuid),
       base::Bind(&BluetoothSocketChromeOSTest::ConnectToServiceSuccessCallback,
                  base::Unretained(this)),
       base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback,
@@ -297,7 +294,7 @@
 
 TEST_F(BluetoothSocketChromeOSTest, Listen) {
   adapter_->CreateRfcommService(
-      BluetoothUUID(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid),
+      BluetoothUUID(FakeBluetoothProfileManagerClient::kRfcommUuid),
       BluetoothAdapter::ServiceOptions(),
       base::Bind(&BluetoothSocketChromeOSTest::CreateServiceSuccessCallback,
                  base::Unretained(this)),
@@ -322,15 +319,15 @@
   //
   // This is done before the Accept() call to simulate a pending call at the
   // point that Accept() is called.
-  bluez::FakeBluetoothDeviceClient* fake_bluetooth_device_client =
-      static_cast<bluez::FakeBluetoothDeviceClient*>(
-          bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient());
-  BluetoothDevice* device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kPairedDeviceAddress);
+  FakeBluetoothDeviceClient* fake_bluetooth_device_client =
+      static_cast<FakeBluetoothDeviceClient*>(
+          DBusThreadManager::Get()->GetBluetoothDeviceClient());
+  BluetoothDevice* device =
+      adapter_->GetDevice(FakeBluetoothDeviceClient::kPairedDeviceAddress);
   ASSERT_TRUE(device != nullptr);
   fake_bluetooth_device_client->ConnectProfile(
       static_cast<BluetoothDeviceChromeOS*>(device)->object_path(),
-      bluez::FakeBluetoothProfileManagerClient::kRfcommUuid,
+      FakeBluetoothProfileManagerClient::kRfcommUuid,
       base::Bind(&base::DoNothing), base::Bind(&DoNothingDBusErrorCallback));
 
   message_loop_.RunUntilIdle();
@@ -377,7 +374,7 @@
 
   fake_bluetooth_device_client->ConnectProfile(
       static_cast<BluetoothDeviceChromeOS*>(device)->object_path(),
-      bluez::FakeBluetoothProfileManagerClient::kRfcommUuid,
+      FakeBluetoothProfileManagerClient::kRfcommUuid,
       base::Bind(&base::DoNothing), base::Bind(&DoNothingDBusErrorCallback));
 
   message_loop_.Run();
@@ -417,13 +414,13 @@
 TEST_F(BluetoothSocketChromeOSTest, ListenBeforeAdapterStart) {
   // Start off with an invisible adapter, register the profile, then make
   // the adapter visible.
-  bluez::FakeBluetoothAdapterClient* fake_bluetooth_adapter_client =
-      static_cast<bluez::FakeBluetoothAdapterClient*>(
-          bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient());
+  FakeBluetoothAdapterClient* fake_bluetooth_adapter_client =
+      static_cast<FakeBluetoothAdapterClient*>(
+          DBusThreadManager::Get()->GetBluetoothAdapterClient());
   fake_bluetooth_adapter_client->SetVisible(false);
 
   adapter_->CreateRfcommService(
-      BluetoothUUID(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid),
+      BluetoothUUID(FakeBluetoothProfileManagerClient::kRfcommUuid),
       BluetoothAdapter::ServiceOptions(),
       base::Bind(&BluetoothSocketChromeOSTest::CreateServiceSuccessCallback,
                  base::Unretained(this)),
@@ -442,14 +439,12 @@
   error_callback_count_ = 0;
 
   // But there shouldn't be a profile registered yet.
-  bluez::FakeBluetoothProfileManagerClient*
-      fake_bluetooth_profile_manager_client =
-          static_cast<bluez::FakeBluetoothProfileManagerClient*>(
-              bluez::BluezDBusManager::Get()
-                  ->GetBluetoothProfileManagerClient());
-  bluez::FakeBluetoothProfileServiceProvider* profile_service_provider =
+  FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client =
+      static_cast<FakeBluetoothProfileManagerClient*>(
+          DBusThreadManager::Get()->GetBluetoothProfileManagerClient());
+  FakeBluetoothProfileServiceProvider* profile_service_provider =
       fake_bluetooth_profile_manager_client->GetProfileServiceProvider(
-          bluez::FakeBluetoothProfileManagerClient::kRfcommUuid);
+          FakeBluetoothProfileManagerClient::kRfcommUuid);
   EXPECT_TRUE(profile_service_provider == nullptr);
 
   // Make the adapter visible. This should register a profile.
@@ -459,7 +454,7 @@
 
   profile_service_provider =
       fake_bluetooth_profile_manager_client->GetProfileServiceProvider(
-          bluez::FakeBluetoothProfileManagerClient::kRfcommUuid);
+          FakeBluetoothProfileManagerClient::kRfcommUuid);
   EXPECT_TRUE(profile_service_provider != nullptr);
 
   // Cleanup the socket.
@@ -474,12 +469,12 @@
 
 TEST_F(BluetoothSocketChromeOSTest, ListenAcrossAdapterRestart) {
   // The fake adapter starts off visible by default.
-  bluez::FakeBluetoothAdapterClient* fake_bluetooth_adapter_client =
-      static_cast<bluez::FakeBluetoothAdapterClient*>(
-          bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient());
+  FakeBluetoothAdapterClient* fake_bluetooth_adapter_client =
+      static_cast<FakeBluetoothAdapterClient*>(
+          DBusThreadManager::Get()->GetBluetoothAdapterClient());
 
   adapter_->CreateRfcommService(
-      BluetoothUUID(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid),
+      BluetoothUUID(FakeBluetoothProfileManagerClient::kRfcommUuid),
       BluetoothAdapter::ServiceOptions(),
       base::Bind(&BluetoothSocketChromeOSTest::CreateServiceSuccessCallback,
                  base::Unretained(this)),
@@ -498,14 +493,12 @@
   error_callback_count_ = 0;
 
   // Make sure the profile was registered with the daemon.
-  bluez::FakeBluetoothProfileManagerClient*
-      fake_bluetooth_profile_manager_client =
-          static_cast<bluez::FakeBluetoothProfileManagerClient*>(
-              bluez::BluezDBusManager::Get()
-                  ->GetBluetoothProfileManagerClient());
-  bluez::FakeBluetoothProfileServiceProvider* profile_service_provider =
+  FakeBluetoothProfileManagerClient* fake_bluetooth_profile_manager_client =
+      static_cast<FakeBluetoothProfileManagerClient*>(
+          DBusThreadManager::Get()->GetBluetoothProfileManagerClient());
+  FakeBluetoothProfileServiceProvider* profile_service_provider =
       fake_bluetooth_profile_manager_client->GetProfileServiceProvider(
-          bluez::FakeBluetoothProfileManagerClient::kRfcommUuid);
+          FakeBluetoothProfileManagerClient::kRfcommUuid);
   EXPECT_TRUE(profile_service_provider != nullptr);
 
   // Make the adapter invisible, and fiddle with the profile fake to unregister
@@ -521,7 +514,7 @@
 
   profile_service_provider =
       fake_bluetooth_profile_manager_client->GetProfileServiceProvider(
-          bluez::FakeBluetoothProfileManagerClient::kRfcommUuid);
+          FakeBluetoothProfileManagerClient::kRfcommUuid);
   EXPECT_TRUE(profile_service_provider != nullptr);
 
   // Cleanup the socket.
@@ -536,11 +529,11 @@
 
 TEST_F(BluetoothSocketChromeOSTest, PairedConnectFails) {
   BluetoothDevice* device = adapter_->GetDevice(
-      bluez::FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress);
+      FakeBluetoothDeviceClient::kPairedUnconnectableDeviceAddress);
   ASSERT_TRUE(device != nullptr);
 
   device->ConnectToService(
-      BluetoothUUID(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid),
+      BluetoothUUID(FakeBluetoothProfileManagerClient::kRfcommUuid),
       base::Bind(&BluetoothSocketChromeOSTest::ConnectToServiceSuccessCallback,
                  base::Unretained(this)),
       base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback,
@@ -552,7 +545,7 @@
   EXPECT_TRUE(last_socket_.get() == nullptr);
 
   device->ConnectToService(
-      BluetoothUUID(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid),
+      BluetoothUUID(FakeBluetoothProfileManagerClient::kRfcommUuid),
       base::Bind(&BluetoothSocketChromeOSTest::ConnectToServiceSuccessCallback,
                  base::Unretained(this)),
       base::Bind(&BluetoothSocketChromeOSTest::ErrorCallback,
@@ -566,7 +559,7 @@
 
 TEST_F(BluetoothSocketChromeOSTest, SocketListenTwice) {
   adapter_->CreateRfcommService(
-      BluetoothUUID(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid),
+      BluetoothUUID(FakeBluetoothProfileManagerClient::kRfcommUuid),
       BluetoothAdapter::ServiceOptions(),
       base::Bind(&BluetoothSocketChromeOSTest::CreateServiceSuccessCallback,
                  base::Unretained(this)),
@@ -599,7 +592,7 @@
   EXPECT_EQ(1U, error_callback_count_);
 
   adapter_->CreateRfcommService(
-      BluetoothUUID(bluez::FakeBluetoothProfileManagerClient::kRfcommUuid),
+      BluetoothUUID(FakeBluetoothProfileManagerClient::kRfcommUuid),
       BluetoothAdapter::ServiceOptions(),
       base::Bind(&BluetoothSocketChromeOSTest::CreateServiceSuccessCallback,
                  base::Unretained(this)),
diff --git a/device/bluetooth/dbus/bluetooth_dbus_client_bundle.cc b/device/bluetooth/dbus/bluetooth_dbus_client_bundle.cc
deleted file mode 100644
index 29a4ce8..0000000
--- a/device/bluetooth/dbus/bluetooth_dbus_client_bundle.cc
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "device/bluetooth/dbus/bluetooth_dbus_client_bundle.h"
-
-#include <vector>
-
-#include "base/command_line.h"
-#include "base/strings/string_split.h"
-#include "base/strings/string_util.h"
-#include "chromeos/chromeos_switches.h"
-#include "device/bluetooth/dbus/bluetooth_adapter_client.h"
-#include "device/bluetooth/dbus/bluetooth_agent_manager_client.h"
-#include "device/bluetooth/dbus/bluetooth_device_client.h"
-#include "device/bluetooth/dbus/bluetooth_gatt_characteristic_client.h"
-#include "device/bluetooth/dbus/bluetooth_gatt_descriptor_client.h"
-#include "device/bluetooth/dbus/bluetooth_gatt_manager_client.h"
-#include "device/bluetooth/dbus/bluetooth_gatt_service_client.h"
-#include "device/bluetooth/dbus/bluetooth_input_client.h"
-#include "device/bluetooth/dbus/bluetooth_le_advertising_manager_client.h"
-#include "device/bluetooth/dbus/bluetooth_media_client.h"
-#include "device/bluetooth/dbus/bluetooth_media_transport_client.h"
-#include "device/bluetooth/dbus/bluetooth_profile_manager_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_adapter_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_device_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_gatt_service_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_input_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_le_advertising_manager_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_media_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_media_transport_client.h"
-#include "device/bluetooth/dbus/fake_bluetooth_profile_manager_client.h"
-
-namespace bluez {
-
-BluetoothDBusClientBundle::BluetoothDBusClientBundle(bool use_stubs)
-    : use_stubs_(use_stubs) {
-  if (!use_stubs) {
-    bluetooth_adapter_client_.reset(BluetoothAdapterClient::Create());
-    bluetooth_le_advertising_manager_client_.reset(
-        BluetoothLEAdvertisingManagerClient::Create());
-    bluetooth_agent_manager_client_.reset(
-        BluetoothAgentManagerClient::Create());
-    bluetooth_device_client_.reset(BluetoothDeviceClient::Create());
-    bluetooth_input_client_.reset(BluetoothInputClient::Create());
-    bluetooth_media_client_.reset(BluetoothMediaClient::Create());
-    bluetooth_media_transport_client_.reset(
-        BluetoothMediaTransportClient::Create());
-    bluetooth_profile_manager_client_.reset(
-        BluetoothProfileManagerClient::Create());
-    bluetooth_gatt_characteristic_client_.reset(
-        BluetoothGattCharacteristicClient::Create());
-    bluetooth_gatt_descriptor_client_.reset(
-        BluetoothGattDescriptorClient::Create());
-    bluetooth_gatt_manager_client_.reset(BluetoothGattManagerClient::Create());
-    bluetooth_gatt_service_client_.reset(BluetoothGattServiceClient::Create());
-  } else {
-    bluetooth_adapter_client_.reset(new FakeBluetoothAdapterClient);
-    bluetooth_le_advertising_manager_client_.reset(
-        new FakeBluetoothLEAdvertisingManagerClient);
-    bluetooth_agent_manager_client_.reset(new FakeBluetoothAgentManagerClient);
-    bluetooth_device_client_.reset(new FakeBluetoothDeviceClient);
-    bluetooth_input_client_.reset(new FakeBluetoothInputClient);
-    bluetooth_media_client_.reset(new FakeBluetoothMediaClient);
-    bluetooth_media_transport_client_.reset(
-        new FakeBluetoothMediaTransportClient);
-    bluetooth_profile_manager_client_.reset(
-        new FakeBluetoothProfileManagerClient);
-    bluetooth_gatt_characteristic_client_.reset(
-        new FakeBluetoothGattCharacteristicClient);
-    bluetooth_gatt_descriptor_client_.reset(
-        new FakeBluetoothGattDescriptorClient);
-    bluetooth_gatt_manager_client_.reset(new FakeBluetoothGattManagerClient);
-    bluetooth_gatt_service_client_.reset(new FakeBluetoothGattServiceClient);
-  }
-}
-
-BluetoothDBusClientBundle::~BluetoothDBusClientBundle() {}
-
-}  // namespace bluez
diff --git a/device/bluetooth/dbus/bluetooth_dbus_client_bundle.h b/device/bluetooth/dbus/bluetooth_dbus_client_bundle.h
deleted file mode 100644
index 3beef619..0000000
--- a/device/bluetooth/dbus/bluetooth_dbus_client_bundle.h
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_DBUS_CLIENT_BUNDLE_H_
-#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_DBUS_CLIENT_BUNDLE_H_
-
-#include <string>
-
-#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
-#include "device/bluetooth/bluetooth_export.h"
-
-namespace bluez {
-
-class BluetoothAdapterClient;
-class BluetoothAgentManagerClient;
-class BluetoothDeviceClient;
-class BluetoothGattCharacteristicClient;
-class BluetoothGattDescriptorClient;
-class BluetoothGattManagerClient;
-class BluetoothGattServiceClient;
-class BluetoothInputClient;
-class BluetoothLEAdvertisingManagerClient;
-class BluetoothMediaClient;
-class BluetoothMediaTransportClient;
-class BluetoothProfileManagerClient;
-
-// The bundle of all D-Bus clients used in DBusThreadManager. The bundle
-// is used to delete them at once in the right order before shutting down the
-// system bus. See also the comment in the destructor of DBusThreadManager.
-class DEVICE_BLUETOOTH_EXPORT BluetoothDBusClientBundle {
- public:
-  explicit BluetoothDBusClientBundle(bool use_stubs);
-  ~BluetoothDBusClientBundle();
-
-  // Returns true if |client| is stubbed.
-  bool IsUsingStub() { return use_stubs_; }
-
-  BluetoothAdapterClient* bluetooth_adapter_client() {
-    return bluetooth_adapter_client_.get();
-  }
-
-  BluetoothLEAdvertisingManagerClient*
-  bluetooth_le_advertising_manager_client() {
-    return bluetooth_le_advertising_manager_client_.get();
-  }
-
-  BluetoothAgentManagerClient* bluetooth_agent_manager_client() {
-    return bluetooth_agent_manager_client_.get();
-  }
-
-  BluetoothDeviceClient* bluetooth_device_client() {
-    return bluetooth_device_client_.get();
-  }
-
-  BluetoothGattCharacteristicClient* bluetooth_gatt_characteristic_client() {
-    return bluetooth_gatt_characteristic_client_.get();
-  }
-
-  BluetoothGattDescriptorClient* bluetooth_gatt_descriptor_client() {
-    return bluetooth_gatt_descriptor_client_.get();
-  }
-
-  BluetoothGattManagerClient* bluetooth_gatt_manager_client() {
-    return bluetooth_gatt_manager_client_.get();
-  }
-
-  BluetoothGattServiceClient* bluetooth_gatt_service_client() {
-    return bluetooth_gatt_service_client_.get();
-  }
-
-  BluetoothInputClient* bluetooth_input_client() {
-    return bluetooth_input_client_.get();
-  }
-
-  BluetoothMediaClient* bluetooth_media_client() {
-    return bluetooth_media_client_.get();
-  }
-
-  BluetoothMediaTransportClient* bluetooth_media_transport_client() {
-    return bluetooth_media_transport_client_.get();
-  }
-
-  BluetoothProfileManagerClient* bluetooth_profile_manager_client() {
-    return bluetooth_profile_manager_client_.get();
-  }
-
- private:
-  friend class BluezDBusManagerSetter;
-
-  bool use_stubs_;
-
-  scoped_ptr<BluetoothAdapterClient> bluetooth_adapter_client_;
-  scoped_ptr<BluetoothLEAdvertisingManagerClient>
-      bluetooth_le_advertising_manager_client_;
-  scoped_ptr<BluetoothAgentManagerClient> bluetooth_agent_manager_client_;
-  scoped_ptr<BluetoothDeviceClient> bluetooth_device_client_;
-  scoped_ptr<BluetoothGattCharacteristicClient>
-      bluetooth_gatt_characteristic_client_;
-  scoped_ptr<BluetoothGattDescriptorClient> bluetooth_gatt_descriptor_client_;
-  scoped_ptr<BluetoothGattManagerClient> bluetooth_gatt_manager_client_;
-  scoped_ptr<BluetoothGattServiceClient> bluetooth_gatt_service_client_;
-  scoped_ptr<BluetoothInputClient> bluetooth_input_client_;
-  scoped_ptr<BluetoothMediaClient> bluetooth_media_client_;
-  scoped_ptr<BluetoothMediaTransportClient> bluetooth_media_transport_client_;
-  scoped_ptr<BluetoothProfileManagerClient> bluetooth_profile_manager_client_;
-
-  DISALLOW_COPY_AND_ASSIGN(BluetoothDBusClientBundle);
-};
-
-}  // namespace bluez
-
-#endif  // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_DBUS_CLIENT_BUNDLE_H_
diff --git a/device/bluetooth/dbus/bluez_dbus_client.h b/device/bluetooth/dbus/bluez_dbus_client.h
deleted file mode 100644
index 3dd0985..0000000
--- a/device/bluetooth/dbus/bluez_dbus_client.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// 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 DEVICE_BLUETOOTH_DBUS_BLUEZ_DBUS_CLIENT_H_
-#define DEVICE_BLUETOOTH_DBUS_BLUEZ_DBUS_CLIENT_H_
-
-#include "base/basictypes.h"
-
-namespace dbus {
-class Bus;
-}  // namespace dbus
-
-namespace bluez {
-
-// Interface for all Bluez DBus clients handled by BluezDBusManager. It
-// restricts
-// access to the Init function to BluezDBusManager only to prevent
-// incorrect calls. Stub clients may lift that restriction however.
-class BluezDBusClient {
- protected:
-  virtual ~BluezDBusClient() {}
-
-  // This function is called by DBusThreadManager. Only in unit tests, which
-  // don't use DBusThreadManager, this function can be called through Stub
-  // implementations (they change Init's member visibility to public).
-  virtual void Init(dbus::Bus* bus) = 0;
-
- private:
-  friend class BluezDBusManager;
-
-  DISALLOW_ASSIGN(BluezDBusClient);
-};
-
-}  // namespace bluez
-
-#endif  // DEVICE_BLUETOOTH_DBUS_BLUEZ_DBUS_CLIENT_H_
diff --git a/device/bluetooth/dbus/bluez_dbus_manager.cc b/device/bluetooth/dbus/bluez_dbus_manager.cc
deleted file mode 100644
index 376261d..0000000
--- a/device/bluetooth/dbus/bluez_dbus_manager.cc
+++ /dev/null
@@ -1,250 +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 "device/bluetooth/dbus/bluez_dbus_manager.h"
-
-#include "base/command_line.h"
-#include "base/sys_info.h"
-#include "base/threading/thread.h"
-#include "dbus/bus.h"
-#include "dbus/dbus_statistics.h"
-#include "device/bluetooth/dbus/bluetooth_adapter_client.h"
-#include "device/bluetooth/dbus/bluetooth_agent_manager_client.h"
-#include "device/bluetooth/dbus/bluetooth_device_client.h"
-#include "device/bluetooth/dbus/bluetooth_gatt_characteristic_client.h"
-#include "device/bluetooth/dbus/bluetooth_gatt_descriptor_client.h"
-#include "device/bluetooth/dbus/bluetooth_gatt_manager_client.h"
-#include "device/bluetooth/dbus/bluetooth_gatt_service_client.h"
-#include "device/bluetooth/dbus/bluetooth_input_client.h"
-#include "device/bluetooth/dbus/bluetooth_le_advertising_manager_client.h"
-#include "device/bluetooth/dbus/bluetooth_media_client.h"
-#include "device/bluetooth/dbus/bluetooth_media_transport_client.h"
-#include "device/bluetooth/dbus/bluetooth_profile_manager_client.h"
-
-namespace bluez {
-
-static BluezDBusManager* g_bluez_dbus_manager = nullptr;
-static bool g_using_bluez_dbus_manager_for_testing = false;
-
-BluezDBusManager::BluezDBusManager(
-    dbus::Bus* bus,
-    scoped_ptr<BluetoothDBusClientBundle> client_bundle)
-    : bus_(bus), client_bundle_(client_bundle.Pass()) {}
-
-BluezDBusManager::~BluezDBusManager() {
-  // Delete all D-Bus clients before shutting down the system bus.
-  client_bundle_.reset();
-}
-
-dbus::Bus* bluez::BluezDBusManager::GetSystemBus() {
-  return bus_;
-}
-
-BluetoothAdapterClient* bluez::BluezDBusManager::GetBluetoothAdapterClient() {
-  return client_bundle_->bluetooth_adapter_client();
-}
-
-BluetoothLEAdvertisingManagerClient*
-bluez::BluezDBusManager::GetBluetoothLEAdvertisingManagerClient() {
-  return client_bundle_->bluetooth_le_advertising_manager_client();
-}
-
-BluetoothAgentManagerClient*
-bluez::BluezDBusManager::GetBluetoothAgentManagerClient() {
-  return client_bundle_->bluetooth_agent_manager_client();
-}
-
-BluetoothDeviceClient* bluez::BluezDBusManager::GetBluetoothDeviceClient() {
-  return client_bundle_->bluetooth_device_client();
-}
-
-BluetoothGattCharacteristicClient*
-bluez::BluezDBusManager::GetBluetoothGattCharacteristicClient() {
-  return client_bundle_->bluetooth_gatt_characteristic_client();
-}
-
-BluetoothGattDescriptorClient*
-bluez::BluezDBusManager::GetBluetoothGattDescriptorClient() {
-  return client_bundle_->bluetooth_gatt_descriptor_client();
-}
-
-BluetoothGattManagerClient*
-bluez::BluezDBusManager::GetBluetoothGattManagerClient() {
-  return client_bundle_->bluetooth_gatt_manager_client();
-}
-
-BluetoothGattServiceClient*
-bluez::BluezDBusManager::GetBluetoothGattServiceClient() {
-  return client_bundle_->bluetooth_gatt_service_client();
-}
-
-BluetoothInputClient* bluez::BluezDBusManager::GetBluetoothInputClient() {
-  return client_bundle_->bluetooth_input_client();
-}
-
-BluetoothMediaClient* bluez::BluezDBusManager::GetBluetoothMediaClient() {
-  return client_bundle_->bluetooth_media_client();
-}
-
-BluetoothMediaTransportClient*
-bluez::BluezDBusManager::GetBluetoothMediaTransportClient() {
-  return client_bundle_->bluetooth_media_transport_client();
-}
-
-BluetoothProfileManagerClient*
-bluez::BluezDBusManager::GetBluetoothProfileManagerClient() {
-  return client_bundle_->bluetooth_profile_manager_client();
-}
-
-void BluezDBusManager::InitializeClients() {
-  GetBluetoothAdapterClient()->Init(GetSystemBus());
-  GetBluetoothAgentManagerClient()->Init(GetSystemBus());
-  GetBluetoothDeviceClient()->Init(GetSystemBus());
-  GetBluetoothGattCharacteristicClient()->Init(GetSystemBus());
-  GetBluetoothGattDescriptorClient()->Init(GetSystemBus());
-  GetBluetoothGattManagerClient()->Init(GetSystemBus());
-  GetBluetoothGattServiceClient()->Init(GetSystemBus());
-  GetBluetoothInputClient()->Init(GetSystemBus());
-  GetBluetoothLEAdvertisingManagerClient()->Init(GetSystemBus());
-  GetBluetoothMediaClient()->Init(GetSystemBus());
-  GetBluetoothMediaTransportClient()->Init(GetSystemBus());
-  GetBluetoothProfileManagerClient()->Init(GetSystemBus());
-
-  // This must be called after the list of clients so they've each had a
-  // chance to register with their object g_dbus_thread_managers.
-  if (GetSystemBus())
-    GetSystemBus()->GetManagedObjects();
-}
-
-// static
-void BluezDBusManager::Initialize(dbus::Bus* bus, bool use_dbus_stub) {
-  // If we initialize BluezDBusManager twice we may also be shutting it down
-  // early; do not allow that.
-  if (g_using_bluez_dbus_manager_for_testing)
-    return;
-
-  CHECK(!g_bluez_dbus_manager);
-  CreateGlobalInstance(bus, use_dbus_stub);
-}
-
-// static
-scoped_ptr<BluezDBusManagerSetter>
-bluez::BluezDBusManager::GetSetterForTesting() {
-  if (!g_using_bluez_dbus_manager_for_testing) {
-    g_using_bluez_dbus_manager_for_testing = true;
-    CreateGlobalInstance(nullptr, true);
-  }
-
-  return make_scoped_ptr(new BluezDBusManagerSetter());
-}
-
-// static
-void BluezDBusManager::CreateGlobalInstance(dbus::Bus* bus, bool use_stubs) {
-  CHECK(!g_bluez_dbus_manager);
-  g_bluez_dbus_manager = new BluezDBusManager(
-      bus, make_scoped_ptr(new BluetoothDBusClientBundle(use_stubs)));
-  g_bluez_dbus_manager->InitializeClients();
-}
-
-// static
-bool BluezDBusManager::IsInitialized() {
-  return g_bluez_dbus_manager != nullptr;
-}
-
-// static
-void BluezDBusManager::Shutdown() {
-  // Ensure that we only shutdown BluezDBusManager once.
-  CHECK(g_bluez_dbus_manager);
-  BluezDBusManager* dbus_manager = g_bluez_dbus_manager;
-  g_bluez_dbus_manager = nullptr;
-  g_using_bluez_dbus_manager_for_testing = false;
-  delete dbus_manager;
-  VLOG(1) << "BluezDBusManager Shutdown completed";
-}
-
-// static
-BluezDBusManager* bluez::BluezDBusManager::Get() {
-  CHECK(g_bluez_dbus_manager)
-      << "bluez::BluezDBusManager::Get() called before Initialize()";
-  return g_bluez_dbus_manager;
-}
-
-BluezDBusManagerSetter::BluezDBusManagerSetter() {}
-
-BluezDBusManagerSetter::~BluezDBusManagerSetter() {}
-
-void BluezDBusManagerSetter::SetBluetoothAdapterClient(
-    scoped_ptr<BluetoothAdapterClient> client) {
-  bluez::BluezDBusManager::Get()->client_bundle_->bluetooth_adapter_client_ =
-      client.Pass();
-}
-
-void BluezDBusManagerSetter::SetBluetoothLEAdvertisingManagerClient(
-    scoped_ptr<BluetoothLEAdvertisingManagerClient> client) {
-  bluez::BluezDBusManager::Get()
-      ->client_bundle_->bluetooth_le_advertising_manager_client_ =
-      client.Pass();
-}
-
-void BluezDBusManagerSetter::SetBluetoothAgentManagerClient(
-    scoped_ptr<BluetoothAgentManagerClient> client) {
-  bluez::BluezDBusManager::Get()
-      ->client_bundle_->bluetooth_agent_manager_client_ = client.Pass();
-}
-
-void BluezDBusManagerSetter::SetBluetoothDeviceClient(
-    scoped_ptr<BluetoothDeviceClient> client) {
-  bluez::BluezDBusManager::Get()->client_bundle_->bluetooth_device_client_ =
-      client.Pass();
-}
-
-void BluezDBusManagerSetter::SetBluetoothGattCharacteristicClient(
-    scoped_ptr<BluetoothGattCharacteristicClient> client) {
-  bluez::BluezDBusManager::Get()
-      ->client_bundle_->bluetooth_gatt_characteristic_client_ = client.Pass();
-}
-
-void BluezDBusManagerSetter::SetBluetoothGattDescriptorClient(
-    scoped_ptr<BluetoothGattDescriptorClient> client) {
-  bluez::BluezDBusManager::Get()
-      ->client_bundle_->bluetooth_gatt_descriptor_client_ = client.Pass();
-}
-
-void BluezDBusManagerSetter::SetBluetoothGattManagerClient(
-    scoped_ptr<BluetoothGattManagerClient> client) {
-  bluez::BluezDBusManager::Get()
-      ->client_bundle_->bluetooth_gatt_manager_client_ = client.Pass();
-}
-
-void BluezDBusManagerSetter::SetBluetoothGattServiceClient(
-    scoped_ptr<BluetoothGattServiceClient> client) {
-  bluez::BluezDBusManager::Get()
-      ->client_bundle_->bluetooth_gatt_service_client_ = client.Pass();
-}
-
-void BluezDBusManagerSetter::SetBluetoothInputClient(
-    scoped_ptr<BluetoothInputClient> client) {
-  bluez::BluezDBusManager::Get()->client_bundle_->bluetooth_input_client_ =
-      client.Pass();
-}
-
-void BluezDBusManagerSetter::SetBluetoothMediaClient(
-    scoped_ptr<BluetoothMediaClient> client) {
-  bluez::BluezDBusManager::Get()->client_bundle_->bluetooth_media_client_ =
-      client.Pass();
-}
-
-void BluezDBusManagerSetter::SetBluetoothMediaTransportClient(
-    scoped_ptr<BluetoothMediaTransportClient> client) {
-  bluez::BluezDBusManager::Get()
-      ->client_bundle_->bluetooth_media_transport_client_ = client.Pass();
-}
-
-void BluezDBusManagerSetter::SetBluetoothProfileManagerClient(
-    scoped_ptr<BluetoothProfileManagerClient> client) {
-  bluez::BluezDBusManager::Get()
-      ->client_bundle_->bluetooth_profile_manager_client_ = client.Pass();
-}
-
-}  // namespace bluez
diff --git a/device/bluetooth/dbus/bluez_dbus_manager.h b/device/bluetooth/dbus/bluez_dbus_manager.h
deleted file mode 100644
index d87fadc..0000000
--- a/device/bluetooth/dbus/bluez_dbus_manager.h
+++ /dev/null
@@ -1,158 +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 DEVICE_BLUETOOTH_DBUS_BLUEZ_DBUS_MANAGER_H_
-#define DEVICE_BLUETOOTH_DBUS_BLUEZ_DBUS_MANAGER_H_
-
-#include <string>
-
-#include "base/callback.h"
-#include "base/macros.h"
-#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
-#include "device/bluetooth/bluetooth_export.h"
-#include "device/bluetooth/dbus/bluetooth_dbus_client_bundle.h"
-
-namespace dbus {
-class Bus;
-class ObjectPath;
-}  // namespace dbus
-
-namespace bluez {
-
-// Style Note: Clients are sorted by names.
-class BluetoothAdapterClient;
-class BluetoothAgentManagerClient;
-class BluetoothDeviceClient;
-class BluetoothGattCharacteristicClient;
-class BluetoothGattDescriptorClient;
-class BluetoothGattManagerClient;
-class BluetoothGattServiceClient;
-class BluetoothInputClient;
-class BluetoothLEAdvertisingManagerClient;
-class BluetoothMediaClient;
-class BluetoothMediaTransportClient;
-class BluetoothProfileManagerClient;
-class BluezDBusManagerSetter;
-
-// BluezDBusManager manages manages D-Bus connections and D-Bus clients, which
-// depend on the D-Bus thread to ensure the right order of shutdowns for
-// the D-Bus thread, the D-Bus connections, and the D-Bus clients.
-//
-// CALLBACKS IN D-BUS CLIENTS:
-//
-// D-Bus clients managed by BluezDBusManagerSetter are guaranteed to be deleted
-// after the D-Bus thread so the clients don't need to worry if new
-// incoming messages arrive from the D-Bus thread during shutdown of the
-// clients. The UI message loop is not running during the shutdown hence
-// the UI message loop won't post tasks to D-BUS clients during the
-// shutdown. However, to be extra cautious, clients should use
-// WeakPtrFactory when creating callbacks that run on UI thread. See
-// session_manager_client.cc for examples.
-//
-class DEVICE_BLUETOOTH_EXPORT BluezDBusManager {
- public:
-  // Sets the global instance. Must be called before any calls to Get().
-  // We explicitly initialize and shut down the global object, rather than
-  // making it a Singleton, to ensure clean startup and shutdown.
-  // This will initialize real or stub DBusClients depending on command-line
-  // arguments and whether this process runs in a ChromeOS environment.
-  static void Initialize(dbus::Bus* bus, bool use_dbus_stub);
-
-  // Returns a BluezDBusManagerSetter instance that allows tests to
-  // replace individual D-Bus clients with their own implementations.
-  // Also initializes the main BluezDBusManager for testing if necessary.
-  static scoped_ptr<BluezDBusManagerSetter> GetSetterForTesting();
-
-  // Returns true if BluezDBusManager has been initialized. Call this to
-  // avoid initializing + shutting down BluezDBusManager more than once.
-  static bool IsInitialized();
-
-  // Destroys the global instance.
-  static void Shutdown();
-
-  // Gets the global instance. Initialize() must be called first.
-  static BluezDBusManager* Get();
-
-  // Returns true if |client| is stubbed.
-  bool IsUsingStub() { return client_bundle_->IsUsingStub(); }
-
-  // Returns various D-Bus bus instances, owned by BluezDBusManager.
-  dbus::Bus* GetSystemBus();
-
-  // All returned objects are owned by BluezDBusManager.  Do not use these
-  // pointers after BluezDBusManager has been shut down.
-  BluetoothAdapterClient* GetBluetoothAdapterClient();
-  BluetoothLEAdvertisingManagerClient* GetBluetoothLEAdvertisingManagerClient();
-  BluetoothAgentManagerClient* GetBluetoothAgentManagerClient();
-  BluetoothDeviceClient* GetBluetoothDeviceClient();
-  BluetoothGattCharacteristicClient* GetBluetoothGattCharacteristicClient();
-  BluetoothGattDescriptorClient* GetBluetoothGattDescriptorClient();
-  BluetoothGattManagerClient* GetBluetoothGattManagerClient();
-  BluetoothGattServiceClient* GetBluetoothGattServiceClient();
-  BluetoothInputClient* GetBluetoothInputClient();
-  BluetoothMediaClient* GetBluetoothMediaClient();
-  BluetoothMediaTransportClient* GetBluetoothMediaTransportClient();
-  BluetoothProfileManagerClient* GetBluetoothProfileManagerClient();
-
- private:
-  friend class BluezDBusManagerSetter;
-
-  // Creates a new BluezDBusManager using the DBusClients set in
-  // |client_bundle|.
-  explicit BluezDBusManager(
-      dbus::Bus* bus,
-      scoped_ptr<BluetoothDBusClientBundle> client_bundle);
-  ~BluezDBusManager();
-
-  // Creates a global instance of BluezDBusManager. Cannot be called more than
-  // once.
-  static void CreateGlobalInstance(dbus::Bus* bus, bool use_stubs);
-
-  // Initializes all currently stored DBusClients with the system bus and
-  // performs additional setup.
-  void InitializeClients();
-
-  dbus::Bus* bus_;
-  scoped_ptr<BluetoothDBusClientBundle> client_bundle_;
-
-  DISALLOW_COPY_AND_ASSIGN(BluezDBusManager);
-};
-
-class DEVICE_BLUETOOTH_EXPORT BluezDBusManagerSetter {
- public:
-  ~BluezDBusManagerSetter();
-
-  void SetBluetoothAdapterClient(scoped_ptr<BluetoothAdapterClient> client);
-  void SetBluetoothLEAdvertisingManagerClient(
-      scoped_ptr<BluetoothLEAdvertisingManagerClient> client);
-  void SetBluetoothAgentManagerClient(
-      scoped_ptr<BluetoothAgentManagerClient> client);
-  void SetBluetoothDeviceClient(scoped_ptr<BluetoothDeviceClient> client);
-  void SetBluetoothGattCharacteristicClient(
-      scoped_ptr<BluetoothGattCharacteristicClient> client);
-  void SetBluetoothGattDescriptorClient(
-      scoped_ptr<BluetoothGattDescriptorClient> client);
-  void SetBluetoothGattManagerClient(
-      scoped_ptr<BluetoothGattManagerClient> client);
-  void SetBluetoothGattServiceClient(
-      scoped_ptr<BluetoothGattServiceClient> client);
-  void SetBluetoothInputClient(scoped_ptr<BluetoothInputClient> client);
-  void SetBluetoothMediaClient(scoped_ptr<BluetoothMediaClient> client);
-  void SetBluetoothMediaTransportClient(
-      scoped_ptr<BluetoothMediaTransportClient> client);
-  void SetBluetoothProfileManagerClient(
-      scoped_ptr<BluetoothProfileManagerClient> client);
-
- private:
-  friend class BluezDBusManager;
-
-  BluezDBusManagerSetter();
-
-  DISALLOW_COPY_AND_ASSIGN(BluezDBusManagerSetter);
-};
-
-}  // namespace bluez
-
-#endif  // DEVICE_BLUETOOTH_DBUS_BLUEZ_DBUS_MANAGER_H_
diff --git a/extensions/common/extension.h b/extensions/common/extension.h
index 17925cb..f2c24d6 100644
--- a/extensions/common/extension.h
+++ b/extensions/common/extension.h
@@ -92,7 +92,7 @@
     DISABLE_RELOAD = 1 << 2,
     DISABLE_UNSUPPORTED_REQUIREMENT = 1 << 3,
     DISABLE_SIDELOAD_WIPEOUT = 1 << 4,
-    DISABLE_UNKNOWN_FROM_SYNC = 1 << 5,
+    DEPRECATED_DISABLE_UNKNOWN_FROM_SYNC = 1 << 5,
     // DISABLE_PERMISSIONS_CONSENT = 1 << 6,  // Deprecated.
     // DISABLE_KNOWN_DISABLED = 1 << 7,  // Deprecated.
     DISABLE_NOT_VERIFIED = 1 << 8,  // Disabled because we could not verify
@@ -102,8 +102,8 @@
     DISABLE_REMOTE_INSTALL = 1 << 11,
     DISABLE_INACTIVE_EPHEMERAL_APP = 1 << 12,  // Cached ephemeral apps are
                                                // disabled to prevent activity.
-    DISABLE_EXTERNAL_EXTENSION = 1 << 13,  // External extensions might be
-                                           // disabled for user prompting.
+    DISABLE_EXTERNAL_EXTENSION = 1 << 13,      // External extensions might be
+                                               // disabled for user prompting.
     DISABLE_UPDATE_REQUIRED_BY_POLICY = 1 << 14,  // Doesn't meet minimum
                                                   // version requirement.
     DISABLE_REASON_LAST = 1 << 15,  // This should always be the last value
diff --git a/ios/chrome/browser/chrome_constants.cc b/ios/chrome/browser/chrome_constants.cc
new file mode 100644
index 0000000..0de81c6
--- /dev/null
+++ b/ios/chrome/browser/chrome_constants.cc
@@ -0,0 +1,19 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ios/chrome/browser/chrome_constants.h"
+
+const char kIOSChromeInitialBrowserState[] = "Default";
+const char kIOSChromeMultiBrowserStatePrefix[] = "Profile ";
+
+const base::FilePath::CharType kIOSChromeCacheDirname[] =
+    FILE_PATH_LITERAL("Cache");
+const base::FilePath::CharType kIOSChromeChannelIDFilename[] =
+    FILE_PATH_LITERAL("Origin Bound Certs");
+const base::FilePath::CharType kIOSChromeCookieFilename[] =
+    FILE_PATH_LITERAL("Cookies");
+const base::FilePath::CharType kIOSChromeCRLSetFilename[] =
+    FILE_PATH_LITERAL("Certificate Revocation Lists");
+const base::FilePath::CharType kIOSChromeNetworkPersistentStateFilename[] =
+    FILE_PATH_LITERAL("Network Persistent State");
diff --git a/ios/chrome/browser/chrome_constants.h b/ios/chrome/browser/chrome_constants.h
new file mode 100644
index 0000000..c2c9704
--- /dev/null
+++ b/ios/chrome/browser/chrome_constants.h
@@ -0,0 +1,22 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_CHROME_BROWSER_CHROME_CONSTANTS_H_
+#define IOS_CHROME_BROWSER_CHROME_CONSTANTS_H_
+
+// A handful of resource-like constants related to the Chrome application.
+
+#include "base/files/file_path.h"
+
+extern const char kIOSChromeInitialBrowserState[];
+extern const char kIOSChromeMultiBrowserStatePrefix[];
+
+extern const base::FilePath::CharType kIOSChromeCacheDirname[];
+extern const base::FilePath::CharType kIOSChromeChannelIDFilename[];
+extern const base::FilePath::CharType kIOSChromeCookieFilename[];
+extern const base::FilePath::CharType kIOSChromeCRLSetFilename[];
+extern const base::FilePath::CharType
+    kIOSChromeNetworkPersistentStateFilename[];
+
+#endif  // IOS_CHROME_BROWSER_CHROME_CONSTANTS_H_
diff --git a/ios/chrome/browser/chrome_paths.h b/ios/chrome/browser/chrome_paths.h
index 77a9122..f447859 100644
--- a/ios/chrome/browser/chrome_paths.h
+++ b/ios/chrome/browser/chrome_paths.h
@@ -16,9 +16,13 @@
   DIR_USER_DATA = PATH_START,  // Directory where user data can be written.
   DIR_CRASH_DUMPS,             // Directory where crash dumps are written.
   DIR_TEST_DATA,               // Directory where unit test data resides.
-
-  FILE_LOCAL_STATE,  // Path and filename to the file in which
-                     // installation-specific state is saved.
+  DIR_GLOBAL_GCM_STORE,        // Directory where the global GCM instance
+                               // stores its data.
+  FILE_LOCAL_STATE,            // Path and filename to the file in which
+                               // installation-specific state is saved.
+  FILE_RESOURCES_PACK,         // Full path to the .pak file containing binary
+                               // data (e.g. html files and images used by
+                               // internal pages).
 
   PATH_END
 };
diff --git a/ios/chrome/browser/chrome_paths.mm b/ios/chrome/browser/chrome_paths.mm
index 0a86fb5..7de53b9 100644
--- a/ios/chrome/browser/chrome_paths.mm
+++ b/ios/chrome/browser/chrome_paths.mm
@@ -10,6 +10,8 @@
 #include "base/logging.h"
 #include "base/path_service.h"
 #include "base/threading/thread_restrictions.h"
+#include "components/gcm_driver/gcm_driver_constants.h"
+#include "ios/chrome/browser/chrome_paths_internal.h"
 
 namespace ios {
 namespace {
@@ -60,12 +62,24 @@
       cur = cur.Append(FILE_PATH_LITERAL("data"));
       break;
 
+    case DIR_GLOBAL_GCM_STORE:
+      if (!PathService::Get(DIR_USER_DATA, &cur))
+        return false;
+      cur = cur.Append(gcm_driver::kGCMStoreDirname);
+      break;
+
     case FILE_LOCAL_STATE:
-      if (!PathService::Get(ios::DIR_USER_DATA, &cur))
+      if (!PathService::Get(DIR_USER_DATA, &cur))
         return false;
       cur = cur.Append(FILE_PATH_LITERAL("Local State"));
       break;
 
+    case FILE_RESOURCES_PACK:
+      if (!base::PathService::Get(base::DIR_MODULE, &cur))
+        return false;
+      cur = cur.Append(FILE_PATH_LITERAL("resources.pak"));
+      break;
+
     default:
       return false;
   }
@@ -83,4 +97,24 @@
   PathService::RegisterProvider(PathProvider, PATH_START, PATH_END);
 }
 
+void GetUserCacheDirectory(const base::FilePath& browser_state_dir,
+                           base::FilePath* result) {
+  // If the browser state directory is under ~/Library/Application Support,
+  // use a suitable cache directory under ~/Library/Caches.
+
+  // Default value in cases where any of the following fails.
+  *result = browser_state_dir;
+
+  base::FilePath app_data_dir;
+  if (!PathService::Get(base::DIR_APP_DATA, &app_data_dir))
+    return;
+  base::FilePath cache_dir;
+  if (!PathService::Get(base::DIR_CACHE, &cache_dir))
+    return;
+  if (!app_data_dir.AppendRelativePath(browser_state_dir, &cache_dir))
+    return;
+
+  *result = cache_dir;
+}
+
 }  // namespace ios
diff --git a/ios/chrome/browser/chrome_paths_internal.h b/ios/chrome/browser/chrome_paths_internal.h
new file mode 100644
index 0000000..0d7b58c
--- /dev/null
+++ b/ios/chrome/browser/chrome_paths_internal.h
@@ -0,0 +1,23 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_CHROME_BROWSER_CHROME_PATHS_INTERNAL_H_
+#define IOS_CHROME_BROWSER_CHROME_PATHS_INTERNAL_H_
+
+namespace base {
+class FilePath;
+}
+
+namespace ios {
+
+// Get the path to the user's cache directory. Note that Chrome on iOS cache
+// directories are actually subdirectories of this directory with names like
+// "Cache". This will always fill in |result| with a directory, sometimes
+// just |browser_state_dir|.
+void GetUserCacheDirectory(const base::FilePath& browser_state_dir,
+                           base::FilePath* result);
+
+}  // namespace ios
+
+#endif  // IOS_CHROME_BROWSER_CHROME_PATHS_INTERNAL_H_
diff --git a/ios/chrome/browser/ios_chrome_field_trials.cc b/ios/chrome/browser/ios_chrome_field_trials.cc
new file mode 100644
index 0000000..7d9f19d
--- /dev/null
+++ b/ios/chrome/browser/ios_chrome_field_trials.cc
@@ -0,0 +1,27 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ios/chrome/browser/ios_chrome_field_trials.h"
+
+#include "base/metrics/field_trial.h"
+#include "components/omnibox/browser/omnibox_field_trial.h"
+
+namespace {
+
+// Instantiates dynamic field trials by querying their state to ensure they
+// get reported as used.
+void InstantiateDynamicTrials() {
+  // Activate the autocomplete dynamic field trials.
+  OmniboxFieldTrial::ActivateDynamicTrials();
+
+  // Activate the iOS tab eviction dynamic field trials.
+  base::FieldTrialList::FindValue("TabEviction");
+}
+
+}  // namespace
+
+void SetupFieldTrials(const base::CommandLine& command_line,
+                      const base::Time& install_time) {
+  InstantiateDynamicTrials();
+}
diff --git a/ios/chrome/browser/ios_chrome_field_trials.h b/ios/chrome/browser/ios_chrome_field_trials.h
new file mode 100644
index 0000000..9f890a7e
--- /dev/null
+++ b/ios/chrome/browser/ios_chrome_field_trials.h
@@ -0,0 +1,17 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_CHROME_BROWSER_IOS_CHROME_FIELD_TRIALS_H_
+#define IOS_CHROME_BROWSER_IOS_CHROME_FIELD_TRIALS_H_
+
+namespace base {
+class CommandLine;
+class Time;
+}
+
+// Sets up iOS-specific field trials.
+void SetupFieldTrials(const base::CommandLine& command_line,
+                      const base::Time& install_time);
+
+#endif  // IOS_CHROME_BROWSER_IOS_CHROME_FIELD_TRIALS_H_
diff --git a/ios/chrome/ios_chrome.gyp b/ios/chrome/ios_chrome.gyp
index 285c8633..0125a56 100644
--- a/ios/chrome/ios_chrome.gyp
+++ b/ios/chrome/ios_chrome.gyp
@@ -182,8 +182,11 @@
         'browser/browser_state_metrics/browser_state_metrics.cc',
         'browser/browser_state_metrics/browser_state_metrics.h',
         'browser/browsing_data_change_listening.h',
+        'browser/chrome_constants.cc',
+        'browser/chrome_constants.h',
         'browser/chrome_paths.h',
         'browser/chrome_paths.mm',
+        'browser/chrome_paths_internal.h',
         'browser/chrome_switches.cc',
         'browser/chrome_switches.h',
         'browser/chrome_url_constants.cc',
@@ -295,6 +298,8 @@
         'browser/install_time_util.mm',
         'browser/installation_notifier.h',
         'browser/installation_notifier.mm',
+        'browser/ios_chrome_field_trials.cc',
+        'browser/ios_chrome_field_trials.h',
         'browser/memory/memory_debugger.h',
         'browser/memory/memory_debugger.mm',
         'browser/memory/memory_debugger_manager.h',
@@ -562,9 +567,9 @@
         '../..',
       ],
       'dependencies': [
-        'app_group_mainapp',
         '../../base/base.gyp:base',
         '../../components/components.gyp:version_info',
+        'app_group_mainapp',
       ],
       'link_settings': {
         'libraries': [
@@ -577,7 +582,7 @@
         'common/channel_info.mm',
         'common/string_util.h',
         'common/string_util.mm',
-      ]
+      ],
     },
     {
       'target_name': 'injected_js',
@@ -585,9 +590,7 @@
       'sources': [
         'browser/find_in_page/resources/find_in_page.js',
       ],
-      'includes': [
-        '../../ios/web/js_compile.gypi',
-      ],
+      'includes': [ '../../ios/web/js_compile.gypi' ],
       'link_settings': {
         'mac_bundle_resources': [
           '<(SHARED_INTERMEDIATE_DIR)/find_in_page.js',
diff --git a/ios/web/web_state/ui/crw_web_controller+protected.h b/ios/web/web_state/ui/crw_web_controller+protected.h
index 187d12f..bfabca4 100644
--- a/ios/web/web_state/ui/crw_web_controller+protected.h
+++ b/ios/web/web_state/ui/crw_web_controller+protected.h
@@ -240,9 +240,9 @@
 // Returns whether the user is interacting with the page.
 @property(nonatomic, readonly) BOOL userIsInteracting;
 
-// YES if a user interaction has been registered at any time once the page has
+// YES if a user interaction has been registered at any time since the page has
 // loaded.
-@property(nonatomic, readonly) BOOL userInteractionRegistered;
+@property(nonatomic, readwrite) BOOL userInteractionRegistered;
 
 // Returns the current window id.
 @property(nonatomic, readonly) NSString* windowId;
@@ -299,10 +299,6 @@
 // state not specific to web pages, and informs the delegate.
 - (void)didStartLoadingURL:(const GURL&)URL updateHistory:(BOOL)updateHistory;
 
-// Should be called with YES if a user interaction has been registered at any
-// time once the page has loaded.
-- (void)setUserInteractionRegistered:(BOOL)flag;
-
 // Returns YES if the user interacted with the page recently.
 - (BOOL)userClickedRecently;
 
diff --git a/ios/web/web_state/ui/crw_web_controller.mm b/ios/web/web_state/ui/crw_web_controller.mm
index ce3510f4..630a84b 100644
--- a/ios/web/web_state/ui/crw_web_controller.mm
+++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -2611,7 +2611,7 @@
   _URLOnStartLoading = url;
   _displayStateOnStartLoading = self.pageDisplayState;
 
-  _userInteractionRegistered = NO;
+  self.userInteractionRegistered = NO;
   _pageHasZoomed = NO;
 
   [[self sessionController] commitPendingEntry];
@@ -3094,7 +3094,7 @@
 - (void)touched:(BOOL)touched {
   _clickInProgress = touched;
   if (touched) {
-    _userInteractionRegistered = YES;
+    self.userInteractionRegistered = YES;
     _userInteractedWithWebController = YES;
     if (_isBeingDestroyed)
       return;
@@ -3302,7 +3302,7 @@
   // - the user has interacted with the page.
   CRWSessionEntry* current = [self currentSessionEntry];
   if (current && [current navigationItem]->GetURL() == [self currentURL] &&
-      _userInteractionRegistered) {
+      self.userInteractionRegistered) {
     [current navigationItem]->SetPageDisplayState(self.pageDisplayState);
   }
 }
diff --git a/ios/web/web_state/ui/crw_wk_web_view_web_controller.mm b/ios/web/web_state/ui/crw_wk_web_view_web_controller.mm
index 31654019..3163c5c 100644
--- a/ios/web/web_state/ui/crw_wk_web_view_web_controller.mm
+++ b/ios/web/web_state/ui/crw_wk_web_view_web_controller.mm
@@ -26,6 +26,7 @@
 #include "ios/web/public/cert_store.h"
 #include "ios/web/public/navigation_item.h"
 #include "ios/web/public/ssl_status.h"
+#include "ios/web/public/url_util.h"
 #include "ios/web/public/web_client.h"
 #import "ios/web/public/web_state/js/crw_js_injection_manager.h"
 #import "ios/web/public/web_state/ui/crw_native_content_provider.h"
@@ -175,8 +176,9 @@
   // |didFailProvisionalNavigation:| delegate method.
   scoped_ptr<CertVerificationErrorsCacheType> _certVerificationErrors;
 
-  // YES if the user has touched the content area since the last URL change.
-  BOOL _touchedSinceLastURLChange;
+  // YES if the user has interacted with the content area since the last URL
+  // change.
+  BOOL _interactionRegisteredSinceLastURLChange;
 }
 
 // Response's MIME type of the last known navigation.
@@ -319,10 +321,20 @@
 // transition based on user interaction state.
 - (void)registerLoadRequest:(const GURL&)url;
 
+// Returns YES if a KVO change to |newURL| could be a 'navigation' within the
+// document (hash change, pushState/replaceState, etc.). This should only be
+// used in the context of a URL KVO callback firing, and only if |isLoading| is
+// YES for the web view (since if it's not, no guesswork is needed).
+- (BOOL)isKVOChangePotentialSameDocumentNavigationToURL:(const GURL&)newURL;
+
 // Called when a non-document-changing URL change occurs. Updates the
 // _documentURL, and informs the superclass of the change.
 - (void)URLDidChangeWithoutDocumentChange:(const GURL&)URL;
 
+// Returns YES if there is currently a requested but uncommitted load for
+// |targetURL|.
+- (BOOL)isLoadRequestPendingForURL:(const GURL&)targetURL;
+
 // Called when web controller receives a new message from the web page.
 - (void)didReceiveScriptMessage:(WKScriptMessage*)message;
 
@@ -414,12 +426,6 @@
   [super close];
 }
 
-- (void)touched:(BOOL)touched {
-  [super touched:touched];
-  if (touched)
-    _touchedSinceLastURLChange = YES;
-}
-
 #pragma mark -
 #pragma mark Testing-Only Methods
 
@@ -450,6 +456,13 @@
   return _currentReferrerString.get();
 }
 
+// Overridden to track interactions since URL change.
+- (void)setUserInteractionRegistered:(BOOL)flag {
+  [super setUserInteractionRegistered:flag];
+  if (flag)
+    _interactionRegisteredSinceLastURLChange = YES;
+}
+
 #pragma mark Protected method implementations
 
 - (void)ensureWebViewCreated {
@@ -782,7 +795,7 @@
 - (void)setDocumentURL:(const GURL&)newURL {
   if (newURL != _documentURL) {
     _documentURL = newURL;
-    _touchedSinceLastURLChange = NO;
+    _interactionRegisteredSinceLastURLChange = NO;
   }
 }
 
@@ -1176,9 +1189,9 @@
     case WKNavigationTypeOther:
       // The "Other" type covers a variety of very different cases, which may
       // or may not be the result of user actions. For now, guess based on
-      // whether there's been a touch since the last URL change.
+      // whether there's been an interaction since the last URL change.
       // TODO(crbug.com/549301): See if this heuristic can be improved.
-      transition = _touchedSinceLastURLChange
+      transition = _interactionRegisteredSinceLastURLChange
                        ? ui::PAGE_TRANSITION_LINK
                        : ui::PAGE_TRANSITION_CLIENT_REDIRECT;
       break;
@@ -1188,10 +1201,29 @@
   [self registerLoadRequest:url referrer:emptyReferrer transition:transition];
 }
 
+- (BOOL)isKVOChangePotentialSameDocumentNavigationToURL:(const GURL&)newURL {
+  DCHECK([_wkWebView isLoading]);
+  // If the origin changes, it can't be same-document.
+  if (_documentURL.GetOrigin().is_empty() ||
+      _documentURL.GetOrigin() != newURL.GetOrigin()) {
+    return NO;
+  }
+  if (self.loadPhase == web::LOAD_REQUESTED) {
+    // Normally LOAD_REQUESTED indicates that this is a regular, pending
+    // navigation, but it can also happen during a fast-back navigation across
+    // a hash change, so that case is potentially a same-document navigation.
+    return web::GURLByRemovingRefFromGURL(newURL) ==
+           web::GURLByRemovingRefFromGURL(_documentURL);
+  }
+  // If it passes all the checks above, it might be (but there's no guarantee
+  // that it is).
+  return YES;
+}
+
 - (void)URLDidChangeWithoutDocumentChange:(const GURL&)newURL {
   DCHECK(newURL == net::GURLWithNSURL([_wkWebView URL]));
   DCHECK_EQ(_documentURL.host(), newURL.host());
-  [self setDocumentURL:newURL];
+
   // If called during window.history.pushState or window.history.replaceState
   // JavaScript evaluation, only update the document URL. This callback does not
   // have any information about the state object and cannot create (or edit) the
@@ -1199,13 +1231,37 @@
   // history changes when a window.history.didPushState or
   // window.history.didReplaceState message is received, which should happen in
   // the next runloop.
+  //
+  // Otherwise, simulate the whole delegate flow for a load (since the
+  // superclass currently doesn't have a clean separation between URL changes
+  // and document changes). Note that the order of these calls is important:
+  // registering a load request logically comes before updating the document
+  // URL, but also must come first since it uses state that is reset on URL
+  // changes.
   if (!_changingHistoryState) {
-    [self registerLoadRequest:_documentURL];
+    // If this wasn't a previously-expected load (e.g., certain back/forward
+    // navigations), register the load request.
+    if (![self isLoadRequestPendingForURL:newURL])
+      [self registerLoadRequest:newURL];
+  }
+
+  [self setDocumentURL:newURL];
+
+  if (!_changingHistoryState) {
     [self didStartLoadingURL:_documentURL updateHistory:YES];
     [self didFinishNavigation];
   }
 }
 
+- (BOOL)isLoadRequestPendingForURL:(const GURL&)targetURL {
+  if (self.loadPhase != web::LOAD_REQUESTED)
+    return NO;
+
+  web::NavigationItem* pendingItem =
+      self.webState->GetNavigationManager()->GetPendingItem();
+  return pendingItem && pendingItem->GetURL() == targetURL;
+}
+
 - (void)didReceiveScriptMessage:(WKScriptMessage*)message {
   // Broken out into separate method to catch errors.
   if (![self respondToWKScriptMessage:message]) {
@@ -1402,22 +1458,22 @@
   // navigation failure and do nothing. If the URL does not match, assume it is
   // a non-document-changing URL change, and handle accordingly.
   //
-  // If |isLoading| is YES, then it could either be case 1 (if the load phase is
-  // web::LOAD_REQUESTED), or it could be case 2 on a page that hasn't finished
-  // loading yet. If the domain of the new URL matches the last committed URL,
-  // then check window.location.href, and if it matches, trust it. The domain
+  // If |isLoading| is YES, then it could either be case 1, or it could be case
+  // 2 on a page that hasn't finished loading yet. If it's possible that it
+  // could be a same-page navigation (in which case there may not be any other
+  // callback about the URL having changed), then check the actual page URL via
+  // JavaScript. If the origin of the new URL matches the last committed URL,
+  // then check window.location.href, and if it matches, trust it. The origin
   // check ensures that if a site somehow corrupts window.location.href it can't
   // do a redirect to a slow-loading target page while it is still loading to
-  // spoof the domain. On a document-changing URL change, the
+  // spoof the origin. On a document-changing URL change, the
   // window.location.href will match the previous URL at this stage, not the web
   // view's current URL.
   if (![_wkWebView isLoading]) {
     if (_documentURL == url)
       return;
     [self URLDidChangeWithoutDocumentChange:url];
-  } else if (!_documentURL.host().empty() &&
-             _documentURL.host() == url.host() &&
-             self.loadPhase != web::LOAD_REQUESTED) {
+  } else if ([self isKVOChangePotentialSameDocumentNavigationToURL:url]) {
     [_wkWebView evaluateJavaScript:@"window.location.href"
                  completionHandler:^(id result, NSError* error) {
                      // If the web view has gone away, or the location
@@ -1428,8 +1484,9 @@
                      }
                      GURL jsURL([result UTF8String]);
                      // Make sure that the URL is as expected, and re-check
-                     // the host to prevent race conditions.
-                     if (jsURL == url && _documentURL.host() == url.host()) {
+                     // the origin to prevent race conditions.
+                     if (jsURL == url &&
+                         _documentURL.GetOrigin() == url.GetOrigin()) {
                        [self URLDidChangeWithoutDocumentChange:url];
                      }
                  }];
diff --git a/media/BUILD.gn b/media/BUILD.gn
index 52af493..f15e5903 100644
--- a/media/BUILD.gn
+++ b/media/BUILD.gn
@@ -791,7 +791,6 @@
     "//testing/gtest",
     "//testing/perf",
     "//third_party/widevine/cdm:version_h",
-    "//third_party/libyuv",
     "//ui/gfx:test_support",
   ]
   if (is_android) {
diff --git a/media/base/android/BUILD.gn b/media/base/android/BUILD.gn
index 52b5ca7..65ce1fc4 100644
--- a/media/base/android/BUILD.gn
+++ b/media/base/android/BUILD.gn
@@ -126,10 +126,6 @@
     "//media/capture/video/android/video_capture_device_android.h",
     "//media/capture/video/video_capture_device.h",
   ]
-  outputs = [
-    "org/chromium/media/AndroidImageFormat.java",
-    "org/chromium/media/CaptureApiType.java",
-  ]
 }
 
 android_library("media_java") {
diff --git a/media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java b/media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java
index 572f19c4..7916f62 100644
--- a/media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java
+++ b/media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java
@@ -105,7 +105,6 @@
             "Nexus 4", // Nexus 4
             "Nexus 5", // Nexus 5
             "Nexus 7", // Nexus 7
-            "Nexus 9", // Nexus 9
             "SM-N9005", // Galaxy Note 3
             "SM-T310", // Galaxy Tab 3 8.0 (WiFi)
     };
diff --git a/media/base/yuv_convert_perftest.cc b/media/base/yuv_convert_perftest.cc
index 81d69ee..d676e4e 100644
--- a/media/base/yuv_convert_perftest.cc
+++ b/media/base/yuv_convert_perftest.cc
@@ -12,7 +12,6 @@
 #include "media/base/yuv_convert.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "testing/perf/perf_test.h"
-#include "third_party/libyuv/include/libyuv/row.h"
 
 namespace media {
 #if !defined(ARCH_CPU_ARM_FAMILY) && !defined(ARCH_CPU_MIPS_FAMILY)
@@ -88,73 +87,6 @@
       kPerfTestIterations / total_time_seconds, "runs/s", true);
 }
 
-#ifdef HAS_I422TOARGBROW_SSSE3
-TEST_F(YUVConvertPerfTest, I422ToARGBRow_SSSE3) {
-  ASSERT_TRUE(base::CPU().has_ssse3());
-
-  base::TimeTicks start = base::TimeTicks::Now();
-  for (int i = 0; i < kPerfTestIterations; ++i) {
-    for (int row = 0; row < kSourceHeight; ++row) {
-      int chroma_row = row / 2;
-      libyuv::I422ToARGBRow_SSSE3(
-          yuv_bytes_.get() + row * kSourceWidth,
-          yuv_bytes_.get() + kSourceUOffset + (chroma_row * kSourceWidth / 2),
-          yuv_bytes_.get() + kSourceVOffset + (chroma_row * kSourceWidth / 2),
-          rgb_bytes_converted_.get(), &libyuv::kYuvIConstants, kWidth);
-    }
-  }
-  double total_time_seconds = (base::TimeTicks::Now() - start).InSecondsF();
-  perf_test::PrintResult("yuv_convert_perftest", "", "I422ToARGBRow_SSSE3",
-                         kPerfTestIterations / total_time_seconds, "runs/s",
-                         true);
-}
-#endif
-
-TEST_F(YUVConvertPerfTest, ConvertYUVAToARGBRow_MMX) {
-  ASSERT_TRUE(base::CPU().has_sse());
-
-  base::TimeTicks start = base::TimeTicks::Now();
-  for (int i = 0; i < kPerfTestIterations; ++i) {
-    for (int row = 0; row < kSourceHeight; ++row) {
-      int chroma_row = row / 2;
-      ConvertYUVAToARGBRow_MMX(
-          yuv_bytes_.get() + row * kSourceWidth,
-          yuv_bytes_.get() + kSourceUOffset + (chroma_row * kSourceWidth / 2),
-          yuv_bytes_.get() + kSourceVOffset + (chroma_row * kSourceWidth / 2),
-          yuv_bytes_.get() + row * kSourceWidth,  // hack: use luma for alpha
-          rgb_bytes_converted_.get(), kWidth, GetLookupTable(YV12));
-    }
-  }
-  media::EmptyRegisterState();
-  double total_time_seconds = (base::TimeTicks::Now() - start).InSecondsF();
-  perf_test::PrintResult("yuv_convert_perftest", "", "ConvertYUVAToARGBRow_MMX",
-                         kPerfTestIterations / total_time_seconds, "runs/s",
-                         true);
-}
-
-#ifdef HAS_I422ALPHATOARGBROW_SSSE3
-TEST_F(YUVConvertPerfTest, I422AlphaToARGBRow_SSSE3) {
-  ASSERT_TRUE(base::CPU().has_ssse3());
-
-  base::TimeTicks start = base::TimeTicks::Now();
-  for (int i = 0; i < kPerfTestIterations; ++i) {
-    for (int row = 0; row < kSourceHeight; ++row) {
-      int chroma_row = row / 2;
-      libyuv::I422AlphaToARGBRow_SSSE3(
-          yuv_bytes_.get() + row * kSourceWidth,
-          yuv_bytes_.get() + kSourceUOffset + (chroma_row * kSourceWidth / 2),
-          yuv_bytes_.get() + kSourceVOffset + (chroma_row * kSourceWidth / 2),
-          yuv_bytes_.get() + row * kSourceWidth,  // hack: use luma for alpha
-          rgb_bytes_converted_.get(), &libyuv::kYuvIConstants, kWidth);
-    }
-  }
-  double total_time_seconds = (base::TimeTicks::Now() - start).InSecondsF();
-  perf_test::PrintResult("yuv_convert_perftest", "", "I422AlphaToARGBRow_SSSE3",
-                         kPerfTestIterations / total_time_seconds, "runs/s",
-                         true);
-}
-#endif
-
 // 64-bit release + component builds on Windows are too smart and optimizes
 // away the function being tested.
 #if defined(OS_WIN) && (defined(ARCH_CPU_X86) || !defined(COMPONENT_BUILD))
@@ -203,11 +135,11 @@
           GetLookupTable(YV12));
     }
   }
-  media::EmptyRegisterState();
   double total_time_seconds = (base::TimeTicks::Now() - start).InSecondsF();
   perf_test::PrintResult(
       "yuv_convert_perftest", "", "LinearScaleYUVToRGB32Row_SSE",
       kPerfTestIterations / total_time_seconds, "runs/s", true);
+  media::EmptyRegisterState();
 }
 #endif  // defined(OS_WIN) && (ARCH_CPU_X86 || COMPONENT_BUILD)
 
diff --git a/media/media.gyp b/media/media.gyp
index 8a2d35d..dc23002a4 100644
--- a/media/media.gyp
+++ b/media/media.gyp
@@ -1449,10 +1449,9 @@
         '../testing/gmock.gyp:gmock',
         '../testing/gtest.gyp:gtest',
         '../testing/perf/perf_test.gyp:perf_test',
-        '../third_party/libyuv/libyuv.gyp:libyuv',
         '../ui/gfx/gfx.gyp:gfx',
-        '../ui/gfx/gfx.gyp:gfx_geometry',
         '../ui/gfx/gfx.gyp:gfx_test_support',
+        '../ui/gfx/gfx.gyp:gfx_geometry',
         'media',
         'media_test_support',
         'shared_memory_support',
diff --git a/net/BUILD.gn b/net/BUILD.gn
index a5d6638..7963a0a 100644
--- a/net/BUILD.gn
+++ b/net/BUILD.gn
@@ -56,6 +56,9 @@
   if (disable_file_support) {
     defines += [ "DISABLE_FILE_SUPPORT" ]
   }
+  if (disable_ftp_support) {
+    defines += [ "DISABLE_FTP_SUPPORT=1" ]
+  }
 }
 
 # net_internal_config is shared with net and net_small.
diff --git a/net/android/BUILD.gn b/net/android/BUILD.gn
index bddf979..7cd9b08 100644
--- a/net/android/BUILD.gn
+++ b/net/android/BUILD.gn
@@ -65,9 +65,6 @@
   sources = [
     "../test/url_request/url_request_failed_job.h",
   ]
-  outputs = [
-    "org/chromium/net/test/FailurePhase.java",
-  ]
 }
 
 java_cpp_enum("net_android_java_enums_srcjar") {
@@ -79,15 +76,6 @@
     "network_change_notifier_android.cc",
     "traffic_stats.cc",
   ]
-  outputs = [
-    "org/chromium/net/CertificateMimeType.java",
-    "org/chromium/net/CertVerifyStatusAndroid.java",
-    "org/chromium/net/ConnectionSubtype.java",
-    "org/chromium/net/ConnectionType.java",
-    "org/chromium/net/NetId.java",
-    "org/chromium/net/PrivateKeyType.java",
-    "org/chromium/net/TrafficStatsError.java",
-  ]
 }
 
 junit_binary("net_junit_tests") {
diff --git a/net/socket/ssl_client_socket_openssl.cc b/net/socket/ssl_client_socket_openssl.cc
index 29c59f7f..0d39f64 100644
--- a/net/socket/ssl_client_socket_openssl.cc
+++ b/net/socket/ssl_client_socket_openssl.cc
@@ -960,10 +960,6 @@
   if (cert_verifier_->SupportsOCSPStapling())
     SSL_enable_ocsp_stapling(ssl_);
 
-  // By default, renegotiations are rejected. After the initial handshake
-  // completes, some application protocols may re-enable it.
-  SSL_set_reject_peer_renegotiations(ssl_, 1);
-
   return OK;
 }
 
@@ -1136,7 +1132,7 @@
   set_signed_cert_timestamps_received(sct_list_len != 0);
 
   if (IsRenegotiationAllowed())
-    SSL_set_reject_peer_renegotiations(ssl_, 0);
+    SSL_set_renegotiate_mode(ssl_, ssl_renegotiate_freely);
 
   // Verify the certificate.
   UpdateServerCert();
diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions_unittests.cc b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions_unittests.cc
index 5c3f785d..280211a 100644
--- a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions_unittests.cc
+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions_unittests.cc
@@ -92,18 +92,6 @@
   clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
 }
 
-#if defined(OS_LINUX)
-
-BPF_DEATH_TEST_C(ParameterRestrictions,
-                 clock_gettime_crash_system_trace,
-                 DEATH_SEGV_MESSAGE(sandbox::GetErrorMessageContentForTests()),
-                 RestrictClockIdPolicy) {
-  struct timespec ts;
-  clock_gettime(base::TraceTicks::kClockSystemTrace, &ts);
-}
-
-#endif  // defined(OS_LINUX)
-
 #if !defined(OS_ANDROID)
 BPF_DEATH_TEST_C(ParameterRestrictions,
                  clock_gettime_crash_cpu_clock,
diff --git a/sandbox/linux/tests/unit_tests.cc b/sandbox/linux/tests/unit_tests.cc
index 20966cb..7ea28156 100644
--- a/sandbox/linux/tests/unit_tests.cc
+++ b/sandbox/linux/tests/unit_tests.cc
@@ -85,8 +85,8 @@
 static const int kExitForTimeout = 2;
 #endif
 
-#if defined(ADDRESS_SANITIZER)
-// ASAN catches SIGSEGV and then performs _exit(1).
+#if defined(SANDBOX_USES_BASE_TEST_SUITE)
+// This is due to StackDumpSignalHandler() performing _exit(1).
 // TODO(jln): get rid of the collision with kExitWithAssertionFailure.
 const int kExitAfterSIGSEGV = 1;
 #endif
@@ -305,13 +305,14 @@
   std::string details(TestFailedMessage(msg));
   const char* expected_msg = static_cast<const char*>(aux);
 
-#if defined(ADDRESS_SANITIZER)
-  // ASAN catches SIGSEGV and calls _exit(1).
-  const bool subprocess_got_sigsegv =
-      WIFEXITED(status) && (kExitAfterSIGSEGV == WEXITSTATUS(status));
-#else
+#if !defined(SANDBOX_USES_BASE_TEST_SUITE)
   const bool subprocess_got_sigsegv =
       WIFSIGNALED(status) && (SIGSEGV == WTERMSIG(status));
+#else
+  // This hack is required when a signal handler is installed
+  // for SEGV that will _exit(1).
+  const bool subprocess_got_sigsegv =
+      WIFEXITED(status) && (kExitAfterSIGSEGV == WEXITSTATUS(status));
 #endif
 
   ASSERT_TRUE(subprocess_got_sigsegv) << "Exit status: " << status
diff --git a/sync/android/BUILD.gn b/sync/android/BUILD.gn
index d337d0b..48f6760 100644
--- a/sync/android/BUILD.gn
+++ b/sync/android/BUILD.gn
@@ -37,9 +37,6 @@
   sources = [
     "//sync/internal_api/public/base/model_type.h",
   ]
-  outputs = [
-    "org/chromium/sync/ModelType.java",
-  ]
 }
 
 generate_jni("jni_headers") {
diff --git a/testing/buildbot/chromium.mac.json b/testing/buildbot/chromium.mac.json
index f62cc5f..59b1edf 100644
--- a/testing/buildbot/chromium.mac.json
+++ b/testing/buildbot/chromium.mac.json
@@ -1184,10 +1184,7 @@
       },
       {
         "isolate_name": "telemetry_perf_unittests",
-        "name": "telemetry_perf_unittests",
-        "swarming": {
-          "can_use_on_swarming_builders": true
-        }
+        "name": "telemetry_perf_unittests"
       }
     ],
     "scripts": [
@@ -1474,10 +1471,7 @@
       },
       {
         "isolate_name": "telemetry_perf_unittests",
-        "name": "telemetry_perf_unittests",
-        "swarming": {
-          "can_use_on_swarming_builders": true
-        }
+        "name": "telemetry_perf_unittests"
       }
     ],
     "scripts": [
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations
index ad0472fd..6971e468 100644
--- a/third_party/WebKit/LayoutTests/TestExpectations
+++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -39,7 +39,7 @@
 
 crbug.com/536138 virtual/spv2/paint/invalidation/repaint-subsequence-on-ancestor-clip-change.html [ Failure ]
 
-crbug.com/537172 [ SnowLeopard XP Win10 ] virtual/spv2/paint/invalidation/spv2/background-image-paint-invalidation.html [ Failure ]
+crbug.com/537172 [ Mac10.6 XP Win10 ] virtual/spv2/paint/invalidation/spv2/background-image-paint-invalidation.html [ Failure ]
 
 crbug.com/504613 crbug.com/524248 paint/images/image-backgrounds-not-antialiased.html [ Skip ]
 crbug.com/504613 crbug.com/524248 virtual/spv2/paint/images/image-backgrounds-not-antialiased.html [ Skip ]
@@ -69,7 +69,7 @@
 crbug.com/492664 [ Win ] imported/csswg-test/css-writing-modes-3/bidi-override-005.html [ Failure ]
 crbug.com/492664 [ Win ] imported/csswg-test/css-writing-modes-3/bidi-plaintext-001.html [ Failure ]
 crbug.com/492664 imported/csswg-test/css-transitions-2/transitioncancel-001.html [ Failure ]
-crbug.com/418091 [ SnowLeopard ] fast/text/aat-morx.html [ Failure ]
+crbug.com/418091 [ Mac10.6 ] fast/text/aat-morx.html [ Failure ]
 crbug.com/463358 [ Mac Linux ] svg/hixie/perf/005.xml [ Pass Failure ]
 crbug.com/463358 [ Mac Linux ] svg/hixie/perf/006.xml [ Pass Failure ]
 crbug.com/463358 [ Linux Mac ] svg/transforms/text-with-pattern-inside-transformed-html.xhtml [ Failure ]
@@ -113,7 +113,7 @@
 crbug.com/521093 http/tests/loading/pdf-commit-load-callbacks.html [ Failure Pass ]
 crbug.com/521094 [ Mac ] http/tests/navigation/beacon-cross-origin.https.html [ Crash Failure Pass ]
 crbug.com/521096 imported/web-platform-tests/webstorage/event_case_sensitive.html [ Failure Pass ]
-crbug.com/521097 [ Lion ] inspector-protocol/loading-iframe-document-node.html [ Crash Pass ]
+crbug.com/521097 [ Mac10.7 ] inspector-protocol/loading-iframe-document-node.html [ Crash Pass ]
 crbug.com/521107 [ Debug ] fast/html/imports/import-custom-element-abort.html [ Crash Pass ]
 crbug.com/520164 [ Linux ] accessibility/is-richly-editable.html [ Failure Pass ]
 crbug.com/520166 compositing/overflow/do-not-repaint-if-scrolling-composited-layers.html [ Failure Pass ]
@@ -129,7 +129,7 @@
 crbug.com/520184 http/tests/history/frameset-repeated-name.html [ Failure Pass ]
 crbug.com/520187 [ Linux Win ] http/tests/loading/bad-scheme-subframe.html [ Failure Pass ]
 crbug.com/520188 [ Win ] http/tests/local/fileapi/file-last-modified-after-delete.html [ Failure Pass ]
-crbug.com/520189 [ SnowLeopard ] http/tests/misc/submit-post-keygen.html [ Pass Timeout ]
+crbug.com/520189 [ Mac10.6 ] http/tests/misc/submit-post-keygen.html [ Pass Timeout ]
 crbug.com/520190 http/tests/navigatorconnect/postmessage-cross-origin.html [ Pass Timeout ]
 crbug.com/520191 http/tests/security/mixedContent/strict-mode-via-pref-image-blocked.https.html [ Failure Pass ]
 crbug.com/520611 [ Debug ] fast/filesystem/workers/file-writer-events-shared-worker.html [ Failure Pass ]
@@ -190,7 +190,11 @@
 crbug.com/445100 fast/block/float/marquee-shrink-to-avoid-floats.html [ Failure Pass ]
 crbug.com/469657 fast/events/mouse-event-buttons-attribute.html [ Failure Pass ]
 crbug.com/469657 virtual/pointerevent/fast/events/mouse-event-buttons-attribute.html [ Failure Pass ]
+
+crbug.com/548226 [ Win ] fast/events/pointerevents/mouse-pointer-event-properties.html [ Failure Pass ]
 crbug.com/548226 [ Win ] virtual/pointerevent/fast/events/pointerevents/mouse-pointer-event-properties.html [ Failure Pass ]
+crbug.com/548226 [ Win ] virtual/trustedeventsdefaultaction/fast/events/pointerevents/mouse-pointer-event-properties.html [ Failure Pass ]
+
 crbug.com/432129 fast/html/marquee-scroll.html [ Failure Pass ]
 crbug.com/320139 fast/repaint/block-layout-inline-children-replaced.html [ Failure Pass ]
 crbug.com/320139 virtual/syncpaint/fast/repaint/block-layout-inline-children-replaced.html [ Skip ]
@@ -203,7 +207,6 @@
 crbug.com/352856 [ Mac ] svg/batik/text/textPosition.svg [ Failure Pass ]
 crbug.com/352856 [ Mac ] svg/batik/text/textPosition2.svg [ Failure Pass ]
 crbug.com/413604 http/tests/loading/script-priorities.html [ Failure Pass ]
-crbug.com/479181 inspector-protocol/animation/animation-multiple-frames.html [ Failure Pass ]
 crbug.com/495523 svg/wicd/test-rightsizing-b.xhtml [ Failure Pass ]
 crbug.com/516364 svg/animations/smil-leak-element-instances.svg [ Failure Pass ]
 crbug.com/248938 virtual/threaded/animations/3d/transform-origin-vs-functions.html [ Pass Failure ]
@@ -251,7 +254,7 @@
 crbug.com/423739 fast/dom/Window/Location/location-override-valueOf.html [ NeedsManualRebaseline ]
 crbug.com/524859 fast/text/complex-text-opacity.html [ NeedsManualRebaseline ]
 # crbug.com/498021 [ Linux ] fast/text/complex-text-opacity.html [ Failure ]
-# crbug.com/509025 [ Yosemite ] fast/text/complex-text-opacity.html [ Failure ]
+# crbug.com/509025 [ Mac10.10 ] fast/text/complex-text-opacity.html [ Failure ]
 # crbug.com/521730 [ Win10 ] fast/text/complex-text-opacity.html [ Failure Timeout ]
 crbug.com/524859 transforms/2d/hindi-rotated.html [ NeedsManualRebaseline ]
 
@@ -267,15 +270,15 @@
 crbug.com/498539 inspector/tracing/timeline-time.html [ Pass Failure Timeout ]
 crbug.com/498539 inspector/tracing/timeline-timer.html [ Pass Failure ]
 crbug.com/498539 inspector/elements/styles-3/styles-change-node-while-editing.html [ Failure Pass ]
-crbug.com/498539 [ Precise MountainLion Trusty Linux32 XP SnowLeopard ] inspector/extensions/extensions-panel.html [ Failure Pass ]
-crbug.com/498539 [ Lion ] inspector/sources/debugger/js-with-inline-stylesheets.html [ Pass Timeout ]
-crbug.com/498539 [ Lion MountainLion Retina Mavericks Yosemite SnowLeopard ] inspector/sources/debugger/live-edit-no-reveal.html [ Crash Pass Timeout ]
-crbug.com/498539 [ MountainLion Yosemite ] inspector/sources/debugger/debug-inlined-scripts-fragment-id.html [ Pass Timeout ]
+crbug.com/498539 [ Precise Mac10.8 Trusty Linux32 XP Mac10.6 ] inspector/extensions/extensions-panel.html [ Failure Pass ]
+crbug.com/498539 [ Mac10.7 ] inspector/sources/debugger/js-with-inline-stylesheets.html [ Pass Timeout ]
+crbug.com/498539 [ Mac10.7 Mac10.8 Retina Mac10.9 Mac10.10 Mac10.6 ] inspector/sources/debugger/live-edit-no-reveal.html [ Crash Pass Timeout ]
+crbug.com/498539 [ Mac10.8 Mac10.10 ] inspector/sources/debugger/debug-inlined-scripts-fragment-id.html [ Pass Timeout ]
 crbug.com/498539 [ Precise ] inspector/sources/debugger-pause/pause-in-inline-script.html [ Pass Timeout ]
 crbug.com/498539 [ Precise ] inspector/sources/debugger-step/debugger-step-over-inlined-scripts.html [ Pass Timeout ]
-crbug.com/498539 [ Precise MountainLion Trusty Mavericks Retina Win7 Lion Linux32 SnowLeopard XP Yosemite ] inspector/sources/debugger-ui/script-formatter-breakpoints-2.html [ Failure Pass ]
-crbug.com/498539 [ Precise Win7 Yosemite ] inspector/sources/debugger-breakpoints/dynamic-scripts-breakpoints.html [ Pass Timeout ]
-crbug.com/498539 [ Precise Yosemite ] inspector/sources/debugger-breakpoints/set-breakpoint.html [ Pass Timeout ]
+crbug.com/498539 [ Precise Mac10.8 Trusty Mac10.9 Retina Win7 Mac10.7 Linux32 Mac10.6 XP Mac10.10 ] inspector/sources/debugger-ui/script-formatter-breakpoints-2.html [ Failure Pass ]
+crbug.com/498539 [ Precise Win7 Mac10.10 ] inspector/sources/debugger-breakpoints/dynamic-scripts-breakpoints.html [ Pass Timeout ]
+crbug.com/498539 [ Precise Mac10.10 ] inspector/sources/debugger-breakpoints/set-breakpoint.html [ Pass Timeout ]
 crbug.com/498539 [ Trusty ] inspector/sources/debugger/mutation-observer-suspend-while-paused.html [ Pass Timeout ]
 crbug.com/498539 [ Win7 ] inspector/profiler/cpu-profiler-stopped-removed-race.html [ Crash Pass ]
 crbug.com/498539 [ Win7 ] inspector/sources/debugger-async/async-callstack-scopes.html [ Failure Pass ]
@@ -287,12 +290,12 @@
 crbug.com/498539 [ XP Trusty ] http/tests/inspector/sources/ui-source-code-highlight.php [ Crash Pass Timeout ]
 crbug.com/498539 [ XP Trusty ] inspector/sources/debugger-pause/pause-on-elements-panel.html [ Pass Timeout ]
 crbug.com/498539 [ XP Win7 ] inspector/sources/debugger/debug-inlined-scripts.html [ Pass Timeout ]
-crbug.com/498539 [ Yosemite ] inspector/sources/debugger-ui/reveal-not-skipped.html [ Failure Pass ]
-crbug.com/498539 [ Yosemite ] inspector/sources/debugger/rethrow-error-from-bindings-crash.html [ Failure Pass ]
+crbug.com/498539 [ Mac10.10 ] inspector/sources/debugger-ui/reveal-not-skipped.html [ Failure Pass ]
+crbug.com/498539 [ Mac10.10 ] inspector/sources/debugger/rethrow-error-from-bindings-crash.html [ Failure Pass ]
 crbug.com/498539 [ Linux32 ] inspector/console/console-log-linkify-stack-in-errors.html [ Failure Pass ]
 crbug.com/498539 [ Linux32 Win7 ] inspector/console/console-log-short-hand-method.html [ Failure Pass ]
-crbug.com/498539 [ Mavericks ] inspector/console/console-uncaught-exception.html [ Failure Pass ]
-crbug.com/498539 [ MountainLion Win7 ] inspector/console/console-log-wrapped-in-framework.html [ Failure Pass ]
+crbug.com/498539 [ Mac10.9 ] inspector/console/console-uncaught-exception.html [ Failure Pass ]
+crbug.com/498539 [ Mac10.8 Win7 ] inspector/console/console-log-wrapped-in-framework.html [ Failure Pass ]
 crbug.com/498539 [ Precise Linux32 ] inspector/console/console-filter-level-test.html [ Failure Pass ]
 crbug.com/498539 [ Win7 ] inspector/console/console-command-clear.html [ Failure Pass ]
 crbug.com/498539 [ Win7 ] inspector/console/console-custom-formatters.html [ Failure Pass ]
@@ -306,16 +309,16 @@
 crbug.com/521099 inspector/console/shadow-element.html [ Crash Pass Timeout ]
 crbug.com/498539 [ Win7 ] inspector/console/console-trace-arguments.html [ Failure Pass ]
 crbug.com/498539 [ Win7 ] inspector/console/console-trace-in-eval.html [ Failure Pass ]
-crbug.com/498539 [ Win7 Mavericks ] inspector/console/worker-exception-message-contains-stack.html [ Failure Pass ]
+crbug.com/498539 [ Win7 Mac10.9 ] inspector/console/worker-exception-message-contains-stack.html [ Failure Pass ]
 crbug.com/498539 [ Retina ] http/tests/inspector/search/sources-search-scope.html [ Failure Pass ]
-crbug.com/498539 [ Lion ] inspector-protocol/heap-profiler/heap-snapshot-with-event-listener.html [ Pass Timeout ]
+crbug.com/498539 [ Mac10.7 ] inspector-protocol/heap-profiler/heap-snapshot-with-event-listener.html [ Pass Timeout ]
 crbug.com/498539 [ Precise ] http/tests/inspector/extensions-useragent.html [ Pass Timeout ]
 crbug.com/498539 [ Precise ] inspector/device-emulation/device-emulation-320-2x.html [ Crash Pass ]
-crbug.com/498539 [ Precise Lion Win7 ] inspector-protocol/cpu-profiler/record-cpu-profile.html [ Crash Pass ]
-crbug.com/498539 [ Precise Lion Win7 SnowLeopard ] inspector/agents-enable-disable.html [ Crash Pass ]
-crbug.com/498539 [ Precise Win7 SnowLeopard ] inspector/elements/styles-1/edit-inspector-stylesheet.html [ Failure Pass Timeout ]
-crbug.com/498539 [ SnowLeopard ] http/tests/inspector/extensions-network-redirect.html [ Crash Pass ]
-crbug.com/498539 [ SnowLeopard ] inspector-protocol/heap-profiler/heap-objects-tracking.html [ Crash Pass ]
+crbug.com/498539 [ Precise Mac10.7 Win7 ] inspector-protocol/cpu-profiler/record-cpu-profile.html [ Crash Pass ]
+crbug.com/498539 [ Precise Mac10.7 Win7 Mac10.6 ] inspector/agents-enable-disable.html [ Crash Pass ]
+crbug.com/498539 [ Precise Win7 Mac10.6 ] inspector/elements/styles-1/edit-inspector-stylesheet.html [ Failure Pass Timeout ]
+crbug.com/498539 [ Mac10.6 ] http/tests/inspector/extensions-network-redirect.html [ Crash Pass ]
+crbug.com/498539 [ Mac10.6 ] inspector-protocol/heap-profiler/heap-objects-tracking.html [ Crash Pass ]
 crbug.com/498539 [ Win7 ] http/tests/inspector/service-workers/service-worker-manager.html [ Crash Pass ]
 crbug.com/498539 [ Win7 Release ] inspector/elements/styles-2/perform-undo-perform-of-mergable-action.html [ Failure Pass ]
 crbug.com/498539 [ Win7 ] inspector/elements/styles-3/selector-list.html [ Failure Pass ]
@@ -448,8 +451,8 @@
 crbug.com/505364 imported/web-platform-tests/shadow-dom/untriaged/shadow-trees/upper-boundary-encapsulation/ownerdocument-002.html [ Failure ]
 crbug.com/505364 crbug.com/520616 imported/web-platform-tests/shadow-dom/untriaged/shadow-trees/upper-boundary-encapsulation/test-009.html [ Failure ]
 
-crbug.com/539623 [ SnowLeopard ] fast/repaint/selection-change-in-iframe-with-relative-parent.html [ Pass Failure ]
-crbug.com/539623 [ SnowLeopard ] virtual/syncpaint/fast/repaint/selection-change-in-iframe-with-relative-parent.html [ Skip ]
+crbug.com/539623 [ Mac10.6 ] fast/repaint/selection-change-in-iframe-with-relative-parent.html [ Pass Failure ]
+crbug.com/539623 [ Mac10.6 ] virtual/syncpaint/fast/repaint/selection-change-in-iframe-with-relative-parent.html [ Skip ]
 
 crbug.com/387740 imported/web-platform-tests/mediacapture-streams/stream-api/introduction/disabled-audio-silence.html [ Skip ]
 crbug.com/387740 imported/web-platform-tests/mediacapture-streams/stream-api/introduction/disabled-video-black.html [ Skip ]
@@ -646,7 +649,6 @@
 crbug.com/492664 imported/csswg-test/css-writing-modes-3/table-progression-vlr-004.html [ Failure ]
 crbug.com/492664 imported/csswg-test/css-writing-modes-3/table-progression-vrl-001.html [ Failure ]
 crbug.com/492664 imported/csswg-test/css-writing-modes-3/table-progression-vrl-004.html [ Failure ]
-crbug.com/492664 imported/csswg-test/css-writing-modes-3/writing-mode-stretch-001.html [ Failure ]
 
 # Either "combo" or split should run: http://testthewebforward.org/docs/css-naming.html
 crbug.com/410320 imported/csswg-test/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001.html [ Skip ]
@@ -864,7 +866,7 @@
 crbug.com/363099 [ Win ] plugins/nested-plugin-objects.html [ Failure ]
 crbug.com/363099 [ Win ] plugins/open-and-close-window-with-plugin.html [ Failure ]
 
-crbug.com/418091 [ SnowLeopard ] fast/text/international/zerowidthjoiner.html [ Failure ]
+crbug.com/418091 [ Mac10.6 ] fast/text/international/zerowidthjoiner.html [ Failure ]
 
 crbug.com/425345 [ Mac ] fast/text/line-break-after-question-mark.html [ Failure ]
 
@@ -917,7 +919,7 @@
 crbug.com/425113 svg/clip-path/clip-path-multiple-children.svg [ Failure ]
 
 crbug.com/480769 http/tests/inspector/service-workers/service-workers-redundant.html [ Crash Pass Slow Failure ]
-crbug.com/528198 http/tests/inspector/service-workers/service-worker-agents.html [ Crash Pass ]
+crbug.com/528198 http/tests/inspector/service-workers/service-worker-agents.html [ Crash Pass Slow ]
 
 crbug.com/472330 fast/borders/border-image-outset-split-inline-vertical-lr.html [ Failure ]
 crbug.com/472330 fast/writing-mode/box-shadow-vertical-lr.html [ Failure ]
@@ -961,12 +963,12 @@
 crbug.com/471824 virtual/pointerevent/imported/web-platform-tests/pointerevents/pointerevent_touch-action-illegal.html [ Skip ]
 crbug.com/471824 virtual/pointerevent/imported/web-platform-tests/pointerevents/pointerevent_touch-action-verification.html [ Skip ]
 
-crbug.com/471066 [ SnowLeopard ] fast/text/apply-start-width-after-skipped-text.html [ Failure ]
-crbug.com/471066 [ SnowLeopard ] fast/text/bidi-explicit-embedding-past-end.html [ Failure ]
-crbug.com/471066 [ SnowLeopard ] fast/text/emphasis-overlap.html [ Failure ]
-crbug.com/471066 [ SnowLeopard ] fast/text/fake-italic.html [ Failure ]
+crbug.com/471066 [ Mac10.6 ] fast/text/apply-start-width-after-skipped-text.html [ Failure ]
+crbug.com/471066 [ Mac10.6 ] fast/text/bidi-explicit-embedding-past-end.html [ Failure ]
+crbug.com/471066 [ Mac10.6 ] fast/text/emphasis-overlap.html [ Failure ]
+crbug.com/471066 [ Mac10.6 ] fast/text/fake-italic.html [ Failure ]
 
-crbug.com/478109 [ SnowLeopard ] fast/text/bidi-embedding-pop-and-push-same-2.html [ Failure ]
+crbug.com/478109 [ Mac10.6 ] fast/text/bidi-embedding-pop-and-push-same-2.html [ Failure ]
 
 # These need a rebaseline due crbug.com/504745 on Windows when they are activated again.
 crbug.com/521124 [ Win7 ] fast/text/international/vertical-text-glyph-test.html [ Pass Failure ]
@@ -1039,58 +1041,58 @@
 
 crbug.com/506312 imported/csswg-test/css-pseudo-4/first-letter-001.html [ Failure ]
 
-# Yosemite-specific failures that still need triaging.
+# Mac10.10-specific failures that still need triaging.
 # Form controls need rebaseline because of the default font change.
 # If you see wider INPUT elements or narrower TEXTAREA elements, you may do just
 # rebaseline. See crbug.com/508768#c6
-crbug.com/509025 [ Yosemite ] compositing/layer-creation/compositing-reason-removed.html [ Failure ]
+crbug.com/509025 [ Mac10.10 ] compositing/layer-creation/compositing-reason-removed.html [ Failure ]
 # TODO(chrishtr): uncomment after fixing crbug.com/529038
-#crbug.com/509025 [ Yosemite ] compositing/layer-creation/should-invoke-deferred-compositing.html [ Failure ]
-crbug.com/509025 [ Yosemite ] compositing/overflow/fixed-scroll-in-empty-root-layer.html [ Failure ]
-crbug.com/509025 [ Yosemite ] compositing/overflow/text-color-change.html [ Failure ]
-crbug.com/509025 [ Yosemite ] compositing/overflow/updating-scrolling-container-and-content.html [ Failure ]
-crbug.com/509025 [ Yosemite ] compositing/overflow/updating-scrolling-container.html [ Failure ]
+#crbug.com/509025 [ Mac10.10 ] compositing/layer-creation/should-invoke-deferred-compositing.html [ Failure ]
+crbug.com/509025 [ Mac10.10 ] compositing/overflow/fixed-scroll-in-empty-root-layer.html [ Failure ]
+crbug.com/509025 [ Mac10.10 ] compositing/overflow/text-color-change.html [ Failure ]
+crbug.com/509025 [ Mac10.10 ] compositing/overflow/updating-scrolling-container-and-content.html [ Failure ]
+crbug.com/509025 [ Mac10.10 ] compositing/overflow/updating-scrolling-container.html [ Failure ]
 # TODO(chrishtr): uncomment/inspect rebaseline of this after fixing crbug.com/516016
-# crbug.com/509025 [ Yosemite ] compositing/repaint/should-not-clip-composited-overflow-scrolling-layer.html [ Failure ]
-crbug.com/509025 [ Yosemite ] compositing/squashing/iframe-inside-squashed-layer.html [ Failure ]
-crbug.com/509025 [ Yosemite ] compositing/squashing/invalidate-when-leaving-squashed-layer.html [ Failure ]
-crbug.com/509025 [ Yosemite ] compositing/squashing/invalidation-for-subpixel-offset-of-squashed-layer.html [ Failure ]
-crbug.com/509025 [ Yosemite ] compositing/squashing/invalidations-with-large-negative-margin.html [ Failure ]
-crbug.com/509025 [ Yosemite ] compositing/squashing/remove-squashed-layer-plus-move.html [ Failure ]
-crbug.com/509025 [ Yosemite ] compositing/squashing/repaint-overflow-scrolled-squashed-content.html [ Failure ]
-crbug.com/509025 [ Yosemite ] compositing/squashing/repaint-squashed-layer-in-rect.html [ Failure ]
-crbug.com/509025 [ Yosemite ] compositing/squashing/repaint-via-layout-offset.html [ Failure ]
-crbug.com/509025 [ Yosemite ] compositing/squashing/resize-squashing-layer-that-needs-full-repaint.html [ Failure ]
-crbug.com/509025 [ Yosemite ] compositing/squashing/squash-partial-repaint-inside-squashed-layer.html [ Failure ]
-crbug.com/509025 [ Yosemite ] compositing/squashing/squashing-inside-preserve-3d-element.html [ Failure ]
-crbug.com/509025 [ Yosemite ] css3/flexbox/repaint-rtl-column.html [ Failure ]
-crbug.com/509025 [ Yosemite ] fast/css/css2-system-fonts.html [ Failure ]
-crbug.com/509025 [ Yosemite ] fast/css/font-face-data-uri-invalid.html [ Failure ]
-crbug.com/509025 [ Yosemite ] fast/css/fontfaceset-download-error.html [ Failure ]
-crbug.com/509025 [ Yosemite ] fast/dom/adopt-attribute-crash.svg [ Failure ]
-crbug.com/509025 [ Yosemite ] fast/forms/hidden-listbox.html [ Failure ]
-crbug.com/509025 [ Yosemite ] fast/forms/textarea-newline.html [ Failure ]
-crbug.com/509025 [ Yosemite ] fast/images/style-access-during-imageChanged-crash.html [ Failure ]
-crbug.com/509025 [ Yosemite ] fast/parser/xml-colon-entity.html [ Failure ]
-crbug.com/509025 [ Yosemite ] fast/parser/xml-declaration-missing-ending-mark.html [ Failure ]
-crbug.com/509025 [ Yosemite ] fast/text/custom-font-data-crash.html [ Failure ]
-crbug.com/509025 [ Yosemite ] fast/text/custom-font-data-crash2.html [ Failure ]
-crbug.com/509025 [ Yosemite ] fast/text/glyph-reordering.html [ Failure ]
-crbug.com/509025 [ Yosemite ] fast/text/large-text-composed-char.html [ Failure ]
-crbug.com/509025 [ Yosemite ] http/tests/navigation/navigation-redirect-schedule-crash.html [ Failure ]
-crbug.com/509025 [ Yosemite ] http/tests/security/contentTypeOptions/nosniff-script-without-content-type-blocked.html [ Failure ]
+# crbug.com/509025 [ Mac10.10 ] compositing/repaint/should-not-clip-composited-overflow-scrolling-layer.html [ Failure ]
+crbug.com/509025 [ Mac10.10 ] compositing/squashing/iframe-inside-squashed-layer.html [ Failure ]
+crbug.com/509025 [ Mac10.10 ] compositing/squashing/invalidate-when-leaving-squashed-layer.html [ Failure ]
+crbug.com/509025 [ Mac10.10 ] compositing/squashing/invalidation-for-subpixel-offset-of-squashed-layer.html [ Failure ]
+crbug.com/509025 [ Mac10.10 ] compositing/squashing/invalidations-with-large-negative-margin.html [ Failure ]
+crbug.com/509025 [ Mac10.10 ] compositing/squashing/remove-squashed-layer-plus-move.html [ Failure ]
+crbug.com/509025 [ Mac10.10 ] compositing/squashing/repaint-overflow-scrolled-squashed-content.html [ Failure ]
+crbug.com/509025 [ Mac10.10 ] compositing/squashing/repaint-squashed-layer-in-rect.html [ Failure ]
+crbug.com/509025 [ Mac10.10 ] compositing/squashing/repaint-via-layout-offset.html [ Failure ]
+crbug.com/509025 [ Mac10.10 ] compositing/squashing/resize-squashing-layer-that-needs-full-repaint.html [ Failure ]
+crbug.com/509025 [ Mac10.10 ] compositing/squashing/squash-partial-repaint-inside-squashed-layer.html [ Failure ]
+crbug.com/509025 [ Mac10.10 ] compositing/squashing/squashing-inside-preserve-3d-element.html [ Failure ]
+crbug.com/509025 [ Mac10.10 ] css3/flexbox/repaint-rtl-column.html [ Failure ]
+crbug.com/509025 [ Mac10.10 ] fast/css/css2-system-fonts.html [ Failure ]
+crbug.com/509025 [ Mac10.10 ] fast/css/font-face-data-uri-invalid.html [ Failure ]
+crbug.com/509025 [ Mac10.10 ] fast/css/fontfaceset-download-error.html [ Failure ]
+crbug.com/509025 [ Mac10.10 ] fast/dom/adopt-attribute-crash.svg [ Failure ]
+crbug.com/509025 [ Mac10.10 ] fast/forms/hidden-listbox.html [ Failure ]
+crbug.com/509025 [ Mac10.10 ] fast/forms/textarea-newline.html [ Failure ]
+crbug.com/509025 [ Mac10.10 ] fast/images/style-access-during-imageChanged-crash.html [ Failure ]
+crbug.com/509025 [ Mac10.10 ] fast/parser/xml-colon-entity.html [ Failure ]
+crbug.com/509025 [ Mac10.10 ] fast/parser/xml-declaration-missing-ending-mark.html [ Failure ]
+crbug.com/509025 [ Mac10.10 ] fast/text/custom-font-data-crash.html [ Failure ]
+crbug.com/509025 [ Mac10.10 ] fast/text/custom-font-data-crash2.html [ Failure ]
+crbug.com/509025 [ Mac10.10 ] fast/text/glyph-reordering.html [ Failure ]
+crbug.com/509025 [ Mac10.10 ] fast/text/large-text-composed-char.html [ Failure ]
+crbug.com/509025 [ Mac10.10 ] http/tests/navigation/navigation-redirect-schedule-crash.html [ Failure ]
+crbug.com/509025 [ Mac10.10 ] http/tests/security/contentTypeOptions/nosniff-script-without-content-type-blocked.html [ Failure ]
 
-#crbug.com/509025 [ Yosemite ] fast/text/emphasis.html [ Failure ]
+#crbug.com/509025 [ Mac10.10 ] fast/text/emphasis.html [ Failure ]
 
-crbug.com/545140 [ Yosemite ] fast/encoding/denormalised-voiced-japanese-chars.html [ Failure ]
-crbug.com/545141 [ Yosemite ] fast/writing-mode/text-orientation-basic.html [ Failure ]
+crbug.com/545140 [ Mac10.10 ] fast/encoding/denormalised-voiced-japanese-chars.html [ Failure ]
+crbug.com/545141 [ Mac10.10 ] fast/writing-mode/text-orientation-basic.html [ Failure ]
 
-crbug.com/509025 [ Yosemite ] fast/text/international/complex-character-based-fallback.html [ Failure ]
-crbug.com/509025 [ Yosemite ] virtual/pointerevent/fast/events/context-no-deselect.html [ Failure ]
-crbug.com/509025 [ Yosemite ] virtual/trustedeventsdefaultaction/fast/events/context-no-deselect.html [ Failure ]
-crbug.com/509025 [ Yosemite ] virtual/prefer_compositing_to_lcd_text/compositing/overflow/theme-affects-visual-overflow.html [ Failure ]
-crbug.com/509025 [ Yosemite ] virtual/rootlayerscrolls/scrollbars/rtl/overflow-scroll-rtl.html [ Failure ]
-crbug.com/509025 [ Yosemite ] virtual/rootlayerscrolls/scrollbars/short-scrollbar.html [ Failure ]
+crbug.com/509025 [ Mac10.10 ] fast/text/international/complex-character-based-fallback.html [ Failure ]
+crbug.com/509025 [ Mac10.10 ] virtual/pointerevent/fast/events/context-no-deselect.html [ Failure ]
+crbug.com/509025 [ Mac10.10 ] virtual/trustedeventsdefaultaction/fast/events/context-no-deselect.html [ Failure ]
+crbug.com/509025 [ Mac10.10 ] virtual/prefer_compositing_to_lcd_text/compositing/overflow/theme-affects-visual-overflow.html [ Failure ]
+crbug.com/509025 [ Mac10.10 ] virtual/rootlayerscrolls/scrollbars/rtl/overflow-scroll-rtl.html [ Failure ]
+crbug.com/509025 [ Mac10.10 ] virtual/rootlayerscrolls/scrollbars/short-scrollbar.html [ Failure ]
 
 crbug.com/443596 media/sources-fallback-codecs.html [ Pass Failure ]
 
@@ -1292,9 +1294,9 @@
 crbug.com/521730 [ Win10 ] svg/text/text-selection-intro-05-t.svg [ Failure ]
 
 crbug.com/550430 fast/html/details-writing-mode.html [ Failure Pass ]
-crbug.com/550285 [ SnowLeopard ] virtual/syncpaint/compositing/repaint/newly-composited-on-scroll.html [ Failure ]
-crbug.com/550285 [ SnowLeopard ] virtual/syncpaint/fast/repaint/background-image-paint-invalidation-large-abspos-div.html [ Failure ]
-crbug.com/550285 [ SnowLeopard ] virtual/syncpaint/fast/repaint/repaint-during-scroll.html [ Failure ]
+crbug.com/550285 [ Mac10.6 ] virtual/syncpaint/compositing/repaint/newly-composited-on-scroll.html [ Failure ]
+crbug.com/550285 [ Mac10.6 ] virtual/syncpaint/fast/repaint/background-image-paint-invalidation-large-abspos-div.html [ Failure ]
+crbug.com/550285 [ Mac10.6 ] virtual/syncpaint/fast/repaint/repaint-during-scroll.html [ Failure ]
 crbug.com/550285 [ XP ] virtual/syncpaint/fast/repaint/float-overflow-right.html [ Failure ]
 
 crbug.com/474759 fast/writing-mode/vertical-rl-replaced-selection.html [ Failure ]
@@ -1333,7 +1335,7 @@
 
 crbug.com/535478 [ Win ] virtual/threaded/inspector/tracing/decode-resize.html [ Slow Pass Failure ]
 
-crbug.com/524646 [ Yosemite ] fast/dom/shadow/shadowdom-for-button.html [ Failure ]
+crbug.com/524646 [ Mac10.10 ] fast/dom/shadow/shadowdom-for-button.html [ Failure ]
 
 crbug.com/538717 [ Win Mac Linux ] http/tests/permissions/chromium/test-request-multiple-window.html [ Failure Pass Timeout ]
 crbug.com/538717 [ Win Mac Linux ] http/tests/permissions/chromium/test-request-multiple-worker.html [ Failure Pass Timeout ]
@@ -1347,16 +1349,12 @@
 
 crbug.com/546215 [ Android ] fast/inline-block/overflow-clip.html [ Failure ]
 
-crbug.com/548416 [ SnowLeopard ] virtual/syncpaint/compositing/repaint/background-attachment-fixed-scrolled.html [ Failure ]
+crbug.com/548416 [ Mac10.6 ] virtual/syncpaint/compositing/repaint/background-attachment-fixed-scrolled.html [ Failure ]
 
 crbug.com/548765 http/tests/inspector/console-fetch-logging.html [ Failure Pass Slow ]
 
 crbug.com/549314 [ XP ] inspector-protocol/layout-fonts/unicode-range-combining-chars-fallback.html [ Failure ]
 
-crbug.com/551057 [ XP ] imported/csswg-test/css-writing-modes-3/vertical-alignment-vlr-023.xht [ Failure ]
-crbug.com/551057 [ XP ] imported/csswg-test/css-writing-modes-3/vertical-alignment-vlr-025.xht [ Failure ]
-crbug.com/551057 [ XP ] imported/csswg-test/css-writing-modes-3/vertical-alignment-vlr-027.xht [ Failure ]
-
 crbug.com/551272 fast/js/getOwnPropertyDescriptor.html [ NeedsManualRebaseline ]
 crbug.com/551272 fast/js/pic/cached-named-property-getter.html [ NeedsManualRebaseline ]
 crbug.com/551272 fast/js/mozilla/strict/15.10.7.html [ NeedsManualRebaseline ]
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-drawImage-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-drawImage-expected.txt
index 963e9054..fd67293 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-drawImage-expected.txt
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-drawImage-expected.txt
@@ -12,3001 +12,3001 @@
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is imageWidth
 PASS bitmap.height is imageHeight
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check crop.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 10
 PASS bitmap.height is 10
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check crop center.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 10
 PASS bitmap.height is 10
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check crop right.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 10
 PASS bitmap.height is 10
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check over crop.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 60
 PASS bitmap.height is 60
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check over crop right.
 PASS bitmap.width is 50
 PASS bitmap.height is 50
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check crop.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 10
 PASS bitmap.height is 10
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check empty.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 30
 PASS bitmap.height is 30
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check empty.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 30
 PASS bitmap.height is 30
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Checking HTMLCanvasElement.
 Check no crop.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is imageWidth
 PASS bitmap.height is imageHeight
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check crop.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 10
 PASS bitmap.height is 10
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check crop center.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 10
 PASS bitmap.height is 10
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check crop right.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 10
 PASS bitmap.height is 10
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check over crop.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 60
 PASS bitmap.height is 60
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check over crop right.
 PASS bitmap.width is 50
 PASS bitmap.height is 50
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check crop.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 10
 PASS bitmap.height is 10
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check empty.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 30
 PASS bitmap.height is 30
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check empty.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 30
 PASS bitmap.height is 30
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Checking ImageData.
 Check no crop.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is imageWidth
 PASS bitmap.height is imageHeight
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check crop.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 10
 PASS bitmap.height is 10
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check crop center.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 10
 PASS bitmap.height is 10
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check crop right.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 10
 PASS bitmap.height is 10
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check over crop.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 60
 PASS bitmap.height is 60
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check over crop right.
 PASS bitmap.width is 50
 PASS bitmap.height is 50
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check crop.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 10
 PASS bitmap.height is 10
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check empty.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 30
 PASS bitmap.height is 30
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check empty.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 30
 PASS bitmap.height is 30
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Checking CanvasRenderingContext2D.
 Check no crop.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is imageWidth
 PASS bitmap.height is imageHeight
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check crop.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 10
 PASS bitmap.height is 10
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check crop center.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 10
 PASS bitmap.height is 10
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check crop right.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 10
 PASS bitmap.height is 10
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check over crop.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 60
 PASS bitmap.height is 60
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check over crop right.
 PASS bitmap.width is 50
 PASS bitmap.height is 50
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check crop.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 10
 PASS bitmap.height is 10
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check empty.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 30
 PASS bitmap.height is 30
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check empty.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 30
 PASS bitmap.height is 30
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Checking ImageBitmap.
 Check no crop.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is imageWidth
 PASS bitmap.height is imageHeight
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check crop.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 10
 PASS bitmap.height is 10
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check crop center.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 10
 PASS bitmap.height is 10
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check crop right.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 10
 PASS bitmap.height is 10
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check over crop.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 60
 PASS bitmap.height is 60
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check over crop right.
 PASS bitmap.width is 50
 PASS bitmap.height is 50
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check crop.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 10
 PASS bitmap.height is 10
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check empty.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 30
 PASS bitmap.height is 30
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check empty.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 30
 PASS bitmap.height is 30
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Checking Blob.
 Check no crop.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is imageWidth
 PASS bitmap.height is imageHeight
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check crop.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 10
 PASS bitmap.height is 10
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check crop center.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 10
 PASS bitmap.height is 10
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check crop right.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 10
 PASS bitmap.height is 10
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check over crop.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 60
 PASS bitmap.height is 60
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check over crop right.
 PASS bitmap.width is 50
 PASS bitmap.height is 50
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check crop.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 10
 PASS bitmap.height is 10
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 255 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 255
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check empty.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 30
 PASS bitmap.height is 30
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 Check empty.
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
 PASS bitmap.width is 30
 PASS bitmap.height is 30
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 PASS successfullyParsed is true
 
 TEST COMPLETE
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-drawImage-video-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-drawImage-video-expected.txt
index 984c66cd..c7ee612 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-drawImage-video-expected.txt
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-drawImage-video-expected.txt
@@ -4,226 +4,226 @@
 
 
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
-PASS d[3] == 255 is true
-PASS d[3] == 255 is true
-PASS d[3] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[3] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[3] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[3] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[3] is 255
+PASS d[3] is 255
+PASS d[3] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[3] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[3] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[3] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
-PASS d[3] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[3] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
-PASS d[3] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[3] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
-PASS d[3] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[3] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[3] == 255 is true
-PASS d[3] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[3] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[3] is 255
+PASS d[3] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[3] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
-PASS d[3] == 255 is true
-PASS d[3] == 255 is true
-PASS d[3] == 255 is true
-PASS d[3] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[3] is 255
+PASS d[3] is 255
+PASS d[3] is 255
+PASS d[3] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
-PASS d[3] == 255 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[3] is 255
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 PASS jsWrapperClass(bitmap) is 'ImageBitmap'
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 PASS successfullyParsed is true
 
 TEST COMPLETE
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-drawImage-video.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-drawImage-video.html
index 2f946e9..92beba4 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-drawImage-video.html
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-drawImage-video.html
@@ -27,16 +27,16 @@
 
 function shouldBeOpaque(x, y) {
     d = ctx.getImageData(x, y, 1, 1).data;
-    shouldBeTrue("d[3] == 255");
+    shouldBe("d[3]", "255");
 }
 
 function shouldBeClear(x, y) {
     // should be transparent black pixels
     d = ctx.getImageData(x, y, 1, 1).data;
-    shouldBeTrue("d[0] == 0");
-    shouldBeTrue("d[1] == 0");
-    shouldBeTrue("d[2] == 0");
-    shouldBeTrue("d[3] == 0");
+    shouldBe("d[0]", "0");
+    shouldBe("d[1]", "0");
+    shouldBe("d[2]", "0");
+    shouldBe("d[3]", "0");
 }
 
 function clearContext() {
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-drawImage.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-drawImage.html
index 5f2325f..db24904 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-drawImage.html
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-drawImage.html
@@ -32,43 +32,43 @@
 
 function shouldBeRed(x, y) {
     d = ctx.getImageData(x, y, 1, 1).data;
-    shouldBeTrue("d[0] == 255");
-    shouldBeTrue("d[1] == 0");
-    shouldBeTrue("d[2] == 0");
-    shouldBeTrue("d[3] == 255");
+    shouldBe("d[0]", "255");
+    shouldBe("d[1]", "0");
+    shouldBe("d[2]", "0");
+    shouldBe("d[3]", "255");
 }
 
 function shouldBeGreen(x, y) {
     d = ctx.getImageData(x, y, 1, 1).data;
-    shouldBeTrue("d[0] == 0");
-    shouldBeTrue("d[1] == 255");
-    shouldBeTrue("d[2] == 0");
-    shouldBeTrue("d[3] == 255");
+    shouldBe("d[0]", "0");
+    shouldBe("d[1]", "255");
+    shouldBe("d[2]", "0");
+    shouldBe("d[3]", "255");
 }
 
 function shouldBeBlue(x, y) {
     d = ctx.getImageData(x, y, 1, 1).data;
-    shouldBeTrue("d[0] == 0");
-    shouldBeTrue("d[1] == 0");
-    shouldBeTrue("d[2] == 255");
-    shouldBeTrue("d[3] == 255");
+    shouldBe("d[0]", "0");
+    shouldBe("d[1]", "0");
+    shouldBe("d[2]", "255");
+    shouldBe("d[3]", "255");
 }
 
 function shouldBeBlack(x, y) {
     d = ctx.getImageData(x, y, 1, 1).data;
-    shouldBeTrue("d[0] == 0");
-    shouldBeTrue("d[1] == 0");
-    shouldBeTrue("d[2] == 0");
-    shouldBeTrue("d[3] == 255");
+    shouldBe("d[0]", "0");
+    shouldBe("d[1]", "0");
+    shouldBe("d[2]", "0");
+    shouldBe("d[3]", "255");
 }
 
 function shouldBeClear(x, y) {
     // should be transparent black pixels
     d = ctx.getImageData(x, y, 1, 1).data;
-    shouldBeTrue("d[0] == 0");
-    shouldBeTrue("d[1] == 0");
-    shouldBeTrue("d[2] == 0");
-    shouldBeTrue("d[3] == 0");
+    shouldBe("d[0]", "0");
+    shouldBe("d[1]", "0");
+    shouldBe("d[2]", "0");
+    shouldBe("d[3]", "0");
 }
 
 function drawPattern(ctx) {
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-recursive-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-recursive-expected.txt
index 0b3eb7ce..8e40693 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-recursive-expected.txt
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-recursive-expected.txt
@@ -3,486 +3,486 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 255 is true
-PASS d[2] == 0 is true
-PASS d[3] == 255 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
-PASS d[0] == 0 is true
-PASS d[1] == 0 is true
-PASS d[2] == 0 is true
-PASS d[3] == 0 is true
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 255
+PASS d[2] is 0
+PASS d[3] is 255
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
+PASS d[0] is 0
+PASS d[1] is 0
+PASS d[2] is 0
+PASS d[3] is 0
 PASS successfullyParsed is true
 
 TEST COMPLETE
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-recursive.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-recursive.html
index 6bdc1cdf..db885b0 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-recursive.html
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-recursive.html
@@ -10,25 +10,25 @@
 
 function shouldBeFilled(x, y, w, h) {
     shouldBeGreen(x+2, y+2);
-    shouldBeGreen(x+w-2, y+h-2);
+    shouldBeGreen(x+w-3, y+h-3);
     shouldBeGreen(x+w/2, y+h/2);
     shouldBeClear(x-2, y-2);
     shouldBeClear(x+w+2, y+h+2);
 }
 function shouldBeGreen(x, y) {
     d = ctx.getImageData(x, y, 1, 1).data;
-    shouldBeTrue("d[0] == 0");
-    shouldBeTrue("d[1] == 255");
-    shouldBeTrue("d[2] == 0");
-    shouldBeTrue("d[3] == 255");
+    shouldBe("d[0]", "0");
+    shouldBe("d[1]", "255");
+    shouldBe("d[2]", "0");
+    shouldBe("d[3]", "255");
 }
 function shouldBeClear(x, y) {
     // should be transparent black pixels
     d = ctx.getImageData(x, y, 1, 1).data;
-    shouldBeTrue("d[0] == 0");
-    shouldBeTrue("d[1] == 0");
-    shouldBeTrue("d[2] == 0");
-    shouldBeTrue("d[3] == 0");
+    shouldBe("d[0]", "0");
+    shouldBe("d[1]", "0");
+    shouldBe("d[2]", "0");
+    shouldBe("d[3]", "0");
 }
 function shouldNotBeCalled() {
     testFailed("Promise was rejected.");
@@ -127,6 +127,7 @@
         shouldBeFilled(x3, y3, w3, h3);
 
         clearContext(ctx);
+        ctx.imageSmoothingEnabled=false;
         ctx.drawImage(imageBitmap, x1, y1, w1, h1, 0, 0, 50, 50);
         shouldBeFilled(0, 0, 50, 50);
     }
diff --git a/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/getComputedStyle-text-decoration-expected.txt b/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/getComputedStyle-text-decoration-expected.txt
index 057f842..d3f2abe 100644
--- a/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/getComputedStyle-text-decoration-expected.txt
+++ b/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/getComputedStyle-text-decoration-expected.txt
@@ -28,7 +28,7 @@
 PASS computedStyle.textDecoration is 'none solid rgb(0, 0, 0)'
 
 Value 'overline overline' (invalid):
-FAIL computedStyle.textDecoration should be none solid rgb(0, 0, 0). Was overline solid rgb(0, 0, 0).
+PASS computedStyle.textDecoration is 'none solid rgb(0, 0, 0)'
 
 Value 'underline blank' (invalid):
 PASS computedStyle.textDecoration is 'none solid rgb(0, 0, 0)'
diff --git a/third_party/WebKit/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-line-expected.html b/third_party/WebKit/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-line-expected.html
index 3c350de..f14d25a 100644
--- a/third_party/WebKit/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-line-expected.html
+++ b/third_party/WebKit/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-line-expected.html
@@ -25,5 +25,9 @@
     <div class="overline">This text is overlined.</div><br/>
     <div class="overline">This text is overlined.</div><br/>
     <div class="underline">This text is underlined.</div>
+    <div class="none">This text contains no decorations.</div><br/>
+    <div class="none">This text contains no decorations.</div><br/>
+    <div class="none">This text contains no decorations.</div><br/>
+    <div class="none">This text contains no decorations.</div><br/>
 </body>
 </html>
diff --git a/third_party/WebKit/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-line.html b/third_party/WebKit/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-line.html
index 766982c8..351b952 100644
--- a/third_party/WebKit/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-line.html
+++ b/third_party/WebKit/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-line.html
@@ -25,5 +25,9 @@
     <div style="text-decoration-line: underline; text-decoration: overline !important;">This text is overlined.</div><br/>
     <div style="text-decoration-line: underline !important; text-decoration: overline !important;">This text is overlined.</div><br/>
     <div style="text-decoration: overline !important; text-decoration-line: underline !important;">This text is underlined.</div>
+    <div style="text-decoration-line: blink blink;">This text contains no decorations.</div><br/>
+    <div style="text-decoration-line: blink underline blink;">This text contains no decorations.</div><br/>
+    <div style="text-decoration-line: blink underline overline blink;">This text contains no decorations.</div><br/>
+    <div style="text-decoration-line: blink underline overline line-through blink;">This text contains no decorations.</div><br/>
 </body>
 </html>
diff --git a/third_party/WebKit/LayoutTests/fast/events/pointerevents/mouse-pointer-event-properties-expected.txt b/third_party/WebKit/LayoutTests/fast/events/pointerevents/mouse-pointer-event-properties-expected.txt
index 3d93ee5..0ee5c09 100644
--- a/third_party/WebKit/LayoutTests/fast/events/pointerevents/mouse-pointer-event-properties-expected.txt
+++ b/third_party/WebKit/LayoutTests/fast/events/pointerevents/mouse-pointer-event-properties-expected.txt
@@ -1,13 +1,16 @@
-CONSOLE ERROR: line 63: Uncaught TypeError: Cannot read property 'type' of null
-CONSOLE ERROR: line 63: Uncaught TypeError: Cannot read property 'type' of null
-CONSOLE ERROR: line 63: Uncaught TypeError: Cannot read property 'type' of null
-CONSOLE ERROR: line 63: Uncaught TypeError: Cannot read property 'type' of null
-CONSOLE ERROR: line 63: Uncaught TypeError: Cannot read property 'type' of null
-CONSOLE ERROR: line 63: Uncaught TypeError: Cannot read property 'type' of null
-CONSOLE ERROR: line 63: Uncaught TypeError: Cannot read property 'type' of null
-CONSOLE ERROR: line 63: Uncaught TypeError: Cannot read property 'type' of null
-CONSOLE ERROR: line 63: Uncaught TypeError: Cannot read property 'type' of null
-CONSOLE ERROR: line 63: Uncaught TypeError: Cannot read property 'type' of null
+CONSOLE ERROR: line 62: Uncaught TypeError: Cannot read property 'type' of null
+CONSOLE ERROR: line 62: Uncaught TypeError: Cannot read property 'type' of null
+CONSOLE ERROR: line 62: Uncaught TypeError: Cannot read property 'type' of null
+CONSOLE ERROR: line 62: Uncaught TypeError: Cannot read property 'type' of null
+CONSOLE ERROR: line 62: Uncaught TypeError: Cannot read property 'type' of null
+CONSOLE ERROR: line 62: Uncaught TypeError: Cannot read property 'type' of null
+CONSOLE ERROR: line 62: Uncaught TypeError: Cannot read property 'type' of null
+CONSOLE ERROR: line 62: Uncaught TypeError: Cannot read property 'type' of null
+CONSOLE ERROR: line 62: Uncaught TypeError: Cannot read property 'type' of null
+CONSOLE ERROR: line 62: Uncaught TypeError: Cannot read property 'type' of null
+CONSOLE ERROR: line 62: Uncaught TypeError: Cannot read property 'type' of null
+CONSOLE ERROR: line 62: Uncaught TypeError: Cannot read property 'type' of null
+CONSOLE ERROR: line 62: Uncaught TypeError: Cannot read property 'type' of null
 Verifies that pointer event parameters are correct when fired for mouse events.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
@@ -20,6 +23,17 @@
 Received mouseenter
 FAIL lastPointerEvent should be non-null. Was null
 FAIL lastPointerEvent.type should be pointerenter. Threw exception TypeError: Cannot read property 'type' of null
+Received mousemove
+FAIL lastPointerEvent should be non-null. Was null
+FAIL lastPointerEvent.type should be pointermove. Threw exception TypeError: Cannot read property 'type' of null
+
+--- move within target ---
+Received mousemove
+FAIL lastPointerEvent should be non-null. Was null
+FAIL lastPointerEvent.type should be pointermove. Threw exception TypeError: Cannot read property 'type' of null
+Received mousemove
+FAIL lastPointerEvent should be non-null. Was null
+FAIL lastPointerEvent.type should be pointermove. Threw exception TypeError: Cannot read property 'type' of null
 
 --- click each button ---
 Received mousedown
diff --git a/third_party/WebKit/LayoutTests/fast/events/pointerevents/mouse-pointer-event-properties.html b/third_party/WebKit/LayoutTests/fast/events/pointerevents/mouse-pointer-event-properties.html
index 636837d..3d3f194 100644
--- a/third_party/WebKit/LayoutTests/fast/events/pointerevents/mouse-pointer-event-properties.html
+++ b/third_party/WebKit/LayoutTests/fast/events/pointerevents/mouse-pointer-event-properties.html
@@ -17,9 +17,8 @@
 <script>
 description("Verifies that pointer event parameters are correct when fired for mouse events.");
 
-// TODO(mustaq): Grow the list as we add support for more PEs
-var testEventList = ["mouseenter", "mouseleave", "mouseover", "mouseout", "mouseup", "mousedown",
-                   "pointerenter", "pointerleave", "pointerover", "pointerout", "pointerup", "pointerdown"];
+var testEventList = ["mouseenter", "mouseleave", "mouseover", "mouseout", "mouseup", "mousedown", "mousemove",
+                   "pointerenter", "pointerleave", "pointerover", "pointerout", "pointerup", "pointerdown", "pointermove"];
 var lastPointerEvent = null;
 
 var checkKeyModifiers = false;
@@ -102,6 +101,11 @@
   eventSender.mouseMoveTo(rect.left + 5, rect.top + 5);
   debug("");
 
+  debug("--- move within target ---");
+  eventSender.mouseMoveTo(rect.left + 7, rect.top + 15);
+  eventSender.mouseMoveTo(rect.left + 5, rect.top + 5);
+  debug("");
+
   debug("--- click each button ---");
   for (var button = 0; button <=2; button++) {
     eventSender.mouseDown(button);
diff --git a/third_party/WebKit/LayoutTests/fast/events/pointerevents/mouse-pointer-preventdefault-expected.txt b/third_party/WebKit/LayoutTests/fast/events/pointerevents/mouse-pointer-preventdefault-expected.txt
index 049a0d07..ab6db491 100644
--- a/third_party/WebKit/LayoutTests/fast/events/pointerevents/mouse-pointer-preventdefault-expected.txt
+++ b/third_party/WebKit/LayoutTests/fast/events/pointerevents/mouse-pointer-preventdefault-expected.txt
@@ -8,98 +8,128 @@
 - move into target & click -
 1. target received mouseover
 2. target received mouseenter
-3. target received mousedown
-4. target received mouseup
+3. target received mousemove
+4. target received mousedown
+5. target received mouseup
 - drag & release within target -
-5. target received mousedown
-6. target received mouseup
+6. target received mousedown
+7. target received mousemove
+8. target received mouseup
 - move outside target again -
-7. target received mouseout
-8. target received mouseleave
+9. target received mouseout
+10. target received mouseleave
 
 --- test with preventDefault on pointerdown ---
 - start with mouse outside target -
 - move into target & click -
 1. target received mouseover
 2. target received mouseenter
-3. target received mousedown
-4. target received mouseup
+3. target received mousemove
+4. target received mousedown
+5. target received mouseup
 - drag & release within target -
-5. target received mousedown
-6. target received mouseup
+6. target received mousedown
+7. target received mousemove
+8. target received mouseup
 - move outside target again -
-7. target received mouseout
-8. target received mouseleave
+9. target received mouseout
+10. target received mouseleave
 
 --- test with preventDefault on pointerup ---
 - start with mouse outside target -
 - move into target & click -
 1. target received mouseover
 2. target received mouseenter
-3. target received mousedown
-4. target received mouseup
+3. target received mousemove
+4. target received mousedown
+5. target received mouseup
 - drag & release within target -
-5. target received mousedown
-6. target received mouseup
+6. target received mousedown
+7. target received mousemove
+8. target received mouseup
 - move outside target again -
-7. target received mouseout
-8. target received mouseleave
+9. target received mouseout
+10. target received mouseleave
 
 --- test with preventDefault on pointerenter ---
 - start with mouse outside target -
 - move into target & click -
 1. target received mouseover
 2. target received mouseenter
-3. target received mousedown
-4. target received mouseup
+3. target received mousemove
+4. target received mousedown
+5. target received mouseup
 - drag & release within target -
-5. target received mousedown
-6. target received mouseup
+6. target received mousedown
+7. target received mousemove
+8. target received mouseup
 - move outside target again -
-7. target received mouseout
-8. target received mouseleave
+9. target received mouseout
+10. target received mouseleave
 
 --- test with preventDefault on pointerleave ---
 - start with mouse outside target -
 - move into target & click -
 1. target received mouseover
 2. target received mouseenter
-3. target received mousedown
-4. target received mouseup
+3. target received mousemove
+4. target received mousedown
+5. target received mouseup
 - drag & release within target -
-5. target received mousedown
-6. target received mouseup
+6. target received mousedown
+7. target received mousemove
+8. target received mouseup
 - move outside target again -
-7. target received mouseout
-8. target received mouseleave
+9. target received mouseout
+10. target received mouseleave
 
 --- test with preventDefault on pointerover ---
 - start with mouse outside target -
 - move into target & click -
 1. target received mouseover
 2. target received mouseenter
-3. target received mousedown
-4. target received mouseup
+3. target received mousemove
+4. target received mousedown
+5. target received mouseup
 - drag & release within target -
-5. target received mousedown
-6. target received mouseup
+6. target received mousedown
+7. target received mousemove
+8. target received mouseup
 - move outside target again -
-7. target received mouseout
-8. target received mouseleave
+9. target received mouseout
+10. target received mouseleave
 
 --- test with preventDefault on pointerout ---
 - start with mouse outside target -
 - move into target & click -
 1. target received mouseover
 2. target received mouseenter
-3. target received mousedown
-4. target received mouseup
+3. target received mousemove
+4. target received mousedown
+5. target received mouseup
 - drag & release within target -
-5. target received mousedown
-6. target received mouseup
+6. target received mousedown
+7. target received mousemove
+8. target received mouseup
 - move outside target again -
-7. target received mouseout
-8. target received mouseleave
+9. target received mouseout
+10. target received mouseleave
+
+--- test with preventDefault on pointermove ---
+- start with mouse outside target -
+- move into target & click -
+1. target received mouseover
+2. target received mouseenter
+3. target received mousemove
+4. target received mousedown
+5. target received mouseup
+- drag & release within target -
+6. target received mousedown
+7. target received mousemove
+8. target received mouseup
+- move outside target again -
+9. target received mouseout
+10. target received mouseleave
 
 PASS successfullyParsed is true
 
diff --git a/third_party/WebKit/LayoutTests/fast/events/pointerevents/mouse-pointer-preventdefault.html b/third_party/WebKit/LayoutTests/fast/events/pointerevents/mouse-pointer-preventdefault.html
index e54f501a..614d11a 100644
--- a/third_party/WebKit/LayoutTests/fast/events/pointerevents/mouse-pointer-preventdefault.html
+++ b/third_party/WebKit/LayoutTests/fast/events/pointerevents/mouse-pointer-preventdefault.html
@@ -16,9 +16,8 @@
 <script>
 description("Verifies the effect of pointer event prevent-default on following pointer & mouse events.");
 
-// TODO(mustaq): Grow the lists as we add support for more PEs.
-var mouseEventList = ["mousedown", "mouseup", "mouseenter", "mouseleave", "mouseover", "mouseout"];
-var pointerEventList = ["pointerdown", "pointerup", "pointerenter", "pointerleave", "pointerover", "pointerout"];
+var mouseEventList = ["mousedown", "mouseup", "mouseenter", "mouseleave", "mouseover", "mouseout", "mousemove"];
+var pointerEventList = ["pointerdown", "pointerup", "pointerenter", "pointerleave", "pointerover", "pointerout", "pointermove"];
 
 var preventDefaultList = ["none"].concat(pointerEventList);
 var eventToPreventDefault = "";
diff --git a/third_party/WebKit/LayoutTests/http/tests/preload/single_download_preload.html b/third_party/WebKit/LayoutTests/http/tests/preload/single_download_preload.html
new file mode 100644
index 0000000..f0267ae
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/preload/single_download_preload.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script>
+    var t = async_test('Makes sure that preloaded resources are not downloaded again when used');
+</script>
+<link rel=preload href="../resources/dummy.js" as=script>
+<link rel=preload href="../resources/dummy.css" as=stylesheet>
+<link rel=preload href="../resources/square.png" as=image>
+<link rel=preload href="../resources/square.png?background" as=image>
+<script src="../resources/slow-script.pl?delay=200"></script>
+<style>
+    #background {
+        width: 200px;
+        height: 200px;
+        background-image: url(../resources/square.png?background);
+    }
+</style>
+<link rel="stylesheet" href="../resources/dummy.css">
+<script src="../resources/dummy.js"></script>
+<div id="background"></div>
+<img src="../resources/square.png">
+<script>
+    window.addEventListener("load", t.step_func(function() {
+        assert_equals(performance.getEntriesByType("resource").length, 7);
+        t.done();
+    }));
+</script>
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/animation/animation-multiple-frames-expected.txt b/third_party/WebKit/LayoutTests/inspector-protocol/animation/animation-multiple-frames-expected.txt
index 0d0eec05..33009db22 100644
--- a/third_party/WebKit/LayoutTests/inspector-protocol/animation/animation-multiple-frames-expected.txt
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/animation/animation-multiple-frames-expected.txt
@@ -1,22 +1,22 @@
 
 Frame appended
-Animation created: start time is valid
+Animation started: start time is valid
 Frame appended
-Animation created: start time is valid
+Animation started: start time is valid
 Frame appended
-Animation created: start time is valid
+Animation started: start time is valid
 Frame appended
-Animation created: start time is valid
+Animation started: start time is valid
 Frame appended
-Animation created: start time is valid
+Animation started: start time is valid
 Frame appended
-Animation created: start time is valid
+Animation started: start time is valid
 Frame appended
-Animation created: start time is valid
+Animation started: start time is valid
 Frame appended
-Animation created: start time is valid
+Animation started: start time is valid
 Frame appended
-Animation created: start time is valid
+Animation started: start time is valid
 Frame appended
-Animation created: start time is valid
+Animation started: start time is valid
 
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/animation/animation-multiple-frames.html b/third_party/WebKit/LayoutTests/inspector-protocol/animation/animation-multiple-frames.html
index d125ef0..f8d49c9 100644
--- a/third_party/WebKit/LayoutTests/inspector-protocol/animation/animation-multiple-frames.html
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/animation/animation-multiple-frames.html
@@ -12,7 +12,7 @@
 
 function test()
 {
-    InspectorTest.eventHandler["Animation.animationCreated"] = onCreated;
+    InspectorTest.eventHandler["Animation.animationStarted"] = onStarted;
     InspectorTest.sendCommand("Animation.enable", {});
     InspectorTest.evaluateInPage("appendIframe()", frameAttached);
     var numberAnimationsCaptured = 0;
@@ -23,13 +23,15 @@
         InspectorTest.log("Frame appended");
     }
 
-    function onCreated(data)
+    function onStarted(data)
     {
-        var player = data.params.player;
+        var animation = data.params.animation;
 
-        if (!lastStartTime || player.startTime > lastStartTime)
-            InspectorTest.log("Animation created: start time is valid");
-        lastStartTime = player.startTime;
+        if (!lastStartTime || animation.startTime >= lastStartTime)
+            InspectorTest.log("Animation started: start time is valid");
+        else if (lastStartTime)
+            InspectorTest.log("Animation started: invalid startTime!" + animation.startTime + "." + lastStartTime);
+        lastStartTime = animation.startTime;
         numberAnimationsCaptured++;
 
         if (numberAnimationsCaptured < 10)
diff --git a/third_party/WebKit/LayoutTests/mhtml/multi_frames_contentid-expected.html b/third_party/WebKit/LayoutTests/mhtml/multi_frames_contentid-expected.html
new file mode 100644
index 0000000..f0fce4a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/mhtml/multi_frames_contentid-expected.html
@@ -0,0 +1,13 @@
+<html><head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+
+
+<title>A page that contains multiple nested frames</title>
+</head><body>
+This page contains several frames.<br>
+<iframe src="resources/frame_0.html"></iframe><br>
+<iframe src="resources/frame_1.html"></iframe><br>
+<iframe src="resources/frame_2.html"></iframe><br>
+And a red square:<br>
+<img src="resources/red_square.png">
+</body></html>
diff --git a/third_party/WebKit/LayoutTests/mhtml/multi_frames_contentid.mht b/third_party/WebKit/LayoutTests/mhtml/multi_frames_contentid.mht
new file mode 100644
index 0000000..5e5d2f4
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/mhtml/multi_frames_contentid.mht
@@ -0,0 +1,91 @@
+From: <Manually edited from multi_frames_unmht.mht>
+Subject: =?iso-2022-jp?B?QSBwYWdlIHRoYXQgY29udGFpbnMgbXVsdGlwbGUgbmVzdGVkIGZyYW1lcw==?=
+Date: Wed, May 18 2011 15:20:34 GMT-0700
+MIME-Version: 1.0
+Content-Type: multipart/related;
+	boundary="----=_NextPart_000_0000_58874EE0.2096A571";
+	type="text/html"
+
+------=_NextPart_000_0000_58874EE0.2096A571
+Content-Type: text/html; charset="ISO-8859-1"
+Content-Transfer-Encoding: quoted-printable
+Content-Location: http://localhost/top_frame.html
+
+<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; charset=
+=3Diso-8859-1">
+
+
+<title>A page that contains multiple nested frames</title>
+<base href=3D"http://localhost/"></base></head><body>
+This page contains several frames.<br>
+<iframe src=3D"cid:frame0@foo.bar"></iframe><br>
+<iframe src=3D"cid:frame1@foo.bar"></iframe><br>
+<iframe src=3D"cid:frame2@foo.bar"></iframe><br>
+And a red square:<br>
+<img src=3D"cid:redsquare@foo.bar">
+</body></html>
+------=_NextPart_000_0000_58874EE0.2096A571
+Content-Type: text/html; charset="ISO-8859-1"
+Content-Transfer-Encoding: quoted-printable
+Content-ID: <frame0@foo.bar>
+Content-Location: http://localhost/frame_0.html
+
+<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; charset=
+=3Diso-8859-1">
+
+<base href=3D"http://localhost/"></base></head><body>
+The first frame!
+</body></html>
+------=_NextPart_000_0000_58874EE0.2096A571
+Content-Type: text/html; charset="ISO-8859-1"
+Content-Transfer-Encoding: quoted-printable
+Content-ID: <frame1@foo.bar>
+Content-Location: http://localhost/frame_1.html
+
+<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; charset=
+=3Diso-8859-1">
+
+<base href=3D"http://localhost/"></base></head><body>
+The second frame!
+</body></html>
+------=_NextPart_000_0000_58874EE0.2096A571
+Content-Type: text/html; charset="ISO-8859-1"
+Content-Transfer-Encoding: quoted-printable
+Content-ID: <frame2@foo.bar>
+Content-Location: http://localhost/frame_2.html
+
+<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; charset=
+=3Diso-8859-1">
+
+<base href=3D"http://localhost/"></base></head><body>
+The third frame!<br>
+This one contains yet another frame. What a twist!<br>
+<iframe src=3D"cid:frame4@foo.bar"></iframe>
+
+
+</body></html>
+------=_NextPart_000_0000_58874EE0.2096A571
+Content-Type: text/html; charset="ISO-8859-1"
+Content-Transfer-Encoding: quoted-printable
+Content-ID: <frame4@foo.bar>
+Content-Location: http://localhost/frame_4.html
+
+<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; charset=
+=3Diso-8859-1">
+
+<base href=3D"http://localhost/"></base></head><body>
+This is frame 4!<br>
+<img src=3D"cid:redsquare@foo.bar">
+</body></html>
+------=_NextPart_000_0000_58874EE0.2096A571
+Content-Type: image/png
+Content-Transfer-Encoding: base64
+Content-ID: <redsquare@foo.bar>
+Content-Location: http://localhost/resources/red_square.png
+
+iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAAAXNSR0IArs4c6QAAAARnQU1BAACx
+jwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAACESURBVEhL7ZYxDoAwCEXB2LGTo46ewXj/zXgV
+PQKgexP/Ai6l889/6Stp4HtZjYKOiRCpEpfSEIYgJqxNMFTkFUjVXiZhT6qGirwCqdrLJOxJ1VCR
+V6A/1XxNc9jqQ6JkpjTU2rwQR+5c4769YCM5zn/BX4PY33Dljb0+JtiTqqEir8ADWEIY6dz7d1cA
+AAAASUVORK5CYII=
+------=_NextPart_000_0000_58874EE0.2096A571--
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/virtual/syncpaint/fast/repaint/float-overflow-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/virtual/syncpaint/fast/repaint/float-overflow-expected.txt
index baf25cd7..7f13ef2 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/virtual/syncpaint/fast/repaint/float-overflow-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/virtual/syncpaint/fast/repaint/float-overflow-expected.txt
@@ -32,8 +32,6 @@
         [63, 15, 54, 19],
         [63, 15, 42, 19],
         [63, 15, 16, 19],
-        [61, 459, 62, 22],
-        [61, 453, 62, 22],
         [61, 420, 62, 22],
         [61, 414, 62, 22],
         [61, 288, 58, 28],
@@ -65,9 +63,11 @@
         [59, 465, 40, 19],
         [59, 465, 16, 19],
         [59, 461, 16, 16],
+        [59, 459, 64, 25],
         [59, 459, 58, 19],
         [59, 459, 40, 19],
         [59, 459, 16, 19],
+        [59, 453, 64, 25],
         [59, 428, 16, 16],
         [59, 426, 40, 19],
         [59, 426, 16, 19],
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/virtual/syncpaint/fast/repaint/float-overflow-right-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/virtual/syncpaint/fast/repaint/float-overflow-right-expected.txt
index 365ed4b..a6b0c5f 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/virtual/syncpaint/fast/repaint/float-overflow-right-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/virtual/syncpaint/fast/repaint/float-overflow-right-expected.txt
@@ -140,8 +140,8 @@
         [677, 531, 64, 37],
         [677, 498, 64, 25],
         [677, 492, 64, 25],
-        [677, 459, 62, 22],
-        [677, 453, 62, 22],
+        [677, 459, 64, 25],
+        [677, 453, 64, 25],
         [677, 420, 62, 22],
         [677, 414, 62, 22],
         [677, 249, 64, 25],
diff --git a/third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/mouse-pointer-event-properties-expected.txt b/third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/mouse-pointer-event-properties-expected.txt
index ba96b6e..f122f17 100644
--- a/third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/mouse-pointer-event-properties-expected.txt
+++ b/third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/mouse-pointer-event-properties-expected.txt
@@ -54,6 +54,83 @@
 PASS lastPointerEvent.y is 31
 PASS lastPointerEvent.button is 0
 PASS lastPointerEvent.buttons is 0
+Received pointermove
+Received mousemove
+PASS lastPointerEvent is non-null.
+PASS lastPointerEvent.type is "pointermove"
+PASS lastPointerEvent.bubbles is true
+PASS lastPointerEvent.cancelable is true
+PASS lastPointerEvent.pointerId is 0
+PASS lastPointerEvent.pointerType is "mouse"
+PASS lastPointerEvent.isPrimary is true
+PASS lastPointerEvent.clientX is 23
+PASS lastPointerEvent.clientY is 31
+PASS lastPointerEvent.layerX is 23
+PASS lastPointerEvent.layerY is 31
+PASS lastPointerEvent.movementX is 0
+PASS lastPointerEvent.movementY is 0
+PASS lastPointerEvent.offsetX is 5
+PASS lastPointerEvent.offsetY is 5
+PASS lastPointerEvent.pageX is 23
+PASS lastPointerEvent.pageY is 31
+PASS lastPointerEvent.screenX is 23
+PASS lastPointerEvent.screenY is 31
+PASS lastPointerEvent.x is 23
+PASS lastPointerEvent.y is 31
+PASS lastPointerEvent.button is 0
+PASS lastPointerEvent.buttons is 0
+
+--- move within target ---
+Received pointermove
+Received mousemove
+PASS lastPointerEvent is non-null.
+PASS lastPointerEvent.type is "pointermove"
+PASS lastPointerEvent.bubbles is true
+PASS lastPointerEvent.cancelable is true
+PASS lastPointerEvent.pointerId is 0
+PASS lastPointerEvent.pointerType is "mouse"
+PASS lastPointerEvent.isPrimary is true
+PASS lastPointerEvent.clientX is 25
+PASS lastPointerEvent.clientY is 41
+PASS lastPointerEvent.layerX is 25
+PASS lastPointerEvent.layerY is 41
+PASS lastPointerEvent.movementX is 0
+PASS lastPointerEvent.movementY is 0
+PASS lastPointerEvent.offsetX is 7
+PASS lastPointerEvent.offsetY is 15
+PASS lastPointerEvent.pageX is 25
+PASS lastPointerEvent.pageY is 41
+PASS lastPointerEvent.screenX is 25
+PASS lastPointerEvent.screenY is 41
+PASS lastPointerEvent.x is 25
+PASS lastPointerEvent.y is 41
+PASS lastPointerEvent.button is 0
+PASS lastPointerEvent.buttons is 0
+Received pointermove
+Received mousemove
+PASS lastPointerEvent is non-null.
+PASS lastPointerEvent.type is "pointermove"
+PASS lastPointerEvent.bubbles is true
+PASS lastPointerEvent.cancelable is true
+PASS lastPointerEvent.pointerId is 0
+PASS lastPointerEvent.pointerType is "mouse"
+PASS lastPointerEvent.isPrimary is true
+PASS lastPointerEvent.clientX is 23
+PASS lastPointerEvent.clientY is 31
+PASS lastPointerEvent.layerX is 23
+PASS lastPointerEvent.layerY is 31
+PASS lastPointerEvent.movementX is 0
+PASS lastPointerEvent.movementY is 0
+PASS lastPointerEvent.offsetX is 5
+PASS lastPointerEvent.offsetY is 5
+PASS lastPointerEvent.pageX is 23
+PASS lastPointerEvent.pageY is 31
+PASS lastPointerEvent.screenX is 23
+PASS lastPointerEvent.screenY is 31
+PASS lastPointerEvent.x is 23
+PASS lastPointerEvent.y is 31
+PASS lastPointerEvent.button is 0
+PASS lastPointerEvent.buttons is 0
 
 --- click each button ---
 Received pointerdown
diff --git a/third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/mouse-pointer-preventdefault-expected.txt b/third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/mouse-pointer-preventdefault-expected.txt
index f3ac659..1671b3b9 100644
--- a/third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/mouse-pointer-preventdefault-expected.txt
+++ b/third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/mouse-pointer-preventdefault-expected.txt
@@ -10,20 +10,24 @@
 2. target received mouseover
 3. target received pointerenter
 4. target received mouseenter
-5. target received pointerdown
-6. target received mousedown
-7. target received pointerup
-8. target received mouseup
+5. target received pointermove
+6. target received mousemove
+7. target received pointerdown
+8. target received mousedown
+9. target received pointerup
+10. target received mouseup
 - drag & release within target -
-9. target received pointerdown
-10. target received mousedown
-11. target received pointerup
-12. target received mouseup
+11. target received pointerdown
+12. target received mousedown
+13. target received pointermove
+14. target received mousemove
+15. target received pointerup
+16. target received mouseup
 - move outside target again -
-13. target received pointerout
-14. target received mouseout
-15. target received pointerleave
-16. target received mouseleave
+17. target received pointerout
+18. target received mouseout
+19. target received pointerleave
+20. target received mouseleave
 
 --- test with preventDefault on pointerdown ---
 - start with mouse outside target -
@@ -32,16 +36,19 @@
 2. target received mouseover
 3. target received pointerenter
 4. target received mouseenter
-5. target received pointerdown, prevented default
-6. target received pointerup
-- drag & release within target -
+5. target received pointermove
+6. target received mousemove
 7. target received pointerdown, prevented default
 8. target received pointerup
+- drag & release within target -
+9. target received pointerdown, prevented default
+10. target received pointermove
+11. target received pointerup
 - move outside target again -
-9. target received pointerout
-10. target received mouseout
-11. target received pointerleave
-12. target received mouseleave
+12. target received pointerout
+13. target received mouseout
+14. target received pointerleave
+15. target received mouseleave
 
 --- test with preventDefault on pointerup ---
 - start with mouse outside target -
@@ -50,20 +57,24 @@
 2. target received mouseover
 3. target received pointerenter
 4. target received mouseenter
-5. target received pointerdown
-6. target received mousedown
-7. target received pointerup, prevented default
-8. target received mouseup
+5. target received pointermove
+6. target received mousemove
+7. target received pointerdown
+8. target received mousedown
+9. target received pointerup, prevented default
+10. target received mouseup
 - drag & release within target -
-9. target received pointerdown
-10. target received mousedown
-11. target received pointerup, prevented default
-12. target received mouseup
+11. target received pointerdown
+12. target received mousedown
+13. target received pointermove
+14. target received mousemove
+15. target received pointerup, prevented default
+16. target received mouseup
 - move outside target again -
-13. target received pointerout
-14. target received mouseout
-15. target received pointerleave
-16. target received mouseleave
+17. target received pointerout
+18. target received mouseout
+19. target received pointerleave
+20. target received mouseleave
 
 --- test with preventDefault on pointerenter ---
 - start with mouse outside target -
@@ -72,20 +83,24 @@
 2. target received mouseover
 3. target received pointerenter, prevented default
 4. target received mouseenter
-5. target received pointerdown
-6. target received mousedown
-7. target received pointerup
-8. target received mouseup
+5. target received pointermove
+6. target received mousemove
+7. target received pointerdown
+8. target received mousedown
+9. target received pointerup
+10. target received mouseup
 - drag & release within target -
-9. target received pointerdown
-10. target received mousedown
-11. target received pointerup
-12. target received mouseup
+11. target received pointerdown
+12. target received mousedown
+13. target received pointermove
+14. target received mousemove
+15. target received pointerup
+16. target received mouseup
 - move outside target again -
-13. target received pointerout
-14. target received mouseout
-15. target received pointerleave
-16. target received mouseleave
+17. target received pointerout
+18. target received mouseout
+19. target received pointerleave
+20. target received mouseleave
 
 --- test with preventDefault on pointerleave ---
 - start with mouse outside target -
@@ -94,20 +109,24 @@
 2. target received mouseover
 3. target received pointerenter
 4. target received mouseenter
-5. target received pointerdown
-6. target received mousedown
-7. target received pointerup
-8. target received mouseup
+5. target received pointermove
+6. target received mousemove
+7. target received pointerdown
+8. target received mousedown
+9. target received pointerup
+10. target received mouseup
 - drag & release within target -
-9. target received pointerdown
-10. target received mousedown
-11. target received pointerup
-12. target received mouseup
+11. target received pointerdown
+12. target received mousedown
+13. target received pointermove
+14. target received mousemove
+15. target received pointerup
+16. target received mouseup
 - move outside target again -
-13. target received pointerout
-14. target received mouseout
-15. target received pointerleave, prevented default
-16. target received mouseleave
+17. target received pointerout
+18. target received mouseout
+19. target received pointerleave, prevented default
+20. target received mouseleave
 
 --- test with preventDefault on pointerover ---
 - start with mouse outside target -
@@ -116,20 +135,24 @@
 2. target received mouseover
 3. target received pointerenter
 4. target received mouseenter
-5. target received pointerdown
-6. target received mousedown
-7. target received pointerup
-8. target received mouseup
+5. target received pointermove
+6. target received mousemove
+7. target received pointerdown
+8. target received mousedown
+9. target received pointerup
+10. target received mouseup
 - drag & release within target -
-9. target received pointerdown
-10. target received mousedown
-11. target received pointerup
-12. target received mouseup
+11. target received pointerdown
+12. target received mousedown
+13. target received pointermove
+14. target received mousemove
+15. target received pointerup
+16. target received mouseup
 - move outside target again -
-13. target received pointerout
-14. target received mouseout
-15. target received pointerleave
-16. target received mouseleave
+17. target received pointerout
+18. target received mouseout
+19. target received pointerleave
+20. target received mouseleave
 
 --- test with preventDefault on pointerout ---
 - start with mouse outside target -
@@ -138,20 +161,50 @@
 2. target received mouseover
 3. target received pointerenter
 4. target received mouseenter
-5. target received pointerdown
-6. target received mousedown
-7. target received pointerup
-8. target received mouseup
+5. target received pointermove
+6. target received mousemove
+7. target received pointerdown
+8. target received mousedown
+9. target received pointerup
+10. target received mouseup
 - drag & release within target -
-9. target received pointerdown
-10. target received mousedown
-11. target received pointerup
-12. target received mouseup
+11. target received pointerdown
+12. target received mousedown
+13. target received pointermove
+14. target received mousemove
+15. target received pointerup
+16. target received mouseup
 - move outside target again -
-13. target received pointerout, prevented default
-14. target received mouseout
-15. target received pointerleave
-16. target received mouseleave
+17. target received pointerout, prevented default
+18. target received mouseout
+19. target received pointerleave
+20. target received mouseleave
+
+--- test with preventDefault on pointermove ---
+- start with mouse outside target -
+- move into target & click -
+1. target received pointerover
+2. target received mouseover
+3. target received pointerenter
+4. target received mouseenter
+5. target received pointermove, prevented default
+6. target received mousemove
+7. target received pointerdown
+8. target received mousedown
+9. target received pointerup
+10. target received mouseup
+- drag & release within target -
+11. target received pointerdown
+12. target received mousedown
+13. target received pointermove, prevented default
+14. target received mousemove
+15. target received pointerup
+16. target received mouseup
+- move outside target again -
+17. target received pointerout
+18. target received mouseout
+19. target received pointerleave
+20. target received mouseleave
 
 PASS successfullyParsed is true
 
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
index 171269f..304d82f 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -1483,7 +1483,25 @@
         }
         list->append(filterValue.release());
     } while (!range.atEnd());
+    return list.release();
+}
 
+static PassRefPtrWillBeRawPtr<CSSValue> consumeTextDecorationLine(CSSParserTokenRange& range)
+{
+    CSSValueID id = range.peek().id();
+    if (id == CSSValueNone)
+        return consumeIdent(range);
+
+    RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> ident;
+    while ((ident = consumeIdent<CSSValueBlink, CSSValueUnderline, CSSValueOverline, CSSValueLineThrough>(range))) {
+        if (list->hasValue(ident.get()))
+            return nullptr;
+        list->append(ident.release());
+    }
+
+    if (!list->length())
+        return nullptr;
     return list.release();
 }
 
@@ -1584,6 +1602,9 @@
     case CSSPropertyOrphans:
     case CSSPropertyWidows:
         return consumeWidowsOrOrphans(m_range);
+    case CSSPropertyTextDecorationColor:
+        ASSERT(RuntimeEnabledFeatures::css3TextDecorationsEnabled());
+        return consumeColor(m_range, m_context);
     case CSSPropertyWebkitTextFillColor:
     case CSSPropertyWebkitTapHighlightColor:
         return consumeColor(m_range, m_context);
@@ -1597,6 +1618,9 @@
     case CSSPropertyWebkitFilter:
     case CSSPropertyBackdropFilter:
         return consumeFilter(m_range, m_context);
+    case CSSPropertyWebkitTextDecorationsInEffect:
+    case CSSPropertyTextDecorationLine:
+        return consumeTextDecorationLine(m_range);
     default:
         return nullptr;
     }
@@ -1959,6 +1983,40 @@
     return true;
 }
 
+bool CSSPropertyParser::consumeShorthandGreedily(const StylePropertyShorthand& shorthand, bool important)
+{
+    ASSERT(shorthand.length() <= 6); // Existing shorthands have at most 6 longhands.
+    RefPtrWillBeRawPtr<CSSValue> longhands[6] = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr };
+    const CSSPropertyID* shorthandProperties = shorthand.properties();
+    do {
+        bool foundLonghand = false;
+        for (size_t i = 0; !foundLonghand && i < shorthand.length(); ++i) {
+            if (longhands[i])
+                continue;
+            // TODO: parseSingleValue needs to handle fastpath keywords.
+            if (CSSParserFastPaths::isKeywordPropertyID(shorthandProperties[i])) {
+                if (CSSParserFastPaths::isValidKeywordPropertyAndValue(shorthandProperties[i], m_range.peek().id()))
+                    longhands[i] = consumeIdent(m_range);
+            } else {
+                longhands[i] = parseSingleValue(shorthandProperties[i]);
+            }
+            if (longhands[i])
+                foundLonghand = true;
+        }
+        if (!foundLonghand)
+            return false;
+    } while (!m_range.atEnd());
+
+    ImplicitScope implicitScope(this);
+    for (size_t i = 0; i < shorthand.length(); ++i) {
+        if (longhands[i])
+            addProperty(shorthandProperties[i], longhands[i].release(), important);
+        else
+            addProperty(shorthandProperties[i], cssValuePool().createImplicitInitialValue(), important);
+    }
+    return true;
+}
+
 bool CSSPropertyParser::parseShorthand(CSSPropertyID unresolvedProperty, bool important)
 {
     CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty);
@@ -2023,6 +2081,17 @@
         return consumeAnimationShorthand(animationShorthandForParsing(), unresolvedProperty == CSSPropertyAliasWebkitAnimation, important);
     case CSSPropertyTransition:
         return consumeAnimationShorthand(transitionShorthandForParsing(), false, important);
+    case CSSPropertyTextDecoration: {
+        // Fall through 'text-decoration-line' parsing if CSS 3 Text Decoration
+        // is disabled to match CSS 2.1 rules for parsing 'text-decoration'.
+        if (RuntimeEnabledFeatures::css3TextDecorationsEnabled())
+            return consumeShorthandGreedily(textDecorationShorthand(), important);
+        RefPtrWillBeRawPtr<CSSValue> textDecoration = consumeTextDecorationLine(m_range);
+        if (!textDecoration || !m_range.atEnd())
+            return false;
+        addProperty(CSSPropertyTextDecoration, textDecoration.release(), important);
+        return true;
+    }
     default:
         m_currentShorthand = oldShorthand;
         return false;
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.h b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.h
index 163ad68..5d4bd3e 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.h
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.h
@@ -114,6 +114,7 @@
 
     bool parseShorthand(CSSPropertyID, const StylePropertyShorthand&, bool important);
     bool parseShorthand(CSSPropertyID, bool important);
+    bool consumeShorthandGreedily(const StylePropertyShorthand&, bool important);
     bool parse4Values(CSSPropertyID, const CSSPropertyID* properties, bool important);
     PassRefPtrWillBeRawPtr<CSSValueList> parseContent();
 
@@ -240,8 +241,6 @@
 
     PassRefPtrWillBeRawPtr<CSSValue> parseTextEmphasisStyle();
 
-    PassRefPtrWillBeRawPtr<CSSValue> parseTextDecoration();
-
     bool parseCalculation(CSSParserValue*, ValueRange);
 
     bool parseGeneratedImage(CSSParserValueList*, RefPtrWillBeRawPtr<CSSValue>&);
diff --git a/third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp
index e9c3543..996a5a7 100644
--- a/third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp
@@ -437,11 +437,9 @@
     case CSSPropertyWebkitBorderEndColor:
     case CSSPropertyWebkitBorderBeforeColor:
     case CSSPropertyWebkitBorderAfterColor:
-    case CSSPropertyTextDecorationColor: // CSS3 text decoration colors
     case CSSPropertyWebkitColumnRuleColor:
     case CSSPropertyWebkitTextEmphasisColor:
     case CSSPropertyWebkitTextStrokeColor:
-        ASSERT(propId != CSSPropertyTextDecorationColor || RuntimeEnabledFeatures::css3TextDecorationsEnabled());
         parsedValue = parseColor(m_valueList->current(), acceptQuirkyColors(propId));
         if (parsedValue)
             m_valueList->next();
@@ -666,19 +664,6 @@
             validPrimitive = validUnit(value, FLength | FPercent | unitless);
         break;
 
-    case CSSPropertyTextDecoration:
-        // Fall through 'text-decoration-line' parsing if CSS 3 Text Decoration
-        // is disabled to match CSS 2.1 rules for parsing 'text-decoration'.
-        if (RuntimeEnabledFeatures::css3TextDecorationsEnabled()) {
-            // [ <text-decoration-line> || <text-decoration-style> || <text-decoration-color> ] | inherit
-            return parseShorthand(CSSPropertyTextDecoration, textDecorationShorthand(), important);
-        }
-    case CSSPropertyWebkitTextDecorationsInEffect:
-    case CSSPropertyTextDecorationLine:
-        // none | [ underline || overline || line-through || blink ] | inherit
-        parsedValue = parseTextDecoration();
-        break;
-
     case CSSPropertyTextUnderlinePosition:
         // auto | [ under || [ left | right ] ], but we only support auto | under for now
         ASSERT(RuntimeEnabledFeatures::css3TextDecorationsEnabled());
@@ -1221,6 +1206,10 @@
     case CSSPropertyBoxShadow:
     case CSSPropertyWebkitFilter:
     case CSSPropertyBackdropFilter:
+    case CSSPropertyTextDecorationColor:
+    case CSSPropertyWebkitTextDecorationsInEffect:
+    case CSSPropertyTextDecorationLine:
+    case CSSPropertyTextDecoration:
         validPrimitive = false;
         break;
 
@@ -5404,39 +5393,6 @@
     return list.release();
 }
 
-PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseTextDecoration()
-{
-    CSSParserValue* value = m_valueList->current();
-    if (value && value->id == CSSValueNone) {
-        m_valueList->next();
-        return cssValuePool().createIdentifierValue(CSSValueNone);
-    }
-
-    RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
-    bool isValid = true;
-    while (isValid && value) {
-        switch (value->id) {
-        case CSSValueUnderline:
-        case CSSValueOverline:
-        case CSSValueLineThrough:
-        case CSSValueBlink:
-            // TODO(timloh): This will incorrectly accept "blink blink"
-            list->append(cssValuePool().createIdentifierValue(value->id));
-            break;
-        default:
-            isValid = false;
-            break;
-        }
-        if (isValid)
-            value = m_valueList->next();
-    }
-
-    // Values are either valid or in shorthand scope.
-    if (list->length())
-        return list.release();
-    return nullptr;
-}
-
 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseTextEmphasisStyle()
 {
     RefPtrWillBeRawPtr<CSSPrimitiveValue> fill = nullptr;
diff --git a/third_party/WebKit/Source/core/fetch/ResourceFetcher.h b/third_party/WebKit/Source/core/fetch/ResourceFetcher.h
index 56c8488..893c17f 100644
--- a/third_party/WebKit/Source/core/fetch/ResourceFetcher.h
+++ b/third_party/WebKit/Source/core/fetch/ResourceFetcher.h
@@ -150,6 +150,9 @@
 
     void updateAllImageResourcePriorities();
 
+    // This is only exposed for testing purposes.
+    WillBeHeapListHashSet<RawPtrWillBeMember<Resource>>* preloads() { return m_preloads.get(); }
+
 private:
     friend class ResourceCacheValidationSuppressor;
 
diff --git a/third_party/WebKit/Source/core/frame/ImageBitmap.cpp b/third_party/WebKit/Source/core/frame/ImageBitmap.cpp
index bb45b3f..7e5b822 100644
--- a/third_party/WebKit/Source/core/frame/ImageBitmap.cpp
+++ b/third_party/WebKit/Source/core/frame/ImageBitmap.cpp
@@ -13,6 +13,8 @@
 #include "platform/graphics/StaticBitmapImage.h"
 #include "platform/graphics/paint/DrawingRecorder.h"
 #include "platform/graphics/paint/SkPictureBuilder.h"
+#include "third_party/skia/include/core/SkScalar.h"
+#include "third_party/skia/include/core/SkSurface.h"
 #include "wtf/RefPtr.h"
 
 namespace blink {
@@ -25,124 +27,68 @@
         std::max(rect.height(), -rect.height()));
 }
 
-static inline PassRefPtr<Image> cropImage(PassRefPtr<Image> image, const IntRect& cropRect)
-{
-    ASSERT(image);
-
-    const SkIRect srcRect = intersection(image->rect(), cropRect);
-    if (srcRect.isEmpty())
-        return nullptr;
-
-    RefPtr<SkImage> skImage = image->imageForCurrentFrame();
-    if (!skImage)
-        return nullptr;
-
-    return StaticBitmapImage::create(adoptRef(skImage->newSubset(srcRect)));
-}
-
 ImageBitmap::ImageBitmap(HTMLImageElement* image, const IntRect& cropRect)
-    : m_imageElement(image)
-    , m_bitmap(nullptr)
-    , m_cropRect(cropRect)
 {
-    IntRect srcRect = intersection(cropRect, IntRect(0, 0, image->width(), image->height()));
-    m_bitmapRect = IntRect(IntPoint(std::max(0, -cropRect.x()), std::max(0, -cropRect.y())), srcRect.size());
-    m_bitmapOffset = srcRect.location();
-
-    if (!srcRect.width() || !srcRect.height())
-        m_imageElement = nullptr;
-    else
-        m_imageElement->addClient(this);
+    m_image = cropImage(image->cachedImage()->image()->imageForCurrentFrame(), cropRect);
 }
 
 ImageBitmap::ImageBitmap(HTMLVideoElement* video, const IntRect& cropRect)
-    : m_imageElement(nullptr)
-    , m_cropRect(cropRect)
-    , m_bitmapOffset(IntPoint())
 {
     IntSize playerSize;
-
     if (video->webMediaPlayer())
         playerSize = video->webMediaPlayer()->naturalSize();
 
     IntRect videoRect = IntRect(IntPoint(), playerSize);
     IntRect srcRect = intersection(cropRect, videoRect);
-    IntRect dstRect(IntPoint(), srcRect.size());
-
-    OwnPtr<ImageBuffer> buffer = ImageBuffer::create(videoRect.size());
+    OwnPtr<ImageBuffer> buffer = ImageBuffer::create(cropRect.size(), NonOpaque, DoNotInitializeImagePixels);
     if (!buffer)
         return;
 
-    buffer->canvas()->clipRect(dstRect);
-    buffer->canvas()->translate(-srcRect.x(), -srcRect.y());
-
-    video->paintCurrentFrame(buffer->canvas(), videoRect, nullptr);
-    m_bitmap = buffer->newImageSnapshot();
-    m_bitmapRect = IntRect(IntPoint(std::max(0, -cropRect.x()), std::max(0, -cropRect.y())), srcRect.size());
+    IntPoint dstPoint = IntPoint(std::max(0, -cropRect.x()), std::max(0, -cropRect.y()));
+    video->paintCurrentFrame(buffer->canvas(), IntRect(dstPoint, srcRect.size()), nullptr);
+    m_image = buffer->newSkImageSnapshot(PreferNoAcceleration);
 }
 
 ImageBitmap::ImageBitmap(HTMLCanvasElement* canvas, const IntRect& cropRect)
-    : m_imageElement(nullptr)
-    , m_cropRect(cropRect)
-    , m_bitmapOffset(IntPoint())
 {
-    IntRect srcRect = intersection(cropRect, IntRect(IntPoint(), canvas->size()));
-    m_bitmapRect = IntRect(IntPoint(std::max(0, -cropRect.x()), std::max(0, -cropRect.y())), srcRect.size());
     ASSERT(canvas->isPaintable());
-    m_bitmap = cropImage(canvas->copiedImage(BackBuffer, PreferAcceleration), cropRect);
+    m_image = cropImage(canvas->copiedImage(BackBuffer, PreferAcceleration)->imageForCurrentFrame(), cropRect);
 }
 
 ImageBitmap::ImageBitmap(ImageData* data, const IntRect& cropRect)
-    : m_imageElement(nullptr)
-    , m_cropRect(cropRect)
-    , m_bitmapOffset(IntPoint())
 {
     IntRect srcRect = intersection(cropRect, IntRect(IntPoint(), data->size()));
-    OwnPtr<ImageBuffer> buffer = ImageBuffer::create(data->size(), NonOpaque, DoNotInitializeImagePixels);
+
+    OwnPtr<ImageBuffer> buffer = ImageBuffer::create(cropRect.size(), NonOpaque, DoNotInitializeImagePixels);
     if (!buffer)
         return;
 
-    if (srcRect.width() > 0 && srcRect.height() > 0)
-        buffer->putByteArray(Unmultiplied, data->data()->data(), data->size(), srcRect, IntPoint(std::min(0, -cropRect.x()), std::min(0, -cropRect.y())));
+    if (srcRect.isEmpty()) {
+        m_image = buffer->newSkImageSnapshot(PreferNoAcceleration);
+        return;
+    }
 
-    m_bitmap = buffer->newImageSnapshot();
-    m_bitmapRect = IntRect(IntPoint(std::max(0, -cropRect.x()), std::max(0, -cropRect.y())),  srcRect.size());
+    IntPoint dstPoint = IntPoint(std::min(0, -cropRect.x()), std::min(0, -cropRect.y()));
+    if (cropRect.x() < 0)
+        dstPoint.setX(-cropRect.x());
+    if (cropRect.y() < 0)
+        dstPoint.setY(-cropRect.y());
+    buffer->putByteArray(Unmultiplied, data->data()->data(), data->size(), srcRect, dstPoint);
+    m_image = buffer->newSkImageSnapshot(PreferNoAcceleration);
 }
 
 ImageBitmap::ImageBitmap(ImageBitmap* bitmap, const IntRect& cropRect)
-    : m_imageElement(bitmap->imageElement())
-    , m_bitmap(nullptr)
-    , m_cropRect(cropRect)
-    , m_bitmapOffset(IntPoint())
 {
-    IntRect oldBitmapRect = bitmap->bitmapRect();
-    IntRect srcRect = intersection(cropRect, oldBitmapRect);
-    m_bitmapRect = IntRect(IntPoint(std::max(0, oldBitmapRect.x() - cropRect.x()), std::max(0, oldBitmapRect.y() - cropRect.y())), srcRect.size());
-
-    if (m_imageElement) {
-        m_imageElement->addClient(this);
-        m_bitmapOffset = srcRect.location();
-    } else if (bitmap->bitmapImage()) {
-        IntRect adjustedCropRect(IntPoint(cropRect.x() -oldBitmapRect.x(), cropRect.y() - oldBitmapRect.y()), cropRect.size());
-        m_bitmap = cropImage(bitmap->bitmapImage(), adjustedCropRect);
-    }
+    m_image = cropImage(bitmap->skImage(), cropRect);
 }
 
 ImageBitmap::ImageBitmap(Image* image, const IntRect& cropRect)
-    : m_imageElement(nullptr)
-    , m_cropRect(cropRect)
 {
-    IntRect srcRect = intersection(cropRect, image->rect());
-    m_bitmap = cropImage(image, cropRect);
-    m_bitmapRect = IntRect(IntPoint(std::max(0, -cropRect.x()), std::max(0, -cropRect.y())),  srcRect.size());
+    m_image = cropImage(image->imageForCurrentFrame(), cropRect);
 }
 
 ImageBitmap::~ImageBitmap()
 {
-#if !ENABLE(OILPAN)
-    if (m_imageElement)
-        m_imageElement->removeClient(this);
-#endif
 }
 
 PassRefPtrWillBeRawPtr<ImageBitmap> ImageBitmap::create(HTMLImageElement* image, const IntRect& cropRect)
@@ -181,38 +127,44 @@
     return adoptRefWillBeNoop(new ImageBitmap(image, normalizedCropRect));
 }
 
-void ImageBitmap::notifyImageSourceChanged()
+PassRefPtr<SkImage> ImageBitmap::cropImage(PassRefPtr<SkImage> image, const IntRect& cropRect)
 {
-    m_bitmap = cropImage(m_imageElement->cachedImage()->image(), m_cropRect);
-    m_bitmapOffset = IntPoint();
-    m_imageElement = nullptr;
+    ASSERT(image);
+
+    IntRect imgRect = IntRect(IntPoint(), IntSize(image->width(), image->height()));
+    const IntRect srcRect = intersection(imgRect, cropRect);
+
+    if (cropRect == srcRect)
+        return adoptRef(image->newSubset(srcRect));
+
+    RefPtr<SkSurface> surface = adoptRef(SkSurface::NewRasterN32Premul(cropRect.width(), cropRect.height()));
+
+    if (srcRect.isEmpty())
+        return adoptRef(surface->newImageSnapshot());
+
+    SkScalar dstLeft = std::min(0, -cropRect.x());
+    SkScalar dstTop = std::min(0, -cropRect.y());
+    if (cropRect.x() < 0)
+        dstLeft = -cropRect.x();
+    if (cropRect.y() < 0)
+        dstTop = -cropRect.y();
+    surface->getCanvas()->drawImage(image.get(), dstLeft, dstTop);
+    return adoptRef(surface->newImageSnapshot());
 }
 
-PassRefPtr<Image> ImageBitmap::bitmapImage() const
+void ImageBitmap::notifyImageSourceChanged()
 {
-    ASSERT((m_imageElement || m_bitmap || !m_bitmapRect.width() || !m_bitmapRect.height()) && (!m_imageElement || !m_bitmap));
-    if (m_imageElement)
-        return m_imageElement->cachedImage()->image();
-    return m_bitmap;
 }
 
 PassRefPtr<Image> ImageBitmap::getSourceImageForCanvas(SourceImageStatus* status, AccelerationHint) const
 {
     *status = NormalSourceImageStatus;
-    return bitmapImage();
+    return m_image ? StaticBitmapImage::create(m_image) : nullptr;
 }
 
 void ImageBitmap::adjustDrawRects(FloatRect* srcRect, FloatRect* dstRect) const
 {
-    FloatRect intersectRect = intersection(m_bitmapRect, *srcRect);
-    FloatRect newSrcRect = intersectRect;
-    newSrcRect.move(m_bitmapOffset - m_bitmapRect.location());
-    FloatRect newDstRect(FloatPoint(intersectRect.location() - srcRect->location()), m_bitmapRect.size());
-    newDstRect.scale(dstRect->width() / srcRect->width() * intersectRect.width() / m_bitmapRect.width(),
-        dstRect->height() / srcRect->height() * intersectRect.height() / m_bitmapRect.height());
-    newDstRect.moveBy(dstRect->location());
-    *srcRect = newSrcRect;
-    *dstRect = newDstRect;
+
 }
 
 FloatSize ImageBitmap::elementSize() const
@@ -222,7 +174,6 @@
 
 DEFINE_TRACE(ImageBitmap)
 {
-    visitor->trace(m_imageElement);
     ImageLoaderClient::trace(visitor);
 }
 
diff --git a/third_party/WebKit/Source/core/frame/ImageBitmap.h b/third_party/WebKit/Source/core/frame/ImageBitmap.h
index 8dc3a51..71fd4a52 100644
--- a/third_party/WebKit/Source/core/frame/ImageBitmap.h
+++ b/third_party/WebKit/Source/core/frame/ImageBitmap.h
@@ -11,7 +11,9 @@
 #include "core/html/canvas/CanvasImageSource.h"
 #include "platform/geometry/IntRect.h"
 #include "platform/graphics/Image.h"
+#include "platform/graphics/ImageBuffer.h"
 #include "platform/heap/Handle.h"
+#include "third_party/skia/include/core/SkImage.h"
 #include "wtf/PassRefPtr.h"
 #include "wtf/RefCounted.h"
 
@@ -32,14 +34,10 @@
     static PassRefPtrWillBeRawPtr<ImageBitmap> create(ImageBitmap*, const IntRect&);
     static PassRefPtrWillBeRawPtr<ImageBitmap> create(Image*, const IntRect&);
 
-    PassRefPtr<Image> bitmapImage() const;
-    PassRefPtrWillBeRawPtr<HTMLImageElement> imageElement() const { return m_imageElement; }
-
-    IntRect bitmapRect() const { return m_bitmapRect; }
-
-    int width() const { return m_cropRect.width(); }
-    int height() const { return m_cropRect.height(); }
-    IntSize size() const { return m_cropRect.size(); }
+    SkImage* skImage() const { return (m_image) ? m_image.get() : nullptr; }
+    int width() const { return (m_image) ? m_image->width(): 0; }
+    int height() const { return (m_image) ? m_image->height(): 0; }
+    IntSize size() const { return (m_image) ? IntSize(m_image->width(), m_image->height()) : IntSize(); }
 
     ~ImageBitmap() override;
 
@@ -59,23 +57,13 @@
     ImageBitmap(ImageBitmap*, const IntRect&);
     ImageBitmap(Image*, const IntRect&);
 
+    PassRefPtr<SkImage> cropImage(PassRefPtr<SkImage>, const IntRect&);
+
     // ImageLoaderClient
     void notifyImageSourceChanged() override;
     bool requestsHighLiveResourceCachePriority() override { return true; }
 
-    // ImageBitmaps constructed from HTMLImageElements hold a reference to the HTMLImageElement until
-    // the image source changes.
-    RefPtrWillBeMember<HTMLImageElement> m_imageElement;
-    RefPtr<Image> m_bitmap;
-
-    IntRect m_bitmapRect; // The rect where the underlying Image should be placed in reference to the ImageBitmap.
-    IntRect m_cropRect;
-
-    // The offset by which the desired Image is stored internally.
-    // ImageBitmaps constructed from HTMLImageElements reference the entire ImageResource and may have a non-zero bitmap offset.
-    // ImageBitmaps not constructed from HTMLImageElements always pre-crop and store the image at (0, 0).
-    IntPoint m_bitmapOffset;
-
+    RefPtr<SkImage> m_image;
 };
 
 } // namespace blink
diff --git a/third_party/WebKit/Source/core/frame/ImageBitmapTest.cpp b/third_party/WebKit/Source/core/frame/ImageBitmapTest.cpp
index 0aa638f8..bae0e24 100644
--- a/third_party/WebKit/Source/core/frame/ImageBitmapTest.cpp
+++ b/third_party/WebKit/Source/core/frame/ImageBitmapTest.cpp
@@ -81,8 +81,6 @@
     Persistent<MemoryCache> m_globalMemoryCache;
 };
 
-// Verifies that the image resource held by an ImageBitmap is the same as the
-// one held by the HTMLImageElement.
 TEST_F(ImageBitmapTest, ImageResourceConsistency)
 {
     RefPtrWillBeRawPtr<HTMLImageElement> imageElement = HTMLImageElement::create(*Document::create().get());
@@ -97,12 +95,14 @@
     RefPtrWillBeRawPtr<ImageBitmap> imageBitmapOutsideCrop = ImageBitmap::create(imageElement.get(),
         IntRect(-m_image->width(), -m_image->height(), m_image->width(), m_image->height()));
 
-    ASSERT_EQ(imageBitmapNoCrop->bitmapImage().get(), imageElement->cachedImage()->image());
-    ASSERT_EQ(imageBitmapInteriorCrop->bitmapImage().get(), imageElement->cachedImage()->image());
-    ASSERT_EQ(imageBitmapExteriorCrop->bitmapImage().get(), imageElement->cachedImage()->image());
+    // Now that we use SkImage::newSubset() to crop the image, the ImageBitmap::skImage() is not necessary the same
+    // as the source imageElement. See SkImage::newSubset() for details.
+    ASSERT_EQ(imageBitmapNoCrop->skImage(), imageElement->cachedImage()->image()->imageForCurrentFrame().get());
+    ASSERT_NE(imageBitmapInteriorCrop->skImage(), imageElement->cachedImage()->image()->imageForCurrentFrame().get());
+    ASSERT_NE(imageBitmapExteriorCrop->skImage(), imageElement->cachedImage()->image()->imageForCurrentFrame().get());
 
-    RefPtr<Image> emptyImage = imageBitmapOutsideCrop->bitmapImage();
-    ASSERT_NE(emptyImage.get(), imageElement->cachedImage()->image());
+    SkImage* emptyImage = imageBitmapOutsideCrop->skImage();
+    ASSERT_NE(emptyImage, imageElement->cachedImage()->image()->imageForCurrentFrame());
 }
 
 // Verifies that HTMLImageElements are given an elevated CacheLiveResourcePriority when used to construct an ImageBitmap.
@@ -161,10 +161,10 @@
         RefPtrWillBePersistent<ImageBitmap> imageBitmapOutsideCrop = ImageBitmap::create(imageOutsideCrop.get(),
             IntRect(-m_image->width(), -m_image->height(), m_image->width(), m_image->height()));
 
-        // Images that are referenced by ImageBitmaps have CacheLiveResourcePriorityHigh.
-        ASSERT_EQ(memoryCache()->priority(imageNoCrop->cachedImage()), MemoryCacheLiveResourcePriorityHigh);
-        ASSERT_EQ(memoryCache()->priority(imageInteriorCrop->cachedImage()), MemoryCacheLiveResourcePriorityHigh);
-        ASSERT_EQ(memoryCache()->priority(imageExteriorCrop->cachedImage()), MemoryCacheLiveResourcePriorityHigh);
+        // Images are not referenced by ImageBitmap anymore, so always CacheLiveResourcePriorityLow
+        ASSERT_EQ(memoryCache()->priority(imageNoCrop->cachedImage()), MemoryCacheLiveResourcePriorityLow);
+        ASSERT_EQ(memoryCache()->priority(imageInteriorCrop->cachedImage()), MemoryCacheLiveResourcePriorityLow);
+        ASSERT_EQ(memoryCache()->priority(imageExteriorCrop->cachedImage()), MemoryCacheLiveResourcePriorityLow);
 
         // ImageBitmaps that do not contain any of the source image do not elevate CacheLiveResourcePriority.
         ASSERT_EQ(memoryCache()->priority(imageOutsideCrop->cachedImage()), MemoryCacheLiveResourcePriorityLow);
@@ -178,7 +178,7 @@
     ASSERT_EQ(memoryCache()->priority(imageOutsideCrop->cachedImage()), MemoryCacheLiveResourcePriorityLow);
 
     // There is still an ImageBitmap that references this image.
-    ASSERT_EQ(memoryCache()->priority(imageInteriorCrop->cachedImage()), MemoryCacheLiveResourcePriorityHigh);
+    ASSERT_EQ(memoryCache()->priority(imageInteriorCrop->cachedImage()), MemoryCacheLiveResourcePriorityLow);
     imageBitmapInteriorCrop = nullptr;
 }
 
@@ -192,27 +192,27 @@
 
     RefPtrWillBeRawPtr<ImageBitmap> imageBitmap = ImageBitmap::create(image.get(),
         IntRect(0, 0, m_image->width(), m_image->height()));
-    ASSERT_EQ(imageBitmap->bitmapImage().get(), originalImageResource->image());
+    ASSERT_EQ(imageBitmap->skImage(), originalImageResource->image()->imageForCurrentFrame().get());
 
     ResourcePtr<ImageResource> newImageResource = new ImageResource(
         StaticBitmapImage::create(m_image2).get());
     image->setImageResource(newImageResource.get());
 
-    // The ImageBitmap should contain the same data as the original cached image but should no longer hold a reference.
+    // The ImageBitmap should contain the same data as the original cached image
     {
-        ASSERT_NE(imageBitmap->bitmapImage().get(), originalImageResource->image());
-        RefPtr<SkImage> image1 = imageBitmap->bitmapImage()->imageForCurrentFrame();
+        ASSERT_EQ(imageBitmap->skImage(), originalImageResource->image()->imageForCurrentFrame().get());
+        SkImage* image1 = imageBitmap->skImage();
         ASSERT_NE(image1, nullptr);
-        RefPtr<SkImage> image2 = originalImageResource->image()->imageForCurrentFrame();
+        SkImage* image2 = originalImageResource->image()->imageForCurrentFrame().get();
         ASSERT_NE(image2, nullptr);
         ASSERT_EQ(image1, image2);
     }
 
     {
-        ASSERT_NE(imageBitmap->bitmapImage().get(), newImageResource->image());
-        RefPtr<SkImage> image1 = imageBitmap->bitmapImage()->imageForCurrentFrame();
+        ASSERT_NE(imageBitmap->skImage(), newImageResource->image()->imageForCurrentFrame().get());
+        SkImage* image1 = imageBitmap->skImage();
         ASSERT_NE(image1, nullptr);
-        RefPtr<SkImage> image2 = newImageResource->image()->imageForCurrentFrame();
+        SkImage* image2 = newImageResource->image()->imageForCurrentFrame().get();
         ASSERT_NE(image2, nullptr);
         ASSERT_NE(image1, image2);
     }
diff --git a/third_party/WebKit/Source/core/input/EventHandler.cpp b/third_party/WebKit/Source/core/input/EventHandler.cpp
index 24cbcfe..0f681c7 100644
--- a/third_party/WebKit/Source/core/input/EventHandler.cpp
+++ b/third_party/WebKit/Source/core/input/EventHandler.cpp
@@ -108,8 +108,67 @@
     return n && n->inDocument();
 }
 
+const AtomicString& touchEventNameForTouchPointState(PlatformTouchPoint::State state)
+{
+    switch (state) {
+    case PlatformTouchPoint::TouchReleased:
+        return EventTypeNames::touchend;
+    case PlatformTouchPoint::TouchCancelled:
+        return EventTypeNames::touchcancel;
+    case PlatformTouchPoint::TouchPressed:
+        return EventTypeNames::touchstart;
+    case PlatformTouchPoint::TouchMoved:
+        return EventTypeNames::touchmove;
+    case PlatformTouchPoint::TouchStationary:
+        // Fall through to default
+    default:
+        ASSERT_NOT_REACHED();
+        return emptyAtom;
+    }
 }
 
+const AtomicString& pointerEventNameForTouchPointState(PlatformTouchPoint::State state)
+{
+    switch (state) {
+    case PlatformTouchPoint::TouchReleased:
+        return EventTypeNames::pointerup;
+    case PlatformTouchPoint::TouchCancelled:
+        return EventTypeNames::pointercancel;
+    case PlatformTouchPoint::TouchPressed:
+        return EventTypeNames::pointerdown;
+    case PlatformTouchPoint::TouchMoved:
+        return EventTypeNames::pointermove;
+    case PlatformTouchPoint::TouchStationary:
+        // Fall through to default
+    default:
+        ASSERT_NOT_REACHED();
+        return emptyAtom;
+    }
+}
+
+const AtomicString& pointerEventNameForMouseEventName(const AtomicString& mouseEventName)
+{
+#define RETURN_CORRESPONDING_PE_NAME(eventSuffix) \
+    if (mouseEventName == EventTypeNames::mouse##eventSuffix) {\
+        return EventTypeNames::pointer##eventSuffix;\
+    }
+
+    RETURN_CORRESPONDING_PE_NAME(down);
+    RETURN_CORRESPONDING_PE_NAME(enter);
+    RETURN_CORRESPONDING_PE_NAME(leave);
+    RETURN_CORRESPONDING_PE_NAME(move);
+    RETURN_CORRESPONDING_PE_NAME(out);
+    RETURN_CORRESPONDING_PE_NAME(over);
+    RETURN_CORRESPONDING_PE_NAME(up);
+
+#undef RETURN_CORRESPONDING_PE_NAME
+
+    ASSERT_NOT_REACHED();
+    return emptyAtom;
+}
+
+} // namespace
+
 using namespace HTMLNames;
 
 // The link drag hysteresis is much larger than the others because there
@@ -971,13 +1030,7 @@
 
     m_frame->selection().setCaretBlinkingSuspended(true);
 
-    bool swallowEvent = dispatchPointerEventForMouseEvent(mev.innerNode(), EventTypeNames::pointerdown, mouseEvent);
-
-    if (swallowEvent) {
-        m_preventMouseEventForPointerTypeMouse = true;
-    }
-    if (!m_preventMouseEventForPointerTypeMouse)
-        swallowEvent = swallowEvent || !dispatchMouseEvent(EventTypeNames::mousedown, mev.innerNode(), m_clickCount, mouseEvent);
+    bool swallowEvent = updatePointerTargetAndDispatchEvents(EventTypeNames::mousedown, mev.innerNode(), m_clickCount, mouseEvent);
 
     // m_selectionInitiationState is initialized after dispatching mousedown
     // event in order not to keep the selection by DOM APIs Because we can't
@@ -1111,7 +1164,7 @@
     }
 
     if (m_frameSetBeingResized)
-        return !dispatchMouseEvent(EventTypeNames::mousemove, m_frameSetBeingResized.get(), 0, mouseEvent);
+        return updatePointerTargetAndDispatchEvents(EventTypeNames::mousemove, m_frameSetBeingResized.get(), 0, mouseEvent);
 
     // Send events right to a scrollbar if the mouse is pressed.
     if (m_lastScrollbarUnderMouse && m_mousePressed) {
@@ -1193,7 +1246,8 @@
     if (swallowEvent)
         return true;
 
-    swallowEvent = !dispatchMouseEvent(EventTypeNames::mousemove, mev.innerNode(), 0, mouseEvent);
+    swallowEvent = updatePointerTargetAndDispatchEvents(EventTypeNames::mousemove, mev.innerNode(), 0, mouseEvent);
+
     if (!swallowEvent)
         swallowEvent = handleMouseDraggedEvent(mev);
 
@@ -1246,12 +1300,12 @@
     }
 
     if (m_frameSetBeingResized)
-        return !dispatchMouseEvent(EventTypeNames::mouseup, m_frameSetBeingResized.get(), m_clickCount, mouseEvent);
+        return dispatchMouseEvent(EventTypeNames::mouseup, m_frameSetBeingResized.get(), m_clickCount, mouseEvent);
 
     if (m_lastScrollbarUnderMouse) {
         invalidateClick();
         m_lastScrollbarUnderMouse->mouseUp(mouseEvent);
-        return !dispatchMouseEvent(EventTypeNames::mouseup, m_nodeUnderMouse.get(), m_clickCount, mouseEvent);
+        return dispatchMouseEvent(EventTypeNames::mouseup, m_nodeUnderMouse.get(), m_clickCount, mouseEvent);
     }
 
     // Mouse events simulated from touch should not hit-test again.
@@ -1266,14 +1320,10 @@
     if (subframe && passMouseReleaseEventToSubframe(mev, subframe))
         return true;
 
-    bool swallowPointerUpEvent = dispatchPointerEventForMouseEvent(mev.innerNode(), EventTypeNames::pointerup, mouseEvent);
-    bool swallowMouseUpEvent = false;
-    if (!m_preventMouseEventForPointerTypeMouse) {
-        swallowMouseUpEvent = !dispatchMouseEvent(EventTypeNames::mouseup, mev.innerNode(), m_clickCount, mouseEvent);
-    } else {
-        // TODO(crbug/545647): This state should reset with pointercancel too.
-        m_preventMouseEventForPointerTypeMouse = false;
-    }
+    bool swallowUpEvent = updatePointerTargetAndDispatchEvents(EventTypeNames::mouseup, mev.innerNode(), m_clickCount, mouseEvent);
+
+    // TODO(crbug/545647): This state should reset with pointercancel too.
+    m_preventMouseEventForPointerTypeMouse = false;
 
     bool contextMenuEvent = mouseEvent.button() == RightButton;
 #if OS(MACOSX)
@@ -1308,12 +1358,12 @@
     }
 
     bool swallowMouseReleaseEvent = false;
-    if (!swallowPointerUpEvent && !swallowMouseUpEvent)
+    if (!swallowUpEvent)
         swallowMouseReleaseEvent = handleMouseReleaseEvent(mev);
 
     invalidateClick();
 
-    return swallowPointerUpEvent || swallowMouseUpEvent || swallowClickEvent || swallowMouseReleaseEvent;
+    return swallowUpEvent || swallowClickEvent || swallowMouseReleaseEvent;
 }
 
 bool EventHandler::dispatchDragEvent(const AtomicString& eventType, Node* dragTarget, const PlatformMouseEvent& event, DataTransfer* dataTransfer)
@@ -1562,7 +1612,7 @@
         sendMouseEventsForNodeTransition(lastNodeUnderMouse.get(), m_nodeUnderMouse.get(), mouseEvent);
 }
 
-bool EventHandler::dispatchPointerEventForMouseEvent(Node* target, const AtomicString& eventType,
+bool EventHandler::dispatchPointerEvent(Node* target, const AtomicString& eventType,
     const PlatformMouseEvent& mouseEvent, Node* relatedTarget)
 {
     if (!RuntimeEnabledFeatures::pointerEventEnabled())
@@ -1581,7 +1631,7 @@
 
     // Dispatch pointerout/mouseout events
     if (isNodeInDocument(exitedNode)) {
-        dispatchPointerEventForMouseEvent(exitedNode, EventTypeNames::pointerout, mouseEvent, enteredNode);
+        dispatchPointerEvent(exitedNode, EventTypeNames::pointerout, mouseEvent, enteredNode);
         exitedNode->dispatchMouseEvent(mouseEvent, EventTypeNames::mouseout, 0, enteredNode);
     }
 
@@ -1643,7 +1693,7 @@
     // Dispatch pointerleave/mouseleave events, in child-to-parent order.
     for (size_t j = 0; j < exitedAncestorIndex; j++) {
         if (exitedNodeHasCapturingAncestor || exitedAncestors[j]->hasEventListeners(EventTypeNames::pointerleave)) {
-            dispatchPointerEventForMouseEvent(exitedAncestors[j].get(), EventTypeNames::pointerleave, mouseEvent,
+            dispatchPointerEvent(exitedAncestors[j].get(), EventTypeNames::pointerleave, mouseEvent,
                 enteredNode);
         }
         if (exitedNodeHasCapturingAncestor || exitedAncestors[j]->hasEventListeners(EventTypeNames::mouseleave))
@@ -1652,7 +1702,7 @@
 
     // Dispatch pointerover/mouseover.
     if (isNodeInDocument(enteredNode)) {
-        dispatchPointerEventForMouseEvent(enteredNode, EventTypeNames::pointerover, mouseEvent, exitedNode);
+        dispatchPointerEvent(enteredNode, EventTypeNames::pointerover, mouseEvent, exitedNode);
         enteredNode->dispatchMouseEvent(mouseEvent, EventTypeNames::mouseover, 0, exitedNode);
     }
 
@@ -1669,7 +1719,7 @@
     // Dispatch pointerenter/mouseenter events, in parent-to-child order.
     for (size_t i = enteredAncestorIndex; i > 0; i--) {
         if (enteredNodeHasCapturingAncestor || enteredAncestors[i-1]->hasEventListeners(EventTypeNames::pointerenter)) {
-            dispatchPointerEventForMouseEvent(enteredAncestors[i-1].get(), EventTypeNames::pointerenter, mouseEvent,
+            dispatchPointerEvent(enteredAncestors[i-1].get(), EventTypeNames::pointerenter, mouseEvent,
                 exitedNode);
         }
         if (enteredNodeHasCapturingAncestor || enteredAncestors[i-1]->hasEventListeners(EventTypeNames::mouseenter))
@@ -1677,14 +1727,38 @@
     }
 }
 
-// The return value means 'continue default handling.'
 bool EventHandler::dispatchMouseEvent(const AtomicString& eventType, Node* targetNode, int clickCount, const PlatformMouseEvent& mouseEvent)
 {
     updateMouseEventTargetNode(targetNode, mouseEvent);
-    return !m_nodeUnderMouse || m_nodeUnderMouse->dispatchMouseEvent(mouseEvent, eventType, clickCount);
+    return m_nodeUnderMouse && !m_nodeUnderMouse->dispatchMouseEvent(mouseEvent, eventType, clickCount);
 }
 
-// The return value means 'swallow event' (was handled), as for other handle* functions.
+// TODO(mustaq): Make PE drive ME dispatch & bookkeeping in EventHandler.
+bool EventHandler::updatePointerTargetAndDispatchEvents(const AtomicString& mouseEventType, Node* targetNode, int clickCount, const PlatformMouseEvent& mouseEvent)
+{
+    ASSERT(mouseEventType == EventTypeNames::mousedown
+        || mouseEventType == EventTypeNames::mousemove
+        || mouseEventType == EventTypeNames::mouseup);
+
+    updateMouseEventTargetNode(targetNode, mouseEvent);
+    if (!m_nodeUnderMouse)
+        return false;
+
+    bool swallowEvent = dispatchPointerEvent(m_nodeUnderMouse.get(),
+        pointerEventNameForMouseEventName(mouseEventType),
+        mouseEvent);
+
+    if (swallowEvent && mouseEventType == EventTypeNames::mousedown) {
+        m_preventMouseEventForPointerTypeMouse = true;
+    }
+
+    if (!m_preventMouseEventForPointerTypeMouse) {
+        swallowEvent |= !m_nodeUnderMouse->dispatchMouseEvent(mouseEvent, mouseEventType, clickCount);
+    }
+
+    return swallowEvent;
+}
+
 bool EventHandler::handleMouseFocus(const MouseEventWithHitTestResults& targetedEvent, InputDeviceCapabilities* sourceCapabilities)
 {
     // If clicking on a frame scrollbar, do not mess up with content focus.
@@ -2126,7 +2200,7 @@
         LeftButton, PlatformEvent::MousePressed, gestureEvent.tapCount(),
         static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::LeftButtonDown),
         PlatformMouseEvent::FromTouch,  gestureEvent.timestamp());
-    bool swallowMouseDownEvent = !dispatchMouseEvent(EventTypeNames::mousedown, currentHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseDown);
+    bool swallowMouseDownEvent = dispatchMouseEvent(EventTypeNames::mousedown, currentHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseDown);
     selectionController().initializeSelectionState();
     if (!swallowMouseDownEvent)
         swallowMouseDownEvent = handleMouseFocus(MouseEventWithHitTestResults(fakeMouseDown, currentHitTest), InputDeviceCapabilities::firesTouchEventsSourceCapabilities());
@@ -2152,7 +2226,7 @@
         LeftButton, PlatformEvent::MouseReleased, gestureEvent.tapCount(),
         static_cast<PlatformEvent::Modifiers>(modifiers),
         PlatformMouseEvent::FromTouch,  gestureEvent.timestamp());
-    bool swallowMouseUpEvent = !dispatchMouseEvent(EventTypeNames::mouseup, currentHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseUp);
+    bool swallowMouseUpEvent = dispatchMouseEvent(EventTypeNames::mouseup, currentHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseUp);
 
     bool swallowClickEvent = false;
     if (m_clickNode) {
@@ -2164,7 +2238,7 @@
             // because commonAncestor() will exit early if their documents are different.
             m_clickNode->updateDistribution();
             Node* clickTargetNode = currentHitTest.innerNode()->commonAncestor(*m_clickNode, parentForClickEvent);
-            swallowClickEvent = !dispatchMouseEvent(EventTypeNames::click, clickTargetNode, gestureEvent.tapCount(), fakeMouseUp);
+            swallowClickEvent = dispatchMouseEvent(EventTypeNames::click, clickTargetNode, gestureEvent.tapCount(), fakeMouseUp);
         }
         m_clickNode = nullptr;
     }
@@ -2811,7 +2885,7 @@
     selectionController().sendContextMenuEvent(mev, positionInContents);
 
     Node* targetNode = overrideTargetNode ? overrideTargetNode : mev.innerNode();
-    return !dispatchMouseEvent(EventTypeNames::contextmenu, targetNode, 0, event);
+    return dispatchMouseEvent(EventTypeNames::contextmenu, targetNode, 0, event);
 }
 
 bool EventHandler::sendContextMenuEventForKey(Element* overrideTargetElement)
@@ -3271,7 +3345,7 @@
 // returns if we should continue "default processing", i.e., whether eventhandler canceled
 bool EventHandler::dispatchDragSrcEvent(const AtomicString& eventType, const PlatformMouseEvent& event)
 {
-    return !dispatchDragEvent(eventType, dragState().m_dragSrc.get(), event, dragState().m_dragDataTransfer.get());
+    return dispatchDragEvent(eventType, dragState().m_dragSrc.get(), event, dragState().m_dragDataTransfer.get());
 }
 
 bool EventHandler::handleDrag(const MouseEventWithHitTestResults& event, DragInitiator initiator)
@@ -3358,7 +3432,7 @@
     // reset. Hence, need to check if this particular drag operation can
     // continue even if dispatchEvent() indicates no (direct) cancellation.
     // Do that by checking if m_dragSrc is still set.
-    m_mouseDownMayStartDrag = dispatchDragSrcEvent(EventTypeNames::dragstart, m_mouseDown)
+    m_mouseDownMayStartDrag = !dispatchDragSrcEvent(EventTypeNames::dragstart, m_mouseDown)
         && !m_frame->selection().isInPasswordField() && dragState().m_dragSrc;
 
     // Invalidate clipboard here against anymore pasteboard writing for security. The drag
@@ -3554,44 +3628,6 @@
     }
 }
 
-static const AtomicString& touchEventNameForTouchPointState(PlatformTouchPoint::State state)
-{
-    switch (state) {
-    case PlatformTouchPoint::TouchReleased:
-        return EventTypeNames::touchend;
-    case PlatformTouchPoint::TouchCancelled:
-        return EventTypeNames::touchcancel;
-    case PlatformTouchPoint::TouchPressed:
-        return EventTypeNames::touchstart;
-    case PlatformTouchPoint::TouchMoved:
-        return EventTypeNames::touchmove;
-    case PlatformTouchPoint::TouchStationary:
-        // Fall through to default
-    default:
-        ASSERT_NOT_REACHED();
-        return emptyAtom;
-    }
-}
-
-static const AtomicString& pointerEventNameForTouchPointState(PlatformTouchPoint::State state)
-{
-    switch (state) {
-    case PlatformTouchPoint::TouchReleased:
-        return EventTypeNames::pointerup;
-    case PlatformTouchPoint::TouchCancelled:
-        return EventTypeNames::pointercancel;
-    case PlatformTouchPoint::TouchPressed:
-        return EventTypeNames::pointerdown;
-    case PlatformTouchPoint::TouchMoved:
-        return EventTypeNames::pointermove;
-    case PlatformTouchPoint::TouchStationary:
-        // Fall through to default
-    default:
-        ASSERT_NOT_REACHED();
-        return emptyAtom;
-    }
-}
-
 HitTestResult EventHandler::hitTestResultInFrame(LocalFrame* frame, const LayoutPoint& point, HitTestRequest::HitTestRequestType hitType)
 {
     HitTestResult result(HitTestRequest(hitType), point);
@@ -3607,9 +3643,12 @@
     return result;
 }
 
-void EventHandler::dispatchPointerEventsForTouchEvent(const PlatformTouchEvent& event,
+void EventHandler::dispatchPointerEvents(const PlatformTouchEvent& event,
     WillBeHeapVector<TouchInfo>& touchInfos)
 {
+    if (!RuntimeEnabledFeatures::pointerEventEnabled())
+        return;
+
     // Iterate through the touch points, sending PointerEvents to the targets as required.
     for (unsigned i = 0; i < touchInfos.size(); ++i) {
         TouchInfo& touchInfo = touchInfos[i];
@@ -3645,6 +3684,9 @@
 
 void EventHandler::sendPointerCancels(WillBeHeapVector<TouchInfo>& touchInfos)
 {
+    if (!RuntimeEnabledFeatures::pointerEventEnabled())
+        return;
+
     for (unsigned i = 0; i < touchInfos.size(); ++i) {
         TouchInfo& touchInfo = touchInfos[i];
         const PlatformTouchPoint& point = touchInfo.point;
@@ -3941,14 +3983,12 @@
         touchInfo.consumed = false;
     }
 
-    if (RuntimeEnabledFeatures::pointerEventEnabled()) {
-        if (!m_inPointerCanceledState) {
-            dispatchPointerEventsForTouchEvent(event, touchInfos);
-            // Note that the disposition of any pointer events affects only the generation of touch
-            // events. If all pointer events were handled (and hence no touch events were fired), that
-            // is still equivalent to the touch events going unhandled because pointer event handler
-            // don't block scroll gesture generation.
-        }
+    if (!m_inPointerCanceledState) {
+        dispatchPointerEvents(event, touchInfos);
+        // Note that the disposition of any pointer events affects only the generation of touch
+        // events. If all pointer events were handled (and hence no touch events were fired), that
+        // is still equivalent to the touch events going unhandled because pointer event handler
+        // don't block scroll gesture generation.
     }
 
     // TODO(crbug.com/507408): If PE handlers always call preventDefault, we won't see TEs until after
@@ -3958,17 +3998,15 @@
     bool swallowedTouchEvent = dispatchTouchEvents(event, touchInfos, freshTouchEvents,
         allTouchReleased);
 
-    if (RuntimeEnabledFeatures::pointerEventEnabled()) {
-        if (!m_inPointerCanceledState) {
-            // Check if we need to stop firing pointer events because of a touch action.
-            // See: www.w3.org/TR/pointerevents/#declaring-candidate-regions-for-default-touch-behaviors
-            if (event.causesScrollingIfUncanceled() && !swallowedTouchEvent) {
-                m_inPointerCanceledState = true;
-                sendPointerCancels(touchInfos);
-            }
-        } else if (allTouchReleased) {
-            m_inPointerCanceledState = false;
+    if (!m_inPointerCanceledState) {
+        // Check if we need to stop firing pointer events because of a touch action.
+        // See: www.w3.org/TR/pointerevents/#declaring-candidate-regions-for-default-touch-behaviors
+        if (event.causesScrollingIfUncanceled() && !swallowedTouchEvent) {
+            m_inPointerCanceledState = true;
+            sendPointerCancels(touchInfos);
         }
+    } else if (allTouchReleased) {
+        m_inPointerCanceledState = false;
     }
 
     return swallowedTouchEvent;
diff --git a/third_party/WebKit/Source/core/input/EventHandler.h b/third_party/WebKit/Source/core/input/EventHandler.h
index 4a059969..20aee78 100644
--- a/third_party/WebKit/Source/core/input/EventHandler.h
+++ b/third_party/WebKit/Source/core/input/EventHandler.h
@@ -283,7 +283,7 @@
     void updateMouseEventTargetNode(Node*, const PlatformMouseEvent&);
 
     // Returns true when the sent PE has defaultPrevented or defaultHandled set.
-    bool dispatchPointerEventForMouseEvent(Node* target, const AtomicString& eventType, const PlatformMouseEvent&, Node* relatedTarget = nullptr);
+    bool dispatchPointerEvent(Node* target, const AtomicString& eventType, const PlatformMouseEvent&, Node* relatedTarget = nullptr);
 
     // Dispatches mouseover, mouseout, mouseenter and mouseleave events to appropriate nodes when the mouse pointer moves from one node to another.
     void sendMouseEventsForNodeTransition(Node*, Node*, const PlatformMouseEvent&);
@@ -291,6 +291,15 @@
     MouseEventWithHitTestResults prepareMouseEvent(const HitTestRequest&, const PlatformMouseEvent&);
 
     bool dispatchMouseEvent(const AtomicString& eventType, Node* target, int clickCount, const PlatformMouseEvent&);
+
+    // Dispatches ME after corresponding PE provided the PE has not been canceled. The eventType arg
+    // must be a mouse event that can be gated though a preventDefaulted pointerdown (i.e., one of
+    // {mousedown, mousemove, mouseup}).
+    // TODO(mustaq): Can we avoid the clickCount param, instead use PlatformMouseEvent's count?
+    //     Same applied to dispatchMouseEvent() above.
+    bool updatePointerTargetAndDispatchEvents(const AtomicString& mouseEventType, Node* target,
+        int clickCount, const PlatformMouseEvent&);
+
     bool dispatchDragEvent(const AtomicString& eventType, Node* target, const PlatformMouseEvent&, DataTransfer*);
 
     void clearDragDataTransfer();
@@ -341,7 +350,7 @@
     // the given element.
     bool slideFocusOnShadowHostIfNecessary(const Element&);
 
-    void dispatchPointerEventsForTouchEvent(const PlatformTouchEvent&, WillBeHeapVector<TouchInfo>&);
+    void dispatchPointerEvents(const PlatformTouchEvent&, WillBeHeapVector<TouchInfo>&);
     void sendPointerCancels(WillBeHeapVector<TouchInfo>&);
 
     bool dispatchTouchEvents(const PlatformTouchEvent&, WillBeHeapVector<TouchInfo>&, bool, bool);
diff --git a/third_party/WebKit/Source/core/loader/LinkLoader.cpp b/third_party/WebKit/Source/core/loader/LinkLoader.cpp
index db207fa..a2a2329c 100644
--- a/third_party/WebKit/Source/core/loader/LinkLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/LinkLoader.cpp
@@ -42,6 +42,7 @@
 #include "core/html/CrossOriginAttribute.h"
 #include "core/html/LinkRelAttribute.h"
 #include "core/inspector/ConsoleMessage.h"
+#include "core/loader/DocumentLoader.h"
 #include "core/loader/LinkHeader.h"
 #include "core/loader/NetworkHintsInterface.h"
 #include "core/loader/PrerenderHandle.h"
@@ -164,7 +165,7 @@
     }
 }
 
-static bool getPriorityTypeFromAsAttribute(const String& as, Resource::Type& type)
+static bool getTypeFromAsAttribute(const String& as, Resource::Type& type)
 {
     if (as.isEmpty())
         return false;
@@ -181,8 +182,11 @@
     return true;
 }
 
-void LinkLoader::preloadIfNeeded(const LinkRelAttribute& relAttribute, const KURL& href, Document& document, const String& as)
+static void preloadIfNeeded(const LinkRelAttribute& relAttribute, const KURL& href, Document& document, const String& as)
 {
+    if (!document.loader())
+        return;
+
     if (relAttribute.isLinkPreload()) {
         UseCounter::count(document, UseCounter::LinkRelPreload);
         ASSERT(RuntimeEnabledFeatures::linkPreloadEnabled());
@@ -191,17 +195,17 @@
             return;
         }
         // TODO(yoav): Figure out a way that 'as' would be used to set request headers.
-        Resource::Type priorityType;
-        if (!getPriorityTypeFromAsAttribute(as, priorityType)) {
+        Resource::Type type;
+        if (!getTypeFromAsAttribute(as, type)) {
             document.addConsoleMessage(ConsoleMessage::create(OtherMessageSource, WarningMessageLevel, String("<link rel=preload> must have a valid `as` value")));
             return;
         }
         FetchRequest linkRequest(ResourceRequest(document.completeURL(href)), FetchInitiatorTypeNames::link);
-        linkRequest.setPriority(document.fetcher()->loadPriority(priorityType, linkRequest));
+        linkRequest.setPriority(document.fetcher()->loadPriority(type, linkRequest));
         Settings* settings = document.settings();
         if (settings && settings->logPreload())
             document.addConsoleMessage(ConsoleMessage::create(OtherMessageSource, DebugMessageLevel, String("Preload triggered for " + href.host() + href.path())));
-        setResource(LinkFetchResource::fetch(Resource::LinkPreload, linkRequest, document.fetcher()));
+        document.loader()->startPreload(type, linkRequest);
     }
 }
 
diff --git a/third_party/WebKit/Source/core/loader/LinkLoader.h b/third_party/WebKit/Source/core/loader/LinkLoader.h
index 65b3794..de920e5 100644
--- a/third_party/WebKit/Source/core/loader/LinkLoader.h
+++ b/third_party/WebKit/Source/core/loader/LinkLoader.h
@@ -73,7 +73,6 @@
 private:
     void linkLoadTimerFired(Timer<LinkLoader>*);
     void linkLoadingErrorTimerFired(Timer<LinkLoader>*);
-    void preloadIfNeeded(const LinkRelAttribute&, const KURL& href, Document&, const String& as);
 
     LinkLoaderClient* m_client;
 
diff --git a/third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp b/third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp
index 34b2df1..364cc3f 100644
--- a/third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp
+++ b/third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp
@@ -8,6 +8,7 @@
 #include "core/fetch/ResourceFetcher.h"
 #include "core/frame/Settings.h"
 #include "core/html/LinkRelAttribute.h"
+#include "core/loader/DocumentLoader.h"
 #include "core/loader/LinkLoaderClient.h"
 #include "core/loader/NetworkHintsInterface.h"
 #include "core/testing/DummyPageHolder.h"
@@ -82,16 +83,16 @@
         const ResourceLoadPriority priority;
         const bool shouldLoad;
     } cases[] = {
-        {"data://example.com/cat.jpg", "image", ResourceLoadPriorityVeryLow, true},
-        {"data://example.com/cat.jpg", "script", ResourceLoadPriorityMedium, true},
-        {"data://example.com/cat.jpg", "stylesheet", ResourceLoadPriorityHigh, true},
-        {"data://example.com/cat.jpg", "blabla", ResourceLoadPriorityUnresolved, true},
-        {"data://example.com/cat.jpg", "image", ResourceLoadPriorityUnresolved, false},
+        {"data://example.test/cat.jpg", "image", ResourceLoadPriorityVeryLow, true},
+        {"data://example.test/cat.js", "script", ResourceLoadPriorityMedium, true},
+        {"data://example.test/cat.css", "stylesheet", ResourceLoadPriorityHigh, true},
+        {"data://example.test/cat.blob", "blabla", ResourceLoadPriorityUnresolved, false},
     };
 
     // Test the cases with a single header
     for (const auto& testCase : cases) {
         OwnPtr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(500, 500));
+        dummyPageHolder->frame().settings()->setScriptEnabled(true);
         MockLinkLoaderClient loaderClient(testCase.shouldLoad);
         LinkLoader loader(&loaderClient);
         KURL hrefURL = KURL(KURL(), testCase.href);
@@ -102,11 +103,18 @@
             hrefURL,
             dummyPageHolder->document(),
             NetworkHintsMock());
-        if (testCase.priority == ResourceLoadPriorityUnresolved) {
-            ASSERT(!loader.resource());
-        } else {
-            ASSERT(loader.resource());
-            ASSERT_EQ(testCase.priority, loader.resource()->resourceRequest().priority());
+        ASSERT(dummyPageHolder->document().fetcher());
+        WillBeHeapListHashSet<RawPtrWillBeMember<Resource>>* preloads = dummyPageHolder->document().fetcher()->preloads();
+        if (testCase.shouldLoad)
+            ASSERT_NE(nullptr, preloads);
+        if (preloads) {
+            if (testCase.priority == ResourceLoadPriorityUnresolved) {
+                ASSERT_EQ((unsigned)0, preloads->size());
+            } else {
+                ASSERT_EQ((unsigned)1, preloads->size());
+                if (preloads->size() > 0)
+                    ASSERT_EQ(testCase.priority, preloads->begin().get()->get()->resourceRequest().priority());
+            }
         }
     }
 }
diff --git a/third_party/WebKit/Source/core/page/PageSerializer.cpp b/third_party/WebKit/Source/core/page/PageSerializer.cpp
index 2c395efe..28ac4e0 100644
--- a/third_party/WebKit/Source/core/page/PageSerializer.cpp
+++ b/third_party/WebKit/Source/core/page/PageSerializer.cpp
@@ -397,6 +397,10 @@
 void PageSerializer::serializeCSSStyleSheet(CSSStyleSheet& styleSheet, const KURL& url)
 {
     StringBuilder cssText;
+    cssText.appendLiteral("@charset \"");
+    cssText.append(styleSheet.contents()->charset().lower());
+    cssText.appendLiteral("\";\n\n");
+
     for (unsigned i = 0; i < styleSheet.length(); ++i) {
         CSSRule* rule = styleSheet.item(i);
         String itemText = rule->cssText();
@@ -411,10 +415,8 @@
     }
 
     if (url.isValid() && !m_resourceURLs.contains(url)) {
-        // FIXME: We should check whether a charset has been specified and if none was found add one.
         WTF::TextEncoding textEncoding(styleSheet.contents()->charset());
         ASSERT(textEncoding.isValid());
-        // TODO(jsbell): Ensure @charset is written out if non-UTF-8.
         String textString = cssText.toString();
         CString text = textEncoding.encode(textString, WTF::EntitiesForUnencodables);
         m_resources->append(SerializedResource(url, String("text/css"), SharedBuffer::create(text.data(), text.length())));
diff --git a/third_party/WebKit/Source/modules/OWNERS b/third_party/WebKit/Source/modules/OWNERS
index d6d9cc02..72f11c26 100644
--- a/third_party/WebKit/Source/modules/OWNERS
+++ b/third_party/WebKit/Source/modules/OWNERS
@@ -1,5 +1,6 @@
 haraken@chromium.org
 mkwst@chromium.org
+mlamouri@chromium.org
 
 # Reviewer for inspector-related code:
 pfeldman@chromium.org
diff --git a/third_party/WebKit/Source/modules/accessibility/AXObject.cpp b/third_party/WebKit/Source/modules/accessibility/AXObject.cpp
index dd0379c..59cead9 100644
--- a/third_party/WebKit/Source/modules/accessibility/AXObject.cpp
+++ b/third_party/WebKit/Source/modules/accessibility/AXObject.cpp
@@ -142,6 +142,7 @@
     { ArticleRole, "Article" },
     { BannerRole, "Banner" },
     { BlockquoteRole, "Blockquote" },
+    // TODO(nektar): Delete busy_indicator role. It's used nowhere.
     { BusyIndicatorRole, "BusyIndicator" },
     { ButtonRole, "Button" },
     { CanvasRole, "Canvas" },
diff --git a/third_party/WebKit/Source/modules/background_sync/SyncRegistration.idl b/third_party/WebKit/Source/modules/background_sync/SyncRegistration.idl
index 56db134..add356ea 100644
--- a/third_party/WebKit/Source/modules/background_sync/SyncRegistration.idl
+++ b/third_party/WebKit/Source/modules/background_sync/SyncRegistration.idl
@@ -8,6 +8,6 @@
     RuntimeEnabled=BackgroundSync,
 ] interface SyncRegistration {
     readonly attribute DOMString tag;
-    [CallWith=ScriptState] readonly attribute Promise<void> finished;
+    [RuntimeEnabled=BackgroundSyncV2, CallWith=ScriptState] readonly attribute Promise<void> finished;
     [CallWith=ScriptState] Promise<boolean> unregister();
 };
diff --git a/third_party/WebKit/Source/platform/blink_platform.gypi b/third_party/WebKit/Source/platform/blink_platform.gypi
index 6b708b1..6858302e 100644
--- a/third_party/WebKit/Source/platform/blink_platform.gypi
+++ b/third_party/WebKit/Source/platform/blink_platform.gypi
@@ -987,6 +987,7 @@
       'fonts/SmallCapsIteratorTest.cpp',
       'fonts/android/FontCacheAndroidTest.cpp',
       'fonts/mac/FontFamilyMatcherMacTest.mm',
+      'fonts/opentype/OpenTypeVerticalDataTest.cpp',
       'fonts/shaping/CachingWordShaperTest.cpp',
       'fonts/shaping/HarfBuzzShaperTest.cpp',
       'fonts/shaping/RunSegmenterTest.cpp',
diff --git a/third_party/WebKit/Source/web/tests/OpenTypeVerticalDataTest.cpp b/third_party/WebKit/Source/platform/fonts/opentype/OpenTypeVerticalDataTest.cpp
similarity index 100%
rename from third_party/WebKit/Source/web/tests/OpenTypeVerticalDataTest.cpp
rename to third_party/WebKit/Source/platform/fonts/opentype/OpenTypeVerticalDataTest.cpp
diff --git a/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoder.cpp b/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
index ee12184..74ef7d51 100644
--- a/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
+++ b/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoder.cpp
@@ -39,8 +39,6 @@
 #include "platform/image-decoders/jpeg/JPEGImageDecoder.h"
 
 #include "platform/PlatformInstrumentation.h"
-#include "wtf/PassOwnPtr.h"
-#include "wtf/dtoa/utils.h"
 
 extern "C" {
 #include <stdio.h> // jpeglib.h needs stdio FILE.
diff --git a/third_party/WebKit/Source/platform/mhtml/ArchiveResource.cpp b/third_party/WebKit/Source/platform/mhtml/ArchiveResource.cpp
index dd4c6aa..7d24500 100644
--- a/third_party/WebKit/Source/platform/mhtml/ArchiveResource.cpp
+++ b/third_party/WebKit/Source/platform/mhtml/ArchiveResource.cpp
@@ -31,8 +31,16 @@
 
 namespace blink {
 
-inline ArchiveResource::ArchiveResource(PassRefPtr<SharedBuffer> data, const KURL& url, const AtomicString& mimeType, const AtomicString& textEncoding, const String& frameName, const ResourceResponse& response)
+inline ArchiveResource::ArchiveResource(
+    PassRefPtr<SharedBuffer> data,
+    const KURL& url,
+    const String& contentID,
+    const AtomicString& mimeType,
+    const AtomicString& textEncoding,
+    const String& frameName,
+    const ResourceResponse& response)
     : m_url(url)
+    , m_contentID(contentID)
     , m_response(response)
     , m_data(data)
     , m_mimeType(mimeType)
@@ -46,20 +54,25 @@
 {
 }
 
-PassRefPtrWillBeRawPtr<ArchiveResource> ArchiveResource::create(PassRefPtr<SharedBuffer> data, const KURL& url, const AtomicString& mimeType, const AtomicString& textEncoding, const String& frameName, const ResourceResponse& response)
+PassRefPtrWillBeRawPtr<ArchiveResource> ArchiveResource::create(
+    PassRefPtr<SharedBuffer> data,
+    const KURL& url,
+    const String& contentID,
+    const AtomicString& mimeType,
+    const AtomicString& textEncoding,
+    const String& frameName,
+    const ResourceResponse& response)
 {
     if (!data)
         return nullptr;
     if (response.isNull()) {
-        const ResourceResponse& resourceResponse = ResourceResponse(url, mimeType, data->size(), textEncoding, String());
-        return adoptRefWillBeNoop(new ArchiveResource(data, url, mimeType, textEncoding, frameName, resourceResponse));
+        const ResourceResponse& resourceResponse = ResourceResponse(
+            url, mimeType, data->size(), textEncoding, String());
+        return adoptRefWillBeNoop(new ArchiveResource(
+            data, url, contentID, mimeType, textEncoding, frameName, resourceResponse));
     }
-    return adoptRefWillBeNoop(new ArchiveResource(data, url, mimeType, textEncoding, frameName, response));
-}
-
-PassRefPtrWillBeRawPtr<ArchiveResource> ArchiveResource::create(PassRefPtr<SharedBuffer> data, const KURL& url, const ResourceResponse& response)
-{
-    return create(data, url, response.mimeType(), response.textEncodingName(), String(), response);
+    return adoptRefWillBeNoop(new ArchiveResource(
+        data, url, contentID, mimeType, textEncoding, frameName, response));
 }
 
 }
diff --git a/third_party/WebKit/Source/platform/mhtml/ArchiveResource.h b/third_party/WebKit/Source/platform/mhtml/ArchiveResource.h
index a049118..a3119fd 100644
--- a/third_party/WebKit/Source/platform/mhtml/ArchiveResource.h
+++ b/third_party/WebKit/Source/platform/mhtml/ArchiveResource.h
@@ -40,14 +40,19 @@
 
 class PLATFORM_EXPORT ArchiveResource final : public RefCountedWillBeGarbageCollectedFinalized<ArchiveResource> {
 public:
-    static PassRefPtrWillBeRawPtr<ArchiveResource> create(PassRefPtr<SharedBuffer>, const KURL&, const ResourceResponse&);
-    static PassRefPtrWillBeRawPtr<ArchiveResource> create(PassRefPtr<SharedBuffer>, const KURL&,
-        const AtomicString& mimeType, const AtomicString& textEncoding, const String& frameName,
+    static PassRefPtrWillBeRawPtr<ArchiveResource> create(
+        PassRefPtr<SharedBuffer>,
+        const KURL&,
+        const String& contentId,
+        const AtomicString& mimeType,
+        const AtomicString& textEncoding,
+        const String& frameName,
         const ResourceResponse& = ResourceResponse());
 
     ~ArchiveResource();
 
     const KURL& url() const { return m_url; }
+    const String& contentID() const { return m_contentID; }
     const ResourceResponse& response() const { return m_response; }
     SharedBuffer* data() const { return m_data.get(); }
     const AtomicString& mimeType() const { return m_mimeType; }
@@ -57,9 +62,17 @@
     DEFINE_INLINE_TRACE() { }
 
 private:
-    ArchiveResource(PassRefPtr<SharedBuffer>, const KURL&, const AtomicString& mimeType, const AtomicString& textEncoding, const String& frameName, const ResourceResponse&);
+    ArchiveResource(
+        PassRefPtr<SharedBuffer>,
+        const KURL&,
+        const String& contentID,
+        const AtomicString& mimeType,
+        const AtomicString& textEncoding,
+        const String& frameName,
+        const ResourceResponse&);
 
     KURL m_url;
+    String m_contentID;
     ResourceResponse m_response;
     RefPtr<SharedBuffer> m_data;
     AtomicString m_mimeType;
diff --git a/third_party/WebKit/Source/platform/mhtml/ArchiveResourceCollection.cpp b/third_party/WebKit/Source/platform/mhtml/ArchiveResourceCollection.cpp
index 9d6f70a..4de6622 100644
--- a/third_party/WebKit/Source/platform/mhtml/ArchiveResourceCollection.cpp
+++ b/third_party/WebKit/Source/platform/mhtml/ArchiveResourceCollection.cpp
@@ -32,9 +32,37 @@
 #include "platform/mhtml/ArchiveResource.h"
 #include "platform/mhtml/MHTMLArchive.h"
 #include "platform/weborigin/KURL.h"
+#include "wtf/text/StringBuilder.h"
+#include "wtf/text/WTFString.h"
 
 namespace blink {
 
+namespace {
+
+// Converts |contentID| taken from a Content-ID MIME header
+// into URI using "cid" scheme.  Based primarily on an example
+// from rfc2557 in section 9.5, but also based on more
+// normative parts of specs like:
+// - rfc2557 - MHTML - section 8.3 - "Use of the Content-ID header and CID URLs"
+// - rfc1738 - URL - section 4 (reserved scheme names;  includes "cid")
+// - rfc2387 - multipart/related - section 3.4 - "Syntax" (cid := msg-id)
+// - rfc0822 - msg-id = "<" addr-spec ">"; addr-spec = local-part "@" domain
+KURL convertContentIDToURI(const String& contentID)
+{
+    if (contentID.length() <= 2)
+        return KURL();
+
+    if (!contentID.startsWith('<') || !contentID.endsWith('>'))
+        return KURL();
+
+    StringBuilder uriBuilder;
+    uriBuilder.append("cid:");
+    uriBuilder.append(contentID, 1, contentID.length() - 2);
+    return KURL(KURL(), uriBuilder.toString());
+}
+
+}
+
 ArchiveResourceCollection::ArchiveResourceCollection()
 {
 }
@@ -50,12 +78,12 @@
         return;
 
     const MHTMLArchive::SubArchiveResources& subresources = archive->subresources();
-    for (MHTMLArchive::SubArchiveResources::const_iterator iterator = subresources.begin(); iterator != subresources.end(); ++iterator)
-        m_subresources.set((*iterator)->url(), iterator->get());
+    for (const RefPtrWillBeMember<ArchiveResource>& subresource : subresources) {
+        addResource(*subresource);
+    }
 
     const MHTMLArchive::SubFrameArchives& subframes = archive->subframeArchives();
-    for (MHTMLArchive::SubFrameArchives::const_iterator iterator = subframes.begin(); iterator != subframes.end(); ++iterator) {
-        RefPtrWillBeRawPtr<MHTMLArchive> archive = *iterator;
+    for (const RefPtrWillBeMember<MHTMLArchive>& archive : subframes) {
         ASSERT(archive->mainResource());
 
         const String& frameName = archive->mainResource()->frameName();
@@ -65,19 +93,23 @@
             // In the MHTML case, frames don't have a name so we use the URL instead.
             m_subframes.set(archive->mainResource()->url().string(), archive.get());
         }
+
+        KURL cidURI = convertContentIDToURI(archive->mainResource()->contentID());
+        if (cidURI.isValid())
+            m_subframes.set(cidURI, archive.get());
     }
 }
 
 // FIXME: Adding a resource directly to a DocumentLoader/ArchiveResourceCollection seems like bad design, but is API some apps rely on.
 // Can we change the design in a manner that will let us deprecate that API without reducing functionality of those apps?
-void ArchiveResourceCollection::addResource(PassRefPtrWillBeRawPtr<ArchiveResource> resource)
+void ArchiveResourceCollection::addResource(ArchiveResource& resource)
 {
-    ASSERT(resource);
-    if (!resource)
-        return;
+    const KURL& url = resource.url();
+    m_subresources.set(url, &resource);
 
-    const KURL& url = resource->url(); // get before passing PassRefPtr (which sets it to 0)
-    m_subresources.set(url, resource);
+    KURL cidURI = convertContentIDToURI(resource.contentID());
+    if (cidURI.isValid())
+        m_subresources.set(cidURI, &resource);
 }
 
 ArchiveResource* ArchiveResourceCollection::archiveResourceForURL(const KURL& url)
diff --git a/third_party/WebKit/Source/platform/mhtml/ArchiveResourceCollection.h b/third_party/WebKit/Source/platform/mhtml/ArchiveResourceCollection.h
index 18922a7..fc956bea 100644
--- a/third_party/WebKit/Source/platform/mhtml/ArchiveResourceCollection.h
+++ b/third_party/WebKit/Source/platform/mhtml/ArchiveResourceCollection.h
@@ -49,7 +49,6 @@
 
     ~ArchiveResourceCollection();
 
-    void addResource(PassRefPtrWillBeRawPtr<ArchiveResource>);
     void addAllResources(MHTMLArchive*);
 
     ArchiveResource* archiveResourceForURL(const KURL&);
@@ -59,6 +58,7 @@
 
 private:
     ArchiveResourceCollection();
+    void addResource(ArchiveResource&);
 
     WillBeHeapHashMap<String, RefPtrWillBeMember<ArchiveResource>> m_subresources;
     WillBeHeapHashMap<String, RefPtrWillBeMember<MHTMLArchive>> m_subframes;
diff --git a/third_party/WebKit/Source/platform/mhtml/MHTMLParser.cpp b/third_party/WebKit/Source/platform/mhtml/MHTMLParser.cpp
index 7ba2df9..cc67350 100644
--- a/third_party/WebKit/Source/platform/mhtml/MHTMLParser.cpp
+++ b/third_party/WebKit/Source/platform/mhtml/MHTMLParser.cpp
@@ -71,6 +71,7 @@
     String charset() const { return m_charset; }
     Encoding contentTransferEncoding() const { return m_contentTransferEncoding; }
     String contentLocation() const { return m_contentLocation; }
+    String contentID() const { return m_contentID; }
 
     // Multi-part type and boundaries are only valid for multipart MIME headers.
     String multiPartType() const { return m_multipartType; }
@@ -88,6 +89,7 @@
     String m_charset;
     Encoding m_contentTransferEncoding;
     String m_contentLocation;
+    String m_contentID;
     String m_multipartType;
     String m_endOfPartBoundary;
     String m_endOfDocumentBoundary;
@@ -162,6 +164,11 @@
     if (mimeParametersIterator != keyValuePairs.end())
         mimeHeader->m_contentLocation = mimeParametersIterator->value;
 
+    // See rfc2557 - section 8.3 - Use of the Content-ID header and CID URLs.
+    mimeParametersIterator = keyValuePairs.find("content-id");
+    if (mimeParametersIterator != keyValuePairs.end())
+        mimeHeader->m_contentID = mimeParametersIterator->value;
+
     return mimeHeader.release();
 }
 
@@ -369,7 +376,8 @@
     // The specs mentions 5 ways to resolve a URL: http://tools.ietf.org/html/rfc2557#section-5
     // IE and Firefox (UNMht) seem to generate only absolute URLs.
     KURL location = KURL(KURL(), mimeHeader.contentLocation());
-    return ArchiveResource::create(contentBuffer, location, AtomicString(mimeHeader.contentType()), AtomicString(mimeHeader.charset()), String());
+    return ArchiveResource::create(
+        contentBuffer, location, mimeHeader.contentID(), AtomicString(mimeHeader.contentType()), AtomicString(mimeHeader.charset()), String());
 }
 
 size_t MHTMLParser::frameCount() const
diff --git a/third_party/WebKit/Source/web/WebPageSerializerImpl.cpp b/third_party/WebKit/Source/web/WebPageSerializerImpl.cpp
index 9e5c6a72..40b79146 100644
--- a/third_party/WebKit/Source/web/WebPageSerializerImpl.cpp
+++ b/third_party/WebKit/Source/web/WebPageSerializerImpl.cpp
@@ -282,8 +282,7 @@
     CString encodedContent = param->textEncoding.encode(content, WTF::EntitiesForUnencodables);
 
     // Send result to the client.
-    m_client->didSerializeDataForFrame(
-        param->url, WebCString(encodedContent), status);
+    m_client->didSerializeDataForFrame(WebCString(encodedContent), status);
 }
 
 // TODO(yosin): We should utilize |MarkupFormatter| here to share code,
@@ -321,9 +320,7 @@
                     result.append(m_htmlEntities.convertEntitiesInString(attrValue));
                 } else {
                     // Get the absolute link
-                    WebLocalFrameImpl* subFrame = WebLocalFrameImpl::fromFrameOwnerElement(element);
-                    String completeURL = subFrame ? subFrame->frame()->document()->url() :
-                                                    param->document->completeURL(attrValue);
+                    String completeURL = param->document->completeURL(attrValue);
                     // Check whether we have local files for those link.
                     if (m_localLinks.contains(completeURL)) {
                         if (!param->directoryName.isEmpty()) {
@@ -455,19 +452,16 @@
 bool WebPageSerializerImpl::serialize()
 {
     bool didSerialization = false;
-    KURL mainURL = m_specifiedWebLocalFrameImpl->frame()->document()->url();
 
-    WebLocalFrameImpl* webFrame = m_specifiedWebLocalFrameImpl;
-    Document* document = webFrame->frame()->document();
+    Document* document = m_specifiedWebLocalFrameImpl->frame()->document();
     const KURL& url = document->url();
 
-    if (url.isValid() && m_localLinks.contains(url.string())) {
+    if (url.isValid()) {
         didSerialization = true;
 
         const WTF::TextEncoding& textEncoding = document->encoding().isValid() ? document->encoding() : UTF8Encoding();
-        String directoryName = url == mainURL ? m_localDirectoryName : "";
 
-        SerializeDomParam param(url, textEncoding, document, directoryName);
+        SerializeDomParam param(url, textEncoding, document, m_localDirectoryName);
 
         Element* documentElement = document->documentElement();
         if (documentElement)
@@ -477,8 +471,7 @@
     } else {
         // Report empty contents for invalid URLs.
         m_client->didSerializeDataForFrame(
-            url, WebCString(),
-            WebPageSerializerClient::CurrentFrameIsFinished);
+            WebCString(), WebPageSerializerClient::CurrentFrameIsFinished);
     }
 
     ASSERT(m_dataBuffer.isEmpty());
diff --git a/third_party/WebKit/Source/web/tests/PageSerializerTest.cpp b/third_party/WebKit/Source/web/tests/PageSerializerTest.cpp
index 9f4b5e0e..6cbf3fdc 100644
--- a/third_party/WebKit/Source/web/tests/PageSerializerTest.cpp
+++ b/third_party/WebKit/Source/web/tests/PageSerializerTest.cpp
@@ -347,6 +347,12 @@
     EXPECT_TRUE(isSerialized("ul-dot.png", "image/png"));
     EXPECT_TRUE(isSerialized("ol-dot.png", "image/png"));
 
+    // Ensure encodings are specified.
+    EXPECT_TRUE(getSerializedData("link_styles.css", "text/css").startsWith("@charset"));
+    EXPECT_TRUE(getSerializedData("import_styles.css", "text/css").startsWith("@charset"));
+    EXPECT_TRUE(getSerializedData("import_style_from_link.css", "text/css").startsWith("@charset"));
+    EXPECT_TRUE(getSerializedData("encoding.css", "text/css").startsWith("@charset \"euc-kr\";"));
+
     // Ensure that stylesheet contents are not NFC-normalized before encoding.
     EXPECT_TRUE(getSerializedData("encoding.css", "text/css").contains("\xE4\xC5\xD1\xE2"));
     EXPECT_FALSE(getSerializedData("encoding.css", "text/css").contains("\xE4\xC5\xE4\xC5"));
diff --git a/third_party/WebKit/Source/web/tests/WebPageSerializerTest.cpp b/third_party/WebKit/Source/web/tests/WebPageSerializerTest.cpp
index 50ac7482..ff4e07a 100644
--- a/third_party/WebKit/Source/web/tests/WebPageSerializerTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebPageSerializerTest.cpp
@@ -56,7 +56,7 @@
     std::string toString() const { return m_string; }
 
 private:
-    void didSerializeDataForFrame(const WebURL&, const WebCString& data, PageSerializationStatus) final
+    void didSerializeDataForFrame(const WebCString& data, PageSerializationStatus) final
     {
         m_string += data;
     }
diff --git a/third_party/WebKit/Source/web/web.gypi b/third_party/WebKit/Source/web/web.gypi
index edead745..bf5c99b 100644
--- a/third_party/WebKit/Source/web/web.gypi
+++ b/third_party/WebKit/Source/web/web.gypi
@@ -274,7 +274,6 @@
       'tests/ListenerLeakTest.cpp',
       'tests/MHTMLTest.cpp',
       'tests/WebMeaningfulLayoutsTest.cpp',
-      'tests/OpenTypeVerticalDataTest.cpp',
       'tests/PageSerializerTest.cpp',
       'tests/PaintAggregatorTest.cpp',
       'tests/PrerenderingTest.cpp',
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/platforminfo.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/platforminfo.py
index 15e17ee..bb1bc1c 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/platforminfo.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/platforminfo.py
@@ -147,12 +147,11 @@
     def _determine_mac_version(self, mac_version_string):
         release_version = int(mac_version_string.split('.')[1])
         version_strings = {
-            5: 'leopard',
             6: 'snowleopard',
             7: 'lion',
             8: 'mountainlion',
             9: 'mavericks',
-            10: 'yosemite',
+            10: 'mac10.10',
         }
         assert release_version >= min(version_strings.keys())
         return version_strings.get(release_version, 'future')
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/platforminfo_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/platforminfo_unittest.py
index 6133dfe..272d7a0 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/platforminfo_unittest.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/platforminfo_unittest.py
@@ -137,12 +137,11 @@
 
     def test_os_version(self):
         self.assertRaises(AssertionError, self.make_info, fake_sys('darwin'), fake_platform('10.4.3'))
-        self.assertEqual(self.make_info(fake_sys('darwin'), fake_platform('10.5.1')).os_version, 'leopard')
         self.assertEqual(self.make_info(fake_sys('darwin'), fake_platform('10.6.1')).os_version, 'snowleopard')
         self.assertEqual(self.make_info(fake_sys('darwin'), fake_platform('10.7.1')).os_version, 'lion')
         self.assertEqual(self.make_info(fake_sys('darwin'), fake_platform('10.8.1')).os_version, 'mountainlion')
         self.assertEqual(self.make_info(fake_sys('darwin'), fake_platform('10.9.0')).os_version, 'mavericks')
-        self.assertEqual(self.make_info(fake_sys('darwin'), fake_platform('10.10.0')).os_version, 'yosemite')
+        self.assertEqual(self.make_info(fake_sys('darwin'), fake_platform('10.10.0')).os_version, 'mac10.10')
         self.assertEqual(self.make_info(fake_sys('darwin'), fake_platform('10.11.0')).os_version, 'future')
 
         self.assertEqual(self.make_info(fake_sys('linux2')).os_version, 'trusty')
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py
index 8fddcf4..a3f161e 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py
@@ -59,6 +59,19 @@
 NEEDS_REBASELINE_KEYWORD = 'NeedsRebaseline'
 NEEDS_MANUAL_REBASELINE_KEYWORD = 'NeedsManualRebaseline'
 
+# TODO(ojan): Don't add new platforms here. New mac platforms
+# should use the version number directly instead of the english
+# language names throughout the code.
+MAC_VERSION_MAPPING = {
+    'mac10.6': 'snowleopard',
+    'mac10.7': 'lion',
+    'mac10.8': 'mountainlion',
+    'mac10.9': 'mavericks',
+}
+
+INVERTED_MAC_VERSION_MAPPING = {value: name for name, value in MAC_VERSION_MAPPING.items()}
+
+
 class ParseError(Exception):
     def __init__(self, warnings):
         super(ParseError, self).__init__()
@@ -149,11 +162,15 @@
         self._parse_specifiers(expectation_line)
         self._parse_expectations(expectation_line)
 
+    def _parse_specifier(self, specifier):
+        specifier = specifier.lower()
+        return MAC_VERSION_MAPPING.get(specifier, specifier)
+
     def _parse_specifiers(self, expectation_line):
         if self._is_lint_mode:
             self._lint_line(expectation_line)
 
-        parsed_specifiers = set([specifier.lower() for specifier in expectation_line.specifiers])
+        parsed_specifiers = set([self._parse_specifier(specifier) for specifier in expectation_line.specifiers])
         expectation_line.matching_configurations = self._test_configuration_converter.to_config_set(parsed_specifiers, expectation_line.warnings)
 
     def _lint_line(self, expectation_line):
@@ -213,7 +230,7 @@
 
     # FIXME: Update the original specifiers and remove this once the old syntax is gone.
     _configuration_tokens_list = [
-        'Mac', 'SnowLeopard', 'Lion', 'MountainLion', 'Retina', 'Mavericks', 'Yosemite',
+        'Mac', 'Mac10.6', 'Mac10.7', 'Mac10.8', 'Mac10.9', 'Mac10.10', 'Retina',
         'Win', 'XP', 'Win7', 'Win10',
         'Linux', 'Linux32', 'Precise', 'Trusty',
         'Android',
@@ -491,6 +508,7 @@
         result = []
         result.extend(sorted(self.parsed_specifiers))
         result.extend(test_configuration_converter.specifier_sorter().sort_specifiers(specifiers))
+        result = [INVERTED_MAC_VERSION_MAPPING.get(specifier, specifier) for specifier in result]
         return ' '.join(result)
 
     @staticmethod
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py
index 702620b..33749d5 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py
@@ -103,6 +103,21 @@
 
 
 class MiscTests(Base):
+    def test_parse_mac_legacy_names(self):
+        host = MockHost()
+        expectations_dict = OrderedDict()
+        expectations_dict['expectations'] = '\nBug(x) [ Mac10.6 ] failures/expected/text.html [ Failure ]\n'
+
+        port = host.port_factory.get('test-mac-snowleopard', None)
+        port.expectations_dict = lambda: expectations_dict
+        expectations = TestExpectations(port, self.get_basic_tests())
+        self.assertEqual(expectations.get_expectations('failures/expected/text.html'), set([FAIL]))
+
+        port = host.port_factory.get('test-win-xp', None)
+        port.expectations_dict = lambda: expectations_dict
+        expectations = TestExpectations(port, self.get_basic_tests())
+        self.assertEqual(expectations.get_expectations('failures/expected/text.html'), set([PASS]))
+
     def test_multiple_results(self):
         self.parse_exp('Bug(x) failures/expected/text.html [ Crash Failure ]')
         self.assertEqual(self._exp.get_expectations('failures/expected/text.html'), set([FAIL, CRASH]))
@@ -867,6 +882,15 @@
         expectation_line.matching_configurations = set([TestConfiguration('xp', 'x86', 'release'), TestConfiguration('xp', 'x86', 'debug')])
         self.assertEqual(expectation_line.to_string(self._converter), 'Bug(x) [ XP ] test/name/for/realz.html [ Failure ]')
 
+    def test_parsed_to_string_mac_legacy_names(self):
+        expectation_line = TestExpectationLine()
+        expectation_line.bugs = ['Bug(x)']
+        expectation_line.name = 'test/name/for/realz.html'
+        expectation_line.parsed_expectations = set([IMAGE])
+        self.assertEqual(expectation_line.to_string(self._converter), None)
+        expectation_line.matching_configurations = set([TestConfiguration('snowleopard', 'x86', 'release')])
+        self.assertEqual(expectation_line.to_string(self._converter), 'Bug(x) [ Mac10.6 Release ] test/name/for/realz.html [ Failure ]')
+
     def test_serialize_parsed_expectations(self):
         expectation_line = TestExpectationLine()
         expectation_line.parsed_expectations = set([])
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py
index 32250bea..5c67601 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py
@@ -102,7 +102,7 @@
 
         ('mountainlion', 'x86'),
         ('mavericks', 'x86'),
-        ('yosemite', 'x86'),
+        ('mac10.10', 'x86'),
         ('xp', 'x86'),
         ('win7', 'x86'),
         ('win10', 'x86'),
@@ -117,13 +117,13 @@
         )
 
     ALL_BASELINE_VARIANTS = [
-        'mac-yosemite', 'mac-mavericks', 'mac-retina', 'mac-mountainlion', 'mac-lion', 'mac-snowleopard',
+        'mac-mac10.10', 'mac-mavericks', 'mac-retina', 'mac-mountainlion', 'mac-lion', 'mac-snowleopard',
         'win-win10', 'win-win7', 'win-xp'
         'linux-trusty', 'linux-precise', 'linux-x86',
     ]
 
     CONFIGURATION_SPECIFIER_MACROS = {
-        'mac': ['snowleopard', 'lion', 'mountainlion', 'retina', 'mavericks', 'yosemite'],
+        'mac': ['snowleopard', 'lion', 'mountainlion', 'retina', 'mavericks', 'mac10.10'],
         'win': ['xp', 'win7', 'win10'],
         'linux': ['linux32', 'precise', 'trusty'],
         'android': ['icecreamsandwich'],
@@ -1271,7 +1271,7 @@
 
         The list should be sorted so that a later platform  will reuse
         an earlier platform's baselines if they are the same (e.g.,
-        'yosemite' should precede 'mavericks')."""
+        'mac10.10' should precede 'mac10.9')."""
         return self.ALL_BASELINE_VARIANTS
 
     def _generate_all_test_configurations(self):
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/builders.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/builders.py
index 0712a68..805e074 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/builders.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/builders.py
@@ -56,7 +56,7 @@
     "WebKit Mac10.8": {"port_name": "mac-mountainlion", "specifiers": ['MountainLion', 'Release']},
     "WebKit Mac10.9 (retina)": {"port_name": "mac-retina", "specifiers": ['Retina', 'Release']},
     "WebKit Mac10.9": {"port_name": "mac-mavericks", "specifiers": ['Mavericks', 'Release']},
-    "WebKit Mac10.10": {"port_name": "mac-yosemite", "specifiers": ['Yosemite', 'Release']},
+    "WebKit Mac10.10": {"port_name": "mac-mac10.10", "specifiers": ['Mac10.10', 'Release']},
     "WebKit Android (Nexus4)": {"port_name": "android", "specifiers": ['Android', 'Release']},
 }
 
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/mac.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/mac.py
index c6a7950..d9c9b40 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/mac.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/mac.py
@@ -38,7 +38,7 @@
 
 
 class MacPort(base.Port):
-    SUPPORTED_VERSIONS = ('snowleopard', 'lion', 'mountainlion', 'retina', 'mavericks', 'yosemite')
+    SUPPORTED_VERSIONS = ('snowleopard', 'lion', 'mountainlion', 'retina', 'mavericks', 'mac10.10')
     port_name = 'mac'
 
     # FIXME: We treat Retina (High-DPI) devices as if they are running
@@ -49,8 +49,8 @@
     # We also currently only support Retina on 10.9.
 
     FALLBACK_PATHS = {}
-    FALLBACK_PATHS['yosemite'] = ['mac']
-    FALLBACK_PATHS['mavericks'] = ['mac-mavericks'] + FALLBACK_PATHS['yosemite']
+    FALLBACK_PATHS['mac10.10'] = ['mac']
+    FALLBACK_PATHS['mavericks'] = ['mac-mavericks'] + FALLBACK_PATHS['mac10.10']
     FALLBACK_PATHS['retina'] = ['mac-retina'] + FALLBACK_PATHS['mavericks']
     FALLBACK_PATHS['mountainlion'] = ['mac-mountainlion'] + FALLBACK_PATHS['mavericks']
     FALLBACK_PATHS['lion'] = ['mac-lion'] + FALLBACK_PATHS['mountainlion']
@@ -66,7 +66,7 @@
     def determine_full_port_name(cls, host, options, port_name):
         if port_name.endswith('mac'):
             if host.platform.os_version in ('future',):
-                version = 'yosemite'
+                version = 'mac10.10'
             else:
                 version = host.platform.os_version
             if host.platform.is_highdpi():
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/mac_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/mac_unittest.py
index cebb9f25..a805a3a 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/mac_unittest.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/mac_unittest.py
@@ -45,7 +45,7 @@
         self.assertEqual(expected, port.name())
 
     def test_versions(self):
-        self.assertTrue(self.make_port().name() in ('mac-snowleopard', 'mac-lion', 'mac-mountainlion', 'mac-mavericks', 'mac-yosemite'))
+        self.assertTrue(self.make_port().name() in ('mac-snowleopard', 'mac-lion', 'mac-mountainlion', 'mac-mavericks', 'mac-mac10.10'))
 
         self.assert_name(None, 'snowleopard', 'mac-snowleopard')
         self.assert_name('mac', 'snowleopard', 'mac-snowleopard')
@@ -55,8 +55,8 @@
         self.assert_name(None, 'lion', 'mac-lion')
         self.assert_name(None, 'mountainlion', 'mac-mountainlion')
         self.assert_name(None, 'mavericks', 'mac-mavericks')
-        self.assert_name(None, 'yosemite', 'mac-yosemite')
-        self.assert_name(None, 'future', 'mac-yosemite')
+        self.assert_name(None, 'mac10.10', 'mac-mac10.10')
+        self.assert_name(None, 'future', 'mac-mac10.10')
 
         self.assert_name('mac', 'lion', 'mac-lion')
         self.assertRaises(AssertionError, self.assert_name, None, 'tiger', 'should-raise-assertion-so-this-value-does-not-matter')
@@ -74,7 +74,7 @@
         port = self.make_port(port_name='mac-mavericks')
         self.assertEqual(port.baseline_path(), port._webkit_baseline_path('mac-mavericks'))
 
-        port = self.make_port(port_name='mac-yosemite')
+        port = self.make_port(port_name='mac-mac10.10')
         self.assertEqual(port.baseline_path(), port._webkit_baseline_path('mac'))
 
     def test_operating_system(self):
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py
index fcc26ff..a0a8a245 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py
@@ -289,8 +289,8 @@
             TestConfiguration('mountainlion', 'x86', 'release'),
             TestConfiguration('mavericks', 'x86', 'debug'),
             TestConfiguration('mavericks', 'x86', 'release'),
-            TestConfiguration('yosemite', 'x86', 'debug'),
-            TestConfiguration('yosemite', 'x86', 'release'),
+            TestConfiguration('mac10.10', 'x86', 'debug'),
+            TestConfiguration('mac10.10', 'x86', 'release'),
             TestConfiguration('xp', 'x86', 'debug'),
             TestConfiguration('xp', 'x86', 'release'),
             TestConfiguration('win7', 'x86', 'debug'),
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py
index 62d75404..b1f76f6 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py
@@ -464,7 +464,7 @@
         self.command._rebaseline(options,  {"userscripts/first-test.html": {"WebKit Mac10.7": ["txt", "png"]}})
 
         new_expectations = self._read(self.lion_expectations_path)
-        self.assertMultiLineEqual(new_expectations, "Bug(x) [ Mavericks MountainLion Retina SnowLeopard Yosemite ] userscripts/first-test.html [ Failure ]\nbug(z) [ Linux ] userscripts/first-test.html [ Failure ]\n")
+        self.assertMultiLineEqual(new_expectations, "Bug(x) [ Mac10.10 Mac10.9 Mac10.8 Retina Mac10.6 ] userscripts/first-test.html [ Failure ]\nbug(z) [ Linux ] userscripts/first-test.html [ Failure ]\n")
 
     def test_rebaseline_updates_expectations_file_all_platforms(self):
         options = MockOptions(optimize=False, verbose=True, results_directory=None)
@@ -476,7 +476,7 @@
         self.command._rebaseline(options,  {"userscripts/first-test.html": {"WebKit Mac10.7": ["txt", "png"]}})
 
         new_expectations = self._read(self.lion_expectations_path)
-        self.assertMultiLineEqual(new_expectations, "Bug(x) [ Android Linux Mavericks MountainLion Retina SnowLeopard Win Yosemite ] userscripts/first-test.html [ Failure ]\n")
+        self.assertMultiLineEqual(new_expectations, "Bug(x) [ Android Linux Mac10.10 Mac10.9 Mac10.8 Retina Mac10.6 Win ] userscripts/first-test.html [ Failure ]\n")
 
     def test_rebaseline_handles_platform_skips(self):
         # This test is just like test_rebaseline_updates_expectations_file_all_platforms(),
@@ -492,7 +492,7 @@
         self.command._rebaseline(options,  {"userscripts/first-test.html": {"WebKit Mac10.7": ["txt", "png"]}})
 
         new_expectations = self._read(self.lion_expectations_path)
-        self.assertMultiLineEqual(new_expectations, "Bug(x) [ Linux Mavericks MountainLion Retina SnowLeopard Win Yosemite ] userscripts/first-test.html [ Failure ]\n")
+        self.assertMultiLineEqual(new_expectations, "Bug(x) [ Linux Mac10.10 Mac10.9 Mac10.8 Retina Mac10.6 Win ] userscripts/first-test.html [ Failure ]\n")
 
     def test_rebaseline_handles_skips_in_file(self):
         # This test is like test_Rebaseline_handles_platform_skips, except that the
@@ -513,7 +513,7 @@
         new_expectations = self._read(self.lion_expectations_path)
         self.assertMultiLineEqual(
             new_expectations,
-            ("Bug(x) [ Linux Mavericks MountainLion Retina SnowLeopard Win Yosemite ] userscripts/first-test.html [ Failure ]\n"
+            ("Bug(x) [ Linux Mac10.10 Mac10.9 Mac10.8 Retina Mac10.6 Win ] userscripts/first-test.html [ Failure ]\n"
              "Bug(y) [ Android ] userscripts/first-test.html [ Skip ]\n"))
 
     def test_rebaseline_handles_smoke_tests(self):
@@ -531,7 +531,7 @@
         self.command._rebaseline(options,  {"userscripts/first-test.html": {"WebKit Mac10.7": ["txt", "png"]}})
 
         new_expectations = self._read(self.lion_expectations_path)
-        self.assertMultiLineEqual(new_expectations, "Bug(x) [ Linux Mavericks MountainLion Retina SnowLeopard Win Yosemite ] userscripts/first-test.html [ Failure ]\n")
+        self.assertMultiLineEqual(new_expectations, "Bug(x) [ Linux Mac10.10 Mac10.9 Mac10.8 Retina Mac10.6 Win ] userscripts/first-test.html [ Failure ]\n")
 
 
 class TestRebaseline(_BaseTestCase):
diff --git a/third_party/WebKit/public/BUILD.gn b/third_party/WebKit/public/BUILD.gn
index f3f5115..bf80025 100644
--- a/third_party/WebKit/public/BUILD.gn
+++ b/third_party/WebKit/public/BUILD.gn
@@ -87,12 +87,6 @@
       "./web/WebInputEvent.h",
       "./web/WebTextInputType.h",
     ]
-    outputs = [
-      "org/chromium/blink_public/platform/WebDisplayMode.java",
-      "org/chromium/blink_public/web/WebInputEventModifier.java",
-      "org/chromium/blink_public/web/WebInputEventType.java",
-      "org/chromium/blink_public/web/WebTextInputFlags.java",
-    ]
   }
 
   # GYP version: WebKit/public/blink_headers.gyp:blink_headers_java
diff --git a/third_party/WebKit/public/web/WebPageSerializerClient.h b/third_party/WebKit/public/web/WebPageSerializerClient.h
index 597dd18a..97e5a0b 100644
--- a/third_party/WebKit/public/web/WebPageSerializerClient.h
+++ b/third_party/WebKit/public/web/WebPageSerializerClient.h
@@ -55,11 +55,9 @@
     };
 
     // Receive the individual chunks of serialized and encoded data to be saved.
-    // The parameter frameURL specifies what frame the data belongs. The
-    // parameter data contains the available data for saving. The parameter
-    // status indicates the status of data serialization.
-    virtual void didSerializeDataForFrame(const WebURL& frameURL,
-                                          const WebCString& data,
+    // The parameter data contains the available data for saving.
+    // The parameter status indicates the status of data serialization.
+    virtual void didSerializeDataForFrame(const WebCString& data,
                                           PageSerializationStatus status) = 0;
     WebPageSerializerClient() { }
 
diff --git a/third_party/libexif/BUILD.gn b/third_party/libexif/BUILD.gn
index 1431f37..3f88f1c9 100644
--- a/third_party/libexif/BUILD.gn
+++ b/third_party/libexif/BUILD.gn
@@ -20,6 +20,11 @@
   }
 
   loadable_module("libexif") {
+    if (is_mac) {
+      # Matches the output from GYP.
+      output_name = "exif"
+    }
+
     sources = [
       "sources/libexif/canon/exif-mnote-data-canon.c",
       "sources/libexif/canon/mnote-canon-entry.c",
diff --git a/tools/ipc_fuzzer/fuzzer/fuzzer.cc b/tools/ipc_fuzzer/fuzzer/fuzzer.cc
index 193bd92..9ab2b39 100644
--- a/tools/ipc_fuzzer/fuzzer/fuzzer.cc
+++ b/tools/ipc_fuzzer/fuzzer/fuzzer.cc
@@ -1220,6 +1220,7 @@
     p->Set(namespace_id, command_buffer_id, release_count);
     if (verified_flush)
       p->SetVerifyFlush();
+    return true;
   }
 };
 
diff --git a/tools/telemetry/catapult_base/dependency_manager/base_config.py b/tools/telemetry/catapult_base/dependency_manager/base_config.py
index 8a02b5d..8450d99 100644
--- a/tools/telemetry/catapult_base/dependency_manager/base_config.py
+++ b/tools/telemetry/catapult_base/dependency_manager/base_config.py
@@ -153,13 +153,15 @@
               '%s/%s' % (cs_base_folder, cs_remote_file))
 
         version_in_cs = platform_info.get('version_in_cs', None)
+        path_within_archive = platform_info.get('path_within_archive', None)
 
-        if download_path or cs_remote_path or cs_hash or version_in_cs:
+        if any([download_path, cs_remote_path, cs_hash, version_in_cs,
+                path_within_archive]):
           dep_info = dependency_info.DependencyInfo(
               dependency, platform, self._config_path, cs_bucket=cs_bucket,
               cs_remote_path=cs_remote_path, download_path=download_path,
               cs_hash=cs_hash, version_in_cs=version_in_cs,
-              local_paths=local_paths)
+              path_within_archive=path_within_archive, local_paths=local_paths)
         else:
           dep_info = dependency_info.DependencyInfo(
               dependency, platform, self._config_path, local_paths=local_paths)
diff --git a/tools/telemetry/catapult_base/dependency_manager/base_config_unittest.py b/tools/telemetry/catapult_base/dependency_manager/base_config_unittest.py
index e4fce4a..5be0716 100644
--- a/tools/telemetry/catapult_base/dependency_manager/base_config_unittest.py
+++ b/tools/telemetry/catapult_base/dependency_manager/base_config_unittest.py
@@ -1391,6 +1391,14 @@
             'download_path': 'download\\path\\1w1',
             'cs_remote_path': 'cs_path1w1',
             'local_paths': ['local\\path\\1w10', 'local\\path\\1w11']
+          },
+          'all_the_variables': {
+            'cloud_storage_hash': 'hash111',
+            'download_path': 'download_path111',
+            'cs_remote_path': 'cs_path111',
+            'version_in_cs': 'version_111',
+            'path_in_archive': 'path/in/archive',
+            'local_paths': ['local_path1110', 'local_path1111']
           }
         }
       }
@@ -1497,6 +1505,8 @@
 
   @mock.patch('__builtin__.open')
   def testConfigEndToEnd(self, open_mock):
+    # TODO(aiolos): break this into smaller tests.
+    self.maxDiff = None
     file_path = os.path.join(os.path.dirname(__file__),
                              'test%s.json' % self.config_type)
     dir_path = os.path.dirname(file_path)
@@ -1506,50 +1516,57 @@
                   local_paths=[os.path.join(dir_path, 'local_path4d0'),
                                os.path.join(dir_path, 'local_path4d1')],
                   cs_remote_path='dep4_hash4d', cs_hash='hash4d',
-                  version_in_cs=None,
+                  version_in_cs=None, path_within_archive=None,
                   download_path=os.path.join(dir_path, 'download_path4d')),
         mock.call('dep4', 'plat1_arch2', file_path, cs_bucket='bucket4',
                   local_paths=[], cs_remote_path='dep4_hash412',
                   cs_hash='hash412', version_in_cs=None,
+                  path_within_archive=None,
                   download_path=os.path.join(dir_path, 'download_path412')),
         mock.call('dep4', 'plat2_arch1', file_path, cs_bucket='bucket4',
                   local_paths=[os.path.join(dir_path, 'local_path4210')],
                   cs_remote_path='dep4_hash421', cs_hash='hash421',
-                  version_in_cs=None,
+                  version_in_cs=None, path_within_archive=None,
                   download_path=os.path.join(dir_path, 'download_path421')),
         mock.call('dep1', 'plat1_arch1', file_path, cs_bucket='bucket1',
                   local_paths=[os.path.join(dir_path, 'local_path1110'),
                                os.path.join(dir_path, 'local_path1111')],
                   cs_remote_path='cs_base_folder1/dep1_hash111',
                   cs_hash='hash111', version_in_cs='111.111.111',
+                  path_within_archive=None,
                   download_path=os.path.join(dir_path, 'download_path111')),
         mock.call('dep1', 'plat1_arch2', file_path, cs_bucket='bucket1',
                   local_paths=[os.path.join(dir_path, 'local_path1120'),
                                os.path.join(dir_path, 'local_path1121')],
                   cs_remote_path='cs_base_folder1/dep1_hash112',
                   cs_hash='hash112', version_in_cs='111.111.111',
+                  path_within_archive=None,
                   download_path=os.path.join(dir_path, 'download_path112')),
         mock.call('dep1', 'plat2_arch1', file_path, cs_bucket='bucket1',
                   local_paths=[os.path.join(dir_path, 'local_path1210'),
                                os.path.join(dir_path, 'local_path1211')],
                   cs_remote_path='cs_base_folder1/dep1_hash121',
                   cs_hash='hash121', version_in_cs=None,
+                  path_within_archive=None,
                   download_path=os.path.join(dir_path, 'download_path121')),
         mock.call('dep1', 'win_arch1', file_path, cs_bucket='bucket1',
                   local_paths=[os.path.join(dir_path, 'local', 'path', '1w10'),
                                os.path.join(dir_path, 'local', 'path', '1w11')],
                   cs_remote_path='cs_base_folder1/dep1_hash1w1',
                   cs_hash='hash1w1', version_in_cs=None,
+                  path_within_archive=None,
                   download_path=os.path.join(
                       dir_path, 'download', 'path', '1w1')),
         mock.call('dep3', 'default', file_path, cs_bucket='bucket3',
                   local_paths=[os.path.join(dir_path, 'local_path3d0')],
                   cs_remote_path='cs_base_folder3/dep3_hash3d',
                   cs_hash='hash3d', version_in_cs=None,
+                  path_within_archive=None,
                   download_path=os.path.join(dir_path, 'download_path3d')),
         mock.call('dep2', 'win_arch2', file_path, cs_bucket='bucket2',
                   local_paths=[], cs_remote_path='cs/base/folder2/dep2_hash2w2',
                   cs_hash='hash2w2', version_in_cs=None,
+                  path_within_archive=None,
                   download_path=os.path.join(
                       dir_path, 'download', 'path', '2w2')),
         mock.call('dep2', 'plat3_arch3', file_path,
@@ -1560,8 +1577,9 @@
                       dir_path, 'local', 'path', '2210')],
                   cs_remote_path='cs/base/folder2/dep2_hash221',
                   cs_hash='hash221', version_in_cs=None,
+                  path_within_archive=None,
                   download_path=os.path.join(
-                    dir_path, 'download', 'path', '221')),
+                      dir_path, 'download', 'path', '221')),
         ]
     json_dict = {'config_type': self.config_type,
                  'dependencies': expected_config_data}
diff --git a/tools/telemetry/catapult_base/dependency_manager/dependency_info.py b/tools/telemetry/catapult_base/dependency_manager/dependency_info.py
index c2c8602..60136ec1 100644
--- a/tools/telemetry/catapult_base/dependency_manager/dependency_info.py
+++ b/tools/telemetry/catapult_base/dependency_manager/dependency_info.py
@@ -2,12 +2,12 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
+import os
 
 class DependencyInfo(object):
   def __init__(self, dependency, platform, config_file, cs_bucket=None,
                cs_hash=None, download_path=None, cs_remote_path=None,
-               version_in_cs=None, unzip_path=None,
-               path_within_archive=None, local_paths=None):
+               version_in_cs=None, path_within_archive=None, local_paths=None):
     """ Container for the information needed for each dependency/platform pair
     in the dependency_manager.
 
@@ -25,7 +25,15 @@
           cs_remote_path: Where the file is stored in the cloud storage bucket.
 
         Optional for downloading from cloud storage:
-          version: The version of the file stored in cloud storage.
+          version_in_cs: The version of the file stored in cloud storage.
+          path_within_archive: Specify if and how to handle zip archives
+              downloaded from cloud_storage. Expected values:
+                  None: Do not unzip the file downloaded from cloud_storage.
+                  '.': Unzip the file downloaded from cloud_storage. The
+                      unzipped file/folder is the expected dependency.
+                  file_path: Unzip the file downloaded from cloud_storage.
+                      |file_path| is the path to the expected dependency,
+                      relative to the unzipped archive location.
 
         Optional:
           local_paths: A list of paths to search in order for a local file.
@@ -46,6 +54,18 @@
     self._cs_bucket = cs_bucket
     self._cs_hash = cs_hash
     self._version_in_cs = version_in_cs
+    if download_path and path_within_archive:
+      self._unzip_location = os.path.abspath(os.path.join(
+          os.path.dirname(download_path), '%s_%s' % (dependency, platform)))
+      self._path_within_archive = path_within_archive
+    else:
+      if path_within_archive:
+        raise ValueError(
+          'Cannot specify archive information without a download path.'
+          'path_within_archive: %s, download_path: %s' % (
+            path_within_archive, download_path))
+      self._unzip_location = None
+      self._path_within_archive = None
     self.VerifyCloudStorageInfo()
 
   def Update(self, new_dep_info):
@@ -73,6 +93,8 @@
         self._cs_bucket = new_dep_info.cs_bucket
         self._cs_hash = new_dep_info.cs_hash
         self._version_in_cs = new_dep_info.version_in_cs
+        self._path_within_archive = new_dep_info.path_within_archive
+        self.VerifyCloudStorageInfo()
     if new_dep_info.local_paths:
       for path in new_dep_info.local_paths:
         if path not in self._local_paths:
@@ -115,21 +137,38 @@
     return self._version_in_cs
 
   @property
+  def path_within_archive(self):
+    return self._path_within_archive
+
+  @property
+  def unzip_location(self):
+    return self._unzip_location
+
+  @property
   def has_cs_info(self):
-    self.VerifyCloudStorageInfo()
-    return self.cs_hash
+    return any([self.cs_bucket, self.cs_remote_path, self.download_path,
+                self.cs_hash, self.version_in_cs, self.path_within_archive,
+                self.unzip_location])
+
+  @property
+  def has_minimum_cs_info(self):
+    return all([self.cs_bucket, self.cs_remote_path, self.download_path,
+                self.cs_hash])
 
   def VerifyCloudStorageInfo(self):
     """Ensure either all or none of the needed remote information is specified.
     """
-    if ((self.cs_bucket or self.cs_remote_path or self.download_path or
-          self.cs_hash or self._version_in_cs) and not (self.cs_bucket and
-            self.cs_remote_path and self.download_path and self.cs_hash)):
+    if self.has_cs_info and not self.has_minimum_cs_info:
       raise ValueError(
             'Attempted to partially initialize cloud storage data for '
             'dependency: %s, platform: %s, download_path: %s, '
-            'cs_remote_path: %s, cs_bucket %s, cs_hash %s, version_in_cs %s' % (
-                self.dependency, self.platform, self.download_path,
-                self.cs_remote_path, self.cs_bucket, self.cs_hash,
-                self._version_in_cs))
+            'cs_remote_path: %s, cs_bucket: %s, cs_hash: %s, version_in_cs: %s,'
+            ' path_within_archive: %s' % (self.dependency, self.platform,
+                self.download_path, self.cs_remote_path, self.cs_bucket,
+                self.cs_hash, self._version_in_cs, self._path_within_archive))
+    if bool(self.unzip_location) != bool(self.path_within_archive):
+      raise ValueError(
+          'DependencyInfo must have both or neither unzip_location and '
+          'path_within_archive. Found: unzip_location: %s, unzippped_path: %s'
+          % (self.unzip_location, self.path_within_archive))
 
diff --git a/tools/telemetry/catapult_base/dependency_manager/dependency_info_unittest.py b/tools/telemetry/catapult_base/dependency_manager/dependency_info_unittest.py
index 7780e28..17c9d14 100644
--- a/tools/telemetry/catapult_base/dependency_manager/dependency_info_unittest.py
+++ b/tools/telemetry/catapult_base/dependency_manager/dependency_info_unittest.py
@@ -40,6 +40,8 @@
     self.assertFalse(dep_info.cs_bucket)
     self.assertFalse(dep_info.cs_remote_path)
     self.assertFalse(dep_info.download_path)
+    self.assertFalse(dep_info.unzip_location)
+    self.assertFalse(dep_info.path_within_archive)
 
   def testInitMinimumCloudStorageInfo(self):
     # Must specify cloud storage information atomically.
@@ -123,6 +125,71 @@
     self.assertEqual('version_in_cs', dep_info.version_in_cs)
     self.assertEqual(['path'], dep_info.local_paths)
 
+  def testInitWithArchivePath(self):
+    self.assertRaises(ValueError, dependency_info.DependencyInfo, 'dep', 'plat',
+                      'config_file', path_within_archive='path_within_archive')
+    self.assertRaises(ValueError, dependency_info.DependencyInfo, 'dep', 'plat',
+                      'config_file', path_within_archive='path_within_archive',
+                      local_paths=['path2'])
+    self.assertRaises(ValueError, dependency_info.DependencyInfo, 'dep', 'plat',
+                      'config_file', cs_bucket='cs_bucket', cs_hash='cs_hash',
+                      cs_remote_path='cs_remote_path',
+                      path_within_archive='path_within_archive',
+                      local_paths=['path2'])
+    self.assertRaises(ValueError, dependency_info.DependencyInfo, 'dep', 'plat',
+                      'config_file', cs_bucket='cs_bucket', cs_hash='cs_hash',
+                      cs_remote_path='cs_remote_path', version_in_cs='version',
+                      path_within_archive='path_within_archive',
+                      local_paths=['path2'])
+
+    dep_info = dependency_info.DependencyInfo(
+        'dep', 'platform', 'config_file', cs_bucket='cs_bucket',
+        cs_hash='cs_hash', download_path='download_path',
+        cs_remote_path='cs_remote_path',
+        path_within_archive='path_within_archive')
+    self.assertEqual('dep', dep_info.dependency)
+    self.assertEqual('platform', dep_info.platform)
+    self.assertEqual(['config_file'], dep_info.config_files)
+    self.assertEqual('cs_hash', dep_info.cs_hash)
+    self.assertEqual('cs_bucket', dep_info.cs_bucket)
+    self.assertEqual('cs_remote_path', dep_info.cs_remote_path)
+    self.assertEqual('download_path', dep_info.download_path)
+    self.assertEqual('path_within_archive', dep_info.path_within_archive)
+    self.assertFalse(dep_info.local_paths)
+    self.assertFalse(dep_info.version_in_cs)
+
+    dep_info = dependency_info.DependencyInfo(
+        'dep', 'platform', 'config_file', cs_bucket='cs_bucket',
+        cs_hash='cs_hash', download_path='download_path',
+        cs_remote_path='cs_remote_path',
+        path_within_archive='path_within_archive', local_paths=['path'])
+    self.assertEqual('dep', dep_info.dependency)
+    self.assertEqual('platform', dep_info.platform)
+    self.assertEqual(['config_file'], dep_info.config_files)
+    self.assertEqual('cs_hash', dep_info.cs_hash)
+    self.assertEqual('cs_bucket', dep_info.cs_bucket)
+    self.assertEqual('cs_remote_path', dep_info.cs_remote_path)
+    self.assertEqual('download_path', dep_info.download_path)
+    self.assertEqual('path_within_archive', dep_info.path_within_archive)
+    self.assertEqual(['path'], dep_info.local_paths)
+    self.assertFalse(dep_info.version_in_cs)
+
+    dep_info = dependency_info.DependencyInfo(
+        'dep', 'platform', 'config_file', cs_bucket='cs_bucket',
+        cs_hash='cs_hash', download_path='download_path',
+        cs_remote_path='cs_remote_path', version_in_cs='version_in_cs',
+        path_within_archive='path_within_archive', local_paths=['path'])
+    self.assertEqual('dep', dep_info.dependency)
+    self.assertEqual('platform', dep_info.platform)
+    self.assertEqual(['config_file'], dep_info.config_files)
+    self.assertEqual('cs_hash', dep_info.cs_hash)
+    self.assertEqual('cs_bucket', dep_info.cs_bucket)
+    self.assertEqual('cs_remote_path', dep_info.cs_remote_path)
+    self.assertEqual('download_path', dep_info.download_path)
+    self.assertEqual('path_within_archive', dep_info.path_within_archive)
+    self.assertEqual(['path'], dep_info.local_paths)
+    self.assertEqual('version_in_cs', dep_info.version_in_cs)
+
   def testInitCloudStorageInfo(self):
     dep_info = dependency_info.DependencyInfo(
         'dep', 'platform', 'config_file', cs_bucket='cs_bucket',
@@ -182,7 +249,6 @@
     self.assertEqual('version_in_cs', dep_info.version_in_cs)
     self.assertEqual(['path0', 'path1'], dep_info.local_paths)
 
-
   def testUpdateRequiredArgsConflicts(self):
     dep_info1 = dependency_info.DependencyInfo(
         'dep1', 'platform1', 'config_file1', local_paths=['path0', 'path1'])
diff --git a/tools/telemetry/catapult_base/dependency_manager/dependency_manager.py b/tools/telemetry/catapult_base/dependency_manager/dependency_manager.py
index daec6bdc..e58263f5 100644
--- a/tools/telemetry/catapult_base/dependency_manager/dependency_manager.py
+++ b/tools/telemetry/catapult_base/dependency_manager/dependency_manager.py
@@ -4,7 +4,10 @@
 
 import logging
 import os
+import shutil
 import stat
+import tempfile
+import zipfile
 
 from catapult_base import cloud_storage
 from catapult_base import support_binaries
@@ -257,7 +260,75 @@
     cloud_storage.GetIfHashChanged(cs_path, download_path, cs_bucket, cs_hash)
     if not os.path.exists(download_path):
       raise exceptions.FileNotFoundError(download_path)
-    #TODO(aiolos): Add support for unzipping files.
+
+    # TODO(aiolos): Add tests once the refactor is completed. crbug.com/551158
+    unzip_location = dependency_info.unzip_location
+    if unzip_location:
+      download_path = DependencyManager._UnzipFile(
+          download_path, unzip_location, dependency_info.path_within_archive)
+
     os.chmod(download_path,
              stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | stat.S_IRGRP)
     return os.path.abspath(download_path)
+
+
+  @staticmethod
+  def _UnzipFile(archive_file, unzip_location, path_within_archive):
+    """Unzips a file if it is a zip file.
+
+    Args:
+        archive_file: The downloaded file to unzip.
+        unzip_location: The destination directory to unzip to.
+        path_within_archive: The relative location of the dependency
+            within the unzipped archive.
+
+    Returns:
+        The path to the unzipped dependency.
+
+    Raises:
+        ValueError: If |archive_file| is not a zipfile.
+        ArchiveError: If the dependency cannot be found in the unzipped
+            location.
+    """
+    # TODO(aiolos): Add tests once the refactor is completed. crbug.com/551158
+    if not zipfile.is_zipfile(archive_file):
+      raise ValueError(
+          'Attempting to unzip a non-archive file at %s' % archive_file)
+    tmp_location = None
+    if os.path.exists(unzip_location):
+      os_tmp_dir = '%stmp' % os.sep
+      tmp_location = tempfile.mkdtemp(dir=os_tmp_dir)
+      shutil.move(unzip_location, tmp_location)
+    try:
+      with zipfile.ZipFile(archive_file, 'r') as archive:
+        for content in archive.namelist():
+          # Ensure all contents in zip file are extracted into the
+          # unzip_location. zipfile.extractall() is a security risk, and should
+          # not be used without prior verification that the python verion
+          # being used is at least 2.7.4
+          dest = os.path.join(unzip_location,
+                              content[content.find(os.path.sep)+1:])
+          if not os.path.isdir(os.path.dirname(dest)):
+            os.makedirs(os.path.dirname(dest))
+          if not os.path.basename(dest):
+            continue
+          with archive.open(content) as unzipped_content:
+            logging.debug(
+                'Extracting %s to %s (%s)', content, dest, archive_file)
+            with file(dest, 'wb') as dest_file:
+              dest_file.write(unzipped_content.read())
+            permissions = archive.getinfo(content).external_attr >> 16
+            if permissions:
+              os.chmod(dest, permissions)
+      download_path = os.path.join(unzip_location, path_within_archive)
+      if not download_path:
+        raise exceptions.ArchiveError('Expected path %s was not extracted from '
+                                      'the downloaded archive.', download_path)
+    except:
+      if tmp_location:
+        shutil.move(tmp_location, unzip_location)
+      raise
+    if tmp_location:
+      shutil.rmtree(tmp_location)
+    return download_path
+
diff --git a/tools/telemetry/catapult_base/dependency_manager/exceptions.py b/tools/telemetry/catapult_base/dependency_manager/exceptions.py
index ecd5934..dd5b5962 100644
--- a/tools/telemetry/catapult_base/dependency_manager/exceptions.py
+++ b/tools/telemetry/catapult_base/dependency_manager/exceptions.py
@@ -41,4 +41,7 @@
     super(CloudStorageUploadConflictError, self).__init__(
         'File location %s already exists in bucket %s' % (path, bucket))
 
+class ArchiveError(Exception):
+  def __init__(self, msg):
+    super(ArchiveError, self).__init__(msg)
 
diff --git a/tools/telemetry/telemetry/internal/util/binary_manager_unittest.py b/tools/telemetry/telemetry/internal/util/binary_manager_unittest.py
index fafacd7..a808f9a 100644
--- a/tools/telemetry/telemetry/internal/util/binary_manager_unittest.py
+++ b/tools/telemetry/telemetry/internal/util/binary_manager_unittest.py
@@ -25,11 +25,12 @@
       'telemetry.internal.util.binary_manager.dependency_manager.BaseConfig')
   def testInitializationNoEnvironmentConfig(
       self, base_config_mock, dep_manager_mock):
-    base_config_mock.return_value = 'base_config_object'
+    base_config_mock.side_effect = ['base_config_object1',
+                                    'base_config_object2']
     binary_manager.InitDependencyManager(None)
     base_config_mock.assert_called_once_with(
         binary_manager.TELEMETRY_PROJECT_CONFIG)
-    dep_manager_mock.assert_called_once_with(['base_config_object'])
+    dep_manager_mock.assert_called_once_with(['base_config_object1'])
 
   @mock.patch(
       'telemetry.internal.util.binary_manager.dependency_manager.DependencyManager') # pylint: disable=line-too-long
diff --git a/ui/accessibility/BUILD.gn b/ui/accessibility/BUILD.gn
index 51372ff..95cd976 100644
--- a/ui/accessibility/BUILD.gn
+++ b/ui/accessibility/BUILD.gn
@@ -109,9 +109,6 @@
     sources = [
       "ax_enums.idl",
     ]
-    outputs = [
-      "org/chromium/ui/accessibility/AXTextStyle.java",
-    ]
   }
 }
 
diff --git a/ui/accessibility/ax_enums.idl b/ui/accessibility/ax_enums.idl
index d308abd..d160ef4 100644
--- a/ui/accessibility/ax_enums.idl
+++ b/ui/accessibility/ax_enums.idl
@@ -71,6 +71,7 @@
     article,
     banner,
     blockquote,
+    // TODO(nektar): Remove busy_indicator because it's used nowhere.
     busy_indicator,
     button,
     button_drop_down,
diff --git a/ui/android/BUILD.gn b/ui/android/BUILD.gn
index 5a13a695..1b5b547 100644
--- a/ui/android/BUILD.gn
+++ b/ui/android/BUILD.gn
@@ -70,16 +70,6 @@
     "resources/resource_manager.h",
     "resources/system_ui_resource_type.h",
   ]
-  outputs = [
-    "org/chromium/ui/WindowOpenDisposition.java",
-    "org/chromium/ui/base/PageTransition.java",
-    "org/chromium/ui/base/HoverType.java",
-    "org/chromium/ui/base/PointerType.java",
-    "org/chromium/ui/base/ime/TextInputType.java",
-    "org/chromium/ui/gfx/BitmapFormat.java",
-    "org/chromium/ui/resources/AndroidResourceType.java",
-    "org/chromium/ui/resources/SystemUIResourceType.java",
-  ]
 }
 
 java_strings_grd("ui_strings_grd") {
diff --git a/ui/aura/window.cc b/ui/aura/window.cc
index 79ef0ce..6ff6c762 100644
--- a/ui/aura/window.cc
+++ b/ui/aura/window.cc
@@ -758,7 +758,7 @@
   // Check if I should claim this event and not pass it to my children because
   // the location is inside my hit test override area.  For details, see
   // set_hit_test_bounds_override_inner().
-  if (for_event_handling && !hit_test_bounds_override_inner_.empty()) {
+  if (for_event_handling && !hit_test_bounds_override_inner_.IsEmpty()) {
     gfx::Rect inset_local_bounds(gfx::Point(), bounds().size());
     inset_local_bounds.Inset(hit_test_bounds_override_inner_);
     // We know we're inside the normal local bounds, so if we're outside the
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc
index 6bb5360..29ea93ca 100644
--- a/ui/compositor/compositor.cc
+++ b/ui/compositor/compositor.cc
@@ -166,6 +166,14 @@
   settings.use_compositor_animation_timelines =
       command_line->HasSwitch(switches::kUIEnableCompositorAnimationTimelines);
 
+#if !defined(OS_ANDROID)
+  // TODO(sohanjg): Revisit this memory usage in tile manager.
+  cc::ManagedMemoryPolicy policy(
+      512 * 1024 * 1024, gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE,
+      settings.memory_policy_.num_resources_limit);
+  settings.memory_policy_ = policy;
+#endif
+
   base::TimeTicks before_create = base::TimeTicks::Now();
 
   cc::LayerTreeHost::InitParams params;
diff --git a/ui/gfx/geometry/insets.h b/ui/gfx/geometry/insets.h
index 8d5344f75..0466d94 100644
--- a/ui/gfx/geometry/insets.h
+++ b/ui/gfx/geometry/insets.h
@@ -34,7 +34,7 @@
   int height() const { return top_ + bottom_; }
 
   // Returns true if the insets are empty.
-  bool empty() const { return width() == 0 && height() == 0; }
+  bool IsEmpty() const { return width() == 0 && height() == 0; }
 
   void Set(int top, int left, int bottom, int right) {
     top_ = top;
diff --git a/ui/gfx/geometry/insets_f.h b/ui/gfx/geometry/insets_f.h
index 4ef07c6..90592d77 100644
--- a/ui/gfx/geometry/insets_f.h
+++ b/ui/gfx/geometry/insets_f.h
@@ -32,7 +32,7 @@
   float height() const { return top_ + bottom_; }
 
   // Returns true if the insets are empty.
-  bool empty() const { return width() == 0.f && height() == 0.f; }
+  bool IsEmpty() const { return width() == 0.f && height() == 0.f; }
 
   void Set(float top, float left, float bottom, float right) {
     top_ = top;
diff --git a/ui/gfx/geometry/insets_unittest.cc b/ui/gfx/geometry/insets_unittest.cc
index b20a9d36..0d334591 100644
--- a/ui/gfx/geometry/insets_unittest.cc
+++ b/ui/gfx/geometry/insets_unittest.cc
@@ -14,7 +14,7 @@
   EXPECT_EQ(0, insets.right());
   EXPECT_EQ(0, insets.width());
   EXPECT_EQ(0, insets.height());
-  EXPECT_TRUE(insets.empty());
+  EXPECT_TRUE(insets.IsEmpty());
 }
 
 TEST(InsetsTest, Insets) {
@@ -25,7 +25,7 @@
   EXPECT_EQ(4, insets.right());
   EXPECT_EQ(6, insets.width());  // Left + right.
   EXPECT_EQ(4, insets.height());  // Top + bottom.
-  EXPECT_FALSE(insets.empty());
+  EXPECT_FALSE(insets.IsEmpty());
 }
 
 TEST(InsetsTest, Set) {
diff --git a/ui/touch_selection/BUILD.gn b/ui/touch_selection/BUILD.gn
index b8d8d40c..a16675df 100644
--- a/ui/touch_selection/BUILD.gn
+++ b/ui/touch_selection/BUILD.gn
@@ -105,16 +105,10 @@
     sources = [
       "selection_event_type.h",
     ]
-    outputs = [
-      "org/chromium/ui/touch_selection/SelectionEventType.java",
-    ]
   }
   java_cpp_enum("ui_touch_handle_orientation_srcjar") {
     sources = [
       "touch_handle_orientation.h",
     ]
-    outputs = [
-      "org/chromium/ui/touch_selection/TouchHandleOrientation.java",
-    ]
   }
 }
diff --git a/ui/views/controls/styled_label_unittest.cc b/ui/views/controls/styled_label_unittest.cc
index 6efcd66..7a2a7f58 100644
--- a/ui/views/controls/styled_label_unittest.cc
+++ b/ui/views/controls/styled_label_unittest.cc
@@ -155,7 +155,7 @@
   InitStyledLabel(text);
 
   // Without links, there should be no focus border.
-  EXPECT_TRUE(styled()->GetInsets().empty());
+  EXPECT_TRUE(styled()->GetInsets().IsEmpty());
 
   // Now let's add some links.
   styled()->AddStyleRange(gfx::Range(0, 1),
@@ -168,7 +168,7 @@
                           StyledLabel::RangeStyleInfo::CreateForLink());
 
   // Now there should be a focus border because there are non-empty Links.
-  EXPECT_FALSE(styled()->GetInsets().empty());
+  EXPECT_FALSE(styled()->GetInsets().IsEmpty());
 
   // Verify layout creates the right number of children.
   styled()->SetBounds(0, 0, 1000, 1000);
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc
index 7d4857d..035df76 100644
--- a/ui/views/win/hwnd_message_handler.cc
+++ b/ui/views/win/hwnd_message_handler.cc
@@ -1070,7 +1070,7 @@
 bool HWNDMessageHandler::GetClientAreaInsets(gfx::Insets* insets) const {
   if (delegate_->GetClientAreaInsets(insets))
     return true;
-  DCHECK(insets->empty());
+  DCHECK(insets->IsEmpty());
 
   // Returning false causes the default handling in OnNCCalcSize() to
   // be invoked.